text:
Q: Rally App Filter Example using OR and AND operators I would like to use a filter that combines OR and AND operator, but this filter syntax uses AND operator only:
this.grid = this.add({
                            xtype: 'rallygrid',
                            model: model,
                            columnCfgs: [
                                'FormattedID',
                                'Name',
                                'Priority',
                                'State'
                            ],
                            storeConfig: {

                                filters: [
                                    {
                                        property: 'Priority',
                                        operator: '=',
                                        value: 'High Attention'
                                    },
                                    {
                                        property: 'Priority',
                                        operator: '=',
                                        value: 'Normal'
                                    },
                                   {
                                        property: 'State',
                                        operator: '=',
                                        value: 'Open'
                                    }
                                ]

                            }
                        });

A: If the filter has to use a mix of AND and OR operators you'll need to build it using and/or methods of Rally.data.QueryFilter .
Here is a full example where I filter in "High Attention" or "Normal" priority defects in "Open" State:
    Rally.onReady(function () {
    Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

            launch: function() {
                Rally.data.ModelFactory.getModel({
                    type: 'Defect',
                    success: function(model) {

                        var filter = Ext.create('Rally.data.QueryFilter', {
                            property: 'Priority',
                            operator: '=',
                            value: 'Normal'
                        });

                        filter = filter.or({
                            property: 'Priority',
                            operator: '=',
                            value: 'High Attention'
                        });
                         filter = filter.and({
                            property: 'State',
                            operator: '=',
                            value: 'Open'
                        });
                        filter.toString();

                        this.grid = this.add({
                            xtype: 'rallygrid',
                            model: model,
                            columnCfgs: [
                                'FormattedID',
                                'Name',
                                'Priority',
                                'State'
                            ],
                            storeConfig: {
                                filters : [filter]

                            }
                        });
                    },
                    scope: this
                });

            }
       });

        Rally.launchApp('CustomApp', {
            name:"MyApp"
        });

});


text:
Q: PyCryptodome alternative for jython I am trying to incorporate a simple encrypting processor for Apache Nifi. I am using the Script Processor module to include a Python script that does the function on encrypting and decrypting with AES. I am having trouble loading the module PyCryptodome (I also tried pycrypto), that was offering me the functionality. I have read that this module cannot be loaded as it is not pure python, which is, aparently, not supported by Nifi.
Any suggestion of what can I use as an alternative to this module?

A: It's not that NiFi doesn't support native Python modules per se, rather it is the Jython engine that we use in NiFi (as NiFi is a pure Java implementation) that does not support it. If you have a Python interpreter on the node(s) running NiFi, you could use ExecuteStreamCommand to shell out to Python using your script (with native imports), you'd get the contents of the flow file as stdin and you'd write your encrypt/decrypt logic to output to stdout, which would become the contents of the outgoing flow file.
I'm looking into a Py4J processor so we can get around Jython's limitation on native modules, but you'd still have to Bring Your Own Python (BYOP). For now, as long as you don't want to do anything more complex than taking in flow file content and writing out flow file content, ExecuteStreamCommand should do the trick.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to add Segmented controll on UIToolBar in iphone How to add segmented control on toolbar, I'm adding but not shows.
  my code is: these code is on viewDidload
    toolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0.0, 325.0, 320.0, 44.0)];
    toolBar.barStyle = UIBarStyleDefault;
     NSArray *segmentItem = [[NSArray alloc]initWithObjects:@"Day",@"List",@"Month", nil];
    UISegmentedControl *segmentControll = [[UISegmentedControl alloc]initWithItems:segmentItem];
    segmentControll.frame = CGRectMake(80.0, 325.0, 200.0, 30.0);

    //[self.toolBar addSubview:segmentControll];

    [self.navigationController.toolbar addSubview:segmentControll];

    [self.view addSubview:toolBar];

A: You can add only the UIBarButtonItem's to UIToolbar.
First, add the segmentControll to a bar button item,
UIBarButtonItem *segBarBtn;
segBarBtn = [[UIBarButtonItem alloc] initWithCustomView:segmentControl];

Add the bar button to the tool bar,
NSArray *toolbarItems = [NSArray arrayWithObject:segBarBtn];
[toolbar setItems:toolbarItems animated:NO];

A: 1. self.navigationController.toolbar is not the same as toolBar.
2. You're doing it wrong. You should add segmentControl as UIBarButtonItem:
UIBarButtonItem *btnItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControll];
toolBar.items = [NSArray arrayWithObject:btnItem];

A: With a regular UIToolbar you do so by making the segmented control a part of a custom UIBarButtonItem like this.
UIBarButtonItem * segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView: segmentControll];
NSMutableArray *itemCopy = [self.toolbar.items mutableCopy];
[itemCopy addObject:segmentBarItem];
self.toolbar.items = itemCopy;

[itemCopy release];
[segmentBarItem release];

But in your case you are trying to modify the toolbar of a navigation controller which is discouraged.

This property contains a reference to the built-in toolbar managed by
  the navigation controller. Access to this toolbar is provided solely
  for clients that want to present an action sheet from the toolbar. You
  should not modify the UIToolbar object directly.

You will still want to create a custom UIBarButtonItem but you will want to set it as the rightBarButtonItem

A: Try something like this
toolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0.0, 325.0, 320.0, 44.0)];
toolBar.barStyle = UIBarStyleDefault;
 NSArray *segmentItem = [[NSArray alloc]initWithObjects:@"Day",@"List",@"Month", nil];
UISegmentedControl *segmentControll = [[UISegmentedControl alloc]initWithItems:segmentItem];
segmentControll.frame = CGRectMake(80.0, 325.0, 200.0, 30.0);

//[self.toolBar addSubview:segmentControll];

UIBarButtonItem *toolbarItem = [[[UIBarButtonItem alloc] initWithCustomView:segmentedControl] autorelease];
[toolBar addSubview:toolbarItem];

[self.view addSubview:toolBar];


text:
Q: Hadoop operation shutting down the node I am running hadoop on a virtual machine inside the code. While doing hdfs operation (copy,..) the virtual machine was shutdown first time and the actual node was shutdown second time.
I am not sure why this is happening and i am not able to see why this happening in any logs either.
Any suggestions/inputs ?
Thanks.

A: Being heavy Daemons, all the Hadoop processes are resource intensive, specially RAM. Increase the RAM of your VM and hopefully it would solve the problem.
(Let me know if it doesn't).


text:
Q: I have a ViewPager by same fragments RecyclerView just load items in one fragment of ViewPager i have a viewPager with fragments when i want to load items in RecyclerView ,the items just load in first fragments RecyclerView and not loading in other but the textviews are loading in all fragments and when i go back to previous item again items load in recyclerView of that fragment
I see some of the solutions and i make all my recyclerView Adapters view not static but again it not worked
and i made other fragment by different name and different layout name and different id for its recyclerView and it work but i have a large number of fragments and it is not the solution for me ):
public class ShowInfo extends Fragment {

 private static ViewPager mPager;
private static int currentPage = 0;
View view;
RecyclerView rv;
RecyclerView rv1;
ImageView lastImage;
ImageView nextImage;
TextView imageStatus;
TextView title;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_item_scrolling, container, false);
    String strtext = getArguments().getString("title","");
    title = v.findViewById(R.id.textView);
    title.setText(strtext);
    return v;
}
private static final Integer[] XMEN= {R.drawable.testimage,R.drawable.slide,R.drawable.testimage,R.drawable.slide};
private ArrayList<Integer> XMENArray = new ArrayList<Integer>();
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    init();
    RVAdapter_item rvAdapter = new RVAdapter_item(initializeData());
    rv.setAdapter(rvAdapter);
    RVAdapter1_item rvAdapter1 = new RVAdapter1_item(initializeData());
    rv1.setAdapter(rvAdapter1);
    imageStatus.setText(getTextString(0));
    rvAdapter.notifyDataSetChanged();
    rvAdapter1.notifyDataSetChanged();
}
private void init() {
    LinearLayout linearLayout = getActivity().findViewById(R.id.linear);
    rv = (RecyclerView) linearLayout.getChildAt(2);
    imageStatus = getActivity().findViewById(R.id.imageStatus);
    lastImage = getActivity().findViewById(R.id.lastImage);
    nextImage = getActivity().findViewById(R.id.nextImage);
    rv.setHasFixedSize(true);
    rv.setLayoutManager( new GridLayoutManager(getActivity(),1));
    rv1 = getActivity().findViewById(R.id.rv1);
    rv1.setHasFixedSize(true);
    rv1.setLayoutManager( new GridLayoutManager(getActivity(),2));
}

private ArrayList<Data> initializeData() {
    ArrayList<Data> qorans = new ArrayList<>();
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    qorans.add(new Data("","",""));
    return qorans;
}

public String getTextString(int i){
    if (i==0){
        lastImage.setVisibility(View.INVISIBLE);
    }else {
        lastImage.setVisibility(View.VISIBLE);
    }
    if (i+1==XMENArray.size()){
        nextImage.setVisibility(View.INVISIBLE);
    }else {
        nextImage.setVisibility(View.VISIBLE);
    }
    return "عکس "+" "+Integer.toString(i+1)+" "+"از"+" "+Integer.toString(XMENArray.size());
}

}
RecyclerAdaptor
public class RVAdapter_item extends RecyclerView.Adapter<RVAdapter_item.QoranViewHolder> {
private SpringyAdapterAnimator mAnimator;
 class QoranViewHolder extends RecyclerView.ViewHolder {
    QoranViewHolder(final View itemView) {

        super(itemView);
        final Context context;

    }
}

List<Data> qoranList;

public RVAdapter_item(List<Data> qoren){
    this.qoranList = qoren;
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
    super.onAttachedToRecyclerView(recyclerView);
    mAnimator = new SpringyAdapterAnimator(recyclerView);
    mAnimator.setSpringAnimationType(SpringyAdapterAnimationType.SCALE);
    mAnimator.addConfig(85,15);
}
@Override
public QoranViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_info, viewGroup, false);
   QoranViewHolder pvh = new QoranViewHolder(v);
    mAnimator.onSpringItemCreate(v);
    return pvh;
}
@Override
public void onBindViewHolder(QoranViewHolder personViewHolder, int i) {
    mAnimator.onSpringItemBind(personViewHolder.itemView, i);
}
@Override
public int getItemCount() {
    return  qoranList.size();
}

}
ViewPager Activity
public class ShowInfoViewPager extends AppCompatActivity {

List<Fragment> fragments = new ArrayList<>();
ArrayList<Data> list;
int num = 0;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_showinfo_viewpager);
    list = MainActivity.initializeData();
    for (int i=0;i<list.size();i++) {
        Bundle bundle = new Bundle();
        bundle.putString("title", list.get(i).category_title);
        ShowInfo firstFragment = new ShowInfo();
        firstFragment.setArguments(bundle);
        fragments.add(firstFragment);
    }
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    ZoomOutTransformation zoomOutTransformation = new ZoomOutTransformation();
    pager.setPageTransformer(true, zoomOutTransformation);
    final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(adapter);
}

