text:
Q: In kubernetes apiserver, what's the function of 'SetSelfLink' when we get or list resources In kube-apiserver, when we get or list a resource, in resthandler.go it will set the 'SelfLink', it will result in little performance loss. I wonder what's the meaning of it, ObjectMeta.SelfLink has already been set in etcd, why reset it?
Thanks.

A: You're right, its redundant and unnecessary. It shouldn't be set especially when we persisting items to disk (etcd).  SelfLink is only useful for kube clients and not for the apiserver.
Indeed, this is an issue being tracked in the kubernetes repo here:
https://github.com/kubernetes/kubernetes/issues/2797


text:
Q: Is this a good description of time? Someone told me that "time" is us seeing 3D slices of 4D spacetime, and that an object in spacetime is a 4D object which is tenseless and contains the past present and future of that object. I don't know much about physics, so is this a good explanation?

A: Yes. This is a good video to watch to understand the 4D spacetime:
https://www.youtube.com/watch?v=44ngv-8b8FM
It talks about many aspects of time involving special relativity, general relativity, thermodynamics (irreversibility), and many more. At about 22 minutes the spacetime is compared to a loaf of bread that can be cut in many different directions by observers moving at different speeds, to explain the relativity of simultaneity. With more and more research done in quantum gravity, cosmology, and high-energy physics, I believe people will have an updated view of spacetime in the future.

redpajama_set_name: RedPajamaStackExchange


text:
Q: subset columns among millions of columns with bash script I have a huge table, with 13 rows and over l00 million columns. I am going to select 10 million columns from those. And I know the indexing of the to-be-selected columns. Can I achieve this goal through bash script?
Any suggestions are appreciated.

A: Yes.  awk, sort, and a variety of other basic UNIX commands have column-selection capabilities.  Depending on your table formatting, a parametrized regular expression might be the most effective solution for you.
Details depend on your required input and output formats.  The size of the data rows suggests a pipelined application rather than a line-by-line processor.
I hope this gets you started writing your code.


text:
Q: Magento 2 - Cron groups explaination What is the purpose of below configuration in cron group xml file? I did not fully understand the meaning of those lines:
schedule_generate_every
Frequency (in minutes) that schedules are written to the cron_schedule table.
schedule_ahead_for
Time (in minutes) in advance that schedules are written to the cron_schedule table.
schedule_lifetime
Window of time (in minutes) that cron job must start or will be considered missed ("too late" to run).
Thanks

A: schedule_generate_every: How often would you like your job to run? Every minute, every 5 minutes, every hour, every day...
schedule_ahead_for: How far in advance would you like to schedule jobs? Example: cron runs at 1pm. schedule_ahead_for is set to 1 hour. Cron jobs for the next hour are scheduled.
schedule_lifetime: In the event that the job's scheduled time passes without the job running, should Magento skip the job? If the schedule_lifetime is zero, yes, Magento skips it. If this value is 5 minutes and the job is expired by only 4 minutes, then Magento will run the job.


text:
Q: How to resize button in primefaces? In Primefaces ShowCase is an example how to use an effects. One of these I used for button - resize.
    <p:commandButton type="button" value="Show" style="width:200px" icon="ui-icon-image">
        <p:effect type="size" event="mouseover">
            <f:param name="to" value="{width:300}" />
        </p:effect>
    </p:commandButton>

Similar example is on this page "Size"
It works, but after the button resize to 300px it come bak to original size. And I want to resize it to 300px and stop it on this size. It is possible? How?
Hope you understand what I try to do. Thank you.

A: If you don't want your button to reset to 200px then you'd better use pure jQuery.
Here is a working example:
<p:commandButton styleClass="expandableBtn" type="button" value="Show" style="width: 200px" icon="ui-icon-image" />

<script type="text/javascript">
//<![CDATA[
jQuery(function () {
     $('.expandableBtn').on('mouseover', function() {
          $(this).css('width', '300px');
     });
});
// ]]>
</script>

If you want to take advantage of the "transition effect" then replace $(this).css('width', '300px'); with:
$(this).animate({
    width: '300px'
}, 1000, function () {
    // Transition complete
});

Where 1000 is the duration (in ms) of the transition.


text:
Q: how to access a specific value from a json response with Fetch API The following code returns a bunch of data when I console.log it. I just want it to log the url. How can I do that?
async function getReq() { let req = await fetch('https://go-apod.herokuapp.com/apod'); let res = await req.json(); return res; } console.log(await getReq().url);
`async function getReq() {
let req = await fetch('https://go-apod.herokuapp.com/apod');
let res = await req.json();
return res;

}
console.log(await getReq().url);
`


text:
Q: Bootstrap 3 modal overlay background color and animation I'm having some issues changing the background color when the Modal Window is displayed using Bootstrap 3.
Ideally I want it to be more of a black and tone down the opacity a bit, but when you click on the boxes located here;
http://roblb.devour.org/march2014/index%20copy.html
Also - how do I stop the Modal sliding down? I just want it to fade in? I've seen a few items on here, but none of them actually answer this...
Thanks
Rob

A: Easy remedy is to override the default.
Just use:
.fade.in {
   background: #000; // or whatever you like
}

A: To change the backdrop color you can use this:
.modal-backdrop {
  background-color: #0000ff;
}

or separate into clases:
.modal-blue .modal-backdrop {
  background-color: #0000ff;
}

.modal-white .modal-backdrop {
  background-color: #ffffff;
}

and then add the class to your div:

      ...

to stop sliding down remove the "fade" class.
Hope this help,
regards.

A: I used :
.modal {
  background-color:black;
}

And it worked.

A: We can also try below pattern.

    .modal-content
    {
       background-color: #331a00;
       color: #b3c6ff;
    }

    .modal-content h5{
       color: #ffcc00;
    }

    .close{
       color: #cf3834;
    }

    .modal-content button{
       background-color: #ffcc00;
       color: #cf3834;
    }


text:
Q: Number of triangles in a Graph/Network Given An undirected graph/Network, and its adjacency matrix A, and 1 (A column vector with all elements as 1).
How do we represent the problem of finding the number of triangles in the network (3-cliques) in terms of A, and 1.
I do understand to find the triangle A summation of $A_{ij}*A_{jk}*A_{ik}$,where $i,j,k$ are vertices, but how do we represent in terms of A, and 1

A: The summation $A_{ij} A_{jk} A_{ki}$ can be written $\text{trace}(A^3)$. Don't forget to divide by 6.

A: $|\{(x,y,z) : x \ne y, x\ne z, z\ne y, A[x][y]=A[x][z]=A[z][y]=1\}|$.


text:
Q: R flag cases with missingness from regression analysis When running a regression analysis in R (using glm) cases are removed due to 'missingness' of the data. Is there any way to flag which cases have been removed? I would ideally like to remove these from my original dataframe.
Many thanks

A: Without a reproducible example I can't provide code tailored to your problem, but here's a generic method that should work. Assume your data frame is called df and your variables are called y, x1, x2, etc. And assume you want y, x1, x3, and x6 in your model.
# Make a vector of the variables that you want to include in your glm model
# (Be sure to include any weighting or subsetting variables as well, per Josh's comment)
glm.vars = c("y","x1","x3","x6")

# Create a new data frame that includes only those rows with no missing values
# for the variables that are in your model
df.glm = df[complete.cases(df[ , glm.vars]), ]

Also, if you want to see just the rows that have at least one missing value, do the following (note the addition of ! (the "not" operator)):
df[!complete.cases(df[ , glm.vars]), ]

A: The model fit object returned by glm() records the row numbers of the data that it excludes for their incompleteness. They are a bit buried but you can retrieve them like this:
## Example data.frame with some missing data
df <- mtcars[1:6, 1:5]
df[cbind(1:5,1:5)] <- NA
df
#                    mpg cyl disp  hp drat
# Mazda RX4           NA   6  160 110 3.90
# Mazda RX4 Wag     21.0  NA  160 110 3.90
# Datsun 710        22.8   4   NA  93 3.85
# Hornet 4 Drive    21.4   6  258  NA 3.08
# Hornet Sportabout 18.7   8  360 175   NA
# Valiant           18.1   6  225 105 2.76

## Fit an example model, and learn which rows it excluded
f <- glm(mpg~drat,weight=disp, data=df)
as.numeric(na.action(f))
# [1] 1 3 5

Alternatively, to get the row indices without having to fit the model, use the same strategy with the output of model.frame():
as.numeric(na.action(model.frame(mpg~drat,weight=disp, data=df)))
# [1] 1 3 5


text:
Q: Download a file in PHP I'm trying to download a PowerPoint file. I'm saving its path in column slide in a table called lesson. Whenever I try to download it, it downloads the whole table.
All I want is the column slide, how can I do that?
// connect to the database
$link = mysql_connect('localhost','root','');

if (!$link) {
    die('Could not connect :' . mysql_error());
}

$Selected= mysql_select_db("elearningg", $link);

if (!$Selected) {
    die("Could not connect: " . mysql_error());
}

// query the server for the file
$L_ID = $_GET['id'];
$query = "SELECT * FROM lesson WHERE LID = '$L_ID'";
$result  = mysql_query($query) or die(mysql_error());

// define results into variables
$name=mysql_result($result,0,"Lname");
$content=mysql_result($result,0,"slide");

header("Content-disposition: attachment; filename=$name");

echo $content;

mysql_close();

A: If all you want is the column slide, you have to select only that column in your select clause. Right now you're selecting all of the table's columns by using SELECT *.
Try this:
$query = "SELECT slide FROM lesson WHERE LID = '$L_ID'";

That should only return the column slide from table lesson.


text:
Q: How do you create a process-wide singleton object? I read that the unit of granularity for static fields in .Net are per AppDomain, not per process.  Is it possible to create a process-wide singleton object?

A: You must use marshalled calls to communicate information across AppDomains.  So you need to create the state object in your parent AppDomain and then pass it to any children that want to use it.  If you didn't have to do this, you'd be sharing memory across AppDomains, which defeats the purpose.
Within each AppDomain you could have a singleton that holds a reference to the (marshalled) reference to the actual singleton in the primary domain.  So your code would still look "singleton-y", but there would be some hidden wiring behind it.


text:
Q: Add a static URL prefix for product and category Magento 2 I need to specify a prefix static string for all URLs of my Products and Categories. Just like Wordpress Woocommerce permalinks.
For example all of Categories should have product-category prefix in their URL:

*

*Cat One: domain.com/product-category/cat-one

*Cat Two (child of 'Cat One'): domain.com/product-category/cat-one/cat-two
and all of Products should have product URL prefix, no matter what their Category is:

*

*Product One: domain.com/product/product-one

*Product Two: domain.com/product/product-two
I tried to do this solution, but It's for 3 years ago and not working in Magento 2.
Also this extension is for Magento 1.x as you see.
By the way, I'm using Magento 2.1.9 with PHP 7.0.22 and XAMPP 3.2.2.
Thanks.

A: I found a good solution for this situation!
We need to make our custom module for extending Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator class with plugin methods and Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator class with preference class (because we need to change inside of its methods, not change after or before them).
Assume that our custom module created by this documentation, has <Vendor> and <Module> names.

