text:
Q: Error: Faild to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin'] I'm having issue after installing push plugin of ionic 3.
ionic cordova plugin add phonegap-plugin-push

npm install --save @ionic-native/push@4

This is blundder
* What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
  All firebase libraries must be either above or below 14.0.0

This is a project.properties file
target=android-27
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.facebook.android:facebook-android-sdk:4.40.0
cordova.system.library.4=com.android.support:support-v4:25.+
cordova.system.library.5=com.android.support:appcompat-v7:25.+
cordova.system.library.6=com.google.android.gms:play-services-analytics:11.0.1
cordova.gradle.include.1=cordova-plugin-googlemaps/citizen-tbxml-android.gradle
cordova.system.library.7=com.google.android.gms:play-services-maps:15.0.1
cordova.system.library.8=com.google.android.gms:play-services-location:15.0.1
cordova.system.library.9=com.android.support:support-core-utils:26.1.0
cordova.system.library.10=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.11=com.google.android.gms:play-services-identity:11.8.0
cordova.system.library.12=com.android.support:support-annotations:27.+
cordova.system.library.13=com.google.android.gms:play-services-location:15.+
cordova.system.library.14=com.android.support:appcompat-v7:23+
cordova.gradle.include.2=cordova-plugin-telerik-imagepicker/citizen-ignorelinterrors.gradle
cordova.gradle.include.3=cordova-plugin-telerik-imagepicker/citizen-androidtarget.gradle
cordova.gradle.include.4=cordova-support-google-services/citizen-build.gradle
cordova.system.library.15=com.android.support:support-v4:26.+
cordova.system.library.16=com.android.support:appcompat-v7:26.+
cordova.gradle.include.5=phonegap-plugin-multidex/citizen-multidex.gradle
cordova.system.library.17=com.android.support:support-v13:27.+
cordova.system.library.18=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.19=com.google.firebase:firebase-messaging:15.0.0

any help is appreciated.


text:
Q: Java - TCP socket only connects in LAN I have created a small TCP server but it only connects to other computers on my LAN. I did forward the port but it is still not working.
connection method:
    private boolean connect(){
    try {
        socket = new Socket(InetAddress.getByName(ip), port);
        System.out.println("socket created");
        dataOutput = new DataOutputStream(socket.getOutputStream());
        dataInput = new DataInputStream(socket.getInputStream());
        accepted = true;
    } catch (IOException e) {
        System.out.println("Unable to connect to the server");
        return false;
    }
    System.out.println("Successfully connected to the server.");
    return true;
}

listen method:
    private void listenForServerRequest(){
    Socket socket = null;
    try{
        socket = serverSocket.accept();
        dataOutput = new DataOutputStream(socket.getOutputStream());
        dataInput = new DataInputStream(socket.getInputStream());
        accepted = true;
        System.out.println("client joined");

    }catch(IOException e){
        e.printStackTrace();
    }
}

opening the server:
    private void initializeServer(){
    try{
        serverSocket = new ServerSocket(port,8,InetAddress.getByName(ip));
    }
    catch(Exception e){
        e.printStackTrace();
    }
}

