text:
Q: Inductance Calculation for a Toroid Core? I have a Toroid Core listed here: LINK , i have T130-52 .
I have all the values of the core from this sheet. Now i need to build an inductor out of this toroid. How do i determine which wire to wound, and how many turns would give me what inductance?

A: Look under \$A_L\$ to see the core's inductance factor, which is the expected inductance (in nanohenries) per turns squared.
\$A_L = \dfrac{L}{turns^2}\$
So, with some algebra:
\$L = A_L \cdot turns^2 \$
\$ turns = \sqrt{\dfrac{L}{A_L}}\$
As for the wire size, choose appropriately based on your expected current (which you haven't specified), the diameter of the wire and the available space on the core.


text:
Q: ION_AUTH not send email with SMTP I am trigger in controller:
if($this->ion_auth->register($login, $pass, $mail, $data, array('2'))){
                        echo $this->ion_auth->messages();
                        echo $this->ion_auth->errors();
                    }else{
                        echo $this->ion_auth->errors();
                    }

I am edit config ion_auth:
 | Email options.
 | -------------------------------------------------------------------------
 | email_config:
 |    'file' = Use the default CI config or use from a config file
 |    array  = Manually set your email config settings
 */
$config['use_ci_email'] = TRUE; // Send Email using the builtin CI email class, if false it will return the code and the identity
$config['email_config'] = array(
    'mailtype' => 'html',
    'protocol' => 'smtp',
    'smtp_host' => 'smtp.mail.ru',
    'smtp_user' => 'user',
    'smtp_pass' => 'pass',
);

ION_AUTH send me error - activation unseccesefull
Please Help me!
In the database the user entered, but the message is not sent through SMTP.
How can I display debug information from a class in Email newsletters ION_AUTH?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Function to replace specific letters won't run with void return type I have to create a program that should replace all letters in the first
parameter with the second parameter. For example, if the string
passed is "How now cow" and the function replaces all 'o' to 'e'
then the new string would be: "Hew new cew."... I keep getting an
error at line 9, the return void part.
#include <iostream>
using namespace std;

string replace(string mystring){
    replace(mystring.begin(), mystring.end(),  'e',  'o');
    return void;
}

A: You just need to return the modified string, use return mystring; instead of return void;

A: string replace(string mystring){

This function is called replace, takes a string as a parameter and returns a string, this is indicated by the type before the function's name in this prototype.
If it expects you to return a string, you can't return void; because void is not of type string.
So, you'll need to return mystring; instead such that you return a string.

A: Instead of returning void, do
replace(mystring.begin(), mystring.end(),  'e',  'o');
return mystring;

EDIT: just realized I was talking about wrong language. Sorry everyone.

A: not very elegant, but it'll get the job done.  now you can replace strings with other strings-- or just use strings that are one character long(similar to what you're doing in your example).
#include <iostream>
#include <cstdlib>
#include <string>

std::string string_replace_all( std::string & src, std::string const& target, std::string const& repl){

        if (target.length() == 0) {
                // searching for a match to the empty string will result in
                //  an infinite loop
                //  it might make sense to throw an exception for this case
                return src;
        }

        if (src.length() == 0) {
                return src;  // nothing to match against
        }

        size_t idx = 0;

        for (;;) {
                idx = src.find( target, idx);
                if (idx == std::string::npos)  break;

                src.replace( idx, target.length(), repl);
                idx += repl.length();
        }

        return src;
}

int main(){

    std::string test{"loool lo l l l    l oooo l loo o"};
    std::cout << string_replace_all(test,"o","z") << std::endl;

    return EXIT_SUCCESS;
}

output: lzzzl lz l l l    l zzzz l lzz z

If you're going to use your own implementation, be careful and check your edge cases.  Make sure the program won't crash on any empty strings.


text:
Q: which source file in rust language source refers_to/parse language keywords I want to change keyword spellings in Rust language.
For example, for -> phur, so where should I look in rustc source code?
Thanks in advance.

A: There isn't just the one place you'd need to change.
The keywords themselves are defined in src/librustc_span/symbol.rs but many things in the compiler internals rely on those keyword not to change, including:

*

*macro expansion

*Any kind of syntactic sugar relying on the quote! family of macros.

*pretty printing

*the test suite


text:
Q: Check if last list item is equal to length Xamarin Forms binding I am trying to hide last Grid column. I'm trying to do it with DataTrigger, this is how my trigger looks like:
            <ResourceDictionary>
               <Style x:Key="HideLastVerticalLine" TargetType="BoxView">
                  <Style.Triggers>
                    <DataTrigger
                        Binding="{Binding Items, Path=Items.LastOrDefault}"
                        TargetType="BoxView"
                        Value="{Binding Items.Length}">
                        <Setter Property="IsVisible" Value="False" />
                    </DataTrigger>
                  </Style.Triggers>
               </Style>
           </ResourceDictionary>

           <BoxView Style="{StaticResource HideLastVerticalLine}" Grid.Column="1" HeightRequest="100" WidthRequest="1" BackgroundColor="Black"/>

I'm applying this DataTrigger to a BoxView, which contains a vertical line separator (I want something as Trim(), just to remove last separator line.
How can I do it?

A: You can use a DataTemplateSelector to achieve this.
The sample is here.
Create two DataTemplates, one for LastViewCell and one for other ViewCells:
public class PersonDataTemplateSelector : DataTemplateSelector
{
    public DataTemplate NormalTemplate { get; set; }

    public DataTemplate LastCellTemplate { get; set; }

    protected override DataTemplate OnSelectTemplate (object item, BindableObject container)
    {

        var lastItem = Items.LastOrDefault();

        return lastItem = item ? LastCellTemplate : NormalTemplate;
    }
}

Choose to use which DataTemplate by checking if the item is last Item.

A: *

*Create Bindable Layout.

*Create separate template selector class.

*The class used to populate the bindable layout itemsource must have new property isLast bool.

*Update the list with last element as true.

*Now Bind this new list with the bindable layout you are using on the view.

*Don't forget to add your templateselector on resource dictionary of that page.
For updating last item in list to isLast = true use.

    int index = 0;
    foreach (var item in list) // here updating last element of list islast =true
    {
    item.IsLast = (index == list.Count - 1);
    index++;
    }


text:
Q: Why LiveData is slow In my application, I load data from the local database and it's very slow. I tried to find what is slow and I found that this occurs because of LiveData.
I created a sample application to test LiveData speed here you are my test code:
FirstFragment:
class FirstFragment : Fragment(), FirstFragmentCallback {
private val TAG = FirstFragment::class.java.simpleName

private var mViewModel: FirstFragmentViewModel? = null

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    mViewModel = ActivityUtils.obtainViewModel(requireActivity(), FirstFragmentViewModel::class.java)
    (mViewModel as FirstFragmentViewModel).callback = this
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    val v = inflater.inflate(R.layout.first_fragment, container, false)
    Log.d(TAG, "onCreateView called")

    registerObservables()
    mViewModel?.loadData()
    return v
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    val secondFragmentButton = view.findViewById<Button>(R.id.second)
    secondFragmentButton.setOnClickListener {
        ActivityUtils.replaceFragmentInActivity(requireFragmentManager(), SecondFragment(), R.id.container, false)
    }
}

private fun registerObservables(){
    mViewModel?.dataLoadedEvent?.observe(this, Observer {
        Log.d(TAG, "dataLoaded event")
    })
    mViewModel?.dataLoaded2Event?.observe(this, Observer {
        Log.d(TAG, "dataLoaded2 event")
    })
}

override fun dataLoaded() {
    Log.d(TAG, "dataLoaded callback")
}
}

FirstFragmentViewModel:
class FirstFragmentViewModel(val mAppliction: Application): AndroidViewModel(mAppliction) {

val dataLoadedEvent: SingleLiveEvent<Void> = SingleLiveEvent()

val dataLoaded2Event: MutableLiveData<Void> = MutableLiveData()

var callback: FirstFragmentCallback? = null

fun loadData(){
    dataLoadedEvent.postValue(null)
    dataLoaded2Event.postValue(null)
    callback?.dataLoaded()
}
}

If I run this fragment I got these in the LogCat:

2019-05-15 13:23:07.405 8632-8632/livedatatest D/FirstFragment: onCreateView called
2019-05-15 13:23:07.406 8632-8632/livedatatest D/FirstFragment: dataLoaded callback
2019-05-15 13:23:07.438 8632-8632/livedatatest D/FirstFragment: dataLoaded event
2019-05-15 13:23:07.439 8632-8632/livedatatest D/FirstFragment: dataLoaded2 event

You can see that dataLoadedEvent.postValue(null) take at least 30ms, but the simple callback is called immediately.
Is there any solution to speed up LiveData events?

A:
You can see that dataLoadedEvent.postValue(null) take at least 30ms

postValue() is for when you want to update the MutableLiveData from a background thread. Under the covers, it uses a Handler to route your event to the main application thread. Therefore, there will be some delay, as other main application thread work queue events get processed.
It also illustrates that your benchmark is flawed ("comparing apples to oranges"). Either:

*

*Use Handler instead of a callback (or some other "run this code on the main application thread" approach), or

*Use setValue() (or value= since you are in Kotlin) instead of postValue(), to update the MutableLiveData content directly on the main application thread


text:
Q: How to copy all certificates from Kubernetes on one server to Kubernetes on another one? How to copy all certificates from Kubernetes on one server to Kubernetes
 on another one?
How to export them?
Possible import step
kubectl create secret tls {{ .Release.Name }}-ingress-tls-secret  --key /tmp/tls.key --cert /tmp/tls.crt [--namespace namespace]

Which actions should be after import step?
I want to see same certs on another server.

A: kubernetes store the certificate in the secret.
you can simply export the secret and import it on to new kubernetes cluster.
here is one example to export the secret locally

kubectl get secret my-secret-name(secret name) --export -o yaml >
  my-secret-name.yaml

my-secret-name.yaml file will be created
now on the new cluster, you can simply import the certificate using generated yaml file

kubectl apply -f my-secret-name.yaml -n namespace-name

(if want to set in a specific namespace)
after importing the certificate you can simply use them in ingress.


text:
Q: How do I construct a Set with an Array I am playing with Set in Node.JS v0.11.3 and the --harmony flag. The API works fine, I can add, remove, clear, etc. I have however not been able to initialise a set with an array. I have tried (as prompted by the MDN page)
var mySet = new Set([1, 1, 2]);

How can I convert an array to a set? Is MDN outdated? Has Node.JS simply not implemented the feature?

A: The v8 implementation of the Set constructor does not yet support the iterator and comparator arguments mentioned in §15.16.1.1 of the current draft of the Harmony specification, and node uses v8 as its JavaScript interpreter.
As a band-aid, you can use the simplesets package.

A: Works fine in v8 now using an array supplied to a constructor. I'm using node v6.2.0 (v8 version 5.0.71.47).
> let mySet = new Set([1,2,3]);
undefined
> mySet;
Set { 1, 2, 3 }

> for ( let key of mySet ) { console.log(key) }
1
2
3
undefined

> mySet.size
3

A: From what I have read it is my understanding that the implementation of this is new and experimental. Some things might not work properly. Also I have noted many instances where new features did not behave as expected until after a period of maturing. It would be best to avoid this and simply add them manually if functionally is your goal.

A: You can try this one:

*

*https://github.com/PeterScott/simplesets-nodejs
Sample session:
> var sets = require('simplesets')
undefined
> var mySet = new sets.Set([1, 1, 2]);
undefined
> mySet
{ _items: [ 1, 2 ] }
> mySet.size()
2


