text:
Q: Read.csv gives dataset with wrong numbers I have a comma seperated dataset of around 26,800 rows. When doing read.csv, R creates a dataframe and everything seems to be fine. However, R gives me wrong numbers when performing statistical analysis. I checked my numbers with the official numbers of the website from which I downloaded the dataset and they deviate in some cases a lot. I thought that the removal of categories, such as "Don't know" or "Refused to answer", could be the reason for wrong share percentages. However, it gives me also wrong numbers when using count() and including all categories. I checked also my codes for values and factor levels several times, but the numbers are already wrong before I manipulate the dataset.
I don't know what else I could check. I could imagine that the way my program handles the CSV file could result in misrepresentation of the data. The CSV is with 22.8 MB quite large.
Here the header and the first five rows:
id,country,psu,splita,splitb,wave,q1,a1,q13,wt,stratum,sample,mode,Q1001,Q1001GCC,Q1002,Q100,Q2061A,Q2061B,Q101,Q101A,Q102,Q108_1,Q108_2,Q108_3,Q108_4,Q109AGCC_1,Q109AGCC_2,Q104,Q104A,Q104A_1,Q104A_2,Q104A_3,Q104A_4,Q104A_5,Q104A_6,Q104A_7,Q104A_8,Q104A_98,Q104A_99,Q104B_KSA,Q104B_UAE,Q104B_QA,Q104B_BA,Q104B_KU,Q104B_OM,Q104B_EG,Q104B_JO,Q104B_LEB,Q104B_MO,Q104B_AL,Q104B_TUN,Q104B_TUR,Q104B_US,Q104B_CAN,Q104B_UK,Q104B_EEU,Q104B_FR,Q104B_GER,Q104B_ESP,Q104B_IT,Q104B_WEUOTHER,Q104B_SSA,Q104B_OTHER,Q104B_DK,Q104B_REF,Q104B_WEU,Q104C,Q105,Q103,Q201A_1,Q201A_2,Q201A_3,Q201A_5,Q201A_41,Q201A_42,Q201A_7,Q201B_6,Q201B_13,Q201B_20,Q201B_31,Q201B_12,Q201C_37,Q201C_38,Q201C_39,Q201C_32,Q201C_40,Q513,Q204A_1,Q204A_2,Q204_2,Q204_3,Q204_11,Q204_20,Q204_22,Q204B_13,Q204B_15,Q204C_13,Q204C_15,Q205_1,Q205_4,Q205_4LEB,Q205_6,Q205_7,Q214,Q211D,Q209B,Q210,Q211,Q211A,Q211B,Q211C,Q213B,Q213A_1,Q213A_2,Q213A_3,Q209,Q216,Q218_2,Q218_5,Q218_6,Q501,Q501A,Q266,Q502_1,Q502_2,Q502_4,Q265,Q263,Q404,Q301A,Q301B,Q303A,Q302,Q503A,Q505A,Q301C,Q601A,Q516A,Q515A2,Q511,Q512,Q514,Q514A,Q516_1,Q516_2,Q516_3,Q516_4,Q423_1,Q423_2,Q423_3,Q409,Q424,Q412A3,Q412A4,Q412A6,Q412A7,Q412A8,Q412A9,Q412A10,Q412A14,Q412A98,Q412A99,Q421,Q521_1,Q521_4,Q521_5,Q521A_3,Q521A_4,Q852,Q853A,Q853B,Q854,Q855A,Q855B,Q851_E1,Q851_E2,Q851A,Q851B,Q851C,Q851D_1,Q851D_2,Q851D_3,Q851D_4,Q851D_5,Q851D_6,Q851D_7,Q851D_98,Q851D_99,Q860A,Q860B,Q860C,Q860D,Q1012,Q1012A,Q609,Q609A,Q610_8,Q610_5A,Q610_5B,Q610_6A,Q610_6B,Q610_9,Q601_1,Q601_3,Q601_4,Q601_7,Q601_9,Q601_9A,Q601_14,Q601_18,Q602_1,Q602_2,Q602_3,Q602_4A,Q602_4B,Q604A_1,Q604A_3,Q604B_1,Q604B_3,Q606_1,Q606_2,Q606_3,Q606_4,Q606_8,Q607_2,Q607_6,Q607_7,Q605,Q605A_1,Q605A_2,Q605A_3,Q605A_4,Q605B,Q700A_1,Q700A_2,Q700A_8,Q700A_9,Q700A_4,Q700A_3,Q700A_13,Q700A_12,Q701C_1,Q701C_2,Q701C_3,Q701C_4,Q701C_5,Q701C_6,Q701F_1,Q701F_2,Q701F_3,Q701G_1,Q701G_2,Q701G_3,Q701G_4,Q701G_5,Q701H,Q703,Q705,Q706A,Q706B,Q707,Q707_1,Q707_2,Q707_3,Q707_4,Q707_5,Q707_6,Q707_7,Q707_8,Q725_1,Q725_2,Q725_3,Q709B,Q7141A,Q7141B,Q833,Q841,Q1003GCCA,Q1003,Q1020JO,Q1001A,Q1001B,Q1001C,Q1001D,Q1005,Q1006,Q1006A,Q1006C,Q1006C_GCC,Q1006C_GGC1,Q1006D,Q1006E,Q1006F_1,Q1006F,Q1006G,Q1010,Q1010C,Q1010B1,Q1010B2,Q1018,Q1018A,Q1018B,Q1018C,Q1018D,Q1018E,Q1018F,Q1014A,Q1015A_LEB,Q1015B_LEB,Q1015C_LEB,Q1015A_JO,Q1015B_JO,Q1015C_JO,Q1015A_PAL,Q1015B_PAL,Q1015C_PAL,Q1015A_MO,Q1015B_MO,Q1015C_MO,Q1015A_TUN,Q1015B_TUN,Q1015C_TUN,Q1015A_EG,Q1015B_EG,Q1015C_EG,Q1015A_SUD,Q1015B_SUD,Q1015C_SUD,Q1015_YEM,Q1015A_YEM,Q1015A_IR,Q1015B_IR,Q1015C_IR,Q1015A_AL,Q1015B_AL,Q1015C_AL,Q1015A_LI,Q1015B_LI,Q1015C_LI,Q1015A_KU,Q1015B_KU,Q1015C_KU,Q1016,Q1017,date
1,1,1,2,2,5,10009,10001,1,0.3544727765156059,1,1,1,33,NA,1,3,2,6,3,5,5,NA,NA,NA,NA,NA,NA,1,5,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,2,2,NA,3,NA,NA,NA,98,98,NA,NA,NA,NA,NA,3,2,98,3,3,NA,3,4,3,3,2,4,NA,NA,NA,NA,NA,2,4,NA,3,97,98,98,2,NA,NA,NA,NA,1,1,1,1,1,3,3,4,2,NA,2,1,99,3,3,3,2,2,2,NA,1,98,2,10003,3,2,3,2,3,6,3,NA,NA,98,2,98,2,2,98,98,1,2,1,0,0,1,1,0,0,0,0,0,98,4,4,98,2,2,98,3,NA,2,2,98,1,1,2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,1,NA,NA,1,5,2,6,3,2,NA,3,NA,4,3,1,3,4,NA,98,2,1,2,3,3,3,NA,NA,NA,98,4,2,98,98,2,98,3,2,3,1,1,98,2,2,1,98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


text:
Q: Add global controller in Angular application I have following scenario,
I have registers my files in $routeProvider as following way by using require.js
$routeProvider
               .when("/:Id", {
                   templateUrl: "Scripts/app/Views/MyHtml.html",
                   controller: "myController",
                   resolve: {
                       load: ['$q', '$rootScope', function ($q, $rootScope) {
                           var deferred = $q.defer();
                           require([
                               'scripts/app/controllers/myController',
                           ], function () {
                               $rootScope.$apply(function () {
                                   deferred.resolve();
                               });

                           });
                           return deferred.promise;
                       }]
                   },
                   caseInsensitiveMatch: true,
               })...
....
..

Now I want to add my global controller in application module
I have this controller in different file.
(function () {
    app.controller("commonController", function ($rootScope, $scope){
        $scope.commonText = "You got successed."
    });
}())

Now I do not want to add commoncontroller file index.html, rather I want to resolve when my app.config execute.
I have done following code in $routeprovider function
var commonController = ['$q', '$rootScope', function ($q, $rootScope) {
               var deferred = $q.defer();
               require([
                   'scripts/app/commonController',
               ], function () {
                   $rootScope.$apply(function () {
                       deferred.resolve();
                   });
               });
               return deferred.promise;
           }]

But how do I resolve this commonController here.
Is there any way to resolve global controllers, directives, services for all common routes.
Thanks

redpajama_set_name: RedPajamaStackExchange


text:
Q: Finding S3 aggregate content length of assets with a specific path prefix I have customer assets stored in S3 an account-related value serving as the first element in the path to each asset, e.g.

*

*account-1/media/video/382476581823.mp4

*account-1/images/2348752.png

I would like to find the total amount of storage being consumed by all assets for an account -- all the assets that have a prefix of "account-1" for the path in the above example.  I have a working solution that iterates over the ObjectSummary objects returned by the S3 query but it's too slow for my needs because it performs an HTTP request for each object.
I'm wondering if it's possible to perform the calculation in an S3 query similar to what you might do with DynamoDB -- ask S3 to perform the calculation and return the total.
Note: Using aws-sdk-ruby