1) So, at first we need to define our plugin and preference class in our etc/di.xml file:

<?xml version="1.0"?>
  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <preference for="Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator" type="<Vendor>\<Module>\Model\CatalogUrlRewrite\ProductUrlPathGenerator"/>

    <type name="Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator">
      <plugin name="my_category_url_path_generator" type="<Vendor>\<Module>\Plugin\Model\CategoryUrlPathGenerator" sortOrder="15"/>
    </type>

  </config>

2) Add these classes in proper addresses:

a) Our preference class in <Vendor>\<Module>\Model\CatalogUrlRewrite\ProductUrlPathGenerator.php :
--> Change this two constant in this class for your own custom static route: <--

<?php
    namespace <Vendor>\<Module>\Model\CatalogUrlRewrite;

    class ProductUrlPathGenerator extends \Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator
    {

        // CHANGE THESE FOR CUSTOM STATIC PREFIX ROUTE of PRODUCT and PRODUCT CATEGORY
        const PRODUCT_PREFIX_ROUTE = 'product';
        const CATEGORY_PREFIX_ROUTE = 'product-category';

        /**
         * @param \Magento\Store\Model\StoreManagerInterface $storeManager
         * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
         * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator
         * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
         */
        public function __construct(
            \Magento\Store\Model\StoreManagerInterface $storeManager,
            \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
            \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator,
            \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
        ) {
            parent::__construct($storeManager, $scopeConfig, $categoryUrlPathGenerator, $productRepository);
        }

        /**
         * Retrieve Product Url path (with category if exists)
         *
         * @param \Magento\Catalog\Model\Product $product
         * @param \Magento\Catalog\Model\Category $category
         *
         * @return string
         */
        public function getUrlPath($product, $category = null)
        {
            $path = $product->getData('url_path');
            if ($path === null) {
                $path = $product->getUrlKey()
                    ? $this->prepareProductUrlKey($product)
                    : $this->prepareProductDefaultUrlKey($product);
            }

            if ($category !== null) {
                $categoryUrl = str_replace(self::CATEGORY_PREFIX_ROUTE .'/','',$this->categoryUrlPathGenerator->getUrlPath($category));
                $path = $categoryUrl . '/' . $path;
            }

            return self::PRODUCT_PREFIX_ROUTE . '/' . $path;
        }
    }

b ) Our plugin class in <Vendor>\<Module>\Plugin\Model\CategoryUrlPathGenerator.php :

<?php
namespace <Vendor>\<Module>\Plugin\Model;

class CategoryUrlPathGenerator
{
    /**
    * Add a static prefix to category URL path
    *
    * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $subject
    * @param $path
    * @return string
    */
    public function afterGetUrlPath(\Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $subject, $path)
    {
        if (strpos($path, \<Vendor>\<Module>\Model\CatalogUrlRewrite\ProductUrlPathGenerator::CATEGORY_PREFIX_ROUTE) === false)
            $path = \<Vendor>\<Module>\Model\CatalogUrlRewrite\ProductUrlPathGenerator::CATEGORY_PREFIX_ROUTE . $path;

        return $path;
    }
}

3) Run this command:

php bin/magento setup:upgrade

And its DONE!, now you can create products and their categories and you'll see the url rewrites that created with these static url prefixes.

DO NOT forget to change <Vendor>,<Module> with your own custom module names and change the constants of ProductUrlPathGenerator class for change to your custom static prefixes.

Good luck.


text:
Q: Initialize std::vector of std::unique_ptr with lambdas Is it possible to initialize an std::vector in a single line using lambda functions?
I am using the following aliases:
using UI = std::unique_ptr<int>;
using VUI = std::vector<UI>;

So far, I am able to do the following:
UI init[] = { UI(new int(0)), UI(new int(0)), UI(new int(0)) };
VUI vec { std::make_move_iterator(std::begin(init)), std::make_move_iterator(std::end(init)) };

VUI vec;
for (unsigned i=0; i<3; ++i)
    vec.emplace_back(UI(new int(0)));

I would like to do something like this but in a single line, preferably using lambdas.

A: Something like this?
int main()
{
    using UI = std::unique_ptr<int>;
    using VUI = std::vector<UI>;

    VUI vec{ []()
             {
                 VUI v;
                 for (int i=0; i<3; ++i)
                     v.emplace_back(new int(0));
                 return v;
             }()};
}

But why?


text:
Q: How to solve Fatal error in php While running the codes on local host it is showing an error of--
( ! ) Fatal error: Call to a member function find() on a non-object in
C:\wamp\www\crawler_based_search_engine\ajax_requests.php on line 130

Call Stack
#   Time    Memory  Function    Location
1   0.0151  162928  {main}( )   ..\ajax_requests.php:0

the codes from line 130 and beyond is as follows
            $html = file_get_html($file_name);
            // Find all links
            foreach($html->find('a') as $element) //--this is line no 130
            {
                $url = $element->href;
                $index = strpos($url,'q=https://');
                if($index > 0)
                {
                    $index2 = strpos($url,'webcache');
                    if($index2 === false)
                    {
                        $index2 = strpos($url,'sa=U');
                        $url = substr($element->href,$index+2,$index2-$index-3);
                        echo "$url";
                        echo '
';
                    }
                }
            }

because of this error my program is not fetching the links from the google


text:
Q: Why does SQL workbench always return a row full of null values in every query? Every query has a final row with an asterisk beside it and null values for every field? Why does this show up? I cant seem to find an explanation for it. Even putting a WHERE clause doesnt seem to get rid of it. Is this only happening to the MySQL implementation alone?

A: Are you sure it's not just the data entry row. Usually when viewing the table data in something like Workbench or SQLYog, it will display the rows of data, plus a blank row at the end that is used for adding new data. It will show NULL for each column if that is the default value for that columns data type

A: It is for inserting a new row, you enter the values there.

A: Yea, you can type the values directly when you click on the box instead of writing "insert into…" in your query tab


text:
Q: onRequestPermissionsResult does not get called in a non-Activity and non-Fragment class In my non-Activity class i requested for a Fine location permission but
 the call back onRequestPermissionsResult "never gets called" .now i have seen some questions related to this but they all considered that request is being made from an Activity or the fragment, non of them considered making a request from a non activity class. here is my code
public class Initial implements
      ActivityCompat.OnRequestPermissionsResultCallback{

and this is implementation for onRequestPermissionResultCallback method
    @Override
public void onRequestPermissionsResult(int requestCode,
                                       String permissions[], int[] grantResults) {
    Log.i("flow", "onRequestPermissionsResult: ");
    switch (requestCode) {
        case 101: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) ==
                        PackageManager.PERMISSION_GRANTED) {

                    LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
                }
            } else {

            permissionDeniedsnackBar();
            Toast.makeText(context,"permission denied",Toast.LENGTH_SHORT).show();
                // permission denied, boo! Disable the
                // functionality that depends on this permission.
            }
            return;
        }
        //add more cases if you are making more than one permission request
    }
}

also my request for permission code
 private void requestPermission() {
    ActivityCompat.requestPermissions((Activity) context, new String[]
     {Manifest.permission.ACCESS_FINE_LOCATION}
            , 101);

   }

here is my constructor
 public Initial(Activity activity) {
   Log.i("flow", "Initial: ");
     mActivity = activity;
      context = (Context) activity;

   }

i have search through this site and could find a solution to this specific question
Solved
: as some folks mentioned  onRequestPermissionsResult method of the "activity" that i passed in as a parameter to ActivityCompat.requestPermissions(activity,..) method while making a permission request will be called. so i managed this onRequestPermissionsResult in that Activity itself and it worked. thanks

A: You are passing the context of Activity while asking for permission, that is why onRequestPermissionsResult of activity will be called. Sorry but you will not be able to receive this function callback in the Initial class of yours. However you can transfer the response to this class from the activity using an interface or something.


text:
Q: Copied Better_Combat.dzip into CookedPC, but no effect As described on the Help page, the .dzip should be copied into CookedPC. I did that, but the Quen Sign still has a duration of 30s when I load my savegame. Any way to check if the mod das been loaded correctly?

A: The best way to check if the mod is downloaded correctly is to download the tooltips of the same mod.
Link Here
On the about page it is highly recommended that you do this anyway so that you can see the full effects of the mod. This secondary mod is described below.
Better Combat - Tooltips

These are the altered in-game descriptions in english, russian, italian, french and polish. To install extract the version you want depending on the language on the CookedPC folder.

This will allow you to see if the changes have taken effect. I have checked and if the main mod was not installed correctly then no changes will appear with the tooltips.
In conclusion, install this and you will be able to see if the core mod has installed correctly.


text:
Q: How to strip out all text to the right of '//' in oracle I want to write a procedure or function which will search // from source code and strip out all the text to right of the //
e.g   //This is not required
After the procedure or function is executed "this is not required" should vanish

A: SELECT REGEXP_REPLACE('BLA//Thi s is not required', '//.*', '' ) FROM DUAL

This gives "BLA"
If you need keep slashes then use this:
SELECT REGEXP_REPLACE('BLA//Ths s is not required', '(//).*', '\1' ) FROM DUAL

OR
SELECT REGEXP_REPLACE('BLA//Ths s is not required', '//.*', '//' ) FROM DUAL

This gives "BLA//"

A: Here is the function you needed:
CREATE OR REPLACE FUNCTION srting_rplc (strng VARCHAR2)
   RETURN VARCHAR2
IS
   var   VARCHAR2 (100);
BEGIN
   var := SUBSTR (strng, 1, INSTR (strng, '//') - 1);

   RETURN var;
END;

Execution:
SQL> select srting_rplc('BLA//Thi s is not required') from dual;

SRTING_RPLC('BLA//THISISNOTREQUIRED')
--------------------------------------------------------------------------------
BLA


text:
Q: Dropzone inserting the same number of values as the same number of files when sending array inputs to backend I have a simple dropbox that uploads files manually when a button is clicked:
var dropzone = $("#dropzone-form").dropzone({
        autoProcessQueue: false,
        addRemoveLinks: true,
        paramName: "fotos",
        url: url,
        uploadMultiple: true,
        init: function(){
            var dropzone_object = this;

            $('#btn-guardar').on('click', function(e){
                if(checkForm()){
                    if(dropzone_object.files.length > 0){
                        dropzone_object.processQueue();
                    }else{
                      sendWithoutFiles();
                    }

                }
            });

        },
        sending: function(file, xhr, formData) {

            var formValues = $('#form-productos').serializeArray();
            $.each(formValues, function(i, obj){
               formData.append(obj.name, obj.value);
            });

        },
        success: function(file, response){

        },
        error: function(file, errorMessage, xhr){

        }
    });

But I'm having problems when I upload more than one file because I have array inputs inside my form with id form-productos such as this:
<input name="emails[]">

or
<select name="colors[]"></select>

So, for each file that the dropzone queue has, it appends the input again, the inputs that are NOT array inputs have no problem because the value just gets overwritten again, so let's suppose that I have the following inputs (NOTE THE VALUES):
<input name="emails[]" value="email1">
<input name="emails[]" value="email2">

