text:
Q: Make Bluetooth connection alive for multiple activity In my application i want to send value from multiple activity to connected Thread,i don't know to solve this problem please help me
Example:
 I want to send String string ="#FFFFFF000*";from First-activity  to service class,
                String string=  "#000000000*" ;from Second- activity to service class
 public class BluetoothDataService1 extends Service {
        final int handlerState = 0;
        Handler bluetoothIn;
        private BluetoothAdapter btAdapter = null;

        private ConnectingThread mConnectingThread;
        private ConnectedThread mConnectedThread;

        private boolean stopThread;

        private static final UUID BTMODULEUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

       // private static String MAC_ADDRESS="98:D3:31:30:A5:00" ;
        private static String MAC_ADDRESS="98:D3:32:20:42:54" ;

        private StringBuilder recDataString = new StringBuilder();
        private final IBinder binder = new LocalBinder();

        @Override
        public void onCreate() {
            super.onCreate();

            stopThread = false;

        }

        @Override
        public int onStartCommand(Intent intent, int flags, int startId) {
            super.onStartCommand(intent, flags, startId);
            bluetoothIn = new Handler()
            {
                public void handleMessage(android.os.Message msg) {

                    if (msg.what == handlerState) {
                        String readMessage = (String) msg.obj;
                        recDataString.append(readMessage);

                    }
                    recDataString.delete(0, recDataString.length());
                }

            };

            btAdapter = BluetoothAdapter.getDefaultAdapter();
            checkBTState();
            return START_STICKY;
            //return super.onStartCommand(intent, flags, startId);
        }

        @Override
        public void onDestroy() {
            super.onDestroy();
            bluetoothIn.removeCallbacksAndMessages(null);
            stopThread = true;
            if (mConnectedThread != null ) {
                mConnectedThread.closeStreams();
            }
            if (mConnectingThread != null) {
                mConnectingThread.closeSocket();
            }

        }

        @Override
        public IBinder onBind(Intent intent)

        {
            return binder;
        }

        //Checks  Bluetooth is available and turned on /off
        private void checkBTState() {
            if (btAdapter == null) {

                stopSelf();
            } else {
                if (btAdapter.isEnabled()) {

                    try {
                        BluetoothDevice device = btAdapter.getRemoteDevice(MAC_ADDRESS);
                        mConnectingThread = new ConnectingThread(device);
                        mConnectingThread.start();
                    }   catch (IllegalArgumentException e) {

                        stopSelf();
                    }
                }   else {

                    stopSelf();
                }
            }
        }

    //    public void senddata() {
    //
    //    }

        // New Class for Connecting Thread
           public class ConnectingThread extends Thread {
            private final BluetoothSocket mmSocket;
            private final BluetoothDevice mmDevice;
            public ConnectingThread(BluetoothDevice device) {

                mmDevice = device;
                BluetoothSocket temp = null;

                try {

                    temp = mmDevice.createRfcommSocketToServiceRecord(BTMODULEUUID);

                }   catch (IOException e) {

                    stopSelf();
                }
                mmSocket = temp;
            }

            @Override
            public void run() {
                super.run();
                btAdapter.cancelDiscovery();
                try {
                    mmSocket.connect();
                    mConnectedThread = new ConnectedThread(mmSocket);
                    mConnectedThread.start();
                    mConnectedThread.write("x");
                } catch (IOException e) {
                    try {

                        mmSocket.close();
                        stopSelf();
                    } catch (IOException e2) {

                        stopSelf();

                    }
                } catch (IllegalStateException e) {

                    stopSelf();
                }
            }
            public void closeSocket() {
                try {

                    mmSocket.close();
                } catch (IOException e2) {

                    stopSelf();
                }
            }
        }

        // New Class for Connected Thread
        class ConnectedThread extends Thread {
            private final InputStream mmInStream;
            private final OutputStream mmOutStream;

            //creation of the connect thread
            public ConnectedThread(BluetoothSocket socket) {

                InputStream tmpIn = null;
                OutputStream tmpOut = null;

                try {
                    //Create I/O streams for connection
                    tmpIn = socket.getInputStream();
                    tmpOut = socket.getOutputStream();
                }   catch (IOException e) {

                    stopSelf();
                }

                mmInStream = tmpIn;
                mmOutStream = tmpOut;
            }

            public void run() {

                byte[] buffer = new byte[256];
                int bytes;

                // Keep looping to listen for received messages
                while (true && !stopThread) {
                    try {
                        bytes = mmInStream.read(buffer);
                        String readMessage = new String(buffer, 0, bytes);
                        //Send the obtained bytes to the UI Activity via handler
                        bluetoothIn.obtainMessage(handlerState, bytes, -1, readMessage).sendToTarget();
                    }   catch (IOException e) {

                        stopSelf();
                        break;
                    }
                }
            }

            //write method
            public void write(String input) {
                byte[] msgBuffer = input.getBytes();
                try {
                    mmOutStream.write(msgBuffer);
                }   catch (IOException e) {
                    stopSelf();
                }
            }

            public void closeStreams() {
                try {
                    mmInStream.close();
                    mmOutStream.close();
                }   catch (IOException e2) {
                    stopSelf();
                }
            }
        }

    //    private class LocalBinder implements IBinder {
    //    }
    public class LocalBinder extends Binder {
              BluetoothDataService1 getService() {
                 return BluetoothDataService1.this;
        }
    }

This is my Activity
public class SendActivity extends Activity implements View.OnClickListener {
    Button on;
    BluetoothDataService1 bluetoothDataService1;
    public boolean isBound = false;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send);
        on= (Button) findViewById(R.id.btnon);
        on.setOnClickListener(this);
    }

    @Override
    public  void onStart() {
        super.onStart();
          Intent intent = new Intent(this, BluetoothDataService1.class);
          bindService(intent, connection, Context.BIND_AUTO_CREATE);
    }

    @Override
    public void onClick(View v) {
        if (isBound) {

//                  Intent intent=new Intent (SendActivity.this,BluetoothDataService1.class);
//                  intent.putExtra("ON","#ffffff00" );
//                  startService(intent);
        }
    }
    private ServiceConnection connection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName className, IBinder service) {
            BluetoothDataService1.LocalBinder binder = (BluetoothDataService1.LocalBinder) service;
            bluetoothDataService1 = binder.getService();
            isBound = true;

        }
        @Override
             public void onServiceDisconnected(ComponentName arg0) {
             isBound = false;
        }
    };
    @Override
      public void onStop() {
        super.onStop();
          if (isBound) {
              unbindService(connection);
              isBound = false;
        }
    }

A: *

*whatever i have understand from your question i am giving solution
to you
 2.you must need to make variable static so that u can directly access that variable from other activity
 3.like you have 3 activity A B C
 4.now you want fetch variable from A and B into C

*then you can make variable static in A and B check below.

*in A public static String string="#FFFFFF000" same as in B

*and you can acess it into C

*String string =A.string;

*or you can create static method into A activity and B activity and call that method from C activity.
publi

*like `public static void send(){
            static veriableName="FFFFFF000"
             // sending code here whatever
           }`

*and by calling this method from C you can do
 A.send();


text:
Q: Given a power series with interval of convergence $(-1,1]$, construct a series with another given interval of convergence Suppose that you have a power series
$$\sum_{n=1}^\infty (a_nx^n)$$
 whose interval of convergence is $(-1,1]$.
A) Using the same numbers $(a_n)$, come up with a new power series whose interval of convergence is $(0,2]$
B) Using the same numbers $(a_n)$, come up with a new power series whose interval of convergence is $(-2,2]$.
C) Using the same numbers $(a_n)$, come up with a new power series whose interval of convergence is $[-1,1)$. Hint: what transformation would turn the interval $(-1,1]$ into $[-1,1)$?
D) Putting together ideas from the previous parts of this question, come up with a new power series whose interval of convergence is $[10,20)$
For part A I got
$$\sum_{n=1}^\infty a_n(x-1)^n. $$
For part B I got
$$\sum_{n=1}^\infty a_n(2x)^n.$$
Part C and D I have no idea. I'm really confused. Can someone explain?

A: Part b is not quite right. If you have a power series with convergence in $x$ on $(-1,1]$ then you should expand the region by shrinking the variable. In other words if $x=\frac{1}{2}y$ then the interval $(-1,1]$ in terms of $x$ corresponds to the interval $(-2,2]$ in terms of $y$. (To confirm, just consider the end points $x=-1$ and $x=1$).
For c, we know that the power series converges on $(-1,1]$. If we let $x=-y$ then at $x=1$ we have $y=-1$ and the range of $y$ is $[-1,1)$, so
$$\sum_{n=1}^{\infty} a_n x^n = \sum_{n=1}^{\infty} a_n (-y)^n$$
has a interval of convergence of $[-1,1)$ in terms of $y$.
In order to answer d you have to consider the steps taken in a, b, and c. We first 'expand' the interval from $(-1,1]$ in terms of $x$ to $(-15,15]$ in terms of $y$:
$$\sum_{n=1}^{\infty} a_n x^n = \sum_{n=1}^{\infty} a_n \left(\frac{y}{15}\right)^n$$
which may then be 'reflected around the center of the interval' to have an interval of convergence of $[-15,15)$ in terms of $z$:
$$\sum_{n=1}^{\infty} a_n \left(\frac{y}{15}\right)^n
= \sum_{n=1}^{\infty} a_n \left(\frac{(-z)}{15}\right)^n$$
which we then 'shift' to $[-10,20)$ in terms of $w$:
$$\sum_{n=1}^{\infty} a_n \left(-\frac{z}{15}\right)^n = \sum_{n=1}^{\infty} a_n \left(-\frac{(w-5)}{15}\right)^n$$
or more simply
$$\sum_{n=1}^{\infty} a_n \left(\frac{5-w}{15}\right)^n< \infty \quad\text{for $w\in[-10,20)$}$$
Note, for a sanity check we may check the end points. $w=-10$ corresponds to $x=\frac{5-(-10)}{15} = 1$, where the series converges in terms of $x$. Also $w=20$ corresponds to $x=\frac{5-(20)}{15}=-1$ where we know that the series diverges.