A: I should have mentioned that we're using an old 1.x version of the aws-sdk-ruby so my answer might vary from what you would find in a current version of S3 sdk.
I was able to use the AWS::S3::Client#list_objects method and iterate over those results.  While this is not exactly what I was hoping for (the calculation is still performed locally), at least it avoids the HTTP HEAD request to the S3 media that is invoked when iterating over the results of the S3::Bucket#objects call.

A: S3 announced a new feature, S3 Select, that lets you use SQL to query your S3 buckets. Here's the launch announcement:
https://aws.amazon.com/blogs/aws/s3-glacier-select/


text:
Q: Keep edited text in custom cell when adding another section ([tableView refresh data]) I have a nib file with a custom UITableViewCell and view controller with a TableView that contains three of the custom cells per section. I also have a button that when pressed, adds a new section with another three custom cells.
My problem is, I have a placeholderArray = @"Name", @"Position", @"Email"; that is used to set the text for each of the cells. And advisorArray to contain the user input of the three textFields. The user input saves into this array but when the user presses the button to add another set of cells, the original three cells text are changed back to the textFieldArray instead of the user text.
I know the [tableView refreshData] is what is causing this but I do not know another way to add another section to the tableView.
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 3;
}

- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{
return sections;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath{
CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:@"myCell"];
cell.tag = indexPath.row;

[cell.textField setText:[self.placeholderText objectAtIndex:indexPath.row]];

cell.textField.delegate = self;
cell.textField.tag = indexPath.row;

return cell;
}

- (void)textFieldDidEndEditing:(UITextField *)textField{

if (textField.tag == 0) {
    self.nameString = textField.text;
    [self.advisorsArray replaceObjectAtIndex:0 withObject:self.nameString];
}
if (textField.tag == 1) {
    self.positionString = textField.text;
    [self.advisorsArray replaceObjectAtIndex:1 withObject:self.positionString];
}
if (textField.tag == 2) {
    self.emailString = textField.text;
    [self.advisorsArray replaceObjectAtIndex:2 withObject:self.emailString];
}

}

- (IBAction)addAdvisor:(id)sender {
sections++;
[self.tableView reloadData];
}

A: What is self.placeholderArray in
[cell.textField setText:[self.placeholderText objectAtIndex:indexPath.row]];

Where is the actual data stored.  Do you mean to use self.advisorsArray ?


text:
Q: Keras, Google colab freezes on the last step of first epoch The code :
from google.colab import drive
import tensorflow as tf
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, Conv2D, MaxPool2D, Flatten
from tensorflow.python.keras.optimizer_v1 import Adam
import numpy as np
import cv2
import matplotlib.pyplot as plt
from tensorflow.python.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
device_list = tf.test.gpu_device_name()
if device_list != '/device:GPU:0':
  raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_list))
datagen_train = tf.keras.preprocessing.image.ImageDataGenerator()
datagen_val = tf.keras.preprocessing.image.ImageDataGenerator()
datagen_test = tf.keras.preprocessing.image.ImageDataGenerator()
size = 128
batch_size=20
tf.compat.v1.disable_eager_execution()
train_set = datagen_train.flow_from_directory("drive/MyDrive/train",
target_size = (size,size),
color_mode = "grayscale",
batch_size = batch_size,
class_mode='categorical',
shuffle=True)

val_set = datagen_val.flow_from_directory("drive/MyDrive/valid",
target_size = (size,size),
color_mode = "grayscale",
batch_size = batch_size,
class_mode='categorical',
shuffle=True)

test_set = datagen_train.flow_from_directory("drive/MyDrive/test",
target_size = (size,size),
color_mode = "grayscale",
batch_size = batch_size,
class_mode='categorical',
shuffle=True)
imgs,labels = next(test_set)
model = Sequential([
    Conv2D(filters=64, kernel_size=(3,3), padding='same', activation='relu', input_shape=(128,128,1)),
    MaxPool2D(pool_size =(2,2), strides=2),
    Conv2D(filters=128, kernel_size=(3,3), padding='same', activation='relu'),
    MaxPool2D(pool_size =(2,2), strides=2),
    Conv2D(filters=256, kernel_size=(3,3), padding='same', activation='relu'),
    MaxPool2D(pool_size =(2,2), strides=2),
    Conv2D(filters=512, kernel_size=(3,3), padding='same', activation='relu'),
    MaxPool2D(pool_size =(2,2), strides=2),
    Flatten(),
    Dense(units=256, activation='relu'),
    Dense(units=512, activation='relu'),
    Dense(units=2, activation='softmax')
])
checkpoint = ModelCheckpoint("./model.h5", monitor = 'val_acc', verbose=1, save_best_only = True, mode='max')

earlystopping = EarlyStopping(monitor='vall_loss', min_delta=0, patience=3, verbose=1,restore_best_weights= True)

reducelearningrate = ReduceLROnPlateau(monitor='val_loss', factor=0.2,patience=3,verbose=1,min_delta=0.0001)

callbacks_list = [earlystopping,checkpoint,reducelearningrate]
ep = 30
opt = Adam(lr=0.0001)

model.summary()
model.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(x=train_set, epochs=ep,steps_per_epoch=601, validation_data = val_set, validation_steps = 209, verbose=1)
model.save('Drowsines_Detector2.h5')
model.evaluate(x = imgs, y = labels, verbose = 2)

The program on first run in google colab takes 1hour and 30 mins in first epoch. Then if gets stuck on the first epoch step 601/601. Then by cancelling it ang rerunning it, it completes the first epoch very fast, like in 15 or 16 secs. Then sometimes it gets stuck on step 600/601. And sometimes gets stuck on step 601/601. But it does not continue to second epoch. How can I fix this.


text:
Q: Optimal RocksDB configuration for use as secondary "cache" I am looking at using RocksDB (from Java in my case) as a secondary "cache" behind a RAM based first level cache. I do not expect any items in RocksDB to be dramatically more commonly accessed than others (all the really frequently used items will be in the first level cache) and there will be no "locality" (if there is such a concept in RocksDB?) as the "next" key in sequence is no more likely to be accessed next than any other so I would like to optimize RocksDB for "truly random access" by for instance reading as little data as possible each time, not have any "cache" in Rocks etc.
All suggestions of configurations are appreciated!

A: The defaults should be more than enough for your use case - but you can increase the block size and pin index and filter blocks
You can also call optimizeForPointLookup if you only are going to do puts and gets to optimize even further


text:
Q: DIV is fixed after a specific point My website looks like this:
http://im.bilderkiste.org/1137050965009/size.jpg
The first block is an image with content in it and the second block (black) is the navigation. I want the following thing:
When you scroll down the page, the second block scrolls normaly to the top, when the second block is on top - it should change the css property to (position: fixed;).
But when you scroll to the top, the second block changes to the position in which it was at the beginning.
Like on this page: http://focuslabllc.com/expressionengine (the second navigation)
How can I achieve that?
Thanks


text:
Q: AlertDialog with images I want to create and dialog, which appears and a person can choose one of eight options.
So i found, that the best will be class 'Alert Dialog'. I know, how to create an object with this class, which displays a list of text options to choose from. But I decided, to now show text option, but images, so I created something like this:
AlertDialog.Builder builder = new AlertDialog.Builder(StartGameActivity.this);
    builder.setTitle(R.string.pickColor);

           builder.setItems(R.array.colorArray, new DialogInterface.OnClickListener() {

               public void onClick(DialogInterface dialog, int which) {
                      it's not important what is inside this function
                   }

}

But when I run my application and the alert dialog appears - i see only text, which i think is the path to the folder where is my image (it's something like: res/drawable-xhpi/image_name.jpeg)
I was looking for a solution to this problem, but, this which I found were useless.
I have read, that I should maybe use an ListAdapter or LayoutInflater, but I not sure how I can use this. Can anybody explain me how make a list of images inside the AletDialog?

A: Assuming your array is a list of resource ids...
AlertDialog.Builder builder = new AlertDialog.Builder(StartGameActivity.this);
builder.setTitle(R.string.pickColor);
ListView lv = new ListView(getActivity());
lv.setAdapter(new ArrayAdapter<String>(getActivity(), -1) {
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Resources res = getResources();
        TypedArray colorArray = res.obtainTypedArray(R.array.colorArray);
        Drawable drawable = colorArray.getDrawable(position);
        ImageView v = new ImageView(getActivity());
        v.setImageDrawable(drawable);
        return v;
    }

    @Override
    public int getCount() {
        Resources res = getResources();
        TypedArray colorArray = res.obtainTypedArray(R.array.colorArray);
        return colorArray.length();
    }
});
lv.setOnItemClickListener(new OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        // do click stuff
    }

});
builder.setView(lv);


text:
Q: Dupe comments are dupes The new auto-comment feature for dupes is adding the same comment for each user that votes to close for the same reason. This just adds a lot of noise - traditionally, people have simply upvoted the original (manual) comment describing the dupe. Can I suggest that only the first dupe vote referring to a specific question should get a comment?
See https://stackoverflow.com/questions/2544577/type-casting-c-and-c-closed for an example.