text:
Q: How to add trailing spaces depending on field length I want to add trailing spaces to each field. My file look like:
Input file:
A|B|C|D

Field 1 length in output file would be: 1
Field 2 length in output file would be: 3
Field 3 length in output file would be: 4
Field 4 length in output file would be: 6
Desired output:
AB  C   D

How to achieve this in shell? Kindly assist

A: With awk:
awk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}' < input > output

Would do right space padding and truncation.
Depending on the awk implementation, that would be length in terms of bytes or characters (making a difference for multi-byte characters). In any case, not based on the display width of those characters (like for double-width or 0-width characters, or TAB which don't have a display width of 1 on terminals).
Examples:
$ echo 'A|B|C|D' | awk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}'
AB  C   D

(all of those  A B C D graphemes are each made of one character, each made of one byte in any locale and each is single-width).
$ echo 'A|B|Ç|D' | gawk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}'
AB  Ç   D
$ echo 'A|B|Ç|D' | mawk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}'
AB  Ç  D

(2 byte, 1-width Ç character in UTF-8)
$ echo $'A|B|C\u0327|D' | gawk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}'
AB  Ç  D
$ echo $'A|B|C\u0327|D' | mawk -F'|' '{printf "%-1.1s%-3.3s%-4.4s%-6.6s\n", $1, $2, $3, $4}'
AB  Ç D

1-byte, 1-width C combined with 0-width, 2 bytes (in UTF-8) combining cedilla to form a 1-width, 2-characters, 3-bytes Ç grapheme, the decomposed version of the pre-composed U+00C7 Ç character in the previous example.
To take into consideration the display width of characters, with some expand implementations (though not GNU expand) and assuming the input doesn't contain TAB characters and none of the input fields exceed their allocated width in the first place, you could do:
<input sed $'s/|/|\t/g;s/$/|\t/' | expand -t3,8,14,22 | sed 's/| //g' >output

Which on the output of printf '%s\n' 'A|B|C|D' $'A|B|\uc7|D' $'A|B|C\u327|D' should give:
AB  C   D
AB  Ç   D
AB  Ç   D

A: Using just bash shell functionality...
For the supplied sample data:
$ foo="A|B|C|D"; printf "%s%s  %s   %s     \n" $(echo -e "${foo//|/ }" )
AB  C   D

$ foo="A|B|C\u0327|D"; printf "%s%s  %s   %s     \n" $(echo -e "${foo//|/ }" )
AB  Ç   D

For fixed field output per question assuming none of the input fields exceed their maximum specified width:
$ foo="A|B|C|D"; printf "%-1.1s%-3.3s%-4.4s%-6.6s\n" $(echo -e "${foo//|/ }" )
AB  C   D

For multibyte characters such as Ç, you encounter the issue that the width specifier in printf (both bash shell builtin and standalone utility) counts bytes, not multibyte characters. Thus you may get "unexpected" output.
$ foo="A|B|\uc7|D"; /bin/printf "%-1.1s%-3.3s%-4.4s%-6.6s\n" $(echo -e  "${foo//|/ }" )
AB  Ç  D

$ foo="A|B|\uc7|D"; /bin/printf "%-1.1s%-3.3s%-4.4s%-6.6s\n" $(echo -e  "${foo//|/ }" ) | xxd
00000000: 4142 2020 c387 2020 4420 2020 2020 0a    AB  ..  D     .
$


text:
Q: Restore messed upp Assemblies Mvc VS2010 I've seem to have messed up my environment. When i create a MVC 2 Web Application project i face this error. Any idea of what i need to reinstall/uninstall?
alt text http://lh4.ggpht.com/_RbcACX1DmM8/SztdvDr0wXI/AAAAAAAAASM/QXCAIHEShEA/s800/Clipboard02.jpg

A: Did you install MVC 2 Beta? It's completely incompatible with VS 2010. You cannot install it on a machine where you want to also use MVC in 2010. You need to use MVC 2 Preview 2 (or earlier) for your VS 2008 projects.
You can also wait for the next VS 2010 beta, which will include an updated MVC 2.

A: VS2K10 comes with MVC.  If you installed one of the betas, it is not compatible.  You should use the distributed version.


text:
Q: .html() method equivalent for SVG elements I have been searching for a good alternative for the .html() method for SVG elements. .html() works in Chrome and Safari, possibly Firefox, but not IE or Edge.
Below is what I want to achieve.
HTML
<svg class="root">
  <g>
  </g>
</svg>

JQuery
import image from '/path/to/svg';

// image imported from another file, looks like <svg>...</svg>

g.append('circle')
    .attr('r', 1)
    .attr('cx', 0)
    .attr('cy', 0);
g.append('g')
    .html(image);

There are similar questions on SO, but answers I've found are outdated, lead to broken links, etc.

A: (I'm assuming you are using D3.js, since you tagged your question as such). In D3.js .html() is equivalent to .innerHTML. It "works" in some browsers, but it's actually parsed as HTML, so it's actually a hack. If you wan't to use it anyway in a browser where it doesn't work and .innerHTML does, then just replace it:
g.node().innerHTML ="<svg><circle cx='50' cy='50' r='30' fill='red'/></svg>";

The node() method returns the original DOM node (which allows you to call DOM methods and refer to DOM properties).
But a better way to load an SVG in D3.js is using d3.xml():
d3.xml("sample.svg",
        function(xmlData) {

    var svg = xmlData.documentElement;
    console.log(svg);

    // do something with the imported SVG
}

From there you can append it to the <g> using DOM:
g.node().appendChild(svg);


text:
Q: I get an error when using .astype() with pandas I get an error when trying to make a new df:
ERROR:
'A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead'

This is the code that gives the error:
df = pd.DataFrame(data)
new_df = df
bools = ['ind-debateclub', 'ind-programming_exp',
'ind-international_exp',
'ind-entrepeneur_exp', 'ind-exact_study', 'decision']

for i in bools:
    new_df[i] = df[i].astype(int)
new_df.head()

I have tried it like this, but this yields the same error:
new_df[i] = df.loc[df[i].astype(int)]

The input looks like this:
DataFrame

A: Try changing the new_df = df line to:
new_df = df.copy()

also change the .astype() line to:
new_df[i] = new_df[i].astype(int)


text:
Q: gtk draw "expose-event" and redraw I want to use expose-event to draw something then update or redraw. That's to say, there are a drawing area and a button in window. When clicking button, the drawing area will be redrawn accordingly. My problems are

*

*In the following code, if I changed gtk_container_add (GTK_CONTAINER (box), canvas); to gtk_box_pack_start(GTK_BOX(box), canvas, FALSE, FALSE, 0);, nothing is drawn. Usually we use gtk_box_pack_start to add something into box. Why doesn't it work this time?

*The function build_ACC_axis refreshed(deleted what has drawn) drawing area and prepared for new draw. But it didn't delete what has drawn. Why? How to refresh the drawing area?
If the source file is test.c, then compilation is

gcc -o test test.c `pkg-config --cflags --libs gtk+-2.0`

The code is below:
#include <gtk/gtk.h>
#include <glib.h>

static void draw (GdkDrawable *d, GdkGC *gc)
{
  /* Draw with GDK */
  gdk_draw_line (d, gc, 0, 0, 50, 50);
  gdk_draw_line (d, gc, 50, 50, 50, 150);
  gdk_draw_line (d, gc, 50, 150, 0, 200);

  gdk_draw_line (d, gc, 200, 0, 150, 50);
  gdk_draw_line (d, gc, 150, 50, 150, 150);
  gdk_draw_line (d, gc, 150, 150, 200, 200);

  gdk_draw_line (d, gc, 50, 50, 150, 50);
  gdk_draw_line (d, gc, 50, 150, 150, 150);
}

static gboolean expose_cb (GtkWidget *canvas, GdkEventExpose *event, gpointer user_data)
{
  GdkGC *gc;

  gc = gdk_gc_new (canvas->window);
  draw (canvas->window, gc);
  g_object_unref (gc);

  return FALSE;
}

void build_ACC_axis (GtkWidget *button, GtkWidget *widget)
{
  GdkRegion *region;

  GtkWidget *canvas = g_object_get_data(G_OBJECT(widget), "plat_GA_canvas");

  region = gdk_drawable_get_visible_region(canvas->window);
  gdk_window_invalidate_region(canvas->window, region, TRUE);
  gtk_widget_queue_draw(canvas);
  /* gdk_window_process_updates(canvas->window, TRUE); */
  gdk_region_destroy (region);
}

int main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *canvas, *box, *button;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request(window, 500, 300);
  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);

  box = gtk_vbox_new(FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), box);

  canvas = gtk_drawing_area_new ();
  g_object_set_data(G_OBJECT(window), "plat_GA_canvas", canvas);
  /* gtk_box_pack_start(GTK_BOX(box), canvas, FALSE, FALSE, 0); */
  gtk_container_add (GTK_CONTAINER (box), canvas);
  g_signal_connect (G_OBJECT (canvas), "expose-event", G_CALLBACK (expose_cb), NULL);

  button = gtk_button_new_with_label ("ok");
  gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
  /* gtk_container_add (GTK_CONTAINER (box), button); */
  gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(build_ACC_axis), window);

  gtk_widget_show_all (window);

  gtk_main ();
}

I would like to answer my second question. After clicking button, it would send expose-event signal and run expose_cb. Since there is no change in draw function, we can't see the refreshing. Following is the updated code that can show refreshing. The point is to add variable factor. But for the first question, I still didn't know why.
#include <gtk/gtk.h>
#include <glib.h>

int factor;
static void draw (GdkDrawable *d, GdkGC *gc, double fac)
{
  /* Draw with GDK */
  gdk_draw_line (d, gc, 0, 0, 50, 50 * fac);
  gdk_draw_line (d, gc, 50, 50, 50, 150);
  gdk_draw_line (d, gc, 50, 150, 0, 200);

  gdk_draw_line (d, gc, 200, 0, 150, 50);
  gdk_draw_line (d, gc, 150, 50, 150, 150);
  gdk_draw_line (d, gc, 150, 150, 200, 200);

  gdk_draw_line (d, gc, 50, 50, 150, 50);
  gdk_draw_line (d, gc, 50, 150, 150, 150);
}

static gboolean expose_cb (GtkWidget *canvas, GdkEventExpose *event, gpointer user_data)
{
  GdkGC *gc;

  gc = gdk_gc_new (canvas->window);
  draw (canvas->window, gc, factor);
  g_object_unref (gc);

  return FALSE;
}

void build_ACC_axis (GtkWidget *button, GtkWidget *widget)
{
  GdkRegion *region;

  GtkWidget *canvas = g_object_get_data(G_OBJECT(widget), "plat_GA_canvas");

  region = gdk_drawable_get_visible_region(canvas->window);
  gdk_window_invalidate_region(canvas->window, region, TRUE);
  /* gtk_widget_queue_draw(canvas); */
  gdk_window_process_updates(canvas->window, TRUE);
  gdk_region_destroy (region);
  factor++;

}

int main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *canvas, *box, *button;

  gtk_init (&argc, &argv);

  factor = 1;
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_size_request(window, 500, 300);
  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);

  box = gtk_vbox_new(FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), box);

  canvas = gtk_drawing_area_new ();
  g_object_set_data(G_OBJECT(window), "plat_GA_canvas", canvas);
  /* gtk_box_pack_start(GTK_BOX(box), canvas, FALSE, FALSE, 0); */
  gtk_container_add (GTK_CONTAINER (box), canvas);
  g_signal_connect (G_OBJECT (canvas), "expose-event", G_CALLBACK (expose_cb), NULL);

  button = gtk_button_new_with_label ("ok");
  gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
  /* gtk_container_add (GTK_CONTAINER (box), button); */
  gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(build_ACC_axis), window);

  gtk_widget_show_all (window);

  gtk_main ();
}