A: For part (c), consider the series:
$$\sum_{n=1}^\infty (a_nx^n(-1)^n)$$
Since when $x =1$, our series becomes: $\sum a_n$, therefore, the series $a_n$ converges.
Therefore, if we want $a_n$ to converge when $x= -1$, by adding $(-1)^n$, when $x =-1$, the series then becomes $\sum (a_n)(-1)^n$. Therefore, if it is multiplied by $(-1)^n$ it will cancel out with the other one and leave our answer to be: $\sum a_n$
You can use this idea to help you answer part (d). of this question, as they are similar in concept.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Algorithm Running Time for O(n.m^2) I would like to know, because I couldn't find any information online, how is an algorithm like O(n * m^2) or O(n * k) or O(n + k) supposed to be analysed?
Does only the n count?
The other terms are superfluous?
So O(n * m^2) is actually O(n)?

A: No, here the k and m terms are not superfluous,they do have a valid existence and essential for computing time complexity. They are wrapped together to provide a concrete-complexity to the code.
It may seem like the terms n and k are independent to each other in the code,but,they both combinedly determines the complexity of the algorithm.
Say, if you've to iterate a loop of size n-elements, and, in between, you have another loop of k-iterations, then the overall complexity turns O(nk).
Complexity of order O(nk), you can't dump/discard k here.
for(i=0;i<n;i++)
for(j=0;j<k;j++)
// do something

Complexity of order O(n+k), you can't dump/discard k here.
for(i=0;i<n;i++)
// do something
for(j=0;j<k;j++)
// do something

Complexity of order O(nm^2), you can't dump/discard m here.
for(i=0;i<n;i++)
for(j=0;j<m;j++)
for(k=0;k<m;k++)
// do something

Answer to the last question---So O(n.m^2) is actually O(n)?

No,O(nm^2) complexity can't be reduced further to O(n) as that would mean m doesn't have any significance,which is not the case actually.

A: FORMALLY:  O(f(n)) is the SET of ALL functions T(n) that satisfy:
There exist positive constants c and N such that, for all n >= N,
                          T(n) <= c f(n)