private class MyPagerAdapter extends FragmentPagerAdapter {

    public MyPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int pos) {
        return fragments.get(pos);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}

}

A:
move below lines code to "onResume:" method of the fragment.

RVAdapter_item rvAdapter = new RVAdapter_item(initializeData());
rv.setAdapter(rvAdapter);
RVAdapter1_item rvAdapter1 = new RVAdapter1_item(initializeData());
rv1.setAdapter(rvAdapter1);
imageStatus.setText(getTextString(0));
rvAdapter.notifyDataSetChanged();
rvAdapter1.notifyDataSetChanged();


text:
Q: Replace same multiple chars with one char How can i replace multiple chars with one desired char using regex?
Example : "----" to be "-" , "////" to be "/" and so on .

A: Try this:
Regex reg = new Regex(@"(-){2,}");
string s = reg.Replace("-----regex----is---cool", "$1");//=> -regex-is-cool

A: var currentUrl =  currentUrl.Trim() ;
    currentUrl = Regex.Replace(currentUrl, @"[/\x2D/]{2,}", "-");

where 2D is the hexa for "-" char .
Here i replace two or more "-" with one "-" .
You can do this for every pattern .
Convert in hexa here : http://www.string-functions.com/string-hex.aspx


text:
Q: How to create helper in codeigniter? I just created file /CodeIgniter/application/helpers/ajax_helper.php and now want to use it's functions in CodeIgniter/application/controllers/Ajax.php so i use:
function __construct(){
    parent::__construct();
    if((bool)$this->session->userdata('logged_in'))
        $this->load->helper('ajax');
    else
        return FALSE;
}

But error occurred:

Unable to load the requested file: helpers/ajax_helper.php

What is wrong?

A: You can only use "MY_" prefix when CodeIgniter has built-in same-name helper (ajax_helper).
Please change the file name "my_ajax_helper.php" into "ajax_helper.php" and use $this->load->helper('ajax');
The "MY_" prefix is only use to extend CI's built-in core helper (same rule on controller, model, etc.),
for example, you can extend url_helper with my_url_helper, and load it by $this->load->helper('url');, not 'my_url', but you cannot create you own helper with this prefix.
Update:
Oops, sorry I found my answer maybe is wrong, CI could load custom helper with 'my_ajax' in my test. Maybe another probably reason is the file / folder permission?
Update: I checked CI's code and found it only output this message when file_exists() is return false, it means helper file not exists. So problem maybe cause by the file name, path, or letter case of ajax_helper.php.

A: The helper "ajax" doesn't exist in system of codeigniter, so first you can rename your filename like ajax_helper.php, second use :
 function __construct(){
parent::__construct();
if((bool)$this->session->userdata('logged_in'))
    $this->load->helper('ajax_helper');

else
    return FALSE;
}


text:
Q: Power BI Visual Level Filter Skewing Measure In my current data model, I am training to avoid using bidirectional relationships if at all possible.
In order for my lookup tables to interact and filter each other, I have been using a KPI as a visual level indicator.
Basically if this KPI is greater than 0, it means that data exists.
This has worked perfectly on slicers, but on other visualizations it still shows all possible fields unless I manually select the items in the slicers.
The problem I am running into is that I have a function that gives a daily average workload based on planned working days. These are indicated by a '1' on the Date table.
While normally this works fine, when using a KPI for a visual level filter it is also impacting another measure that is using the dates from my calendar table.
In particular on drill down is where I am getting stuck.
Avg. Daily Workday Runtime =
DIVIDE(
    SUMX(
        efficiency_records,
        efficiency_records[Runtime] * related('Calendar'[Binary Working Days])
    ),
    CALCULATE(
        sum('Calendar'[Binary Working Days])
    )
) / 60

The above measure takes the number of days that qualify as planned working days (1 or 0 column next to date) to give the average runtime per planned workday.
The issue is that if I add a filter to only show items that have records, this measure then only looks at the days the specific machine ran, rather than all days in the selected time period.
Adding an allexcept('Calendar', 'Calendar['Date']) seemed to work at first, but if I drilldown on a part or machine then the date table is still getting filtered. As a result, while the true number of working days in the selected range is '11' let's say, it ends up as '2' for a selected machine because it only ran for 2 days.
I feel like there has to be some combination of filters to get around this, but have had a hard time finding the right combination.
Any advice would be appreciated.

A: Problem was that I had a secondary measure based on a different table that was showing regardless of what was happening. By applying the filter to that measure instead of the visual itself everything works as intended.


text:
Q: Filter query through an ID to another table in Django Let's say I have this query
Table 1
cardId = 1
table_1 = card_tbl.ocabjects.get(id=cardId).values('category1_id')

and the Output for this is Table 1 is <QuerySet [{'category1_id': 1}]>
Next is I want to match the value of table 1 to table 2
Table 2 but it returns an error
table_2 = category1_tbl.objects.filter(Q(id=table_1))
print(table_2.name)

The table 2 contains column which is a name and I want just to get result name through matching ID from different table for example name jason The table_2 have a column name
Need help

A: I cant get your exact point but if you want to filter from table 2 according to the ids of table 1.
can do this
 table_2 = category1_tbl.objects.filter(id=table_1.category1_id))
    print(table_2.first().name)


text:
Q: How to execute second dispatch_async when previous first dispatch_async is finished? I would like to add a dispatch_async sequentially but I would like them not to be launched randomly.
I would like for example :
dispatch_async 1 begins...
dispatch_async 1 ends.
dispatch_async 2 begins...
dispatch_async 2 ends.
dispatch_async 3 begins...
dispatch_async 3 ends.
I need to update a sqlite, and the informations in the first dispatch are necessary for the second dispatch...
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"%@",[connection currentRequest]);

    NSLog(@"connectionDidFinishLoading");
    NSError* error;
    NSString *responseKey = [self getResponseKey:connection];

    NSDictionary* response = [NSJSONSerialization JSONObjectWithData:[receivedData objectForKey:responseKey] options:kNilOptions error:&error];
    //NSLog(@"%@", response);

    if (error)
    {
        NSLog(@"Error: %@", error);
        NSLog(@"Error: Response strange format, not an NSArray and not a NSString!\n%@", [[NSString alloc] initWithData:[receivedData objectForKey:responseKey] encoding:NSUTF8StringEncoding]);
    }

    NSLog(@"connection url : %@", connection.currentRequest.URL);

    if ([[NSString stringWithFormat:@"%@", [connection currentRequest]] rangeOfString:@"getSynchroGuest?"].location != NSNotFound)
    {
        NSLog(@"response success");
        if ([[response valueForKey:@"lignes"] isKindOfClass:[NSArray class]])
        {
            if ([[response valueForKey:@"lignes"] count] > 0)
            {
                dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
                    //Background Thread

                [self fillDataBaseWithDict:response];

                nbTotal = nbTotal + PACKET_FOR_SYNC;

                [self WebServiceSynchroGuest:self.activityIndicator withSynchroBtn:synchroBtn withNbTotal:nbTotal];
                                 });

            }
        }
...

Thanks in advance.
SOLUTION:
                dispatch_async(serialDispatchQueue, ^{
                    [self fillDataBaseWithDict:response];
                    nbTotal = nbTotal + PACKET_FOR_SYNC;

                    dispatch_async(dispatch_get_main_queue(), ^(void){
                    [self WebServiceSynchroGuest:self.activityIndicator withSynchroBtn:synchroBtn withNbTotal:nbTotal];
                    });
                });

A: define your own serial queue
and add code like this
 dispatch_queue_t yourSerialQueue = dispatch_queue_create("com.testcompany.testproduct.testserialqueue", DISPATCH_QUEUE_SERIAL);
 dispatch_async(yourSerialQueue, ^{ /* first task */ });
 dispatch_async(yourSerialQueue, ^{ /* second task to be executed after first task */ });

serial queue guarantees that the tasks will be exevuted in the order they are submitted and in a serial manner(one at a time)

A: To take your Q literally, you have to nest the calls:
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^(void)
{
  // do some work
  …
  // finished here

  // The next async code
  dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
  ^(void)
  {
    // do some work
    …
    // finished here

    // and so on

  }

}

But you should really consider to use a custom serial queue or NSOperation et al.
With a serial Q:
dispatch_queue_t stepByStepQueue = dispatch_queue_create("com.you.taks", NULL);

dispatch_async(stepByStepQueue,
^(void)
{
  // Step
});

dispatch_async(stepByStepQueue,
^(void)
{
  // By
});

dispatch_async(stepByStepQueue,
^(void)
{
  // Step
});

A: You can put all dispatch_async as a Serial Queue and execute one by one
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {

    // block1
    NSLog(@"Block1");
    [ NSThread sleepForTimeInterval:5.0];
    NSLog(@"Block1 End");

});

dispatch_group_async(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {
            // block2
    NSLog(@"block 2");
    [ NSThread sleepForTimeInterval:10.0];
    NSLog(@"Block2 End");

});
dispatch_group_async(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {

    // block3
    NSLog(@"block 3");
    [ NSThread sleepForTimeInterval:15.0];
    NSLog(@"Block3 End");
});
dispatch_group_notify(group,dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^ {

    // block4
    NSLog(@"block 4");
    [ NSThread sleepForTimeInterval:20.0];
    NSLog(@"Block4 End");
});

A: Best approach would be to use NSOperations & add them in queue.so it would be called in sequence of completion
But if you want to do it in same way then define completion blocks & add your dispatch_async2 & dispatch_Async3 in completion blocks & call those completion blocks in end.
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

            // do some long running processing here

            // Check that there was not a nil handler passed.
            if( completionHandler1 )
            {
               completionHandler1();
            }
            });
        });

A: add code like this
You can set PRIORITY as well.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

});
});

A: What you want is easily achieved with Operation instead of GCD. Operation class has addDependency(_ op: Operation) function. Put your code in BlockOperation instances, add dependencies and run them in OperationQueue


text:
Q: FragmentStatePagerAdapter getItem not called I'm trying to show some fragments in a viewpager.
I start the PlanFragment from a NavigationDrawer using
FragmentTransaction transaction = appCompatActivity.getFragmentManager().beginTransaction();
transaction.replace(R.id.activity_main_frame, navItem.getFragment()).commit();