A: According to Jeff:

*

*once closed, the question should auto-remove any comments of the type "possible duplicate of.."

*when multiple people vote for the same dupe, should not insert duplicate comments (oh, the irony)

So, I guess this is work-in-progress?
(And the wish for the upvote is in the same explanation.)
Update: Jeff did some strikethrough, which I copied here. Might indicate it's already done (quick!), or will never be implemented. ;-)


text:
Q: FireFox cant establish a connection to the server at ws://1.1.1.26:81 I am new to Java and PHP, I am trying to add some features to the website, nut when i inspect the website i get this error. The website seems to work fine except for that it wont display variables i have in a config file. How do i get rid of this error? Here is my code for the websocket.
var FancyWebSocket = function(url)
{
    var callbacks = {};
    var ws_url = url;
    var conn;

this.bind = function(event_name, callback){
    callbacks[event_name] = callbacks[event_name] || [];
    callbacks[event_name].push(callback);
    return this;// chainable
};

this.send = function(event_name, event_data){
    console.log(event_data);
    this.conn.send( event_data );
    return this;
};

this.connect = function() {
    if ( typeof(MozWebSocket) == 'function' )
        this.conn = new MozWebSocket(url);
    else
        this.conn = new WebSocket(url);

    // dispatch to the right handlers
    this.conn.onmessage = function(evt){
        dispatch('message', evt.data);
    };

    this.conn.onclose = function(){dispatch('close',null)}
    this.conn.onopen = function(){dispatch('open',null)}
};

this.disconnect = function() {
    this.conn.close();
};

var dispatch = function(event_name, message){
    var chain = callbacks[event_name];
    if(typeof chain == 'undefined') return; // no callbacks for this event
    for(var i = 0; i < chain.length; i++){
        chain[i]( message )
    }
}

};


