text:
Q: Convert GIcon into GdkPixbuf I'm using the GAppInfo/GDesktopAppInfo.
GIcon *icon = gtk_app_info_get_icon (G_APP_INFO(appinfo));
Now I need to put it on a GtkIconView but I found that there is no way to create a GdkPixbuf from GIcon. Anyone knows this? Thanks very much!
EDIT 1: Actually it's GThemedIcon.

A: From the docs:

GIcon does not provide the actual pixmap for the icon as this is out of GIO's scope, however implementations of GIcon may contain the name of an icon (see GThemedIcon), or the path to an icon (see GLoadableIcon).

However, knowing icon name may facilitate in obtaining actual pixmap. For example, file-roller project uses the following function to obtain pixbuf from GtkIconTheme and GThemedIcon:
GdkPixbuf *
get_icon_pixbuf (GtkIconTheme *icon_theme,
         GThemedIcon  *icon,
         int           size)
{
    char        **icon_names;
    GtkIconInfo  *icon_info;
    GdkPixbuf    *pixbuf;
    GError       *error = NULL;

    g_object_get (icon, "names", &icon_names, NULL);

    icon_info = gtk_icon_theme_choose_icon (icon_theme, (const char **)icon_names, size, 0);
    pixbuf = gtk_icon_info_load_icon (icon_info, &error);
    if (pixbuf == NULL) {
        g_warning ("could not load icon pixbuf: %s\n", error->message);
        g_clear_error (&error);
    }

    gtk_icon_info_free (icon_info);
    g_strfreev (icon_names);

    return pixbuf;
}

A: Please see the following code for how to get icons file from GIcon:
GtkIconInfo *pGtkIconInfo;
Gicon *pgIcon=gtk_app_info_get_icon (G_APP_INFO(appinfo));

GtkIconTheme *pGtkIconTheme= gtk_icon_theme_get_default();
pGtkIconInfo=gtk_icon_theme_lookup_by_gicon(pGtkIconTheme,pgIcon,256,GTK_ICON_LOOKUP_USE_BUILTIN);

//get icon filename if icone 256*256 exist.

printf("%s\n",gtk_icon_info_get_filename(pGtkIconInfo));


