text:
Q: Loop if file exists, go to next iteration I've been trying to search a file in the local directory and if it doesn't exist just to name as in the second block of the if function, and thereon in to iterate and save with the name Rev i (where i is the iteration number 1 to 10), only if i-1 exists. I'm not sure if that makes sense, but I've attached my code (Sorry, it is quite lengthy)
Thanks guys :)
DirFile = Application.ActiveWorkbook.Path & "\" & QuoteNo & " - " & Client & " Rev " & i - 1 & ".docm"
For i = 1 To 10
  If Dir(DirFile) <> "" Then
    With objDoc
      objDoc.Bookmarks("Quote").Select    'To place the Quote Number in the Word Template
      .Application.Selection.Find.Text = "Quote "
      .Application.Selection = QuoteNo & " - Revision " & i
    End With

    With objDoc
      objDoc.Bookmarks("Footer").Select    'To place the Client Name in the Word Template
      .Application.Selection.Find.Text = ""
      .Application.Selection = Client & ": Rev. " & i
    End With

    Worksheets("Dewater - E&Q").UsedRange.Copy
    objDoc.Activate
    objDoc.Application.Run "EQAlign"
    Application.CutCopyMode = False

    objDoc.Application.Run "PrintLayout"

    objDoc.SaveAs FileName:=Application.ActiveWorkbook.Path & "\" & QuoteNo & " - " & Client & " Rev " & i
  Next i
  Exit For
 Else
   With objDoc
     objDoc.Bookmarks("Quote").Select    'To place the Quote Number in the Word Template
     .Application.Selection.Find.Text = "Quote "
     .Application.Selection = QuoteNo
   End With

   With objDoc
     objDoc.Bookmarks("Footer").Select    'To place the Client Name in the Word Template
     .Application.Selection.Find.Text = ""
     .Application.Selection = Client
   End With

   Worksheets("Dewater - E&Q").UsedRange.Copy
   objDoc.Activate
   objDoc.Application.Run "EQAlign"
   Application.CutCopyMode = False

   objDoc.Application.Run "PrintLayout"

   objDoc.SaveAs FileName:=Application.ActiveWorkbook.Path & "\" & QuoteNo & " - " & Client
 End If

A: It looks like the only thing that differentiates the If block from the Else block is the revision number, and that is based on whether or not you find a matching file name. Instead of trying to do everything at once, break it into 2 separate tasks - first find the revision, then do everything else based on what revision number you found. This avoids repeating the majority of the code twice (there are exactly 2 lines that are different other than the file name).
I'd also replace the For loop with a Do Until loop. This matches the semantics of what you are doing better and makes the code more readable as to its intent.  It also combines the test for exiting the loop into the loop itself, so you don't need to test for an exit condition separately:
'Find a unique revision\file name.
Dim revision As Long
With CreateObject("Scripting.FileSystemObject")
    DirFile = QuoteNo & " - " & Client & ".docm"
    Do Until Not .FileExists(.BuildPath(ActiveWorkbook.Path, DirFile))
        revision = revision + 1
        DirFile = QuoteNo & " - " & Client & " Rev " & revision & ".docm"
    Loop
Next

With objDoc
    objDoc.Bookmarks("Quote").Select 'To place the Quote Number in the Word Template
    .Application.Selection.Find.Text = "Quote "
    'This is based on the revision found above.
    If revision = 0 Then
        .Application.Selection = QuoteNo
    Else
        .Application.Selection = QuoteNo & " - Revision " & revision
    End If
End With

With objDoc
    objDoc.Bookmarks("Footer").Select 'To place the Client Name in the Word Template
    .Application.Selection.Find.Text = ""
    'This is based on the revision found above.
    If revision = 0 Then
        .Application.Selection = Client
    Else
        .Application.Selection = Client & ": Rev. " & revision
    End If
End With

Worksheets("Dewater - E&Q").UsedRange.Copy
objDoc.Activate
objDoc.Application.Run "EQAlign"
Application.CutCopyMode = False

objDoc.Application.Run "PrintLayout"
objDoc.SaveAs DirFile

A: I think you are trying to get a functionality similar to break in other java.
VBA does not provide break as any inbuilt keyword.
However there is a smart workaround that I used to use in my projects. Here is how it works.
--Without break
for i = 0 to x
 statement 1
 statement 2
 statement 3
next

In above code suppose you want to go to next iteration after statement 2, you wont be able to.
But try this
for i = 0 to x
    for i = 1 to 1
     statement 1
     statement 2
     '---if you need to break here, just do exit for and you will be out of inner loop (from 1 to 1)
     exit for
     statement 3
    next
   next

Using above method, by employing 1 to 1 for loop, you will be able to exit the inner loop and hence effectively going to the next iteration of the main loop, and thus replicating the break keyword.
Let me know if this is what you needed.


text:
Q: How to write in english in an arabic text? I am writing the abstract for my master thesis and I used this code in order to get three abstracts with three different languages - french, english, and arabic - on the same page. The code works perfectly, but there is one problem: I want to write  some english words in the arabic paragraph, but I can't find a way, that works with this code. I am really in a hurry and need a solution for my problem, since I am graduating very soon.
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[arabic,francais,english]{babel}
\usepackage{ragged2e}
\newcommand{\ab}{\selectlanguage{arabic}}
\newcommand{\fr}{\selectlanguage{french}}
\newcommand{\en}{\selectlanguage{english}}

\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\cfoot{\thepage} }
\pagenumbering{roman}

\begin{document}
\setcounter{page}{4}

\chapter*{ABSTRACT}
\thispagestyle{empty}
 \ab

 \section*{ملخص}
 لكتابة العربية هو نظام الكتابة المستخدم في كتابة اللغة العربية، وفي
 كتابة لغات أخرى في آسيا وإفريقيا كذلك، مثل اللغات الأذرية والسندية
 والبشتوية والفارسية والبنجابية والكردية واللرية والأردية والمندنكوية
  وغيرها
 \newline \newline
 \textbf{الكلمات الرئيسية :  }  العربية
 \fr

 \en

 \section*{Abstract}

  Anyone who reads Old and Middle English literary texts will be familiar
  with the mid-brown volumes of the EETS, with the symbol of Alfred's jewel
embossed on the front cover. Most of the works attributed to King Alfred or
    to Aelfric, along with some of those by bishop Wulfstan and much
  anonymous
  prose and verse from the pre-Conquest period, are to be found within the
  Society's three series; all of the surviving medieval drama, most of the
    Middle English romances, much religious and secular prose and verse
     including the English works of John Gower, Thomas Hoccleve and most of
     Caxton's prints all find their place in the publications. Without EETS
      editions, study of medieval English texts would hardly be possible.
  \newline \newline
  \textbf{\textit{Keywords} : }English, text

   \section*{Résumé}

    La vie en France est très différente de celle au Canada. Ici, il fait
    toujours chaud. Chaque dimanche, nous allons à la magnifique plage de
    Biarritz et nous achetons des glaces après avoir nagé dans la mer.

    Les Français sont très sympathiques et accueillants. Nous parlons
    français lorsque nous sommes dehors, à l'école ou au marché. Cependant,
    nous continuons de parler canadien à la maison, car mes parents ne
    veulent pas que je perde ma langue natale.
  \newline \newline
  \textbf{Mots clés :

   }vie, France.
  \thispagestyle{empty}

  \end{document}

A: We need to use \textLR{text} to write latin words inside arabic paragraph and \textAR{كلمة} for arabic words inside latin paragraph.
Notes:

*

*you need to add \usepackage[LAE,T1]{fontenc} to your preamble

*and may be to replace francais option of bable with french option : \usepackage[arabic,french,english]{babel}

MWE
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[LAE,T1]{fontenc}

\usepackage[arabic,french,english]{babel}
\usepackage{ragged2e}
\newcommand{\ab}{\selectlanguage{arabic}}
\newcommand{\fr}{\selectlanguage{french}}
\newcommand{\en}{\selectlanguage{english}}

\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\cfoot{\thepage}}
\pagenumbering{roman}

\begin{document}
\setcounter{page}{4}

\chapter*{ABSTRACT}
\thispagestyle{empty}
\ab

\section*{ملخص}
 لكتابة العربية هو نظام الكتابة المستخدم في كتابة اللغة العربية، وفي
 كتابة لغات أخرى في آسيا وإفريقيا كذلك، مثل اللغات الأذرية والسندية
\textLR{french or englich words}
 والبشتوية والفارسية والبنجابية والكردية واللرية والأردية والمندنكوية
  وغيرها
 \newline \newline
 \textbf{الكلمات الرئيسية :  }  العربية

 \en
 \section*{Abstract}

  Anyone who reads Old and Middle English literary texts will be familiar
  with the mid-brown volumes of the EETS, with the symbol of Alfred's jewel
embossed on the front cover. Most of the works attributed to King Alfred or
    to Aelfric, along with some of those by bishop Wulfstan and much
  anonymous
  \textAR{كلمات عربية}
  prose and verse from the pre-Conquest period, are to be found within the
  Society's three series; all of the surviving medieval drama, most of the
    Middle English romances, much religious and secular prose and verse
     including the English works of John Gower, Thomas Hoccleve and most of
     Caxton's prints all find their place in the publications. Without EETS
      editions, study of medieval English texts would hardly be possible.
  \newline \newline
  \textbf{\textit{Keywords}: }English, text

\fr
   \section*{Résumé}
    La vie en France est très différente de celle au Canada. Ici, il fait
    toujours chaud. Chaque dimanche, nous allons à la magnifique plage de
    Biarritz et nous achetons des glaces après avoir nagé dans la mer.

    Les Français sont très sympathiques et accueillants. Nous parlons
    français lorsque nous sommes dehors, à l'école ou au marché. Cependant,
    nous continuons de parler canadien à la maison, car mes parents ne
    veulent pas que je perde ma langue natale.

  \textbf{Mots clés : } vie, France.
  \thispagestyle{empty}

  \end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I create a Get request in Node.js to get specific object from json? I am optimizing an api, therefore I need to use only data that is relevant for my analysis. I have created a route that pull out of the objects, but I just need 4 of them (account_manager, fronter, closer, management_fee and sales_date)

I am currently doing this:

A: you can use .find() with projection to retrieve only the relevant field
try this :
const model_CancellationKPI = await CancellationKPI.find({},{
    account_manager:1,
    fronter:1,
    closer:1,
    management_fee:1,
    sales_date:1
}).sort({sales_date:-1})