Here are some examples of when and why factors other than n matter.
[1]  1,000,000 n  is in  O(n). Proof:  set c = 1,000,000, N = 0.
Big-Oh notation doesn't care about (most) constant factors. We generally leave constants out; it's unnecessary to write O(2n), because O(2n) = O(n).  (The 2 is not wrong; just unnecessary.)
[2]  n  is in  O(n^3).  [That's n cubed]. Proof:  set c = 1, N = 1.
  Big-Oh notation can be misleading.  Just because an algorithm's running time is in O(n^3) doesn't mean it's slow; it might also be in O(n).  Big-Oh notation only gives us an UPPER BOUND on a function.
[3]  n^3 + n^2 + n  is in  O(n^3). Proof:  set c = 3, N = 1.
   Big-Oh notation is usually used only to indicate the dominating (largest
     and most displeasing) term in the function.  The other terms become
     insignificant when n is really big.
These aren't generalizable, and each case may be different. That's the answer to the questions: "Does only the n count? The other terms are superfluous?"

A: Although there is already an accepted answer, I'd still like to provide the following inputs :
O(n * m^2) : Can be viewed as n*m*m and assuming that the bounds for n and m are similar then the complexity would be O(n^3).

Similarly -
O(n * k) : Would be O(n^2) (with the bounds for n and k being similar)

and -
O(n + k) : Would be O(n) (again, with the bounds for n and k being similar).

PS: It would be better not to assume the similarity between the variables and to first understand how the variables relate to each other (Eg: m=n/2; k=2n) before attempting to conclude.


text:
Q: Windows Kernel Mode aka SYSTEM privilege? Can I say that a process (say, cmd.exe) running under SYSTEM privilege is running in Kernel mode?
I mean, are those concepts (a process running under SYSTEM privilege and a process running in kernel mode) equivalent?

A: I don't believe SYSTEM privilege is a recognized term. You can ask for elevation from the system, which - if granted - allows you to do certain things in the file system and elsewhere that you would otherwise be prevented from doing, but that's a user account/access rights concept. There's a System account that Windows services often run under, which has privileges that usually differ from those of ordinary logged on users.
Kernel mode is the CPU protection mode that the O/S kernel and most device drivers execute in. In kernel mode, there is little or no protection against memory overwrites, and so on, so it isn't practical to have individual applications run in that mode, but because there are fewer checks kernel mode is faster than user mode. All applications, including cmd.exe, execute in user mode.

A: No.  The system process is a special case, but all other processes are run in user mode, even if they are running in SYSTEM context.
Each user-mode process has its own address space.  The kernel has a separate address space, accessible only to kernel-mode code.  Most threads in a user-mode process run in both user mode (when running code from the process) and kernel mode (when running code from the kernel).
A thread may enter kernel mode as the result of a call to a Windows API function, or because of an external event: when a device driver needs to process an interrupt or DPC, the code runs in the context of whichever thread happens to be active at the time.  This avoids the overhead of a context switch, but means that such code has to be able to run in an arbitrary context.
(Kernel-mode code can bypass the security model, but has to be careful not to leak this access out to the user-mode process that it is running in.  For example, if kernel-mode code running in the context of an arbitrary thread opens a handle, it has to mark it as a kernel-only handle; otherwise, the user mode process could gain access to it.)
The System process is a special case; its threads run only in kernel mode.  This allows device drivers and the kernel to do background processing that is not directly in response to an external event.  It is also possible for a device driver to create a kernel-mode thread in a user-mode process.
Although they are still running in user-mode, processes running as SYSTEM are given privileges that are not (in the default configuration) given to processes running in an administrative context.  For example, they have SeTcbPrivilege ("act as part of the operating system") which allows them to do things like using SetTokenInformation to change the Remote Desktop session associated with a security token.


text:
Q: @Cachable annotated method is not caching a new data after doing @CacheEvict Developed an API to retrieve data from a table and put it into cache in spring boot from Eclipse. Integrated with an SAP cloud platform.
DB- SAP cloud HANA DB.
Step-1: Call an API from the postman.
Step-2: Method invoked. The method annotated with @Cacheable("dictionary")
** ** -->At this time the values from DB 4000+ records get cached
--> within 5 mins if postman executes, values are returning faster based on execution time as expected.

Step-3: Every 5 mins, @CacheEvict is scheduled.
** Before Eviction starts, updating a DB column "comments" in DB **
Step-4: Scheduled Eviction method executed.
@Service
public class CacheEvit {

    @Autowired
    private CacheManager cacheManager;

    @Scheduled(cron = "0 0/5 * * * ?") // execure after every 5 min
    public void clearCacheSchedule() {
        System.err.println("inside clear scheduled--" + cacheManager.getCacheNames());
        Cache c = cacheManager.getCache("dictionary");
        for (String name : cacheManager.getCacheNames()) {
            System.err.println("inside clear scheduled before clear in for loop" + cacheManager.getCacheNames());
            cacheManager.getCache("dictionary").clear(); // clear cache by name
        }

        if (c != null) {
            System.err.println("cleared succ -- " + cacheManager.getCacheNames());
        } else {
            System.err.println("cache is not null");
        }
    }

}

 @Cacheable("dictionary")
  public List<DictionaryEntity> getDictionaryData() {
      System.err.println("inside getDictionaryData");
    return dictionaryServiceImpl.getDictionary();
  }

@EnableScheduling
@EnableCaching --> declared in Starter class.
@Bean
  public CacheManager cacheManager() {
      SimpleCacheManager cacheManager = new SimpleCacheManager();
      cacheManager.setCaches(Arrays.asList(
        new ConcurrentMapCache("dictionary")));
      return cacheManager;
  }

These both are in different java classes and different services.
Problem: As cache got cleared, The method with @Cachable is executed ( observed by printing log ) but the value of cache is not loaded newly as we edited comments, still its returning old values

A: For me the issue was that the cacheable method was in the same class, which you mentioned are not in your case. However, cacheable will not get called if the classes are part of the same bean. I separated them and it works fine for me. Hope it helps.


text:
Q: Unable to log into Windows 7 PC - "The RPC server is unavailable" I am trying to log into my Windows 7 computer and after entering in my username and password (which I have confirmed is correct), I am seeing the error message "The RPC server is unavailable".
I have tried booting up in Safe mode but it doesn't help.
I think this is caused by some sort of registry corruption, but I'm not sure how to fix it if I cannot log in.
Does anyone have any ideas?

A: Step 1: To start the RPC service, try these steps.
a. Start the computer using Windows DVD to boot to Windows Recovery Environment (WinRE) and select command prompt.
b. Type net start RpcSs and hit enter.
c. Type exit to close the command prompt.
d. Restart the computer and check the result.
Step 2: Check the registry entry for the service
a. Start the computer using Windows DVD to boot to Windows Recovery Environment (WinRE) and select command prompt.
b. On the command prompt, type regedit.exe and hit enter.
c. Look for the following entries:
d. Entry for Remote Procedure Call (RPC): Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\RpcSs
e. Entry for Remote Procedure Call (RPC) Locator:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\RpcLocator
Important:
Set REG_DWORD value to 2 for automatic start on RpcSs
Set REG_DWORD value to 3 for manual start on RPCLocator
Very important: Modifying the registry incorrectly will cause serious damage to the computer. Backup the registry before you make any changes.
Reference: http://social.answers.microsoft.com/Forums/en-US/w7repair/thread/734dc03b-a795-4f08-aa32-84cf12b5e6be


text:
Q: Filling in a single colour background in OpenCV I'm writing a program in OpenCV which takes a picture of parasite eggs and attempts to identify at least a large portion of them. My problem is that the input image I have the best results with has a large background. I've tried both filling in the background, and cropping it out, but when I do I get a worse selection of the eggs.
My currently thought out solution is to use the image with the background and then fill it in. It felt like it would be easy because I just want to fill anything outside of that circle with black, but I'm not sure how to actually perform the action. If anyone could point be toward a method to use, or any suggestions that would be great.
Here is a link to what the image looks like:

Thanks!

A: Worked out a fix for my problem, I created a mouse event callback which fills in whatever I click with black. Below is the code I used in the callback:
def paint(event, x, y, flags, param):
    global opening

    if event == cv2.EVENT_LBUTTONDOWN:
        h, w = opening.shape[:2]
        mask = np.zeros((h+2, w+2), np.uint8)
        cv2.floodFill(opening, mask, (x,y), (0, 0, 0))
        cv2.imshow("open", opening)

A: It seems that you need the exterior of the image to be filled with black because it makes it easier to identify the eggs since they will be isolated in white.
But what if the parasite eggs magically appeared as blue? I'll explain this in a second, but this approach would free you from the burden of clicking on the image every time a new sample needs to be analyzed.
I wrote the answer in C++, but you if follow what the code does I'm sure you can quickly translate it to Python.
#include <iostream>
#include <vector>

#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>

int main(int argc, char* argv[])
{
    // Load input image (3-channel)
    cv::Mat input = cv::imread(argv[1]);
    if (input.empty())
    {
        std::cout << "!!! failed imread()" << std::endl;
        return -1;
    }

    // Convert the input to grayscale (1-channel)
    cv::Mat grayscale = input.clone();
    cv::cvtColor(input, grayscale, cv::COLOR_BGR2GRAY);

What grayscale looks like at this point:

    // Locate the black circular shape in the grayscale image
    std::vector<std::vector<cv::Point> > contours;
    cv::findContours(grayscale, contours, cv::RETR_LIST, cv::CHAIN_APPROX_SIMPLE);

    // Fill the interior of the largest circular shape found with BLUE
    cv::Mat circular_shape = input.clone();
    for (size_t i = 0; i < contours.size(); i++)
    {
        std::vector<cv::Point> cnt = contours[i];
        double area = cv::contourArea(cv::Mat(cnt));

        if (area > 500000 && area < 1000000) // magic numbers to detect the right circular shape
        {
            std::cout << "* Area: " << area << std::endl;
            cv::drawContours(circular_shape, contours, i, cv::Scalar(255, 0, 0),
                             cv::FILLED, 8, std::vector<cv::Vec4i>(), 0, cv::Point() );
        }
    }

What circular_shape looks like at this point:

    // Create the output image with the same attributes of the original, i.e. dimensions & 3-channel, so we have a colored result at the end
    cv::Mat output = cv::Mat::zeros(input.size(), input.type());

    // copyTo() uses circular_shape as a mask and copies that exact portion of the input to the output
    input.copyTo(output, circular_shape);

    cv::namedWindow("Eggs", cv::WINDOW_NORMAL | cv::WINDOW_KEEPRATIO);
    cv::imshow("Eggs", output);
    cv::resizeWindow("Eggs", 800, 600);
    cv::waitKey(0);

    return 0;
}

The output displayed on the window is:

The advantage of this solution is that the user doesn't need to interact with the application to facilitate the detection of the eggs, since they are already painted in blue.
After this, other operations can be done on the output image such as cv::inRange() to isolate colored objects from the rest of the image.
So, for completion's sake I'll add a few more lines of text/code to demonstrate what you could do from this point forward to completely isolate the eggs from the rest of the image:
// Isolate blue pixels on the output image
cv::Mat blue_pixels_only;
cv::inRange(output, cv::Scalar(255, 0, 0), cv::Scalar(255, 0, 0), blue_pixels_only);

What blue_pixels_only looks like at this stage:

// Get rid of pixels on the edges of the shape
int erosion_type = cv::MORPH_RECT; // MORPH_RECT, MORPH_CROSS, MORPH_ELLIPSE
int erosion_size = 3;
cv::Mat element = cv::getStructuringElement(erosion_type,
                                            cv::Size(2 * erosion_size + 1, 2 * erosion_size + 1),
                                            cv::Point(erosion_size, erosion_size));
cv::erode(blue_pixels_only, blue_pixels_only, element);
cv::dilate(blue_pixels_only, blue_pixels_only, element);

cv::imshow("Eggs", blue_pixels_only);
cv::imwrite("blue_pixels_only.png", blue_pixels_only);

What blue_pixels_only looks like at this stage:


text:
Q: Sleep is disabled on my Windows 7, how do I enable it? When I go to Start->Shutdown Menu the Sleep option is disabled.  What's going on here?  I read online it could be the graphics driver but that's insalled already.
What is causing this?

A: You should check Device Manager and ensure that the graphics card driver is not just a general driver like "standard VGA" and is specific to the Graphics card you have.  I had this exact issue 20 minutes ago which I solved by installing the proper Driver (in my case an obsolete AMD Radeon 6600). Once i installed the Driver I was able to go into my power options and Sleep was present as an option for closing the lid and pressing the power button etc.
Last place I would have thought to look for something to disable Sleep Mode.
I have also seen the multimedia properties under advanced settings (again in the power options) blocking sleep for streaming but both of my options were defaulted to no.
Hope that helps.
Good Luck!

A: Is it possible that your computer does not support sleep, or that it is turned off in the BIOS?
This article suggests these two options may be the cause.


text:
Q: how to find specific html element pattern A sample of my code:

    <classified_title check_zone="true" article="start" a_type="advertisement" cid="#P98_001"></classified_title>

    <dc_title article="start" check_zone="true" a_type="article" cid="#P95_001"></dc_title>
    <pam_credit rot_ang="90_3021_1470_681_71" check_zone="true" article_con="95.1" cid="#P95_010">ILLUSTRATION BY HECTOR CADEMARTORI</pam_credit>

I want to distinguish sets of three, like the following code:

The first tag (

) has an attribute article_con and second tag (

) has attribute article="start" and again third tag is like first tag, as the  article_con attribute has same value.
Not like that:

The first and third tag's article_con attribute value different, important thing is there must be article="start" attribute in second tag.

A: This is what I would do:

If you wrap each set of 3 in a div and set its id attribute to the article_con number, then you can easily access the div and thus its children by that id using:

From there you can access the first, second, or third paragraph from that array.

A: I agree with @Bluehound that you should reformat your HTML, but in case you can't do this here is my plain JS suggestion:
var findArticle = function() {
    var start = document.querySelectorAll('[article="start"]')
    var l = start.length
    for (var i = 0; i < l; i++) {
        var node = start[i]
        var prev = node.previousElementSibling
        if (!prev || !prev.hasAttribute('article_con')) continue
        var con = prev.getAttribute('article_con')
        var next = node.nextElementSibling
        if (!next || !next.hasAttribute('article_con') ||
            next.getAttribute('article_con') != con) continue
        return node
    }
    return null
}

var article = findArticle()
console.log(article)

example code here


text:
Q: How to move specific list items between site collections I have a project to break up our large, single site collection/database into multiple separate site collections, with each collection having its own database. I know how to do that natively, but the obstacle is that I'm required to break up existing content and move it to the new locations. For example, I might need to copy/migrate 3072 list items out of 78000.
The only way I know of to do this is duplicate the site via backup and then delete un-needed items. However, space is a concern, so it's not practical to copy the entire site in such a way. I can manually recreate the site, but manually copying hundreds (if not thousands) of list items is not really practical, either. As well, there are linked lookup values that would probably break if the IDs change from source to destination.
Is there a way - either via SharePoint UI, Powershell, or 3rd-party application - to migrate specific list items between different site collections, while keeping all metadata intact?
ADDITIONAL INFO: This is a SharePoint 2013 Enterprise farm. All site collections will be under the same web application. All content databases will be under the same SQL instance, using MS SQL 2012. I'm willing to look into 3rd-party apps like DocAve, but would love to hear from someone who has actually done this sort of project successfully.
I have direct access to the servers and can muddle through writing powershell scripts or even C# code if needed, although I'm by no means a professional developer.

A: You can use this script, which copy items with their metadata:
#Configuration variables
$WebURL = "http://intranet.crescent.com"
$SourceListName = "News"
$TargetListName= "NewsArchive"

#Get Objects
$web = Get-SPWeb $WebURL
$SourceList = $web.Lists[$SourceListName]
$TargetList = $web.Lists[$TargetListName]

#Get all source items
$SourceColumns = $sourceList.Fields
$SourceItems = $SourceList.GetItems();

#Iterate through each item and add to target list
Foreach($SourceItem in $SourceItems)
{
    $TargetItem = $TargetList.AddItem()
    Foreach($column in $SourceColumns)
    {
        if($column.ReadOnlyField -eq $False -and $column.InternalName -ne "Attachments")
        {
             $TargetItem[$($column.InternalName)] = $sourceItem[$($column.InternalName)];
        }
    }
   $TargetItem.Update();
}

You can use migration tools for this like Metalogix, ShareGate.


text:
Q: Алгоритм Тарьяна поиска LCA Пытаюсь разобрать алгоритм с описанием по ссылке.
Никак не могу понять, откуда следует корректность этого утверждения: «Заметим, что при фиксированном v каждый из предков вершины v порождает некоторый класс вершин u, для которых он является ответом, в этом классе содержатся все вершины, которые находятся "слева" от этого предка.».
Ведь для любой вершины X, например, если взять её самого левого и самого правого потомков, то для них вершина X будет считаться наименьшим общим предком? Но это явно не то, что хотят сказать в алгоритме.
Что имеется в виду?


text:
Q: Showing a single TextView after clicks of 6 buttons in android Hello everyone I am working on a random number generator app where I have implemented six buttons with a switch case that generates random numbers in android. Now trying to implement a logic where I want to show a retry button or text view after the user clicks all those six buttons. and also want to go to the first state after the user clicks the retry button. Here is my code:
@Override
public void onClick(View v)
{
    switch (v.getId())
    {
        case R.id.img_1:
            f2413X = false;
            Random random = new Random();
            int val = random.nextInt(100); // save random number in an integer variable
            textView3.setText(Integer.toString(val)); //convert to String and set it as text inside the textview
            box1.setVisibility(View.INVISIBLE);
            linearLayout1.setVisibility(View.VISIBLE);
            final Handler handler = new Handler(Looper.getMainLooper());
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        case R.id.img_2:
            f2414Y = false;
            Random random2 = new Random();
            int val2 = random2.nextInt(100); // save random number in an integer variable
            textView4.setText(Integer.toString(val2)); //convert to String and set it as text inside the textview
            box2.setVisibility(View.INVISIBLE);
            linearLayout2.setVisibility(View.VISIBLE);
            final Handler handler2 = new Handler(Looper.getMainLooper());
            handler2.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val2 + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val2))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        case R.id.img_3:
            f2415Z = false;
            Random random3 = new Random();
            int val3 = random3.nextInt(100); // save random number in an integer variable
            textView5.setText(Integer.toString(val3)); //convert to String and set it as text inside the textview
            box3.setVisibility(View.INVISIBLE);
            linearLayout3.setVisibility(View.VISIBLE);
            final Handler handler3 = new Handler(Looper.getMainLooper());
            handler3.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val3 + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val3))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        case R.id.img_4:
            f2416a0 = false;
            Random random4 = new Random();
            int val4 = random4.nextInt(100); // save random number in an integer variable
            textView7.setText(Integer.toString(val4)); //convert to String and set it as text inside the textview
            box4.setVisibility(View.INVISIBLE);
            linearLayout4.setVisibility(View.VISIBLE);
            final Handler handler4 = new Handler(Looper.getMainLooper());
            handler4.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val4 + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val4))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        case R.id.img_5:
            f2417b0 = false;
            Random random5 = new Random();
            int val5 = random5.nextInt(100); // save random number in an integer variable
            textView8.setText(Integer.toString(val5)); //convert to String and set it as text inside the textview
            box5.setVisibility(View.INVISIBLE);
            linearLayout5.setVisibility(View.VISIBLE);
            final Handler handler5 = new Handler(Looper.getMainLooper());
            handler5.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val5 + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val5))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        case R.id.img_6:
            f2418c0 = false;
            GameScreen gameScreen2 = GameScreen.this;
            GameScreen.coinCollected(gameScreen2, gameScreen2.f2410U);
            Random random6 = new Random();
            int val6 = random6.nextInt(100); // save random number in an integer variable
            textView9.setText(Integer.toString(val6)); //convert to String and set it as text inside the textview
            box6.setVisibility(View.INVISIBLE);
            linearLayout6.setVisibility(View.VISIBLE);
            final Handler handler6 = new Handler(Looper.getMainLooper());
            handler6.postDelayed(new Runnable() {
                @Override
                public void run() {

                    builder = new AlertDialog.Builder(GameScreen.this);
                    builder.setTitle("Congratulations")
                            .setMessage("You won " + val6 + " coins")
                            .setCancelable(false)
                            .setPositiveButton("COLLECT", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialogInterface, int i) {
                                    int coins = Integer.parseInt(String.valueOf(Integer.parseInt(Integer.toString(val6))));

                                    prefs.setCoins(coins);
                                    displayCoins();
                                }
                            });
                    builder.show();
                }
            }, 200);
            break;
        default:

            break;
    }
}