And also, let's suppose that I have 2 files in the queue, when I press the button and the data is being sent to PHP, I get the following when I print "$request->emails":
array(
   'email1',
   'email2', //After this, since I uploaded two files, I get the same values again:
   'email1',
   'email2'
)

Reading the dropzone documentation clearly states that this is the correct behaviour:

sending: Called just before each file is sent. Gets the xhr object and
  the formData objects as second and third parameters, so you can modify
  them (for example to add a CSRF token) or add additional data.

So, the problem is on my side, what can I do to prevent this when appending to formData?

A: I solved the issue easily replacing the send event with sendingmultiple, this event should be used in most cases when the uploadMultiple option is set to true:
sendingmultiple: function(files, xhr, formData) {

            var formValues = $('#form-productos').serializeArray();
            $.each(formValues, function(i, obj){
               formData.append(obj.name, obj.value);
            });

        },

The difference is that this event receives a file array as first parameter, in this way, the process inside the event is only done once.


text:
Q: Janrain php library and google endpoint for OpenId Im using janRain Php library for OpenId and yadis discovery and no matter what i do, i will work in stuff like user.openid.org or my own provider, but if i try to use the google endpoint, i cant get any discovery information.
Even if i run the discovery example for the janrain library, i get the next result Claimed
Identifier  http://www.google.com/accounts/o8/id
No OpenID services discovered.

and it happens the same if I add the https:// before the url.
My question is probably not how to make it work, but if its actually possible, what other choices do i have (that run in my site, no sassy auth wanted in the project).
Why is openId so #@!#@ complex and undocumented?(note, i gave zend_openid a couple of hours to have the same result)

A: it's working here. some hints:

*

*as i understand it, http(s)://www.google.com/accounts/o8/id is not an openid endpoint, but googles discovery endpoint. you have to supply it a valid (google) OpenID Identifier, like example.blogspot.com, for which it returns Claimed Identifier, Server URL, Service types, etc.

*i got the discovery example only working after fixing the <? and <?= in discover.php (replacing them with <?php and <?php echo). alternatively, you can ini_set('short_open_tag', '1'). it's off by default in php.ini-recommended.

*does your PHP installation support SSL? see README, specifically this part:

Not all PHP installations support SSL.  You can find out if yours
supports SSL by reading the "HTTP Fetching" section of the output of
"examples/detect.php."  If your installation does not support SSL,
then https:// identity URLs and server URLs will not be supported by
the library.  An attempt to use such an identity URL will be
equivalent to using an invalid OpenID.  To enable SSL support,
recompile PHP with OpenSSL support or install the appropriate OpenSSL
module for your platform.  If you are using CURL, CURL will need to be
built with OpenSSL support.

A: This is a legitimate beef. Google says they support OpenID, but theirs doesn't work like ANYONE elses. MyOpenID.com, blogspot, aol, yahoo, wordpress, myspace, livejournal and many others all support the standard correctly and it works as expected. As does your own OpenID provider  you can build using the CommunityID server project.
/sigh

A: You need to do a directed identity request.  Normally that just involves passing the URL as though the user had entered it... that's always worked for me in the past (so long as the library you use supports OpenID2.0).

A: I suggest you look this question: Janrain's PHP-OpenID and Google/Yahoo


text:
Q: DOJO Custom Dialog Box - does not parse template file I am new to DOJO. I have a custom widget , which uses a template file for the dialog box contents.
I am extending dijit.Dialog in the script file.
dojo.declare(
    "custom.credentials",
    [dijit._WidgetBase, dijit._Templated,dijit._WidgetsInTemplateMixin,**dijit.Dialog**],
    {

          templatePath: dojo.moduleUrl("custom", "templates/credentials.html"),
          ....
          ....
          postCreate: function() {

          this.inherited(arguments);
          alert(this.containerNode);
          alert(this.mainDIV);
             },
          });

My Template test file looks like this

    Login Dialog Box template here

For some reason, when I alert on this.mainDIV, I get 'undefined'. It does not read the template file. Also, this.containerNode gives me 'HTMLDIVElement', (parent dijit dialog DIV).
I am not able to figure out after a lot of trial error where exactly the issue is. Any help would be greatly appreciated.
Calling code
function opnPop(){
var pop= dijit.byId("customPopup");
    pop.show();
}

Note : *When dijit.Dialog is not extended* it reads the template file without any problem, I.e, I am able to access this.mainDIV.innerHTML , that contains my own inner html contents.
Thank you.

A: If Dialog has to be sub-classed, then it must be the base class. Here, it seems that it is used as a mixin. Anyways, the problem is with the template that is used.
The template will be parsed and used by the code in Dialog. So, the template mentioned here has nothing but a div element with an attach point. There is no "containerNode" element (ie. attach point) and you are trying to access it in your js code, which will give error.
More important, the "titleBar" & "titleNode" elements are also missing form template, which will give errors while parsing the template. In order to avoid that, the code part that uses these elements need to be removed from js, to avoid error. So the widget creation will be successful. Try with the standard dijit.Dialog's template.
Add the data-dojo-attach-point="mainDIV" to the top level Dialog's div in the template.
In template, more things can be added, which won't cause any issues. But, if removed anything, will cause problem. If we are sub-classing a class/widget, we need to comply to the existing code.


text:
Q: lxml: I can't remove a span tag and the text inside I have an html file with some divs like this (a lot simplified):

       some chinese text
      some english text

I'm trying to remove all the Chinese text by removing the span node that contains it with lxml:

parser = et.XMLParser(remove_blank_text=True, recover=True)
documentXml=et.parse(html_FileName, parser)
for class1Node in documentXml.xpath('//div[@class="class1-text"]'):
    chineseNode=class1Node.xpath('.//span[@class="class3"]')
    chineseNode.getparent().remove(chineseNode)

but instead of getting just the span class3 node from xpath  I get the span class2, and so I end to remove all the content (even the English text).
If I don't parse with lxml I get parsing errors (maybe Chinese characters problem or bad html).

A: You can try with strip_elements() function, like:
from lxml import etree as et

parser = et.XMLParser(remove_blank_text=True, recover=True)
documentXml=et.parse(html_FileName, parser)
for class1Node in documentXml.xpath('//div[@class="class1-text"]'):
    chineseNode=class1Node.xpath('.//span[@class="class3"]')
    et.strip_elements(chineseNode[0].getparent(), 'span', with_tail=False)

print(et.tostring(documentXml))

It yields:
b'

\n      some english text\n

'

A: You should be able to simplify your xpath selector to:
for chineseNode in documentXml.xpath("//div[@class='class1-text']//span[@class='class3']"):
    chineseNode.getparent().remove(chineseNode)


text:
Q: Getting FeatureTemplate dialog form ArcObjects? Is it possible to access the "Select Feature Template" dialog as shown in the below screenshot through ArcObjects? We can access this dialog when using the Editor -> Copy Parallel tool.

A: Check this ArcGIS sample that exactly addresses your question:
Feature Template Select Dialog


text:
Q: how to split an single array in to arrays - PHP I need to split single array in to multiple arrays.
For example:
Array
(
    [0] => Array
        (
            [pageviews] => 26
            [visits] => 20
        )

    [1] => Array
        (
            [pageviews] => 9
            [visits] => 4
        )

    [2] => Array
        (
            [pageviews] => 18
            [visits] => 9
        )
)

I need to split the array like below:
Array
(

            [ga:pageviews] => 26
            [ga:visits] => 20
)

Array
(
            [ga:pageviews] => 9
            [ga:visits] => 4
)

Array
(
            [ga:pageviews] => 18
            [ga:visits] => 9
)

How can i do this?
Any help will be thankful and grateful...
Thanks in advance..

A: Ok, so using foreach:
foreach ( $original as $item ) {
    var_dump( array(
        'ga:pageviews' => $item['pageviews'],
        'ga:visits' => $item['visits'],
    ) );
}

A: try
$array =     Array
(
    [0] => Array
        (
            [pageviews] => 26
            [visits] => 20
        )

    [1] => Array
        (
            [pageviews] => 9
            [visits] => 4
        )

    [2] => Array
        (
            [pageviews] => 18
            [visits] => 9
        )
)

for($x=0; $x<count($array); $x++){
   $newArray = $array[$x];       // that extract the second array, containing pageview and visits.
}

A: According to your samples, you seem to want to split one variable into multiple variables (or perhaps you used incorrect notation in the 2nd one?).  If that is the case, and you know how many arrays are in the starting variable, you can do this:
list($one, $two, $three) = $originalArray;

If you don't know how many arrays are in the original array, or there is more than a handful, I have to wonder why you would want to or need to do this in the first place...


text:
Q: How to set the target version info with Premake I want to set the file version of my executables with Premake. Is this possible? How?
I've already looked at the Documentation for both versionlevel and versionconstants, but they aren't properly documented.


text:
Q: Automatic Type Promotion in JAVA I have started studying JAVA .
In there,
byte ch=50;
ch*=2;

works fine.
But
byte ch=50;
ch=ch*2;

does not.
error:possible loss of precision
  required:byte
  found:int
Why this do not happen in 1st case.

A: The second case contains a general multiplication expression, which is of type int, and assignment of int to byte doesn't work because information loss could occur (there are many more ints than bytes).
But the first one contains only a *= operator, and that operator is well-defined for any input value, so no loss occurs. The trick is that byte is defined to "wrap around" when you exceed its range via arithmetic, so a technically correct (although not very useful) result can be computed.
In other words, loss still occurs, but since it's defined to occur in the language definition, the compiler doesn't complain. (There is a hint in the specification, that says the result of the binary operation is converted to the type of the left-hand variable, Java Specification 1.7) There is no such rule defined for assignment; assigning 12345 to a byte does not silently result in Byte.MAX_VALUE, instead it's simply a type error.
And why were things done that way? Because all obvious alternatives would have been worse! If integer arithmetic didn't wrap around, it would have to throw an exception (bad), or yield undefined results (very bad), or it would have to be disallowed unless the compiler could prove that overflow will not occur (basically impossible to guarantee). So we took silent wrapping as the least bad alternative.
But with assignment we can use the strong type system to catch all possible overflow situations and allow most reasonable uses, so that option was chosen.

A: don't follow any answer above,I will give u definite answer:
Java Has a concept called auto Promotion.
See below Example:
bye is 8 bits, so, maximum range of byte value is : 2^8 =256.
Its -128 to -1 and 0 to 127.
Example: if byte a=100,b=28; both are valid
but byte sum=a+b; // it will result 128 which is not in byte range.
that's why , compiler automatically converts byte into int.
int is 32 bits. so,2^32 is very large range of value which can hold results
which byte cannot hold.
java focus more on data. Java won't allow data loss unlike c/c++ without user knowledge.
This concept is called auto promotion.
auto promotion is done to byte,short and char also.
You try to add characters,it will give error this way.
above program,you can write like this:
byte ch=50;
int ch=ch*2;//ch is treated as int and 2 is also considered integer literal.
since: 50 * 2 is 100, still in byte range, you can do typecasting here,
but is risky since value of ch can be modified.
it will work:
  like this:   byte ch=50;
                byte ch=(byte)(ch*2);// manual type casting