At the first time everything works fine, but if I select another fragment from the NavigationDrawer and go back to the PlanFragment afterwards the viewpager shows no content (the tabs are visible). If you try to switch the tab the
behavior of the tabs becomes crazy so that the indicationbar stops in the mid and it is very sluggish (the indicationbar isn't jumping to the next tab entry as normal)
I found out that the getItem() method in FragmentStatePagerAdapter isn't called on the second time.
I already tried to use getChildFragmentManager(), but this didn't work. I also uses API Level 16, so this isn't possible to use.
I'm using android.support.v13 for the Fragment Support.
public class PlanFragment extends Fragment {

    Toolbar toolbar;
    ViewPager viewPager;
    PagerAdapter adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_vplan, container, false);

        ((AppCompatActivity) getActivity()).getSupportActionBar().setElevation(0);

        viewPager = (ViewPager) view.findViewById(R.id.viewpager);

        TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tabs);

        tabLayout.removeAllTabs();
        tabLayout.addTab(tabLayout.newTab().setText("MONDAY"));
        tabLayout.addTab(tabLayout.newTab().setText("TUESDAY"));
        adapter = new PagerAdapter(getFragmentManager(), tabLayout.getTabCount());

        viewPager.setAdapter(adapter);

        viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));

        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });

        return view;
    }

    public class PagerAdapter extends FragmentStatePagerAdapter {
        int tabCount;

        public PagerAdapter(FragmentManager fm, int tabcount) {
            super(fm);
            this.tabCount = tabcount;
        }

        @Override
        public Fragment getItem(int position) {
            Log.i("ERROR", "YO");
            return new TestFragment();
        }

        @Override
        public int getCount() {
            return tabCount;
        }
    }
}

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_gravity="bottom">
        </android.support.design.widget.TabLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

The fragment showing in the viewpager
public class TestFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_test, container, false);

        return view;
    }

}

TestFragment XML:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Nulla quis lorem ut libero malesuada feugiat. Pellentesque in ipsum id orci porta dapibus. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Vivamus suscipit tortor eget felis porttitor volutpat." />
    </android.support.v4.widget.NestedScrollView>

A: You need a setOffScreenPageLimit somewhere so that the other pages are available.  The default is 1 so nothing available when you swipe.