text:
Q: Graph in pgfplots: global style for all node labels I have this graph rendering three functions:
\documentclass[12pt,a4paper]{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[
    width=10cm,
    height=10cm,
    axis lines=center,
    xmin=-1, xmax=100,
    ymin=-1, ymax=1000,
  ]
  \addplot[
    domain=0:25,
    ] {x^2} node[label={\(x^2\)}] {};
  \addplot[
    domain=0:9.8,
    ] {2^x} node[label={\(2^n\)}] {};
  \addplot[
    domain=0:90,
    ] {x} node[label={\(n\)}] {};
  \end{axis}
  \end{tikzpicture}
\end{document}

I want to set the style of the node labels globally. Lets say that I want them with yellow background: I know I can do it locally, but if the style get complex the code becomes hard to read.
\begin{tikzpicture}
  \begin{axis}[
    width=10cm,
    height=10cm,
    axis lines=center,
    xmin=-1, xmax=100,
    ymin=-1, ymax=1000,
    label style={font=\small}
  ]
  \addplot[
    domain=0:25,
    ] {x^2} node[label={[fill=yellow]:{\(x^2\)}}] {};
    \addplot[
      domain=0:9.8,
      ] {2^x} node[label={[fill=yellow]:{\(2^n\)}}] {};
    \addplot[
      domain=0:90,
      ] {x} node[label={[fill=yellow]:{\(n\)}}] {};
  \end{axis}
  \end{tikzpicture}
\end{document}

How can I add the styles for the node labels only once in the header?

A: You can make use of TikZ's styling mechanims, which allow you to style all labels at once:
\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[every label/.style={fill=yellow}]
  \begin{axis}[
    width=10cm,
    height=10cm,
    axis lines=center,
    xmin=-1, xmax=100,
    ymin=-1, ymax=1000,
    label style={font=\small}
  ]
  \addplot[
    domain=0:25,
    ] {x^2} node[label={\(x^2\)}] {};
    \addplot[
      domain=0:9.8,
      ] {2^x} node[label={\(2^n\)}] {};
    \addplot[
      domain=0:90,
      ] {x} node[label={\(n\)}] {};
  \end{axis}
  \end{tikzpicture}
\end{document}


text:
Q: GetTokenInformation doesn't return statue of all privileges when non-elevated I created a command which uses GetTokenInformation to obtain privilege information for the current process and ran it both elevated and non-elevated.  When elevated (running as administrator), I get the state of all privileges.  When non-elevated, I only get the state of 8 privileges some of which some are enabled and some are disabled.
Why are only 8 privileges returned when running non-elevated?

A: Tokens can not have privileges added after being created, a non-elevated token is created with a lesser set of privileges so that even if security is broken on a non-elevated process the privilege simply is not present to be enabled. This way only the elevated process set presents an attack surface that matters.

A: It depends on User Account Control(UAC), you can ref to the document about How User Account Control works
If UAC is enabled:
When you run the process(without elevation), it will get a restricted token, and the administrator is removed from the group list. Even if the current user is a member of the administrators group, the process cannot use administrator privileges.
And if UAC is disabled:
You will get the a copy of the original token with no limitation.
You can set the following register to disable(Disable UAC is not recommended):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
EnableLUA = 1 (REG_DWORD)

And restart the PC.


text:
Q: Queue isEmpty and poll incosistency? Please see the following code segment:
private static Queue<Message> m_Queue;

public boolean isQueueEmpty()
{
    if (m_Queue.isEmpty())
        return true;
    else
        return false;
}

public WgwConferenceMessage dequeue(){
try{
 if(!isQueueEmpty())
 {
    Message message = m_Queue.poll();

    if (message != null)
    {
        if (!message.getMessage().equals(""))
            Log4jWrapper.writeLog("Retrieved "  + message.getMessage() + " from queue");
        else
            Log4jWrapper.writeLog(LogLevelEnum.ERROR, "<Queue> dequeue", "Message empty");

        return message;
    }
    else
    {
        Log4jWrapper.writeLog(LogLevelEnum.TRACE, "<Queue> dequeue", " Q is empty!");
        return null;
    }
 }
 else
    return null;
}
catch (Exception e)
{
    ExceptionHandler.printException(e, "<Queue>", "dequeue");
    return null;
}
}

public void enqueue(Message a_Message) throws Exception
{
    try
    {
        if (m_Queue.offer(a_Message))
            Log4jWrapper.writeLog(LogLevelEnum.TRACE, "<Queue> enqueue", "Pushed "  + a_Message.getMessage() + " to queue");
        else
            throw new Exception("Queue - Could not push message to queue");
    }
    catch (Exception e)
    {
        ExceptionHandler.printException(e, "Queue", "enqueue");
    }

}

My problem is that eventually I get " Q is empty!" log line.
And I can't understand how can it be?
isQueueEmpty() says the Q is not empty, and poll says it is!
Can you advice please?
Thank you.

A: Assuming this code is accessed by multiple threads, the reason is that the check for emptiness and the subsequent polling are not done atomically: they are two separate actions. This means that it is possible for a different thread to call poll on the queue in between the first thread checking if it is empty and calling poll itself; if there happens only to have been one element in the queue, one of these threads is going to get null back from the call to poll.
Quoting the Javadoc for Queue:

Queue implementations generally do not allow insertion of null elements, although some implementations, such as LinkedList, do not prohibit insertion of null. Even in the implementations that permit it, null should not be inserted into a Queue, as null is also used as a special return value by the poll method to indicate that the queue contains no elements.

This means that you should use the fact that null is returned by poll as an indication that the queue was empty - you don't need to do the calls separately.
poll may be atomic - depending on the implementation of Queue you are actually using:

*

*If you're using a non-synchronized implementation like LinkedList, you should be synchronizing it anyway if multiple threads are modifying the list, making poll atomic;

*Concurrent implementations like BlockingQueue implements poll atomically, so you don't need to worry about doing anything explicitly.

TL;DR:

*

*Remove the !isQueueEmpty() check

*Ensure that your poll method is atomic either by choosing a concurrent implementation, or by synchronizing mutations of the queue.

A: your initialization of Queue is as follows:
m_Queue = new LinkedList<Message>();

LinkedinList is an implementation of Queue which allows null to be added.
so basically you are adding null values into your m_Queue
And as @Andy mentioned, such implementation should not be used when using poll() method.
There are two ways to avoid that

*

*before adding Message to m_Queue you can check if its  null or not

*new LinkedList<Message>(); to new ArrayDequeue<Message>(); where it throws Exception if you are adding null to your Queue

I prefer second one as it makes it as a Queue should really be.


text:
Q: True fullscreen browser display I confess I'm not a regular Mac user so apologies in advance if this is a stupid question.
I'm building a web page to be displayed (offline) as a projection on a wall. On the Windows PC, running Firefox in full screen mode (F11) gives me exactly the desired effect -- no toolbars or other distractions, just the web page filling the entire display.
Over on the Mac (v10.8.5) I've tried getting this effect in both Safari and Firefox. On Firefox I got stuck because I couldn't figure out how to hide the navigation bar (yes, I do feel stupid).
On Safari I can manually get rid of all the toolbars but even after that I'm still stuck with a bright white line across the top of the display where the menu bar would appear were I to drag the mouse up there.
I'm after a solution that doesn't require installing add-ons or other software (this isn't my machine) and that is as low-hassle as possible (non-techy folks will be setting it up each day). I might get away with something that can be run off a USB stick if that helps.

A: This is actually a lot easier in OSX El Capitan now because there is an option to not show the toolbar in fullscreen mode.
However, in Lion, I believe you can still do this:

*

*Enter Full Screen mode

*Secondary click on the grey area above the address bar and choose "Hide Toolbar" in the Contextual Menu displayed.

That should get you what you need.

A: I can think of two way.

*

*Opera

In addition to Fullscreen Mode, Opera has a Presentation Mode. It is a fullscreen window without any UI.

*Classic Theme Restorer & Tree Style Tab Addons.

CTR allows you to hide toolbars, while TST autoshow/hide tabbar when the cursor is near an edge of the screen.


text:
Q: incrementally un-hide input boxes and text with 1 button I have a couple input boxes that are generated dynamically and are attached on the bottom of some lists. These are for custom user input, alongside selected objects. I need this to be expandable by 1 upon each push of a button. I'm really new with jquery so I'm sure I've mixed up the syntax somewhere but I'm not really sure where. When I click my button nothing happens. What am I missing?
Here's my jquery:
var addanother;
function increment(){
    addanother++;
    $('input['.addmore'="'+ addanother +'"]').show();
}

Here's my HTML:
<input type="button" onClick="increment()" value="Add more!"/>

<input id="<?php echo $catkey; ?>_addone_friendly_1" type="text" class="auto" size="9" /> - Friendly

<input id="<?php echo $catkey; ?>_addone_1" name="[<?php echo $catkey; ?>][]" type="text" class="auto" size="9" /> - Exact

<input id="<?php echo $catkey; ?>_addone_friendly_2" type="text" class="auto" size="9" /> - Friendly

<input id="<?php echo $catkey; ?>_addone_2" name="[<?php echo $catkey; ?>][]" type="text" class="auto" size="9" /> - Exact

... and so on

Thanks!

A: To increment something, it has to start with something other than undefined, and you mixed the quotes:
var addanother = 0;

function increment(){
    addanother++;
    $('.addmore'+addanother).show();
}

FIDDLE

A: Another way to approach this would be to get rid of the sequence numbers, just make all of them class="addmore", and let jquery find the first one that's hidden and show it.
function increment() {
  $('.addmore').filter(':hidden').eq(0).show()
}


text:
Q: Why are key codes seen differently on Windows and Linux? I am writing a program in Python using a library called Pynput. This library can listen for keys by utilizing key codes such as these ones. In Windows, this has been working fine and the key codes are the same as in the above link, but in Linux, some keys are off by 32, while others are off by 16.
For example, the ! key appears as 049 when I run my program in Windows, but as 033 when I run it in Linux (difference of 16). The r key in Windows appears as 82, while it appears as 114 in Linux. Lastly, the numpad keys 0 - 9 show as key codes 096 - 105 in Windows, but in Linux their key codes show as "None" except for numpad 5 which shows as 65437. This last example is especially strange to me.
The result of this is that my program works fine in Windows, and typing in !reload is interpreted as it is typed, but in Linux, it is interpreted as !r5lo14 instead. The most confusing part about this is that only some keys are interpreted correctly while some are not. The letters are all off by 32, but r, l, and o are correct, e, a, and d are not correct. The ! key is also correct despite being off by 16 instead of 32. The numpad keys all interpret correctly except numpad 5.
This is how I got the key value from my program:
# Starts Pynput listener. When you press a key, it calls word_builder with the argument key
with Listener(on_press=self_word_builder) as self._listener:
    self._listener.join()

# Builds a word as you type
def word_builder(self, key):

    self._key = key

    # Assigns self._keycode with the string value of key
    self._keycode_to_keydata()

    # MAP VK KEYS HERE. Below codeblock shows this in more detail

    # Output resulting key
    print(self._keycode)

I just wanted to note that this isn't a problem with Pynput as it was not recognizing the numpad keys even on Windows. We fixed this by remapping keys pynput read as vk, such as vk_numpad1. This is when it no longer worked correctly on Linux. This remap is as per below:
    # Map virtual key codes for key codes outside the typical ASCII keyboard range
    self._vk_map = {
        110: '.',  # [Num .]
    }
    # Numpad support
    self._vk_map.update({i: f'{i - 96}' for i in range(96, 106)})  # [Num 0] = 96, [Num 1] = 97

    if hasattr(self._key, 'vk'):
        # Map the vk values
        if self._key.vk in self._vk_map:
            key = self._vk_map[self._key.vk]

Before our fix, everything worked correctly on Windows and Linux except for the numpad keys, so it is almost as if Linux shows some keys as virtual keys and not others, but I'm not sure how to confirm this.
In my attempts to fix this, I have tried searching for a Linux equivalent of the Window key codes I posted above, but I couldn't find anything. The closest thing I found was an app on my machine called Character Map which found these keys in separate lists. For example, when I searched for my lower case e it came up wrong (101) but upper case E was right (069). Each of these appeared in a different list of characters that was named differently. The ! appeared in a third list of characters. Does Linux have any default list of key codes, or is it different on each Linux machine?
I also looked into fixing this programmatically, but I can't find any other people listing this issue anywhere I have looked. I don't really understand what is happening so it is very difficult for me to even attempt a fix. I have only found the cause (character codes are appearing incorrectly in Linux) but as they do not diverge from the Windows equivalent with the same amount, I can't just fix this offset. I was hoping with this post to get an understanding of what is happening, and any suggestions for how best to tackle this issue. Thanks in advance for any suggestions.


text:
Q: How can I match a word containing every vowel at least once? How can I match a word containing every vowel at least once?

A: It depends what you mean by a "vowel" — and for that matter, what you mean by "word", too — but the normal way would be something like this:
(?xsi)
(?= .* a)
(?= .* e)
(?= .* i)
(?= .* o)
(?= .* u)
(?= .* y)

But you don't want to do it that way.  You want to put the logical conjunction in the programming language proper, not the regex, which leads to something like this (disregarding casing issues):
/a/ && /e/ && /i/ && /o/ && /u/ && /y/

What's a Vowel?
Note that the entire "vowel" issue is pretty ridiculous, because any continuant can act like a vowel, even if it doesn't look like one. That means that some letters that don't look like vowels, are. Plus sometimes letters look like vowels but aren't.

*

*For example, the s is psst, the second l in little, the r in acre, and the n in nth are all acting as vowels. Plus there's the famous word cwm, from Welsh, where w is a vowel.

*Furthermore, the e in Mike is not acting as a vowel, whereas the i there is a diphthong (two vowels fused).

*Also, while the y in sky is a vowel, the y in yellow is not a vowel.

*You'll have to figure out how many vowels you think there are in words like lie or speak, or even queue.

*Finally, if you have diacritics, you have to decide whether to count them as separate.  Are e, é, è, and ê just one vowel, or four?

A: How about this
\s* (?= \S* a)  (?= \S* e)  (?= \S* i)  (?= \S* o)  (?= \S* u)  (?= \S* y) (\S*)


text:
Q: Why CDI not working? I have the next rest service:
@ApplicationPath("geo")
@Path("weather")
public class MainResource extends Application {

    @Inject
    private MainDep dep;

    @GET
    public String printGotIt() {
        return "Got it!";
    }

    @GET
    @Path("propaganda")
    public String printPropaganda() {
        return dep.printPropaganda();
    }
}

MainDep dependency code:
public class MainDep {
    public String printPropaganda() {
        return "Interesting enterprise";
    }
}

When I trying to use resource on following url: host:port/root/geo/weather GlassFish threw a javax.servlet.ServletException:
type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
`javax.servlet.ServletException: Servlet.init() for servlet com.app.weather.rs.MainResource threw exception
root cause`
A MultiException has 1 exceptions.  They are:
    1. org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=MainDep,parent=MainResource,qualifiers={}),position=-1,optional=false,self=false,unqualified=null,22064320)
    root cause
    org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=MainDep,parent=MainResource,qualifiers={}),position=-1,optional=false

A: You need to add @RequestScoped to your class.

A: The problem here is that you're mixing JAX-RS Application + JAX-RS resource class in one class and on top of that you're adding a CDI injection into the mix.
Try to separate the JAX-RS Application from JAX-RS resource, like:
@ApplicationPath("geo")
public class MainApplication extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        final Set<Class<?>> classes = new HashSet<Class<?>>();
        classes.add(MainResource.class);
        return classes;
    }
}

and
@Path("weather")
public class MainResource {

    @Inject
    private MainDep dep;

    @GET
    public String printGotIt() {
        return "Got it!";
    }

    @GET
    @Path("propaganda")
    public String printPropaganda() {
        return dep.printPropaganda();
    }
}