text:
Q: Angular ng-repeat & ng-model with firebase not updating I'm using angularfire and am at the last stage of my poll app where someone casts their vote, clicks submit and updates the count(or mark is what I call it) in the quesiton. Here's my data model:
"-JOiDEYd8ANSv9jbL5qJ" : {
    "question" : "Coffee or Tea?",
    "options" : [ {
      "mark" : 0,
      "option" : "Coffee"
    }, {
      "mark" : 0,
      "option" : "Tea"
    } ]
  },
  "-JOiD7pd0fpY_lvYr74s" : {
    "question" : "Bagels or Waffles?",
    "options" : [ {
      "mark" : 0,
      "option" : "Bagels"
    }, {
      "mark" : 0,
      "option" : "Waffles"
    } ]
  },

Here's my html for what a user sees when they take a poll:
     <form role="form" ng-submit="pollSubmit()">

            <input type="radio" name = "answer" ng-value="1" ng-model="option.mark" > {{option.option}}

            <input class="btn btn-primary btn-xs pull-left" type="submit" value="Submit Poll">

    </form>

When I test {{option.mark}} in the html, the value of mark increments every time I select the radio button and doesn't reset to 0 when I click the other option. I want the mark on the back end to go up by one when I actually submit it. So how do I make so my radio button only picks one option and doesn't keep incrementing the mark by one when someone clicks on the radio button before they even submit it.
Here's my controller
'use strict';

angular.module('controllers', [])
        .controller('homeCtrl', ['$scope', '$firebase', function ($scope, $firebase){
            $scope.total = null;

            var ref = new Firebase('https://resplendent-fire-5367.firebaseio.com/');
            $scope.polls = $firebase(ref);

            $scope.title = 'Active Polls';

            $scope.select = function(poll){
                $scope.selected = poll;
            };

            $scope.pollSubmit = function (){
            if(confirm('Submit response?')){
                $scope.polls.$update({

                })
            }else{
                return;
            }
        };

        }]);


text:
Q: how to collect environment containing verbatim text and definitions with parameters to typset it later? I'm stuck trying to collect tex tokens (detokenized) and output them latter with \scantokens.
Problem is that can't drop duplicated parameters (#)
Ideally would be great to read all the content as a string until some marker but this probably requires to read tokens one by one and change their catcodes to string and add spaces in certain places.
For example I want to collect thebibliography and output it at the end of document. Problem raises
when I uncomment \def\path.... It will give an error ! Parameters must be numbered consecutively.
Example:
\documentclass{article}
\usepackage{environ}

\makeatletter
\def\printOrigBibliography{%
    \let\thebibliography\copythebibliography
    \let\endthebibliography\copyendthebibliography
    %% fix of space after \verb token
    \let\origverb\verb
    \def\verb##1{\origverb##1}%
    \expandafter\scantokens\expandafter{\my@envthebibliography\noexpand}\relax
    }

\AtBeginDocument{%
    \environbodyname\envthebibliography
    \let\copythebibliography\thebibliography
    \let\copyendthebibliography\endthebibliography
    \RenewEnviron{thebibliography}
      {\xdef\my@envthebibliography{%
        \noexpand\begin{thebibliography}%
        \expandafter\detokenize\expandafter{\envthebibliography}%
        \noexpand\end{thebibliography}}%
      }%
    }

\AtEndDocument{\printOrigBibliography}
\makeatother

\begin{document}

\begin{thebibliography}{1}
%\def\path#1{#1}

\bibitem{R}
aa \verb|a_a| bb

\end{thebibliography}

Final words
\end{document}    \end{document}

Can I drop some how duplicated parameters down by one level?
I tried to drop it with:
\expandafter\scantokens\expandafter{%
   \expandafter\long\expandafter\def\expandafter\fooo
       \expandafter{\my@envthebibliography}\noexpand}\relax
\fooo

but then I have \verb problems again.

A: Isn't storing the bibliography in a box simpler?
\documentclass{article}

\let\origthebibliography\thebibliography
\let\origendthebibliography\endthebibliography
\newsavebox{\bibliographybox}
\renewenvironment{thebibliography}
 {\global\setbox\bibliographybox=\vtop\bgroup\origthebibliography}
 {\origendthebibliography\egroup}
\AtEndDocument{\unvbox\bibliographybox}

\begin{document}

\begin{thebibliography}{1}
\def\path#1{#1}

\bibitem{R}
aa \verb|a_a| bb

\end{thebibliography}

Final words \cite{R}

\end{document}


text:
Q: Why is ?android:attr/textColorPrimary black in night mode notification? I'm trying to implement night mode for my app.
In my whole app, ?android:attr/textColorPrimary is white in night mode and black in day mode. Just in my notifications it's always black. In the Android Studio layout preview the text is white. (I'm sending the notifications from a foreground service if that's relevant.)
I could make a night mode layout file for the notifications where I use @color/white for the text but why doesn't it work with attributes?

A: I've found the reason. I had to set the notification layout's theme to Theme.MaterialComponents.DayNight.

A: In addition to answer of @Colin, this is an example snippet, how its done:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:theme="@style/Theme.MaterialComponents.DayNight">


text:
Q: How to uninstall eclipse from /root Using Eclipse installer I erroneously installed it on /root directory (default path) using sudo to run eclipse-inst:

As shown here:

Not even a .desktop file was created. After learning about /root and how to install Eclipse I decided I want to uninstall it to do it properly. But if I shouldn't change /root permission, how can I safely remove eclipse?
Using
sudo apt-get autoremove eclipse

returns
Package 'eclipse' is not installed, so not removed

A: I think you can use this thread to solve your issues but you need to remove purge not only eclipse but all related packages...
Read this...


text:
Q: Definition of a set: "conceived as a whole" According to George Cantor "a set is a well defined collection of distinct objects of our perception or of our thought, to be conceived as a whole".
What does "conceived as a whole" mean?
Does it just mean that we don't think of the elements of a set separately, but think of them together?

A: The idea is that if you think about infinity in a pre-19th century mindset, you most likely think of it as somehow a progression that is unbounded. As though you are computing something, and the larger the input, the larger the output gets.
But set theory is predicated on something else. We can collect all of these outputs into one object. We are not computing $f(x)$ for more and more $x$s, instead, we are just assuming that $f$ itself is given, start to, well, "finish".
The simplest example, perhaps, is that of the natural numbers. Instead of saying that $0$ is a natural number, and that if $n$ is a natural number, then $n+1$ is a natural number, and merely stopping there (where we can compute larger and larger natural numbers), set theory asserts that there is a set of all natural numbers. We don't need to compute anything, all the numbers are already there.


text:
Q: How can I use `InSampleSize` for pictures that I get from the camera intent? (Bitmap) I've got this piece of code but it works only when the user has to choose the picture from the gallery:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2;
mPhoto = BitmapFactory.decodeFile(path, options);
image.setImageBitmap(mPhoto);

So I have a bitmap file, mPhoto. It has an image in it.
I need to apply the options on that photo.
How can I do that?

A: I've done it like that:
BitmapFactory.Options options = new BitmapFactory.Options();
  options.inSampleSize = 10;
  mPhoto = BitmapFactory.decodeFile(mUri.getPath(), options);


text:
Q: Need help looping the spawning of an object in AS3 For school i am creating a basic game in AS3 for mobile, basically all you need to know is that I need a rectangle the width of the stage(380) (height doesn't matter) to spawn up the top then after a few seconds another spawns, and this process repeats infinitely until said otherwise. I haven't done much yet so i do not have much code to show but if anyone could tell me how it would be greatly appreciated.
I have the movement down packed, just not the spawning
var rectangle:Shape = new Shape;
var RecTimer:Timer = new Timer(10,10000);
RecTimer.addEventListener(TimerEvent.TIMER, fRecMovement);
RecTimer.start()

function fRecMovement (e:TimerEvent):void {

rectangle.graphics.beginFill(0xFF0000); // choosing the colour for the fill, here it is red
rectangle.graphics.drawRect(0, 0, 480,45.49); // (x spacing, y spacing, width, height)
rectangle.graphics.endFill();
addChild(rectangle); // adds the rectangle to the stage
rectangle.y +=1

}

A: You need to create a new shape each time you want to add something, using the new keyword. But you also need to keep track of each rectangle that you create so you can move it. In the code below, the rectangles array is a list of all the rectangles. Then you can go through the list and move each rectangle.
var RecTimer:Timer = new Timer(10,10000);
RecTimer.addEventListener(TimerEvent.TIMER, onTimer);
RecTimer.start();

var rectangles:Array = []; // a list of all the rectangles we've made so far

function spawnRectangle():void {
    var rectangle:Shape = new Shape();
    rectangle.graphics.beginFill(0xFF0000); // choosing the colour for the fill, here it is red
    rectangle.graphics.drawRect(0, nextRectangleY, 480, 45.49); // (x spacing, y spacing, width, height)
    rectangle.graphics.endFill();
    addChild(rectangle); // adds the rectangle to the stage

    rectangles.push(rectangle); // adds the rectangle to our list of rectangles
}

function moveAllRectangles():void {
    for each (var rectangle:* in rectangles) {
        rectangle.y += 1;
    }
}

function onTimer(e:TimerEvent) {
    spawnRectangle();
    moveAllRectangles();
}

This will create a new rectangle every time the timer runs, but you probably want to do it slower than that. Maybe you could do that with a separate timer.
Also, if you keep letting this code run it's going to slow down a lot and use a lot of memory as it's going to keep creating new rectangles and never stop! See if you can figure out a way to limit that.


text:
Q: Outlook 2016 COM Add-in Load Behaviour has status 'Removed'? We have an odd issue. We have an Outlook Add-in that is not properly loading. As such that is not uncommon as Outlook is notorious of disabling add-in and having an issue with load behavior; we have seen that for years with setting the load behavior to "3" in Regedit, Add-in resiliency and do not disable options intervention needed  (https://support.boyum-it.com/hc/en-us/articles/208245778-CRM-for-Outlook-Add-In-keeps-disabling)
But now we have a new odd case that we have seen before. The Load Behaviour is instead of the normal "Unloaded" it is set as "Removed" and the Com-add-in is unchecked

Further More the LoadBehaviour DWORD entry does not exist at all on the customer's system (Again never seen that)
Facts:
- Add-in is running on over 2000 other installations around the world so doubt it is some sort of code error
- If the add-on is checked in the list the Add-in start-up fine (but is unchecked again after a restart of Outlook)
Has anyone seen this behavior before and know how to resolve/troubleshoot further?

A: Most probably your add-in fires an exception at runtime if a sample add-in works correctly.
Microsoft Office applications can disable VSTO add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.
Hard disabling can occur when a VSTO Add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your VSTO Add-in is executing.
Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.
When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again. Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article.


text:
Q: Postgres ts_headline inconsistent behaviour I have just stumbled over a weird behaviour in postgres ts_headline function (used for highlighting fulltext search results).
First I thought the simple dictionary does not play with highlighting as the below example shows (there should be  tags):
# SELECT ts_headline('simple', 'This is artificial text', to_tsquery('artificial'));
       ts_headline
-------------------------
 This is artificial text
(1 row)

But a different word works fine...
# SELECT ts_headline('simple', 'some Word in', to_tsquery('Word'));
 ts_headline
---------------------
 some Word in
(1 row)

Does anybody have an explanation for this behaviour?

A: I noticed my mistake.
The to_tsquery function inside also needs to know which dictionary to use (aka use the simple one). By default it uses english stemming which produces this result:
SELECT to_tsquery('artificial');
 to_tsquery
------------
 'artifici'

which of course can not be found in the text converted by simple dictionary.
So the correct query would have been:
# SELECT ts_headline('simple', 'This is artificial text', to_tsquery('simple', 'artificial'));
          ts_headline
--------------------------------
 This is artificial text
(1 row)


text:
Q: CSS :hover works but :active does not I'm preparing a WordPress theme and can't figure why :active in my CSS doesn't work while :hover is working fine.
HTML:
(...)

     About ICAR

     News

     For the authors

     Resources

     Contact
& promotion

(...)

CSS:
div#mainMenu{
        float: left;
        width: 140px;
        height: 430px;
        margin-top: 48px;
        background-image: url("img/mainMenu.svg");
        background-size:cover;
        text-align: center;
}

div#mainMenu a{
        font-family: 'Raleway', sans-serif;
        font-size: 10.6pt;
        text-decoration: none;
}