text:
Q: Homeomorphism between two subspaces of $\mathbb{R}^n$ Let $$X_1 = \left\{(0,0)\right\} \cup \left\{\left(0,\frac{1}{n}\right): n = 1,2... \right\} \cup \left\{\left(1,\frac{1}{n}\right): n = 1,2... \right\}$$
$$X_2=\left\{(0,0)\right\} \cup \left\{\left(\frac1n,\frac1m\right): n \ge m, m,n\in\mathbb{N}\right\}$$
Decide whether those sets are homeomorhic as subsets of $(\mathbb{R}^2, d_e)$.
I suspect they are not, but I cannot find a good reason why. They both have one limit point, so the easiest argument doesn't work. Also in the neighbourhood of this point and cannot see anything special.
Edit. Is it true that neighbourhoods of limit points are not homeomorphic, because one is compact and the other is not? If so, is it enough?

A: The space $X_1$ can be decomposed into two clopen sets (closed-and-open), $$X_1=C_1 \cup C_2
$$
where $C_1$ is a compact set containing the unique limit point, and $C_2$  is a countably infinite discrete set. Namely, $C_1=\left\{(0,0)\right\} \cup \left\{\left(0,\frac{1}{n}\right): n = 1,2... \right\}$ and $C_2=\left\{\left(1,\frac{1}{n}\right): n = 1,2... \right\}$.
But $X_2$ has no such decomposition, hence $X_1$, $X_2$ are not homeomorphic.
To see why, suppose that $X_2$ does have such a decomposition,
$$X_2 = C_1 \cup C_2
$$
The set $C_2$ is disjoint from some neighborhood of the unique limit point $(0,0)$ of $X_2$. Since $C_1$ is open, it follows that $C_2 \subset \{(x,y) : y \ge \epsilon\}$ for some $\epsilon>0$. The set $C_1$ therefore contains a sequence with no convergent subsequence, namely $(1/n,1/m)$ for some fixed value of $m > 1/\epsilon$. That contradicts compactness of $C_1$.


text:
Q: SQL Server : get previous day results using UNIX Timestamp Using SQL Server 2016, I have a table that contains a column DateTime of type INT which contains a UNIX timestamp. So if I want to get all the rows where the timestamp is yesterday, I know I need to check if the timestamp is >= the timestamp for 'yesterday at 00:00' and <= 'yesterday at 23:59'.
How can I do this with SQL Server 2016?
Found a few examples but they where for MySQL. I did find this example below. But it throws an error, so I'm probably not using it correctly. Or actually, this might be MySQL as well...
WHERE [DateTime] <= DATEADD(day, -1, convert(day, GETDATE()))

Any help would be greatly appreciated!

A: Here's my solution that seems to work. Did a test manually where I checked if the timestamp was between 1596513600 and 1596599940, and got the same output from the Solution below:
Function to Convert Timestamp to datetime type (*adjusts for Local time):
CREATE FUNCTION dbo.fn_ConvertToDateTime (@Datetime int)
RETURNS DATETIME
AS
BEGIN
    DECLARE @LocalTimeOffset BIGINT
           ,@AdjustedLocalDatetime BIGINT;
    SET @LocalTimeOffset = DATEDIFF(second,GETDATE(),GETUTCDATE())
    SET @AdjustedLocalDatetime = @Datetime - @LocalTimeOffset
    RETURN (SELECT DATEADD(second,@AdjustedLocalDatetime, CAST('1970-01-01 00:00:00' AS datetime)))
END;
GO

SQL Statement:
SELECT *
FROM dbname.dbo.Tablename
WHERE dbo.fn_ConvertToDateTime([DateTime]) >= dateadd(day,datediff(day,1,GETDATE()),0)
    AND dbo.fn_ConvertToDateTime([DateTime]) < dateadd(day,datediff(day,0,GETDATE()),0)

The Resulting output shows only Rows that contain a unix timestamp from Yesterday.


text:
Q: Powerline adaptor overheating I'm currently using a 500Mbps powerline adaptor and I believe it has been constantly overheating from time to time. It stops working once every few hours and it gets extremely warm.
However it resumes functionality after unplugging it and plugging it.
What should I do to resolve this issue? Should I just get a new one? And if I do should I get a 200Mbps instead ?
Thanks

A: Try drilling some holes in the plastic housing to allow some air to flow.  It might save you a few bucks on buying a new one.

A: Different manufacturers use different components....
...I have seen quite a few "mini" powerline adapters that overheat... All I can really suggest is try a big chunky one or a different manufacturer and hopefully it will stop your problems.

A: If the adapters stop working because of overheating, then surely this is a case of guarantee/warranty. Bring it back to the seller and buy another, better product. Be assured, this is not generally a problem of 500 Mbps adapters.


text:
Q: Split a large text file on a delimiter using Spark I have text file where entries (log events) are not split by new lines. Unfortunately everything is over a single line:

Info|[Log] iffidfdfdfdfdfd
testst ddedede dede  dedededed
warning|[Log] etststs dedessdsds
trtrtrtrtrtrtrtr
Error| [Log]  tetdtetdetddeded
dededededededed    dedededededededede

My goal is to split this one huge line into different lines per log event:

Info|[Log] iffidfdfdfdfdfd testst ddedede dede  dedededed
warning|[Log] etststs dedessdsds trtrtrtrtrtrtrtr
Error| [Log] tetdtetdetddeded dededededededed dedededededededede


text:
Q: Saving for "always" information in Android phone Hello I'm creating application for android no mater what kind but I need to store some information that information are so important because it's kind of result of registration and future settings for application, and now in managing application there is a button which can clear data, is there any way to disable it? I found some threads in internet where people writing that no it's impossible.
Or maybe if I'll use internal storage to save that information if the user will press "clear data" it'll also delete files in internal storage or not?
I can also use IMEI to identify phone user but what if the IMEI number will be unavailable?
I really need help any idea how I can do it?

A: go for sqlite database
you can use SqliteOpenHelper class for storing and retreving data


text:
Q: Spring boot error ORA-01400: cannot insert NULL into ("AAKASH"."USERS"."EMAILVERIFICATIONSTATUS") This is the error I am getting:

2020-04-14 13:44:21 WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 1400, SQLState: 23000 2020-04-14 13:44:21 ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ORA-01400: cannot insert NULL into ("AAKASH"."USERS"."EMAILVERIFICATIONSTATUS")

A: Pretty much self-explainable. You are inserting a row into table named USERS which belongs to user AAKASH and omit value for EMAILVERIFICATIONSTATUS column which is set to NOT NULL.
What to do? Provide value for that column.

A: It cause by column setting(not null).
You can do

*

*set value(not null-java or your logic)

*set default value(alter column-edit table)


text:
Q: Allure is not generating report on cucumber 7 After updating the cucumber version to 7.2.3, Allure not generating reports. (unknown report and NaN%). It still uses the config file in the directory. I think it's not about the folder path. If I decrease the version to 5.6.0 it is working.
The related part of the pom.xml is like below.
Does anyone have a solution for this??
Thanks,
<dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>7.2.3</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>7.2.3</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-cucumber7-jvm</artifactId>
            <version>2.17.3</version>
        </dependency>
<dependencies>

 <argLine>
    -Dcucumber.options="--plugin io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm
 </argLine>

A: I know that it doesn't answer the exact question but hope it can help somebody.
I had the same issue with Gradle - build/allure-results folder had only one small json file that generated empty allure report.
It seems like not all the Cucumber and Allure versions are compatible with each other. So I have found a compatible versions pair of Cucumber and Allure. Surprisingly they are the same as author has:
cucumberVersion = '7.2.3'
allureVersion = '2.17.3'

related part of my build.gradle:
plugins {
    id 'java'
    id 'io.qameta.allure' version '2.9.1'
}

apply plugin: 'io.qameta.allure'

dependencies {
    implementation group: 'io.cucumber', name: 'cucumber-java', version: '7.2.3'
    testImplementation group: 'io.cucumber', name: 'cucumber-java', version: '7.2.3'
    implementation group: 'io.qameta.allure', name: 'allure-cucumber7-jvm', version: '2.17.3'
}

configurations {
    cucumberRuntime {
        extendsFrom testImplementation
    }
}

task cucumber() {
    dependsOn assemble, testClasses
    doLast {
        javaexec {
            main = "io.cucumber.core.cli.Main"
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = ['--plugin', 'html:results.html',
                    '--plugin', 'pretty',
                    '--plugin', 'io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm',
                    '--glue', 'step_definitions',
                    'src/test/resources']
        }
    }
}

A: No, no this problem is not depend any cucumber version. Allure report have to write allure-result to any folder on test executing so you can use this commandline under <argLine> raw your pom.xml.
  <systemPropertyVariables>
   <allure.results.directory>
     ${project.build.directory}/allure-results
   </allure.results.directory>
 </systemPropertyVariables>


text:
Q: 2nd order linear differential equation with piece wise continuous in homogeneous term. $y^{ii}=f(x)$ where
$f(x)=\begin{cases}
0 ,& \text{ if } x \in [0,1/2]\\
1, & \text{ if } x \in (1/2,1]
\end{cases} $\
subject to $y'(0)=0,y(1)=1$
We can solve this differential equation by finite difference method.But how can we find exact solution of this differential equation ? Any body please help me.

A: $y^{''}=f(x)$ where
$f(x)=\begin{cases}
0 ,& \text{ if } x \in [0,\frac{1}{2}]\\
1, & \text{ if } x \in (\frac{1}{2},1]
\end{cases} $\
subject to $y^{'}(0)=0,y(1)=1$

The function must be continuous and differentiable. In $[0,\frac{1}{2}]$ we have $ y^{'} $ is constant: $ y = a + rx $. Then $ y^{'}(0)=0 $ gives: $ y=a , x \in [0,\frac{1}{2}]$.Similarly $  y=b+cx^2+dx , x \in (\frac{1}{2},1] $.
Continuity in $x=\frac{1}{2} \implies a=b+\frac{1}{4}c+\frac{1}{2}d $.
Differentiability in $x=\frac{1}{2} \implies d=-c $.
$y^{''}=1 \in (\frac{1}{2},1] \implies c=\frac{1}{2} $.
$y(1)=1 \implies b=1$. So the solution becomes:

$y=\frac{7}{8}  , x \in [0,\frac{1}{2}] \\ y=1+\frac{1}{2}x^2-\frac{1}{2}x  , x \in (\frac{1}{2},1]$


text:
Q: Setting headers and page redirection using angular I am developing a login application, in which I have angular communicating with REST interface for authenticating a user. I am usin $http for this task. Now, I need to redirect my page to another URL(this may be on same or different domain). Also, I need to set the headers during this process.
Please help me with an implementation in order to proceed with this task.

A: 1) AngularJs was designed to build SPAs, you should not redirect to another url. You should redirect to another path in your current page instead. If you are using angular router, you would redirect to another state. Take a look at this for more information: single page application deep linking with login page
2) Because the browser automatically handles 302 responses and forces your ajax function to send another ajax request to the Location to retrieve the final result with status 200. Your server should return 401 instead when the user is not authorized. Cannot handle 302 redirect in ajax and why?
A sample code on client side to handle 401 status code (Unauthorized):
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){
    if (error.status == 401) { // check for 401 status code
        $state.transitionTo("login", { returnUrl: $location.url() });
    }
})

