text:
Q: Changing font attributes of selected text (even when unselected) Since I would like to use a font that does not align well when using align functions, I figured that I could alter the font type prior to aligning the text.
So, I do not want to change what happens to text that is selected, but I want to edit selected text to alter the font at that time, allowing to use align.
(defun set-font-and-align ()
  (change font type of the selected text)
  (align-regexp)
)

Any ideas?

A: After some work, this is what I came up with:
(overlay-put (make-overlay (region-beginning) (region-end)) 'face '(:family "Monospace"))
This changes the font of the text in the region to Monospace. Similarly, it is possible to add :bold among other things.
Here is it in action: I use it for marking the paragraph, followed by assigning a monospace font, and then aligning on both & and \\.
(defun align-test ()
  (interactive)
  (mark-paragraph)
  (overlay-put (make-overlay (region-beginning)  (region-end)) 'face '(:family "Monospace"))

 (if (eq major-mode 'latex-mode)
    (progn   (align-regexp (region-beginning) (region-end)  "\\(\\s-*\\)&" 1 1 t )
         (align-regexp (region-beginning) (region-end)  "\\(\\s-*\\)\\\\\\\\" 1 1 t )))
  )


text:
Q: jQuery Mobile Complex Listview Items I've got an iOS app that has some fairly complex UITableViewCells.
I'm considering converting it to a web app, and I'd like to use jQuery Mobile, if possible, since it seems a good way to have the app appear decently for desktop browsers, too. (iUI, while nice, REALLY doesn't work with IE, in my experience.)
The basic listview in jQuery Mobile appears to be exactly what I'd like to have, but I can't figure out a way to make each listview item any more complex than, say, multiple lines of text.
Ideally, I'd like the ability to have multiple
 elements to structure text in a specific way, plus the ability to change the background color of each item to one of a list of pre-specified colors (we already have the color scheme and I can't change what each color means). Additionally, I'd like to keep the icon on the right-hand side to indicate that the user can click/press/tap the cell to see more detailed information.
Sample layout for how I'd possibly structure the HTML (it would actually be more complex than this):

        Doe, Jane (57 y)

I: 0800

R: 0900

S: 1000

O: 1100

            // Some more content here

Can jQuery Mobile do this, or am I barking up the wrong tree?

A: I dont think you can add divs to the listview, but you can have multiple lines of text like this: jquery mobile list formatting (View the source for a how to). You can also theme each li element in a different color: jquery mobile theming list.
My experience is that jquery mobile does not give you much freedom in customizing listviews, so if you need them to be more complex then the examples they have on their page, i would recommend using plain old html/css. Hopefully someone with more experience can prove me wrong!

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to fix: Only one expression can be specified in the select list when the subquery is not introduced with EXISTS I've been through a bunch of existing posts but couldn't get this to
work. I'm trying to build a query get all the records in a table and
an extra column. The extra column is populated by this logic - the
first value represented in the row which has same session ID as the
original record and has ToolName=ReportingTool. When I try to
implement the query like this, I get this error.
I tried doing a left join but the problem there is I don't know how to
limit the left join output (from the right table's select) to 1. This
causes multiple joins on the left and the no. of records returned
changes. My query is as follows:
SELECT
      *
      FROM [TraceDB].[dbo].[TelemetryLogs] AS TelemetryOuter

  LEFT JOIN [TraceDB].[dbo].[TelemetryLogs] AS TelemetryInner
  ON
    TelemetryInner.SessionID = TelemetryOuter.SessionID AND
    TelemetryInner.ToolName='ReportingTool' AND
    TelemetryInner.Name='Identity' AND
    TelemetryInner.SessionID = (
        SELECT TOP 1 *
        FROM [TraceDB].[dbo].[TelemetryLogs] AS TelemtryIntInt
        WHERE TelemtryIntInt.SessionID=TelemetryInner.SessionID
        )

  WHERE
    TelemetryOuter.ToolName ='ReportingTool'

EDIT: Fixed a comma which got introduced as a copy paste type

A: Try
SELECT TOP 1 TelemtryIntInt.SessionID

In your inner SELECT.  You're currently returning the whole row and you can't compare a scalar sessionID against a whole row.


text:
Q: Clearcase Restore lost+found Folder Element Running Clearcase 7.1.1.09 on a windows server. Lost+found directory element was removed using CCRC from a VOB. I can still see the lost+found directory in main/0. How can I restore the lost+found directory element of a VOB? According to this article http://www-01.ibm.com/support/docview.wss?uid=swg21135672 the lost+found directory element cannot be removed whatever that means.
Thanks for any help.

A: It means the /Vobs/MyVob/main/0 will always contain lost+found.
You may have ln, renamed or moved lost+found in more recent version of that Vob (like, for instance /Vobs/MyVob/main/4), you can always:
cleartool co -nc /Vobs/MyVob
cleartool ln /Vobs/MyVob/main/0/lost+found /Vobs/MyVob/lost+found
cleartool ci -c "restore lost+found" /vobs/MyVob

In Windows:
cleartool startview aDynamicView
cleartool mount \MyVob
cd m:\aDynamicView\MyVob
cleartool co -nc .
cleartool ln .@@/main/0/lost+found ./lost+found
cleartool ci -c "restore lost+found" .

That would create, in this example, a 5th version of the Vob root directory, with in it referenced once again the lost+found directory, effectively restoring it.
(as shown in this thread, see also cleartool man ls)
Since ln isn't available a sa CCRC command, you need to contact a ClearCase admin who will have access to the CCRC server (and the full ClearCase vob server) in order to restore that lost+found directory.


text: Q: CI for difference If you build confidence interval for difference (for example, when you are comparing shares), and 0 is included, it means, that the difference is not significant. But can you say something about this difference, using its left and right boundaries? Or these boundaries are meaningful only if they both are the same side from zero?


text:
Q: Flutter Comparing 2 lists of objects using map and contains not working I have 2 lists of Objects namely newList and oldList as shown below:
newList: [Object{id: -LhnrmWPWN2X_cWdIAQW, title: , category: abandoned, latitude: -17.8594103, longitude: 30.9615846}, Object{id: -LhnpMHQ3l288W28qoDW, title: , category: potholes, latitude: -17.8593472, longitude: 30.9614917}]
oldList: [Object{id: -LhnpMHQ3l288W28qoDW, title: , category: potholes, latitude: -17.8593472, longitude: 30.9614917}]
The problem is that using contains is not working when checking if all objects in newList are in oldList using the following code:
newList.where((Object p) => !oldList.contains(p))
            .map((Object obj) => print('\n\n\n\ntest \n$obj'))
            .toList();
In fact this code is returning true for both instances of the object in newList.
I expect that the code should return true for only one of the objects.
Please assist.

A: I think you want to check is two objects are equal or not,
In Dart by default, == returns true if two objects are the same instance the contains is the same too.
In addition, you can use the equatable package to be able to compare objects.
or as equatable package provides, you can do it without the package, you need to override == method in your object and hashCode staff.
class Person {
  final String name;

  const Person(this.name);

  @override
  bool operator ==(Object other) =>
    identical(this, other) ||
    other is Person &&
    runtimeType == other.runtimeType &&
    name == other.name;

  @override
  int get hashCode => name.hashCode;
}

but I would recommend to use the equatable package
import 'package:equatable/equatable.dart';

class Person extends Equatable {
  final String name;

  Person(this.name) : super([name]);
}

A: Seems like you're looking for whether oldList doesn't contain the object in your code snippet. Try utilising this code.
newList.where((i) => oldList.contains(i)).map((obj) {
    print('${obj.id}');
    return obj;
  }).toList();

Here is a little snippet on the workings of the code above.


text:
Q: Profile: Questions, Answers, Comments? I've decided to look at how many upvotes I have on comments that I made. I can't seem to find it anywhere? Perhaps a tab should be made in the profile just after " Summary | Answers | Questions | Comments " showing your list of comments and upvotes.
Even if there is a way to check your comments that I have not yet found, I still think a tab there wouldn't hurt.
Just a suggestion...

A: Adding this wastes screen real estate and encourages an unhealthy attachment to comments. Anything which encourages "hey why was my comment deleted?" and discourages moving the useful bits into edits or answers as self cleanup is a bad idea.

A: These are all the comments you've made on SO and on Meta with at least one upvote.
https://data.stackexchange.com/stackoverflow/query/116031


text:
Q: i want to check the the given value present in a dataset column or not I want to check the given value present in a dataset column.
I was insert the value using separator and stored in a column name fld empname.
Example the dataset field fldempname have the value Hari,vinoth,Arun. suppose i ll insert again the value hari and arun means it display error message Like this Employee name already present otherwise the value inserted.
please help me..
My partial code is here..
 for (int i = 0; i < lstbox.Items.Count; i++)
                    {
                        if (lstbox.Items[i].Selected)
                        {
                            string id = lstbox.Items[i].Text;
                            DataSet4TableAdapters.sp_getallattendancesetupTableAdapter TA1 = new DataSet4TableAdapters.sp_getallattendancesetupTableAdapter();
                            DataSet4.sp_getallattendancesetupDataTable DS1 = TA1.GetData();
                            if (DS1.Rows.Count == 0)
                            {
                                employee = employee + lstbox.Items[i].Text + ",";
                            }
                            else if (DS1.Rows.Count > 0)
                            {
                                foreach (DataRow dr in DS1.Rows)
                                {
                                    foreach (string category in dr["fldemployee"].ToString().Split(','))
                                    {
                                        if (category != "")
                                        {
                                            if (category == id)
                                            {
                                                Value = Value + lstbox.Items[i].Text + "\\n";
                                                break;
                                            }
                                        }
                                        continue;

                                    }

                                }
                            }
                        }

A: You can use the DataSet's Select() method:
DataRow[] foundRows;
foundRows = dataSet1.Tables["MyTable"].Select("fldempname = 'Hari'");

A: I haven't worked with datasets in a while.. so there prob is cleaner/better way to do this..
 DataSet st = new DataSet();
 foreach (DataRow row in st.Tables["table_name"].Rows)
 {
      if (row["column_name"] == "value")
      {
         //found
      }
 }

side note: i'd try Mitch Wheat's answer


text:
Q: How to remove -DCMAKE_C_COMPILER:FILEPATH -DCMAKE_CXX_COMPILER:FILEPATH from Visual Studio Code CMake extension I am trying to use ccache from CMake extension in Visual Studio Code. For this I added the following to settings.json:
"cmake.configureArgs": [
    "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
    "-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache",
    ...
],

However, the problem is that Visual Studio Code CMake extension adds the following flags to the command-line, and they seem to override ccache flags I passed:
-DCMAKE_C_COMPILER:FILEPATH=/bin/x86_64-linux-gnu-gcc-9 -DCMAKE_CXX_COMPILER:FILEPATH=/bin/x86_64-linux-gnu-g++-9

Is there a way to get rid of the latter flags?


text:
Q: Can I hide time and date and size in Nginx webserver directory listings? By default Nginx webserver shows the date , time and the size of all uploaded files when you browse each directory . It's something like " 21-Apr-2016 07:38           719858135 " . Is there a way to hide these informations and only list the links in webserver directory listings ?

A: Adding autoindex_localtime on; in the location directive would format the Date/Time to you local format, but I can't see a way to hide them.


text:
Q: How to create chained methods in Java I have a class responsible for controlling the objects created during runtime - it builds them from inputs at swing frames - just as a DAO. It has this method that removes already created objects:
public void removeFrom(Class<?> clazz, int index) {
    for (Map.Entry<String, Object> entry : modelsMap.entrySet()) {
        if (entry.getKey().equals(clazz.getSimpleName())) {
            ((ArrayList<Object>) entry.getValue()).remove(index);
        }
    }
}

Instead of calling this method and passing the referent class and index, I'd like the method call to be like this: dao.removeFrom(MyObject.class).at(myIndex); Guess it's looks like chained methods as the Stream API uses. Glad if anyone can help me!

A: In this case your removeFrom() method should return wrapper around ((ArrayList<Object>) entry.getValue()). And that wrapper has to have method at(int index) which removes element for given index.
And you also need to think about corner case when your modelsMap doesn't have entry for a given clazz.

A: Please check on the Builder design pattern. Try creating builder design pattern for a simple object which has few attributes and getters and setters.
Once you are able to do that, method chaining will look very clear. :)

A: You could introduce a DaoRemover class that you can instantiate by a factory method and which the instance methods return the current instance.
For example :
public class DaoRemover {
    private Map<String, Object> modelsMap; // your actual data
    private final List<ArrayList<Object>> list; // list of list after filtering on the class

    public static DaoRemover of(Class<?> clazz) {
        return new DaoRemover(clazz);
    }

    private DaoRemover(Class<?> clazz) {
        list = modelsMap.entrySet()
                        .stream()
                        .filter(e -> e.getKey()
                                      .equals(clazz.getSimpleName()))
                        .map(e -> (ArrayList<Object>) e.getValue())
                        .collect(toList());
    }

    public DaoRemover at(int index) {
        list.forEach(l -> l.remove(index));
        return this;
    }

}

You could do now :
DaoRemover.of(MyObject.class)
          .at(myIndex);

or
DaoRemover.of(MyObject.class)
          .at(myIndex)
          .at(myOtherIndex);


text:
Q: Does $\sum 3^{-\sqrt{n}}$ converge or diverge? I need to find out whether this series converges or diverges:
$$\sum_{n=1}^\infty \frac 1{3^{\sqrt{n}}}$$
The $n$th term, ratio, and root tests are inconclusive, Abel's test doesn't apply (or I can't think of how to separate out part of the sequence), and I can't figure out a series to compare this to that'll work.
WolframAlpha says it converges by the comparison test, BTW.  It just doesn't tell me what it compared the series to.

A: Here's something different, that doesn't require comparing $n^2$ with $3^{\sqrt{n}}$, or any similar comparison:
$$\frac{1}{3^{\sqrt{n}}}\leq\frac{1}{3^{\left\lfloor\sqrt{n}\right\rfloor}}$$
And the sequence $\{\left\lfloor\sqrt{1}\right\rfloor,\left\lfloor\sqrt{2}\right\rfloor,\left\lfloor\sqrt{3}\right\rfloor,\ldots\}$ is equal to $$\{\overbrace{1,1,1}^3,\overbrace{2,\ldots,2}^{5},\overbrace{3,\ldots,3}^{7},\ldots,\overbrace{k,\ldots,k}^{2k+1},\ldots\}\text{.}$$ This follows from understanding that consecutive perfect squares differ by increasing odd numbers. Or equivalently that the sum of consecutive odd integers $3+5+7+\cdots$ is always $1$ shy of a perfect square.
So
$$\begin{align}
\sum_{n=1}^{\infty}\frac{1}{3^{\sqrt{n}}}&<\sum_{n=1}^{\infty}\frac{1}{3^{\left\lfloor\sqrt{n}\right\rfloor}}\\
&=\sum_{k=1}^{\infty}\frac{2k+1}{3^{k}}\\
&=2\sum_{k=1}^{\infty}\frac{k}{3^{k}}+\sum_{k=1}^{\infty}\frac{1}{3^{k}}\\
&=2\cdot\frac{3}{4}+\frac{1}{2}\\
&=2
\end{align}$$
Not only is the sum convergent, it's less than $2$. You can get a better upper bound by leaving the initial terms alone instead of using the floor function. For instance, this same approach can be used with $$\begin{align}\frac{1}{3^{\sqrt{1}}}+\frac{1}{3^{\sqrt{2}}}+\frac{1}{3^{\sqrt{3}}}+\sum_{n=4}^{\infty}\frac{1}{3^{\left\lfloor\sqrt{n}\right\rfloor}}
&=\frac{1}{3^{\sqrt{1}}}+\frac{1}{3^{\sqrt{2}}}+\frac{1}{3^{\sqrt{3}}}+1\\
&\approx1.69\ldots
\end{align}$$
which is a better upper bound. (A CAS says the true value is approximately $1.34\ldots$)

For an even better approximation that you can't immediately tell is over or under, replace each term in $\sum_{n=N^2}^{(N+1)^2-1}\frac{1}{3^{\sqrt{n}}}$ (the portion of the series corresponding to one of the constant substrings in $\{\left\lfloor\sqrt{n}\right\rfloor\}$) with the average of the end terms: $\frac{1}{3^{\sqrt{N^2}}}$ and $\frac{1}{3^{\sqrt{(N+1)^2}}}$. So
$$\begin{align}
\sum_{n=1}^{\infty}\frac{1}{3^{\sqrt{n}}}
&\approx\sum_{N=1}^{\infty}\frac12\left(\frac{1}{3^N}+\frac{1}{3^{N+1}}\right)(2N+1)\\
&=\frac43
\end{align}$$
I'm not offering error analysis, but you can note that this does indeed get within $0.6\%$ of the exact value.

A: Hint: $\log_e n \leq \sqrt{n}$ for $n\geq 1$. Then
$$3^{\log_e n} = n^{\log_e3}\leq 3^{\sqrt{n}}$$
This will imply, for n large enough
$$\frac{1}{n^{\log_e3}}\geq \frac{1}{3^{\sqrt{n}}}$$
Now $\log_e3 > 1$.

A: One way to show that this series converges can be to compare it to $\int_0^\infty (1/3)^\sqrt x dx$, which is convergent.
Edit - You can solve this integral by substituting $t=\sqrt x$, and then integrating the resulting integral by parts.

A: If we stick to general tests, we
can apply the condensation test ($a_n=\frac{1}{3^{\sqrt{n}}}$ is decreasing) + the $n$-th root (for example) test.
$$
\sum_n a_n \le \sum_n (2n+1)a_{n^2}=\sum_n \frac{2n+1}{3^n}\\
\lim_{n} \left(\frac{2n+1}{3^n}\right)^{\frac{1}{n}}=\frac{1}{3}<1
$$
(The condensation is done through the $\varphi(n)=n^2$ subsequence, in this way we "eliminate" the square root.)

A: Or you can apply https://en.wikipedia.org/wiki/Integral_test_for_convergence
Here, $f(x)=3^{-\sqrt{x}}$, then your series converges if and only if $\int_1^{\infty}3^{-\sqrt{x}}dx$ converges.
But $\int_1^{\infty}3^{-\sqrt{x}}dx\overset{x=u^2}=\int_1^{\infty}2ue^{-(\ln3)u}du=-\frac{2u}{\ln3}e^{-(\ln3)u}\vert_1^{\infty}+\frac{2}{\ln3}\int_1^{\infty}e^{-(\ln3)u}du=\frac{2}{\ln3}+\frac{2}{(\ln3)^2}$, it converges so does the series $\sum_{n=1}^{\infty}3^{-\sqrt{n}}$.


text:
Q: Matplotlib map and subplot with different text at each data point I am mapping some data, weather stations across London, and want to label each data point (the green points) with the names of the weather stations, for example, Bow, Westminster.
The map is created from a Geopandas dataframe, from the geometry column. Using this post: https://stackoverflow.com/questions/14432557/matplotlib-scatter-plot-with-different-text-at-each-data-point
I tried to annotate the text, but get the following error:
TypeError: 'Point' object is not iterable.
Here is the map as it currently looks:

and here is the code:
f, ax = plt.subplots(1, figsize=(12, 12))
ax.set_title('Plot of London Grid for Learning weather stations with London boroughs and locations of Urban Mind datapoints', fontsize = 15)

boroughs.plot(alpha=1,edgecolor='w', facecolor='gray', linewidth=0.1, ax=ax)
london_umdata_geo.plot(ax=ax, marker="o",color="red",markersize=10.0,alpha=1.0, legend=True) #1,015 UM datapoints in London
stations_geo.plot(ax=ax, marker="X",color='green',markersize=20.0,alpha=1.0,legend=True)

n = stations_geo['Station Name'].tolist()
for i, txt in enumerate(n):
    ax.annotate(txt, xy = stations_geo.loc[i,'geometry'])

plt.show()

The stations are the green points, other data points (which will not be labelled) are in red.
stations_geo is a GeoPandas dataframe, which contains a geometry column from which the points are plotted using matplotlib.
I am using a loop for the annotate method, supposedly to loop through the points in the geometry column and use these as the co-ordinates for the annotations, but matplotlib seems not to like the Point objects (which are Shapely points). However, these points are being used directly to create the green points in the first place, so I am not sure where I am going wrong.
Any help appreciated, thanks!

A: You already found the problem yourself ("matplotlib seems not to like the Point objects (which are Shapely points)").
So when confronted with such a problem, you may use the documentation as follows.

*

*Look at the matplotlib documentation about what you may supply to the xy argument of annotate.

xy : iterable
        Length 2 sequence specifying the (x,y) point to annotate

*Look at the object you have. In cause of doubt, use print(type(stations_geo.loc[i,'geometry'])). It will show something like shapely.geometry.Point. Look at the documentation of that object.

*Identify a way to convert the one to the other. In this case you'll find

Coordinate values are accessed via coords, x, y, and z properties.

*Print stations_geo.loc[i,'geometry'].coords, it will be a list of (a single) tuple(s).
So in order to convert a single shapely Point to a python tuple, you would use its .coords attribute and take the first (and only) element from that list.
xy = stations_geo.loc[i,'geometry'].coords[0]


text:
Q: How to get JaCoCo instrumentation code coverage while executing webApplication on server I want to get a code coverage report (or tracking controller flow of an application) when I execute the some scenario on live application i.e. while application running in server, so I have refereed the official Jacoco documentation  and did as fallows
As a first step, I tried to bind the jacoco agent to the application running port
export MAVEN_OPTS=-javaagent:/home/user/.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=includes=*,output=tcpserver,port=6300,address=*,dumponexit=true

then I have started the server and executed some test scenarios by that time I have also requested jacoco to get the dump by executing following command
 mvn jacoco:dump

when I executed the above command first it showed like java.net.BindException: Address already in use then it printed as fallows
[INFO] Connecting to localhost/127.0.0.1:6300

When I stopped the server jacoco.exec has been generated to a known location there after I have requested to generate a jacoco report by executing the following command
mvn jacoco:report

Finally I got the report but when I open the index.html page it showed 0% coverage.
you can reproduce my difficulty with following sample Spring MVC project
please download Spring MVC project from https://github.com/mkyong/spring4-mvc-ajax-example from the Github
In my case I am using WildFly 8.x server to run the project and add the following dependencies to downloaded projects pom.xml
 maven-surefire-plugin of 2.19.1 version
 jacoco-maven-plugin of 0.7.4.201502262128 version
 junit of 4.12 version

Then clean and build the project by using following commands.
mvn clean install

once it is done get the .war file from target folder of the project and keep inside the wildfly serverwildfly-9.0.0.CR2/standalone/deployments/ folder
Once the .war is deployed go to /wildfly-9.0.0.CR2/bin/ folder and execute/run the ./standalone.sh file or depending on platform you can run the.dat/.sh file
once project is deployed and server is started execute the following command
mvn jacoco:dump

it displayed like listening/connected to localhost/127.0.0.1:6300
Then execute some test scenarios and execute following maven command
mvn jaococ:report

Finally report will be generated with 0% coverage!.
Downloaded project can be found in  MKyong website
Please help me to get the code coverage report and any help will be appreciated.

A: JaCoCo requires the exact same class files for report generation that were used at execution time, so

*

*if report is completely empty, then classes were not provided

*if report contains classes but their coverage is 0%, then they don't match classes that were used at runtime - this is described along with other related information in JaCoCo documentation on page http://www.jacoco.org/jacoco/trunk/doc/classids.html
and in either case check existence of warnings in log.
Update for updated question
Here is what I did:

*

*downloaded and unpacked JaCoCo 0.7.9 into /tmp/jacoco/jacoco-0.7.9

*downloaded and unpacked Wildfly 9.0.0.CR2 into /tmp/jacoco/wildfly-9.0.0.CR2

*cloned https://github.com/mkyong/spring4-mvc-ajax-example into /tmp/jacoco/spring4-mvc-ajax-example and built as mvn verify

*copied /tmp/jacoco/spring4-mvc-ajax-example/spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war into /tmp/jacoco/wildfly-9.0.0.CR2/standalone/deployments

*Wildfly started as JAVA_OPTS=-javaagent:/tmp/jacoco/jacoco-0.7.9/lib/jacocoagent.jar=output=tcpserver ./standalone.sh and got enough time to deploy application

*in directory /tmp/jacoco/spring4-mvc-ajax-example executed mvn org.jacoco:jacoco-maven-plugin:0.7.9:dump org.jacoco:jacoco-maven-plugin:0.7.9:report (note that version of used agent matches version of jacoco-maven-plugin) so that it created /tmp/jacoco/spring4-mvc-ajax-example/jacoco.exec and report /tmp/jacoco/spring4-mvc-ajax-example/site/jacoco:

*opened http://localhost:8080/spring4-mvc-maven-ajax-example-1.0-SNAPSHOT/ and did some actions

*executed mvn org.jacoco:jacoco-maven-plugin:0.7.9:dump org.jacoco:jacoco-maven-plugin:0.7.9:report again to get an updated report:


text:
Q: str.extract vs str.count regex usage in pandas I am trying to understand why str.extract"([\d+%])" returns NaN while str.count"([\d+%])" returns the correct answer when parsing text within a column of a dataframe.
For example,
df = pd.DataFrame({'Subject':['3 hrs only! 35% off', 'Secret Savings!', 'Sale: 40% off']})
pattern = re.compile(r"(\d+%)")
df['Discount'] = df['Subject'].str.count(pattern)

...yields a Discount column with "1's" in row 1 and 3 as you would expect. However,
df['Discount'] = df['Subject'].str.extract(pattern)

...returns NaNs instead. I cannot understand why count can parse the percentages but extract does not. This is driving me a little crazy as it seems like it should be straightforward.

A: The bug was fixed in the subsequent Pandas version.
Now, with Pandas  0.24.2, you may use
>>> df.index=['a', 'b', 'c']
>>> df
               Subject Discount
a  3 hrs only! 35% off      35%
b      Secret Savings!      NaN
c        Sale: 40% off      40%
>>> df['Subject'].str.extract(pattern)
     0
a  35%
b  NaN
c  40%


text:
Q: VBA Populate range from array I created an array which is populated if a condition is met - so far so good.
Now the values which met the condition need to be copied to a different sheet.
Actually I have to questions:
1. I can't get the values in the range in the first place.;
2. The array stores 4 columns (range) for each row if the criteria is met. Would it be possible if I can determine each array column and paste it in a specific column (in the array the columns are next to each other, but in the destination sheet they are not).
This the code I have so far:
Sub determineDelta()
'Start determination and copy values to Delta sheet
Worksheets("Source").Activate
Range("A2").Select
numberOfRecords = Range(Selection, Selection.End(xlDown)).Rows.Count + 1

Dim myArray() As Variant
ReDim myArray(1 To 500) As Variant
Dim i, j, k As Integer
k = 0
ReDim myArray(numberOfRecords, k) As Variant

    For i = 2 To numberOfRecords
        If IsError(Application.Match(Cells(i, "A").Value, Sheets("SE16N").Range("A:A"), 0)) Then
            For j = 2 To 6
                myArray(j, k) = Cells(i, j).Value
                Debug.Print myArray(j, k)
            Next j
            k = k + 1
            ReDim Preserve myArray(numberOfRecords, k)
        End If
    Next i

Worksheets("Delta").Activate
Range("I2:I" & UBound(myArray)) = "FI"
Range("J2:J" & UBound(myArray)) = "A"
Range("M2").Resize(UBound(myArray), 1).Value = Application.Transpose(myArray)
End Sub

I've been looking on the internet for 2 days, including cpearson. In this article about array sizing (on the bottom) it states #N/A. This is what I do have! But don't want. :-)
I have the feeling I'm not that far off and wouldn't be surprised if it is just something relatively small.
I hope someone can help me.

A: Some advice added, not sure if this is what you need.
Sub determineDelta()
    'Start determination and copy values to Delta sheet
    Worksheets("Source").Activate
    Range("A2").Select
    numberofrecords = Range(Selection, Selection.End(xlDown)).Rows.count + 1

    Dim myArray() As Variant
    'Unnecessary code
    'ReDim myArray(1 To 500) As Variant
    Dim i, j, k As Integer
    k = 0
    'ReDim myArray(numberOfRecords, k) As Variant
    ReDim myArray(numberofrecords, 2 To 6) As Variant

    For i = 2 To numberofrecords
        '[1]
        If Not IsError(Application.Match(Cells(i, "A").Value, Sheets("SE16N").Range("A:A"), 0)) Then
            For j = 2 To 6
                '[2]
                'myArray(j, k) = Cells(i, j).Value
                'Debug.Print myArray(j, k)
                myArray(k, j) = Cells(i, j).Value
            Next j
            k = k + 1
            'Since we already have a large enough array, no need to redim here
            'ReDim Preserve myArray(numberofrecords, k)
        End If
    Next i

    With Worksheets("Delta")
        .Range("I2:I" & UBound(myArray)) = "FI"
        .Range("J2:J" & UBound(myArray)) = "A"
        '[3]
        '.Range("M2").Resize(UBound(myArray), 1).Value = Application.Transpose(myArray)
        .Range("M2").Resize(UBound(myArray), 5).Value = myArray
    End With
End Sub

[1]:
IsError will return TRUE if there is an error in the following formula. If Cells(i, "A") is found in the Sheets("SE16N"), it won't go into the for loop. So myArray will always catch values that are not in Sheets("SE16N"). After adding a NOT operator, only items could be found are able to load into myArray. However, if you need to catch the values that are not shown in Sheets("SE16N"), the origin is right.
[2]:
It's a waste that you claimed an array about hundred rows but you access only row #2 to #6. I changed (j, k) into (k, j), so hopefully most of the array can be used.
[3]:
Since I exchanged the row and column, the array no longer needs to be transposed. In your original code, resize the range will get you a range with several rows and only one column. So only the first column of the array can be copied into the worksheet, feel free to change 5 back to 1 if I'm wrong.
If you need to paste the data into separated columns, two methods come up in my mind. 1. You can store the data into different arrays at the beginning. 2. Loop through the array several times such as:
Set OriginCell = Range("M2")
Set OriginCell2 = Range("Q2")
For i = 0 to UBound(myArray)
    OriginCell.Offset(i).Value = myArray(i, 2)
    OriginCell2.Offset(i).Value = myArray(i, 3)
Next i

A: Thanks a lot. When I change the above code with your comments, it works.
[1] Yes, if the value doesn't exist it needs to do something. So I didn't change that part.
[2] I guess I still need to read more about arrays, because this is not 100% clear to me.
[3] Awesome. Didn't know it was possible.
Yes, the columns in the array need to go to individual columns.
I tried it with your code, but it didn't do the trick. I get the point what you're trying to do. However, if I insert it like this, it will use the current sheet, i.e. Source, while the data needs to be in sheet Delta.
When setting the ranges I included the Worksheets function as well  and it works like charm:
Set OriginCell = Worksheets("Delta).Range("M2")
Set OriginCell2 = Worksheets("Delta).Range("Q2")
For i = 0 to UBound(myArray)
    OriginCell.Offset(i).Value = myArray(i, 2)
    OriginCell2.Offset(i).Value = myArray(i, 3)
Next i

There are only some empty rows in the array, but I will be able to manage that myself. :) Thanks!


text:
Q: Angular js - TypeError: Cannot read property 'get' of undefined I have a mean stack application where on click of a button, translate function is being called. When the button is clicked, it enters this function, but then is not able to execute the http.get part where it throws the error :

TypeError: Cannot read property 'get' of undefined

Below is my angular code for that page.
(function() {
    var app = angular.module('dashboard', []);
    app.config(['$stateProvider', function($stateProvider) {
        $stateProvider.state('secured.dashboard', {
            url: '/dashboard',
            controller: 'searchController',
            templateUrl: '/views/dashboard.html'
        });
    }]);

    app.controller('searchController', ['$scope', 'AuthService', '$state', '$http', function($scope, AuthService, user, $state, $http) {
        console.log($scope.user)
        // AuthService.setUser(user);
        console.log("In search controller");
        $scope.logout = function() {
            AuthService.logout().then(function() {
                $scope.user = null;
                $state.go('unsecured');
            })
        }

        $scope.data = {};

        $scope.translate = function() {
            console.log("Entered")
            console.log($scope.item);
            $scope.show_results = true;

            $http.get('/mosesTranslateSmall', { params: { name: $scope.item }, timeout: 600000 }).
            then(function(response) {
                console.log(response.data);
                $scope.data.moses_less = response.data;

            });

I have looked at similar questions which advice on passing http as an argument in the controller, but am doing that and it still throws an error.

A: Your order of dependency is wrong, remove user from the second set of params
   app.controller('searchController', ['$scope', 'AuthService', '$state', '$http', function($scope, AuthService, $state, $http) {


text:
Q: How can I contour plot a custom function? I have a custom function which returns either 0 or 1 depending on two given inputs:
function val = myFunction(val1, val2)

  % logic to determine if val=1 or val=0

end

How can I create a contour plot of the function over the x,y coordinates generated by the following meshgrid?
meshgrid(0:.5:3, 0:.5:3);

This plot will just simply display where the function is 0 or 1 on the contour map.

A: If your function myFunction is not designed to handle matrix inputs, then you can use the function ARRAYFUN to apply it to all the corresponding entries of x and y:
[x,y] = meshgrid(0:0.5:3);      %# Create a mesh of x and y points
z = arrayfun(@myFunction,x,y);  %# Compute z (same size as x and y)

Then you could use the function CONTOUR to generate a contour plot for the above data. Since your z data only has 2 different values, it would probably make sense for you to only plot one contour level (which would be at a value of 0.5, halfway between your two values). You might also want to instead use the function CONTOURF, which produces color-filled contours that will clearly show where the ones and zeroes are:
contourf(x,y,z,1);  %# Plots 1 contour level, filling the area on either
                    %#   side with different color

NOTE: Since you are plotting data that only has ones and zeroes, plotting contours may not be the best way to visualize it. I would instead use something like the function IMAGESC, like so:
imagesc(x(1,:),y(:,1),z);

Keep in mind the y-axis in this plot will be reversed relative to the plot generated by CONTOURF.

A: The following will do it:
function bincontour
    clear; clc;

    xrange = 0:.5:3;
    yrange = 1:.5:5;
    [xmesh, ymesh] = meshgrid(xrange, yrange);
    z = arrayfun(@myFunction, xmesh, ymesh);

    contourf(xrange, yrange, z, 5)
end

function val = myFunction(val1, val2)
    val = rand() > 0.5;
end


text:
Q: Stream a local mp3 file to a remote UPnP-client without a UPnP-server I have a nice hardware UPnP streaming client (Phillips NP2900) here in my room.
I want to play music from my PC (Ubuntu 14.04.3 LTS) on that remote device. But I don't want to setup a complete UPnP-server on my PC for that.
Please remember the Windows Media Player. It recognize any UPnP/DLNA-client in available it offer to play on it. This worked fine on windows. I need something like that on a unixoid system.

A: I can suggest http://www.eezupnp.de/ - simple nice and easy. Supports playlists. Plays files directly from a hard disk. I use it all the time.


text:
Q: can not change a css class value using recaptcha I am using recaptcha for a form and am trying to change its width but not to give.
I have an id that has width 153px! Important and I want to change to 260px but whenever I try the initial value is prevailing.
I already tried these ways:
1st - $ ('# recaptcha_area') css ({'width': '260px important! '});
2nd - $ ('# recaptcha_area') addClass ('test');
thank you all

A: This won't change as if the minimum width of recaptcha is 300px set by google. But if you want to try you do like this:
$('#recaptcha_area').css('width','260px','important');

I was also facing this problem later I used zoom to decrease it's width. So you can use css like this:
#recaptcha_widget_div{zoom: .8}

A:
Jquery confused at the time two important for the same id. Remove the
  line width:153px !important in css and write simply width : 153px; And
  then try this

$('#recaptcha_area') css({'width': '260px important!'});

Note :    If the same property is declared in both rules, the conflict
  is  resolved first through specificity, then according to the order of
  the  CSS declarations. The order of classes in the class attribute is
  not  relevant.


text:
Q: configuring _JAVA_OPTIONS for remote debug, I always get ERROR: JDWP Good day, I'm trying debug my code, It's a clojure code using vertx lein...generally I use
export JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

and this works perfect, but I don't know why these JAVA_OPTS are ignored when I use a lein vertx project, basically the remote debugger doesn't start
searching here in stackoverflow I found than I could use _JAVA_OPTIONS instead, now when I run my project seems than my jvm takes the options perfectly but fails after open the socket
lein vertx run
Picked up _JAVA_OPTIONS: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
Listening for transport dt_socket at address: 4000
Picked up _JAVA_OPTIONS: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_

this is not an issue related to the port address, I've tried with 7000,5050,5000,9000,4848,48148,18787 and with every address It's fails...also I tried check what app is using the port
netstat -ap | grep 18787

and it's empty, basically any app is using the same port...
Also I try adding the jvm_opts to my project.clj
:jvm-opts ["-Xdebug" "-Xnoagent" "-Djava.compiler=NONE" "-Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"]

it doesnt works neither...
these are some options than I tested before
export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket, address=1043, server=y, suspend=n"
--- src/yvertx3 » export JVM_OPTS="-agentlib:jdwp=transport=dt_socket, address=1043, server=y, suspend=n"

export JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

export _JAVA_OPTIONS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

export JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999"

export _JAVA_OPTIONS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

export _JAVA_OPTIONS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n $JAVA_OPTS"

any clue will be appreciate...thanks!!

A: The options you are using are only setting the dt_socket port. To fix this error you should change the port used by the vertx server itself.


text:
Q: the name of function return anonymous when I define a function with new Function I was trying to define a function with constructor Function as below, but why the name of the function return anonymous?
let sayHi = new Function('alert("Hello")');
//this will return anonymous
sayHi.name

A: This happens because you are creating anonymouse function.
Named functions are initialized with:
function sayHi() {
  alert('Hello');
};

sayHi.name // sayHi

A:
...but why the name of the function return anonymous?

Because that's how the Function constructor is defined. This is covered by the spec. The Function constructor calls the abstract operation CreateDynamicFunction, which sets the name to "anonymous" near the end:

*Perform SetFunctionName(F, "anonymous").

This is in contrast to a non-dynamic function with no name, which is relatively difficult to create these days because ES2015 defined that names are assigned to functions created with anonymous (!) function expressions in most situations.
The exception is assigning to a property on a pre-existing object:

const o = {};
o.foo = function() { };
console.log(o.foo.name); // ""

Just for completeness, here are some functions that use neither "" nor "anonymous" as their name:

function foo() {
}
console.log(foo.name);

const bar = function() { };
console.log(bar.name);

const baz = () => { };
console.log(baz.name);

(Yes, those second two are assigned a name as specified behavior; see this answer for details.)

A: Function constructor does not accept a name, therefore it is always anonymous as specified in the docs:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name

A: Functions created with the syntax new Function(...) or just Function(...) create Function objects and their name is "anonymous".
(new Function).name; // "anonymous"

Hope this helps you!


text:
Q: Firestore error Request had insufficient authentication scopes I'm trying to use Google Firestore for the first time, authenticating with google api authentication. The first thing I'm doing is populating the database with a StartBatch with several Set methods, when I await the batch Task, it gives me this error:
Error: Status(StatusCode=PermissionDenied, Detail="Request had insufficient authentication scopes.") ;

I've found little about authenticating with google to connect to firestore. First I authenticate with this method using the secret provided by google console for my app:
    public async Task<GoogleOAuthState> GetUserCredentialAsync(string user = null, GoogleOAuthState oAuthState = null)
    {
        using (ClientSecretStream)
        {
            string credPath = System.Environment.GetFolderPath(
                System.Environment.SpecialFolder.Personal);

            if (oAuthState == null)
            {
                try
                {
                    var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                        GoogleClientSecrets.Load(ClientSecretStream).Secrets,
                        _Scopes,
                        string.IsNullOrEmpty(user) ? "user" : user,
                        CTS.Token,
                        new FileDataStore(credPath, true));

                    return new GoogleOAuthState(credential, _AppName);
                }
                catch (Exception e)
                {
                    SetErrorMessage(e, "Error al intentar identificarse en google");
                    return null;
                }
            }
            else
            {
                try
                {
                    await GoogleWebAuthorizationBroker.ReauthorizeAsync(
                        oAuthState.Credential,
                        CTS.Token);
                    return oAuthState;
                }
                catch (Exception e)
                {
                    SetErrorMessage(e, "Error al intentar volver a identificarse en google");
                    return null;
                }
            }
        }
    }

Using the same scopes that are configured in my google console for the app (I use google drive in the same app):
            SheetsService.Scope.Spreadsheets
            DriveService.Scope.DriveFile
            DriveService.Scope.Drive
            DriveService.Scope.DriveAppdata
            DriveService.Scope.DriveMetadata
            "https://www.googleapis.com/auth/datastore"
            "https://www.googleapis.com/auth/cloud-platform"

GoogleOAuthState is just an object to hold and pass Credential and what not.
After that I connect to firestore with this:
    public async Task ConnectDB(GoogleLogin.GoogleOAuthState oAuthState)
    {
        var channelCredentials = oAuthState.Credential.ToChannelCredentials();
        var channel = new Channel(FirestoreClient.DefaultEndpoint.ToString(), channelCredentials);
        var client = FirestoreClient.Create(channel);
        _DB = FirestoreDb.Create(Properties.Settings.Default.FirebaseProjectName, client);
    }

I saw that method in this question and thought it'd be the most reliable.
I've set firestore rules like this in the meanwhile:
service cloud.firestore {
match /databases/{database}/documents {
  match /{document=**} {
    allow read, write: if true;
    }
  }
}

The google authentication works ok, I can use google drive without problems. I've also added google as an authentication method in the firestore console, and added the app id(I'm not sure if this is really necessary).
I think I'm misunderstanding something... Is it even possible to do this? Or do I have to use a service account?

A: Well, from what I've tested and read, It seems that it's not possible to sign to Firestore via oAuth from a desktop application: you use a service account or nothing. I'm not even sure if it's possible to sign from a desktop application at all, it's all mobile or web, nothing more.
Anyway, even with the service account, now I have another problem, so I'm opening another question.


text:
Q: Excel interop in C# will not actually release no matter what I do I'm using the Excel interop for C# and all the methods to dispose of it exactly as described in many different places and no matter which method I use to dispose of the objects there is still an Excel.exe process running after the method finishes and everything should be finished and released. The existence of the process wouldn't bother me so much except you cannot open Excel without first closing my app which happens to terminate the Excel process at the same time.
Without resorting to actually figuring out which Excel processes have a parent process of my process and terminating them, I don't know what else to do.
Here is the current test method I'm using which should by all means work and releae:
    private bool FillExcelFileWithDataTest()
    {

        string sPath = "C:\\Some.xls";

        Excel.Application xlApp;
        Excel.Workbook xlWorkBook;
        Excel.Worksheet xlWorkSheet;
        Excel.Range oRange = null;
        object misValue = System.Reflection.Missing.Value;

        xlApp = new Excel.Application();
        var xlWorkbooks = xlApp.Workbooks;
        xlWorkBook = xlWorkbooks.Open(sPath);
        var xlWorksheets = xlWorkBook.Worksheets;
        xlWorkSheet = xlWorksheets.get_Item(1);

        oRange = xlWorkSheet.Cells[1, 1];
        oRange.Value = "Test";

        oRange = xlWorkSheet.Cells[1, 1];
        oRange.Copy();
        oRange = xlWorkSheet.Cells[2, 1];
        oRange.PasteSpecial(Excel.XlPasteType.xlPasteFormats);

        if (oRange != null)
        {
            releaseObject(oRange);
        }

        releaseObject(xlWorkSheet);
        releaseObject(xlWorksheets);
        xlWorkBook.Save();
        xlWorkBook.Close(true, misValue, misValue);
        releaseObject(xlWorkBook);
        releaseObject(xlWorkbooks);
        xlApp.Quit();

        releaseObject(xlWorkSheet);
        releaseObject(xlWorksheets);
        releaseObject(xlWorkBook);
        releaseObject(xlWorkbooks);
        releaseObject(xlApp);

        GC.Collect();
        GC.WaitForPendingFinalizers();

        xlWorkSheet = null;
        xlWorksheets = null;
        xlWorkBook = null;
        xlWorkbooks = null;
        xlApp = null;
        return true;
    }

    private void releaseObject(object obj)
    {
        try
        {
            // Do not catch an exception from this.
            // You may want to remove these guards depending on
            // what you think the semantics should be.
            if (obj != null)
            {
                while(Marshal.FinalReleaseComObject(obj) > 0)
                { }
            }
            // Since passed "by ref" this assingment will be useful
            // (It was not useful in the original, and neither was the
            //  GC.Collect.)
            obj = null;
        }
        catch (Exception ex)
        {
            obj = null;
            MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
        }
        finally
        {
            //GC.Collect();
        }
    }

What am I doing wrong?


text:
Q: Unable to load html string in UIWebView using loadHTMLString:baseURL in iOS? I am trying to embed youtube video into my iOS application.For that I have created a UIWebView  & trying to load the Youtube video from following here
I have gone through the all the answers for the above problem. Even then its not working.
I have also tried loading very simple HTML
 NSString *embedHTML =[NSString stringWithFormat:@"Hello World"];
 [webView loadHTMLString:embedHTML baseURL:nil];

Even then, I am getting compile error Parse Issue Expecte ']'
I have tried cleaning, quitting the XCode & relaunching it again. I donno, I am not able to use that method. How to use the above loadHTMLString method for my UIWebView.
PS : Please do not tag this question as duplicate. I have tried all the solutions in Stackoverflow. Nothing has worked

A: WebView *webDesc = [[UIWebView alloc]initWithFrame:CGRectMake(12, 50, 276, 228)];

NSString *embedHTML = @"
1. You agree that you will be the technician servicing this work order?.
2. You are comfortable with the scope of work on this work order?.
3. You understand that if you go to site and fail to do quality repair for  any reason, you will not be paid?.
4. You must dress business casual when going on the work order.
";

webDesc.userInteractionEnabled = NO;
webDesc.opaque = NO;
webDesc.backgroundColor = [UIColor clearColor];
[webDesc loadHTMLString: embedHTML baseURL: nil];

A: - (NSString *)getHTMLContent
{
    NSString *cssPath = [[NSBundle mainBundle] pathForResource:@"baseline" ofType:@"css"];

    NSData *cssData = [NSData dataWithContentsOfFile:cssPath];
    NSString *cssStyle = [[NSString alloc] initWithData:cssData encoding:NSASCIIStringEncoding];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateStyle:NSDateFormatterMediumStyle];

    NSString *subtitle = [NSString stringWithFormat:@"%@ | %@", self.article.author, [dateFormatter stringFromDate:self.article.publishedDate]];

    NSString *htmlString = [NSString stringWithFormat:@"<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0;'>

%@

%@
%@
", cssStyle, self.article.title, subtitle, self.article.content];

    return htmlString;
}

A: It is very simple. You just have to add only one line. Try It:
NSString *htmlString = @"
1. You agree that you will be the technician servicing this work order?.
2. You are comfortable with the scope of work on this work order?.
3. You understand that if you go to site and fail to do quality repair for  any reason, you will not be paid?.
4. You must dress business casual when going on the work order.
";
[WebView loadHTMLString: htmlString baseURL: nil];

A: You probably need to provide more code if you want people to help you. I just used webView in a similar way and it's working fine.
self.webView = [[UIWebView alloc] initWithFrame:myFrame];
self.webView.scalesPageToFit = YES;
[self.webView setBackgroundColor:[UIColor whiteColor]];

//pass the string to the webview
[self.webView loadHTMLString:[[self.itineraryArray objectAtIndex:indexPath.row] valueForKey:@"body"] baseURL:nil];

//add it to the subview
[self.view addSubview:self.webView];

Can you provide more information and code?

A: it doesnt seems like an issue on webview.Please do add the code where it breaks.Error says you missed a ] somewhere in the code

A: try to load the url directly into the webview :
 UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(100, 100, 200, 250)];

[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://youtube.com/embed/-0Xa4bHcJu8"]]];


text:
Q: Writing a program with do-while loop and making it asks for user choice Yes/No Currently writing program that shows info about cities.
I already programmed first phase. User inputs city name and it prints out its data. Thing is,after this was executed,program should ask a user for any additional info is needed. If user inputs Yes it will loop same message and same system as above ( it will again ask user to input city name and display that city data). If user inserts NO program will stop executing.
I am not sure about approach to this.
So what is the best approach doing this? How to write it properly to loop IF statement.
    #include <iostream>
    #include <string>

    struct CityData {
      std::string name;
      double population;
      short id;
    };

    void printCityData(CityData city) {
      std::cout << "City Name : " << city.name << std::endl;
      std::cout << "Population : " << city.population << " Milion" << std::endl;
      std::cout << "City ID : " << city.id << std::endl;
    }

    int main() {
      std::string NOP = "CityData AI"; // NOP stands for NAME OF PROGRAM
      std::cout << NOP << std::endl;

      // Create space between Name of program and user input
      std::cout << '\n';

      // CITYDATA FULL INFO
      CityData Toronto = {"Toronto", 2.1, 1};
      CityData Montreal = {"Montreal", 1.7, 2};
      CityData Ottawa = {"Ottawa", 1, 3};

      std::cout << "Enter city name or see the city list : " << std::endl;
      std::string cnl; // CN stands for City Name
      getline(std::cin, cnl);

      // Create space between user input and city info print
      std::cout << '\n';

      // City name choice - start of
      if (cnl == "Toronto" || cnl == "toronto" || cnl == "to") {
        printCityData(Toronto);
      } else if (cnl == "Montreal" || cnl == "montreal" || cnl == "mo") {
        printCityData(Montreal);
      } else if (cnl == "Ottawa" || cnl == "ottawa" || cnl == "ot") {
        printCityData(Ottawa);
      } else if (cnl == "city list" || cnl == "City List" || cnl == "City list") {
        std::cout << "Currently on list : Toronto, Montreal, Ottawa" << '\n';
      } else {
        std::cout << "City is not on the list!" << std::endl;
      }
      // City name If statement outro

      // Create space between data print and end of program
      std::cout << '\n';

      // Declare choice outside of DO-WHILE statement
      std::string choice;
      do {
        std::cout << "Any additional info needed?" << '\n';
        getline(std::cin, choice);
        if (choice == "Yes")
          std::cout << "Enter city name :" << std::endl;

      } while (choice != "No");

      system("pause");
      return 0;
    }

Using Visual Studio 2017.

A: #include <iostream>
#include <string>

struct CityData {
  std::string name;
  double population;
  short id;
};

void printCityData(CityData city) {
  std::cout << "City Name : " << city.name << std::endl;
  std::cout << "Population : " << city.population << " Milion" << std::endl;
  std::cout << "City ID : " << city.id << std::endl;
}

int main() {
  std::string NOP = "CityData AI"; // NOP stands for NAME OF PROGRAM
  std::cout << NOP << std::endl;

  // Create space between Name of program and user input
  std::cout << '\n';

  // CITYDATA FULL INFO
  CityData Toronto = {"Toronto", 2.1, 1};
  CityData Montreal = {"Montreal", 1.7, 2};
  CityData Ottawa = {"Ottawa", 1, 3};
  // Declare choice outside of DO-WHILE statement
  std::string choice;
  do {
    std::cout << "Enter city name or see the city list : " << std::endl;
    std::string cnl; // CN stands for City Name
    getline(std::cin, cnl);

    // Create space between user input and city info print
    std::cout << '\n';

    // City name choice - start of
    if (cnl == "Toronto" || cnl == "toronto" || cnl == "to") {
      printCityData(Toronto);
    } else if (cnl == "Montreal" || cnl == "montreal" || cnl == "mo") {
      printCityData(Montreal);
    } else if (cnl == "Ottawa" || cnl == "ottawa" || cnl == "ot") {
      printCityData(Ottawa);
    } else if (cnl == "city list" || cnl == "City List" || cnl == "City list") {
      std::cout << "Currently on list : Toronto, Montreal, Ottawa" << '\n';
    } else {
      std::cout << "City is not on the list!" << std::endl;
    }
    // City name If statement outro

    // Create space between data print and end of program
    std::cout << '\n';

    std::cout << "Any additional info needed?" << '\n';
    getline(std::cin, choice);
  } while (choice ==
           "Yes"); // This acts as the second if statement in original code

  system("pause");
  return 0;
}


text:
Q: Getting a 408 RequestTimeout on Cosmos Emulator (MacOS) - .NET Core 6.0 I'm trying to do a proof-of-concept of connecting to and working with a local Cosmos Emulator from a .NET project. I have my Cosmos Emulator running on a Docker container, and I can browse the Cosmos Explorer by navigating to https://localhost:8081/_explorer/index.html. However, I am getting the following error below when connecting to the Cosmos instance from my .NET project:
Microsoft.Azure.Cosmos.CosmosException : Response status code does not indicate success: RequestTimeout (408); Substatus: 0; ActivityId: 08b1bf4d-99a3-43dd-94d8-598354f7e4f7; Reason: (GatewayStoreClient Request Timeout. Start Time UTC:7/16/2022 4:53:39 PM; Total Duration:65269.468 Ms; Request Timeout 65000 Ms; Http Client Timeout:65000 Ms; Activity id: 08b1bf4d-99a3-43dd-94d8-598354f7e4f7;);
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at Microsoft.Azure.Cosmos.CosmosHttpClientCore.ExecuteHttpHelperAsync(HttpRequestMessage requestMessage, ResourceType resourceType, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.CosmosHttpClientCore.SendHttpHelperAsync(Func`1 createRequestMessageAsync, ResourceType resourceType, HttpTimeoutPolicy timeoutPolicy, IClientSideRequestStatistics clientSideRequestStatistics, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.GatewayStoreClient.InvokeAsync(DocumentServiceRequest request, ResourceType resourceType, Uri physicalAddress, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.GatewayStoreModel.ProcessMessageAsync(DocumentServiceRequest request, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.Handlers.TransportHandler.ProcessMessageAsync(RequestMessage request, CancellationToken cancellationToken)
   at Microsoft.Azure.Cosmos.Handlers.TransportHandler.SendAsync(RequestMessage request, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Cosmos.ResponseMessage.EnsureSuccessStatusCode()
   at Microsoft.Azure.Cosmos.CosmosResponseFactoryCore.ProcessMessage[T](ResponseMessage responseMessage, Func`2 createResponse)
   at Microsoft.Azure.Cosmos.CosmosResponseFactoryCore.CreateDatabaseResponse(Database database, ResponseMessage responseMessage)
   at Microsoft.Azure.Cosmos.CosmosClient.<>c__DisplayClass54_0.<<CreateDatabaseIfNotExistsAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.Azure.Cosmos.ClientContextCore.RunWithDiagnosticsHelperAsync[TResult](ITrace trace, Func`2 task, Func`2 openTelemetry, String operationName)
   at Microsoft.Azure.Cosmos.ClientContextCore.OperationHelperWithRootTraceAsync[TResult](String operationName, RequestOptions requestOptions, Func`2 task, Func`2 openTelemetry, TraceComponent traceComponent, TraceLevel traceLevel)
   at Program.InitializeDatabaseAndContainer(String accountEndpoint, String primaryKey, String databaseName) in /Users/matt/source/azure-cosmos-docker/TestCosmosDocker/TestCosmosDocker/Program.cs:line 109
   at Program.Main() in /Users/matt/source/azure-cosmos-docker/TestCosmosDocker/TestCosmosDocker/Program.cs:line 33
   at Program.<Main>()
--- Cosmos Diagnostics ---{"Summary":{"GatewayCalls":{"(0, 0)":1}},"name":"CreateDatabaseIfNotExistsAsync","id":"545e7145-f0b7-4c7e-9993-c2ca9d3ece02","start time":"04:53:39:257","duration in milliseconds":65587.1384,"data":{"Client Configuration":{"Client Created Time Utc":"2022-07-16T16:53:39.1505710Z","MachineId":"hashedMachineName:4a41c3d5-a264-2df2-a0c9-fc104350c1bf","NumberOfClientsCreated":1,"NumberOfActiveClients":0,"ConnectionMode":"Gateway","User Agent":"cosmos-netstandard-sdk/3.29.0|1|X64|Darwin 21.1.0 Darwin Kernel Ve|.NET 6.0.7|N|F 00000010|","ConnectionConfig":{"gw":"(cps:50, urto:10, p:False, httpf: True)","rntbd":"(cto: 5, icto: -1, mrpc: 30, mcpe: 65535, erd: True, pr: ReuseUnicastPort)","other":"(ed:False, be:False)"},"ConsistencyConfig":"(consistency: NotSet, prgns:[], apprgn: )","ProcessorCount":8}},"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler","id":"c0beb150-c3b0-42fe-8561-c6cee1fb7493","start time":"04:53:39:310","duration in milliseconds":65473.9117,"children":[{"name":"Waiting for Initialization of client to complete","id":"b8bb7584-4fee-4151-b3ef-666908d4e791","start time":"04:53:39:338","duration in milliseconds":384.8078},{"name":"Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler","id":"6e8bcd35-24b4-4b05-bfbc-de4e99ee4e28","start time":"04:53:39:726","duration in milliseconds":65057.0317,"data":{"System Info":{"systemHistory":[{"dateUtc":"2022-07-16T16:53:49.4578290Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.2742,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0},{"dateUtc":"2022-07-16T16:53:59.4604740Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0554,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0},{"dateUtc":"2022-07-16T16:54:09.4608060Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0083,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0},{"dateUtc":"2022-07-16T16:54:19.4628340Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0293,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0},{"dateUtc":"2022-07-16T16:54:29.4673550Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0221,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0},{"dateUtc":"2022-07-16T16:54:39.7381800Z","cpu":"no info","memory":"no info","threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0109,"availableThreads":32766,"minThreads":8,"maxThreads":32767},"numberOfOpenTcpConnection":0}]}},"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RetryHandler","id":"fc81cba1-9f08-4521-a1d3-0e37d3f077a2","start time":"04:53:39:727","duration in milliseconds":65055.62,"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RouterHandler","id":"86614889-83f3-4c39-97bd-3e439e1fecc7","start time":"04:53:39:730","duration in milliseconds":65033.8201,"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.TransportHandler","id":"4764abb2-6f15-475e-92f5-3c3421a0fe0c","start time":"04:53:39:731","duration in milliseconds":65032.3511,"children":[{"name":"Microsoft.Azure.Cosmos.GatewayStoreModel Transport Request","id":"7012e432-2e2c-4636-8ab1-7e630af92c4b","start time":"04:53:39:743","duration in milliseconds":65013.3039,"data":{"Client Side Request Stats":{"Id":"AggregatedClientSideRequestStatistics","ContactedReplicas":[],"RegionsContacted":[],"FailedReplicas":[],"AddressResolutionStatistics":[],"StoreResponseStatistics":[],"HttpResponseStats":[{"StartTimeUTC":"2022-07-16T16:53:39.7506050Z","DurationInMs":65267.718,"RequestUri":"https://172.29.0.2:8081/dbs/test-database","ResourceType":"Database","HttpMethod":"GET","ActivityId":"08b1bf4d-99a3-43dd-94d8-598354f7e4f7","ExceptionType":"System.Threading.Tasks.TaskCanceledException","ExceptionMessage":"A task was canceled."}]}}}]}]}]}]}]}]}

This is the code that is throwing the error:
// For local testing purposes, ignore SSL validation
CosmosClientOptions cosmosClientOptions = new CosmosClientOptions()
        {
            HttpClientFactory = () =>
            {
                HttpMessageHandler httpMessageHandler = new HttpClientHandler()
                {
                    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
                };

                return new HttpClient(httpMessageHandler);
            },
            ConnectionMode = ConnectionMode.Gateway
        };

using var cosmosClient = new CosmosClient("https://localhost:8081/", "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==", cosmosClientOptions);

await cosmosClient.CreateDatabaseIfNotExistsAsync("test-database");

And this is my docker-compose.yml
version: '3.5'
services:
  cosmos-db:
    container_name: cosmosdb
    image: "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator"
    tty: true
    restart: always
    mem_limit: 3G
    cpu_count: 2
    environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10
      - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
    ports:
       - "8081:8081"
       - "10251:10251"
       - "10252:10252"
       - "10253:10253"
       - "10254:10254"
    volumes:
       - vol_cosmos:/data/db

volumes:
  vol_cosmos:

I've run this exact code on another computer running Linux without any issues. I'm wondering if there's something on the MacOS side that is blocking this request?
Additionally, I'm running on an Intel Mac.

A: I was running into the same problem. I came across this SO page: Cosmos SDK experiences timeouts if mapped ports in docker-compose file differ
I got it working with the following code
docker-compose.yml
version: '3.5'
services:
    cosmos:
        image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
        container_name: cosmos
        ports:
          - 8081:8081
          - 10251:10251
          - 10252:10252
          - 10253:10253
          - 10254:10254
        expose:
          - "8081"
          - "10251-10255"
        environment:
          - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=6
          - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=false
          - AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=127.0.0.1

Code that's working
var httpMessageHandler = new HttpClientHandler()
{
    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};

CosmosClientOptions cosmosClientOptions = new CosmosClientOptions()
{
    HttpClientFactory = () => new HttpClient(httpMessageHandler),
    ConnectionMode = ConnectionMode.Gateway,
    RequestTimeout = TimeSpan.FromMinutes(3)
};

CosmosClient client = new CosmosClient(
    "https://localhost:8081",
    "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==",
    cosmosClientOptions);

var dbResponse = await cosmosClient.CreateDatabaseIfNotExistsAsync("test-database");


text:
Q: Smooth sawtooth wave $y(x)=\cos(x-\cos(x-\cos(x-\dots)))$ Consider an infinite recursive function
$$y(x)=\cos(x-\cos(x-\cos(x-\dots)))$$
$$y=\cos(x-y)$$
Plotting the function $y(x)$ implicitly we get a smooth sawtooth-like wave:

Was this function studied before? For example, its derivative, Fourier series or other properties. It may be useful in electronics or other applications.

I can find the expression for its derivative in terms of $y$ and $x$, but I do not know how to plot it effectively (without tabulating it by recursive formula for $y$).
$$y'(x)=-\frac{\sin(x-y)}{1-\sin(x-y)}$$
We obtain the correct expression for the maxima and minima of the function. (Note that the first positive maximum is at $x=1$ and the first minimum is at $x=\pi-1$, which is confirmed by numerical computation).
Since the function is smooth, the derivative should be finite everywhere. Does this mean that the denominator in this expression can never be equal to $0$?
By the way, the recursive formula itself is not a fluke - I checked its convergence numerically in Mathematica and it seems to converge for all values. However, for the values close to the 'vertical lines' the convergence is slower than for the rest.
Edit
The function is not smooth, because its derivative is not defined at $x=\frac{\pi}{2}+2\pi n$ and $y=0$ as cardboard_box pointed out and as can be seen from the expression. Oh, it's just vertical tangents apparently
Update
I wanted to illustrate the very helpful answers and comments I've been given so far.
First, credit goes to Lucian for introducing me to Clausen function (see the first comment below). However, this function does not have vertical tangents anywhere, as you can see in the graph (I plotted Clausen using its Fourier series, since it's easier than the integral definition):

So, the function I defined here is much more "sawtooth-like".
And finally, davik gave the parametric form for the function and figured out its Fourier series, which I plot below:

You may notice I displaced and reversed the original function when plotting these graphs. We can also use sine instead of cosine if needed.
Now the final question that I wanted to ask:

Has anyone seen this function anywhere? Maybe it's worth it to make a complete description of its properties and publish somewhere?

A: Note that this function's graph can be parametrized as $ x(t) = t + \cos(t)$ and $ y(t) = \cos (t)$
So, we can pretty much use this to find most interesting things you may want to know. First, it is a shear of the graph of $ y = \cos(x)$ by the matrix
$$
\pmatrix{1 & 1 \\
  1 & 0}
$$
Which tell you the zeros and maxima. Also, if you want vertical tangents, since $y'(t) = - \sin(t);~~ x'(t) =  1 - \sin (t)$ you have vertical tangents at $\frac{\pi}{2} + 2\pi k$.
If we shift this to the right by $\frac{\pi}{2}$, then by quite straightforward computation, together with the definition of the Bessel function, we get that the nth fourier sine series coefficent
$$b_n = \frac{2(-1)^nJ_n(n)}{n}$$ where $J_n(x)$ is the Bessel function of the first kind.


text:
Q: Drag to Delete from a list in android I want something like the list of items in Gmail on mobile.
There, when we drag an item horizontally the item disappears and some other things happen.
I want to know how to do something like this in my list of objects.

A: This is the full code to delete row item with the help of swipe.....
public void delete_operation() {
        list.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return gesture_detector.onTouchEvent(event);
            }
        });
    }

 GestureDetector gesture_detector = new GestureDetector(
                new OnGestureListener() {
                    private static final int SWIPE_THRESHOLD = 100;
                    private static final int SWIPE_VELOCITY_THRESHOLD = 100;

                    @Override
                    public boolean onSingleTapUp(MotionEvent e) {
                        // TODO Auto-generated method stub
                        return false;
                    }

                    @Override
                    public void onShowPress(MotionEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public boolean onScroll(MotionEvent e1, MotionEvent e2,
                            float distanceX, float distanceY) {
                        // TODO Auto-generated method stub
                        return false;
                    }

                    @Override
                    public void onLongPress(MotionEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public boolean onFling(MotionEvent e1, MotionEvent e2,
                            float velocityX, float velocityY) {
                        boolean result = false;
                        try {
                            float diffY = e2.getY() - e1.getY();
                            float diffX = e2.getX() - e1.getX();
                            if (Math.abs(diffX) > Math.abs(diffY)) {
                                if (Math.abs(diffX) > SWIPE_THRESHOLD
                                        && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
                                    if (diffX > 0) {

                                        onSwipeRight();
                                    } else {
                                        row_id_ins = lst_pollution.pointToPosition(
                                                (int) e1.getX(), (int) e1.getY());
                                        Log.e("", "id.......row" + row_id_ins);
                                        id_ins = row_id_ins + 1;
                                        row_id_str = String.valueOf(id_ins);
                                        Log.d("", "ROW ID" + row_id_str);
                                        onSwipeLeft();
                                    }
                                }
                            } else {

                            }
                        } catch (Exception exception) {
                            exception.printStackTrace();
                        }
                        return result;

                    }

                    @Override
                    public boolean onDown(MotionEvent e) {
                        // TODO Auto-generated method stub
                        return false;
                    }
                });

        final class gesture_detector extends SimpleOnGestureListener {

            @SuppressWarnings("unused")
            private static final int SWIPE_THRESHOLD = 100;
            @SuppressWarnings("unused")
            private static final int SWIPE_VELOCITY_THRESHOLD = 100;

        }

        public void onSwipeRight() {
            Log.e("", "onSwipeRight");
        }

        public void onSwipeLeft() {
            Log.e("", "onSwipeRight");

        }

    }


text:
Q: cannot use realtek ethernet controller in 16.10 i have a ethernet controller as listed below. but I cannot turn it on or configure it. any ideas on what to do.
00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GFX port 0)
00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 0)
00:05.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 1)
00:07.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 3)
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 42)
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge (rev 40)
00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:15.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0)
00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
01:00.0 VGA compatible controller: NVIDIA Corporation GK208 [GeForce GT 710] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GK208 HDMI/DP Audio Controller (rev a1)
***02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11)***
03:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
04:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller
06:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821AE 802.11ac PCIe Wireless Network Adapter