div#mainMenu a:link, div#mainMenu a:visited, div#mainMenu a:active {
        color: #262E5B;
}

div#mainMenu a:hover{
        color: #262E5B;
}

a#mm_1 {
        position: relative;
        display: table-cell;
        top: 21px;
        left: 18px;
        width: 120px;
        height: 35px;
        vertical-align: middle;
}

a#mm_1:hover, a#mm_1:active {             <-- THIS IS NOT WORKING
        background-image: url('img/ElementAbout.png');
        background-size: cover;
}

div#mm_links{
        clear:both;
        height: 430px;
}

div#mm_tail{
        background-color: white;
        border-left: 2px solid #262E5B;
        border-right: 2px solid #262E5B;
        border-bottom: 2px solid #262E5B;
        width: 30px;
        height: 100%;
        clear: both;
        float: right;
}

A: What are you trying to accomplish? If you remove the :hover and press the link I think you will find that the :active is working just fine. But it doesn't do much good since you are styling it the same as when you hover over it. So basically you are hovering over it and then the background-image shows, then you click the link and the same background-image keeps showing.
a#mm_1:active {
        background-image: url('img/ElementAbout.png');
        background-size: cover;
}

A: The :hover pseudo-class selects an element when the mouse cursor is right above it.
The :active pseudo-class applies styles when the element is clicked (or activated in another way).
In your code, your :hover and :active styles are identical.
a#mm_1:hover, a#mm_1:active {
        background-image: url('img/ElementAbout.png');
        background-size: cover;
}

You won't notice any difference when hovering or clicking.
However, give each a different style and you'll see the difference:
a#mm_1:hover { background-color: yellow; }

a#mm_1:active { background-color: red; }

DEMO


text:
Q: database relations grouping items Hi I'm creating an online tool allowing users to add items of clothing to their account. I want to allow users to group these items but am unsure when it comes to the database relationships.
Items are added by users;
Multiple items should then be able to be grouped together;
A single item should be able to be in more than one group.
Before the grouping feature I had one table for users and one table for items, linked via a primary/foreign key. Then to get items from a specific user I simply joined the two tables and selected entries by user_id.
I'm unsure how I should go about implementing the groups feature
Should I have a table for groups and how should they relate ?
I'm really new to database relations but if I have a table called groups, how can it have an array of items as an entry?
or how can an item have an array of groups that it belongs to ?
any help would be brilliant

A: Tables
USER
-----
userID (pk)

GROUP
------
groupID  (pk)
userID   (fk)

GROUP_ITEMS
---------
groupID (pk)
itemID  (pk)

ITEM
----
ItemID (pk)

Be aware the "GROUP" will most likely be a reserved/keyword so you may want to rename it.


text:
Q: Django Autocomplete form media tag problem in my html file i use {{ form.media }} tag but not see included JavaScript files in chrome browser
{% extends 'base.html' %}
{# Don't forget that one ! #}
{% load static %}

{% block content %}

<div>
    <form action="" method="post">
        {% csrf_token %}
        {{ form.as_p }}
        <input type="submit" />
    </form>
</div>
{% endblock %}

{% block footer %}
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>

{{ form.media }}
{% endblock %}

Can someone help me ?


text:
Q: C-Compiler warning "Warning: too many arguments for format" how to fix? I am just starting C programming and am using Eclipse Mars environment and MinGW compiler. I encountered a problem when writing a program that adds two integers and outputs the sum.
I received the "warning:too many arguments for format" dialog for the following statement:
printf("Sum of %d ", integer1," and %d", integer2," is: %d\n", sum);

Can anyone please explain why this is incorrect and how I may correct it?
(the full program is given below):
#include <stdio.h>
#include <stdlib.h>

int main(){

    int integer1;
    int integer2;

    printf("Enter first integer \n");
    scanf("%d\n", &integer1);

    printf("Enter second integer \n");
    scanf("%d", &integer2);

    int sum;
    sum = integer1 + integer2;

    printf("Sum of %d ", integer1," and %d\a", integer2," is: %d\n", sum);

    system("pause");

    return 0;
}

Can anyone explain how to rewrite the incorrect statement?

A: printf()
 takes one string that may include format specifiers, and then a list of arguments:
printf("Sum of %d and %d\a is: %d\n", integer1, integer2, sum);

A: The function printf has the following declaration
int printf(const char * restrict format, ...);

Thus you should write
printf("Sum of %d and %d\a is: %d\n", integer1, integer2, sum);


text:
Q: Echo an image tag with site_url() inside PHP tags I have a loop in my view that outputs all the content gathered from the database:
<?php foreach($content as $contentRow): ?>
     <?php
          echo $contentRow->value;
     ?>
<?php endforeach; ?>

This works fine for HTML strings like:

Example Text

however I have some image content that I would like to display and I have tried the following database entries to no avail:
<img src="<?php echo site_url('pathToImage/Image.png'); ?>" alt="Cover">"
"

I feel like I am missing a step on how to use PHP values in this way.
How do I access the URL of the image and use that to show the image?

Full Code Edit
<?php
    $CI =& get_instance();
?>

                    <?php echo $this->session->userdata('someValue'); ?>

                        <?php foreach($content as $contentRow): ?>

                            <?php
                            echo $contentRow->value;
                            ?>

                        <?php endforeach; ?>

and the values are being read out in $contentRow->value;

A: I have to verify this, but to me it looks like you are echo'ing a string with a PHP function. The function site_url() is not executed, but simply displayed. You can execute it by running the eval() function. But I have to add this function can be very dangerous and its use is not recommended.
Update:
To sum up some comments: The use of eval() is discouraged! You should reconsider / rethink your design. Maybe the use of tags which are replaced by HTML are a solution (Thanks to  Manfred Radlwimmer). Always keep in mind to never trust the data you display, always filter and check!

A: I'm not going to accept this answer as @Philipp Palmtag's answer helped me out alot more and this is more supplementary information.
Because I'm reading data from the database it seems a sensible place to leave some information about what content is stored. In the same table that the content is stored I have added a "content type" field.
In my view I can then read this content type and render appropriately for the content that is stored. If it is just text I can leave it as HTML markup, images all I need to do is specify the file path and then I can scale this as I see fit.
I have updated my view to something akin to this and the if/else statement can be added to in the future if required:
<?php foreach($content as $contentRow): ?>
   <?php if ($contentRow->type != "image"): ?>
      <?php echo $contentRow->value; ?>
   <?php else: ?>
      <?php echo "value)."\">"; ?>
   <?php endif; ?>
<?php endforeach; ?>


text:
Q: Argument type '()' does not conform to expected type 'View' SwiftUI? I am trying to create a startup screen then animate to the mainMenu, but I get the error specified in the title. You can probably see how I am trying to do this. Please help.
struct Content: View {
    @State var ShowMainMenu = false
    var body: some View {
        VStack {
            if (ShowMainMenu) {
                MainMenu()
            } else {
                ContentView(ToMainMenu: $ShowMainMenu)
            }
        }
    }
}
struct ContentView: View {
    @Binding var ToMainMenu:Bool
    var body: some View {
        VStack {
            Text("I hate phone numbers")
            DispatchQueue.main.asyncAfter(deadline: .now()+1.5) {
                withAnimation {
                    self.ToMainMenu.toggle()
                }
            }
        }
    }
}

A: You cannot execute code in a view but you could execute something in onAppear of that view:
struct ContentView: View {
    @State var ShowMainMenu = false
    var body: some View {
        VStack {
            if (ShowMainMenu) {
                Text("Hello")
            } else {
                Content(ToMainMenu: $ShowMainMenu)
            }
        }
    }
}
struct Content: View {
    @Binding var ToMainMenu: Bool
    var body: some View {
        VStack {
            Text("I hate phone numbers")
        }.onAppear() {
            DispatchQueue.main.asyncAfter(deadline: .now()+1.5) {
                withAnimation {
                    self.ToMainMenu.toggle()
                }
            }
        }
    }
}

Note: I had to change the names of Content and ContentView
I hope this helps.


text:
Q: Unknown Column in Where Clause Why MySQL claims of not finding a column? I did specify it in 'select clause'.
MySQL 5.1.39
Error Code: 1054
Unknown column 'dt' in 'where clause'
Query:
-- Generate a Table for Every Day in 2008 Year
SELECT DATE_ADD('2008-01-01',
            INTERVAL (ones.num + tens.num + hundreds.num) DAY) dt
FROM
    (SELECT 0 num UNION ALL
     SELECT 1 num UNION ALL
     SELECT 2 num UNION ALL
     SELECT 3 num UNION ALL
     SELECT 4 num UNION ALL
     SELECT 5 num UNION ALL
     SELECT 6 num UNION ALL
     SELECT 7 num UNION ALL
     SELECT 8 num UNION ALL
     SELECT 9 num) ones
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 10 num UNION ALL
     SELECT 20 num UNION ALL
     SELECT 30 num UNION ALL
     SELECT 40 num UNION ALL
     SELECT 50 num UNION ALL
     SELECT 60 num UNION ALL
     SELECT 70 num UNION ALL
     SELECT 80 num UNION ALL
     SELECT 90 num) tens
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 100 num UNION ALL
     SELECT 200 num UNION ALL
     SELECT 300 num) hundreds
WHERE YEAR(dt) < 2009
ORDER BY dt;

A: You must reference column aliases in a HAVING clause. HAVING conditions are executed on the results set after the query has been processed, as opposed to WHERE clauses which are part of the intial query execution. Because of this HAVING is able to operate on column aliases which are only available in the results set.
-- Generate a Table for Every Day in 2008 Year
SELECT DATE_ADD('2008-01-01',
            INTERVAL (ones.num + tens.num + hundreds.num) DAY) dt
