text:
Q: Reassigning vector values using nested for-loops in matlab? In matlab I have two vectors, ind and ind3. ind = [1 2 3 4 5] and I want to define ind3 based on ind such that I want ind(3), ind(4) and ind(5) to be ind3(1) and ind3(2) and ind3(3). so that ind3 = [ind(3) ind(4) ind(5)] but for some reason I can't do this. I thought it would be simple to do using nested for loops but it doesn't really work.
for i=3:5
  for n=1:3
    ind3(n,:) = ind(i,:);
  end
end

By going through the for-loops logically I know why the output is wrong.. but I don't get how else to do it? Am I being stupid and missing something really simple?!
I know its probably a simple answer but can anybody help??
Thanks.

A: If you want ind3 = [ind(3) ind(4) ind(5)] and you want to do it in a loop you just need a single loop. Additionally, since you're dealing with vectors you just have one indexing variable.
for n=1:3
  ind3(n) = ind(n + 2);
end

A: Maybe I'm misunderstanding your question but is this what u want:
ind3=ind(3:5)

A: First of all, you said that your arrays are one dimensional (they are not matrices), and in your code by calling ind3(n,:) or ind(i,:) you treat them like 2 dimensional arrays.
As long as everything is 1 dimensional here, you need just one for loop:
for i=3:5
    ind3(i)=ind(i-2);
end

Explanation: here i=3,4,5. For i=3 you assign ind3[3]=ind[1], for i=4:  ind3[4]=ind[2],  for i=5:  ind3[5]=ind[3].
Or you can simply call ind3=ind(3:5)


text:
Q: Is it possible to use eBPF or perf to calculate time spent in individual traced functions? Currently, I can tell trace-cmd (an ftrace front-end) to use ftrace's function graph infrastructure to trace a specified workload.  Using some trace data processing tools, I can look at the frequency with which functions were called and the corresponding total duration across each of the function calls.  Example output might look like the following, where I trace ext4 function calls generated by my workload:
# trace-cmd post-processing example output
# function name, frequency, total duration (us)
ext4_alloc_inode(),1,35.567
ext4_read_inode_bitmap(),1,12.076
ext4_init_io_end(),2,41.216
ext4_journal_check_start(),39,716.3
ext4_da_write_end(),10,102.661
ext4_da_get_block_prep(),9,257.46999999999997
ext4_block_write_begin(),2,88.069
ext4_bio_write_page(),1,33.016

I've seen the incredible flame graphs that can be generated by eBPF, systemtap, perf, etc, which lead me to believe that I should be able to achieve output similar to that of my trace-cmd output using perf or eBPF.  However, there are a few obstacles:

*

*My workload can run for up to 15 minutes, which could generate enormous logs if I were to use perf.  For reference, you can view example output that traced bash for far less time.

*I am not familiar enough with eBPF to determine whether I can achieve similar data/output as my trace-cmd post-processing example output.

For those of you who are more familiar with eBPF or perf than I am, I would like to know:

*

*Is it possible to use eBPF or perf to achieve my goal?

*If so, why is it possible?

If you are feeling extra generous, sample code/commands that would help me achieve my goal would be appreciated.

A: Absolutely, it is possible to use eBPF to do that.
There's actually a tool that does something similar in the bcc tools. funclatency traces a set of functions and display the histogram of their latencies (time spent in the function at each call):
# ./funclatency do_sys_open
Tracing do_sys_open... Hit Ctrl-C to end.
^C
     nsecs           : count     distribution
       0 -> 1        : 0        |                                      |
       2 -> 3        : 0        |                                      |
       4 -> 7        : 0        |                                      |
       8 -> 15       : 0        |                                      |
      16 -> 31       : 0        |                                      |
      32 -> 63       : 0        |                                      |
      64 -> 127      : 0        |                                      |
     128 -> 255      : 0        |                                      |
     256 -> 511      : 0        |                                      |
     512 -> 1023     : 0        |                                      |
    1024 -> 2047     : 0        |                                      |
    2048 -> 4095     : 124      |****************                      |
    4096 -> 8191     : 291      |**************************************|
    8192 -> 16383    : 36       |****                                  |
   16384 -> 32767    : 16       |**                                    |
   32768 -> 65535    : 8        |*                                     |
   65536 -> 131071   : 0        |                                      |
  131072 -> 262143   : 0        |                                      |
  262144 -> 524287   : 0        |                                      |
  524288 -> 1048575  : 0        |                                      |
 1048576 -> 2097151  : 0        |                                      |
 2097152 -> 4194303  : 1        |                                      |
Detaching...

Starting from funclatency, it's rather easy to derive a tool that does what you're looking for:
from __future__ import print_function
from bcc import BPF
from time import sleep, strftime
import argparse