A: Your ethernet device is probably using the r8169 driver, which is buggy. You need to install the r8168-dkms driver (and dkms).
Start Synaptic. Click the RELOAD icon. Click the SEARCH icon and enter r8168-dkms. Enable for installation that item in the results pane. Click the APPLY icon. Reboot.
Let us know how you make out.
Cheers, Al

A: I don't know why but changing the way I installed the files made a difference and using lightdm as the display kept me from loosing my ethernet connection. So as long as I kept lightdm as the window manager I did not loose my ethernet connecton as for heynnema sorry I wasted your time.


text:
Q: Resposta do PHP Excel em JSON Estou tentando obter uma resposta para saber se o arquivo do PHPExcel já baixou, para então prosseguir com meu algoritmo.
Eu tentei colocar no meu arquivo phpexcel a seguinte linha antes do exit;
echo json_encode(array("teste" => 1));

Porém não funciona. Ele retorna como não definido
$.ajax({
  type : 'post',
  url  : 'services/'+url,
  data : {
     data : competencia
 },
 success: function (data) {
   if(data.teste === 1)
    alert('baixou');
   else
     alert('nao baixou: '+data.teste);
   }
});

A: Faça um parse dos dados retornados, assim você terá um objeto.
$.ajax({
  type : 'post',
  url  : 'services/'+url,
  data : {
     data : competencia
 },
 success: function (data) {
   //Parse do JSON retornado
   var obj = JSON.parse(data);

   if(obj.teste === 1)
    alert('baixou');
   else
     alert('nao baixou: '+data.teste);
   }
});