FROM
    (SELECT 0 num UNION ALL
     SELECT 1 num UNION ALL
     SELECT 2 num UNION ALL
     SELECT 3 num UNION ALL
     SELECT 4 num UNION ALL
     SELECT 5 num UNION ALL
     SELECT 6 num UNION ALL
     SELECT 7 num UNION ALL
     SELECT 8 num UNION ALL
     SELECT 9 num) ones
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 10 num UNION ALL
     SELECT 20 num UNION ALL
     SELECT 30 num UNION ALL
     SELECT 40 num UNION ALL
     SELECT 50 num UNION ALL
     SELECT 60 num UNION ALL
     SELECT 70 num UNION ALL
     SELECT 80 num UNION ALL
     SELECT 90 num) tens
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 100 num UNION ALL
     SELECT 200 num UNION ALL
     SELECT 300 num) hundreds
HAVING YEAR(dt) < 2009
ORDER BY dt;

A: Having without a group by is mysql-specific.  You could also try something like this:
select * from (
SELECT DATE_ADD('2008-01-01',
      INTERVAL (ones.num + tens.num + hundreds.num) DAY) dt
FROM
    (SELECT 0 num UNION ALL
     SELECT 1 num UNION ALL
     SELECT 2 num UNION ALL
     SELECT 3 num UNION ALL
     SELECT 4 num UNION ALL
     SELECT 5 num UNION ALL
     SELECT 6 num UNION ALL
     SELECT 7 num UNION ALL
     SELECT 8 num UNION ALL
     SELECT 9 num) ones
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 10 num UNION ALL
     SELECT 20 num UNION ALL
     SELECT 30 num UNION ALL
     SELECT 40 num UNION ALL
     SELECT 50 num UNION ALL
     SELECT 60 num UNION ALL
     SELECT 70 num UNION ALL
     SELECT 80 num UNION ALL
     SELECT 90 num) tens
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 100 num UNION ALL
     SELECT 200 num UNION ALL
     SELECT 300 num) hundreds
dates
where year(dates.dt) < 2009
ORDER BY dt;

A: It can be a bit tricky using those named columns, but you can use 'HAVING'  instead of WHERE:
SELECT DATE_ADD('2008-01-01',
      INTERVAL (ones.num + tens.num + hundreds.num) DAY) dt
FROM
    (SELECT 0 num UNION ALL
     SELECT 1 num UNION ALL
     SELECT 2 num UNION ALL
     SELECT 3 num UNION ALL
     SELECT 4 num UNION ALL
     SELECT 5 num UNION ALL
     SELECT 6 num UNION ALL
     SELECT 7 num UNION ALL
     SELECT 8 num UNION ALL
     SELECT 9 num) ones
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 10 num UNION ALL
     SELECT 20 num UNION ALL
     SELECT 30 num UNION ALL
     SELECT 40 num UNION ALL
     SELECT 50 num UNION ALL
     SELECT 60 num UNION ALL
     SELECT 70 num UNION ALL
     SELECT 80 num UNION ALL
     SELECT 90 num) tens
CROSS JOIN
    (SELECT 0 num UNION ALL
     SELECT 100 num UNION ALL
     SELECT 200 num UNION ALL
     SELECT 300 num) hundreds
HAVING YEAR(dt) < 2009
ORDER BY dt;


text:
Q: Failed to connect to dumpstate service: No such file or directory I try to run bugreport from Runtime exec and I get the following error:
FAIL:Failed to connect to dumpstate service: No such file or directory

I looked into bugreport code here , and it looks like it failed to open a tcp socket to dumpstate service. I also investigated that when com.android.settings asks for a bugreport it uses ActivityManagerService function "requestBugReport" as you can see here, the system set property to start a service but I fail to that also. I tried to reflect this method but for some reason this "ActivityManagerService" class not found.
 val check = Class
        .forName("com.android.server.am.ActivityManagerService")
        .getMethod("requestBugReport")
        .invoke(null)

Is there anyway to get the output of bugreport/bugreportz?


text:
Q: When using @-ms-viewport to handle all screen resolutions in a Windows 8 app, does it matter whether I scale down or scale up? I'm creating my first Windows 8 app using JavaScript / CSS / HTML and have developed my application based on the 1920 x 1080 native resolution on my system. I've then put the following into my css:
@-ms-viewport {
   width: 1920px;
   height: 1080px;
}

This seems to work ok in the simulator at various resolutions, as it scales everything down for 1024x768 for example. I'm just wondering if I'm going about this the right way though. Should I perhaps instead be designing my app for 1024x768 and scaling up instead? Does it matter?


text:
Q: Vision API C# - reading stored image's URL in Azure     //If the user uploaded an image, read it, and send it to the Vision API
if (activity.Attachments.Any() && activity.Attachments.First().ContentType.Contains("image"))
{
   //stores image url (parsed from attachment or mess`enter code here`age)
   string uploadedImageUrl = activity.Attachments.First().ContentUrl; ;
   uploadedImageUrl = HttpUtility.UrlDecode(uploadedImageUrl.Substring(uploadedImageUrl.IndexOf("file=") + 5));

   using (Stream imageFileStream = File.OpenRead(uploadedImageUrl))
   {
       try
       {
            analysisResult = await visionClient.AnalyzeImageAsync(imageFileStream, visualFeatures);
       }
       catch (Exception e)
       {
            analysisResult = null; //on error, reset analysis result to null
       }
   }
}
//Else, if the user did not upload an image, determine if the message contains a url, and send it to the Vision API
else
{
    try
    {
        analysisResult = await visionClient.AnalyzeImageAsync(activity.Text, visualFeatures);
    }
    catch (Exception e)
    {
        analysisResult = null; //on error, reset analysis result to null
    }
}

I am trying the code above. I got the code from here: https://docs.botframework.com/en-us/bot-intelligence/vision/#example-vision-bot.
As is, the code does what it can do when ran locally, but reading the image's URL from an uploaded file doesn't work after I published my bot to Azure and ran it from there.
I attempted to debug by attaching Visual Studio directly to my published webapp bot in Azure. It looked like the webapp is unable read the stored image's URL from the Azure server temp storage location or can't access the temp storage location.
This line:
uploadedImageUrl = HttpUtility.UrlDecode(uploadedImageUrl.Substring(uploadedImageUrl.IndexOf("file=") + 5));

Shows this value:
    "https://bcattachmentsprod.blob.core.windows.net/at4984/Gv4cOx6OdSl-      original"
Then, this line:
using (Stream imageFileStream = File.OpenRead(uploadedImageUrl))

Changes the value to:
    "s://bcattachmentsprod.blob.core.windows.net/at4984/Gv4cOx6OdSl-original"
And then it just stops.
Has anyone ran into an issue like this? How do I go about solving this issue?
Thanks!

A: If you have a image URL, you should simply call AnalyzeImageAsync with that URL instead of creating a stream as you have.  The File class should be used for files on your local drive/network.  By creating a stream, you download the image once to your VM, then upload it to the vision service, doubling the work.


text:
Q: Content overlaps in Ionic 1 app for IOS version 11 and above I have a app built using Cordova, Ionic V1 and AngularJS V1 and in a particular control that is displaying date, content overlaps to the previous value. This issue is observed only in IOS 11.4.1 (latest release). In the previous version IOS the control was working properly.
I have attached the screen shot

After inspecting in XCode I found out that this is a issue which is caused by display: block property. So I tried changing the value of display, most of the values says unsupported in IOS and which works is display: -webkit-box-. But when I add that all the contents move to extreme left side that is Month, Date and Year values which I have highlighted in the image.
And below is the code
this.selectDate = function (date) {
        if (this.isDisabled(date)) return;
        this.selectedDate = angular.copy(date);
        this.selectedDate.setHours(0, 0, 0, 0);
        this.tempDate = angular.copy(this.selectedDate);
    };

Template code

       {{datepickerCtrl.selectedDate | date: \'d\'}}

The above code is part of ionic-datepicker link.
The date content works properly on Android has issue only in IOS V 11.4.1.
Thanks :)

A: I have not tested it but I faced something similar issue. Please try to replace
 with  and see if it works:

       {{datepickerCtrl.selectedDate | date: \'d\'}}

Also instead of display: block use display: inline.
Hope it will help you.

A: The issue is related to the display property value which does not support for IOS 11.4.1.
display: block;

The above property does not work in the latest version of IOS.
So I changed the value of the display property
display: -webkit-inline-box !important;
text-align: -webkit-center !important;

text-align is used to align the div elements at the center.
This solution works for both Android and IOS.
Hope this helps others.


text:
Q: Unsual Gmail Java messaging exception I am using Java Mail Api to send mail , it works perfectly on my computer system. But it does not work on the Clients Network.. I get Java Messaging exception cannot connect to
Here is A snipet of the code
private static void sendmail(String file) throws IOException
{
        try {
            final String username ="username";
            final String password= "password";

            Properties props= new Properties();
            props.put("mail.smtp.host", "smtp.gmail.com");
            props.put("mail.smtp.socketFactory.port", "465");
            props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
            props.put("mail.smtp.auth", "true");
            props.put("mail.smtp.port", "465");

            Session session = Session.getInstance(props,
            new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password);
                        }
                    });

          Message message= new MimeMessage(session);
          String To= "a@client.com";
          String subject= "ERROR LOG IN EXCEL";
          String body= "Testing Attached within";
          message.setFrom(new InternetAddress(username));
          message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(To));
          message.setSubject(subject);
          message.setText(body);
          MimeBodyPart messageBodyPart = new MimeBodyPart();
          Multipart multipart = new MimeMultipart();
          DataSource source = new FileDataSource(file);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName("eror log.xls");
          multipart.addBodyPart(messageBodyPart);
          message.setContent(multipart);

          Transport.send(message);
          JOptionPane.showMessageDialog(null, "message sent");

    }

I get the Error Java messaging exception cannot mail.smtp. host smtp.gmail.com port: 465
This works however on my own system. and the email was sent successful.
Could this be a security configuration issue with the clients Network System