text:
Q: How can I place a text in tabBar and how can I know in which scene am I in storyboard, Corona SDK I am using Corona SDK and I am facing a problem. In my Tab Bar Application, I need to know in which scene I am in order to change my text's text to the number of the scene. For example, if I am at "scene 1" I want my text's text to be "1", else if I am at "scene 2" I want my text's text to be "2".I aslo need to place my text in the tabBar.
I am thinking of doing somthing like
 local sceneName = (my scene's name)

 If sceneName == "Scene 1" then
     myText.text = "Scene 1"
 else if sceneName == "Scene 2" then
     myText.text = "Scene 2

So how can I place my text in the tabBar and how can I know my Scene's name?
Also how can I name a scene and how do I use it in the code?

A: Use storyboard.getCurrentSceneName() to get the name of the current scene. The name of the scene is the name of the lua file (without the .lua extension) that contains the scene code, i.e. the same name you use in storyboard.gotoScene("mySceneName").
If you want to have a scene where the name is not related to the lua file I think you have to use storyboard.newScene("sceneName") to create a new scene.


text:
Q: How to install ruby-oci8? I'm trying to install ruby-oci8 on OS X.
I've tried installing both with and without sudo.
Error Message without sudo:
gem install ruby-oci8
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

Error Message with sudo:
sudo gem install ruby-oci8
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-oci8:
    ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for load library path...
  DYLD_LIBRARY_PATH is not set.
checking for cc... ok
checking for gcc... yes
checking for LP64... yes
checking for sys/types.h... yes
checking for ruby header... ok
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    --with-instant-client
    --without-instant-client
./oraconf.rb:887:in `get_home': RuntimeError (RuntimeError)
    from ./oraconf.rb:703:in `initialize'
    from ./oraconf.rb:319:in `new'
    from ./oraconf.rb:319:in `get'
    from extconf.rb:18

Error Message:
Set the environment variable ORACLE_HOME if Oracle Full Client.
Append the path of Oracle client libraries to DYLD_LIBRARY_PATH if Oracle Instant Client.

The 'sudo' command unset some environment variables for security reasons.
Pass required varialbes as follows
     sudo env DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH /usr/bin/gem install ruby-oci8
  or
     sudo env ORACLE_HOME=$ORACLE_HOME /usr/bin/gem install ruby-oci8

Backtrace:
  ./oraconf.rb:887:in `get_home'
  ./oraconf.rb:703:in `initialize'
  ./oraconf.rb:319:in `new'
  ./oraconf.rb:319:in `get'
  extconf.rb:18

See:
 * http://ruby-oci8.rubyforge.org/en/HowToInstall.html
 * http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html

A: For anyone attempting to get this to work in the good old year of 2016, the error message now contains a link to the page http://www.rubydoc.info/github/kubo/ruby-oci8/file/docs/install-on-osx.md that gives you instructions for how to do it using Homebrew. None of the above stuff worked for me (and I tried it all), but then I took this problem to a coworker and they said, "Hey, did you try that link in the error message there?" Sure enough, that did it.

A: Slightly updated version of install of ruby-oci8 for 10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan - step-by-step:

*

*Go here: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html

*Download the 64bit versions of instantclient-sqlplus, instantclient-sdk, instantclient-basic - the 32bit versions do not work with OSX 10.9

*Create directories at /opt/oracle

*Unzip instantclient-basic first, move to /opt/oracle (should add a folder - something like /opt/oracle/instantclient_11_2/)

*Unzip instantclient-sdk and move its contents to /opt/oracle/instantclient_11_2/

*Unzip instantclient-sqlplus and move its contents /opt/oracle/instantclient_11_2/

*Open Terminal (if you haven't already) and type...

*DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH

*ORACLE_HOME=/opt/oracle/instantclient_11_2 export ORACLE_HOME

*cd /opt/oracle/instantclient_11_2

*ln -s libclntsh.dylib.11.1 libclntsh.dylib (creates a symbolic link)

*env

*verify that DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2  (be sure there's no trailing / after instantclient_11_2)

*verify ORACLE_HOME=/opt/oracle/instantclient_11_2

*gem install ruby-oci8

Should work after that. The file structure should look similar to this:

A: On OS X Sierra, I was unable to set DYLD_LIBRARY_PATH due to system integrity protection (https://forums.developer.apple.com/thread/13161), so I copied all oracle's instant client files to /users/.../lib, since it has a fallback to some directories including this one:
...
checking the default value of DYLD_FALLBACK_LIBRARY_PATH...
checking /Users/<username>/lib... no
checking /usr/local/lib... no
checking /lib... no
checking /usr/lib... no
...

And the gem installed successfully!
cp -R /opt/oracle/instantclient_11_2/* /users/..username../lib
gem install ruby-oci8

Building native extensions.  This could take a while...
Successfully installed ruby-oci8-2.2.2
1 gem installed

A: In case anyone else needs to install a legacy version of ruby-oci8 on Ruby 1.8.7 on mac osx el capitan, I had success installing ruby-oci8-2.1.2 using the following method. I think it will also work on other ruby-1.8.7 versions as well (ruby-oci8 < 2.2.0) but I haven't checked other versions:

*

*Go here: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
Download the 64bit versions of instantclient-basic, instantclient-sdk, instantclient-sqlplus (I'm using the -macos.x64-11.2.0.4.0 versions)

*Copy the zip files to /opt/oracle and unzip each of them. It should extract them to /opt/oracle/instantclient_11_2

*cd /opt/oracle/instantclient_11_2

*ln -s libclntsh.dylib.11.1 libclntsh.dylib

*curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb

*Be sure to append the -a flag when running the script, this will make the script fix the libs using an absolute path rather than an @rpath/*.dylib path which ends up choking the gem build process. (read the fix_oralib.rb script first if you want to check). Anyways, run: ruby fix_oralib.rb -a

*export OCI_DIR=/opt/oracle/instantclient_11_2

*Now grab the ruby-oci8 source git clone https://github.com/kubo/ruby-oci8.git

*Checkout the version you want to install (I needed 2.1.2) git checkout ruby-oci8-2.1.2

*Edit this file: ruby-oci8/ext/oci8/oraconf.rb and change this line:

when /darwin/
  @@ld_envs = %w[DYLD_LIBRARY_PATH]
  so_ext = 'dylib'
To this:
when /darwin/
   @@ld_envs = %w[DYLD_LIBRARY_PATH OCI_DIR]
   so_ext = 'dylib'

*Now change back into the root directory of the gem itself and build the gemspec: gem build ruby-oci8.gemspec

*2potatocakes$ gem install ruby-oci8-2.1.2.gem
Building native extensions.  This could take a while...
Successfully installed ruby-oci8-2.1.2
1 gem installed

A: If you are using MAC with El Capitan, the DYLD_* environment variables are ignored,due the latest embedded feature of System Integrity Protection (SIP).
SO if you wants to install ruby-oci8 with El Capitan, first you have to disable SIP.
Follow these steps to disable SIP:

*

*Restart your Mac.

*Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots you into Recovery.

*From the Utilities menu, select Terminal.

*At the prompt type exactly the following and then press Return: csrutil disable

*Terminal should display a message that SIP was disabled.

*From the  menu, select Restart.

If you still facing problem try this link
http://blog.codiez.co.za/2013/09/setup-oracle-instant-client-ruby-oci8-gem-mac/

A: The error message is somewhat verbose, but it basically says that you need to install the Oracle Client libraries and point the DYLD_LIBRARY_PATH variable to that location.

A: Begin by downloading oracle instantclient version 11.2 for 32 bit Linux from their website. Version 12 or later will not work with some databases (I always grabbed the .zip versions, so that's what the guide assumes. It also assumes the downloaded files are in the /tmp folder.). You will need the basic version, sqlplus, and sdk. Once those downloads are completed, execute the following commands in the terminal
sudo mkdir -p /opt/oracle
sudo cd /opt/oracle
sudo unzip /tmp/instantclient-basic-linux-11.2.0.4.0.zip
sudo unzip /tmp/instantclient-sqlplus-linux-11.2.0.4.0.zip
sudo unzip /tmp/instantclient-sdk-linux-11.2.0.4.0.zip
sudo apt-get install libaio1
sudo cd instantclient_11_2
sudo ln -s libclntsh.so.11.2 libclntsh.so

-Now, we'll need to tell our bash shell where the oracle client is located. So allow yourself to see hidden files, and open up $home/.bashrc with a text editor. Add the following line to the bottom of the file and then save it:
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2

-Now source .bashrc to load the new settings with this command in the terminal:
source ~/.bashrc

-Now if we did everything correctly, we should be able to install the oracle database adapter gem. Try it with this command:
gem install ruby-oci8 -v '2.1.5'

A: This looked painful. I think I may have found a better way to resolve this (on Mac OS, at least).
Just run the following brew commands:
brew tap InstantClientTap/instantclient
brew install instantclient-basic
brew install instantclient-sqlplus
brew install instantclient-sdk

A: For some reason ruby-oci8 was not getting installed with instant client_11_2 for me. I tried all the answers suggested here and other places but couldnt get it done. Later I tried with instant client 12_1 and it worked without any issues.

A: updated version of install of ruby-oci8 for CENTOS7
cd /etc/yum.repos.d
sudo wget http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7
sudo rpm --import RPM-GPG-KEY-oracle-ol7
sudo yum-config-manager --enable ol7_oracle_instantclient
sudo yum install oracle-instantclient18.3-basic
sudo yum install oracle-instantclient18.3-devel
sudo yum install oracle-instantclient18.3-jdbc
sudo yum install oracle-instantclient18.3-sqlplus
export ORACLE_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
gem install ruby-oci8 -v '2.2.7'

A: For those using zsh rather than bash still follow Etusm's answer however, on steps 8 and 9 replace with
8. export DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2
9. export ORACLE_HOME=/opt/oracle/instantclient_11_2

A: If you are using OS X El Capitan, Yosemite and Mavericks. You should use Instant Client 12.1.0.2
Download Instant Client 12.1.0.2 from oracle website

*

*instantclient-basic-macos.x64-12.1.0.2.0.zip

*instantclient-sqlplus-macos.x64-12.1.0.2.0.zip

*instantclient-sdk-macos.x64-12.1.0.2.0.zip

Then follow these steps :-

*

*Create directories at /opt/oracle

*Unzip instantclient-basic first, move to /opt/oracle (should add a folder -
something like /opt/oracle/instantclient_12_1/)

*Unzip instantclient-sdk and move its contents to
/opt/oracle/instantclient_12_1/

*Unzip instantclient-sqlplus and move its contents
/opt/oracle/instantclient_12_1/

*Open Terminal (if you haven't already) and type...

DYLD_LIBRARY_PATH=/opt/oracle/instantclient_12_1 export
  DYLD_LIBRARY_PATH
      ORACLE_HOME=/opt/oracle/instantclient_12_1 export ORACLE_HOME

*cd /opt/oracle/instantclient_12_1

ln -s libclntsh.dylib.12.1 libclntsh.dylib (creates a symbolic link)
ln -s libocci.dylib.12.1 libocci.dylib

*run: env

*verify that DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 (be sure there's
no trailing / after instantclient_11_2)
verify ORACLE_HOME=/opt/oracle/instantclient_11_2

*gem install ruby-oci8 -v gemVersion
Note:-  If this still didn't work fro you try disabling SIP on your mac
            then try it again.
It has worked for me hope it works for you too. All the best


text:
Q: Not able to perform selection of cells in unifrom grid I am working on an application where i am displaying images in a matrix (Uniform grid). I wanted to focus and images when i move my cursor on it and select images on mouse click.
XAML:
<ItemsControl Name="UniformGrid" ItemsSource="{Binding ImageList1}" >
                <ItemsControl .ItemsPanel>
                    <ItemsPanelTemplate>

                                <UniformGrid Rows="3" Columns="3" Width="800" Height="500"/>

                        </ItemsPanelTemplate>
                </ItemsControl .ItemsPanel>

                <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Vertical" Margin="0.5">

                                <Image Source="{Binding Path}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="UniformToFill" />

                                <!--<TextBlock Background="DimGray"  Margin="0,2,0,0" Foreground="White" Height="16" TextAlignment="Center" VerticalAlignment="Bottom">
                                    <TextBlock.Text>
                                        <MultiBinding StringFormat="{}{0}x{1}">
                                            <Binding Path="Height"/>
                                            <Binding Path="Width"/>
                                        </MultiBinding>
                                    </TextBlock.Text>
                                </TextBlock>-->
                              <TextBlock Background="Black" Foreground="White" Height="18" TextAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,4">
                                <TextBlock Name="ImageName" Margin="0,0,0,1" Foreground="Red" FontWeight="Bold"  Text="{Binding FileName}"/>
                                <TextBlock Name="ImageType" Margin="0,0,0,2" Foreground="LightGoldenrodYellow" FontSize="11">
                                    <TextBlock.Text>
                                        <MultiBinding StringFormat="Type: {0}">
                                            <Binding Path="Extension" />
                                        </MultiBinding>
                                    </TextBlock.Text>
                                </TextBlock>
                                <TextBlock Name="ImageSize" Margin="0,0,0,3" Foreground="Violet">
                                    <TextBlock.Text>
                                        <MultiBinding StringFormat="Size: {0} Bytes">
                                            <Binding Path="Size"/>
                                        </MultiBinding>
                                    </TextBlock.Text>
                                </TextBlock>
                              </TextBlock>
                            </StackPanel>
                        </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl >

Code Behind:
int index = 1;
 UniformGrid.SelectedItem = UniformGrid.Items[index];
            UniformGrid.ScrollIntoView(UniformGrid.Items[index]);

I want to select the images when i move mouse over them and button down.
But i have error saying SelectedItem does not exist in this context.

A: ItemsControl doesn't handle selection and does not have SelectedItem property. Instead you can use ListBox with ItemsPanel as UniformGrid, then you will get the SelectedItem of ListBox.
<ListBox Name="UniformGrid" ItemsSource="{Binding ImageList1}" SelectedItem="{Binding SelectedImage}">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <UniformGrid Rows="3" Columns="3" Width="800" Height="500"/>
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        <DataTemplate>
            ..
        </DataTemplate>
    </ListBox.ItemTemplate>
    ..
</ListBox>


text:
Q: Scan for Wifi networks on iPhone SDK I'm looking for the API to search for networks on the iPhone/iPad, and get data from them.
A private API is also OK, the app's for cydia.
I know it is possible, because I saw some wardriving apps (in the store). I want that functionality in my app too.
Could you please help me out?
Thanks,
Yvan

A: Have a look at redpin.org . Especially have a look to their class Sniffer.m
It is exactly what you need!


text:
Q: Storing Firehose transfered files in S3 under custom directory names We primarily do bulk transfer of incoming click stream data through Kinesis Firehose service. Our system is a multi tenant SaaS platform. The incoming click stream data are stored S3 through Firehose. By default, all the files are stored under directories named per given date-format. I would like to specify the directory path for the data files in Firehose planel \ through API in order to segregate the customer data.
For example, the directory structure that I would like to have in S3 for customers A, B and C :

/A/2017/10/12/
/B/2017/10/12/
/C/2017/10/12/

How can I do it?

A: AWS Firehose supports the dynamic partitioning .
It can be done in two ways either with inline JQ parser or lambda function.
Example:
"ExtendedS3DestinationConfiguration": {
"BucketARN": "arn:aws:s3:::my-logs-prod",
"Prefix": "customer_id=!{partitionKeyFromQuery:customer_id}/
    device=!{partitionKeyFromQuery:device}/
    year=!{partitionKeyFromQuery:year}/
    month=!{partitionKeyFromQuery:month}/
    day=!{partitionKeyFromQuery:day}/
    hour=!{partitionKeyFromQuery:hour}/"
}

A: You can separate your directories by configuring the S3 Prefix. In the console, this is done during setup when you set the S3 bucket name.
Using the CPI, you set the prefix in the --s3-destination-configuration as shown here:
http://docs.aws.amazon.com/cli/latest/reference/firehose/create-delivery-stream.html
Note however, you can only set one prefix per Firehose Delivery Stream, so if you're passing all of your clickstream data through one Firehose Delivery Stream you will not be able to send the records to different prefixes.

A: Custom prefixes are now supported.


text: Q: Can one use 5A transistor for motor driver of BLDC motor 920kv? I am designing an esc for 920kv motors. For Code testing purposes on microcontroller, I want to make a low speed circuit but only have TIP122 (5A transistor) available in hand. Can they handle ESC control of EMAX 920kv. I will be using 3s battery to power the motor.


text:
Q: Autcomplete Jquery UI doesnt work at first enter I've got an issue that drive me crazy, I'm not a pro in javascript and I'm sure, the answer is easy.
I use the jquery ui aucomplete and I use data got from Ajax.
I have the result I want only when I delete, the word and retype it.
There is some screens and my code for help :)

var noms = new Array();

function pushNoms(nom) {
    noms.push(nom);
    console.log(noms);
}

function ajaxRequest() {
    var $search = $('#searchListDossier');
    var request = '?objet=dossier&action=autoComplete&search=' + $search.val();
    var xhr = new XMLHttpRequest();
    xhr.open('GET', request);
    xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
    xhr.responseType = 'json';
    xhr.addEventListener('load', function() {
        //crea tableau
        for (var i = 0; i < this.response.length; i++) {
            pushNoms(this.response[i].nom);
        }
    });
    xhr.send();
}
$('#searchListDossier').donetyping(function() {
    ajaxRequest();
    console.log(noms);
    $('#searchListDossier').autocomplete({
        source: noms
    });
});

A: Problem solved, I used the jquery function : getJson who did the job instead of my own javascript ajax function.
Thanks for helping :)


text:
Q: Detect Administrator account DelphiXe, Win7x64
How to define, that the user started the program starts it on behalf of system record of the Administrator of system (domain or local). The rights I define so:
Function IsUserAdmin:Bool;
Const
  SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority =(Value: (0, 0, 0, 0, 0, 5));
  SECURITY_BUILTIN_DOMAIN_RID = $00000020;
  DOMAIN_ALIAS_RID_ADMINS = $00000220;
Var
  hAccessToken: THandle;
  ptgGroups: PTokenGroups;
  dwInfoBufferSize: DWORD;
  psidAdministrators: PSID;
  x: Integer;
  bSuccess: BOOL;
begin
  Result := False;
  bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken);
  if not bSuccess then
  begin
    if GetLastError = ERROR_NO_TOKEN then
      bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hAccessToken);
  end;

  if bSuccess then
  begin
    GetMem(ptgGroups, 1024);
    bSuccess := GetTokenInformation(hAccessToken, TokenGroups, ptgGroups,
                                    1024, dwInfoBufferSize);
    CloseHandle(hAccessToken);
    if bSuccess then
    begin
      AllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2,
                               SECURITY_BUILTIN_DOMAIN_RID,
                               DOMAIN_ALIAS_RID_ADMINS,
                               0, 0, 0, 0, 0, 0, psidAdministrators);
      {$R-}
      for x := 0 to ptgGroups.GroupCount-1 do
        if EqualSid(psidAdministrators, ptgGroups.Groups[x].Sid) then
        begin
          Result := True;
          Break;
        end;
      {$R+}
      FreeSid(psidAdministrators);
    end;
    FreeMem(ptgGroups);
  end;
end;

But it only defines an accessory of the user to group of administrators. How to define, what exactly from under the accounting record "Administrator" goes start (taking into account what the record name can be changed (the account is renamed, example "Admin")?
P.S. It is all to that if the user starting the application is in group administrator at inclusion Windows UAC at it start on behalf of the Administrator will be all the same requested.
So it is necessary for me:

*

*To learn, that the user which starts the program is in group of
managers (local or domain) is as works

*Start is made on behalf of the system accounting record the "Administrator" (can and renamed), instead of the created new user with the rights of the administrator

[UPDATE]
Once again, in another way. We will admit, in system there are some accounts: Administrator (a system account of the administrator by default), User1 (consists in group "Administrators", the new created account), User2 (consists in group "Users", the new created account). For any reasons, system account "Administrator" is renamed in "Admin" (or into any other name). There is my application. It is started by different users. As to me to establish, that the user who starts my application, is the administrator of system (Admin). Because for Windows UAC the rights for start from User1 and Admin will differ - also question UAC will appear only if the application starts User1, and if Admin - message UAC will not appear. Here a question: how to define, what the user who has started the application = Admin (old name Administrator), in other words the user and is the administrator of system?
Need:
Function GetCurrentUserName:string;
begin
... detect current user name
end;

Function isCurrentUserisAdministratorPC:bool;
begin
// ??? Result:=isUserPCAdmin(GetCurrentUserName);
end;

// uses
User1 start program: isCurrentUserisAdministratorPC return False;
User2 start program: isCurrentUserisAdministratorPC return False;
Admin start program: isCurrentUserisAdministratorPC return TRUE; //!!!
rename account Admin to Test123.
Test123 start program: isCurrentUserisAdministratorPC return TRUE; //!!!

A: That code checks if the user is a member of the Administrators group. Someone can be a member of the Administrators group, but not have any administrator privelages.
You want to know if the user actually has administrator privelages. i answered this already here.

A: Has found. By means of NetUserEnum (http://msdn.microsoft.com/en-us/library/aa370652(VS.85).aspx) at level=1 at the built in record the flag 66049 (or 66051 if it is disconnected) will come back.

Ian Boyd:
    That code checks if the user is a member of the Administrators group. Someone can be a member of the Administrators group, but not have any administrator privelages.

If it is included Windows UAC that members of group of Admins for reception of the rights at first should confirm it in an emerging window of the message from UAC (it is by default included in local and group politicians Windows). Local record of the Administrator of the personal computer - does not require such actions.
And yes, it's also detected "IsUserAnAdmin" function.
if IsUserAnAdmin then Showmessage('Admin') else Showmessage('Not Admin, or UAC enabled');


text:
Q: wxPython: Load font from file I'm making a wxPython app, and I want to use some non-standard font that I have on file. How do I do this?

A: The Win32 API you need is called AddFontResource (you'll also want to use RemoveFontResource when you're done with a font).  I haven't been able to find a python wrapper for this function, so you'll need to use ctypes or equivalent to access the API directly.  Once the font has been added, it should be accessible in the usual way (note that it will be accessible to all applications).
There's an SO thread that suggests using a FreeType library wrapper (ft2) but this seems like overkill (unless you have some other need for it) and the wrapper is marked as beta.


text:
Q: Resize flex items to fit parent I am trying to create a two-column layout with flex parent height: 100vh. The first column is a div with some heading and a paragraph and the second column has a div with an image. I want flex parent height to be 100vh on all viewports and the image to shrink to fit in the container.
However, the image overflows the container and doesn't shrink. This is what I am trying to achieve:

Here's my code:

.section {
  width: 100vw;
  height: 100vh
  background-color: blue;
}

.container {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
}

.wrapper {
  width: 100%;
  max-height: 100%
}

img {
  width: 100%
  height: 100%;
  object-fit: contain;
}

Some heading

Lorem ipsum dolor sit amet

A: You have to need to add style to organize layouts

<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" rel="stylesheet" />

Feature Two

Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.

Learn More

Heading

A: If I understand the problem correctly, you want the header and content section and the image to spread evenly when the viewport is full size but when you shrink the viewport the image should move to the next line.
IF yes, then you can do two things to achieve the desired result:

*

*introduce flex-wrap: wrap in your container

*remove the width: 100% from wrapper

The css will look like:
.section {
  width: 100vw;
  height: 100vh;
  background-color: blue;
}

.container {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  flex-wrap: wrap;
}

.wrapper {
  /* width: 100%; */
  max-height: 100%
}

img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}


text:
Q: Spartacus CCV2 How header Sass placeholder is processed Does anyone know how the header component sass placeholder tag is processed in Spartacus?
As in file https://github.com/SAP/cloud-commerce-spartacus-storefront/blob/develop/projects/storefrontstyles/scss/components/layout/header/_header.scss
%header {
  background-color: var(--cx-color-dark);
  color: var(--cx-color-inverse);
  display: block;

It's just a placeholder, but it works like a  header element selector. I couldn't find any extension for this

A: The extension of this placeholder is done dynamically - here in line 42: https://github.com/SAP/cloud-commerce-spartacus-storefront/blob/f3c81d4bb04f8c222fc73d3ca1ea099783e1a82f/projects/storefrontstyles/scss/_components.scss
It's done this way to allow developers to skip the styling of specific components. Here you can read more about this: https://sap.github.io/cloud-commerce-spartacus-storefront-docs/css-architecture/#skipping-specific-component-styles

A: The header placeholder is placed in an array of layout placeholders in the index.scss file for the layout folder.
$layout-components-whitelist: cx-storefront, header, cx-site-context-selector,
  cx-skip-link !default;

This scss array is imported in _component.scss which you can see here _component.scss. This file has a loop that will dynamically extend the placeholders for all of the default Spartacus styles.
@each $selector in $selectors {
  #{$selector} {
    // skip selectors if they're added to the $skipComponentStyles list
    @if (index($skipComponentStyles, $selector) == null) {
      @extend %#{$selector} !optional;
      // optional theme specific placeholder
      @extend %#{$selector}-#{$theme} !optional;
    }
  }
}


text:
Q: How to store entire encrypted response, unencrypt it with POST method and update the response for next rest call using Jmeter
*

*Run Get method to get the data of the policy - response is encrypted.

*Run a Post method to decrypt the response from step 1

*On the response from Step 2 there is the field policyStatus and will be changed to value = 2

*Encrypt the decrypted payload with changes in the policyStatus. I created a regular expression extractor in step 2 to get the response, but the problem is if I directly parameterized it in this step I wont be able to change the value of policyStatus, is there a way to change the value after extracting without posting it so that I can encrypt it and then post it.

I tried the __strReplace() function but this will be possible if the request is step 4 is not parameterized. see below
Actual Body(Parameterized):
{
  "isEncrypt": true,
  "payload": "{${payload}}"
}
Body(Not Parameterized):
{
  "isEncrypt": true,
  "payload": "{\"policyNumber\":\"\",\"policyStatus\":\"1\",\"ownerName\":\"\",\"exchangeRate\":1,\"product\":{\"productName\":\"",\"category\":\"T\",\"shariaIndicator\":\"",\"currency\":\""},\"billings\":[{\"type\":\"",\"amount\":0,\"currency\":\""},{\"type\":\"",\"paidToDate\":\"2019-07-08\",\"mode\":\"",\"amount\":,\"currency\":\"",\"minimumPayment\":,\"outstandingPeriod\":0,\"paymentSuspend\":}]}"
}
the policyStatus is inside the payload field which comes from the response on step 2.
tried the advice from this --> How to store entire response and update it for next rest call using Jmeter
but this applies in the value of the single field.

A: *

*Add JSR223 PostProcessor after the Regular Expression Extractor in step 2

*Put the following code into "Script" area:
vars.put('changedPolicy', vars.get('myVar').replace("\\\"policyStatus\\\":\\\"1\\\"","\\\"policyStatus\\\":\\\"2\\\""))

Replace myVar with your actual JMeter Variable reference name from the Regular Expression Extractor

*That's it, the JSR223 PostProcessor will generate changedPolicy variable with the policyStatus value set to 2
Demo:

vars keyword used in the Groovy script is the shorthand for JMeterVariables class instance, it is used for reading myVar variable value and writing the replacement into changedPolicy variable. See Top 8 JMeter Java Classes You Should Be Using with Groovy to learn more about JMeter API shorthands available for Groovy scripts.


text:
Q: Javascript terminal emulation in windows I am attempting to use Javascript / NodeJS to build a new command line / terminal for personal use but I am running into some issues. I can't not seem to find a decent way of interacting with the windows command line from my own Javascript.
I understand that by default browsers do not allow javascript to interact with system based commands so I was considering using socketIO or something of the sort.
I was planning on using Electron (chromium).
I'm wondering what would be a good direction to pull the windows command line env into my window.
In all honesty, even just taking the existing output from the CMD would be a good enough start.

A: In a Windows console window you can execute a JavaScript script using the command "cscript". It has been a while since I have done that so I was reviewing my previous work.
I know nothing about NodeJS but as I was searching for help to refresh my memory, I found several articles and StackOverflow answers that seem relevant. I hope these help.
Command Line JavaScript
How do I prompt users for input from a command-line script? - docs.nodejitsu.com
How to Read from stdin in JavaScript
node.js - How to read from stdin line by line in Node - Stack Overflow


text:
Q: Storing username that last modified database row via EJB3.0 and JPA I'd like to store username that has last modified table row to as a field in every table.
I have following setup: an user logs in, web layer calls some EJB 3.0 beans. Those EJB beans create and modify some JPA entities.
Now, I'd like that username (from weblayer) would be automatically stored to every JPA entity (and database row) that is created or modified during EJB method call.
I have this kind of table, (that is: every table has field modifier):
CREATE TABLE my_table (
  some_data INTEGER,
  modifier VARCHAR(20)
);

By automatically I mean, that I wouldn't need to set manually username to each entity inside EJB methods.
You could achive this by storing username to ThreadLocal variable and fetching username from ThreadLocal in JPA entity's EntityListener.
However this works only you are using a local EJB call, it will not work with EJB calls  that cross JVM boundaries. I'd like to make this work over remote EJB method calls.
It this possible at all?
I am using Weblogic Server 10.3, EJB3.0 and EclipseLink JPA. I am also interested in hearing if this works with other JPA implementations.

A: You can use an EJB interceptor (@Around) on the EJB class to get the current user (using standard EJB api) and storing the name in the threadlocal variable. This would work transparently for remote and local calls.


text:
Q: getusermedia - Mirror image instead of flip I am using getusermedia to grab an image from a video stream and mirror it like this...
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;

var ctx = canvas.getContext('2d');
ctx.setTransform(1,0,0,-1,0,canvas.height)

ctx.drawImage(video, 0, 0, canvas.width, canvas.height);

dataUrl = canvas.toDataURL('image/jpeg');

But instead of mirroring it, it is flipping it upside down.  Where am I going wrong?

A: The arguments to CanvasContext2d.setTransform are
setTransform(scaleX, skewX, skewY, scaleY, translateX, translateY)

You are setting scaleY to -1 and translating by height on the Y axis. So indeed, you flipped vertically.
To flip horizontally, you'd do
ctx.setTransform(-1,0,0,1,canvas.width,0);

const vid = document.createElement('video');
const ctx = canvas.getContext('2d');
// gUM has problems with StackSnippet's overprotected iframes
// so we'll use a normal video instead
vid.src = 'https://upload.wikimedia.org/wikipedia/commons/transcoded/a/a4/BBH_gravitational_lensing_of_gw150914.webm/BBH_gravitational_lensing_of_gw150914.webm.480p.webm';
vid.play()
  .then(() => {
    canvas.width = vid.videoWidth;
    canvas.height = vid.videoHeight;
    drawloop();
  });

function drawloop() {
  if (inp.checked) {
    ctx.setTransform(-1, 0, 0, 1, canvas.width, 0);
  } else {
    ctx.setTransform(1, 0, 0, 1, 0, 0);
  }
  ctx.drawImage(vid, 0, 0);
  requestAnimationFrame(drawloop);
}
canvas {
  width: 100%;
}
flip horizontally<input type="checkbox" id="inp">

<canvas id="canvas"></canvas>


text:
Q: Return to Fragment A from Fragment B with a value I know there have been many threads about this, but i just cant seem to really understand how to nail it.. What i basically try to do is after button click in Fragment B i want to return to Fragment A together with a id value..

So in my BackStack you go to Fragment A which lead you to Fragment B and when pressing a button i want to go back to Fragment A with a value to show. This is my onClick listener in Fragment B:
//Fragment B which i called from Fragment A
addButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(value.getText().toString().trim().length() != 0) {
                 String order = value.getText().toString(); //The value i want in Fragment B
                 //return to Fragment A
            }
}