text:
Q: How to refresh jsp page? I'm new to Google App Engine and I'm having a little problem that I can't seem to be able to find the solution to.
Whenever I create/delete/update something from the Datastore, in the end I do this:
resp.sendRedirect("/view_list.jsp");

And the page doesn't get updated.
For instance, if I have a page with a list of 2 items, then I create another item and I redirect to that page with the list, and instead of showing 3 items, it shows 2 items, until I change page and come back.
So how can I make sure that the page refreshes after my changes to the Datastore?

A: A couple of points that are relevant:

*

*The Data store is HRD (High Replication Database) and as per the documentation, the delay from the time a write is committed until it becomes visible in all datacenters means that queries across multiple entity groups (non-ancestor queries) can only guarantee eventually consistent results. Consequently, the results of such queries may sometimes fail to reflect recent changes to the underlying data. Please refer to the documentation for more details.

*In short, to get consistent reads, use get as much as you can. If you use a query, there could be a delay due to the indexing.
Hope this helps. I also suggest to frame the question title better. The question is a good one but could get lost when it says "refresh the jsp page".


text:
Q: Iterating through a list of users and pushing to an array in knockout I have this script that returns a list of all users. I would like to have:

*

*set the viewModel's totalUsers and page properties based on data returned.

*Iterate through the list of users and push the last user object into the observableArry