A: Try this:
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendEmail
{
   public static void main(String [] args)
   {
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Now set the actual message
         message.setText("This is actual message");

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}


text:
Q: RNN Back propagation proof Chapter 10 of the Deep Learning book has

$$
\begin{align}
a^{(t)} &= b + Wh^{(t-1)} + Ux^{(t)} \\
h^{(t)} &= \tanh(a^{(t)})\\
o^{(t)} &= c + Vh^{(t)}\\
\hat{y}^{(t)} &= \text{softmax}(o^{(t)})\\ \\
L &= \sum_t L^{(t)}\\
&= -\sum_t \log{p_{\text{model}}(y^{(t)}\ |\ x^{(1)},\dots,x^{(t)})}
\end{align}
$$
where $p_{\text{model}}(y^{(t)}\ |\ x^{(1)},\dots,x^{(t)})$ is given by reading the entry for $y^{(t)}$ from the model's output vector $\hat{y}^{(t)}$.
...
$$
\frac{\partial L}{\partial L^{(t)}}=1\\
(\nabla_{\pmb{o}^{(t)}}L)_i = \frac{\partial L}{\partial L^{(t)}}\frac{\partial L^{(t)}}{\partial o_i^{(t)}} = \hat{y}_i^{(t)} - \pmb{1}_{i=y^{(t)}}
$$

I got $\frac{\partial L^{(t)}}{\partial o_i^{(t)}} = \hat{y}_i^{(t)} - y_i^{(t)}$ as shown here. But how do we get the result in the book?

A: I think both writing are identical.
In vector form, you can write
$$
\frac{\partial L}{\partial \mathbf{o}} = \mathrm{softmax}(\mathbf{o})-\mathbf{y}
$$
where vector $\mathbf{y}$ is null everywhere except at the position that indicates the class.
For instance $y(2)=1$ if we are dealing with an example from the second class...


text:
Q: How to run $("tr").each(function() {} on a webpage given a url I'm trying to get some table data from an external url. Let's say that url is defined by the variable "url." How can I use javascript/jquery to get what I want? I want it to be able to run the code I've written below on that url so I can obtain the data I want and then display that data on a different webpage.
`
var arrdata = []
$("tr").each(function(){
    var currentRow = $(this);
    var header_value = currentRow.find("th:eq(0)").text();
    arrdata.push(header_value);
});
`

A: fetch(url)
    .then(function (response) {
        return response.text();
    })
    .then(function (content) {
        $(content).find("tr").each(function (index) {
            alert($(this).text()); //do what you need
        })
    })


text:
Q: Why this Artin ring is simple? Suppose we have a non-commutative left Artin ring $R$, such that the subring generated by any nonzero two-sided ideal together with the unity is $R$ itself. I read that $\mathrm{Z}(R)$, which is the center of $R$, forms an integral domain, but why is this true? And how can one proceed to deduce that $R$ is simple? I tried to use DCC on the sets of all two-sided ideals to go further, but don't see why this implies there can only be extremal two-sided ideals in this case. Any hints on this?

A: Let $R$ be left artinian such that, for all non-zero two-sided ideals $I$, the subring generated by 1 and $I$ is all of $R$. We will describe all such $R$, including the commutative ones.
Write $J$ for the Jacobson radical of $R$, a two-sided ideal. Suppose first that $J^2$ is non-zero. Then $R$ is generated as a ring by 1 and $J^2$, so $R/J^2$ is generated by 1, and hence is a quotient of $\mathbb Z$. In particular, $J/J^2$ is generated by the image of some integer $a$, so by Nakayama's Lemma $J=Ra$, and hence, using the nilpotency of $J$, we see that $\mathbb Z$ surjects onto $R$. Thus $R=\mathbb Z/n$ for some integer $n$.
Otherwise $J^2=0$. Assume $J\neq0$. Then $R$ is generated by 1 and $J$, so $R/J$ is generated by 1, so is a quotient of $\mathbb Z$. If the image of some $a\in\mathbb Z$ is non-zero and in $J$, then $R$ is generated by $1$ and $Ra$, so by 1, and hence is a quotient of $\mathbb Z$.
Otherwise, the image $A$ of $\mathbb Z$ intersects $J$ trivially, and $R=A\oplus J$. If $e\in A$ is a non-trivial idempotent, then $R$ is generated by 1 and $Re$, so $J=Je$. Similarly $J=J(1-e)$, so $J=0$, a contradiction. Thus $A=\mathbb Z/p$ for some prime $p$. Taking any non-zero $t\in J$ we see that $R=(\mathbb Z/p)[t]/(t^2)$.
Finally, if $J=0$, then $R$ is semisimple artinian, so a product of matrices over division rings. If $R=A\times B$ is a proper product, then $R$ is generated as a ring by 1 and either $A$ or $B$. Thus both $A$ and $B$ are quotients of $\mathbb Z$ by square-free integers. This holds for any such decomposition, so either $R=\mathbb Z/m$ with $m$ square-free, or else $R=(\mathbb Z/p)^2$ for some prime $p$. Note that up to now, all such $R$ are commutative.
The only other case is when $R$ is a matrix ring over a division ring, and so simple. In particular, every such non-commutative $R$ is simple artinian.
In summary, then only such rings are
$$ \mathbb Z/n, \quad (\mathbb Z/p)[t]/(t^2), \quad (\mathbb Z/p)^2, \quad \mathbb M_r(D) $$
with $p,n,r\in\mathbb N$ and $p$ prime, and $D$ a division ring.

A: This is what I was working on.  Let $R$ be a right ring such that $1\cdot \mathbb Z+I=R$ for every nonzero ideal $I$, such that $R$ is not commutative.

Lemma 1: under the conditions above, there is no nonzero element $x$ such that $x\mathbb Z$ is an ideal of $R$.

Proof: if $x\mathbb Z$ were a two-sided ideal, $1\cdot\mathbb Z+x\mathbb Z$ would be commutative, contradicting our standing hypotheses.

Lemma 2: under the conditions above, if $I$ is a nonzero ideal, $I^2\neq \{0\}$.

Proof: if $I^2=\{0\}$, then $R=1\cdot \mathbb Z+I$ is commutative, so the square of $I$ must be nonzero.

Proposition:  The center of $R$ is a domain.

Proof: If $xy=0$, and $x,y$ are nonzero elements of the center of $R$, then from $R=1\cdot \mathbb Z+(y)$, we learn $xR=x\mathbb Z$. Since the right hand side is manifestly a nonzero ideal, the Lemma 1 above contradicts this. Therefore there is no such pair $x,y$, and the center is a domain.

Proposition: $R$ is simple Artinian

Proof: it suffices to show that $R$ is prime, i.e. there are no nonzero ideals $A,B$ such that $AB=\{0\}$.  Suppose two such ideals existed.  Since $(BA)^2=\{0\}$, we see by Lemma 2 that $BA=\{0\}$ as well.
Now let $a$ be a nonzero element of $A$.  From $R=1\cdot \mathbb Z +B$ we learn both $aR=a\mathbb Z$ and $Ra=a\mathbb Z$. Therefore $aR=Ra=a\mathbb Z$ is a nonzero ideal of $R$, something prevented by the Lemma 1 above.
Therefore $R$ is a right Artinian prime ring, which is well-known to be a simple Artinian ring.

If one does not recall the proof that a right Artinian prime ring is simple, we could also say that $R$ is right Artinian and semiprime, hence semisimple. It would remain to show that it is simple, and this would follow from a similar argument about existence of two ideals $A,B$ such that $AB=BA=\{0\}$.

A: After having needed to spend a bit of time in order for things to come to light, may I say that this is quite a lovely problem and may I convey my regards to your professor for having included it in his textbook.
Let us assume a left Artinian, non-commutative ring $A$ such that for every nonzero bilateral (I dislike the English terminology of "two-sided") ideal we have $A=[I \cup \{1_A\}]_{\mathrm{Ann}}$, where for arbitrary subset $X \subseteq A$ I use the notation $[X]_{\mathrm{Ann}}$ to refer to the subring generated by $X$ in $A$. Let us remark that for any bilateral ideal $I \leqslant_{\mathrm{b}} A$ we have the relation $[I \cup \{1_A\}]_{\mathrm{Ann}}=I+\mathbb{Z}_A$, where I have used the abbreviation $\mathbb{Z}_A\colon=\mathbb{Z}1_A\colon=\{n1_A\}_{n \in \mathbb{Z}}$ (on the same note let us also introduce $n_A\colon=n1_A$ for arbitrary integer $n \in \mathbb{Z}$).
We seek to prove that $A$ is simple under these conditions and we shall proceed in the following sequence:

*

*Introducing the abbreviation $C\colon=\mathrm{Z}(A)$ for the centre of $A$, we first argue that $C$ is a field.

Since $A$ is non-commutative it is in particular nonzero, which means $0_A \neq 1_A$ and therefore $C$ is also nonzero. Given arbitrary ring $R$ we shall write $\mathrm{U}(R)$ for the subset of units of $R$ and similarly $R^{\times}\colon= R \setminus \{0_R\}$. For arbitrary subset $X \subseteq R$ we recall the left and right annihilators $\mathrm{Ann}_{\mathrm{s}}(X)\colon=\{t \in A \mid tX \subseteq \{0_R\}\}$ respectively $\mathrm{Ann}_{\mathrm{d}}(X)=\{t \in A \mid Xt \subseteq \{0_R\}\}$, remarking that left (right) annihilators are always left (right) ideals: $\mathrm{Ann}_{\mathrm{s}}(X) \leqslant_{\mathrm{s}} R$ respectively $\mathrm{Ann}_{\mathrm{d}}(X) \leqslant_{\mathrm{d}} R$. In the particular case when $X \subseteq \mathrm{Z}(R)$ is a central subset it is easily seen that the two lateral annihilators coincide and are both a bilateral ideal of $R$: $\mathrm{Ann}_{\mathrm{s}}(X)=\mathrm{Ann}_{\mathrm{d}}(X) \leqslant_{\mathrm{b}} R$.
We first establish the following characterisation: $z \in \mathrm{U}(C) \Leftrightarrow \mathrm{Ann}_{\mathrm{s}}(z)=\{0_A\}$ (a central element is invertible if and only if it is cancellable). Indeed, the implication $z \in \mathrm{U}(C) \Rightarrow \mathrm{Ann}_{\mathrm{s}}(z)=\{0_A\}$ is a particular case of the more general implication $x \in \mathrm{U}(A) \Rightarrow \mathrm{Ann}_{\mathrm{s}}(x)=\mathrm{Ann}_{\mathrm{d}}(x)=\{0_A\}$, relation which is valid in any ring without imposing any supplementary hypotheses.
As for the converse implication, we turn to the left Artinian nature of $A$ by considering the decreasing sequence of principal left (they are actually bilateral) ideals $\left(Az^n\right)_{n \in \mathbb{Z}}$ and inferring the existence of $k \in \mathbb{N}$ such that $Az^k=Az^{k+1}$, which further entails the existence of $x \in A$ such that $z^k=z^{k+1}x$ or equivalently $(1_A-zx)z^k=0_A$ and thus $1_A-zx \in \mathrm{Ann}_{\mathrm{s}}\left(z^k\right)$. In general, for arbitrary $y \in A$ it is elementary that $\mathrm{Ann}_{\mathrm{s}}(y)=\{0_A\}$ entails $\mathrm{Ann}_{\mathrm{s}}\left(y^n\right)=\{0_A\}$ for any $n \in \mathbb{N}$ (if $y$ has a zero left annihilator then the group endomorphism of $(A, +)$ given by right multiplication with $y$ is injective, property which is preserved by all the powers of this endomorphism in the ring $\mathrm{End}_{\mathbf{Gr}}((A, +))$, powers which are none other than the endomorphisms given by right multiplication with $y^n$ for generic $n \in \mathbb{N}$). We thus infer that $zx=xz=1_A$, which means that $z \in \mathrm{U}(A) \cap \mathrm{Z}(A)=\mathrm{U}(C)$ (recall that in general for any monoid $M$ the equality $\mathrm{U}(\mathrm{Z}(M))=\mathrm{U}(M) \cap \mathrm{Z}(M)$ holds, since indeed any central element of $M$ which is a unit of $M$ will necessarily have a central inverse, rendering it into a unit of the centre).
Having obtained the above characterisation, let us further establish the relation $z=0_A \Leftrightarrow z \in C \wedge \mathrm{Ann}_{\mathrm{s}}(z) \neq \{0_A\}$. The $\Rightarrow$ direction is clear, so we focus on the converse, considering an arbitrary central element $z \in C$ whose (left...) annihilator $I\colon=\mathrm{Ann}_{\mathrm{s}}(z)$ is nonzero. As we have already remarked, $I \leqslant_{\mathrm{b}} A$ is in this case a bilateral ideal and as it is nonzero we gather that $A=I+\mathbb{Z}_A$ by virtue of our very particular assumption. This immediately entails the description $Az=\left(I+\mathbb{Z}_A\right)z=Iz+\mathbb{Z}z=\mathbb{Z}z$, which means that any element in the principal (left...) ideal generated by $z$ is actually an integer multiple of $z$. Let us now additionally assume that $z \neq 0_A$ and derive from this a contradiction. If indeed $z \neq 0_A$ then $z \in Az \leqslant_{\mathrm{b}} A$, in other words $Az$ is a nonzero bilateral ideal (left ideals generated by central subsets are automatically bilateral). The particular assumption of our problem once again applies to the conclusion that $A=Az+\mathbb{Z}_A=\mathbb{Z}z+\mathbb{Z}_A$, which further entails the commutativity of $A$ thus contradicting the hypothesis. It follows that with necessity $z=0_A$, under the above assumptions.
Hence, an arbitrary central element $z \in C$ either has nontrivial (left...) annihilator - in which case it is $0_A$ - or a trivial one, in which case it is a unit of $C$. This establishes $C$ as a field.

*We now argue that $A$ is a simple ring, for which it will suffice to show that its Jacobson radical $R\colon=\mathrm{Rad}(A)$ is null.

Indeed, having established the fact that $R=\{0_A\}$ we recall the general property of any left Artinian ring of having a semisimple quotient by its radical. It follows from one of the Wedderburn structure theorems that $A/\{0_A\} \approx A \ (\mathbf{Ann})$ is semisimple and thus isomorphic to the direct product of a finite family $S$ - indexed by $\Lambda$ - of nonzero simple rings. This entails that the centre $C$ is isomorphic to the direct product of the family $(\mathrm{Z}(S_{\lambda}))_{\lambda \in \Lambda}$ of centres. By virtue of another one of the Wedderburn structure theorems, it can be easily inferred that the centre of a nonzero simple ring is necessarily a field. Combining this with the fact that $C$ is itself a field and hence a nonzero domain, we gather that $|\Lambda|=1$, in other words the direct product isomorphically expressing $A$ must consist of precisely one factor (the case $|\Lambda| \geqslant 2$ would contradict the integrity of $C$ whereas $\Lambda=\varnothing$ is prohibited by our previous observation that since $A$ is noncommutative it is in particular nonzero).
Let us proceed by Reductio ad Absurdum and assume that $R \neq \{0_A\}$. We first remark that under this hypothesis it is impossible that $\mathrm{char}\ C=0$. Indeed, if this were the case then $2_A \neq 0_A$. Since $R \leqslant_{\mathrm{b}} A$ is nonzero we gather that $A=R+\mathbb{Z}_A$ and as $C$ is a field we can claim that $\frac{1}{2_A} \in A$, whence there must exist $a \in R$ and $k \in \mathbb{Z}$ such that $\frac{1}{2_A}=a+k_A$. This equation leads to $a=-k_A+\frac{1}{2_A} \in C^{\times}=\mathrm{U}(C)$ and signifies that the proper ideal $R$ would contain a unit, clearly an absurd situation (the hypothesis that $C$ is of characteristic $0$ is the one which justifies the assertion that $k_A \neq \frac{1}{2_A}$, equivalent to $(2k-1)_A \neq 0_A$).
Since $C$ is a field, we must have $\mathrm{char}\ C=p$ for a certain (strictly positive) prime number $p$. This means that $A$ has a canonical (associative and unitary) $\mathbb{Z}_p$ - algebra structure, where I am using the notation $\mathbb{Z}_r\colon=\mathbb{Z}/r\mathbb{Z}$ for arbitrary $r \in \mathbb{N}$. From the particular assumption in the hypothesis we gather that given any proper nonzero bilateral ideal $I \leqslant_{\mathrm{b}} A$, we have $A=I+(\mathbb{Z}_p)1_A$, where the sum on the right-hand side is direct: indeed, $I \cap \left(\mathbb{Z}^{\times}_p\right)1_A \subseteq I \cap \mathrm{U}(A)=\varnothing$ whence it follows that $I \cap (\mathbb{Z}_p)1_A=\{0_A\}$. From this we infer that $\mathrm{codim}^{A}_{\mathbb{Z}_p}I=\mathrm{dim}_{\mathbb{Z}_p}(A/I)=1$, in other words any nonzero proper bilateral ideal of $A$ is a hyperplane in the $\mathbb{Z}_p$-vector space structure subjacent to the algebra structure introduced above.
Let $\mathscr{Id}_{\mathrm{b}}(A)$ denote the set of all bilateral ideals of $A$, $\mathscr{I}\colon=\mathscr{Id}_{\mathrm{b}}(A) \setminus \{A\}$ and $\mathscr{I}'\colon=\mathscr{I} \setminus \{\{0_A\}\}$. As $A$ is nonzero we clearly have $\mathscr{I} \neq \varnothing$. Bearing in mind the general relation $R \subseteq \displaystyle \bigcap \mathrm{Max}\left(\mathscr{I}\right)$ ($\mathscr{I}$ is considered implicitly ordered by inclusion and the syntax $\mathrm{Max}$ refers to the collection of maximal elements with respect to this ordered set, in other words the collection of all maximal bilateral ideals), we infer that $\mathscr{I}' \neq \varnothing$ (otherwise we would have $\mathscr{I}=\{\{0_A\}\}$, $\mathrm{Max}\left(\mathscr{I}\right)=\{0_A\}$ and eventually $R \subseteq \{0_A\}$).
It is also an elementary fact that the ordered set $\mathscr{I}$ is inductive and therefore admits at least a maximal element, say $M \in \mathrm{Max}\left(\mathscr{I}\right)$. It is clear that $M \neq \{0_A\}$, for assuming the contrary would once again entail $\mathscr{I}=\{\{0_A\}\}$, situation which we have already ruled out as impossible under the given assumptions. Since $M, R \in \mathscr{I}'$ we have that $M$ and $R$ are both $\mathbb{Z}_p$ - hyperplanes of $A$, according to one of the previous observations. Since $R \subseteq M$, we thus gather that $R=M$, meaning that the Jacobson radical $R$ is a maximal bilateral ideal. Since $R$ is at the same time included in every maximal bilateral ideal, we infer that $\mathrm{Max}\left(\mathscr{I}\right)=\{R\}$.
Since any proper bilateral ideal is included in a certain maximal bilateral ideal (by virtue of the same token of inductivity of $\mathscr{I}$ ordered by inclusion), the existence of just one maximal bilateral ideal means that $A$ actually has $R$ as a maximum proper bilateral ideal, symbolically $R=\max \mathscr{I}$. Thus, if we furthermore consider an arbitrary $I \in \mathscr{I}'$ we gather that $I \subseteq R$ and $I$, $R$ are both $\mathbb{Z}_p$ - hyperplanes of $A$. Once again, this entails $I=R$ and signifies that we actually have the relation $\mathscr{I}=\{\{0_A\}, R\}$.
Let us however keep in mind another general property of left Artin rings, namely that they have nilpotent Jacobson radicals. I will use the notation $I^{.n}$ to refer to the power of exponent $n \in \mathbb{N}$ of the bilateral ideal $I$ within the multiplicative monoid $(\mathscr{Id}_{\mathrm{b}}(A), \bullet)$. In our case, since $R^{.2} \in \mathscr{I}$ we have either $R^{.2}=\{0_A\}$ or $R^{.2}=R$. The latter option would mean that $R$ is at the same time a nonzero idempotent as well as a nilpotent element, which constitutes a contradiction. This leaves the only possible option $R^{.2}=\{0_A\}$.
The above finding means in particular that $R^{(2)}=RR=\{0_A\}$ and - together with the relation $A=R+\mathbb{Z}_A$ - allows us to infer that $R \subseteq \mathrm{C}_A(R)$, in other words $R$ centralises itself. As it is also obvious that $R \subseteq \mathrm{C}_A(\mathbb{Z}_A)$, taking into account the relation $A=R+\mathbb{Z}_A$ we easily gather that $A \subseteq \mathrm{C}_A(A)=\mathrm{Z}(A)$, contradicting the restriction that $A$ is not commutative. This contradiction is caused by the assumption $R\neq \{0_A\}$ and signifies that indeed $R=\{0_A\}$, as we had set out to prove.
Our argument thus comes to an end.


text:
Q: Actionscript: call a superclass method from a subclass What I would like to do is to call a method from a superclass in a subclass. Specifically I want to be able to add the subclass as a child of the superclass but without physically having to type addChild in the superclass (but I will have to type it in the subclass). For now I'm just trying to call a method in the superclass that draws some text from a subclass.
Here is the MAIN class (the superclass)
package
{
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class MAIN extends Sprite
    {
        public var SOMETEXT:TextField = new TextField();
        public function MAIN()
        {
            new OBJECT_square().CREATE();
        }
        public function DRAWTEXT():void
        {
            SOMETEXT.text = "sometext";
            addChild(SOMETEXT);
        }
    }
}

Here is the OBJECT_square class (the subclass)
package
{
    import flash.display.*;
    import flash.events.*;
    public class OBJECT_square extends MAIN
    {
        public function CREATE():void
        {
            MAIN.DRAWTEXT();
        }
    }
}

The code doesn't compile, I get "Call to a possibly undefined method DRAWTEXT through a reference with a static type class".
I realize there are otherways to display text on the screen. I just need to learn how to call superclass methods.

A: Just call it regularly. When you have a class extend a base class, the class inherits all the base classes methods.
package
{
    import flash.display.*;
    import flash.events.*;
    public class OBJECT_square extends MAIN
    {
        public function CREATE():void
        {
            DRAWTEXT();
        }
    }
}

A: Edited
My bad about suggesting static, I clearly didn't pay much attention to your code before answering. DRAWTEXT doesn't show up anything because your object has not beed added to the stage. You have to call addChild() to see your diplsay object.

As a side note, don't take this bad, buy you have been asking a lot of questions that show that you lack a basic understanding of how Flash and Actionscript works (and also you seem to be a bit too insistent on having it work the way you want).
It's always ok to ask questions here (as long as you keep them on-topic, which seems to be the case with your questions), but I think you would be better off first learning the basics from some good books, tutorials, etc.
These two posts contain links to good resources, I think you should check them out.
Resources for Learning ActionScript 3.0 as a Professional Programmer
https://stackoverflow.com/questions/168586/where-to-learn-actionscript-3-0
Also, what's with all these users with the same name? Right now I can see 9 users with the name 1101 here: https://stackoverflow.com/users/, and I think all of them are yours. One is enough. Really. You don't need to create a new user everytime you want to ask a question. Also, try to follow up the questions you've asked to give some feedback to the people that bothered answering (this will be much easier if you have just one user). And when you want to comment on some response, leave a comment instead of adding an answer.