Another sample code with $http, I recommend doing it globally inside interceptors
$httpProvider.interceptors.push(function($q, $location) {
    return {
      'responseError': function(response) {
         if(response.status === 404){
             $location.path('your redirection path');
         }
         return $q.reject(response);
      }
    };
  });

3) In order to set your request headers, you could set it globally in your $httpProvider.defaults.headers or per request

A: Have you considered reading the Angular documentation / API?
Use the $location service for redirect and read the $http docs in order to learn how to set headers.
Quote:

the $http service will automatically add certain HTTP headers to all requests. These defaults can be fully configured by accessing the $httpProvider.defaults.headers configuration object [...]

It is unlikely that anyone of the SO community will provide a complete guide to your question, as the needed information is easyily accesible.

A: If you need to go to another page,  use straight java script
window.location.href=......


text:
Q: VB.Net Web Scraper - The request was aborted: Could not create SSL/TLS secure channel I am working on a web scraping program and I am getting the following error on sites that have Tls 1.0 and 1.1 disabled, and Tls 1.2 and 1.3 enabled:
'The request was aborted: Could not create SSL/TLS secure channel'
I should also note that I am using .Net version 4.8
This is the site that I am using to check:
https://www.cdn77.com/tls-test
I've read nearly a dozen posts on the topic and none of the solutions have worked for me.
This is the code. It works on most sites:
        Try
            ServicePointManager.Expect100Continue = True
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or
                                                    SecurityProtocolType.Tls13

            Dim address = New Uri(url)

            Using client = New WebClient()
                Dim stream = client.OpenRead(address) ' This is where exception is caught
                Using sr = New StreamReader(stream)
                    Dim page = sr.ReadToEnd()
                    Return page
                End Using
            End Using

        Catch ex As Exception
            Return ex.Message
        End Try

A: I think you will not find so much sites with only TLS1.3
I use this function for many years:
  Function getFromURL(ByVal url As String) As String
        Dim request As System.Net.WebRequest = System.Net.WebRequest.Create(url)
        'request.Headers.Add("HTTP_USER_AGENT", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.40607; .NET CLR 1.1.4322; .NET CLR 2.0.50215)")
        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12
        Dim response As System.Net.WebResponse

        response = request.GetResponse()

        Dim responseStream As System.IO.Stream = response.GetResponseStream()

        Dim reader As System.IO.StreamReader = New System.IO.StreamReader(responseStream)

        Return reader.ReadToEnd()

    End Function


text:
Q: Dual boot CentOS7 / Ubuntu I just got a lenovo T450 with a 500 GiB SSD drive and I would like to install both Ubuntu (rather 16.04 at the time of writing, but probably 18.04 in a near future) and centOS7 on it.
I used to succeed doing multiple boot with win, ubuntu and centOS, but this time I would really like to make a clean install:

*

*with  all trace of windows removed,

*with both root directories on bare metal (~20 GiB for each)

*and then typically /var, /usr and /home on logical volumes, possibly with a single home for both installs.

