text:
Q: Difference in profiling results for numpy.loadtxt I'm trying to understand why I'm getting very different profiling/timing numbers when using numpy.loadtxt within a function and stand-alone.
Setup of data to read/profile

*

*1 file with 26 columns and 1000 rows, each item in file is random floating point number

*File is space separated

*1st line in file is a space separated header with 26 column names

*See below for code on how this data was generated

Profiling numpy.loadtxt alone
Assume I have a file called 'test.out' with the above properties:
>>> f = open('test.out', 'r');f.readline()
'a b c d e f g h i j k l m n o p q r s t u v w x y z\n'
>>> %timeit -n 1 np.loadtxt(f, unpack=True)
1 loops, best of 3: 30 us per loop

Profiling numpy.loadtxt inside of a function
Now I want to profile numpy.loadtxt inside of a function (using line_profiler) and %lrpun magic in ipython:
>>> %lprun -f file_to_numpy_ordered_dict file_to_numpy_ordered_dict('test.out')
Timer unit: 1e-06 s

Function: file_to_numpy_ordered_dict at line 88
Total time: 0.085642 s

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
    88                                           def file_to_numpy_ordered_dict(filename):
    89                                               """
    90                                               Read a space-separated-value file as a dict of columns, keyed by
    91                                               column header where each column (dict value) is a numpy array.
    92                                               """
    93
    94         1          430    430.0      0.5      with open(filename, 'r') as file_obj:
    95         1          363    363.0      0.4          headers = file_obj.readline().split()
    96
    97                                                   # unpack=True b/c want data organized as column based arrays, not rows
    98         1        84634  84634.0     98.8          arrs = np.loadtxt(file_obj, unpack=True)
    99
   100         1           66     66.0      0.1      ret_dict = collections.OrderedDict()
   101        27           34      1.3      0.0      for ii, colname in enumerate(headers):
   102        26          114      4.4      0.1          ret_dict[colname] = arrs[ii]
   103
   104         1            1      1.0      0.0      return ret_dict

Why?
Why does calling numpy.loadtxt by itself only take 30us and calling it inside this function take roughly .085 seconds?  I feel like there is something obvious I'm missing here, but it looks like the function is being called exactly the same in each scenario with the same arguments, etc.
Is this some weird difference because I'm using %timeit and %lprun?  Maybe this data cannot be compared for some reason?
Details of random data creation

*

*File data was generated with the following code:
def generate_test_data(column_names, row_count, filename):
    """
    Generate file of random test data of size (row_count, len(column_names))
column_names - List of column name strings to use as header row
row_count - Number of rows of data to generate
filename - Name of file to write test data to
"""

col_count = len(column_names)
rand_arr = np.random.rand(row_count, col_count)
header_line = ' '.join(column_names)
np.savetxt(filename, rand_arr, delimiter=' ', fmt='%1.5f',
              header=header_line, comments='')

A: Just for reference the 'answer' to this question is related to how I was doing my profiling, not in the actual calls to numpy.loadtxt being slower or faster within a function.

*

*Be careful of the arguments to %timeit:
-n: execute the given statement  times in a loop. If this value
is not given, a fitting value is chosen.
-r: repeat the loop iteration  times and take the best result.
Default: 3
Notice that I was specifying -n 1 to force %timeit to only run the numpy.loadtxt code 1 time.  However, -n 1 is not sufficient for this.  You must also specify -r 1 to force the evaluation of the code to only happen exactly once.
So, my call to %timeit was effectively evaluating the call to numpy.loadtxt 3 times.  The first call would actually read all of the file and take the majority of the total runtime.  The next two calls would have no data to read because the file handle passed to numpy.loadtxt didn't have anymore data to read.  Thus, two out of three calls didn't have any real work to do and took almost no time at all.

*

*Be careful what the time reported from %timeit means.

Notice what the call to %timeit reports as part of it's output, 1 loops, best of 3: 30 us per loop.  Since two of my three calls effectively did no work one of these two calls would be the best of 3.
So by comparing my original call to %timeit and %lprun I was effectively comparing the time numpy.loadtxt takes to look at an empty/finished file handle and the time numpy.loadtxt takes to truly open and read a full 208k of data.
The real timings, when using correct arguments to %timeit make much more sense:
>>> f = open('test.out', 'r');f.readline()
'a b c d e f g h i j k l m n o p q r s t u v w x y z\n'
>>> %timeit -n 1 -r 1 np.loadtxt(f, unpack=True)
1 loops, best of 1: 31.1 ms per loop

Function: file_to_numpy_ordered_dict at line 88
Total time: 0.083706 s

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
    88                                           def file_to_numpy_ordered_dict(filename):
    89                                               """
    90                                               Read a space-separated-value file as a dict of columns, keyed by
    91                                               column header where each column (dict value) is a numpy array.
    92                                               """
    93
    94         1          583    583.0      0.7      with open(filename, 'r') as file_obj:
    95         1          313    313.0      0.4          headers = file_obj.readline().split()
    96
    97                                                   # unpack=True b/c want data organized as column based arrays, not rows
    98         1        82417  82417.0     98.5          arrs = np.loadtxt(file_obj, unpack=True)
    99
   100         1          226    226.0      0.3      ret_dict = collections.OrderedDict()
   101        27           35      1.3      0.0      for ii, colname in enumerate(headers):
   102        26          131      5.0      0.2          ret_dict[colname] = arrs[ii]
   103
   104         1            1      1.0      0.0      return ret_dict

31ms vs 83 ms makes a bit more sense.  These numbers are close enough that I'm assuming the differences are simply because I'm only running this relatively fast operation one time.  To effectively compare these it would be best to take an average of a bunch of runs.


text:
Q: How do you prove that $p → q$ is equivalent to $p \lor q ↔ q$? I gotta draw $p \lor q ↔ q$ from $p → q$, logically. not by a truth table.
While it seems obvious, I cannot find a formal proof.
This is how far I came up to:
$\quad p \lor q$
$\equiv (p \land T) \lor q$
$\equiv q \lor (p \land T)$
$\equiv (q \lor p) \land (q \lor T)$
$\equiv (q \lor p) \land T$
$\equiv (q \lor p) \land (\neg p \lor q)$
I know that by drawing a venn-diagram here i can intuitively know that it is equivalent to q, but how do I draw such conclusion logically?

A: $(p\lor q)↔q$
$=((p\lor q)→q)\land((p\lor q)←q)$
$=(\overline{(p\lor q)}\lor q)\land((p\lor q)\lor \overline {q})$
$=((\overline{p}\land \overline{q})\lor q)\land(p\lor (q\lor \overline {q}))$
$=((\overline{p}\land \overline{q})\lor q)\land(p\lor T)$
$=((\overline{p}\land \overline{q})\lor q)\land T$
$=((\overline{p}\land \overline{q})\lor q)$
$=(\overline{p}\lor q)\land (\overline{q}\lor q)$
$=(\overline{p}\lor q)\land T$
$=(\overline{p}\lor q)$
$=(p→q)$

A: You got this far:
$$p \vee q \equiv (\sim p \vee q) \wedge (p \vee q)$$
Use distributivity:
$$p \vee q \equiv (\sim p \wedge p) \vee q$$
By Law of Contradiction, we know that the former part of this disjunction is always false, so using disjunctive syllogism we can conclude:
$$p \vee q \equiv q$$

A: so we must prove: $(p\Rightarrow q)\Leftrightarrow [(p\vee
q)\Leftrightarrow q)]$.
suppose $(p\Rightarrow q)$ and prove the equivalence $(p\vee
q)\Leftrightarrow q$
$\Rightarrow$): $ (p\Rightarrow q)\Rightarrow[ (p\Rightarrow q)
\wedge (q\Rightarrow q)] \Rightarrow [(p\vee q)\Rightarrow q]$.
$\Leftarrow$): $q\Rightarrow(p\vee q)$ obvious
suppose $(p\vee q)\Leftrightarrow q$ and prove that $p\Rightarrow
q$
so $[(p\vee q)\Leftrightarrow q)]\Rightarrow [(p\vee q)\Rightarrow
q)]\Rightarrow [(p\Rightarrow q)\wedge (q\Rightarrow
q)]\Rightarrow (p\Rightarrow q)$.

A: One way to prove that the statements $p \rightarrow q$ and $p \vee q \iff q$ are logically equivalent is as follows.  It suffices to show that their truth tables (which have $4$ rows each) are the same.  Recall that the only assignment of truth values for $p$ and $q$ for which $p \rightarrow q$ evaluates to $F$ is when $p$ is $T$ and $q$ is $F$.  For which truth values does $p \vee q \iff q$ evaluate to $F$?  Precisely when $p \vee q$ and $q$ have different truth values.  If $q$ is $T$, so is $p \vee q$.  If $q$ is $F$, the only way for $p \vee q$ to be $T$ is if $p$ is $T$.  So, the only truth values for which $p \vee q \iff q$ is $F$ is when $p$ is $T$ and $q$ is $F$. This truth table is the same as that of $p \rightarrow q$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: changing layout of boxplot and adding labels to it I want to (got suggestion to do so) create boxplot with different look and added labels to it. The expected (not complete) output will look like the following (with every box has quatile labeles) and sample size.

 boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE,
  col=(c("gold","darkgreen")),
   main="Tooth Growth", xlab="Suppliment and Dose", names = supp )

  # some  unsuccessful trials
 # to add names
 boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE,
  col=(c("gold","darkgreen")),
   main="Tooth Growth", xlab="Suppliment and Dose", names = supp*dose)
 # to remove the plot outline
 boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE,
  col=(c("gold","darkgreen")),
   main="Tooth Growth", xlab="Suppliment and Dose", bty="n")

A: This should get you started. The key is to know that if you save the results of boxplot into an object while setting plot = FALSE, you get all the information for where each of the objects goes. Then you can use this information to add text via text.
d <- boxplot(len~supp*dose, data=ToothGrowth,plot = FALSE)

 boxplot(len~supp*dose, data=ToothGrowth, notch=TRUE,
  col=(c("gold","darkgreen")),
   main="Tooth Growth", xlab="Suppliment and Dose",axes = FALSE )

for (i in 1:ncol(d$stats)){
    text(i,d$stats[,i],labels = d$stats[,i],cex = 0.75,adj = c(0.5,0))
    text(i,d$stats[5,i]+1,labels = paste0("n=",d$n[i]),cex = 0.75)
    text(i-0.25,d$stats[3,i],labels = d$names[i],adj = 1,cex = 0.75)
}

I would, however, point out that whoever suggested that you:

*

*remove the axes

*annotate each boxplot with the quantile values and sample sizes