text:
Q: ASP.NET MVC 4 Submit from 2 partials on same view invokes both action methods for each submit I am brand new to .NET MVC Programming - and have been stuck here with no where to go:
2 Models representing 2 tables in a db
 public class t1
{
    public string c1 { get; set; }
    public string c2 { get; set; } ...

2 partial views one for each model
@model WebApplication2.Models.Database.t1
@using (Ajax.BeginForm( new AjaxOptions { UpdateTargetId = "t1div" }))
{
<fieldset>
     @Html.EditorFor(model => model.c1)
     <input type="submit" value="t1view" class="btn btn-default" />
 ....

@model WebApplication2.Models.Database.t2
@using (Ajax.BeginForm( new AjaxOptions { UpdateTargetId = "t2div" }))
{
<fieldset>
     @Html.EditorFor(model => model.c4)
     <input type="submit" value="t2view" class="btn btn-default" />
 ....

1 "composite" controller with actions to process submits from both partial views
public ActionResult t1view()
    {
        t1 model = new t1();....
    }
 [HttpPost]
 public ActionResult t1view([Bind(Include = "c1,c2,c3")] t1 t1)
    {
        if (ModelState.IsValid)....
    }
public ActionResult t2view()
    {
        t2 model = new t2();....
    }
 [HttpPost]
 public ActionResult t2view([Bind(Include = "c4,c5,c6")] t2 t2)
    {
        if (ModelState.IsValid)....
    }

and the index view

   @Html.Action("t1view")

   @Html.Action("t2view")

So the "composite" view with the 2 partial views displays data from the tables okay. When I make some changes and hit either of the buttons, even though I have specifically called the correct action method, both the action methods under [HttpPost] get called all the time, and one of the fails as that particular partialview just sent null for the "other" table. Any ideas what am I doing wrong here? Its just been a week of me learning this - what am I doing wrong here?

A: explicitly you have to give action property in ajax.beginForm for which action you are going to make request
@model WebApplication2.Models.Database.t1
@using (Ajax.BeginForm("t1view","controllerName", new AjaxOptions { UpdateTargetId =       "t1div" }))
{
<fieldset>
 @Html.EditorFor(model => model.c1)
 <input type="submit" value="t1view" class="btn btn-default" />
 ....

@model WebApplication2.Models.Database.t2
@using (Ajax.BeginForm("t2view","controllerName", new AjaxOptions { UpdateTargetId = "t2div" }))
{
<fieldset>
 @Html.EditorFor(model => model.c4)
 <input type="submit" value="t2view" class="btn btn-default" />
....

redpajama_set_name: RedPajamaStackExchange


text:
Q: Mapreduce in MPI I want to use word count on this dataset :
http://snap.stanford.edu/data/web-Movies.html
I can't find a program on the internet which will help me to do so.
Please suggest something ?

A: This is something that is pretty amenable to MapReduce.  If you're a python guy, you might like mrjob, which actually uses a word count example in a lot of their documentation:
http://pythonhosted.org/mrjob/guides/writing-mrjobs.html

A: Have a look at easyLambda. It is a C++ and MPI library based on data-flow and map-reduce. It has a word-count example as well.


text:
Q: Get list of users with name, phone number and group memberships from G Suite I have looked into the G Suite admin APIs and found this function:
GET https://www.googleapis.com/admin/directory/v1/users
I get a list of all users, but no users in the list have a phone number. How can I include the user's phone number in the list?
I would also like to know how to get a list of every user's group memberships if this is possible.

A: The phone number property is under user Resource which you might have missed since it's also located in the Users.list under Response.
  {
  "kind": "admin#directory#users",
  "etag": etag,
  "users": [
    users Resource
  ],
  "nextPageToken": string
}

which when you click leads to the full User Resources which then contains the phones property including others.
"phones": [
    {
      "value": string,
      "primary": boolean,
      "type": string,
      "customType": string
    }
  ],
  "phones": string


text:
Q: How can I turn user monitor off and prevent turning on when user activity detected? I want to build a software that when a user press Ctrl+Alt+P the monitor turn off, he can type his password and when the monitor is off, after he finish typing he press Ctrl+Alt+O and got the screen back.
I manage to do it all but the only problem I have is when the user start typing his password the computer detect user activity and turn the screen on automatically.
I use this method to turn screen off
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);

public static void Main(string[] args)
{
    Form f = new Form();
    bool turnOff;   //set true if you want to turn off, true if on
    SendMessage(f.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, turnOff ? 2 : -1);
}

Anyone has an idea how can I prevent the monitor from turning on during user activity?
I don't mind which script language to use, I prefer C#.
Thanks ahead.


text:
Q: How do I go about writing a parser? I have this giant Maude string. This is a small piece of it:
NamedElements
(
    (
        NamedElement
        (
            SpecTable
            (
                 SpecColumns
                (

                    (
                        SpecColumn
                        (
                            Name
                            (
                                "Id"
                            )
                            ,
                             TypeVarChar
                            (
                                18
                            )

                        )
                        ,
                        SpecColumn
                        (
                            name
                            (
                                "IsDeleted"
                            )
                            ,
                                 DataTypeBit
                        )

...
...
There is only one thing called NamedElements. This has a lot of NamedElement objects in it. The format is simple to understand. I need to write a parser for this so that I can do something like get all SpecColumn objects who have a Name that is equal to something. I'm not sure the best way to do this though.
Some things i've thought about:
Loop through each character until I find a '('. I make a new object. I add this object as a property on the object above it. I continue going until I find the matching ')'. This then finalizes what's in that object.
Basically, I've never done anything like this before, and was wondering if there is some established way of doing this, or will I need to do something like what I described above?

A: To write a parser you need to define your grammar and syntax: the words you can use and how those words can be put together to make statements. This looks mostly like a markup for objects, similar to XML or JSON. But still, you need to define your language before you can write a parser.
In writing a parser, you should look at lexical analysis. That's a good place to start. Once you know what is and is not in your language, you can then "parse" it, and convert it to whichever other thing you want, be it into another language, format, whatever.
Parsers consist of scanners, tokenizers, and a lexer. I know all of this is a bit vague, but your question is fairly open, as well.

A: I'd suggest you formalise the grammar a bit.
Name        ::= ( "STRING" )

TypeVarChar ::= ( NUMBER )

DataTypeBit ::= DATATYPEBIT

SpecColumn  ::= ( Name {, TypeVarChar | DataTypeBit} )

SpecColumns ::= ( SpecColumn {, SpecColumn}* )

SpecTable   ::= ( SpecColumns )

etc


text:
Q: Google Data Java Client Library for Android I want to make a youtube client app for android. I was trying to follow this So I need to import these:
import com.google.api.client.googleapis.GoogleHeaders;
import com.google.api.client.googleapis.GoogleTransport;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpResponseException;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.InputStreamContent;
import com.google.api.client.sample.picasa.model.AlbumEntry;
import com.google.api.client.sample.picasa.model.PicasaUrl;
import com.google.api.client.sample.picasa.model.UserFeed;
import com.google.api.client.sample.picasa.model.Util;
import com.google.api.client.util.DateTime;
import com.google.api.client.xml.atom.AtomParser;
I am using Eclipse IDE and installed the google-api-java-client-1.3.1-alpha.zip as Reference Libraries.
But it is still showing error on the Bold import statements. How to resolve that?
Thanks for your help.

A: I doubt that you need those classes if you are creating a YouTube client. If you look at the package name, they are for Picasa, which is not YouTube.

A: Hello: I think you must be looking for the following. Check the following links and you might find related classes.
http://code.google.com/p/google-api-java-client/source/browse/picasa-atom-android-sample/?repo=samples
http://code.google.com/p/google-api-java-client/source/browse/picasa-atom-android-sample/?repo=samples#picasa-atom-android-sample/src/com/google/api/client/sample/picasa/model


text:
Q: Dissecting Bad Grammar I have a fairly good sense of what is and isn't correct in terms of grammar, but that's mostly through feeling, rather than hard knowledge of the rules. My formal knowledge of the English Language only goes as far as GCSE and that is already a long time ago.
Normally, I'm the person who sorts out typos and grammatical blunders in company documents, but "an innate ability" to know whether something is right seems to get on people's nerves.
So I'm hoping to learn some of the technicalities with regards to bad grammar, using this paragraph from a job description that I was checking.

You'll continuously improve the product and your skills via active involvement with the community. Small projects can act as a sandbox where appropriate to allow you to evaluate these techniques, from a new framework to a pre-processor language.

It's clear what it means, but it somehow feels wrong. If I was going to rewrite this, it would look something like:

You will continuously improve both the product and your skills through active involvement within the community. Where appropriate, small projects can act as sandboxes for learning and evaluating new frameworks or pre-processor languages.

What exactly, is wrong with the original quote and what is a reasonable way to explain that to someone without coming across as pretentious?

A: The second sentence is structured in such a way as to encourage an initial parsing attempt that is actually invalid.  (In other words, it is a "Garden Path Sentence".)
The phrasing of "Small projects can act as a sandbox where ..." invites a natural reading that the phrase headed by where is about to tell you what you can do in the sandbox.  As you progress, however, "where appropriate to allow you" clearly cannot describe a property of the sandbox; this forces you to stop, backtrack, and actively work to parse the sentence correctly despite its misleading formation.
This structure pretty much guarantees a break in the flow of the reader, a loss of concentration, and a transfer of focus from what is being said to how it is being said, all of which are negatives for a passage that is trying to communicate effectively.


text:
Q: stop reading file when marker is reached I have the following code, just the basics of what i'm trying to do:
let ic = open_in "file.txt" in
try
  while true do
    let line = input_line ic in
    print_endline line
  done
with End_of_file -> close_in ic

what i want to do is read the file in to a string appending each line until i reach the word "stop_here" I tried a few ways of my own and got totally messed up.. this is on windows os.
thanks for help

A: Inside the while loop, add a test if line = "stop_here" then raise End_of_file?
Refine it if you want to stop on a line that just contains this marker.


text:
Q: Android ListView and Database ID I have got some Objects shown in a ListView. For that reason I've got a class just for the Objects with 2 attributes: "name" and "price" (Yes, no ID, because I set the datatype in my SQLite Database to integer, primary key, autoincrement.)
In my Activity class, I've got an ArrayList filled with all of the Objects, which are in the Database (which works fine)
Now, I have added a onItemClick method.
  public boolean onItemLongClick(AdapterView<?> parent, View convertView, final int position, long id)

And there is the problem: trying to delete the object (I've written my own delete method which works fine, but needs an ID as parameter) is not working, because the ID in the database is not equal to the POSITION in the ListView.
I've wondered about the 4th argument in the method (long id), but it's showing the value 0 for every ListView Item
Any Ideas how I can get the proper Id to each ListView Item position (which will still work fine if Items are getting deleted) ?

A: If your are using a CursorAdapter subclass, then your primary key should be named _id if you want to get it from the 4th parameter of onItemLongClick method.
have a look here and here

A: I believe that the list builds itself from the db so if the primary key is autoincrementd it should follow the list's index? First item in db = first item in list? It would be really easier to simply add the ID in your object class tho

A: the id of the ListView is totally separated from the id of your database. You could use the position, BUT if you delete an entry in the database the matching isn't correct anymore. I strongly recommend to load and store the database id in the object.

A: Get the object from the Array or ArrayAdapter used to populate the listview from the position passed to onItemLongClick  The example below get's the item from an ArrayAdapter that was used to populate a listview.
public boolean onItemLongClick(AdapterView<?> parent, View convertView, final int position, long id) {
    myObject = myArrayAdapter.getItem(position);
}


text:
Q: Controls not rendering properly in actual android device I am very new to android app development. I am designing the layout of an Activity of an Android project in android studio. I am noticing a strange behavior and I am not able to find a solution. In the design view I am seeing the following view being generated for the following code.
View generated:

Code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".RegistrationActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:orientation="vertical">

        <LinearLayout
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="200dp"
                android:layout_height="200dp"
                android:src="@drawable/test" />

            <LinearLayout
                android:layout_width="200dp"
                android:layout_height="match_parent"
                android:layout_marginLeft="20dp"
                android:orientation="vertical">

                <Button
                    android:id="@+id/button"
                    android:layout_marginTop="20dp"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/GalleryImagePicker"
                    />
                <TextView
                    android:layout_marginTop="20dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:id="@+id/ORTextView"
                    android:text="OR"
                    android:layout_marginLeft="10dp"

                    />
                <Button
                    android:layout_marginTop="20dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    style="?android:attr/buttonStyleSmall"
                    android:text="@string/FacebookImagePicker"
                    android:id="@+id/button2"
                    android:layout_gravity="right"/>
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>
</RelativeLayout>

As you can see in the view the device I have selected is Nexus 5, which has a 1080p display. The view generated is also exactly the same in Genymotion emulator running Nexus 5 android 5.1
Now if I deploy the same application to Sony Xperia Z Ultra device (running android 5.0) which also has a 1080p display the view I get is:

What is the reason behind these two different behaviors?

A: The reason for the seemingly odd behaviour in your question is because the width of Nexus 5 and Xperia Z Ultra are different in dps (density independent pixels)
You need to prepare different layout files based on size qualifiers to give the same look across multiple devices. Take a look here. If you use smallest width(sw) as a size qualifier, Nexus 5 will use layout from sw320dp and Xperia Z ultra will use layout from sw480dp proving the fact that they have different widths in dps.

A: You should use the relative positions for the layout parameters, do not use hard coded (fixed) values. Relative positions will be rendered accordingly on different screen size and density devices.
You can refer this link


text:
Q: How to create a event list with day and hour using table calendar So, The user have the calendar to select one day, after this he taps on the (+) button to create an event. Then, it shows the TimePicker to user select the event start hour and minute, after he write the event name and the event is showed above the calendar, (in event list). But until now i was using only the day, now, I have to set the hour too.
Method which creates the event:
Future<void> _createEvent() async {
    return showDialog<void>(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text('Write the event name', textAlign: TextAlign.center,
            style: TextStyle(color: Colors.black)),
          actions: [
            Padding(
              child: RaisedButton(
                child: Text("Save", style: TextStyle(color: Colors.white, fontSize: 20),),
                onPressed: (){
                  if(_eventController.text.isEmpty) return;
                  if(_myEvents[_calendarDaySelected] != null){
                    _myEvents[_calendarDaySelected].add(_eventController.text.toString());
                    _selectedEvents = _myEvents[_calendarDaySelected];
                  }else{
                    _myEvents[_calendarDaySelected] = [_eventController.text];
                    _selectedEvents = _myEvents[_calendarDaySelected];
                  }
                  _eventController.clear();
                  Navigator.pop(context);
                  setState(() {});
                },
              ),
            ),
          ],
        );
      },
    );
  }

In this case i'm using _myEvents[_calendarDaySelected] so I thought to write _myEvents[calendarDaySelected][_time] but it throws an error:

error: The argument type 'TimeOfDay' can't be assigned to the parameter type 'int'

How could I do this? If you need more code, I can post here

A: I resolve that with this code:
_myEvents[_calendarDaySelected].add({"time": _time, "eventName": _eventController.text.toString()});


text:
Q: Equality in definition of midconvex function Let $f:I \rightarrow  \mathbb{R}$, where $I\subset \mathbb{R}$ is an interval, be midconvex, that is
$$f\left(\frac{x+y}{2}\right) \leq \frac{f(x)+f(y)}{2}$$ for all $x,y \in I$.
Assume that for some $x_0, y_0 \in \mathbb{R}$ such that $x_0 < y_0$  holds equality
$$f\left(\frac{x_0+y_0}{2}\right)= \frac{f(x_0)+f(y_0)}{2}.$$
What can we say about $f$ restricted to $[x_0, y_0]$ ? Maybe  $f|_{[x_0,y_0]}$ is
a sum of some additive function and some constant?
Thanks.
Added.
Maybe then $f(qx_0+(1-q)y_0)=qf(x_0)+(1-q)f(y_0)$ for $q=\frac{k}{2^n}$, where $n \in \mathbb{N}$, $k=0,1,...,2^n$ ?

A: Consider the following example.  Let $B$ be a Hamel basis of $\mathbb R$ over the rationals $\mathbb Q$.  Thus each $x \in \mathbb R$ can be written uniquely as
$x = \sum_{b \in B} c_b(x) b$, where all but finitely many of the $c_b(x)$ are $0$ for any particular $x$.  Let $f(x) = c_{b_0}(x)^2$ for some given $b_0 \in B$.
Since $c_b\left(\frac{x+y}{2}\right) = \frac{c_b(x) + c_b(y)}{2}$, $f$ is midpoint-convex.  For any $x_0$ and $y_0$ such that $c_b(x_0) = c_b(y_0) = 0$ we have
$f\left(\frac{x_0+y_0}{2}\right) = \frac{f(x_0)+f(y_0)}{2} = 0$. But there is a dense set of points $ y_1$ where $f\left(\frac{x_0+y_1}{2}\right) < \frac{f(x_0)+f(y_1)}{2} $

A: If I understand your new question correctly (after the addition in
your question and some clarification in the comments) you want to
know, whether the following is true:

Let $f$ be a midpoint convex (a.k.a. Jensen convex) function on
  $[x_0,y_0]$, i.e. for any $x,y\in[x_0,y_0]$
  $$ f\left(\frac{x+y}2\right)\le \frac{f(x)+f(y)}2 \qquad (1)$$
  holds. Suppose that, moreover,
  $$ f\left(\frac{x_0+y_0}2\right)=\frac{f(x_0)+f(y_0)}2 \qquad (2).$$
  Then $f(qx_0+(1-q)y_0)=qf(x_0)+(1-q)f(y_0)$ for $q=\frac{k}{2^n}$,
  where $n \in \mathbb{N}$, $k=0,1,...,2^n$.

This can be shown by induction on $n$.
For $n=1$ the claim is equivalent to (1).
For $n=2$ we want to show that
$f\left(\frac{x_0+3y_0}4\right)=\frac{f(x_0)+3f(y_0)}4$ and
$f\left(\frac{3x_0+y_0}4\right)=\frac{3f(x_0)+f(y_0)}4$. Using (1)
for the points $\frac{x_0+3y_0}4$ and $\frac{3x_0+y_0}4$ we get
$$2f\left(\frac{x_0+y_0}2\right) \le f\left(\frac{x_0+3y_0}4\right) + f\left(\frac{3x_0+y_0}4\right). \qquad (3)$$
We also get from (1) that
$$2f\left(\frac{x_0+3y_0}4\right) \le f\left(\frac{x_0+y_0}2\right) +
f(y_0) \qquad (4)$$ and
$$2f\left(\frac{3x_0+y_0}4\right) \le f(x_0)+f\left(\frac{x_0+y_0}2\right)
\qquad (5)
$$
Combining (3), (4), (5) we get that
$$4f\left(\frac{x_0+y_0}2\right) \le 2f\left(\frac{x_0+3y_0}4\right) + 2f\left(\frac{3x_0+y_0}4\right) \le f(x_0)+2f\left(\frac{x_0+y_0}2\right)+f(y_0).$$
But since from (2) we know that in fact the equality holds for the
leftmost and rightmost expression, we get that equality holds in
(4) and (5), too. This implies our claim for $n=2$.
Suppose that the claim is true for $n$, we will show it for
$n+1$: Let $q=\frac{k}{2^{n+1}}$. If $k$ is even, the claim
follows from induction hypothesis. If $k$ is odd, we can use what
we proved in the case $n=2$, using either $\frac{k-1}{2^{n+1}}$
and $\frac{k+3}{2^{n+1}}$ or $\frac{k-3}{2^{n+1}}$ and
$\frac{k+1}{2^{n+1}}$ instead of $x_0$ and $y_0$. (We can choose
whichever pair belongs to the original interval. For these point
the claim is true, since $k\pm1$, $k\pm 3$ are even.)

The proof is basically a modification of the proof that every
midpoint convex function is rationally convex, see this question:
Midpoint-Convex and Continuous Implies Convex
(You can try whether other proofs mentioned there can be modified to
you situation too.)


text:
Q: Text Starting From New Line I am creating a resume using Texmaker by following this project. link
\documentclass[]{mcdowellcv}

\usepackage{amsmath}

\name{Name Here}
\address{Address here \linebreak XYZ}
\contacts{+1 9999999999 \linebreak xyz@gmail.com}

\begin{document}

    % Print the header
    \makeheader

    \begin{cvsection}{Education}
        \begin{cvsubsection}{City Name State}{Some Lengthy College     Name Some Lenghty}{2013}
            \begin{itemize}
                \item Bachelor of Technology in Computer Science and     Engineering
            \end{itemize}
        \end{cvsubsection}
    \end{cvsection}

\end{document}

Output is like this.

What I want to achieve is that the college name should remain in the same line as there is some space to the left and right side.

A: Quick and dirty: put the name of your college in a box
% !TeX TS-program = lualatex
\documentclass[]{mcdowellcv}

\usepackage{amsmath}

\name{Name Here}
\address{Address here \linebreak XYZ}
\contacts{+1 9999999999 \linebreak xyz@gmail.com}

\begin{document}

    % Print the header
    \makeheader

    \begin{cvsection}{Education}
        \begin{cvsubsection}{City Name State}{\mbox{Some Lengthy College Name Some Lenghty}}{2013}
            \begin{itemize}
                \item Bachelor of Technology in Computer Science and     Engineering
            \end{itemize}
        \end{cvsubsection}
    \end{cvsection}

\end{document}


text:
Q: How do I add the same sequential class to each nested div? I have three divs with the class .outer and each of those divs contain 1-3 other divs with class .inner. I want the class .inner0 to be added to the .inner divs in the first .outer div, the class .inner1 to be added to the .inner divs in the second .outer div, and so on.
Here is what I have:
$.each($('.outer'), function(index) {
    $('.inner').addClass("inner" + index);
});

This adds .inner0, .inner1, and .inner2 as classes to every single .inner div on the page. What should I be doing differently?

A: You need to get the .inner that are inside the selected .outer. You could use context in second arg like below to select the inner inside selected outer,
$.each($('.outer'), function(index) {
    $('.inner', this).addClass("inner" + index);
    //equivalent to $(this).find('.inner').addClass('inner' + index);
});


text:
Q: Run application on win8 login screen I need to run my app (some kind of on-screen keyboard) on login screen (before login, to help enter password). I can sign code when needed.
EDIT: I prefer to schedule app running from my manager app code.

A: The relevant search term is "Input Method Editor" or IME. Microsoft has released guidelines how these should work, and then it is possible to choose them from the login screen.


text:
Q: Why can't I initialize this List>? Why isn't this possible to do?
private ObservableList<List<String>> fnlData;
.
.
fnlData.get(i).get(indexC) = null;

It says:

A: fnlData.get(i).get(indexC) is the value of a method call. You can't assign anything to the value of a method call.
You can initialize elements of your Lists with set :
fnlData.get(i).set(indexC,null);

Of course, fnlData.get(i) must be initialized first.
And set(indexC,null) will only work if the List returned by fnlData.get(i) already contains at least indexC+1 elements.


text:
Q: How can I use Parcel class to send an object with complex attributes to another activity? I need to send an object ModuleDetection from an activity to another. I've found that using the Parcel class to turn my object into a Parcelable object would help me. However, in every example I could find, the parcelable object's attributes had default types of Android. But the ModuleDetection object has an attribute of ImageInterface type, another class that I made.
When writing the method :
@Override
public void writeToParcel(Parcel dest, int flags) {
}

I can't use methods like dest.writeInt() or dest.writeString() , because my attribute hasn't a default type of android. How can I do this?

A: You should make both classes implement Parcelable. When you pass your ModuleDetection object as a parcelable, the ImageInterface field will get handled as well.

A:
You should make both classes implement Parcelable. When you pass your ModuleDetection object as a parcelable, the ImageInterface field will get handled as well.

You can make your ImageInterface extend Parcelable so each ImageInterface implementation will have to implement also parcel
Here is an example


text:
Q: How to modify or update POJO models at instantiating Java Spring Webflux i'm working with the Google Maps Geocoding API for Java. I have a basic address POJO. What I want to do is run the createLatCord method on the lat property with the body response of the address, city, state and zipcode
I don't know where I should also modify at, at the model itself, Controller or Service/Repository?
Method I need to run on the lat property at create time
private double createLatCord() throws InterruptedException, ApiException, IOException {
    GeoApiContext context = new
    GeoApiContext.Builder().apiKey("abc").build();
    GeocodingResult[] results = GeocodingApi.geocode(context, address+city+state+zipcode).await();
//  Gson gson = new GsonBuilder().setPrettyPrinting().create();
    return results[0].geometry.location.lat;
}

Model :

// all the imports ...

public class User {

    private String address;
    private String zipcode;
    private String city;
    private String state;
    private double lat; // <-- Run createLatCord method on this property
    @Id
    private String id;

    public User() {
    }

    public User(String address, String zipcode, String city, String state, double lat) throws InterruptedException, ApiException, IOException {
        this.address = address;
        this.city = city;
        this.state = state;
        this.zipcode = zipcode;
        this.lat = lat;
    }

// GETTERS AND SETTERS HERE FOR THE ABOVE
// Leaving it out cause it's alot

}

Controller:
@PostMapping(path = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Mono<User> createUser(@RequestBody Mono<User> user) {
     return userService.createUser(user);
}

Service/ Repository:
@Override
public Mono<User> createUser(Mono<User> userMono) {
   return reactiveMongoOperations.save(userMono);
}

SOLUTION:
Model:
 public Mono<User> createLatCord(User user) throws InterruptedException, ApiException, IOException {
        GeoApiContext context = new GeoApiContext.Builder().apiKey("elnjvw").build();
        GeocodingResult[] results = GeocodingApi.geocode(context, user.getAddress() + user.getCity() + user.getState() + user.getZipcode()).await();
        user.setLat(results[0].geometry.location.lat);
        user.setLng(results[0].geometry.location.lng);
        return Mono.just(user);
    }

Service/ Repository
@Override
    public Mono<User> createUser(Mono<User> userMono) {
        return userMono.flatMap(user -> {
            try {
                return reactiveMongoOperations.save(
                        user.createLatCord(user));
            } catch (InterruptedException | ApiException | IOException e) {
                e.printStackTrace();
            }
            return Mono.just(user);
        });
    }

A: If I get it right you want to update lat when you save the user. Since your service already receives a Mono you could flatMap it to call the google api and then call the repository.
It'll be something like this:
@Override
public Mono<User> createUser(Mono<User> userMono) {
    return userMono.flatMap(user ->
                            methodToCallGoogleApiAndSetValueToUser(user))
                   .subscribe(reactiveMongoOperations::save)
}

One point is that methodToCallGoogleApiAndSetValueToUser should return a Mono with the updated user.
Hope this might be helpfull!


text:
Q: mysql ndb cluster add data node This is my config.ini file
options affecting ndbd processes on all data nodes:
[ndbd default]
NoOfReplicas=1    # Number of replicas
DataMemory=80M    # How much memory to allocate for data storage
IndexMemory=18M   # How much memory to allocate for index storage
                  # For DataMemory and IndexMemory, we have used the
                  # default values. Since the "world" database takes up
                  # only about 500KB, this should be more than enough for
                  # this example Cluster setup.
TCP/IP options:
[tcp default]
portnumber=2202   # This the default; however, you can use any port that is free
                  # for all the hosts in the cluster
                  # Note: It is recommended that you do not specify the port
                  # number at all and allow the default value to be used instead
Management process options:
[ndb_mgmd]
hostname=192.168.1.10           # Hostname or IP address of management node
datadir=/var/lib/mysql-cluster  # Directory for management node log files
Options for data node "A":
[ndbd]
                                # (one [ndbd] section per data node)
hostname=192.168.1.10           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's data files
Options for data node "B":
[ndbd]
hostname=192.168.0.20           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's data files
SQL node options:
[mysqld]
hostname=192.168.1.10           # Hostname or IP address
                                # (additional mysqld connections can be
                                # specified for this node for various
                                # purposes such as running ndb_restore)
I want to specify second data node on 192.168.0.20 server.
What changes do i need to do on 192.168.0.20? It is a very low end machine so, I want don't want mysqld to run there.
 can anyone provide any input on this.

A: If you use http://www.severalnines.com/config/index.php to create configurations files, and ask it to send it to you as an e-mail, you will get several scripts, including add_node.sh, which might be what you need.


text:
Q: Need help on eclipse project config - Could not find class when debugging on device (android) I'm new to Android and today I've found an Android library on Github. Link: https://github.com/nhaarman/ListViewAnimations
I've cloned the project to my computer and imported 3 projects to Eclipse: 2 from the cloned directory and 1 from sdk/extras/android/support/v7/appcompat.
Here is my "MainActivity" project properties:

*

*Android >> library: android-support-v7-appcompat, Library-ListViewAnimations

*Java Build Path >> projects: android-support-v7-appcompat

There're no error remarks in package explorer, however, when i run the project, some errors happen like this:
12-01 01:05:22.189: E/dalvikvm(2924): Could not find class 'com.haarman.listviewanimations.appearanceexamples.AppearanceExamplesActivity', referenced from method com.haarman.listviewanimations.MainActivity.onAppearanceClicked
The entire log file is here: https://www.dropbox.com/s/ct2fhgy0m0lvdgn/log.txt
Thanks for any help!
Update: I've found the solution:
The problem comes from a jar mismatch
[2013-12-01 09:34:06 - MainActivity] Found 2 versions of android-support-v4.jar in the dependency list,
[2013-12-01 09:34:06 - MainActivity] but not all the versions are identical (check is based on SHA-1 only at this time).
[2013-12-01 09:34:06 - MainActivity] All versions of the libraries must be the same at this time.
[2013-12-01 09:34:06 - MainActivity] Versions found are:
[2013-12-01 09:34:06 - MainActivity] Path: /Code/Android/Git/Others/ListViewAnimations/example/libs/android-support-v4.jar
[2013-12-01 09:34:06 - MainActivity]    Length: 556198
[2013-12-01 09:34:06 - MainActivity]    SHA-1: 4a6be13368bb64c5a0b0460632d228a1a915f58f
[2013-12-01 09:34:06 - MainActivity] Path: /Code/Android/adt-bundle-mac-x86_64-20131030/sdk/extras/android/support/v7/appcompat/libs/android-support-v4.jar
[2013-12-01 09:34:06 - MainActivity]    Length: 621451
[2013-12-01 09:34:06 - MainActivity]    SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4
[2013-12-01 09:34:06 - MainActivity] Jar mismatch! Fix your dependencies

Delete android-support-v4.jar in my libs folder and everything works fine!

A: make sure you have referenced the library properly in your project. Right click your project and select Android from the left panel and add a reference to the library in the library section.
    ![Adding a reference to a library project][1]

A: Follow the instructions on their github page under Setup.  You can just download the jar files and stick tehm in the libs folder.  Download the entire project to see what other jars they have in their libs folders.  It looks like their project is dependent on one or more others (like the NineOldAndroids.jar).


text:
Q: Create buffer around selected points and add to a new shapefile I am trying to figure out how to create a buffer around selected points and add them to an new shapefile.
My idea is to have a loop that loops through the selected points and perform a buffer and then adds them to a new shapefile and saves it.
So here is my code to create points and feature data and saves it as a shapefile.
Here is my code for the shapefile creation:
public void addDataToMap(string folder, string shapefilename) {
        pMap = mDoc.FocusMap;

        string strFolder = folder;
        string strName = shapefilename;
        string strShapeFileName = "Shape";
        string strLatitude = "Latitude";
        string strLongitude = "Longitude";
        string strLocationName = "Name";

        IFeatureWorkspace pFWS;
        IWorkspaceFactory pWorkspaceFactory;
        pWorkspaceFactory = new ShapefileWorkspaceFactory();
        pFWS = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(strFolder, 0);

        //FIELDS SETUP
        IFields pFields;
        IFieldsEdit pFieldsEdit;
        pFields = new Fields();
        pFieldsEdit = (IFieldsEdit)pFields;

        //FIELD1 SETUP
        IField pField;
        IFieldEdit pFieldEdit;
        pField = new Field();
        pFieldEdit = (IFieldEdit)pField;

        pFieldEdit.Name_2 = strShapeFileName;
        pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
        pFieldsEdit.AddField(pField);

        //FIELD2 SETUP
        IField pField1;
        IFieldEdit pFieldEdit1;
        pField1 = new Field();
        pFieldEdit1 = (IFieldEdit)pField1;

        pFieldEdit1.Name_2 = strLatitude;
        pFieldEdit1.Type_2 = esriFieldType.esriFieldTypeDouble;
        pFieldsEdit.AddField(pField1);

        //FIELD3 SETUP
        IField pField2;
        IFieldEdit pFieldEdit2;
        pField2 = new Field();
        pFieldEdit2 = (IFieldEdit)pField2;

        pFieldEdit2.Name_2 = strLongitude;
        pFieldEdit2.Type_2 = esriFieldType.esriFieldTypeDouble;
        pFieldsEdit.AddField(pField2);

        //FIELD4 SETUP
        IField pField3;
        IFieldEdit pFieldEdit3;
        pField3 = new Field();
        pFieldEdit3 = (IFieldEdit)pField3;

        pFieldEdit3.Name_2 = strLocationName;
        pFieldEdit3.Type_2 = esriFieldType.esriFieldTypeString;
        pFieldsEdit.AddField(pField3);

        IGeometryDef pGeomDef;
        IGeometryDefEdit pGeomDefEdit;
        pGeomDef = new GeometryDefClass();
        pGeomDefEdit = (IGeometryDefEdit)pGeomDef;
        pGeomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;

        //Spatialreference setup
        ISpatialReferenceFactory SRF = new SpatialReferenceEnvironmentClass();
        ISpatialReference SR = SRF.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_World_Mercator);
        SR = SRF.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
        ISpatialReferenceResolution SRR = (ISpatialReferenceResolution)SR;
        SRR.ConstructFromHorizon();
        ISpatialReferenceTolerance SRT = (ISpatialReferenceTolerance)SR;
        SRT.SetDefaultXYTolerance();
        pGeomDefEdit.SpatialReference_2 = SR;

        pFieldEdit.GeometryDef_2 = pGeomDef;

        IFeatureClass pFeatClass;
        pFeatClass = pFWS.CreateFeatureClass(strName, pFields, null, null, esriFeatureType.esriFTSimple, strShapeFileName, "");

        IFeatureLayer pFeaturelayer = new FeatureLayerClass();
        pFeaturelayer.FeatureClass = pFeatClass;
        pFeaturelayer.Name = pFeatClass.AliasName;

        IPoint point = new Point();
        for (int i = 1; i < data_.Count; i++)
        {

            point.PutCoords(data_[i].getLngAsDouble(), data_[i].getLatgAsDouble());

            IFeature feature = pFeatClass.CreateFeature();
            feature.Value[2] = data_[i].getLatgAsDouble();
            feature.Value[3] = data_[i].getLngAsDouble();
            feature.Value[4] = data_[i].getName();
            feature.Shape = point;
            feature.Store();
        }
        pMap.AddLayer(pFeaturelayer);
        mDoc.UpdateContents();
        mDoc.ActiveView.Refresh();
    }

And now when the layer is created I have done some code to Count the selected features and the if it is a Point I want to create a new shapefile with a given buffer around the selected points.
And here is that code:
        private void cmdBuffer_Click(object sender, EventArgs e)
        {
        int counter=0;
        IEnumFeature enumFeature = (IEnumFeature)ArcMap.Document.FocusMap.FeatureSelection;
        IFeature feature = enumFeature.Next();
        while (feature != null) {
            IGeometry geomfeature = feature.ShapeCopy;
            if (geomfeature.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                //Create some buffering magic.
            }
            feature = enumFeature.Next();
        }
        if (counter != 0)
        {

        }
        else {
            MessageBox.Show("You need to select features to make a buffer", "Try again.");
        }
    }

Does anyone have a good practice for this?

A: Here is some code using VBA showing you an approach to calling the Buffer tool:
Public Sub buff()
    ' Get featurelayer so selections are used
    Dim pmxd As IMxDocument
    Set pmxd = ThisDocument
    Dim pmap As IMap
    Set pmap = pmxd.FocusMap
    Dim pl As ILayer
    Set pl = pmap.Layer(0)
    Dim pfl As IFeatureLayer
    Set pfl = pl

    ' Load parameters into Array, IMPORTANT must be same order as tool
    Dim pA As IVariantArray
    Set pA = New VarArray
    With pA
        .Add pfl
        .Add "IN_MEMORY/test"
        .Add "100 Meters" ' 100m
        .Add "FULL"
        .Add "ROUND"
        .Add "NONE"
        .Add "#" ' Default
        .Add "#" ' Default
    End With

    ' Create geoprocessor
    Dim pGP As IGeoProcessor
    Set pGP = New GeoProcessor
    pGP.AddOutputsToMap = True
    pGP.OverwriteOutput = True

    ' Run tool
    Dim pRes As IGeoProcessorResult
    Set pRes = pGP.Execute("Buffer_analysis", pA, Nothing)
    If pRes.Status <> esriJobSucceeded Then
        Debug.Print "oops something went wrong!"
    End If
End Sub


text:
Q: Concerning Dickson's Conjecture Dickson's Conecture says the following:
If $f_1(n)=a_1+b_1n, f_2(n)=a_2+b_2n, \ldots, f_k(n)=a_k+b_kn$, with $b_j \geq 1$, $1 \leq j \leq k$ satisfy a congruence condition, then there exist infinitely many positive integers $n$ for which every $f_j(n)=a_j+b_jn$ is a prime number, $1 \leq j \leq k$.

(1) What is the congruence condition?

In Schinzel's hypothesis H, a condition is mentioned, which I suspect is the congruence condition that I am looking for; it says:
"For every prime $p$, there is an $n$ such that all the polynomial values at $n$ are not divisible by $p$".
This condition obviously excludes the case $f_1(n)=3+n$ and $f_2(n)=4+n$,
which is a trivial counterexample to Dickson's conjecture/Schinzel's hypothesis H, since always one of $\{3+n,4+n\}$ is an even number, so cannot be a prime number (this counterexample does not satisfy the above condition, since for $p=2$ there is no $n$ with $2 \nmid 3+n$ and $2 \nmid 4+n$).

(2) If the congruence condition is indeed: "For every prime $p$, there is an $m$ such that all the polynomial values at $m$, $\{f_j(m)\}$, are not divisible by $p$", then it seems to me that in practice it is very difficult to check (except trivial cases as $f_1(n)=3+n, f_2(n)=4+n$); Am I missing something?

I am interested in the special case where $\gcd(a_j,b_j)=1$, $1 \leq j \leq k$,
$k=2$.
In that case, if I wish to check the congruence condition, then, for a given prime $p$, all I know (by Dirichlet's theorem on arithmetic progressions) that there exists $m$ such that $p \nmid f_1(m)=a_1+b_1m$ (just take large enough $m$ such that $a_1+b_1m$ is a prime number greater than $p$, so clearly $p$ does not divide a greater prime number), but $p$ may divide $f_2(m)$.
Therefore, if we assume that Dickson's Conjecture is true, then even in the special case $k=2$, $\gcd(a_1,b_1)=1$, $\gcd(a_2,b_2)=1$, it seems not applicable.
Edit: This is a relevant paper that I have just found. In that paper an interesting result due to Maynard-Tao is mentioned ("Even more impressively... it was shown that one can take $k_2=50$").
However, they deal with $b_1=\cdots=b_k=1$.
Thank you very much!

A: I saw it, in addition to $a_j > 0$ and $(a_j, b_j) = 1$ ($1 \leq j \leq k$), in the following form: for any prime $\color{red}{p \leq k}$, the mapping $n \mapsto P(n) := \displaystyle\prod_{j = 1}^{k}(a_j + b_j n) \bmod p$ is not identically zero.
For $p > k$ this holds automatically, as any polynomial over $\mathbb{Z}/p\mathbb{Z}$ in $n$, which is identically zero as a function of $n$, must be a multiple of $n(n-1)\ldots(n-(p-1))\color{lightgray}{\equiv n^p-n}$ with degree $p>k$ (and in our case it cannot be identically zero as a polynomial).
Thus it's not that hard to check ($n^p - n$ should not divide $P$ over $\mathbb{Z}/p\mathbb{Z}$ for each prime $p \leq k$).

A: In practice it is not that hard to check (2).  Unless $b$ is itself divisible by $p$, there is exactly one congruence class of $m$ for which $a+bm$ is divisible by $p$.  That means that in the generically-worst case, there are at most $k$ congruence classes of $m$ mod $p$ that could cause any of the $\{f_j(m)\}_j$ to be divisible by $p$.
If $p > k$ then there will always be some congruence class available that makes all the $\{f_j(m)\}$ non-zero, so we only need to be concerned with $p \le k$, at least when $p$ does not divide any $b_j$.
But there are only finitely many possible primes that divide any $b_j$, so those can be checked separately (as metamorphy's answer suggests, they are in fact completely harmless unless $p$ also divides $a_j$).


text:
Q: How do I pass the correct parameters to the 'az storage fs upload' command? How do I use 'az storage fs upload' ?    There appears to be 3 basic arguments but the documentation does not clearly explain exactly what they are.
The old style of this command looked like this, and it worked.  I was getting WARNING messages ( WARNING: This command is implicitly deprecated because command group 'storage blob directory' is deprecated and will be removed in a future release. Use 'az storage fs directory' instead. ) telling to to migrate to a new command style:
az storage blob directory upload -c '$web' --account-name $STACCT --recursive \
 -s /agent/_work/1/service-name/karate/target/cucumber-html-reports
 -d TESTS/2022/2022-08-05/16:38:07/dev/service-name --account-key $STKEY

And I am trying to get it to work this way, as the warning message suggested, but it says my syntax is wrong:
 az storage fs directory upload -f '$web' --account-name $STACCT \
  -s /agent/_work/1/service-name/karate/target/cucumber-html-reports \
  -p TESTS/2022-08-05/16:38:07/dev/service-name --account-key $STKEY

The error I get is:
ERROR: unrecognized arguments: -p TESTS/2022-08-05/16:38:07/dev/service-name/...

If I pass -d instead of -p, it just hangs and says nothing.
So, is there any real documentation on exactly what these parameters are supposed to look like?

A: Have you tried using az interactive to test the new command and available parameters, the autocompletion could be handy.
You can use Azure CLI in interactive mode by running the az interactive command.
The Azure CLI interactive mode places you in an interactive shell with auto-completion, command descriptions, and examples.
Visit https://learn.microsoft.com/en-us/cli/azure/interactive-azure-cli


text:
Q: How to solve problems with tensorflow in PyCharm? I've downloaded all the libraries required for this code, manually in the Settings->Project Interpreter. My program copiles, however I don't know how to solve the following problems.:
2020-07-04 10:47:31.288138: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-07-04 10:47:31.288458: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-07-04 10:47:33.543588: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-04 10:47:33.564498: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.6705GHz coreCount: 10 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 178.99GiB/s
2020-07-04 10:47:33.565358: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-07-04 10:47:33.565968: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-07-04 10:47:33.566677: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-07-04 10:47:33.567277: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-07-04 10:47:33.567993: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-07-04 10:47:33.568630: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-07-04 10:47:33.569371: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-07-04 10:47:33.569631: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-07-04 10:47:33.570391: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-07-04 10:47:33.578443: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1d3c8e21060 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-04 10:47:33.578954: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-07-04 10:47:33.579419: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-07-04 10:47:33.579763: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]

My code:
import keras
from keras.modes import Sequential
from keras.layers.convolutional import *
from keras.layers.core import Dense, Flatten
import numpy as np

model_valid = Sequential([
    Dense(16, input_shape=(20, 20, 3), activation='relu'),
    Conv2D(32, kernel_size=(3, 3), activation='relu', padding='valid'),
    Conv2D(64, kernel_size=(5, 5), activation='relu', padding='valid'),
    Conv2D(128, kernel_size=(7, 7), activation='relu', padding='valid'),
    Dense(2, activation='softmax')
])

model_valid.summary()

model_same = Sequential([
    Dense(16, input_shape=(20, 20, 3), activation='relu'),
    Conv2D(32, kernel_size=(3, 3), activation='relu', padding='same'),
    Conv2D(64, kernel_size=(5, 5), activation='relu', padding='same'),
    Conv2D(128, kernel_size=(7, 7), activation='relu', padding='same'),
    Dense(2, activation='softmax')

])

model_same.summary()

A: Well the code has no problem. I have tried it on my computer and it works fine. The problems seems like you have not installed Cudnn. Here is a good tutorial about how to install tensorflow - gpu
https://youtu.be/uIm3DMprk7M


text:
Q: C# JIRA SDK Unclear Error in SaveChanges() Function I'm trying to create a web form where I can dynamically create a JIRA Epic using whatever the user inputs. I'm relying on the Atlassian JIRA SDK Nuget package to do so.
Here's the function as it stands right now.
public ActionResult Create(string title, string description)
{
    Jira jiraConnection = Jira.CreateRestClient("https://xxxx.atlassian.net/", "username", "password");
    Issue issueMain = jiraConnection.CreateIssue("xxxx");
    issueMain.Type = "Epic";
    issueMain.Priority = "Major";
    issueMain.Summary = title;
    issueMain.Description = description;

    try
    {
        issueMain.SaveChanges();
    }
    catch (Exception ex)
    {
         MessageBox.Show(ex.InnerException.Message.ToString());
         return View("Contact");
    }

    return RedirectToAction("Index");
}

I've come across a few different errors in trying to get the issue actually created, but the one currently plaguing me is this:
error CS0103: The name 'client' does not exist in the current context
I hit this error when I hit the issueMain.SaveChanges() line, and I don't know why, because I'm not instantiating a "client" variable anywhere in this function and I can't step into the SaveChanges function to see where it might be getting referenced within it.
When I check the inner exception, I see that I'm getting an Encountered a 401 - Unauthorized error while loading this page error, which I also don't understand, as I am providing the credentials I would usually use to log in to our JIRA site.

A: I have found the link to the Atlassian Jira SDK documentation:
https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home
It looks like you need to add the two propertiesType and Priority when creating the issue.
issueMain.Type = "Bug";
 issueMain.Priority = "Major";


text:
Q: Smtp error 451 Temporary local - please try later on Cpanel Server I have a Cpanel Server.
It send emails correctly expect from 1 domain which hosted on the server , so when I try to send email from that domain using roundcube or Horde I got the errror
SMTP Error (451): Failed to add recipient "recipient@exmple.com" (Temporary local problem - please try later).

does anyone know why and how to fix this?

I found the porblem:
After reviewing the file /var/log/exim_mainlog using
tail -f /var/log/exim_mainlog

I noticed that the error was:
2013-05-29 20:04:28 SMTP connection from [127.0.0.1]:36797 (TCP/IP connection count = 1)
2013-05-29 20:04:28 lowest numbered MX record points to local host: domain.com (while verifying <user@domain.com> from host localhost.localdomain (domain.com) [127.0.0.1]:36797)
2013-05-29 20:04:28 H=localhost.localdomain (domain.com) [127.0.0.1]:36797 sender verify defer for <user@domain.com>: lowest numbered MX record points to local host
2013-05-29 20:04:28 H=localhost.localdomain (domain.com) [127.0.0.1]:36797 F=<user@domain.com> A=dovecot_login:narena temporarily rejected RCPT <recipient@exmple.com>: Could not complete sender verify
2013-05-29 20:04:28 SMTP connection from localhost.localdomain (domain.com) [127.0.0.1]:36797 closed by QUIT

so the main problem was:
lowest numbered MX record points to local host

after couple of search I found the soluation in http://forums.cpanel.net/f5/lowest-numbered-mx-record-points-local-host-73563.html
which was to:
login to WHM and go to Main >> DNS Functions >> Edit MX Entry for the domain
set MX priority to 0 for the related domain and save.

A: I had the same problem after running a script to fix directory permissions on a cPanel-powered server (CentOS 6.5). I checked the logfile (tail -f /var/log/exim_mainlog) and found this error:
require_files: error for /home/user_name/etc/domain.com: Permission denied

Just ran the following command and the issue was fixed:
chown -R user_name:mail /home/user_name/etc/

Hope this helps someone.

A: check the the file /var/log/exim_mainlog to see more information about the error
tail -f /var/log/exim_mainlog

while trying to send email

A: Check your MX Entry in Cpanel, if the existing domain priority is less than or equals to 0, set it to 1. Mine is fixed. Hope it will help you.

A: Wow, after about an hour of searching and meddling with different files, I'd caution any novice not to venture out editing anything before you have a backup or image if your server, as you can cause irrevocable damage to your server. So many people talking garbage about what you should do or test without any real solution.
Anyways, here's what worked for me:
Real problem: Exim was updated to latest version which has loads of bugs like this issue.
How I fixed my server:
Authenticate to Linux via SSH and run the command lines through which we download and install the old version of EXIM.
Command Line 1: wget https://ca1.dynanode.net/exim-4.93-3.el7.x86_64.rpm
Command Line 2: rpm -Uvh --oldpackage exim-4.93-3.el7.x86_64.rpm
Command Line 3: systemctl restart exim
Command Line 4: Systemctl restart clamd
Command Line 5: systemctl restart spamassassin
Optional: just type "Reboot" to restart your server
The command lines above does the following:

*

*Downloads the old package (I'm sure you can google other sources with this file)

*Install the old package without prompt

*Restart the Exim service

*Restart the Clamd Service (AV)

*Restart the spamassassin service (Spam Filter)

Restart outlook or whatever you use for mail client and send an email. Mine works, hope yours do too.


text:
Q: How can I call a function from an existing View Controller class? I'm still an early stage Swift developer. I'm trying to create a feature where I click a button on a screen, then I get prompted by the iPhone to allow location, and when I click allow, I am automatically navigated to another screen.
So far I've done the following things:

*

*created a seperate class ("User") where all the location functions are handled

*Setup a button on the first view controller and the appropiate IBAction that calls the location prompt function from "User"

*Added storyboard IDs for the first and second view controller

*Created a function ("changeScreen") in the first view controller class that performs the navigation to another view

*Setup a listener in the "User" class for when user has clicked allow location, which then calls the "changeScreen" function

I think there's another way to do this (call some sort of completion handler) and I toyed around with that for 1-2 hours and nothing worked. So far this solution has almost completely worked but I get the following error:

Warning: Attempt to present ____ on _____ whose view is not in the window hierarchy!

Here's the code in my "User" class
class User: NSObject, CLLocationManagerDelegate {

func getLocation(){

    // For use in foreground
    locationManager.requestWhenInUseAuthorization()

    locationManager.delegate = self
    locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.requestWhenInUseAuthorization()
    //locationManager.startUpdatingLocation()

    println("hello location")

}

    func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status:CLAuthorizationStatus){

        if status == .AuthorizedWhenInUse {

            locationManager.startUpdatingLocation()

            firstView!.showSecondScreen() // this is where I call the other      class's function

        }
    }
  }

Here's the code in my First View controller class
var firstView: FirstView? = nil

class FirstView: UIViewController {

var newUser = User()

override func viewDidAppear(animated: Bool) {

    firstView = self.storyboard!.instantiateViewControllerWithIdentifier("firstView") as? FirstView

// here i take the first view controller class and store it into a public variable

}

@IBAction func allowLocationBtn(sender: AnyObject) {

    newUser.getLocation()  // this is the first button clicked

}

func showSecondScreen(){

    let secondScreen = self.storyboard!.instantiateViewControllerWithIdentifier("SecondScreen") as! SecondScreen

    self.presentViewController(secondScreen, animated: true, completion:   nil  )

}

Ps. I know I can combine all the code into one class, and it could all work like that. But I want to do it the "proper" way, have different functionalities in different classes.

A: *

*try to set first = self , dont instantiate a new view-controller

*if using storyboard, better to use segues to display another screen

Though the correct thing here would be to have a UserDelegate Protocol
protocol UserDelegate {
      func displayOtherScreen( )
}
then in User add var delegate: UserDelegate?
and in the locationManager function instead of calling
firstView!.showSecondScreen call
delegate?.displayOtherScreen( )
Then make FirstView adopt the UserDelegate Protocol
class FirstView: UIViewController, UserDelegate {
var newUser = User()

override func viewDidAppear(animated: Bool) {
    newUser.delegate = self
    ...
    }
    ...
    ...
func displayOtherScreen( ) {
    showSecondSceen( )
    }

Now there is no need for the first variable..

A: Ideally the situation you are trying handle multiple MVC's. Your second Screen by itself should be a different View and should have its own Model View Controller. That way you are not breaking the rules of MVC architecture. Your ShowSecondScreen() function should be controlled by a SecondViewController.
Once you have this multiple MVC's defined you can wire them up.
There are some ways to do this - UISplitViewController, UITabViewController, UINavigationViewController. In your case, UINavigationViewController seems best option. You can add Navigation Controller to wireup MVC's using Editor -> Embed on your class FirstView. That would make FirstView controller as your rootViewController.
Then add a segue from your button on the FirstView to your controller for the SecondScreen i.e SecondViewController
class FirstView: UIViewController {
    override func prepareForSegue(..) {
        if let secondControllerObject = segue.destinationViewController as? SecondViewController {
            if let identifier = segue.identifier {
                 switch identifier {
                       case "<your_buttons_identifier_string" : secondControllerObject .callToSecondScreen()
/* Now will move the Second View to the top of the MVC stack and you
will be also able to go back to first view as you have a
Navigation Controller hooked up.*/
/* callToSecondScreen - should be a controller object displaying the
 controlling and displaying contents in the second screen's view.
Data for second screen's view will come from its Model */

        }


text:
Q: Converting a Windows 2003 server We have a legacy database system based upon MS SQL running on Windows Server 2003.  The client software will only run on Windows XP.
We have recently had success converting a client into a virtual machine and running it under Fusion on Mac minis.  So far, it is working incredibly well.  So well, in fact, that we are now considering trying to convert the server to a virtual machine.
This raises several questions, though:

*

*The server uses a raid array.  Does the VM virtualize the RAID array?  I only ask because in my experience Windows products don't like it when you change core hardware.

*Is there any reason why running SQL server on a virtual machine won't work?  It will be up 24/7.

*Is there a different converter for servers?

*Will I have to track down the licensing for MS SQL and Server 2003 or will they come across ok?

*The company that designed the software is no longer in business.  There is some fear that the software is somehow tied to the hardware configuration.  We bought the hardware, but their engineers came out and configured the system.  Will the virtual machine be able to spoof particular chip sets?

A: You've got a lot of questions in there, hopefully I'll get them all answered in one shot.

*

*Yes you'll be converting the RAID array to a virtual disk.  What ever sort of disk you put the new virtual disk on will determine the performance.

*No. You can run SQL Server within a virtual machine without an issue.

*Probably not.  You'll want to use what ever converter is available for the platform that you are moving the virtual server into.

*No.  The licenses will come across just fine.

*No the virtual platform will not be spoofing specific chipsets or specific hardware.  All the hardware will be changed to the new stuff.  You'll need to install drivers (the VMware Tools) to get all the needed drivers installed and working.
The nice thing about doing a P2V (Physical to Virtual) migration like this is that the rollback if there's a problem is really easy.  Just power down the virtual machine and power up the physical server.
Now all that being said, I hope that you aren't planning on virtualizing this server to a Mac Mini.  That probably won't have enough horse power to run the server at the current levels, and it sure won't have a fast enough hard drive to give you the performance that you are looking for.  You'll want a more server style virtualization platform for running the server such as Hyper-V 3.0 or vSphere 5.1.

A: *

*The converter will virtualize the disk volumes. It doesn't know or care about the underlying hardware.

*No. SQL Server is a perfectly acceptable candidate for virtualization.

*Not for VMware. The VMware Converter works for any Windows OS (AFAIK).

*You may have to activate Windows again after the conversion. Also, if your Windows server came with an OEM license for the OS it is non-transferable to the VM AFAIK.

*No. You may have issues if the software only works with particular hardware or with a hardware "dongle" or "hasp".


text:
Q: combine information from two tables into one table I need to combine information from two tables into one table, the following table is
table 1
+----+---------------+---------+
|id_k|   name        |  value  |
+----+---------------+---------+
| 1  | enak          | 4       |
| 2  | nor           | 3       |
+----+---------------+---------+

table 2
+------+------+---------+
| id_d | id_k |  feel   |
+------+------+---------+
|  1   |  1   | good    |
|  2   |  1   | better  |
|  3   |  1   | verygood|
+------+------+---------+

result should be
+------+------+-------+------------------------+
| id_d | name | value |            feel        |
+------+------+-------+------------------------+
|  1   | enak |   4   | good, better, verygood |
|  2   | nor  |   3   |                        |
+------+------+-------+------------------------+

this is my code [not worked]
select k.name, k.value, s.feel
from table1 as k
left join table2 as s on s.id_k=k.id_k

A: You could use the gorup_concat function to concatinate the values from table2 to a coma-delimited string in the result:
SELECT   table1.id_k, name, value, GROUP_CONCAT(feel SEPARATOR ', ') AS feel
FROM     table1
JOIN     table2 ON table1.id_k = table2.id_k
GROUP BY table1.id_k

A: http://sqlfiddle.com/#!9/3a7564/1
SELECT   t1.id_k,
  t1.`name`,
  t1.`value`,
  GROUP_CONCAT(t2.feel) AS feel
FROM     table1 t1
LEFT JOIN table2 t2
ON t1.id_k = t2.id_k
GROUP BY t1.id_k


text:
Q: How to make this in html and css? I am trying to make this from a design someone gave me:

Now, I do have this:

But how am I able to add those lines on full height between the options?

Log In

VIP Membership

Best Players

Administrators

Forums

#navigation {
    float: right;
    padding-top: 8px;
    font-size: 18px;
    font-family: Arial;
}

#navigation li {
    padding: 2px;
    margin: 0;
    float: left;
    list-style: none;
}

A: Your question is lines on full height between the options - Answer is border-left: 1px solid #666666
Fiddle
#navigation
{
    width: 100%;
    list-style-type: none;
    background: #000000;
    text-align: center;
}
#navigation li
{
    display: inline-block;
    height: 70px;
    line-height: 70px;
    border-left: 1px solid #666666;
}
#navigation li:last-child
{
     border-right: 1px solid #666666;
}
#navigation li a
{
    text-decoration: none;
    color: #FFFFFF;
    padding: 10px 15px 10px 15px;
    font-family: arial;
}
#navigation li a:hover
{
    color: red;
}

A: I guess you could use the CSS border attribute. Try something like:
#navigation li:not(:first-child) {
  border-left: 1px gray solid;
}


text:
Q: PHP to list all Packages/Procedures/Functions and also its body of content in a script I need a quick PHP script to list down all packages/procedures/functions including its body of content so that any line of SQL code can easily be found by using CTRL+F.
I have like 100+ procedures and functions in a db/schema which is hard to find for a specific line of SQL inside the procedures script. Example like toad package viewer:

The php script will loop through all packages and show their scripts like:
SET CURRENT SCHEMA = JCONVEY;

SET CURRENT PATH = SYSIBM,SYSFUN,SYSPROC,SYSIBMADM,DB2INST1;

CREATE OR REPLACE PROCEDURE JCONVEY.ENDSTAGE_SENDMAIL (
    BAID IN VARCHAR(4000) DEFAULT 'BPP',
    EMAILTITLE IN   VARCHAR(4000),
    SQLMSG IN   VARCHAR(4000),
    RECEMAIL IN VARCHAR(4000),
    CASEID IN   VARCHAR(4000),
    UNIQUEID IN VARCHAR(4000) DEFAULT '',
    CC_TO IN    VARCHAR(4000) DEFAULT '',
    HISTTYPE IN DECFLOAT(16) DEFAULT 99,
    USRID IN    VARCHAR(4000) DEFAULT '*SYSTEM',
    ATT_ID IN   VARCHAR(4000) DEFAULT '0',
    MAQ_TYP IN  VARCHAR(12) DEFAULT NULL )
IS
subject VARCHAR2(200);
msg  CLOB;

A: Answer based on @hotfix above, php script can be used like this:
<?php
$conn = db2_connect('DB', 'db2inst1','password' );
db2_exec($conn, 'set schema jconvey');

$stmt = db2_prepare($conn,'
    select text from all_source where text is not null
    ');
$result = db2_execute($stmt);

if($result)
{
    while ($row = db2_fetch_assoc($stmt)) {
        echo '-------------------------------------------------------

';
        echo $row['TEXT'].'

';
    }
}


text:
Q: Text to 2D Char Array I'm trying to save a txt file in this format to a 2d array.
@@@@@@@@@@@@@@@@@@@@
    @@@ @ @ @@    @@
@ @ @@  @ @    @@ @@
@ @   @   @ @  @@  @
@ @@@ @ @   @@   @ @
@@@@@@@@@@@@@@@@@@@@

As of now, my code looks like this:
char maze[H][W];
int i;
char filename[100];

printf("Enter maze's filename: ");
scanf("%s", filename);
FILE *fp;
fp = fopen(filename, "r");
fread(maze, 1, sizeof(maze), fp);
for (i = 0; i < H; ++i)
    maze[i][W] = 0;

H and W are defined as 6 and 20. When I print this using:
int i, j;
for(i=0; i<H; i++){
    for(j=0; j<W; j++){
        printf("%c", maze[i][j]);
    }
printf("\n");
}

I included .txt and this is what it prints.
@@@@@@@@@@@@@@@@@@@@

    @@@ @ @ @@
@@
@ @ @@  @ @    @
@ @@
@ @   @   @ @
  @@  @
@ @@@ @ @
@@   @ @
@@@@@@@@@@

What do I need to change on my code?

A: #define H 6
#define W 21 //change to 21, +1 for newline

....
char maze[H][W];
int i, j;
char filename[100];

printf("Enter maze's filename(w/o .txt): ");
scanf("%s", filename);
FILE *fp;
fp = fopen(filename, "r");
fread(maze, 1, sizeof(maze), fp);
for (i = 0; i < H; ++i) maze[i][W-1] = 0;

for(i=0; i<H; i++){
    printf("%s\n", maze[i]);//change
}

A: It looks like the file contains \r\n (windows style) newline, which is 2 characters. So you have to read 6*(20+2) characters but printf only 6*20 chars, if you keep it the way you coded it.

A: If you have to keep compatibility between a text format map and your maze you need to skip the final \n at the end of each line.
You can read a line at time and skip the newline.
The sample shows also the nature of array of arrrays that applies to multidimensional arrays in C.
#include <stdio.h>

#define H  6
#define W 20

void PrintMaze(char maze[H][W])
{
    int i, j;
    for (i = 0; i < H; i++)
    {
        for (j = 0; j < W; j++)
        {
            printf("%c", maze[i][j]);
        }
        printf("\n");
    }
}

int main(int argc, char *argv[])
{
    char maze[H][W];
    int i;
    char filename[100];

    printf("Enter maze's filename: ");
    scanf("%s", filename);
    FILE *fp;
    fp = fopen(filename, "r");
    for (i = 0; i < H; ++i)
    {
        fread(maze[i], 1, W, fp);    //we use a single subscipt we get an array of W elements
        fgetc(fp);  //Skip '\n'
    }

    PrintMaze(maze);

    return 0;
}


text:
Q: Why jenkins custom plugin could not upload file from slave to s3 I have written a custom jenkins plugin which uploads the artifact in my workspace to s3 bucket. This works fine when i run my job on jenkins master. When my build job is targetted to build from jenkins slave, i get "file not found error" even if file is present in slave directory with exactly the same name. Why it is happening and how can i fix this.
I am exactly using the same code in my plugin as in: http://docs.aws.amazon.com/AmazonS3/latest/dev/llJavaUploadFile.html
For your information my jenkins master runs as "jenkins" user in master and when slave jobs run, they run as "jenkins-slave" user in slave machine. Both as ubuntu machines.
I think i have know the cause of the problem:
Code as in Jenkins plugin:
public void perform(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) {
    ...
    String filePath = workspace.getRemote();
    File file = new File(filePath);
    System.out.println(" File exists? :" + file.exists());
    System.out.println(" File is directory? :"+file.isDirectory());
    System.out.println(" file is file? :"+ file.isFile());
    ....
    }
returns true false true when run on jenkins master. and returns false false false when run on jenkins slave.
When printing workspace.getRemote() returns correct path to file as in filePath. How to fix this.


text:
Q: AllowPartiallyTrustedCallersAttribute error with MVC 2 and .NET 4.0
Assembly 'Foo.BAL, Version=1.0.0.0,
  Culture=neutral, PublicKeyToken=null'
  is marked with the
  AllowPartiallyTrustedCallersAttribute,
  and uses the level 2 security
  transparency model.  Level 2
  transparency causes all methods in
  AllowPartiallyTrustedCallers
  assemblies to become security
  transparent by default, which may be
  the cause of this exception.
Description: An unhandled exception
  occurred during the execution of the
  current web request. Please review the
  stack trace for more information about
  the error and where it originated in
  the code.

I have a standard Business Layer calling into my Data Access Layer, why am I getting this error with MVC 2 and .NET 4.0?
I was using the Enterprise Block, so I ditched it and am now just using standard System.Data.SqlClient APIs to minimize dependencies.
EDIT: If I change the Target Framework on my BAL and DAL projects to 3.5 I do not get the error.

A: The security model changed pretty dramatically between .NET 3.5 and .NET 4.
http://msdn.microsoft.com/en-us/library/dd233103.aspx


text:
Q: Conditional waiting time We got the following problem last week...
A person waiting for the traffic light to turn green. There are two kinds of traffic lights in the city, one that switches color (there is no amber color, just green and red) every 1 minute and one that switches every 2 minutes. We assume it's 50-50% chance it is either one. The person has waited 20 seconds at the traffic light already, and the light is still red. What is the probability that he needs to wait at least another 20 seconds?
I sent in 2 different solutions. One of them was clearly  wrong, but I can't see the problem in my latest solution, which is the following:
For the sake of simplicity, let me assume the waiting times are uniformly distributed. First, we have to calculate the $p_{1}$ probability, that the person stands in front of the 1-minute traffic light, and the $p_{2}$ probability, that he stands in front of the 2-minutes traffic light. Since he has waited already 20 seconds, it is more probable that he stands in front of the 2 minutes long traffic light, than he stands in front of the 1 minute long traffic light (and the 50-50% chances are not applicable anymore). Using Bayes' theorem we get
$$\begin{align*}
p_{1} & =\frac{\int_{20}^{60}\frac{1}{60}dx}{\int_{20}^{60}\frac{1}{60}dx+\int_{20}^{120}\frac{1}{120}dy}=\frac{5}{11},\\
p_{2} & =\frac{\int_{20}^{120}\frac{1}{120}dy}{\int_{20}^{60}\frac{1}{60}dx+\int_{20}^{120}\frac{1}{120}dy}=\frac{6}{11}.
\end{align*}$$
Now we can calculate the asked probability using the law of total probability:
$$\int_{20}^{60-20}\frac{1}{60-20}dx\cdot p_{1}+\int_{20}^{120-20}\frac{1}{120-20}dy\cdot p_{2}=\frac{73}{110}.$$

A: Let $W$ the total amount of time you have to wait for the light to switch; you are interested in the probability
$$
\begin{align}
\mathbf P[W > 40 \, |\,  W > 20] &= \frac{\mathbf P[W > 40,\, W>20]}{\mathbf P[W>20]}\\
& = \frac{\mathbf P[W > 40]}{\mathbf P[W>20]}.
\end{align}
$$
So it willl suffice to calculate $\mathbf{P}[W > t]$ for general values values $t > 0$.
Let $L \in \{1,2\}$ denote the type of light, which switches after 1 or 2 minutes respectively. Then by the law of total probability, and the fact that you're given $\mathbf P[L = 1] = \mathbf P[L=2] = \frac12$,
$$ \mathbf P[W > t] = \frac12 \bigg( \mathbf P[W>t |L=1] + \mathbf P[W>t |L=2]\bigg).$$
As you suppose that you arrive at a uniform time through the cycle, the probability that you have to wait more than $t$ seconds is
$$ P[W > t |L=l] = \max \left(0, \frac{60l - t}{60l}\right).$$
Combining the above:
$$\mathbf P[W > 40] = \frac12 \left(\frac{60-40}{60} + \frac{120-40}{120}\right) = \frac{1}{2}$$
$$\mathbf P[W > 20] = \frac12 \left(\frac{60-20}{60} + \frac{120-20}{120}\right) = \frac{3}{4}$$
And so
$$\mathbf P[W > 40 \, |\,  W > 20] =\frac{2}{3}$$


text:
Q: Basic webpage css and html not loading hey i am a newbie in HTML world, and i am trying to make a simple html webpage with css in it but the webpage is just blank, please help me outand also there are no error in the console.
linking14.html

    <link href="C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css" rel="stylesheet" type="text/css">
                                        <!relation and accordingly type is set>

and linking14.css
#div1{
    width: "300px";
    height: "200px";
    background: "firebrick"; <!#B222222>
}
#div2{
    width:"300px";
    height:"200px";
    background:"skyblue";
}
#div3{
    width:"300px";
    height:"200px";
    background:"slateblue";   <!#6A5ACD>
}
#div4{
    width:"300px";
    height:"200px";
    background:"firebrick" ;  <!#87CEEB>
}
#div5{
    width:"300px";
    height:"200px";
    background:"#1BE7FF";
        float:left;
}
#div6{
    width:"300px";
    height:"200px";
    background:"#052633";
        float:left;
}

A: Dont use quotes " " for css properties' values

#div1{

    width: 300px;
    height: 200px;
    background: firebrick;

}

#div2{
    width:300px;
    height: 200px;
    background:skyblue;
}
#div3{
    width:300px;
    height:200px;
    background:slateblue;   <!#6A5ACD>
}
#div4{
    width:300px;
    height:200px;
    background:firebrick;  <!#87CEEB>
}
#div5{
    width:300px;
    height:200px;
    background:#1BE7FF;
        float:left;
}
#div6{
    width:300px;
    height:200px;
    background:#052633;
        float:left;
}

A: Try changing
<link href="C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css" rel="stylesheet" type="text/css">

to
<link type="text/css" href="css/linking14.css" rel="stylesheet">

Also, use forward slashes. I would not use spaces in my file names, or directory names. Know what your webroot is. It helps when trying to specify relative paths to resources.

A: <link>

This tag's src attribute should not use Windows file path conventions. Use a file path that is relative to your web server. I would not use spaces in file names or folders.
<link type="text/css" href="css\linking14.css" rel="stylesheet">

A: You shouldn't use the windows directory structure as the css link like
C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css

It should be
./css/linking14.css

./ is current folder

A: If your html file is on the same folder of css file, change your link to:
<link href="linking14.css" rel="stylesheet" type="text/css">

If is on subfolder "css", change your link to:
<link href="css/linking14.css" rel="stylesheet" type="text/css">

A: The Problem is that your values for your CSS properties are in quotes "".
#div4{
    width:"300px";
    height:"200px";
    background:"firebrick";
}

Needs to be:
#div4{
    width: 300px;
    height: 200px;
    background: firebrick;
}

