text:
Q: Machine Learning on scarce data - how to tackle this task? We are making algorithm for prediction of Conversion Rate (CR) for CPC advertising.
We have historical (statistical) data that we can analyze in many projections (in many factors).
For example we have such independent variables (factors, projections) as:

*

*keyword

*date

*source

*landing page

among others.
Then, when we unite them in the table, many combinations have too few clicks (statistical base).
The table looks like this:
keywords - date - source - landing page - number of clicks - transactions - conversion rate
buy socks - 12.05.2013 - google - buysocks.com - **100** - 1 - 1%
buy red socks - 12.05.2013 - google - buysocks.com/red - **10** - 0 - 0%
buy red socks now - 12.05.2013 - google - buysocks.com/redsocknow - **1** - 0 - 100%

The problem is that we have combinations of factors that lead to too few clicks, meaning that statistically the information is almost useless.
Could you give us advice, how to deal with this kind of task?
We thought of:

*

*Aggregation (grouping) of factors (for example we can unite all the long-tail keywords with less than 100 clicks in group "other keywords").
Though after grouping of factors, we still are left with combinations with few clicks.

*Initially, not to drill in too many factors (projections).

*Elimination - we can just delete the combinations with low data.

*Do nothing - just find algorithm that can can deal with low-statistical data.

*Somehow use probability coefficients that will adjust the data.

A: You should aggregate.  But before you do that, you should take a step back and consider how you will use the data after you have aggregated it, because the answer to that question will influence how you choose to aggregate it in the first place.
Here is the crux of your problem as I understand it: you would like to know what observable factors are correlated with higher/lower conversion rates, so that you can either target your advertising dollars more effectively, or perhaps even intervene with potentially marginal customers directly on your website (for example, by offering an instant 10% off coupon in order to convince users to convert when perhaps they would not have done so otherwise).
In order to aggregate effectively, you should first sit down in front of a white board and just brainstorm about some hypotheses that you might like to test.  For example, perhaps you'd like to test the idea that people are more likely to buy socks as Christmas presents.  Then one of your aggregated date intervals might consist of the 4 weeks in late Nov/early Dec immediately prior to Christmas.  Conversely, perhaps users are much less likely to buy socks during the summer, when more people are wearing sandals, so perhaps another aggregated date interval might consist of the 3 month period from June-August.
Another example arises from the keywords.  All of the keyword lists in your table contained the word "buy".  But if your data set is large enough, you probably have at least a few examples of conversions that did not contain the word "buy".  It would be my guess that the ones containing the word "buy" have higher conversion rates.  It's just a guess, but either way, you can aggregate your data in a way that will help you to test this hypothesis definitively by defining a new column or "factor" titled BuyTrueFalse.  This column would simply contain a binary value (i.e., 1/0, yes/no, true/false, etc.) expressing whether the word "buy" appeared anywhere in the keyword list, regardless of order or other keyword content.  Similarly, you might define another column called ColorTrueFalse which is set to true if any color words are present, not just red, but also blue, green, purple, etc.  This would help you to test the much more general hypothesis of whether people who had any specific color in mind were more likely to buy than those with only a vague notion of what kind of socks they are looking for.
In short: you should aggregate, but before you do that, you must first decide what hypotheses you wish to test, and the answer to that question will help you decide how you choose to aggregate.


text:
Q: How to access a list from the net and show the list as an list control on the Device I want to create a list control from a csv/txt file which I have hosted on my site, The CSV/txt can be edited to add new items(in rows) every row has 4 coloumns,
This file should be downloaded first time the app runs, and can be updated later.
I want the list to feature like this:
Title-(1st Coloumn of the row)
Subtitle-(2nd coloumn of the row)
And when the user clicks the list item a page opens which displays all the 4 items in that separate page. I also want that list to be searcheable wrt the 1st item.

A: You need to download the file, parse it, display as a list, make the displayed list items clickable with clicks triggering navigation to the details view of your collection item and have a search box, right?

*

*To download the file - you could use WebClient.DownloadStringAsync

*To parse it - you could use string.Split('\n') and string.Split(',')

*To display as list - you would put the parsed objects representing csv file rows in a collection - like a List, then use a ListBox control and set its ItemsSource to that list. Additionally you would need to define the ItemTemplate to display the strings in two columns, eg.
<ListBox.ItemTemplate>
    <DataTemplate>
        <!-- The DataContext here is a string array, so binding to [i] will bind to its string at position i -->
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding [0]}" Width="240" TextWrapping="Wrap"/>
            <TextBlock Text="{Binding [1]}" Width="240" TextWrapping="Wrap"/>
        </StackPanel>
    </DataTemplate>
</ListBox.ItemTemplate>

*To handle clicks - the best way would be to use Buttons with Command-bindings, but the simple solution works OK too - you just handle ListBox.SelectionChanged event and the SelectedItem is what was clicked - you have to override OnNavigated in your page and set ListBox.SelectedItem back to null when you navigate back there to allow clicking the same item again.

*To navigate to another page with all the details - you can call NavigationService.Navigate(new Uri(string.Format("/DetailsPage.xaml?col1={0}&col2={1}&col3={2}&col4={3}", Uri.EscapeUriString(((string[])(lb.SelectedItem))[0]), ... [1,2,3]), UriKind.Relative), then parse the Uri in OnNavigatedTo override of the DetailsPage class.

*To allow searches in the ListBox you would use a CollectionViewSource object as the ItemsSource of the ListBox and allow the user to enter search queries that would update the Filter causing the contents of the ListBox to refresh.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Crystal Reports : change database connection of existing reports in batch I have hundreds of legacy .rpt and am trying to change the connection configuration of all of these reports.
I used Crystal Reports Developer Version for Visual Studio (2019 community edition) to create a new Windows form application project and copy all the .rpt files to the project.
In the solution explorer of VS, I see the cs code in each rpt. It looks like the code only controls the layout of report. The .rpt files don't seem to have any database connection information.

*

*Is copying existing rpt files directly into Windows Form Application project a correct way to import existing rpt? How to import .rpt in VS correctly?

*Is changing database connection of existing reports in batch possible in Crystal Reports with Visual Studio 2019 community edition?

*How to change database connection of existing rpt in Crystal Reports with Visual Studio? Can it be done in code with configuration file storing database connection information?

*I have no idea what language were the reports developed in. It could be VB or C#. Are existing .rpt files language agnostic so that I can manipulate them in any programming language?

*Documentation for Crystal Reports Developer Version for Visual Studio seems to be very limited on the internet. Is this the official user guide? The content doesn't seem to help with my problem.
https://help.sap.com/docs/SAP_CRYSTAL_REPORTS,_DEVELOPER_VERSION_FOR_MICROSOFT_VISUAL_STUDIO?locale=en-US&version=latest
Thanks!

A: The design of Crystal Reports rpt files is saved in a proprietary format. It is not a programming language.
You can programmatically run these reports and/or modify their design using code via the object model (e.g. Crystal for Visual Studio).
What you are trying to do is possible but rather complex. Given that you have no experience with this, consider using one of the 3rd-party Crystal Reports tools that provide mass-update functionality.

A: Yes, Ken Hamady maintains a list of such tools here.
While that list contains 10 utilities, most of them are limited to documenting report properties. So focus your attention on those that can update data sources.
Disclosure: I'm the developer of the Visual CUT utility. Here is a video demo of mass-updating data sources across multiple reports using that utility:


text:
Q: DBSCAN Clustering with additional features Can I apply DBSCAN with other features in addition to location ? and if it is available how can it be done through R or Spark ?
I tried preparing an R table of 3 columns one for latitude, longitude and score (the feature I wanna cluster upon in addition to space feature) and when tried running DBSCAN with the following R code, I get the following plot which tells that the algorithm makes clusters upon each pair of columns (long, lat), (long, score), (lat, score), ...
my R Code:
df = read.table("/home/ahmedelgamal/Desktop/preparedData")
var = dbscan(df, eps = .013)
plot(x = var, data = df)

and the plot I get:

A: You are misinterpreting the plot.
You don't get one result per plot, but all plots show the same clusters, only in different attributes.
But you also have the issue that the R version is (to my knowledge) only fast for Euclidean distance.
In your current code, points are neighbors if (lat[i]-lat[j])^2+(lon[i]-lon[j])^2+(score[i]-score[j])^2 <= eps^2. This bad because: 1. latitude and longitude are not Euclidean, you should be using haversine instead, and 2. your additional attribute has much larger scale and thus you pretty much only cluster points with near-zero score, and 3) your score attribute is skewed.
For this problrm you should probably be using Generalized DBSCAN. Points are similar if their haversine distance is less than e.g. 1 mile (you want to measure geographic distance here, not coordinates, because of distortion) and if their score differs by a factor of at most 1.1 (i.e. compare score[y] / score[x] or work in logspace?). Since you want both conditipns to hold, the usual Euclidean DBSCAN implementation is not yet enough, but you need a Generalized DBSCAN that allows multiple conditions. Look for an implementation of Generalized DBSCAN instead (I believe there id one in ELKI that you may be able to access from Spark), or implement it yourself. It's not very hard to do.
If quadratic runtime is okay for you, you can probably use any distance-matrix-based DBSCAN, and simply "hack" a binary distance matrix:

*

*compute Haversine distances

*compute Score dissimilarity

*distance = 0 if haversine < distance-threshold and score-dissimilarity < score-threshold, otherwise 1.

*run DBSCAN with precomputed distance matrix and eps=0.5 (since it is a binary matrix, don't change eps!)

It's reasonably fast, but needs O(n^2) memory. In my experience, the indexes of ELKI yield a good speedup if you have larger data, and are worth a try if you run out of memory or time.

A: You need to scale your data. V3 has a range which is much larger than the range for the V1 and V2 and thus DBSCAN currently mostly ignores V3.


text:
Q: Performance Impacts of Declaring a Variable With "let" Inside a Loop - Javascript I'm having trouble finding information on the performance impacts of declaring a variable with "let" inside of a loop in Javascript. I've found a lot of information about the scope of said variable if I do this, but not the performance impacts or lack thereof.
For example, in my code below (a binary search algorithm) I'm declaring the midpoint variable inside of my while loop.
const binarySearch = (arr, num) => {
  if(arr.length === 0) return false;
  if(arr.length === 1) return arr[0] === num;
  let left = 0;
  let right = arr.length - 1;
  while (left < arr.length && right >= 0){
    let midpoint = Math.floor((right + left) / 2);
    if(arr[midpoint] === num) return true;
    if(arr[midpoint] < num) left = midpoint + 1;
    else right = midpoint - 1;
  }
  return false;
}

My understanding is that this confines the scope of midpoint to the while loop itself, which I understand, and is just fine in this case.
I've found information saying that if I had used "var" to declare midpoint, instead of "let", the performance of declaring midpoint inside or outside of the loop wouldn't matter because "var" is automatically hoisted. Again, this makes sense, and I believe I understand it.
But I can't find information on if declaring midpoint with "let" inside the loop negatively impacts performance at all.
Does this create a new variable in memory with each loop, therefore taking up more memory than if I first declared midpoint with "let" outside the loop and then simply updated its value with each loop? See below for an example:
const binarySearch = (arr, num) => {
  if(arr.length === 0) return false;
  if(arr.length === 1) return arr[0] === num;
  let left = 0;
  let right = arr.length - 1;
  let midpoint;
  while (left < arr.length && right >= 0){
    midpoint = Math.floor((right + left) / 2);
    if(arr[midpoint] === num) return true;
    if(arr[midpoint] < num) left = midpoint + 1;
    else right = midpoint - 1;
  }
  return false;
}


text:
Q: Can i run an .exe file in pyqt? I want to put an .exe file in pyqt which is designed using a Qt designer. I have managed to show a video captured by openCV. However this time the video capturing file is converted to an executable file. I want to run the .exe file and show the output inside the pyqt UI. I have tried using os module in opening an executable file wherein it opens it but it is not inside the created Qlabel widget. Is there a way i can put it inside the UI? Thank you
Update: Ive done research but all i see is Qt in C++
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    QWindow *window = QWindow::fromWinId(125829124);
    QWidget *widget = QWidget::createWindowContainer(window);
    widget->setParent(this);
    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(widget);
    this->setLayout(layout);
}

