text:
Q: Black screen on boot I recently installed Arch on my laptop, and I've been having a problem booting. After the grub screen, it loads up until it says "Reached target Graphical Interface", and then it gets stuck on a black screen with a cursor in the corner. I think it might be a problem with lighten or nvidia, but I'm not entirely sure and I don't know how to approach it. Any help would be appreciated.
Edit: I have a Geoforce GTX1050 graphics card and I tried installing nvidia 435.21 and bumblebee 3.2.1. I've also tried using other display managers, but they all have the same issue. Secure boot is disabled in the UEFI.
I installed the drivers by following the guides on the arch wiki, and bumblebee is enabled and starts fine. lightdm fails to start though.

A: I had a similar problem with a "intel" GPU in arch. No matter how you combine distros, configuration tools and intel, nvidia etc, there is always room for some misconfiguration.
The main configuration file for X's GPU drivers is /etc/X11/xorg.conf. It has a man page, which is actually the main man page for x (man xorg.conf). "Card0" is the default identifier name for the (first) GPU card or chip. Here is what that xorg.conf must contain: actually just the correct Driver:
Section "Device"
        Identifier  "Card0"
        Driver      "intel"  # nvidia also has own drivers
        #   Driver     "modesetting" ...deactivated
        BusID       "PCI:0:2:0" # necessary?
EndSection

Arch Linux had left me without any xorg.conf at all, the way I installed. First I got "modesetting" and X wouldn't start, it would just read configfiles and probe some modes and give up with lots of messages. Could be a CRT monitor thing even. I finally just added "intel" as driver and it worked. No trick or hack whatsoever. Somebody just had to tell X. Very simple in the end, and looking back.
So look at your xorg.conf, section "Device", option "Driver". Nvidia is a bit special ("nouveau"?). Probably just takes one line to get right.
I'm assuming you reach some "multi-user" systemd target, a working non-GUI linux console...

Geoforce GTX1050 graphics card

You know your GPU, you know your kernel version and modules, you know when you want to go graphical: so you tell your system which pieces you want. Should be automatic, yes, but this area often needs a push. Arch.wiki should really have up to date info about anything specific on nvidia.
(I am not to talking about real GPU driver problems...GPU drivers are simply the largest chunk in linux kernel source. It's also the most complex "chip" in a consumer system, besides the CPU)


text:
Q: Pandas GroupBy and remove duplicates without shifting cells I have a somewhat large array (~3000 rows) where the first column has a duplicate string values that are of varying numbers. I want to be able to remove these duplicates without shifting the cells in this column.
Input
row/rack     shelf    tilt
row1.rack1     B       5
row1.rack1     A       nan
row1.rack2     C       nan
row1.rack2     B       nan
row1.rack2     A       17

Desired output
row/rack     shelf    tilt
row1.rack1     B       5
               A       nan
row1.rack2     C       nan
               B       nan
               A       17

Is there a good way to do this? I've been searching through stackoverflow and other sites but haven't been able to find something like this

A: using .duplicated and .loc
df.loc[df['row/rack'].duplicated(keep='first'),'row/rack'] = ''

print(df)

     row/rack shelf  tilt
0  row1.rack1     B   5.0
1                 A   NaN
2  row1.rack2     C   NaN
3                 B   NaN
4                 A  17.0

A: mask the duplicates with empty strings:
df["row/rack"] = df["row/rack"].mask(df["row/rack"].duplicated(), "")

>>> df
     row/rack shelf  tilt
0  row1.rack1     B   5.0
1                 A   NaN
2  row1.rack2     C   NaN
3                 B   NaN
4                 A  17.0

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the nicest a Unix command can be? For a quick benchmarking test, how can nice and ionice be combined to maximum effect, ie for a command to use as little resource as possible (without idling altogether)?
(I think it's something like `nice -n 19 ionice -c 2 [command], but not sure about ionice's "-n" (classdata param), the man page is cryptic about its relevance.)

A: The full command you want is:
chrt -b 0 nice -n 19 ionice -c 2 -n 7 [command]

The chrt command at the beginning will switch things to the batch scheduling class, which is equivalent to adding 0.5 to the nice value.  The -n option for ionice is a simple priority for the realtime (-c 1) and best-effort (-c 2) options, with lower values being higher priority just like nice values (but in the range 0-7).  However, the ionice command is not strictly necessary, since I/O scheduling class and priority are by default derived from the CPU scheduling parameters, and nice -n 19 implies ionice -c 2 -n 7.
However, you can get the absolute minimal resource usage by setting both the CPU and I/O scheduling classes to idle.  In both cases, the 'idle' schedulers aren't actually idle schedulers, and you will still be able to use resources, it's just that everything will have higher priority.
For the CPU scheduling class, this also uses the chrt command, albeit without needing nice (priority must be set to 0 in the idle scheduling class), and looks like this:
chrt -i 0 {command or PID}

The nice command on Linux mirrors the SVR4 version, which means that it can't change scheduling class, only nice value (which also behaves differently on Linux than classical UNIX, but that's a bit OT).  As the original alternative scheduling classes were the POSIX.1E realtime SCHED_RR and SCHED_FIFO, the command to set scheduling classes ended up being called chrt.  The -i option specifies to use the SCHED_IDLE scheduling class
For the I/O scheduling class, you use ionice.  The exact command looks like this:
ionice -c 3 {command or PID}

The -c option specifies what scheduling class to use, and 3 is the number for the idle class.  Note that depending on which block I/O scheduler is being used, this may not actually impact anything.  In particular, the noop I/O scheduler doesn't support priorities or scheduling classes at all, and I'm pretty sure the deadline schedulers (both the legacy one, and the blk-mq one) don't either.
If you want to do this programmatically, either for your own program, or to adjust things for other processes, check out the man pages for the sched_setscheduler and ioprio_set system calls (although both are worth reading if you just want more background too).

A: Assuming you don't want that command to completely wait for others to finish, so not to potentially suffer resource starvation, the line would be:
nice -n19 [command]

As ionice will be set proportionally on modern Linux kernels.
By the way chrt -b0 has nothing to do with niceness, but to how often the CPU will jump from one process to another. This line makes that time longer for batch programs to make better use of caches, but for other commands it's useless. As seen here.


text:
Q: How to use the :first-of-type rule inside a styled-components/emotion partial? I'm trying to replicate some CSS in Emotion using Partials but I don't see how it's possible to replicate a rule like :first-of-type in a situation where I'm using a partial. Is there some way to achieve this?
Starting CSS:
li.item {
  background: white;
  border: 1px solid;
}

li.item.isResult:first-of-type {
  background: pink; /* Don't know how to port this rule */
}

Best attempt at porting this rule to Emotion:
import styled from '@emotion/styled';
import { css } from '@emotion/core';

const Item = styled.li`
  background: white;
  border: 1px solid;
  ${resultPartial}
`

const resultPartial = props => props.isResult && css`
  &:first-of-type {
    background: pink; // Has no effect
  }
`

PS: Although partials don't seem to be mentioned in Emotion's docs, they are supported and do work. I'm specifically wondering about how to go about recreating a :first-of-type rule inside a partial.

A: Not a solution, but an explanation why it doesn't work.
const Div = styled.div`
  color: black;
  &:first-of-type {
    color: red;
  }
`;

Generates CSS like this:
.HaSh{color: black}
.HaSh:first-of-type{color: red}

However, the CSS spec only allows "type" to be a tag name for first/nth/last/only-of-type. Yet, styled-components relies and must rely on class names to distinguish differently styled div's. Thus, a dead end.
I believe you can work around the limitation (in general) by setting the style on any "parent's child", e.g.:
const Comp = () => <Container>
1

2
</Container>;

const Container = styled.div`
  & > *:first-of-type {
    color: red;
  }
`;


text:
Q: GetSystemMetrics(SM_CYSCREEN); | Gives wrong value| but GetSystemMetrics(SM_CXSCREEN); gives correct value I have a problem with GetSystemMetrics(SM_CYSCREEN); – the height this function returns is random each time I run the program but the width function, GetSystemMetrics(SM_CXSCREEN); gives the correct value.
Here is my code:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>

int  MessageBoxPrintf(const wchar_t * szCaption, const wchar_t * szFormat, ...) {

    wchar_t buffer[1024];
    va_list v1;
    va_start(v1, szFormat);
    wchar_t* c = va_arg(v1, wchar_t*);
    wsprintf(buffer, szFormat, c); //gives formated output to buffer
    va_end(v1);
    return MessageBox(NULL, buffer, szCaption, 0);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
    int cxScreen, cyScreen;
    cxScreen = GetSystemMetrics(SM_CXSCREEN);
    cyScreen = GetSystemMetrics(SM_CYSCREEN);
    MessageBoxPrintf(TEXT("ScreenRes"), TEXT("The screen is %i pixels wide by %i pixels high"), cxScreen, cyScreen);
    return 0;
}

This program basically just is a Format string Message box with the WinAPI and C++.