Even though your CSS file is linked correctly, the CSS will not display because the quotes will produce an invlaid property value error when the CSS is loaded.

A: If this is supposed to be a comment
<!relation and accordingly type is set>
it should be

And i advice you put all you project files in a Folder for easy linking of css , scripts, images or nay other files
read here`

A: Link relatively to a subfolder with the css file and everything will be fine:
<link href="css\linking14.css" rel="stylesheet" type="text/css">

Just make sure linking14.html and css subfolder are in the same folder.
Also remember that this link is case-sensitive so if you name your css file "Linking14.css" you will also have to use capital L in the html file.


text:
Q: ZMQ Pub Sub - Should it be dropping messages? Was trying to test a simple implementation of pub/sub. I am finding that if I leave subscriber up and send messages, they are not all received by Subscriber. Sometimes all are received, sometimes partial, sometimes whole set is not received.
Run the Subscriber ( leave it running) , followed by running the Publisher multiple times.
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public static void main (String[] args) {

    // Prepare our context and subscriber
    Context context = ZMQ.context(1);
    Socket subscriber = context.socket(ZMQ.SUB);

    subscriber.connect("tcp://localhost:5563");
    subscriber.subscribe("B".getBytes());

    System.out.println("Starting Subscriber..");
    int i = 0;
    while (true) {
        String address = subscriber.recvStr();
        String contents = subscriber.recvStr();
        System.out.println(address+":"+new String(contents) + ": "+(i));
        i++;
    }

}

}
Publisher:
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class TestPublisher {

public static void main (String[] args) throws Exception {
    Context context = ZMQ.context(1);
    Socket publisher = context.socket(ZMQ.PUB);
    publisher.bind("tcp://*:5563");
    System.out.println("Starting Publisher..");
    publisher.setIdentity("B".getBytes());
    publisher.setHWM(1000);
    for (int i = 0; i < 10; i++) {
        Thread.sleep(10l);
        publisher.sendMore("B");
        boolean isSent = publisher.send("We would like to see this:"+i);
        System.out.println("Message was sent "+i+" , "+isSent);
    }

    Thread.sleep(1000);
    publisher.close ();
    context.term ();
}

}

A: After a bit of debugging found the issue to be that when publishing the socket binding took a bit of time and trying to publish just discarded the message.  Adding a simple sleep of 100ms on the initial bind fixed this. In a prod environment, the publisher would be already bound at startup.
Guess it was a one line solution. Now all the messages for a pub/sub with average data volumes works just fine without any data loss. See code snippet update for my publisher below.
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class TestPublisher {

    public static void main (String[] args) throws Exception {
        Context context = ZMQ.context(1);
        Socket publisher = context.socket(ZMQ.PUB);

        publisher.bind("tcp://*:5563");
        System.out.println("Starting Publisher..");
        publisher.setIdentity("B".getBytes());
        // for testing setting sleep at 100ms to ensure started.
        Thread.sleep(100l);
        for (int i = 1; i <= 10; i++) {
            publisher.sendMore("B");
            boolean isSent = publisher.send("X("+System.currentTimeMillis()+"):"+i);
            System.out.println("Message was sent "+i+" , "+isSent);
        }

        publisher.close ();
        context.term ();
    }
}

A: Reliable pub/sub is covered in chapter 5 "Advanced Pub-Sub Patterns" of the zmq guide. But if your server is always up and running in production, you don't need to do anything more than the sleep you've already put in to get your tests working.
If you really wanted to solve the problem of subscribers mising messages, the "Getting an Out-of-Band Snapshot" example in chapter 5 covers it.


text:
Q: Linear Mapping Proof with Kernel & Range Given that $L$ is a linear map such that $L:\Bbb R^n\to \Bbb R^m$, and $\ker(L) = \{\mathbf{0}\}$ and $\operatorname{range}(L) = \Bbb R^m$, show that $m = n$.
So far, I've tried to use the definitions of Kernel, and Range, but nothing is coming to mind. Any idea where I should start? By the way, I haven't learned about 'Dimension' yet.

A: $$\operatorname{dim}(\Bbb R^n) = \operatorname{dim}(\ker(L)) + \operatorname{dim}(\operatorname{Im}(L)) $$
Hence
$n = 0 + m$


text:
Q: What aggregation function to concatenate string like sum() for number in google sheet? Basically I would like to convert the following table

Name
Team

A
X

B
X

A
Y

B
Z

C
X

A
Z

to

Name
Team

A
X,Y,Z

B
X,Z

C
X

It is something like sum(B) group by A but for strings rather than numbers
What kind of Google Sheet formula or Query() can do this? Thanks!

A: =ArrayFormula(
 REGEXREPLACE(
  SPLIT(
   TRANSPOSE(
    QUERY(
     QUERY(
      SPLIT(
       FILTER(A2:A&"♦♥"&B2:B,A2:A<>"")&",",
      "♥"
      ),
      "SELECT MAX(Col2) WHERE Col2 IS NOT NULL GROUP BY Col2 PIVOT Col1",0
     ),,10^7
    )
   ),
   "♦"
  ),
  "^(?:,?\s*)+|(?:,\s*)$|(,)\s*(?:,\s*)*","$1"
 )
)

A: Use this formula-
={UNIQUE(A2:INDEX(A2:A,COUNTA(A2:A))),BYROW(UNIQUE(A2:INDEX(A2:A,COUNTA(A2:A))),LAMBDA(x,JOIN(",",FILTER(B2:B,A2:A=x))))}

*

*Here A2:INDEX(A2:A,COUNTA(A2:A)) will return a array of values as well cell reference from A2 to last non empty cell in column A (Assume you do not have any blank rows inside data). If you have blank row, then you have to use different approach. See this post by @TheMaster

*Then LAMBDA() will apply for each unique value return by INDEX() function to gather corresponded values from B column.

*Inside lambda, JOIN() will concat those filtered values into one single string.

*And finally, by {} results will be combined into on array for output.


text:
Q: How to access Extension method from view context in MVC Core 2 I want access ViewContext on view because I have created extension method and using that extension I want to access Base Controller on View.
Refer to the code below
public static class ViewContextExtension
{
    public static BaseController BaseController(this ControllerContext view)
    {
        BaseController objBaseController = null;
        if (view != null)
            objBaseController = view.Controller as BaseController;
        return objBaseController;
    }
}

I want to use same code in MVC Core 2 but I am not able access it on view side.
Previously I was using it in MVC 5.2.3 E.g.
!ViewContext.BaseController().IsMobileDevice

A: I have found solution for above question. refer below.
Use Name library.
using Microsoft.AspNetCore.Mvc;

Find code below
public static class ControllerContextExtension
    {
        /// <summary>
        /// BaseController
        /// </summary>
        /// <param name="view"></param>
        /// <returns></returns>

        public static BaseController BaseController(this ControllerContext view)
        {
            var factory = CreateControllerFactory();
            return factory.CreateController(view) as BaseController;
        }
        private static DefaultControllerFactory CreateControllerFactory()
        {
            var propertyActivators = new IControllerPropertyActivator[]
            {
                  new DefaultControllerPropertyActivator(),
            };

            return new DefaultControllerFactory(
                new DefaultControllerActivator(new TypeActivatorCache()),
                propertyActivators);
        }
    }

Access above code in view as below .cshtml.
controllerContext.BaseController().IsMobileDevice

Suggest if we can improve above code. Happy coding.


text:
Q: Why does this explicit conversion operator work with g++ but not Visual Studio 2013? The following example contains two templated classes to represent degrees and radians with an explicit conversion operator to cast between them. It compiles and runs with g++ (ideone link) but not with Visual Studio 2013 with Visual C++ Compiler Nov 2013 CTP (CTP_Nov2013) as the platform toolset.
#include <iostream>

static const double PI = 3.14159265358979323846;

// Forward declarations
template< typename T > class radians;
template< typename T > class degrees;

template< typename T >
class degrees
{
    public:
        degrees(const T value)
            : value_(value)
        {}

        template< typename U >
        explicit operator U() const
        {
            return value_ * PI / 180.0;
        }

        T value() const { return value_; }

    private:
        T value_;
};

template< typename T >
class radians
{
    public:
        radians(const T value)
            : value_(value)
        {}

        template< typename U >
        explicit operator U() const
        {
            return (value_* 180.0) / PI;
        }

        T value() const { return value_; }

    private:
        T value_;
};

template< typename T >
std::ostream& operator<<(std::ostream& out, const radians<T>& r)
{
    return out << r.value() << "r";
}

template< typename T >
std::ostream& operator<<(std::ostream& out, const degrees<T>& r)
{
    return out << r.value() << "d";
}

int main()
{
    using degs = degrees<float>;
    using rads = radians<float>;

    auto d = degs{10};
    auto r = static_cast<rads>(d);

    std::cout << d << std::endl;
    std::cout << r << std::endl;

    return 0;
}

The Visual Studio error output:
error C2440: 'static_cast' : cannot convert from 'degrees<float>' to 'rads' degrad.cpp  69  1   degrad
error C3536: 'r': cannot be used before it is initialized   degrad.cpp  72  1   degrad

What's wrong? Why does it work with g++ but not Visual Studio 2013? Which compiler is doing the right thing?

A: A compiler not accepting the metioned snippet is faulty, the code provided is legal and should not yield a fatal diagnostic during compilation. In other words; msvc is doing it wrong.

RELEVANT SECTIONS OF THE STANDARD

12.3.2 Conversion functions [class.conv.fct]

2 A function may be explicit (7.1.2), in which case it is only considered as a user-defined conversion for direct-initialization (8.5). Otherwise, user-defined conversions are not restricted to use in assignments and initializations.

8.5 Initializers [dcl.init]

16 The initialization that occurs in the forms
T x (a);
       T x {a};
as well as in new expressions (5.3.4), static_cast expressions (5.2.9), functional notation type conversions (5.2.3), and base and member initializers (12.6.2) is called direct-initialization.

HOW WOULD I WORK AROUND MSVC++ BEING FAULTY?

*

*use typedef radians<float> rads; instead of using, and either;

*

*remove explicit from your conversion function, or;

*initialize your variable using auto r = rads { d } or auto r = rads (d);.


text:
Q: MFC Dialog Data Validation reverting data on failure Has anyone found a way to revert a value on an editbox if it fails validation? If the value is invalid, it harasses the user with message boxes until they fix it.
void MyDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT_FOO, foo);
    DDV_MinMaxFloat(pDX, foo, 0.001f, 300.0f);
}

A: I was able to do this by writing custom DDX_ handlers.  The application I worked on used a custom control (MCReal derived from CEdit) that would only accept decimal values between an acceptable range defined in the control.  When the user entered a non-decimal value, or, a value outside of the range, the code would pop up a custom message and revert the value entered into the dialog field.
This was accomplished by creating a custom control and a custom validation handler.  Here's what the DDX_ routine looked like:
void AFXAPI_EXPORT DDX_ProcessEditReal(CDataExchange* pDX, int nIDC, MCReal& mcr)
    {
    // prepare edit control
    HWND hWndCtrl = pDX->PrepareEditCtrl(nIDC);

    // does control exist yet?
    if (!IsWindow(mcr.m_hWnd))
        {
// subclass the control
        if (!mcr.SubclassWindow(hWndCtrl))
            {
            ASSERT(false);
// possibly trying to subclass twice?
            AfxThrowNotSupportedException();
            }
        return;
        }

    if (!ValidateMCRealCtrl (mcr, pDX->m_pDlgWnd, (pDX->m_bSaveAndValidate == TRUE)))
        {
        pDX->Fail ();
        }
    }

I used the standard DDX_ routines as a starting point to write a custom version.  The real work is done in ValidateMCRealCtrl():
bool ValidateMCRealCtrl (MCReal &mcRealCtrl, CWnd *pParentWnd, bool bSaveAndValidate)
    {
    CString ctext;
    double val = 0.0, r = 0.0;
    double unit_factor = 0.0;
    bool bDmsrg = false;
    bool rc = false;
    bool ret;

    ...

    if (bSaveAndValidate)               // Move from dialog to data
        {
        if (pParentWnd != nullptr && mcRealCtrl.CancelButtonClicked (pParentWnd))
            {
            return true;
            }

        if (!mcRealCtrl.IsWindowEnabled () || !mcRealCtrl.IsWindowVisible ())
            {
            return true;;    // don't update if not enabled
            }

        mcRealCtrl.GetWindowText (ctext);

        ...

        //  base field validation.
        ret = mcRealCtrl.Validate ();

        if (!ret)
            {
            make_mcreal_str (r, ctext.GetBuffer (mcRealCtrl.maxlen), mcRealCtrl.maxlen, prec, mcRealCtrl.add_plus,
                             mcRealCtrl.m_strip_trailing == TRUE);
            ctext.ReleaseBuffer ();
            InvalidRealField (mcRealCtrl);              // Bad value
            return false;                       // Reset Focus
            }

        ...

        ctext.ReleaseBuffer ();
        mcRealCtrl.SetWindowText (ctext);
        }
    else                                        // Move from data to dialog
        {
        if (mcRealCtrl.angle)                           // If angle field...
            {
            val = mcRealCtrl.value * R2D;    // Convert to degrees
            }
        else
            {
            val = mcRealCtrl.value;    // Use data value
            }

        make_mcreal_str (val, ctext.GetBuffer (mcRealCtrl.maxlen), mcRealCtrl.maxlen, prec, mcRealCtrl.add_plus,
                         mcRealCtrl.m_strip_trailing == TRUE);
        ctext.ReleaseBuffer ();
        mcRealCtrl.SetWindowText (ctext);
        mcRealCtrl.SetLimitText (mcRealCtrl.maxlen);
        }

    ...

    return true;
    }

(Note: I've replaced code that does not pertain to your question with "...")
The work to revert the field value occurs in InvalidRealField ().  That code displays a pop up message and uses the previous value of the field (saved within the actual MCReal control class), before it was changed, to revert the value.
This framework was not written specifically to revert incorrect dialog field values.  It provides much more than that since the control class provides some extra capabilities.   However, having the control defined in a custom class allowed me to provide custom validation.


text:
Q: jquery-UI Dialog resize issue I'm trying to create a "docked" dialog using jquery-ui dialog, and I'm having some issues resizing it.
I have docked it using css when the dialog opens to give it fixed position and appropriate sizing.
$("#test").dialog({
    open: function() {
        $(this).closest(".ui-dialog")
               .css({"float": "right",
                     "position": "fixed",
                     "right": "0px",
                     "left": "auto",
                     "top": "0px",
                     "height":  $(window).height() + "px"
                })
    }

The problem I have is that I can make it narrower (by dragging the left edge of the dialog), but I can't make it wider.
Here is a jsfiddle.
Any help, suggestions would be most appreciated.  Or even a better way to achieve the same effect.

A: Add width: auto in the CSS of the dialog configuration. Like so
...
"top": "0px",
"width": "auto",
"height":  $(window).height() + "px"
...

http://jsfiddle.net/tqa5Lsns/5/
Tried in Chome. The maximum width is limited by the dialog content.