and my Layout for this
[![I want to show retry button or text view in the below circle][1]][1]

A: Create an ArrayList to maintain button states, then check in ArrayList whether all buttons are clicked and then display retry in TextView.


text:
Q: Python 3 sorting: Custom comparer removed in favor of key - why? In Python 2.4, you can pass a custom comparer to sort.
Let's take the list -
list=[5,1,2,3,6,0,7,1,4]

To sort with the even numbers first, and then odds, we can do the following -
evenfirst=lambda x,y:1 if x%2>y%2 else -1 if y%2>x%2 else x-y
list.sort(cmp=evenfirst)
list == [0, 2, 4, 6, 1, 1, 3, 5, 7] # True

In Python 3, you can only pass key (which is also supported in Python 2.4).
Of course, the same sorting can be achieved in Python 3 with the right key:
list.sort(key=lambda x:[x%2,x])

I am curious about the decision of not supporting custom comparers anymore, especially when it seems something that could be implemented easily enough.
Is it true that in all, or most of the cases, a desired sort order has a natural key?
In the example above for example, such a key exists - and actually the code becomes more succinct using it. Is it always the case?
(I am aware of this recipe for converting comparer to key, but ideally, one should not have to take such workarounds if it could be built into the language.)

A: Performance.
The cmp function was called every time the sorting algorithm needed a comparison between two elements.
In contrast, the key object can be cached. That is, the sorting algorithm only needs to get the key once for each element and then compare the keys. It doesn't need to get a new key for every comparison.

A: Sorting by keys is well-defined, meaning the result doesn't depend on which (stable) sorting algorithm you use. There's no pathological key function. You might suggest random.random(), but that simply shuffles the list.
Whereas sorting with a compare function is well-defined only if the function is transitive and antisymmetric, which Python can neither test nor prove. What happens if you sort by nonsense compare function lambda(x, y): 1? You can't say, the result depends on the algorithm. Some algorithms might not even terminate.


text:
Q: Bolding part of paragraph with vba in ms word I am having trouble bolding part of a paragraph in MS WORD.
I am building a document paragraph by paragraph. In only one of those I want to bold only one number. The number may occur more than once in the document but should be bolded only once, in this specific paragraph.
Example:
My first paragraph.
My second paragraph.
My number is 123.
I access paragraphs with the following code:
Dim paragraphN As Integer
paragraphN = 3
ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Range