*push() method adds users to already loaded and shown users

Purpose
I actually want to get a count of all users because i will be loading 20 users a page and when i reach the bottom of the page i will check if i still have more users to load and then load them. That way if i have 400 users - they won't be all loaded at once and take up time.
Knockout JS File
$.views.Roster.RosterViewModel = function (data) {
    var self = this;
    self.RosterUsers = ko.observableArray([]);
    _rosterUsers = self.RosterUsers;
    self.currentPage = ko.observable(1);
    self.toDisplay = ko.observable(20);
    self.filteredRoster = ko.computed(function(){
        var init = (self.currentPage()-1)* self.toDisplay(),
            filteredList = [],
            rosterLength = self.RosterUsers().length,
            displayLimit = self.toDisplay();
        if(rosterLength == 0)
            return[];
        for(var i = init; i<(displayLimit + init) - 1 && i<rosterLength; i++)
        {
            filteredList.push(self.RosterUsers()[i]);
        }
        return filteredList;
    }),
    totalRoster = ko.computed(function () {
        return self.RosterUsers().length;
    }),
    changePage = function (data) {
        currentPage(data);
    },
    next = function () {
        if ((self.currentPage() * self.toDisplay()) > self.RosterUsers().length)
            return;

        self.currentPage(self.currentPage() + 1);
    },
    prev = function () {
        if (self.currentPage() === 1)
            return;

        self.currentPage(self.currentPage() - 1);
    },

    $.views.Roster.RosterViewModel.AddUsers(data);
};