text:
Q: LWJGL - VBO's and Sprite Classes I've recently found out that using immediate mode when rendering is a big no-no.
So I started looking up on VBO's and VAO's and if I understand correctly, VBO's are objects/buffers which containts data like position, color and so on.
You then put the VBO's in a VAO and render everything in the VAO?
All of this is very new and strange to me, so I was wondering on HOW I would use it, for example, how would a Sprite/Texture class look like, and am I able to modify things like textures once I've started rendering?
I've googled around but haven't found anything I've been able to grasp.
Thank you in advance!

A: Even though the question is quite wierd formulated, I think I get what you want(correct me if I don't)
You have to think of a VAO as a list. In this list, there are a number of attributes, for example positions, texture coordinates, etc(up to 16). Each attribute is stored as an array(VBO). This array is filled with all data of one attribute(e.g. all vertex-positions). The function glVertexAttribPointer describes the properties of one VBO, like the size of one vertex, data type, etc.
On the other hand, there are Uniform variables. These variables are loaded before the draw-call into a slot specified in the shader. These variables stay constant for the whole mesh and are used for values, which stay the same for all vertices(projection, view, etc.). These variables can also be of the datatype Sampler, which represents a texture.
For more detailed information I suggest you read through some samples/tutorials.


text:
Q: Is there normal "set" function (not special form) in Scheme language? Is there normal "set" function (not special form) in Scheme language or some way to implement it?
I'd like to write code something like:
(map (lambda (var)
       (set var 0))
     '(a b c))

which could assign a value (here it is '0') to variables from list (here they are 'a', 'b' and 'c').

A: No.  And to see why there isn't consider something like this:
(define (mutant var val)
  (let ((x 1))
    (set var val)
    x))

Now, what should (mutant 'x 3) return?  If it should return 3, then:

*

*set can't be a function since it needs access to the lexical environment of mutant;

*any kind of reasonable compilation of this function is not possible.

If you want set to be a function then catastrophe follows.  Consider this definition:
(define (mutant-horror f)
  (let ([x 3])
    (f)
    x))

Now, you would think that this can be optimised to this:
(define (mutant-horror f)
  (f)
  3)

But it can't.  Because you might call it like this:
(mutant-horror (λ () (set 'x 3)))

or, more generally, you might call it with a function which, somewhere eventually in some function called indirectly from it might end up saying (set 'x 3).
This means that no binding can ever be optimised at all, which is a disaster.  It's also at least very close to meaning lexical scope is not possible: if as well as set, a function called get exists, which retrieves the binding of a symbol, then you have, essentially, dynamic scope.  That in turn makes things like tail-call elimination at least difficult and probably impossible (in fact set probably does this on its own).
Reasons like this are why even very old Lisps, where things like set did exist and did superficially work, actually made special exemptions for compiled code, where set didn't work (see for instance the Lisp 1.5 programmer's manual (PDF link), appendix D.  This divergence between the semantics of compiled and interpreted code is one of the things that later Lisps and Lisp-related languages such as CL and Scheme did away with.

If instead you want something like Common Lisp's semantics, where the equivalent thing
(defun mutant (var val)
  (let ((x 1))
    (set var val)
    x))

Would return 1 (unless x was a globally (see below) special variable, in which case it might return something else) and as a side-effect modify the value cell of whatever symbol was named by var (which might be x), then, well, Scheme has no notion of that at all, and that's a good thing on the whole.
Note that a modified version of the function will also work for locally special variables:
(defun mutant/local-special (a b)
  (let ((x 1))
    (declare (special x))
    (set a b)
    x))

But in this case you always know there's a special binding happening because you can always see the declaration.

A: When you write something like
(map (lambda (var)
       (set var 0))
     '(a b c))

my first thought was that you try to accumulate unordered sets of the form ( (a 0) (b 0) (c 0) ).
You cannot implement your own setter for any of the internal data structures that are provided by the language as this would mean to write a scheme function to modify some data structures that is implemented in C.  For the data structures implemented in C you need to provide setters written in C -- supposing the lower language is C.
If you want to implement your own setter you either
-- check how the data structure in implmented, and if it's implemented in scheme you will undestand how to modify it
-- define your own data structure using already existing data structures and define setters for it.
A setter that mutates the data structure contains a ! at the end of its name, such as set!, append!, etc.

A: A function call just evaluates a series of instructions in an extended environment, the environment in particular is that of definition extended with its function parameters, this is prety much the case in any language...
If you do this:
(define (my-set var val)
   (set! var val))

you will bind the value of val to var, but only within the scope of the current call on my-set. The reason you cannot write such function has to do with the nature of scheme itself, var is a pointer to whatever you pass in the function, but set! will make this pointer point to something else (still within the scope of my-set). my-set could work if we had some sort of mechanism of using actual pointers, as some low lever languages allow. But scheme does not...
Note that scheme goes very well with the functional programming style as well as recursion, so if you have a need for a function as you described, you are probably "doing something wrong"... :)
You can, however, do this:
(define my-list (list 1 2 3))
(define (my-set a-list a-value)
  (set-car! my-list a-value))

> (my-set my-list 4)
> my-list
(4 2 3)

this works since a-list is a pointer to a cons-cell, set-car! will modify the contents of a cons-cell, but not affect the pointer to which.


text:
Q: How do I bind a comboBox to a different ItemsSource than it's parent DataGrid's ItemSource in a UWP project? I am using MVVM and bind a DataGrid to an ObservableCollection<CustomClass>. I can successfully do that, however I want one of the DataGrid columns to be a ComboBox column, with items source List<ComboBoxValues>. Also another column must be a ToggleSwitch where a Command with parameter is fired when it's IsOn property changes value.
In the ViewModel:
    public ObservableCollection<CustomClass> DataGridData { get; set; } = new ObservableCollection<CustomClass>();
    public List<ComboBoxValues> ListValues { get; set; } = new List<ComboBoxValues>();
    public MyICommand<ToggleSwitch> ToggleSwitchToggled_Command { get; private set; }

The problem I am getting is that the DataGrid's ItemsSource Binding is overriding the Binding path for the CombobBox's ItemsSource, as well as the Command's Binding. ListValues and ToggleSwitchToggled_Command is looked for within DataGridData.
For example:

Error: BindingExpression path error: 'ListValues' property not found on 'UWPProject.ViewModels.DataGridData'. BindingExpression: Path='ListValues' DataItem='UWPProject.ViewModels.DataGridData'; target element is 'Windows.UI.Xaml.Controls.ComboBox' (Name='null'); target property is 'ItemsSource' (type 'Object')

In Xaml:
      <controls:DataGrid GridLinesVisibility="All"
                         AlternatingRowBackground="Gray" AutoGenerateColumns="False"
                         ItemsSource="{Binding DataGridData,Mode=TwoWay}">
            <controls:DataGrid.Columns>
                <controls:DataGridTextColumn Header="TextOne" Binding="{Binding aPropertyOneInDataGridData,Mode=TwoWay}"/>
                <controls:DataGridTextColumn Header="TextTwo" Binding="{Binding aPropertyTwoInDataGridData,Mode=TwoWay}"/>
                <controls:DataGridTemplateColumn Header="ComboBoxHeader">
                    <controls:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <ComboBox ItemsSource="{Binding ListValues}"
                                          SelectedValue="{Binding aPropertyThreeInDataGridData,Mode=TwoWay}"
                                          PlaceholderText="Select Action">
                                </ComboBox>
                            </StackPanel>
                        </DataTemplate>
                    </controls:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
                <controls:DataGridTemplateColumn Header="ToggleSwitch_Header">
                    <controls:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <ToggleSwitch x:Name="ToggelSwitch_Run"
                                              IsOn="{Binding aPropertyFourInDataGridData,Mode=TwoWay}">
                                    <interact:Interaction.Behaviors>
                                        <interactcore:EventTriggerBehavior EventName="Toggled">
                                            <interactcore:InvokeCommandAction Command="{Binding ToggleSwitchToggled_Command}"
                                                                              CommandParameter="{Binding}"/>
                                        </interactcore:EventTriggerBehavior>
                                    </interact:Interaction.Behaviors>
                                </ToggleSwitch>
                            </StackPanel>
                        </DataTemplate>
                    </controls:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>
            </controls:DataGrid.Columns>
        </controls:DataGrid>

So I guess, the question is, how do I split the "source" or path where the Binding is looked for within the parent DataGrid. There are many WPF questions and answers on this, such as here and here. however I can't use DataContext, as I get the error that "DataContext is not supported in a UWP project." I can't find a solution for a UWP project for this problem. Also, I am using MVVM and no code behind, so I don't believe I can use x:Binding. I don't want to use code behind either.
Please help.

A: For your scenario, we suggest use DataGridComboBoxColumn to replace custom celltemplate. Then you could use x:bind markup extension to bind list property directly.
Because DataGridComboBoxColumn ItemsSource property could not access data source sub property directly, If you already make ListValues property for the Page class, you could also use x:bind to access like the following.
<controls:DataGridComboBoxColumn
    Width="*"
    Binding="{Binding p2}"
    Header="Link"
    ItemsSource="{x:Bind ListValues ,Mode=OneWay}"
    Tag="Link"
    />

If you do want to make custom celltemplate, you could insert the ListValues property into your CustomClass. For more detail please refer this case reply.


text:
Q: Which NDB query function is more efficient to iterate through a big set of query results? I use NDB for my app and use iter() with limit and starting cursor to iterate through 20,000 query results in a task.  A lot of time I run into timeout error.
Timeout: The datastore operation timed out, or the data was temporarily unavailable.
The way I make the call is like this:
results = query.iter(limit=20000, start_cursor=cursor, produce_cursors=True)
for item in results:
  process(item)
save_cursor_for_next_time(results.cursor_after().urlsafe())

I can reduce the limit but I thought a task can run as long as 10 mins.  10 mins should be more than enough time to go through 20000 results.  In fact, on a good run, the task can complete in just about a minute.
If I switched to fetch() or fetch_page(), would they be more efficient and less likely to run into the timeout error?  I suspect there's a lot of overhead in iter() that causes the timeout error.
Thanks.

A: Fetch is not really any more efficient they all use the same mechanism, unless you know how many entities you want upfront - then fetch can be more efficient as you end up with just one round trip.
You can increase the batch size for iter, that can improve things. See  https://developers.google.com/appengine/docs/python/ndb/queryclass#kwdargs_options
From the docs the default batch size is 20, which would mean for 20,000 entities a lot of batches.
Other things that can help.  Consider using map and or map_async on the processing, rather than explicitly calling process(entity)  Have a read https://developers.google.com/appengine/docs/python/ndb/queries#map  also introducing async into your processing can mean improved concurrency.
Having said all of that you should profile so you can understand where the time is used.  For instance the delays could be in your process due to things you are doing there.

A: There are other things to conside with ndb like context caching, you need to disable it. But I also used iter method for these. I also made an ndb version of the mapper api with the old db.
Here is my ndb mapper api that should solve timeout problems and ndb caching and easily create this kind of stuff:
http://blog.altlimit.com/2013/05/simple-mapper-class-for-ndb-on-app.html
with this mapper api you can create it like or you can just improve it too.
class NameYourJob(Mapper):

    def init(self):
        self.KIND = YourItemModel
        self.FILTERS = [YourItemModel.send_email == True]

    def map(self, item):
        # here is your process(item)
        # process here
        item.send_email = False
        self.update(item)

# Then run it like this
from google.appengine.ext import deferred
deferred.defer(NameYourJob().run, 50,  # <-- this is your batch
    _target='backend_name_if_you_want', _name='a_name_to_avoid_dups')

A: For potentially long query iterations, we use a time check to ensure slow processing can be handled. Given the disparities in GAE infrastructure performance, you will likely never find an optimal processing number. The code excerpt below is from an on-line maintenance handler we use which generally runs within ten seconds. If not, we get a return code saying it needs to be run again thanks to our timer check. In your case, you would likely break the process after passing the cursor to your next queue task. Here is some sample code which is edited down to hopefully give you a good idea of our logic. One other note: you may choose to break this up into smaller bites and then fan out the smaller tasks by re-enqueueing the task until it completes. Doing 20k things at once seems very aggressive in GAE's highly variable environment. HTH -stevep
def over_dt_limit(start, milliseconds):
    dt = datetime.datetime.now() - start
    mt = float(dt.seconds * 1000) + (float(dt.microseconds)/float(1000))
    if mt > float(milliseconds):
        return True
    return False

    #set a start time
    start = datetime.datetime.now()
    # handle a timeout issue inside your query iteration
    for item in query.iter():
        # do your loop logic
        if over_dt_limit(start, 9000):
            # your specific time-out logic here
            break


text:
Q: Transferring data from Database to multiple pages after selecting Gridview row I have a GridView bound to a Database. I want to click a row and display data from the Database that are not in the GridView to 2 pages. I used the DataNavigationFields but that only display what is in the Gridview.
This is my code for the GridView
<asp:GridView ID="gvStock" CssClass="GV" runat="server" enablepagingandcallbackz="false" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" OnSorting="OnSorting" OnPageIndexChanging="OnPageIndexChanging"  PageSize="20">
      <Columns>
        <asp:HyperLinkField Text="View" DataNavigateUrlFields="pCode,pID,bCode,SBrand" DataNavigateUrlFormatString="ProductDetail.aspx?pCode={0}&pID={1}&bCode={2}&SBrand={3}/>
        <asp:BoundField DataField="pCode" HeaderText="Product Code" />
        <asp:BoundField DataField="pID" HeaderText="PID"/>
        <asp:BoundField DataField="bCode" HeaderText="Bar Code"/>
        <asp:BoundField DataField="SBrand" HeaderText="Brand"/>
    </Columns>
</asp:GridView>


text:
Q: Huggins Displacement Theory and Retrocausality I was looking at the Wikipedia entries on Time Travel and the Grandfather paradox and noticed a paragraph on the so-called Huggins Displacement Theory. I haven't been able to find the source although I assume it's originator was the Victorian astronomer Sir William Huggins. Does anyone know of the precise reference?
Normally sending information into one's past can lead to contradictions. For example based on some condition now I could send a message into my past that prevents that very condition from occurring in my present. Thus sending information into the past, and therefore arbitrarily changing it, seems to be forbidden physically.
However the Huggins Displacement Theory says that there is a loop-hole in this argument (or more accurately a "corner case"!) I could send information along my past lightcone so that if I influence something a year in my past then it must be a light-year away from me. Thus no change in the past has a enough time to travel back to me to cause a contradiction in my present.
For example imagine that I see a stock price going up today. The Huggins Theory says that I can beam knowledge of this stock price rise back in time provided that the message is also displaced by a comparable distance. Thus if I send it back a year in time then it must also travel away from me by a light-year in distance. If my twin gets the message then he might try to profit from the information by sending back a message to me to buy the stock. Unfortunately the message will only get back to me at the instant that the price rises so that neither myself nor my twin will be able to profit from this situation.
Maybe physics does allow information to be sent back in time along a past lightcone so that this effect could be measured. My hunch is that perhaps if one charged up an electrode then electrostatic influences from it might travel back along its lightcone to cause measureable repulsion or attraction on distant electrodes.
I don't think electromagnetic radiation itself could go backwards in time as in principle it could be reflected back onto an observer's past worldline and therefore trigger contradictions in his/her present.

A: My name is Sarah Huggins, about three years ago, my dad wrote an article on Wikipedia to demonstrate how nothing on the site is reliable. That article was The Huggins Displacement Theory.  A couple years later, it's in three books, multiple movie and book reviews, and on physics blogs like this. He took the article down once it got flagged, but I thought I should let you know that it's not a legitimate theory and was made up to teach 12 year old me a lesson.


text:
Q: Custom form on front page redirects on error page I've created a form in a wordpress page (it's hardcoded in it's template.) This form redirects on the same page as it's on. This form also verifies the data right there, in the template file.
If I put this form on any page, it works. But on the front page, when I submit it, I get a page, with the default template, with only "There has been an error." in it's contents.
So how can I make that form work everywhere? How can I use POST data returned by my form on the front page?

A: Seems my form was using some value from the namespace of wordpress. If this problem happens to you, check what id/names you give to your inputs. If it's too general, it might conflict.


text:
Q: SVN error: Subcommand 'help' doesn't accept option '--no-auth-cache' SVN client doesn't works on my CentOS development server
CLI SVN client call produces the same error.
$ svn revert ./foo.txt
Subcommand 'revert' doesn't accept option '--no-auth-cache'
Type 'svn help help' for usage.

$ svn help
Subcommand 'help' doesn't accept option '--no-auth-cache'
Type 'svn help help' for usage.

...

So it produces the same error each time I'm trying to call the svn client from CLI
I'm able to "svn list" and "svn status". But there is no ability to "svn revert" my changes and call "svn help".
I've tried to investigate the problem and found that svn client always tries to use "--no-auth-cache" switch somehow automatically without explicit mention of this switch.
But as this switch is not available for such local commands like "revert" it produces that kind of error.
It looks like this problem somehow related to svn client configuration/setup.
I've even tried to remove the entire client configuration data directory:
$ rm -rf ~/.subversion
but it doesn't helps.

A: Looks like there is a script ( or an alias?) in your path that is calling svn with the extra flag.
For example an alias set like:
alias svn='svn --no-auth-cache'

will give this problem.
Try calling svn directly like /bin/svn or wherever it is installed

A: Are you sure you are using vanilla SVN? Maybe someone setup an alias?
Try apropos svn to find out where your svn client is installed, and execute that file directly (example /usr/bin/svn help).
Check alias for aliases.
Is there anything in ~/.subversion/config? Try renaming or removing that directory.
Edit:
To circumvent possible aliases, try executing \svn instead of svn.

A: Concur with others; the output of type -all svn will indicate which svn command will execute, and which others it shadows.


text:
Q: search dont work well (use storyBoard, coreData) I add search bar follow tutorial but in some reason the search dont show me results.
note: I add "self tableView" in line 2 to avoid error.
maybe this is the problem? or the problem with the IF?
git: https://github.com/dennis87/git_bookList
I think the problem is in this code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    //cell create
    if (nil == cell)
    {
        UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
                                                        reuseIdentifier:CellIdentifier];
    }

    if (tableView == self.searchDisplayController.searchResultsTableView)
    {
        NSLog(@"Configuring cell to show search results");
        Books *book = [[self searchResults]objectAtIndex:indexPath.row];
        [[cell textLabel]setText:[book title]];
    }
    else
    {
        NSLog(@"Configuring cell to show normal data");
        Books *book = [[self fetchResultsController]objectAtIndexPath:indexPath];
        [[cell textLabel]setText:[book title]];
    }
    return cell;
}

I tried put NSlogs and get that this NSLog never printed, so maybe the problems is with the IF?
what I do wrong?
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
    NSLog(@"Previous Search Results were removed.");
    [self.searchResults removeAllObjects];

    for (Books *book in [self.fetchResultsController fetchedObjects])
    {
        if ([scope isEqualToString:@"All"] || [book.title isEqualToString:scope])
        {
            NSLog(@"entered");
            NSComparisonResult result = [book.title compare:searchText
                                                   options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)
                                                     range:NSMakeRange(0, [searchText length])];
            if (result == NSOrderedSame)
            {
                NSLog(@"Adding book.title '%@' to searchResults as it begins with search text '%@'", book.title, searchText);
                [self.searchResults addObject:book];
            }
        }
    }
}

A: There are several problems.

*

*self.searchDisplayController is nil because you haven't set that outlet in the Storyboard. Ctrl-drag from "Books Table View Controller" to "Search Display Controller" and select the "searchDisplayController" outlet.

*Your filterContentForSearchText method checks the value of scope, but that is nil because you have not defined any scopes in the seach bar.

*numberOfSectionsInTableView should return 1 for the search results table view.
If you fix these issues, you should be able to see some search results.
REMARK: This line
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

seems suspicious to me. You ask self.tableView to dequeue a cell even for the search results table view. I have seen this somewhere on SO as a method to use prototype cells with a search display, and it may be correct, but I have a small doubt.
If it is correct, then you don't need the following if (nil == cell) { ... }, because that method always returns a cell from the prototype.
You should also note that inside the  if (nil == cell) { ... } block you assign the value to a local variable cell instead of the variable from the outer scope.


text:
Q: how to make a T-Test in R in GDS files? My project is about predicting biomarker breast cancer.
I use this function to give me a 2x2 matrix:
Table(gpl96)[1:10,1:4]

I want to take this data that represents the samples of genes in GDS and compare the p-value to know if it is normally distributed or not.

A: t.test tests whether there is a difference in location between two samples that adhere to normal distributions.
To approximately check the assumed normality, you might inspect whether outputs from qqnorm seem linear, or use ks.test in conjunction with estimating parameters from observations*:
set.seed(1)
x1 <- rnorm(200,40,10) # should follow a normal distribution
ks.test(x1,"pnorm",mean=mean(x1),sd=sd(x1)) # p: 0.647 [qqnorm(x1) looks linear]
x2 <- rexp(200,10) # should *not* follow a normal distribution
ks.test(x2,"pnorm",mean=mean(x2),sd=sd(x2)) # p: 3.576e-05, [qqnorm(x2) seems curved]

I do not know GEO's Table, but I suggest you might want to use its VALUE columns -and not any 2x2 matrices- as inputs for t.test, qqnorm or ks.test; maybe you might provide some additional illustration of your data by posting outputs of head(Table(gpl96)[1:10,1:4]).
(* After https://stat.ethz.ch/pipermail/r-help/2003-October/040692.html, which also appears to demonstrate the more refined Lilliefors test.)


text:
Q: WordPress foreach loop pulling 3 videos by tag I am trying to get 3 of my videos I tagged in WordPress with the tag "video."
The code in the theme I got doesn't work, I tried to edit it and all but I can't get any further.
global $post;

$tag = get_term_by( 'name', 'video', 'post_tag', 'ARRAY_A' );
$videos = get_posts(array('tag__in' => $tag, 'showposts' => '3'));

foreach($videos as $post) :
    setup_postdata($post);
    echo "
".woo_get_embed('embed', '520', '293')."
";
endforeach;

So, I'm filling up $tag with the "video" tag (post_tag) and make it an array_a. Then, I'm filling up $videos with the posts that have the tag I've put in $tag and I would like the 3 latest.
Then, I foreach the post I got out of $videos I want to embed by using the woo_get_embed function.
Unfortunately, somehow the tag comparison doesn't go well, because it echoes posts without the video tag and because of that it doesn't echo anything at all.

A: tag__in expects an array with ID's
You are giving it an array with all info about the video.
You want 'tag_id' => $tag['term_id']


text:
Q: encrypt and decrypt Django rest framework field as superuser? I read the answers here: plaintext API secret and have read about encryption and decryption of API keys and secrets.
In django Rest Framework,
1- store the API key and Secret in plain text in Django REST framework DB.
2- An endpoint, only accessible by superuser(I could limit this further to IP address), gives all users API keys and secrets to be used in another script. TLS communication.
I am not sure if this is the best approach.


text:
Q: In jssor, is it possible to prevent download of images jssor looks good, but I need a solution where people cannot right-click and save an image.  Ideally, they should also not be able inspect the source and figure out the uri of the photo - but I can possibly live without this.
Are either or both of the above available or implementable in jssor?  Can I add another plugin or code to jssor to disable right-click/download of images?

A: $("#slider1_container").contextmenu(function (event) {
    event.preventDefault();
});


text:
Q: How to rescue from bad url I have a method in my application that finds a photo from the og:image tag of a link that is submitted. In my create action, I use the method photo_form_url, described below.
def photo_from_url(url)
  if !Nokogiri::HTML(open(url)).css("meta[property='og:image']").blank?
    photo_url = Nokogiri::HTML(open(url)).css("meta[property='og:image']").first.attributes["content"]
    self.photo = URI.parse(photo_url)
    self.save
  end
end

However, this produces an error if a bad url is entered.
I tried to rescue as below, but this gives me an "undefined method redirect_to"
def photo_from_url(url)
  begin
    if !Nokogiri::HTML(open(url)).css("meta[property='og:image']").blank?
      photo_url = Nokogiri::HTML(open(url)).css("meta[property='og:image']").first.attributes["content"]
      self.photo = URI.parse(photo_url)
      self.save
    end
  rescue OpenURI::HTTPError
    redirect_to :back, notice: 'link's broken!'
  end
end

What am I doing wrong?

A: According to your answer to my comment, your function photo_from_url is defined in the model. Trying to redirect a user within a model is not possible as shown by the error you are facing.
Bear in mind that your model can be called outside of a browsing session environment. EG:

*

*tests

*rake task

You should thus never, ever put any code that has to do with manipulating the user browser, or the user session within your models. This is the job of the controller.
So what you need to do is simply raise an exception or return a specific value in your model when you are encountering a bad url. And react to that exception / return value in your controller by redirecting the user. This ensure that anything that has to do with the user browser stays in the controller, and that you could implement a different behavior in a rake task if encountering the same error.
So, your model should do stuff, and raise errors when it can't :
# Link.rb
def photo_from_url(url)
  if !Nokogiri::HTML(open(url)).css("meta[property='og:image']").blank?
    photo_url = Nokogiri::HTML(open(url)).css("meta[property='og:image']").first.attributes["content"]
    self.photo = URI.parse(photo_url)
    self.save
  end
end

Your controller should ask your model to do stuff, and deal with the user if there is a problem :
# link_controller
# in create
begin
  link.photo_from_url(url)
rescue OpenURI::HTTPError
   redirect_to :back, notice: 'link's broken!'
end


text:
Q: Google play Android crash - Native crash at /system/lib/libcutils.so I am getting crash reports from Google Play. And all those error occur only on Android v4.4.2.
I don't known what is causing the crash and how do i fix it.
Hope someone can help me.
Log:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/ja3gxx/ja3g:4.4.2/KOT49H/I9500XXUFNI2:user/release-keys'
Revision: '10'
pid: 28579, tid: 28587, name: FinalizerDaemon >>> com.iam.nearer.app <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'heap corruption detected by dlfree'
r0 00000000 r1 00006fab r2 00000006 r3 00000000
r4 00000006 r5 00000000 r6 00006fab r7 0000010c
r8 00000000 r9 72822f48 sl 7282c108 fp 72a90b24
ip 00000016 sp 72a909b8 lr 401090e1 pc 401182d0 cpsr 000f0010
d0 65746564206e6f64 d1 207962206465746c
d2 6dba675800000066 d3 0000010000000072
d4 8000000000000000 d5 0000000000000000
d6 4b83075000000000 d7 42c8000000000003
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000000000000000 d17 0000000000000000
d18 0000000000000000 d19 8000000000000000
d20 0000000000004000 d21 0000000000000000
d22 0000000000004000 d23 8000000000000000
d24 0000000000000000 d25 4008000000000000
d26 3fc2f112df3e5244 d27 0000000000000001
d28 00000000000000e6 d29 00000000000000e5
d30 0000000000000001 d31 0000000000004000
scr 80000010

backtrace:
#00 pc 000222d0 /system/lib/libc.so (tgkill+12)
#01 pc 000130dd /system/lib/libc.so (pthread_kill+48)
#02 pc 000132f1 /system/lib/libc.so (raise+10)
#03 pc 00012027 /system/lib/libc.so
#04 pc 00021b84 /system/lib/libc.so (abort+4)
#05 pc 00012b0d /system/lib/libc.so
#06 pc 0000f22d /system/lib/libc.so
#07 pc 000117ef /system/lib/libc.so (dlfree+1222)
#08 pc 0000dd1f /system/lib/libc.so (free+10)
#09 pc 000af60b /system/lib/libskia.so (SkMallocPixelRef::~SkMallocPixelRef()+10)
#10 pc 0008e1b1 /system/lib/libskia.so
#11 pc 0008e211 /system/lib/libskia.so (SkPixelRef::globalUnref()+20)
#12 pc 000915cf /system/lib/libskia.so (SkBitmap::freePixels()+36)
#13 pc 000915fb /system/lib/libskia.so (SkBitmap::setPixelRef(SkPixelRef*, unsigned int)+26)
#14 pc 0009168f /system/lib/libskia.so (SkBitmap::setPixels(void*, SkColorTable*)+16)
#15 pc 000bfe93 /system/lib/libskia.so (SkPixelRef::unlockPixels()+32)
#16 pc 000915c9 /system/lib/libskia.so (SkBitmap::freePixels()+30)
#17 pc 000917af /system/lib/libskia.so (SkBitmap::~SkBitmap()+4)
#18 pc 0002a5db /system/lib/libhwui.so (android::uirenderer::ResourceCache::destructorLocked(SkBitmap*)+50)
#19 pc 0002a613 /system/lib/libhwui.so (android::uirenderer::ResourceCache::destructor(SkBitmap*)+20)
#20 pc 0001e84c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#21 pc 0004f28b /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#22 pc 00027c60 /system/lib/libdvm.so
#23 pc 0002ec9c /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#24 pc 0002c300 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#25 pc 000618f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#26 pc 00061915 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#27 pc 00056603 /system/lib/libdvm.so
#28 pc 0000d280 /system/lib/libc.so (__thread_entry+72)
#29 pc 0000d418 /system/lib/libc.so (pthread_create+240)

code around pc:
401182b0 e8bd00f0 e3700a01 912fff1e e2600000
401182c0 ea006fce e92d50f0 e3a07f43 ef000000
401182d0 e8bd50f0 e3700a01 912fff1e e2600000
401182e0 ea006fc6 e92d50f0 e3a070ee ef000000
401182f0 e8bd50f0 e3700a01 912fff1e e2600000
40118300 ea006fbe e1520003 8a000102 f5d1f040
40118310 e92d4001 e3520010 3a00003f e3520d0d
40118320 aa00004c e2603000 e213300f 0a00000e
40118330 e0422003 e1b0cf83 44d1e001 44c0e001
40118340 24d1c001 24d1e001 24c0c001 24c0e001
40118350 e1b0ce83 aa000001 f4a1030d f480031d
40118360 3a000001 f421070d f400071d e2522080
40118370 3a000014 f4210acd f4000acd f4210acd
40118380 f4000acd f4210acd f4000acd f4210acd
40118390 f4000acd f4210acd f4000acd f4210acd
401183a0 f4000acd f4210acd f4000acd f4210acd

code around lr:
401090c0 447b4b13 42b3e010 4812d10e 44786a1e
401090d0 ec90f7fb ea42f00d 46224631 e8f2f00f
401090e0 d00a3001 e00b2400 2b00681b 480ad1eb
401090f0 44782403 ec7ef7fb f001e002 6804fa87
40109100 fa84f001 46206005 bf00bd70 0003c2e2
40109110 0003c2d6 0003c2ce 0003c2aa bf7ef7ff
40109120 4a3e4b3d 43f0e92d 4606b08b 447b460d
40109130 6823589c 930946a1 fa68f001 8000f8d0
40109140 d0482d00 f0104628 280ff8af d8444604
40109150 ffe4f7ff d1064286 4629200f e90cf00d
40109160 d03c2800 482ee02e f7fb4478 482debc2
40109170 e0154478 d11342b0 482b6a06 f7fb4478
40109180 4a2aec3a 46332120 447aa801 fdd4f013
40109190 a8012101 f8d6f01b 46061c42 e011d104
401091a0 28006800 e02cd1e6 46294630 f00d4622
401091b0 1c43e948 d11e4607 fa28f001 29046801

Similar errors have occurred for other apps, which are caused by Android OS bugs.

A: Remove your bitmap.recycle() calls and set all your bitmaps = null when your done using them. Let the GC clear the bitmaps.


text:
Q: WCF NET TCP Service listening to thousands of remote computers We have a NET TCP WCF service host running on a windows service getting thousands of messages per minute.
What WCF parameters should we consider changing when moving from getting all the messages from few computers, to getting all the messages from the various source computers directly?
Current:   3 computers --> WCF service

Propose:   5000 computers --> WCF service
Overall load is the same on both cases ~ 30,000 messages/min


text:
Q: Application keeps force closing when I try to run in emulator using Eclipse. Help needed So I am sort of a noob to java and programming at that. I am picking it up however. Recently I have tried to run my app on an emulator but it force closes. It is probably my fault but i can't find any errors. So i decided to turn to you guys since you seem experienced. Any help would be appreciated.
This is the manifest file:
 <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.MrNom"
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="preferExternal">

    <application android:icon="@drawable/icon"  android:label="@string/app_name"
                 android:debuggable="true">
        <activity android:name=".Mr.NomActivity"
                  android:label="@string/app_name" android:screenOrientation="landscape"      android:configChanges="keyboard|keyboardHidden|orientation">
            <intent-filter>

                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
</manifest>

This is the XML:
 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:weightSum="1">
    <TextView android:layout_width="fill_parent" android:textSize="30dp" android:text="Mr. Nom"    android:layout_weight="0.05" android:gravity="center" android:layout_height="wrap_content" android:textStyle="bold"></TextView>
    <Button android:layout_width="160dp" android:text="Play" android:id="@+id/Button02" android:clickable="true" android:layout_weight="0.06" android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="25dp"></Button>
    <Button android:layout_width="160dp" android:text="Settings" android:id="@+id/Button03" android:clickable="true" android:layout_height="wrap_content" android:textSize="25dp" android:layout_gravity="center" android:layout_weight="0.06"></Button>
    <Button android:layout_width="160dp" android:text="Help" android:id="@+id/Button01" android:clickable="true" android:layout_weight="0.06" android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="25dp"></Button>
    <Button android:layout_width="160dp" android:id="@+id/button1" android:clickable="true" android:layout_weight="0.06" android:layout_height="wrap_content" android:textSize="25dp" android:layout_gravity="center" android:text="High Scores"></Button></LinearLayout>

So once again I'm new to this but I thought you guys might need this code. Just let me know if you need anything else.
Heres the activity code:
package Mr;

import com.MrNom.R;
import android.app.Activity;
import android.os.Bundle;

public class NomActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}
When I tried to run the app this was red in logcat.
07-29 18:30:29.347: ERROR/AndroidRuntime(333): FATAL EXCEPTION: main
07-29 18:30:29.347: ERROR/AndroidRuntime(333): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.MrNom/com.MrNom.Mr.NomActivity}: java.lang.ClassNotFoundException: com.MrNom.Mr.NomActivity in loader dalvik.system.PathClassLoader[/data/app/com.MrNom-1.apk]
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.os.Looper.loop(Looper.java:123)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at java.lang.reflect.Method.invokeNative(Native Method)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at java.lang.reflect.Method.invoke(Method.java:521)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at dalvik.system.NativeStart.main(Native Method)
07-29 18:30:29.347: ERROR/AndroidRuntime(333): Caused by: java.lang.ClassNotFoundException: com.MrNom.Mr.NomActivity in loader dalvik.system.PathClassLoader[/data/app/com.MrNom-1.apk]
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-29 18:30:29.347: ERROR/AndroidRuntime(333):     ... 11 more
So to clarify it should look like this:
package com.MrNom;

import android.app.Activity;
import android.os.Bundle;

public class NomActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }

}