text:
Q: Attempt at variadic functions for MSIProcessMessage crashed C++ compiler I'm trying to write variadic template functions to help simplify the reporting of errors to MSI from MSI DLL calls. This is my first encounter with variadic functions (I hadn't heard the term before), and so I apparently screwed it up pretty badly seeing as how I crashed the compiler with my attempt:
UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index)
{
   return MsiProcessMessage(hInstall, eMessageType, hRec);
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index, TCHAR message, Args... rest)
{
   LRESULT lResult = MsiRecordSetString(hRec, index, message);
   if (ERROR_SUCCESS != lResult)
      return lResult;
   return ReportMSIMessage(hInstall, eMessageType, hRec, index + 1, rest...);
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index, int value, Args... rest)
{
   LRESULT lResult = MsiRecordSetInteger(hRec, index, value);
   if (ERROR_SUCCESS != lResult)
      return lResult;
   return ReportMSIMessage(hInstall, eMessageType, hRec, index + 1, rest...);
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, Args... rest)
{
   const int argCount = sizeof...(Args);
   if (eMessageType == INSTALLMESSAGE_INFO)
   {
      PMSIHANDLE hLogRec = MsiCreateRecord(argCount-1);
      return ReportMSIMessage(hInstall, eMessageType, hLogRec, 0, rest...);
   }
   else
   {
      PMSIHANDLE hLogRec = MsiCreateRecord(argCount);
      return ReportMSIMessage(hInstall, eMessageType, hLogRec, 1, rest...);
   }
}

When I compile, the compiler hangs for quite a while and finally reports:
1>  Note: non-fatal system error releasing memory (487)
1>SetupFunc.cpp(1460): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'msc1.cpp', line 1325)
1>   To work around this problem, try simplifying or changing the program near the locations listed above.
1>  Please choose the Technical Support command on the Visual C++
1>   Help menu, or open the Technical Support help file for more information

Then there are hundreds or thousands of lines line this:
see reference to function template instantiation 'UINT ReportMSIMessage<PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,const char*,TCHAR*>(MSIHANDLE,INSTALLMESSAGE,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,PMSIHANDLE,int,const char *,TCHAR *)' being compiled

(That's just the shortest of the many lines)

A: One of the problems was that the TCHAR parameter should have been TCHAR * instead. This might have been interfering with the compiler's ability to pick the right template instance, overload, or whatever you call it, given that I was calling the template function with TCHAR * arguments. Another problem may have been the similarity of the argument data types near the end of the list. But I needed to add an int * parameter to receive the return value from MsiProcessMessage anyway. With these two changes in place, the compiler and code are working much better.
UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index, int *iResponse)
{
   int response = MsiProcessMessage(hInstall, eMessageType, hRec);
   if (iResponse != NULL)
      *iResponse = response;
   if (response == -1)
      return ERROR_BAD_ARGUMENTS;
   return ERROR_SUCCESS;
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index, int *iResponse, const TCHAR *message, Args... rest)
{
   LRESULT lResult = MsiRecordSetString(hRec, index, message);
   if (ERROR_SUCCESS != lResult)
      return lResult;
   return ReportMSIMessage(hInstall, eMessageType, hRec, index + 1, iResponse, rest...);
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, PMSIHANDLE& hRec, int index, int *iResponse, int value, Args... rest)
{
   LRESULT lResult = MsiRecordSetInteger(hRec, index, value);
   if (ERROR_SUCCESS != lResult)
      return lResult;
   return ReportMSIMessage(hInstall, eMessageType, hRec, index + 1, iResponse, rest...);
}
template <typename... Args> UINT ReportMSIMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, int *iResponse, Args... rest)
{
   const int argCount = sizeof...(Args);
   if (eMessageType == INSTALLMESSAGE_INFO)
   {
      PMSIHANDLE hLogRec = MsiCreateRecord(argCount-1);
      return ReportMSIMessage(hInstall, eMessageType, hLogRec, 0, iResponse, rest...);
   }
   else
   {
      PMSIHANDLE hLogRec = MsiCreateRecord(argCount);
      return ReportMSIMessage(hInstall, eMessageType, hLogRec, 1, iResponse, rest...);
   }
}

One change that helped to narrow down the problems was changing the function names from ReportMSIMessage to ReportMSIMessageRec where one of the parameters was a PMSIHANDLE. That prevented the compiler from potentially picking the recursive option long enough to tell me why the other templates weren't working out as options.


text:
Q: SQL syntax error in Java Servlet I tried to do this:
query1="INSERT INTO `users`(`email`, `password`, `login`, `familiya`, `name`, `otchestvo`, `age`, `country`, `city`, `mob`, `skype`) VALUES ("+user.getEmail()+","+user.getPassword()+","+user.getLogin()+","+user.getFamiliya()+","+user.getName()+","+user.getOtchestvo()+",11,"+user.getCountry()+","+user.getCity()+","+user.getMob()+","+user.getSkype()+")";

what did I do wrong? All "get" is not null, only syntax error.
I want to post image of database but I need 10 reputation...
all fields are varchar(15), age is int(2)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@mail.ru,12345,dima,Dmitriev,dima,Dmitrievich,11,Dmitrountry,Dmitriegrad,2020327' at line 1

A: put single quotes " ' " around your string values (varchar, text etc)
so
String query1="INSERT INTO users(email, password, login, familiya, name, otchestvo, age, country, city, mob, skype) VALUES  ('"+user.getEmail()+"','"+user.getPassword()+"','"+user.getLogin()+"','"+user.getFamiliya()+"','"+user.getName()+"','"+user.getOtchestvo()+"',11,'"+user.getCountry()+"','"+user.getCity()+"','"+user.getMob()+"','"+user.getSkype()+"')";

not string related types DON't get single quotes....
A better way to do this however is using PreparedStatement,
String sql = "INSERT INTO users(email, password, login, familiya, name, otchestvo, age, country, city, mob, skype) VALUES  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

 try (PreparedStatement preparedStatement = con.prepareStatement(sql)) {
     preparedStatement.setString(1, user.getEmail);
     preparedStatement.setString(2, user.getPassword);
     preparedStatement.setString(3, user.getLogin());
     preparedStatement.setString(4, user.getFamiliya());
     preparedStatement.setString(5, user.getName());
     preparedStatement.setString(6, user.getOtchestvo());
     preparedStatement.setInt(7, 11);
     preparedStatement.setString(8, user.getCountry());
     preparedStatement.setString(9, user.getCity());
     preparedStatement.setString(10, user.getMob());
     preparedStatement.setString(11, user.getSkype());
     preparedStatement.executeUpdate();
}


text:
Q: PHP_XLSXWriter library questions I have some question about the PHP_XLSXWriter:
(1)
When I go to example.php, I don't understand the below code:
$writer->writeToStdOut();

What is the code meaning?
(2)
When I go to example-cli-load.php, I follow this code:
echo '#'.floor((memory_get_peak_usage())/1024/1024)."MB"."\n";