parser = argparse.ArgumentParser(
    description="Time functions and print time spent in each function",
    formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("-p", "--pid", type=int, help="trace this PID only")
parser.add_argument("pattern", help="search expression for functions")
args = parser.parse_args()

# define BPF program
bpf_text = """
#include <uapi/linux/ptrace.h>

struct stats_t {
    u64 time;
    u64 freq;
};
BPF_HASH(start, u32);
BPF_HASH(ipaddr, u32);
BPF_HASH(stats, u64, struct stats_t);

int trace_func_entry(struct pt_regs *ctx)
{
    u64 pid_tgid = bpf_get_current_pid_tgid();
    u32 pid = pid_tgid;
    u64 ts = bpf_ktime_get_ns();

    u64 ip = PT_REGS_IP(ctx);
    ipaddr.update(&pid, &ip);
    start.update(&pid, &ts);

    return 0;
}

int trace_func_return(struct pt_regs *ctx)
{
    u64 *tsp, delta;
    u64 pid_tgid = bpf_get_current_pid_tgid();
    u32 pid = pid_tgid;

    // calculate delta time
    tsp = start.lookup(&pid);
    if (tsp == 0) {
        return 0;   // missed start
    }
    delta = bpf_ktime_get_ns() - *tsp;
    start.delete(&pid);

    // store as histogram
    u64 ip, *ipp = ipaddr.lookup(&pid);
    if (ipp) {
        ip = *ipp;
        struct stats_t *stat = stats.lookup(&ip);
        if (stat) {
            stat->time += delta;
            stat->freq++;
        } else {
            struct stats_t s = {};
            s.time = delta;
            s.freq = 1;
            stats.update(&ip, &s);
        }
        ipaddr.delete(&pid);
    }

    return 0;
}
"""

# load BPF program
b = BPF(text=bpf_text)
pattern = args.pattern.replace('*', '.*')
pattern = '^' + pattern + '$'
b.attach_kprobe(event_re=pattern, fn_name="trace_func_entry")
b.attach_kretprobe(event_re=pattern, fn_name="trace_func_return")
matched = b.num_open_kprobes()

if matched == 0:
    print("0 functions matched by \"%s\". Exiting." % args.pattern)
    exit()
# header
print("Tracing %d functions for \"%s\"... Hit Ctrl-C to end." %
    (matched / 2, args.pattern))

while (1):
    try:
        sleep(99999999)
    except KeyboardInterrupt:
        break

print()
print("%-36s %8s %16s" % ("FUNC", "COUNT", "TIME (nsecs)"))
stats = b.get_table("stats")
for k, v in stats.items():
    print("%-36s %8s %16s" % (BPF.sym(k.value, -1), v.freq, v.time))

This tool uses BPF to compute the frequency and total duration of each function call directly in the kernel. The aggregated values are only copied to userspace at the end, before displaying them.
Output:
# ./time-spent do_sys_*
Tracing 6 functions for "do_sys_*"... Hit Ctrl-C to end.
^C
FUNC                                    COUNT     TIME (nsecs)
do_sys_poll                              6783     213928440379
do_sys_open                              3127         43172656
do_sys_ftruncate.constprop.15              39           189623

This solution relies on bcc to load BPF programs in the kernel, but it's also possible to do everything in C. You can find a tutorial to get started with bcc on the repository.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Play Framework - CRUD - ImageUpload I'm using play 1.2.5 with the CRUD module and now try to upload images for an entity. It has the
property
public Blob image;
It works via the tutorial on
"Play framework CRUD file upload"
, but is it somehow possible to save the image not as a File with a hashtag name and without extension, but instead as the original file name and extension, just a copy? For example if I upload a "test.jpg" I want play to save a "test.jpg" in my app and the path to this file in the database-table!


text:
Q: Opinions on distribution of software via virtual appliance I've created a distribution of my open source application framework in a working virtual appliance.  It includes everything to get started with the tutorial.  The distribution is Fedora 14 running Tomcat 5.5 and Oracle 10g Express Edition, plus my framework.  It is completely preconfigured and boots into a working running copy.
Would this be something you might try?
What assurances might you need to get you to try it?
Edit: The VM is just over a 2Gb download.  Alternatively it is also available via 23Mb download for the source and a PDF detailing how to configure the Tomcat and Oracle dependencies.

A: Yeah, I think this is a terrific thing, especially for systems which require (potentially) complex configuration to get up and running.  If you can ship a working VM image that you just "boot and go" it makes it far easier to get a system up and running for evaluation / analysis ( at a minimum).  I believe that if you want people to evaluate your software and see the value in it, you need to make it as easy as possible for them to get it deployed and working so they can give it a spin.
I wouldn't make it the only means of distribution, but it's something I think many software projects should make available.  I'm planning to (eventually, when I can find time) do a virtual appliance distribution of my own project.  So yeah, I'm definitely on-board with this concept.
That said, I don't think having a VA distribution obviates the need to make it as easy as possible to build, deploy and configure the system via other methods.  Building from source, for example.  I'd still try to do as much as possible to make the source download, build, deploy, configure stuff as easy as possible.
Edit:  also, just to be clear... I'm talking about this in general / conceptual terms only.  Since you didn't say much (if anything) about what your actual project is or what it does, then no, I'm not actually going to download it and try it out.  I'm assuming you were asking this in the context of "Would you recommend that I make this available to people who are already interested in my project and visit the website looking for a download" as opposed to "would you, Stackexchange User $FOO, want to download this appliance and try it out?"

A: Microsoft has had success distributing demo software using appliances, and did this with the beta of Visual Studio 2010.  I think they use appliances pretty often for betas of operating systems also.
How big is the download?  Could you explain more about what the framework is?

A: Well, I would have a couple barriers to entry:

*

*Configuration would be significantly troublesome that I wouldn't want to do it on my own.

*I have a beefy enough system to run a VM. My work machine is beefy enough, only 1 of my home machines is.

*Configuration of the VM wouldn't fry my existing configurations.

It's an uncommon approach for open-source distribution, certainly.  Typically I would prefer to just ./configure && make && make install software.
On the enterprise consumption front, it would probably go over better due to the existing VM infrastructure.
HTH.

A: If I wanted to stand up one of these appliances, I would be willing to go get the supporting software myself (Oracle, Tomcat, Linux, etc.), especially if you had some script or installer that would help me cobble all of the software sources together.

A:
Would this be something you might try?

No.  For a couple reasons.
Frankly, I wouldnt want to have to download a 2gig file just to try out an unknown, undocumented open-source project.  Not everybody has 100MB bandwidth.  Plus, you dont say what VM system this 'virtual appliance' uses, but 'virtual appliance' typically refers to VMWare.  That is not a no-impact install on a machine.
Also, imo, if this is the easiest way for you to distribute the project, I'm left with the impression then that the project must be such a pain to install that it needs a virtual appliance like this to realistically test.  Why would a user want to jump into that?
Also, your site has practically zero information about the project.  So now you are asking people to download a 2 gig appliance, and let VMWare do whatever its going to do to your system, without any assurances your project would actually do anything useful.
I think you'd be better suited to spend your time fleshing out the site so people can read a thorough description of the project's features, as well as streamlining the installation process to the point where an appliance isnt needed.

A: No.
If you have an open source framework - note: Open Source - which you want me to use on a Linux platform, I want full integration with the package system on said platform.  This means a maintained yum installation site or - for Debian/Ubuntu an apt-get repository - so that updates are automatic.
Please let me emphasize that:  Installation, updates and removal should be automatic.
If your framework uses a database, I want the package system to pull it in as a dependency of your framework, and I want THAT too to be maintained automatically.   This might disqualify your choice of Oracle as the database, but that is just life.
I do not want to run any framework in a lone virtual machine.  I want to run my favorite distribution which usually do other things too and then use your framework in there.


text:
Q: Loop over all the values of the named ranges I have a number of named ranges within the scope of my Workbook.

Now I want to loop over each named range by following the second answer of this related topic
Sub Range1()

Dim i As Integer

For i = 2 To ActiveWorkbook.Names.Count
    MsgBox ActiveWorkbook.Names(i).Name
Next i

End Sub

This macro shows me all the names such as C_1 in a msgbox. I modify the script in the following way to "call" each of the ranges based on the name of the corresponding range.
Sub Range2()

Dim i As Integer
Dim rng As Range
Dim nm As Name
Dim rng_name As String

For i = 2 To ActiveWorkbook.Names.Count
   Set nm = ActiveWorkbook.Names(i)
   rng_name = nm.Name
   Set rng = Application.Range(nm.Name)           `This line yields an error
   MsgBox rng.Address
Next i

End Sub

The error I get is:

"Run-time error '1004': Method 'Range' of object'_ Apolication failed

Any idea what I am doing wrong? If I inspect the elements I see that rng_name is equal to "C_1".
EDIT
I believe that it has something to do with how the named ranges are created. This is done in the following way:
Sub createRanges()

Dim LastRowAll As Long, LastRowUnique As Long
Dim x, y
Dim rng As Range
Dim rng_name As String

LastRowUnique = Sheets("Lists").Range("J2").End(xlDown).Row
LastRowAll = Sheets("Deribit").Range("D8").End(xlDown).Row

For Each x In Sheets("Lists").Range("J2:J" & LastRowUnique)
    For Each y In Sheets("Deribit").Range("D8:D" & LastRowAll)
        If y.Offset(0, -1).value = "Call" Then
            If rng Is Nothing And y = x Then
                Set rng = y.Offset(0, -2)
            ElseIf y = x Then
                Set rng = Union(rng, y.Offset(0, -2))
            End If
        Else:
        End If
    Next y
    rng_name = "C_" & x.Offset(0, -1).value
    ThisWorkbook.Names.Add Name:=rng_name, RefersTo:=rng.Address
    Set rng = Nothing
Next x

A: See:
For i = 1 To ActiveWorkbook.Names.Count
    Set nm = ActiveWorkbook.Names(i)
    Set rng = ActiveWorkbook.Names(nm.Name) 'This is where the error was
    MsgBox rng.Address
Next i

I also dropped the rng_name, since you didn't use it.

Edit1:
I was unable to get Application.Range(nm.Name) to work originally, but was able to get ActiveWorkbook.Range(nm.Name) to work, using ranges on different sheets named "c" and "d".  I noted that nm = ActiveWorkbook.Names(i) did not include the sheet name when it was recorded.
When naming ranges with the underscore and number in them (I tried c_1 & c_2) I was unable to get my code to work; on inspecting nm in debug mode, I noticed that it also listed the sheet name.  I had to specify that than rng would .RefersToRange to get the cell address to show up without the sheet name.
I did two additional checks, one with the underscore without number (used "d_") and another with a number and no underscore (used "name2"), and both did give me the same error.  Both scenarios kept the Sheet name in the string nm.
Here is the testing code that I was executing/stepping through to sort that out:
Dim rng As Range, i As Long
For i = 1 To ActiveWorkbook.Names.Count
    Set nm = ActiveWorkbook.Names(i)
    'Set rng = ActiveWorkbook.Names(nm.Name)
    Set rng = nm.RefersToRange
    'Debug.Print rng.Address
    MsgBox rng.Address
Next i

Using Set rng = nm.RefersToRange worked in all scenarios, while alpha-character only names worked with the Set rng = ActiveWorkbook.Names(nm.Name).
Suggestion, stick with .RefersToRange as the robust code.


text:
Q: Wrapping a string buffer We have a large C++ real-time program that uses buffers (e.g. char str[500]) of different sizes to store strings.
Due to some memory leakages we had in the past, we want to wrap the strings with a MyString class that would be initialized with the buffer and the size.
The problem is how to efficiently and easily allocate the buffers and the wrapper together, while keeping the buffer allocated as part of the class, and not allocated from the heap (see the next example).
I've tried using a template in the following manner:
template <unsigned int N>
class BufferString : public MyString
{
public:
   BufferString() : MyString(m_buf, N) { }
   char m_buf[N];
};

So it could be allocated as class member or as an automatic variable:
class SomeClass
{
   BufferString<500> m_str;   // Need the buffer to be allocated in SomeClass
};

void foo()
{
   BufferString<350> str;     // Need the buffer to be allocated on the stack
}

However, the executable size grows dramatically using this solution, by about 1kB per instantiation of the template (probably due to the compilation of the constructor).
Is there a better way to do this?
Thanks.

EDIT: I've found an implementation similar to my proposed solution called fixed_char_buf (by John Panzer, found here).
Another implementation and reasoning for this method is found here.

A: Strip the debug symbols from your executable. 1k per instance is probably no the code of the c'tor, but debug symbols.

A: That seems like the most logical and precise way when using templates.  As suggested by Torsten Robitzki, try stripping debug symbols from your executable.
Depending on your compiler, particularly older compilers for real-time embedded systems, templates can quickly bloat the binary size.  If this is the case, there are a few options that avoid templates:

*

*Implement an allocation strategy.  If BufferString is written properly, then the memory it owns (m_buf) could be allocated on the stack or heap without introducing leaks.  If fragmentation and time, not memory leaks, are the primary reasons to avoid the heap, then there are numerous allocation patterns to consider that are specifically designed to mitigate these issues on real-time systems, such as pool or static allocation patterns.

*If the heap must be avoided, and templates are causing too much bloat, then the other alternative is manually declare the buffer and MyString separately.  Although I would try to avoid it as much as possible, macros may provide a suitable compromise between usability and readability.  For example, the following macro could be used to declare an automatic variable:
#define BUFFER_STRING(name, size)  \
  char name##buffer[size];         \
  MyString name(name##buffer, size)


text:
Q: error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>' Getting this error and I'm pretty sure it's in the operator<< function. Both prints are public.
void CRational::print() const
{
    print(cout);
}

void CRational::print(ostream & sout) const
{
    if(m_denominator == 1)
        cout << m_numerator;
    else
        cout << m_numerator << "/" << m_denominator;
}

ostream operator<<(ostream & sout,const CRational a)
{
    a.print();

    return sout;
}

CRational operator++() // prefix ++x
{
    m_numerator += m_denominator;
    return *this;
}

in main:
cout << "e before: " << e << ", \"cout << ++e\" : " << ++e << " after: " << e << endl;

A: ostream operator<<(ostream & sout,const CRational a)
       ^ You are trying to return by value

Streams are not copyable, so you can't return one by value.  You need to return the stream by reference (std::ostream&).
Also, you should probably be outputting to sout in your CRational::print(ostream&) function (otherwise, why take it as an argument?) and you should probably be passing sout when you call a.print() in your operator<< overload (otherwise, the overload doesn't really do what an idiomatic operator<< overload for a stream is supposed to do).

A: operator<< should return a reference to an ostream: ostream& operator<<...
Also your functions are kinda messed up. Instead of using cout, you should used the passed in ostream which you've named sout.

A: You need to return the ostream by reference, not value. Its trying to call a constructor.
Might as well pass 'a' as reference as well:
ostream& operator<<(ostream & sout,const CRational& a)

I also note that the print method is probably wrong. It has sout passed as the name of the stream but is then implemented using cout directly. It should be
void CRational::print(ostream & sout) const
{
    if(m_denominator == 1)
        sout << m_numerator;
    else
        sout << m_numerator << "/" << m_denominator;
}


text:
Q: Android Viewpager animation choppy I have around 4 (list)views added to my ViewPager which acts as a controller to a TabHost. Something similar to example found here :
http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html
When I fling my finger to go to next view, its not very smooth. I have used the setDrawingCacheEnabled(true); to improve on the animation. Still, it seems choppy.
Can anyone provide any guidelines to have smooth animations ?

A: Just a wild guess here, but is it possible that populating the ListViews takes too much time, thus causing the choppy animations as the ViewPager has to wait for the next View to be instantiated? I've had a similar problem, the cause of which I found out to be SQLite functions being called in a ListAdapter's getView(), causing the delay.

A: try set the layout parameters at Adapter which extends the pagerAdapter example
TextView txt = new TextView(context);
txt.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));


text:
Q: Http GET request with parameters - Java I need to create a java code that sends an Http GET request with the required parameter to get a response, or else I get an information message that is missing the parameter. In the moment I have the second option.
Why my DataOutputStream not write the parameters in my request?
Look the code:
public class ClienteWebService {
String URL_WEBSERVICE = "http://seat.ind.br/processo-seletivo/2018/01/desafio.php";
String nome = "Leonardo Rodrigues Torres";

public String getInformacoes() {

    StringBuilder urlParametros = new StringBuilder();
    urlParametros.append("nome=").append(nome);

    URL url;
    try {
        url = new URL(URL_WEBSERVICE);

        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setDoOutput(true);

        DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
        wr.writeBytes(urlParametros.toString());
        wr.flush();
        wr.close();

        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String inputLine;
        StringBuilder response = new StringBuilder();

        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();

        return response.toString();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return null;
  }

}


text:
Q: Does JBoss cache authentication information? When testing various authentication solutions (my own LoginModule etc) in JBoss, it seemed to me that sometimes when I redeployed a change or otherwise provoked the login form to show, that JBoss didn't actually call the authentication module.
Just wondering if there is some type of short term caching going on?
I tested both from a web application (taking care to delete cookies etc) and from a fat RMI java client.
Of course, If I restarted JBoss, the full authentication process was followed.
Is there a cache, and if so, can it be disabled for development purposes?

A: Yes, JBoss caches authentication information by default for a few minutes.
To disable caching, set DefaultCacheTimeout to 0 in the configuration for the JaasSecurityManagerService. The configuration is in the "jboss-service.xml" file.
For more info and various ways to flush the cache, see CachingLoginCredentials at jboss.org.


text:
Q: Почему светодиод подключается к GND? Всем привет! Не могу понять, почему анод от светодиода идёт к GND (катод - PC13, анод - GND). Это минус? Что значит GND? При подключении остальных модулей - так же вести всё к GND как минус? Ничего не могу найти по этому поводу.
STM32F103C8xx

A: Gnd - граунд, земля, он же минус в цепях с постоянным током.


text:
Q: gnuplot plotting a filled surface (polygon) using 3 points I am trying to draw a triangular surface. I am setting three corners of the surface as [1,0,1], [0,1,1] and [1,1,0]. I am doing like this:
set view 57, 64
$data << EOD
1.000 0.000 1.000
0.000 1.000 1.000
1.000 1.000 0.000
1.000 0.000 1.000
EOD
set label 1 "C" font "Arial, 11" front at 1.100, 0.000, 1.100
set label 2 "A" font "Arial, 11" front at 0.000, 1.050, 1.050
set label 3 "B" font "Arial, 11" front at 1.050, 1.050, 0.000
splot "$data" with lines lw 3 lc rgb 'black', \
    "< echo '1.000 0.000 1.000'" with points pt 7 lc rgb 'black', \
    "< echo '0.000 1.000 1.000'" with points pt 7 lc rgb 'black', \
    "< echo '1.000 1.000 0.000'" with points pt 7 lc rgb 'black'

and the plot I am getting is like this:

Now how do I make the polygon grey or transparent grey?

A: One way to do that is by using a polygon object:
set xrange [0:1]
set yrange [0:1]
set zrange [0:1]
set xyplane at 0
set view 69,74
set object 1 polygon from 1,0,1 to 0,1,1 to 1,1,0 fillstyle transparent solid 0.5
splot 1/0 notitle


text:
Q: Git won't merge ("Already up to date") - how to fix this WITHOUT rewriting history? I've found a raft of answers here for the case when resetting and/or rebasing (and thus rewriting history) are allowed, but what can one do when you've freshly cloned a repo, checked out and pulled branch A and branch B, then on branch B and git merge A returns Already up to date. despite the fact git diff A clearly shows a non-trivial delta?
One way I know of is to back-merge B to A, correct the issue on A and then merge that to B (effectively a no-op on A). But that means changing the source branch, and I feel that shouldn't be necessary.
So, is there a way to tell git to merge everything from A so that B matches A without resetting/rebasing, without needing to do anything to A (since A is exactly as I want things to begin with), and without adding another commit to B that simply compounds the issue (as this is one way to cause the very problem I'm trying to solve)?
(To emphasize, this is from a freshly cloned and pulled repo, so I have no tricks to use (if this would create a merge commit at all, I could correct things and amend it before pushing, but the problem is there is no merge commit at all.)
I suspect there may not be, and the only clean way (given that I can't rewrite history in this case) will involve (back)merges to A. But, git is rich and full of wonders, so I thought it would be worth asking here.

A: The message means : B is ahead of A, so the merge action does not understand what it should merge.

(edit : re-read your question ... )
If you want to set the content back to "what it was in A" : this is not a merge action, this is a matter of setting back, on disk or in the index, the content to what it was in A.

*

*if you have git version 2.23 or later : look at git restore A

*if you have an older git :
# apply the diff between B and A to B :
git diff -p B A | git apply --index -

# commit
git commit

A: My suggestion is to create a new branch and delete B (after cherry-picking what's needed from B, if necessary).

A: Try:
git checkout master
git reset --hard <branch>
git push --force origin master


text:
Q: Trying to install Ubuntu mate 15.10 Hi i'm trying to install buntu mate on my new pc.
I had a wierd bug where it got struk after partioning;
Window stuck on 'Force UEFI installation?' window
after i figured this out i had to restart the installaton, (i've read the only way to do that is turn off the power)
edit:
i get a green splash screen before the screen goes black/gray
(i also added spacing to th specs section)
edit3:
downloaded a new ubuntu mate file, but it didn't change a thing.
it seems to get into the os fine, but it just doesn't give me the graphical data
(i can see my mouse and move it, and when i move it over where the
buttons from the mate startup menu should be the courser changes, but i cant see anything)

now when i try to install again the top 1/3 screen is black and the lowest 2/3 are gray, but it seems i'm in the os (in the try without installing area)
i've read that i have to use nomodeset, and that to do this i have to press either e or downarrow afte you choose try os without installing, but none of this seems to do anything
edit 2:
i found out i had to push e while the "try ubuntu mate" option was highlighted
i did this and then wrote nomodeset noveau.modeset=0
but it still doesn't work

specs:
Intel Core i5-6600K 3.5Ghz

NVIDIA GeForce GTX 970

8 gigs of  ram

thanks for the help
edit 4:

a guy told me to go into the terminal with alt + crtl + f1, i did so, and logged in with ubuntu-mate with a blank password, then i did:
startx

this made the desktop show up, but it has twisted and wierd colors, should i install this? or redownload again?

A: when inside the os you push:
alt + crtl + fx

where x is any number between 1 and 7
it'll ask for a username and keyword
the username is ubuntu-mate
there is no password
then you write
sudo startx

this will clear up some of the screen, but not all, to clear all you push
alt + crtl + fx

where x is a number between 1 and 7 (not including the number you used before)
you log in and use startx as before (the process needed to be repeated 3 times for me every time i start and every time i log in)
Then you install XD


text:
Q: Convert a string into different arrays based on certain characters I have a string like this:
var string = "cat, dog/hat, car, fork/John, Jane";

There is no telling how many terms will be located between each forward slash "/" and some will have spaces " ". Each term is separated with a single comma ",".
The final output should look like:
array1 = ["cat_1", "dog_1"];
array2 = ["hat_2", "car_2", "fork_2"];
array3 = ["John_3", "Jane_3"];

I'm not really sure where to start with this since I'm fairly new to Javascript. Any help would be greatly appreciated!

A: str.split('/')

Will split your example string into the following:
["cat, dog", "hat, car, fork", "john, jane"]

From there you can create new arrays by going through each string element in the array received from split. Hope that helps!

A: const string = 'cat, dog/hat, car, fork/John, Jane';
const results = string.split('/')
.map((pair, i) => pair.split(',').map((single) => single +'_'+ (i+1)));

Now results have three arrays with values you wished for.


text:
Q: Proving $2^x$ is only ever 9 less than a perfect square for a unique value of x I am trying to prove something that has essentially boiled down to proving that
$9 + 2^x$ will only ever be a perfect square for the unique value of x=4, and that no other value will produce a perfect square. First, I am not sure if this always holds true, but it is valid for a few small values I checked.
I need to prove that $9 + 2^x = k^2$ only when $x=4$, and where $k$ is an integer. I tried reducing $\text{mod } 9$ to get
$$2^x \equiv k^2 \text{ (mod 9)}$$ and I know that squares modulo 9 will be 0, 1, 4, or 7. However, after this I am stuck and do not know how to proceed.

A: Hint: $2^x+9=k^2$ if and only if $2^x = k^2-9 = (k-3)(k+3)$. Thus $k-3$ and $k+3$ must be powers of $2$.

A: Hint and trivia: Difference of consecutive squares are odd numbers, so 9 being the second odd square has very few occurrences, and as such 3,4,5 is the only Pythagorean triplet with 3 in it.


text:
Q: Is it necessary to write all the variables and the loop with numpy? I saw someone trying to use python and numpy to do simulations. However, it was quiet slow. I read his code and it turnes out to me that he only used numpy packages when dealing with the array/matrix calculation, and all the other variables and codes was defined in the python main console(i.e. for loops).
My questions are:

*

*Is it necessary to write all the variable as numpy variable, for example np.float in order to get the full capability of numpy package?

*Also, as from what I'm understanding, python's for loop is quiet slow. But I don't want to use cython for the sake of simplicity and readibility. It there a way for the numpy to use some special iteration process to accelerate the calculation? I saw a page that looks like it but did not quite understand(https://docs.scipy.org/doc/numpy/reference/arrays.nditer.html). Bascially, how to utilize the full capability ofnumpy package?

A: Since you didn't provide details of your program, I'll assume you are wondering if numpy.ndarray is faster than using normal python loop.
Yes, it IS much faster.
It's called vectorization. It's faster because:

*

*It'll be executed by the precompiled C/C++ library and thus faster than executing python script

*It takes advantage of the architecture of modern CPU. See: link
That said, it also depends on what you want to do with it. If you are performing math/matrix operations, than vectorization also provides better readability (since it just looks similar to the equation) and more boost since the operations are mostly numerical. If the operations are not numerical, than you'll get less boost and thus can do it the python way.


text:
Q: Select max value of index (V lookup Table)

I have to calculate F1 & F2 using following V Lookup table

to calculate F1
F1 = max{0, (A * F11 + B * F12 + C * F13)}
From following combination of F11, F12, F13 calculate Max value of F1.
Accordingly it should select max of index & its values of F21, F22, F23 at Index max & calculate F2

To calculate F2

F2 = (A * F21 + B * F22 + C * F23)
Here A, B & C are the constants

e.g. If I am getting max value of F1 on **Index [5]** (F11=0.8730, F12=-0.3920, F13=-0.3616),
to calculate F2, It should select F21=0.2256, F22=-0.4620, F23=0.0012 from same Index i.e. **Index [5]

V Lookup Table as follows
          1       2       3       4       5       6       7       8
F11 -0.0083  0.1299  0.3297  0.5682  0.8730  1.1329  1.0602  0.6777
F12  0.5877  0.6826  0.4869  0.1875 -0.3920 -1.2367 -1.5999 -0.3279
F13 -0.0621 -0.1514 -0.2211 -0.2951 -0.3616 -0.4118 -0.3589 -0.2504
F21 -0.0596 -0.0189  0.0554  0.1089  0.2256  0.2878  0.2648  0.1561
F22  0.0721  0.0660 -0.0640 -0.1519 -0.4620 -0.8230 -1.1272 -1.3765
F23 -0.0220 -0.0289 -0.0261 -0.0140  0.0012  0.0559  0.1311  0.2506

A: You can try this
A, B, C = 1, 2, 3
def exp(x, y, z):
    return A*x + B*y + C*z

F1 = exp(df.loc['F11'], df.loc['F12'], df.loc['F13'])
print(F1)
F2 = exp(*(df.loc[['F21', 'F22', 'F23'], F1[F1 == F1.max()].index[0]]))
F1 = F1.max()
print('F1:', F1)
print('F2:', F2)

I am getting for above values of A, B, C
F1 = 1.0408999999999997
F2 = 0.026400000000000007


text:
Q: How do I use configure TbEditableColumn in Yiibooster? I am trying to get TbEditableColumn working using Yiibooster. I have followed the instructions here http://yii-booster.clevertech.biz/components.html#editable
I am confused by the line
'editable' => array(
'url' => $this->createUrl('site/editable'),
'placement' => 'right',
'inputclass' => 'span3'
)

Does that mean I should already have an actionEditable() method or need to create one?
I tried using the preexisting actionUpdate($id) method in the my image controller.
'editable' => array(
'url' => $this->createUrl('image/update', array('id'=>'1')),
'placement' => 'right',
'inputclass' => 'span3'

ATM it updates the front end but when I refresh the page it does not retain its value.
I have hard coded the id in this example.
If I need to create an actionEditable method, has anyone done this and can post how?
Kind regards :)

A: The following worked for me.
in my admin.php view I had this code:
'editable' => array(
    'url' => $this->createUrl('image/editableSaver'),
    'placement' => 'right',
    'inputclass' => 'span3'
),

And in my corresponding controller I had this (as per @schmunk's) comment. With slight changes.
public function actionEditableSaver()
{
    Yii::import('bootstrap.widgets.TbEditableSaver');
    $es = new TbEditableSaver('Image');
    $es->update();
}

So I needed to change
public function actionEditableSaver()
{
    Yii::import('path.to.editable.EditableSaver');
    $es = new EditableSaver('MyModel');
    $es->update();
}

to
public function actionEditableSaver()
{
    Yii::import('bootstrap.widgets.TbEditableSaver');
    $es = new TbEditableSaver('Image');
    $es->update();
}

To correspond to the Tb prefix in my widget names (as downloaded from http://yii-booster.clevertech.biz/getting-started.html)
I hope this helps someone else.

A: You're right so far. The method is pretty straightforward, as there is an existing component for that. Put the following code into your controller and call image/editableSaver
public function actionEditableSaver()
{
    Yii::import('path.to.editable.EditableSaver');
    $es = new EditableSaver('MyModel');
    $es->update();
}


text:
Q: How to start my telegram bot on Google Cloud I want to upload my bot to the server. I am using Google Cloud. My bot.service file looks like this:
[Unit]
Description=Telegram bot 'ConverterBot'
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/home/misha_markov1015@converterbot/ConverterBot
ExecStart=/usr/bin/python3 /home/misha_markov1015@converterbot/ConverterBot/main.py

RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

When I enter the following commands:
sudo systemctl daemon-reload
sudo systemctl enable bot
sudo systemctl start bot
sudo systemctl status bot

I get the following error:
Nov 01 19:08:53 converterbot systemd[1]: Started Telegram bot 'ConverterBot'.
Nov 01 19:08:53 converterbot systemd[8978]: bot.service: Changing to the requested working directory failed: No such file or directory
Nov 01 19:08:53 converterbot systemd[8978]: bot.service: Failed at step CHDIR spawning /usr/bin/python3: No such file or directory
Nov 01 19:08:53 converterbot systemd[1]: bot.service: Main process exited, code=exited, status=200/CHDIR
Nov 01 19:08:53 converterbot systemd[1]: bot.service: Failed with result 'exit-code'.

If you start the bot with the /home/python3/ConverterBot/main.py command, then everything works correctly. I checked several times: the path to this file exists, but why does the error say that this file does not exist?

A: If suddenly someone encounters such a problem, then the solution was as follows: /home/misha_markov1015@converterbot/ConverterBot this path really does not exist. Instead, you had to write: /home/misha_markov1015/ConverterBot.


text:
Q: what's the meaning of "spare" there, I got a sentence when I watched the televison "Lost". The sentence is "Please respect me enough to spare me the pretense that you are actually offended."
I am confused with "spare me the pretense", what's meaning of "spare" here? I looked up dictionary, but I still could not get a proper meaning for this sentence.

A: Spare

Verb
2.0 Refrain from killing, injuring, or distressing:
2.1 [WITH TWO OBJECTS] Refrain from inflicting (something unpleasant) on (someone):

Spare me is also an idiomatic set phrase:

spare someone something
to exempt someone from having to listen to or experience something.
I'll spare you the details and get to the point.
Please, spare me the story and tell me what you want.


text:
Q: A method to UINavigationController as "viewDidLoad" to UIViewController This may be a very stupid question. I'm just wondering
Is there a method that would be called after a NavigationController has been segued?
[which works just like viewDidLoad in UIViewController, besides viewDidLoad is called after the view controller has loaded its view hierarchy into memory]
If there isn't such a thing, is it possible to write one into the UIKit Framework??
(I know we can always use RootViewController's viewDidLoad to trigger something after a NavigationController has been segued. I'm just being curious..)

A: First, there are no views loaded by a UINavigationController. It just controls UIViewControllers that in turn control views. Therefore there is no need to have a callback like viewDidLoad.
Second, you already have a place where you can customize the UINavigationController after it has been created: in prepareForSegue: of the calling view controller, or in your app delegate if it is the root navigation controller.
Of course, you can always subclass UINavigationController and override its init methods if you want to encapsulate your modifications.


text:
Q: Pass Data using Closures I know that there are multiple approaches to pass data back from one controller to another like Delegates, NSNotifications. I am using another way using Closures to pass data data back. I just want to know is it safe way how I pass any data using blocks like below or should I avoid this approach.
First ViewController (where I make object of Second ViewController)
 @IBAction func push(sender: UIButton) {
        let v2Obj = storyboard?.instantiateViewControllerWithIdentifier("v2ViewController") as! v2ViewController

        v2Obj.completionBlock = {(dataReturned) -> ()in
            //Data is returned **Do anything with it **

            print(dataReturned)

        }
        navigationController?.pushViewController(v2Obj, animated: true)

    }

Second ViewController (where data is passed back to First VC)
import UIKit
typealias v2CB = (infoToReturn :NSString) ->()
class v2ViewController: UIViewController {

    var completionBlock:v2CB?
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    @IBAction func returnFirstValue(sender: UIButton) {

        guard let cb = completionBlock else {return}

        cb(infoToReturn: returnFirstValue)

    }
    @IBAction func returnSecondValue(sender: UIButton) {

        guard let cb = completionBlock else {return}

        cb(infoToReturn: returnSecondValue)

    }
}

A: That's a very good and reasonable approach and much better than notifications.
Looking at the evolution of Cocoa API you will notice that Apple has replaced more and more delegate API with blocks / closures over the years.


text:
Q: Redis PubSub: Connections timeout Our subscription client connections keeps disconnecting with the following error.

at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:47)
at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:36)
at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:37)
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:37)
at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:210)
at org.springframework.data.redis.connection.jedis.JedisConnection.subscribe(JedisConnection.java:2986)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.eventuallyPerformSubscription(RedisMessageListenerContainer.java:784)
at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask.run(RedisMessageListenerContainer.java:740)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:202)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:151)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:285)
at redis.clients.jedis.BinaryJedisPubSub.process(BinaryJedisPubSub.java:87)
at redis.clients.jedis.BinaryJedisPubSub.proceed(BinaryJedisPubSub.java:82)
at redis.clients.jedis.BinaryJedis.subscribe(BinaryJedis.java:3070)
at org.springframework.data.redis.connection.jedis.JedisConnection.subscribe(JedisConnection.java:2983)
... 5 common frames omitted
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.net.SocketInputStream.read(SocketInputStream.java:127)
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196)
... 14 common frames omitted
]

For having permanent connections, we have configured 0 timeout in both client and server.
Redis Client:
        poolConfig.setMaxTotal(10);
        poolConfig.setMaxIdle(5);
        poolConfig.setBlockWhenExhausted(true);
        poolConfig.setMinIdle(2);
        poolConfig.setTestOnBorrow(true);

        JedisConnectionFactory factory = new JedisConnectionFactory();
        factory.setHostName(HOST);
        factory.setPort(PORT);
        factory.setDatabase(Protocol.DEFAULT_DATABASE);
        factory.setPoolConfig(poolConfig);
        factory.setTimeout(0);
        JedisShardInfo shardInfo = new JedisShardInfo(factory.getHostName(), factory.getPort(), 0);
        factory.setShardInfo(shardInfo);

        return factory;

Redis Server Config:
127.0.0.1:6379> CONFIG GET client-output-buffer-limit
1) "client-output-buffer-limit"
2) "normal 0 0 0 slave 268435456 67108864 60 pubsub 257949696 134217728 0"

Can someone please help?


text:
Q: EXT JS : How to conditionally hide an item in combobox I am trying to sort out below issue.
I have a combobox which is associated with a dataStore which has 3 items. (a,b and c).
I want to hide an item 'c' from the combo box but still want to pre populate (or show) it with value 'c' for the previous records which have chosen item 'C' in past.
Any idea will be very helpful.
Thank you

A: Kind of a pickle here.
First of all, removing the item from the store - removes it from the pick list.
So if your server side populates the data for combobox - just don't include it in the payload.
Second, to show the item anyway, you have to add it back into the store that backs your combobox. You can do that manually, when setting the value of the field, or in the store load listener which triggers after the store is loaded with data from server.

A: dbrin has given a good way, other way is you do not need to remove that record from store as dbrin told but you need to apply filter to the store. Later when you want to add/display that particular record, just remove/clear filter


text:
Q: Exported bash functions sometimes visible from Perl My Redhat 9, OpenBSD 4.9, FreeBSD 10, Macos X, LinuxMint 17.3, and Ubuntu 14.04.4 all print OK when running this:
myfunc() { echo OK; }
export -f myfunc
perl -e open\(\$fh,\"\|-\",\"@ARGV\"\)\;close\$fh\; /bin/bash\ -c\ myfunc\\\ a

My Ubuntu 16.04.1 gives:
bash: myfunc: command not found

But if I remove \\\ a it works.
perl -e open\(\$fh,\"\|-\",\"@ARGV\"\)\;close\$fh\; /bin/bash\ -c\ myfunc

I have the feeling something is configured wrongly on my system, but what should I look for?
Edit
thrig found a shorter version that also fails. Using that I straced on a failing and a non-failing system:
stdout strace -ff perl -e 'system @ARGV' /bin/bash\ -c\ myfunc\\\ a|grep bash

Failing:
execve("/usr/bin/perl", ["perl", "-e", "system @ARGV", "/bin/bash -c myfunc\\ a"], [/* 71 vars */]) = 0
[pid  7728] execve("/bin/sh", ["sh", "-c", "/bin/bash -c myfunc\\ a"], [/* 71 vars */]) = 0
[pid  7729] execve("/bin/bash", ["/bin/bash", "-c", "myfunc a"], [/* 70 vars */]) = 0

Non-failing:
execve("/usr/bin/perl", ["perl", "-e", "system @ARGV", "/bin/bash -c myfunc\\ a"], [/* 20 vars */]) = 0
[pid 26497] execve("/bin/sh", ["sh", "-c", "/bin/bash -c myfunc\\ a"], [/* 20 vars */]) = 0
[pid 26498] execve("/bin/bash", ["/bin/bash", "-c", "myfunc a"], [/* 20 vars */]) = 0

That looks awfully similar. Removing the \\\ a gives on both systems:
execve("/usr/bin/perl", ["perl", "-e", "system @ARGV", "/bin/bash -c myfunc"], [/* 71 vars */]) = 0
[pid  7826] execve("/bin/bash", ["/bin/bash", "-c", "myfunc"], [/* 71 vars */]) = 0

So Perl drops the sh -c if there is only a single command. Maybe sh -c eats the function on the Ubuntu 16.04?
/bin/sh is dash on both systems.
Edit2
env shows the function. This displays the function as part of the environment on both systems:
perl -e 'system @ARGV' /bin/bash\ -c\ env

Ubuntu 16.04 and one working system:
BASH_FUNC_myfunc%%=() {  echo OK
}

Other working system:
BASH_FUNC_myfunc()=() {  echo OK
}

But this shows only the definition on the working systems:
perl -e 'system @ARGV' /bin/bash\ -c\ env';true'

Edit3
Workaround:
myfunc() { echo OK; }
export -f myfunc
perl -e open\(\$fh,\"\|-\",@ARGV\)\;close\$fh\; /bin/bash -c myfunc\ a

A: The problem is that the /bin/sh from systems like Debian or Ubuntu (dash) or OpenBSD will clear from the environment any variables whose names contain fancy chars like %, and that includes those BASH_FUNC_foo%%=() { ..., which are used to encode bash's exported functions.
If the |- from the open function is followed by a single argument instead of a list of arguments, and that argument contains any shell metacharacters (the backslash is one of those), then perl will pass it as an argument to /bin/sh -c instead of using execvp(2) directly.
The same holds true for the system, exec, open2, etc functions in perl, and is documented in perldoc -f system.
A simpler example:
$ foo(){ echo foo; }; export -f foo

$ perl -e 'system shift' '/bin/bash -c foo\ a'
/bin/bash: foo: command not found
$ perl -e 'system shift' '/bin/bash -c foo'
foo
$ perl -e 'system shift' '/bin/bash -c "foo"'
/bin/bash: foo: command not found

$ perl -e 'open F, "|-", shift' '/bin/bash -c foo\ a'
/bin/bash: foo: command not found
$ perl -e 'open F, "|-", shift' '/bin/bash -c foo'
foo

The work-around is to run external commands with the user's $ENV{SHELL}, which will let them use any shell features seamlessly:
perl -e 'open F, "|-", $ENV{SHELL}, "-c", "@ARGV"' '/bin/bash -c "foo a"'

A: You're having trouble with portability of an exported bash function across systems.
Yes, that makes sense.
To improve portability simply
$ touch myfunc
$ chmod a+x myfunc

and put the desired bash code in that file,
starting with a #! /usr/bin/env bash shebang line.
(env obeys $PATH, you see.)
Then you're relying on the ability of programs
(including gnu parallel) to fork+exec,
rather than on how well variants like sh or dash conform to bash behavior.


text:
Q: How to disable the Windows 8 Charms bar programmatically? I need to create an application that will run full-screen on Windows 8 and which the user shouldn't be able to exit easily.
Since the application will be running on computers or tablets with only tactile input, I was going to create a chromeless and top-most WPF application, which could only be closed if a keyboard is connected.
The problem is that the app switching bar on the left and the charms bar on the right can still be opened without a keyboard and would allow users to exit the application. Can this be disabled from code? I can't seem to find a way.
The easy solution would be to run on another OS, but the machines will be running Windows 8 and there's not much I can do about that.

A: I have dug up a .TXT with some notes I found somewhere on the net some time ago, it might be helpful (worst case scenario, it doesn't apply to Windows 8 and doesn't work. Unfortunately I'm unable to cite a source for it, I don't really remember where it came from):
A "kiosk mode" has already existed since XP. Usually it's aimed at locking IE up in order to show some interactive webpage while not letting the user close it: it's called mandatory user profiles.
To set it up:

*

*Set up the account just the way you want. Set the group policy, set up the startup programs
The user must be a standard user, not an admin. But then again, if an unauthorized person can get admin rights even though the computer is "frozen", I think you got more serious problems.

*Login as admin and Computer Properties > Advanced > User Profiles Settings > (select that profile) > (copy it to whatever place) > set "permitted to use" to Everyone

*Go to that folder properties > Security > (change it so that Everyone can read and modify, but not write, make sure you apply to EVERYTHING inside)

*Rename NTUSER.DAT to NTUSER.MAN

*Open Computer Management > Local Users and Groups > Users > (create a new user) > (open that newly created user) > Profile > (on profile path, set it to that folder)

*Disable the user that you just copied (since you don't want people to login to there)

When you're finished and log in the new account, you will find out it performs almost like kiosk mode that you have been seeking for. To undo changes, log off and log back in.

A: I had the exact same problem, and form what I know unless you're using a self-made rootkit to disable the Charms Bar there's no way to do it. That's the way I've been operating after considering all the other options.
To save you some time here's what won't work.

*

*Classic Shell.

*Start Menu Suite.

*Registry Edit of EdgeUI.

*Disabling by rightclicking start menu -- though you should do this to disable other features.

Here are some options that may work, though not pretty. Look into the following:

*

*Sideloading Apps

*Recreating a Windows Store App

*Rootkit

Otherwise, there's not much you can do. I would love to hear how you solved this though.
Check out a similar question I asked: Kiosks in Windows 8 Running Regular Software (Non-Windows Store App)

A: Kill explorer.exe when your application launches and charms bar won't work.

A: I know it might be a bit late to answer this question but hopefully this helps someone else, in your Regedit there is a regkey that allows you to choose what 'Shell' windows boots into, by default it is set to explorer.exe if you change this it will boot into whatever program that you would like without going through the stupid windows 8 start menu.
Regkey is at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\shell

Hope that helps you all.

A: Simple solution, not perfect but works, every time the charms bar is activate, your application is deactivate, so reactivate it immediately and the charms bar disappear. add this in your App.xaml.cs
DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
    public App()
    {
        this.Deactivated += App_Deactivated;
        this.Activated += App_Activated;
        timer.Tick += delegate
        {
            Application.Current.MainWindow.Activate();
        };
        timer.Interval = new TimeSpan(0, 0, 0, 0, 10);
    }

    void App_Activated(object sender, EventArgs e)
    {
        timer.Stop();
    }

    void App_Deactivated(object sender, EventArgs e)
    {
        timer.Start();
    }

A: The year is 2018 and Window 10 almost completely pushed out Windows 8. Win8's "hot corners" are again cold in Win10 - they were obviously a great success. But if you still need to disable them in Win8.x/Win2012 and end up here searching for a solution (as I did), here's how I solved it.
I realised that Windows disables them automatically if a full-screen application is active and covering the task-bar. Since my application is dialog-based and not full-screen, I create a transparent window (transparent optically and transparent for input) and set it as the parent window for my dialog. Now this invisible window covers the whole screen -> hot corners are disabled.
Something like this (simplified):
int nVirtualScreenLeft   = GetSystemMetrics (SM_XVIRTUALSCREEN);
int nVirtualScreenTop    = GetSystemMetrics (SM_YVIRTUALSCREEN);
int nVirtualScreenWidth  = GetSystemMetrics (SM_CXVIRTUALSCREEN);
int nVirtualScreenHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);

HWND hwndFullScreenInvisible = CreateWindowEx(
    WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW,
    _T("Static"), strWindowCaption,
    WS_VISIBLE | WS_POPUP,
    nVirtualScreenLeft, nVirtualScreenTop, nVirtualScreenWidth, nVirtualScreenHeight,
    HWND_DESKTOP, NULL, NULL, NULL);

if (hwndFullScreenInvisible != NULL)
{
    BOOL bRet = SetLayeredWindowAttributes (hwndFullScreenInvisible, /*COLORREF = */ 0, /* byAlpha = */ 0, LWA_ALPHA);
}

CMyDlg dlg (CWnd::FromHandle(hwndFullScreenInvisible));
dlg.DoModal ();

A: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUI\DisableTLcorner DWORD=1
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUI\DisableCharmsHint DWORD=1


text:
Q: Why I do not need to import the android "R" class? This is more a java beginner's question, but it is related to an Android code.
Here is my MainActivity.java:
package tld.mydomain.buttonclickcounter;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private EditText myEditText;
    private Button myButton;
    private TextView myTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myEditText = (EditText) findViewById(R.id.myEditText);
        myButton = (Button) findViewById(R.id.myButton);
        myTextView = (TextView) findViewById(R.id.myTextView);
    }
}

As you can see, I'm using the R class without having to import it. How can it be possible? I believed that in Java everything needed to imported to be used. How java compiler knows where to get the class? I am using Android Studio.

A: It is because your MainActivity.java are inside the package name which is the same as package name declared in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tld.mydomain.buttonclickcounter">

</manifest>

The R.java will be generated based on the package name in AndroidManifest.xml. So, if you're using other package name like tld.mydomain:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tld.mydomain">

</manifest>

you then need to import the R.java with tld.mydomain.R.

A: Because R.java and MainActivity.java are inside tld.mydomain.buttonclickcounter package and your package is mentioned in AndroidManifest.xml. To test whether R.java is inside tld.mydomain.buttonclickcounter package you can decompile your apk.


text:
Q: Manifold visualization in 2D maps I am trying to implement in C the algorithm by Parker and Chua as described in the book "Practical Numerical Algorithms for Chaotic Systems" (chapter 6).
In that chapter, the authors describe a method to plot manifolds for discrete time systems (aka maps). I am trying to translate the pseudocode given into a C code for standard map (Chirikov-Taylor). I already did it for Fortran and now C gives the same issue as Fortran 90.
The idea is to display points on (unstable, for while) manifold such that the distance between them are not far from a given tolerance. If so, then points are linearly interpolated. As authors says, like a window moving and revealing the manifold.
The problem is that the output gives some points on manifold, but after few points the output hangs at one value.
I am warned about C and Fortran, specially about arrays indexation. But I can't see what is wrong with the method or my translation from pseudocode...
I know there are plenty of methods for manifolds visualization and papers about it, but if I am not able to construct one from a given pseudocode, I doubt if my other implementations are in the right way... so I prefer to make it work.
Well, let me show a simplified version of my code, that should work (in C):
  x_bar = alpha * vx;
  y_bar = alpha * vy;

  //choose linear approximation as initial condition
  x[0] = x_bar;
  p[0] = y_bar;

  //iterate once
  x[1] = map_x(x[0], p[0]);
  p[1] = map_p(x[0], p[0]);

  //iterate again
  x[2] = map_x(x[1], p[1]);
  p[2] = map_p(x[1], p[1]);

  x_new = x[1];
  y_new = p[1];

  do
    {
      dist = sqrt( pow((x[2] - x[1]), 2.) + pow((p[2] - p[1]), 2.) );

      if(dist < 0.001) //absolute criteria for while...
    {
      //accept the point and move the window
      printf("%f\t %f\n", x[0], p[0]);

      x[0] = x[1];
      p[0] = p[1];

      x[1] = x[2];
      p[1] = p[2];

      i++;
    }
      else
    {
      //linear interpolation required
      x_new = (x[0] + x_new) / 2.;
      y_new = (p[0] + y_new) / 2.;

      x_aux = map_x(x_new, y_new);
      y_aux = map_p(x_new, y_new);

      x[2] = x_aux;
      p[2] = y_aux;
    }
    }
  while(i < 10);

In the code above, vx and vy are the eigenvectors of the Jacobian matrix, evaluated at the fixed point (x, p) = (0, 0).
My functions 'map_x' and 'map_p' are working well and returns the one step iteration of the Chirikov-Taylor map.
I attached a figure produced by first steps of my code. Consider r = (x, p).
Fig: first points produced by the algorithm
Thank you in advance.

A: It seems that if the dist < 0.001 you aren't updating the x[2] or p[2] but you are setting x[1]=x[2] and p[1]=p[2]. This means the next time it loops the distance will be 0 because you're doing x[2]-x[1] and p[2]-p[1] but they're equal to each other so you'll get dist = 0. And 0 < 0.001 so you'll just keep repeating this and be stuck at the same point.
You're probably missing something like:
if (dist < 0.001) {
// other stuff
x[2] = map_x(x[1], p[1]);
p[2] = map_p(x[1], p[1]);
} else { // ...


text:
Q: Automatically extract data from graph I have a graph like:

I would like to generate a set of (x,y) pairs that correspond to points of this graph.
Maybe one for each horizontal pixel.
How would I go about doing this?
If I had the image in uncompressed bitmap format, maybe cropped to the actual graph, I could examine each vertical strip for the blackest point...
I would prefer to work in Python, but I'm interested in any technique.

A: I answered a question like this a while back. It should be fairly easy to detect the grid, from there you can get the pixel's coordinates relatively to the grid. However, it wasn't clear how to extract the numbers, which you need to do in order to get the the scale of the grid. Although, it might be possible fairly easily if you can match the font and font size (which might be possible via scaling). Otherwise, you'd have to enter the numbers manually.
To extract the grid, you'd start from the top right and move diagonally until you find the start of the grid. From there you can follow the vertical and horizontal lines (of the grid) until they end. This should allow you to say with fairly high probability where the outer rectangle of the grid is and what the x and y intervals of the grid are in terms of pixels. The blackest parts within the grid should do for finding the curve, but it may require some interpolation depending on how many data points you need/want.
It also may be useful to look into techniques for reversing anti-aliasing effects. Although, the uncompressed bitmap image may not need it.


text:
Q: get list of child class in python I have some class like this
class Base(object):
 __child_class__ = []

class ChildA(Base): pass

class ChildB(Base): pass

What I need to do for the interpreter to automatically fill the argument __child_class__ by all the child class so I can have this result
Base.__child_class__ = [ChildA, ChildB]

Do I need the metaclass for this?


text:
Q: Function of distance to a moving object I have few problems, I'll try to split them in an understandable way. If you are good at linear algebra, could you take a look at the second part? (Both questions are clickable links.)
(1)
Two objects are situated at a arbitiary distance from one another. One is immobile (A), one is moving (B) at a constant velocity (Bv). What is the distance (d) between them at a given time?
The distance can be a scalar or a vector, either one helps. Thanks!
(2)
Two same objects, but at a given time, B wants to move straight toward A with a certain speed (a). We want to find the vector (V) along which we apply the acceleration force
Think: I'm a rocket inside an asteroid formation, in a few seconds I'd like to move straight towards THAT asteroid. Which direction should I face and how long should I use my thrusters?
[PS 1] The function is meant to be used by computer script, so try to go easy on usage of square roots :)


text:
Q: VIM - NerdTree - Open Bookmarks when VIM is started I set VIM to open NERDTree whenever VIM is started by doing this: autocmd VimEnter * NERDTree
What changes should I make to my vimrc file so that the Bookmarks also open up whenever VIM & NerdTree are started?

A: From the help file of Nerdtree :

2.2.1. The Bookmark Table NERDTreeBookmarkTable
  If the bookmark table is active (see |NERDTree-B| and |'NERDTreeShowBookmarks'|), it will be rendered above the tree. You can double click bookmarks or use the |NERDTree-o| mapping to activate them. See also, |NERDTree-t| and |NERDTree-T|

So I guess that
let NERDTreeShowBookmarks=1 in your .vimrc should work.

A: I know this question was asked a while ago but since it is at the top of the google results I thought I would give the proper answer.
In your .vimrc file NERDTreeFromBookmark will not op a bookmark name BUT it will open a hard path.
For example:
au VimEnter *  NERDTreeFromBookmark /path/to/your/bookmark/folder/

This will open NERDTree at that location on VIM startup.
Hope that helps some people.
EDIT:
im guessing you could also do:
au VimEnter *  NERDTree /path/to/a/folder/

A: let NERDTreeShowBookmarks=1 will display the bookmarks table on startup.  If you wanted to actually open the files for editing, I'm not sure how to do that.
NERDTree provides a very nice documentation file.  If you extracted the zip file in ~/.vim, it is located at ~/.vim/doc/NERD_tree.txt.  If you want to use with vim's built in help, run :helptags ~/.vim/doc/ and then you'll be able to access it with :help NERDTree.
Of course, if you extracted the zip someplace else, replace ~/.vim with the folder you extracted it into.


text:
Q: How to get details of Deleted rpms I had some rpms which was build locally using rpm-build.I installed it on CentOS machine and later i removed and installed latest build ones. Now i am in a situation to get the previous installed rpm version. Is there any way to get the list of removed rpms??. I removed the previous rpms using "rpm -e" command.

A: Older versions stored a snapshot of the installed RPMs in /var/log/rpmpkgs - I don't remember what interval, but it's not built-in; it was a cron job. Newer distributions don't seem to do that any more, because yum logs everything natively, and the cron job was kind of a hack.
You don't say what version of CentOS, but if you don't have that log file, I think you're out of luck. You might get lucky and have it in somebody's shell history (root or a user who ran sudo).


text:
Q: How would I use arrays in Bash to symlink ALL dotfiles to their correct directories (Including files in nested Dotfiles directories)? So, I am trying to use Bash to automate dotfiles. Before you ask, this is not the problem. I have that part figured out. Here is what my code looks like:
configs=(
    ~/.config/alacritty
    ~/.config/dunst
    ~/.config/flameshot
    ~/.config/i3
    ~/.config/i3status
    ~/.config/kitty
    ~/.config/nvim
    ~/.config/picom
    ~/.config/rofi
    ~/.config/gtk-3.0
    ~/.config/obs-studio
    ~/.config/sway
    ~/.config/waybar
    ~/.config/swappy
    ~/.config/mako
    ~/.config/swaylock
    ~/.config/Code\ -\ OSS/User/settings.json
)

for name in "${configs[@]}"; do
    if [ ! -e "$name" ]; then
        echo "$name does not exist."
        ln -sfv "$HOME/Dotfiles/configs/${name##*/}" "$name"
    else
        echo "$name exists."
    fi
done

Well, there's an issue there. It works perfectly fine until it gets to attempting to symlink ~/.config/Code\ -\ OSS/User/settings.json. When symlinking, the Bash script ignores everything up until the last /.
This means that when I run the script, it creates a file in ~/.config/Code\ -\ OSS/User/settings.json that directs itself to ~/Dotfiles/configs/settings.json, and not the Code\ -\ OSS directory that I created in Dotfiles.
How do I set this up so that it will symlink all of those files in the array above so that it redirects to the corresponding Dotfiles file?

A: Focusing on the last element in the array, you are executing:
ln -sfv "$HOME/Dotfiles/configs/settings.json" ~/.config/Code\ -\ OSS/User/settings.json

(assuming the subdirectories already exist)
Then the following symlink is created:
~/.config/Code\ -\ OSS/User/settings.json -> ~/Dotfiles/configs/settings.json

(Please note the lhs is the symlink name and the rhs is the actual file.)
Your mentioned results are very natural behavior.
Instead, if you want to create the symlink such as:
~/.config/Code\ -\ OSS/User/settings.json -> ~/Dotfiles/configs/Code\ -\ OSS/User/settings.json

Then you will need to say:
for name in "${configs[@]}"; do
    if [ ! -e "$name" ]; then
        echo "$name does not exist."
        ln -sfv "$HOME/Dotfiles/configs/${name#*config/}" "$name"
    else
        echo "$name exists."
    fi
done


text:
Q: Is it proper to use HTTP response code representing business exception on server side? The background is like this:

*

*The client web browser send a request to the server;

*The server program will launch some biz check rules before doing the real work.

If check fail, some tips should be feed back to the client browser.
So, here is the question. Should I use an error response http code to indicate this, or use 200 directly, and then parse the message from response body.
Sometimes, this is not a problem. But, some client component give some util methods if error code returned. So, that's a hard decision to make:

*

*return 200,and error message. parse and show them myself;

*return some code like 500, let the client component to show it directly.

A: I would suggest to use as many http status codes as possible. That is a standard and why should you not use them?
Here are some examples where IMHO the usage of http status codes makes sense:

*

*Somebody wants a dataset wich is not aviable use 404 not found

*A secured ressource needs an authentification use 401

*A ressource which is not aviable for the currient user should get a 403 forbidden

*A error accours which you cannot handle well write out an 500 status

*And so on

Look also for the logic for REST-APIs there you can see the advantages.

A: Typically, you'll want to indicate the reason the service failed.  Returning custom errors can also potentially allow the client application to respond in an appropriate way.  If an input validation check fails, for instance, I imagine the user would appreciate the chance to fix and resubmit the request.  An HTTP error won't be enough to indicate what exactly went wrong.


text:
Q: Questions on dynamoDB query result I'm currently thinking about how I should write my queries for DynamoDB. I have questions below which I hope someone could advise me on it.
Given scenarios: I have a million records on a table.
Questions:

*

*When I query, can I fetch 1000 records in batches instead of 1 million records at one go?

*Is the time taken to fetch 1000 records similar to 1 million records?

*What happens if I hit the limit of 1MB or my throughput for the table so that I can fetch again for the remaining records?
Thanks in advance!

A: 1) Yes you can specify a limit for a query (1000 in your case).
2) No. The time is not the same. More records will mean more time - because you will need to fetch more pages (most time will be spend in network roundtrips)
3) If you hit the 1MB limit, Dynamo will provide a LastEvaluatedKey. You repeat the request and pass the LastEvaluatedKey until you fetch everything (you are basically fetching in a loop).
If you hit the provisioned throughput limits, you either increase the limits or you back off (i.e. you need to regulate your consumption to stay within the limits)
Reference: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html


text:
Q:  and  elements do not show up Website:

*

*http://www.crystal-grace.so/compendium/resume.html

*http://www.crystal-grace.so/compendium/index.html
CSS:

*

*http://www.crystal-grace.so/compendium/css/master.css
Hi, for some reason the nav and section elements do not show on the site. The only attributes are the height and background-color that shows. It shows up properly on my old (3.6.25) version of Firefox, but remains the same with Chrome and Safari.
I believe the master.css needs to be fixed for the nav and section elements, but I am unsure.
FYI, I have put the following in my document:
1) both HTML files
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->

2) master.css
header, footer, article, section, nav, menu, hgroup {
display: block;
}

Any help would be greatly appreciated!!

A: The footer is over the whole thing. If you assign a lower value to the footer's z-index, like -200, they show up. (tested in Chrome)

A: This is causing the problem:
footer {
    background: none repeat scroll 0 0 #1D1C1C;
}

Just remove that background property... or have this instead:
background-color: #1D1C1C;

The 0 0 part of the original value appears to overlay the page with the #1D1C1C color. That value doesn't make sense to me...

A: I have found something else than others. If you remove float: left; from styling of section tag (line no. 148. in master.css file), both seem to be working correctly.
Personally, I think you have made an overkill with styling, if so many solutions are correct and working.


text:
Q: Write tests for Visual Studio extensions I have written an extension for VS 2017 but I can't seem to find how to write tests for it.
Can someone please refer me to a resource explain how to test the extension?

A: See for example VisualStudio-TestHost and VsixTesting projects.


text:
Q: I've installed the Admob plugin into my Phonegap project... now what? Following the installation instructions on the Admob Phonegap plugin page on GitHub, it seems like it's all gone well without errors.
However, even though the functionality is theoretically available, I don't see how to implement it. Where in my Javascript or HTML files do I place code to actually display an Admob ad?
Where do I get that code for the Admob ad?
Just so it's clear, I have added the relevant Java .JAR files to my project, I've edited the .XML files, so the plugin is enabled. But there is an extra step, which is to actually place an ad somewhere in my web pages. With a Google Adsense ad, I take a snippet of Javascript and place it in my HTML layout. I am trying to figure out how to connect my HTML/Javascript interface to the Admob plugin that I have (successfully) installed in my project.
An answer would ideally say what is the code to put into my HTML/Javascript, and where to put it. Previously I had Google Adsense code, which is not allowed on mobile apps, so I'm trying to figure out what to replace it with. I have a <DIV> that previously contained the Google Adsense, so what do I put in it?

A: The plugin project you linked to is using the Android AdMob SDK which is a Android native component and doesn't require you to add anything to your Phonegap/Cordova HTML/Javascript code in any way. What is happening is that you are modifying your DroidGap Activity and adding a AdMob AdView component along side the WebView which contains your HTML/Javascript.
The code gets the linear layout which your WebView is held and adds in the AdView.
adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit);
LinearLayout layout = super.root;
layout.addView(adView);

After that it is just initializing the Ad.


text:
Q: How to build a function when parameters are combination of string and array(object) in javascript? I'm reading values from excel and then trying to build a function based on parameters it has.
It will have dynamic parameters in combination of strings and arrays as per its usage in function.
My sample code as below
excel
A1 = 'test'
A2 = ['test1','test2']

JS
function test(params){
..
var paramValues = params.split(","); //params1=A1, params2=A2 here params is sheet name
    if(paramValues != null)
    {
        for(var pi = 0;pi<paramValues.length;pi++)
        {
            index = paramValues[pi].substring(6) //returns value of row number as index
            var paramCellVal = await excel.getCellValue("A"+index) //returns 'test' in iteration 1,['test1','test2'] in iteration 2
            actualParams.push(paramCellVal) //push values to array
        }
        console.log(actualParams+"actualParams"+typeof(actualParams)) //returns object
        action =  findFunction(...actualParams);
    }
    else
    {
        ...
    }
}

function findFunction(...actualParams){
    run(...actualParams)
}

function run(param1, param2){
console.log(param1, typeof(param1))
console.log(param2, typeof(param2))
console.log(param2[0], typeof(param2[0]))
console.log(param2[0], typeof(param2[1]))
}

expected output:
'test', string
['test1','test2'], object
'test1', string
'test2', string

actual output:
'test', string
['test1','test2'], string
[, string
', string

My expectation is to build dynamic function with different set of variables, hence used spread syntax.

A: function run(param1, param2){
console.log(param1, typeof(param1))
console.log(JSON.stringify(param2), typeof(JSON.stringify(param2)))
console.log(JSON.stringify(param2[0]), typeof(JSON.stringify(param2[0])))
console.log(JSON.stringify(param2[1]), typeof(JSON.stringify(param2[1])))
}


text:
Q: How to dynamically equal the DIV height I have two columns in my layout. Main content and side bar. My requirement is the side bar should automatically adjust its height if the main content is growing. And I want to achieve this vice versa.
Here is the sample code: http://jsfiddle.net/SZ7y9/4/
It will be great if I get the fix for IE6 too.

A: Faux columns is good but if you want a pure CSS version - http://jsfiddle.net/spacebeers/s8uLG/3/
You set your container up with overflow set to hidden, then on each div add negative margin-bottom and equal positive padding-bottom.
#container { overflow: hidden; }
#container div { float: left; background: #ccc; width: 200px; margin-bottom: -2000px; padding-bottom: 2000px; }
#container .col2 { background: #eee; }

Content 1

Content 2

Content 2

Content 2

Content 2

EDIT: If you want a border round it then have a look at this example - http://www.ejeliot.com/samples/equal-height-columns/example-6.html

A: I think faux columns would work: http://www.alistapart.com/articles/fauxcolumns/

A: I've seen this needed a million times. Generally what I'll do is this:
Fiddle
Basically put an inner container in there, with the sidebar background color, and set the sidebar to transparent. Then, if you want the background to show through in the gutter, put a border-right on the main-content area, so that you get a sort of artificial gutter.
Caveat: The main content area needs to be longer than the sidebar, or the "gutter" will only show as far down as the main content area. I'll generally "fix" this by setting a minimum height on the main-content area.


text:
Q: Paypal direct recurring payment upgrade/cancel payment How does paypal Direct recursive payment work (using paypal business acc)

*

*If my client wants to cancel the recursive payment

*If my client wants to upgrade his/her payment method

May i know the API calls i should make to Cancel a recursive payment and Upgrade a recursive payment.

A: You can use ManageRecurringPaymentsProfileStatus API call to Cancel, Suspend or Reactive a recurring profile.
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/ManageRecurringPaymentsProfileStatus_API_Operation_NVP/
You can use UpdateRecurringPaymentsProfile API call to update the recurring profile.
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/UpdateRecurringPaymentsProfile_API_Operation_NVP/


text:
Q: Use internal class in input parameters of a DataTestMethod I am using DataTestMethod with a custom DataSource attribute and I am facing a problem when I want to use an internal class in the input parameters for the DataTestMethod.
[DataTestMethod, CustomDataSource]
public void TestMethod(MyInternalClass param1)
{
    // Do whatever
}

I see the following error:

Inconsistent accessibility: parameter type 'MyInternalClass' is less
  accessible than method 'TestMethod(MyInternalClass)'

Is there a way to solve this?
I am already using the InternalsVisibleTo attribute in the project so that the test project can use the internal types.


text:
Q: iPhone Enterpise Deployment: Mobile Device Management I was reading up on iPhone in the enterprise and saw something about Mobile Device Management servers. As far as I can tell, there are a few 3rd party MDM vendors, but Apple says that one could implement their own.
The iPhone Configuration Utility allows you to set up a Server URL, Check in URL, Topic, Identity, and some other things for an MDM, but there's little information on how to build a server that hooks in with these.
I've looked in the Enterprise Deployment, iPhone Configuration, and even the iPhone Mobile Device Management docs, but have found little aside from vague mentions or the occasional diagram. Is there a documented protocol somewhere?

A: The best document for iOS MDM implementation is https://media.blackhat.com/bh-us-11/Schuetz/BH_US_11_Schuetz_InsideAppleMDM_WP.pdf.
You can get sufficient detail to implement iOS MDM. Refer this  How to develop iPhone MDM Server?  and this generate MDM certificate

A: I think the all you need is in here in apple website  click here
If still you require any more, Here is the link of  Mobile device management Download Pdf
It may help you to configure your own MDM server.

A: I think you might find that protocol for MDM here..
Mobile Device Management for enterprise

A: You better follow the apple provided ruby code. Set it up and make it working. After that you can simply convert that to any language. That worked for me.

A: DeviceMax http://www.kochartech.com/mobile-device-management-enterprise.html?tab=enterprise Enterprise Mobile Device Management (MDM) offers end -to-end security, enterprise grade architecture, world class service and support across major mobile platforms available. It addresses every facet of the need, for mobile device configuration at present and provides a framework for meeting future needs with most advanced technology.

A: There are a lot of MDM products that serves the iOS device management purpose. There are a lot out there like Airwatch, Mobileiron, Meraki, SimpleMDM etc. I've tried out Hexnode MDM and it is worth checking out.
Hope this helps.

A: Mobile Device Management makes it easy to manage iOS devices. There are a lot of MDM vendors available in the industry. You can reach out them for solutions.


text:
Q: Prove a > 0 is a terminating decimal if and only if it has more than one decimal representation I want to prove that if we choose a positive real $a$ that has a terminating decimal representation, it has more than one decimal representation, and if a number has more than one decimal representation, one of them is terminating, using the theorem of Completeness of Numbers.
NOTE: There is a similar question asked previously (Which real numbers have two representations?), but the accepted answer there doesn't provide any proof to the problem.

A: The first statement is easy to prove.
Suppose
$$a=\sum_{k=1}^{n}a_k\cdot 10^{-k},$$
then also
$$\sum_{k=1}^{n-1}a_k\cdot 10^{-k} + (a_{n}-1)\cdot 10^{-n} + \sum_{k=n+1}^{+\infty}9 \cdot 10^{-k}$$
converges to $a$, since the last term is a geometric series converging to $10^{-n}$.

Let us now suppose that
$$a = \sum_{k=1}^{+\infty}a_k\cdot 10^{-k}=\sum_{k=1}^{+\infty}b_k \cdot 10^{-k},$$
with $a_j\neq b_j$ for some $j\in \Bbb Z^+$, and $a_k=b_k$ for $1 \leq k < j$.
Suppose, e.g., that $a_j> b_j$, and consider the series
\begin{eqnarray}
S &=& \sum_{k=1}^{+\infty}a_k\cdot 10^{-k}-\sum_{k=1}^{+\infty}b_k \cdot 10^{-k}\\
&=&\underbrace{\sum_{k=j}^{+\infty}a_k\cdot 10^{-k}}_A-\underbrace{\sum_{k=j}^{+\infty}b_k\cdot 10^{-k}}_{B},
\end{eqnarray}
where we took advantage of absolute convergences of both terms, in order to use the associative property. With our hypothesis, $S\to 0$.
Let $h$ the position of the first non-$9$ digit following $b_j$. Then
$$A>\sum_{k=j}^h a_k\cdot 10^{-k}=A^-$$
and
$$B < \sum_{k=j}^{h-1}b_k\cdot 10^{-k} + (b_h+1)\cdot 10^{-h}=B^+.$$
Thus
$$S > A^--B^+>0$$
cannot converge to $0$, as required. We have a contradicion, and $b_j$ therefore must be followed by an infinite sequence of $9$'s (of course this also implies $b_j=a_j-1$ and $a_k = 0$ for $k>j$).

A: I assume you're familiar with the proof for the converse and are asking about a proof of the conditional, i.e if a number has more than one decimal representation it must be terminating. We can prove this by contradiction.
Suppose there exists a non-terminating decimal with two decimal representations, call them $\alpha$ and $\beta$. Let the $k$th decimal place be the first place they differ, and say from the $k$th place onward, the decimal representations $\alpha$ and $\beta$ are $\;\overline{a_0a_1a_2a_3...}\;$ and $\;\overline{b_0b_1b_2b_3...}\;$ respectively; WLOG assume $a_0 \gt b_0$.
Introduce two terminating decimals, $\alpha_0$ and $\beta_0$, that agree with $\alpha$ and $\beta$ up to the $k$th decimal place and then terminate. Since $a_0 \gt b_0$, clearly $\alpha_0 \gt \beta_0$. Now consider $\beta_0 + 10^{-k}$ (essentially adding 1 to the last decimal place of $\beta_0$.) Then $\alpha_0 \ge \beta_0 + 10^{-k}$. But this leads to
$$\alpha \gt \alpha_0 \ge \beta_0 + 10^{-k} \ge \beta$$
which contradicts the assumption that $\alpha$ and $\beta$ represent the same non-terminating decimal.
[The first inequality in the above statement comes from the fact that at least one of the $a_{j\gt0}$ must be non-zero, else $\alpha$ would be terminating; the last inequality from the fact that even if we maximize $\beta$ by setting each $b_{j\gt0}$ to 9, $\beta$ would still only be equal to $\beta_0 + 10^{-k}$.]


text:
Q: Is it possible to click a Button without ever losing focus on a TextBox? I am trying to develop a touchscreen keyboard control in a C# WPF project that will be visible when a TextBox gets focus and is hidden when the TextBox loses focus.  The projects I have seen for touchscreen keyboards have accomplished this by defining the keyboard as a new window rather than a control.
For my application, I would really like to have the keyboard as a control within the main application window.  Is there a way to allow a button to be clicked (on the keyboard control) without causing the TextBox to lose focus?  Ideally, I would like to just place a character at the current position of the carat.

A: Set Focusable="False" on the Button.  You will still be able to click it with the mouse, and it will still call your click event handler, but it won't acquire focus or cause the TextBox to lose focus.

A: An alternative is to use a PictureBox instead o a Button, then you would customize it. PictureBoxes don't lose focus when clicked.


text:
Q: Run local bash script on multiple remote machine I have below bash script,every time i want to create a user i need to copy this script to server and run it.
Is there any thing we can do so that this script fetches the IP's from a hosts.txt file(running script on multiple server's)one by one and create user on server.Also,we need to be root to run this script.
1.ask for password once and use it in script for rest of the script where ever necessary.
2.login as normal user.
3.become a root user and run the script
#!/bin/bash

#Script to Add User

read -p 'Please Enter The Username To Add: ' name
echo "$name" > /tmp/userlist.txt
clear
echo -e "Hallo $name\nYour Name Is Added To The List."
userfile=/tmp/userlist.txt
username=$(cat /tmp/userlist.txt | tr 'A-Z' 'a-z')
for user in $username
do
useradd $user -N -s /bin/bash
usermod -aG sudo $user
passwd $user
done
echo "=================================="

echo "User $name Have Been Created."

echo "=================================="
tail /etc/passwd | cut -d: -f1

A: If you want to copy the script and run it from a centralized point create a general provisioning script in charge of copying and executing

*

*Create an array list, in this case I used a file called hostList.active

*Set the only argument to be the script you're trying to copy & execute on the remote server. (In this case it will run in the remote machines home directory)
#! /bin/bash
while read box; do
  ping -c 1 -w 1 -q $box > /dev/null
  if (test $? = 0); then
      echo "***************************************************************"
      echo $box
      scp $1 $box:~/.
      ssh -n -o stricthostkeychecking=no -X $box "~/$1"
   else echo $box is not responding to ping
       echo $box >> hostList.notdone
   fi
done < hostList.active

I placed 2 test servers in my array list file (hostList.active) and it connected to both, copied the script and executed it.
   ./copyandrun.sh bogus.sh

   ***************************************************************
    tsweb
    bogus.sh                                                            100%   36     0.0KB/s   00:00
    Running a Test
    ***************************************************************
    tsdb
    bogus.sh                                                            100%   36     0.0KB/s   00:00
    Running a Test

Ensure the script your copying has proper permissions to be able to be executed by whatever user your copying it over as.


text:
Q: Proving divergence of $\sum_2^\infty{(-1)^n}{1\over \sqrt n+(-1)^n}$ Q: Is $\sum_2^\infty{(-1)^n}{a_n}$ convergent?
$$a_n={1\over \sqrt n+(-1)^n} \space \forall n\in\mathbb{N_{\ge2}}$$
The answer says it diverges.The only thing I could deduce is that the series is not absolutely convergent by comparison test.I  tried to find a smaller diverging series but failed miserably.I guess only thing that can be done is to show the series doesn't meet
the Cauchy criterion but the difference of two partial sums looks horribly refractory to me.

A: We have
$${(-1)^n\over \sqrt n+(-1)^n}=\frac{(-1)^n}{\sqrt n}\frac{1}{1+\frac{(-1)^n}{\sqrt n}}=\frac{(-1)^n}{\sqrt n}\left(1-\frac{(-1)^n}{\sqrt n}+O\left(\frac 1 n\right)\right)\\=\frac{(-1)^n}{\sqrt n}-\frac{1}{n}+O\left(\frac 1 {n^{3/2}}\right)$$
so the given series is sum of three series:

*

*the first is convergent by Leibniz rule

*the second is the harmonic divergent series

*the third is convergent by comparison with a Riemann series. Conclude.

A: Just group the terms in pairs and look for a way to estimate $b_n = a_{2n} - a_{2n+1}$. If the sum of $b_n$ diverges then so does the original (actually the two series are equivalent because $a_n\to 0$).

A: \begin{align}
a_{2n}+a_{2n+1}&=\frac{1}{\sqrt{2n}+1}-\frac{1}{\sqrt{2n+1}-1}=\frac{-2+(\sqrt{2n+1}-\sqrt{2n})}{\sqrt{2n(2n+1)}+\sqrt{2n+1}-\sqrt{2n}-1} \\ &=
\frac{-2-\frac{1}{\sqrt{2n}+\sqrt{2n+1}}}{2n\sqrt{1+\frac{1}{2n+1}}-\frac{1}{\sqrt{2n+1}+\sqrt{2n}}-1}=-\frac{1}{n}\left(\frac{1+\frac{1}{2\sqrt{2n}+2\sqrt{2n+1}}}{\sqrt{1+\frac{1}{2n+1}}-\frac{1}{2n\sqrt{2n+1}+2n\sqrt{2n}}-\frac{1}{2n}}\right).
\end{align}
Clearly
$$
n(a_{2n}+a_{2n+1})\to -1.
$$
In fact
$$
\left|\,a_{2n}+a_{2n+1}+\frac{1}{n}\right|\le \frac{k}{n^{3/2}},
$$
for a suitable $k>0$
and hence the series it diverges.


text:
Q: Cox-Hazard Ratio differences in Software suits; Manual calculation Working in clinical research my task is to calculate the Hazard ratio, better to check the calculations of someone else. This first calculation was based on ARM=(3 different treatments) with only t=(end-times) and censored data of format CNSR=(a,b,...) in {0,1} in the software suite SAS.
I redid the work in NCSS and R, all three computations totally different.
Please let me post my R-Code:
library(survival)
    data<-filter_na_values(data)
    surv_obj<-Surv(data$times,data$censor)
    result<-coxph(surv_obj~ARM,data)
Resulting from this code I got coefficients which tends to resemble the NCSS and SAS output at least in direction, yet have a high error rate. All 3 outputs could yield different results.
Please help getting insights into this problem, I would be especially interested in literature on how to calc cox-hazard ratio manually; code samples of how a similiar setting is done right, criterias to check the output by and additional packages to redo the calculations on. All three treatment ARM's are varying in size, if it matters.
Thx for the flowers.


text:
Q: Custom stepping tree traversal generator I want to traverse a dom tree with a generator with a custom matcher callback, when yield value, return an array with traversed nodes in between. Say I have this structure.
  root
  / \
P1   P2
 |   |
T1   T2

I want to do iter.next(isP) or iter.next(isText) update matcher and step til next node match.
type Matcher = (node: INode) => boolean
export function* nextNode(node: INode, matcher: Matcher = () => true, store: []): Generator<INode, any, Matcher> {
  let reset: Matcher = matcher
  store = store.concat(node)
  if (reset(node)) {
    reset = yield store
    store = []
  }
  if (node.children) {
    for (let childNode of node.children) {
      yield *nextNode(childNode, matcher, store)
    }
  }
  return
}

The problem with my code is reset is lost when function call stack is popped. For example if I'm in T1 and previous stack is isText, now if I do iter.next(isP) won't work. How do I do it?
const iter = nextNode(root, isT)
iter.next() <-- this is T1
iter.next(isP) <-- this is T2 should be P2

A: You could use the return value of the generator to pass through the traversal state. When the yield* returns from the first child of root, it will need to give you the store and matcher that became available in the next call after root and p1 were yielded.
…
if (node.children) {
  for (let childNode of node.children) {
    [reset, store] = yield* nextNode(childNode, reset, store)
//  ^^^^^^^^^^^^^^^^^                           ^^^^^
  }
}
return [reset, store]
//     ^^^^^^^^^^^^^^

A complete example:

function* nextNode(node, matcher = () => true, store = []) {
  store.push(node.name)
  if (matcher(node)) {
    matcher = yield store
    store = []
  }
  if (node.children) {
    for (let childNode of node.children) {
      [matcher, store] = yield* nextNode(childNode, matcher, store)
    }
  }
  return [matcher, store]
}

const node = (name, children) => ({name, children})
const is = c => n => n.name[0] == c

const iter = nextNode(node("root", [
  node("p1", [node("t1")]),
  node("p2", [node("t2")])
]), is("t"))
console.log("until next t:", iter.next())
console.log("until next p:", iter.next(is("p")))
console.log("until next p:", iter.next(is("p")))

A: Ah, seems an easy solution is to just have a global matcher.
type Matcher = (node: INode) => boolean
type TYield = INode[]
function* nextNode(
  node: INode,
  matcher: Matcher = () => true,
): Generator<TYield, TYield, Matcher> {
  let store: INode[] = []
  let reset = matcher
  function* _nextNode(node: INode): Generator<TYield, any, Matcher> {
    store.push(node)
    if (reset(node)) {
      reset = yield store
      if (!reset) reset = matcher
      store = []
    }
    if (node.children) {
      for (const childNode of node.children) {
        yield* _nextNode(childNode)
      }
    }
    return
  }
  yield* _nextNode(node)
  return store
}