HTML View Page

Prev

Next

Update: Scroll Script
$(window).scroll(function () {
        if ($(window).scrollTop() == $(document).height() - $(window).height()) {
            if (parseInt($.views.Roster.RosterViewModel.currentPage(), "10") * 20 < parseInt($.views.Roster.RosterViewModel.totalRoster(), "10")) {
                $.views.Roster.RosterViewModel.next();
            }
        }
    });

How can i make these additions with what i already have? Thanks ahead for any help.

A: HEre you go. I have mimicked the getRoster ajax call for the fiddle. in your case, you will be making a "GET" call and not a "POST".
http://jsfiddle.net/sujesharukil/z8vpx/4/
rosterArray is the main observableArray that will store the entire list from the server, filteredRoster will get the data from the rosterArray based on the currentPage, toDisplay stores the limit, currentPage tracks the current page, totalRoster is computed that returns the total elements in the array
var rosterArray = ko.observableArray(),
    currentPage = ko.observable(1),
    toDisplay = ko.observable(20),
    filteredRoster = ko.computed(function(){
        var init = (currentPage() - 1) * toDisplay(),
            filteredList = [],
            rosterLength = rosterArray().length,
            displayLimit = toDisplay();

        if(rosterLength === 0)
            return [];

        for(var i = init; i < (displayLimit + init) - 1 && i < rosterLength; i++){
            filteredList.push(rosterArray()[i]);
        }

        return filteredList;
    }),
    totalRoster = ko.computed(function(){
        return rosterArray().length;
    }),
    changePage = function(data){
        currentPage(data);
    },
    next = function(){
        if((currentPage() * toDisplay()) > rosterArray().length)
            return;

        currentPage(currentPage() + 1);
    },
    prev = function(){
        if(currentPage() === 1)
            return;

        currentPage(currentPage() - 1);
    };