In my MainActivity i tread my fragment like this:
//fragmentManager is initialized in onCreate()
...
private void selectItem(int position) {

    Fragment fragment = null;
    String fTag = null;

    switch (position) {
        case 0:
            fragment = new FragmentA();
            fTag = "fragmentA";
            break;
        case 1:
            fragment = new FragmentC();
            fTag = "fragmentC";
            break;
        case 2:
            fragment = new FragmentD();
            fTag = "fragmentD";
            break;

        default:
            break;
    }

    if (fragment != null) {
        if(replaceFragments(fragment, fTag)) {
            mDrawerList.setItemChecked(position, true);
            mDrawerList.setSelection(position);
            setTitle(mNavigationDrawerItemTitles[position]);
            mDrawerLayout.closeDrawer(mDrawerList);
        }
    } else {
        Log.e(LOGTAG, "Error in creating fragment");
    }
}

public boolean replaceFragments(Fragment fragment, String fTag) {
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment, fTag).addToBackStack(fTag).commit();
    return true;
}

@Override
public void onBackPressed() {
    int count = fragmentManager.getBackStackEntryCount();
    if (count == 0) {
        super.onBackPressed();
    } else {
        getSupportFragmentManager().popBackStack();
        //TODO: add app title on count == 1
    }
}