Ive tried to use this code but still the window is not inside the UI.
class Program(QMainWindow):
def __init__(self):
    super().__init__()
    exePath = "/home/liva/app.exe"
    subprocess.Popen(exePath)
    hwnd = 3800003 #the window id of the app.exe
    self.window = QWindow.fromWinId(hwnd)
    self.setWindowFlags(Qt.FramelessWindowHint)
    self.widget = QWidget.createWindowContainer(self.window,self)
    self.widget.resize(300, 300)
    self.widget.move(400, 300)
    print(self.window.parent())
    layout = QVBoxLayout()

    layout.addWidget(self.widget)
    self.setLayout(layout)

    self.setGeometry(100, 100, 900, 900)
    self.setWindowTitle('UI')
    self.show()


text:
Q: Dictionary and function gene mapping output not returning expected frequencies I have been trying to figure out what's wrong with this bioinformatics code for hours and I can't see it. the pieces of my function appear to work, but it's not seeing certain patterns. I'm using a sliding window function to return the number of times a certain combination of base pairs of length k shows up in a piece of text.
the first function I need essentially creates the index of the quaternary number of the nucleotide string:
nucs = {'A':0,'C':1,'G':2,'T':3}
def PatternToNumber(Pattern):
    index = 0
    power = []
    for i in range(len(Pattern)-1,-1,-1):
        power.append(i)
    for i in range(len(Pattern)):
        index += nucs[Pattern[i]]*(4**power[i])
    return index

and the next function I use iterates down a chunk of text and adds 1 to the index in a frequency array.
def ComputingFrequencies(Text,k):
    FrequencyArray = [0]*(4**k)
    for i in range(len(Text)-k):
        Pattern = Text[i:i+k]
        index = PatternToNumber(Pattern)
        FrequencyArray[index] += 1
    print(*FrequencyArray)

Like I said I've looked into every line and it seems to work fine getting nucleotide patterns into index numbers the way I would expect them to, but the output you get running:
ComputeFrequencies('ACGCGGCTCTGAAA',2)

is:
1 1 0 0 0 0 2 2 1 2 1 0 0 1 1 0

if you look at the first number in the FrequencyArray it would tell us that the string 'AA' only shows up 1, but the last three characters in the Text input are 'AAA' which would mean 'AA' shows up twice and the first entry in the FrequencyArray should be 2 and not 1. What we should expect is:
2 1 0 0 0 0 2 2 1 2 1 0 0 1 1 0

If I've not explained it well, I can try to clarify my code a bit if needed.

A: I'm pretty sure you just have an off by 1 error. Since you're just not checking up to the last character?
for i in range(len(Text)-k):

For length 2, it will only iterate up to the first AA, so you're only seeing it once. Change to
for i in range(len(Text)-(k-1)):

And I think that should give you what you want.


text:
Q: Customize login cakephp3 I have a form like this:
email
[input]
password
[input]
Login-Button
I want to eliminate the "email" and "password" text and put them inside the inputs like placeholder and also change the "login" text to "LOGIN".
This is my login ctp.
<fieldset style="background:#F44336">
    <?= $this->Form->create() ?>
    <?= $this->Form->input('email') ?>
    <?= $this->Form->input('password') ?>
    <?= $this->Form->button('Login') ?>
    <?= $this->Form->end() ?>

Forgot Password?

A: Your question is confusing and vague.
But I believe you are asking you dont want the value or words "Email" and "Password" to be next to the input but rather inside the input textbox?
If so, you can add HTML code inside the HTML form
<input type="email" name="email_form" placeholder="Email">
Keep in mind that is HTML 5.
In HTML 4, the traditional way would to be adding an attribute to the HTML form to email or password as value="Email..."

A: Above code is correct but you should use helpers.
So a better way to achieve the same task with Html helpers is:
<?= $this->Form->input('email', array('label' => false)); ?>
<?= $this->Form->input('password', array('label' => false)); ?>

It's a suggestion to make your code better which we all should focus on.