Hope that helps.
-Suj


text:
Q: XML declaration in Office 2013 I have the follow VBA code to work with XML using Office 2010:
Public xmlDOM As DOMDocument

Public Sub setXML(xmlFileName As String)

    Set xmlDOM = CreateObject("MSXML.DOMDocument")
    xmlDOM.async = False
    xmlDOM.Load xmlFileName

End Sub

OBS: There is a reference set to Microsoft XML, v6.0
BUT if I open the same code on Office 2013 I got an error that the
Public xmlDOM As DOMDocument

is not declared but there is still the reference to Microsoft XML, v6.0 set.
if I change
Public xmlDOM As DOMDocument

to
Public xmlDOM As MSXML.DOMDocument60

the compiler accepts but running the code I will get an error in
Set xmlDOM = CreateObject("MSXML.DOMDocument")

even if I change it to
Set xmlDOM = CreateObject("MSXML2.DOMDocument60")

OBS: There is a reference set to Microsoft XML, v6.0 in Office 2013
What is going on?

A: Replace
Public xmlDOM As DOMDocument

with
Public xmlDOM As MSXML2.DOMDocument60

and
Set xmlDOM = CreateObject("MSXML.DOMDocument")

with
Set xmlDOM = New MSXML2.DOMDocument60


text:
Q: help regarding INSERT IGNORE mysql The query is:
$sql="CREATE TABLE IF NOT EXISTS prod_day(