A: Create interface ValueChangeListener.java
public interface ValueChangeListener {

    public void onValueChanged(String value);
}

Pass the value via interface:
public class FragmentB extends Fragment {

    private ValueChangeListener valueChangeListener;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            valueChangeListener = (ValueChangeListener) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString() + " must implement ValueChangeListener");
        }
    }

    //your code
    addButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(value.getText().toString().trim().length() != 0) {
                 String order = value.getText().toString();
                 //now the value is in the Activity and you can pass it anywhere you want from there
                 valueChangeListener.onValueChanged(order);
            }
    }

}

Implement interface to the activity:
public class YourActivity extends FragmentActivity implements ValueChangeListener{

    @Override
    public void onValueChanged(String value) {
    //your value is here
    }
}

A: Your onclick method should look like this:
 @Override
    public void onClick(View view) {
        if(value.getText().toString().trim().length() != 0) {
             String order = value.getText().toString(); //The value i want in Fragment B
             //return to Fragment A

            FragmentA fragment = new FragmentA();
            Bundle args=new Bundle();
            args.putString(order);
           fragment.setArguments(args);
           getFragmentManager().beginTransaction().replace((R.id.content_frame,fragment).commit();

        }

And then from your FragmentA you can recover the value with:
getArguments();


text:
Q: Что это значит 0x01 ? что значит это?
int code = 0;
code|=0x01;

A: с первой строкой проблем не должно быть. А вторая - это просто
code= code | 0x01;

То есть, обычное побитовое или.
0x01 - это такая форма для записи шестнадцатеричных чисел. В данном случае это просто 1. 0xFF - это уже 255.


text:
Q: How to call a module's method within the same module? I created a route :
var connexion = require('./dbMysql');

exports.getPrefixNomTables = function () {
    return "george_";
};

exports.getRegionIdFromLib = function (regionLib, cb) {
    var ret = 0;
    connexion.query("select region_id from george_region where region_libelle = ? limit 1", [regionLib], (err, rows) => {
        if (err) {
            throw err;
        }
        if (rows.length > 0)
            ret = rows[0].region_id;
        cb(ret);
    });
};

In the getRegionIdFromLib function I want to call the getPrefixNomTables method instead of hardcoding george_region. How to do that ?

A: You can just call exports.getPrefixNomTables() inside getRegionIdFromLib:
exports.getRegionIdFromLib = function (regionLib, cb) {

  var region = exports.getPrefixNomTables()

  // ...

};


text:
Q: Modify Struct variable in a Dictionary I have a struct like this:
public struct MapTile
{
    public int bgAnimation;
    public int bgFrame;
}

But when I loop over it with foreach to change animation frame I can't do it...
Here's the code:
foreach (KeyValuePair<string, MapTile> tile in tilesData)
{
        if (tilesData[tile.Key].bgFrame >= tilesData[tile.Key].bgAnimation)
        {
            tilesData[tile.Key].bgFrame = 0;
        }
        else
        {
            tilesData[tile.Key].bgFrame++;
        }
}

It gives me compile arror:
Error 1 Cannot modify the return value of 'System.Collections.Generic.Dictionary<string,Warudo.MapTile>.this[string]' because it is not a variable
Error 2 Cannot modify the return value of 'System.Collections.Generic.Dictionary<string,Warudo.MapTile>.this[string]' because it is not a variable

Why can't I change a value inside a struct which is inside a dictionary?

A: tilesData[tile.Key] is not a storage location (i.e., it's not a variable). It's a copy of the instance of MapTile associated with the key tile.Key in the dictionary tilesData. This is what happens with struct. Copies of their instances get passed around and returned everywhere (and is a large part of why mutable struct are considered evil).
What you need to do is:
    MapTile tile = tilesData[tile.Key];
    if (tile.bgFrame >= tile.bgAnimation)
    {
        tile.bgFrame = 0;
    }
    else
    {
        tile.bgFrame++;
    }
    tilesData[tile.Key] = tile;

A: The indexer will return a copy of the value. Making a change to that copy won't do anything to the value within the dictionary... the compiler is stopping you from writing buggy code. If you want to do modify the value in the dictionary, you'll need to use something like:
// Note: copying the contents to start with as you can't modify a collection
// while iterating over it
foreach (KeyValuePair<string, MapTile> pair in tilesData.ToList())
{
    MapTile tile = pair.Value;
    tile.bgFrame = tile.bgFrame >= tile.bgAnimation ? 0 : tile.bgFrame + 1;
    tilesData[pair.Key] = tile;
}

Note that this is also avoiding doing multiple lookups for no good reason, which your original code was doing.
Personally I'd strongly advise against having a mutable struct to start with, mind you...
Of course, another alternative is to make it a reference type, at which point you could use:
// If MapTile is a reference type...
// No need to copy anything this time; we're not changing the value in the
// dictionary, which is just a reference. Also, we don't care about the
// key this time.
foreach (MapTile tile in tilesData.Values)
{
    tile.bgFrame = tile.bgFrame >= tile.bgAnimation ? 0 : tile.bgFrame + 1;
}

A: I would suggest creating a utility class:
public class MutableHolder<T>
{
    public T Value;
    public MutableHolder(T value)
    {
        this.Value = value;
    }
}

Then store a newly-created MutableHolder<MapTile> into each dictionary slot rather than storing a MapTile directly.  This will allow you to easily update the map tile associated with any particular key, without having to modify the dictionary itself (an act which would otherwise, at minimum, invalidate the enumerator used by your foreach loop).

A: Since C# 9.0, you can use the with syntax to create a new copy of the old struct overriding arbitrary fields.
mapTile = mapTile with { bgAnimation = 1 };

A: Chance struct to Class
before:
public struct MapTile
{
    public int bgAnimation;
    public int bgFrame;
}

after:
public Class MapTile
{
    public int bgAnimation;
    public int bgFrame;
}


text:
Q: asp.net response.redirect() in subdomain I have a subdomain in this name (job.amez.co) and there is a master page inside my subdomain that contain some links and one of the links redirect me to a page (Logout.aspx)

                    بەخێربێیت بەرێز:

                        <asp:HyperLink ID="HyperLink1" NavigateUrl="~/Profile.aspx" runat="server">پرۆفایل</asp:HyperLink>

                        <asp:HyperLink ID="HyperLink2" NavigateUrl="~/jobs/Myjobs.aspx" runat="server">کارەکانم</asp:HyperLink>

                        <asp:HyperLink ID="HyperLink3" NavigateUrl="~/LogOut.aspx" runat="server">چوونە دەرەوە</asp:HyperLink>

and when ever I click on these links instead of taking me to job.amez.co/LogOut.aspx it takes me to job.amez.co/job/LogOut.aspx


text:
Q: proof of the Meyers-Serrin Theorem in Evans's PDE book The following is the Meyers-Serrin theorem and its proof in Evans's Partial Differential Equations:

Could anyone explain where (for which $x\in U$) is the convolution in step 2 defined and how to get (3) from Theorem 1?

A: In Evans' book, $\eta_\varepsilon$ is the standard mollifiers, and in my edition is defined/discussed in appendix C.4.
Here was my thought process in thinking about your question:
Looking at the definition in the appendix, $$f^\varepsilon(x)=(f*\eta_\varepsilon)(x)=\int_{B(0,\varepsilon)}\eta_\varepsilon(y)f(x-y)dy=\int_{B(x,\varepsilon)}\eta_\varepsilon(x-y)f(y)dy.$$ We are essentially taking the mollifier $\eta_\varepsilon$, whose support sits inside the ball $B(0,\varepsilon)$, and moving it around $U$ so that we can weight $f$ by it at each point $x$ with the goal of smoothing out $f$. Thus in order for the integrad $\eta_\varepsilon(y)f(x-y)$ to even make sense, the ball sitting at $x$ has to be completely inside $U$. This is motivation for the notation/definition $U_\varepsilon=\{x\in U \ | \ \mathrm{dist}(x,\partial U)<\varepsilon\}$, and why the (basically) direct proof of Theorem 1 only gives local approximation, and why "dealing with the boundary" is the main goal of this result.
Thus, the convolutions $u^i$ are defined for any $x\in U_{\varepsilon_i}$. Theorem 1 then implies that, since $\zeta_iu\in W^{k,p}(U)$, we have a local approximation of smooth functions, but since $\mathrm{spt}(\zeta_iu)\subset V_i\subset\subset U$, we may presumably take the $\varepsilon_i$'s small enough that the convolution is defined on all of $V_i$ so we may drop the "$\mathrm{loc}$" from the approximation. This gives us the sequence $u^i$ satisfying $(3)$ without loss of generality.
Hope this helped clarify the proof!

A: The following theorem is from Adam's Sobolev Spaces

If $u\in L^1_{\hbox{loc}}(\Omega)$ and $\text{supp }(u)\subset\subset\Omega$, then $\eta_\varepsilon*u\in C_c^\infty(\Omega)$ provided
  $$
\varepsilon<\text{dist }(\text{supp }(u),\partial U).
$$

Also, we have the mollification in $W^{k,p}(\Omega)$ which is related to Theorem 1 in OP:

Let $1\leq p<\infty$ and $u\in W^{k,p}(\Omega)$. If $\Omega'$ is a subdomain with compact closure in  $\Omega$, then $\eta_\varepsilon*u\to u$ in $W^{k,p}(\Omega')$.

Because we have $\zeta_iu\in W^{k,p}(U)$ (thus in $L^1_{\hbox{loc}}(U)$), and $\text{spt }(\zeta_iu)\subset V_i\subset\subset U$,  the convolution $u^i=\eta_{\varepsilon_i}*(\zeta_iu)$ is defined (for small enough $\varepsilon_i>0$) everywhere in $U$, comparing to the $f^\varepsilon$ in Theorem 1 that it is only well-defined in $U_\varepsilon$.
One can (for example done in Adam's book, Thm 3.17, which is the same as Theorem 2 in OP) explicitly calculate the $\varepsilon_i>0$ such that
$$
\text{spt }u^i\subset W_i
$$
and
$$
\|u^i-(\zeta_iu)\|_{W^{k,p}({W_i})}\leq\delta'\qquad\text{by the second theorem quoted from Adam.}
$$
Since both $u^i$ and $\zeta_iu$ are in $W^{k,p}(U)$ (noting that $u^i\in C^\infty_c(U)$), and both have support in $W_i$, one has
$$
\|u^i-(\zeta_iu)\|_{W^{k,p}(U)}=\|u^i-(\zeta_iu)\|_{W^{k,p}({W_i})}.
$$
(3) is thus established.


text:
Q: как удалить из массива повторяющиеся элементы js var x=[55,44,55,30,30]=>[55,44,30]

A:

let x = [55, 44, 55, 30, 30]
let unique = [...new Set(x)]

console.log(unique)

или

let x = [55, 44, 55, 30, 30]
let unique = x.filter((e, i) => x.indexOf(e) === i )

console.log(unique)

A:

var x = [55, 44, 55, 30, 30];
for (var i = x.length - 1; i >= 0; i--) {
  if (x.indexOf(x[i]) != i)
    x.splice(i, 1);
}
console.log(x);

A:

var x = [55, 44, 55, 30, 30];
var y = [];
x.forEach(function(el, i) {
  if (y.indexOf(el) === -1) {
    y.push(el);
  }
})
console.log(y);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


text:
Q: WTForms dynamic field: binding a unbounded field with bind() I have looked into the bind() function/method of wtforms in combintation with python3 flask and jinja.
My goal is to make on the fly a hiddenfield which is included in the base model on render time in the form. I have spend days looking for a solution but it is not clear to me. How does binding a unbound field work?
A little snippet of things i tried
# self.model.append_field(
    name="multiselector_results",
    field=HiddenField()
    )
tmp = HiddenField(
    label="multiselector_results",
    validators=[],
    description="",
    id="multiselector_results",
    default=""
    )

tmp.bind(
    self.model,
    "multiselector_results"
    )

# self.model.multiselector_results.bind(self, tmp)

# self.model._fields["multiselector_results"] = self.model.multiselector_results.bind(
    self, HiddenField(), {"name": "multiselector_results"})
# self.model.multiselector_results.bind()

My main Form class includes this function
@classmethod
def append_field(cls, name, field):
    setattr(cls, name, field)
    return cls

The append_field function is in a main class called Form where every model basically inhirits from.
I am able to assign the hidden field to my model on the fly which validates the append_field method is actually working, but the hidden field itself stays Unbound for some reason.
The documentation is not clear enough for me since even ctrl + F brings up one hit with bind().
Here a couple of references I have looked into:
http://wtforms.simplecodes.com/docs/0.6/fields.html
https://wtforms.readthedocs.io/en/latest/forms.html#wtforms.form.Form.__init
https://media.readthedocs.org/pdf/wtforms/2.0.2/wtforms.pdf
https://media.readthedocs.org/pdf/wtforms/1.0.5/wtforms.pdf
http://wtforms.simplecodes.com/docs/1.0.2/fields.html
https://groups.google.com/forum/#!topic/wtforms/cJl3aqzZieA

I also found a couple of stack overflow question which are scary close to this one, however slightly different. Those solutions however gave me new inspiration to try stuff out. A example topic:
How to bind a field in __init__ function of a form
I do like the other solutions davidism provided but its out of the question in my case.
Only thing in the whole wtforms documentation which i have found about bind()
If _form and _name isn't provided, an UnboundField will be returned instead. Call its
bind() method with a form instance and a name to construct the field.

How can a unbound field get constructed?


text:
Q: What is the return value of shared_ptr::get() after it is released? After releasing a std::shared_ptr<T>, when I do ptr.get() is the return value NULL or nullptr? In order to compare, I used this:
std::shared_ptr<int> ptr(new int(44));

ptr.reset();
int *p = ptr.get();

if (p == nullptr)
{
    cout << "nullptr";
}

if (p == NULL)
{
    cout << "NULL";
}

Both seem to be the result.

A:
2.14.7 Pointer literals [lex.nullptr]
The pointer literal is the keyword nullptr. It is a prvalue of type
std::nullptr_t. [ Note: std::nullptr_t is a distinct type that is
neither a pointer type nor a pointer to member type; rather, a prvalue
of this type is a null pointer constant and can be converted to a null
pointer value or null member pointer value.

Both are equivalent, but you should prefer to use nullptr.

A: In C++11, use nullptr.
It is true that they are both correct and equivalent in this case, since both are null pointer constants as specified by paragraph 4.10/1 (NULL is usually #defined to be 0):

A null pointer constant is an integral constant expression (5.19) prvalue of integer type that evaluates to
  zero or a prvalue of type std::nullptr_t. A null pointer constant can be converted to a pointer type; the
  result is the null pointer value of that type and is distinguishable from every other value of object pointer or
  function pointer type.

However, nullptr is recognized by the type system as the pointer literal of type nullptr_t and as a special null pointer constant, so its semantics are clear both to you and to the compiler. NULL, on the other hand, is just a macro that is known to expand to zero.


text:
Q: Adding Valid File Types - PHP form I am trying to add accepted file types to a form that was built by someone else. I'm not exactly proficient with PHP.
Can anyone indicate where I am going wrong? I have tried replicating part of the form by adding RTF and TXT file types however the form doesn't appear to accept them still.
Any help is greatly appreciated.
if($_FILES['file']['error'] == UPLOAD_ERR_OK) {

    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime = finfo_file($finfo, $_FILES['file']['tmp_name']);

    if($mime == 'application/msword' || $mime == 'application/pdf' || $mime == 'application/rtf' || $mime == 'text/plain'){

        //Check 'temp' Directory Exsists
        if(!file_exists(WP_CONTENT_DIR .'/uploads/temp')){
            mkdir(WP_CONTENT_DIR .'/uploads/temp', 0777, true);
        }
        move_uploaded_file($_FILES["file"]["tmp_name"], WP_CONTENT_DIR .'/uploads/temp/'.basename($_FILES['file']['name']));
        $attachment = array(WP_CONTENT_DIR ."/uploads/temp/".$_FILES["file"]["name"]);
    } else {
        $validation_message = " Invalid File Type";
        $attachment = NULL;
        $passes = false;
    }

    } else {
        $attachment = NULL;
    }

A: You may check by getting the output of variable $mime.
You can also put the type in superglobal array $_FILES.
$mime = finfo_file($finfo, $_FILES['file']['type']);


text:
Q: In Android Studio why is there no TextViewPreference? Ok so I wanted to create a Settings activity. I was told using the Preference layout makes it much easier.
I want a TextView that when clicked does a certain action, yet there is no TextViewPreference. The closest thing is EditTextPreference that must have the attribute "selectable" set to off which turns it gray.
Also another thing, these Preferences have no ID attribute. How am I supposed to attach OnClickListeners to them if they have no ID???

A: try-->
Method 1
create a custom preference layout item and use it in the Preference Activity:-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize">

    <TextView android:id="@android:id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal" />

  </LinearLayout>

add in preference xml:
<Preference
android:title="@string/label_pref_version"
android:key="@string/pref_version"
android:layout="@layout/pref" />

then lastly:-
fire findViewById in your Activity code and attach a listener....
Method 2
For the xml:
<Preference android:title="Acts like a text"
            android:key="@string/myCooltext"
            android:summary="This is a text"/>

Then for the java in your onCreate()
Preference text = findPreference(getString(R.string.myCoolText));
text.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                //code for what you want it to do
                return true;
            }
        });

