text:
Q: iOS app is rejected because of user buy subscription without IAP I build a tool app on iOS platform. I want create three level for users. basic, pro and premium. each level provide different functions. So user need pay for pro and premium subscription plan. the difference between level is pro user can create more document than basic user.
The thing is I don't want use IAP, I don't want apple share the 30% revenue, so I created a website to let user pay the subscription through web.
I got the app approved 3 times before, without any rejection.
but recently, Apple review team reject my app with follow info

From Apple
  11.13 - Apps that link to external mechanisms for purchases or subscriptions to be used in the App, such as a "buy" button that goes to a web site to purchase a digital book, will be rejected
  11.13 Details
We noticed that your app provides access to external mechanisms for purchases or subscriptions to be used in the app, which does not comply with the App Store Review Guidelines.

I am very sure that I didn't have any button or link inside of app to navigate user to website for payment.
My app do grab the subscription level from website by API to restrict user function by level. I am not very sure if this is not allowed by apple.
I check apple review guideline again and find

11.14 Apps can read or play approved content (specifically magazines, newspapers, books, audio, music, video and cloud storage) that is subscribed to or purchased outside of the App, as long as there is no button or external link in the App to purchase the approved content. Apple will only receive a portion of revenues for content purchased inside the App

Kindle and dropbox are following 11.14. they removed IAP from app and let user buy content from website. I can tell they are following 11.14. so apple approve that.
But 11.14 only works for magazines, newspapers, books, audio, music, video and cloud storage. while I am not sure whether my app belongs one of them. But my app is very similar with Evernote. Evernote provide payment both on website and IAP.
So my question is If Evernote remove IAP from app and only let user buy from website. will apple reject that? If not, then my app should not be rejected.