id int(11) NOT NULL AUTO_INCREMENT,
heading TEXT,
image TEXT,
text LONGTEXT,
PRIMARY KEY (id)
)TYPE=InnoDB";

I don't want to allow any entry that is duplicate with respect to heading , image and text column altogether. At the same time I want the id column to be auto-incrementing, plz tell me how to do that. I googled the net but couldn't get any solution comprehendible to me.
thanks

A:
I  don't want to allow any entry that is duplicate with respect to heading , image and text column

What you want is a UNIQUE key on all these columns - however MySQL will only index the first 767 bytes of for each TEXT and LONGTEXT column. (That's bytes not characters - each character will use more than one byte in the keyspace). This means that with a UNIQUE KEY on heading two very long but distinct strings will result in a duplicate key error:
-- Even though the complete strings are different, MySQL isn't indexing the whole string.
-- These two statements will result in a duplicate key error.
INSERT INTO prod_day (heading) VALUES ('a very long string the same in the first 767 bytes ..... asdfjkl');
INSERT INTO prod_day (heading) VALUES ('a very long string the same in the first 767 bytes ..... 1234567');

You have a few options:
Refactor your database schema to use smaller column types:
CREATE TABLE prod_day(
 id int(11) PRIMARY KEY AUTO_INCREMENT,
 heading VARCHAR(256),
 image VARCHAR(256),
 text VARCHAR(256),
 UNIQUE (heading, image, text)
) ENGINE=InnoDB

If that's not an option then:
Use MD5 hashes of column data for UNIQUE keys
CREATE TABLE prod_day(
 id int(11) PRIMARY KEY AUTO_INCREMENT,
 heading TEXT,
 image TEXT,
 text LONGTEXT,
 heading_md5 VARCHAR(50),
 image_md5 VARCHAR(50),
 text_md5 VARCHAR(50),
 UNIQUE (heading_md5, image_md5, text_md5)
) ENGINE=InnoDB

Then, either have your PHP script calculate the md5 hash of the text fields or have MySQL do it as in the following:
INSERT IGNORE INTO prod_day
 (heading, image, `text`, heading_md5, image_md5, text_md5)
VALUES (
 'HEADING Lorem ipsum dolor sit amet, ... truncated ...',
 'IMAGE Lorem ipsum dolor sit amet, ... truncated ...',
 'TEXT Lorem ipsum dolor sit amet, ... truncated ...',
 MD5('HEADING Lorem ipsum dolor sit amet, ... truncated ...'),
 MD5('IMAGE Lorem ipsum dolor sit amet, ... truncated ...'),
 MD5('TEXT Lorem ipsum dolor sit amet, ... truncated ...')
);
Query OK, 1 row affected (0.03 sec)

INSERT IGNORE INTO prod_day
 (heading, image, `text`, heading_md5, image_md5, text_md5)
VALUES (
 'HEADING Lorem ipsum dolor sit amet, ... truncated ...',
 'IMAGE Lorem ipsum dolor sit amet, ... truncated ...',
 'TEXT Lorem ipsum dolor sit amet, ... truncated ...',
 MD5('HEADING Lorem ipsum dolor sit amet, ... truncated ...'),
 MD5('IMAGE Lorem ipsum dolor sit amet, ... truncated ...'),
 MD5('TEXT Lorem ipsum dolor sit amet, ... truncated ...')
);
Query OK, 0 rows affected (0.02 sec)  -- 0 rows, duplicate avoided!

A: You could set a UNIQUE constraint on the required columns
something like:
ALTER TABLE prod_day ( UNIQUE 'UKey_name' (`heading`,`image`,`text`));

EDIT: maybe some issues with your column types as Scrum Meister has pointed out. You will need to rectify this, or do it manually before inserting.


text:
Q: using rails backend, best practice to develop ember frontend in rails or out? I'm just about to start my first "real" ember.js project but I'm seriously lacking in best practices experience.  One thing in particular I'm wondering about is, if I'm using a rails backend, is it better to develop within the rails distro using ember-cli-rails or just developing the front and back ends completely separately?
I first I thought it was a no-brainer, just stuck ember in rails and go.  But I'm finding it a clunky experience compared to developing each separately.  The automatic reloading isn't smooth (which I really enjoy when it works), server tail is a little chaotic having two players logging there, and I've only been at it a few minutes, I'm afraid of what I might find later, especially when testing.
I'm also wondering, that besides the clunkyness, the separation of concerns of back end and front end might have more benefits than sticking the two together.

A: It's a matter of preference how to incorporate Ember into your Rails driven app. If you're just now starting the app, I would definitely recommend jumping on with Ember CLI; as 2.0 approaches, the Ember community is coming together in support of CLI as the future. I can't think of a good reason to develop in isolation. I believe it's better to fight through any configuration issues you have up-front so that you have a great platform for easier development and maintainability later.
There's a fantastic gem (it seems like you've heard of it) that helps integrate Rails and Ember CLI: ember-cli-rails. If I were starting a new Rails app that had an Ember front end, I'd start with that.
Hope this helps!