Method 3
You can try it like this to get the Textview in activity:
 View name= ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layouttext, null, false);

add android:id to the LinearLayout that contains the Textview in layouttext.xml, i.e. android:id="@+id/mylayout"
 LinearLayout mLayout = (LinearLayout)name.findViewById(R.id.mylayout);
  Textview login = (Textview) footerView.findViewById(R.id.Text);
  login.setOnClickListener(this);


text:
Q: Qt: connecting signals and slots from text How would I connect a signal and slot of 2 objects when the object names, signals, and slots are all specified in a text file?
Getting the right objects names isn't an issue, since I can easily loop through an array and compare the names to the spot in the file, but there has to be some sort of way where I can return the signal and slot from the file and use it in the connect function, like:
connect(rtnObj1(line),SIGNAL(rtnSignal(line)),rtnObj2(line),SLOT(rtnSlot(line)));

where rtn functions return the object name/signal/slot, and "line" is the current QString line from the file.
The only way I know of is by literally coding in every single combination and comparing QStrings with if statements, but that would be incredibly tedious, as the amount of combinations would be incredibly high.
Note:
Here's a simplified example demonstrating essentially how this issue exists.
Frame 1:
4 QComboBoxes. The first and third hold object names, the second holds signals, the fourth holds slots. Every item is of course a QString within these lists. Hitting a button appends a new line to a file, writing the text selected from each box.
Frame 2: Has already has the required objects. Reading the file, it would match the objects defined in the list against the ones already created, and connect them as the file describes.
It's easy enough to create an object based on the data a file holds, but how would one create/pull a signal and a slot from a file?
Edit:
Unless, is one able to connect like this?
connect(objectA, "", objectB, "");