should not be giving advice to anyone about making graphs. Ever. They have successfully made your boxplot much, much worse.


text:
Q: Nautilus issues I recently used Nautilus (from /usr/share/applications as a double click on "File") to "make a link" for a desktop icon. This worked fine once I changed the permissions to executable. However when I installed sync stuff for rythmbox for iphone I noted in the terminal window a reference to Nautilus flash by. Not sure that is relevant but the desktop icon is no longer a filing cabinet and when executed it has lost its function as su. Also when run from terminal it functions as normal but with following messages. forgive me for I am but a newbie:
simon@Arthur:~$ sudo nautilus
[sudo] password for simon:

(nautilus:4921): Gtk-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
wrestool: /vmlinuz: file contains no resources

(nautilus:4921): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed

(nautilus:4921): Gtk-CRITICAL **: gtk_spinner_start: assertion 'GTK_IS_SPINNER (spinner)' failed

(nautilus:4921): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed

(nautilus:4921): Gtk-CRITICAL **: gtk_spinner_start: assertion 'GTK_IS_SPINNER (spinner)' failed

(nautilus:4921): GLib-CRITICAL **: Source ID 120 was not found when attempting to remove it

(nautilus:4921): GLib-CRITICAL **: Source ID 121 was not found when attempting to remove it

(nautilus:4921): GLib-CRITICAL **: Source ID 122 was not found when attempting to remove it

A: Answered in comments by OP:

I think I have my head around it now. What I wanted to do was create a usable desktop icon from applications outside of my home directory i.e. nautilus. I think I have achieved this by using the command sudo nautilus in terminal and creating a link to my desktop from /usr/share/applications/Files. Then changing the command in properties to sudo nautilus --new-window %U.


text:
Q: Building Vocaluxe on Windows using Visual Studio 2012 or Xamarin Studio on Windows I want to build https://github.com/Vocaluxe/Vocaluxe/ on windows. I currently have installed mono-3.2.3 with gtksharp-2.12.11, howerver I can't build that project neither on Microsoft Visual Studio 2012 nor on Xamarin studio.
When Vacaluxe is opened in Visual Studio 2012, two warning messages appear instantly. Visual Studio complains that: 1) The referenced component 'SlimDX' could not be found and 2) The referenced component 'System.Data.SQLite' could not be found. As a result build fails.
When I open that project in Xamarin Studio error message pops up, saying that "Could not load Visual C++ project 'GstreamerHelper\GstreamerHelper.vcxproj'. This project type is not supported by Xamarin studio". GstreamerHelper package has red icon and on the right side "Load failed" is written, however remaining packages "PartyModeChallenge", "PartyModeChallengeMedley", "PartyModeTicTacToe", "ServerLib", "Vocaluxe" etc. seems to be fine. Building process fails on this IDE too.
How can I build this program on windows? What steps do I need to take in order to get rid of these warning and error messages in IDEs?
P.S
I'm curious about this because I want to create my own gstreamer 1.0 C# bindings project on windows.

A: SlimDX can be downloaded from http://slimdx.org/ while System.Data.SQLite can be downloaded from https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
If possible, contact the developer of Vocaluxe to see how you should grab the dependencies.
Obviously this project must be edited and built in Visual Studio (due to vcxproj). You cannot use Xamarin Studio.


text:
Q: Dynamically change what is being awked I have this input below:
 IDNO     H1  H2  H3    HT   Q1 Q2 Q3 Q4 Q5    M1  M2  EXAM

 OUT OF  100 100 150   350   30 30 30 30 30   100 150   400

 1434    22  95 135   252   15 20 12 18 14    45 121   245

 1546     99 102 140   341   15 17 14 15 23    91 150   325

 2352     93  93 145   331   14 17 23 14 10    81 101   260

(et cetera)

          H1  H2  H3    HT   Q1 Q2 Q3 Q4 Q5    M1  M2  EXAM
 OUT OF  100 100 150   350   30 30 30 30 30   100 150   400

I need to use write a unix script to use the awk function to dynamically find any column that is entered in and have it displayed to the screen.  I have successfully awked specific columns, but I cant seem to figure out how to make it change based on different columns.  My instructor will simply pick a column for test data and my program needs to find that column.
what I was trying was something like:
#!/bin/sh

awk {'print $(I dont know what goes here)'} testdata.txt

EDIT: Sorry i should have been more specific, he is entering in the header name as the input. for example "H3". Then it needs to awk that.

A: I think you are just looking for:
#!/bin/sh
awk 'NR==1{ for( i = 1; i <= NF; i++ ) if( $i == header ) col=i }
  { print $col }' header=${1?No header entered} testdata.txt

This makes no attempt to deal with a column header that does not appear
in the input.  (Left as an exercise for the reader.)

A: Your line format has a lot of variation (in the number of fields). That said, what about something like this:
echo "Which column name?"
read column
case $column in
  (H1) N=2;;
  (H2) N=3;;
  (H3) N=4;;
  ...
  (*) echo "Please try again"; exit 1;;
esac
awk -v N=$N '{print $N}' testdata.txt

A: Well, you question is quite diffuse and in principle you want someone else write your awk script... You should check man pages for awk, they are quite descriptive.
my 2 cent wort, as an example would be (for the row) :
myscript.sh:
#/bin/sh
cat $1 | awk -v a=$2 -v b=$3 '{if ($(a)==b){print $0}}';

if you just want a column, well,
#/bin/sh
cat $1 | awk -v a=$2 '{print $(a)}';

Your input would be :

myscript.sh file_of_data col_num

Again, reiterating: Please study man pages of awk. Also please when asking question present what you have tried (code) and errors (logs). This will make people more ready to help you.