text:
Q: Replace text from select statement from one file to another I have a bunch of views for my database and need to update the select statements within each view.
I have all the select statements in files called viewname.txt in one dir and in a sub dir called sql; I have the all the views viewname.sql.  I want to run a script to take the text from viewname.txt and replace the select statement in the correct viewname.sql in the sql sub dir.
I have tried this to append the text after the SELECT in each .sql file:
for i in */*; do
  if ["../$(basename "${i}")" == "$(basename "${i}")"]
  then
    sed '/SELECT/a "$(basename "$i" .txt)"' "$(basename "$i" .sql)"
  fi
done

Any assistance is greatly appreciated!
Dickie

A: This is an awk answer that's close - the output is placed in the sql directory under corresponding "viewname.sql.new" files.
#!/usr/bin/awk -f

# absorb the whole viewname.txt file into arr when the first line is read
FILENAME ~ /\.txt$/ && FILENAME != last_filename {
    last_filename = FILENAME

    # get the viewname part of the file name
    split( FILENAME, file_arr, "." )

    while( getline file_data <FILENAME > 0 ) {
        old_data = arr[ file_arr[ 1 ] ]
        arr[ file_arr[ 1 ] ] = \
            old_data (old_data == "" ? "" : "\n") file_data
    }
    next
}

# process each line of the sql/viewname.sql files
FILENAME ~ /\.sql$/ {
    # strip the "/sql" from the front of FILENAME for lookup in arr
    split( substr( FILENAME, 5 ), file_arr, "." )
    if( file_arr[ 1 ] in arr ) {
        if( $0 ~ /SELECT/ )
            print arr[ file_arr[ 1 ] ] > FILENAME ".new"
        else
            print $0 > FILENAME ".new"
    }
}

I put this into a file called awko and chmod +x and ran it like the following
awko *.txt sql/*

You'll have to mv the new files into place, but it's as close as I can get right now.


text:
Q: Como eu posso substituir um erro por um print sem encerrar o programa? Python 3 Se eu criar uma variável com um input que só recebe números inteiros (int) e colocar outros tipos de números ou até letras, vai gerar um erro e o programa vai encerrar.
Queria saber se tem uma forma de substituir o erro, por uma mensagem de erro personalizada, sem encerrar o programa.

A: Você pode tratar o erro com um bloco try/except, algo assim:
def entrar_dados():
    try:
        numero = int(input('Entre com um numero: '))
    except ValueError as e:
        print('Voce nao digitou um numero valido', e)

    # Continuação do código

Adicionando mais regras ao seu programa após a captura de valor ou erro, ele continuará executando normalmente.


text:
Q: Solidity TypeError mapping(uint => Info) private infos;

struct Info {
    uint _id;
    address _add;
}

function getInfo(uint _infoid) external view returns (uint, address) {
    return infos[_infoid]; //to return id & add
}

I have another function that is creating the mapping using the struct so that's not an issue here.
The error I am facing is in getInfo()
from solidity:
TypeError: Different number of arguments in return statement than in returns declaration.
  --> Contract.sol:97:9:
   |
97 |         return infos[_infoid];

A: If you write this return infos[_infoid]; you're returning only the object and not its attributes with relative values.
For fix this issue, you must access to the attributes inside the object in this case _id, _add using the statement:
[StructObject].[Attribute];

You can change your getInfo() method implementation with this:
function getInfo(uint _infoid) external view returns (uint, address) {
  return (infos[_infoid]._id, infos[_infoid]._add);
}


text:
Q: how to control the calling activity in android My application need to control the calling activity.I had use Itelephony aidl but it is not working in the real device.i had search lot of sights but they are all using ITelephony aidl.
my question is how to end the call programattically that is compatible with all the release.
I am using the object from the following method execute end call..
protected Object getITelephony(final Context context)
        throws SecurityException, NoSuchMethodException,
        IllegalArgumentException, InvocationTargetException,
        IllegalAccessException
    {
        final TelephonyManager tm = (TelephonyManager)
                context.getSystemService(Context.TELEPHONY_SERVICE);
        final Method getITelephony
                = tm.getClass().getDeclaredMethod("getITelephony");
        if (!getITelephony.isAccessible()) {
            getITelephony.setAccessible(true);
        }
        return getITelephony.invoke(tm);

    }

A: use of reflection to get access to "getITelephony" won't work in Android 2.3+
Reference:
http://hive-mind.org/android-call-blocking
How do you programmatically end a call on 2.3+?
See this links may this helps you... as ITelephony is not working above API Level 2.3.


text:
Q: convert 2-d list into data frame How can I convert the list o beneath into a long dataframe with name and j as variables in addition to an extra variable y representing the list number, ie o[,y] where y here is 1 or 2.
> dput(o)
structure(list(c("Mary", "John", "Michael", "Robert", "Jennifer",
"Jacob", "James", "Emily", "Jessica", "Lisa", "Linda", "Sophia",
"Ashley", "Isabella", "David", "Emma", "Noah"), c(0.567164179104478,
0.328358208955224, 0.328358208955224, 0.126865671641791, 0.111940298507463,
0.104477611940299, 0.0970149253731343, 0.0895522388059701, 0.0671641791044776,
0.0597014925373134, 0.0447761194029851, 0.0223880597014925, 0.0149253731343284,
0.0149253731343284, 0.00746268656716418, 0.00746268656716418,
0.00746268656716418), c("Mary", "Michael", "John", "William",
"Robert", "James", "Anna", "Helen", "Christopher", "Jessica",
"Jacob", "Jennifer", "Emily", "Ashley", "David", "Linda", "Lisa",
"Barbara", "Dorothy", "Emma", "Betty", "Isabella", "Jason", "Amy",
"Michelle", "Sophia", "Susan", "Hannah", "Melissa", "Ethan",
"Kimberly", "Madison", "Mason", "Matthew", "Shirley", "Amanda",
"Deborah", "Debra", "Liam", "Noah"), c(0.641791044776119, 0.41044776119403,
0.388059701492537, 0.298507462686567, 0.246268656716418, 0.23134328358209,
0.149253731343284, 0.149253731343284, 0.134328358208955, 0.126865671641791,
0.119402985074627, 0.111940298507463, 0.0895522388059701, 0.082089552238806,
0.0746268656716418, 0.0746268656716418, 0.0746268656716418, 0.0597014925373134,
0.0597014925373134, 0.0597014925373134, 0.0522388059701493, 0.0373134328358209,
0.0373134328358209, 0.0298507462686567, 0.0298507462686567, 0.0298507462686567,
0.0298507462686567, 0.0223880597014925, 0.0223880597014925, 0.0149253731343284,
0.0149253731343284, 0.0149253731343284, 0.0149253731343284, 0.0149253731343284,
0.0149253731343284, 0.00746268656716418, 0.00746268656716418,
0.00746268656716418, 0.00746268656716418, 0.00746268656716418
)), .Dim = c(2L, 2L), .Dimnames = list(c("name", "j"), NULL))

A: ## Make a list of data.frames, one from each column of your input matrix
ll <- lapply(seq_len(ncol(o)), FUN = function(i) data.frame(id=i, o[,i]))

## Then rbind them all together into a single data.frame
df <- do.call(rbind, ll)

## Finally, check that it worked
df[c(1:2, 56:57),]
#    id    name           j
# 1   1    Mary 0.567164179
# 2   1    John 0.328358209
# 56  2    Liam 0.007462687
# 57  2    Noah 0.007462687
str(df)
# 'data.frame':   57 obs. of  3 variables:
#  $ id  : int  1 1 1 1 1 1 1 1 1 1 ...
#  $ name: Factor w/ 40 levels "Ashley","David",..: 13 10 14 16 8 6 7 3 9 12 ...
#  $ j   : num  0.567 0.328 0.328 0.127 0.112 ...

A: Or you could do:
 library(reshape2)
 res <-setNames(cbind(melt(o[c(T,F)]), melt(o[c(F,T)])[,1])[,c(2,1,3)], c("id", "name", "j"))

   res[c(1:2, 56:57),]
   # id name           j
 #1   1 Mary 0.567164179
 #2   1 John 0.328358209
 #56  2 Liam 0.007462687
 #57  2 Noah 0.007462687


text:
Q: Need to reboot wireless router to get internet to work after every restart of my laptop I recently got a new ASUS RT-N10 LX wireless router. I set it up using a wired client. After setting up the router (SSID, authentication, etc.), I got rid of the wired client and I was able to connect to the router wireless. Everything worked fine.
EDIT:
But if I restart my wireless client (laptop), I am able to connect to the router wireless but without internet access. I need to reboot the router to get internet to work on the wireless client.
Moreover, I forgot to mention earlier that I am behind a proxy. Does it have anything to do with this problem?
Following is the router's log:
Jul 19 11:22:12  klogd started: BusyBox v1.13.4 (2011-07-19 11:18:35 CST)
Jul 19 11:22:12  RTL8192C/RTL8188C driver version 1.4 (2011-03-21)
Jul 19 11:22:16  UPnP: start_UPnP
Jul 19 19:22:19 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jul 19 19:22:19 wlan0: WPA-TKIP PSK authentication in progress...
Jul 19 19:22:19 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jul 19 19:22:19 wlan0: Open and authenticated
Jan  3 23:23:02 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  3 23:23:02 wlan0: WPA-TKIP PSK authentication in progress...
Jan  3 23:23:02 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  3 23:23:02 wlan0: Open and authenticated
Jan  3 23:23:03 wlan0: A wireless client is disassociated - B8:8D:12:07:62:6C
Jan  3 23:33:49 wlan0: A wireless client is associated - 70:F3:95:B4:D2:62
Jan  3 23:33:49 wlan0: WPA-TKIP PSK authentication in progress...
Jan  3 23:33:49 wlan0: A wireless client is associated - 70:F3:95:B4:D2:62
Jan  3 23:33:49 wlan0: Open and authenticated
Jan  3 23:34:04 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  3 23:34:04 wlan0: WPA-TKIP PSK authentication in progress...
Jan  3 23:34:04 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  3 23:34:04 wlan0: Open and authenticated
Jan  3 23:40:36 wlan0: A wireless client is disassociated - B8:8D:12:07:62:6C
Jan  4 00:33:54 wlan0: A wireless client is deauthenticated - AC:72:89:4D:FE:31
Jan  4 00:38:23 wlan0: A wireless client is deauthenticated - AC:72:89:4E:0A:34
Jan  4 00:38:59 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  4 00:38:59 wlan0: WPA-TKIP PSK authentication in progress...
Jan  4 00:38:59 wlan0: A wireless client is associated - B8:8D:12:07:62:6C
Jan  4 00:38:59 wlan0: Open and authenticated

EDIT - 2: Renewing the DHCP lease, doesn't seem to work for me. My computer doesn't get a new IP on renewal. Infact after DHCP lease renewal, the computer is not even able to connect to the router wireless.

A: You should not need to restart your router, unless there is a serious firmware issue.
If your router has DHCP enabled, and your client is set to automatically get addresses via DHCP, running the following should do the same thing as restarting the router:
Windows:
ipconfig /flushdns
ipconfig /release
ipconfig /renew
Mac OSX Lion:
(Thanks @slhck)
sudo killall -HUP mDNSResponder
sudo ifconfig en1 down
sudo ifconfig en1 up
Or from the GUI:
System Preferences » Network » Advanced… » TCP/IP

A: to get a good image of the situation..
your behind a proxy.. were is the proxy. i.e on wich side of the router?
Is the router talking with the proxy and you with the router
or do you talk to the proxy and the proxy goes to the router?
Does the proxy work with credentials?

A: The following questions/suggestions might help:
Is this the same for other wireless devices you connect to the router?
Do your wireless clients get a full IP configuration (IP, gateway, DNS, etc) or are there things missing?
Are you capable of pinging a wired host from your wireless host if it doesn't have internet?
It could be a faulty config on your router. Maybe if you reset it to factory defaults and configure it again it might work.
Temporarily shut down the firewall(s) on your router and wireless clients, it could be that your client firewall doesn't trust the wireless network.
Edit: I don't know if your router keeps logs. Try to access it with SSH/telnet or via the webinterface and look for log and post them here.

A: Try changing the mac's name to something short with no hyphens in it.  The "wizard" that runs when you turn on a new mac for the first time gives the machine a long name like richards-mac-mini.  Use System Preferences > Sharing to change it to something short like "rsmm" after recording the current name. Doing so worked for me. Note that my wifi router is not an Asus, though.


text:
Q: Can't run applets in browser Right now in my Java online class, I am on a GUI unit and I need to run applets from HTML files. After making an HTML file with an applet, when I opened it in my browser (Chrome) it wouldn't run because of the security settings. What should I do?

A: Preferably you need to go to the java control panel which you might do by clicking on start button on windows 7 and go to control panel, in the search bar of control panel search for java control panel. Once you enter there, click on security tab where, you would find an exception bar to enter a website URL. Please enter the URL which you use to open the HTML file and add it. Try running it once again.
If you are still not able to run it, consider checking you init() method at times if there is any issue in it, it does not lets you run the applet.
This alternative is to completely remove Java from you system and again install it from start. Also, you may try to upgrade your java plug-in for the browser. It should run then.
Regards,
Saurabh Bhatia


text:
Q: Variance over IID a random number of times Let $X_1, X_2,\dotsc$ be independent and identically distributed with mean $E[X]$ and variance $VAR[X]$. Let $N$ be a non-negative integer-valued random variable independent of the $X_i$'s. Show
$$
VAR\left[ \sum_{i=1}^N X_i \right] = E[N]VAR[X]+(E[X])^2VAR[N]
$$
I've tried expanding this in a number of different ways but I can't quite seem to get it to work out. I don't really understand how to condition on a random variable like this. Any help would be greatly appreciated.

A: The law of total variance says
$$
\operatorname{var}(Y) = \operatorname{E}(\operatorname{var}(Y\mid X)) + \operatorname{var}(\operatorname{E}(Y\mid X)).
$$
So
$$
\begin{align}
\operatorname{var}\left(\sum_{i=1}^N X_i\right) & = \operatorname{E} \left(\operatorname{var}\left(\sum_{i=1}^N X_i \mid N\right)\right) + \operatorname{var}\left(\operatorname{E} \left(\sum_{i=1}^N X_i \mid N\right)\right) \\  \\  \\
& = \operatorname{E}(N\operatorname{var}(X)) + \operatorname{var}(N\operatorname{E}(X)) \\  \\
& = \operatorname{var}(X)\operatorname{E}(N) + (\operatorname{E}(X))^2 \operatorname{var}(N).
\end{align}
$$

A: Performing repeated integration yields
$$
\begin{align}
\operatorname{E}[X]
&=\operatorname{E}_Y[\operatorname{E}_X[X\mid Y]]\tag{1}
\end{align}
$$
Applying $(1)$ to $X^2$ and using the fact that $\operatorname{Var}[X]=\operatorname{E}\left[X^2\right]-\operatorname{E}[X]^2$, we get
$$
\begin{align}
\operatorname{E}\left[X^2\right]
&=\operatorname{E}_Y\left[\operatorname{E}_X\left[X^2\mid Y\right]\right]\\
&=\operatorname{E}_Y\left[\operatorname{Var}_X[X\mid Y]\right] +\operatorname{E}_Y\left[\operatorname{E}_X[X\mid Y]^2\right]\tag{2}
\end{align}
$$
Applying $(1)$ and $(2)$, we get
$$
\begin{align}
\operatorname{Var}[X]
&=\operatorname{E}\left[X^2\right]-\operatorname{E}[X]^2\\
&=\operatorname{E}_Y\left[\operatorname{Var}_X[X\mid Y]\right] + \operatorname{E}_Y\left[\operatorname{E}_X[X\mid Y]^2\right]-\operatorname{E}_Y[\operatorname{E}_X[X|Y]]^2\\
&=\operatorname{E}_Y\left[\operatorname{Var}_X[X\mid Y] \right] +\operatorname{Var}_Y[\operatorname{E}_X[X\mid Y]]\tag{3}
\end{align}
$$
Now apply $(3)$ to the problem:
$$
\begin{align}
\operatorname{Var}\left[\sum_{i=1}^NX_i\right]
&=\operatorname{E}_N\left[\left.\operatorname{Var}_X\left[\sum_{i=1}^NX_i\right]\right|N\right]+\operatorname{Var}_N\left[\left.\operatorname{E}_X\left[\sum_{i=1}^N X_i\right]\right|N\right]\\
&=\operatorname{E}_N[N\operatorname{Var}[X]]+\operatorname{Var}_N[N\operatorname{E}[X]]\\
&=\operatorname{E}[N]\operatorname{Var}[X]+\operatorname{Var}[N]\operatorname{E}[X]^2\tag{4}
\end{align}
$$

A: Another way to do this: let $Y_i = 1$ if $N \ge i$, $0$ otherwise.  Then your sum is $$S = \sum_{i=1}^N X_i = \sum_{i=1}^\infty Y_i X_i$$ (I won't worry about convergence of infinite sums: if you wish you can use a truncated version of $N$ and then take limits). So $$\text{var}(S) = \sum_{i=1}^\infty \text{var}(Y_i X_i) + 2 \sum_{i=1}^\infty \sum_{j=1}^{i-1} \text{cov}(Y_i X_i, Y_j X_j)$$
Now $\text{var}(Y_i X_i) = E[Y_i^2 X_i^2] - E[Y_i X_i]^2 =  E[Y_i] \text{var}(X) + \text{var}(Y_i) E[X]^2$, while
for $j < i$, $\text{cov}(Y_i X_i, Y_j X_j) = E[Y_i Y_j X_i X_j] - E[Y_i X_i] E[Y_j X_j]
= E[Y_i] (1 - E[Y_j]) E[X]^2$, so that
$$ \text{var}(S) = \sum_{i=1}^\infty E[Y_i] \text{var}(X) + \sum_{i=1}^\infty \text{var}(Y_i) E[X]^2 + 2 \sum_{i=1}^\infty \sum_{j=1}^{i-1} E[Y_i](1 - E[Y_j]) E[X]^2$$
Now doing the same calculation with $X_i$ replaced by 1 (since  $N = \sum_{i=1}^\infty Y_i$),
$$ \text{var}(N) = \sum_{i=1}^\infty \text{var}(Y_i) + 2 \sum_{i=1}^\infty \sum_{j=1}^{i-1} E[Y_i](1 - E[Y_j])$$
so that
$$ \text{var}(S) = \sum_{i=1}^\infty E[Y_i] \text{var}(X) + \text{var}(N) E[X]^2
= E[N] \text{var}(X) + \text{var}(N) E[X]^2 $$

A: Let $Y = \sum_{i=1}^N X_i$. Notice, that the characteristic function of $Y$ can be expressed as composition of characteristic functions of $X$ $\phi(t)$ and the probability generating function of $N$, $g(s)$:
$$
 \psi(t) = \mathbb{E}( \exp( i Y t) ) = \mathbb{E}\left( \mathbb{E}( \exp( i Y t) \vert N) \right) =
    \mathbb{E}\left( \phi(t)^N \right) = \sum_{k=0}^\infty \phi(t)^k \mathbb{P}(N=k) = g(\phi(t)).
$$
Notice that the variance of $Y$ is related to its moments $\mathrm{Var}(Y) = m_2(Y) - m_1(Y)^2$, and that $m_r(Y) = (-i)^r \psi^{(r)}(0)$, so that $\mathrm{Var}(Y) = -\psi^{\prime\prime}(0)+\left( \psi^\prime(0)\right)^2$. Using $\psi = g \circ \phi$:
$$
  \psi^{\prime}(0)= g^\prime(1) \times \phi^\prime(0) = i \mathbb{E}(N) \mathbb{E}(X)
$$
and
$$
  \psi^{\prime\prime}(0)= g^{\prime\prime}(1) \phi^\prime(0)^2 + g^\prime(1) \phi^{\prime\prime}(0) = -\left( \mathbb{E}(X)^2 \cdot \mathbb{E}(N(N-1)) + \mathbb{E}(N) \cdot \mathbb{E}(X^2) \right)
$$
Combining these together will yield the result you seek to establish.
$$ \begin{eqnarray}
  \mathrm{Var}(Y) &=& \mathbb{E}(X)^2 \cdot \left( \mathbb{E}(N^2) -\mathbb{E}(N) \right) + \mathbb{E}(N) \cdot \left( \mathrm{Var}(X) + \mathbb{E}(X)^2 \right) - \mathbb{E}(N)^2 \cdot \mathbb{E}(X)^2 \\
  &=&  \mathbb{E}(X)^2 \cdot \left( \mathrm{Var}(N) + \mathbb{E}(N)^2 -\mathbb{E}(N) \right) + \mathbb{E}(N) \cdot \left( \mathrm{Var}(X) + \mathbb{E}(X)^2 \right) - \mathbb{E}(N)^2 \cdot \mathbb{E}(X)^2 \\
  &=& \mathbb{E}(X)^2 \cdot \mathrm{Var}(N) + \mathbb{E}(N) \cdot \mathrm{Var}(X)
 \end{eqnarray}
$$
Since I used $g^\prime(1) = \mathbb{E}(N)$ and $g^{\prime\prime}(1) = \mathbb{E}(N(N-1))$ I should note that they follow from the definition of the probability generating function
$g(s) = \sum_{k=0}^\infty s^k \mathbb{P}(N=k)$.  Indeed $g^\prime(1) = \sum_{k=0}^\infty k \mathbb{P}(N=k) = \mathbb{E}(N)$, and $g^{\prime\prime}(1) = \sum_{k=0}^\infty k (k-1) \mathbb{P}(N=k) = \mathbb{E}(N (N-1))$.


text:
Q: How to add multivalue property to jcr node through java code? According this answer
https://stackoverflow.com/a/18726682/2674303
I see that I can add property to node in crxde.  But I don't understand how can I add multivalue property(array) to node.
Please, help.

A: You have to create an array of values:
ValueFactory valueFactory = session.getValueFactory();
Node node = session.getNode("/content/path/to/my/node");
Value[] values = new Value[3];
values[0] = valueFactory.createValue("First value");
values[1]  = valueFactory.createValue("Second value");
values[2] = valueFactory.createValue("Third value");
node.setProperty("propertyName", values);

alternatively, you may use a String array:
node.setProperty("propertyName", new String[] {"First value", "Second value", "Third value"});


text:
Q: Invisible XML grammar wont work for this entry (using Coffeepot) I am using coffeepot in a Java runtime to try to convert the following text:
WARNING: Do Not Modify This File!
Check 24.1.6 Data File
CONTROL 1 (
  code = CEZ_90_1_2016
  compliance mode = UA
  version = 24.1.6 )
LOCATION 1 (
  state = Texas
  city =  USA )
BUILDING 1 (
  project type = NEW_CONSTRUCTION
  bldg use type = WHOLE_BLDG
  feet bldg height = 0.000
  number of stories = 1
  is nonresidential conditioning = TRUE
  is residential conditioning = FALSE
  is semiheated conditioning = FALSE
  conditioning = HEATING_AND_COOLING)
ENVELOPE 1 (
  use orient details = TRUE
  use vlt details = TRUE
  use cool roof performance details = FALSE )
AG WALL 1 (
  wall type = MASONRY_AG_WALL
  next to uncond space = FALSE
  concrete thickness = 12.00
  concrete density = 115.00
  furring type = NO_FURRING
  cmu type = CMU_PARTIAL_GROUT_CELLS_EMPTY
  list position = 1
  description = <|Concrete Block:12", Partially Grouted, Cells Empty|>
  assembly type = <|Exterior Wall 1|>
  parent number = 0
  bldg use key = 1884629903
  continuous rvalue = 10.00
  daylight credit = 0.000
  orientation = WEST
  allowance type = ENV_ALLOWANCE_NONE
  exemption type = ENV_EXEMPTION_NONE
  valid allowance type = FALSE
  valid exemption type = FALSE
  construction type = NON_RESIDENTIAL
  adjacent space type = ADJACENT_SPACE_EXTERIOR
  gross area = 3377.000)
DOOR 4 (
  door type = INSUL_METAL_DOOR
  door open type = SWINGING_DOOR
  list position = 3
  description = <|Insulated Metal|>
  assembly type = <|Door 1|>
  parent number = 1
  bldg use key = 1884629903
  prop uvalue = 0.100000
  daylight credit = 0.000
  orientation = WEST
  allowance type = ENV_ALLOWANCE_NONE
  exemption type = ENV_EXEMPTION_NONE
  valid allowance type = FALSE
  valid exemption type = FALSE
  construction type = NON_RESIDENTIAL
  adjacent space type = ADJACENT_SPACE_EXTERIOR
  gross area = 21.000)
AG WALL 2 (
  wall type = METAL_FRAME_16_AG_WALL
  next to uncond space = FALSE
  list position = 4
  description = <|Steel-Framed, 16" o.c.|>
  assembly type = <|Exterior Wall 2|>
  parent number = 0
  bldg use key = 1884629903
  cavity rvalue = 21.00
  continuous rvalue = 0.00
  daylight credit = 0.000
  orientation = NORTH
  allowance type = ENV_ALLOWANCE_NONE
  exemption type = ENV_EXEMPTION_NONE
  valid allowance type = FALSE
  valid exemption type = FALSE
  construction type = NON_RESIDENTIAL
  adjacent space type = ADJACENT_SPACE_EXTERIOR
  gross area = 42.000)

to:
<Document xmlns:ixml="http://invisiblexml.org/NS" ixml:state="ambiguous">
   <data>
      <name>CONTROL</name>
      <number>1</number>
      <property>
         <name>code</name>
         <value>CEZ_90_1_2016</value>
      </property>
      <property>
         <name>compliance mode</name>
         <value>UA</value>
      </property>
      <property>
         <name>version</name>
         <value>24.1.6</value>
      </property>
   </data>
   <data>
      <name>LOCATION</name>
      <number>1</number>
      <property>
         <name>state</name>
         <value>Texas</value>
      </property>
      <property>
         <name>city</name>
         <value> USA</value>
      </property>
   </data>
   <data>
      <name>BUILDING</name>
      <number>1</number>
      <property>
         <name>project type</name>
         <value>NEW_CONSTRUCTION</value>
      </property>
      <property>
         <name>bldg use type</name>
         <value>WHOLE_BLDG</value>
      </property>
      <property>
         <name>feet bldg height</name>
         <value>0.000</value>
      </property>
      <property>
         <name>number of stories</name>
         <value>1</value>
      </property>
      <property>
         <name>is nonresidential conditioning</name>
         <value>TRUE</value>
      </property>
      <property>
         <name>is residential conditioning</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>is semiheated conditioning</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>conditioning</name>
         <value>HEATING_AND_COOLING</value>
      </property>
   </data>
   <data>
      <name>ENVELOPE</name>
      <number>1</number>
      <property>
         <name>use orient details</name>
         <value>TRUE</value>
      </property>
      <property>
         <name>use vlt details</name>
         <value>TRUE</value>
      </property>
      <property>
         <name>use cool roof performance details</name>
         <value>FALSE</value>
      </property>
   </data>
   <data>
      <name>AG WALL</name>
      <number>1</number>
      <property>
         <name>wall type</name>
         <value>MASONRY_AG_WALL</value>
      </property>
      <property>
         <name>next to uncond space</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>concrete thickness</name>
         <value>12.00</value>
      </property>
      <property>
         <name>concrete density</name>
         <value>115.00</value>
      </property>
      <property>
         <name>furring type</name>
         <value>NO_FURRING</value>
      </property>
      <property>
         <name>cmu type</name>
         <value>CMU_PARTIAL_GROUT_CELLS_EMPTY</value>
      </property>
      <property>
         <name>list position</name>
         <value>1</value>
      </property>
      <property>
         <name>description</name>
         <value><|Concrete Block:12", Partially Grouted, Cells Empty|></value>
      </property>
      <property>
         <name>assembly type</name>
         <value><|Exterior Wall 1|></value>
      </property>
      <property>
         <name>parent number</name>
         <value>0</value>
      </property>
      <property>
         <name>bldg use key</name>
         <value>1884629903</value>
      </property>
      <property>
         <name>continuous rvalue</name>
         <value>10.00</value>
      </property>
      <property>
         <name>daylight credit</name>
         <value>0.000</value>
      </property>
      <property>
         <name>orientation</name>
         <value>WEST</value>
      </property>
      <property>
         <name>allowance type</name>
         <value>ENV_ALLOWANCE_NONE</value>
      </property>
      <property>
         <name>exemption type</name>
         <value>ENV_EXEMPTION_NONE</value>
      </property>
      <property>
         <name>valid allowance type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>valid exemption type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>construction type</name>
         <value>NON_RESIDENTIAL </value>
      </property>
      <property>
         <name>adjacent space type</name>
         <value>ADJACENT_SPACE_EXTERIOR </value>
      </property>
      <property>
         <name>gross area</name>
         <value>3377.000</value>
      </property>
   </data>
   <data>
      <name>DOOR</name>
      <number>4</number>
      <property>
         <name>door type</name>
         <value>INSUL_METAL_DOOR</value>
      </property>
      <property>
         <name>door open type</name>
         <value>SWINGING_DOOR</value>
      </property>
      <property>
         <name>list position</name>
         <value>3</value>
      </property>
      <property>
         <name>description</name>
         <value><|Insulated Metal|></value>
      </property>
      <property>
         <name>assembly type</name>
         <value><|Door 1|></value>
      </property>
      <property>
         <name>parent number</name>
         <value>1</value>
      </property>
      <property>
         <name>bldg use key</name>
         <value>1884629903</value>
      </property>
      <property>
         <name>prop uvalue</name>
         <value>0.100000</value>
      </property>
      <property>
         <name>daylight credit</name>
         <value>0.000</value>
      </property>
      <property>
         <name>orientation</name>
         <value>WEST</value>
      </property>
      <property>
         <name>allowance type</name>
         <value>ENV_ALLOWANCE_NONE</value>
      </property>
      <property>
         <name>exemption type</name>
         <value>ENV_EXEMPTION_NONE</value>
      </property>
      <property>
         <name>valid allowance type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>valid exemption type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>construction type</name>
         <value>NON_RESIDENTIAL </value>
      </property>
      <property>
         <name>adjacent space type</name>
         <value>ADJACENT_SPACE_EXTERIOR </value>
      </property>
      <property>
         <name>gross area</name>
         <value>21.000</value>
      </property>
   </data>
   <data>
      <name>AG WALL</name>
      <number>2</number>
      <property>
         <name>wall type</name>
         <value>METAL_FRAME_16_AG_WALL</value>
      </property>
      <property>
         <name>next to uncond space</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>list position</name>
         <value>4</value>
      </property>
      <property>
         <name>description</name>
         <value><|Steel-Framed, 16" o.c.|></value>
      </property>
      <property>
         <name>assembly type</name>
         <value><|Exterior Wall 2|></value>
      </property>
      <property>
         <name>parent number</name>
         <value>0</value>
      </property>
      <property>
         <name>bldg use key</name>
         <value>1884629903</value>
      </property>
      <property>
         <name>cavity rvalue</name>
         <value>21.00</value>
      </property>
      <property>
         <name>continuous rvalue</name>
         <value>0.00</value>
      </property>
      <property>
         <name>daylight credit</name>
         <value>0.000</value>
      </property>
      <property>
         <name>orientation</name>
         <value>NORTH</value>
      </property>
      <property>
         <name>allowance type</name>
         <value>ENV_ALLOWANCE_NONE</value>
      </property>
      <property>
         <name>exemption type</name>
         <value>ENV_EXEMPTION_NONE</value>
      </property>
      <property>
         <name>valid allowance type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>valid exemption type</name>
         <value>FALSE</value>
      </property>
      <property>
         <name>construction type</name>
         <value>NON_RESIDENTIAL </value>
      </property>
      <property>
         <name>adjacent space type</name>
         <value>ADJACENT_SPACE_EXTERIOR </value>
      </property>
      <property>
         <name>gross area</name>
         <value>42.000</value>
      </property>
   </data>
</Document>

with the following grammar:
Document = Warning, check, data+, #a? .
-Warning = -"WARNING: Do Not Modify This File!", -#a.
-check = -"Check 24.1.6 Data File", -#a .
data = name, -' ', number, -' (', -#a, property++-#a, -' '?, -')', -#a .

name = namechar, (namechar | ' ')*, namechar .
-namechar = ['A'-'Z'] | ['a'-'z'] .
number = ['0'-'9']+ .
property = -' '*, name, -' = ', value .
value = ~[#a]+ .

I execute coffeepot with the following command line:
java -jar coffeepot-1.99.11.jar --input:input.txt --grammar:grammar.txt --pretty-print

However, I get the following error:
<fail xmlns:ixml="http://invisiblexml.org/NS" ixml:state="failed">
   <line>1</line>
   <column>34</column>
   <pos>33</pos>
   <unexpected>!</unexpected>
   <permitted>#A</permitted>
   <also-predicted>'W'</also-predicted>
</fail>

I am very new to this, but once I can get through this hump I can start dissecting, reverse engineering this, and etc... :D thank you!

A: I converted the text to Unix using Notepad++ and it worked like a charm.
Fix:
In Notepad++, go to Edit -> EOL Conversion -> Unix (LF)


text:
Q: Training loss and accuracy remain constant after adding attention mechanism I trained bidirectional lstm on imdb dataset for sentiment analysis using keras and tensorflow as backend. This is the example in keras. After training accuracy quickly jumps to 90% and above for training and 84% for validation. So, far so good. But when I create a custom layer of attention decoder and train the network, the training and validation stays constant from epoch 1 to 10.
Below is my code for training on imdb dataset having implemented a custom layer of attention decoder.
max_features = 20000
maxlen = 80
batch_size = 32
timesteps = 80
print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)

x_train = x_train[:5000]
y_train = y_train[:5000]
x_test = x_test[:5000]
y_test = y_test[:5000]

print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
print (x_train[0])          #Shape(5000, 80)
print (y_train[0])          #Shape (5000,)

print('Build model...')
encoder_units=64
decoder_units=64
n_labels=1
trainable=True
return_probabilities=False

def modelnmt():
    input_ = Input(shape=(80,), dtype='float32')
    print (input_.get_shape())
    input_embed = Embedding(max_features, 128 ,input_length=80)(input_)
    print (input_embed.get_shape())
    rnn_encoded = Bidirectional(LSTM(encoder_units, return_sequences=True),
        name='bidirectional_1',
        merge_mode='concat')(input_embed)
    print (rnn_encoded.get_shape())
    y_hat = AttentionDecoder(decoder_units,
        name='attention_decoder_1',
        output_dim=n_labels,
        return_probabilities=return_probabilities,
        trainable=trainable)(rnn_encoded)
    y_adec = Reshape((80,))(y_adec)
    y_hat = Dense(1, activation='sigmoid')(y_adec)
    model = Model(inputs=input_, outputs=y_hat)
    model.summary()

    return model

model = modelnmt()

# try using different optimizers and different optimizer configs
model.compile(loss='binary_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])

print('Train...')
model.fit(x_train, y_train,
          batch_size=batch_size,
          epochs=10,
          validation_data=(x_test, y_test))

And here is the output:

Layer (type)                 Output Shape              Param #
=================================================================
input_1 (InputLayer)         (None, 80)                0
_________________________________________________________________
embedding_1 (Embedding)      (None, 80, 128)           2560000
_________________________________________________________________
bidirectional_1 (Bidirection (None, 80, 128)           98816
_________________________________________________________________
attention_decoder_1 (Attenti (None, 80, 1)             58050
_________________________________________________________________
reshape_1 (Reshape)          (None, 80)                0
_________________________________________________________________
dense_1 (Dense)              (None, 1)                 81
=================================================================
Total params: 2,716,947
Trainable params: 2,716,947
Non-trainable params: 0
_________________________________________________________________
Epoc 1/10
5000/5000 [==============================] - 289s - loss: 0.6955 - acc: 0.5056 - val_loss: 0.6935 - val_acc: 0.4956
Epoch 2/10
5000/5000 [==============================] - 348s - loss: 0.6944 - acc: 0.4956 - val_loss: 0.6936 - val_acc: 0.4956

I will explain model in short.First the words are embedded and then passed to bidirectional LSTM later to attention decoder. So, what attention decoder does it that it outputs for number of timesteps one number i.e. (None, 80, 1). This number is then reshaped and passed to Dense Layer to calculate overall sentiment of the sentence (probability). The output from attention decoder can later be used for visualizing contribution of each word in the sentence.
What can be possible reasons for such output?


text:
Q: Ant design editable Paragraph value become null when onChange is triggered import {Typography} from 'antd'
const {Paragraph} = Typography

const [value, setValue] = useState("This is initial value");
const onChangeEdit = editVal => {
    setValue(editVal);
};

<Paragraph editable={{ onChange: onChangeEdit }}> {value} </Paragraph>

I have issue with above code.

Initially, the Paragraph has "This is intial value" as a intital value. Hence, if I start editing, it should have "This is intial value" as a intial value.
But whenever I click the edit icon, the input box become empty instead of having inital value.
What's the solution to correct this issue?

A: I solved the issue! First, include the css of antd on index.js
import "antd/dist/antd.css";

then remove the spaces inside the <Paragraph> component, it should be:
<Paragraph editable={{ onChange: onChange }}>{value}</Paragraph>

here is the working link


text:
Q: Galois extension over (commutative) rings I was reading a paper by Childs, Garfinkel and Orzech and at some point they mentioned Galois extensions over commutative rings. I have never heard of this so I decided to look at one of the references. This brought me to the paper "A Cohomological Description of Abelian Galois Extensions" by Orzech himself. In this paper he writes the following:
Let $G$ be a group and $R$ a ring. We define a category $_{G}\mathcal{A}_R$ whose objects are $R$-algebras which are also $R(G)$-modules such that $G$ acts by $R$-algebra automorphisms. Here $R(G)$ denotes the group ring. The morphisms in this category are $R(G)$-module maps which are also $R$-algebra morphisms.
Let $A\in \ _{G}\mathcal{A}_R$. We define $e_G(A):=\left\{f:G\rightarrow A\mid \text{ $f$ is a function}\right\}$. We can turn $e_G(A)$ into a $R$-algebra under pointwise operations.
Consider the morphism $h:A\otimes A\rightarrow e_G(A)$ defined by $h(a\otimes b)(x):=ax(b)$ for all $a,b\in A$ and $x\in G$. We also define the $G$-coinvariants $A^G:=\left\{a\in A\mid x(a)=a, \forall x\in G\right\}$.

We say that $A$ is a Galois extension of $R$ with group $G$ if $h$ is a bijection and $A^G=R$.

I have two questions concerning the above:

*

*What kind of morphism is $h$? The following calculation suggests that $h$ is not an algebra morphism.
\begin{eqnarray}
h((a\otimes b)(c\otimes d))(x)&=& h(ac\otimes bd)(x)\\
&=& acx(bd)\\
&=& acx(b)x(d),\\
(h(a\otimes b)h(c\otimes d))(x)&=& h(a\otimes b)(x)h(c\otimes d)(x)\\
&=& ax(b)cx(d).
\end{eqnarray}

*Secondly, I was wondering how this definition reduces to ordinary Galois extensions for fields. Suppose that $R$ is a field and $R\subset A$ is a field extension. Assume that $A$ is a Galois extension of $R$ with Galois group $G$ (as defined above). Then $A^G=R$ says that for any $x\in G$, the automorphism $x$ on $A$ restricted to $R$ is the identity. Hence $x\in \text{Gal}(A,R)$ where $\text{Gal}(A,R)$ is the ordinary Galois group of the field extension $R\subset A$. This does not imply that $G\subset \text{Gal}(A,R)$, indeed suppose that each $x$ acts trivially on $A$, then we may only conclude that $Id_A\in \text{Gal}(A,R)$. (There is a difference between the group $G$ and the group $G$ of automorphisms on $A$ with composition as multiplication). The fact that $h$ is an isomorphism of vector spaces(?) implies that $\dim(A)^2=\dim(e_G(A))$. However I can only show that $\dim(e_G(A))\geq \dim(A)$. So this is not to useful.

So how should I interpret this and why is it called a Galois extension?


text:
Q: Change domain of S3 provider (not AWS) to own domain w/o proxying all traffic I want to mask the address of a S3 hoster (not AWS) from https://s3.hoster.com/bucket-ID/file to https://s3.mydomain.com/bucket-ID/file as this is for a business project where I want my own domain without any certificate issues.
What I did so far is the following via nginx:
server {
        listen 80;
        listen [::]:80;
        server_name s3.mydomain.com;
        return 301 https://$server_name$request_uri ;
}

server {
        # SSL configuration
        listen 443 ssl;
        listen [::]:443 ssl;        # ssl on;
        ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
        server_name s3.mydomain.com;        set $cors '' ;
        if ($http_origin ~* (.*\.mydomain\.com)) {
                set $cors 'true' ;
        }        # add security header SC-1147
        add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' blob: data: https://$server_name ";
        add_header Referrer-Policy "same-origin";
        add_header Feature-Policy "vibrate 'self' ; speaker * ; fullscreen *; sync-xhr 'self' ; notifications 'self' ; push 'self' ; geolocation 'self'; midi 'self'; microphone 'self'; camera 'self'; magnetometer 'self'; gyroscope 'self';  payment 'none'; " ;

location / {
        proxy_cookie_domain ~ s3.hoster.com;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://s3.hoster.com;
        }
    }

This works great but all the traffic is doubled which is not helpful.
What I want to achieve is the ability to use my domain for the bucket and just relay it in some way to the hosters domain. When changing the hoster I don't need to change all domains but just the relay or rewrite in some way.
Can this easily be made or do I need some specialised software or does it not work at all? At the current hoster I can't make any changes at all but creating and deleting buckets.


text:
Q: Having trouble casting string to integer I'm trying to convert the string "127.0" to an integer.
I tried this function:
int getInt(string numStr)
{
 int result;
 int.TryParse(numStr, out result);
 return result;
}

But when I call it as int x = getInt("127.0"); then int.TryParse() sets result to 0.
When I rewrite the function like this:
int getInt(string numStr)
{
 result=Convert.ToInt32(numStr);
 return result;
}

the same getInt() call throws this exception:
Input string was not in a correct format.

A: The issue here is that "127.0" is not an integer, it's a floating point number. You will need to parse it using one of the other floating point types (i.e. double, float, Decimal, etc.).
You may want to consider either stripping off any values after the decimal point and attempting to parse it, or parsing it as another type and casting it as an integer :
int result = (int)Convert.ToDouble("1.270");

You could also take advantage of the Math.Truncate() function which would give you the integer portion of your value :
int result = (int)Math.Truncate(Convert.ToDouble("127.0"));

A: First off, you need to check the return value of int.TryParse(). If it returns false, then the string could not be converted.
Had you done that, you would see it returned false because 127.0 does not describe an integer value (it describes a floating point value).
Note that decimal.TryParse() would succeed here. You need to figure out if you need an integer or floating point value, and reject data that is incorrect.

A: An int cannot contain a decimal point; that makes it either a double, a float, or a decimal. Try to pull the number minus anything from the decimal point over to the right, like this:
int getInt(string numStr)
{
  int result;
  string[] splitup;
  string number;
  if (numstr.Contains('.'))
  {
    splitup = numstr.Split('.');
    number = splitup[0];
    int.TryParse(number, out result);
  }
  else
  {
    int.TryParse(numstr, out result);
  }
  return result;
}

A: Rion Williams is absolutely correct, IMHO.
Along with the fact that what you are parsing is not an integer, I'd personally use the TryParse method.  Many of the .NET types have it, and it's quite a bit "safer" (it won't throw exceptions) than just parsing a string.
Example:
string stringValue = "127.0";
int intValue;

if(Int32.TryParse(stringValue, out intValue))
{
    // return value
}

// handle the failure

If you don't like that, I'd wrap it in a try-catch...


text:
Q: zAdjustment="top" has no effect for button inside TableRow? I have a Fragment (using the support library, and yes I have read this post). Inside this fragment I have an ImageButton (A) inside a TableRow (B). I'm trying to animate A - expanding it, then shrinking it again. Here's the animation used:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator" >

    <scale
        android:duration="250"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="1"
        android:repeatMode="reverse"
        android:toXScale="1.25"
        android:toYScale="1.25"
        android:zAdjustment="top"/>
</set>

It works except that when A grows it is clipped by the borders of B. Hence, android:zAdjustment seems to have no effect. (B is necessary for this layout, so I can't change/remove it during animation.)
Q: How do I animate my button on top of all other views?


text:
Q: CSS animation not happening when chrome auto-completes password I am making a simple website, and now I'm working on the login page. It looks like this (run in full page, otherwise some parts miss):

html, body {
    width: 100%;
    height: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

body {
  font-family: "Roboto", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  background-color: #2196F3;
  height:100%;
  overflow: hidden;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-webkit-autofill:valid {
 -webkit-box-shadow: 0 0 0 30px #2196F3 inset;
 -webkit-text-fill-color: white !important;
 }

.msg {
  font-size: 15px;
  display: inline-block;
  text-align: center;
  word-wrap: break-word;
  width: 90%;
  max-width: 300px;
  line-height: 28px;
  min-height: 28px;
  background-color: #ffc107;
  border-radius: 2px;
  color: white;
  margin-bottom: 3em;
}

.spacer {
 font-size: 15px;
 display: block;
 text-align: center;
 word-wrap: break-word;
 width: 90%;
 max-width: 300px;
 line-height: 28px;
 min-height: 28px;
 border-radius: 2px;
 color: white;
 margin-top: 2em;
 margin-bottom: 3em;
}

form {
  display: block;
  position: absolute;
  width: 100%;
  height: 80%;
  left: 0;
  margin-top: -100px;
  text-align: center;
  animation: swipein 0.5s forwards;
}

@keyframes swipein {
  from{top:30%;opacity: .8}
  to{top:20%;opacity: 1}
}

input, button {
  font-family: "Roboto", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
  outline: 0;
  color: white;
}

.group {
  display: inline-block;
  position:relative;
  margin-bottom: 20px;
}
.group:nth-of-type(1){
  margin-top: 15%;
}

input {
  font-size:21px;
  padding:10px 10px 10px 5px;
  display:block;
  width:250px;
  border:none;
  border-bottom:1px solid white;
  border-radius: 0;
  background-color: transparent;
  color: white;
}
input:focus   { outline:none; }

label      {
  color: white;
  font-size:18px;
  font-weight:normal;
  position:absolute;
  pointer-events:none;
  left:5px;
  top:10px;
  transition:0.2s ease all;
  -moz-transition:0.2s ease all;
  -webkit-transition:0.2s ease all;
}

input:focus ~ label, input:valid ~ label   {
  top:-20px;
  font-size:14px;
  color: white ;
}

.bar  { position:relative; display:block; width:265px; }
.bar:before, .bar:after  {
  content:'';
  height:2px;
  width:0;
  bottom:1px;
  position:absolute;
  background:white;
  transition:0.2s ease all;
  -moz-transition:0.2s ease all;
  -webkit-transition:0.2s ease all;
}
.bar:before {
  left:50%;
}
.bar:after {
  right:50%;
}

input:focus ~ .bar:before, input:focus ~ .bar:after {
  width:50%;
}

li {
 list-style-type: none;
 padding: 10px;
}

a {
 color: white;
 padding: 10px;
}

button {
  -webkit-appearance: none;
  padding: 12px 65px 12px 65px;
  background-color: white;
  color: #2196F3;
  border: none;
  border-radius: 2px;
  font-size: 18px;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
}

button:hover {
  cursor: pointer;
}

@media screen and (min-width: 800px){
  logo {
    top: 15%;
  }
  .logo span {
    font-size: 2em;
  }
  .logo h2 {
    font-size: 2.7em;
  }
  .group:nth-of-type(1){
    margin-top: 25%;
  }
  form {
    width: 750px;
    top: 20%;
    left: calc(50% - 375px);
  }
  input{
    width:350px;
  }
  .bar {
    width:365px;
  }
}
    <title>connerdassen.ddns.net</title>

    <form id="form" method="POST" action="http://connerdassen.ddns.net/login.php">

          <input id='input' type="text" name="uid" required="">

          Username

          <input id='input' type="password" name="pwd" required="">

          Password

Sign up

   <button>Log In</button>

  </form>

As you see the labels 'Username' and 'Password' are animated up when selecting the input. But when google chrome auto-fills them, the username is automatically animated upwards, but the password label stays, as you can see here. After clicking any key on the keyboard/ mouse, the label is animated up immediately. I want the password to go up immediately. How would I do this?


text:
Q: Generate MS Graph Outlook Task Access Token from Sharepoint I want to read all the Outlook Task assigned to the logged in user from with an Office365 web part (SPFX), But I do not want the user to sign in again or do any such operation, Ideally what I want is to use SharePoint context to be used to authenticate the user.
I came across the GraphHttpClient which uses /_api/SP.OAuth.Token/Acquire to acquire an access token which can be used with Microsoft Graph but, by default, this method only issue Group.ReadWrite.All and Reports.Read.All permission.
I need to grant it Tasks.Read permission.
I was wondering if there is any way to pass the Scope into the method to get an updated token?
I have already tried passing Scope as a query string to URL and as a header, both yielded me no result. Any suggestions on how to tackle this issue will be helpful.

A: The GraphHttpClient has been deprecated, you want to use the new MSGraphClient instead.
By default, MSGraphClient doesn't have any permission scopes applied other than User.Read. It does, however, support requesting additional permission scopes from the tenant administrator. The overview for how this works can be found at Connect to Azure AD-secured APIs in SharePoint Framework solutions.


text:
Q: too many initializers for 'char []' #include <iostream>
using namespace std;
    int main(){
    char a[] = {"qqq","www","eee"};
    cout << a[1];
    return 0;
}

Если написать string а не char то все работает, просто я немного не понял как это должно работать, пример взял из книги, там вот так было написано и я толком не понял там объявляется массив строк или массив символов, если массив строк то надо было написать вместо char string но почему написано char не пойму и поэтому до конца не ясно что хотел сказать автор, может это ошибка в книге?

A: char a[] = {"qqq","www","eee"};

Здесь объявлен массив char'ов, т.е. массив отдельных символов. Если бы вы написали
char a[] = {'q','w','e'};

все было бы верно. Но у вас - массив строковых литералов, а это в C++ - const char *. Поэтому правильнее всего -
const char * a[] = {"qqq","www","eee"};

Когда вы пишете
string a[] = {"qqq","www","eee"};

то просто каждый строковый литерал преобразуется в объект типа string...
Кроме того, поскольку строка - это массив символов, можно объявлять и так:
char a[] = {"qqq"};

В этом случае вы объявляете один массив char'ов - три из которых q, а четвертый - нулевой символ. a при этом при использовании является адресом первого элемента (первой буквы q).


text:
Q: MATLAB GUI: Slider as scrollbar; subpanel doesn't clip Long time lurker -- I really appreciate the community's knowledge. I've seen this question posed a couple of times here and elsewhere, though I've yet to find a suitable solution. If I missed a previously-listed answer, please post the link and accept my apologies.
My GUI figure has a main panel with a uibuttongroup as tabs at the top. Each tab enables visibility of different over-sized subpanels (filled with various content), and I use a slider to scroll the subpanels up & down.
Generally, this works. However, when I scroll down, the content of the subpanels (not the subpanels themselves) covers my tabs at the top (which should always be visible). I thought that it may have something to do with clipping, but I can't figure out how to make that work. Does anybody know how to prevent this from happening?
I have included code (with limited functionality for brevity) that shows my situation:
function h = ScrollQuestion_StackOverflow

h.myFig = figure('position', [100 100 800 600],...
    'menubar','none');

%% Panel covers full figure
h.Main_Panel = uipanel('Parent', h.myFig,...
    'units','normalized',...
    'position', [0 0 1 1],...
    'visible','on');

%% ALWAYS needs to be visible by the user, not covered by anything
h.Main_BtnGrp = uibuttongroup('parent', h.Main_Panel,...
    'units','normalized',...
    'position', [0 .95 1 .05]);

h.Tab1_TglBtn = uicontrol('parent', h.Main_BtnGrp,...
    'units','normalized',...
    'position', [0 0 .125 1],...
    'style','togglebutton',...
    'string', 'Tab1');

h.Tab2_TglBtn = uicontrol('parent', h.Main_BtnGrp,...
    'units','normalized',...
    'position', [.125 0 .125 1],...
    'style','togglebutton',...
    'string', 'Tab2');

%% Oversized sub-panel
h.ThisPanelMoves = uipanel('parent',h.Main_Panel,...
    'units','normalized',...
    'position', [0 -1 1 1.95]);

% Generic content of sub-panel
h.ContentText = uicontrol('parent', h.ThisPanelMoves,...
    'units','normalized',...
    'position', [.05 .95 .8 .05],...
    'style','text',...
    'string', 'BLOCKS TABS WHEN YOU SCROLL DOWN',...
    'fontsize', 20,...
    'clipping','on');

%% Add slider
h.Tab1_Slider = uicontrol('Parent', h.myFig,...
    'units','normalized',...
    'position',[.98, 0 .02 1],...
    'style', 'slider',...
    'value', 1,...
    'callback', {@SliderCallback, h});

guidata(h.myFig,h)

%% Slider Callback
function SliderCallback(hObject, eventdata, h)
    val = get(hObject,'Value');
    set(h.ThisPanelMoves, 'Position', [0 -val 1 1.95]);

Thanks so much for your help!

A: uistack() will allow you to adjust the order of your uicontrol objects. It doesn't seem like children inherit the position of their parent so you can't just move your panel to the top and call it a day. Calling it for each of the tab toggles gives the desired result.
uistack(h.Tab1_TglBtn,'top');
uistack(h.Tab2_TglBtn,'top');

It still passes over the panel borders, so you'll have to adjust your other objects as necessary to get a more aesthetically pleasing GUI.
I'm not 100% sure what properties uistack is modifying to adjust the object order, the code is present if you do an open uistack, but I haven't had a chance to look through it to see what's going on.

A: Change in your function:
function SliderCallback(hObject, eventdata, h)
    val = get(hObject,'Value');
    set(h.ThisPanelMoves, 'Position', [0 -val 1 1.95]);
end

For this:
function SliderCallback(hObject, eventdata, h)
    val = get(hObject,'Value');
    set(h.ThisPanelMoves, 'Position', [0 -val 1 0.95]);
end

In your code, height of the moving panel is greater than the window size (1.95, while the limit of the window is 1).
And set max and min limits to '1' and '0' in the slider in order to not to have circular movement:
%% Add slider h.Tab1_Slider = uicontrol('Parent', h.myFig,...
    'units','normalized',...
    'position',[.98, 0 .02 1],...
    'style', 'slider',...
    'value', 1, 'max', 1, 'min', 0,...
    'callback', {@SliderCallback, h});


text:
Q: Azure Tomcat Eclipse Deployment I have an azure server that runs my Tomcat web apps. Everything works well but I find that exporting my war, undeploying, then redeploying the war to Tomcat is a hassle. On my dev environment I run Tomcat within eclipse and have my latest code to run. What would be the problem with running eclipse on my azure server, having Tomcat run within eclipse to run my web apps? This way with any change I can simply git pull my latest code into eclipse and restart tomcat. Is this a bad idea in production and why? If so any recommendations on how to make this easier? I would rather not expose the tomcat manager application to the world so please don't recommend that.

A: Per my experience, the easy way to continuous deployment for Tomcat web apps in Eclipse is using local Git repository.
First, Create a Dynamic Web Project with Tomcat in Eclipse. There is a key step for creating project different from normal step. When configuring web module settings, need to set webapps/ROOT for Content directory, see below:

Then, the project structure tree as below:

Second, Configure the continuous deployment for Azure WebApp on Azure Portal.

After done above, copy the git clone url for git cmd.

Until now, open the git bash to push project into Azure. The steps as below.

*

*Open the git bash cmd and cd into project directory <app-name>.

*git init

*git add webapps

*git commit -m "Initial Commit"

*git remote add <app-name> <git-clone-url>

*git push <app-name> master
Now, you can browse https://<app-name>.azurewebsites.net/ to see it.
For continous developement, you just need to repeat the step 3, 4 and 6.

A: Which is all nice and fine if you are doing development, but for production you shouldn't need the Development Code Environment, rather the production should always contain the runtimes. Which anyways in case of Azure Webapp with Tomcat8 is available (you don't actually need eclipse on  the server).
I think your worry is that if you use the Azure WebApps than your Tomcat manager will be exposed to the world, if thats the case I suggest you use "Jetty" blade to deploy your app rather then using the Tomcat, if you use Jetty than the basic page would be "Nothing" unless you push code.
More Detailed overview of Using Azure Webapp deployment with Jetty is Available here https://azure.microsoft.com/en-in/documentation/articles/web-sites-java-get-started/


text:
Q: ASP.net web service on server sometimes doesn't load We have an ASP.net web service (.asmx) up on our server that one of our clients uses to get data from us.
They've been complaining about timeout issues occurring now and then. I decided to check out my code to see if anything could be causing the issue.
I went to our .asmx url using my internet explorer and saw that it just kept loading. This is the second time that I've noticed this happen. I just can't connect to the .asmx page. I get no error message, just keeps loading.
Now obviously, this would cause timeout errors for their client program as the service is unreachable. Any idea why this could be happening??
Also, where are the asp.net error logs usually stored on the server??? Is it in the same directory as the .asmx?? And do these error logs get generated automatically or do I have to put something in my code??
EDIT: Forgot to mention that the server where my web service resides is a Linux based server. I had to use MonoDevelop to package it for such.

A: Look at the application event viewer on the server.  If any errors are occuring at the service level, you'll see them posted there.  Timeout processes can be tricky to debug.  If there are server resources that are being vied for by other application pools, this application might be getting the shaft.  I would look at process usage of memory and cpu at the server first.  If all looks well there, check into IIS and see what other applications reside with your service.  If it is all good there, then I would look into your code for long running possibilities.


text:
Q: Nearest equivalent to Prolog atom or Lisp symbol in Haskell I'm trying to write a simple program for manipulating expressions in propositional calculus and would like a nice syntax for proposition variables (e.g. 'P or something).
Strings get the job done, but the syntax is misleading in this context and they permit inappropriate operations like ++.
Syntactically, I'd like to be able to write down something that does not "look quoted" visually (something like 'P is okay, though). In terms of the supported operations, I'd like to be able to determine whether two symbols are equal and to convert them into a string matching their name via show. I'd also like these things to be open (ADTs with only nullary constructors are similar in principle to symbols, but require all variants to be declared in advance).
Here's a toy example using strings where something symbol-like would be more appropriate.
type Var = String

data Proposition =
    Primitive Var |
    Negated Proposition |
    Implication Proposition Proposition

instance Show Proposition where
    show (Primitive p) = p
    show (Negated n) = "!" ++ show n
    show (Implication ant cons) =
        "(" ++ show ant ++ "->" ++ show cons ++ ")"

main = putStrLn $ show $ Implication (Primitive "A") (Primitive "B")

A: Typically the way this is done in Haskell is by parameterizing over the type of symbols.  So your example would become:
data Proposition a =
    Primitive a |
    Negated (Proposition a) |
    Implication (Proposition a) (Proposition a)

which then leaves it up to the user to decide the best representation their symbols.  This has advantages over LISP-like symbols: symbols intended for different purposes will not be mixed up, and data structures involving symbols now admit transformations over all the symbols, which are more useful than you realize.  For example, Functor changes between symbol representations, and Monad models substitution.
(=<<) :: (a        ->      Proposition b)      -> Proposition a -> Proposition b
          ^                ^^^^^^^^^^^^^          ^^^^^^^^^^^^^
substitute each free var   with an expression   in this expression

You can get a form of type-safe openness too:
implyOpen :: Proposition a -> Proposition b -> Proposition (Either a b)
implyOpen p q = Implication (Left <$> p) (Right <$> q)

Another fun trick is using a non-regular recursive type to model variable bindings in a type-safe way.
data Proposition a =
    ... |
    ForAll (Proposition (Maybe a))

Here we have added one "free variable" to the inner proposition -- Primitive Nothing is the variable being quantified over.  It may seem awkward at first, but when you get to coding it's bomb, because the types make it very hard to get it wrong.
bound is an excellent package for modelling expression languages based on this idea (and a few other tricks).


text:
Q: Error Writing Data To Text File I am using access to write data to a text file, but I get this error

invalid procedure call or argument

What do I need to alter in this procedure so that data can be succesfully written?  I have access to the path, and the file already exists and is spelled properly in my code.
 Function WriteData(fulllocale As String, tblName As String, CString As String)
  Dim fso As Object
  Set fso = CreateObject("Scripting.FileSystemObject")

  Dim Fileout As Object
  Set Fileout = fso.OpenTextFile("C:\Test.txt", ForAppending, True)
  Fileout.Write fulllocale & "," & tblName & "," & CString & vbCrLf
  Fileout.Close
End Function

A: ForAppending isn't declared, and since you've apparently late bound your Scripting.FileSystemObject, it's getting initialized to a local Variant with it's default value.
You can prevent this in the future by putting Option Explicit at the top of all of your modules.
Either add the reference the Microsoft Scripting Runtime (there is absolutely no reason not to), or use the integer value of the IOMode.  In this case, ForAppending, which is 8:
Set Fileout = fso.OpenTextFile("C:\Test.txt", 8, True)


text:
Q: TeXForm of symbols For reasons unknown, TeXForm seems to produce different results when acting on symbols that are one character long versus longer characters:
TeXForm[f]

f

TeXForm[fc]

\text{fc}

The question is is there a way to suppress this adding of the \text{} wrapper around symbols that are more than one character long, either in general, or can I at least redefine it for a particular symbol?

A: TeXForm works by converting the expression to TraditionalForm boxes, and then processing those boxes. The TraditionalForm boxes for fc is "fc", while the TraditionalForm boxes for a string like "fc" is \""fc\"". The following code modifies the TeX conversion rules for strings that come from symbols:
System`Convert`TeXFormDump`maketex[s_String] /; !stringQ[s] := Replace[
    s,
    {
        n_ /; StringMatchQ[n, NumberString] :> n
    }
]

stringQ[s_] := StringMatchQ[s, "\""~~___~~"\""] || !SyntaxQ[s, TeXForm]

Your example:
ToString[fc, TeXForm]

"fc"


text:
Q: UTF8String example for seagull I am trying to test a diameter application using seagull.
In the captured PCAP file I have 3GPP-SGSN-MCC-MNC, which is defined as UTF8String.
In seagull, I defined UTF8String in base_cc.xml as:
<typedef name="UTF8String" type="number" size="8" unit="octet"> </typedef>
in my ccr-cca.client.xml I use it <avp name="3GPP-SGSN-MCC-MNC" value="41308"></avp>
but this fails in PCRF side. It does not recognize the value as 41308. I have changed type=string, but didn't solve the problem.
What am I missing here? Is there a way to convert a number into a UTF8String?

A: Officially its not supported yet in Seagull. I have to use OctetString for every UTF8String values.
Derived AVP Data Formats in Diameter dictionary
diameter derived types


text:
Q: How to get OrbitControls ref I am trying to access OrbitControls ref as follow:
const controlsRef = useRef<any>();

  return (
    <>
      <Canvas
        camera={{
          position: [0, 0, 100],
          up: [0, 0, 1],
        }}
      >
        <OrbitControls makeDefault ref={controlsRef} />
        <ambientLight />
        <FakeSphere position={[0, 0, 0]} color="red" />
        <FakeSphere position={[100, 100, 0]} color="blue" />
        <Nav controls={controlsRef.current} />
      </Canvas>
    </>
  );

Code:
https://codesandbox.io/s/cool-flower-f5qr0?file=/src/App.tsx:949-962
The ref is undefined. Any idea please?

A: Found a hint hehe (https://github.com/pmndrs/drei/issues/718). Cant get ref from outside Canvas.
For now, add a wrapper over OrbitControls to capture the ref. Not sure if any better solution or not.
const MyControls = (props: any) => {
  const { setControls } = props;
  const ref = useRef<any>();

  useEffect(() => {
    if (!ref.current) return;
    setControls(ref.current);
  }, ref.current);
  return <OrbitControls makeDefault ref={ref} />;
};


text:
Q: How to get a user token from Logonuser for a user account with no password? How can you get a user token from Logonuser for a user account with no password?
In particular Logonuser will fail for accounts that do not have passwords.
You can validate an account by checking for a blank password + checking for GetLastError() == ERROR_ACCOUNT_RESTRICTION.
But I need to actually get a token returned, so I need this function to succeed.

A: This will fail if the registry setting LimitBlankPasswordUse is enabled, which it is by default. In order to disable this change the LimitBlankPasswordUse value under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa to zero. Or change the group policy setting under Security Options.
Be aware that this creates a security hole since it allows remote logons for accounts with null passwords.


text:
Q: MariaDB connection with Sequelize I have been checking for the connectivity of MariaDB, with Sequelize.
const Sequelize = require('sequelize');

// Setting up database (MariaDB) connection
const sequelize = new Sequelize('dbName', 'usr', 'pass', {
  host: 'localhost',
  dialect: 'mariadb'
});

But I am getting the following error:
/home/lt-196/api/node_modules/sequelize/lib/sequelize.js:236
        throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.');
        ^

Error: The dialect mariadb is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.
    at new Sequelize (/home/lt-196/api/node_modules/sequelize/lib/sequelize.js:236:15)
    at Object.<anonymous> (/home/lt-196/api/app.js:21:19)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

A: MariaDB
For MariaDB compatibility you have to install the package mariasql@0.1.20, or higher.
The configuration needs to look like this:
var sequelize = new Sequelize('database', 'username', 'password', {
  dialect: 'mariadb'
})

Or Try this:
MariaSQL: https://www.npmjs.com/package/mariasql
A node.js binding to MariaDB's non-blocking (MySQL-compatible) client library.
var Client = require('mariasql');

var c = new Client({
  host: '127.0.0.1',
  user: 'foo',
  password: 'bar'
});

c.query('SHOW DATABASES', function(err, rows) {
  if (err)
    throw err;
  console.dir(rows);
});

c.end();

MariaSQL is recommended.

A: https://github.com/MariaDB/mariadb-connector-nodejs
NPM
    npm install --save mariadb
    npm install --save sequelize@next

Yarn
    yarn add mariadb
    yarn add sequelize@next

  const Sequelize = require('sequelize'),
    sequelize = new Sequelize(process.env.db_name, process.env.db_user, process.env.db_pass, {
    dialect: 'mariadb',
    dialectOptions: {
      socketPath: process.env.db_socket,
      timezone: process.env.db_timezone
    },
    pool: {
      min: 0,
      max: 5,
      idle: 10000
    },
    define: {
      charset: 'utf8',
      timestamps: false
    },
    benchmark: false,
    logging: false
  })


text:
Q: Yield ValueError: Too many vaues to unpack (expected 2) in python I have an issue trying to implement the regression solution proposed in this thread.
Using Keras ImageDataGenerator in a regression model
Another stack question had a similar issue: Tensorflow ValueError: Too many vaues to unpack (expected 2) but I couldnt find a solution that would work in my case.  I went through this explanation for yield without any result.  What is odd to me is that the first two loops complete but it crashes on the third when the outputs are identical.
For the directory, the folders are labeled 0, 1, and 2 corresponding to the 0.1, 0.3, and 0.5, respectively in the list_of_values.
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
            rescale=1./255,
            height_shift_range=0.15,
            shear_range=0.2)
def regression_flow_from_directory(flow_from_directory_gen, list_of_values):
    for x, y in flow_from_directory_gen:
        print (list_of_values[y], list_of_values,y)
        yield (x, list_of_values[y])
batch_size=3
list_of_values=[0.1,0.3,0.5]
(x_train,y_train) = regression_flow_from_directory(train_datagen.flow_from_directory(
                'figs/train',  # this is the target directory
                batch_size=batch_size,
                class_mode='sparse'),
                np.asarray(list_of_values))

output
Found 9 images belonging to 3 classes.
[ 0.5  0.3  0.1] [ 0.1  0.3  0.5] [2 1 0]
[ 0.3  0.1  0.3] [ 0.1  0.3  0.5] [1 0 1]
[ 0.5  0.5  0.1] [ 0.1  0.3  0.5] [2 2 0]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-179-3cf97453bd05> in <module>()
      5         batch_size=batch_size,
      6         class_mode='sparse'),
----> 7         np.asarray(list_of_values))

ValueError: too many values to unpack (expected 2)

EDIT: the Error was in returning the function regression_flow_from_directory to two variables (x_train, y_train). Returning only to x_train passes the generator correctly.
x_train = regression_flow_from_directory(train_datagen.flow_from_directory(
        'figs/train',  # this is the target directory
        batch_size=batch_size,
        class_mode='sparse'),
        np.asarray(list_of_values))

A: The error has nothing to do with np.asarray.  The function regression_flow_from_directory contains a yield statement.  Therefore when you call it you get, not a tuple of yielded values, but a generator object.  That's just one object, which you are trying to unpack into a two-element tuple.  That's the reason for the error message.

A: (x_train,y_train) = regression_flow_from_directory(
    train_datagen.flow_from_directory(
        'figs/train',  # this is the target directory
        batch_size=batch_size,
        class_mode='sparse'),
        np.asarray(list_of_values))

The problem appears to be that your routine regression_flow_from_directory returns more than two values.  You have a pair on the left of that assignment, so you must have exactly two values on the right.  Try printing your actual return value, rather than the components.  For instance:
result = regression_flow_from_directory(...)
print (result)
(x,y) = result

You'll see the problem: you have to iterate through regression_flow_from_directory with those arguments.
Trivial example of the principal:
>>> (x, y) = 1, 2
>>> x
1
>>> y
2
>>> (x, y) = 1, 2, 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: too many values to unpack


text:
Q: How many ball removals before all bucket are same size, if a bucket is recursively unevenly sliced into $m$ buckets of size $\leq n/m$. The problem:
Assume a bucket $B_{(1,0)}$ containing $n$ identical balls. If it is recursively split for $r$ rounds where $r \to \{0,1...\}$ so that at round $r$, we have $2^r$ buckets $B_{(1,r)}...B_{(2^r,r)}$ were $|B_{(i,r-1)}| = |B_{(i,r)}| + |B_{(2^{r-1}+i, r)}|$ and $ \frac{1}{3}|B_{(2^{r-1}+i,r)}| < |B_{(i,r)}| < \frac{2}{3} |B_{(2^{r-1}+i,r)}|$ for $1 \leq i \leq 2^{r-1}$.
(1) What is the minimum number of rounds needed to ensure exactly $m$ buckets with size $\le m$ where m is a predefined constant $1 \le m \le n$?
(2) What would be the maximum error be, if the error is define as $$ e := \sum_{i=1}^{2^r} | \lceil\frac{n}{m}\rceil - |B_{(i,r)}|| $$
(3) How may balls need to be removed before all m buckets are of equal size?

A: I've been giving this some thought, even though I haven't had time to do much. This is not a complete answer, but I'm hoping it will be useful.
Let $$p = \frac{|B_{(i,r)}|}{|B_{(i,r-1)}|}$$ Then
 $$1 - p = \frac{|B_{(2^{r-1}+i, r)}|}{|B_{(i,r-1)}|}$$
and when divided through by $|B_{(i,r-1)}|$, your inequality becomes
$$\frac 13(1-p) < p < \frac 23(1-p)$$
$$1-p < 3p\quad\text{and}\quad 3p < 2 - 2p$$
$$\frac 14 < p < \frac 25$$
So your divisions are never even. The smaller bucket contains between 25% and 40% of the balls, while the larger bucket contains between 60% and 75%.
There are a number of issues that arise because of the discrete nature of this problem. For instance, what happens when a bucket gets down to just one ball? You can no longer divide the balls per the inequality, so the rounds must stop. A modification of the problem avoids these difficulties:
Instead of balls and buckets, start with a string of length $n$ laid out on a line. Instead of a round consisting of moving balls into new buckets, it consists of, starting with the leftmost string, cutting off an integral length of between 60% and 75% of the string and moving it to the rightmost end of the line. Continue until all existing strings at the beginning of the round have been cut (you don't cut the new bits until the next round).
This corresponds directly to your ball-and-buckets description, with each string being a bucket, and its length acting as the number of balls. But if we drop the "of integral length" requirement, we can always divide the strings to meet the inequality, no matter what their length is. So there is nothing to stop the rounds other than meeting or exceeding the requirement of exactly $m$ strings of length $\le m$. We can also change our unit of measurement so that the original string has total length $1$, and the requirement is now $m$ strings of length $\le \frac mn$. But as this is now the only use of the arbitrary value $n$, we can just replace $\frac mn$ with some $\lambda > 0$.
Whether the added issues of the discrete problem are something you are really interested in is your decision, not mine. But I am looking at the continuous version where I don't have to worry about them. You can consider it as just an approximation to the balls-and-buckets problem. I'd also like to clean up the symbolry a bit. I find that $B$ notation cumbersome. So:

*

*$r$ is the current round, and $R$ is the round whose result has exactly $m$ strings of length $\le \lambda$.

*$L_r^i$ is the length of $i+1^\text{st}$ string in line at the end of round $r$. The original string will have length $L_0^0 = 1$, and the leftmost string on round $r$ has length $L_r^0$, while the rightmost has length $L_r^{2^r-1}$. This is a shift from your index scheme, but it will be useful. Let $$\rho_r^i = \frac{L_r^i}{L_{r-1}^i}\\\rho_r^{i + 2^{r-1}} = \frac{L_r^{i + 2^{r-1}}}{L_{r-1}^i}$$ for $i < 2^{r-1}$. So $\rho_r^i + \rho_r^{i + 2^{r-1}} = 1$.

*If $i$ is a non-negative integer, let $b(i)$ be the number of $1$s occurring in its binary expansion. So $b(0) = 0, b(1) = b(2) = b(4) = 1, b(3) = b(5) = b(6) = 2, b(7) = 3$, etc.

The index $i$ of a string in round $r$ can be expressed as a binary number with $r$ bits (including leading zeros). By removing the highest order bit, one gets the index of the string in round $r-1$ from which the round $r$ string was cut. If the removed bit was a $0$, then the string is the shorter of the two pieces, while a removed bit of $1$ means it was the longer piece. Thus $b(i)$ is the number of times string $i$ descended from the larger piece in a cut.
The length can be expressed as $$L_r^i = \prod_{s=1}^r \rho_s^{i\bmod 2^s}$$ For each round $s$ where the string is descended from a larger piece, $0.6 < \rho_s^{i\bmod 2^s} < 0.75$, while for each round $s$ where the string is descended from a smaller piece, $0.25 < \rho_s^{i\bmod 2^s} < 0.4$. Thus we can be sure that if $b(i) > b(j)$ then $L_r^i > L_r^j$. And in fact, $$\left(\frac14\right)^{r - b(i)}\left(\frac 35\right)^{b(i)} \le L_r^i \le \left(\frac25\right)^{r - b(i)}\left(\frac 34\right)^{b(i)}$$

Next, let's examine the case where $m = 2^{r_0}$ for some $r_0$. On round $r$, the shortest possible longest string is $(3/5)^r$, while the longest possible string is $(3/4)^r$. So

*

*if $(3/5)^{r_0} < \lambda$, where $m = 2^{r_0}$, then the string game can be won on the $r_0^\text{th}$ round. It can never be won earlier, since this is the first round with $m$ or more strings.

On the next round, we would need exactly half the strings $\le \lambda$. A simple combinatorial argument shows that there are ${r \choose k}$ binary numbers $0\le i < 2^r$ with $b(i) = k$. When $r_0$ is even, that means you need all strings with $b(i) = \frac{r_0}2$ to be $\le \lambda$, while all strings with $b(i) = 1+\frac{r_0}2$ should all be $> \lambda$. Because $(3/5)^{r_0} \le \lambda$ (since we couldn't win in the previous round), the first condition is easily met. The maximum length for strings with $b(i) = 1 +\frac {r_0}2$ is $$\left(\frac25\right)^{r_0/2}\left(\frac 34\right)^{r_0/2 + 1}$$

*

*if $(3/5)^{2r} \le \lambda < (2/5)^r(3/4)^{r+1}$, where $m = 2^{2r}$, the game can be won in $2r + 1$ rounds.

When $r_0$ is odd, we need half of the $r_0 + 1\choose (r_0+1)/2$ strings with $b(i) = (r_0+1)/2$ to be $\le \lambda$ while the other half are $>\lambda$. Again, since $\lambda \ge (3/5)^{r_0}$, getting the needed strings $\le \lambda$ is easy. The maximum length for these strings is now $$\left(\frac 3{10}\right)^{(r_0+1)/2}$$
- if $(3/5)^{2r-1} \le \lambda < (3/10)^r$, where $m = 2^{2r-1}$, the game can be won in $2r$ rounds.

This can be generalized to $m$ that are not powers of $2$ and more rounds. To find out if the condition can be met on round $r$, assuming it couldn't be met on $r-1$, find the value $k$ such that $\sum_{i=0}^{k-1} {r\choose i} < m \le \sum_{i=0}^k {r\choose i}$. The game can be won on round $r$ if $$\lambda < \left(\frac25\right)^{r - b(k)}\left(\frac 34\right)^{b(k)}$$