text:
Q: Why does a AmqpChannelFactoryBean with Jackson2JsonMessageConverter not store type? I'm trying to use Spring integration with RabbitMQ, using RabbitMQ backed Spring integration channels. (Which seems almost not documented for some reason, is this new?).
To do this, it seems I can use AmqpChannelFactoryBean to create a channel.
To set up message conversion, I use a Jackson2JsonMessageConverter.
When I use a GenericMessage with a POJO payload, it refuses to de-serialize it from Java, basically because it doesn't know the type. I would have expected the type to be automagically be put on the header, but on the header there is only __TypeId__=org.springframework.messaging.support.GenericMessage.
In Spring boot my configuration class looks like this:
@Configuration
public class IntegrationConfiguration {

    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }

    @Bean
    public AmqpChannelFactoryBean myActivateOutChannel(CachingConnectionFactory connectionFactory,
        MessageConverter messageConverter) {

        AmqpChannelFactoryBean factoryBean = new AmqpChannelFactoryBean(true);
        factoryBean.setConnectionFactory(connectionFactory);
        factoryBean.setQueueName("myActivateOut");
        factoryBean.setPubSub(false);
        factoryBean.setAcknowledgeMode(AcknowledgeMode.AUTO);
        factoryBean.setDefaultDeliveryMode(MessageDeliveryMode.PERSISTENT);
        factoryBean.setMessageConverter(messageConverter);
        return factoryBean;
    }

    @Bean
    @ServiceActivator(inputChannel = "bsnkActivateOutChannel", autoStartup="true")
    public MessageHandler mqttOutbound() {

        return m -> System.out.println(m);
    }

}

Sending is done like this:
private final MessageChannel myActivateOutChannel;

@Autowired
public MySender(MessageChannel myActivateOutChannel) {
    this.myActivateOutChannel = myActivateOutChannel;
}

@Override
public void run(ApplicationArguments args) throws Exception {
    MyPojo pojo = new MyPojo();
    Message<MyPojo> msg = new GenericMessage<>(pojo);

    myActivateOutChannel.send(msg);
}

If I set my own classmapper, things do work as they should. But I would have to use many MessageConverters if I set up things like that.
E.g.
    converter.setClassMapper(new ClassMapper() {

        @Override
        public void fromClass(Class< ? > clazz, MessageProperties properties) {
        }

        @Override
        public Class< ? > toClass(MessageProperties properties) {
            return MyPojo.class;
        }

    });

Am I using this wrong? Am I missing some configuration? Any other suggestions?
Thanks!! :)
Note: Looking more at things, I'm guessing the 'Spring integration' way would be to add a Spring integration JSON transformer on each side, which means also adding two additional direct channels per RabbitMQ queue?
This feels wrong to me, since I've got triple the channels then (6! for in/out), but mayby that's how the framework is supposed to be used? Couple all the simple steps with direct channels? (Do I keep the persistence which the RabbitMQ channels offer in that case? Or do I need some transaction mechanism if I want that? Or is it inherent in how direct channels work?)
I've also noticed now there's both a Spring-integration MessageConverter, and a Spring-amqp MessageConverter. The latter being the one I've used. Would the other work the way I want it to? A quick glance at the code suggests it doesn't store the object type in the message header?

A: Prior to version 4.3, amqp-backed channels only supported serializable payloads; the work around was to use channel adapters instead (which support mapping).
INT-3975 introduced a new property extractPayload which causes the message headers to be mapped to rabbitmq headers and the message body is just the payload instead of a serialized GenericMessage.
Setting extractPayload to true should solve your problem.


text:
Q: What are these custom declarations in this C program? I have a very simple question, what are these declarations in the beginning of this C program called? Normally in a C program you list the <variable-type> <variable-name>, and optionally the <variable-value>. But in the first few lines of this program it seems it goes; <random-word> <variable-name>;
what is this syntax called? So I can learn more about it..
#include<X11/Xlib.h>

#include<stdio.h>
#include<stdlib.h>

int main()
{
    Display *dpy;
    Window rootwin;
    Window win;
    Colormap cmap;
    XEvent e;
    int scr;
    GC gc;

A: They're simply types defined in the X11/Xlib.h header file, the main head file for Xlib. It's the one you include when you want everything.
For example, under Debian, the Xlib.h file contains:
typedef struct _XDisplay Display;

after defining a (rather large) struct _XDisplay.


text:
Q: load data from multiple files Can I ask for these two pieces of advice?

*

*How to read all files named Pene_n.txt where n is a digit?
I was attacked by these orders, but the fourth one, for some reason unknown to me, does not work :(

*Is there a simple command how I could write new data for old data in that matrix (without header)?

My code:
numberOfFiles = size (listfiles("pene.txt"))
for i=1:1:numberOfFiles(1,1)
    //this 4 line is trouble :((
    Data = csvRead(("Pene_%d.txt",i),";",",","string")
end

Please does anyone how to do it?
By the way there I put whole file :) http://leteckaposta.cz/859703762

A: You are likely

*

*missing the correct path with wildcard and correctly get length of string vector

numberOfFiles = size(listfiles("Pene_*.txt"),1)

*missing msprintf before its arguments in the loop:

Data = csvRead(msprintf("Pene_%d.txt",i),";",",","string")

For your second question use csvWrite (see its help page with help csvWrite).