A: Ultimately this is a question that you should be asking Apple. Different reviews catch different things. Although you may not have a button to send people to your website to pay for the subscription, it kind of sounds like the only purpose of the website is to buy a subscription for the app (if i'm wrong feel free to correct me). If thats the case i can completely understand the rejection. Apple wants purchases made for subscriptions for the app to be made in the app which means going through Apple and dealing with them taking %30. If you make a website with the sole purpose of bypassing Apples guidelines then they are going to notice eventually.
Also the difference between your app and Evernote from the sounds of it, is that Evernote has other platforms that the subscription relates too. The app just happens to be another place the user can benefit from the subscription.
At the end of the day i would mostly recommend that you think about the user experience first. I get not wanting to shave off %30, but you may end up gaining more subscriptions by having IAP in your app and giving away the %30 then by not having an in app subscription mechanism at all.


text:
Q: Remove VAT from all product prices Recently a developer imported all products prices as without VAT. Problem is the prices are including VAT.
We want to remove 25% VAT from all products in our Magento shop. My first thought is to export all the products, open it in Excel and correct the prices, save it and import the prices.
Do you have an easy/better way to do it?

A: You need to have the correct settings in your configuration.
Look under System/Configuration/Sales/Tax/Calculation
If you write your product prices including taxes, then these options should be set to yes.

A: Add bellow script in file (test.php) on magento root and run your browser
<?php
require_once('app/Mage.php');
Mage::app('default');

class ABDUL
{
    public function index()
    {
        echo '<pre>';
        $collection = Mage::getResourceModel('catalog/product_collection');
        $collection->addAttributeToSelect('price');
        $collection->addAttributeToSelect('visibility');
        if(count($collection)) {
            foreach($collection as $product) {
                try {
                    $odlPrice = $product->getPrice();
                    $newPrice = $odlPrice -($odlPrice*25/100);
                    $product->setPrice($newPrice);
                    $product->setVisibility($product->getVisibility());
                    $product->setId($product->getId());
                    $product->save();
                    Mage::log('product sku: '.$product->getSku().' old price : '.$odlPrice.'new price : '.$newPrice,'product_price_update.log');
                } catch (Mage_Core_Exception $e) {
                   $e->getMessage();
                }
            }
        }
    }
}

$obj = new ABDUL();
$obj->index();
?>

Note : take your database backup first

redpajama_set_name: RedPajamaStackExchange


text:
Q: Postfix Recipient address rejected: Access denied Error Trying to use zend mail smtp to send email from my php app login authenticated and give me this constant error I don't have to deal with I look into de 36 question here on serverfault.com changing parameters as they explain without success.
The data:

*

*MY POSTFIX version 2.6.6

*I'm on Centos 6.5

*I'm trying to use Postfix and Dovecot with Dovecot-sasl

*My users are virtual created

*I'm able to sent mail via telnet on port 25 and 587

*5000 is my POSTFIX user

*Ips where i'm testing my app (if it help) is listed on bl.spamcannibal.org b.barracudacentral.org   pbl.spamhaus.org and zend.spamhaus.org

*My ip server is not listed

Telnet to 587 look like this:
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.mydomain.com ESMTP Postfix
ehlo localhost
250-mail.mydomain.com
250-PIPELINING
250-SIZE 10485760
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

Testing my ssl with:
openssl s_client -starttls smtp -crlf -connect mail.mydomain.com:25

Give me this answer ,last lines (I assume is OK)
Verify return code: 18 (self signed certificate)
---
250 DSN

if you need anything more just ask for that.
I Need to know, if you know, where this error used to came from ,at least.
Jan 13 13:44:16 domainname postfix/smtpd[22902]: NOQUEUE: reject: RCPT from mydomain.com[XX:XX:MY:IP]: 554 5.7.1 <mipersonalemail@hotmail.com>: Recipient address rejected: Access denied; from=<no-replay@mydomain.com> to=<mipersonalemail@hotmail.com> proto=ESMTP helo=<domainname>

My Postfix conf NON DEFAULT (postconf -n) give me this:  /postfix/main.cf
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
milter_default_action = accept
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = mydomain.com
myhostname = mail.mydomain.com
mynetworks = 127.0.0.1 xx:xx:xx:xx 127.0.0.0/8
myorigin = $mydomain
queue_directory = /var/spool/postfix
relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf
relayhost = $mydomain
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = plain, login
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtpd_client_restrictions = sleep 1,reject_unauth_pipelining,permit_sasl_authenticated
smtpd_delay_reject = yes
smtpd_error_sleep_time = 30
smtpd_hard_error_limit = 20
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, permit
smtpd_recipient_limit = 100
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks permit_tls_clientcerts reject_unauth_pipelining reject_non_fqdn_hostname reject_non_fqdn_sender reject_non_fqdn_recipient reject_unknown_recipient_domain reject_unauth_destination reject_invalid_hostname reject_rbl_client bl.spamcop.net reject_rbl_client b.barracudacentral.org reject_rbl_client sbl-xbl.spamhaus.org reject_rbl_client pbl.spamhaus.org reject_rbl_client zen.spamhaus.org reject_rhsbl_helo dbl.spamhaus.org reject_rhsbl_sender dbl.spamhaus.org permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = no
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain, permit
smtpd_soft_error_limit = 10
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /path/to/my/domain.crt
smtpd_tls_key_file = /path/to/my/domain.key
smtpd_tls_loglevel = 2
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_tls_cache
smtpd_tls_session_cache_timeout = 3600s
tls_random_exchange_name = /var/lib/postfix/prng_exch
tls_random_source = dev:/dev/urandom

And my master.cf look like this:
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
  -o smtpd_sasl_security_options=noanonymous
  -o smtpd_sasl_local_domain=$myhostname
  -o smtpd_client_restrictions=permit_sasl_authenticated,permit
  -o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       n       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING

Any suggestion would be good help.

A: In this line:
-o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject

You are rejecting not authenticated messages from submission port. You need change the test, to authenticate (AUTH command) or replace reject to reject_unauth_destination


text:
Q: MVC Pattern: Usage Best Practices I am striving to respect the best I can the MVC pattern. It simplifies the life of a developer (or devs) a lot. The thing that I am wondering about is how to load multiple sections at a time.
To make it clear, I am going to take the example of a to-do list (it's pretty used this days). Let's say there are project -> milestones -> tasks.
What we need:

*

*get them all - all the projects with all the milestones with all the tasks in a nested json encoded array.

*get only the projects

*get only the milestones

*get only the tasks

For the last three, we can have separate controllers that provide us with the corresponding data. The problem shows up when we try to "get them all" in a nested json-encoded array.
What is probably the best way to handle that?
I thought of a few possibilities:
 - Move the project, milestone and task generators in helper classes - this means we call them from the individual controllers and also call them when we need to get them all
 - From the view of the projects, call the controller/view of the milestones (of each project) [which in turn calls the controller/view of the tasks (of each milestone)]. This might look like a simulation of 3 requests in 1.
The motivation comes from the fact that while I could fetch all the projects and then the milestones of each and then the tasks of each milestone, it would take a lot of requests. If we could get all the calls in one, it would take considerably less time to get the data, let alone that in one request the data is more organized.

A: You definitely need to separate the data access concern into a logical layer that can be accessed from different controllers.
If you are willing to go down the DDD path, than it would make sense to identify your domain objects (Project, Task etc.), aggregate roots and then build repositories for data access. You can reuse the repositories (e.g. ProjectRepository, TaskRepository) in different controllers and the repository itself will be the unit of reuse that will allow you to get data from multiple controllers using the same interface. You can also leverage a unit of work if you need to get data from multiple repositories from the same controller efficiently.
If you are not going down the DDD path you can use an ActiveRecord pattern (like in Ruby on Rails) that will be a in-memory representation of a database record. This would be probably pretty simple to implement if you are using a relational SQL database.
I think that the Project in your case is the aggregate root, and that means you would have only one repository (ProjectRepository). That repository would have an operation to get all the projects and fetch all associated data (Milestones etc.) and that would be a fast operation optimized as close as possible to the data source (store procedure?). On the controller itself you would use the objects retrieved and serialize/encode to JSON.

A: Make 3 independent JSON requests from browser. Don't worry.
If you turn on Firebug, and open mail.google.com - you will see there more than 40 requests.


text:
Q: Can git format patch so it can be used with patch program? I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility.
Can it be done?

A: The accepted answer states the following:

Patches, that git diff yields, are correctly processed by patch tool.

I'm pretty sure I just ran into a case where this is incorrect. /usr/bin/patch just silently (without reporting an error) ignored my patch including file rename information, thereby breaking a deployment (fortunately I'm only testing the deployment at the moment :-) ...
I'm posting this alternative answer as a heads up for other people running into the same problem because I was scratching my head for a while... Also comments to answers on StackOverflow apparently can't contain quotes.
Ironically enough I just now switched to the unified diff format to overcome this problem and now my deployment breaks in a different way because unified diffs can't represent the creation of empty files (e.g. __init__.py). Talk about being between a rock and a hard place!

A: Patches, that git diff yields, are correctly processed by patch tool.
patch skips all the additional info git appends to the patch file.  To apply the patch you most likely will need -p1 option.


text:
Q: How to create a executable Jar file for the Groovy script developed using Eclipse IDE I have developed groovy script to run the Automation Testing using Eclipse IDE. The code generally triggers the Web service based on the input and Validates the responses.
I have exported the jar file by right clicking the project. The jar file is created.
But when I try to run the jar using Command prompt I am facing an error.
Can anyone please help me how to create a executable jar for the Groovy script


text:
Q: PowerPoint 2010 VSTO Question How do I go next/previos slide from within the addin

A: As VSTO uses Interop for just about everything (not everything), you can use the samples on MSDN for VSTO-specific solutions. What you want is SlideShowView.Next and SlideShowView.Previous.


text:
Q: Schedule a Particular task on every Friday via WorkManager API I am using workmanager to send sms at every Friday for reminder purpose. even, app is closed state also.
sample:
PeriodicWorkRequest periodicWork = new
    PeriodicWorkRequest.Builder(MyWorker.class, 7, TimeUnit.DAYS).build();
WorkManager.getInstance().enqueue(periodicWork);

can anyone help on this. Thanks.
Note: I have this onetime request. its working fine. even, app is closed also.
WorkManager workManager = WorkManager.getInstance();
workManager.enqueue(new OneTimeWorkRequest.Builder(MyWorker.class).build());

If suppose, workmanager is not possible, please suggest any other api also in android.
Already Refereed this link also: its not working.
Schedule a work on a specific time with WorkManager

A: Not the best solution but it works.
Use PeriodicWorkRequest and schedule the task daily. Then use jodatime library and check if the day is Friday. If it's Friday execute the task. If not cancel the task. Based on the first execution you can manipulate the PeriodicWorkRequest to schedule every Friday by adding 6 to the request.

A: WorkManager is a wrong choice for this use case.
Why?
WorkManager is intended for tasks that are deferrable—thatis, not required to run immediately—and required to run reliably even if the app exits or the device restarts.
You should be using AlarmManager if you want your task to be run exactly at some point of time.

A: Can use AlarmManager (not tried with workmanager, but with following way with AlarmManager tested and working).
This execute once a week on Friday, you need register Broadcast receiver to receive intent, so that you can do your sms sending on Receive..
    PendingIntent pintent = PendingIntent.getBroadcast( this, 0, new Intent("RECIVER"), 0 );

    AlarmManager alarm = (AlarmManager) Context.getSystemService(Context.ALARM_SERVICE);
    Calendar timeOff = Calendar.getInstance();
    int days = Calendar.FRIDAY + (7 - timeOff.get(Calendar.DAY_OF_WEEK));
    timeOff.add(Calendar.DATE, days);
    timeOff.set(Calendar.HOUR, 12);
    timeOff.set(Calendar.MINUTE, 0);
    timeOff.set(Calendar.SECOND, 0);

    alarm.set(AlarmManager.RTC_WAKEUP, timeOff.getTimeInMillis(), pintent);

A: Below steps might be helpful:

*

*Use the Alarm Manager Api to trigger a pending intent.

*Do step 1 after receiving the broadcast.

*Do step 1 after the device rebooted(BOOT_COMPLETED) using another Broadcast Receiver.


text:
Q: Haskell Squeal SQL library - Type error with MonadReader I'm building a Haskell Servant API using an SQL library called Squeal:
https://github.com/morphismtech/squeal
I need help getting the types correct so the app compiles.
My Schema is of type

type Schema = '["users" ::: UsersTable, ...]
type Schemas = Public Schema

Where Public is a type family for a single schema database. It's from:
http://hackage.haskell.org/package/squeal-postgresql-0.5.1.0/docs/Squeal-PostgreSQL-Schema.html
I'm trying to pass the Connection Pool in a Reader like this:

import qualified Squeal.PostgreSQL             as S
import qualified Squeal.PostgreSQL.Pool        as SPG

newtype AppT m a
    = AppT
    { runApp :: ReaderT SquealPool (ExceptT ServerError m) a
    } deriving
    ( Functor, Applicative, Monad, MonadReader SquealPool, MonadError ServerError
    , MonadIO
    )

type App = AppT IO

type SquealPool = SPG.Pool (SQ.K S.Connection Schema)

My SQL query & session are something like this:

emailQuery :: Query_ Schemas (Only Text) UserEmail
emailQuery = select (#email `as` #email)
                    (from (table #users) & where_ (#email .== param @1))

emailTakenSession
    :: (MonadReader SquealPool m, MonadPQ Schemas m, MonadIO m)
    => Text
    -> m UserEmail
emailTakenSession email = do
    result <- runQueryParams emailQuery (Only email)
    email  <- getRow 1 result
    return email

Finally, I'm using them in the Servant handlers like this:

emailTaken :: MonadIO m => Text -> AppT m APIEmail
emailTaken emailStr = do
    pool   <- ask -- this produces error
    result <- liftIO $ runPoolPQ (Q.emailTakenSession emailStr) pool
    return $ APIEmail result True

Problem
The compiler reports an error in ask in emailTaken:
 * Couldn't match kind `[(ghc-prim-0.5.3:GHC.Types.Symbol,
                         Squeal.PostgreSQL.Schema.SchemumType)]'
                 with `Squeal.PostgreSQL.Schema.SchemumType'

From what I understand, it's trying to match type family Schemas with type Schema.
Question
How do I need to edit the type signatures to get this to compile and work?
Particularly emailTakenSession is probably off at least.

Solution
In the interest of completeness for other readers, I needed to change

type SquealPool = SPG.Pool (SQ.K S.Connection Schema)

into

type SquealPool = SPG.Pool (S.K S.Connection '["public" ::: Schema])

The type family would resolve to this anyway, and this way I'm not providing an  illegal construct (a type family) to MonadReader derivation in AppT.

A: Here's a skeleton of how I combine Squeal & Servant.
{-# LANGUAGE
    DataKinds
  , OverloadedLabels
  , OverloadedStrings
  , PolyKinds
#-}

module SquealServant where

import Control.Monad.IO.Class
import Data.String
import Servant
import Squeal.PostgreSQL
import Data.Pool

type DB = Public Schema

type Schema = '[] -- your schema here

type API = Get '[JSON] String -- your api here

type PoolDB = Pool (K Connection DB)

application :: PoolDB -> Application
application pool = serve api (server pool)

server :: PoolDB -> Server API
server pool = hoistServer api (handler pool) serverT

handler :: PoolDB -> PQ DB DB IO x -> Handler x
handler pool session = do
  errOrResult <- liftIO . usingConnectionPool pool $
    trySqueal (transactionally_ session)
  case errOrResult of
    Left err -> throwError (sqlErr err)
    Right result -> return result

sqlErr :: SquealException -> ServerError
sqlErr err = err500 { errBody = fromString (show err) }

api :: Proxy API
api = Proxy

serverT :: ServerT API (PQ DB DB IO)
serverT = hello

hello :: PQ DB DB IO String
hello = do
  Only greeting <- getRow 0 =<< runQuery helloQ
  return greeting

helloQ :: Query_ DB () (Only String)
helloQ = values_ ("hello world" `as` #fromOnly)

usingConnectionPool :: PoolDB -> PQ DB DB IO x -> IO x
usingConnectionPool pool (PQ session) = unK <$> withResource pool session


text:
Q: Keras in `pip list` and anaconda package list but cannot import I am using anaconda 4.4.0 with Python 3.6.2. First, I pip installed Keras, it shows on pip list and conda list and also in environment>root>packages in Anaconda. But when I use import keras ,in Anaconda or in Terminal, I get

Traceback (most recent call last):
   ...
   ModuleNotFoundError: No module named 'keras'

I tried installing Keras with anaconda also, and I get the same ModuleNotFoundError.
I have also tried uninstalling it, then download the master branch from github and install using python setup.py install. Again the package is in the lists but I cannot import it.
UPDATE:
I have uninstalled packages several times and installed using Keras package in pypi, Now I am able to import the packages in the python in terminal. But still I cannot import in jupyter notebook.
It may worth mentioning that I am working with MacOS Sierra 10.

A: If you are able to import in shell but not in the notebook, according to gnestor's answer to this question, your python may use different executables. Run:
import sys
sys.executable

in shell and in notebook. If the directories are different then you must change the kernelspec of the notebook. This might have happened by installing Tensorflow or other packages that change the environment and kernelspec. You can find the kernelspec directory with this command:
from jupyter_core.paths import jupyter_data_dir
print(jupyter_data_dir())

In that directory you will find a JSON file. Open it and change the path to your working python directory. (working python directory in which python)

A: use python -m pip install keras
Then, use python shell to check for installation.

A: try this code:
conda install -c deeplearn keras

Basically, the full answer you can find here:
Install Python package: "Package missing in current win-64 channels"
However, it seems to me you are using different python in your terminal.
Check this command in the terminal:
which python

It should return something like this:
/Users/***/anaconda3/bin/python

A: Try running:
conda install jupyter
conda install tensorflow
pip install Keras

with your conda environment activated. Don't ask me why - Anaconda's behavior baffles me. (I've created a .yml script with these yet I still seem to need to do this step)


text:
Q: how to get soft keypad to write email id in edittext in android I am using android:phoneNumber to open soft keypad to get phone number in android.I want to open keypad which contains all key required to write email id in edittext.So is there any solution for this(email) like phone number.
Thank you

A: Use textEmailAddress (0x00000021) as defined here: http://developer.android.com/reference/android/widget/TextView.html
In Java code:
 myEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

In XML properties:
 android:inputType="textEmailAddress"

A: use the below code for getting the email soft keyboard
Editetxt email=(EditText)findViewById(R.id.edotetxtemail)
email.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

A: you can set property Input Type for EditText


text:
Q: How to does the token prevent csrf attack? I have read about CSRF and how the Unpredictable Synchronizer Token Pattern is used to prevent it. I didn't quite understand how it works.
Let's take this scenario :
A user is logged into a site with this form:
<form action="changePassword" method="POST">
   <input type="text" name="password"><br>
   <input type="hidden" name="token" value='asdjkldssdk22332nkadjf' >
</form>

The server also stores the token in the session. When the request is sent it compares the token in the form data to the token in the session.
How does that prevent CSRF when the hacker can write JavaScript code that will:

*

*Send a GET request to the site

*Receive html text containing the request form.

*Search the html text for the CSRF token.

*Make the malicious request using that token.

Am missing something?

A: The attacker can't use JavaScript to read the token from the site, because it would be a cross-origin request and access to the data from it is blocked (by default) by the Same Origin Policy (MDN, W3C).
Take this for example:

var xhr = new XMLHttpRequest();
xhr.open("GET", "http://google.com");
xhr.addEventListener('load', function (ev) {
    console.log(this.responseText);
});
xhr.send();

The JS console reports:

XMLHttpRequest cannot load http://google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource.

A: It's important to realize that CSRF attacks only happen in the browser. The user's session with the target server is used by the malicious server to forge requests. So how does #1 happen? Two options: you could make the #1 request from the malicious server, but that would simply return a CSRF token for the server's session, or you could make the #1 request using AJAX which, as you correctly identified, would return the CSRF token of the victim user.
Browsers have implemented HTTP access control for this very reason. You must use the Access-Control-Allow-Origin header to restrict which domains may make AJAX requests to your server. In other words your server will ensure the browser doesn't let the malicious site do #1. Unfortunately the documents I've read on the matter aren't very clear about it, but I think that's because servers by default do not send an Access-Control-Allow-Origin header unless configured to do so. If you do need to allow AJAX requests, you must either trust any origins in the header not to perform a CSRF attack, you can selectively lock down sensitive portions of your application to not allow AJAX requests, or use the other Access-Control-* headers to protect yourself.

Using a Synchronizer Token is one way that an application can rely
  upon the Same-Origin Policy to prevent CSRF by maintaining a secret
  token to authenticate requests

https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet
You should read up on Cross-Origin Resource Sharing (CORS).


text:
Q: How to change Max Schedulable Application for Hadoop Apache 2.2 I am playing around with capacity-scheduler. I have updated number of total applications running on cluster and total number of applications that can be submitted by user more than 1 respectively. Yet it does not allow me to submit more than one job. I was going through the scheduler configuration available at Web Interface, and I came across Max Schedulable Applications, of whose value is 1.
Can some one please tell me which property do I need to add to get maximum schedulable applications more than 1.

A: I've patched /etc/hadoop/capacity-scheduler.xml
<property>
  <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
  <value>100</value>
  <description>
    Maximum percent of resources in the cluster which can be used to run
    application masters i.e. controls number of concurrent running
    applications.
  </description>
</property>

And that increased Max Schedulable Applications property.
EDIT: In newer versions of Hadoop Yarn the value for yarn.scheduler.capacity.maximum-am-resource-percent is given as a float where 0.5 = 50% and 1.0 = 100%.

A: I increased the memory for Application Master and I allowed me to schedule multiple jobs on cluster.


text:
Q: PHP MySQL and forms, nothing happens I'm trying to code a page that checks a database if a users ip address exists, if not it offers them to signup in a form, if the user does exist then it offers a "play" button.
For some odd reason it's not working, I have an account in the DB but it still won't offer the "play" button. I've also tried signing up with the form I've made, but the page doesn't do anything when I click submit.
<?php
    $con = mysqli_connect("localhost","root","","********");
    $ip = $_SERVER['REMOTE_ADDR'];

    // Check connection
    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

    //Checking DB Connection//
    $result = mysqli_query($con,"SELECT * FROM users WHERE ip='$ip'");

    while($row = mysqli_fetch_array($result)) {
        $rsname = $row['rsname'];
        $tokens = $row['tokens'];
    }

    if (mysqli_num_rows($result) > 0) {
        if ($tokens >= 1) {
            echo '
Hello '.$rsname.'! Click The Button Below To Play!';
            echo '<button>Play!</button>';
        }
        else {
            echo '
Your Account "'.$rsname.'" Already Exists, But You Do Not Have Any Tokens.

';
            echo '
You Can Purchase More Token From "Got Your IP" In Game For 20k/Token.
';
        }
    }
    else if (isset($_POST['rsname'])) {
        $sql="INSERT INTO users (rsname, ip)
        VALUES
        ('$_POST[rsname]','$_SERVER[REMOTE_ADDR]')";

        if (!mysqli_query($con,$sql)) {
            die('Error: ' . mysqli_error($con));
        }

        echo '
Your account has been setup! Click the button below to play!
';
        echo '<button>Play!</button>';
    }
    else {
        echo '
You Need To Register To Play RSLOTTO.
';
        echo '<form id="form1" name="form1" method="post" action="play.php">';
        echo 'RuneScape Username:';
        echo '<input name="rsname" type="text" id="rsname" size="32" maxlength="40" />';
        echo '<input name="submit" type="button" value="submit" /></form>';
        echo 'We only ask for your username and not a password, because we tie your username to     your IP address so you don\'t need to enter a password. Safe as can be! :D';
    }

    mysqli_close($con);
?>

A: Checking a client using IP address is not a good scenario. Most users will be having IP address that changes dynamically.
Here a good solution would be to set a cookie in user browser that will not expire. So when the user visits your page again, you can check for the cookies which are set. If the cookie exist, then show the play button or else the registration page. This solution has also many downfalls. But we need to go with that. If the user deletes the browser cookie or so, then we have no other choice. This is not a best solution, but you can try this.
Please look at this thread for how you can identify unique visitors : Detecting a "unique" anonymous user
In your case the form is not submitting, because you are using input type="button".
<input type="button" /> buttons will not submit a form - they don't do anything by default. They're generally used in conjunction with JavaScript as part of an AJAX application.
<input type="submit"> buttons will submit the form they are in when the user clicks on them, unless you specify otherwise with JavaScript.
In your case,
<input name="submit" type="button" value="submit" />

should be
<input name="submit" type="submit" value="submit" />

So your form should be :
echo '<form id="form1" name="form1" method="post" action="play.php">';
echo 'RuneScape Username:';
echo '<input name="rsname" type="text" id="rsname" size="32" maxlength="40" />';
echo '<input name="submit" type="submit" value="submit" /></form>';

Hope this helps you :)


text:
Q: Trying to highlight a selected item from a GridView I have a Gridview and when i press a certain element, i want paint the background.
I have an adapter to load the gridview elements dinamically. And i have a listener on that adapter.
On that listener, i put the background with the color that i want, but then it also paints another element down the list (i guess the one with the same position, after the view is reloaded).
Important : My minimum API is 9, and i can't really change it.
Here is the code for my getView method (from the adapter) :
   @Override
public View getView(int position, View convertView, ViewGroup parent) {

    viewHolder = null;
    if (convertView == null) {

        viewHolder=new ViewHolder();

        LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view=layoutInflater.inflate(R.layout.highwayappselectionitem,parent, false);

        viewHolder.appImageIcon=(ImageView) view.findViewById(R.id.highwayGridViewItemIcon);
        viewHolder.appNameLabel=(TextView) view.findViewById(R.id.highwayGridViewItemName);
        viewHolder.appInfoButton = (ImageView) view.findViewById(R.id.highwayGridViewItemInfoButton);
        viewHolder.linearLayout = (LinearLayout) view.findViewById(R.id.HighwayGridViewItem);

    }else{
        view= convertView;
        viewHolder = (ViewHolder) convertView.getTag();
    }

    viewHolder.appNameLabel.setText(appsList.get(position).getAppName());
    viewHolder.appImageIcon.setImageDrawable(appsList.get(position).getImageIcon());

    view.setTag(viewHolder);

    viewHolder.linearLayout.setOnClickListener(new MyOnClickListener(position,0));

    return view;
}

and here is the listener for the linearlayout (that represents each item):
public void onClick(View v) {

        if(selectedView==0 || selectedView==1){

            appName=appsList.get(position).getAppName();
            filePath=appsList.get(position).getFilePath();
            appLogo=appsList.get(position).getImageIcon();

           v.setBackgroundColor(activity.getResources().getColor(R.color.light_grey));

            System.out.println("Just pressed the app ... "+appName);
            System.out.println("His filePath is ... "+filePath);

            HighwayGridViewAppItem tmpSelectedItem= new HighwayGridViewAppItem(appLogo, appName, filePath);
            selectedAppsList.add(tmpSelectedItem);

            System.out.println("AppSelectionCUstomAdapter : Added a new application to the list of selected apps .!!!!!!!!!!!!!!!.........");
            System.out.println("AppselectioncustomAdaptaer  :   The size of the selectedAppsList is now  : "+selectedAppsList.size());

        }else{
            //pressed the info button
            System.out.println("This will be implemented later, need access to the webservices");
        }
    }
}

ignore the if(selected view ==0 or ==1 it is not being used anymore, i can delete it... ).
Also, appsLIst is a list my custom class of items. There i have a boolean attribute to represent if it is selected or not.
WHat is happening is , imagine this gridview:
A B C
D E F

G H I
J K L
The grey line represents the scroll... if scroll those new elements show up.
If i press B, it selects B, but it also selects H.
I tried to do research but the problems that I found weren't the same.
Something that might help.. the gridview used to add repeated elemetns, so when i add the elements to the gridview i check if the list of elements already has a similar element, if so i dont add it.

A: You need to add this line when you want to keep selected some item of gridview after selection.
((BaseAdapter) gridView.getAdapter()).notifyDataSetChanged();

Edit I think there is problem in getView method that's why you are getting duplicate values:
public View getView(int position, View convertView, ViewGroup parent) {
   View view = convertView;
    if (view== null) {  // if it's not recycled, initialize some attributes
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(     Context.LAYOUT_INFLATER_SERVICE );
        view = inflater.inflate(R.layout.highwayappselectionitem, parent, false);
    }

}


text:
Q: Terminate another task from within a postDebugTask - VS Code I have a debug launch configuration (launch.json) like below.
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Current TS File",
            "type": "node",
            "request": "launch",
            "preLaunchTask": "Pre Debug Task",
            "postDebugTask": "Stop Watch Styles",
            "args": ["${relativeFile}"],
            "runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
            "sourceMaps": true,
            "cwd": "${workspaceRoot}",
            "protocol": "inspector",
        }
    ]
}

My tasks configuration (tasks.json) is like
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "next:copy",
            "label": "Copy Files",
            "problemMatcher": []
        },
        {
            "type": "npm",
            "script": "styles:tsw",
            "label": "Watch Styles",
            "problemMatcher": [],
        },
        {
            "label": "Pre Debug Task",
            "isBackground": true,
            "dependsOn" :[
                "Copy Files",
                "Watch Styles"
            ]
        },
        {
            "label": "Stop Watch Styles",
            // No sure what should come here
        }
    ]
}

Trying to stop watch process in postDebugTask, is there a way to Terminate Task by providing name (Watch Styles) as parameter in tasks.json. Watch styles is a continuously running process, please suggest if there is any other approach to terminate a task after debugging is complete.

A: This works for me:
{
   "label": "postdebugKill",
   "type": "process",
   "command":[
      "${command:workbench.action.tasks.terminate}",
      "${command:workbench.action.acceptSelectedQuickOpenItem}",
   ],
},

The first "${command:workbench.action.tasks.terminate}" will bring up a panel asking you to select which task to terminate.  So if you had multiple running tasks and wanted to choose one you would use this command only.
The second "${command:workbench.action.acceptSelectedQuickOpenItem}" will terminate the selected task in that panel mentioned above.  (So you will not even see the terminate panel.)  If you have only one running task when you call the postdebugKill task, it will be selected automatically and thus terminated.  Otherwise whichever task is listed first will be terminated.  Again, if you have more than one other task running and you want to select which to terminate don't include this second command.
I don't know of any way to list, perhaps via an args option a label name for which task to terminate if running.  It would be nice to have this functionality.
[postdebugKill name can be whatever you want.]
To call a postdebug task your launch.json config might look like this:
{
   "type": "node",
   "request": "launch",
   "name": "Gulp: serve",
   "program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
   "args": [
     "serve"
   ],

   //  "preLaunchTask": "someTask",

   "postDebugTask": "postdebugKill"
},

Upon stopping that "Gulp: serve" debugging session, the task "postdebugKill" will be triggered.  And so if I had used the "preLaunchTask" to start a task or had simply started a task running before launching the "Gulp: serve" debugging session - that preLaunchTask would be terminated.
The ability to run vscode commands in a task was recently added to vscode.  Some minimal info here: using a command in a task doc.

A: [I'll add another answer because the new additional info is extensive.]
It seems there is an issue with running a preLaunchTask and then launching a debugging session.  See particularly debugging does not work on first try.  It appears to be fixed though in an insiders edition and may be released in early February 2019.  terminal not sending onLineData.
In the meantime there is a suggested fix within one of the issues that I have lost the link to and that is a problemMatcher which will signal to the debugger that the dependent tasks have completed.
In my watching task I used this:
"problemMatcher": [
   {
     "base": "$tsc-watch",
     "background": {
       "activeOnStart": true,
       "beginsPattern": "Using gulpfile ~\\OneDrive\\experimental\\gulpfile.js",
       "endsPattern": "Starting 'watch'..."
     }
   }
],

I chose that because when I manually start the gulp:watch task I get this in the terminal:
[22:27:48] Using gulpfile ~\OneDrive\experimental\gulpfile.js
[22:27:48] Starting 'watch'...
[22:27:48] Starting 'watch'...

So you see the start and end pattern there that I copied (with extra escaping).
I suggest that you separately run your "Pre Debug Task" and copy the start and ending output into your "Pre Debug Task" problemMatcher and see if it now works.
My code in the first answer I believe is correct, I just wasn't using "isBackground" and "dependsOn" as you are.  But I have added "isBackground" to mine and the problemMatcher option and it works flawlessly now.
Hopefully, this will be fixed in the next February 2019 release and there will be no need for this workaround.

A: If on Linux or macOS, a less hacky solution that just works is using pkill. If on Windows, see below.
First run the task and find the full command vscode runs for that task, with $ ps -af
Then use pkill + the full command in a postDebugTask.
I have an entry in tasks.json like this:
{
    "label": "stop npm:watch",
    "type": "shell",
    "command": "pkill -f 'sh -c node ./scripts/watch.js'",
    "presentation": {
        "reveal": "silent",
        "panel": "dedicated",
        "close": true,
    }
}

'sh -c node ./scripts/watch.js' is how vscode runs my npm:watch task.
The presentation properties prevent this task from taking focus or taking up terminal space after it finishes successfully.
Then you reference that task in a launch.json configuration:
{
    ...
    "preLaunchTask": "npm:watch",
    "postDebugTask": "stop npm:watch",
    ...
}

If the full command contains changing parameters (paths, port numbers, etc.), you can use a part of the command or regex.
e.g.: I could have probably matched with './scripts/watch.js' or 'node.*watch'.

For Windows: you can make this work by substituting pkill for taskkill.
If you want to support both Unix and Windows, you can make a script that does one or the other depending on the underlying OS.

A: This will terminate all tasks after debug stops
Or in this case, just build_runner watch...
launch.json
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Flutter",
      "request": "launch",
      "type": "dart",
      "flutterMode": "debug",
      "preLaunchTask": "flutter: build_runner watch",
      "postDebugTask": "Terminate All Tasks"
    }
  ]
}

tasks.json
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Terminate All Tasks",
      "command": "echo ${input:terminate}",
      "type": "shell",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "terminate",
      "type": "command",
      "command": "workbench.action.tasks.terminate",
      "args": "terminateAll"
    }
  ]
}

More info here: https://code.visualstudio.com/docs/editor/variables-reference#_command-variables


text:
Q: Enter password only once for a script that uses rsync and SSH I am trying to write a script that pushes a website to my server, where the website files are on my local machine for testing.
It works now, by using rsync to update the server, then ssh to get the server to run a script that does a few things (namely restart apache – the website uses WSGI).
The problem is that I have to input my password for the server twice, which I am not fond of.
Is there a way to make it so that I only have to input my password once?  I don't particularly want to not have to enter my password at all, so I would like to have some way to do it without the ssh-key thing.

A: Look up the -M and -S options in ssh(1). The idea is to open a master connection to the server, and then do multiple accesses as slave connections through the open socket. Also see ControlMaster and ControlPath in the ssh_config(5) manual.

A: We have a similar complicated setup at our university. Users are required to use password login.
Eventually I learnt about expect which can automate this.
In my case I made my program a bit unreadable so that the password would not be obvious visible.
Anyway – first well readable example I found is here:
#!/usr/local/bin/expect
spawn  sftp  -b cmdFile user@yourserver.com
expect "password:"
send "shhh!\n";

The idea is to completely recreate the process of your manual logon. So you will need to know beforehand what "questions" your script will encounter and what it should reply.
Also the command in my case it was
spawn  ssh user@myserver.com

Replace the string in expect to what is shown in YOUR case – and also input replies as will be required there.
So e.g. if you have to enter your password twice – add another
expect "password:"
send "my_super_secret_password\n";

Don't forget to add the commands for putting your website in the script ;) It will look like:
expect "prompt:"
send "update my website\n"

A: There is a similar questions with another descriptive answer you can find HERE.
Just in case it is helpful, I made this generic script with two different rsync processes following Kusalananda's suggestion:
#!/usr/bin/env bash

REMOTEUSER=username
REMOTEHOST=hostname

mkdir -P ~/.ssh/ctl
ssh -nNf -o ControlMaster=yes -o ControlPath="$HOME/.ssh/ctl/%L-%r@%h:%p" $REMOTEUSER@$REMOTEHOST

rsync -axuv -e "ssh -o 'ControlPath=$HOME/.ssh/ctl/%L-%r@%h:%p'" --progress --delete-after /localdir01/ $REMOTEUSER@$REMOTEHOST:/remotedir01/

rsync -axuv -e "ssh -o 'ControlPath=$HOME/.ssh/ctl/%L-%r@%h:%p'" --progress --delete-after /localdir02/ $REMOTEUSER@$REMOTEHOST:/remotedir02/

ssh -O exit -o ControlPath="$HOME/.ssh/ctl/%L-%r@%h:%p" $REMOTEUSER@$REMOTEHOST


text:
Q: How can I detect that a View was load in the tabBarController.moreNavigationController? I need to redraw the UINavigation Bar when I load a View from the moreNavigationController. How can I detect that a view has been loaded by the tabBarController.moreNavigationController?

A: The view controller responsible for the view will get a viewDidLoad callback. If you want to know when a navigation pushes/pops view controllers you can set a delegate to the navigation controller and implement the following methods
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated


text:
Q: Grand Total is wrong in Google Data Studio I have a table in Google Data Studio with the following data:

Date    Users
1-Mar-18    616
2-Mar-18    632
3-Mar-18    550
4-Mar-18    567
5-Mar-18    688
6-Mar-18    1,844
7-Mar-18    788
8-Mar-18    2,153
9-Mar-18    1,469
10-Mar-18   554
11-Mar-18   448
12-Mar-18   861
13-Mar-18   1,578
14-Mar-18   823
15-Mar-18   628
16-Mar-18   556
17-Mar-18   292
18-Mar-18   311
19-Mar-18   635
20-Mar-18   1,966
21-Mar-18   1,111
22-Mar-18   748
23-Mar-18   610
24-Mar-18   366
25-Mar-18   359
26-Mar-18   720
27-Mar-18   2,103
28-Mar-18   879
29-Mar-18   664
30-Mar-18   562
31-Mar-18   272

If you sum the "Users" you will come up with 26353 as a total. However, if you check the "Show summary row" box on the "Data" tab for the table, the "Grand Total" for users is listed as 20,997.
Furthermore, if I create a scorecard with "Users" as the metric over the same date period, I get 20,997 as the total number of Users. However, if I reduce the date period to cover any single day, I will get the same value value for users for that day as I see in the table (e.g. A scorecard on Users with a date range from March 1 to March 1 will show 616 Users).
I am not sure where this difference is coming from, and I'm not sure which number to trust.

A: This is because of your breakdown dimension (date). Google Analytics does its best to deduplicate users. So, if you're looking at the whole month, it will tell you that you had 20,997 users. But if you add a specific day to the mix and some of those users came back multiple times, then you'll necessarily have a higher number. Each of those users is only counted once for the aggregate number, but when split out by day, they may be listed several times.


text:
Q: Not getting redirection to custom error page using custom errors - ASP.Net Here's my Application_OnError event sink in global.asax.vb:
    Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs)

    Dim innerMostException As Exception = getInnerMostException(Me.Context.Error)

    If TypeOf innerMostException Is AccessDeniedException Then

        Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException))

        Dim fourOhThree As Integer = DirectCast(HttpStatusCode.Forbidden, Integer)

        Throw New HttpException(fourOhThree, innerMostException.Message, innerMostException)

    End If

End Sub

You'll see that if we've got an innermost Exception of type AccessDeniedException we throw a new HTTPExcpetion with a status code of 403 AKA 'forbidden'
Here's the relevant web.config entry:
    <customErrors defaultRedirect="~/Application/ServerError.aspx" mode="On">
      <error statusCode="403" redirect="~/Secure/AccessDenied.aspx" />
    </customErrors>

So what we're expecting is a redirect to the AccessDenied.aspx page.  What we get is a redirect to the ServerError.aspx page.
We've also tried this:
    Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs)

    Dim innerMostException As Exception = getInnerMostException(Me.Context.Error)

    If TypeOf innerMostException Is AccessDeniedException Then

        Security.LogAccessDeniedOccurrence(DirectCast(innerMostException, AccessDeniedException))

        Context.Response.StatusCode = DirectCast(HttpStatusCode.Forbidden, Integer)

    End If

End Sub

Which unsuprisingly doesn't work either.
Any ideas what we're doing wrong?

A: Application_Error is intended to catch errors that aren't handled by your application. When it fires, an error has already happened and everything is about that error. If you throw an error from within Application_Error you are actually saying "there's an error with my error handler". Instead just Server.Transfer to the appropriate page. If you want to keep all of your redirection logic in web.config you can see this article about how to parse the customErrors section to figure out where to redirect to.
All this said, and I haven't tried this, but can you try calling Server.ClearError():
            Dim Ex = Server.GetLastError()
            Server.ClearError()
            Throw New HttpException(System.Net.HttpStatusCode.Forbidden, Nothing, Ex)

I don't think it will work because of what I said above but its worth a try.


text:
Q: Is it valid to write $\lim_{x \rightarrow \infty}\frac{2}{x^r}=2.\frac{1}{\infty}=0$ in limits? I'm wondering if it's valid to write the follwing: $$\lim_{x \rightarrow \infty}\frac{2}{x^r}=2\lim_{x \rightarrow \infty}\frac{1}{x^r}=2.\frac{1}{\infty}=2.0=0$$
I know it's valid to say that $\frac{1}{\infty}=0$ in limits but I'm not suring if it would be valid to say $2.\frac{1}{\infty}=2.0=0$

A: You should avoid manipulating $\infty$ like numbers. your result is right just skip the step where you wrote $\frac 1 {\infty}$

A: Since the limit of a product is the product of the limits:
$$
\lim_{x\to \infty} \frac{2}{x^r}= 2\lim_{x\to\infty}\frac{1}{x^r}= 2\times 0=
0\, ,\qquad (r>0)\,
$$
since $\lim_{x\to \infty}1/x^r=0$ for $r>0$.

A: There are some operations with infinite limits that are valid. One of them is as follows:
Let $ (x_n)_{n \in \mathbb N} $ and  $ (y_n)_{n \in \mathbb N} $ sequences of positive real numbres such that:
$ (x_n)_{n \in \mathbb N} $ is bounded and  $\lim_{n \to \infty}
y_n = +\infty $
Then
$\lim_{n \to \infty}
{x_n}/{y_n} = 0 $.
This property remains valid if we consider functions rather than sequences. In this case, the constant function equal to 2 is bounded and the function $ x^r $ is such that it tends to infinity where $ x $ tends to infinity. Where $ r > 0 $.


text:
Q: What's the difference between ".colorName" and "Color.colorName" in SwiftUI? Why is it showing two outputs if they are the same? I was learning Swift UI and I faced an issue regarding colors. If I use background(.red) then my output of the button looks like this (Line number 39).

But the weird part is that if I use background(Color.red) then my output of the button looks like this (Line number 39).

Now my questions are

*

*Why two different outputs?

*What's the actual difference between Color.red and .red?

*When to use Color.red and .red?

Full code is given below
Using .red code
//
//  ContentView.swift
//  Dicey-SwiftUI
//
//  Created by Moh. Absar Rahman on 26/11/21.
//

import SwiftUI

struct ContentView: View {
    @State var leftDiceNumber = 1
    @State var rightDiceNumber = 1

    var body: some View {
        ZStack {
            Image("background")
                .resizable()
                .edgesIgnoringSafeArea(.all)
            VStack {
                Image("diceeLogo")
                Spacer()
                HStack {

                    DiceView(n: leftDiceNumber)
                    DiceView(n: rightDiceNumber)
                }
                .padding(.horizontal)
                Spacer()
                Button(action: {
                    leftDiceNumber = 2
                    rightDiceNumber = 2
                }) {
                    Text("Roll")
                        .font(.system(size: 50))
                        .fontWeight(.heavy)
                        .foregroundColor(.white)
                        .padding(.horizontal)
                }
                .background(.red)
            }

        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

struct DiceView: View {
    let n: Int
    var body: some View {
        Image("dice\(n)")
            .resizable()
            .aspectRatio(1, contentMode: .fit)
            .padding()
    }
}

Using Color.red code
//
//  ContentView.swift
//  Dicey-SwiftUI
//
//  Created by Moh. Absar Rahman on 26/11/21.
//

import SwiftUI

struct ContentView: View {
    @State var leftDiceNumber = 1
    @State var rightDiceNumber = 1

    var body: some View {
        ZStack {
            Image("background")
                .resizable()
                .edgesIgnoringSafeArea(.all)
            VStack {
                Image("diceeLogo")
                Spacer()
                HStack {

                    DiceView(n: leftDiceNumber)
                    DiceView(n: rightDiceNumber)
                }
                .padding(.horizontal)
                Spacer()
                Button(action: {
                    leftDiceNumber = 2
                    rightDiceNumber = 2
                }) {
                    Text("Roll")
                        .font(.system(size: 50))
                        .fontWeight(.heavy)
                        .foregroundColor(.white)
                        .padding(.horizontal)
                }
                .background(Color.red)
            }

        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

struct DiceView: View {
    let n: Int
    var body: some View {
        Image("dice\(n)")
            .resizable()
            .aspectRatio(1, contentMode: .fit)
            .padding()
    }
}

Note: Please do not laugh at me. I am still a beginner who is trying his best to learn SwiftUI

A: This is called implicit member expression. in situations where the type can be inferred from other information, like return types, the actual type name can be omitted.
in
.background(Color.red)

it cannot be omitted, as the parameter isnt typed Color, but some View. it wouldn't know where to look for red if type was missing.

The difference that you see in the preview are not explainable by the code, there-for I suggest you execute it on the device, as it might be some unwanted artefact. I see a lot of those in the current Xcode version.


text:
Q: What is @ISA in Perl? If I have a module with methods a and b and want to export them I do:
use Exporter;
our @ISA = qw (Exporter);
our @EXPORT = qw (a b);

What I don't understand is what does this line:
our @ISA = qw (Exporter); do?

A: Think object oriented here.
Think of Exporter not as a mere module, but as a class. Think of ISA as meaning "Is a" as in "My module is a sub-class of Exporter".
What you're doing is declaring your module as a sub-class of the Exporter class which means you can use the import method of the Exporter class which is sort of useful.
To really explain what Exporter is doing, you must understand that Perl uses Namespaces. Imagine if your program has a variable1 called $total, but so does the module you're using. Your $total variable would interfere with the module's $total variable.
To prevent this, Perl uses namespaces. Your program operates in the default namespace of main. Your modules use the package function to declare a new namespace. Now, both you and your module can safely use a variable called $total. In your program, it's really $main::total, and in the package, it's $Package::Name::total. If you want to use something from one _namespace_ in another, you can prepend the _namespace_ on it. Think of the$File::Find::nameand$File::Find::dirvariables you have when you useFile::Find`.
What the Exporter's import method does is copy your subroutines (and if you so desire, your variables) from your namespace to the current namespace. Imagine using the File::Copy module without the ability to copy over the copy subroutine to your main namespace. You could still use it, but you'd have to give it the name of the namespace on it:
use File::Copy;

...

File::Copy::copy( $from_file, $to_file );

Thanks to Exporter (and the import method), any subroutines you put into your packages @EXPORT array are copied over to the current namespace. Thus, you can access File::Copyscopy` subroutine like this:
use File::Copy;

...

copy ( $from_file, $to_file );

This is also why you must declare all of these variables as our and not my. my variables are lexically scoped and cannot be accessed outside of where they're declared. Package variables (like $File::Find::name) can be. For Exporter to find your @EXPORT, and @EXPORT_OK arrays, these need to be package variables.
Now, comes the desirability of exporting functions...
The oldest modules that we know and love export subroutines willy-nilly. You use File::Copy, File::Path, File::Find, and you have immediate access to their subroutines. This is because they put their subroutines into the @EXPORT array. This was at one time thought desirable because it makes these functions immediately available to you.
Newer modules like File::Temp require you to declare the subroutines you want to import:
use File::Temp qw(tempdir);

...
my $temp_dir = tempdir;

If I didn't have that qw(tempdir), I couldn't use the tempdir function.
This is considered polite. The module is asking your permission to import the function. This is done by putting the subroutines into @EXPORT_OK. These will only be exported upon request.
This is better because you don't have to import everything, just what you need. And, you're documenting where these functions are defined.
Object Oriented modules don't export anything at all and don't need to use Exporter. It's been a long time since I've written a module that uses Exporter.
--
1 We're talking about package variables here. Package variables are visible everywhere.

A: The @ISA package variable is used to specify inheritance between classes. You are discouraged to manipulate this variable yourself. If you want to inherit from another class, do
use parent 'Parent::Class';

or pre v10.1:
use base 'Parent::Class';

In this specific case, inheriting from Exporter makes the import method available. Your code could be rewritten as.
use parent 'Exporter';
our @EXPORT = qw/a b/;

The import method is called automatically when your module is used, and may export symbols to the using package.

Why using @ISA manually is bad:

*

*Do not assign to @ISA: Other modules may have already added entries to it; this would overwrite them. Therefore, push @ISA, "Some::Class".

*Avoid modifying @ISA during runtime. It is better to specify the inheritance relationship as early as possible (during parsing or after initial compilation), so that your module could be used there without restrictions. You could wrap it in an BEGIN or CHECK block, like
BEGIN {
  push @ISA, "Some::Class";
}

Inheritance via parent makes this much easier. parent will also compile the requested module if it isn't already loaded: no need for use Some::Class.

A: It instructs Perl to look in the Exporter module for methods when it can't find them in your package. The usual method you want to inherit from Exporter is its import method, which is where the work of copying your module's exported symbols to the calling package takes place.
From perlobj:

Each package contains a special array called @ISA. The @ISA array contains a list of that class's parent classes, if any. This array is examined when Perl does method resolution, which we will cover later.

For example, this is an error because Perl will try to call the non-existent subroutine Foo::some_method:
sub Bar::some_method { 42 }
my $obj = bless {}, 'Foo';
$obj->some_method;

The @ISA variable in a package tells Perl to look for the method in other packages, so this code will work and invoke the Bar::some_method method.
sub Bar::some_method { 42 }
my $obj = bless {}, 'Foo';
@Foo::ISA = qw(Bar);
$obj->some_method;

The practical application for this is inheritance.
As amon mentions, there is rarely a need to set @ISA directly. The parent pragma (and the older, now discouraged base pragma) declare inheritance relationships and set this variable for you.

A: The @Foo::ISA array is a global variable that holds the classes from which class Foo inherits.
Generally, you shouldn't manipulate @ISA directly; doing so is a sign that you're probably looking at old Perl code.
If you want to declare an inheritance relationship, a better way to do it is
use parent 'Exporter';

which tweaks @ISA behind the scenes for you and also does some other useful stuff.
In your case, when you do
our @ISA = qw(Exporter)

you're declaring your class as a subclass of Exporter. The Exporter class provides a method called import. Why do you want that? Because when you say
use MyClass;

What actually happens is:
BEGIN {
    require 'MyClass.pm';
    MyClass->import;
};

The import method is automatically called every time someone uses your class. That method can do anything you want. (You could write your own import if you want to) but usually it's used to import symbols into the caller's namespace. That's what Exporter does for you.
However, Exporter also exports its own import method, so you don't actually have to inherit it any more. (This was fixed a loooong time ago.) So now you can just say
use Exporter qw(import);

and your package will get the import method without having to mess with @ISA at all.


text:
Q: In the Inheritance Cycle why did it take so long for Saphira to hatch for Eragon If Saphira chose Eragon why did it take the dragon so long to hatch for him?

A: Christopher Paolini answered this question on his recent Facebook AMA.

Why didn't Saphira hatch as soon as Eragon touched the egg?
  After so long spent in Galbatorix's clutches -- and after having endured many, many attempts to force her into hatching, Saphira was in no hurry to emerge until she was absolutely sure it was the right choice.

Upon further research, it seems he answered this back in 2010 as well:

I was wondering why Saphira's egg did not hatch for Eragon for more than a week?
  Usually it didn't take so long for a dragon egg to hatch. However, (and I believe I said this in one of the books) Saphira had been Galbatorix's captive for so long, she was afraid that Eragon's presence might have been just another trick. So, she waited just to make sure. Also, I think that, after a century of waiting, Saphira decided to take charge of the situation herself. She wasn't about to leave her fate solely in the hands of this young farmboy who had found her.


text:
Q: Getting Perforce Connection Error with invalid SSL session Getting the following error while trying to create a new perforce connection with helix client for eclipse
Error occurred during SSL handshake: invalid SSL session
I have tried replacing the JCE with the Unlimited JCE Policy as I have found in several articles.


text:
Q: How to force child element to have a value in XSD? I have XML (as an example) with a segment called Type within the segment Order. The segment is a one to many, so we have something like :
<Order>
  <Type>1</Type>
  <Type>2</Type>
  <Type>3</Type>
</Order>

Now the validation should be, that there always should be segment Type with value 1 in the segment Order, if not, a validation error should occur. I tried some validations, but could not get the correct result. Has someone thought on how to implement this and if this is even possible?

A: XSD 1.0
Your constraint cannot be expressed in XSD 1.0.
XSD 1.1
Your constraint can be expressed in XSD 1.1 using an assertion to state that there be at least one Type child of Order that has a value of 1:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           vc:minVersion="1.1">
  <xs:element name="Order">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Type" maxOccurs="unbounded" type="xs:integer"/>
      </xs:sequence>
      <xs:assert test="Type = 1"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

A: in XSD 1.1, you can use xs:assertelement:
<xs:element name="Order">
    <xs:complexType>
        <xs:sequence maxOccurs="unbounded">
            <xs:element name="Type" type="xs:string"/>

        </xs:sequence>
        <xs:assert test="count(Type[text() = '1']) > 0"/>
    </xs:complexType>

</xs:element>


text:
Q: Buck input decoupling capacitance and efficiency I'm working on an high frequency buck (>10 MHz) and there's a problem with the input decoupling capacitance, the one used to filter battery harmonics and have a more stable voltage with less ripple.
In our testbench we have an ideal voltage source and two RL series which represents PCB trace before and after capacitor. Bondings wires are modeled as RL and they connect HS drain to battery.
It's a multiphase design with n-n phases.
I have noticed that by using certain values of capacitance efficiency decreases and this happens when red box RLC has resonance frequency similar to buck switching frequency (total Fsw and not the half fsw of each phase)
Seems obvious to avoid resonance so I've used a bigger capacitor and got an higher efficiency.
The problem is that I still lose around 4 % of efficiency compared to eff peak: what happens is that Vbatt provides x ampere but around 5% goes to charge the damping capacitor (or whatever).
Capacitor is basically always charged at regime.
Initial simulations were done without ESR but even with ESR things don't really change and if you think power loss related to a capacitor you think about ESR and not the capacitor itself.
I can reach the efficiency peak by using a really small capacitor (47 nF compared to 4.7 uF) but filtering action is really bland.
Another problem of using 47 nF is that if i account real capacitor tolerance and a PCB trace just 0.5 mm longer I refall into resonance/switching frequency.
I cannot design things around a +- 20 % capacitor and PCB parasitic inductance so I must use a big capacitor to avoid risky zone.
I've done some literature research and at my fsw small caps are used (< 10 nF) and only one work mentions this problem suggesting to avoid fres=fsw.
The problem is a bit weird because with a small Cdamp I have worse input voltage so I expected more voltage overshot during buck switching activity and higher switching losses.
Since it's a master thesis I'm more interested to know your opinion about this resonance effect and not a link to a ultra low tolerance capacitor. The impact of this problem is pretty big (we aren't talking of a +-0.01% efficiency) so it must be explained in a convincing way.


text:
Q: Listing directories based on size from largest to smallest on single line I can use the following command to get a list of directories and their sizes and sort them from largest to smallest (in the example I renamed the directories to numbers to make this easier to understand).
$: du -sk [a-z]* 2>/dev/null | sort -nr
413096  one
106572  two
97452   three
76428   four
55052   five
45068   six
33680   seven
23220   eight
17716   nine

I'm writing a program that requires input of these directories from largest to smallest, but for matters of convenience it needs them all on one line. Is there a command that will allow me to sort the directories from largest to smallest on one line without the size?
I would like the output to be like this:
one two three four five six seven eight nine

A: If you are confident that the directory names do not contain whitespace, then it is simple to get all the directory names on one line:
du -sk [a-z]*/ 2>/dev/null | sort -nr | awk '{printf $2" "}'

Getting the information into python
If you want to capture that output in a python program and make it into a list.  Using python2.7 or better:
import subprocess
dir_list = subprocess.check_output("du -sk [a-z]*/ 2>/dev/null | sort -nr | awk '{printf $2\" \"}'", shell=True).split()

In python2.6:
import subprocess
subprocess.Popen("du -sk [a-z]*/ 2>/dev/null | sort -nr | awk '{printf $2\" \"}'", shell=True, stdout=subprocess.PIPE).communicate()[0].split()

We can also take advantage of python's features to reduce the amount of work done by the shell and, in particular, to eliminate the need for awk:
subprocess.Popen("du -sk [a-z]*/ | sort -nr", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].split()[1::2]

One could go further and read the du output directly into python, convert the sizes to integers, and sort on size.  It is simpler, though, just to do this with sort -nr in the shell.
Specifying a directory
If the directories whose size you want are not in the current directory, there are two possibilities:
du -sk /some/path/[a-z]*/ 2>/dev/null | sort -nr | awk '{printf $2" "}'

and also:
cd /some/path/ && du -sk [a-z]*/ 2>/dev/null | sort -nr | awk '{printf $2" "}'

The difference between these two is whether /some/path is included in the output or not.

A: Using paste
du -sk [a-z]* 2>/dev/null | sort -nr| cut -f2- | paste -s -

A: zsh has the ability to sort its globs using globbing qualifiers. You can also define your own glob qualifiers with functions. For instance:
zdu() REPLY=$(du -s -- "$REPLY")

print -r -- [[:alpha:]]*(/nO+zdu)

would print the directories (/) whose name starts with a letter (btw, [a-z] only makes sense in the C locale) numerically (n) reverse sorted (O) using the zdu function.
Note that when you do:
du -s a b

If a and b contain hardlinks to the same files, their disk usage will be counted for a but not for b. The zsh approach here avoids that.
If you're going to use python, I'd do the same from there: call du -s for each of the files, and sort that list there. Remember that file names can contain any character including space, tab and newline.

A: Or maybe something like this
du -sk [a-z]* 2>/dev/null | sort -nr | awk '{print $2}' | sed ':a;N;$!ba;s/\n/ /g'

This will give you everything in one line.

A: I believe the du command uses \t to separate the size and the directory path, so you only need to pass in some extra parameters for awk:
du -sk [a-z]* 2>/dev/null | sort -nr | awk -F'\t' -v ORS=" " '{print $2}'

In the unlikely event that your directory paths contain the tab character as well, you can remove the size prefix first:
du -sk [a-z]* 2>/dev/null | sort -nr | awk -v ORS=" " '{sub(/^[0-9]*\t/,"");print}'

A: I know there are many ways to skin this problem but this resolved it for me
du --max-depth=1 . | sort -n | awk '{system("du -h --max-depth=0 "$2);}'

du --max-depth=1 . would provide the direct bytes number which sort -n would sort by number then awking the result of the sort to provide the human-readable value;
if i used  du -h --max-depth=1 . as the first command the sort by number would sort incorrectly since 2.2G is smaller the 3.3M in number terms since sort does not know about human Readable units.


text:
Q: Angular 4 unit testing OKTA SignIn not defined error I am trying to write unit tests in Angular 4. In our application OKTA Sign In is being used. How to mock OKTA Sign in? I am getting an error OktaSignIn not defined

A: We are using okta-sign-in.min.js in our index.html. OktaSignIn object is declared in a service as below:
declare let OktaSignIn: any;

This object is being used in the constructor of the service. During testing this object is not available.
Solution:
As mentioned in this link - https://developer.okta.com/blog/2017/03/27/angular-okta-sign-in-widget instead of including in index.html install the package and use it. One issue I faced not mentioned in the post is overriding Global Promise object of Zone.js. To fix this okta-sign-in-widget should be included before loading zone.js


text:
Q: LXDE: Switch Tool Bar Menu and Desktop Right Click Menu Around On my desktop I currently have a right click menu that looks like:

However, I want to have the full system menu that looks like this show up:

How do I do that?

A: Right click on Desktop > Desktop Preferences > Advanced > chekbox [Show menu bla-bla...]

A: You're really looking for obm-xdg.
https://wiki.archlinux.org/index.php/Openbox#Obm-xdg
I'm using it as a pipe menu and calling it with this command:
obm-xdg /etc/xdg/menus/lxde-applications.menu
Here's the manpage.
http://manpages.ubuntu.com/manpages/hardy/man1/obm-xdg.1.html
You can use any .menu file, so feel free to try gnome.menu or debian.menu too.


text:
Q: Call Command from Mupen64Plus dll using RUNDLL32 through Command Prompt I'm using the Nintendo 64 emulator, Mupen64Plus.
It has a file called mupen64plus-ui-console.exe used to launch games through command-line. It also accepts keyboard shortcuts to perform commands, but it is limited.

Mupen64Plus Commands/Functions
This wiki page shows a list of all commands that can be called, I think from the mupen64plus.dll.

RUNDLL32
I read how to pass commands to a dll like this:
RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>

Calling a Command with RUNDLL32
I'm trying to call M64CMD_STATE_LOAD with cmd.exe, to load a save file.
Info from Wiki:

Command Functions Prototype   m64p_error CoreDoCommand(m64p_command
  Command, int ParamInt, void *ParamPtr)
ParamInt Ignored ParamPtr Pointer to string containing state file path
  and name, or NULL
This command will attempt to load a saved state file. If ParamPtr is
  not NULL, this function will load a state file from a full pathname
  specified by this pointer. Otherwise (ParamPtr is NULL), it will load
  from the current slot.

I have the Mupen64Plus emulator running a game. I then open cmd.exe and paste in this line.
RUNDLL32.EXE "C:\Path\To\mupen64plus.dll", CoreDoCommand M64CMD_STATE_LOAD 1 "C:\Path\To\MySave.m64p"

Problem
It accepts the command, I get no errors, but the save file isn't loaded.

Questions

*

*Are the arguments being passed wrong?

*Does the mupen64plus.dll not have hooks into the currently running mupen64plus-ui-console.exe?

*Is it loading the save file into nothing?

*Is it not possible to do it this way?


text:
Q: Read spatial point type with an api-platform graphql query Here is my stack:

*

*postgres 12

*GraphQL with api platform

I have an entity with a coordinates attribute based on point Type from the package longitude-one/doctrine-spatial, and I would like to access to this attribute through a graphQL request, but graphQL ignore this attribute as it doesn't recognize the type...
How can I make it return my attribute, I tried through a customType but I don't want to loose postgres benefits with the geometryViewer ...
Does anyone know how to handle this ? Or did it with a different type ?

A: I've found a solution, when you use graphQL with api platform, and when you create a new attribute to the entity through the symfony cli, the getters and the setters are automatically created.
For example:

If I create a new entity called NewEntity. I will have a setNewEntity
method and a getNewEntity method, that are based on the type the
entity have.

The get method is important has it will be used by api platform to return the data in your graphql response. And this is where you can format the data the way you want.
In my geometry example, I will have:

#[ORM\Column(type: "point")]
private $myCoordinates;

public function getMyCoordinates(): ?array
{
    if ($this->myCoordinates) {
        return [
            "longitude" => $this->myCoordinates->getLongitude(),
            "latitude" => $this->myCoordinates->getLatitude()
        ];
    } else {
        return null;
    }
}


text:
Q: What is an alternative to leap() that can handle NAs? Need to apply Branch and bound method to choose best model. leaps() from leaps package works well, only if the data has no NA values, otherwise throws an error:
#dummy data
x<-matrix(rnorm(100),ncol=4)
#convert to 0,1,2 - this is a genetic data, NA=NoCall
x<-matrix(round(runif(100)*10) %% 3,ncol=4)
#introduce NA=NoCall
x[1,1] <-NA
#response, case or control
y<-rep(c(0,1,1,0,1),5)
leaps(x,y)

Error in leaps.setup(x, y, wt = wt, nbest = nbest, nvmax = NCOL(x) + int,  :
  NA/NaN/Inf in foreign function call (arg 4)

Using only complete.cases() is not an option as I lose 80% of data.
What is an alternative to leap that can handle NAs? I am writing my own function to do something similar, but it is getting big and clunky, I feel like I am reinventing the wheel...
UPDATE:
I have tried using stepAIC(), facing the same problem of missing data:
Error in stepAIC(fit) :
  number of rows in use has changed: remove missing values?

A: you may try bestglm::bestglm where branch-bound method can be specified. The NAs can be handled by na.action argument as it in glm. see here for additional information:
http://cran.r-project.org/web/packages/bestglm/vignettes/bestglm.pdf

A:
This is a stats problem, as AIC can't compare models built with
  different data sets. So to compare models with and without certain
  variables, you need to remove the rows with missing values for those
  variables. You may need to "reconsider your modeling strategy", to
  quote Ben
  Bolker.
  Otherwise you may also want to look into variants of AIC, a quick
  Google search brings up a recent JASA
  article
  that might be a good starting point.

- Aaron


text:
Q: Am I looking for a cross join? If I have two tables:
id_table     entry_table
--------     -----------
 [Id]         [entries]
  1             a
  2             b
  3             c
  4             d
  5

Is there a way to select the results into another table where I get:
select_results
--------------
[Id] [entries]
1     a
2     b
3     c

I'm trying e.g.
Select top 3 * from id_table, entry_table

and vice versa, but that gives:
1  a
1  b
1  c

These two tables SHOULD have the same amount of entries but I'm using "top 3" at the minute to see if it's possible.
Maybe I need a cross join with a where clause?

A: you can use row_number() and then use join
select a.*,b.* from
(select *,row_number() over(order by Id) rn1
from id_table
)  a
join
(select *,row_number() over(order by entries) rn1
from entry_table
) b on a.rn=b.rn1

A: Alternatively you can use row_number() window analytic function with top keyword as
select top 3
       [Id], [entries]
  from id_table i
  join ( select row_number() over (order by [entries]) as row_id,
                [entries]
           from entry_table ) e
    on i.[Id]=e.row_id;

Demo


text:
Q: Curve sketching without a computer program How to sketch the curve x^6 + y^6 = (x^4)*y without using a computer program ? Could someone give me the step by step ?

A: $\dfrac{y^6}{x^4} = y - x^2$, so there are no solutions whenever $y - x^2 < 0$. Whenever $y - x^2 = 0$, we find (by substitution) that the only solution is the origin. Notice that the curve is symmetric with respect to the y-axis, that is $(-x,y)$ is a solution if $(x,y)$ is a solution. Therefore, it is only necessary to graph the curve in the region bounded by the parabola $y = x^2$ and the y-axis. You may also want to ask if the curve is bounded in its y-component. In fact, if $y = 1$, then $x^6 - x^4 - 1 = 0$. The polynomial $f(x) = x^6 - x^4$ is pretty simple to graph with the three roots $(-1,0), (0,0),$ and $(1,0)$. By translating the graph of $x^6 - x^4$ down by one unit, to obtain the graph of $x^6 - x^4 - 1$, we see that there are two roots: one whose x-component is less than -1 and the other whose x-component is greater than 1, yet these points do not belong in the region that we described. This may be generalized for any $y \geq 1$, so the curve must be bounded above by $y = 1$.
In polar coordinate form, recall $x = r\cos(\theta)$ and $y = r\sin(\theta)$.
$x^6 + y^6 = r^6\cos^6(\theta) + r^6\sin^6(\theta) = r^6[\cos^2(\theta) + \sin^2(\theta)][\cos^4(\theta) - \cos^2(\theta)\sin^2(\theta)+\sin^4(\theta)] = r^6[\cos^4(\theta) - \cos^2(\theta)\sin^2(\theta)+\sin^4(\theta)]$
The equation $x^6 + y^6 = x^4y$ becomes
$r^6[\cos^4(\theta) - \cos^2(\theta)\sin^2(\theta)+\sin^4(\theta)] = r^5\cos^4(\theta)\sin(\theta).$ We may divide appropriately since we've already discussed the points at which division would not be well-defined.
$r = \dfrac{\sin(\theta)}{1 - \tan^2(\theta) + \tan^4(\theta)}$
You may plot a few points of the form $(r,\theta)$ by way of a trigonometric table: $\big(\frac{9}{14}, \frac{\pi}{6}\big), \big(\frac{1}{\sqrt{2}},\frac{\pi}{4}\big), \big(\frac{\sqrt{3}}{14}, \frac{\pi}{3}\big)$.

A: If $x=0$ or $y=0$ the given equation enforces $x=y=0$. Therefore assume $xy\ne0$. Then the equation is equivalent with
$${x^2\over y}+{y^5\over x^4}=1\ .$$
Put
$${x^2\over y}=:u,\quad{y^5\over x^4}=:v\ .$$
Then on the one hand $u+v=1$, and on the other hand
$$x^6=u^5 v,\quad y^3=u^2 v\ .$$
This leads to the following "formal" parametric representation of the solution set:
$$u\mapsto(x,y):=\left(\root 6\of{u^5(1-u)},\> \root3\of{u^2(1-u)}\>\right)\qquad(-\infty<u<\infty)\ ,\tag{1}$$
whereby you will obtain $\geq0$ admissible values, depending on the choice of $u$ and the sign of the sixth root. At any rate, the representation $(1)$ allows to produce  arbitrarily many points of the solution set with the help of a pocket calculator.


text:
Q: Shopify :: ActiveResource::ForbiddenAccess: Failed. Response code = 403. Response message = Forbidden I have sent the app(not listed yet) for review. The reviewer is getting the mentioned error on index action of HomeController which triggers when user clicks on install button.  I verified the app with many development stores in different partners account. I was able to install the app sucessfully for all the stores I tested.
Here is simplified version of the code
controllers/shopify/home_controller.rb
module Shopify
  class HomeController < ShopifyApp::AuthenticatedController
    def index
      MyCustomServie.new(shopify_detail).call
    end

    private

    def current_shopify_store
      @current_shop ||= begin
        Shopify::Base.with_rate_limit_protection do
          ShopifyAPI::Shop.current
        end
      end
    end

    def shopify_detail
      @shopify_detail ||= ShopifyDetail.find_by(shopify_domain: current_shopify_store.try(:myshopify_domain))
    end
  end
end

config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shopify,
    ShopifyApp.configuration.api_key,
    ShopifyApp.configuration.secret,
    scope: ShopifyApp.configuration.scope,
    callback_path: "#{Settings.shopify.mounted_at}/auth/shopify/callback"

  provider :google_oauth2,
           Settings.google.client_id,
           Settings.google.client_secret,
          { access_type: "offline", approval_prompt: "" }
end

conffig/initializers/shopify_app.rb
ShopifyApp.configure do |config|
  config.application_name = 'Shopify - Feed Champion'
  config.api_key = Settings.shopify.api_key
  config.secret = Settings.shopify.api_secret
  config.scope = Settings.shopify.scope
  config.embedded_app = true
  config.after_authenticate_job = { job: ShopifyAfterAuthenticateJob, inline: true }
  config.webhooks = [  Shopify::AppUninstalledWebhook::PARAMS  ]
end

The error comes from the below line
ShopifyAPI::Shop.current
Here is the error log. Can anybody give pointers where could be the problem?

A: Being a newbie to Shopify, I missed adding required scopes for using available Shopify APIs, and was getting the same ForbiddenAccess error.
In shopify_app.rb I added missing scopes. Example for fetching all products and customers of a Shopify store:

config.scope = "read_products, read_customers"

Here is the list of all available scopes.