I don`t know how to specify only a part of this specific paragraph.
I tried:
ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Range(Start:=14, End:=17).Font.Bold = True

ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Range.Characters(Start:=14, End:=17).Font.Bold = True

ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Characters(Start:=14, End:=17).Range.Font.Bold = True

ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Characters.Range(Start:=14, End:=17).Font.Bold = True

ActiveDocument.Sections(1).Range.Paragraphs(paragraphN).Range(14,17).Font.Bold = True

All failed. The problem seems pretty straightforward but I am out of ideas...

A: I was able to get it to work using a slightly different method:
   ActiveDocument.Range(ActiveDocument.Paragraphs(1).Range.Characters(5).Start, _
   ActiveDocument.Paragraphs(1).Range.Characters(10).End).Font.Bold = True

You can adjust the paragraph numbers and character numbers with your variables.

A: The accepted answer didn't work for me because I couldn't do a Range(x, y) without an error.  This worked for me however...  doc.Paragraphs(paragraphIndex).Range.Sentences(1).Font.Bold = True


text:
Q: com.itextpdf.kernel.PdfException: Document has no pages Im facing some problems with PDF Documents:
com.itextpdf.kernel.PdfException: Document has no pages.
INFO   | jvm 2    | main    | 2019/07/12 15:14:17.389 |         at
com.itextpdf.kernel.pdf.PdfPagesTree.generateTree(PdfPagesTree.java:263)
[kernel-7.1.1.jar:?]
INFO   | jvm 2    | main    | 2019/07/12 15:14:17.389 |         at
com.itextpdf.kernel.pdf.PdfDocument.close(PdfDocument.java:837) ~
[kernel-7.1.1.jar:?]
INFO   | jvm 2    | main    | 2019/07/12 15:14:17.389 |         at
com.app.document.PdfHelper.close(PdfHelper.java:128) ~

I can't post my code right now , but any hint about why is this is happening ? I must know the possible reasons .

A: A PDF needs to have at least one page.  If you are creating new PDFs and you have an error in your code so it fails to create a page in the new document. Then you could certainly run into this.
Another possibility is the page creation failed due to a bug in the PDF library are using.


text:
Q: Ubuntu 10.04 + Lighttpd. can't bind to port: :: 80 Address already in use I've had a machine running Ubuntu 9.10, with lighttpd and PHP.
After the OS update to Ubuntu 10.04, it installed apache2 automatically for some reason (I believe it is due to some dependencies php -> apache). Anyway I removed apache2 permanently, but starting lighttpd fails, giving provided error -

can't bind to port: :: 80 Address already in use

using

sudo lsof -i :80

results in empty list!!
What is wrong?!
thanks in advance,
m.

A: Are you running lighttpd as root (sudo)? Normal users can't launch processes that bind on ports < 1024 ...

A: I ended up with replacing the config file with the default one, than copying custom settings back to the new config. I haven't compared the files, however the only change after all the modifications is the order of extension (modules) loading, I think.

A: I solved this by commenting out below line and the IPv6 Virtual Host in /etc/lighttpd.conf file.
#include_shell "/usr/share/lighttpd/use-ipv6.pl"

A: Just in case this was overlooked or not showing up for some reason, but skype uses port 80, so make sure it isn't running when you start your server....


text: Q: MVC Add migration to existing migration file Is it possible to apply the changes to the existing migration file? Every time I do the add-migration some_name_here, it creates a new file. My migration folder gets very overcrowded making fixing hard. Thanks for the help and ideas.


text:
Q: Best way to flatten json I have this awful looking JSON that is returned from the SugarCRM API.
What's the best approach to clean it up and remove the "name" key, and just have a single key and value (with no nested objects)
I wouldn't mind using the underscore library if needed.
{
"assigned_user_name": {
    "name": "assigned_user_name",
    "value": ""
},
"modified_by_name": {
    "name": "modified_by_name",
    "value": "Website Administrator"
},
"created_by_name": {
    "name": "created_by_name",
    "value": "Website Administrator"
},
"id": {
    "name": "id",
    "value": "6f9ec13f-dc29-ff18-da36-52d81a0076ad"
},
"name": {
    "name": "name",
    "value": " "
},
"date_entered": {
    "name": "date_entered",
    "value": "2014-01-16 17:45:33"
},
"date_modified": {
    "name": "date_modified",
    "value": "2014-01-16 17:45:33"
},
"modified_user_id": {
    "name": "modified_user_id",
    "value": "ab5ff74f-8043-f125-1409-523b6767fca9"
},
"created_by": {
    "name": "created_by",
    "value": "ab5ff74f-8043-f125-1409-523b6767fca9"
},
"description": {
    "name": "description",
    "value": ""
},
"deleted": {
    "name": "deleted",
    "value": "0"
},
"assigned_user_id": {
    "name": "assigned_user_id",
    "value": ""
},
"salutation": {
    "name": "salutation",
    "value": ""
},
"first_name": {
    "name": "first_name",
    "value": ""
},
"last_name": {
    "name": "last_name",
    "value": ""
},
"full_name": {
    "name": "full_name",
    "value": " "
},
"title": {
    "name": "title",
    "value": ""
},
"department": {
    "name": "department",
    "value": ""
},
"do_not_call": {
    "name": "do_not_call",
    "value": "0"
},
"phone_home": {
    "name": "phone_home",
    "value": ""
},
"email": {
    "name": "email",
    "value": ""
},
"phone_mobile": {
    "name": "phone_mobile",
    "value": ""
},
"phone_work": {
    "name": "phone_work",
    "value": ""
},
"phone_other": {
    "name": "phone_other",
    "value": ""
},
"phone_fax": {
    "name": "phone_fax",
    "value": ""
},
"email1": {
    "name": "email1",
    "value": "test@example.com"
},
"email2": {
    "name": "email2",
    "value": ""
},
"invalid_email": {
    "name": "invalid_email",
    "value": "0"
},
"email_opt_out": {
    "name": "email_opt_out",
    "value": "0"
},
"primary_address_street": {
    "name": "primary_address_street",
    "value": ""
},
"primary_address_street_2": {
    "name": "primary_address_street_2",
    "value": ""
},
"primary_address_street_3": {
    "name": "primary_address_street_3",
    "value": ""
},
"primary_address_city": {
    "name": "primary_address_city",
    "value": ""
},
"primary_address_state": {
    "name": "primary_address_state",
    "value": ""
},
"primary_address_postalcode": {
    "name": "primary_address_postalcode",
    "value": ""
},
"primary_address_country": {
    "name": "primary_address_country",
    "value": ""
},
"alt_address_street": {
    "name": "alt_address_street",
    "value": ""
},
"alt_address_street_2": {
    "name": "alt_address_street_2",
    "value": ""
},
"alt_address_street_3": {
    "name": "alt_address_street_3",
    "value": ""
},
"alt_address_city": {
    "name": "alt_address_city",
    "value": ""
},
"alt_address_state": {
    "name": "alt_address_state",
    "value": ""
},
"alt_address_postalcode": {
    "name": "alt_address_postalcode",
    "value": ""
},
"alt_address_country": {
    "name": "alt_address_country",
    "value": ""
},
"assistant": {
    "name": "assistant",
    "value": ""
},
"assistant_phone": {
    "name": "assistant_phone",
    "value": ""
},
"email_and_name1": {
    "name": "email_and_name1",
    "value": ""
},
"lead_source": {
    "name": "lead_source",
    "value": ""
},
"opportunity_role_fields": {
    "name": "opportunity_role_fields",
    "value": ""
},
"opportunity_role_id": {
    "name": "opportunity_role_id",
    "value": ""
},
"opportunity_role": {
    "name": "opportunity_role",
    "value": ""
},
"reports_to_id": {
    "name": "reports_to_id",
    "value": ""
},
"report_to_name": {
    "name": "report_to_name",
    "value": ""
},
"birthdate": {
    "name": "birthdate",
    "value": false
},
"campaign_id": {
    "name": "campaign_id",
    "value": ""
},
"campaign_name": {
    "name": "campaign_name",
    "value": ""
},
"c_accept_status_fields": {
    "name": "c_accept_status_fields",
    "value": ""
},
"m_accept_status_fields": {
    "name": "m_accept_status_fields",
    "value": ""
},
"accept_status_id": {
    "name": "accept_status_id",
    "value": ""
},
"accept_status_name": {
    "name": "accept_status_name",
    "value": ""
},
"sync_contact": {
    "name": "sync_contact",
    "value": ""
},
"event_contact_fields": {
    "name": "event_contact_fields",
    "value": ""
},
"event_contact_id": {
    "name": "event_contact_id",
    "value": ""
},
"event_status": {
    "name": "event_status",
    "value": ""
},
"cc_sync": {
    "name": "cc_sync",
    "value": "0"
},
"cc_id": {
    "name": "cc_id",
    "value": ""
},
"cc_lists": {
    "name": "cc_lists",
    "value": ""
},
"cc_lists_view": {
    "name": "cc_lists_view",
    "value": ""
},
"cc_optout": {
    "name": "cc_optout",
    "value": "0"
},
"mc_expires_c": {
    "name": "mc_expires_c",
    "value": false
},
"birthyear_c": {
    "name": "birthyear_c",
    "value": ""
},
"contact_id_c": {
    "name": "contact_id_c",
    "value": ""
},
"currency_id": {
    "name": "currency_id",
    "value": ""
},
"employer_c": {
    "name": "employer_c",
    "value": ""
},
"employer_website_c": {
    "name": "employer_website_c",
    "value": ""
},
"fico_score_c": {
    "name": "fico_score_c",
    "value": ""
},
"household_income_c": {
    "name": "household_income_c",
    "value": ""
},
"investment_capital_c": {
    "name": "investment_capital_c",
    "value": ""
},
"job_title_c": {
    "name": "job_title_c",
    "value": ""
},
"mbrs_company_c": {
    "name": "mbrs_company_c",
    "value": ""
},
"membr_type_c": {
    "name": "membr_type_c",
    "value": ""
},
"nickname_c": {
    "name": "nickname_c",
    "value": ""
},
"num_properties_financed_c": {
    "name": "num_properties_financed_c",
    "value": ""
},
"num_properties_owned_c": {
    "name": "num_properties_owned_c",
    "value": ""
},
"own_primary_residence_c": {
    "name": "own_primary_residence_c",
    "value": ""
},
"parent_id": {
    "name": "parent_id",
    "value": ""
},
"parent_name": {
    "name": "parent_name",
    "value": ""
},
"parent_type": {
    "name": "parent_type",
    "value": ""
},
"planned_retirement_date_c": {
    "name": "planned_retirement_date_c",
    "value": false
},
"realestateadvisor_c": {
    "name": "realestateadvisor_c",
    "value": ""
},
"referral_c": {
    "name": "referral_c",
    "value": ""
},
"sdira_c": {
    "name": "sdira_c",
    "value": ""
},
"self_directed_ira_c": {
    "name": "self_directed_ira_c",
    "value": ""
},
"self_directed_ira_capital_c": {
    "name": "self_directed_ira_capital_c",
    "value": ""
},
"source_c": {
    "name": "source_c",
    "value": ""
},
"source_sub_c": {
    "name": "source_sub_c",
    "value": ""
},
"spouse_c": {
    "name": "spouse_c",
    "value": ""
},
"user_id1_c": {
    "name": "user_id1_c",
    "value": ""
},
"user_id_c": {
    "name": "user_id_c",
    "value": ""
},
"usigndate_c": {
    "name": "usigndate_c",
    "value": ""
},
"usign_c": {
    "name": "usign_c",
    "value": ""
},
"longitude_c": {
    "name": "longitude_c",
    "value": ""
},
"latitude_c": {
    "name": "latitude_c",
    "value": ""
},
"newmemberform_c": {
    "name": "newmemberform_c",
    "value": ""
},
"nr_contact_lead_source_c": {
    "name": "nr_contact_lead_source_c",
    "value": ""
},
"nr_contact_lead_score_c": {
    "name": "nr_contact_lead_score_c",
    "value": ""
},
"nr_contact_recent_activity_c": {
    "name": "nr_contact_recent_activity_c",
    "value": ""
}
}

A: If you want to use Underscore then reduce will do the trick:
var o = _(ugly).reduce(function(m, h) {
    m[h.name] = h.value;
    return m;
}, { });

Demo: http://jsfiddle.net/ambiguous/mE56S/

A: I'd just use a straight forward approach:
var newArr = {};
for(var key in YOUR_JSON_ARRAY)
    newArr[key] = YOUR_JSON_ARRAY[key].value;

A: Keep in mind that the convention in the vardef array is to have the array indices be the field names, but it's not mandatory. I can't think of an example where they're not the same, but you could create a field with an array like 'my_new_field' => array('name'=>'new_field_c') and it would work.


text:
Q: Azure Message size limit and IOT I read through azure documentation and found that the message size limit of Queues is 64 Kb and Service Bus is 256 KB. We are trying to develop an application  which will read sensor data from the some devices, call a REST Service  and upload it to cloud . This data will be stored in the queues and then dumped in to a Cloud database.
There could be chances that the sensor data collected is more than 256 KB... In such cases what is the recommended approach... Do we need to split the data
in the REST service and then put chunks of data in the queue or is there any other recommended pattern
Any help is appreciated

A: You have several conflicting technology statements.  I will begin by clarifying a few.

*

*Service Bus/IoT Hub are not post calls.  A post call would use a
restful service, which exists separately.  IoT Hub uses a low
latency message passing system that is abstracted from you.  These
are intended to be high volume small packets and fits most IoT
scenarios.

*In the situation in which a message is larger than 256 KB (which is very interesting for an IoT scenario, I would be interested to
see why those messages are so large), you should ideally upload to
blob storage.  You can still post packets

*

*If you have access to blob storage api's with your devices, you should go that route

*If you do not have access to this, you should post big packets to a rest endpoint and cross your fingers it makes it or chop it up.

*You can run post analytics on blob storage, I would recommend using the wasb prefix as those containers are Hadoop compliant and you can stand up analytics clusters on top of those storage mechanisms.

You have no real need for a queue that I can immediately see.
You should take a look at the patterns leveraging:

*

*Stream Analytics: https://azure.microsoft.com/en-us/services/stream-analytics/

*Azure Data Factory: https://azure.microsoft.com/en-us/services/data-factory/
Your typical ingestion will be:  Get your data up into the cloud into super cheap storage as easily as possible and then deal with analytics later using clusters you can stand up and tear down on demand.  That cheap storage is typically blob and that analytics cluster is usually some form of Hadoop.  Using data factory allows you to pipe your data around as you figure out what you are going to use specific components of it for.
Example of having used HBase as ingestion with cheap blob storage as the underlayment and Azure Machine Learning as part of my analytics solution: http://indiedevspot.com/2015/07/09/powering-azureml-with-hadoop-hbase/


text:
Q: Maven assembly Plugin with Maven Jar Plugin I'm trying to use the maven assembly plugin for the first time. Essentially, I want to combine the output of the maven assembly plugin with that of the maven jar plugin into the target/classes directory so I can still run the app within Eclipse.
I couldn't find a way to tell the maven jar plugin to collect the output of the maven assembly plugin. Similarly, I found no way to tell assembly plugin to put its output into target/classes.
The closes i cam to a solution was to tell assembly plugin to output its result into classes.dir directory.  The suffix 'dir' is the format used while 'classes' is the finalName define in the plugin configuration.
I was hoping that directory-single would force assembly plugin to ignore the format and hence, output in the classes directory. This doesn't work for me; am i misinterpreting the description of this goal?
How would you guys solve this issue? Below is my assembly plugin declaration in the pom as well as my descriptor:
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2-beta-1</version>
            <executions>
                <execution>
                    <id>package</id>
                    <goals>
                         <goal>directory-single</goal>
                    </goals>
                    <phase>package</phase>
                </execution>
            </executions>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <finalName>classes</finalName>

                <descriptors>
                    <descriptor>descriptor.xml</descriptor>
                </descriptors>
            </configuration>
        </plugin>

     <assembly>
     <files>
    <file>
        <source>${repository-path}</source>
        <outputDirectory>/</outputDirectory>
        <filtered>true</filtered>
        <destName>repository.xml</destName>
    </file>
    </files>
    <fileSets>
    <fileSet>
        <directory>src/main/resources</directory>
        <outputDirectory>/</outputDirectory>
    </fileSet>
    <fileSet>
         <directory>${project.build.directory}</directory>
    </fileSet>
   </fileSets>
  </assembly>

A:
That's exactly what i am trying to do. How would you do that? That is you have two files Dev.xml and Prod.xml and you want to include them as Config.xml depending on the profile.

You could use the maven-antrun-plugin and profiles to delete/copy/rename configuration files depending on the target environment (this is one solution). Have a look at Building For Different Environments with Maven 2, this guide shows precisely how to achieve this.


text:
Q: How do I output display at 2560x1080? (am trying to add modeline with xrandr) I'm trying to use xrandr to add a custom resolution for my 2560x1080 AOC monitor.
I've been given the VESA timings by the manufacturer (attached), but I'm not sure what I should be doing with them:

I'm using cvt to generate a ModeLine (cvt 2560 1080 60.00), which generates:
# 2560x1080 59.98 Hz (CVT) hsync: 67.17 kHz; pclk: 230.00 MHz
#Modeline "2560x1080_60.00" 230.00 2560 2720 2992 3424 1080 1083 1093 1120 -hsync +vsync

I can use xrandr to add that Modeline, then add it to HDMI1 - but when I set the monitor to the new resolution, all I'm getting from the monitor is flashing colours, until I drop it back to 1920x1080@60.00.
The laptop I'm using is an Acer Aspire v7-581PG - which has a 720M chip, so using Optimus (I also have bumblebee installed), but it seems that anything being output over HDMI uses the Intel chip anyway (which I believe is a 4400 chipset from the i5)
If I go into nvidia-settings with:
# optirun nvidia-settings -c :8,

I get to the settings menu, but no monitors are displayed there - so I assume everything's being handled by the Intel chip?).
I know the chipset CAN handle HDMI @ 2560x1080, as Windows 8 had no troubles outputting properly.
I assume I'm doing something wrong with the timings here, but I just can't work out what. I've tried dropping the refresh rate down in decrements of 1, all the way down to 40, but I get the same result - once I get down to 47.00, it just shows a black screen, rather than flashing colours.
Any help would be hugely appreciated. Having a 21:9 monitor running at 1920x1080 is annoying enough to make me consider switching back to windows!
Just to follow up, looking at the VESA timings, the nominal frequency is 181.250, so I have tried the following but get the same issue:
#Modeline "2560x1080_60.00" 230.00 2560 2720 2992 3424 1080 1083 1093 1120 -hsync +vsync

A: I have connected ultrawide monitor by HDMI with
Modeline "2560x1080_40.00"  147.25  2560 2680 2944 3328  1080 1083 1093 1108 -hsync +vsync

I used:
cvt 2560 1080 40

HDMI did not support > 165 Mhz, however HDMI 1.3 supports up to 340 MHz maximum pixel clock rate wiki.


text:
Q: Finding the roots, with multiplicity, of a polynomial with compound angle formula My question is to find the roots, counted with multiplicity, of the polynomial equation
$16x^5-20x^3+5x-1=0$ using the compound angle formula $\sin\left(5\theta\right)=16\sin^5\theta-20\sin^3\theta+5\sin\theta$
So after substituting $x=\sin\theta$, I get to the equation
$\sin(5\theta)=1$
Then I get an infinitude of $\theta$ values, which when I find the sines of these values, all correspond to the distinct solutions $x=1,\sin\left(\frac{\pi}{10}\right),\sin\left(-\frac{3\pi}{10}\right)$.
What I don't understand is how I can then find which roots are repeating, since the degree of the polynomial is 5 hence there must be 5 roots when counted with multiplicity.
Also if possible, is there a way to solve this polynomial using the given compound angle formula without the need to find the distinct roots and then determine the ones which repeat?
This is because the solutions to this question say $x=1,\sin\left(\frac{\pi}{10}\right),\sin\left(\frac{9\pi}{10}\right),\sin\left(\frac{13\pi}{10}\right),\sin\left(\frac{17\pi}{10}\right)$ without any reasoning, which makes me suspect I am unaware of some related theorem.

A: As already explained, the solutions are:
$$x=1,\sin\left(\frac{\pi}{10}\right),\sin\left(\frac{9\pi}{10}\right),\sin\left(\frac{13\pi}{10}\right),\sin\left(\frac{17\pi}{10}\right)$$
Because,
$$\sin(5\theta)=1 \Rightarrow \theta=\frac{1}{5}\left(\frac{\pi}{2}+2k\pi\right)$$
and setting $k=0,1,2,3,4$ we get all five solutions.
But $\sin\left(\frac{\pi}{10}\right)=\sin\left(\frac{9\pi}{10}\right)$ and $\sin\left(\frac{13\pi}{10}\right)=\sin\left(\frac{17\pi}{10}\right)$.
So the five roots (with multiplicity) are
$$1,\sin\left(\frac{\pi}{10}\right),\sin\left(\frac{\pi}{10}\right),\sin\left(\frac{13\pi}{10}\right),\sin\left(\frac{13\pi}{10}\right)$$.
Let's explain better why if make any other choice of $k$ we will always find an angle congruent to one of those in $S=\{\pi/10,\pi/2,9\pi/10,13\pi/10,17\pi/10\}$.
We can write $k=5n+r$ with $r \in \{0,1,2,3,4\}$ and $n \in \Bbb Z$. Replacing that at the expression of $\theta$ we get:
$$\theta=\frac{\pi}{10}+\frac{2k\pi}{5}=\frac{\pi}{10}+\frac{2(5n+r)\pi}{5}=\frac{\pi}{10}+2n\pi+\frac{2r\pi}{5} \equiv \frac{\pi}{10}+\frac{2r\pi}{5} $$
The last equivalence means that the angle $\frac{\pi}{10}+2n\pi$ is congruent to $\frac{\pi}{10}$. That means that both angle stop at the same point on the trigonometric circle and then if we apply any trigonometric function at those angles we will get the same value. The algebric value are different but geometricaly they represent the same point at the circle.
It means that if we want to find the different solution for $\sin\theta$ is enough to take
$$\frac{\pi}{10}+\frac{2r\pi}{5}$$
with $r=0,1,2,3,4$.

A:
What I don't understand is how I can then find which roots are repeating, since the degree of the polynomial is 5 hence there must be 5 roots when counted with multiplicity.

If one knows the roots, then it is possible to find their multiplicity by finding whether or not the function's derivative(s) have the same root. See this question for a proof.


text:
Q: how to correctly use ctime() to print different time stamps I was expecting the following code should print different time stamps t1 and t2, however the result shows t1 and t2 are the same. Where did I make the mistake?
#include<iostream>
#include<ctime>

using namespace std;

int main()
{
    time_t t1 = time(NULL);
    cout << "time now " << ctime(&t1) << endl;
    time_t t2 = t1 + 10000.0;
    cout << "time now " << ctime(&t1) << endl << " time later " << ctime(&t2) <<endl;
}

Result:
time now Thu Apr 28 20:37:03 2016

time now Thu Apr 28 20:37:03 2016

 time later Thu Apr 28 20:37:03 2016

A: The answer to your question can be found in the manual page for the ctime() function:

The return value points to a statically allocated string which might
  be overwritten by subsequent calls  to  any  of  the date and time
  functions.

ctime() returns a pointer to an internal buffer it uses. Every time it's called, it returns a pointer to the same buffer:
 cout << "time now " << ctime(&t1) << endl << " time later " << ctime(&t2) <<endl;

For this line of code, your compiler generated code that calls ctime() twice, then executes the << operator. But on the second call to ctime(), it overwrote the buffer with the second time, so when the << operator formats the output, because the result of the first call to ctime() is the same pointer, and the buffer that it points to has been overwritten by the second call to ctime(), you get the same time printed twice.
Thank you for posting a Minimal, Complete, and Verifiable example.

A: What is ctime actually returning? From cppreference:

Pointer to a static null-terminated character string holding the textual representation of date and time. The string may be shared between std::asctime and std::ctime, and may be overwritten on each invocation of any of those functions.

It likely works out that on your compiler, the later ctime() gets called first, then the newer ctime(), then both operator<<()s get evaluated - which emit the same char*. As a result of the unspecified order, your code has undefined behavior. On some compilers, it could work as you hoped it would! On yours, it happens not to.
If you separate out the two calls:
cout << "time now " << ctime(&t1) << endl;
cout << " time later " << ctime(&t2) <<endl;

you'd definitely and consistently see different values.

A: Quote from N1570 7.27.3 Time conversion functions:

Except for the strftime function, these functions each return a pointer to one of two
  types of static objects: a broken-down time structure or an array of char. Execution of
  any of the functions that return a pointer to one of these object types may overwrite the
  information in any object of the same type pointed to by the value returned from any
  previous call to any of them and the functions are not required to avoid data races with
  each other.

This suggests that the contents pointed by what is returned from ctime() can be overwritten by another call of ctime(), so you will have to copy the result to use the result in one expression with no sequence point in that.
Try this:
#include<iostream>
#include<ctime>
#include<string>

using namespace std;

int main()
{
    time_t t1 = time(NULL);
    cout << "time now " << ctime(&t1) << endl;
    time_t t2 = t1 + 10000.0;
    string t1s = ctime(&t1);
    string t2s = ctime(&t2);
    cout << "time now " << t1s << endl << " time later " << t2s <<endl;
}


text:
Q: Why is VSCode using Cygwin to build and execute my CPP programs? I downloaded and installed MinGW under C:\MinGw and installed g++ and gcc.
If I run g++ --version I get:
g++.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

If I run gcc --version, I get:
gcc (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE

I'm trying to run a simple helloworld.cpp file from VSCode:
#include<iostream>

int main()
{
    std::cout << "Hello World" << std::endl;
}

I've edited the c_cpp_properties.json file as follows:
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\MinGW\\include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\MinGW\\bin\\g++.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}

But when I go and build/run the file, I get the following:
Starting build...
C:\cygwin64\bin\cpp.exe -fdiagnostics-color=always -g C:\Users\Pippo\Desktop\Programming\CPP\helloworld.cpp -o C:\Users\Pippo\Desktop\Programming\CPP\helloworld.exe
cpp: fatal error: cannot execute 'cc1plus': spawn: No such file or directory
compilation terminated.

Build finished with error(s).

Why is this failing? And why am I seeing Cygwin being called??
EDIT (more stuff I don't get):
The behaviour I showed before happens when I click on Run C/C++ File

But when I click on Run Code it works (and it calls g++):

EDIT (@Yakk - Adam Nevraumont answer): Nope, Cygwin is after g++ in my env vars:

A: VSCode uses a completely separate tool chain for compiling and for linting and syntax highlighting and similar.
c_cpp_properties.json isn't for compiling.
It gets the compiler typically from your PATH.  See here.
Your build task is probably set to the compiler g++, and the first one on the search path (the PATH environment variable) is Cygwin's g++.  Alternatively, it can be hard coded in tasks.json.


text:
Q: Breeze BeforeSaveEntities: how to modify savemap I read the following from the Breeze documentation about BeforeSaveEntities:
"Entities may be added or removed from the map returned by this method".
So I suppose I can add a new instance of EntityInfo to the saveMap.
My question is: how can I do that? Is there any example of that anywhere?
I can perfectly loop through the dictionary. But since EntityInfo has no constructor, and all its fields are get only, I feel a bit stuck here. Any help is welcome.
Thanks

A: Ok, here is a very contrived example of a BeforeSaveEntities override that creates comment records alongside a whatever is normally saved.  Comment records include a comment generated based on the value of the SaveOptions.Tag property.
protected override Dictionary<Type, List<EntityInfo>> BeforeSaveEntities(Dictionary<Type,   List<EntityInfo>> saveMap) {
    var comment = new Comment();
    var tag = ContextProvider.SaveOptions.Tag;
    comment.Comment1 = (tag == null) ? "Generic comment" : tag.ToString();
    comment.CreatedOn = DateTime.Now;
    comment.SeqNum = 1;
    var ei = ContextProvider.CreateEntityInfo(comment);
    List<EntityInfo> comments;
    if (!saveMap.TryGetValue(typeof(Comment), out comments)) {
      comments = new List<EntityInfo>();
      saveMap.Add(typeof(Comment), comments);
    }
    comments.Add(ei);

    return saveMap;
  }

}

A: This answer is for those developers that have chosen to use Database First using an  objectContext instead of Code First, and for Nicolas.
I found after using the Breeze Source Code in Debug that line 805 of the GetEntitySetName method (cspaceEntityType = cspaceEntityTypes.First(et => et.FullName == entityType.FullName)
I would get the error "Sequence contains no matching element"
I noticed inside my watch that et.FullName and entityType.FullName did not have the same namespace. This told my comrad and I that the edmx models namespace was not the same as the object context.
Go to your edmx model select right click inside the empty space and  select properties. ensure that the Namespace property is the same as your Object Context.


text:
Q: php session_start() warning I'm new to php.. Im trying to get value from session. Below is my code.
Set session in login page
session_start();
$_SESSION["username"] = $username ;
$_SESSION["password"] = $password ;
$_SESSION["companycode"] = $companycode;

Get the session
if(! isset($_SESSION))
session_start();
$a=$_SESSION["companycode"];
echo $a;

But i got the warning in my page:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\lucent\clientlogin.php:216) in C:\xampp\htdocs\lucent\clientlogin.php on line 219

Please help. Thanks

A: You're sending text somewhere before starting the session. Stop doing that.

A: may be you have white space's before <?php in some file.
check your files

A: Maybe the problem is the "" that you need to chango to ''
$_SESSION['nome'] == "" in to $_SESSION['nome'] == ''

or
Your file encoding is UTF8 and has blank row and that can cause header to be sent. Change encoding to ANSI.
I use Notepad++ and you can see encoding in the bottom right corner.
If none of the above works try moving it before <html> tag.


text:
Q: Run javascript code each time a page is opened I often find myself using this line of code on the console of the browser:
document.getElementsByTagName('video')[0].playbackRate = 1.5;

I use it so I can speed up a video (I just prefer to watch videos on a higher speed). Is there a way to make this line of code run on every web page I open. For example if I go to a youtube video, this line of code runs automatically. I know that YouTube already has buttons for speed, but some players don't have the UI for this and this is why I have to do this often. Thanks in advance :)


text:
Q: How do I parse a Promise JS Object to a singluar variable? I write Python 99% of the time but decided to start playing with Amazon Cloudscape and therefore started to write some React. It's been a slog...
I have a backend service (flask) that returns a JSON object of data I want to use in order to create a line-chart (using the Cloudscape Linechart component). However, the JSON data is within a promise (Async fetch statements) and for the life of me I cannot figure out how to assign it to a variable that can be used as an export for my Linechart component class.
How do I:

*

*Get rid of the Promise object (parse it)

*Get a valid array in its own variable

*Be able to consume the variable (export) in a different class (e.g., import {my_var} from "./my_class").

I need to do some math on this data which complicates this.
Fetch Function that returns a Promise
export async function GetRegionRidecounts(region) {
   try {
      var response = await fetch('http://localhost:5000/get_region_ridecounts?region_name=' + region, {
         method: 'GET',
         mode: 'cors',
         headers: {
            'Content-Type': 'application/json',
         },
      });
      return await response.json()
   } catch (error) {
      return { "error": error };
   }
}

Consumer function that returns a Linechart
export default function RidersLineChart(region) {
    console.log(region)
    GetRegionRidecounts("west-lake-marion-park")
    .then(data => {
    return <LineChart
        height={200}
        series={data}
        xDomain={[data[0].date,data[data.length -1].data]}
        yDomain={[0, 500]}
        xScaleType="time"
        xTitle="Time (UTC)"
        yTitle="Data transferred"
        ariaLabel="Network traffic"
        ariaDescription={`Line chart showing transferred data of all your instances.`}
    />
    });
}

Edit 1: I've tried to use the useState capabilities but get the following errors:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

Example Function that throws error
export async function GetRegionRidecounts(region) {
   const [data, setData] = useState([]);
   try {
      await fetch('http://localhost:5000/get_region_ridecounts?region_name=' + region, {
         method: 'GET',
         mode: 'cors',
         headers: {
            'Content-Type': 'application/json',
         },
      }).then(response => {return response.json()})
      .then(data => {setData(data)});
      console.log(data)
      return data
   } catch (error) {
      return { "error": error };
   }
}


text:
Q: Toolbar transparente no Android Preciso fazer com que minha toolbar fique transparente, ou pelo menos remover aquela linha sombreada que fica abaixo dela. Alguém já passou por uma situação parecida?

A:  Elevação
Aquela "linha sombreada" que lhe diz respeito se trata do elevation. Você pode remover setando o valor dela para 0dp. Então seu código ficaria assim:
<android.support.v7.widget.Toolbar
       xmlns:app="http://schemas.android.com/apk/res-auto"
       android:id="@+id/my_awesome_toolbar"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:background="?attr/colorPrimary"
       android:elevation="0dp"
       android:minHeight="?attr/actionBarSize"
       app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

Toolbar Transparente
Referente a transparência, uma das formas de você fazer isso é você trabalhar com seu style. Tudo que você precisa é definir o tema que esconde o toolbar, definindo o estilo da barra de ação com fundo transparente e definir este estilo para o widget da barra de ferramentas.
<style name="Theme.Custom" parent="@android:style/Theme.AppCompat">
    <item name="windowActionBar">false</item>
    <item name="windowActionBarOverlay">true</item>
    <item name="android:windowActionBarOverlay">true</item>
</style>

<style name="CustomActionBar" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:windowActionBarOverlay">true</item>
    <!-- Support library compatibility -->
    <item name="windowActionBarOverlay">true</item>
</style>

Layout Transparente
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Toolbar should be above content-->
    <include layout="@layout/toolbar" />

</RelativeLayout>

Toolbar Layout
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:theme="@style/CustomActionBar"/>

Outra forma seria assim:
Você pode definir o plano de fundo para Android, do padrão de cor transparente, o que funciona muito bem. Adicione isso ao layout que deseja uma barra de ferramentas transparente:
android:background="@android:color/transparent"

Se você quer mudar o alfa programaticamente, você pode modificar o alfa no próprio fundo da barra de ferramentas. Basta obter uma instância da drawable e definir o alpha:
mToolbar = findViewById(R.id.my_toolbar);
mToolbar.getBackground().setAlpha(0);


text:
Q: Why does my clock signal have a step half way between high and low? I'm trying to debug a clock signal between two ICs (DS90CR287 and DS90CR288). There is a step half way up the single ended clock generated by the DS90CR288 which I don't know how to explain. I can't post the schematic but there is a 30Ohm series resistor between the output clock (DS90CR288) and input clock (DS90CR287).

EDIT
I meant to say between two DS90CR287 ICs and a DS90CR288. It seems like the cause of the step is using series termination rather than parallel termination.

A: Let me offer an analysis of the presented trace.
This is a classic high-speed waveform when a probe is placed at the source of clock that drives a trace (or transmission line, or coax cable) with no termination on the destination end. The driver impedance (plus any in-series resistor) forms a voltage divider with the line impedance (which is 103 Ohms, as reported). The initial voltage amplitude gets divided in Driver/Zline proportion. Then the signal propagates to unterminated end, and is 100% reflected, so the DC amplitude becomes equal to the driver output amplitude when the reflection comes back.
The duration of "shoulder" is two flight times across the trace. If it is 2.7 ns, it means the one-way flight of 1350 ps. With typical propagation delay of 150 ps per inch, it makes the trace length between two chips of about 200-250 mm.
If the driver impedance matches the transmission line characteristic impedance, the shoulder should be exactly half-way. If the impedances do not match at the source, secondary reflections will occur, making the waveform less pretty. The shoulder on the scope capture is less than half of the DC level, meaning that the driver impedance (driver+resistor) is MORE than 100 Ohms, and the resistor should be reduced or removed.
This shoulder shouldn't be of much concern, because at the destination point the clock will look just fine, and the receiving IC will function just fine as well.

A: Most likely it is measurement error from improper test methods.
The signal captured is a 20MHz square wave with a resonant signal near 200MHz which could be the 9th harmonic at 180Mhz due to probe inductance rather than a balanced low ESL probe method with very short or no ground wires, just using a calibrated 200MHz probe tip & Barrel with matched source and load.
You could be getting textbook waveforms if you follow best practices for signal integrity, supply decoupling and signal capturing. It is possible to get < 0.1% noise or 60dB SNR. Yours is about  16 dB SNR. tisk.

get spring probe accessory or make this happen then show new photo.
No need for cap shown in photo, that's for Supply Voltage ripple into an AC coupled 50 Ohm termination.

*

*your lab instructor or mentor ought to know better. Now you do.


text:
Q: Do native English speakers pronounce every final letter when speaking fast? I came across situations where it looks like they don't pronounce the final letter of every word in a sentence? Personally, I feel that skipping the final letter somehow seems beautiful? What is the extent of correctness in my thought? Secondly, is it a good practice to do so? I would love to hear from native English speakers.

A: There are a number of regional British accents which do not do this, in a variety of ways.  This basically applies to consonants which are omitted, altered, or replaced with a glottal stop.
Much of Britain will pronounce words ending with "ing" as "in"; so "I'm going out" becomes "I'm goin' out". (You'll often see it written this way in books too.)
For a number of regional accents too, the letter "T" is unvoiced, or replaced with a glottal stop if it occurs in the middle of a word or sentence.  "R" is often also unvoiced too. So "Put your hat on" can become "Pu-ya ha'n".  This is common for Essex, Liverpool and Scotland, although with different vowel sounds in each case for the relevant regional accent.
More than this, in much of Lancashire (north-west England) there is a tendency to simply not voice the end of sentences, and the last word trails off without being fully enunciated.  I used to do this myself, and my first singing teacher had to do the whole "My fair lady" thing to get me to sound out the ends of sentences properly!
Just for a few examples...

A: Apart from words ending in r, there are not many English words where the last letter is a single silent consonant.  Many of those come from other languages, for example ballet, valet. Some words have a consonant combination where only one is sounded, eg lamb, crumb, rock. The final consonant combination ng (as in running) represents a single sound and it is sometimes pronounced with a different sound, which would be spelt without the g.
The letter r, when not pronounced as a consonant, acts as a modifier for the preceding vowel. So while the final e in ride is not pronounced (though it modifies pronunciation of the i) it is pronounced (as some variation of er) in all accents.
In general it is much more common to pronounce the last consonant or consonant combination, than not. When speaking very quickly consonants may be reduced, as outlined in @Void's answer. Most people I know think that dropping consonants makes speech less beautiful, not more beautiful.

A: It's unclear what you mean by 'every final letter' (and I wouldn't say every letter is dropped), but I'll start off by classifying English accents into two main categories:

*

*Rhotic accents: Rhotic accents are ones in which the R is pronounced in all positions (red, park, car; the R in all these words is pronounced). Most American and Canadian accents are rhotic (there are also rhotic accents in Britain).

*Non-rhotic accents: Non-rhotic accents are ones where the R sound is only pronounced when it comes before a vowel sound (not the vowel letters a e I o u), so the R is pronounced in red, arrive, car is but not in bar, park, card etc. Most English-English accents are non-rhotic (there are also non-rhotic accents in the US such as New York and Boston). So the final (and pre-consonantal) R's in non-rhotic accents aren't pronounced.

Other consonants that are usually affected in speech include p, t, k. I wouldn't say they're dropped but rather 'unreleased'. If you have noticed, p t k are produced by blocking the air at a particular place of articulation and then the blocked air is released:

*

*p is made by blocking the air at the lips

*t is made by blocking the air at the ridge just above the top teeth (called alveolar ridge)

*k is made by blocking the air at the velum (the soft palate)

Sometimes in word-final positions (and before certain other consonants), native speakers block the air for p t k and don't release it (= 'unreleased'), so they can be inaudible.
There's another phenomenon called 'glottalisation' that happens to word-final (or syllable-final or pre-consonantal) t's in some accents (chiefly British). What happens is that the closure for the t (which is normally made at the ridge) is made in the glottis (= glottal stop).
Further, as pointed out in Graham's answer, the -ing in some accents such as Southern US, Cockney and AAVE is reduced to -in (i.e. from /ɪŋ/ to [ɪn]) so words like singing, going, morning are reduced to singin', goin', mornin'. That is called NG droppin'.
Incidentally, most (perhaps all) non-rhotic speakers usually insert consonants that are not present in spelling (ghost consonants!), for instance, [w] in go[w]away, [j] ('y') in he[j]is and (the striking) [ɹ] ('r') in saw[ɹ]a film or idea[ɹ]of. I've explained them in this answer to a question asking 'Is 'idea of' pronounced 'idearof'?'.