A: The code you have posted shows (almost certainly) undefined behaviour, because of the incorrect way you handle the variadic argument list in your MessageBoxPrintf function.
In the wchar_t* c = va_arg(v1, wchar_t*); line, you are 'assuming' a single wchar_t argument – but, in your main function, you are passing two int arguments. This may or not produce meaningful results; – in your case, it seems that the first int argument is correctly interpreted by the subsequent call to wsprintf but the second is somewhat "lost in translation" (manifesting the aforementioned undefined behaviour).
To correctly handle that variadic argument list, you need to extract it, then pass it unprocessed to the vswprintf function, which can then properly interpret that argument list:
int MessageBoxPrintf(const wchar_t* szCaption, const wchar_t* szFormat, ...)
{
    wchar_t buffer[1024];
    va_list v1;
    va_start(v1, szFormat);
    vswprintf(buffer, 1024, szFormat, v1);
    va_end(v1);
    return MessageBox(NULL, buffer, szCaption, 0);
}


text:
Q: functions of javascript "return" In JavaScript, can return be used to "kill" a variable so to speak (as in, stop it from functioning past that point throughout the code)? I am working on this piece of code and I want the variable "msg" to stop working if its value is empty to avoid the alert box from popping up. Is this correct, or would the alert still pop up?
if(msg==""){
return result;
}

{
alert(msg)
return result;
}

A: return is used to allow functions to hand back control, it can not be used outside of a function. I think what you are looking for is else
if(msg==""){
 // do something
} else {
  alert(msg);
}

If you want to "kill" a variable, all you can do is delete VARIABLE_NAME which will make it undefined

A: Why don't you put a simple condition on your alert ?
 if(msg!="")
    alert(msg)

 return result;

A: It depends on what you want to happen.
Do you want the code within your function to continue executing if msg is ""?
If so, then use else:
if (msg) {
   alert(msg);
} else {
   //continue on in function while msg is ""
}

Or do you want to exit out of the function altogether?  If so:
if (!msg) {
   return;
}

alert(msg);

// continue on in function while msg is NOT ""


text:
Q: Remove WooCommerce shipping method based on product attribute I'm using this referral.
I'm trying to remove shipping rates based on product attributes inside customer cart.
For example if cart contains product with pa_size attribute and values 30x50, 50x70 in it, shipping method flat_rate:3 will be removed.
add_filter( 'woocommerce_package_rates', 'hide_shipping_method_based_on_variation_product_attribute', 10, 2 );
function hide_shipping_method_based_on_variation_product_attribute( $rates, $package ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    // HERE define the Product Attibute taxonomy (starts always with "pa_")
    $taxonomy = 'pa_size'; // Example for "Color"

    // HERE define shipping method rate ID to be removed from product attribute term(s) slug(s) (pairs) in this array

    // If site language is Hebrew
    if (get_locale() == 'he_IL') {
      $data_array = array(
          'flat_rate:3'      => array('30x50-he', '50x70-he', '50x70', '30x50')
      );
    }
    // Else site language
    else{
      $data_array = array(
          'flat_rate:3'      => array('50x70', '50x70-he')
      );
    }

    // Loop through cart items
    foreach( $package['contents'] as $cart_item ){
        if( isset($cart_item['variation']['attribute_'.$taxonomy]) ) {
            // The product attribute selected term slug
            $term_slug = $cart_item['variation']['attribute_'.$taxonomy];

            // Loop through our data array
            foreach( $data_array as $rate_id => $term_slugs ) {
                if( in_array($term_slug, $term_slugs) && isset($rates[$rate_id]) ) {
                    // We remove the shipping method corresponding to product attribute term as defined
                    unset($rates[$rate_id]);
                }
            }
        }
    }
    return $rates;
}

It works, but I get conflict with WooCommerce files on wc-cart-functions.php file that in charge of shipping rate on cart file (which affect other functions in WordPress).
/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 477

How can I remove WooCommerce shipping method basing on attributes on user cart without conflict WooCommerce?
Full error log:
Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/wc-cart-functions.php:477 Stack trace: #0 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/wc-cart-functions.php(477): array_keys() #1 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/wc-cart-functions.php(413): wc_shipping_methods_have_changed() #2 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1454): wc_get_chosen_shipping_method_for_package() #3 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1423): WC_Cart->get_chosen_shipping_methods() #4 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/V1/AbstractCartRoute.php(165): WC_Cart->calculate_shipping() #5 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Routes/V1/AbstractCartRoute.php(69): Automattic\WooCommerce\StoreApi\Routes\V1\AbstractCartRoute->calculate_totals() #6 [internal function]: Automattic\WooCommerce\StoreApi\Routes\V1\AbstractCartRoute->get_response() #7 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1171): call_user_func() #8 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/rest-api/class-wp-rest-server.php(1018): WP_REST_Server->respond_to_request() #9 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/rest-api.php(535): WP_REST_Server->dispatch() #10 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/rest-api.php(2884): rest_do_request() #11 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Assets/AssetDataRegistry.php(317): rest_preload_api_request() #12 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AllProducts.php(40): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->hydrate_api_request() #13 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AllProducts.php(33): Automattic\WooCommerce\Blocks\BlockTypes\AllProducts->hydrate_from_api() #14 /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/AbstractBlock.php(100): Automattic\WooCommerce\Blocks\BlockTypes\AllProducts->enqueue_data() #15 [internal function]: Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->enqueue_editor_assets() #16 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/class-wp-hook.php(308): call_user_func_array() #17 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #18 /var/www/vhosts/rockstar-z.com/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action() #19 /var/www/vhosts/rockstar-z.com/httpdocs/wp-admin/edit-form-blocks.php(272): do_action() #20 /var/www/vhosts/rockstar-z.com/httpdocs/wp-admin/post-new.php(72): require('/var/www/vhosts...') #21 {main} thrown in /var/www/vhosts/rockstar-z.com/httpdocs/wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 477

A: I'm not seeing a full error log, and I haven't looked at what you're doing in any depth, but I can see that in wc-cart-functions.php at line 477, in the function wc_shipping_methods_have_changed, array_keys acts on $package['rates'], but that, in your function, if ( is_admin() && ! defined( 'DOING_AJAX' ), you would not be returning anything.
So, you might try returning either array() or simply, probably safer, $rates. In other words:
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
        return $rates;

}

Anyway I'd at least try that. If the error persists, I'd look for anywhere else that $package or $package['rates'] might be changed.


text:
Q: How to call a countdown timer from 5 second and it should decrement to 1 second in iPhone? I have an application in which I want that when I run my application initially it should show a screen for 2 seconds that displays warning about the app and just after 2 seconds a countdown should start from 5 seconds that should decrement from 5 second to 1 second.

A: There are two ways:

*

*[NSTimer timerWithTimeInterval: .....]

*[self performSelector: withObject: afterDelay:]

A: so if i got your point you want to display a warning screen and after 2 seconds you want to show the user count down start from 5 and end at 1 .. well this can done easy by using a timer and counter as following :

*

*define a NSTimer and start it once the warning view is shown .. your definition will be like this:
timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerFires) userInfo:nil repeats:YES];

[timer fire];

*define a global integer and set its initial Value to 7 (lets suppose you name it counter).
-in timerFires selector you decreament counter by 1 and check its value when its equal to 5 start to show its vlaue on UILabel for example and when its 1 invalidate the timer and do you what you want at this point .. the timerFires will be like this:
- (void)timerFires
{

   counter --;
   if(counter ==5)
   {
      //show its Value
   }

   if(counter ==1)
   {
      [timer invalidate];
      timer = nil;

      //Do other stuff
   }
}

A: [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(updateFunction) userInfo:NULL repeats:YES];

In updateFunction you can write your code for count down.
You can also set "repeats:NO" and to call the updateFunction at the end of itself if it is necessary


text:
Q: Stuck on transforming DNF into CNF I have the formula
$(A \land B \implies C) \implies ((A \implies B) \land (B \implies C))$
which I have transformed into DNF:
$(A \land B \land \neg C) \lor (\neg A \land \neg B) \lor (\neg A \land C) \lor (B \land C)$.
Now I'm stuck on tranforming this into a CNF. How could I do this? Distribution laws, de Morgan, ...? Could somebody give me a hint?

A: Hint: Try expanding the partial clauses into full clauses first using $(x \lor   \neg x \Leftrightarrow  true)$ and $(y \land true \Leftrightarrow  y)$.
For eg: the term $A \land \neg B$ can be expanded by $(A \land \neg B) \land (true)$ which is the same as $(A \land \neg B) \land (C \lor \neg C)$ which is the same as $(A \land \neg B \land C) \lor (A \land \neg B \lor \neg C)$ by Distributive Law.
Do this for all partial clauses.
Then, you have a Conjunction of full clauses. Now use De Morgan's law to get the equivalent disjunction of full clauses.
Hint: Sum of minterms = Complement of product of Maxterms.


text:
Q: Execute function alternately How can I alternately perform 2 different functions
Example: Function 1 executed After 20 seconds function 2 executed and then everything starts again

A:

function function1() {
  // Do what you have to do...
  console.log("Function 1 called");
  setTimeout(function2, 20000);
}

function function2() {
  // Do what you have to do...
  console.log("Function 2 called");
  setTimeout(function1, 20000);
}

function1();