I made a first try and installed first centOs and then ubuntu, as described above without trying to mutualize the home directories  (and honestly without putting to much thoughts in it) and it kind of worked. but now, when I boot, after a couple of minutes, the computer freezes on both systems and I have to restart it. (This wasn't a dual boot issue see comments below)
Yet, I want to do it again to really have 2 clean and reliable installs. I had a look around and everything I've found is with very old versions (aka. without EFI) or with windows.
Could someone give me some hints or point me toward relevant resources so that I can achieve this?
Many thanks,
Bruno


text:
Q: Bluestacks does not run even though I disabled Hyper-V I tried disabling Windows Subsystem for Linux (WSL), Windows Defender Application Guard, and Hyper-V, but even THAT didn't work. I always disable virtualization to run Bluestacks, but now I need to enable virtualization for the new Bluestacks N version. I really want it, but Bluestacks keep saying that Hyper-V is enabled on my system and I have to review the FAQ to disable it. I also set hypervisorlaunchtype to off using bcdedit.
EDIT: Even Google's Android AVD manager reports the same thing!

A: Did you enable the Memory Integrity option in the Core Isolation menu on Windows Defender? This option is available on Windows 1709 and later. Try disabling it. Here's the pic:

And if you see that you can't disable it because of the lack of administrator rights, even though you're the owner of the administrator account, go to this registry directory in regedit:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceGuard\Scenarios\HypervisorEnforcedCodeIntegrity
Then go to the right side pane, double click on the Enabled, change its value data from 1 to 0 and click OK to save changes.
Hope this helps.

A: Go to: Control Panel > Programs and Features > Turn Windows features on or off >
Disable "Virtual Machine Platform" and restart.
I had this same issue after installing WSL and turning off Hyper-V, so apparently you need to turn off more than just Hyper-V.
This bluestacks support article lists multiple things to disable in case it still isn't working for you:

*

*Hyper V

*Windows Hypervisor Platform

*Windows Sandbox

*Virtual Machine Platform

*Windows Subsystem for Linux

Additional info:

For some specific editions of Windows 10, the "Virtual machine
platform" and "Windows hypervisor platform" check-boxes are not
available. If you don't see these options in the Windows features:

*

*In the windows search bar, search for "core isolation" and open it.

*In the core isolation settings, turn off the Memory integrity.

Note: If you can't interact with the "Memory integrity" switch, check this post: How can you turn Core Isolation Memory Integrity back off again in Windows 10 build 17127 and later


text:
Q: Cleaning up text in an inconsistent format in Python I'm trying to learn textual analysis in Python by analyzing Congressional testimony transcripts. I've been able to extract the text from the PDF transcripts, but the text is very dirty. I'm not sure how to clean it up. I'm trying to convert this:
`["HOUSE COMMITTEE ON BANKING, FINANCE AND URBAN AFFAIRSHENRY S. REUSS, Wisconsin, ChairmanTHOMAS'L.
ASHLEY, OhioWILLIAM S. MOORHEAD, PennsylvaniaFERNAND J. ST GERMAIN, Rhode Island", "HENRY B.
GONZALEZ, TexasPAUL NELSON, Clerk and Staff DirectorMICHAEL P. FLAHERTY, General CounselMERCER L.
JACKSON, Minority Staff Director(H)']`

to a list of names, states, and title (ex: "Chairman"), like this:
`[["HENRY S. REUSS", "Wisconsin", "Chairman"],
["THOMAS'L. ASHLEY", "Ohio"],
["WILLIAM S. MOORHEAD", "Pennsylvania"],
["FERNAND J. ST GERMAIN", "Rhode Island"],
["HENRY B. GONZALEZ", "Texas"],
["PAUL NELSON", "Clerk and Staff Director"],
["MICHAEL P. FLAHERTY", "General Counsel"],
["MERCER L. JACKSON", "Minority Staff Director(H)"]]`

Note that some individuals have a state and title associated with their name, while some have just a state or title associated with their name. Is this type of conversion doable? Any recommendations on how to approach this? Any help will be greatly appreciated. Cheers!
-Mike


text:
Q: debian cron bug or missing something? I'm configuring a server in N.Virginia to have the same cron schedule as our 'old' server with America/Chicago timezone.
I've edited /etc/timezone to have the value America/Chicago.
I have the environment variable TZ=/usr/share/zoneinfo/US/Central .
I've basically matched the old server, and both are on the NTP network.
The cron schedule is definitely stuck on UTC. It wouldn't be because of this 8yr old bug that was fixed in April 2010 ? The current server is running older stuff so probably not.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=166533
new server info:
uname -a
Linux omittedhostname #7-Ubuntu SMP Tue Oct 13 19:55:22 UTC 2009 x86_64 GNU/Linux
current server info:
Linux omittedhostname 2.6.24-23-xen #1 SMP Mon Jan 26 03:09:12 UTC 2009 x86_64 GNU/Linux
Thanks so much!!

A: I'm pretty sure I solved it.
Doing zdump /etc/localtime between the 2 machines produced different output.
On the new server, I basically did:
cp /usr/share/zoneinfo/US/Central /etc/localtime
If that wasn't it, I'll be surprised.


text:
Q: Access file-level argv from within a function I have a script, like follows:
echo 'Hello world' # etc

function fun
   if test 1 -gt 0
      echo "$argv[1]"
   end
end

# lots of code in between

fun

I call this file with ./file foo --bar. I want fun to print --bar. Instead, it prints nothing, because the argv containing --bar (ie, the file's argv) is being masked by the function's argv, which isn't receiving any input.
I could, theoretically, pass argv to the function, as in fun $argv. However, this is very obnoxious to have to include with every single function call (I make extensive references to argv in this file). Is there a way to access the file-scope argv variable from within functions in the file?

A: The outer argv is shadowed by the inner argv - a global variable shadowed by a local variable. There is no way to change this.
There are numerous ways around it, including what I would recommend: Use set -g fileargv $argv once before you execute the functions and then use $fileargv in your functions.


text:
Q: Slow canvas performance using clip region I'm creating some smoke using a particle emitter in Canvas. Everything is working fine but the design requires I add a mask to the canvas so we can see the page background. When I add a clipping region, I get extremely poor performance especially in Safari. Is there anything I can to do to optimise the performance when using a clip region?
Here's the smoke with no mask
http://codepen.io/fatlinesofcode/pen/AcLim
and with the mask
http://codepen.io/fatlinesofcode/pen/GLFqf
I'm drawing a vector region each time within the render loop.
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(960, 00);
ctx.lineTo(960, 500);
ctx.lineTo(960 / 2, 550);
ctx.lineTo(0, 500);
ctx.closePath();
ctx.clip();
ctx.restore();

A: Yes, context.clip is expensive.
Perhaps use an overlay mask instead of a clipping mask.
Since you're just blitting the overlay mask onto the canvas it's much faster than calculating which pixels are in the clipping path.
Step#1: draw your smoke
!
Step#2: draw the overlay mask which hides the unwanted part of the smoke
Left: the overlay mask.
Right: the smoke with the overlay mask.

Example code and a Demo:  http://jsfiddle.net/m1erickson/uHg4E/
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /> <!-- reset css -->
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<style>
    body{ background-color: ivory; }
    canvas{border:1px solid red;}
</style>
<script>
$(function(){

    var canvas=document.getElementById("canvas");
    var ctx=canvas.getContext("2d");

    var maskCanvas=document.createElement("canvas");
    var maskCtx=maskCanvas.getContext('2d');

    var img=new Image();
    img.onload=start;
    img.src="https://dl.dropboxusercontent.com/u/139992952/multple/mountain.png";
    function start(){

        makeOverlayMask();

        var smokeImage = new Image();
        smokeImage.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABjlJREFUeNqsl0lz20YQhTnYSXAxKcmS7aTKsrOUTz7lDyT//5BUDskhix27YtmSSYIrCAyQ/qYBiVaUWHKZVSBBDIh+/d7r7mHwePJN524v0zGm06lrOZGPy4t8kZcxd3tacJebJWgnCLwoCIKutXZXljY3xni+74We5wVVVduyLNfN3Z8dgJEgfhzHo7SX3hcaTJ5v55vNdhqGQbebdCeAmWfzl0VRrD4zA5plFEX9KIoHg+Hwi6Ojw2fWVsXbt29/3uV5xjXu3AoomKnrqvxcACQx44dhlPb7gwdpmt4/OTl+fnp6+n1VVeXh4cG35+fnvzRB7Wg4+lKkqtbr9blYwjZS1J8MgOhB4EdJEo/u3Rs9Pj4+ef7o0cPvDg+PngnV691ut/R9P8qyxWu+jyeTr3YiAef4REBUAOPzJiDBx8KL7qG8eknSHRP0yZPTH4aSJUxk2fwv1lSaqI8fxKBJNp+/3G63MzHkFhAcsKUgHJDbAfA8E/h+EBNkMOg/nEh2Q9GaQ93vR5PJwddVZQu9L0o3m837KI4HYtYhYKwtc3llZUkVVbaqHAv1bQCQfYDDAz9Iut3eQb/fP6HU2tLr9dKj3S5f7HbFKgjyZD6fvTg7e/Njvt3Oe93uAVkjEb+p67yyFk55/ygAlBcCBACuj5NkRDaspGnviMw5hxlozfPdYr1evZvN5i9Y68k9bV/orFZnRVluYKmuC0DU/yOBacIT3A85ut3uBPORNXQGQdjd/wUPph8URbkRyfzxePJ0uVy+EePGrIskFypF6BrXdR9613qdO7Tsgi7OlyxTNVmYrtebi+n0/W9lWWw0eFWSPYYrit0KDxAsjqMBa5gSJsRIsSRlAPvRKjDO+L6jftAfPER3AOAB1sgO7ZPEGFxOINb4jOPtDMcDdi6VgP4AAOB2m8+bUvxPAEa190J0jKNI4vcfjMfjJ8Ph4FEcJyMWoZHy02yMITBBkIrfYUikow9kWfZqtVyeifWlSryoKDpraVIfDCzvmvEkfS0v6bup1niYkjG0tkMHvcmKskJ3HVPKHvcDBikAS3CeS1fkfu65gQHjscCNTfMJmHhQy3eCcY0DGsmOo9ezubqdcitWfPIcPgGJHJQpPuGc6qURKVyVI2hcT+a+gjCea5/Nwyg7HrBYZK8Jlqb9Yxl9Y9ig3/NgrrcDm9/SjPCA0P+mobxl168qNTvXOQk+NJ9micuzRfYqlEnX0jubzf4k2GiUZ7idbohBWVcAtBjtemdnZz9dyIBiJuAV+kHLntSOVA+KXEpwZQluamgylNDFxcWvBU72/VBG7qK0Nt9IKQpUX2bBMa15Mhk/RXOoJnN+h/u5p5WGzBUAFJE5U7K69IBpa1o1rKuWjXagJElyrzGHz3fp9UMyw+Xuu5QpfYP9ASxhQJHQOiBOVs/n8DzMKM3Q1let2GjxebzzMBDyMIaLqlpZJJGy6FMVLhPNbAmlCpYMqQbjms1isfwbCVnX6+qz1qAqhdtZXlaB0VIxjgscrEOH7iVdSdovWVGe18sIM7IOMCSYTqe/LzKCd5w38IVzpvMCLNdNKbpqqIO9xmDai4Aoy2pDUMkghFbkkJMdWGGCFi2U76bT2R+r1fod4ITBDSZUZtzz6ibrQodRp9YqwwBai0EzAGSxlhvdhqFuu6JS6AXu4WJAppp2Q6RS+sWkK6nR1/R79gAA1F0QDPghUfCGslx3ml4jsTrlfivGnXZvm99IInYVCrU6HG28nLnwBfsELM0gqoKwhDFoBqw4zxd9Ir47JzWfDJomVrUHQOvjKroaBgORDQEZrzqKBYFIURR2tSrX77iPtdYD1WXL9XzditkCBrimbFgMuL8hEUGq+l8zse0PrelcZkL9VcnWtt0PlKU2o9qvK52Qtd033Z7r6+t/Wm7aEdWNeRofoKVxdXxlJG2rzDKpaQp7p7NfG04LUr3wwQg213fGwc1/wdREQNBMOgVGbB/Yzoy297d1vs9cY+I9XdVTtwLQYEA724LRLun5jSS1jlctNwHottty7rOda9arVve9dl/d+n9Bg9buZ3c1NaEZZ7NuXG93vUa3XDDnEtjLdo+LT/tzWmvZwLyhvdpGItipWnvVrkBKe5d/3P8IMAB3LDj0/a4R5QAAAABJRU5ErkJggg==";
        smokeImage.onload = function () {

            ctx.clearRect(0,0,canvas.width,canvas.height);
            for(var y=0;y<canvas.height;y+=smokeImage.height){
                ctx.drawImage(smokeImage,canvas.width/2-15,y);
            }
            ctx.drawImage(maskCanvas,0,0);

        }
    }

    function makeOverlayMask(){
        maskCanvas.width=img.width;
        maskCanvas.height=img.height+166;
        //
        maskCtx.drawImage(img,0,166);
        //
        maskCtx.save();
        maskCtx.globalCompositeOperation="destination-out";
        maskCtx.beginPath();
        maskCtx.moveTo(0, 0);
        maskCtx.lineTo(320, 00);
        maskCtx.lineTo(320, 166);
        maskCtx.lineTo(320 / 2, 183);
        maskCtx.lineTo(0, 166);
        maskCtx.closePath();
        maskCtx.fill();
        maskCtx.restore();
    }

}); // end $(function(){});
</script>
</head>
<body>
    <canvas id="canvas" width=320 height=300></canvas>
</body>
</html>


text:
Q: Show specific, private documents on a user homepage I am new to SharePoint and excited about what it could help to achieve and trying to figure out the possibilities. I am using Office 365 EDU package.
My question
Person 1 owns 6 documents, A.docx, B.docx and so on in a folder in their one drive. Each document is shared with one other person.  Is it possible to easily arrange so that
Person 2 homepage contains clear link to A.docx
Person 3 homepage contains clear link to B.docx
Person 4 homepage contains clear link to C.docx
Ideally, Person 1 homepage contains clear link to all documents.
Is this possible?

A: As an alternative to Amal's answer, if the files are stored at the One Driver for Business(from the my site feature of SharePoint) you can use the Content Search Web Part to list the documents that are stored in SharePoint and since before showing the results, SharePoint applies the user's permissions to the results the users will only see the files shared with them.
You can tweak the results, to display files only from specific areas or of specific content types as well.

A: When you share file via OneDrive, basically it generates a URL which can be used to access the file directly.
In order to make your requirement work, first Person1 should

*

*Create a "Document Library" in SharePoint and upload all documents
into that library

*Stop Inheriting permissions on that library - so other users won't be able to see the content

*Edit home page and document library to the home page

*Go back to the library and Share Individual file to other users

Now once other users login to SharePoint, they will be able to see direct links to the shared documents.


text:
Q: Where is the best place I can go to learn everything about the electronics-side of computers? Throughout my childhood, I grew up learning about electronics and computers. I am starting to get to the point where I want to incorporate my knowledge of both into a single project. I have tried using Arduinos and Raspberry Pis, but find myself in the usual scenario where I want to re-invent the wheel myself. Where is the best place that I can go to get the most comprehensive knowledge base about how computers, both old-school 4-bit and modern 86 and 64-bit machines work? Looking around, I have not really found much of what I was looking for. Projects like Big Mess O' Wires' custom 4-bit CPU and other projects where people made a computer on a breadboard and stuck linux on it are of the most interest, however things like USB interfacing, LCD/LED displays and touch input would be great too!
Thanks in advance,
Tim

A: The reason there isn't much information online about it is because:

*

*People who have knowledge of this do not have knowledge on how to make websites, and probably do not have time/interest to run a blog on an existing CMS site. They'd much rather do what they're good at, which is to design computer/IC architecture.

*This gets REALLY in depth. Companies like Qualcomm have 40,000 employees and the vast majority are engineers working on very few ASICs. You can find some information online but you will only scratch the surface.

*You're quite interested in this, which is good, go to a good university for an ECE degree because this is something that needs to be learned in a structured way and not something you can fully teach yourself. If you REALLY want to start now, perhaps you'll have to get your hands on university-level textbooks. A good textbook from my own program was Microelectronic Circuits by Sedra/Smith. You can also look for textbooks with keywords such as: analog design, digital design, ASIC, IC, computer architecture.

Hope that's enough to get you started. It's great that you have interest at such an age, but you should take this one step at a time and learn the basics because a firm grasp of the basics will allow you to snowball your learning of advanced topics.

A: You are wildly underestimating the amount of knowledge needed to learn "everything". Studying computer architecture alone could take you at least through a master's degree. If you want to understand digital electronics you're going to need to learn about circuit analysis and MOSFETs. (Each of those is at least one semester in college, and calculus is a prerequisite.) You could go arbitrarily deep into physics studying LCDs. Communications protocols are simpler, but unfortunately USB is on the difficult end of those.
None of these things are impossible, but they will take time. You can start by studying basic combinational and sequential logic, perhaps with a small FPGA platform. If you master that, you can move on into basic computer architecture.
On the analog/electronics side, the Falstad circuit simulator is a fun tool to play with. HyperPhysics has a lot of brief lessons on electricity. You could also try All About Circuits. Play-Hookey is probably more helpful on the digital front.
All of the books I know are college-level or have other prerequisites, so I can't help you there.
If you want to major in engineering in college, be sure to study hard in any high school class that teaches or uses algebra. This will make life much easier for you in the future.


text:
Q: Unity videoTexture doesn't load after build I have a unity project where i load multiple ogv-videos from a folder on my disk. When i run the game in debug mode it works perfectly, but when I build the game the video doesn't load
public class Video
{
    public MovieTexture movieTexture { get; set; }
    public string title { get; set; }

}

public class VideoLoader : MonoBehaviour {

public static List<Video> allVideos;

// Use this for initialization
void Start () {

    StartCoroutine(LoadAllVideos());
}

IEnumerator LoadAllVideos()
{
    allVideos = new List<Video>();

    string path = "C:/Users/Bram Sikkens/Desktop/SealifeBestanden/ProductBestanden";
    string[] videoFilePaths = Directory.GetFiles(path, "*.ogv");
    for(int i =0; i< videoFilePaths.Length;i++)
    {
        WWW diskMovieDir = new WWW("file://" + videoFilePaths[i]);

        while(!diskMovieDir.isDone)
        {
            yield return null;
        }

        Video v = new Video();
        v.movieTexture = diskMovieDir.GetMovieTexture();
        v.title = videoFilePaths[i];

        allVideos.Add(v);
    }

    foreach (GameObject menu in ProductContainers.menuGameObjects)
    {

        foreach(Video video in allVideos)
        {
            if(video.title.Contains(menu.name))
            {
                menu.transform.GetChild(2).GetComponent<Renderer>().material.mainTexture = video.movieTexture;
                video.movieTexture.Play();
                video.movieTexture.loop = true;
            }
        }
    }

}

}
What is the reason that he video doens't run when I build?


text:
Q: Emmet Snippet to Write Many Numbered Variables I'm writing some JS that requires a bunch of similar variables, numbered. I can do this just fine with multiple cursors etc, but since I'm using Emmet so much I wondered if there was a simple one line way of writing a list like:
let element1, element2, element3 ...
Is there a reason?

A: If you don't get an emmet answer, an extension I wrote, Find and Transform, can do this pretty easily:
{                                      // put this keybinding into your keybindings.json
  "command": "findInCurrentFile",
  "key": "alt+i",
  "args": {
    // "find": "element",              // not necessary
    "replace": "$1${matchNumber}",
    "restrictFind": "line",
    "isRegex": true
  }
}

Just put your cursor on the word that you want matched.  And then each match will be replaced by itself plus an incremented counter.

A: If you have to regularly have to apply numbers at the current cursor positions you can use the extension Regex Text Generator with a predefined setting.
"regexTextGen.predefined": {
    "sequantial numbers" : {
      "originalTextRegex": "(.*)",
      "generatorRegex": "{{=i+1}}"
    }
  }

*

*Place the cursors at the location needed (select all element and RightArrow)

*execute command: Generate text based on Regular Expression

*choose the sequantial numbers option

*Enter and possibly adjust the offset

If you don't define a preset you can type the expressions yourself.

A: Thanks for these examples, I was using Asuka's extension Insert Numbers and it's quite helpful especially for additional sets of variables.


text:
Q: Mysql Cluster stored procedure with subselect group by and order by is slow i have migrated this stored procedure from ms sql server 2012 to mysql cluster.
CREATE DEFINER = 'root'@'%'
PROCEDURE get_activeSub(IN p_top int, IN p_carrierid int, IN p_mode int)
BEGIN

DECLARE v_tomorrow datetime;
DECLARE v_temp int;
DECLARE v_sysdate datetime;

SET v_tomorrow = DATE_ADD(CURRENT_DATE(), INTERVAL 1 DAY);

IF (p_mode IS NULL) THEN
    SET p_mode = 0;
END IF;

IF ((p_mode != 0) AND (p_mode != 1)) THEN
    SET p_mode = 0;
END IF;

IF (p_mode = 0) THEN

SET v_sysdate = SYSDATE();
SELECT
activeSub.*
FROM
(
SELECT
--              e.msisdn
--              ,e.hasCredit
--              ,e.lastBillingDate
-- ,
MIN(a.schedulingId) AS schedulingIdMin
FROM
activeSub a
LEFT OUTER JOIN endUser e /*force INDEX for ORDER BY (IDX_enduser_lastBillingDate)*/ ON e.endUserId = a.endUserId
INNER JOIN smartBillingInterval sb ON a.serviceId = sb.serviceId    AND sb.transactionTypeId = 7
WHERE
(a.stateId IN (2000, 2007, 2008) OR a.stateid IS NULL)
AND a.nextBillingDate < v_tomorrow
AND a.carrierId = p_carrierId
AND (a.numRetry IS NULL OR a.numRetry <= sb.maxRetry_full)
AND (a.lastBillingPrice IS NULL OR (a.lastBillingPrice = sb.price_full AND a.nextBillingDate < v_sysdate))
GROUP BY
e.enduserid
--              ,e.hasCredit
--              ,e.lastBillingDate
ORDER BY
e.hasCredit DESC
,e.lastBillingDate DESC
LIMIT p_top
) aGrouped INNER JOIN activeSub ON activeSub.schedulingId = aGrouped.schedulingIdMin
ORDER BY activeSub.numRetry;

ELSE

SELECT
COUNT(*)
FROM (SELECT
COUNT(*) AS QUANTITY
FROM activeSub a
left outer join endUser e
ON e.endUserId = a.endUserId
INNER JOIN smartBillingInterval sb
ON a.serviceId = sb.serviceId AND sb.transactionTypeId = 7
-- where stateId not in (71010,21010) and nextBillingDate<@tomorrow and a.carrierId=@carrierId
WHERE (stateId IN (2000, 2007, 2008) OR stateid IS NULL)
AND nextBillingDate < v_tomorrow
AND a.carrierId = p_carrierId
-- NUMRETRY IN INTERVALS
AND (numRetry IS NULL OR numRetry <= sb.maxRetry_full)
-- NEXT PRICE TO USE, TAKING CARE ABOUT SHORT-RETRIES FOR FULL PRICES SWEPT
AND (lastBillingPrice IS NULL OR (lastBillingPrice = sb.price_full AND nextBillingDate < SYSDATE()))
GROUP BY    e.msisdn,
e.hasCredit,
e.lastBillingDate) AS Q;
END IF;
END

    i call them with call  get_activesub(300,101101,0)

    the structure of tables involved are

    USE lisabel;
    CREATE TABLE lisabel.activesub (
        endUserId bigint(20) NOT NULL,
        serviceId int(11) NOT NULL,
        carrierId int(11) NOT NULL,
        shortCodeId int(11) DEFAULT NULL,
        schedulingId bigint(20) NOT NULL,
        pendingDate datetime DEFAULT NULL,
        subscriptionDate datetime DEFAULT NULL,
        firstBillingDate datetime DEFAULT NULL,
        numBilling int(11) DEFAULT NULL,
        numCredits int(11) DEFAULT NULL,
        originId int(11) NOT NULL,
        text varchar(160) DEFAULT NULL,
        hierarchyId int(11) DEFAULT NULL,
        subscriptionHierarchyId int(11) NOT NULL,
        contentId bigint(20) DEFAULT NULL,
        moId bigint(20) DEFAULT NULL,
        channel varchar(100) DEFAULT NULL,
        pinCode varchar(4) DEFAULT NULL,
        transactionId bigint(20) DEFAULT NULL,
        nextBillingDate datetime DEFAULT NULL,
        deliveryReportId int(11) DEFAULT NULL,
        retCode varchar(255) DEFAULT NULL,
        numRetry int(11) DEFAULT NULL,
        numShortRetry int(11) DEFAULT NULL,
        stateId int(11) DEFAULT NULL,
        previousStateId int(11) DEFAULT NULL,
        page varchar(100) DEFAULT NULL,
        handsetId int(11) DEFAULT NULL,
        lastBillingDate datetime DEFAULT NULL,
        banningCount int(11) DEFAULT NULL,
        flowId int(11) DEFAULT NULL,
        subscriptionNumRetry int(11) DEFAULT NULL,
        subscriptionNumShortRetry int(11) DEFAULT NULL,
        debit int(11) DEFAULT NULL,
        partnerNotificationMask varchar(10) DEFAULT NULL,
        lastBillingPrice decimal(10, 2) DEFAULT NULL,
        sessionId bigint(20) DEFAULT NULL,
        gclid varchar(50) DEFAULT NULL,
        msisdn varchar(50) DEFAULT NULL,
        PRIMARY KEY (endUserId, serviceId),
        INDEX FK_activeSub_content USING BTREE (contentId),
        INDEX FK_activeSub_deliveryReport USING BTREE (deliveryReportId),
        INDEX FK_activeSub_handset USING BTREE (handsetId),enter code here
        INDEX FK_activeSub_hierachy USING BTREE (hierarchyId),
        INDEX FK_activeSub_origin USING BTREE (originId),
        INDEX FK_activeSub_shortCode USING BTREE (shortCodeId),
        INDEX FK_activeSub_subscriptionHierarchy USING BTREE (subscriptionHierarchyId),
        INDEX IDX_activesub_carrierId USING BTREE (carrierId),
        INDEX IDX_activesub_endUserId USING BTREE (endUserId),
        INDEX IDX_activesub_lastBillingPrice USING BTREE (lastBillingPrice),
        INDEX IDX_activesub_nextBillingDate USING BTREE (nextBillingDate),
        INDEX IDX_activesub_numRetry USING BTREE (numRetry),
        INDEX IDX_activesub_schedulingId USING BTREE (schedulingId),
        INDEX IDX_activesub_serviceId USING BTREE (serviceId),
        INDEX IDX_activesub_stateId USING BTREE (stateId)
    )
    ENGINE = NDBCLUSTER
    AVG_ROW_LENGTH = 204
    CHARACTER SET latin1
    COLLATE latin1_swedish_ci;

    USE lisabel;
    CREATE TABLE lisabel.enduser (
        endUserId bigint(20) NOT NULL AUTO_INCREMENT,
        msisdn varchar(50) NOT NULL,
        carrierId int(11) NOT NULL,
        handsetId int(11) DEFAULT NULL,
        hasCredit bit(1) DEFAULT NULL,
        lastBillingDate datetime DEFAULT NULL,
        lastAttemptDate datetime DEFAULT NULL,
        PRIMARY KEY (endUserId),
        INDEX FK_endUser_handset USING BTREE (handsetId),
        INDEX FK_endUsers_carrier USING BTREE (carrierId),
        INDEX IDX_enduser_endUserId USING BTREE (endUserId),
        INDEX IDX_enduser_lastBillingDate USING BTREE (lastBillingDate),
        UNIQUE INDEX IDX_enduser_msisdn USING BTREE (msisdn)
    )
    ENGINE = NDBCLUSTER
    AUTO_INCREMENT = 2040353
    AVG_ROW_LENGTH = 60
    CHARACTER SET latin1
    COLLATE latin1_swedish_ci;

both tables are table in memory.
table activesub have 300.000 records the enduser table have 2.000.000 records.
if i run explain extended
EXPLAIN EXTENDED
SELECT
activeSub.*
FROM
(`enter code here`
SELECT
--              e.msisdn
--              ,e.hasCredit
--              ,e.lastBillingDate
-- ,
MIN(a.schedulingId) AS schedulingIdMin
FROM
activeSub a
LEFT OUTER JOIN endUser e USE INDEX for ORDER BY (IDX_enduser_lastBillingDate) ON e.endUserId = a.endUserId
INNER JOIN smartBillingInterval sb ON a.serviceId = sb.serviceId    AND sb.transactionTypeId = 7
WHERE
(a.stateId IN (2000, 2007, 2008) OR a.stateid IS NULL)
AND a.nextBillingDate < '2014-12-15'
AND a.carrierId = 101101
AND (a.numRetry IS NULL OR a.numRetry <= sb.maxRetry_full)
AND (a.lastBillingPrice IS NULL OR (a.lastBillingPrice = sb.price_full AND a.nextBillingDate < sysdate()))
GROUP BY
e.enduserid
--              ,e.hasCredit
--              ,e.lastBillingDate
ORDER BY
e.hasCredit DESC
,e.lastBillingDate DESC
LIMIT 300
) aGrouped INNER JOIN activeSub ON activeSub.schedulingId = aGrouped.schedulingIdMin
ORDER BY activeSub.numRetry;
SHOW WARNINGS;

The result is:
    1   PRIMARY <derived2>  ALL (null)  (null)  (null)  (null)  300 100 Using where; Using temporary; Using filesort
    1   PRIMARY activeSub   ref IDX_activesub_schedulingId  IDX_activesub_schedulingId  8   aGrouped.schedulingIdMin    1   100 (null)
    2   DERIVED a   ref IDX_activesub_stateId,IDX_activesub_lastBillingPrice,IDX_activesub_numRetry,IDX_activesub_nextBillingDate,IDX_activesub_carrierId,IDX_activesub_serviceId   IDX_activesub_carrierId 4   const   305303  100 Parent of 3 pushed join@1; Using where with pushed condition (((`lisabel`.`a`.`stateId` in (2000,2007,2008)) or isnull(`lisabel`.`a`.`stateId`)) and (`lisabel`.`a`.`nextBillingDate` < '2014-12-15')); Using temporary; Using filesort
    2   DERIVED sb  eq_ref  PRIMARY PRIMARY 8   lisabel.a.serviceId,const   1   100 Child of 'a' in pushed join@1; Using where
    2   DERIVED e   eq_ref  PRIMARY,IDX_enduser_endUserId   PRIMARY 8   lisabel.a.endUserId 1   100 Child of 'a' in pushed join@1; Using where

And the workbench execution plan is:

The execution time is 2.5 - 3 seconds. How you can improve the execution time?


text:
Q: Get files from S3 bucket sub folders and process the files in Mule I have the following folder structure in a S3 bucket called "test-files":
pending-files/products
pending-files/prices

Each folder contains a number of small CSV files and I want to retrieve them all in one call and then process each file in a For Each loop which contains a Choice component to redirect the payload based on the folder name e.g. "products" or "price".
I use List Objects to retrieve the files and have been able to retrieve all the files but the list contains an entry for the folder and the For Each will fail validation due to the folder not being a valid CSV file and also will fail the empty file check because the size will be 0.
How can I do this?
XML Workflow:
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http"
    xmlns:file="http://www.mulesoft.org/schema/mule/file"
    xmlns:s3="http://www.mulesoft.org/schema/mule/s3" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/s3 http://www.mulesoft.org/schema/mule/s3/current/mule-s3.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">

<flow name="listobjects">
        <poll doc:name="Poll">
            <fixed-frequency-scheduler frequency="1000" timeUnit="HOURS"/>
            <s3:list-objects config-ref="Amazon_S3__Configuration" bucketName="test-files" prefix="pending-files/" maxKeys="5" doc:name="Amazon S3" delimiter="/" marker="pending-files/"/>
        </poll>
    <foreach collection="#[payload.objectSummaries]" doc:name="For Each">
            <logger message="#[payload.getKey()]" level="INFO" doc:name="Logger"/>
            <s3:get-object-content config-ref="Amazon_S3__Configuration" bucketName="test-file-drop" key="#[payload.getKey()]" mimeType="application/csv" doc:name="Amazon S3"/>
            <choice doc:name="Choice">
                <when expression="">
                    <flow-ref name="csvToMongodbFlow" doc:name="csvToMongodbFlow"/>
                </when>
                <otherwise>
                    <logger message="#['*************Missed*****************']" level="INFO" doc:name="Logger"/>
                </otherwise>
            </choice>

    </foreach>
        <logger message="#['\nCompleted']" level="INFO" doc:name="Logger"/>
</flow>

</mule>


text:
Q: Number of degree-$d$ representations of a perfect group? It seems to be a standard result that the number of degree-1 representations of a group $G$ is equal to $[G : G']$ where $G'$ is the commutator subgroup (e.g. Lemma 6.2.7 in the 2012 textbook "Representation Theory of Finite Groups" by Steinberg).
A consequence is that a group is perfect (i.e. $G = G'$) iff the only degree-1 representation is the trivial one.
Is there any analogous theorem that bounds the number of degree-$(d > 1)$ representations of a perfect group, or gives some other characterization of them (that is unique to perfect groups)?

A: Let $G_p = \operatorname{SL}(2,p)$ for $p$ prime, $p \geq 5$. Then $G_p$ is a perfect group and has $\frac{p-1}{2}$ characters of degree $p-1$.
Taking $p$ to be the first prime greater than or equal to $2n+1$, we get that $G_p$ has more than $n$ characters of degree $p-1$.
Most groups of Lie type have high multiplicity character degrees (multiplicity above some multiple of $q^r$ where $r$ is the twisted lie rank and $q$ is the smaller of the possibilities for $q$, so that $q^t$ is the field size with $t$ the degree of the twist).
I didn't check alternating groups, but they probably work as well.


text:
Q: Загрузка файлов в Django setting.py
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')

MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

STATIC_URL = '/static/'

форма
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}

    {{ form }}
    <input type="submit" value="Submit" />
</form>

views.py
def uploads(request):

    if request.method == 'POST':
        form = upload(request.POST, request.FILES)

        return HttpResponse(request.FILES['file'].temporary_file_path)

    else:
        form = upload()
    return render_to_response('ff.html', {'form': form})

request.FILES['file'].temporary_file_path должен возвращать путь к временному файлу.В папке media файл отсутствует, а в браузере отображается только знак >
в модели формы только поле FileField(). При добавлении в него upload_to в консоли выдается ошибка __init__() got an unexpected keyword argument 'upload_to'

A: Кратко: файл, загружаемый через форму, необходимо обработать, чего ваша программа не делает.
Когда вы загружаете файл, Django сперва помещает его во временно хранилище. Маленькие файл размещаются в памяти, большие — в системной временной директории (на Linux это /tmp/).
Пример (UploadFileForm — форма, содержащая поле file типа FileField):
def upload_file(request):
    # Если метод POST
    if request.method == 'POST':
        # Заполняем форму полученными данными
        form = UploadFileForm(request.POST, request.FILES)
        # Если данные валидны
        if form.is_valid():
            # обрабатываем файл
            handle_uploaded_file(request.FILES['file'])
            # перенаправляем на другую страницу
            return HttpResponseRedirect('/success/url/')
    # Если другой метод (обычно GET)
    else:
        form = UploadFileForm()
    # Выводим форму загрузки
    return render_to_response('upload.html', {'form': form})

Перенаправление делают для того, чтобы при обновлении страницы файл не загружался повторно. handle_uploaded_file — функция обработки файла, её нужно писать самому.
Пример копирования содержимого полученного файла в файл /srv/media/data.txt:
def handle_uploaded_file(f):
    with open('/srv/media/data.txt', 'wb+') as dest:
        for chunk in f.chunks():
            dest.write(chunk)

Нужно использовать chunks, так как копирование по частям меньше нагружает систему. Просто копирование из временной папки тоже не подходит, так как файл может быть загружен в память.
Путь, по которому будет сохраняться файл можно сформировать самому из MEDIA_ROOT и имени загруженного файла с помощью os.path.join.
Обрабатывать файл можно по-разному. Можно прочитать его содержимое целиком при помощи метода read() или по частям с помощью метода chunks() и что-то с ним сделать. Но чаще всего файл просто сохраняют в какую-либо директорию, где он будет в дальнейшем хранится.
Также Django предоставляет удобный способ. Если файл также хранится в модели, то его можно сохранить в указанное место одним вызовом. Для этого в модели вы создаёте поле типа FileField с аргументом upload_to, содержащим путь, по которому будет размёщён файл. Если вы создавали форму на основе модели (то есть, с помощью ModelForm), то достаточно команды
form.save()

для сохранения файла в указанное место. Также вы сможете загружать файлы через админку.
Загрузка файлов в Django


text:
Q: How to do a custom insert inside a python-eve app I have some custom flask methods in an eve app that need to communicate with a telnet device and return a result, but I also want to pre-populate data into some resources after retrieving data from this telnet device, like so:
@app.route("/get_vlan_description", methods=['POST'])
def get_vlan_description():
    switch = prepare_switch(request)
    result = dispatch_switch_command(switch, 'get_vlan_description')

    # TODO: populate vlans resource with result data and return status

My settings.py looks like this:
SERVER_NAME = '127.0.0.1:5000'
DOMAIN = {
    'vlans': {
        'id': {
            'type': 'integer',
            'required': True,
            'unique': True
        },
        'subnet': {
            'type': 'string',
            'required': True
        },
        'description': {
            'type': 'boolean',
            'default': False
        }
    }
}

I'm having trouble finding docs or source code for how to access a mongo resource directly and insert this data.

A: Have you looked into the on_insert hook? From the documentation:

When documents are about to be stored in the database, both on_insert(resource, documents) and on_insert_<resource>(documents) events are raised. Callback functions could hook into these events to arbitrarily add new fields, or edit existing ones. on_insert is raised on every resource being updated while on_insert_<resource> is raised when the <resource> endpoint has been hit with a POST request. In both circumstances, the event will be raised only if at least one document passed validation and is going to be inserted. documents is a list and only contains documents ready for insertion (payload documents that did not pass validation are not included).

So, if I get what you want to achieve, you could have something like this:
def telnet_service(resource, documents):
    """
        fetch data from telnet device;
        update 'documents' accordingly
    """
    pass

app = Eve()
app.on_insert += telnet_service

if __name__ == "__main__":
    app.run()

Note that this way you don't have to mess with the database directly as Eve will take care of that.
If you don't want to store the telnet data but only send it back along with the fetched documents, you can hook to on_fetch instead.
Lastly, if you really want to use the data layer you can use app.data.driveras seen in this example snippet.

A: use post_internal
Usage example:
from run import app
from eve.methods.post import post_internal

payload = {
    "firstname": "Ray",
    "lastname": "LaMontagne",
    "role": ["contributor"]
}

with app.test_request_context():
    x = post_internal('people', payload)
    print(x)


text:
Q: Process maker Document Upload - Error 404 sysworkflow was not found on this server While Uploading document on Processmaker through POSTMAN, I am able to upload the document but while accessing the same method via my C# code. I am getting an HTML page as response ERROR 404 /sysworkflow was not found on this server.

A: Upon checking in the documentation, this is the endpoint:
/api/1.0/workflow/project/{prj_uid}/file-manager/{prf_uid}/upload
maybe you are using this part of the endpoint that is making the ERROR 404 appear
/api/1.0/sysworkflow/project/{prj_uid}/file-manager/{prf_uid}/upload

Check this documentation out


text:
Q: Inno Setup Postpone locked file replacing to the next restart during silent installation In Inno Setup installer (5.5.1(a)) during upgrade .exe is being replaced. When the exe is locked, it is showing error

DeleteFile failed; code 5.
  Access is denied.
  Abort, Retry, Ignore

How to suppress message during silent upgrade please help me. By default during silent installation it should take Ignore option without any error.
.

A: I do not think it makes sense to ignore/skip the file. I assume you need to replace it during upgrade, don't you?

You can have a different entry for silent and non-silent installations:
[Files]
Source: C:\path\MyProg.exe; Dest: {app}; Check: not WizardSilent
Source: C:\path\MyProg.exe; Dest: {app}; Flags: restartreplace; Check: WizardSilent

A: Most of the times it won't be able to replace your executable because that file is still running. Why don't you just kill that process through BeforeInstall ?.
Kill process before (re)install using "taskkill /f /im" in Inno Setup
This approach won't help if your problem is because you have no rights to modify that file though.


text:
Q: Reformatting MacBookPro6,2 I have a macbook pro 6,2 and don't have the recovery discs as I am traveling abroad and left my discs at home. Is there any way to reformat my hard drive and get it to factory (or near factory) settings without the discs?
Does my computer have a recovery partition and can I use that to reformat?

A: All Lion and later (10.7) OS X should have a recovery HD by default.
If you haven't changed your configuration, it likely does still have the recovery partition.  Find out by holding Option while booting. Now, the recovery HD only has disk formatting tools and terminal and the ability to connect to the App Store to re-download the installer. It doesn't actually save the installer to the drive.
Barring that, I would download the Mac OS from the App Store and put it on a thumb drive for a reinstall.


text:
Q: MS SQL Server: Load All Data vs Aggregate with +1 round trip I love to get your opinion on this problem.
I need to show the list of order records for the range of particular date/time. Then summarise it with # of Order compare with the "last" order. "Last" can mean either last month OR last year
Since I am going to show the list of order record, I am thinking to get the record from last month OR last year with one hit (ie. together with the records of current date/time range)
OR, alternatively, I can:

*

*Get the record of current date/time range, THEN

*Get the total number of order (using aggregate) for last month OR last year
The alternative means there is 2 round trips to database (but less data to return). Or should I stick with my current method (loading all records including those from last month OR last year).

NOTE: The website and the SQL server is hosted in Microsoft Azure Cloud. But we might switch to AWS in the future.

Thanks

Input example (some fields are omitted including time for simplicity)
----------------------------------------------------------------
| Warehouse Id | Order Id | Product Id | Quantity | Order Date |
----------------------------------------------------------------
|            1 |       10 |          1 |       10 | 2016-09-25 |
|            1 |        9 |          5 |        5 | 2016-09-24 |
|            1 |        8 |          4 |        8 | 2016-09-23 |
|            1 |        7 |          6 |        2 | 2016-09-23 |
|            1 |        6 |          8 |        1 | 2016-09-23 |
|            1 |        5 |          1 |        2 | 2016-09-22 |
|            1 |        4 |          1 |        2 | 2016-09-21 |
|            1 |        3 |          5 |       10 | 2016-09-21 |
|            1 |        2 |          5 |       15 | 2016-08-12 |
|            1 |        1 |          5 |        5 | 2016-08-10 |
----------------------------------------------------------------

The desire OUTPUT:
Input:
   WarehouseId: 1
   StartDate: 2016-09-01   End Date: 2016-09-30)
   Comparison type: Last Month (ie. StartDate: 2016-08-01   EndDate: 2016-08-31)

Output:
Warehouse: xxx
-------------------------------------------------
| Order Id | Product Id | Quantity | Order Date |
-------------------------------------------------
|       10 |          1 |       10 | 2016-09-25 |
|        9 |          5 |        5 | 2016-09-24 |
|        8 |          4 |        8 | 2016-09-23 |
|        7 |          6 |        2 | 2016-09-23 |
|        6 |          8 |        1 | 2016-09-23 |
|        5 |          1 |        2 | 2016-09-22 |
|        4 |          1 |        2 | 2016-09-21 |
|        3 |          5 |       10 | 2016-09-21 |
-------------------------------------------------
Total Order: 40 (increase 100% from last month)

So, what I am doing now is to get ALL records from 2016-08-01 to 2016-09-30. That way I can avoid 2 round trips.
Alternatively, I can do the following:
1. Get record from 2016-09-01 to 2016-09-30
   var rec = (from rec in tblOrders
              where (rec.WarehouseId == whsId) && (rec.OrderDate >= startDate) && (rec.OrderDate <= endDate)
              select rec).ToList();
2. Then do the SUM of total order from 2016-08-01 to 2016-08-31 for comparison purposes
   var recSum = (from rec in ef.tblOrders
                 where (rec.WarehouseId == whsId) && (rec.OrderDate >= cStartDate) && (rec.OrderDate <= cEndDate)
                 group rec by rec.WarehouseId into grec
                 select new
                 {
                     TotalQty = grec.Sum(x => x.Quantity),
                 }).FirstOrDefault();

A: You can do this with window functions:
select o.*
from (select o.*
             sum(case when datetime is "last month" or "last year" then 1 else 0 end) over () as last_num_orders
      from orders o
     ) o
where o.datetime between @date1 and @date2;

I am very unclear what "last" means in this context.  However, you can do what you want with window functions, which is the preferred option 0.


text:
Q: Majorization of cyclic products Let $k,m,n\in\mathbb N$ such that $n>k$. For a partition $\alpha=(\alpha_1,\dots,\alpha_k)\vdash m$ with $\alpha_1\ge\dots\ge \alpha_k>0$ and nonnegative $ x_1,\dots,x_n$ define $x^\alpha :=\prod_{i=1}^k x_i^{\alpha_i} $ and ${\tilde x^{\alpha}}  :=\prod_{i=1}^k x_{i+1}^{\alpha_i} $. All indices are cyclical $\mod n$.

Prove or disprove: $${\prod_{cyc}(x_1^m+ \tilde x^{\alpha} )\ge\prod_{cyc}(x_1^m+ x^{\alpha})}.$$

For exemple, $\alpha=(1,1)$ yields the inequality  $$\prod_{cyc}(x_{i}^{2}+x_{i+1}x_{i+2})\ge \prod_{cyc}(x_{i}^{2}+x_{i}x_{i+1}),$$ or in more sloppy but intuitive notation, if the variables are denoted $a,b,c,...,z$, $$\prod_{cyc}(a^2+bc)\ge \prod_{cyc}(a^2+ab ).$$
A two-line proof for this:

By Cauchy-Schwarz, $ (a^2 + bc)(c+b) \ge (a\sqrt {c} + \sqrt {bc}\sqrt {b})^2 = c(a + b)^2$.
  Now multiply all cyclic permutations of that and note that $\prod\limits_{cyc}(c+b)=\prod\limits_{cyc}(a + b)$.

More generally, for a partition $(p,q)$ with $p\ge q$, putting $$x=\frac{q}{p+q},y=\frac{p-q}{2(p+q)}, z=\frac12,$$ we have $x+y+z=1$ and can apply the discrete form of Hölder's inequality to obtain
$$(a^{p+q}+b^pc^q)^x(b^q+c^q)^y(c^q+b^q)^z\ge a^{(p+q)x}b^{qy}c^{qz}+b^ {px+qz} c^{qx+qy}=(a^q+b^q)b^{qy} c^{qz} ,$$ which after multiplying all its cyclic permutations and dividing by $\prod\limits_{cyc}(a^q+b^q)^{y+z}$, leaves us with $$\prod\limits_{cyc} (a^{p+q}+b^pc^q)^x \ge \prod\limits_{cyc}(a^q+b^q)^{x}\prod\limits_{cyc}a^{q(y+z)}=\prod\limits_{cyc}(a^q+b^q)^{x}\prod\limits_{cyc}a^{px} ,$$ qed.
This proof settles $k=2$. (The inequality is wrong for $p<q$). For $k\ge3$ and some special choices of $\alpha$, there are elegant proofs using Cauchy-Schwarz or Hölder. But not for the general case.
A bit of motivation: Looking at some famous inequalities of discrete variables like the power means inequality or Maclaurin's inequality, but also Cauchy-Schwarz, a recurrent principle is that for homogenous inequalities, the more "separated" the variables are, the bigger the expression, and the more "mixed" they are (in the sense of multiplied with each other), the smaller the expression. This coincides with the patterns in question here, giving some "empirical support" in favour of the conjecture.
Even though the condition of non-increasing parts of $\alpha\vdash m$ does not seem always necessary for $k\ge 3$, I think the above conjecture is very tough. (Of course I would be happy to learn the contrary.) I don't even know of a proof for the simplest case of $k=3$, viz. $\alpha=(1,1,1)$, yielding $$\prod_{cyc}(a^3+bcd)\ge \prod_{cyc}(a^3+abc )$$ for $n\ge4$ variables. It might be possible to use some kind of majorization, but I don't see how.
Based on strong numerical evidence, I also have a different "iff" conjecture for $k=3$:

Conjecture: for a partition $\alpha=(p,q,r)$, the inequality $${\prod_{cyc}(x_1^m+ \tilde x^{\alpha} )\ge\prod_{cyc}(x_1^m+ x^{\alpha})}$$ holds for all nonnegative $ x_1,\dots,x_n$ iff both $p\ge r$ and $p+r\ge q$ hold.
It seems tempting to conjecture for each $k\ge4$ the existence of an "iff" statement with a similar set of conditions.

As a side note: In an AoPS thread which deals with a somewhat dual question in 3 variables (the question: for which pairs of partitions $(u,v,w),(p,q,r)\vdash m$ does the inequality $\sum\limits_{cyc} a^ub^vc^w\geq \sum\limits_{cyc} a^{p}b^{q}c^{r}$ hold $ \forall a,b,c\ge0$ ?), it turned out that this holds iff it can be reduced to the weighted AM-GM inequality in a similar way as the reduction to Hölder above.

A: This is an idea/a partial answer.
Let $x_1,\dots,x_n$ be positive nubmers such that $\prod x_i=1$. Assume that $y_i=\prod_{k=0}^{n-1} x_{i+k}^{\lambda_k}$ for some exponents $\lambda_k$, indices are modulo $n$. Note that we may replace $\lambda_k$ to $\lambda_k+c$ for any constant $c$. Now assume that $\sum |\lambda_i+c|\leq 1$ for some $c$. Then we may choose $c$ such that $\sum |\lambda_i+c|=1$ (by continuity). Now apply Jensen inequality for the convex function $\log(1+e^x)$: Denote $\beta_k=|\lambda_k+c|$, $z_{i,k}=x_{i+k}^{{\rm sign}\,(\lambda_k+c)}$,
$$
\prod (1+y_i)=\prod_i \left(1+\prod_{k=0}^{n-1} z_{i,k}^{\beta_k}\right)\leqslant
\prod_i \prod_k (1+z_{i,k})^{\beta_k}=\prod (1+x_i),
$$
since $\prod (1+1/x_i)=\prod_j (1+x_i)=\prod_i (1+z_{i,k})$ for any fixed $k$.
So, if $\min_c \sum_i |\lambda_i+c|\leq 1$, we get $\prod (1+y_i)\leqslant \prod (1+x_i)$. Apply it to, say $\prod (a^3+bcd)\geqslant \prod(a^3+abc)$, here $x_1=bcd/a^3$ and $y_1=bc/a^2$. Expressing $y$'s via $x$'s is a linear system of equations with circulant matrix. But, say, already for $n=5$ lambdas are equal to $28/41,-2/41,-5/41,7/41,0$, and such $c$ does not exist.


text:
Q: How to exclude character sequences when matching Is there some sort of escape sequence or character in regexes that specify that a specific character should not be found at this place in the pattern?
For instance if I want match a string that has C-style escape sequences but not the specific escape sequence for a literal backslash (Should match "Hello\tWorld" but not "Hello\\World") then how would I write the regex so that it matches any '\' but not if followed by ONLY another '\'?
Thanks.

A: As you don't specify your language, here is a perl script that do the job:
#!/usr/bin/perl
use strict;
use warnings;
use 5.10.1;

my @l = ("Hello\tWorld", "Hello\\World");

for(@l) {
  say /^.*?\\(?!\\).*$/ ? "$_ -> KO" : "$_ -> OK";
}

Output:
Hello   World -> OK
Hello\World -> KO

Explanation:
/       : start regex
^       : begining of the line
  .*?   : any number of any char (not greedy)
  \\    : backslash
  (?!   : negative look ahead
    \\  : backslash
  )     : end of negative look ahead
  .*    : any number of any char
$       : end of line
/

A: In most regex syntaxes, you can define an inverse character class using ^, e.g. [^a] matches anything apart from an a.

A: I think a very similar question was just asked a few minutes ago, check it out and see if it helps you: PHP regex to find non-espaced letters
Regex from link: (?<!\\\)F
Possible regex for you: (?<!\\\)[tnr] which matches \n, \t, or \r


text:
Q: Problem with orthogonal mapping We have an orthogonal mapping  $A$ on an Euclidean space  and two linearly independent vectors $x,y$ such that for some $a,b\in \mathbb R$, $b\neq 0$,
$$
Ax=ax-by;
$$
$$
Ay=bx+ay.
$$
Since $x,y$ form a basis in $span [x,y]$ and $A$ is orthogonal,  $a^2+b^2=1$.
Are $x,y$ of the same norm? If not  how to obtain unit orthogonal  vectors $x',y'$, from $x,y$, such that  $Ax'=ax'-by',
Ay'=bx'+ay'$?


text:
Q: How to ignore js file from webpack config in reactjs My webpack config file shows error Sitemap is not function, If I ignore css file it's working fine, if I ignore js file it display this error. How to ignore js file. Could you please check my config file below.
Error:
> babel-node src/sitemap-builder.js

F:\react\test\live\testserver\src\sitemap-builder.js:16
new Sitemap(router).build("http://localhost:3000/").save('./public/sitemap.xml');
^

TypeError: Sitemap is not a constructor

webpack config file:
require("babel-register")({
    presets: ["es2015", "react"]
  });
  require.extensions['.scss'] = () => {
    return;
  };
  require.extensions['.css'] = () => {
    return;
  };
  require.extensions['.js'] = () => {
    return;
  };

  const router = require('./Routes').default;
  const Sitemap = require('react-router-sitemap').default;
  (
     new Sitemap(router)
        .build("http://localhost:3000/")
        .save('./public/sitemap.xml')
  );

A: Check if anything happens by using this
const Sitemap = require('../').default;