text:
Q: JSF modification in Groovy way? Somewhere in Grails family I had a lecture about conneting JSF / Groovy / Grails. I.e. less configuration, more convention, Groovy session bean returning "next" navigation link etc.
Very interesting at intellectual level, but i think these tools have acceptance by totally different teams / people. JSF (standard, certified etc) in corporate programming, G* technologies at small, independent development.
Meet anybody real project using such mixing?
(To understand my POV: in web programming I prefer Wicket, JSF in prototype, I'm quite new in Groovy, and no real project in Grails)

A: We have both JSF and Grails applications.  We are in the process of sunseting the JSF applications and all new applications in Grails.  I have read that the LinkedIn site used Grails on a larger projects with much success.  I am still on the Grails 2.X platform.  Switching developers from JSF to Grails was an easy transition for me and generally provides a large increase in productivity over JSF.  I highly recommend Grails over JSF.


text:
Q: CSS, firefox nao reconhece fonte Bree Serif Uso sources do google, porem obtive a surpresa hoje em que fui testar meus arquivos no firefox e percebi que a fonte nao era carregada. Veja
http://jsfiddle.net/xrckh1db/
@font-face {
font-family: 'Bree Serif';
font-style: normal;
font-weight: 400;
src: local('Bree Serif'), local('BreeSerif-Regular'), url(http://fonts.gstatic.com/s/breeserif/v5/0daoUMW28nkWOnFz2G4AAgsYbbCjybiHxArTLjt7FRU.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;

}
@font-face {
  font-family: 'Bree Serif';
  font-style: normal;
  font-weight: 400;
  src: local('Bree Serif'), local('BreeSerif-Regular'), url(http://fonts.gstatic.com/s/breeserif/v5/LQ7WLTaITDg4OSRuOZCpswsYbbCjybiHxArTLjt7FRU.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}
div {
    font-family: 'Bree Serif';
    }

A: Talvez seja mais interessante utilizar o Quick-use, como o Google indica. Não coloco minha mão no fogo mas acredito que dificilmente você terá um problema de carregamento pelo "Google estar offline".
As três formas de importação descritas no Google Fonts:

Padrão: Importando diretamente no HTML

<!doctype html>

    <link href='http://fonts.googleapis.com/css?family=Bree+Serif' rel='stylesheet' type='text/css'>

StackOverflow

Importando no CSS com @import

@import url(http://fonts.googleapis.com/css?family=Bree+Serif);

.minha-fonte {
  font-family: 'Bree Serif', serif;
}

StackOverflow

Importando com Javascript

<!doctype html>

StackOverflow


text:
Q: Excel VBA - Do While Loop - Date in a cell I want to increase the settlement date which is (assigned to cell N13) until the network days (assigned to cell P11) reaches 3.
Network days counts the number of weekdays between two dates excluding holidays. However, I added a range of holidays to it.
Sub Settlement_Date()

Do While Cells(16, 12) < 3

    Cells(14,11)

Loop

A: to increase Cells(14,11) within the loop, change that line to
Cells(14,11) = Cells(14,11) + 1

A: Managed to do it myself but got snippets in some of the post I found here
Sub Settlement_Date()

Do While ActiveCell.Offset(0, 2).Value < 3

    ActiveCell.Value = ActiveCell.Value + 1

Loop

End Sub

Moving Right One Cell
Add one day to date in cells using VBA


text:
Q: titletoc editing List Of Figures issues with caption The template I am using requires the titletoc package. The issues I have with the current list of figures are that:

*

*There is an indent between the Figure number and a long caption such that the first line of the caption is indented further than the additional lines under it.

*The caption hyphenates words rather than moving them to the next line.

I have tried:

*

*adding \raggedright \noindent \skipparindent with no changes

*adding \renewcommand{@tocrmarg}{2.55em plus1fil} though it removes the hyphenation, the caption is no longer justified

Below is the code for the list of figures in the pre-amble. Any help would be appreciated:
\renewcommand*{\l@figure}{\@dottedtocline{1}{0em}{2.5em}}
\renewcommand*{\listoffigures}{%
 \phantomsection\addcontentsline{toc}{frontchapter}{List of Figures} %
 \frntpg %
 \centerline{\large\bf LIST OF FIGURES} %
 \vspace{1ex} %
 \begin{onehalfspacing}
  \@starttoc{lof}\if@restonecol\twocolumn\fi %
 \end{onehalfspacing} %
 \addtocontents{lof}
}


text:
Q: problem in adding tab bar in bottom of view in android In my application I have a tab bar.  It contains four tabs in which I am showing a list view.  It was working fine, but now I need to shift the tab bar to the bottom of the screen.  When I changed my code to show tab bar at the bottom of the view, list views are showing in full screen overlapping the tab bar as well.
Here is the sample code
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/mainlayout"
             android:layout_height="fill_parent"
             android:layout_width="fill_parent"
             android:orientation="vertical" >
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:background="#000000">

        <RelativeLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="5dp">

            <TextView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/Label"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="Credit Balance"
                    android:background = "#55000000"
                    android:textColor = "#FF0033"
            />

            <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    **android:layout_alignParentBottom = "true"**/>
            <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:padding="5dp" />
        </RelativeLayout>
    </TabHost>
</FrameLayout>

I am adding 4 list views in 4 respective tabs with the following code
 tabHost.addTab(tabHost.newTabSpec(NEW_TAB).setIndicator(NEW)
            .setContent(new Intent(this, NEWActivity.class)));

Please can anyone suggest a solution to this?
Thanks

A: add this
android:layout_above="@android:id/tabs"

line to your FrameLayout and with
android:layout_alignParentBottom = "true"

in TabWidget


text:
Q: WordPress : make categories automatically match according to external API Value I'm managing a company website, where we have to display our products. We however do not want to handle the admin edit for this CPT, nor offer the ability to access to the form. But we have to read some product data form the admin edit page. All has to be created or updated via our CRM platform automatically.
For this matter, I already setup a CPT (wprc_pr) and registered 6 custom hierarchical terms: 1 generic for the types (wprc_pr_type) and 5 targeting each types available: wprc_pr_rb, wprc_pr_sp, wprc_pr_pe, wprc_pr_ce and wprc_pr_pr. All those taxonomies are required for filtering purposes (was the old way of working, maybe not the best, opened to suggestions here). We happen to come out with  archive pages links looking like site.tld/generic/specific-parent/specific-child/ which is what is desired here.
I have a internal tool, nodeJS based, to batch create products from our CRM. The job is simple: get all products not yet pushed to the website, format a new post, push it to the WP REST API, wait for response, updated CRM data in consequence, and proceed to next product. Handle about 1600 products today on trialn each gone fine
The issue for now is that in order for me to put the correct terms to the new post, I have to compute for each product the generic type and specific type children.
I handled that by creating 6 files, one for each taxonomy. Each file is basically a giant JS object with the id from the CRM as a key, and the term id as a value. My script handles the category assertion like that:
wp_taxonomy = [jsTaxonomyMapper[crm_id1][crm_id2]] // or [] if not found
I have to say it is working pretty well, and that I could stop here. But I will have to take that computing to the wp_after_insert_post hook, in order to reaffect the post to the desired category on updated if something changed on the CRM.
Not quite difficult, but if I happen to add category on the CRM, I'll have to manually edit my mappers to add the new terms, and believe me that's a hassle.
Not waiting for a full solution here, but a way to work the thing. Maybe a way to computed those mappers and store their values in the options table maybe, or have a mapper class, I don't know at all.
Additional information:
Data from the CRM comes as integers (ids corresponding to a label) and the mappers today consist of 6 arrays (nested or not), about 600 total entries.
If you have something for me, or even suggestions to simplify the process, I'll go with it.
Thanks.
EDIT :
Went with another approach, see comment below.


text:
Q: How to prove the two angles are equal?
It is from Young Double slit experiment. But How to prove the the two $\theta$ are equal, I meant, how  $\angle EAD= \angle PEC$? I see from the both triagle have $90^0$ but what about others.
If we think θ→0 we get valid results. we can see the image from any article whoch is YOUNG's double slit experiment. citycollegiate.com/interference2.htm

A: I believe both the angles can be equal only when L is infinity. Here is why---
If ∠PEC =  θ then ∠AEP = 90 - θ
So in small triangle AEO  where O is the point of intersection of EP and AD :--
∠AOE = 180 - (θ + 90 - θ) = 90
Now because ∠AOE = ∠ADB = 90 so it follows that EP and BP are parallel. It is only possible when L is infinity.
Does the answer make sense to you...??

A: The fact that the angles are 'equal' is based on the assumption given in the original post.
It says "Since the value of 'd' is very very small as compared to L, therefore, θ will also be very small. In this condition we can assume that : sin θ = tan θ".


text:
Q: Lubuntu 20.04 laptop suddenly lost the internal screen, and the font is tiny on an external one Usually, a screen suddenly going out means that the backlight has died.  But that's not the case here.  This is a dual-boot machine, and the internal screen is perfectly okay during POST, GRUB, and in Windows 10.  So it's not the backlight, and I'm pretty sure it's not anything hardware related.
This is a Dell M6800 with two graphics cards: a low-power Intel thing, and a Quadro K5100M.  The NVIDIA X Server Settings GUI reports a single screen (the external one) running at 1920x1080x60Hz, just like LXQt's Monitor Settings does.  A handful of apps seem to be readable enough - NVIDIA X Server and Firefox for example, which is how I'm writing this - but the text for most things is just a couple of blurry pixels tall, including the terminal.  If I'm making it out out correctly, LXQt's Appearance Configuration still has the font size at 11pt and the DPI at 96.
I just updated about an hour ago - sudo apt [update|full-upgrade|autoremove] - got a few, and rebooted, with no change.
Any idea what's causing this?  And how to get the internal screen back with a decent system font?

Compiled from chat:
/var/log/Xorg.0.log is:
https://pastebin.ubuntu.com/p/24tSjCHdmW/
aaron@aaron-Lubuntu:~$ xrandr --listmonitors
Monitors: 1
 0: +DP-0 1920/1150x1080/650+0+0  DP-0
aaron@aaron-Lubuntu:~$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x2d8 cap: 0x1, Source Output crtcs: 4 outputs: 8 associated providers: 0 name:NVIDIA-0
aaron@aaron-Lubuntu:~$
aaron@aaron-Lubuntu:~$ glxinfo | grep OpenGL

Command 'glxinfo' not found, but can be installed with:

sudo apt install mesa-utils

aaron@aaron-Lubuntu:~$ sudo apt install mesa-utils
[sudo] password for aaron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  mesa-utils
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 34.2 kB of archives.
After this operation, 150 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 mesa-utils amd64 8.4.0-1build1 [34.2 kB]
Fetched 34.2 kB in 1s (40.3 kB/s)
Selecting previously unselected package mesa-utils.
(Reading database ... 296803 files and directories currently installed.)
Preparing to unpack .../mesa-utils_8.4.0-1build1_amd64.deb ...
Unpacking mesa-utils (8.4.0-1build1) ...
Setting up mesa-utils (8.4.0-1build1) ...
Processing triggers for man-db (2.9.1-1) ...
aaron@aaron-Lubuntu:~$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro K5100M/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.103.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 470.103.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 470.103.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
aaron@aaron-Lubuntu:~$ sudo apt install nvidia-prime
Reading package lists... Done
Building dependency tree
Reading state information... Done
nvidia-prime is already the newest version (0.8.16~0.20.04.1).
nvidia-prime set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
aaron@aaron-Lubuntu:~$
aaron@aaron-Lubuntu:~$ cat ./.bash_history | grep nvidia
sudo apt install nvidia-driver-430
aaron@aaron-Lubuntu:~$
aaron@aaron-Lubuntu:~$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-LM (rev 04)
00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d4)
00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d4)
00:1c.3 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4 (rev d4)
00:1c.4 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #5 (rev d4)
00:1c.6 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #7 (rev d4)
00:1c.7 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #8 (rev d4)
00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM87 Express LPC Controller (rev 04)
00:1f.2 RAID bus controller: Intel Corporation 82801 Mobile SATA Controller [RAID mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GK104GLM [Quadro K5100M] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GK104 HDMI Audio Controller (rev a1)
03:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
11:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)
aaron@aaron-Lubuntu:~$ lshw -C video
WARNING: you should run this program as super-user.
  *-display
       description: VGA compatible controller
       product: GK104GLM [Quadro K5100M]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:39 memory:f4000000-f4ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
aaron@aaron-Lubuntu:~$ sudo lshw -C video
[sudo] password for aaron:
  *-display
       description: VGA compatible controller
       product: GK104GLM [Quadro K5100M]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:39 memory:f4000000-f4ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff
aaron@aaron-Lubuntu:~$ apt policy xserver-xorg-video-intel
xserver-xorg-video-intel:
  Installed: 2:2.99.917+git20200226-1
  Candidate: 2:2.99.917+git20200226-1
  Version table:
 *** 2:2.99.917+git20200226-1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
aaron@aaron-Lubuntu:~$
aaron@aaron-Lubuntu:~$ dpkg -l | grep mesa
ii  libegl-mesa0:amd64                            21.2.6-0ubuntu0.1~20.04.2           amd64        free implementation of the EGL API -- Mesa vendor library
ii  libgl1-mesa-dri:amd64                         21.2.6-0ubuntu0.1~20.04.2           amd64        free implementation of the OpenGL API -- DRI modules
ii  libgl1-mesa-dri:i386                          21.2.6-0ubuntu0.1~20.04.2           i386         free implementation of the OpenGL API -- DRI modules
ii  libglapi-mesa:amd64                           21.2.6-0ubuntu0.1~20.04.2           amd64        free implementation of the GL API -- shared library
ii  libglapi-mesa:i386                            21.2.6-0ubuntu0.1~20.04.2           i386         free implementation of the GL API -- shared library
ii  libglu1-mesa:amd64                            9.0.1-1build1                       amd64        Mesa OpenGL utility library (GLU)
ii  libglx-mesa0:amd64                            21.2.6-0ubuntu0.1~20.04.2           amd64        free implementation of the OpenGL API -- GLX vendor library
ii  libglx-mesa0:i386                             21.2.6-0ubuntu0.1~20.04.2           i386         free implementation of the OpenGL API -- GLX vendor library
ii  mesa-utils                                    8.4.0-1build1                       amd64        Miscellaneous Mesa GL utilities
ii  mesa-va-drivers:amd64                         21.2.6-0ubuntu0.1~20.04.2           amd64        Mesa VA-API video acceleration drivers
ii  mesa-vdpau-drivers:amd64                      21.2.6-0ubuntu0.1~20.04.2           amd64        Mesa VDPAU video acceleration drivers
ii  mesa-vulkan-drivers:amd64                     21.2.6-0ubuntu0.1~20.04.2           amd64        Mesa Vulkan graphics drivers
ii  mesa-vulkan-drivers:i386                      21.2.6-0ubuntu0.1~20.04.2           i386         Mesa Vulkan graphics drivers
aaron@aaron-Lubuntu:~$ prime-select query
nvidia
aaron@aaron-Lubuntu:~$

For comparison, a live USB has this in /var/log/Xorg.0.log:
https://pastebin.ubuntu.com/p/GDDhPjFTCv/
and:
lubuntu@lubuntu:~$ xrandr --listmonitors
Monitors: 2
 0: +eDP-1 1920/382x1080/215+0+0  eDP-1
 1: +DP-3 1920/708x1080/398+1920+0  DP-3
lubuntu@lubuntu:~$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x48 cap: 0x9, Source Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:modesetting
lubuntu@lubuntu:~$


text:
Q: bool method inside a class ''Control may reach end o non-void function'' So, i have a class called Vuelo, it has a method in which i can add a passenger to an airplane flight, i must check that the passenger id is not already in the array (the array is at first with all zeros), i must also check that there is enough space for another passenger to be added (max 10)
bool Vuelo :: agregarPasajero(int id)
{
   int i = 0;

for(int iC = 0; iC < 10; iC++)
{
    if (listaPasajeros[iC] == id)
    {
        i++;
        return false;
    }
}

if(i == 0)
{
    if(cantidadPasajeros >= 10)
    {
        return false;
    }
    else
    {
        return true;
        cantidadPasajeros++;
    }
  }
 }

A: If i is not zero, you get to the end of the function without any kind of return statement. Since you declared the function to always return a bool, you should provide one for that case.
Now, you may know that i will never be zero at that spot, but the logic for that is fairly complex (I missed it on the first reading), and a compiler cannot be expected to realize that there is in fact no chance of control flow ever getting to the end of the function without encountering a return. In this case it's best to add a dummy return.
You can probably get away with not having a dummy return if you remove the bogus i == 0 test. i will necessarily always be zero at that point, since if it were ever increased, the function immediately returns false.
The statement cantidadPasajeros++; will never be executed since it is located after a return statement. Any halfway decent compiler also warns on that.


text:
Q: Error handling for stream with Twitter's API. (Blank lines and receive problems) I'm trying to modify the functionality in my teacher's module for saving tweets from Twitter's Streaming API. The problem is that if I keep the stream open for more than a minute, the API starts sending blank lines to the stream in order to verify its connection.
From what I've understood, the tweets are broken down and then reassembled, but this becomes a problem with the last function in the code below, pop_size.
Pop_size expects the argument to start with a text-representation of a number. So when the blank lines are sent, represented by <<"\r\n">>, the stream crashes with this message:
Error in process <0.118.0> with exit value: {function_clause,
[{twitterminer_source,pop_size,[<<2 bytes>>],[{file,"src/twitterminer_source.erl"}

If I add the line below, does anyone have any suggestions what I should try executing in it?
pop_size(<<"\r\n">>) ->  %%Code here!

To clarify: I want the blank line to be disregarded and the loop to continue checking for the next tweets. I'm quite over my head here, but I'll try to answer any follow-up questions as elaborate as I can.
Code: (Three functions)
% Get HTTP chunks and reassemble them into chunks that we get
% as a result of specifying delimited=length.
% https://dev.twitter.com/streaming/overview/processing
split_loop(Sink, Sender, Buffer) ->
  case pop_size(Buffer) of
    {size, N, Rest} ->
      case buffer_pop_n(Rest, N, Sender) of
        {pop, Chunk, NewBuf}   ->
          Sink ! {message, Chunk},
          receive next -> ok end,
          split_loop(Sink, Sender, NewBuf);
        {incomplete, Chunk}    -> Sink ! {error, {incomplete, Chunk}};
        {terminate, _Chunk}    -> Sink ! terminate;
        {error, Reason, Chunk} -> Sink ! {error, {Reason, Chunk}}
      end;

    {more, L} ->
      case buffer_pop_n(Buffer, L, Sender) of
        {pop, Chunk, NewBuf}   ->
          split_loop(Sink, Sender, <<Chunk/binary, NewBuf/binary>>);
        {incomplete, <<>>}     -> Sink ! finished;
        {incomplete, Chunk}    -> Sink ! {error, {incomplete, Chunk}};
        {terminate, _Chunk}    -> Sink ! terminate;
        {error, Reason, Chunk} -> Sink ! {error, {Reason, Chunk}}
      end
  end.

% Get a chunk of N bytes from the buffer. If there is not enough data
% in the buffer, get more messages from the pipeline.
buffer_pop_n(B, N, Sender) ->
  if
    byte_size(B) < N ->
      Sender ! next,
      receive
        {message, Part} ->
          Part2 = Part,
          buffer_pop_n(<<B/binary, Part2/binary>>, N, Sender);
        finished -> {incomplete, B};
        terminate -> {terminate, B};
        {error, Reason} -> {error, Reason, B}
      end;
    true -> {pop, binary:part(B, {0, N}), binary:part(B, {N, byte_size(B)-N})}
  end.

% We should also support discarding \r\n here
% (see 'blank lines' in https://dev.twitter.com/streaming/overview/messages-types)
pop_size(<<>>) -> {more, 1};
pop_size(<<A,Rest/binary>>) when A >= $0, A =< $9 ->
  pop_size((A - $0), 1, Rest);
pop_size(_N, L, <<>>) -> {more, L+1};
pop_size(_N, L, <<"\r">>) -> {more, L+2};
pop_size(N, L, <<A,Rest/binary>>) when A >= $0, A =< $9 ->
  pop_size(N * 10 + (A - $0), L+1, Rest);
pop_size(N, _L, <<"\r\n",Rest/binary>>) -> {size, N, Rest}.


text:
Q: Select row with most recent date per user with 1 condition in JPA I have this Entity and I want to list for each device the last event with the property message = 1
@Entity
@Table(name = "t_device_event")
@NamedQueries(value = {
@NamedQuery(name = "DeviceEvent.findWithMessageActive",
            query = "from DeviceEvent as de1 where de1.message = 1 and de1.received = "
                  + " ( select max(de2.received) from DeviceEvent de2 "
                  + " where de2.device.id = de1.device.id )  "), )
public class DeviceEvent {
     ..
}

But I have an assertion problem in the last test, because it considers device3 as a last event and its not the case.
assertTrue ((numDevicesWithActiveMessage+1) == deviceEventService.findWithActiveMessage().size());

DeviceEvent deviceEvent3 = newDeviceEvent();
deviceEvent3.setMessage(1);
deviceEventService.save(deviceEvent3);

DeviceEvent deviceEvent4 = newDeviceEvent();
deviceEventService.save(deviceEvent4);

assertTrue ((numDevicesWithActiveMessage+1) == deviceEventService.findWithActiveMessage().size());

A: I assume DeviceEvent.received is set in newDeviceEvent() method and it's set to current time.
In such case as there is no delay between creating deviceEvent3 and deviceEvent4, most probably they will have the same time in received field. The query will then choose the maximum of all received and according to outer condition it will select both deviceEvent3 and deviceEvent4 for which only deviceEvent3 will match as it has message equal to 1.
So I believe that because the TEST consider device3 as a Last event is actually correct (most probably unless the clocks tick between creation of the two events).

A: Why not create an identity column for each record to be inserted. For an instance, an ID which automatically increment upon insertion (identity). From there, it should be able to return the latest value of that ID and we base our data from the ID being returned?

A: You have not set  - deviceEvent4.setMessage(1). Hence deviceEvent3 would be the latest device event and hence your test seems to be considering the correct device event (deviceEvent3) as the latest event

A: I think you should have added
deviceEvent4.setMessage(1);

since this code
assertTrue ((numDevicesWithActiveMessage+1) == deviceEventService.findWithActiveMessage().size());

is looking for an active message but device4 doesn't have any.
Thus, the latest one is device3.


text:
Q: Tent map is topologically transitive Let $T:[0,1] \to [0,1]$ be the function $Tx= 2x$, if $ x \in [0, \frac{1}{2}]$ and $Tx = 2-2x$, if $ x \in ( \frac{1}{2} , 1] $. We say that a map is topologically transitive if, for any pair $U, V$ of nonempty open subsets of $X$, there exists some $n\ge0$ such that $T^{n}(U) \cap V \neq \varnothing$. I need to show that $T$ is topologically transitive.
My attempt was to show that for any open and nonempty subset of $X$, say $U$, there exists $n\ge0$ such that $T^n(U)=[0,1]$ and then for any open and nonempty subset of $X$, say $V$, $T^n(U)\cap V=[0,1]\cap V=V\neq \varnothing$. What I have tried so far is to do this by cases:
First I suppose $U$ is an open interval containing $\frac{1}{2}$. Observe that $T(U)$ contains $T(\frac{1}{2}) = 1$ and $T^{2}(U)$ contains $T(T( \frac{1}{2}))=T(1)=0$, so $T^{2} (U)$ is an interval which contains the number $0$, so $[0,a]\subseteq T^{2}(U)$ for some $a\in [0,\frac{1}{2}]$. We also observe that $T$ is doubling the length of the interval $[0, \frac{1}{2}]$ as we iterate it. So, there exists $n\ge0$ such that $T^{n+2}(U)$ is an interval which contains $0$ and $\frac{1}{2}$ and then $T^{n+3}(U)$ contains $0,1$ which show that $T^{n+3}(U)=[0,1]$.
The second case is if $U$ is an open subinterval of $[0,\frac{1}{2}]$. In this case we observe that $T$ is doubling the length of the interval, as we iterate it and it gets to a point that there exists some $n\ge0$ such that $\frac{1}{2}\in T^n(U)$, so from the first case there exists some $m\ge0$ such that $T^m(T^n(U))=[0,1]\implies T^{m+n}(U)=[0,1]$.
The third case is that $U=(a,b)\subseteq(\frac{1}{2},1)$, then $T(U)=(2-2b, 2-2a)$. We observe that $T(U)$ is double the length of the interval $(a,b)$. I want to show that there exists a $n\ge0$ such that $\frac{3}{4} \in T^n(U)$ and then $T(\frac{3}{4})=\frac{1}{2}\in T^{n+1}(U)$, so I apply the first case again. This is where I got stuck and I don't know how to continue. I would appreciate any help with this, or any other kind of solution.

A: First we need, as you suspected and attempted, the lemma:

$I\subseteq[0,1]$ is a nontrivial closed interval, $T^n(I)=[0,1]$ eventually.

Core to the proof is that the continuous image of an interval is an interval.
Proof:

Suppose $0\in I$, so $I=[0,a]$ for some $a$. For some $n$ we will then have, for some $x$, $T^n(I)=[0,x]\supseteq[0,1/2]$ and then $T^{n+1}(I)=[0,1]$. Now suppose $I\subseteq(0,1/2]$. After some number of iterations $n$ clearly we will have either $T^n(I)$ straddling $1/2$ or $T^n(I)\subseteq[1/2,1]$. We treat the latter case last.
For the former, let $T^n(I)=[a,b]$, and then the hypothesis is that $a\lt\frac{1}{2}\lt b$. $T^{n+1}(I)$ will then equal $[x,1]$ for some $x$; $T^{n+2}(I)$ will equal $[0,y]$ for some $y$ and we have already covered this case.
Finally suppose $I=[a,b]$,$1/2\lt a\lt b\lt1$ (the case when the interval contains $1$ has already been covered, and if the interval contains $1/2$ its next time iterate contains $1$). Our dream is to get this interval into one of the already seen forms - this dream fails if and only if $T^n(I)$ remains in the above form for all $n$. Let's analyse this failure: consider that $1/2\lt T(x)\lt 1$ and $1/2\lt x\lt1$ implies further that $1/2\lt x\lt3/4$. What if $1/2\lt T^2(x)\lt1$ as well? Then $1/2\lt T(x)\lt3/4$ and $5/8\lt x\lt3/4$ - the possibilities for $x$ are shrinking.
These numbers come from solving $2-2x=y$, which is testing the assumption that for all $x\in I$, the orbit of $x$ is strictly between $1/2$ and $1$ so that the action of $T$ is always $x\mapsto2-2x$ on this orbit. $2-2x=y\implies x=1-y/2$, and thus the preimage of any interval $(c,d)$ by this map is $(1-d/2,1-c/2)$ which has length $(d-c)/2$. Thus the infinite intersection of preimages can have at most one point ($2/3$, in fact), since the diameter vanishes ($1/2,1/4,1/8,\cdots\to0$). However, as a nontrivial interval, $I$ cannot have only one point, so it is impossible that every element of $I$ should have the entirety of its orbit contained in $(1/2,1)$.
Accordingly, our dream never fails, and $I$ evolves over time into one of the already-covered cases. The event that $I$ gets caught in a loop, i.e. always going from the case $I\subset(1/2,1)$ to the case $I\subset(0,1/2)$ and back, is impossible by similar argument. $\blacksquare$

With this lemma in hand, note that if $U,V$ are any two nonempty open subsets of $[0,1]$ then $U$ must contain a point $x_0\in[0,1]$ and an open interval $(x_0-r,x_0+r)$ for some $r\gt0$, and it must contain the nontrivial closed interval $I:=[x_0-r/2,x_0+r/2]$. Using the lemma, as: $$\emptyset\neq V\cap[0,1]=V\cap T^n(I)\subseteq V\cap T^n(U)$$For some $n\in\Bbb N$, the claim holds and we are done by the arbitrariness of $U,V$.


text:
Q: ActiveMQ - JDBC Master/Slave persistance issue with Mysql When configured in Cluster / Replicated. I was able to configure ActiveMQ Cluster JDBC Master/Slave  here with the help of link. But, When I configure Mysql DB in a cluster then I'm getting the following message in my logs in both the machines(through various blogs I understand the setup is not completed properly).

2016-04-20 09:47:21,200 | INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@7c16905e: startup date [Wed Apr 20 09:47:21 UTC 2016]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
  2016-04-20 09:47:22,821 | INFO  | Using Persistence Adapter: JDBCPersistenceAdapter(org.apache.commons.dbcp2.BasicDataSource@1ed4ae0f) | org.apache.activemq.broker.BrokerService | main
  2016-04-20 09:47:23,363 | INFO  | Database adapter driver override recognized for : [mysql-ab_jdbc_driver] - adapter: class org.apache.activemq.store.jdbc.adapter.MySqlJDBCAdapter | org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
  2016-04-20 09:47:24,015 | INFO  | Database lock driver override not found for : [mysql-ab_jdbc_driver].  Will use default implementation. | org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main
  2016-04-20 09:47:24,020 | INFO  | Attempting to acquire the exclusive lock to become the Master broker | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:47:24,053 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:47:34,065 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:47:44,078 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:47:54,089 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:04,102 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:14,115 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:24,128 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:34,140 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:44,154 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:48:54,166 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:49:04,176 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:49:14,188 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:49:24,200 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:49:34,213 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main
  2016-04-20 09:49:44,227 | INFO  | Failed to acquire lock.  Sleeping for 10000 milli(s) before trying again... | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main

I'm not seeing anything other than this in my logs. I'm I doing something wrong over here? Thanks for your help in advance.

A: The log said that the ActiveMQ server cannot grabs exclusive lock to become master. So it would retry after 10000 ms.
It means current ActiveMQ Server is in 'Slave' state, while the other is 'Master'.
More information about ActiveMQ lock:
http://activemq.apache.org/pluggable-storage-lockers.html


text:
Q: Invalid UTF-8 sequence with postgresql driver 9.4 and Postgres installation 9.6 I have installed newest PostgreSQL version: 9.6
I'm using postgresql driver version 9.4-1206-jdbc42 - I can't find newer in maven repository.
When I try to connect, I get an exception:
Caused by: java.io.IOException: Ungültige UTF-8-Sequenz: das erste Byte ist 10xxxxxx: 179
    at org.postgresql.core.UTF8Encoding.decode(UTF8Encoding.java:98)
    at org.postgresql.core.PGStream.ReceiveString(PGStream.java:327)
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:424)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:203)
    ... 49 more

The application is deployed in OSGi container, the datasource is configured using PAX config file:
osgi.jdbc.driver.class=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/test
dataSourceName=test
user=test
password=test
protocolVersion=3

What is wrong here? Is this an incompatibility between driver version and database installation? Should I downgrade?
The database uses encoding UTF-8.
In standalone java application, the following code is successful:
    ConnectionPool pool = new ConnectionPool();
    pool.setUrl("jdbc:postgresql://localhost:5432/test");
    pool.setUser("test");
    pool.setPassword("test");
    pool.setProtocolVersion(3);
    Connection conn = pool.getConnection();

so it looks more like PAX issue...

A: The actual problem was somewhere else. After changing authorization method from 'md5' to 'trust' in pg_hba.conf I've got the real error message: that the role "test " could not be found.
PAX has appended trailing space to user name, which is easy to oversee, and PostgreSQL driver was unable to decode the error message from server.


text:
Q: Update multiple objects using EntityFramework in ASP.NET MVC 3 with TryUpdateModel method I am struggling with ASP.NET MVC3 when trying to update data via Entity Framework. The process is as followed:
I have this Model:
    public class Bet
    {
       public string BetID { get; set; }
       public int FixtureID { get; set; }
       public string Better { get; set; }
       public int GoalsHome { get; set; }
       public int GoalsGuest { get; set; }

       public virtual Fixture { get; set; }

    }

In the controller I filter the table via a where statement to get only the entrys that match the user:
    [HttpGet]
    public ActionResult Index()
    {
        var user = User.Identity.Name;
        var model = _db.Bets.Where(t => t.Better == user);

        return View(model);
    }

The View is two parts, one that takes care of the table headers, and the other that lists all bets of the user:
<fieldset>
    <legend>Bets</legend>

                Kickoff

                Home Team

                Guest Team

                Group

                Bet

        @Html.EditorFor(m => m)  //this is resolved in an self made EditorTemplate

The EditorTemplate:
@model Betting.Models.Bet

    @Html.DisplayFor(modelItem => Model.Fixture.Kickoff)

    @Html.DisplayFor(modelItem => Model.Fixture.HomeTeam)

    @Html.DisplayFor(modelItem => Model.Fixture.GuestTeam)

    @Html.DisplayFor(modelItem => Model.Fixture.Group)

    @Html.TextBoxFor(modelItem => Model.GoalsHome, new { style = "width: 30px" }):
    @Html.TextBoxFor(modelItem => Model.GoalsGuest, new { style = "width: 30px" })

    @Html.HiddenFor(modelItem => Model.FixtureID)

Back in the controller I try to update the model:
    [HttpPost]
    public ActionResult Index(FormCollection collection)
    {
        var user = User.Identity.Name;
        var model = _db.Bets.Where(t => t.Better == user);
        TryUpdateModel(model);
        _db.SaveChanges();

        return RedirectToAction("Index");
    }

This does absolutely nothing. The Entity Framework won't update the database at all. I even separated the table so that the resulting bet tags in the html file will be distinguishable (note the [index] before the name value:
 <input data-val="true" data-val-number="The field GoalsHome must be a number." data-val-required="The GoalsHome field is required." name="[1].GoalsHome" style="width: 30px" type="text" value="3" />:
 <input data-val="true" data-val-number="The field GoalsGuest must be a number." data-val-required="The GoalsGuest field is required." name="[1].GoalsGuest" style="width: 30px" type="text" value="0" />

Can somebody tell me why the Entity Framework isn't updating the database? Is there something wrong with the object mapping?

A: I was having the same issue before. MSDN can be pretty confusing on this subject but halfway down the page states that if you are creating your POCO entities without proxycreationenabled, you will have to call detectchanges before calling savechanges.
TryUpdateModel(model);
_db.DetectChanges();
_db.SaveChanges();

A: Ok, it seems that I found a way to update the database without using the TryUpdateModel method. Since the items sent in the html post are distinguishable, I can add a parameter to the controller method which holds the bets I get from the view. Then I iterate over the results from the database and update the fields that changed with the field values of the bets from the view:
    [HttpPost]
    public ActionResult Index(FormCollection collection, List<Bet> bets)
    {
        var user = User.Identity.Name;
        var model = _db.Bets.Where(t => t.Better== user);
        int i = 0;
        foreach (var bet in model)
        {
            Bet the_Bet= bets.Find(
                delegate(Bet _bet)
                {
                    return _bet.BetID == bet.BetID;
                });
            bet.GoalsHome= the_Bet.GoalsHome;
            bet.GoalsGuest= the_Bet.GoalsGuest;
            i++;
        }
        _db.SaveChanges();

        return RedirectToAction("Index");
    }

I wonder if there is still a way to get it work with the TryUpdateModel method.


text:
Q: How to set up ToggleFlyoutMenuItems so that only 1 option can be toggled on at a time? I'm currently working on building a UWP Application (Minesweeper) in Visual Studio 2019 for school, I created a little menu bar at the top and am using buttons for dropdown menus using MenuFlyout. For the most part, everything works fine, however, when a user wants to make a new game using the menu they need to select a difficulty setting (Easy, Medium, or Hard) however by default the user can turn any number of these off and on at the same time as opposed to only being able to have on checked at a time. Is there a way for me to set it so that when 1 is toggled on it automatically toggles the other 2 off if they aren't already off or is that something I would need to build in when setting up the EventHandler method?
<Button x:Name="GameMenuButton"
        Width="110"
        Height="40"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Content="Game"
        Background="#7f1c1c"
        FontSize="20"
        VerticalContentAlignment="Top">

    <Button.Flyout>
        <MenuFlyout>
            <MenuFlyoutItem Text="New Game"/>
            <MenuFlyoutItem Text="Reset Board"/>
            <MenuFlyoutItem Text="View Mine Locations"/>

            <MenuFlyoutSeparator/>

            <ToggleMenuFlyoutItem Text="Easy"/>
            <ToggleMenuFlyoutItem Text="Medium"/>
            <ToggleMenuFlyoutItem Text="Hard"/>

            <MenuFlyoutSeparator/>

            <MenuFlyoutItem Text="Exit"/>
        </MenuFlyout>
    </Button.Flyout>
</Button>

Currently how the menu can look depending on what the user toggles

-------------------VS---------------------
How the Menu Should look when the user toggles an item

It doesn't need to always be medium, if for some reason that was confusing someone, it just needs to only have 1 item selected at any given moment.

A:
How to set up ToggleFlyoutMenuItems so that only 1 option can be toggled on at a time?

You could bind ToggleMenuFlyoutItem IsChecked with bool value and change the other two when one was checked. Please refer the following.
xaml
<ToggleMenuFlyoutItem IsChecked="{x:Bind Easy, Mode=TwoWay}" Text="Easy" />
<ToggleMenuFlyoutItem IsChecked="{x:Bind Medium, Mode=TwoWay}" Text="Medium" />
<ToggleMenuFlyoutItem IsChecked="{x:Bind Hard, Mode=TwoWay}" Text="Hard" />

Code
public bool Hard
{
    get { return (bool)GetValue(HardProperty); }
    set
    {
        SetValue(HardProperty, value);

        if (value)
        {
            SetValue(MediumProperty, false);
            SetValue(EasyProperty, false);
        }
        else if(!value && !Medium && !Easy)
        {
            SetValue(HardProperty, true);
        }
    }
}

// Using a DependencyProperty as the backing store for Hard.  This enables animation, styling, binding, etc...
public static readonly DependencyProperty HardProperty =
    DependencyProperty.Register("Hard", typeof(bool), typeof(MainPage), new PropertyMetadata(false));

public bool Medium
{
    get { return (bool)GetValue(MediumProperty); }
    set
    {
        SetValue(MediumProperty, value);

        if (value)
        {
            SetValue(EasyProperty, false);
            SetValue(HardProperty, false);
        }
        else if (!value && !Easy && !Hard)
        {
            SetValue(MediumProperty, true);
        }
    }
}

// Using a DependencyProperty as the backing store for Medium.  This enables animation, styling, binding, etc...
public static readonly DependencyProperty MediumProperty =
    DependencyProperty.Register("Medium", typeof(bool), typeof(MainPage), new PropertyMetadata(false));

public bool Easy
{
    get { return (bool)GetValue(EasyProperty); }
    set
    {
        SetValue(EasyProperty, value);

        if (value)
        {
            SetValue(MediumProperty, false);
            SetValue(HardProperty, false);
        }
        else if (!value && !Medium && !Hard)
        {
            SetValue(EasyProperty, true);
        }
    }
}

// Using a DependencyProperty as the backing store for Easy.  This enables animation, styling, binding, etc...
public static readonly DependencyProperty EasyProperty =
    DependencyProperty.Register("Easy", typeof(bool), typeof(MainPage), new PropertyMetadata(true)); ```

A: As of 2019, there is a RadioMenuFlyoutItem in WinUI which will do this out the box: https://learn.microsoft.com/en-us/uwp/api/microsoft.ui.xaml.controls.radiomenuflyoutitem?view=winui-2.2


text:
Q: Example of functions where L'Hospital fails with limit at finite value due to nonexistence of limits of derivatives but the actual limit exists. I've seen that L'Hospital's Rule fails for functions such as
$$\lim_{x \to \infty} \frac{x}{x+\sin(x)}$$
since the limit of the derivatives oscillates. But all the examples I've seen so far have been limits at infinity. Are there any examples of functions where the actual limit exists, the limit is evaluated at a finite value but the limit of the derivatives is not equal to the actual limit?
I've been thinking about the functions $f(x)=1/x+\sin(1/x)$ and $g(x)=1/x$ and taking the limit as $x\to 0$ but clearly these functions are not differentiable at an interval containing zero so it doesn't work.

A: Consider $$\lim_{x\to 0}{f(x)\over g(x)},\quad \, g(x)=x+\sin x,\ f(x)=\begin{cases} x^2\sin{1\over x} & x\neq 0\\
0 & x=0
\end{cases}$$
The limit is equal $0.$ Both functions $f$ and $g$ are differentiable for any $x$ including $0.$ We have $f'(0)=0$ and
$$f'(x)=2x\sin{1\over x}-\cos{1\over x},\quad x\neq 0,\quad
g'(x)=1+\cos x$$
Therefore  $\displaystyle\lim_{x\to 0}{f'(x)\over g'(x)}$ does not
exist.


text:
Q: Cassandra assertion error after starting the second node I have a Cassandra cluster with two nodes with simple replication strategy.
Everything worked well until one of nodes crashed. I recovered the crashed node by cloning the remaining node virtual machine (so we cloned a file system), and updated the listening and RPC address.
Now I keep getting the following strange error.
When I am running each single node, everything is working well. But when I am starting the second node, the first one falls back with an error!
ERROR [Native-Transport-Requests-1] 2020-07-21 08:19:31,042 Message.java:693 - Unexpected exception during request; channel = [id: 0xc1935e7a, L:/192.168.40.15:9042 - R:/192.168.40.15:47980]
java.lang.AssertionError: null
    at org.apache.cassandra.locator.TokenMetadata.firstTokenIndex(TokenMetadata.java:1065) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.locator.TokenMetadata.firstToken(TokenMetadata.java:1079) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.locator.AbstractReplicationStrategy.getNaturalEndpoints(AbstractReplicationStrategy.java:107) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageService.getLiveNaturalEndpoints(StorageService.java:3866) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageService.getLiveNaturalEndpoints(StorageService.java:3852) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy.getLiveSortedEndpoints(StorageProxy.java:1914) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy$RangeIterator.computeNext(StorageProxy.java:1992) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy$RangeIterator.computeNext(StorageProxy.java:1962) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.utils.AbstractIterator.hasNext(AbstractIterator.java:47) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at com.google.common.collect.Iterators$PeekingImpl.hasNext(Iterators.java:1149) ~[guava-18.0.jar:na]
    at org.apache.cassandra.service.StorageProxy$RangeMerger.computeNext(StorageProxy.java:2014) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy$RangeMerger.computeNext(StorageProxy.java:1999) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.utils.AbstractIterator.hasNext(AbstractIterator.java:47) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy$RangeCommandIterator.computeNext(StorageProxy.java:2132) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.service.StorageProxy$RangeCommandIterator.computeNext(StorageProxy.java:2092) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.utils.AbstractIterator.hasNext(AbstractIterator.java:47) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.db.transform.BasePartitions.hasNext(BasePartitions.java:92) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:786) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:438) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:416) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:289) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:117) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:225) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:256) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:241) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116) ~[apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:566) [apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410) [apache-cassandra-3.11.4.jar:3.11.4]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:35) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:348) [netty-all-4.0.44.Final.jar:4.0.44.Final]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_252]
    at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) [apache-cassandra-3.11.4.jar:3.11.4]
    at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:114) [apache-cassandra-3.11.4.jar:3.11.4]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]

I'm using the following Cassandra version:
[cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
Here are the configuration files:
cassandra.yaml
cluster_name: 'babelfish'

num_tokens: 256

hinted_handoff_enabled: true

hinted_handoff_throttle_in_kb: 1024

max_hints_delivery_threads: 2

hints_flush_period_in_ms: 10000

max_hints_file_size_in_mb: 128

batchlog_replay_throttle_in_kb: 1024

authenticator: AllowAllAuthenticator

authorizer: AllowAllAuthorizer

role_manager: CassandraRoleManager

roles_validity_in_ms: 2000

permissions_validity_in_ms: 2000

credentials_validity_in_ms: 2000

partitioner: org.apache.cassandra.dht.Murmur3Partitioner

data_file_directories:
    - /var/lib/cassandra/data

commitlog_directory: /var/lib/cassandra/commitlog

cdc_enabled: false

disk_failure_policy: stop

commit_failure_policy: stop

prepared_statements_cache_size_mb:

thrift_prepared_statements_cache_size_mb:

key_cache_size_in_mb:

key_cache_save_period: 14400

row_cache_size_in_mb: 0

row_cache_save_period: 0

counter_cache_size_in_mb:

counter_cache_save_period: 7200

saved_caches_directory: /var/lib/cassandra/saved_caches

commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000

commitlog_segment_size_in_mb: 32

seed_provider:
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
          - seeds: "192.168.30.15, 192.168.40.15"

concurrent_reads: 32
concurrent_writes: 32
concurrent_counter_writes: 32

concurrent_materialized_view_writes: 32

memtable_allocation_type: heap_buffers

index_summary_capacity_in_mb:

index_summary_resize_interval_in_minutes: 60

trickle_fsync: false
trickle_fsync_interval_in_kb: 10240

storage_port: 7000

ssl_storage_port: 7001

listen_address: 192.168.40.15

start_native_transport: true
native_transport_port: 9042

start_rpc: false

rpc_address: 192.168.40.15

rpc_port: 9160

rpc_keepalive: true

rpc_server_type: sync

thrift_framed_transport_size_in_mb: 15

incremental_backups: false

snapshot_before_compaction: false

auto_snapshot: true

column_index_size_in_kb: 64

column_index_cache_size_in_kb: 2

compaction_throughput_mb_per_sec: 16

sstable_preemptive_open_interval_in_mb: 50

read_request_timeout_in_ms: 5000
range_request_timeout_in_ms: 10000
write_request_timeout_in_ms: 2000
counter_write_request_timeout_in_ms: 5000
cas_contention_timeout_in_ms: 1000
truncate_request_timeout_in_ms: 60000
request_timeout_in_ms: 10000

slow_query_log_timeout_in_ms: 500

cross_node_timeout: false

endpoint_snitch: GossipingPropertyFileSnitch

dynamic_snitch_update_interval_in_ms: 100
dynamic_snitch_reset_interval_in_ms: 600000
dynamic_snitch_badness_threshold: 0.1

request_scheduler: org.apache.cassandra.scheduler.NoScheduler

server_encryption_options:
    internode_encryption: none
    keystore: conf/.keystore
    keystore_password: cassandra
    truststore: conf/.truststore
    truststore_password: cassandra

client_encryption_options:
    enabled: false
    optional: false
    keystore: conf/.keystore
    keystore_password: cassandra

internode_compression: dc

inter_dc_tcp_nodelay: false

tracetype_query_ttl: 86400
tracetype_repair_ttl: 604800

enable_user_defined_functions: false

enable_scripted_user_defined_functions: false

enable_materialized_views: true

windows_timer_interval: 1

transparent_data_encryption_options:
    enabled: false
    chunk_length_kb: 64
    cipher: AES/CBC/PKCS5Padding
    key_alias: testing:1
    key_provider:
      - class_name: org.apache.cassandra.security.JKSKeyProvider
        parameters:
          - keystore: conf/.keystore
            keystore_password: cassandra
            store_type: JCEKS
            key_password: cassandra

tombstone_warn_threshold: 1000
tombstone_failure_threshold: 100000

batch_size_warn_threshold_in_kb: 5

batch_size_fail_threshold_in_kb: 50

unlogged_batch_across_partitions_warn_threshold: 10

compaction_large_partition_warning_threshold_mb: 100

gc_warn_threshold_in_ms: 1000

back_pressure_enabled: false
back_pressure_strategy:
    - class_name: org.apache.cassandra.net.RateBasedBackPressure
      parameters:
        - high_ratio: 0.90
          factor: 5
          flow: FAST

cassandra-rackdc.properties
# These properties are used with GossipingPropertyFileSnitch and will
# indicate the rack and dc for this node
dc=DC1
rack=RACK1

# Add a suffix to a datacenter name. Used by the Ec2Snitch and Ec2MultiRegionSnitch
# to append a string to the EC2 region name.
#dc_suffix=

# Uncomment the following line to make this snitch prefer the internal ip when possible, as the Ec2MultiRegionSnitch does.
# prefer_local=true

cassandra-topology.properties
# Cassandra Node IP=Data Center:Rack
192.168.30.15=DC1:RACK1
192.168.40.15=DC1:RACK1

# default for unknown nodes
default=DC1:r1

# Native IPv6 is supported, however you must escape the colon in the IPv6 Address
# Also be sure to comment out JVM_OPTS="$JVM_OPTS -Djava.net.preferIPv4Stack=true"
# in cassandra-env.sh
# fe80\:0\:0\:0\:202\:b3ff\:fe1e\:8329=DC1:RAC3

What could be the origin of this error, and how could it be fixed?

A: If you cloned the virtual machine with all data, then you have all data of the first node, including the node's ID.  To solve this problem, shutdown the 2nd node, delete all data from the data_file_directories and commit logs, leave only the first node as a seed node, and then start the 2nd node, so it will join the cluster as normal, and after this process finished, update the seed list (if you leave the 2nd node in the seed list, it won't join the cluster, but bootstrap a new cluster).


text:
Q: Django and Buildout Deployment Problem I am trying to deploy my existing django project via buildout, following loosely the instructions here.
my buildout.cfg file is:
[buildout]
parts       =     django python
develop     =     .
eggs        =     myproject

[django]
recipe      =     djangorecipe
version     =     1.2.3
project     =     myproject
projectegg  =     myproject
settings    =     settings
wsgi        =     true
eggs        =     ${buildout:eggs}

[python]
recipe      =     zc.recipe.egg
interpreter =     python
eggs        =     ${buildout:eggs}

There are two problems:

*

*First of all, if i invoke the python interpreter via ./bin/python, i get an import error with import myproject

*Secondly if i try to load the django.wsgi file, i also get an apache error

[Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): Target WSGI script '/usr/src/django/myproject/bin/django.wsgi' cannot be loaded as Python module.
[Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): SystemExit exception raised by WSGI script '/usr/src/django/myproject/bin/django.wsgi' ignored.
[Sun Oct 03 11:57:37 2010] [error] [client ::1] Traceback (most recent call last):
[Sun Oct 03 11:57:37 2010] [error] [client ::1]   File "/usr/src/django/myproject/bin/django.wsgi", line 20, in
[Sun Oct 03 11:57:37 2010] [error] [client ::1]     application = djangorecipe.wsgi.main('myproject.settings', logfile='')
[Sun Oct 03 11:57:37 2010] [error] [client ::1]   File "/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/wsgi.py", line 15, in main
[Sun Oct 03 11:57:37 2010] [error] [client ::1]     sys.exit(1)

My django.wsgi file is (updated as per suggested changes):

#!/usr/bin/python

import sys
sys.path[0:0] = [
  '/usr/src/django/myproject/src',
    '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg',
    '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg',
    '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg',
    '/usr/local/lib/python2.6/dist-packages',
    '/usr/local/lib/python2.6/dist-packages',
    '/usr/src/django/myproject/parts/django',
    '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg',
    '/usr/src/django/myproject/parts/django',
    '/usr/src/django/myproject',
    '/usr/src/django/myproject/src(/usr/src/django/myproject)',
    '/usr/src/django/myproject',
  ]

import djangorecipe.wsgi

application = djangorecipe.wsgi.main('myproject.settings', logfile='')

my bin/django file is:

#!/usr/bin/python

import sys
sys.path[0:0] = [
    '/usr/src/django/myproject/src',
    '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg',
    '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg',
    '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg',
    '/usr/local/lib/python2.6/dist-packages',
    '/usr/local/lib/python2.6/dist-packages',
    '/usr/src/django/myproject/parts/django',
    '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg',
    '/usr/src/django/myproject/parts/django',
    '/usr/src/django/myproject',
    '/usr/src/django/myproject/src(/usr/src/django/myproject)',
    '/usr/src/django/myproject',
    ]

import djangorecipe.manage

if __name__ == '__main__':
    djangorecipe.manage.main('myproject.settings')

Neither the import or the apache server seem to be working

A: your problem is that you are setting wrong your egg dependancies in your recipe
in the buildout part the line
eggs = myproject

you are setting your own myproject django project as a dependancy
in this settings, you need to set all the python eggs (packages) that are dependencies for your django project
for example
eggs =
    psycopg2
    south
    django-debug-toolbar
    django-extensions

if your project are using postgresql psycopg2 connector, south for database migrations and django-debug-toolbar and django-extensions
you can except from this list any package that you have in your python system install.
remove your project from the eggs setting, this one confuse your buildout.

A: Probably you need to set extra path to your project so it would be put on python path. Could you paste your django.wsgi and django files ?
Try this config:
[buildout]
parts       =     django python
develop     =     .
eggs        =     myproject
extra_paths =
    src(path_to your_project_source)
    ${buildout:directory}

[django]
recipe      =     djangorecipe
version     =     1.2.3
project     =     myproject
projectegg  =     myproject
settings    =     settings
wsgi        =     true
eggs        =     ${buildout:eggs}
extra-paths = ${buildout:extra_paths}

[python]
recipe      =     zc.recipe.egg
interpreter =     python
eggs        =     ${buildout:eggs}
extra-paths = ${buildout:extra_paths}

You can also make sure that django.wsgi has executable rights
chmod +x django.wsgi

A: The one thing that looks really strange: '/usr/src/django/myproject/src(/usr/src/django/myproject)' in both your bin/django and bin/django.wsgi file.
I've never seen that () stuff.  It looks like it might break things.
Best bet: just run
$> bin/python
>>> import sys
>>> print sys.path

and see what python itself thinks its path is. Buildout sets it up OK, but you've got something I've never seen before in your script.
Another alternative: are you sure your actual code doesn't include import errors that are ending up as import errors of your application (this can sometimes happen if you depend on c-level libraries like PIL or cx_oracle).

A: What worked for me was just not touching the buildout itself at all, and simply making sure all the eggs were in PYTHONPATH when the .wsgi script is executed. The .wsgi script itself looked like the following:
import os
import sys

PREFIX = '/path/to/my/app'  # the buildout is here

BUILDOUT_EGGS = [
    'Django-1.3-py2.6.egg',
    'South-0.7.6-py2.6.egg',
    'django_haystack-1.2.7-py2.6.egg',
    'djangopypi-0.4.4-py2.6.egg',
    'docutils-0.9.1-py2.6.egg',
    'setuptools-0.6c12dev_r88846-py2.6.egg',
    'zc.recipe.egg-1.3.2-py2.6.egg',
    'Whoosh-2.4.1-py2.6.egg',
    'django_registration-0.8_alpha_1-py2.6.egg',
    'djangorecipe-1.2.1-py2.6.egg',
#    'pkginfo-0.9-py2.6.egg',
#    'zc.buildout-1.6.0-py2.6.egg',

]

sys.path[0:0] = [PREFIX] + ['%s/eggs/%s' % (PREFIX, egg) for egg in BUILDOUT_EGGS]

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'

import djangorecipe.wsgi
application = djangorecipe.wsgi.main('myapp.settings', logfile='myapp.log')


text:
Q: Newbie: Where to place script for cronjob? I'm deploying an apache container which downloads php code from my github, but this code should run every 5min because it pulls an external API and fills a database.
I've been reading about cron in openshift and do understand the scripts, but I have no clue on where to put the scripts. All examples talk about how to put the script in the following directory: ".openshift/cron/minutely/awesome_job" but where is it ?????
Should I create it on my local harddisk and use the OC client to deploy an apache cointainer from that directory? I'm lost.
Using public Paas OpenShift.

A: Mine are in /etc/cron.daily/ but there are other flavors too, like .hourly, .weekly, .monthly..  This is debian.
I've also regularly put them in /usr/local.  Or in my own home directory if these are personal jobs.  Basically you give cron a path, so it goes there.


text:
Q: Choose entities from data-frame where dummy-variable is 1 at least once I have this data-frame:
df=data.frame(student=c(rep("John",6),rep("Meredith",7),rep("Jeremy",5),rep("Audrey",8)),
               semester=c(1,2,3,4,5,6, 1,2,3,4,5,6,7, 1,2,3,4,5, 1,2,3,4,5,6,7,8),
               addQual=c( 1,0,0,0,1,0, 0,0,0,0,0,0,0, 0,0,1,0,1, 0,0,0,0,0,0,0,0))

It contains students, all their semesters and for every semester whether they took an additional qualifications course(dummy variable addQual = 1 if they took it).
How can I get a data-frame dfFilt that only contains those students who ever participated in an additional qualifications course?
My desired output would therefore be:
dfFilt=data.frame(student=c(rep("John",6),rep("Jeremy",5)),
               semester=c(1,2,3,4,5,6,  1,2,3,4,5),
               addQual=c( 1,0,0,0,1,0,  0,0,1,0,1))

A solution in dplyr is preferred.

A: A base R solution
df[which(df$student %in% df$student[which(df$addQual >0)]), ]
   student semester addQual
1     John        1       1
2     John        2       0
3     John        3       0
4     John        4       0
5     John        5       1
6     John        6       0
14  Jeremy        1       0
15  Jeremy        2       0
16  Jeremy        3       1
17  Jeremy        4       0
18  Jeremy        5       1

A: In dplyr:
dfFilt = df %>% group_by(student) %>% filter(sum(addQual)>=1)

   student semester addQual
    <fctr>    <dbl>   <dbl>
 1    John        1       1
 2    John        2       0
 3    John        3       0
 4    John        4       0
 5    John        5       1
 6    John        6       0
 7  Jeremy        1       0
 8  Jeremy        2       0
 9  Jeremy        3       1
10  Jeremy        4       0
11  Jeremy        5       1


text:
Q: Push to a UIViewController from a presentViewController I want to push to a new viewcontroller from a presented viewcontroller. I don't want to dismiss the presented viewcontroller. I want the new viewcontroller to come over the presented viewcontroller.
Can anybody tell me how to do that.

A: You do not push form the presented controller so the best option is
First you have to dismiss the controller without animation and then in the method of -(void)viewWillApper you can easly push to the controller where you want to push.

A: You can do by using UINavigationController like
UINavigationController *vcObject = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"YourViewController"];
[self.navigationController presentViewController:vcObject animated:YES completion:NULL];

Now you can easily push or pop to other ViewController like you want.Thankyou

A: Open your modalView controller as a new rootViewController :
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:nextViewController];

 [self.navigationController presentViewController: navController animated:YES completion:nil]


text:
Q: Client Side Date Conversions in GWT I have a date that is:
2009-10-12T00:00:00

How would I convert this into UNIX Milliseconds, on the client side in GWT? Please give actual advice and not links, as a lot of the ways I have tried lead me to deprecated methods that point to non-Javascript convertible code.
As GWT converts all client side Java you have written into Javascript, it's making it very difficult for me to figure out how to do it.

A: DateTimeFormat seems to be what you are looking for :)
Update:
Some sample code showing the usage of the DateTimeFormat class:
DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss");
long unix = dtf.parse("2009-10-12T00:00:00").getTime();

Of course, you can do whatever else you want with the Date object that DateTimeFormat.parse returns.
Also, be sure to read the JRE Emulation Reference to see which parts of the JRE GWT emulates and which you should leave alone.


text:
Q: How to define a boost factor to each term in each document during indexing? I want to insert another score factor in Lucene's similarity equation. The problem is that I can't just override Similarity class, as it is unaware of the document and terms it is computing scores.
For example, in a document with the text below:
The cat is in the top of the tree, and he is going to stay there.

I have an algorithm of my own, that assigns for each one the terms in this document a score regarding how much each one of them are important to the document as whole. A possible score for each word is:
cat: 0.789212
tree: 0.633423
top: 0.412315
stay: 0.123912
there: 0.0999842
going: 0.00988412
...

The score for each word is different from document to document. For example, in another document cat could have score: 0.0023912
I want to add this score to the Lucene's scoring, but I'm kind of lost on how to do that.
Any tips?

A: Use Lucene's Payload feature:
From: http://www.lucidimagination.com/blog/2009/08/05/getting-started-with-payloads/

*

*Add a Payload to one or more Tokens during indexing.

*Override the Similarity class to handle scoring payloads

*Use a Payload aware Query during your search


text:
Q: Why execute with param method does not work? I am creating a master-details page in adf.
The master is iterator for department and the details is iterator for employees .. until now it is ok
I added execute with params method(with bind parameter "BEmpid")
to look for a specific employee in the details but it doesn't filter the result
Can you please help me?
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                xmlns:f="http://java.sun.com/jsf/core">
  <af:panelGroupLayout id="pgl1">
    <af:panelTabbed position="above" id="pt1" partialTriggers="i1:b1">
      <af:iterator id="i1" var="dept" value="#{bindings.DepartmentVO2.collectionModel}">
      <af:showDetailItem id="tab1" text= "#{dept.DepartmentName}">
        <af:inputText label="dept id" id="it1"  value="#{dept.DepartmentId}" disabled="true"/>
        <af:inputText label="dept name" id="it2"  value="#{dept.DepartmentName}" disabled="true"/>
        <af:inputText label="location id" id="it3"  value="#{dept.LocationId}" disabled="true"/>
        <af:inputText label="manager id" id="it4"  value="#{dept.ManagerId}" disabled="true"/>
         <af:panelFormLayout id="pfl1">
            <af:inputText value="#{bindings.BEmpId.inputValue}" label="#{bindings.BEmpId.hints.label}"
                          required="#{bindings.BEmpId.hints.mandatory}" columns="#{bindings.BEmpId.hints.displayWidth}"
                          maximumLength="#{bindings.BEmpId.hints.precision}"
                          shortDesc="#{bindings.BEmpId.hints.tooltip}" id="it9">
              <f:validator binding="#{bindings.BEmpId.validator}"/>
              <af:convertNumber groupingUsed="false" pattern="#{bindings.BEmpId.format}"/>
            </af:inputText>
            <af:commandButton actionListener="#{bindings.ExecuteWithParams.execute}" text="ExecuteWithParams"
                       disabled="#{!bindings.ExecuteWithParams.enabled}" id="b1"/>
          </af:panelFormLayout>

           <af:panelTabbed position="above" id="pt2" partialTriggers="b1">
            <af:iterator id="i2" var="employees" value="#{dept.EmployeesVO}">
                <af:showDetailItem id="tab2" text="#{employees.FirstName}">
                    <af:inputText label="employee id" id="it5"  value="#{employees.EmployeeId}" disabled="true"/>
                    <af:inputText label="first name" id="it6"  value="#{employees.FirstName}" disabled="true"/>
                    <af:inputText label="last name" id="it7"  value="#{employees.LastName}" disabled="true"/>
                    <af:inputText label="department id" id="it8"  value="#{employees.DepartmentId}" disabled="true"/>
                </af:showDetailItem>
            </af:iterator>
          </af:panelTabbed>

        </af:showDetailItem>
      </af:iterator>
    </af:panelTabbed>
  </af:panelGroupLayout>

</ui:composition>

A: Reason For Not Working :-
Here is the code to retrieve the Employees data,
"
<af:iterator id="i2" var="employees" value="#{dept.EmployeesVO}"> ",
In the case Tree/TreeTable binding, ADF At run time , in order to retrieve the Employees data, it will dynamically create view instance (some thing like 'EmployeesVO11') and use that e to retrieve the data i.e in another words , the ADF UI will not use the 'EmployeesVO' view instance under 'DepartmentVO' instance  added to your AM.
Where as 'ExecuteWithParams' action binding must have binded to AM's DepartmentVO.EmployeesVO instance.
Work Around
one work around to achieve your use case .
For your 'EmployeeVO, add 'where' a clause like ' EMP_ID = :pEmpId or :pEmpId IS NULL' and define a where clause param called 'pEmpId' and default it using groovy "adf.context.current.sessionScope.get('sEmpId')", and then populate session scope variable called 'sEmpId' from UI .


text:
Q: .NET Entity Framework code-first: navigation properties are not loaded In my application I have many entities.
Two of them are Person and Company, which have a many-to-many relationship.
So in my code I have a Person class which contains a refeference to a collection of Companies (ICollection), and a Company class which contains a reference to a collection of people. (ICollection).
Using a first-code approach, the database was correctly generated.
There are three tables: People, Companies and PeopleCompanies.
In the table PeopleCompanies I have a record which should create an association between determined Person and an other determined Company, as shown in the image below.
http://s27.postimg.org/xnkz3j94j/DBPrint.png
So, what is my problem?
In my business logic I need to know which people are associated to a determined Company, but the navigation property of the class Company remains empty: ICollection.Count() -----> 0
In realty, as you can see in the image above, there is exactly one person associated to the company.
I need the navigation property!
Someone can help?
The code of the DbContext is below. Thanks!
 public class EnterpriseDataContext : DbContext
{
    public EnterpriseDataContext(string connString) : base(connString)
    {

    }

    #region CRM Module

    public DbSet<Category> Categories { get; set; }
    public DbSet<City> Cities { get; set; }
    public DbSet<Company> Companies { get; set; }
    public DbSet<CompanyNote> CompanyNotes { get; set; }
    public DbSet<Country> Countries { get; set; }
    public DbSet<Lead> Leads { get; set; }
    public DbSet<Person> People { get; set; }
    public DbSet<PersonNote> PersonNotes { get; set; }
    public DbSet<Sector> Sectors { get; set; }

    #endregion

}

A: My psychic debugging powers are telling me that lazy loading is enabled and you're not using the proper Includes.
First, you need to make sure you have the following using statement
using System.Data.Entity

And then use .Include() to load your people.
var myEnterpriseDataContext = new EnterpriseDataContext("insert connection string here");

myEnterpriseDataContext.Companies
    .Include(c => c.People)
    //.Rest Of Query

note:  you don't need includes for fields that you only access while executing your query.  I.E.
myEnterpriseDataContext.Companies
    .Select(c => new CompanyViewModel(){People = c.People});


text:
Q: Could I integrate and deploy K2 blackpearl workflow engine for Drupal? I have one of the biggest Government agencies looking for new Portal based on Drupal, and they have a lot of workflows that need to be built via K2 workflow.
Could I integrate and deploy K2 blackpearl workflow engine for Drupal?
Does K2 blackpearl support that? Can Drupal handle this to be front-end for it?

A: If you want an appropriate answer, you would need to defined what you mean by 'integrate'.
I am not familiar with what Drupal does or not but as far as I know, this is a CMS.
So let me ask and answer a few questions, hopefully, one of the points is what you are looking for.
Can we integrate K2 forms into another product such as Drupal?
Yes, you can use iFrames to do that.
Could K2 access data from Drupal?
Yes. I am assuming Drupal stores its data in a MySQL server. There is a service broker from the community for MySQL. It would allow you reading and writting back data from/to the Drupal database.
Could drupal start processes?
No really, but you could a form using SmartForms that could do that and integrate that into an iFrame.
Can you access the blackpearl data from a third party product?
This one is more complicated than the others. Theorically, you could use the 2 available APIs (K2Services to the processes and tasks mainly and the SmartObject Services to access any SmartObject) to access K2 data from Javascript for example. The problem is as far as I know is that K2 does not handle (or not properly) cross origin requests (CORS).
I hope that answers your question.


text:
Q: Enable svg, svgz mime type in IIS8 I am using IIS 8 and MIME types are seemingly correctly configured in the IIS manager both globally and for my site.  However SVGs only get served as "document" and I cant serve svgz files at all (I get a parser error).
I have tried adding tricks like remove fileExtention, mimeMap in the web.config but that has no effect.  However if I leave out the remove tag in web.config and just try to map the filetype it gives an error, so IIS thinks the svg mimetype is mapped...  I have no idea how to solve this.