A: It appears as if you're supplying an IP address to InetAddress.getByName(). It requires a host name. Specifically, it needs the host name corresponding to the network that the port is forwarded to. For example, if you're forwarding to your computer's (internal) ip address (say, 192.168.1.10), then it needs the host name that corresponds to that address (for example mycomputer.local). Java needs that host name to know what interface it should listen on. I'm surprised it worked at all.
If you do want to supply the IP address and not the host name, use InetAddress.getByAddress(byte[] addr) instead:
byte[] addr = new byte[4];
addr[0] = 192;
addr[1] = 168;
addr[2] = 1;
addr[3] = 10;
...
serverSocket = new ServerSocket(port,8,InetAddress.getByAddress(addr));

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is wrong with my algorithm when calculating the sum of a series (x86 Assembly)? I'm currently trying to get the sum of a series using the following formula:
((endNum * (endNum + 1) / 2) - ((startNum * (startNum - 1) / 2)
The first part seems to work correctly, however when I get to the second part, it gives me issues.
Here is what I'm doing:
; Formula and testing numbers
; -----------------------------
;((x (x+1) / 2) - ((y (y-1) /2)
;
; - x = 8
; - y = -2
; -----------------------------

ReadInt WORD[y]        ; read ending integer from user (8)
ReadInt WORD[x]        ; read starting integer from user (-2)

; ((x * (x + 1) / 2)

mov    AX, [x]
mov    BX, [x]
add    BX, 1
mul    BL
shr    AX, 1
mov    [x], AX

; ((y * (y - 1) / 2)

mov    AX, [y]         ; -2
mov    BX, [y]         ; -2
sub    BX, 1           ; -3
mul    BL              ; <-- comes out with 1112 or some odd large number??
shr    AX, 1

sub    [x], AX

I'm not sure what the issue is, but it seems to happen when it is multiplying -2 and -3.
Is someone able to point out where I'm making the mistake?
EDIT
Meant to edit this sooner, since I'm only dealing with unsigned numbers, I had to change my algorithm to loop through each number and add them rather than trying to use the formula. I originally wanted to use the formula since I believe it would be more efficient than looping.

A: A few problems I'm seeing:

*

*If the numbers are signed, you have to use IMUL instead of MUL for their multiplication.

*If the numbers are signed, you can't use SHR as a way to divide them by a power of two. At the very least it must be SAR, not SHR. And even then I'd actually advise to use IDIV to get symmetric truncation.

*I don't know exactly which part is wrong, but if your input numbers are 16-bit, doing 8-bit*8-bit=16-bit multiplication is wrong as you're likely truncating the input values. Likewise, if the input numbers are 8-bit reading them as 16-bit is generally wrong as well as you might step on a memory location without memory and crash.

And you absolutely must get an Intel or AMD x86 CPU manual describing how instructions work and read about the instructions you're using and see where they take their inputs from, what do with them and where the outputs go.


text:
Q: Computer controlled rotary switch I have a circuit with a rotary switch (1 pole, 6 positions).
Instead of turning this switch by hand, I would like to control it via a computer.
Are there any components that can do this? They would receive commands and then switch their relay between several positions accordingly? If so, what are they called?

A: You can get a reed relay, such as this one, with contacts rated at 200 VDC @ 500 mA, and a nominal coil voltage of 5v.  The datasheet is here.
The advantage of a relay over a transistor solution is it would provide total isolation.
Also the easiest way of integrating into your current system, just wire the relay contacts across your switch contacts.
Since you are switching a fairly low current, you might want to use a relay with two Form A contacts and wire them in parallel.  This relay is identical to the one above except it is DPST (and costs about twice as much).

A: They're called "rotary stepping switches" and one version is made by coupling a rotary solenoid to a rotary switch, as shown below.
A bit overkill for your application, which can be easily handled by six relays driven individually by separate MCU I/Os, or driven by something like a 74HC138 with omly three IOs required from the MCU.

A: I have seen stepper switches which are solenoid-controlled rotary switches.  You pulse the solenoid for a specified time at a specified voltage, and the switch advances to the next position.  However, such things are physically large, not easily and commonly available, and quite expensive.
The right solution is to step back two logical layers and define what you really want to accomplish, and leave any supposed solution like a rotary switch out of it.
Apparently you want to switch 100 V at 10 mA to 6 different feeds.  That should be doable using transistors for much lower cost, much lower size, and much higher reliability.  To recommend the best architecture, you need to tell us more about what is being switched on and off.  For example, is it OK to switch the grounds, or must the power be switched?
At worst, a few FETs or BJTs as high side switches should work here.  These can be controlled from a microcontroller, which can implement the sequencing logic to emulate a rotary switch, if that even matters.  Basically, the micro has individual control over each of the 6 switches, and the rest is firmare logic.
Added
I see using relays is a popular answer.  That would certainly work, but relays have downsides too.  The way to decide whether relays or transistors are more appropriate is whether you need isolation or not, which you haven't told us.  If you need isolation between these power feeds that are being switched and the control logic that decides what needs to be switched when, then I'd use relays.  If everything has a common ground then I'd use transistors.
Transistors will be smaller, cheaper, and last much longer than relays, so I'd use the relays only if the the extra isolation they provide was a benefit.

A: Unfortunately there is no such thing as an electronically controlled stepped switch. I recently tried to find exactly what you describe. Old telephone network "stepper switches" technically fit the description but in practice they are almost certainly not applicable to doing anything but routing telephone calls. The nearest practical alternative to a physical rotary switch that can be electronically controlled, would be a series of individual electronically controlled switches wired in an appropriate way. But the type of switch that must be used depends greatly on what precisely is being switched. If it is a current to power something like a motor, a series of solid state relays might be sufficient (or one of those old-school RC car speed controllers connected to a servo). If you are switching something like audio or small signals, you could use regular relays. Relay controlled stepped attenuators are popular DIY projects. But they are large, suffer from switching noises, expensive and generally crude. Depending on the load you might find an "analog switch" that is suitable. For example, Analog Deviecs make a number of analog switches that are relatively high performance. They have low on resistance, low on resistance flatness and support +-15V. Unfortunately, analog switches and solid state relays (analog switches are really just speciality solid state relays) have high junction capacitance that can be 100's of pF. It seems the lower the on resistance, the higher the capacitance. That might not sound like a lot but if you have 6 junctions with 100p capacitance on both the source and drain, that can easily alter audio flowing through the switch unless the load is like 1k. You would have to design the circuit around the switch. OTOH, if you're just trying to control some LEDs or something of that nature, then solid state relays would be overkill. You could just use regular transistors. If you care to elaborate on precisely what is being switched, you will probably get better answers.


text:
Q: How do I obtain log info from the installer? I have prepared a PXE-preseed-netinstall configuration for a cluster I am setting up. On all nodes, the install process works perfectly. But I have one node for which the installer freeze when installing the base system. I suspect a failure on disk (it is a hardware RAID, in fact).
Is there a way to store the logs of the install? This could maybe help to understand what is going on on that node...

A: The installer logs to /var/log/installer
I believe the mini.iso uses the debian-installer: See this page for more info on debugging the installer:

*

*https://www.debian.org/releases/stable/i386/ch06s01.html.en

*https://wiki.debian.org/DebianInstaller

*https://wiki.ubuntu.com/DebuggingUbiquity


text:
Q: Write new line to file with variable in Python I am trying to write a new line to a file after writing a variable. How do I do that?
Here's what I have but isn't working:
abc = "Test"
myfile.write(abc\n)

A: Try this:
abc = "Test"
myfile.write(f"{abc}\n")

A: You can to concatenate both strings, the one stored in the variable abc and "\n"
myfile.write(abc + "\n")

A: You may want to consider where the cursor is in your file_handle.
file_handle.write() will write from the beginning of the file if you've open(file, 'w') whereas file_handle.write() will add to the end (And is probably what you want) if you open(file, 'a'). Other than that, the \n in the other answers are also what you want.


text:
Q: Can you see my code? This is right? Delivery is not working. Please help me In next, my code:
Note: I have success when i send, but not trigger when the another mobile receiver.
So, i know only when my sms is sent, but i never know when my sms is delivered on another emulator.
I'm from Brazil, so sorry about the english. I'm still trying learn, laughs...
So, i hope you can help me, more next you can see my code.
My code:
private static final String SENT  = "SMS_SENT";
private static final String DELIVERED = "SMS_DELIVERED";

private void enviaMensagem(String numero, String texto, int id){
        try{
            ID_SMS = id;
            PendingIntent sendPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0);
            PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0);

        registerReceiver(new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                switch(getResultCode()){
                case Activity.RESULT_OK: atualizaStatus("Mensagem Enviada", "envio", ID_SMS);break;
                case SmsManager.RESULT_ERROR_GENERIC_FAILURE: atualizaStatus("Erro no envio da mensagem", "envio", ID_SMS); break;
                case SmsManager.RESULT_ERROR_NO_SERVICE: atualizaStatus("Sem serviço", "envio", ID_SMS); break;
                case SmsManager.RESULT_ERROR_NULL_PDU: atualizaStatus("ErroO de PDU", "envio", ID_SMS); break;
                }

            }
        }, new IntentFilter(SENT));

        registerReceiver(new BroadcastReceiver() {

            @Override
            public void onReceive(Context context, Intent intent) {
                switch(getResultCode()){
                case Activity.RESULT_OK:atualizaStatus("Mensagem entregue", "recebimento", ID_SMS);break;
                case Activity.RESULT_CANCELED:atualizaStatus("Mensagem não entregue", "recebimento", ID_SMS);break;
                }

            }
        }, new IntentFilter(DELIVERED));
        sMessage = SmsManager.getDefault();
        sMessage.sendTextMessage(numero, null, texto, sendPI, deliveredPI);
        txtStatus.setTextColor(Color.GREEN);
        txtStatus.setText("Mensagem enviada.");
        }
        catch(Exception ex){
            txtStatus.setTextColor(Color.BLUE);
            txtStatus.setText(ex.getMessage());
        }

    }

Thanks everybody for everything. Bye.

A: It looks like your intent filter might have the wrong action.  According to this site the action name is SMS_RECEIVED.


text:
Q: How to move the progress bar to the page bottom in Qualtrics? The original progress bar was at the page top in Qualtircs, I tried to move it to the center bottom of the page using .Skin #ProgressBar{position: absolute;bottom:10px;right:10px;left:10px}, It works for some pages but not for the ones which need to be scrolled down to see the whole page. From what I understand, the "bottom" means the relative end of a page but not the actual end, but I have no idea of how to change it to the actual end.

A: Change 'absolute' to 'fixed'.
.Skin #ProgressBar{position: fixed;bottom:10px;right:10px;left:10px}


text:
Q: Kafka configuration min.insync.replicas not working Its my early days in learning kafka. And I am checking out every kafka property/concept in my local machine.
So I came across this property min.insync.replicas and here is my understanding. Please correct me if I've misunderstood anything.

*

*Once a message is sent to a topic, the message must be written to at least min.insync.replicas number of followers.

*min.insync.replicas also includes the leader.

*If number of available live brokers( indirectly, in sync replicas )  are less than the specified min.insync.replicas , then producer will raise an exception failing to publish the message.

Following are the steps I followed to create the above scenario

*

*Started 3 brokers in local with broker Ids 0, 1 and 2

*created the topic insync and set min.insync.replicas to 2
using the following command

sudo ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic insync --config min.insync.replicas=2

*Describe the topic resulted in the following

Topic:insync  PartitionCount:1    ReplicationFactor:3 Configs:min.insync.replicas=2
    Topic: insync   Partition: 0    Leader: 2   Replicas: 2,0,1 Isr: 1,2,0

At this point, I made sure the property I've provided is picked by kafka

*I started sending messages and consuming them from terminal using following command
Producer: ./kafka-console-producer.sh --broker-list localhost:9092 --topic insync --producer.config ../config/producer.properties
Consumer:  ./kafka-console-consumer.sh --zookeeper localhost:2181 --topic insync
At this point, I was able to send and receive messages successfully.

*Bought down 2 brokers (0 and 2) and described the topic and resulted in following

Topic:insync  PartitionCount:1    ReplicationFactor:3 Configs:min.insync.replicas=2
    Topic: insync   Partition: 0    Leader: 1   Replicas: 2,0,1 Isr: 1

At this point, the In Sync Replicas are just 1(Isr: 1)
Then I tried to produce the message and it worked. I was able to send messages from console-producer and I could see those messages in console consumer.
My Kafka version: kafka_2.10-0.10.0.0
following are the producer properties:

bootstrap.servers=localhost:9092
compression.type=none
batch.size=20
acks=all

I expected the producer to fail with NotEnoughReplicasException as mentioned in this.

public class NotEnoughReplicasException
  extends RetriableException
Number of insync replicas for the partition is lower than >min.insync.replicas

but it worked normally.
Am I missing something? How can I create the scenario?
***************  EDIT  **********************
Instead of producing the messages from console producer, I tried to generate messages from java code. This time, I got the expected exception in the kafka broker. Although I expected it in the producer (java code). As this experiment is raising more questions, I've posted  another question.

A: is acks set to "all"? if not, try setting it to all

A: *

*I believe that error is for transactional producer, you may need to add this config:
transactional.id=TID-TEST

*if still not working, please check your replicator factor and min insync isr for the internal topic: __transaction_state


text:
Q: Immutable primitive types Why can't the following argument be made against the claim that primitive types are immutable in Javascript:
var $b = false;
$b = true;
alert($b); //-> true

I am misunderstanding what it means for a variable to immutable.

A: Values are immutable; variables are not.
$b = true changes $b to contain the true value.
The immutable false value is not changed.
Some languages support immutable variables as well (C++'s const, Java's final, or C#'s readonly); Javascript does not.

A: An immutable variable is one that can't be changed, like a constant.  Unfortunately, there are no true immutable variables in JavaScript (at least that I am aware of).
The closest you can get is by using a closure with a getter method.

A: Scope is mutable, true and false are not.
You just showed that scope is mutable, and nothing about whether or not true or false are mutable.


text:
Q: Exception during iteration on collection and remove items from that collection I remove item from ArrayList in foreach loop and get follwing exception.
Collection was modified; enumeration operation may not execute.
How can I remove items in foreach,
EDIT: There might be one item to remove or two or all.
Following is my code:
/*
 * Need to remove all items from 'attachementsFielPath' which does not exist in names array.
 */

try
{
    string attachmentFileNames = txtAttachment.Text.Trim(); // Textbox having file names.
    string[] names = attachmentFileNames.Split(new char[] { ';' });

    int index = 0;

    // attachmentsFilePath is ArrayList holding full path of fiels user selected at any time.
    foreach (var fullFilePath in attachmentsFilePath)
    {
        bool isNeedToRemove = true;

        // Extract filename from full path.
        string fileName = fullFilePath.ToString().Substring(fullFilePath.ToString().LastIndexOf('\\') + 1);

        for (int i = 0; i < names.Length; i++)
        {
        // If filename found in array then no need to check remaining items.
        if (fileName.Equals(names[i].Trim()))
        {
            isNeedToRemove = false;
            break;
        }
        }

        // If file not found in names array, remove it.
        if (isNeedToRemove)
        {
        attachmentsFilePath.RemoveAt(index);
        isNeedToRemove = true;
        }

        index++;
    }
}
catch (Exception ex)
{
    throw ex;
}

EDIT: Can you also advice on code. Do I need to break it into small methods and exception handling etc.
Invalid argument exception On creating generic list from ArrayList
foreach (var fullFilePath in new List<string>(attachmentsFilePath))

{

When I use List<ArrayList> the exception is
Argument '1': cannot convert from 'System.Collections.ArrayList' to 'int'
attachmentsFilePath  is declared like this
ArrayList attachmentsFilePath = new ArrayList();

But when I declared it like this, problem solved
List<ArrayList> attachmentsFilePath = new List<ArrayList>();

A: Another way of doing it, start from the end and delete the ones you want:
List<int> numbers = new int[] { 1, 2, 3, 4, 5, 6 }.ToList();
for (int i = numbers.Count - 1; i >= 0; i--)
{
    numbers.RemoveAt(i);
}

A: You can't remove an item from a collection while iterating over it.
You can find the index of the item that needs to be removed and remove it after iteration has finished.
int indexToRemove = 0;

// Iteration start

if (fileName.Equals(names[i].Trim()))
{
    indexToRemove = i;
    break;
}

// End of iteration

attachmentsFilePath.RemoveAt(indexToRemove);

If, however, you need to remove more than one item, iterate over a copy of the list:
foreach(string fullFilePath in new List<string>(attachmentsFilePath))
{
    // check and remove from _original_ list
}

A: You can iterate over a copy of the collection:
foreach(var fullFilePath in new ArrayList(attachmentsFilePath))
{
    // do stuff
}

A:     List<string> names = new List<string>() { "Jon", "Eric", "Me", "AnotherOne" };
    List<string> list = new List<string>() { "Person1", "Paerson2","Eric"};

    list.RemoveAll(x => !names.Any(y => y == x));
    list.ForEach(Console.WriteLine);

A: while enumerating (or using foreach) you cannot modify that collection. If you really want to remove items, then you can mark them and later remove them from list using its Remove method

A: do the following:
foreach (var fullFilePath in new List(attachmentsFilePath))
{

this way you create a copy of the original list to iterate through

A: You could loop over the collection to see which items need to be delete and store those indexes in a separate collection. Finally you would need to loop over the indexes to be deleted in reverse order and remove each from the original collection.
list<int> itemsToDelete

for(int i = 0; i < items.Count; i++)
{
    if(shouldBeDeleted(items[i]))
    {
        itemsToDelete.Add(i);
    }
}

foreach(int index in itemsToDelete.Reverse())
{
    items.RemoveAt(i);
}


text:
Q: How to know how many concurrent user using my application in php? I have a php web page, but I would like to show how many user is currently online....
How can I do so? Thank you.

A: Something to consider looking into is mod_status. It's an Apache module that creates a simple HTML page with details (one of which is number of active clients/requests). If you don't have access to a DB, or would prefer not to add the overhead of calling it each time the user requests a page, you could have PHP parse the status file created by mod_status for the number of active clients. For security, you might want to consider hiding the status file from normal users with some rewrite rules.

A: Counting the number of active sessions is probably the best way to do what you want.
You could use PHP's session_set_save_handler() function to set up some custom code that will run whenever a new user session is created or destroyed, and have that custom code maintain an application-scope variable that stores the current count of active sessions.
http://www.php.net/manual/en/function.session-set-save-handler.php
http://www.leosingleton.com/projects/code/phpapp/

A: The first two solutions would even be real-time. My preference would be number 2, because then I have most control. The order in which I would implement are 2, 1, 3, 4.
1) Hosted solution Pusher
The best solutions would be to use efficient transport(like for example long-polling or websockets) which can keep connection open. Sadly this has scaling problems when using PHP/Apache. Luckily you can use hosted solutions like Pusher. Pusher also offers a free plan, but has a concurrent connection limit of 20. This means you can not use this solution for free if you think you will have more than 20 concurrent users online at the same time. If not you could use presence events to detect number of users efficiently.
2) Host yourself using socket.io
Host it yourself using socket.io. For this you will need to compile node.js and redis and use redis client library. It would be pretty straightforward to implement this in socket.io. But keep in mind your count can be off if users open multiple tabs/windows to your page and you don't detect this. On connection event join room count for example just sent along session_id() which is unique per browser(session). You should store this session_id in your database. I would be using Redis because it is insane fast and easy to use. Store number inside redis set using sadd. If sadd returns 1 then you know that session does not yet have a connection. If not then there is already a connection to socket.io in different tab/window and you could just disconnect that connection. You should also get the number of session_ids using scard and sent them back to all connected users using socket.broadcast.to('count').send('<<< scard from redis >>>');
3) Use redis only
P.S: I am out of time, and would like to improve answer when I have some more time.
When not using efficient transport the number will be off a little bit. But this is how I would implement this. add session_id() to set using sadd. Also put time() in key with session_id() to keep track of when user connected. If I was more than take for example 3 minutes you know the session is not longer connected. To keep session live you post session_id() to server every two minutes. Be aware that if user opens more windows/tabs you will have to process more requests, but you could keep track of the number of open windows using cookies. You will also have to keep track of expired sessions and delete them.
4) Use your database(PDO)
Right now I am out of time to answer this, but will update this.

A: You'll have to save last visit of unique IP visitor. (If you would like to take it by IP)
After that, select everyone that last visited your site in past 100 seconds (example).
$query = "SELECT count(1) FROM unique_users WHERE last_click > ".(time() - 100);


text:
Q: Python build not seeing openssl/ssl.h in existing location (CentOS 7) I am attempting to build Python 3.10.5 on a CentOS 7 linux machine with the ssl module included. The python build succeeds but the ssl module fails to build.
Initially I was getting an error about python requiring OpenSSL >= 1.1.1, so I followed the instructions here to install OpenSSL 1.1.1c, and verified that the installation was successful:
$ which openssl
/usr/local/ssl/bin/openssl

$ openssl version
OpenSSL 1.1.1c  28 May 2019

To install Python 3.10.5 I followed the steps here, replacing 3.10.2 with 3.10.5. When I ran the step:
sudo ./configure --enable-optimizations

I discovered that it was using the default version of OpenSSL which doesn't meet the requirement. So then I tried running:
sudo ./configure --enable-optimizations --with-openssl="/usr/local/ssl/bin"

but then running sudo make altinstall revealed that the ssl and _ssl modules again failed to build. Going back to the output of the config command I noticed:
checking for openssl/ssl.h in /usr/local/ssl/bin... no

So then I tried running:
sudo ./configure --enable-optimizations --with-openssl="/usr/local/ssl/include"

because I confirmed that this is the location of openssl/ssl.h. However, the output still says:
checking for openssl/ssl.h in /usr/local/ssl/include... no

which is baffling because I confirmed that is where the file lives!
$ ll /usr/local/ssl/include/openssl/ssl.h
-rw-r--r-- 1 root root 111295 Oct 27 17:12 /usr/local/ssl/include/openssl/ssl.h

I've also tried running different variations of this command with slightly different paths in the --with-openssl argument, as well as including --with-openssl-rpath=auto and --with-openssl-rpath=/usr/local/ssl/lib, but it still fails to find openssl/ssl.h.
I saw another stackoverflow answer instruct to modify the file ~/Python-3.10.5/Modules/Setup
to uncomment and edit the lines:
OPENSSL=/usr/local/ssl/bin/openssl  # (Here I provided the path to my OPENSSL, which was set to some fake path before)
_ssl _ssl.c \
    -I$(OPENSSL)/include -L$(OPENSSL)/lib \
    -lssl -lcrypto

I did that, but still get the same error. Could the issue be related to the fact that ssl.h lives in /usr/local/ssl/include/openssl while the openssl binary lives in /usr/local/ssl/bin? I don't know enough to proceed from here, would really appreciate any help!


text:
Q: How to calculate distance between two latitude and longitude points? First of all while registering the futsal my system ask for location and saves latitude and longitude of that futsal in database.
And when user visits my system, it ask for user's location and saves latitude and longitude in session.
with the help of these futsal and user's latitude and location i want to calculate the distance between them in KM and show in the landing page.
I have tried
$lat = $request->session()->get("latitude");
$long = $request->session()->get("longitude");
$data['futsals'] = DB::table("users")
            ->where('is_futsal',1)
            ->select("*",
            DB::raw("6371  * acos(cos(radians(".$lat."))
            * cos(radians(users.latitude))
            * cos(radians(users.longitude) - radians(".$long."))
            + sin(radians(".$lat."))
            * sin(radians(users.latitude))) AS distance"))
            ->get();

It gives me distance but when ever i want to show the distance between user's and futsal the distance varies. I registered the futsal and login as a user from same place. which means the distance between them should be 0 but sometimes it gives me 0 also it gives me 1.9 km or 3.5 KM


text:
Q: Taglib 1.8 on windows 7 is not working properly like windows XP I compiled taglib 1.8 using Mingw succesfully, then i integrated it into a Qt project.
The purpuse is to remove ID3 Tag from mp3 files.
This code :
void MainWindow::removeTagFromFile(QByteArray &fileContent)
{
    TagLib::ByteVector byteVector(fileContent.constData());
    TagLib::ID3v2::FrameFactory *frame = TagLib::ID3v2::FrameFactory::instance();
    TagLib::IOStream *vectorStream = new TagLib::ByteVectorStream(byteVector);
    TagLib::MPEG::File file(vectorStream, frame);
    file.strip();
    file.save();
}

Compile and works fine on XP.
Compile and doesn't work as expected on Windows 7.
Taking the ".exe compiled on XP" to seven do not solve the problem.
is it weird ? i'm afraid that this is a bug in Taglib, does it make sense ?
Any idea or an explanation is welcome,
Thanks in advance.
You can download the project here
I'm writing a tutorial in french about details of compilation and integration into a Qt project, i'll write one in english if there is interested people.

A: Well, finally it's not question of XP or Seven, it's about codecs installed on your computer.
There is a simple solution, you don't need to remove ID3 Tag from mp3 files to get them readable by Phonon, you need just to install K-Lite Codecs.
Explanation :
Phonon backend use DirectShow on Windows to read mp3 files.
The K-Lite Codec Pack is a collection of DirectShow filters, VFW/ACM codecs, and tools. Codecs and DirectShow filters are needed for encoding and decoding audio and video formats.
installing K-Lite solve the problem of Phonon with some mp3 files.
I hope this will save someone out there who suffer from phonon with mp3 files on windows.


text:
Q: Index document to multiple indicies at once from logstash So I have no issues with indexing a record from logstash, however I want to be able to  index the same record to multiple indicies.
Currently in my logstash output i have this:
output{
     elasticsearch {
        hosts => ["myHost"]
        user => "myUser"
        password => "myPassword"
        cacert => "myCert.pem"
        index => "myIndex_primary"
        document_id => "12345"
        action => "update"
        doc_as_upsert => true
        manage_template => false
    }
}

Lets say I also wanted to save the same record to a 'secondary' index. Is this possible from the same elasticsearch or would have be forces to duplicate the entire elasticsearch call?
My thought would be something like:
output{
    elasticsearch {
        hosts => ["myHost"]
        user => "myUser"
        password => "myPassword"
        cacert => "myCert.pem"
        index => ["myIndex_primary", "myIndex_secondary"]
        document_id => "12345"
        action => "update"
        doc_as_upsert => true
        manage_template => false
   }
}

A: Yes, this is possible. You need to add another elasticsearch output to the configuration file. The index option expects a string, not an array.
So your pipeline's output section would look like this:
output{
    elasticsearch {
        hosts => ["myHost"]
        user => "myUser"
        password => "myPassword"
        cacert => "myCert.pem"
        index => "myIndex_primary"   <--- index 1
        document_id => "12345"
        action => "update"
        doc_as_upsert => true
        manage_template => false
   }

   elasticsearch {
        hosts => ["myHost"]
        user => "myUser"
        password => "myPassword"
        cacert => "myCert.pem"
        index => "myIndex_secondary"   <--- index 2
        document_id => "12345"
        action => "update"
        doc_as_upsert => true
        manage_template => false
   }
}

I hope I could help you.


text:
Q: Numpy Python/C API - PyArray_SimpleNewFromData hangs I'm figuring out the Python/C API for a more complex task. Initially, I wrote a simple example of adding two ndarrays of shape = (2,3) and type = float32.
I am able to pass two numpy arrays into c functions, read their dimensions and data and perform custom addion on data. But when I try to wrap the resulting data using PyArray_SimpleNewFromData, code hangs (returns NULL?)
To replicate the issue, create three files: mymath.c, setup.py, test.py in a folder as follows and run test.py (it runs setup.py to compile and install the module and then runs a simple test).
I'm using python in windows, inside an anaconda environment. I'm new to the Python/C API. So, any help would be much appreciated.

// mymath.c

#include <Python.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/npy_math.h"
#include <math.h>
#include <omp.h>

/*
  C functions
*/

float* arr_add(float* d1, float* d2, int M, int N){

  float * result = (float *) malloc(sizeof(float)*M*N);

  for (int m=0; m<M; m++)
    for (int n=0; n<N; n++)
      result [m*N+ n] = d1[m*N+ n] + d2[m*N+ n];

  return result;
}

/*
  Unwrap apply and wrap pyObjects
*/

void capsule_cleanup(PyObject *capsule) {
  void *memory = PyCapsule_GetPointer(capsule, NULL);
  free(memory);
}

// add two 2d arrays (float32)
static PyObject *arr_add_fn(PyObject *self, PyObject *args)
{
  PyArrayObject *arr1, *arr2;

  if (!PyArg_ParseTuple(args, "OO", &arr1, &arr2))
    return NULL;

  // get data as flat list
  float *d1, *d2;
  d1 = (float *) arr1->data;
  d2 = (float *) arr2->data;

  int M, N;
  M = (int)arr1->dimensions[0];
  N = (int)arr1->dimensions[1];

  printf("Dimensions, %d, %d \n\n", M,N);

  PyObject *result, *capsule;
  npy_intp dim[2];
  dim[0] = M;
  dim[1] = N;

  float * d3 = arr_add(d1, d2, M, N);

  result = PyArray_SimpleNewFromData(2, dim, NPY_FLOAT, (void *)d3);
  if (result == NULL)
    return NULL;

  // -----------This is not executed. code hangs--------------------
  for (int m=0; m<M; m++)
    for (int n=0; n<N; n++)
      printf("%f \n", d3[m*N+n]);

  capsule = PyCapsule_New(d3, NULL, capsule_cleanup);
  PyArray_SetBaseObject((PyArrayObject *) result, capsule);
  return result;
}

/*
  Bundle functions into module
*/

static PyMethodDef MyMethods [] ={
  {"arr_add", arr_add_fn, METH_VARARGS, "Array Add two numbers"},
  {NULL,NULL,0,NULL}
};

/*
  Create module
*/

static struct PyModuleDef mymathmodule = {
  PyModuleDef_HEAD_INIT,
  "mymath", "My doc of mymath", -1, MyMethods
};

PyMODINIT_FUNC PyInit_mymath(void){
  return PyModule_Create(&mymathmodule);
}

# setup.py

from distutils.core import setup, Extension
import numpy

module1 = Extension('mymath',
        sources = ['mymath.c'],
        # define_macros = [('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
        include_dirs=[numpy.get_include()],
        extra_compile_args = ['-fopenmp'],
        extra_link_args = ['-lgomp'])

setup (name = 'mymath',
        version = '1.0',
        description = 'My math',
        ext_modules = [module1])

# test.py

import os

os.system("python .\setup.py install")

import numpy as np
import mymath

a = np.arange(6,dtype=np.float32).reshape(2,3)
b = np.arange(6,dtype=np.float32).reshape(2,3)

c = mymath.arr_add(a,b)
print(c)


text:
Q: HTML encoding in SQL I have a requirement where I have to encode/decode a string having special characters or symbols in SQL to its HTML equivalent values.
Have tried with utl_i18n.escape_reference or utl_i18n.unescape_reference but it does not work for all characters or sysmbols. Below is such example:
select utl_i18n.escape_reference('REGIONS BANK Ó MORTGAGE Û') from dual;

Expected Output---- REGIONS BANK Ó MORTGAGE Û
Output Got --- REGIONS BANK Ó MORTGAGE Û
The unescape is working if i pass the text as
REGIONS BANK Ó MORTGAGE Û

Are there any other utilities that I can use for the same?

A: You asked:
Are there any other utilities that I can use for the same?
Answer: UTL_URL with it's escape and unescape functions.
Reference: Oracle DOCS
UTL_URL.escape provides output of REGIONS%20BANK%20%D3%20MORTGAGE%20%DB instead of what you have.
If you unescape the resulting value; you get your original REGIONS BANK Ó MORTGAGE Û back.
This function appears to be URL safe which I think is what you're after.
Your example keeps the space which I don't think is URL safe.
Example Script:
SELECT UTL_URL.escape('REGIONS BANK Ó MORTGAGE Û') as val FROM DUAL
UNION ALL
SELECT UTL_URL.unescape('REGIONS%20BANK%20%D3%20MORTGAGE%20%DB') as val FROM DUAL;

Gives us the expected/desired results:
REGIONS%20BANK%20%D3%20MORTGAGE%20%DB
REGIONS BANK Ó MORTGAGE Û


text:
Q: Adding text to textarea in the presence of many form submissions I am using AJAX to fetch some string from the server. For that purpose, I am using the ajax() function of jQuery. And after that I am adding the string to the textarea.
But my HTML (XHTML 1.0 specifically) is an old file to which I want to adapt to. Now this page has many JS functions like the following bounded to certain events like onclick and onchange, and this is what causes the value to be repeated in the textarea.
So if the data fetched is string then after all these submissions make it string string to be displayed in the form element.
function() {
    document.forms[0].action="MyServlet";
    document.forms[0].method="POST";
    document.forms[0].submit();

};

Is there any way I can make the AJAX to run this only once when the page is loaded? Here is what I am currently using,
(function() {

       $.ajax({
            type: "GET",
            url: "GetNarrative",
            dataType: "json",
            data: { datum : "<%=id %>" },
            success: function(data) {

                 var text_area = $("#narrative");
                 text_area.val(text_area.val() + data);

            }
        });

})();


text:
Q: Git pull doesnt work as expected ... which probably is because I use it wrong.
Szenario:
I have a local repository and a remote repository (named staging). Now I developed on my local repository and committed and pushed it to my remote repository. Then, on my REMOTE repository, I added a file "newfiletest". I expected that when I locally do "git pull staging master", it should download the "newfiletest" file, which it doesnt.
Hope you get it :P I'm kinda new to git.

A: So you did some work on your local repository and then you did
git add -A
git commit -m "Embrace my epic programming skills"

Then you decided you want to push it upstream to the remote so you did
git remote add <remote_name> <url>

and then
git push -u <remote_name> <branch>

Git will then asks you for your username and password for authentication reasons and poof! You pushed your stuff upstream.
Now then, you decide to make a new file (ex. .gitignore, readme.md etc.) on Git Hub. You do so and then run
git pull

This should fetch and merge your changes on top of your local repoistory

A: The problem is that unless you made a commit to your server, git will not be able to track that new file. Putting a file into the folder isn't enough, you need to make a commit too. I'm not sure if you can commit directly on a server, as I've never tried it, but I don't see why it wouldn't work. use git add and git commit on the server to make the new file a part of your repository.


text:
Q: Conditions under which eigenvalues of hermitian matrix are positive Under what conditions are the eigenvalues of a hermitian matrix positive?

A: For a hermitian matrix $A$, the following are equivalent:

*

*$\mbox{Spectrum}(A)\subseteq (0,+\infty)$.

*$(Ax,x)>0$ for every $x\neq 0$, i.e. $A$ is positive definite.

*There exists $B$ invertible such that $A=B^*B$ (which also implies that $A$ is hermitian).


text:
Q: Should current Python projects list `<4` in `python_requires` (setup.py) or not? I've made a couple of PRs in some projects I'm involved with adding a python_requires to their setup.py (as per packaging.python.org/guides/dropping-older-python-versions/).
One question that's come up is whether it's a good idea to include <4 in this statement or not.
On one hand, there's no guarantee that the code will work on Python 4 whenever it comes out (years in the future, probably), but maybe it's also overspecification and would better be left out and added in once Py4 is actually a thing that is even being considered?
I've tried searching for this (including on SO :)), but I'm not getting any good results. Are there are mailing list threads or something that I didn't find that discusses best practices for this? sampleproject includes <4 but didn't seem to actually discuss this in the related PR, the packaging.python.org documentation for setup_requires has examples both with and without the <4 but doesn't really describe (as far as I can tell) when to include it or not.

A:
maybe it's also overspecification and would better be left out and added in once Py4 is actually a thing that is even being considered?

Exactly!
The core developers hasn't even started to discuss Python 4, not to say about planning or implementing. They also promised not to break things the way they did with 2-to-3 transition.
With such a distant future and backward compatibility promise it's simply too early to protect yourself from unknown and unplanned breakage. Wait at least until the core developers start to discuss Python 4.


text:
Q: Lenovo X220 reboots instead of shutting down When I push the shutdown button in the shutdown dialog my notebook (Lenovo X220) does a restart instead.
I also tried running the "sudo shutdown -P now" from command line -> same result!
Before upgrading to 11.10 everything was fine.
Anybody else experiences this malfunction? Any tips to make it work again?

A: I'm here on Xubuntu 11.10 with an x220 i5 and experienced the same issue.
Installing laptop-mode-tools (with aptitude install laptop-mode-tools --without-recommends) fixed it for me.
(found the hint via https://answers.launchpad.net/ubuntu/+source/acpi/+question/168617)
I came up with another solution that does not involve laptop-mode-tools. Maybe it works for others.
The problem seems to occur when power-management for PCI(e) devices is enabled (set to "auto").
Here are two ways to check that:

*

*run powertop, switch to the "Tunables" tab and see if your "Runtime PM for PCI*" entries are marked as "Good"

*cat /sys/bus/pci/devices/*/power/control and see if it outputs some "auto" values.
"auto" causes the shutdown problems on my machine while "on" does not.

I created an init.d script to handle that (and other stuff like setting battery charge threshs and the like), available via pastebin.
Note:

*

*The script runs fine on my machine. This does not mean it will run on others due to missing programs, etc.

*The script does more than (potentially) circumventing the shutdown problem, so please read it first.

*I am not sure that "auto" brings any benefit at all ;)

Hope it helps.

A: I have laptop-mode-tools installed but the problem occurs anyway. Oneiric with gnome/unity, on an i7 x220. Happens whether I do sudo shutdown -h now or shutdown via the gui. My only workaround is to hold the power button after reboot.


text:
Q: Create Form dropdown list with input amount value I ask for help or suggestions for the form I made:
Template Design:

I want to create a form where the item list can select the available items in the drop down and then give it the amount used.
then there is an add button to add another item.
i am confused how to make html form and javascript / ajax for this design

A: You can replicate the components and remove components by using JavaScript's onclick event and Nodes.

var counter = 0;

document.getElementById('moreFields').onclick = moreFields;

function moreFields() {
    counter++;
    var newFields = document.getElementById('readroot').cloneNode(true);
    newFields.id = '';
    newFields.style.display = 'block';
    var newField = newFields.childNodes;
    for (var i=0;i<newField.length;i++) {
        var theName = newField[i].name
        if (theName)
            newField[i].name = theName + counter;
    }
    var insertHere = document.getElementById('writeroot');
    insertHere.parentNode.insertBefore(newFields,insertHere);
}

window.onload = moreFields;

    <input type="button" value="x"
        onclick="this.parentNode.parentNode.removeChild(this.parentNode);" />

    <input name="amount" value="title" />

    <select name="items">
        <option>Items</option>
        <option value="cable">Cable</option>
        <option value="rj45">rRJ45</option>
    </select>

  <select name="type">
        <option>type</option>
        <option value="m">Cable</option>
        <option value="pcs">pcs</option>
    </select>

<form method="post" action="/cgi-bin/show_params.cgi">

    <input type="button" id="moreFields" value="Add more" />

</form>

When you click the "Add more" button, it will trigger the moreFields(). Inside that function, it keeps a count of the rows that currently created by using the counter variable. Then it creates a copy of the elements inside the element ID: readroot and append it to the element Section with ID: writeroot.
When you click the button with "x" value, it will trigger a removeChild() function and removes the row connected to the "x" button.
References: Click Here


text:
Q: After modifying string (char*) in a function the value won't show unless printed inside function #include <stdio.h>
#include <string.h>
void increase(char **tab)
{
    int i=strlen(*tab);
    int o=i;
    while((*tab)[i]!='5' && i>=0)
    {
        i--;
    }
    if(i>=0)
    {
        int tt;
        char array[o+1];
        for(tt=0;tt<o;tt++)
        {
            if(tt!=i)
            array[tt]=(*tab)[tt];
            else
            array[tt]='6';
        }
        array[o]='\0';
        *tab=array;
    //  printf("\n%s",*tab);
    }
    else
    {
        char array[o+2];
        int tt;
        for(tt=0;tt<=o;tt++)
        {
            array[tt]='5';
        }
        array[o+1]='\0';
        *tab=array;
    //  printf("\n%s",*tab);
    }
}
int main()
{
    int n;
    char *test;
    test="555";
    increase(&test);
    printf("\n%s",test);

    return 0;
}

Okay, so increase() is meant to replace number in test with the next number containing only 5 and 6.
What I wanted to do is to change the value of test directly by using pointer to char*. Everything seems to work just fine untill it comes to displaying changed value - it simply won't show unless was asked to do it inside the
increase() function. Once I add
printf("\n%s",*tab);

inside any of conditions (commented), everything works just fine (excluding showing a double result).
What causes a problem here?
555 is just a testing value, actually any number made of 5s or 6s will do the work.

A: Lines like *tab=array; cause a problem, given that array is a local variable that goes out of scope when its enclosing block ends. In main(), test now points to memory that's invalid, and trying to use it is undefined behavior.


text:
Q: JavaScript I/O using cmd I want to take input in javascript program using cmd, as I am executing the js program using node through cmd, So how can I do it?

A: Short Answer: Use readline (built-in nodejs module)
Long Answer:
According to this blog
Streams are the Node.js way of dealing with evented I/O - it's a big topic, and you can read more about them here. For now, we're going to use the built-in readline module which is a wrapper around Standard I/O, suitable for taking user input from command line(terminal).
Here's a simple example. Try the following in a new file:
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question("What is your name ? ", function(name) {
    rl.question("Where do you live ? ", function(country) {
        console.log(`${name}, is a citizen of ${country}`);
        rl.close();
    });
});

rl.on("close", function() {
    console.log("\nBYE BYE !!!");
    process.exit(0);
});


text:
Q: Is the derivative of a bump function still a bump function? My question is rather simple : are derivatives of bump functions still bump functions ?
For example, for a bump function $u\in D(\mathbb{R}^d)$, that is,
$$u \in C^\infty|\;\text{supp}\;u\subseteq K : \mathbb{R}^d \to \mathbb{R}$$
Is this always true for all derivatives?
$$\frac{\partial u}{\partial x_j} \in D(\mathbb{R}^d)$$
I'm sure it is and couldn't imagine the contrary but I have an unexplainable doubt.

A: Yes, because, obviously, $\operatorname{supp}\partial u/\partial x_j\subset\operatorname{supp}u$.


text:
Q: Django form wizard: how do you specify views that form a loop? I'm trying to create a form wizard in Django where the second view points back to the first view, and the only way to exit the loop is by clicking a "Finish" button on the second view. Is there any way to do this?
For example:
from django import forms

class ContactForm1(forms.Form):
    subject = forms.CharField(max_length=100)
    sender = forms.EmailField()

class ContactForm2(forms.Form):
    message = forms.CharField(widget=forms.Textarea)

I would like the next view after ContactForm2 to be ContactForm1, and when you click a "Finish" button on the second view, you complete the form.
Any help will be appreciated.
Thanks in advance!


text:
Q: WCF REST Upload Azure Blob I have created a WCF REst web service with C# where i'm trying to upload a blob in the local Azure Storage Account. I created a FileUpload control and a button so that i can choose the file to be uploaded, but i am unable to upload..
Here's my code:
    public class Service : IService
   {
    [WebInvoke(Method = "POST", UriTemplate = "Upload", ResponseFormat =
        WebMessageFormat.Json)]
    public void Upload(string path)
    {
        // Retrieve storage account from connection string.
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnection"));

        // Create the blob client.
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

        //Get the reference of the container in which the blobs are stored
        CloudBlobContainer container = blobClient.GetContainerReference("upload");

        //Set the name of the uploaded document to a unique name
        string docName = "Document_" + Guid.NewGuid().ToString() + ".txt";

        //Get the blob reference and set its metadata properties
        CloudBlockBlob blockBlob = container.GetBlockBlobReference(docName);

        using (var fileStream = System.IO.File.OpenRead(path))
        {
            blockBlob.UploadFromStream(fileStream);
        }

    }

Then in my web form, i have the following design:

    <form id="form1" runat="server">

        <asp:FileUpload ID="uplFileUpload" runat="server" />

        <asp:Button ID="btnUpload" runat="server" Text="Upload"
            onclick="btnUpload_Click" />

        <asp:Button ID="btnDisplayBlobs" runat="server" Text="Display Blobs"
            onclick="btnDisplayBlobs_Click" />

            <asp:Label ID="lblURIs" runat="server" Text=""></asp:Label>

    </form>

And finally here's the code for when i click my button:
public partial class WebClient : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnUpload_Click(object sender, EventArgs e)
    {
        Service blob = new Service();

        if (uplFileUpload.HasFile)
        {
            blob.Upload(uplFileUpload.PostedFile.FileName);
        }
    }

This is the error i get:

A: You are mixing classic asp.net and a rest service. In you code you do a not to a asp.net form and then call in the serverside code a rest service. You need to handle the post in your asp.net code, or do a call to you rest service by posting the file there. The filename you have as entry point to you rest service will definitely not work because you are getting the file from you local service drive by referencing the path: System.IO.File.OpenRead(path) of the calling party. This will only work if you do a call locally (localhost).


text:
Q: Google+ Sign in error in android I'm trying to add Google+ sign in button to my android app, and I moved step by step on what written here: https://developers.google.com/+/mobile/android/sign-in
and here: https://developers.google.com/+/mobile/android/getting-started
But no matter what I did, the sign-in process always failed and the error that I get is "UNKNOWN_ERROR_CODE" (17).
The onConnected function never called, just the onConnectionFailed.

A: You might want to try checking whether it's your code and not the console configuration by getting the Google Sign-in Android Quickstart sample app working.
Make sure that you have configured your developer console to have a developer email setup as described in step 4 of part 1 of the Android getting started instructions.
Update:
Double, triple, and quadruple check that you have selected an email from the consent screen:

Even if you have one email address, you must select an email address and configure the consent screen or else you will get this one weird code.
99% of the time, these issues are caused by misconfiguration of the Google API console, so you might want to try using the new json-based configuration described at https://developers.google.com/mobile/add


text:
Q: Sharepoint Designer 2010: Is it possible to customize the field types under "Collect Data From User" in the WF I'm trying something that should be included in the default SPD behavior but is not: in the workflow, on the Collect Data from User Action, I would like to be able to upload files to the list.  Out of the box, SPD 2010 only supports basic types, lookups, and hyperlinks.  Is there a way to customize SPD to include Upload File type?
Digging a little deeper into \14\TEMPLATE\1033\Workflow\WSS.Actions, we see that the "Collect User Data" uses the Survey template for data collection.  Does that mean that we have to modify/create a new template? or do we have to create a new column type?
Thanks,
Alex

A: It will not be possible just extending the "Collect Data from User" action with your custom column types (or different column types than already offered).
You will have to create your own "Collect Data from User" action and include an upload functionality like that. Some pointers to get you started creating your own Sharepoint Designer Workflow Actions:

*

*Adding Custom Actions in SharePoint Designer 2010

*Extending SharePoint Designer Workflow with Custom Actions


text:
Q: форматированный вывод double double d = 1000000000000000000;
Нужно чтобы на экран вывелось это число именно в таком виде без плавающей точки.
A: С++ стиль:
std::cout.setf(std::ios::fixed);
std::cout.precision(0); //0 - число символов после точки
std::cout << d;

C стиль:
printf("%.0lf",d);  //%.Klf - K - число символов после точки, в данном случае 0


text:
Q: Issue with solr memory usage I'm having memory problems with a Solr slave instance.
The problem is that every time the slave replicates new changes from the master, the slave starts a new searcher, and apparently the old one isn't released.
Eventually the young collection is full, and it spills into the old collection (or at least that's how it appears), and it starts to do constant full garbage collections. It doesn't appear to actually be able to free any noticeable memory at this point. The full garbage collections can cause searches that usually take a few milliseconds to execute, to take up to ½-4 seconds in spikes around every 10 seconds.
And again, at some point, even the old generation is full, and then it either stops everything, and manages to free some memory, or it just appear to lock up completely, apparently never to go back to being functional.
Some system info :
The machine is an Amazon AWS m1.medium machine:
3.7GB memory
20GB HDD space
1 CPU core
2 ECU (1 ECU is the equivalent CPU capacity of a 1.0-1.2 GHz 2007 Opteron or 2007 Xeon processor).
OS : Ubuntu 12.10
Java :
java version "1.7.0_09"
OpenJDK Runtime Environment (IcedTea7 2.3.3) (7u9-2.3.3-0ubuntu1~12.10.1)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
Java servlet : Tomcat 7
Solr : 4.0
Tomcat startup parameters :
-Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp
-Dcatalina.home=/usr/share/tomcat7
-Dcatalina.base=/var/lib/tomcat7
-Djava.endorsed.dirs=/usr/share/tomcat7/endorsed
-javaagent:/spm/spm-monitor/lib/spm-monitor-solr-1.8.0-withdeps.jar=/spm/spm-monitor/conf/spm-monitor-config-[snip]-default.xml
-Dcom.sun.management.jmxremote
-Xloggc:/var/log/tomcat7/GCLog.txt
-XX:+PrintGCDetails
-XX:NewSize=500M
-Xmx3G
-Xms3G
-Dsolr.solr.home=/data/solr
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-XX:+UseConcMarkSweepGC
-Xmx128m
-Djava.awt.headless=true
-Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties

the spm-monitor thing is a monitoring system from SemaText.
Solr has 4 cores, 1 for each of 4 countries, and contain product information. 3 of the cores have a small amount of documents in them, but the 4th has around 470k documents in it. That core's index currently takes up 843MB.
Here's my solrconfig.xml : http://pastebin.com/c5vHKgMF
And my schema.xml : http://pastebin.com/tFA4bmT5
I use pastebin because otherwise this post would be too big.
Here's how an output of jstat -gc [pid] 2s looks for various events :
When solr starts, it runs fine and all queries are taking normal amount of time :
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT
51200.0 51200.0 51200.0  0.0   409600.0 49393.0  2633728.0   751578.5  24896.0 24736.6      4    7.271   0      0.000    7.271
51200.0 51200.0 51200.0 51200.0 409600.0 409600.0 2633728.0   968965.2  24896.0 24826.1      5    7.271   0      0.000    7.271
51200.0 51200.0  0.0   51200.0 409600.0 392671.8 2633728.0  1082530.8  27584.0 27504.1      5   10.459   0      0.000   10.459
51200.0 51200.0 51200.0 51200.0 409600.0 409600.0 2633728.0  1249210.0  27776.0 27578.9      7   11.822   0      0.000   11.822
51200.0 51200.0 51200.0  0.0   409600.0 90674.5  2633728.0  1484383.0  27776.0 27676.6      8   14.380   1      0.064   14.444
51200.0 51200.0 51200.0  0.0   409600.0 333155.3 2633728.0  1484383.0  28544.0 28450.1      8   14.380   1      0.064   14.444
51200.0 51200.0 51200.0  0.0   409600.0 335203.3 2633728.0  1484383.0  28544.0 28453.7      8   14.380   1      0.064   14.444
51200.0 51200.0 51200.0  0.0   409600.0 337251.4 2633728.0  1269719.9  47424.0 28459.8      8   14.380   2      0.542   14.922
51200.0 51200.0  0.0   51200.0 409600.0  1515.0  2633728.0  1347052.7  47424.0 28557.9      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 96780.5  2633728.0  1347052.7  47424.0 28634.0      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 103202.9 2633728.0  1347052.7  47424.0 28666.7      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 103203.1 2633728.0  1347052.7  47424.0 28666.7      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 109626.5 2633728.0  1347052.7  47424.0 28668.5      9   15.025   2      0.542   15.567

This is the first replication. Full GC's start to happen often after the replication, causing ½-4 seconds pauses in searches :
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT
51200.0 51200.0  0.0   51200.0 409600.0 181746.1 2633728.0  1347052.7  47424.0 28745.4      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 181746.3 2633728.0  1347052.7  47424.0 28745.4      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 186884.2 2633728.0  1347052.7  47424.0 28746.4      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 186884.3 2633728.0  1347052.7  47424.0 28746.4      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 217818.1 2633728.0  1347052.7  47424.0 28754.1      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 217818.3 2633728.0  1347052.7  47424.0 28754.1      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 222957.2 2633728.0  1347052.7  47424.0 28754.8      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 222957.3 2633728.0  1347052.7  47424.0 28754.8      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 229379.7 2633728.0  1347052.7  47424.0 28756.3      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 265260.5 2633728.0  1347052.7  47424.0 30313.9      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 298923.2 2633728.0  1347052.7  47424.0 31046.5      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 301654.4 2633728.0  1347052.7  47424.0 31048.7      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 312181.6 2633728.0  1347052.7  47424.0 31051.6      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 314912.8 2633728.0  1347052.7  47424.0 31051.6      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 324156.0 2633728.0  1347052.7  47424.0 31160.7      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 329617.6 2633728.0  1347052.7  47424.0 31299.6      9   15.025   2      0.542   15.567
51200.0 51200.0  0.0   51200.0 409600.0 361996.8 2633728.0  1347052.7  47424.0 31382.4      9   15.025   2      0.542   15.567
51200.0 51200.0 30088.6  0.0   409600.0 217328.7 2633728.0  1398099.4  47424.0 32633.0     10   15.316   2      0.542   15.858
51200.0 51200.0 51200.0 51200.0 409600.0 409600.0 2633728.0  1843888.2  47424.0 32853.0     12   16.800   2      0.542   17.342
51200.0 51200.0 51200.0 51200.0 409600.0 409600.0 2633728.0  2049137.6  47424.0 32864.9     13   19.310   3      0.628   19.938
51200.0 51200.0  0.0   51200.0 409600.0 334292.6 2633728.0  2202213.0  47424.0 32873.8     13   22.241   3      0.628   22.869
51200.0 51200.0 51200.0 51200.0 409600.0 409600.0 2633728.0  2391020.4  47424.0 32876.1     14   22.241   3      0.628   22.869
51200.0 51200.0 51200.0  0.0   409600.0 72530.9  2633728.0  2544393.5  47424.0 32892.1     14   26.071   3      0.628   26.699
51200.0 51200.0 51200.0  0.0   409600.0 84458.3  2633728.0  2520856.9  54832.0 32898.3     14   26.071   5      0.883   26.954
51200.0 51200.0 51200.0  0.0   409600.0 90076.2  2633728.0  2520856.9  54832.0 32899.5     14   26.071   5      1.139   27.210
51200.0 51200.0 51200.0  0.0   409600.0 93651.1  2633728.0  2426346.3  55024.0 32899.9     14   26.071   6      1.387   27.458
51200.0 51200.0 51200.0  0.0   409600.0 102844.1 2633728.0  2426346.3  55024.0 32899.9     14   26.071   7      1.643   27.714
51200.0 51200.0 51200.0  0.0   409600.0 103739.1 2633728.0  2426346.3  55024.0 32901.0     14   26.071   7      1.643   27.714
51200.0 51200.0 51200.0  0.0   409600.0 133067.1 2633728.0  2426242.2  55024.0 32904.8     14   26.071   8      1.899   27.970
51200.0 51200.0 51200.0  0.0   409600.0 133946.5 2633728.0  2426227.6  55024.0 32904.9     14   26.071   9      2.175   28.245
51200.0 51200.0 51200.0  0.0   409600.0 139729.7 2633728.0  2426227.6  55024.0 32907.3     14   26.071   9      2.175   28.245
51200.0 51200.0 51200.0  0.0   409600.0 140141.2 2633728.0  2426227.6  55024.0 32907.3     14   26.071  10      2.175   28.245
51200.0 51200.0 51200.0  0.0   409600.0 146923.3 2633728.0  2426226.6  55024.0 32909.0     14   26.071  11      2.761   28.831
51200.0 51200.0 51200.0  0.0   409600.0 148190.4 2633728.0  2426226.6  55024.0 32909.3     14   26.071  11      2.761   28.831
51200.0 51200.0 51200.0  0.0   409600.0 162871.6 2633728.0  2426176.5  55024.0 32912.4     14   26.071  12      3.062   29.132
51200.0 51200.0 51200.0  0.0   409600.0 164115.7 2633728.0  2426176.5  55024.0 32912.4     14   26.071  13      3.375   29.445
51200.0 51200.0 51200.0  0.0   409600.0 169801.3 2633728.0  2426167.1  55024.0 32912.6     14   26.071  14      3.677   29.747
51200.0 51200.0 51200.0  0.0   409600.0 170464.9 2633728.0  2426167.0  55024.0 32913.0     14   26.071  15      3.978   30.048
51200.0 51200.0 51200.0  0.0   409600.0 176939.4 2633728.0  2426167.0  55024.0 32913.3     14   26.071  16      4.292   30.363
51200.0 51200.0 51200.0  0.0   409600.0 177982.8 2633728.0  2426167.0  55024.0 32916.8     14   26.071  17      4.602   30.673
51200.0 51200.0 51200.0  0.0   409600.0 207087.6 2633728.0  2426167.0  55024.0 32919.0     14   26.071  18      4.952   31.022
51200.0 51200.0 51200.0  0.0   409600.0 207915.5 2633728.0  2426167.0  55024.0 32920.0     14   26.071  19      5.289   31.359
51200.0 51200.0 51200.0  0.0   409600.0 213503.3 2633728.0  2426167.0  55024.0 32922.7     14   26.071  20      5.641   31.711
51200.0 51200.0 51200.0  0.0   409600.0 214918.9 2633728.0  2426167.0  55024.0 32922.9     14   26.071  21      6.053   32.124
51200.0 51200.0 51200.0  0.0   409600.0 221854.4 2633728.0  2426167.0  55024.0 32922.9     14   26.071  21      6.053   32.124
51200.0 51200.0 51200.0  0.0   409600.0 222649.1 2633728.0  2426167.0  55024.0 32922.9     14   26.071  23      6.763   32.834
51200.0 51200.0 51200.0  0.0   409600.0 228783.4 2633728.0  2426167.0  55024.0 32923.9     14   26.071  23      6.763   32.834
51200.0 51200.0 51200.0  0.0   409600.0 229735.2 2633728.0  2426149.5  55024.0 32924.7     14   26.071  25      7.521   33.591
51200.0 51200.0 51200.0  0.0   409600.0 235296.9 2633728.0  2426149.5  55024.0 32925.6     14   26.071  25      7.521   33.591
51200.0 51200.0 51200.0  0.0   409600.0 236130.0 2633728.0  2426149.4  55024.0 32925.6     14   26.071  27      8.260   34.331
51200.0 51200.0 51200.0  0.0   409600.0 243076.6 2633728.0  2426149.4  55024.0 32925.6     14   26.071  27      8.260   34.331
51200.0 51200.0 51200.0  0.0   409600.0 243960.8 2633728.0  2426149.4  55024.0 32926.3     14   26.071  29      9.029   35.100
51200.0 51200.0 51200.0  0.0   409600.0 273105.0 2633728.0  2426149.4  55024.0 32930.8     14   26.071  29      9.029   35.100
51200.0 51200.0 51200.0  0.0   409600.0 274353.8 2633728.0  2425918.4  55024.0 32932.0     14   26.071  31      9.436   35.507
51200.0 51200.0 51200.0  0.0   409600.0 279947.9 2633728.0  2425918.4  55024.0 32932.1     14   26.071  31      9.842   35.913
51200.0 51200.0 51200.0  0.0   409600.0 280804.8 2633728.0  2425853.6  55024.0 32932.1     14   26.071  32     10.258   36.329
51200.0 51200.0 51200.0  0.0   409600.0 288224.7 2633728.0  2425853.6  55024.0 32932.1     14   26.071  33     10.669   36.740
51200.0 51200.0 51200.0  0.0   409600.0 288924.5 2633728.0  2425801.3  55024.0 32932.1     14   26.071  34     11.086   37.157
51200.0 51200.0 51200.0  0.0   409600.0 294579.7 2633728.0  2425801.3  55024.0 32932.1     14   26.071  35     11.496   37.567
51200.0 51200.0 51200.0  0.0   409600.0 295011.3 2633728.0  2425756.8  55024.0 32932.3     14   26.071  36     11.937   38.007
51200.0 51200.0 51200.0  0.0   409600.0 300928.6 2633728.0  2425749.2  55024.0 32932.3     14   26.071  37     12.364   38.434
51200.0 51200.0 51200.0  0.0   409600.0 302173.1 2633728.0  2425749.2  55024.0 32932.3     14   26.071  38     12.794   38.865
51200.0 51200.0 51200.0  0.0   409600.0 309040.9 2633728.0  2425748.9  55024.0 32932.7     14   26.071  39     13.221   39.291
51200.0 51200.0 51200.0  0.0   409600.0 309776.0 2633728.0  2425748.9  55024.0 32932.7     14   26.071  40     13.221   39.291
51200.0 51200.0 51200.0  0.0   409600.0 338791.4 2633728.0  2425748.9  55024.0 32937.5     14   26.071  41     14.111   40.182
51200.0 51200.0 51200.0  0.0   409600.0 339363.3 2633728.0  2425748.9  55024.0 32937.5     14   26.071  41     14.111   40.182

And this is the second replication where everything almost locks up. At this point, all queries take at least 30 seconds :
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       PC     PU    YGC     YGCT    FGC    FGCT     GCT
51200.0 51200.0  0.0    0.0   409600.0 104445.7 2633728.0  2264909.9  55024.0 32909.4     15   26.071  68     33.808   59.879
51200.0 51200.0  0.0    0.0   409600.0 131077.9 2633728.0  2264909.9  55024.0 32912.0     15   26.071  69     33.902   59.973
51200.0 51200.0  0.0    0.0   409600.0 131078.1 2633728.0  2264909.9  55024.0 32912.0     15   26.071  69     33.902   59.973
51200.0 51200.0  0.0   51200.0 409600.0   0.0    2633728.0  2313467.9  55024.0 32925.0     16   26.533  70     34.030   60.563
51200.0 51200.0 51200.0  0.0   409600.0 272264.2 2633728.0  2621778.0  55024.0 32925.4     17   28.589  71     34.113   62.702
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2621778.0  55024.0 32925.7     18   28.589  72     34.113   62.702
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2621778.0  55024.0 32925.7     18   28.589  72     34.113   62.702
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2621778.0  55024.0 32925.7     18   28.589  72     34.113   62.702
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2621778.0  55024.0 32925.7     18   28.589  72     34.113   62.702
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32929.0     18   28.589  74     56.386   84.975
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32929.0     18   28.589  74     56.386   84.975
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32929.0     18   28.589  74     56.386   84.975
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32929.0     18   28.589  74     56.386   84.975
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32929.0     18   28.589  74     56.386   84.975
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  76     80.943  109.532
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  76     80.943  109.532
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  76     80.943  109.532
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  76     80.943  109.532
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  76     80.943  109.532
51200.0 51200.0 24901.3  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.0     18   28.589  77    105.639  134.229
51200.0 51200.0 51199.5  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.2     18   28.589  78    106.270  134.859
51200.0 51200.0 51199.5  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.2     18   28.589  78    106.270  134.859
51200.0 51200.0 51199.5  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.2     18   28.589  78    106.270  134.859
51200.0 51200.0 51199.5  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.2     18   28.589  78    106.270  134.859
51200.0 51200.0 37977.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32935.7     18   28.589  79    130.681  159.270
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  80    131.342  159.932
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  80    131.342  159.932
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  80    131.342  159.932
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  80    131.342  159.932
51200.0 51200.0 44939.3  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  81    155.284  183.874
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  82    155.957  184.547
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  82    155.957  184.547
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  82    155.957  184.547
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  82    155.957  184.547
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  82    155.957  184.547
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  84    181.848  210.437
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  84    181.848  210.437
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  84    181.848  210.437
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32936.2     18   28.589  84    181.848  210.437
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32922.9     18   28.589  84    181.848  210.437
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32922.9     18   28.589  85    206.950  235.539
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32922.9     18   28.589  85    206.950  235.539
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32922.9     18   28.589  85    206.950  235.539
51200.0 51200.0 51109.1  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32919.2     18   28.589  86    224.879  253.469
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32919.2     18   28.589  87    225.545  254.135
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32919.2     18   28.589  87    225.545  254.135
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32919.2     18   28.589  87    225.545  254.135
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32919.2     18   28.589  87    225.545  254.135
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32914.3     18   28.589  87    225.545  254.135
51200.0 51200.0 51194.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32914.5     18   28.589  88    250.623  279.213
51200.0 51200.0 51194.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32914.5     18   28.589  88    250.623  279.213
51200.0 51200.0 51194.9  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  88    250.623  279.213
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.1     18   28.589  89    266.103  294.693
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.1     18   28.589  89    266.103  294.693
51200.0 51200.0 51200.0  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.1     18   28.589  89    266.103  294.693
51200.0 51200.0 51184.2  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  91    284.683  313.272
51200.0 51200.0 51184.2  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  91    284.683  313.272
51200.0 51200.0 51184.2  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  91    284.683  313.272
51200.0 51200.0 51184.2  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  91    284.683  313.272
51200.0 51200.0 51184.2  0.0   409600.0 409600.0 2633728.0  2633727.9  55024.0 32901.1     18   28.589  91    284.683  313.272
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.3     18   28.589  92    309.958  338.547
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.3     18   28.589  92    309.958  338.547
51200.0 51200.0 51199.9  0.0   409600.0 409600.0 2633728.0  2633728.0  55024.0 32901.3     18   28.589  92    309.958  338.547

An output of jstat -gccause [pid] shows the following :
  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
100.00   0.00 100.00 100.00  59.79     18   28.589    94  327.704  356.293 Allocation Failure   Allocation Failure

I also have a dump of the heap from one of the times where it stopped being able to even respond to searches, so if anyone wants some output from jhat i can supply that.
Does anyone have any idea why solr/tomcat/java is doing this? I can replicate it consistently, so if you need more debugging info, i can supply that as well.

A: -Xmx3G
-Xms3G
-Dsolr.solr.home=/data/solr
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-XX:+UseConcMarkSweepGC
-Xmx128m
Why do you have two max heap settings? Was it a copy paste error? Or is it the way your tomcat is configured? Also please see if you  can reduce the min heap to 512M or 1G. Same size of min and max heap is generally not encouraged.


text:
Q: Real-world examples where C# 'out' parameters are useful? I'm reading up on core C# programming constructs and having a hard time wrapping my head around the out parameter modifier. I know what it does by reading but am trying to think of a scenerio when I would use it.
Can someone give me a real-world example? Thanks.

A: Sure, take a look at any of the TryParse methods, such as int.TryParse:
The idea is you actually want two pieces of information: whether a parse operation was successful (the return value), and, if so, what the result of it actually was (the out parameter).
Usage:
string input = Console.ReadLine();
int value;

// First we check the return value, which is a bool
// indicating success or failure.
if (int.TryParse(input, out value))
{
    // On success, we also use the value that was parsed.
    Console.WriteLine(
        "You entered the number {0}, which is {1}.",
        value,
        value % 2 == 0 ? "even" : "odd"
    );
}
else
{
    // Generally, on failure, the value of an out parameter
    // will simply be the default value for the parameter's
    // type (e.g., default(int) == 0). In this scenario you
    // aren't expected to use it.
    Console.WriteLine(
        "You entered '{0}', which is not a valid integer.",
        input
    );
}

Many developers complain of out parameters as a "code smell"; but they can be by far the most appropriate choice in many scenarios. One very important modern example would be multithreaded code; often an out parameter is necessary to permit "atomic" operations where a return value would not suffice.
Consider for example Monitor.TryEnter(object, ref bool), which acquires a lock and sets a bool atomically, something that wouldn't be possible via a return value alone since the lock acquisition would necessarily happen before the return value were assigned to a bool variable. (Yes, technically ref and out are not the same; but they're very close).
Another good example would be some of the methods available to the collection classes in the System.Collections.Concurrent namespace new to .NET 4.0; these provide similarly thread-safe operations such as ConcurrentQueue<T>.TryDequeue(out T) and ConcurrentDictionary<TKey, TValue>.TryRemove(TKey, out TValue).

A: Output parameters are found all over the .NET framework. Some of the uses I see most often are the TryParse methods, which return a boolean (indicating whether or not the parse was valid) and the actual result is returned via the output parameter. While it's also very common place to use a class when you need to return multiple values, in such an example as this it's a little heavy handed. For more on output parameters, see Jon Skeet's article on Parameter passing in C#.

A: Simple, when you have a method that returns more than one value.
One of the most "famous" cases is Dictionary.TryGetValue:
string value = "";

if (openWith.TryGetValue("tif", out value))
{
    Console.WriteLine("For key = \"tif\", value = {0}.", value);
}
else
{
    Console.WriteLine("Key = \"tif\" is not found.");
}

A: The main motivation to using an out parameter is to allow a function to return multiple values to the caller and everyone else provided examples in the framework.  I'll take a different approach to answering your question by exploring the reasoning behind having out parameters in the first place.  I won't write out actual examples but describe them.
Normally you have only one mechanism to return values, the function's return value.  Sure you could use a global (static) or instance variables too but that's not very practical nor safe to do in general (for reasons I won't explain here).  Prior to .NET 3.5, there wasn't a really practical way to return multiple values from a function.  If out or ref modifiers were not available, you would have a few options:

*

*If all your values had the same type, you could return some collection of the values.  This is perfectly fine in most cases, you could return an array of number, list of strings, whatever.  This is perfect if all the values were related in exactly the same way.  i.e., All numbers were the number of items in a container, or the list was of names of guests at a party.  But what if the values you returned represented different quantities?  What if they had different types?  A list of objects could hold them all but it is not a very intuitive way to manipulate that sort of data.

*For the case when you need to return multiple values of different types, the only practical option you had was to create a new class/struct type to encapsulate all these values and return an instance of that type.  Doing so you could return strongly typed values with intuitive names and you could return multiple values this way.  The problem is that in order to get that, you had to define the type with a specific name and everything just to be able to return multiple values.  What if you wanted to return only two values which were simple enough making it impractical to create a type for it?  You have a couple more options again:

*

*You could create a set of generic types to contain a fixed amount of values of varying types (like a tuple in functional languages).  But it is not as appealing to do so in a reusable manner since it wasn't part of the framework at the time.  It could be put in a library but now you add a dependency on that library just for the sake of these simple types.  (just be glad that .NET 4.0 now includes the Tuple type)  But this still doesn't solve the fact that these are simple values which means added complexity for a simple task.

*The option that was used was to include an out modifier which allows the caller to pass a "reference" to a variable so that the function may set the referenced variable as another way to return a value.  This way of returning values was also available in C and C++ in many ways for the same reasons and played a role in influencing this decision.  However the difference in C# is that for an out parameter, the function must set the value to something.  If it doesn't, it results in a compiler error.  This makes this less error prone since by having an out parameter, you're promising the caller that you will set the value to something and they can use it, the compiler makes sure you stick to that promise.
A note on the typical usage of the out (or ref) modifier, it will be rare to see more than one or two out parameters.  In those cases, it will almost always be a much better idea to create the encapsulating type.  You would typically use it if you needed just one more value to return.
However since C#-3.0/.NET-3.5 with the introduction of anonymous types and tuples introduced in .NET 4.0, these options provided alternative methods to return multiple values of varying types easier (and more intuitive) to do.

A: there are many scenarios where you would use it, but the main one would be where your method needs to return more then one parameter.  Take, for example, the TryParse methods on int type.  In this case, instead of throwing an exception a bool is returned as a success/failure flag and the parsed int is return as the out param.  if you were to call int.Parse(...) you could potentially throw an exception.
string str = "123456";
int val;
if ( !int.TryParse(str,out val) )
{
// do some error handling, notify user, etc.
}

A: As others have said - out parameters allow us to return more than one value from a method call without having to wrap the results in struct/class.
The addition of the xxx.TryParse methods greatly simplified the coding necessary to convert between a string value (frequently from the UI) and a primitive type.
An example of what you might have had to write to achieve the same functionality is here:
/// <summary>
/// Example code for how <see cref="int.TryParse(string,out int)"/> might be implemented.
/// </summary>
/// <param name="integerString">A string to convert to an integer.</param>
/// <param name="result">The result of the parse if the operation was successful.</param>
/// <returns>true if the <paramref name="integerString"/> parameter was successfully
/// parsed into the <paramref name="result"/> integer; false otherwise.</returns>
public bool TryParse(string integerString, out int result)
{
    try
    {
        result = int.Parse(integerString);
        return true;
    }
    catch (OverflowException)
    {
        // Handle a number that was correctly formatted but
        // too large to fit into an Int32.
    }
    catch (FormatException)
    {
        // Handle a number that was incorrectly formatted
        // and so could not be converted to an Int32.
    }

    result = 0; // Default.
    return false;
}

The two exception checks that are avoided here make the calling code much more readable. I believe that the actual .NET implementations avoid the exceptions altogether so perform better as well. Similarly, this example shows how IDictionary.TryGetValue(...) makes code simpler and more efficient:
private readonly IDictionary<string,int> mDictionary = new Dictionary<string, int>();

public void IncrementCounter(string counterKey)
{
    if(mDictionary.ContainsKey(counterKey))
    {
        int existingCount = mDictionary[counterKey];

        mDictionary[counterKey] = existingCount + 1;
    }
    else
    {
        mDictionary.Add(counterKey, 1);
    }
}

public void TryIncrementCounter(string counterKey)
{
    int existingCount;
    if (mDictionary.TryGetValue(counterKey, out existingCount))
    {
        mDictionary[counterKey] = existingCount + 1;
    }
    else
    {
        mDictionary.Add(counterKey, 1);
    }
}

And all thanks to the out parameter.

A: bool Int32.TryParse(String, out Int);

or something similar like Dictionary.TryGetValue.
But I would consider this one to be a not too good practice to employ it, of course, using those provided by API like the Int32 one to avoid Try-Catch is exceptions.

A: //out key word is used in function instead of return. we can use multiple parameters by using out key word
public void outKeyword(out string Firstname, out string SecondName)
{
    Firstname = "Muhammad";
    SecondName = "Ismail";

}
//on button click Event
protected void btnOutKeyword_Click(object sender, EventArgs e)
{
    string first, second;
    outKeyword(out first, out second);
    lblOutKeyword.Text = first + "  " + second;
}


text: Q: Degree bounds for Grobner Basis Let $I= \langle f_1, \ldots f_n \rangle \subset K[x_1,\ldots, x_n]$ be a homogeneous ideal and $\operatorname{deg}(f_i) \leq d$ then it has Grobner Basis where degree of each generator is less than or equal to $2(d^2/2+d)^{2^{n-2}}$. This is proved in The structure of polynomial ideals and Grobner bases. Does there exists any similar result for the  Grobner Basis for the submodules of $M$ where $M$ is a free-module of rank $n'$ over the ring  $K[x_1,\ldots, x_n]$


text:
Q: Check if a function is available in Swift? I would like to detect if the user has enabled Reduce Transparency. It's simple you just call the func UIAccessibilityIsReduceMotionEnabled() and it returns a Bool. But my app targets iOS 7 and 8 and this function isn't available on iOS 7.
In Objective-C, this is how I checked to see if that function exists:
if (UIAccessibilityIsReduceMotionEnabled != NULL) { }

In Swift, I can't figure out how to check if it exists or not. According to this answer, you can simply use optional chaining and if it's nil then it doesn't exist, but that is restricted to Obj-C protocols apparently. Xcode 6.1 doesn't like this:
let reduceMotionDetectionIsAvailable = UIAccessibilityIsReduceMotionEnabled?()

It wants you to remove the ?. And of course if you do so it will crash on iOS 7 because that function doesn't exist.
What is the proper way to check if these types of functions exist?

A: If you're okay with being a little bit cheeky, you can always open the UIKit binary using the library loader and see if it can resolve the symbol:
let uikitbundle = NSBundle(forClass: UIView.self)
let uikit = dlopen(uikitbundle.executablePath!, RTLD_LAZY)
let handle = dlsym(uikit, "UIAccessibilityIsReduceMotionEnabled")
if handle == nil {
    println("Not available!")
} else {
    println("Available!")
}

The dlopen and dlsym calls can be kinda expensive though so I would recommend keeping the dlopen handle open for the life of the application and storing somewhere the result of trying to dlsym. If you don't, make sure you dlclose it.
As far as I know this is AppStore safe, since UIAccessibilityIsReduceMotionEnabled is a public API.

A: You could check to see if you're running in iOS 8 or higher --
var reduceMotionEnabled = false
if NSProcessInfo().isOperatingSystemAtLeastVersion(NSOperatingSystemVersion(majorVersion: 8, minorVersion: 0, patchVersion: 0)) {
    reduceMotionEnabled = UIAccessibilityIsReduceMotionEnabled()
}

I don't think there's another way to tell. So in theory, if you were able to check, trying to access the function name without the () would give you nil in iOS 7 and the () -> Bool function in iOS 8. However, in order for that to happen, UIAccessibilityIsReduceMotionEnabled would need to be defined as (() -> Bool)?, which it isn't. Testing it out yields a function instance in both versions of iOS that crashes if called in iOS 7:
let reduceMotionDetectionIsAvailable = UIAccessibilityIsReduceMotionEnabled
// reduceMotionDetectionIsAvailable is now a () -> Bool
reduceMotionDetectionIsAvailable()
// crashes in iOS7, fine in iOS8

The only way I can see to do it without testing the version is simply to define your own C function to check in your bridging header file, and call that:
// ObjC
static inline BOOL reduceMotionDetectionIsAvailable() {
    return (UIAccessibilityIsReduceMotionEnabled != NULL);
}

// Swift
var reduceMotionEnabled = false
if reduceMotionDetectionIsAvailable() {
    reduceMotionEnabled = UIAccessibilityIsReduceMotionEnabled()
}

A: A proper check for availability has been added in Swift 2. This is recommended over other options mentioned here.
var shouldApplyMotionEffects = true
if #available(iOS 8.0, *) {
    shouldApplyMotionEffects = !UIAccessibilityIsReduceMotionEnabled()
}

A: From the Apple Developer docs (Using Swift with Cocoa and Objective-C (Swift 3) > Interoperability > Adopting Cocoa Design Patterns > API Availability):

Swift code can use the availability of APIs as a condition at
  run-time. Availability checks can be used in place of a condition in a
  control flow statement, such as an if, guard, or while
  statement.
Taking the previous example, you can check availability in an if
  statement to call requestWhenInUseAuthorization() only if the method
  is available at runtime:
let locationManager = CLLocationManager()
if #available(iOS 8.0, macOS 10.10, *) {
    locationManager.requestWhenInUseAuthorization()
}

Alternatively, you can check availability in a guard statement,
  which exits out of scope unless the current target satisfies the
  specified requirements. This approach simplifies the logic of handling
  different platform capabilities.
let locationManager = CLLocationManager()
guard #available(iOS 8.0, macOS 10.10, *) else { return }
locationManager.requestWhenInUseAuthorization()

Each platform argument consists of one of platform names listed below,
  followed by corresponding version number. The last argument is an
  asterisk (*), which is used to handle potential future platforms.
Platform Names:

*

*iOS

*iOSApplicationExtension

*macOS

*macOSApplicationExtension

*watchOS

*watchOSApplicationExtension

*tvOS

*tvOSApplicationExtension


text:
Q: How to add  according to changing  part My requirement is,when new version comes  in a project I need to display each test case result  in each version.
Example :-
tc_id     testcase       version1     version2  ......
1       Invalid login      pass         fail
2          .                .
3
I want to make my table as dynamic.That means when new version comes in the project column has to add.In heading part it is adding the new versions.In particular version I need to display the test case result. I am able to display by putting  but how to add  in  part according to newly added (version) means how to add  dynamically.
My code is,
<?php

function project_table(){
      echo '<DOCTYPE html>

             <link rel="stylesheet" type="text/css" href="http://localhost/Dashboard/css/table_css.css">

             ';
                include("C:\wamp64\www\DashBoard\Config2.php");
                  $sql = "select version_number from version where rel_id= 1";
                  $query = mysqli_query($db,$sql);
                 echo'

                      Test case id
                      Test case description	';
                      while($row=mysqli_fetch_array($query))
                      {
                        echo''.$row['version_number'].'	';
                      }
              echo'

';
             $sql="select prefix , tc_id ,tc_description from (select testcases.tc_id as tc_id, project_table.prefix as prefix,testcases.tc_summary as tc_description from project_table join testcases on project_table.project_id=testcases.pro_id join executions on testcases.id=executions.parent_id where executions.version_id=1 and executions.pro_id=4)as t;";
             $query=mysqli_query($db,$sql);

             while($row = mysqli_fetch_array($query)){
               echo '

                '.$row['prefix'].'
                '.$row['tc_description'].'
                '.$row['prefix'].'-'.$row['tc_id'].'

';

              }
            echo'

';
}

    project_table();

?>

And these query gives me result, this result I need to print in below the each version.
$res="select result from (select executions.tc_result as result from project_table join testcases on project_table.project_id=testcases.pro_id join executions on testcases.id=executions.parent_id where executions.version_id=1 and executions.pro_id=4)as t;";

gives means result;
can Any one help me, I am struggling a lot in that.


text:
Q: MenuItemLocator unable to find shell I'm using WindowTester to automate testing of an Eclipse RCP application. When I try to automate menu interaction like this:
IUIContext ui = getUI();
ui.click(new MenuItemLocator("Window/Show View/My View"));

I get an exception.
com.windowtester.runtime.WidgetNotFoundException: No menubar found for active shell

The menubar exists, of course. It is created by Eclipse. I contribute to it via an extension point under org.eclipse.ui.commands.
How can I automate interaction with these menu items?

A: The test thread is getting ahead of the UI thread. The menubar doesn't yet exist when the MenuItemLocator looks for it. Add a delay to ensure that the application has finished initializing before starting the test.
ui.wait(new ShellLocator("Application Title").isVisible());