It shows #0MB in web page. Why?
(3)What is the difference between the writeSheetRow and writeSheet?
(4)What is the purpose of writeSheetHeader from the following code?
$header = array("string","string");
...
$writer->writeSheetHeader($sheet_name, $header, $suppress_header_row = true);`

A:
(1)
  When I go to example.php, I don't understand the below code:
$writer->writeToStdOut();
What is the code meaning?

It means write the spreadsheet to standard output (the browser) rather than write it to a file on the server

(3)
  What is the difference between the writeSheetRow and writeSheet?

writeSheetRow() writes a single row at the end of the worksheet; writeSheet() writes all the rows in the array that you pass as the argument

(4)
  What is the purpose of writeSheetHeader from the following code?
$header = array("string","string");
  ...
  $writer->writeSheetHeader($sheet_name, $header, $suppress_header_row = true);

writeSheetHeader() doesn't just write a header row, it also sets style for a column. Suppressing the header row still sets the column styling (to string in this case) but without writing an actual header row


text:
Q: Dynamically updating polygon shape in tkinter window I'm writing a program for my raspberry pi4 for my Master's project which sounded so simple at first but for some reason Python is causing me grief.
In short - I have created a tkinter canvas with a polygon centred on the canvas. The shape of this polygon will depend upon the value of a counter.
The count is controlled by a blink event from a neurosky mindwave headset - this count is working (mostly).
What I want to then do is update the canvas to put the new points for the polygon into the pack but nothing I have tried seems to work. The closest I got was trying a .redraw() command which drew an infinite number of windows before I pulled the plug.
I am not a complete novice to coding having taught many languages in my time but have never used python before and am clearly missing a very simple step which will cause everything to fall out.
I will try to modify the code to use a keyboard press rather than a headset and add it below later if folk think it will help.
import keyboard
import time
from tkinter import *
count = 0
points = [250,250,350,250,350,350,250,350]
root = Tk()
while True:

# set window to middle of screen
    screen_width = root.winfo_screenwidth()
    screen_height = root.winfo_screenheight()
    xcoord = screen_width/2-300
    ycoord = screen_height/2 - 300
    root.geometry("%dx%d+%d+%d" % (600,600,xcoord,ycoord))
#set up canvas size and background colour
    canvas1 = Canvas(root, relief = FLAT,width = 600, height = 600, background = "blue")
#set up buttons shape and colour
    button = canvas1.create_polygon(points, fill="darkgreen", outline="yellow")
    canvas1.pack()
    if keyboard.is_pressed("f"):
        if count < 4:
            count += 1
        elif count == 4:
            count = 0
    time.sleep(0.1)

    if count == 0:
        points = [250,250,350,250,350,350,250,350]
    elif count == 1:
        points = [300,100,500,500,100,500]
    elif count == 2:
        points = [200,100,400,100,300,500]
    elif count == 3:
        points = [100,300,500,100,500,500]
    elif count == 4:
        points = [100,100,100,500,500,300]
    print(count)
    root.update()

A: You need to delete the old polygon and create new one.  Also don't use while loop in tkinter application.  For your case, you can bind a callback on <Key> event and update the polygon in the callback:
import tkinter as tk

count = 0
points = [
    [250,250,350,250,350,350,250,350],
    [300,100,500,500,100,500],
    [200,100,400,100,300,500],
    [100,300,500,100,500,500],
    [100,100,100,500,500,300],
]

root = tk.Tk()

# set window to middle of screen
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
xcoord = screen_width//2 - 300
ycoord = screen_height//2 - 300
root.geometry("%dx%d+%d+%d" % (600,600,xcoord,ycoord))

#set up canvas
canvas1 = tk.Canvas(root, relief=tk.FLAT, background="blue")
canvas1.pack(fill=tk.BOTH, expand=1)

# create the polygon with tag "button"
canvas1.create_polygon(points[count], fill="darkgreen", outline="yellow", tag="button")

def on_key(event):
    global count
    if event.char == 'f':
        count = (count + 1) % len(points)
        print(count)
        canvas1.delete("button") # delete the old polygon
        canvas1.create_polygon(points[count], fill="darkgreen", outline="yellow", tag="button")

root.bind("<Key>", on_key)

root.mainloop()

A: You can update any parameters of a shape.
canvas.itemconfigure(shape1_id_or_tag, fill="green")
canvas.itemconfigure(shape2_id_or_tag, fill="#900", outline="red", width=3)

But for your situation try '.coords()':
canvas1.coords("Button", points[count])

Source: https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/canvas-methods.html


text:
Q: Can pytest_sessionfinish still call the fixture with session as scope? I need call one fixture when all the tests are successful. I tried to check if all tests are successful in pytest_sessionfinish. I also put my fixture with the session scope @pytest.fixture(scope="session"). However, the code in pytest_sessionfinish can not call this fixture at all. Are there some way to solve this issue?
@pytest.fixture(scope="session")
def myfunction(
    ser: Serial, logger: Logger
) -> bool:
    print("In my function")
...

@pytest.hookimpl(trylast=True)
def pytest_sessionfinish(session, exitstatus):
   print("Prepare to call myfunction")
   myfunction

It only showes "Prepare to call myfunction" as the output.
Thanks!


text:
Q: Rotation in LYX package Hey I am using Lyx and would like to use to rotate a table because it does not fit my page.
I used the below link to rotate however when running the programming an error occured .
tex.stackexchange.com/questions/298668/how-to-rotate-a-large-matrix-in-lyx

Can someone guide me how can I solve this please?


text:
Q: salesforce custom field use case In Salesforce I am wanting create a custom field in Contact called 'Chapter' that references 2 other fields (State and Country' to auto populate itself. similar to a case in SQL
e.g.
'Chapter' =
    CASE
       When country = 'Aus' and state in ('NSW', 'ACT') then 'NSW / ACT`
       When country = 'Aus' and state in ('VIC', 'TAS') then 'VIC / TAS`
       When country = 'Aus' and state in ('SA', 'NT') then 'SA / NT`
       When country = 'Aus' and state in ('WA, 'QLD') then 'WA/QLD'
       When country = 'NZ' then 'NZ'
       When country not in ('Aus', NZ) then 'INT'
    END

I presume I use the formula data type when creating field however I can not seem to write the formula.

A: I worked this out on my own. It was an custom field using a IF formula
F(Country = "Aus" && State = "NSW" , "NSW/ACT",
IF(Country = "Aus" && State = "ACT" , "NSW/ACT",
IF(Country = "Aus" && State = "TAS" , "VIC/TAS",
IF(Country = "Aus" && State = "VIC" , "VIC/TAS",
IF(Country = "Aus" && State = "SA" , "SA/NT",
IF(Country = "Aus" && State = "NT" , "SA/NT",
IF(Country = "Aus" && State = "WA" , "WA",
IF(Country = "Aus" && State = "QLD" , "QLD",
IF(Country = "NZ" , "NZ",
IF(Country <> "New Zealand" && Country <> "Aus" , "INT",
""))))))))))


text:
Q: NavigationController size issue I have a NavigationController with a root ViewController which in storyboard is the size of an iPhone 6 plus, and one of my test devices is an iPhone 5.
In the viewDidLoad() i print out the view height, when testing on iPhone 5 it says that the size is 568 which is the iPhone 5 height... but if I print out the height after a little delay with dispatch_after() it says 504.
I need to have the view for the ViewController set to 504 before viewDidLoad() gets called.
What could be the problem?


text:
Q: Tomcat running, catalina throwing exception  So I have to preface that I'm not familiar with tomcat/catalina, but trying to troubleshoot this anyway. Anyway I see in /var/log/tomcat5/catalina.out I'm seeing these errors:
Using CATALINA_BASE:   /usr/share/tomcat5
Using CATALINA_HOME:   /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:223)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)

I'm not really sure what this means. This installation was working a week ago ... did something get corrupted? How would I figure if it did ... what other information would be valuable here?
Tomcat seems to be running and starting up fine ...
UPDATE: this might be related:
Jun 19, 2011 11:00:25 PM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-9080
Jun 19, 2011 11:00:26 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.

Some more stuff in the logs:
2011-06-12 23:04:45,223 INFO [main] [com.atlassian.confluence.lifecycle] contextInitialized Starting Confluence 3.1.1 (build #1724)
2011-06-12 23:04:45,663 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from c
lass path resource [bootstrapContext.xml]
2011-06-12 23:04:46,134 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from c
lass path resource [setupContext.xml]
2011-06-12 23:04:46,236 INFO [main] [beans.factory.xml.XmlBeanDefinitionReader] loadBeanDefinitions Loading XML bean definitions from c
lass path resource [bootstrapCacheContext.xml]
2011-06-12 23:04:47,571 INFO [main] [atlassian.plugin.manager.DefaultPluginManager] init Initialising the plugin system
2011-06-12 23:04:48,338 INFO [main] [atlassian.plugin.manager.DefaultPluginManager] init Plugin system started in 0:00:00.748
Jun 12, 2011 11:05:05 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:525)
        at java.net.Socket.connect(Socket.java:475)
        at java.net.Socket.<init>(Socket.java:372)
        at java.net.Socket.<init>(Socket.java:186)
        at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:344)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435)
Jun 12, 2011 11:05:44 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.pa
th: /usr/java/jdk1.6.0_18/jre/lib/i386/client:/usr/java/jdk1.6.0_18/jre/lib/i386:/usr/java/jdk1.6.0_18/jre/../lib/i386:/usr/java/packag
es/lib/i386:/lib:/usr/lib

CLEAN LOG OUTPUT FROM STARTING TOMCAT:
Using CATALINA_BASE:   /usr/share/tomcat5
Using CATALINA_HOME:   /usr/share/tomcat5
Using CATALINA_TMPDIR: /usr/share/tomcat5/temp
Using JRE_HOME:
java.lang.ClassNotFoundException: org.apache.catalina.startup.Catalina
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:223)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:410)

So I did a /etc/rc.d/init.d/tomcat status and I get this:
[wqadm1n@ip-72-167-51-178 proc]$ sudo /etc/rc.d/init.d/tomcat5 status
/etc/rc.d/init.d/tomcat5 is stopped
[wqadm1n@ip-72-167-51-178 proc]$ sudo /etc/rc.d/init.d/tomcat5 start
Starting tomcat5:                                          [  OK  ]
[wqadm1n@ip-72-167-51-178 proc]$ sudo /etc/rc.d/init.d/tomcat5 status
lock file found but no process running for pid 30774

A: You don't have a JRE_HOME directory set. You need to download the java SDK (yes, SDK) and point your JRE_HOME to the root of your SDK folder.
You need to set it in your init script or your catalina.sh (my preference has always been catalina.sh)
Also see my answer here
My guess is that the init script is su'ing into a different user enviroment, so if you don't have it in your startup scripts it will never get properly set.

A: I was facing the same issue. Then I noticed that I have accidentally deleted lib folder from tomcat directory. The issue got resolved as "lib" back in place. May this help.


text:
Q: Virtual void not being overridden with override keyword in C# I am trying to make a class the user of my library can derive from and  then access a method for debugging the times of each action. Because my main debug method, where most information is stored, is static (and needs to be), I cannot use it to derive a class or add an overridable method in it. To combat this, I added the following code:
public static class Debug
{
    internal static void CallObjectEvent(string log)
    {
        new Call().CallEvent(new Log(log, Timer.GetTime()));
    }
}

internal class Call : IDebug
{
    internal void CallEvent(Log log)
    {
        base.Event(log);
    }
}

public class IDebug
{
    public virtual void Event(Log log) {Console.WriteLine("test");}
}

class Program : IDebug
{
    public override void Event(Log log)
    {
        Console.WriteLine(log.log);
    }
}

Every time, it outputs 'test' instead of the log message. How can I fix this? Are there any alternatives to do the same thing?

A: Your Debug.CallObjectEvent() method explicitly instantiates a Call object and calls the overridden method in that class:
public static class Debug
{
    internal static void CallObjectEvent(string log)
    {
        new Call().CallEvent(new Log(log, Timer.GetTime()));
    }
}