Because I just found out that my code will compile like that, however whenever I try putting in the slot or signal names I just get an error like:

QObject::connect: Use the SIGNAL macro to bind Tile::clicked

A: Your problem is easily solvable with one of the following static QObject::connect() method:
QMetaObject::Connection QObject::connect(
    const QObject *sender, const QMetaMethod &signal,
    const QObject *receiver, const QMetaMethod &method,
    Qt::ConnectionType type = Qt::AutoConnection)

First of all, you need pointers to sender and receiver objects. There are several ways how you can store an object pool. I would suggest to keep all objects in QHash:
QHash<QString, QObject *> m_objects; // I use QObject as a generic example

Now, it's possible to find a pointer to any object for connecting in an efficient way.
The next step would be obtaining QMetaMethod objects for sender's signal and receiver's slot from corresponding QMetaObject objects. Use QObject::metaObject() QMetaObject instances.
Here's the complete code of a function which connects two object using only string parameters:
void dynamicConnect(const QString &senderName, const QString &signalName,
                    const QString &receiverName, const QString &slotName)
{
    QObject *emitter = m_objects.value(senderName);
    int index = emitter->metaObject()
            ->indexOfSignal(QMetaObject::normalizedSignature(qPrintable(signalName)));
    if (index == -1) {
        qWarning("Wrong signal name!");
        return;
    }
    QMetaMethod signal = emitter->metaObject()->method(index);

    QObject *receiver = m_objects.value(receiverName);
    index = receiver->metaObject()
            ->indexOfSlot(QMetaObject::normalizedSignature(qPrintable(slotName)));
    if (index == -1) {
        qWarning("Wrong slot name!");
        return;
    }
    QMetaMethod slot = receiver->metaObject()->method(index);

    QObject::connect(emitter, signal, receiver, slot);
}


text:
Q: Forecasting with ARIMA and GARCH: does my plan look alright? I have a time series containing the daily close price for a stock and I would like to perform a 10 days forecast of the volatility.
I'm trying to follow this tutorial: https://talksonmarkets.files.wordpress.com/2012/09/time-series-analysis-with-arima-e28093-arch013.pdf
This is my data and its autocorrelation:
> closing_price$CloseDayPriceA
 [1] 0.0610 0.0605 0.0590 0.0575 0.0590 0.0585 0.0610 0.0590 0.0615 0.0610 0.0625
[12] 0.0605 0.0600 0.0650 0.0650 0.0710 0.0740 0.0730 0.0765 0.0770 0.0755 0.0765
[23] 0.0760 0.0775 0.0850 0.0955 0.0975 0.1155 0.1365 0.1200 0.1270 0.1230 0.1210
[34] 0.1040 0.1155 0.1355 0.1315 0.1310 0.1265 0.1250 0.1230 0.1245 0.1240 0.1235
[45] 0.1225 0.1185 0.1110 0.1130 0.1170 0.1150 0.1120 0.1135 0.1135 0.1085 0.1100
[56] 0.1090 0.1075 0.1050 0.1030 0.0960 0.0955 0.0970 0.0960 0.0915 0.0910
> a = acf(closing_price$CloseDayPriceA)
> a

Autocorrelations of series 'closing_price$CloseDayPriceA', by lag

     0      1      2      3      4      5      6      7      8      9     10
 1.000  0.955  0.908  0.864  0.813  0.759  0.714  0.680  0.625  0.570  0.511
    11     12     13     14     15     16     17     18
 0.446  0.381  0.314  0.242  0.170  0.106  0.048 -0.017
>

The data is clearly not stationary. I can make it stationary by differencing:
diff_price = diff(closing_price$CloseDayPriceA)

or alternatively by fitting an AR(1) model and taking the residuals:
arimaA = arima(closing_price$CloseDayPriceA, order = c(1, 0, 0))

Now the squared residuals are still autocorrelated as shown by their ACF. For this reason I apply a GARCH model:
library(fGarch)

    garchA=garchFit(formula = ~garch(2, 1), data = arimaA$residuals, trace = F)
    acf(residuals(garchA))

My questions are:

*

*Does the procedure that I am following make sense?

*How can I make a 10 days forecast and compute the 10 days volatility?

EDIT:
This should be the code:
A = closing_price$CloseDayPriceA
A.log = log(A)
log_rtn = diff(A.log)
A.garch = garchFit(formula = ~garch(1, 1), data = log_rtn, trace = F)
A.est = predict(A.garch, 30, plot=T)

A: When modelling stock prices, it is quite common to transform the original prices $P_{t}$ to logarithmic returns $r_t:=\ln(P_{t})-\ln(P_{t-1})$ and then employ a GARCH model.
Logarithmic returns reflect price changes relative to price levels. If the price was fluctuating at around the same level, logarithmic returns would behave similarly to simple returns (just be scaled by roughly a constant); then not taking logarithms could be justified. But since the price is roughly a random walk, it does not stay around any fixed level for too long, and hence there is a difference between logarithmic and simple returns. Simple returns have an amplitude that changes with the price level, while logarithmic returns have a roughly constant amplitude. Therefore, modelling logarithmic returns is more convenient.
Given a GARCH model for (logarithmic) returns, you can predict the volatility iteratively:
$$
\begin{aligned}
\hat\sigma_{t+1}^2 &= \hat\omega + \hat\alpha r_{t}^2 + \hat\beta \sigma_{t}^2 \\
\hat r_{t+1}^2 &= \hat\sigma_{t+1}^2 \\
\hat\sigma_{t+2}^2 &= \hat\omega + \hat\alpha r_{t+1}^2 + \hat\beta \hat\sigma_{t+1}^2 \\
\hat r_{t+2}^2 &= \hat\sigma_{t+2}^2 \\
&\dotsc
\end{aligned}
$$
In R, use function predict on a fitted object from garchFit, in your case, garchA; see p. 30-31 of the "fGarch" manual for details.
In the above I assumed you are not using an ARMA model for the conditional mean of returns. Predictability in the level of returns via ARMA would be a little naive to expect and would be a sign of market inefficiency. Without ARMA, the point forecast of $r_{t+h}=0$ for $h>0$.
However, if you decide to use ARMA, replace $r_t$ and $\hat r_t$ with $\hat\varepsilon_t$ in the GARCH formulas above, where $\hat\varepsilon_t$ is a residual from the ARMA model. Also, the point forecast is generally nonzero and is given by the ARMA model.
Also, if you use ARMA, estimate both ARMA and GARCH simultaneously (rather than first estimating ARMA and then fitting GARCH on its residuals). This will yield consistent and efficient parameter estimates. This can be done with the same garchFit function as you are using now.


text:
Q: SQL Server Hanging after Insert Into Select Thanks for taking a look at this.
The issue has to do with the following sql query. Basically it recursively finds all pages underneath a certain page(master page), and then applies the master page's categories(looked up in the xref_pages_categories) to all of those pages.
Upon running the insert, querying the table for data that should have been inserted completely hangs.
If i run the query without the insert line, the results come back perfectly, like:
3245    490
3249    490
3252    490

But upon putting the insert in front of it and inserting, querying for pageid=3245 just hangs. Any ideas?
declare @page int;

set @page=3202;
begin transaction transki;

With FindAllPagesUnderneath(PageID, ParentID) as
(
    select id as PageID, ParentPageId as ParentID
    from pages where id=@page
    union all
    select id as PageID, ParentPageID as ParentID
    from pages p
    inner join FindAllPagesUnderneath mp on
    p.parentpageid=mp.PageID
)

insert into xref_pages_categories (PageID, CategoryID)

    --get records that definitely arent already in xref_pages_categories
select * from
(
    select distinct thegood.*
    from
        (
        --get all pages under @page attached to new categoryid
        select distinct fap2.PageID, fapo.CategoryID
            from FindAllPagesUnderneath fap2
            cross join  (
                select fap.PageID,xpc.categoryid
                from xref_pages_categories xpc
                inner join FindAllPagesUnderneath fap
                on fap.PageID=xpc.pageid
                where fap.pageid!=1 and
                fap.pageid!=1332
                and fap.parentid=1332
            ) fapo
        where fap2.pageid !=@page
        ) thegood
        left outer join xref_pages_categories xpc
        on xpc.pageid = thegood.pageid
        where xpc.pageid is null
) final

A: without looking into all of your code, at execution plans, or locking/blocking issues, you could try this hack:
create this table before the CTE:
CREATE TABLE #TempResults
(
PageID         ...
,CategoryID    ...
)

INSERT into it and not xref_pages_categories (using the CTE SELECT)
then put this at the end of the code block:
insert into xref_pages_categories (PageID, CategoryID)
    SELECT PageID, CategoryID FROM #TempResults

This INSERT should run faster and hopefully not lock/block like they are doing now as part of the CTE.