text:
Q: recyclerview in tab layout i am currently working on recyclerview in tab tablayout.
i am getting a error
Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
can anybody tell me what is the mistake
listcontent.java file
    package com.example.a1407268.learn12;
      import android.content.Context;
      import android.content.res.Resources;
      import android.content.res.TypedArray;
      import android.graphics.drawable.Drawable;
      import android.os.Bundle;
      import android.support.v4.app.Fragment;
      import android.support.v7.widget.LinearLayoutManager;
      import android.support.v7.widget.RecyclerView;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.ImageView;
      import android.widget.TextView;

    public class Listcontent extends Fragment {
    private RecyclerView.Adapter adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        RecyclerView recyclerview = (RecyclerView)
    inflater.inflate(R.layout.recycler_view, container, false);
        adapter = new MyAdapter(getContext());
        recyclerview.setAdapter(adapter);
        recyclerview.setHasFixedSize(true);
        recyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
        return recyclerview;
    }
}

    class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyrecyclerViewHolder>{
     final int LENGTH=18;
    String[] place;
    String[] des;
    Drawable[] pic;

    public MyAdapter(Context context) {
        Resources r = context.getResources();
        place = r.getStringArray(R.array.places);
        des = r.getStringArray(R.array.place_desc);
        TypedArray a = r.obtainTypedArray(R.array.place_avator);
        pic = new Drawable[a.length()];
        for (int i = 0; i < pic.length; i++) {
            pic[i] = a.getDrawable(i);
        }
        a.recycle();
    }

    @Override
    public MyrecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v
    =LayoutInflater.from(parent.getContext()).inflate(R.layout.item_tile,
    parent,false);
        MyrecyclerViewHolder recyclerview = new MyrecyclerViewHolder(v);
        return recyclerview;
    }

    @Override
    public void onBindViewHolder(MyrecyclerViewHolder holder, int position) {
        holder.tx_des.setText(des[position]);
        holder.tx_title.setText(place[position]);
        holder.img.setImageDrawable(pic[position]);
    }

    @Override
    public int getItemCount() {
        return LENGTH;
    }

    public class MyrecyclerViewHolder extends RecyclerView.ViewHolder {

        ImageView img;
        TextView tx_des, tx_title;

        public MyrecyclerViewHolder(View view) {
            super(view);
            img = (ImageView) view.findViewById(R.id.image_view);
            tx_des = (TextView) view.findViewById(R.id.discription);
            tx_title = (TextView) view.findViewById(R.id.tittle);
        }
  }
}

item_list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="60dp">
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/card_view"
>
 <RelativeLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     >
     <ImageView
         android:layout_width="100dp"
         android:layout_height="100dp"
         android:id="@+id/image_view"
         android:src="@drawable/a_avator"
         />
     <TextView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:id="@+id/tittle"
         android:text="@string/item_title"
         android:textStyle="bold"
         android:textAppearance="?android:textAppearanceLarge"
         android:layout_toRightOf="@+id/image_view"
         />
     <TextView
         android:id="@+id/discription"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_below="@+id/tittle"
         android:layout_toRightOf="@+id/image_view"
         android:textAppearance="?attr/textAppearanceListItem"
         />

 </RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

array.xml
    <resources>
    <string-array name="places">
    <item>Palais Garnie</item>
    <item>Piazza del Duomo</item>
    <item>Manhattan</item>
    <item>Senso-ji</item>
    <item>Sultan Ahmed Mosque</item>
    <item>Table Mountain</item>
   </string-array>
    <string-array name="place_desc">
    <item>The Palais Garnier which locates in Paris was built from 1861 for
    the Paris Opera.
    </item>
    <item>Piazza del Duomo the cathedral which locates in Florence.</item>
    <item>Manhattan is the district in New York City</item>
    <item>Senso-ji is the Shrine locates in Asakusa Tokyo</item>
    <item>Sultan Ahmed Mosque is mosque locates in Istabul, Turkey</item>
    <item>Table Mountain is mountain and park locates in Cape Town, South `
Africa.</item>
</string-array>
<string-array name="place_details">
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
    minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo `             `       `consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu  `               `       fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa `        `qui officia
    deserunt mollit anim id est laborum.
    </item>
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad `         `        `minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo `          `       `consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu   `       fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa `      `qui officia
    deserunt mollit anim id est laborum.
    </item>
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad                                  `       `minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo `                           `       `consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu             `      `fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa `       `qui officia
    deserunt mollit anim id est laborum.
    </item>
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim `          `       `minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo `       `        `consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu `      `       `fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in cu`         `       `qui officia
    deserunt mollit anim id est laborum.
    </item>
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
    deserunt mollit anim id est laborum.
    </item>
    <item>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
    eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
    nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
    irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
    deserunt mollit anim id est laborum.
    </item>
    </string-array>

    <string-array name="place_locations">
    <item>8 Rue Scribe, 75009 Paris, France</item>
    <item>Piazza del Capitolo - 50122 Florence</item>
    <item>New York City</item>
    <item>2-3-1 Asakusa, Taitō-ku, Tokyo, Japan</item>
    <item>At Meydanı No:7, 34122 Fatih/İstanbul, Turkey</item>
    <item>Cape Town, South Africa</item>
</string-array>
<array name="place_avator">
    <item>@drawable/a_avator</item>
    <item>@drawable/b_avator</item>
    <item>@drawable/c_avator</item>
    <item>@drawable/d_avator</item>
    <item>@drawable/e_avator</item>
    <item>@drawable/f_avator</item>
</array>

</resources>

strings.xml
 <resources>
<string name="app_name">Learn12</string>
<string name="action_settings">Settings</string>
<string name="item_title">Palais Garnier</string>
<string name="item_desc">The Palais Garnier which locates in Paris was built
</string>
<string name="detail_desc">Lorem ipsum dolor sit amet, consectetur
 adipisicing elit, sed doeiusmod tempor incididunt ut labore et dolore magna `    `aliqua. Ut enim ad minim veniam, quisnostrud exercitation ullamco laboris         `    `nisi ut aliquip ex ea commodo   consequat. Duis auteirure dolor in `    `           ``    `reprehenderit in voluptate velit esse cillum dolore eu    fugiat nulla `     `      `pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa    `       `qui officia
    deserunt mollit anim id est laborum.