The CallEvent() method in the Call class simply calls base.Event(), which resolves to IDebug.Event(). The Program.Event() override is never invoked because Program is not in the class hierarchy at the point of the call.
When you override a method or property, the override applies only to the class where it is defined (and all of its child classes, of course). Since Program isn't a parent class of Call there's no reason why its overrides would ever be referenced.
From what you've written it looks like you're trying to set up a system for handling different log outputs depending on the program's requirements. You need a way to register the appropriate log writer for your program. Something like:
public interface ILogWriter
{
    void Event(Log item);
}

private class DefaultLogWriter : ILogWriter
{
    public void Event(Log item)
    {
        Console.WriteLine($"[test] {item.Time} {item.Message}");
    }
}

internal static class Debug
{
    private static ILogWriter _writer = null;

    public static ILogWriter Writer
    {
        get
        {
            if (_writer == null)
                _writer = new DefaultLogWriter();
            return _writer;
        }
        set => _writer = value;
    }

    internal static void CallObjectEvent(string log)
    {
        Writer.Event(new Log(log, Timer.GetTime()));
    }
}

class Program
{
    private class MyLogWriter : ILogWriter
    {
        public void Event(Log item)
        {
            Console.WriteLine($"[MyLogWriter] {item.Time} {item.Message}");
        }
    }

    static void Main()
    {
        Debug.Writer = new MyLogWriter();

        Debug.CallObjectEvent("Test message.");
    }
}


text:
Q: OAUTH2: On accessing the REST end point from customer end UI to secure URI returns anonymousUser I am working on OAUTH2 spring security, i am supposed to hit http://localhost:8082/ui - REST end point from client UI which will take me to the secure URI http://localhost:8082/secure after logging into the auth server http://localhost:8081/auth/login.
But instead it after hitting on client UI http://localhost:8082/ui it is directly taking me to http://localhost:8082/secure, not prompting for login page. and on secure page "anonymousUser" value is returned.
I am sharing my client and server below, and value returned is "Welcome Login User!== anonymousUser".
Any help would be really appreciated where i'm doing wrong.
my client side configuration
@EnableOAuth2Sso
@Configuration
@EnableWebSecurity
public class OauthConfig extends WebSecurityConfigurerAdapter {

     @Autowired
        private OAuth2ClientContextFilter oauth2ClientContextFilter;

    @Override
    protected void configure(HttpSecurity http) throws Exception {

    http
        .authorizeRequests()
        .antMatchers("/**")
       .permitAll()

       .antMatchers("/", "/login/**")
       .permitAll()
            .anyRequest()
            .authenticated().and()
            .httpBasic().and().addFilterAfter(oauth2ClientContextFilter, SecurityContextPersistenceFilter.class);
        }

    @Bean
    protected OAuth2RestTemplate OAuth2RestTemplate(
        OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context) {
      return new OAuth2RestTemplate(resource, context);
    }
    }

application.yml
server:
  port: 8082
  servlet:
    context-path: /ui
  session:
    cookieName: UISESSION

 security:
   oauth2:
    client:
      clientId: ClientId
      clientSecret: secret
      accessTokenUri: http://localhost:8081/auth/oauth/token
      userAuthorizationUri: http://localhost:8081/auth/oauth/authorize
      scope: openid
    resource:
      userInfoUri: http://localhost:8081/auth/rest/hello/principal
      preferTokenInfo: false

application.properties
spring.thymeleaf.cache= false
spring.mvc.view.prefix=/
spring.mvc.view.suffix=.html

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration

server.port= 8082
server.servlet.session.cookie.name=UISESSION

spring.thymeleaf.mode=LEGACYHTML5

management.endpoints.web.expose=*

server side authorization server
@Configuration
@EnableAuthorizationServer
public class AuthorisationServerConfig extends AuthorizationServerConfigurerAdapter {

    @Autowired
    private AuthenticationManager authenticationManager;

    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
        // TODO Auto-generated method stub
        //security.allowFormAuthenticationForClients();
        security.tokenKeyAccess("permitAll()")
        .checkTokenAccess("isAuthenticated()");

    }

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {

        clients.inMemory().withClient("ClientId")//.authorities("ROLE_ADMIN")
        .secret("{noop}secret")
        .authorizedGrantTypes("authorization_code").scopes("user_info").autoApprove(true);
    }

    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        // TODO Auto-generated method stub
        endpoints.authenticationManager(authenticationManager);
    }

}

serve side resource server
@EnableResourceServer
@Configuration
@Order(1000)
public class ResourceServerConfig  extends WebSecurityConfigurerAdapter {

    @Autowired
    private AuthenticationManager authenticationManager;
    @Autowired

    private  UserDetailsService customUserDetailsService;

    @Autowired
      public ResourceServerConfig(AuthenticationManager authenticationManager,
              CustomUserDetailsService customUserDetailsService) {
        this.authenticationManager = authenticationManager;
        this.customUserDetailsService = customUserDetailsService;
      }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.requestMatchers().antMatchers("/login","/oauth/authorize").and().authorizeRequests()
        .anyRequest().authenticated().and().formLogin().permitAll();

    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.parentAuthenticationManager(authenticationManager).
        userDetailsService(customUserDetailsService);

    }
}

server side Service
@Service
public class CustomUserDetailsService implements UserDetailsService{

    @Autowired
    private UserRepository userRepository;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        // TODO Auto-generated method stub
        Optional<Users> userOptional= userRepository.findByName(username);
        userOptional.orElseThrow(() -> new UsernameNotFoundException("user not found"));
        return userOptional.map(users -> new CustomUserDetails(users)).get();
    }

}


text:
Q: Overload subscript operator in Fortran I have some matrix type that can either be real or complex:
type t_mat
   logical :: is_real
   real    :: data_r(:,:)
   complex :: data_c(:,:)
end type

and I would like to overload the =-operator as well as the (i,j) operator, so that I could conveniently say:
type(t_mat) :: a

...

a(2,3) = 3

I know in C++ it is possible to overload the subscript operator. Does Fortran allow for something similar?


text:
Q: What is $\lim_{x \to 0} \frac{\cos^{-1}(1-\{x\}^2) \sin^{-1}(1-\{x\})}{\{x\}-\{x\}^3}$, where $\{\cdot \}$ represents fractional part function? What is $$\lim_{x \to 0} \frac{\cos^{-1}(1-\{x\}^2) \sin^{-1}(1-\{x\})}{\{x\}-\{x\}^3}$$, where $\{\cdot \}$ represents fractional part function?
I have made some headway with both left and right limits, but I haven't completed any yet.
For right hand limit, $\{x\} =x$.
This gives $$\lim_{x \to {0^+}} \frac{\cos^{-1}(1-x^2) \sin^{-1}(1-x)}{x-x^3}$$ I don't know how to proceed after this. I tried using L'Hopital rule, but it gets way too complicated.
Also, for left hand limit, $\{x\} = x+1$. This gives
$$\lim_{x \to {0^-}} \frac{\cos^{-1}(-x^2-2x) \sin^{-1}(-x)}{(1+x)(-x^2-2)}$$
I don't know how to solve this limit further. Any help is appreciated.