A: This line:
import com.MrNom.R;

should be
package com.MrNom

And remove the package Mr;
Also in the manifest xml file this line:
    activity android:name=".Mr.NomActivity"
Should be:
    activity android:name="Mr.NomActivity"


text:
Q: Change line thickness in thmtools I am using the thmbox=M option with thmtools and I would like to change the line thickness of the box. I found how to change the colour in here: thmbox color bar. Is there an easy modification of what is in that post to apply here?!

A: All thmtools does is passing on the value of the thmbox key as the optional argument to thmbox' defining command, so
\declaretheorem[thmbox={style=M, thickness=10pt}]{foo}

and you're ready to go. (Apart from the fact that 10pt would be exceedingly ugly... )

A: If you just want to play with the thickness of the line, place this in your preamble:
\newtheorem[style=M, thickness=1pt]{theoremExa}{Example}[chapter]

If you also want to change the colour, you can use this piece of code provided by Marco Daniel in this answer. Here is a MWE with the red colour and 2pt thickness:
\documentclass{book}

\usepackage{thmbox}
\usepackage{xcolor}

\makeatletter
\def\thmbox@color{black}
\define@key{thmbox}{color}{\def\thmbox@color{#1}}
\def\thmbox@head#1{%
  \par\noindent\vbox{%
    \setbox\thmbox@box@=\hbox{%
      \vrule width 0mm height 0mm depth \thmbox@vskip%
      #1}%
    \copy\thmbox@box@%
    \ifthmbox@underline%
       \color@begingroup\color{\thmbox@color}\hrule width \wd\thmbox@box@ height \thmbox@thickness\color@endgroup%
    \fi}%
  \hrule height 0mm\relax}
\def\thmbox@put#1{
  \vskip\z@%
  \noindent%
  \hbox{%
    {\dimen0=\thmbox@leftmargin%
     \advance\dimen0-\thmbox@hskip%
     \advance\dimen0-\thmbox@thickness%
     \hskip\dimen0}%
    \color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
    \hskip\thmbox@hskip%
    \box#1%
    \ifx\thmbox@style L%
      \hskip\thmbox@hskip%
      \color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
    \fi}%
  \par\nobreak}
\def\thmbox@tail{%
  \hrule height 0mm%
  \ifx\thmbox@style M%
    \thmbox@dim=1cm%
  \else\ifx\thmbox@style L%
    \thmbox@dim=\hsize%
    \advance\thmbox@dim-\thmbox@leftmargin%
    \advance\thmbox@dim-\thmbox@rightmargin%
    \advance\thmbox@dim2\thmbox@hskip%
    \advance\thmbox@dim2\thmbox@thickness%
  \fi\fi%
  \noindent%
  {\dimen0=\thmbox@leftmargin%
   \advance\dimen0-\thmbox@hskip%
   \advance\dimen0-\thmbox@thickness%
   \hskip\dimen0}%
  \color@begingroup\color{\thmbox@color}\vrule width \thmbox@dim height \thmbox@thickness\color@endgroup%
  \par}
\makeatother

\newtheorem[style=M, thickness=2pt, color=red]{theoremExa}{Example}[chapter]
\begin{document}
 \begin{theoremExa}[Example Bla]
 Here is my customised theorem.
 \end{theoremExa}
\end{document}

for the following output:


text:
Q: CMake on Ubuntu: Could NOT find Threads (missing: Threads_FOUND) I'm trying to compile Onx and I am receiving a CMake error message.
I am receiving this error on my ubuntu 20.04 lts:
Could NOT find Threads (missing: Threads_FOUND)
I'm waiting your comments. Thanks for help


text:
Q: Pass 1 float from array to vertex shader for every vertex I have to draw a sphere (I already managed to do this) using it's parametric formula.
I also have to generate an array with as many values as there are vertices (I also managed to do this). The values need to range from 0.95 to 1.05.
I have to pass this array to the vertex shader as a uniform and have to multiply every vertex of the sphere with the corresponding value from the array (this should create an Earth-looking sphere).
The problem is that I can't seem to pass the array as a uniform and even if I could, I don't understand how I could choose the corresponding value from the array that I have to multiply it with.
in vec3 pos;
in vec3 col;
uniform float arr[];

out vec3 out_col;

uniform mat4 mtr;

void main()
{
    gl_Position = mtr * vec4(pos, 1) * vec4(arr[someIndex], 1);
    out_col = col;
}

arr[] is the array containing the values for every vertex. pos is the current vertex and col is the current color. What should someIndex be and how can I pass an array as uniform?


text:
Q: How to align shapes using VBA Loop My code loops a range of cells, which in return adds a shape with the cells value if the cell value within the range is greater than 1.
I would like each newly added shape to be evenly positioned to the right of the first added shape.
Currently my code stacks every shape on top of each other.
Code
Sub foo()
Dim oval As Shape
Dim rCell As Range
Dim rng As Range
Dim h As Integer
Dim w As Integer
Dim x As Long
Dim shp As Object

h = h + 50 + 2
w = w + 200 + 2
Set rng = Sheet1.Range("A1:A7")

For Each rCell In rng

If rCell > 0 Then

    Set oval = ActiveSheet.Shapes.AddShape(msoShapeOval, h + 1, w + 1, 75, 80)

With oval
    .Line.Visible = True
    .Line.Weight = 8
    .Fill.ForeColor.RGB = RGB(255, 255, 255)
    .Line.ForeColor.RGB = RGB(0, 0, 0)
    .TextFrame.Characters.Caption = rCell.Value
    .TextFrame.HorizontalAlignment = xlHAlignCenter
    .TextFrame.VerticalAlignment = xlVAlignCenter
    .TextFrame.Characters.Font.Size = 22
    .TextFrame.Characters.Font.Bold = True
    .TextFrame.Characters.Font.Color = RGB(0, 0, 0)
End With

End If

    Next rCell

End Sub

Screenshot

A: Some math should do the trick. The 95 is the width of 75 plus a margin of 20. Adjust as needed.
For Each rCell In rng
    If IsNumeric(rCell.Value) Then
        If rCell.Value > 0 Then
            Dim counter As Long
            counter = counter + 1

            Set oval = ActiveSheet.Shapes.AddShape(msoShapeOval, h + 95 * (counter - 1), w + 1, 75, 80)

            With oval
                .Line.Visible = True
                .Line.Weight = 8
                .Fill.ForeColor.RGB = RGB(255, 255, 255)
                .Line.ForeColor.RGB = RGB(0, 0, 0)
                .TextFrame.Characters.Caption = rCell.Value
                .TextFrame.HorizontalAlignment = xlHAlignCenter
                .TextFrame.VerticalAlignment = xlVAlignCenter
                .TextFrame.Characters.Font.Size = 22
                .TextFrame.Characters.Font.Bold = True
                .TextFrame.Characters.Font.Color = RGB(0, 0, 0)
            End With
        End If
    End If
Next rCell

Note that Shapes.AddShape has the arguments Type, Left, Top, Width, Height, so using h and w for Left and Top is a little confusing.


text:
Q: HTML onclick function doesn't call through PHP echo Originally I had the following to produce a menu using PHP:

   <?php
         $items = mysqli_query($con, "SELECT DISTINCT item FROM table");
         while ($row = mysqli_fetch_array($items)) { ?>

<a href='#' onclick='myFunction(<?php echo $row['item'] ?>)'><?php echo $row['item'] ?>
<? php
         } ?>

I had this code inside an index.php page surrounded by html. The is to produce a menu from items in a database. In this form it worked fine and called 'myFunction(string)' which is in a seperate global.js file.
function myFunction(string) {
$('#container').load('php/getContent.php', {string: string});
}

getContent.php is similar to the php above. except it uses a where clause in the query which it extracts from the string.

So my problem arose when I went to clean up the code which produces the menu.
I added the following function to global.js
$(document).ready(function() {
    $('#menu').load('php/getMenu.php');
});

getMenu.php looks like this:
$items = mysqli_query($con, "SELECT DISTINCT item FROM table");

echo "
";
while ($row = mysqli_fetch_array($items) {
    echo "
".$row['item']."
";
}
echo "
"

This works correctly in producing the menu items as before except the onclick function no longer works.
Placing an anonymous inline onclick function did work however so I figured it may be the $(document.ready() inside the global.js file causing issues. I moved the $(document).ready() back into index.php in a script tag to check, still not working.
I originally had the script tags as the last elements in the body so I moved them up into the header to check if that changed anything but that also didn't work.
the header tag looks as follows:

all my php files are in a subfolder called php and all my js files in a subfolder called scripts.

So firslty, does it matter if I have the $(document).ready() in a js file with other functions, does that mess with the other functions?
Secondly any idea on why the function is no longer being called?
Thanks in Advance.

A: This is a problem I had too. When you generate elements after the DOM fully loads the onclick wont work anymore.
In my case I used:
$('parent of element which is in DOM').delegate('element', 'event', function(){
});

And worked.
Take a look at jQuery API http://api.jquery.com/delegate/
In your case your php should be like:
$items = mysqli_query($con, "SELECT DISTINCT item FROM table");

echo "
";
while ($row = mysqli_fetch_array($items) {
    echo '
'.$row['item'].'<input class="sql_input" hidden="hidden" value="'.$row['item'].'">
';
}
echo '
';

And your Javascript:
function load_file(value){
   $('#container').load('php/getContent.php', {string: value});
}

$('parent of .tab').delegate('.tab li a', 'click', function(){
   var get_value = $(this).find('.sql_input').val();
   load_file(get_value);
});


text:
Q: how to read a multipage API using react using Axios so im trying to use this api that even if you call just the element/people he returns only ten people instead of the 82 total i want  , so i have to slowly go through them all and keep adding the values on a list, i wanted to have a list with all the character names and one with all the other results,so i did this (im using SWAPI star wars api btw)
import React, { useEffect, useState } from "react";
import api from "./components/services/api";

export default function App() {
  const [listPeople, setList] = useState();
  const [page,setPage]=useState(1)
  const [names,setNames]=useState([])
  const [full,setFull]=useState([])
  const [finished,setFinished] =useState(false);
  useEffect(() => {
    api
      .get(`people/?page=${page}`)
      .then((response) => setList(response.data))
      .catch((err) => {
        console.error("an error occured: " + err);
      });
  },[page]);
  function  generateList() {
    if(listPeople.next != null) {
      var i=0
      while(i <9) {
        setPage(page +1)
        setNames(names.concat(listPeople.results.map((res) => (res.name))))
        setFull(full.concat(listPeople.results))
        i++
      }
    }
    else  {
      if(!finished) {
        setNames(names.concat(listPeople.results.map((res) => (res.name))))
        setFull(full.concat(listPeople.results))
        setFinished(true)
      }
    }
    console.log(names)
    console.log(full)
  }
  return (
    <>
    <button onClick={generateList}>click here!</button>

    </>
  );
}

as you can see i need to press a button everytime i want to get the rest of the elements in the api(first 10 buttons then 20.. until 82)
what i wanted was to click the button once and have the whole list(of only the names and of all the results) already in an array/object
but if i try to do that using a  while loop the hoops it doesnt work,i ve tried using mapp but cant think of a way to apply it in this situation and the few that i did got me the same effect, and there is no numeric atribute on the api that shows the number of  pages, just one that says next with the next page url, like so
ex:https://swapi.dev/api/people
"count": 82,
    "next": "https://swapi.dev/api/people/?page=2",
    "previous": null,
    "results": [
        {
            "name": "Luke Skywalker",
            "height": "172",
            "mass": "77",
            "hair_color": "blond",
            "skin_color": "fair",
            "eye_color": "blue",
            "birth_year": "19BBY",
            "gender": "male",
            "homeworld": "https://swapi.dev/api/planets/1/",
            "films": [
                "https://swapi.dev/api/films/1/",
                "https://swapi.dev/api/films/2/",
                "https://swapi.dev/api/films/3/",
                "https://swapi.dev/api/films/6/"
            ],
            "species": [],
            "vehicles": [
                "https://swapi.dev/api/vehicles/14/",
                "https://swapi.dev/api/vehicles/30/"
            ],
            "starships": [
                "https://swapi.dev/api/starships/12/",
                "https://swapi.dev/api/starships/22/"
            ],
            "created": "2014-12-09T13:50:51.644000Z",
            "edited": "2014-12-20T21:17:56.891000Z",
            "url": "https://swapi.dev/api/people/1/"
        }, ... until the 10th person

again i just want to press the button and have the entire list in my console.log, and the '/people' adress doesnt return everything.
im still a beginner at react so every help is appreciated, thanks :)


text:
Q: Smallest C++ Program that will compile What is the smallest C++ program that will compile without any error?
Functionality is not important.

A: I believe that this is it
int main(){}

A:
This will compile, but not link. ;)
~/blargh
16:48:24 $ cat t.cpp

~/blargh
16:50:21 $ clang++ -c t.cpp
~/blargh
16:50:28 $

A: The following should be the shortest:
int main(){}

Note that omitting the return value without invoking undefined behaviour is possible only with main().


text:
Q: UIPageViewController viewControllerAfterViewController never called I have a UIPageViewController that I've set up with an array as the datasource. I see the first page fine and the presentation count dots show up correctly, but when I try to drag the to the next page nothing happens. So I set up some breakpoints in the viewControllerAfterViewController as well as Before methods and they never get called on. The other dataSource methods for presentationCountForPageViewController get called on fine.
Any idea what I am missing? I've been going line by line with examples I've found on the web but can't find anything.
- (void)viewDidLoad
{
   [super viewDidLoad];

   UIPageViewController *pageController = self.pageController;
   pageController.dataSource = self;

   UIChildViewController *initialViewController = [self viewControllerAtIndex:0];
   NSArray *viewControllers = @[initialViewController];
   [pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];

   [self addChildViewController:pageController];
   [self.view addSubview:pageController.view];
   [pageController didMoveToParentViewController:self];
  }

- (UIPageViewController *)pageController
{
   return !_pageController ? _pageController =
      ({
          UIPageViewController *value = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
                                                                  navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal
                                                                                options:nil];
          value.view.frame = self.view.bounds;
          value;
   }) : _pageController;
}

- (UIViewController *)pageViewController:(UIPageViewController *)pa geViewController viewControllerBeforeViewController:(UIChildViewController *)viewController
{
   NSUInteger index = viewController.index;
   return (index == 0 ) ? nil : [self viewControllerAtIndex:--index];
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIChildViewController *)viewController
{
   NSUInteger index = viewController.index;
   index++;
   return (index == self.myDataSourceArray.count) ? nil : [self viewControllerAtIndex:index];
}

- (UIChildViewController *)viewControllerAtIndex:(NSUInteger)index
{
   UIChildViewController *childViewController = [UIChildViewController new];
   childViewController.view.frame = self.pageController.view.bounds;
   childViewController.index = index;

   ...

   return childViewController;
}

- (NSInteger)presentationCountForPageViewController:   (UIPageViewController *)pageViewController
{
   // The number of items reflected in the page indicator.
   return self.myDataSourceArray.count;
}

- (NSInteger)presentationIndexForPageViewController:(UI PageViewController *)pageViewController
{
   // The selected item reflected in the page indicator.
   return 0;
}

A: The problem was that in including my UIViewController subclass which encapsulated the UIPageViewController, I forgot in the parent view controller's viewDidLoad to include addChildViewController and didMoveToParentViewController
[self addChildViewController:myViewController];
[self.view addSubview:myViewController.view];
[myViewControllerController didMoveToParentViewController:self];

Fixed the problem.


text:
Q: When does conjugating one generator in $F_2$ give an automorphism? Let $F_2$ be the free group on generators $x,y$.
For $w\in F_2$, consider homomorphisms $\alpha_w : F_2\rightarrow F_2$ sending
$$\alpha_w : \left\{\begin{array}{rcl}
x & \mapsto & x \\
y & \mapsto & wyw^{-1}
\end{array}\right.$$
For which $w$ is $\alpha_w$ an automorphism? Is there a name for the set of $\alpha_w$'s which are automorphisms?

A: Using a theorem of Lyndon Schupp in combinatorial group theory, we know that :
$$Out(\mathbb{F}_2)\text{ is isomorphic to } Aut(\mathbb{F}_2^{Ab}) $$
Furthermore $\mathbb{F}_2^{Ab}=\mathbb{Z}^2$ hence :
$$Aut(\mathbb{F}_2^{Ab})=GL_2(\mathbb{Z}) $$
Now the correspondance can be made explicit, if $\psi\in Aut(\mathbb{F}_2)$ then write the image of the two generators (say $a$ and $b$) in terms of maybe non reduced words into those generators :
$$\psi(a)=a^{k_1}b^{l_1}...a^{k_s}b^{l_s} \text{ and }\psi(b)=a^{k_1'}b^{l_1'}...a^{k_{s'}'}b^{l_{s'}'} $$
I claim now that through the isomorphism, $[\psi]$ will be sent to the matrix :
$$\begin{pmatrix}\sum_{i=1}^sk_i&\sum_{i=1}^{s'}k_i'\\\sum_{i=1}^sl_i&\sum_{i=1}^{s'}l_i'\end{pmatrix} $$
Now apply this to $\alpha_w$, that is if $\alpha_w$ is an automorphism then its outer-class is represented by $I_2$ (the identity matrix). So that if $\alpha_w$ is an automorphism then it is necessarily inner.
Hence there should be a word $v$ such that $vxv^{-1}=\alpha_w(x)=x$ and $vyv^{-1}=\alpha_w(y)=wyw^{-1}$ Hence we should have :
$$v\in Z_{\mathbb{F}_2}(x)\text{ and } w^{-1}v\in Z_{\mathbb{F}_2}(y)$$
Since $Z_{\mathbb{F}_2}(x)=<x>$ and  $Z_{\mathbb{F}_2}(y)=<y>$ it follows that we should have :
$$v=x^k\text{ and } w=x^ky^l $$
Hence we have shown that for any $\alpha_w$ group automorphism, $w=x^ky^l$ and then $\alpha_w$ is the conjugation by $x^k$. Reciprocally every conjugation by $x^k$ is of this form and we can conclude that the automorphism you are highlighting are just inner automorphism by $x^k$.


text:
Q: Show that for a rational $a$ there is a finite amount of rationals $\frac{p}{q} \neq a$ such that $|a - \frac{p}{q}| < \frac{1}{q^2}$ I want to shot that there for rational number $a \in \mathbb{Q}$, there is a finite amount of rational numbers $\frac{p}{q} \neq a$ such that $|a - \frac{p}{q}| < \frac{1}{q^2}$.
I know that for a irrational number $\alpha$, there are infinite such rationals, and it follows as a correlation from Dirichlet's approximation theorem.
However, I am not sure how it fails when $a$ is rational.
Help would be appreciated.

A: Let $a=m/n$. Then
$$\left|a-\frac pq\right|=\left|\frac mn-\frac pq\right|=\frac{|mq-np|}{nq}.$$
Since this is a nonnegative integer over $nq$, it is either $0$ or $\geq \frac{1}{nq}$. Can you finish from here?


text:
Q: Multiline titles in TeeChart Legend? Is it possible to have the title of a series span more than one line in the chart legend? I can't seem to find a way to get a reference to the UILabel, or whatever control is used to display the series name within the legend.

A: What about subscribing the GetLegendText event in your chart and add line breaks in the text (e.Text argument)?


text:
Q: difference between static block vs main method in java my question is simple, why we need the main() method?. jvm call public static void main() method to start application. as well as static block also executed after classes loaded. without main() the program gives main method not found exception but you can avoid this error by adding System.exit(0) line at the static block after your statements, then whats the point of main() method?. is there any functionality's not available without main method?
class A{

public static void main(String ar[]){
.....
....
}

// VS

static{
....
...

System.exit(0);  // to avoid main method not found error

}

}

A: Certainly you lose some functionality.  How are you going to get the command-line arguments?  There might be some clever trick to do so, but there's no need to make some hack for it.
The reason to have a standard main method across all applications is so that the JVM always knows where to look in a project for the block to begin execution.  You have to have that standardized somewhere.

A: The static block is not executed after the class has been loaded.  It is executed while the class is being loaded.  Until the static block exits, the class is not fully constructed.
-------- Edit ----------
@sky, try running this program, and see what happens:
class Foo {
    static String name = "Michael";
    static {
        Thread t = new Thread(new Bar());
        t.start();
        try {
            Thread.sleep(30000);
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
    public static void main(String[] args) {
    }
}

class Bar implements Runnable {
    public void run() {
        System.out.println(Foo.name);
    }
}

A: Well I haven't given much thought to the question in scene however just by looking at the face of it, you cannot at least have command line arguments without a main() method.

A: As mentioned there is the issue where command line arguments are impossible or needlessly difficult to access.
There are also the issue of programs with multiple mains in different classes. Sometimes I will create a separate main method to do initial testing of a new class. If I had to put that within the static initialisation block then every intended start point of the program would run whenever that class is loaded; this would be a new source of bugs for no benefit.
It also adds one more complexity of class initialisation that anything below the static initialisation block will have their default value rather than their set values. For example the following prints 0.
static{
    HackedStaticBlock h=new HackedStaticBlock();
}
static int badNumber=17;

public HackedStaticBlock() {
    System.out.println(badNumber);

}

This is something you sometimes need to worry about with static initialisation but this means you need to worry about it in every program.


text:
Q: nested mapping in Spring Boot does not load static content So it's my html file:
getPass.html
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <link rel="shortcut icon" type="image/jpg" href="../static/image/PUB_PIX_LION_K.jpg"
          th:href="@{image/PUB_PIX_LION_K.jpg}">
    <link href="../static/css/style.css"  th:href="@{css/style.css}" rel="stylesheet" media="screen"/>

    <title>PP-Secure</title>

Password:

And it is my Controller:
    @RequestMapping("password/link/{enterId}")
    public ModelAndView getPasswordById(@PathVariable("enterId") UUID uuid) {
        ModelAndView mv = new ModelAndView();

        if(passwordService.hasKey(uuid)) {
            String passText = passwordService.getPassTextById(uuid).getPassText();
            mv.addObject("dispPass",passText);
            mv.setViewName("getPass");
        } else {
            String error = "No password available.";
            mv.addObject("dispError",error);
            mv.setViewName("getPass");
        }

        passwordService.removePasswordAfterVisit(uuid);

        return mv;
    }

The problem is when i use this URL (the Argument of the above @RequestMapping() ) the html page use neither of .css (styling) and the .jpg (logo in browser tab) so i tried everything and finally wrote a test mapping :
    @GetMapping("test")
    public String showGetPass(){
        return "getPass";
    }

And everything is ok with localhost:8080/test , i mean the logo appears in browser tab and the styling is there from .css
So my fast solution was that i packed all my .css file in  tag in getPass.html ... but i was curious to know:
Is there any problem to have UUID as endpoint of a URL for a Get Request? I mean, does it make a problem for linking the css file in html file?
UPDATE:
It is working when i removed password/link/ in @RequestMappingbut what is wrong with xzy/jkj/{id} ?

A: Solved!
the only thing i needed was a /!!!! behind the css : th:href="@{css/style.css}" so th:href="@{/css/style.css}"
Why on earth it makes difference between @GetMapping("xxx")and @GetMapping("nested/xxx")... !!!!


text:
Q: How to kill a process by reading from pid file using bash script in Jenkins? Inside Jenkins, I have to run 2 separate scripts: start.sh and stop.sh. These scripts are inside my application which is fetched from a SCM . They are inside same directory.
The start.sh script runs a process in the background using nohup, and writes the processId to save_pid.pid. This script works fine. It successfully starts my application.
Then inside stop.sh, I am trying to read the processId from save_pid.pid to delete the process. But,I am unable to delete the process and the application keeps running until I kill the process manually using: sudo kill {processId}.
Here are the approaches that I have tried so far inside stop.sh but none of these work:
kill $(cat /path/to/save_pid.pid)

kill `cat /path/to/save_pid.pid`

kill -9 $(cat /path/to/save_pid.pid)

kill -9 `cat /path/to/save_pid.pid`

pkill -F /path/to/save_pid.pid

I have also tried all of these steps with sudo as well. But, it just doesn't work. I have kept an echo statement inside stop.sh, which prints and then there is nothing.
What am I doing wrong here ?
UPDATE:
The nohup command that I am using inside start.sh is something like this:
nohup deploy_script > $WORKSPACE/app.log 2>&1 & echo $! > $WORKSPACE/save_pid.pid

Please Note:

In my case, the value written inside save_pid.pid is surprisingly
  always less by 1 than the value of actual processId. !!!

A: I think the reason why this happens is because you are not getting the PID of the process that you are interested in, but the PID of the shell executing your command.
Look:
$ echo "/bin/sleep 10" > /tmp/foo
$ chmod +x /tmp/foo
$ nohup /tmp/foo & echo $!
[1] 26787
26787
nohup: ignoring input and appending output to 'nohup.out'
$ pgrep sleep
26789

So 'nohup' will exec the 'shell', the 'shell' will fork a second 'shell' to exec 'sleep' in, however I can only count two processes here, so I am unable to account for one created PID.
Note that, if you put the nohup and the pgrep on one line, then pgrep will apparently be started faster than the shell that 'exec's 'sleep' and thus pgrep will yield nothing, which somewhat confirms my theory:
$ nohup /tmp/foo & echo $! ; pgrep sleep
[2] 26899
nohup: ignoring input and appending output to 'nohup.out'
$

If you launch your process directly, then nohup will "exec" your process and thus keep the same PID for the process as nohup itself had (see http://sources.debian.net/src/coreutils/8.23-4/src/nohup.c/#L225):
$ nohup /bin/sleep 10 & echo "$!"; pgrep sleep
[1] 27130
27130
nohup: ignoring input and appending output to 'nohup.out'
27130

Also, if you 'exec' 'sleep' inside the script, then there's only one process that's created (as expected):
$ echo "exec /bin/sleep 10" > /tmp/foo
$ nohup /tmp/foo & echo "$!"; pgrep sleep
[1] 27309
27309
nohup: ignoring input and appending output to 'nohup.out'
27309

Thus, according to my theory, if you'd 'exec' your process inside the script, then you'd be getting the correct PID.


text:
Q: How to get a specific section of JSON into a string? I'm new to JSON, node.js and javascript... I have a small node.js server that fetch a JSON object(named weatherData below) from openweathermap.org and I'm trying to make it display only a specific part of the JSON object(a section called "temp"). So far I used:
var tempString = JSON.stringify(weatherData);

And then I used search and substring methods of string to get my info but there's got to be an easier way right? How do I only display the temp section without using string methods?
EDIT: When I stringify the whole thing I get this

"{\"coord\":{\"lon\":-75.7,\"lat\":45.41},\"sys\":{\"type\":3,\"id\":119304,\"message\":0.0297,\"country\":\"CA\",\"sunrise\":1413804390,\"sunset\":1413842906},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered
  clouds\",\"icon\":\"03n\"}],\"base\":\"cmc
  stations\",\"main\":{\"temp\":273.05,\"humidity\":84,\"pressure\":1012.188,\"temp_min\":273.05,\"temp_max\":273.05},\"wind\":{\"speed\":1.11,\"deg\":260.506},\"rain\":{\"3h\":0},\"clouds\":{\"all\":44},\"dt\":1413780770,\"id\":6094817,\"name\":\"Ottawa\",\"cod\":200}\n"

A: The JSON is already a native Javascipt object, but weatherData.temp is undefined because that's not one of the object's properties. What you want is nested under main:
weatherData.main.temp // 273.05

Since you mention you're new to JS / Node, it may be helpful to know about console.log() and util.inspect(). You can output an object to the console to inspect its structure using these tools.

A: Its already is in JSON format, you don't need to convert it into a string.
You can access the "temp" section directly by using weatherData.temp

A: have you tried?
var result = JSON.stringify(weatherData.temp);


text:
Q: SuperMicro 16-Bay chassis only recognizes 12 drives I recently purchased two refurbished Supermicro SC836TQ (3U, 16bay) chassis with SAS backplanes (Standard SAS836-TQ planes).
One works perfectly fine, but the other fails to recognize/initialize any disks installed in the right-most column.
Unfortunately, I'm a little out of my depth in this, so I'm looking for common causes and/or ways to troubleshoot or fix.
Any help would be greatly appreciated!


text:
Q: UIViewControllerAnimatedTransitioning does not work properly I want to make a transitioning animation on navigationController's pushes and pops. But it works really weird. Like 1/5 times the fromViewController fades out as it should but toViewController does not fade in, it just appears. Constraints go weird sometimes too. If I use standard transitioning it is all OK. Here is my transitioning class:
class TMFadeAnimator: NSObject, UIViewControllerAnimatedTransitioning {

    func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
        return 0.5
    }

    func animateTransition(transitionContext: UIViewControllerContextTransitioning) {

        let toViewController   = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)
        let fromViewController   = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)
        toViewController?.beginAppearanceTransition(true, animated: true)
        fromViewController?.beginAppearanceTransition(false, animated: true)

        transitionContext.containerView()!.addSubview(toViewController!.view)

        toViewController!.view.alpha = 0.0

        UIView.animateWithDuration(self.transitionDuration(transitionContext), animations: {
            toViewController!.view.alpha = 1.0
            fromViewController!.view.alpha = 0.0
        }) { (finished) in
            toViewController?.endAppearanceTransition()
            fromViewController?.endAppearanceTransition()
            transitionContext.completeTransition(finished)
        }
    }
}

A: Strangely enough the problems were solved by putting toViewController?.view.frame = fromViewController!.view.frame just after the toViewController and fromViewController were defined. (Thanks to A'sa Dickens for findinding it out). Here is the final code
class TMFadeAnimator: NSObject, UIViewControllerAnimatedTransitioning {

    func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
        return 0.5
    }

    func animateTransition(transitionContext: UIViewControllerContextTransitioning) {

        let toViewController   = transitionContext.viewControllerForKey(UITransitionContextToViewControllerKey)
        let fromViewController   = transitionContext.viewControllerForKey(UITransitionContextFromViewControllerKey)

        toViewController?.view.frame = fromViewController!.view.frame

        toViewController?.beginAppearanceTransition(true, animated: true)
        fromViewController?.beginAppearanceTransition(false, animated: true)

        transitionContext.containerView()!.addSubview(toViewController!.view)

        toViewController!.view.alpha = 0.0

        UIView.animateWithDuration(self.transitionDuration(transitionContext), animations: {
            toViewController!.view.alpha = 1.0
            fromViewController!.view.alpha = 0.0
        }) { (finished) in
            toViewController?.endAppearanceTransition()
            fromViewController?.endAppearanceTransition()
            transitionContext.completeTransition(finished)
        }
    }
}


text:
Q: ArcMap label expression returning NoneType error I'm trying to create street range labels rounded to the nearest 100 unless a street range is less than 100 I'm using "50". I have a field l_refaddr that is a string with number ranges for a street segment. If a string value has less than 3 characters i want the expression to return "50", if the length is 3, then return first character and concatenate with "00", if length is 4, first two characters and "00", if legth is 5, first three characters and "00". Here's what I wrote in the expression builder:
    def FindLabel ( [l_refaddr] ):
      if len( [l_refaddr]) < 3:
        [l_refaddr] = "50"
      elif len( [l_refaddr]) == 3:
        [l_refaddr] =  [l_refaddr][0]+"00"
      elif len( [l_refaddr]) == 4:
        [l_refaddr] =  [l_refaddr][:2]+"00"
      else:
    [l_refaddr] = [l_refaddr][:3]+"00"
    return [l_refaddr]

And this is the error I'm getting:

Any ideas what I'm missing?

A: Michael Stimson pointed me in the right direction. I needed to use a variable name for assigning new values instead of the field name. Here is the corrected code:
def FindLabel ( [l_refaddr] ):
  if  [l_refaddr] == None:
    MyLabel = ''
  elif len( [l_refaddr]) < 3:
    MyLabel = "50"
  elif len( [l_refaddr]) == 3:
    MyLabel =  [l_refaddr][0]+"00"
  elif len( [l_refaddr]) == 4:
    MyLabel =  [l_refaddr][:2]+"00"
  else:
    MyLabel = [l_refaddr][:3]+"00"
  return MyLabel


text:
Q: Sum of digits of ternary and novenary numbers When a natural number is represented as a ternary (base 3), the sum of the digits is 2007.  What are the maximal and minimal values of the sum of digits when it is represented as a novenary (base 9)?
I have no clue.

A: So first we note that to convert from ternary to novenary we simply go from the least significant digit (or "trit") and pair them up and convert each pair into a novenary digit from ternary (I'll leave it to you to see why this is case)
So really we have a bunch of pairs $\in \{0,1,2\}^2$ such that all the numbers have a fixed sum (2007 in this case), and we want to maximise the sum of all the digits when we convert to base 9. So really we want to maximise the base 9 representation of every pair.
So to make the best use of the fixed sum, we need to only put non-zero values in the first element of the pair, as that corresponds to a higher value in base 9.
Interestingly from here (again I'll leave it to you to see why), it's completely irrelevant how we distribute the sum, as the base-9 sum is always the same. So let's just do it the obvious way and have $2007$ pairs all equal to $(1,0)$, so the maximal base-9 sum is $1*3*2007 = 6021$.


text:
Q: Load Mixed-Mode dll from class library So i have a mixed-mode dll what i would like to load from my C# class library. But im getting this error:

Mixed mode assembly is built against version 'v2.0.50727' of the
  runtime and cannot be loaded in the 4.0 runtime without additional
  configuration information.

So i did some searching and figured out that i should add this to my app.config:
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

But now there is the problem, since im trying to load that mixed mode dll from class library i dont have the app.config file.
How could i resolve this problem?

A: I found this blog post when googling:
http://reedcopsey.com/2011/09/15/setting-uselegacyv2runtimeactivationpolicy-at-runtime/
It's exactly what i wanted and it works!


text:
Q: Merge multiple Arrays to one 2D Array I have this code snippet here:

#define byte uint8_t

byte pins0[11] = {  0,  1,  2, 3,   4,  5,  6,  7, 63, 64, 65};
byte pins1[11] = {  8,  9, 10, 11, 12, 13, 14, 15, 60, 61, 62};
byte pins2[11] = { 16, 17, 18, 19, 20, 21, 22, 15, 60, 61, 62};
byte pins3[11] = { 23, 24, 25, 26, 27, 28, 29, 30, 60, 61, 62};
byte pins4[11] = { 31, 32, 33, 34, 35, 36, 37, 38, 60, 61, 62};
byte pins5[11] = { 39, 40, 41, 42, 43, 44, 45, 46, 60, 61, 62};

byte *segPins[6] = {&pins0,&pins1,&pins2,&pins3,&pins4,&pins5};

The compiler shows an error:
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
 byte *segPins[11] = {&pins0,&pins1,&pins2,&pins3,&pins4,&pins5};
                                                               ^
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
src\main.cpp:15:63: error: cannot convert 'byte (*)[11] {aka unsigned char (*)[11]}' to 'byte* {aka unsigned char*}' in initialization
*** [.pio\build\nanoatmega328\src\main.cpp.o] Error 1

In my opinion, segPins is an Array of byte pointers. So it should pass the compiler but it sees a difference?

A: What you need is
byte *segPins[6] = {pins0,pins1,pins2,pins3,pins4,pins5};

This is because &pins0 refers to the address of the array pins0.
Edit
For more information see answers to this question.


text:
Q: Borrowers that take all loans using NOT EXISTS I want to find the borrowers who took all loan types.
Schema:
loan (number (PKEY), type, min_rating)
borrower (cust (PKEY), no (PKEY))

Sample tables:
number | type     | min_rating
------------------------------
L1     | student  | 500
L2     | car      | 550
L3     | house    | 500
L4     | car      | 700
L5     | car      | 900

cust  | no
-----------
Jim   | L2
Tom   | L1
Tom   | L2
Tom   | L3
Tom   | L4
Tom   | L5
Bob   | L3

The answer here would be "Tom".
I can simply count the total number of loans and compare the borrower's number of loans to that, but I'm NOT allowed to (this is a homework exercise), for the purposes of this homework and learning.
I wanted to use double-negation where I first find the borrowers who didn't take all the loans and find borrowers who are not in that set. I want to use nesting with NOT EXISTS where I first find the borrowers that didn't take all the loans but I haven't been able to create a working query for that.

A: A simple approach is to use the facts:

*

*that an outer join gives you nulls when there's no join

*coalesce() can turn a null into a blank (that will always be less that a real value)

Thus, the minimum coalesced loan number of a person who doesn't have every loan type will be blank:
select cust
from borrower b
left join loan l on l.number = b.no
group by cust
having min(coalesce(l.number, '')) > ''

The group-by neatly sidesteps the problem of selecting people more than once (and the ugly subqueries that often requires), and relies on the quite reasonable assumption that a loan number is never blank. Even if that were possible, you could still find a way to make this pattern work (eg coalesce the min_rating to a negative number, etc).
The above query can be re-written, possibly more readably, to use a NOT IN expression:
select distinct cust
from borrower
where cust not in (
  select cust
  from borrower b
  left join loan l on l.number = b.no
  where l.number is null
)

By using the fact that a missed join returns all nulls, the where clause of the inner query keeps only missed joins.
You need to use DISTINCT to stop borrowers appearing twice.

Your schema has a problem - there is a many-to-many relationship between borrower and load, but your schema handles this poorly. borrower should have one row for each person, and another association table to record the fact that a borrower took out a loan:
create table borrower (
    id int,
    name varchar(20)
    -- other columns about the person
);

create table borrrower_loan (
    borrower_id int, -- FK to borrower
    load_number char(2) -- FK to loan
);

This would mean you wouldn't need the distinct operator (left to you to figure out why), but also handles real life situations like two borrowers having the same name.

A: I think a good first step would be to take a cartesian product* of the borrowers and the loans, then use a where clause to filter down to the ones which aren't present in your "borrowers" table.  (Although I think that would use a NOT IN rather than a NOT EXISTS, so may not be exactly what you have in mind?)
(* With the caveat that cartesian products are a terrible thing to do, and you'd need to think very carefully about performance before doing this in real life)
ETA: The NOT EXISTS variant could look like this:
Take the Cartesian product as before, do a correlated subquery for the combination of borrower and loan, then filter by whether this query returns any rows, using a WHERE clause with a NOT EXISTS condition.

A: select cust from borrower
except
select t.cust
from (select distinct cust,number
      from borrower cross join loan) t
left join borrower b on t.cust = b.cust and t.number = b.num
where b.num is null

Fiddle
Take a cross join of customers from borrowers and loan nums from loans. Then left join the borrower table to find customers who haven't taken all loans. Finally, use except to select the customers who have taken all loans.