</string>
    <string name="detail_location">"8 Rue Scribe, 75009 Paris, France"`       `      `</string>
  </resources>

Recycler_view.xml
<android.support.v7.widget.RecyclerView
 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

A: You are inflating a wrong layout item_tile.xml instead of item_list.xml to create ViewHolder View.
Change this
@Override
public MyrecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v =  LayoutInflater.from(parent.getContext()).inflate(R.layout.item_tile, parent, false);
    MyrecyclerViewHolder recyclerview = new MyrecyclerViewHolder(v);
    return recyclerview;
}

To
@Override
public MyrecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_list, parent,false);
    MyrecyclerViewHolder recyclerview = new MyrecyclerViewHolder(v);
    return recyclerview;
}


text:
Q: Calculate gradient directions using java I'm trying to code a function that calculate an orientation or gradient directions of image without using the Built-in method in boofCV library which is
 GradientToEdgeFeatures.direction(derivX,derivY,orientation);

derivX is image derivative in x-direction.
derivY is image derivative in Y-direction.
orientation is image for storing the value of gradient directions.
magnitude is image for storing the value of gradient directions.
The output from the last Built-in method for 3x3 image=
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
Orientation 1.5707964
I wrote the code for this step and also for calculating the Magnitude as following:
         for (int i = 0; i < Orientation.getHeight(); i++) {
                for (int j = 0; j < orientation.getWidth(); j++) {
                    float valueOfOrientation =  (float) ((float)Math.atan2(derivY.get(j, i), derivX.get(j, i)));
                    orientation.set(j, i,valueOfOrientation);
                    System.out.println("Orientation"+valueOfOrientation );

                   }
                }

         for (int i = 0; i < (magnitude.getHeight()); i++) {
                for (int j = 0; j <( magnitude.getWidth()); j++) {

                    float valueXMag=(float) Math.pow(derivX.get(j, i),2);
                    float valueYMag=(float) Math.pow(derivY.get(j, i),2);
                    float magnitudeValue=(float) Math.sqrt(valueXMag+valueYMag);
                    magnitude.set(j, i,magnitudeValue );
                    System.out.println("Magnitude  "+magnitudeValue);

                    }
                }

But the value of output for 3x3 Image=
Orientation-1.5707964
Orientation-1.5707964
Orientation-1.5707964
Orientation-1.5707964
Orientation0.0
Orientation-1.5707964
Orientation-1.5707964
Orientation-1.5707964
Orientation-1.5707964
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
Magnitude  0.0
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
Magnitude  1.9073486E-6
which is not equal to the Built-in method.
What is causing this and how can I solve this? Thanks in advance!
P.S Sorry for my writing mistakes. English in not my native language.


text:
Q: Can I set a POST variable before redirecting to a new page?
Possible Duplicate:
How do you POST to a page using the PHP header() function?

For example, I need to redirect a user to a different page upon error, but I also want to POST a value to that page as well.

A: You definitely cannot POST and redirect in the same time. Redirect means setting several HTTP headers. However, there are several solutions to your needs.
One is to store the data into $_SESSION and retrieve it from there, as answered above.
Another way is to put the form aside from PHP, in a separate file and include it if you have errors in the data posted, so you have all the variables in the current POST without the need to redirect the user (and set an error message in the form too).
You can think to use an AJAX to make the post and get the result back then you'll do the redirection using javascript.
Or, if there aren't many variables/values you want to pass you may use GET when doing the redirection.
I'm sure other alternatives exists too.

A: Could you use $_SESSION instead?
$_SESSION['var'] = 'foo';
//redirect

A: In the action="" html tag just put the address you are redirecting them to.  This will post the value to that page as well.

A: When a redirect is performed, a GET request is made.  I don't believe it's possible to make a POST redirect.
You could modify your code to check for both POST and GET requests by using the $_REQUEST super global variable.  That way, you can pass whatever parameters you need in the redirect as GET parameters and still have your PHP script pick them up.
But, if you are working with a multi-step form, it might be a good idea to use session variables.  This allows you to save the user's entered information from each step in the session, making it easy to load it again if they go back to a previous step.


text:
Q: $|X|=|X\cup\{a\}|?$ Let $X$ be an infinite set and $a\notin X$. Prove
$$|X|=|X\cup\{a\}|$$
This is so intuitively obvious but upon inspection it appears quite non-obvious. How might one prove this? Do I need the axiom of choice?

A: To answer the second question: yes, the axiom of choice (or rather, a weak form of it) is necessary.
It is consistent with ZF (= set theory without choice) that there is a set $X$ which is

*

*infinite, but

*cannot be put in bijection with any of its proper subsets. That is, $X$ is Dedekind-finite.
(That is, infinite but Dedekind-finite.) If $X$ is such a set, then for $a\not\in X$ we can't have $\vert X\cup\{a\}\vert=\vert X\vert$ - otherwise we'd have a bijection $f$ from $X$ to $X\cup\{a\}$, which we could turn around and restrict to a bijective map from $X$ to a proper subset of $X$ (specifically, $f^{-1}(X)$).

In fact, we can do even better (or worse :P): it is consistent with ZF that there is a set $X$ which is

*

*infinite, but

*whenever I partition $X$ into two sets ($X=Y\sqcup Z$), one piece or the other is finite!
Such sets are called amorphous, and are quite weird.

Here's an interesting further comment:

*

*On the one hand, even without choice a couple powersets fix everything: if $X$ is infinite, then $P(P(X))$ has a countably infinite subset (equivalently, $P(P(X))$ is Dedekind-infinite).

*On the other hand, sometimes one powerset isn't enough: if $X$ is amorphous, then $P(X)$ will not be amorphous, but also will not have a countably infinite subset.
These are nice exercises!

A: Via Cantor-Bernstein we just need an injective function from $X$ to $X\cup \{a\}$ and an injective function from $X\cup\{a\}$ to $X$.
an example of the first is clear, as for the second show $X$ contains a countable subset $A=\{a_1,a_2\dots a_n\dots \}$ and define the injective map $f:X\cup\{a\}\rightarrow X$ as follows:
$f(x)=x$ if $x\not\in A$, $f(a)=a_1, f(a_i)=a_{i+1}$


text:
Q: possible combinations without zeros So I am looking for a way to get possible combinations of two integers from an array, say I have
v = [0, 1, 2, 0, 4]

I would like at the end, conceptually a matrix like this, C = v^T v  where v^T is the Transpose of the vector so you get a matrix with some nonzeros and the entries will be the combinations of two integers. For row 1 for instance,
(0,0) (1,1) (1,2) (0,0) (0,4)

but I only need (1,1) (1,2) also similar reasoning holds for the other rows in my conceptual matrix visualisation. I can do this by two nested loops by checking if they include 0 or not. Question is: are there some algorithms for these kinds of combinatorial tasks that would do that better than nested loops?

A: There is no way to generate this output "matrix" without a 2D nested loop (or something directly equivalent).  So given you'll have the loops anyway, it's trivial to add the conditional checking.
I suppose you could pre-sort the array, and then start your loop counters at the first non-zero value...

A: Depending on how many zeroes you have, you could use a sparse matrix data structure and that may reduce the problem from O(n^2) to something slightly smaller (depending on how many zeroes you have).
If you ignore the zeroes for a second, N choose 2 combinations is equal to n^2/2-n/2 combinations.  Similarly there are n*(n-1) 2-permutations of n.  So no matter whether you are doing combinations or permutations, you still need an algorithm that is worst case O(n^2).  Note your matrix would possibly be symmetric depending on certain assumptions, but that would not be enough to change it from O(n^2) because it would essentially be O((n/2)^2) which is still O(n^2).


text:
Q: Como usar um estilo externo(pronto) de CSS no código HTML? Minha dúvida é a seguinte, tenho um código HTML que estou usando para aprender nas aulas do meu curso. Então após a aula de CSS quis usar um dos modelos utilizados durante a explicação no meu código. Coloquei a pasta com o estilo dentro da pasta que o HTML está. Logo, eu escrevi o seguinte código:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Loja X-Sobre</title>

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

Loja X

Bem-vindo à Loja X, a sua loja de eletro-eletrônicos!

Confira nossas promoções.

Fique por dentro de nossos lançamentos.

Veja nosso catálogo.

Faça logo a sua lista de compras.

Ache o Olie

Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Texto Texto TextoTextoTexto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto
    Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto TextoTexto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto Texto

Creio que seja algo no head. Podem me ajudar ?
O código CSS abaixo:
========================================================================
/* Stylesheet 2: */
body {
    font-family: Arial;
    background-color: #d14836;
    line-height: 20px;
}

.wrapper {
    position: relative;
    overflow: auto;
}

header {
    color: #ffffff;
    padding: 15px;
    font-size: 30px;
    line-height: 26px;
}

header h1 {
    margin:0;
    line-height: 50px;
}

nav {
    width: 190px;
    float: right;
}

#main {
    padding: 10px;
    background-color: #ffffff;
    font: 80% Verdana;
}

#main h1, #main h2 {
    color: #d14836;
}

aside {
    background-color: #F6DAD7;
    color: #d14836;
    padding: 10px;
}

footer {
    text-align: center;
    padding: 10px;
    font-size: 70%;
    color: #ffffff;
}

#menulist {
    padding:0;
    font: 16px verdana;
}

.menuitem {
    width: 155px;
    background-color: #d14836;
    border: 1px solid #d14836;
    border-radius: 40px;
    color: #ffffff;
    list-style-type: none;
    margin: 10px;
    padding: 5px;
    text-align: center;
    cursor: pointer;
}

.menuitem:nth-child(2) {
background-color:white;
color: #d14836;
font-weight:bold;
}

.menuitem:hover {
    background-color: #ffffff;
    color: #d14836;
}

a {
    color: #d14836;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

A: O problema foi resolvido com uma mudança nas pastas onde o código html se encontra. Com esse ajuste pude diminuir em 1x o caminho do CSS e assim pude utilizalo de forma correta no meu código.
Desde já, obrigado aos que me ajudaram. Até a próxima!

A: use um <link rel="stylesheet" type="text/css" href="exemplo.css">
dentro do


text:
Q: How to step-down voltage without a transformer? Say I am running a line from a transformer to a distribution panel that doesn't quite need 240V but less. How do you go about creating the required voltage drop?
I was asked this in a interview for my internship and he told me the answer to that is thicker ground wire?

A: Change the tapping on the transformer.

A: The only way to step down voltage without a transformer, is to add resistance to the circuit, whether that is by adding more length to the feeder, which would increase voltage drop,or by adding a resistor in the circuit. Either way, you are adding resistance, but with the resistor, you dont need more wire.

A: None of the answers are accepted or have any upvotes, and this question was bumped accordingly. So, I see no reason not to try a different answer.
I suppose a capacitive divider could be used in such a case?

It is not a great solution, but then again, it seems as if the question itself was not very well thought out. At least, it is a technically feasible and somewhat plausible approach that answers the question as posed.

A: In general, this does require a transformer.  However, the transformer that you use doesn't have to be rated for the full power of the load.  In other words, you can usually get by with a much smaller transformer.
Do a Google search for the word "autotransformer".  This is a transformer that either has a single winding that has a tap part way up the winding OR is a transformer where the secondary winding is in series with the incoming voltage.  The advantage of the 2nd configuration is that the transformer can be configured as a Boost or a Buck transformer just changing the phase relationship of the primary and secondary winding.
Note that the primary winding does NOT have to handle the full current of your load.  Only the secondary winding does.
Your situation is a common requirement for doing 208 Vac to 240 Vac conversion.  A single-winding 240V autotransformer with a tap at 208V is readily available from most electrical suppliers.
You can approximate the same thing by using a power transformer with 208V or 240V input (depending upon whether your input voltage is 208V or 240V) and then connecting the secondary winding in series with the input and then to your load.
Let's do a practical example.  You have a piece of equipment requiring 240 Vac and your building supply is 208 Vac 3-phase.  Your normal 120V loads aren't a problem because the phase-to-neutral voltage is 120 Vac.  But you've got this 240V load that just won't work properly from 208V.
Choose a transformer with a SECONDARY current rating greater than your connected load.  The primary voltage will be 208V and a very common secondary voltage is 24V.  208V + 24V is 232V.  This is well within the allowable range of your equipment.
Let's go further and assume that you want to have a full-load current rating of 15 Amps.  You will choose a transformer who's secondary winding is good for that current (or more).  The power rating of the transformer is (24V) * (15A) or 360 VA.  You will probably wind up purchasing a transformer rated at 500 VA, which is actually good for slightly more than 20 Amps.
But: note that the transformer is much smaller than you would think.  If your transformer had to handle the full 240V @ 15A, it would have to be rated at 3600 VA.  But because the transformer is handling only the difference in voltage rather than the full voltage, it can be much smaller.


text:
Q: Not able to fetch facebook profile album in andorid I am making an application in which I want to fetch the profile pictures of a facebook user. I tried to fetch the albums from facebook but I am getting null response from the facebook server.
I have tried it with multiple users but its not working.Can anyone help me?
here is my code:
mAsyncRunner.request(fbuserid+"/albums", new RequestListener()
{
    @Override
    public void onComplete(String response, Object state)
    {
        try
        {
            JSONObject albumjson = Util.parseJson(response);
            JSONArray albums = albumjson.getJSONArray("data");
            for (int i =0; i < albums.length(); i++)
            {
                JSONObject album = albums.getJSONObject(i);
                String album_name = album.getString("name");
                String album_id = album.getString("id");

                System.out.println("albumname  "+album_name +album_id);
            }
        }
        catch (JSONException e)
        {
            e.printStackTrace();
        }
    }
    @Override
    public void onIOException(IOException e, Object state)
    {
    }

    @Override
    public void onFileNotFoundException(FileNotFoundException e,Object state)
    {
    }

    @Override
    public void onMalformedURLException(MalformedURLException e,Object state)
    {
    }

    @Override
    public void onFacebookError(FacebookError e, Object state)
    {
    }
});

A: You should try to get by below code:
If you have album id then
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{album-id}/photos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();

And If it's for a particular person then
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/photos",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();

For this you need to set Permissions
1) Any valid access token if the photos are public.
2) A user access token user_photos permission to retrieve any photos that the session user has uploaded that are not public.
Reference : https://developers.facebook.com/docs/graph-api/reference/v2.0/album/photos
Hope it will help.
For detailed explanation please refer below link :
iOS : Facebook Album Photos Picker


text: Q: How to simulate microsoft surface dial event? Microsoft has introduced a new peripheral called Surface Dial. I know there are ways to simulate mouse and keyboard events but I can't find any api to simulate Surface Dial event. Basically, I want to do things like Ctrl+Shift+L would trigger counterclockwise rotation event.


text:
Q: Woocommerce Product permalinks "product" word is not working I have facing one issue with Woocommerce Product permalinks.
When I used the "Product" keyword on Product permalinks at that time product detail page came with 404 not found.


text:
Q: WatiN clear browser cache It seems the ClearCache method doesn't quite work for IE in WatiN. at least, it doesn't work for things you've cached SINCE you've opened the instance.
Any suggestions?
I tried using ReOpen, but it errors. It also seems to do the same thing as
Browser.Close();
Browser = new IE();

Which is slow. My tests take just about twice as long to run doing it that way (which is the only current workaround for clearing the cache).
Thanks in advance.

A: Go through this url this will help you.
http://jawedm.blogspot.com/2009/08/working-with-cookies-and-caches-using.html
using(IE ie = new IE())
{
ie.ClearCache();
ie.ClearCookies();

}


text:
Q: Syntax Error For Exponential Growth Program I am working on a calculator program for a geometry midterm project. It involves making 5 programs for commonly used equations. One of my programs is exponential growth. The prompts in the beginning appear and work, but when I try to have the program solve the equation, a Syntax Error pops up.
I am using the TI-84 Plus calculator and the TI Connect CE software to do the programming.
My code:
Lbl 4
ClrHome
0→I
0→G
0→O
Input "ORIGINAL AMT.=",I
Input "GROWTHRATE(Dec.)=",G
Input "PERIOD OF TIME=",Q
Goto M
Lbl M
ClrHome
Output(I(1+G))^(Q)
Pause
ClrHome
Menu("TRY AGAIN?","YES",4,"NO",6)

Any help would be greatly appreciated.

A: You are using the mistakenly using the Output( command instead of Disp. Try replacing Output(I(1+G))^(Q) with Disp I(1+G)^Q like so:
Lbl 4
Input "ORIGINAL AMT.=",I
Input "GROWTHRATE(Dec.)=",G
Input "PERIOD OF TIME=",Q
ClrHome
Disp I(1+G)^Q
Pause
ClrHome
Menu("TRY AGAIN?","YES",4,"NO",6


text:
Q: Getting Illegal Argument Exception: addAppToken Invalid stackId while launching a activity I am trying to open an Activity from another Activity using the flag CLEAR_TASK, but sometimes I am getting an exception.

java.lang.IllegalArgumentException: addAppToken: invalid stackId=1

It's a intermittent issue and is not happening every time.
Intent intent1 = new Intent(ActivityA.this, ActivityB.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);

startActivity(intent1);

My ActivityA is a SingleInstance and ActivityB is a SingleTask.

A:
If set in an Intent passed to Context.startActivity(), this flag will cause any existing task that would be associated with the activity to be cleared before the activity is started. That is, the activity becomes the new root of an otherwise empty task, and any old activities are finished. This can only be used in conjunction with FLAG_ACTIVITY_NEW_TASK.

http://developer.android.com/reference/android/content/Intent.html

A: I found same error like you.and finally i knew why,just because i start same activity twice at same time.
but there something bothers me.
i develop a launcher app,this error only occurred when i boot or reboot my device,after i exited my app,then restart it,everything runs good,even this wrong code still there.


text:
Q: Mongoose query inside a loop I'm trying to develop a simple application with mongoose.
Given an array of username 'group.contacts', I want to get the corresponding IDs of these user. However, the loop does not work as expected: the loop continues before the .find() method finish so I cannot get all the IDs of people. How can I solve this problem?
for(var v = 0; v < group.contacts.length; v++) {
    PersonModel.find({
        name: group.contacts[v]
    }, function (err, person) {
        if(!err && person) {
            console.log('Found ' + person._id + ' ' + v);
        }

    });
}

A: Try this:
PersoModel
.where('name').in(group.contacts)
.exec(function(person){
   console.log('Found ' + person._id + ' ' + person.name);
});


text:
Q: HTTP GET with VBA and special characters in URL I'm trying to communicate with Google Distance API via VBA in 64bit Excel 365, but having trouble with special character input in street address data. Other threads having similar issues with other HTTP requests, though with output and I struggle to relate.
Sub Check_routes()

Dim objRequest, Json As Object
Dim apiKey, apiURL, myOrigin, myDest As String

Set objRequest = CreateObject("MSXML2.XMLHTTP")

myOrigin = "Tähetorni+1+Tallinn"
myDest = "Sääse+2+Tallinn"
apiURL = "https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=" & myOrigin & "&destinations=" & myDest & "&mode=driving&key=" & apiKey

objRequest.Open "GET", apiURL, False
objRequest.send

...

Set objRequest = Nothing

End Sub

I'm getting an error response in JSON back stating Invalid 'origins' parameter. The problem is special character ä in origin & destination. Replacing this with a fixes it, but that's not a reliable solution. Is my problem string not being UTF-8 as Google stipulates?
https://developers.google.com/maps/documentation/distance-matrix/web-service-best-practices#BuildingURLs
Power Query in Excel environment is also perfectly capable in communicating with Google Distance API and has no problem handling special characters - and is a more convenient tool on top of that, however annoyingly generates duplicate requests which is less than ideal with a paid API such as Google Distance. That's the lone reason for going with VBA here.
Is this a MSXML2.XMLHTTP object problem which cannot handle my input string as is?

A: I suggest you change these two lines in your code:
myOrigin = WorksheetFunction.EncodeURL("Tähetorni 1 Tallinn")
myDest = WorksheetFunction.EncodeURL("Sääse 2 Tallinn")

Your code returns a valid string with those changes (also note I replaced the + with <space> as the function will take care of encoding that also).
By the way, you need to specify data type for each element in a declaration string.  They will NOT take the data type of the last element. Rather they will be of type Variant when not specified.
So change these lines also:
Dim objRequest as Object, Json As Object
Dim apiKey as String, apiURL as String, myOrigin as String, myDest As String


text:
Q: Doctrine merge error I'm using Slim Framework, Doctrine and Twig for a small application. Everything works perfect until I tried storing an entity in a session.
Type: ErrorException
Code: 4096
Message: Object of class Doctrine\Models\PeopleGlobal\Code could not be converted to string
File: /var/www/app/vendor/slim/slim/Slim/Log.php
Line: 309
Trace

#0 /var/www/app/vendor/slim/slim/Slim/Log.php(309): Slim\Slim::handleErrors(4096, 'Object of class...', '/var/www/app/ve...', 309, Array)
#1 /var/www/app/vendor/slim/slim/Slim/Log.php(203): Slim\Log->log(7, Object(Doctrine\Models\PeopleGlobal\Code), Array)
#2 /var/www/html/index.php(36): Slim\Log->info(Object(Doctrine\Models\PeopleGlobal\Code))
#3 [internal function]: Doctrine\Models\PeopleGlobal\{closure}()
#4 /var/www/app/vendor/slim/slim/Slim/Route.php(462): call_user_func_array(Object(Closure), Array)
#5 /var/www/app/vendor/slim/slim/Slim/Slim.php(1326): Slim\Route->dispatch()
#6 /var/www/app/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#7 /var/www/app/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#8 /var/www/app/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#9 /var/www/app/vendor/slim/slim/Slim/Slim.php(1271): Slim\Middleware\PrettyExceptions->call()
#10 /var/www/html/index.php(115): Slim\Slim->run()
#11 {main}

The exception is thrown on the following line: "$code = $entityManager->merge($code);"
if (isset($_SESSION['code']) && $_SESSION['code'] instanceOf Code) {
  $app->log->info("Event: Session contains code.");

  $code = $_SESSION['code'];
  $code = $entityManager->merge($code);

  $global_event = $code->getGlobalEvent();

  $app->render('event.html', array(
    'global_event' => $global_event,
    'code' => $code
  ));
}

Looking forward to some help? Any other information you require?
Thanks!


text:
Q: Filter by dynamic properties I have a generic method that filters a List dynamically, I recently updated my project to NetCore 3.0 and after that the method is not working
Here is the error that I got when method is called.
System.InvalidOperationException: 'The LINQ expression 'Where<Provincia>(
    source: OrderBy<Provincia, string>(
        source: DbSet<Provincia>,
        keySelector: (p) => p.Identificador),
    predicate: (p) => p.GetType().GetProperty((Unhandled parameter: __prop_0)).GetValue(
        obj: (object)p,
        index: null).ToString() == (Unhandled parameter: __value_1))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'

Here is my method
public static IQueryable<T> FilerByProperties(string properiesFilter, IQueryable<T> query)
{
    if (properiesFilter == null) properiesFilter = "";
    string[] properties = properiesFilter.Split(";");

    for (int i = 0; i < properties.Length; i++)
    {
        if(!properiesFilter.IsNullOrEmpty())
        {
            int pocisionProp = properties[i].ToString().IndexOf('=');
            string prop = properties[i].Substring(0, pocisionProp);
            string value = properties[i].Substring(pocisionProp + 1);

            if (typeof(T).GetProperty(prop) != null)
            {
                query = query.Where(x => x.GetType().GetProperty(prop).GetValue(x, null).ToString() == value);
            }
        }
    }
    return query;
}

And I used it like that
public override Task<PagedResultDto<ProvinciaDto>> GetAllAsync(PagedAndSortedRequest input)
{
    var lista = new List<Provincia>();
    var query = Repository.GetAllIncluding(x => x.Pais);

    query = CreateFilteredQuery(input);
    query = ApplySorting(query, input);
    query = FilterHelper<Provincia>.FilerByProperties(input.FilterProperties, query);

    lista = query
        .Skip(input.SkipCount)
        .Take(input.MaxResultCount)
        .ToList();

    var result = new PagedResultDto<ProvinciaDto>(query.Count(), ObjectMapper.Map<List<ProvinciaDto>>(lista));
    return Task.FromResult(result);
}

In input.FilterProperties i'm recieving "PaisId=1" and in this case I need to filter the Provincias
which has "PaisId=1"
I Hope you could help me.

A: Lambda expressions should do the trick for you here.
Helper classes
public static class ExpressionBuilder
{
    public static Expression<Func<T, bool>> GetExpression<T>(IList<DynamicFilter> filters)
    {
        if (filters.Count == 0)
            return null;

        ParameterExpression param = Expression.Parameter(typeof(T), "t");
        Expression exp = null;

        if (filters.Count == 1)
        {
            exp = GetExpression<T>(param, filters[0]);
        }
        else if (filters.Count == 2)
        {
            exp = GetExpression<T>(param, filters[0], filters[1]);
        }
        else
        {
            while (filters.Count > 0)
            {
                var f1 = filters[0];
                var f2 = filters[1];

                exp = exp == null
                    ? GetExpression<T>(param, filters[0], filters[1])
                    : Expression.AndAlso(exp, GetExpression<T>(param, filters[0], filters[1]));

                filters.Remove(f1);
                filters.Remove(f2);

                if (filters.Count == 1)
                {
                    exp = Expression.AndAlso(exp, GetExpression<T>(param, filters[0]));
                    filters.RemoveAt(0);
                }
            }
        }

        return Expression.Lambda<Func<T, bool>>(exp, param);
    }

    private static Expression GetExpression<T>(ParameterExpression param, DynamicFilter filter)
    {
        MemberExpression member = Expression.Property(param, filter.PropertyName);
        ConstantExpression constant = Expression.Constant(filter.Value);

        return Expression.Equal(member, constant);
    }

    private static BinaryExpression GetExpression<T>(ParameterExpression param, DynamicFilter filter1, DynamicFilter filter2)
    {
        Expression bin1 = GetExpression<T>(param, filter1);
        Expression bin2 = GetExpression<T>(param, filter2);

        return Expression.AndAlso(bin1, bin2);
    }
}

public class DynamicFilter
{
    public string PropertyName { get; set; }
    public object Value { get; set; }
}

Using it with the code that you posted:
    public static IQueryable<T> FilerByProperties(string properiesFilter, IQueryable<T> query)
    {
        if (properiesFilter == null) properiesFilter = "";
        string[] properties = properiesFilter.Split(";");

        var filters = new List<DynamicFilter>();
        for (int i = 0; i < properties.Length; i++)
        {
            if (!properiesFilter.IsNullOrEmpty())
            {
                int pocisionProp = properties[i].ToString().IndexOf('=');
                string prop = properties[i].Substring(0, pocisionProp);
                object value = properties[i].Substring(pocisionProp + 1);

                if (typeof(T).GetProperty(prop) != null)
                {
                    var badWayBuySomeWay = 0;
                    if(Int32.TryParse(value.ToString(), out badWayBuySomeWay))
                    {
                        value = badWayBuySomeWay;
                    }
                    var filter = new DynamicFilter { PropertyName = prop, Value = value };
                    filters.Add(filter);
                }
            }
        }

        if (filters.Count > 0)
        {
            var deleg = ExpressionBuilder.GetExpression<T>(filters).Compile();
            return query.Where(deleg).AsQueryable();
        }

        return query;
    }


text:
Q: Select and group KonvaJS objects not working I want to create a "select and group" functionality for my KonvaJS application.
For the select functionality, I'm using this example that works well:
selecting by drawing a box around objects in konva
But the group function is not working as I expect. This is what's happening:
Example
First I create an empty group like this:
selectGroup = new Konva.Group({
    x: 50,
    y: 50,
    draggable: true
});

When a shape is hit I add it like this:
selectGroup.add(shapeObject);

And when I finish the selection I call the Transform functionality like this:
var tr = new Konva.Transformer();
layer.add(tr);
tr.attachTo(selectGroup);
layer.draw();

I don't why when I add a shape it disappears. And when I finish and I call the transform functionality it doesn't seem to be working.
Any ideas?

A: Thanks to lavrton I saw that the problem was that I didn't add the selectGroup to the layer.
Right now is working fine. Problem fixed.


text:
Q: psql: Relation does not exist I get the following error:
test=# Select * from Venue;
ERROR:  relation "venue" does not exist
LINE 1: Select * from Venue;

But as you can see here the table exist:

I have already spent more than 2 hours, and I cant find my error


text:
Q: /etc/passwd continually accessed I'm running a server on EC2 (Cent OS, 2.6.35.14, x86_64), and I recently went over my 1 million I/Os per month quota, which is absurd, as my disk utilization shouldn't be anywhere near that.  (I'm not running any services that should require much disk access.... or even any disk access)
My first thought was to fire up iotop, and see if there were any processes continually writing out to disk.  iotop showed me that a process named jbd2 was writing out to disk more than once a minute.
After some googling around, it appeared that the problem is either a kernel bug, or some daemon touching the disk regularly.
I installed inotify-tools and started an inotifywait on the entire filesystem;
sudo /usr/local/bin/inotifywait -m -r /!(dev|proc)

And what this showed is that /etc/passwd is being opened, accessed, and then closed, multiple times a minute.  Without me doing anything else on the system!  inotify doesn't tell you what process is doing the touching, but I installed audit (http://people.redhat.com/sgrubb/audit/), setup some logging on /etc/passwd and let it run for a little while, and then took a look at the logs, but all they tell me is that it's being accessed by sudo: (username redacted)
type=SYSCALL msg=audit(10/03/2011 17:48:30.493:260) : arch=x86_64 syscall=open success=yes exit=4 a0=7f809205669a a1=80000 a2=1b6 a3=0 items=1 ppid=6466 pid=6467 auid=**** uid=root gid=**** euid=root suid=root fsuid=root egid=**** sgid=**** fsgid=**** tty=pts0 ses=79 comm=sudo exe=/usr/bin/sudo key=(null)
type=SYSCALL msg=audit(10/03/2011 17:48:30.493:261) : arch=x86_64 syscall=open success=yes exit=4 a0=7f809205669a a1=80000 a2=1b6 a3=0 items=1 ppid=6466 pid=6467 auid=**** uid=root gid=**** euid=root suid=root fsuid=root egid=**** sgid=**** fsgid=**** tty=pts0 ses=79 comm=sudo exe=/usr/bin/sudo key=(null)
type=SYSCALL msg=audit(10/03/2011 17:48:30.488:256) : arch=x86_64 syscall=open success=yes exit=3 a0=7f809205669a a1=80000 a2=1b6 a3=0 items=1 ppid=6441 pid=6466 auid=**** uid=**** gid=**** euid=root suid=root fsuid=root egid=**** sgid=**** fsgid=**** tty=pts0 ses=79 comm=sudo exe=/usr/bin/sudo key=(null)
...

Is there any way to narrow this down further?  I have nothing in my cron files, and no other services that I can think of that would be causing this:
chkconfig | grep on
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
cgconfig        0:off   1:off   2:off   3:off   4:off   5:off   6:off
cloud-init      0:off   1:off   2:on    3:on    4:on    5:on    6:off
cloud-init-user-scripts 0:off   1:off   2:on    3:on    4:on    5:on    6:off
conman          0:off   1:off   2:off   3:off   4:off   5:off   6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off
irqbalance      0:off   1:off   2:off   3:on    4:on    5:on    6:off
lvm2-monitor    0:off   1:on    2:on    3:on    4:on    5:on    6:off
mdmonitor       0:off   1:off   2:on    3:on    4:on    5:on    6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
restorecond     0:off   1:off   2:off   3:off   4:off   5:off   6:off
rsyslog         0:off   1:off   2:on    3:on    4:on    5:on    6:off
sendmail        0:off   1:off   2:on    3:on    4:on    5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
udev-post       0:off   1:on    2:on    3:on    4:on    5:on    6:off
yum-updatesd    0:off   1:off   2:on    3:on    4:on    5:on    6:off

A: As you are using CentOS, you should be able to find out what sudo is doing by looking in /var/log/secure e.g.
sudo tail /var/log/secure

Oct  4 03:45:44 ec2-centos-instance sudo:     iain : TTY=pts/0 ;
  PWD=/home/iain ; USER=root ; COMMAND=/usr/bin/tail /var/log/secure

Edit: Updating with answer from comments
Enabling block dump with:echo 1 > /proc/sys/vm/block_dump and take a look at it with dmesg helped track down which processes were accessing the disk. Much more reliable than iotop. Turns out, sar was running continually, writing out to /var/log/sa/saXX so I disabled that in cron.d, and all is well again

A: It sounds like you have a script or program that is using sudo to try and do stuff as root.  You can enable logging in sudo to figure out what they are trying to do and come up with a better solution (perhaps a setuid binary is in order).  Here is more info on sudo (like how to enable logging):
http://aplawrence.com/Basics/sudo.html


text:
Q: Django Form "'ForwardManyToOneDescriptor' object has no attribute 'all'" I'm having quite some problems. In effect trying to add a form to a home-page with options for a user to select based on a DB object. Then once submitted the page will refresh, and the form can be used again.
Forms.py:
rom django import forms
from django.forms import ChoiceField, ModelForm, RadioSelect
from .models import command_node

class command_form(ModelForm):
    class Meta:
        model = command_node
        fields = (
            'host_id',
            'current_commands'
        )

        host_id = forms.ModelChoiceField(
            required=True,
            queryset=command_node.host_id,
            widget=forms.Select(
                attrs={
                    'class': 'form-control'
                },
            )
        )

        current_comamnds = forms.ChoiceField(
            required=True,
            attrs={
                'class': 'form-control'
            },

            choices=[
                ('Sleep', "Sleep"),
                ('Open SSH_Tunnel', 'Open SSH_Tunnel'),
                ('Close SSH_Tunnel', 'Close SSH_Tunnel'),
                ('Open TCP_Tunnel', 'Open TCP_Tunnel'),
                ('Close TCP_Tunnel', 'Close TCP_Tunnel'),
                ('Open Dynamic', 'Open Dynamic'),
                ('Close Dynamic', 'Close Dynamic'),
                ('Task', 'Task'),
            ])

Models.py:
from tkinter import CASCADE
from turtle import update
from django.db import models

class beacon(models.Model):
    host_id = models.BigAutoField('Id', primary_key=True)
    hostname = models.CharField('Hostname', max_length=200)
    internalIp = models.CharField('Internal-IP', max_length=200)
    externalIp = models.CharField('External-IP', max_length=200)
    current_user = models.CharField('Current_User', max_length=200)
    os = models.CharField('OS', max_length=200)
    admin = models.CharField('Admin', max_length=200)

    def __str__(self):
        return self.hostname

class command_node(models.Model):
    host_id = models.ForeignKey(beacon, on_delete=models.CASCADE)
    current_commands = models.CharField('current_command', max_length=50, null=True)
    previous_commands = models.CharField('previous_commands', max_length=2000, null=True)

    def __str__(self):
        return str(self.host_id)

views.py:
from django.shortcuts import render
from django.http import HttpResponse
from .models import beacon
from .models import command_node
from .forms import command_form
from django.http import HttpResponseRedirect

def home(request):
    form = command_form,
    if request.method == "POST":
            form = form(request.POST)
            if form.is_valid():
                form.save()
                return render(request, 'home.html', context)
    context = {'form':form},
    return render(request, 'home.html', context)

Relevant HTML section:
</br>
</br>
    <form action="" method=POST>
        {% csrf_token %}
        {{ form.as_p }}
        {{form}}
        <button type="Submit" class="btn btn-secondary btn-sm">Submit</button>
    </form>
</body>
</html>

urls.py:
from django.contrib import admin
from django.urls import path
from django.urls import include, re_path
from .forms import command_node
from . import views

urlpatterns = [
    re_path('home/', views.home)
]

When I attempt to run the server or even now migrate I get the following.
PS C:\Python-projects\commandsite> python manage.py makemigrations
Traceback (most recent call last):
  File "C:\Python-projects\commandsite\manage.py", line 22, in <module>
    main()
  File "C:\Python-projects\commandsite\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 414, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 455, in execute
    self.check()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 487, in check
    all_issues = checks.run_checks(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\urls.py", line 24, in check_resolver
    return check_method()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 480, in check
    for pattern in self.url_patterns:
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 696, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\functional.py", line 49, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 689, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Python-projects\commandsite\commandsite\urls.py", line 22, in <module>
    re_path('website/', include('website.urls'))
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\conf.py", line 38, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Python-projects\commandsite\website\urls.py", line 4, in <module>
    from .forms import command_node
  File "C:\Python-projects\commandsite\website\forms.py", line 6, in <module>
    class command_form(ModelForm):
  File "C:\Python-projects\commandsite\website\forms.py", line 7, in command_form
    class Meta:
  File "C:\Python-projects\commandsite\website\forms.py", line 14, in Meta
    host_id = forms.ModelChoiceField(
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\forms\models.py", line 1463, in __init__
    self.queryset = queryset
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\django\forms\models.py", line 1488, in _set_queryset
    self._queryset = None if queryset is None else queryset.all()
AttributeError: 'ForwardManyToOneDescriptor' object has no attribute 'all'
PS C:\Python-projects\commandsite>

This was all working before I attempted to add a form in. Since tinkering with it to try and get a form this is the issue I face. So any help would be Greatly appericated. As I don't know what I've done wrong.

A: Looking at your code, the error is raised because you're specifying queryset=command_node.host_id in your form:
    host_id = forms.ModelChoiceField(
        required=True,
        queryset=command_node.host_id,
        widget=forms.Select(
            attrs={
                'class': 'form-control'
            },
        )
    )

Actually, command_node.host_id is a ForwardManyToOneDescriptor (this is the class assigned to fields that are marked as ForeignKey). In this case, what you want to supply as the queryset parameter is a set of objects that should belong to the model beacon which is the onea associated to host_id:
    host_id = forms.ModelChoiceField(
        required=True,
        queryset=beacon.objects.all(),
        widget=forms.Select(
            attrs={
                'class': 'form-control'
            },
        )
    )

This will display all beacon objects in your DB as options in a dropsdown in your form (the widget used is a Select). You could also display any queryset related to the beacon model. For example if you wanted to display only the beacon objects that have an internal IP equal to X.Y.Z.W you could sepecify queryset=beacon.objects.filter(internalIP="X.Y.Z.W").
Some things to note here:

*

*Django already uses a ModelChoiceField when displaying the available options for fields that rely on a ForeignKey. You can check the associations Django makes between Model fields and Form fields here: https://docs.djangoproject.com/en/4.0/topics/forms/modelforms/#field-types. If you want all beacon objects to be able for selection in your form, your code could be simplified to:

class command_form(ModelForm):
    class Meta:
        model = command_node
        fields = (
            'host_id',
            'current_commands'
        )

        current_comamnds = forms.ChoiceField(
            required=True,
            attrs={
                'class': 'form-control'
            },

            choices=[
                ('Sleep', "Sleep"),
                ('Open SSH_Tunnel', 'Open SSH_Tunnel'),
                ('Close SSH_Tunnel', 'Close SSH_Tunnel'),
                ('Open TCP_Tunnel', 'Open TCP_Tunnel'),
                ('Close TCP_Tunnel', 'Close TCP_Tunnel'),
                ('Open Dynamic', 'Open Dynamic'),
                ('Close Dynamic', 'Close Dynamic'),
                ('Task', 'Task'),
            ])

*

*A common practice in Python (and therefore in Django too) is to write class names in UpperCaseCamelCase instead of snake_case (see https://visualgit.readthedocs.io/en/latest/pages/naming_convention.html#classes). If you adopt this naming convention, differentiating the class from its instances is easier.


text:
Q: Minimal relations to generate wallpaper symmetry groups For a given wallpaper symmetry group, it seems like there should be a minimal set of group element relations that generate the symmetry group. For example, the p1 symmetry group only has translational symmetry, so I can say that the group is generated by the elements $T_x$ and $T_y$, with the relation $T_x T_y T_x^{-1} T_y^{-1} = 1$. I would like to know if such a description exists for the other 16 wallpaper groups. Clearly for a given symmetry group, I could write down all the various transformations in that group (translations, reflections, rotations, glide reflections, etc.) and start pairing up different transformations to derive various relations, but it's not clear to me at what point my list of relations become necessary and sufficient for specifying the wallpaper group under consideration.
The closest question I've found to this is here, but the answer refers to a thesis written in German so I can't fully understand it. There is a section from the referenced thesis that seems relevant to my question, which seems to specify the symmetry groups in terms of group relations:

but as far as I can tell, gives no indication of what the variables correspond to in terms of concrete symmetry transformations (except for $x$ and $y$, which I'm assuming are translations).


text:
Q: When to apply complex integration for integral resolutions
Is there a criterion, a clue that makes me think that certain integrals can also be solved through complex integration and how to solve them?

When I can't solve an integral for my students of a high school, I use the numerical methods.
If I have these integrals how are they solved used the complex integrations?
First integral: $${\displaystyle\int_0^{2\pi}}\dfrac1{2\cos\left(x\right)+5}\,\mathrm{d}x={\displaystyle\int_0^{2\pi}}\dfrac{\sec^2\left(\frac{x}2\right)}{3\tan^2\left(\frac{x}2\right)+7}\,\mathrm{d}x \tag 1$$
I remember that $-2\leq 2\cos x\leq 2 \to 0<3\leq 2\cos x+5\leq 7$. Hence $2\cos x+5\neq 0, \forall x\in\Bbb R$.
Using the substitution $t=\dfrac{\sqrt{3}\tan\left(\frac{x}2\right)}{\sqrt{7}}$
I will have
$$\mathrm{d}x=\dfrac{2\sqrt{7}}{\sqrt{3}\sec^2\left(\frac{x}2\right)}\,\mathrm{d}t$$
Starting from the $(1)$ I will have $$(1)={\displaystyle\int_0^{2\pi}}\dfrac{2\sqrt{7}}{\sqrt{3}\left(7t^2+7\right)}\,\mathrm{d}t$$
and with easy steps I have:
$$=\left[\dfrac{2\arctan\left(\frac{\sqrt{3}\tan\left(\frac{x}2\right)}{\sqrt{7}}\right)}{\sqrt{21}}\right]_0^{2\pi}=\dfrac{2{\pi}}{\sqrt{21}}$$
Second integral: remember that $(x^2+1)^2\ne 0, \forall x\in\Bbb R$.
$$\displaystyle\int\limits^{+\infty}_{-\infty} \dfrac{\mathrm{d}x}{\left(x^2+1\right)^2}$$
Apply reduction formula:
$$\small{{\displaystyle\int}\dfrac1{\left(\mathtt{a}x^2+\mathtt{b}\right)^{\mathtt{n}}}\,\mathrm{d}x=\class{steps-node}{\cssId{steps-node-1}{\dfrac{2\mathtt{n}-3}{2\mathtt{b}\left(\mathtt{n}-1\right)}}}{\displaystyle\int}\dfrac1{\left(\mathtt{a}x^2+\mathtt{b}\right)^{\class{steps-node}{\cssId{steps-node-2}{\mathtt{n}-1}}}}\,\mathrm{d}x+\dfrac{x}{2\mathtt{b}\left(\mathtt{n}-1\right)\left(\mathtt{a}x^2+\mathtt{b}\right)^{\class{steps-node}{\cssId{steps-node-3}{\mathtt{n}-1}}}}}$$
I have:
$$\begin{aligned}&=\dfrac{x}{2\left(x^2+1\right)}+\dfrac12\int_{-\infty}^{+\infty}\frac1{x^2+1}\,\mathrm{d}x\\&=\lim_{p\to+\infty}\left[\dfrac{\arctan\left(x\right)}2+\dfrac{x}{2\left(x^2+1\right)}\right]_{-p}^p=\frac \pi2\end{aligned}$$
Third example: Obviously it must be $\sqrt{x}\left(x+1\right) \neq 0 \iff x>0$
$${\displaystyle\int_0^{+\infty}}\dfrac1{\sqrt{x}\left(x+1\right)}\,\mathrm{d}x$$
If I take $t=\sqrt{x} \to \mathrm{d}x=2\sqrt{x}\,\mathrm{d}t$. When with simple steps I will find
$$=\lim_{p\to+\infty}\left[2\arctan\left(\sqrt{x}\right)\right]_0^p=\pi$$
Thank you all very much and I hope always the best for all users.

A: One suggestive principle is this.  To evaluate the integral $\int_a^b f(x)\;dx$ by complex contour integral methods, it is (usually) required that $a$ and $b$ are "special" points for the function $f$:  for example, poles or branch points.
For example,
$$
\int_{-1}^1\frac{dx}{\sqrt{1-x^2}}
\tag1$$
is a good candidate, since $\pm1$ are branch points for the integrand.  But
$$
\int_{1/2}^1 \frac{dx}{\sqrt{1-x^2}}
\tag2$$
is not a good candidate, since the point $x=1/2$ is nothing special for that integrand.  Probably evaluating $(2)$ is no easier than evaluating the indefinite integral
$$
\int_{a}^1 \frac{dx}{\sqrt{1-x^2}}
\tag2
$$
for all $a$ with $-1 < a < 1$.


text:
Q: Jekyll rendering inner element outside parent tag I'm creating a site using the Hydejack Jekyll template.
The following HTML snippet:

Programming Concepts

Program Analysis

Data Structures & Algorithms

Databases

Fundamentals of Machine Learning

Natural Language Engineering

and relevant SCSS:
.note-sm {
  @extend .message;
  background: transparent;
  color: var(--body-color);
  font-size: smaller;
  border-left: 1px solid var(--border-color);
  padding: 1.2rem 1rem 0 1rem;
  margin: 1rem -1rem;
  position: relative;

  &:before {
    font-size: 0.667rem;
    font-weight: bold;
    font-style: normal;
    letter-spacing: .025rem;
    text-transform: uppercase;
    color: var(--menu-text);
    position: absolute;
    top: 0;
  }

  &[title]:before {
    content: attr(title)!important;
  }
}

.note {
  @extend .note-sm;
  font-size: 1rem;
}

Renders as so: Outside tag
The ul element is outside the p element. Why is this?

A: According to the specification, there are certain tags that imply the close of a p tag:

A p element's end tag can be omitted if the p element is immediately followed by an address, article, aside, blockquote, details, div, dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul element, or if there is no more content in the parent element and the parent element is an HTML element that is not an a, audio, del, ins, map, noscript, or video element, or an autonomous custom element.

So you'll have to use another containing tag (i.e. div), or deal with the ul as a sibling of the p.


text:
Q: getting problem in inserting values in microseconds I am inserting in time using timestamp datatype but it cannot give me values in microseconds. Is it possible to insert values in microseconds or it takes values only up to milliseconds.
cqlsh:cassandradb> select * from time_stamp;

 id | name    | t
----+---------+---------------------------------
  1 | deepank | 2015-02-16 06:30:24.000000+0000
  2 |    arun | 2016-02-16 06:35:24.483000+0000

this is what I have inserted but I am not expecting this value. I have simply inserted value in milliseconds when I insert in micro it gives me error as following
    (2 rows)
    cqlsh:cassandradb> select id, name, blobAsBigint(timestampAsBlob(t)) from time_                                                                          stamp;
 id | name    | system.blobasbigint(system.timestampasblob(t))
----+---------+------------------------------------------------
  1 | deepank |                                  1424068224000
  2 |    arun |                                  1455604524483

(2 rows)
In this, I have used blob but I think it didn't go well.
cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.84325');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.84325' to a formatted date (long)"

cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.8432');
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '2015-02-16 06:30:2.8432' to a formatted date (long)"

cqlsh:cassandradb> insert into time_stamp(id,name, t)values(3,'tarun','2015-02-16 06:30:2.842');``
last value is taken

I expect that it could insert value in microseconds;
so that output will be in six digit.

A: Timestamp in Cassandra has millisecond resolution, and you should use only 3 digits after . in timestamp string. The microsecond resolution is used only for WriteTime of the record.
For some, unknown for me, reason, cqlsh outputs data with microseconds resolution, and imho it's huge UX problem with it...


text:
Q: How to override / extend local extension model in magento? I got a problem in overriding magento model local extension.
Here is my module config:
etc/modules/Mycompany_OrderExport.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mycompany_OrderExport>
            <active>false</active>
            <codePool>local</codePool>
            <depends>
                 <Xtento_OrderExport />
            </depends>
        </Mycompany_OrderExport>
    </modules>
</config>

And here is my extension config: app/code/local/Mycompany/OrderExport/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Mycompany_OrderExport>
            <version>0.1.0</version>
        </Mycompany_OrderExport>
    </modules>
    <global>
        <models>
            <orderexport>
                <class>Mycompany_OrderExport_Model</class>
            </orderexport>
            <xtento_orderexport>
                <rewrite>
                     <export_data_shared_items>Mycompany_OrderExport_Model_Xtento_Export_Data_Shared_Items</export_data_shared_items>
                 </rewrite>
             </xtento_orderexport>
        </models>
    </global>
</config>

and here is my model:
<?php
class Mycompany_OrderExport_Model_Xtento_Export_Data_Shared_Items extends Xtento_OrderExport_Model_Export_Data_Shared_Items
{
    public function getExportData($entityType, $collectionItem)
    {

        echo 'Override';
        die(1);
    }
}
?>

I would like to know where part I have missed on my script ? Because when I execute my script there's nothing's happen. Thank you for your help.

A: This is the part that makes problem here.
    <Mycompany_OrderExport>
        <active>false</active>
        <codePool>local</codePool>
        <depends>
             <Xtento_OrderExport />
        </depends>
    </Mycompany_OrderExport>

You have disabled your module by setting the active node as false. Turn it on. Means put true for active. Make sure module is enabled through admin side. You can do this by go to
 System  >  Configuration  >  Advanced

Clear all cache and then try again.