A: Taylor is not necessary.
$$\lim_{x\to +0} \frac{cos^{-1}(1-x^2) sin^{-1} (1-x)}{x-x^3} = \lim_{x\to +0} \frac{cos^{-1}(1-x^2)}{x-x^3} \lim_{x\to +0}sin^{-1} (1-x) =  \frac{\pi}{2} \lim_{x\to +0} \frac{cos^{-1}(1-x^2)}{x-x^3}  = (L'Hopital) \frac{\pi}{2} \lim_{x\to +0} \frac{2x}{\sqrt{2x^2 - x^4}*(1-3x^2)} = \frac{\pi}{2} \lim_{x\to +0} \frac{2}{\sqrt{2 - x^2}*(1-3x^2)} = \frac{\pi}{\sqrt{2}}$$

A: When $\;x\to0\;$ , say $\;x\in(-0.1,\,0.1)\;$ , we already have $\;x=\{x\}\;$ (see my comment below the question), so your function in fact is
$$\frac{\arccos(1-x^2)\arcsin(1-x)}{x-x^3}=\frac{\arccos(1-x^2)}x\frac{\arcsin(1-x)}{1-x}\frac1{1+x}$$
Now, with l'Hospital:
$$\lim_{x\to0}=\frac{\arccos(1-x^2)}x\stackrel{\text{l'H}}=\lim_{x\to0}\frac{2x}{\sqrt{1-(1-x^2)^2}}=\lim_{x\to0}\frac2{\sqrt{2-x^2}}=\sqrt2$$
and thus the limit is
$$\frac{\arccos(1-x^2)}x\frac{\arcsin(1-x)}{1-x}\frac1{1+x}\xrightarrow[x\to0]{}\sqrt2\cdot\frac\pi2\cdot1=\frac\pi{\sqrt2}$$


text:
Q: Python oci sdk question regarding boot volume backup How do we find boot volume backups of the particular instance using python oci package
list_boot_volume_backups function will return all the backups in the compartment.
ref: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/BootVolumeBackup/ListBootVolumeBackups

*

*if we need to pass source_boot_volume_backup_id then where do we find this value

*we can use boot_volume_id but in that case as well ListBootVolumes function will list all the boot volumes in the compartment.
ref:  https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/BootVolume/ListBootVolumes
Thank you in advance!!

A: You would have to utilize the ListBootVolumeAttachments API, you can filter by Instance OCID, boot volume OCID, or both. ref: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/BootVolumeAttachment/ListBootVolumeAttachments
The above would return you the Boot Volume Attachment OCID which can then be used with the GetBootVolumeAttachment API to get details of the attachment between a boot volume and an instance.
ref: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/BootVolumeAttachment/GetBootVolumeAttachment
Hope this helps solve your issue!


text:
Q: Hyperref is loaded by the class, and I need to load packages that are supposed to be loaded before I am using the lipics documentclass, which loads hyperref. Since I want my figures boxed, I added the following
\usepackage{float}
\floatstyle{boxed}
\restylefloat{figure}

The problem: I receive warnings of the kind
name{figure.1} has been referenced but does not exist,replaced by a fixed one

which use to happen when I load the float package after hyperref.
The question: is there any correct way to do this without redefining the class?

A: It is well-known (and should be to class authors) that hyperref needs to be loaded as late as possible. Hence, the class should really be changed not to load hyperref.

A: In the KOMA-Script-bundle, Markus Kohm's replacement for the standard LaTeX-classes and much more, he includes a package called scrlfile, that is designed to execute actions both before and after the loading of files. May be that package can solve your problems. It can be used on a stand alone basis.
If you do not read German, the author has started the work on improving the English manual. He describes scrlfile on pages 248ff. You will find KOMA-Script at CTAN and BerliOS.
Links to the new, improved, English manual you will find here.

A: In my case, I added:
\RequirePackage{fooPackage}
\PassOptionsToPackage{bookmarks=false}{hyperref}

BEFORE \documentclass, which fixed the issue I was having without modifying the class.

A: Short version: yes, you'll have to redefine the class, or at least patch their hyperref inclusion.
I ran into a similar problem with my hyperref-using thesis class (which was originally a package). When it was a package, I could have students load packages before or after my thesis package, and hyperref would then be in the right order. Once I made a class, though, all my packages would be loaded first in the \documentclass line, which made it impossible for anyone to work around hyperref. Rather than abandon hyperref entirely, I added the following to the class:
\IfFileExists{\jobname-packages-loaded-before-hyperref.sty}{%
  \RequirePackage{\jobname-packages-loaded-before-hyperref}
}{}

% For all sorts of hyperlinks in the PDF output.
\RequirePackage[pdfcreator={pdfLaTeX with hyperref},
  plainpages=false,
  pdfpagelabels,
  hypertexnames=true,
  colorlinks=false]{hyperref}

\IfFileExists{\jobname-packages-loaded-after-hyperref.sty}{%
  \RequirePackage{\jobname-packages-loaded-after-hyperref}%
}{}

and now my students just have to put all their extra \usepackage or \RequirePackage entries in one of two .sty files. Examples: before package, after package, and class.


text:
Q: keyInvalid Error when calling Google Calendar API I'm writing a Lambda function that queries Google Calendar events. Although I successfully created a credential (client ID, and client secret) on Google Developers Console, I cannot access the events. Error:

{ "error": { "errors": [{ "domain": "usageLimits", "reason": "keyInvalid", "message": "Bad Request" } ], "code": 400, "message": "Bad Request" } }

My http request looks like this:
https://www.googleapis.com/calendar/v3/calendars/MY_CLIENT_ID/events?key=MY_CLIENT_SECRET
What went wrong? Any help is greatly appreciated.

A:
"domain": "usageLimits", "reason": "keyInvalid", "message": "Bad Request"

Means that the key you are sending is an invalid api key.
Background info
When you make a request to a Google api for public data you can use an API key.  Public data is data that is not owned by a user.  For example public posts on google+, google books.  In these instances you can use an api key inorder to access the api using
GET https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&q=surfing&type=test&key={YOUR_API_KEY}

key identifies your application to google using the api key you create in google developer console.
Private data is data that is owned by a user for instance your google calendar an application can not post to it with out permissions.  Inorder to do this we use Oauth2.  You create a client on google developer console then login the user using oauth2.  you will get an access token back then you can make a request
https://www.googleapis.com/calendar/v3/calendars/MY_CLIENT_ID/events?accesstoken=ACCESSTOKEN

Notice that the first request used key and the second used accesstoken.
Anwser
Your problem is that you are sending a client secret as an api key which will not work because first of all a client secret is not an api key and second events are private user data which will require that you authenticate your user first.


text:
Q: DOM does not represent the html structure of d3 force layout I want to make an SVG group to store a node and text in it. My generated HTML looks like this:
<g class="node" cx="946.6911642155153" cy="434.4579018064595">
    <circle class="circle" r="4.5" />
    <text dx="12" dy="0.35em">Harry Potter</text>
</g>

Nevertheless, the nodes and the text are stuck in the top left corner. I tried to build it from this question on SO.
My code looks like this:
function draw() {
    node = svg.selectAll(".node");
    node = node.data(force.nodes(), function(d) { return d.id;});
    var gnode = node.enter().append('g').attr("class", "node");
    gnode.append("circle").attr("class", "circle").attr("r", 4.5);

    gnode.append("text")
    .attr("dx", 12)
    .attr("dy", ".35em")
    .text(function(d) { return d.name });

    force.start();
}

A working demo can be found here. I suspect that I have to push the gnode to the force.nodes(), but I am not a 100% sure.

A: Your SVG is not correct since the attributes cx and cy are not valid for g elements. They are only applicable to circle elements.
To place the group elements you may use a transformation to translate the g. A simple change in your tick function will solve this:
function tick() {
    node.attr("transform", function(d) {
        return "translate(" + d.x + " " + d.y + ")";
    });
//    node.attr("cx", function(d) { return d.x; })
//        .attr("cy", function(d) { return d.y; });

    link.attr("x1", function(d) { return d.source.x; })
        .attr("y1", function(d) { return d.source.y; })
        .attr("x2", function(d) { return d.target.x; })
        .attr("y2", function(d) { return d.target.y; });
}


text:
Q: S_ISDIR() and S_ISREG() only working properly within current directory? I am writing a simple c program which outputs all the contents within a given directory. Files are printed in green, executables are printed in red, and directories are printed in blue. Files and executables have their size printed as well. The code works properly when I open the current directory with either a relative path (".") or an absolute path. However, when I open other directories, all contents are identified as directories and printed in blue. I am unsure why the behavior changes when opening different directories.
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

int main(int argc, char *argv[]){
    DIR* dir;
    struct dirent* sd;

    dir = opendir(".");

    if(dir == NULL){
        exit(1);
    }
    int fd;
    int size;
    while((sd=readdir(dir)) != NULL){
        struct stat statstruct;
        stat(sd->d_name, &statstruct);

        if(S_ISREG(statstruct.st_mode)){
            fd = open(sd->d_name, O_RDONLY);
            size = lseek(fd, 0, SEEK_END);
            if(statstruct.st_mode & S_IXUSR){
                printf("\033[1;31m%s %d bytes\n\033[0m", sd->d_name, size);
            }
            else{
                printf("\033[0;32m%s %d bytes\n\033[0m", sd->d_name, size);
            }

        }
        else if(S_ISDIR(statstruct.st_mode)){
            printf("\033[0;34m./%s\n\033[0m", sd->d_name);
        }

    }

    closedir(dir);

}

A:
stat(sd->d_name, &statstruct);

stat opens relative to current directory. So the file will be parsed relative to current directory. Instead open the file relative to the directory you are interested in.
int err = fstatat(dirfd(dir), sd->d_name, &statstruct, 0);
if (err) abort(); // yes, handle errors


text:
Q: Woocommerce - Changing sender email address for Admin emails only Woocommerce sends a range of email notifications relating to customer activity.
The default 'From' sender email address is the same for Admin/system emails as well as emails the customer receives - The address is set from a single field.

Due to some spam issues, I need to set one From address for Admin emails, and another From address for customer emails.
How, if at all, can this be achieved?


text:
Q: ¿Python 3 grafica mal una función? Saludos.
Estaba graficando una función cuadrática en Jupyter con kernel python 3 con el siguiente código:
from sympy.plotting import plot
from sympy.abc import t
%matplotlib inline
eq=-16*(t**2)+20*t
plot(eq,t,xlim=(-1,2),ylim=(-1,7))

pero me aparece un gráfico raro:

La prábola parece estar bien pero la recta está de más, ¿alguien de ustedes sabe qué ocurre y como solucionarlo?

A: Primero, lo que devuelve ese código es correcto si tomamos en cuenta que le estás pidiendo las gráficas de -16*(t**2)+20*t y t, es decir dos expresiones diferentes, donde la segunda corresponde a la recta que está de más.
Recordar que la sintaxis más general de la función plot de SymPy, es:
plot(expr, range, **kwargs)

Donde expr puede ser una o más expresiones simbólicas a graficar.
En tu caso bastaría con que indicaras que sólo te interesa graficar la expresión guardada en eq, es decir:
from sympy.plotting import plot
from sympy.abc import t
%matplotlib inline
eq=-16*(t**2)+20*t
plot(eq, xlim=(-1,2), ylim=(-1,7))