text:
Q: How can i show my webtrends reports in sharepoint I am looking to show webtrends analytics report data in a sharepoint portal, how can this be achieved? I would also like to alter the data (calculations) before the data is uploaded.

A: Are you already exporting these reports, or having them emailed to you (scheduled), in CSV format? If so, you could just open them in Excel and adjust the calculations, then upload the file to your SharePoint portal.
If you are an On Demand customer (meaning you log in at ondemand.webtrends.com), you also have access to the REST generator (http://generator.webtrends.com). You would just log in with the same account/user/pass. The REST generator can creates a URL for you to paste into a spreadsheet, which will function as a refreshable query, right from the spreadsheet. The only caveats are that there are some report types which aren't support. Scenario Analysis (funnels) for example.


text:
Q: Is there a way to set default groups inside a EXT JS's GroupingView? I have a CQ.Ext.grid.GridPanel that uses a CQ.Ext.grid.GroupingView to group records of a CQ.Ext.data.GroupingStore.
I manage to successfully group rows inside the view using the groupRenderer property, but I would like to have a set of groups always available, even if no record belongs to that group or even if the Store is empty. Do you know if this is posible?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't load resx file in code I have a C# library (MyApp.ServiceLayer) and I want to access a common resx (/Resources/global.en-GB.resx) file from another library (MyApp.Common). I've added a reference from ServiceLayer to Common.
In the /bin/Debug folder of ServiceLayer I have (amongst others):

*

*MyApp.Common.dll

*en-gb/MyApp.Common.resources.dll.

*/Resources/global.en-GB.resx

Reflector tells me that MyApp.Common.resources.dll has a Resources folder and a resource file: MyApp.Common.Resources.global.en-GB.resources
This code returns "could not load assembly" error.
ResourceManager resource = new ResourceManager("resources.global", Assembly.Load(new AssemblyName("MyApp.Common.resource")));

Why can't I get to it?

A: The loading by AssemblyName only works if the resource file has been loaded into the current AppDomain.
Use the method LoadFrom() instead of Load() to load the assembly from a file:
ResourceManager resource = new ResourceManager("resources.global", Assembly.LoadFrom(@"C:\full\path\of\the\assembly\MyApp.Common.resources.dll"));


text:
Q: Include zeros in SQL count query? I want to be able to return 0 when I am doing a count, I'd preferably not use joins as my query doesn't use them.
This is my query.
SELECT count( user_id ) as agencyLogins,
      DATE_FORMAT(login_date, '%Y-%m-%d') as date
FROM logins, users
WHERE login_date >= '2015-02-10%' AND login_date < '2016-02-11%'
AND logins.user_id = users.id
GROUP BY DATE_FORMAT(login_date,'%Y-%m-%d')

What it does is counts the amount of times a user has logged into the website.
It doesn't count zeros though where as I want to know when there has been no log ins.

A: Please try using explicit join in the future, more readable and will make you avoid this errors. What you need is a left join:
SELECT t.id,count(s.user_id) as agencyLogins, DATE_FORMAT(s.login_date, '%Y-%m-%d') as date
FROM users t
LEFT OUTER JOIN login s
ON(t.id = s.user_id)
WHERE (s.login_date >= '2015-02-10%' AND s.login_date < '2016-02-11%') or (s.user_id is null)
GROUP BY t.id,DATE_FORMAT(s.login_date,'%Y-%m-%d')

A: I think below SQL useful to you. 2015-02-10% please remove % symbol in that string.
    SELECT IF(COUNT(user_id) IS NULL,'0',COUNT(user_id)) as agencyLogins, DATE_FORMAT(login_date, '%Y-%m-%d') as date FROM users left join logins on logins.user_id = users.id
    WHERE date(login_date) >= date('2015-02-10') AND date(login_date) <= date('2016-02-11')
GROUP BY DATE_FORMAT(login_date,'%Y-%m-%d')

A: This might be help you out
    SELECT SUM(agencyLogins), date FROM (
    SELECT count( user_id ) as agencyLogins,
          DATE_FORMAT(login_date, '%Y-%m-%d') as date
    FROM logins, users
    WHERE login_date >= '2015-02-10%' AND login_date < '2016-02-11%'
    AND logins.user_id = users.id
    GROUP BY DATE_FORMAT(login_date,'%Y-%m-%d')

    UNION ALL

    SELECT 0,''
    ) AS A
    GROUP BY DATE


text:
Q: How to write nginx redirect rule for mapping all unmatched urls to one rule Here is my initial nginx rule :
location /main/ {
  root /app/dist;
  try_files $uri /index.html =404;
}

however, I want redirect all the urls which are not /main/ to /main/, even include the root url path /
How should I add nginx redirect rule ?


text:
Q: Identifying the cause why a Windows computer wakes up from sleep I put my Windows 7 desktop to sleep when it's unused. I noticed that it wakes up around the same time every night. How can I identify the cause?

A: There could be multiple things that could cause this. For starters check the following

*

*Go into your computer's BIOS as @OmarAsifShaikh suggests go to power setting/power config/Power Management depending on your computers' bios manufacturer. There should be setting called "Wake on Alarm", check to see if it is enabled. This wakes the computer on a set interval.

*There are other settings like Power on by Mouse, Power on by Keyboard etc. A pet, a prankster roomie, or something could potentially trigger a mousemove/click, keypress to wake-up that computer if any of these settings are enabled.

*Wake on Lan could be activated for your ethernet card. Go to your ethernet card's properties, power settings and see if "allow this device to wake up this computer" is checked. If it is then something on your network could be sending the WOL magic packet (no pun intended) to power up your PC via the ethernet device.

*Lastly, highly unlikely but a bad BIOS may cause abrupt power cycling, if none of the above is proven to be the case check if the bios/bios battery is in good shape.

A: Open command prompt, and use the following command
powercfg lastwake

It should tell you what hardware device caused the computer to wake up.
As to why the device woke up the computer, there could be many reasons, some of which are detailed in IUnknown's answer

A: Not sure about 7, but on Vista you'd do Windows button -> Control Panel -> Administrative Tools -> Task Scheduler.
In Task Scheduler, click on "Task Scheduler Library" in the left-hand column, an in the top center column you will see a list of scheduled tasks.  Eg, there's apt to be one for Adobe Flash update, Google Update, etc.
For each suspicious task, highlight it and select "Properties" in the right-hand column.  Examine the data in the "Triggers" tab to see when the task is scheduled to run.  To prevent it from waking the computer, select the "Conditions" tab and, under "Power", deselect "Wake the computer to run this".
(While you're at it, take advantage of the opportunity to disable or completely delete some of the silly tasks, such as ones that update rarely-used tools twice a day.)

A: There is usually some kind of update being done, either Windows or some other apps. Also some apps run in the background all the time, but there is also a chance that it could be a virus, or malware. If it is constantly going on and off, then it is usually malware. Try using Malwarebytes.org, there is a free scan. It works better than any other scan I have ever used. Your security updates, and Windows, but it should only stay awake for a short time, unless there is a huge update for Windows.


text:
Q: ajax post return php variable in php I am working on a project that sends a ajax post request to a php file and then sets a php variable and returns the variable in js. That all works fine. What I am struggling with is being able call $name in the index.php file once getPhpVar() function has run.
This is what the program is supposed to do:
1.run getPhpVar() function
2.sends ajax post to get.php
3. get.php set name variable
4. get.php sends name variable back through js
5. I am able to call name variable in php
Code:
index.php

<?php echo $name;
?>

get.php:
<?php
if( $_REQUEST["name"] ) {
   $name = $_REQUEST['name'];
   echo $name;
}

?>

A: You can't do that by echo, you need to do that by javascript like this:

And your html file would be like :

In fact your $name variable is in server side but you want to use it in client side, to use it you need to put it in some var or use use equivalence of echo in javascript which is document.getElementById("result").innerHTML or document.write, Another way is to use $_SESSION variables in php and echo.


text:
Q: How to "sorted" python dictionary that each "value" is an array? For example if my dictionary (or whatever it's called) look like
itemList =
[
{
'attribute1': (1,2)
'attribute2': (3,4)
...
}
{
'attribute1': (5,6)
'attribute2': (7,8)
...
}
]

I tried to sort this according to the second number of the attribute1:
sorted(itemList, key=lambda x: ['attribute1'][1]
but it gives me an error
IndexError: list index out of range

How can I fix this?

A: It should be:
sorted(itemList, key=lambda x: x['attribute1'][1])

The way you were doing, it was trying to access the second element of the list ['attribute1'], that doesn't exist.

A: Try:
sorted(itemList, key=lambda x: x['attribute1'][1]

A: your lambda expression is not making any sense:
You're actually trying to access and return the second element of the list: ['attribute1'] which obviously has only one element!
what you should write is:
sorted(itemList, key=lambda x: x['attribute1'][1]
                               ^
                               |
             missing variable matching an element of the list

so that x is an item of your itemList.
edit:

As a follow up, I am still confused why ['attribute1'] has only one element? In my example, I have 'attribute1': (1,2), isn't that "2" the second element?

well, because where you're getting confused is that ['attribute1'] is not x['attribute1'], but it is still a valid python syntax, which is the unnamed list containing one element, the string 'attribute1'.
As you've defined x as a list of tuples, you want to extract a value out of the tuple using the [] operator. But because that operator exists for a list, when you access a value off ['attribute1'], it is syntactically correct. But because ['attribute1'] only has one element, it is semantically incorrect, and thus yells list index out of range at you!
I'm not sure where you're getting confused here. The lambda expression is no magic, it's is strictly equivalent to the following:
def get_second_of_attribute1(x):
    return x['attribute1'][1]

sorted(itemList, key=get_second_of_attribute1)

here, x is the parameter that sorted() gives to the function defined as the key parameter for each item of its first parameter, itemList, to make a comparison so the list returns as sorted.
In summary, the lambda expression, and generally speaking the python compiler does not guess what you're trying to do, it needs explicit and clear instruction. If you tell him something wrong, it will either yell at you (if it's impossible), or actually do it!
Like, if you were looking for first element of tuple in your itemList, then you'd end up having no error, but sorted returning a non-sorted list, as the key function would always return the same thing: 'attribute1'.
HTH!


text:
Q: Count Rows MySQL [I know mysqli is the new standard and I am in the process of updating, but for now I have questions about the old standard.]
I am trying to count the number of rows that match a query, then add a number to it.
$findTypes = "SELECT * _products WHERE product_type = '$productType'";
$queryTypes = mysql_query($findTypes, $db_products);
$numTypes = mysql_num_rows($queryTypes);
$productID = $numTypes + 100;

If there is already an existing product-type in the database, then there should return a result of 101, if there are two then 102, etc.
As it stands now this doesn't work... not sure why.
Thanks,

A: Your query is wrong, you have no FROM statement...
Try:
SELECT * FROM _products WHERE product_type = '$productType'

A: You could get the value from a single faster query, leaving MySQL to do all the work:
$findTypes = "SELECT COUNT(*) + 100 FROM _products "
           . "WHERE product_type = '$productType'";

A: Use mysql_error() function, something like
mysql_query($query) or die(mysql_error());

It will return error message, if your syntax is wrong.


text:
Q: Symfony 2 - Bidirectionnal translation I have to translate a website where the page content can be writen in English or in French.
So I made two files in my translations repository:

*

*message.en.yml (to translate french to english when the locale is en_us or en_gb)

*message.fr.yml (to translate english to french when the locale is fr)

To explain my issue I will take an exemple, the pair of word Hardware | Matériel.
When the page is viewed with fr locale Hardware need to be translated by Matériel.
So I put : Hardware: Matériel in my message.fr.yml.
When the page is viewed with en_us or en_gb locale Matériel need to be translated by Hardware.
So I put : Matériel: Hardware in my message.en.yml.
At this point the translation behaviour is:
When the page is viewed with the fr locale Hardware is correctly translated.
When the page is viewed with the en_gb locale Hardware is correctly not translated.
When the page is viewed with the en_us locale Hardware is incorrectly translated by Matériel.
To add to the fun, if I clear the Symfony cache, the behaviour change, sometimes everything get translated by Matériel, sometimes nothing does...
A week ago I only needed to translate French to English and it worked perfectly by just using the message.en.yml file, maybe there is something to do that I didn't noticed when you use several files.
Can someone explain me how to handle this two way translation?

A: Use variables.
I'm using translation like this:
messages.en.yml
string.hardware: Hardware

messages.fr.yml
string.hardware: Matériel

In twig:
{{ "string.hardware"|trans }}

Using with dynamic variables:
string.hardware: %variable% Hardware

Usage in twig:
{{ "string.hardware"|trans({"%variable%": your_variable_or_string}) }}

A: Okay, I understood what I was doing wrong.
For this kind of situation you have to:

*

*Put : Hardware: Matériel in my message.fr.yml. (if fr locale translate Hardwareby Matériel)

*Put : Matériel: Hardware in my message.en.yml. (if en locale translate Matérielby Hardware)

*Put : Hardware: Hardware in my message.en.yml. (if en locale don't translate Hardware)

I think all of this happend because of the translation fallback, I ask for the translation of Hardwareso symfony look for one in message.en.yml.first (because the locale is en), if it doens't find any, it looks for it in message.fr.yml, here it found Hardware: Matérielso it use it.
I still don't get why sometime, depending on the cache, the translation worked fine on en_gb locale...


text:
Q: Google SignIn validation error using jwt-go I'm currently trying to integrate my app with Google SignIn. I want my Golang backend to be able to decode and validate OIDC tokens. I'm trying to use the JWT-GO library, but I'm stuck with the validation of the signature of the JWT.
I found this post and it helped me well, still I can't figure out why I'm getting an crypto/rsa: verification error.
I pushed an example code in this Github repository. Would be great if someone could help with that.
Thanks in advance :)

A: I finally made it work, more details here : https://github.com/dgrijalva/jwt-go/issues/116#issuecomment-188903951


text:
Q: 'int' object is not subscriptable , trying to translate a 2d list to a tkinter canvas, this is the error i got def mirror_model_to_ui():
    global screen , width , height , tetris_grid

    screen.delete('all')
    for i in range(height+1):
        for j in range(width+2):
            if tetris_grid[i][j] != 0:
                draw_cell( i , j , tetris_grid[i][j])


text:
Q: GoogleWebAuthorizationBroker - Access to the path 'C:\Windows\system32\config\systemprofile' is denied I'm using the Google Analytics reporting API v4 (c#) to get data. I use this code below to authorize. On my local machine evering works fine. But on my production-server I get the error: "Access to the path 'C:\Windows\system32\config\systemprofile' is denied."
It's not related to folder/file read write permissions because I read from an online sorce. I can't figure this one out.... Heres my code:
var client = new WebClient();
var stream = client.OpenRead("https://api.myjson.com/bins/drj87");

var loginEmailAddress = ConfigurationManager.AppSettings["AnalyticsReporting.Email"];

return await GoogleWebAuthorizationBroker.AuthorizeAsync(
    GoogleClientSecrets.Load(stream).Secrets,
    new[] { AnalyticsReportingService.Scope.Analytics },
    loginEmailAddress, CancellationToken.None,
    new FileDataStore("GoogleAnalyticsApiConsole"));

A: From https://developers.google.com/api-client-library/dotnet/reference/1.9.1/classGoogle_1_1Apis_1_1Util_1_1Store_1_1FileDataStore:
Google.Apis.Util.Store.FileDataStore.FileDataStore(string folder, bool fullPath = false)

Constructs a new file data store. If fullPath is
  false the path will be used as relative to
  Environment.SpecialFolder.ApplicationData, otherwise the input folder
  will be treated as absolute. The folder is created if it doesn't exist
  yet.

So put the full path of a directory your service account does have permissions to, and set fullPath to true.


text:
Q: How to have two v-model directive inside ValidationProvider in VeeValidate? I want to create a custom Date Picker component with Vue version 2 and VeeValidate. I am using vuetify and v-menu component from there: https://vuetifyjs.com/en/components/menus/ . The problem is that ValidationProvider which is responsible for validating fields accepts only one v-model inside of it and I have two: one for triggering v-menu and second for gathering value to v-text-field from v-date-picker. When I remove this v-model from v-menu validation works but I cannot close menu after I choose some values in date-picker.
<ValidationProvider v-slot="{ validate, errors }">
  ...
  <v-menu v-model="menu">
    <template v-slot:activator="{ on, attrs }">
      <v-text-field
        v-bind="attrs"
        :value="formatDate"
        readonly
        v-on="on"
        @input="$emit('input', $event) || validate($event)"
      />
    </template>
    <v-date-picker
      :value="value"
      no-title
      @input="$emit('input', $event) || validate($event)"
      @change="menu = false"
    />
  </v-menu>
   0"
  >{{ errors[0] }}
</ValidationProvider>


text:
Q: Как подключиться к RCON серверу из PHP? Есть простенькая задача... Попросили подключиться к RCON серверу из PHP... Есть готовые библиотеки, я быстренько их заюзал, думал, что работы на 5 минут... но не тут-то было... Оказалось не всё так просто, потому как не работает)
Не поделитесь своим опытом, может кто пробывал, экспериментировал с этим RCON?
Рассмотрю примеры на любых языках программирования...

A: Я лично пользуюсь https://github.com/xPaw/PHP-Source-Query, там уже есть пример отправки команд RconExample.php


text:
Q: UICollectionView horizontal layout row breaking I am trying to achieve specific layout inside UICollectionView.
I need to adjust my phone layout to work well with iPad, so I used horizontal scrolling direction for "default" flow layout.
But unfortunately I am doing something wrong. Please look at following sketch:

These are elements view:

*

*So far, I will not have too much cells, but maybe they will not fit (so I need to use UIScrollView derivate).

*One cell is double in size (plus one margin space), a very first one.

*Other cells are all same size (square)

As can be seen in sketch, row is not "breaking" in right moment (even after I played with contentSize) and 1st cell in 2nd row occupy two places.
If nothing helps, I will start with writing own UICollectionLayout descendant, but maybe it's something simple and can be done with "standard" flow layout.
Thank you.
Sample file

A: I needed to subclass UICollectionView.
I have followed tutorial from Raywenderlich, and converted vertical scrolling from their example to my horizontal layout.
I avoided using custom layout for long, but luckily it's not too bad at the end.


text:
Q: NodeJs async SyntaxError I don't understand why is not working.
The compiler is asking for the async in the await function in router, and I have the async in router exports.
The problem in IMG
Server:
const http = require("http");
const router = require("./router");

module.exports = http.createServer((request, response) => {
    console.log(request.url);

    try {
        const content = await router(request, response);
        return response.end(content);
    } catch (error) {

        response.writeHead(404,{
            'Content-Type': 'text/html',
        });
        response.end(`<h1>${error.message}</h1>`);
    }
});

Router:
const { parse } = require("url");
const indexAction = require("./actions/index");

const routes = {
  "/": indexAction,
};

module.exports = async (request, response) => {
  const parseUrl = parse(request.url, true);
  const route = parseUrl.pathname;

  if (routes[route]) {
    return await routes[route](request, response, parseUrl.query);
  }

  throw new Error("404 Not Found");
};


text:
Q: Linq .Contains or IN I have the following :
  Dim Pols As Model.Batches.Renewals.YYYYY() = RenewAnaFindToYYYY(BegDate, EndDate, BegDate2, EndDate2, True)
        Pols = Pols.Where(Function(x) x.PolicyId = 1440728).ToArray()

Now how do I test for a list of PolicyID's ? I want to include PolicyID's {1425427, 1440728, 1695324} in the Array. How do I do this ? Any help would be most appreciated.
Jason

A: Declare the ids in some collection and use Contains extension method in your query as I show below:
Dim ids= New Integer(){1425427, 1440728, 1695324};
Pols = Pols.Where(Function(x) ids.Contains(x.PolicyId)).ToArray()


text:
Q: WordPress function gives different results outside vs inside PHPUnit test I've been working very hard to get PHPUnit to play nice with WordPress (with the help of this, this, this, this, and this), and I think I've gotten pretty close. The code I run directly before my tests looks like this (basically lifted verbatim from this article):
( PHP_SAPI === 'cli' ) || die( 'Access Denied' );

define( 'PHPUNIT_DB_PREFIX', 'phpunit_' );

global $wp_rewrite, $wpdb;

define( 'WP_MEMORY_LIMIT', '100M' );

require_once( dirname( __FILE__ ) . '/../../../../wp-load.php' );
require_once( ABSPATH . 'wp-admin/includes/admin.php' );

wp_set_current_user( 1 );

Seems to work fine, except that functions return different things based on where they are in the file. For instance, outside of a test class, shortcode_exists returns true, whereas within a test case the exact same shortcode_exists statement returns false. What am I doing wrong?
Here are the contents of the entire test file:
[The file has changed since I originally posted this...]
EDIT: Ok, so I've followed J.D.'s tutorial as closely as I could. It feels really close. I'm now getting this error:
PHPUnit_Framework_Error_Warning : copy(data/not-gettexted-0.php): failed to open stream: No such file or directory
#0 [internal function]: PHPUnit_Util_ErrorHandler::handleError(2, 'copy(data/not-g...', '/Applications/w...', 41, Array)
#1 /Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/wordpress-dev/trunk/tools/i18n/t/NotGettextedTest.php(41): copy('data/not-gettex...', 'data/not-gettex...')
#2 [internal function]: NotGettextedTest->test_replace()
#3 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestCase.php(988): ReflectionMethod->invokeArgs(Object(NotGettextedTest), Array)
#4 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestCase.php(838): PHPUnit_Framework_TestCase->runTest()
#5 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestResult.php(648): PHPUnit_Framework_TestCase->runBare()
#6 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestCase.php(783): PHPUnit_Framework_TestResult->run(Object(NotGettextedTest))
#7 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestSuite.php(779): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#8 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestSuite.php(749): PHPUnit_Framework_TestSuite->runTest(Object(NotGettextedTest), Object(PHPUnit_Framework_TestResult))
#9 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/Framework/TestSuite.php(709): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#10 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/TextUI/TestRunner.php(350): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#11 phar:///Applications/wordpress-3.8.3-0/apps/wordpress/htdocs/wp-content/plugins/hf-accountability/tests/phpunit-lts.phar/phpunit/TextUI/Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#12 /private/var/folders/r5/0w5bp7b13pndfymz_pgf_zz00000gn/T/ide-phpunit.php(268): PHPUnit_TextUI_Command->run(Array, true)
#13 /private/var/folders/r5/0w5bp7b13pndfymz_pgf_zz00000gn/T/ide-phpunit.php(506): IDE_Base_PHPUnit_TextUI_Command::main()
#14 {main}

Any idea how I can fix that? In the mean time, I'm going to keep checking all the file paths I defined in the several config files.
EDIT EDIT: That last error was resolved by modifying the PhpStorm configuration I was using. You have to both set it to "Use alternative configuration file" and set the test scope to "Defined in the configuration file."

A: The reason this is happening is actually not because of anything in the code you've posted, per se, but because of how you have PHPUnit configured. The shortcode callbacks are stored in a global ($shortcode_tags). When you load WP, the shortcode is registered and added to the global. You call shortcode_exists(), it checks $shortcode_tags, and returns true. Then PHPUnit starts running your tests. And it clears out the global variable scope. So, when your test is run, $shortcode_tags no longer exists, so shortcode_exists() reports that your shortcode isn't registered. (PHPUnit will then restore the global scope to what it was before the test, so that tests don't affect the global variables. Running shortcode_exists() after the tests are finished would report true.)
PHPUnit does have the backupGlobals setting, and setting it to false will prevent PHPUnit from touching the global scope. And that should fix your issues. However....
A more excellent way
As the author of this tutorial, I would like to recommend that you set up your tests more like I show there. The reason being that you won't have to write all this bootstrap to get PHPUnit to play with WordPress. You should instead just use WordPress's PHPUnit bootstrap, which, obviously, is already engineered to play nice with WordPress. :-)


text:
Q: Non-Linear ODE Strategy I encountered the following $2^{nd}$-order, non-linear ODE while working on a classical mechanics problem:
$$
\frac{d^2r}{dt^2}-\frac{\alpha^2}{r^3}+\beta=0
$$
where $\alpha \ \text{and}\  \beta$ are positive, real constants.
I'm really struggling to find an analytic solution. I tried taking the Inverse Laplace Transform, but when I transformed back, I got nonsense. Any advice on a good strategy for solving this problem?
Edit: Here's the problem since someone asked about it: suppose you have a marble constrained to move along the inside surface of a cylindrical, frictionless, concave cone. It's Lagrangian is given by $L=\frac{m}{2}(\dot r^2+(r\dot\phi)^2+\dot z^2)-mgz+\lambda(z-r\tan(\theta))$, where $(r,\phi,z)$ are the normal cylindrical coordinates, $\theta$ is the inclination of the cone above horizontal, and $\lambda$ is the Lagrange multiplier.
Solving Lagrange's equations to eliminate $\lambda$ and rewrite $z$ in terms of $r$ gives the above equation.

A: Removing the $z$-coordinate with the constraint leads to the reduced Lagrangian
$$\tag{1} L~=~ \frac{\mu}{2}\dot{r}^2 +\frac{m}{2}r^2\dot{\phi}^2 -V(r),$$
where $\mu:=\frac{m}{\cos^2\theta}$ and $V(r):=mgr\tan\theta $. The canonical momenta are
$$ \tag{2} p_r~=~ \mu\dot{r}, \qquad p_{\phi}~=~mr^2\dot{\phi}. $$
Performing the Legendre transformation leads to Hamiltonian
$$ \tag{3} H~=~ \frac{p_r^2}{2\mu}+\frac{p_{\phi}^2}{2mr^2} +V(r). $$
The angular momentum $p_{\phi}$ is a constant of motion. A first integral is given by energy conservation
$$ \tag{4} E~=~ \frac{\mu}{2}\dot{r}^2 + \frac{p_{\phi}^2}{2mr^2}+V(r), $$
which leads to
$$ \tag{5} \Delta t ~=~\pm\int \frac{dr}{ \sqrt{\frac{2}{\mu}(E-\frac{p_{\phi}^2}{2mr^2}-V(r))}} .$$
Eq. (5) agrees up to signs with the integral that OP writes in a comment. We note that all orbits are radially bound. We know from Bertrand's theorem that not all radially bound orbits are closed.


text:
Q: Access a php function in a different file I am getting an error that a file in a required_once statement can not be found. Full disclosure; I'm not a complete n00b but I'm not far off when I comes to php.
Helpers file
In a file, dedicated to a class inside a Models folder, I am trying to require a file which is inside a sibling folder. I have tried to declare namespaces, tried to require and then 'use' the file, I try one or the other, try all three or any combination, all fail only with differing but similar error messages.
This always provides the first error:
// Models/Weather.class.php
<?php

require_once '../assets/helpers.php';

Warning: include(..\assets\helpers.php): failed to open stream: No such file or directory in C:\xampp\htdocs\test\Models\Weather.class.php on line 5

The helpers file starts something like this:
// assets/helpers.php
<?php

/**
* Send a GET request using cURL
*/
function curl_get($url, ...

VS Code hints to where the file can be found while I am typing the php, so I'm fairly sure I'm referencing the correct file in the correct location, but when I run the script in the xampp I get the error.
When I use an absolute path to the file there is no problem, but why would I need to? I would like to be able to use the function in the helpers.php file in my class methods using the relative file path.
Class file reference
Now when I use the absolute path, I get the next error:

Fatal error: Uncaught Error: Class 'DB' not found in C:\xampp\htdocs\test\index.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\index.php on line 7

// index.php
<?php

require_once 'Models/Weather.class.php';
require_once 'Models/DB.class.php';

$DB = new DB('weather'); // line 7

Using 'use'
If I do the same but add the line use Models\DB; The error message changes to

Fatal error: Uncaught Error: Class 'Models\PDO' not found in C:\xampp\htdocs\test\index.php:10 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\index.php on line 10

Line 10 refers to the same line as above, the line creating a DB class instance.
I've been looking at this code for a number of days now trying different angles. This should be easy, include one file in an other file. Just use include or require and Bob's your uncle, easy peasy right. That's what I thought, but I'm pulling my hair out and I'm getting no further. I'm sure it's something insignificant, I'm overlooking something...can you help me out?

UDPATE
So still errors but thanks to @Genhis I implemented the spl_autoload_register() autoloader from a comment in the docs, with an echo to see what is being autoloaded, and I created a test file with ony one require and an instantiation;
<?php

spl_autoload_register(function ($class_name) {
  if (file_exists($class_name . '.php')) {
    require $class_name . '.php';
    echo $class_name . ' exists'. "\n
";
    return TRUE;
  }
  echo $class_name . ' does not exists' . "\n
";
  return FALSE;
});

use db\DB; // gave the classes their own dir
$db = new DB('weather');

Now the first output is:

Models\DB exists
  Models\PDO does not exists
Fatal error: Uncaught Error: Class 'db\PDO' not found in C:\xampp\htdocs\test\test.php:15 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\test.php on line 15

The DP class has an options private variable:
private $options = [
   PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
   PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
];

When I remove the variable the error comes when I try to establish a connection to the database. Do I need to include/require pdo (there goes more hair)?

A:
When I use an absolute path to the file there is no problem, but why would I need to?

If the file is included in other files, then your relative path is from the first one - {main} file.
Consider this - if you call dir1/include1.php directly, everything works; if you call index.php first, you get an error:
root/index.php
include("dir1/include1.php");
//error: can't find file "root/../dir2/include2.php"

root/dir1/include1.php
include("../dir2/include2.php");

root/dir2/include2.php
To cope with this problem, I used absolute paths when I had to include helper functions and similar files.

Fatal error: Uncaught Error: Class 'DB' not found in C:\xampp\htdocs\test\index.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\index.php on line 7

You should use either use statement or fully qualified names if your classes have namespaces.

Fatal error: Uncaught Error: Class 'Models\PDO' not found in C:\xampp\htdocs\test\index.php:10 Stack trace: #0 {main} thrown in C:\xampp\htdocs\test\index.php on line 10

Your class DB depends on another class which hasn't been loaded. You should use a function to deal with loading classes on demand (e.g. spl_autoload_register()) or use a framework, such as Composer.

A: Okay I found the answer, and it was in large part due to my inexperience with php.
I should not have been require-ing the files where the classes were being defined but in the files they were being called/instantiated.
So this:
// index.php
<?php

require_once 'Models/Weather.class.php';
require_once 'Models/DB.class.php';

$DB = new DB('weather');

..is where I should have included the helpers.php file. Because even though I was using a function from the helpers.php file in the class definition, that function was only used from where I was instantiating that class. In this case the index.php file.
So adding an include/require here...:
// index.php
<?php

require_once 'Models/Weather.class.php';
require_once 'Models/DB.class.php';
require 'assets/helpers.php';

$DB = new DB('weather')

...solved all the problems.
Why require-ing the file in the wrong location caused the DPO error messages I still don't understand.
I'll leave the question because for me it was kind of an "Aha, I get it now" moment.
Thanks for the input, person who has by now deleted their comment, using an autoloader is quite useful and I will include an autoloader in the files I use the classes!


text:
Q: In VHDL, Is it possible to reference a static variable using an access reference? In VHDL, Is it possible to reference a static variable using an access reference?
Most of the examples I've seen with VHDL accesses involve allocating memory dynamically.  I was curious if you can also get the access handle to a statically allocated variable.  Like if I had a global integer in a particular architecture that is allocated statically,  Could I assign a reference to that variable to an access type for integer?

A: No such thing in VHDL exists. You cannot get a "handle" to another variable for an access type. You can only create dynamic memory into an access type.
But, VHDL does have aliases. With these, you can create an alias to anything visible. And using external names (from VHDL 2008) you can create an alias to any object that is not directly visible. For example:
entity ent1
end entity ent1;

architecture arch of ent1 is
  constant SOME_CONST : integer := 7;

  alias my_alias : integer is SOME_CONST;
begin
  process
  begin
    report "ent1 alias = " & to_string(my_alias);
    wait;
  end process;
end architecture;

entity ent2 is
end entity ent2;

architecture arch of ent2 is
begin
  inst : entity work.ent1;

  process
    alias a is << constant inst.SOME_CONST : integer >>;
  begin
    report "ent2 alias = " & to_string(a);
    wait;
  end process;
end architecture;


text:
Q: A sufficient criterion for a finite group to be a Frobenius group Suppose that $G$ has a non-trivial proper subgroup $H$ such that the following holds: Whenever $1 \ne X \le H$, then $N_G(X) \le H$. Then $G$ is a Frobenius group with Frobenius complement $H$.

Let $p \in \pi(H)$. First we show that $H$ contains a Sylow $p$-subgroup of $G$. For this let $P \in Syl_p(H)$. Then $P \ne 1$ and therefore $N_G(P) \le H$, so in particular $P \in Syl_p(N_G(P))$. Now assume there exists a Sylow $p$-subgroup $Q$ of $G$ which contains $P$ proper, i.e. $P < Q$, then $P < N_Q(P)$, because normalisers of proper subgroups of $p$-groups grow. But $N_Q(P) = N_G(P) \cap Q$, so that $N_Q(P)$ is a $p$-subgroup of $N_G(P)$ which contains $P$ proper, i.e. $P$ is not a Sylow $p$-subgroup of $N_G(P)$, this contradiciton yields $P \in Syl_p(G)$.
Now let $g \in G$ and suppose that $x \in H\cap H^g$ is a non-trivial $p$-element. Without loss $x \in P$. Then by hypothesis if follows first that $Z(P) \le H\cap H^g$ and then that $P \le H\cap H^g$. In particular $P$ and $P^{g^{-1}}$  are Sylow $p$-subgroups of $H$. Let $h \in H$ be such that $P^h = P^{g^{-1}}$. Then $P^{hg} = P$ whence $hg \in N_G(P) \le H$ by hypothesis. We deduce that $g \in H$, so $H = H^g$.
Therefore if $g \notin H$ we must have $H\cap H^g = 1$, and this means that $G$ is a Frobenius group with $H$ as Frobenius complement. $\square$

The first part of the second paragraph I do not understand "[...] $x \in H\cap H^g$ is a non-trivial $p$-element. Without loss $x \in P$. Then by hypothesis if follows first that $Z(P) \le H\cap H^g$ and then that $P \le H\cap H^g$ [...]". As $Z(P) \le N_G(\langle x \rangle)$ is see that $Z(P) \le H$, but why $Z(P) \le H^g$, and why does $Z(P) \le H\cap H^g$ implies $P \le H^\cap H^g$?

A: The hypothesis holds for $H^g$ as well as for $H$, so $Z(P) \le H^g$ for exactly the same reason that $Z(P) \le H$.
We have $P \le N_G(Z(P)) \le H$ and similarly $P \le H^g$.
By the way, you mean "criterion" not "criteria", which is plural.


text:
Q: Neo4j encryption How I can encrypt a Neo4j database?
For example if I have a small database only two nodes and one relationship,
Node (Tom:person) and Node (ABC: company) and the relationship is Employer
and I have this query
Cypher query:
MATCH   (Tom:person) - [:EMPLOYER] - > (ABC:company)
WHERE   Tom.name = "Tom"
RETURN   company.name;

I have read about Neo4j encryption and I found the following:
Neo4j does not currently deal with data encryption explicitly, for scenarios where additional security is desired two approaches are common:
Encrypting the filesystem the database sits upon and encrypting the data itself from the application.
Many Thanks

A: As the explanation states, Neo4J has no built-in encryption. Either encrypt the filesystem or just the data before you insert it. The latter one is probably easier if you don't have the resources for a crypted filesystem, but it requires you to write more code.


text:
Q: Can java inline a large method if the most of it would be dead code at the call site? I know that one of the criteria that Java HotSpot uses to decide whether a method is worth inlining is how large it the method is.  On one hand, this seems sensible: if the method is large, in-lining leads to code bloat and the method would take so long to execute that the call overhead is trivial.  The trouble with this logic is that it might turn out that AFTER you decide to inline, it becomes clear that for this particular call-site, most of the method is dead code.  For instance, the method may be a giant switch statement, but most call sites call the method with a compile-time constant, so that actually: in-lining is cheap (don't need whole method body; minimal code bloat) and effective (method call overhead dominates actual work done).
Does HotSpot have any mechanism to take advantage of such situations and inline the method anyway, or is there a limit beyond which it refuses to even consider inlining a method, even though it would have a minimal code bloat effect?

A: HotSpot JIT inlining policy is rather complicated. It involves many heuristics like caller method size, callee method size, IR node count, inlining depth, invocation count, call site count etc.
There are some hard limits that prevent a large method from inlining, including:

*

*-XX:FreqInlineSize=325 - the maximum size in bytecodes of the callee to be inlined;

*-XX:InlineSmallCode=2000 - do not inline the callee if it already has a compiled code of at least this size in bytes;

*-XX:NodeCountInliningCutoff=18000 - stop inlining if parser generates this number of IR nodes;

*-XX:DesiredMethodLimit=8000 - the maximum size in bytecodes of aggregate method after inlining. This parameter is not tunable in product builds of HotSpot, but the limit can be switched off with -XX:-ClipInlining.

There are also other limits, but as you already see, a large method does not have much chance to be inlined, even though -XX:+IncrementalInline is enabled by default.


text:
Q: Use live/online firestore in local Functions firebase emulator I am making a cloud function and using the firebase local emulator. Node.js
I follow this guide where it uses the firestore on the local machine. But i want to use my firestore that already is online. Is there any way to achieve this?

A: I understand that you want to test your function within local emulator, but use cloud database.
This is possible, although I don't think it very helpful. You can test easier deploying your function to the cloud. Anyway....
When you test both in emulator and you have both on cloud it's enough to initiate like this (its from here):
const admin = require('firebase-admin');
admin.initializeApp();

const db = admin.firestore();

However if you want to connect from local to cloud you need to initialize like "Initialize on your own server" from the same doc.
I have created similar example from helloworld function working on my side (showing all fields of the docs). I have collection "users" and document "1" in my firestore:
const functions = require("firebase-functions");
const admin = require('firebase-admin');
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
exports.helloWorld = functions.https.onRequest((request, response) => {

       const serviceAccount = require('./serviceAccountKey.json');
       admin.initializeApp({
               credential: admin.credential.cert(serviceAccount)
       });
       const db = admin.firestore();
       const ref = db.collection('users').doc('1');
       ref.get().then((doc)=> {
               functions.logger.info(doc, {structuredData: true});
               response.send('Document data:'+JSON.stringify(doc.data()))
       }).catch(e => {
               console.log('error; '+e)
       })
});

The serviceAccountKey.json you can easily generate in Firebase console in Project settins/Service Accounts tab. Just remember that if you want to deploy to cloud you should change the app initialization.


text:
Q: Ancient Babylonian problem: solve the system $x + y = 50$, $x^2 + y^2 + (x - y)^2 = 1400$ $x + y = 50, x^2 + y^2 + (x - y)^2 = 1400$.  [Hint: Subtract the square of the first equation from twice the second equation to get a quadratic in $x - y$.]  I have gotten it reduced to $x^2 + y^2 -3xy = 550$ but am not sure how to get it in terms of $x - y$ to solve it.

A: The hint is saying that you should take two times $x^2 + y^2 + (x - y)^2$ (the second equation) and subtract the square of the first, $(x + y)^2 = x^2 + 2xy + y^2$.
So the result is
$$
2(x^2 + y^2 + (x-y)^2) - (x^2 + 2xy + y^2)
$$
You should be able to simplify this into something simple in terms of just $(x-y)$.  But then, we also know that the above is equal to
$$
2(1400) - (50)^2
$$
So from here you can solve for $x-y$.  Then once you know $x - y$, since you already know $x + y$ you can find out what $x$ and $y$ are individually.

A: This is a symmetric system, so it can be reformulated in terms of $x+y=50$ and $xy=?$. Just observe that $x^2+y^2=(x+y)^2-2xy$.
When we know the sum and product of two numbers, it's easy to find them.

A: As you have now figured out the answer on your own, I'll post the way I was hinting at in a comment.
I would say your book is pointing you towards the hard way. It's easier just to solve for $y$ in the first equation and substitute that into in the second, giving you a quadratic in $x$, trivially solved by inspection or the quadratic equation.
$$
x + y = 50 \\
y = 50 - x \\
--- \\
x^2 + y^2 + (x - y)^2 = 1400 \\
x^2 + (50-x)^2 + (x - (50 - x))^2 = 1400 \\
x^2 + x^2 - 100x + 50^2 + 4x^2 - 200x + 50^2 = 1400 \\
6x^2 - 300x + 3600 = 0 \\
x^2 - 50x + 600 = 0 \\
(x - 20)(x - 30) = 0 \\
x = 20~or~30\\
y = 50 - x\\
y = 30~or~20
$$
So x and y are 20 and 30, in either combination.


text:
Q: Alternative Proof(s) That A Disk Cannot Be Tiled By Finitely Many Smaller Disks
Show that a disk cannot be tiled completely and without overlap using only finitely many smaller disks. (A disk here contains its boundary)

I came up with this problem while reading about the Apollonian gasket. My little brother's original solution (cleaned up somewhat by myself) went as follows: Assume that we have a valid finite tiling. Note that every nondegenerate disk has infinitely points on its circumference. Consider any disk $O$ in the tiling. Each disk that disk $O$ touches, touches $O$'s circumference at exactly one point. But the space around $O$ must be filled, so every point along its circumference must touch another disk (if it did not, there would necessarily be some $\epsilon>0$ such that for a distance $<\epsilon$ from the circumference of $O$, there exists a point not covered by a disk, which would make it a non-complete tiling, which would be a contradiction). Thus there must be infinitely many disks touching $O$, which contradicts our assumption that there were only finitely many disks in the tiling. Therefore no such tiling exists.
Are there any alternative proofs that there must be infinitely many disks in such a tiling? I was so struck by my brother's elegant proof (slightly nonrigorous as it may be) that I haven't come up with any alternatives, but I'd really like to know if any exist. (Making the above proof more rigorous would be helpful too.)

A: Here's a different proof, though with a similar flavor (we're effectively using the "only one point on the circumference" argument on the big disk, though with more formality).
Without loss of generality, suppose the large disk is the unit disk centered at the origin. Then the maximum radius of any of the smaller disks must be some $x<1$ (since there are finitely many). Then for every $\epsilon$, there will be some $\delta$ such that no disk of radius at most $x$ can cover more than $\epsilon$ fraction of the annulus $\{(x,y)\ |\ 1-\delta\le x^2+y^2\le1\}$. (Proving this rigorously would involve some garbage bashing of trig functions and coordinates, but it shouldn't pose any real difficulty.) Then you just choose $\epsilon$ to be less than the reciprocal of the number of disks in the tiling, and you conclude that not all points on the annulus can be covered.
This proof actually shows the stronger statement that finitely many smaller disks cannot cover the large disk even if they are allowed to overlap each other (but not to cross the boundary of the large disk), since we don't use disjointness of the small tiles at any point. It also gives us concrete lower bounds on how much area is left uncovered, given the list of radii in the tiling.

Another approach: Pick any point $P$ on the boundary of a tile which does not lie on the boundary of the large disk. All 360 degrees of angle around $P$ must be covered by some tile, but it can only be covered by tiles it lies on the boundary of. But since every circle $P$ touches uses up 180 degrees of angle, it must be the meeting point of two circles. But then since every other disk is some positive distance away from $P$, there is some $\epsilon>0$ such that the ball of radius $\epsilon$ around $P$ is only intersected by the two tangent circles mentioned above. But for any such ball, there will be two "slivers" of area left uncovered.
(This proof actually applies to any collection of smooth curves - we just need for there to be no "corners" in the tiles. If our curves have flat sides, we'll need to choose $P$ on a part of the tile with positive curvature.)


text:
Q: redirect unauthorized users to another page spatie laravel I am working on spatie laravel i want to redirecct unthorized users to a specific view on that view it will have a simple button to redirect to back i have tried like this but its giving me error like
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to a member function setCookie() on null

this is my code in app/exception/handler.php
 public function render($request, Exception $exception)
{

     if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) {
    // Code here ...
      return view('404');
}
    return parent::render($request, $exception);
}
 /**
 * Convert an authentication exception into an unauthenticated response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Illuminate\Auth\AuthenticationException  $exception
 * @return \Illuminate\Http\Response
 */
protected function unauthenticated($request, AuthenticationException $exception)
{
    if ($request->expectsJson()) {
        return response()->json(['error' => 'Unauthenticated.'], 401);
    }
    $guard = array_get($exception->guards(), 0);
    switch ($guard) {
      case 'admin':
        $login = 'admin.login';
        break;
      default:
        $login = 'login';
        break;
    }
    return redirect()->guest(route($login));
}

in 404.blade.php
 @extends('web.layouts.default')
@section('title', '404')
@section('content')

You are not authorized

                     Click here to go back

@endsection

i have gievn view homepage permission to user when this permission is there you can view profile page in profileController i have written like
 <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Auth;
use Spatie\Permission\Models\Permission;
class ProfileController extends Controller
{
     public function __construct()
    {
        //$this->middleware('auth',['except' => 'otp']);
       // return redirect(route('logout'));
         $this->middleware(['permission:view homepage','auth']);
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {

        //$per=Auth::user()->getAllPermissions();
        return view('profile');

    }
}

when i type /profile to user who dont have view homepage permission i am getting above mentioned error
please let me know any inputs you want from me

A: You should try to below button use in your 404.blade.php file and it's working fine.
back()->getTargetUrl() }}" class="btn btn-primary"> Click here to go back


text:
Q: Why is the degree:rank ratio of a vector bundle called its "slope"? Whenever one studies moduli spaces of vector bundles on curves, one of the first things to be introduced is the "slope" of a vector bundle, i.e., its degree:rank ratio.  Is there a nice (preferably geometric) intuition behind the use of the word "slope" for this?

A: Mumford studied the quasi-projectivity of moduli space of vector bundle. But such big family is unbounded. So he needed to consider moduli space of vector bundles with some sort of GIT. He arrived to the notion of slope stability. One advantage to restricting to semistable bundles of fixed rank and degree is that
the moduli problem is bounded. In fact Mumford extended Giesecker-stability notion. See section 2.5
Suppose $\mathcal F$ is a coherent sheaf on a projective $X$. Define the Euler characteristic
$$\chi(\mathcal F)=\sum_{i=0}^{dim X}(-1)^i\dim H^i(X,\mathcal F)$$
Let $L$ be an ample line bundle with $c_1(L) =\beta$ on a smooth projective variety $X$ of
dimension $g$. A torsion-free sheaf $E$ is Gieseker stable (respectively Gieseker
semistable) with respect to $\beta$ if for each subsheaf $F$ we have
$$P(F) < P(E) \;\;  \;\;  (P(F) \leq P(E))$$
where $P(E) = \frac{\chi(E \otimes L^n)}{r(E)} $, is the reduced Hilbert polynomial.
Using Riemann-Roch theorem we have
$$P(E\otimes \mathcal O_X(1)^{\otimes m})=rk E\frac{m^n}{n!}+(deg E-rk E\frac{deg K}{2})\frac{m^{n-1}}{(n-1)!}+\cdots$$
where $K$ is the canonical divisor.
We have nice interpretation between the notion of semi-stability for vector bundles and the notion of
semistability coming from an associated GIT problem
We can interpret the slope of vector bundle over a curve of genus $g$ using Riemann-Roch formula. Let me explain it
From of differential geometric point of view the degree of a holomorphic vector bundle can be computed by Chern–Weil formula in terms of curvature, and the fact that curvature decreases in sub-bundles. We explain Chern-Weil formula which gives an effective way for degree of holomorphic vector bundle.
A reflexive sheaf (i.e its double dual is equal itself) is locally free (i.e., a holomorphic vector bundle) outside a subvariety of codimension greater than or equal to two. Let $\mathcal F$ be a coherent subsheaf of holomorphic vector bundle $E$, then there is an analytic subset $S \subset M$ of codimension bigger than two and a holomorphic vector bundle $F$ on $X \setminus S$ such that
$$\mathcal F|_{X\setminus S}=\mathcal O(F)$$
and $F$ is a sub-bundle of $E|_{X\setminus S}$ and there is an orthogonal projection $\pi:E|_{X\setminus S}\to F$
which $\pi\in L_1^2(End(E))$ lying in the Sobolev space of $L^2$ sections of $End(E)$ with $L^2$ first-order weak derivatives and satisfying $\pi=\pi^*=\pi^2$ where $\pi^*$ denotes the adjoint of $\pi$. The Chern-Weil formula is $$deg_\omega \mathcal F=\frac{\sqrt[]{-1}}{2\pi n}\int_X tr(\pi\Lambda_\omega F_h)\omega^n-\frac{1}{2\pi n}\int_X|\nabla''\pi|^2\omega^n$$
where $\nabla''\pi$ is computed in the sense of currents using the $(0,1)$ part of the Chern connection of $E$.
We define the slope of $\mathcal E$, to be $$\mu(\mathcal E)=\frac{deg \mathcal E}{rk \mathcal E}$$
For any non-trivial vector bundle $E$ on curve $X$ by using the Riemann-Roch formula we can compute the slope of a vector bundle over a curve as follows,
$$\mu(E)=\frac{dim H^0(X,E)-dim H^1(X,E)}{rank E}+g_X-1$$
where $g_X$ is the genus of curve $X$.
Another interpretation about semi-stability via slope
It is known that a holomorphic
line bundles on a compact connected Riemann surface $\Sigma_g$
do not admit non-zero global holomorphic sections if their degree is negative.
A non-zero homomorphism from line bundles $L_1$ and $L_2$(which is a section of the line bundle $L^∗_1 ⊗ L_2$)  exist if $deg (L^∗_1 ⊗ L_2) ≥ 0$, which is equivalent to $deg L_1 ≤ deg L_2$
Note that, for higher rank vector bundles, the degree of $E^∗_1 ⊗ E_2$ is
$$deg (E^∗_1 ⊗ E_2) = rk (E_1)deg (E_2) − deg (E_1)rk E_2$$
so the semi-positivity  condition is equivalent to
$$\frac{deg E_1}{rk E_1}
≤
\frac{deg E_2}{rk E_2}
$$

A: This is an addition to Angelo's comment. Given a vector bundle $E$, you can consider its  Harder-Narasimhan filtration  and assign to each element of the filtration a point in the degree-rank plane. The HN-polygon is the polygon obtained by connecting the dots. S.S.Shatz discussed the behaviour of the HN-polygon under specialisation in
The decomposition and specialisation of algebraic families of vector bundles
   I beleive this is where the term orginated, see also
Atiyah-Bott, section 7 (p.565).
Addendum:
You can gain minor visual gratification from looking at the degree-rank plane as follows.
If $F\subset E$ is a subbundle, then
$$
\deg \underline{Hom}(F,E)= \textrm{rk}F\deg E-\textrm{rk}E \deg F=
\left|
\begin{array}{cc} \deg E & \deg F\\\
\textrm{rk} E & \textrm{rk} F\\\
\end{array} \right|.
$$
Also,  $F$ destabilises $E$  exactly when  the above determinant has negative sign.


text:
Q: Discord Bot Java API (net.dv8tion) Permission Problems i'm trying to make a discord bot that can add/delete roles of users but sadly i got some permission problems.
API can be found: https://github.com/DV8FromTheWorld/JDA/
I would love to hear of someone who has an idea of what to do. I have not found anyone with the same problem.
The "exiting" part of the error looks like the following:
net.dv8tion.jda.api.exceptions.HierarchyException: Can't modify a role with higher or equal highest role than yourself! Role: R:unverified(1014845515776671764)
at net.dv8tion.jda.internal.entities.GuildImpl.checkPosition(GuildImpl.java:1866)
at net.dv8tion.jda.internal.entities.GuildImpl.addRoleToMember(GuildImpl.java:1535)
at Verify.onMessageReceived(Verify.java:29)

What i've already checked:

*

*in the https://discord.com/developers/applications - bot section i marked the Privileged Gateway Intents stuff

*in the invite for my bot on the server i checked the administrator permissions

*in the invite i also checked the guild-related scopes in addition to bot and application.commands scopes (but if i just check all of  the scopes the invite link doesnt work so i concentrated on the ones i think are important ... whatever)

*in the source code i enabled the GatewayIntents (see source code below) but i think it's not needed since i set them already in the previous points

*EDIT: i also tried to do the addRoleThingy with a new Account that has no roles at all on the server -> received the exact same error

*EDIT: when i want to kick the other account with the bot it works as intended even though you need some higher permission for that...

Main.java:
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.*;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.requests.GatewayIntent;
import javax.security.auth.login.LoginException;

public class Main extends ListenerAdapter {
    public static Channel verifyingChannel = null;
    public static Role unverified = null;
    public static Role verified = null;

    public static void main(String[] args) throws LoginException {

        String token = "MTAxNDc5NDM3NTc5ODIwNjU2NA.GbfY1_.xBGsGKK5Ox1jzFVYwIp_cMU3kMcOvNnq2dKOQM";
        JDABuilder builder = JDABuilder.createDefault(token);

        builder.enableIntents(GatewayIntent.GUILD_MEMBERS, GatewayIntent.MESSAGE_CONTENT,GatewayIntent.GUILD_PRESENCES);
        builder.setStatus(OnlineStatus.ONLINE);
        builder.setActivity(Activity.listening("the sound of life"));

        builder.setMemberCachePolicy(MemberCachePolicy.ALL);
        builder.setChunkingFilter(ChunkingFilter.ALL);
        builder.enableCache(CacheFlag.ROLE_TAGS);
        JDA bot = builder.build().awaitReady();
        bot.addEventListener(new Verify());

        // don't worry about the next one, it adds some commands that just work already
        bot.addEventListener(new Commander(bot));

        System.out.println("Bot is online!");

    }

}

Verify.java
import net.dv8tion.jda.api.entities.Channel;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;

public class Verify extends ListenerAdapter {

    public Verify(){}

    @Override
    public void onGuildMemberJoin(GuildMemberJoinEvent event) {
        // later: implement the addRoleToMember funtion here
    }

    @Override
    public void onMessageReceived(MessageReceivedEvent event){
        // The Role Main.unverified is first set with a setup command in the Commander-Class, that part is not the problem
        event.getGuild().addRoleToMember(event.getMember(),Main.unverified).queue();
    }

}

A: You simply cannot modify a user with higher or equal permissions as shown in the error log.
I assume you are an admin on your server where you test the bot.
Therefore, you and the bot have the same/equal permissions which goes against the fact that ...

..."You simply cannot modify a user with higher or equal permissions as shown in the error log"

I would recommend that you invite another user to the server and give him lower permissions. If you do so, the bot should be able to modify the new user with no issues.

A: So, to finally fix my problem i simply rearranged the roles on the server. In the server properties the bot role had to be above the role i wanted to apply.


text:
Q: python charmap codec can't decode byte X in position Y character maps to  I'm experimenting with python libraries for data analysis,the problem i'm facing is this exception

UnicodeDecodeError was unhandled by user code Message: 'charmap' codec
  can't decode byte 0x81 in position 165: character maps to < undefined>

I have looked into answers with similar issues and the OP seems to be either reading text with different encoding or printing it.
In my code the error shows up at import statement,that's what confuses me.

I'm using python 64 bit 3.3 on Visual Studio 2015
and geotext is the library where it shows the error.
Kindly point as to where to look to deal with this error.

A: Here is how I solved this issue (its applicable for geotext 0.3.0)
Check the traceback:

Traceback (most recent call last):
    File "pythonTwitterTest.py", line 5, in
      from process.processData import *
    File "C:\OwaisWorkx\Courses\5th Semester\Project\pythonTwitterTest\pythonTwitterTest\process\processData.py", line 1, in
      from geotext import GeoText # for classifying and seperating City , Country and States/Provinces
    File "c:\Python33\lib\site-packages\geotext__init__.py", line 7, in
      from .geotext import GeoText
    File "c:\Python33\lib\site-packages\geotext\geotext.py", line 87, in
      class GeoText(object):
    File "c:\Python33\lib\site-packages\geotext\geotext.py", line 103, in GeoText
      index = build_index()
    File "c:\Python33\lib\site-packages\geotext\geotext.py", line 77, in build_index
      cities = read_table(get_data_path('cities15000.txt'), usecols=[1, 8])
    File "c:\Python33\lib\site-packages\geotext\geotext.py", line 54, in read_table
      for line in lines:
    File "c:\Python33\lib\site-packages\geotext\geotext.py", line 51, in
      lines = (line for line in f if not line.startswith(comment))
    File "c:\Python33\lib\encodings\cp1252.py", line 23, in decode
      return codecs.charmap_decode(input,self.errors,decoding_table)[0]
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 165: character maps to

This shows the error is actually in the geotext.py file
so open that up
geotext.py and goto line 45:
Change from this
with open(filename, 'r') as f

to this
with open(filename, 'r', encoding='utf-8') as f:

P.S: Solution taken from Python-forum.io


text:
Q: GARCH Model Estimation I am analysing a GARCH(1,1) model under the assumption of t-Student distribution.
In particular, I set the problem in the following way. I have a series ${y_t}, t \in{1,2,...,T}$ and I assume that:
1) $y_t = \sigma_t \epsilon_t$ where $\epsilon_t\sim t_{\nu}$ where $t_{\nu}$ is a
   t-Student distribution with $\nu$ degrees of freedom, to be estimated by the
   model
2) $\sigma_t^2=\omega + \alpha y_{t-1} + \beta \sigma_{t-1}^2$ is the equation of variance
My question is: when creating $\sigma_t^2$ I have to consider the real values of the series $y_t$ or I have to generate a random number $\epsilon_t$ distributed as a t-Student distribution, calculate $y_t = \sigma_t \epsilon_t$ and then evaluate $\sigma_t^2=\omega + \alpha y_{t-1} + \beta \sigma_{t-1}^2$?
Another question is, assuming that $\epsilon_t\sim t_{\nu}$ means that the degrees of freedom of the distribution have to estimated by the model or I have to set these degrees of freedom before the GARCH(1,1) estimation problem?

A: The answer provided in this post may be of help to you. The code is in MATLAB but that should be irrelevant, because the transformations are algebraic anyway, not code-specific. The main idea is that you build your model in such a way that you transform your original parameters $\vec{\alpha}$ (which have certain constraints on them) to a different set of parameters $\vec{\theta}$ which do not have constraints. You do the transformation using a specific, "1-to-1" function for each parameter, perform the unconstrained optimisation on $\vec{\theta}$, and then transform the resulting $\vec{\hat{\theta}}$ into the original $\vec{\alpha}$ by using the inverse of the "1-to-1" function used in the first place.
You should check the book "Quantitative Risk Management" by Embrechts, McNeil, Frey. Its section called "GARCH models for Changing Volatility" covers pretty much everything you are looking for, including the topic of QMLE.

A: Ad 1) Yes, when creating $\sigma_t^2$ you use $y_t$ in the equation
$$
\sigma_t^2 = \omega + \beta \sigma_{t-1}^2 + \alpha y_{t-1}^2
$$
You have made the assumption $E[y_t] = 0$. You have an error in the GARCH equation - it should be $y_{t-1}^2$.
Ad 2) You decide. You can estimate the degree of freedom or simply assume a value. If the goal is to understand how fat tailed distribution you need, then I would estimate the degree of freedoms.


text: Q: DHCP configuration for iPXE Is there a way to configure the DHCP process in iPXE? In particular, I want to configure the DHCP Discover message sent by iPXE, so that the message issued by iPXE includes more options in Parameter Request List (Option 55) for the server to replied with. Currently, only a restricted subset of options are requested, but I want more.


text:
Q: How to add a scroll bar in PhoneGap I have to add a scroll bar in PhoneGap. Please check my code below.
public class MyActivity extends DroidGap {
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        super.loadUrl("file:///android_asset/www/index.html");

        // Display vertical scrollbar and hide horizontal scrollBar
        super.appView.setVerticalScrollBarEnabled(true);
        super.appView.setHorizontalScrollBarEnabled(false);
        // set scrollbar style
        super.appView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    }
}

I get an error in this statement:
super.appView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

A: Mobile WebKit (iOS and Android, etc) does not provide a native way to scroll content inside a fixed width/height element, but many libraries can help you with that issue.
I use the iScroll to scroll the content in my PhoneGap app. It's a very lightweight framework, only focuses on the scroll problem of mobile WebKit browser or WebViews, and it works perfect.
Here is a simple example .

A: Perhaps you haven't added this line
import android.view.View;

before
public class MyActivity extends DroidGap {


text:
Q: react-datepicker is highlighting previously selected date, as well as current date on open. How do I prevent this? I am using the npm package 'react-datepicker'. As you can see in the screenshots below, I am having an issue where if I increment/decrement the date via the left/right arrows, my previously selected date will still appear when I open the date picker.
const [startDate, setStartDate] = React.useState(new Date());
const [datePicker, setDatePicker] = React.useState(false);
const showDatePicker = () => {setDatePicker(!datePicker)};

return (
    <S.HotelSearchBar>
        <S.Item col="1/1" row="1/1">
            <S.CheckIn onClick={() => showDatePicker()}>
                <S.Grid>
                    <S.DateIcon>
                        <S.Icon icon="date_range" />
                    </S.DateIcon>
                    <S.ButtonHead>Check In</S.ButtonHead>
                    <S.ButtonLabel>
                        <DatePicker
                            customInput={<S.customDateRange />}
                            selected={startDate}
                            onChange={(date) => setStartDate(date)}
                            onClickOutside={() => showDatePicker()}
                            open={datePicker}
                            dateFormat="d MMMM, yyyy"
                        />
                    </S.ButtonLabel>
                    <S.DateNavigator>
                        <S.DateButton
                            onClick={(event) => {
                                event.stopPropagation();
                                let newDate = new Date(startDate);
                                setStartDate(newDate.setDate(newDate.getDate() - 1));
                            }}
                        >
                            <S.Icon clickableIcon icon="chevron_left" />
                        </S.DateButton>
                        <S.DateButton
                            onClick={(event) => {
                                event.stopPropagation();
                                let newDate = new Date(startDate);
                                setStartDate(newDate.setDate(newDate.getDate() + 1));
                            }}
                        >
                            <S.Icon clickableIcon icon="chevron_right" />
                        </S.DateButton>
                    </S.DateNavigator>
                </S.Grid>
            </S.CheckIn>
        </S.Item>
    </S.HotelSearchBar>
);

My default selected date

After I have opened the date picker

After I select the right-arrow icon to increment the date

After I open the date picker again

A: Just encountered the same issue, and came to the conclusion that this library is bugged, and doesn't "clean up" after itself while manually changing date values.
You can fix this by doing the following -

    const Component = () => {
      const datePickerRef = useRef();

      useEffect(() => {
        if (datePickerRef.current) {
          datePickerRef.current.handleCalendarClickOutside();
        }
      }, [props.selectedValue]);

      return (
        <DatePicker ref={datePickerRef} ... />
      );
    }

This way you "manually" clean up after the value changed.
Hope this works for you as well as it did for me!

A: I believe this should work for you:
<DatePicker
    customInput={<S.customDateRange />}
    selected={startDate}
    startDate={startDate} // add this
    onChange={(date) => setStartDate(date)}
    onClickOutside={() => showDatePicker()}
    open={datePicker}
    dateFormat="d MMMM, yyyy"
/>


text:
Q: why the continue url(firebase flutter) Redirect me to the app before the verification process complete? I am trying to send verification link using firebaseauth, what is happening that the process of sending the link is completely successful, what i aiming to do is to redirect the user to the application after the " verification link click" , i used continue url & dynamic links to do that, and this also worked for me , and the user was redirected to the app but without verifying the email , it looks like the dynamic link deny the server side process that should set isEmailVerfied to true !
**This is my code with 2 *
 void sendVerificationLink() {
    var actionCodeSettings = ActionCodeSettings(
      url: 'https://testapp.page.link/',
      androidPackageName: 'com.example.test',
      androidInstallApp: true,
      androidMinimumVersion: '1',
      handleCodeInApp: true,
    );
    emit(LoadingSendEmailVerification());
    FirebaseAuth.instance.currentUser!.sendEmailVerification(actionCodeSettings).then((value) {
      emit(SuccessSendEmailVerification());
    }).catchError((error) {
      print("the error is :"+error.toString());
      emit(ErrorSendEmailVerification());
    });
  }

and this is the function that should verify the process
  void ensureEmailVerified() {
    emit(LoadingEnsureEmailVerified());
    FirebaseAuth.instance.currentUser!.reload().then((value) {
      if (FirebaseAuth.instance.currentUser!.emailVerified) {
        FirebaseFirestore.instance
            .collection('users')
            .doc(uid)
            .update({'isEmailVerified': true})
            .then((value) {})
            .catchError((onError) {});
      }
      emit(SuccessEnsureEmailVerified());
    }).catchError((onError) {
      emit(ErrorEnsureEmailVerified());
      print(onError.toString());
    });
  }

thanks in advance...


text:
Q: How to set construction fields or configuration loading in akka actor? I have a scenario where i need to get data from Soap Service API call for each company.
For each industry i have thousands companies.
To call API , i need to set/pass few parameters apart from companyid. These parameters like user name , password , url , port etc... more of configuration or property files ..
These wont change for each call i.e. each Actor.
I am trying to implement the same using Akka Actor system for company retrieval i.e. calling Soap Service API .
Me new to Akka ,  any help how to do this ?
Thanks and Regards.
Tried :
CompanyActor -- which expects a companyId so created a CompanyInput as below
CompanyInput{
 String companyId,
 DataAPIConnection conn;
}

I am preparing CompanyInput where I get connection object "conn" by passing all valid userName and pwd , url to Soap Service API call.
I set companyId also.
Then create CompanyActor . where
@Override
        public void onReceive(Object msg) throws Throwable {
               if(msg instanceof CompanyInput) {
                   CompanyInput input = (CompanyInput)  msg;
                   logger.info("onRecive msg companyId : " + input.getCompanyId());
               }

        }

Hope the above works fine. Please suggest if any corrections needed.
But from this I need to return CompanyInfo object i.e. reading the fields from SoapAPI call and populating  CompanyInfo  VO.
How to return an object from an Actor call ? onReceive() returning void so I return a Future ?

A: In Akka, messages go in one direction and the receive function does not return a value. Instead, you can send a reply message back to the original sender:
https://doc.akka.io/docs/akka/current/actors.html#reply-to-messages
You can use the "ask pattern" to simplify sending a message that expects a reply. Calling ask returns a CompletionStage in Java (or a Future in Scala) that completes when the receiving actor replies to its sender:
https://doc.akka.io/docs/akka/current/actors.html#ask-send-and-receive-future


text:
Q: jQuery - How to assign ajax post response to a variable  var jqxhr = $.post("/cms/menu_pagesave", {
   page_id: pageID,
   name : value_td,
   url : value_url
   }, function(data) { })
   .success(function(response, textStatus, jqXHR){
   if (response) {
    menupageID = response;
    console.log(response);
    }
  });

I've got the correct response (which should be an integer) as it's turning up in the console. However it's not get assigned to the menupageID. How can I assign the value of the response to a variable? Thanks

A: You are probably attempting to using menupageID before the asynchronous response is returned. If possible, try to localize your access to the response value to be only within the success handler. In other words, put the code that needs access to menupageID also inside the success function.


text:
Q: 2 x 2 between-subjects design ANCOVA with non-sig. interaction effect; but profile plot shows curves crossing I'm running a 2X2 between-subjects design ANCOVA and wonder about one peculiar thing: The ANCOVA output table reveals no significant interaction effect, albeit the profile plot shows two lines that cross each other, i.e. an disordinal interaction. So how to reconcile these apparently contradictory findings? Might I presume the existence of an interaction effect (which would make a lot of sense by the way..) based on the plot despite a lack of statistical significance? And why is it non-significant; perhaps because of a lack of statistical power?

A: There's no necessary contradiction.
The crossing can be present but not significantly different from zero. Lines that don't cross are not necessarily 'weaker' in effect than lines that do.
Lack of a significance may not just be a lack of power; it might be that there's actually no population effect (or at least none of any practical import - i.e. none that we'd care to identify).
That said, there could well be a 'real' interaction (one large enough to be worth finding) and, as you suggest, a lack of power (relative to the size of the random variation in the data) is why you didn't find it.


text:
Q: What does Earth feel like when squeezed? he average density is about 4g/cm^3 so if the earth was in the size of an orange, it would feel like a rather heavy ball.
The crust is relatively thin, and the earth is said to be solid land masses floating on the molten core. So what would it feel like to squeeze this orange-sized ball? Would it feel like a rock, or more like something with a solid crust, and then with some more force, would break and leak?
Question 2: What if instead of shrinking the earth model, we make ourselves much larger so that the earth fit nicely in the palm of the hand? Would the physics feel significantly different?
Now, one needs to ignore a bunch of issues about scaling a human, but I think my intention is clear.
A good answer to this would help with the intuition of the composition of the Earth, and if there are two different answers depending on what scale this thought-experiment takes place, that would be interesting as well I think.

A: This is a really interesting question!
So what would it feel like to squeeze this orange-sized ball?
So, assuming that the earth keeps most of it's material properties after being shrunk, and you hold it the moment it was transformed then it won't be comfortable experience.
The Weight
For one, as you pointed out the average density of the earth is about $4g/cm^3$ (Wolfram gives $5.515 g/cm^3$). Going by this table the most common metal that is close to that number is cast iron. So it would feel a little lighter than an iron ball.
The Texture
According to this "The major, intermediate and minor diameters of [a] grade 2 orange [is] 84.1, 77.4 and 75.5 mm, respectively". This means that the diameters of an orange deviate a lot between axes. That is not the case with the earth. According to Wikipedia the earth's radius ranges from 6,378 kilometers at the equator and 6,357, so the earth is a lot closer to a sphere than our orange. Furthermore, as I am sure you've heard, the earth's crust is very smooth. A bad astronomy post breaks down this fact by proving that the earth is in fact smoother than a standardized billiard ball.
The Burn
Of course none of this compares with the fact that as soon as you pick up the orange sized planet you will feel just how hot the earth is. According to Wikipedia the temperature of the mantle ranges from 200 centigrade to 4000 centigrade. For the most part we are shielded from those temperatures by the 30 km crust right above it. But in our orange sized earth that crust has now been shrunk to about 0.3-0.5 mm thick.
Using the formula for heat conduction through spherical shells, and assuming the inner radius is 80mm, the outer radius is 80.5mm, a $k$ value of 1.3 W/mK and you are at r.t.p we get:
$$\frac{\delta Q}{\delta t} = 4k\pi\frac{(T_1 - T_2)r_1r_2}{r_2 - r_1} \approx 38kW$$
so even though at first the "crust" would be relatively cool, it would almost instantly heat up to the point where it would be unbearable. Also, this was done with the 200 centigrade figure but in reality it would feel much much hotter.
The Squeeze
But what about the real reason we came here for? If you were wearing industrial heat resistant gloves that also felt like they weren't there at all, how would the orange sized earth "give"? Well for one as you pointed out the reason the mantle close to our crust is so hot is partly due to the fact that it convects. Its almost fluid behaviour means that temperature can circulate.
But a lot of that is due to the behaviour of rock and other materials as they are heated and compressed with insane pressure. In actuality, the mantle is mostly composed of solid rock that is under so much pressure and heat that it behaves somewhat like a fluid.
However, that is no longer the case once you have shrunk the Earth to the size of an orange. The core might be primarily liquid iron and nickel but you wont be able to really squeeze it like a water balloon.
That being said, the temperature of the inner parts of the mantle as well as the core are way above the melting point for the materials found there so the inner portions would quickly melt.
If anything I think it would feel more like a really hot and tough bonbon or jawbreaker with a liquid core. I also speculate that it could expand very rapidly due to the large change in pressure from the sudden shrinking.
What about making ourselves big?
Would the physics feel significantly different?
YES. For one, there exist the problem of making objects big when they are only feasible at smaller scales. The only time when an average person is concerned with gravity is when they have to deal with Earth's influence. However, once you are at the planetary scale you find that you will inevitably have to deal with your own gravity.
If you look at photos of "small" astronomical objects like asteroids and comets then you will see that their shapes vary a lot from case to case. However, the bigger you get, the more these objects seem to approach a sphere-like structure. This can be (very crudely and simplistically) explained as tendency to for these systems to minimize they're potential energy. For a system that is experiencing its own gravity, this is a sphere, since it is the shape where the most mass can be closest to the center.
As an aside, Randall Munroe, the author of XKCD comics, has another series in which he explores the types of questions and in several he has to deal with scaling up objects and their effects. I really recommend this series as it is full of interesting questions like yours. In particular I would look at the earth sized bowling ball.
So what? You are a ball now, what about the squeeze?
Well it just so happens that you are not the only entity that has to deal with your gravity. Earth now has to come to terms that you are now much larger and massive than it. If we scale ourselves up so that the Earth (about $1\times10^{21} \ m^3$) is the size of an orange relative to us then going by the dimensions of that grade 2 orange:
$$V_{\text{orange}} = \frac{4}{3}\pi abc \approx 2.06 \times 10^{-3} m^3$$
Using the fact that mass generally scales up with volume we can use proportions. Assuming you are around 70kg:
$$M_{\text{big-you}} = \frac{V_{\text{earth}}}{V_{\text{orange}}}M_{\text{small-you}} \approx 3.4 \times 10^{25} kg$$
which, according to wolfram, happens to be almost 6 times the mass of Earth. So the earth would now orbit you. As fun as that is I would not recommend to try to squeeze since tidal forces are now certain to have an effect between you two.
For one, assuming you are a sphere of average human density (about the density of water) your Roche limit is now:
$$d = R_{\text{earth}}\left(2\frac{M_{\text{big-you}}}{M_{\text{earth}}}\right)^{\frac{1}{3}} \approx 1.4 \times 10^7 m$$
which according to wolfram is about the diameter of the Earth. So you must keep a distance of one Earth, from the Earth. If you don't you will both start breaking up into dust in spectacular fashion.
Finally, if you somehow manage to ignore all that and become Galactus then you could easily squeeze through the hard (now relatively cool) crust to find that the mantle is once again your limiter. It is essentially solid but very hot rock that "flows" but not at the rate to make it seem like a balloon or feel like anything you've touched before. What would be fun is that now that you have squeezed the crust some of that is now orbiting you! Like the Galactus equivalent of crumbs.


text:
Q: storing closest and parents in variable is not working in internet explorer so I have

YO!

and then
$('.clickthis').click(function(){
    alert($(this).closest('.the-table').html());
    parent = $(this).closest('.the-table');
    alert(parent.html());
    alert($(parent).html());
 });

But then in internet explorer the first alert would alert the table properly, the second alert would return an error that html() is not supported and the third alert would alert null...
on the other hand in Firefox, everything alerts the html properly
how do you go about storing jquery objects in a variable in IE such that you can do the stuff above?
I also tried using parents() instead of closest() but it still didn't work

A: Change it to this and it works on IE:
$('.clickthis').click(function(){
    alert($(this).closest('.the-table').html());
    var parent = $(this).closest('.the-table');
    alert(parent.html());
    alert($(parent).html());
 });

Apparently, IE has some sort of conflict with a global variable named parent.  It works when you make that variable a local variable.
As mu is too short points out, it is probably a conflict with window.parent which IE9 may correctly be making read-only since it isn't something you are supposed to be able to change.
Yet another reason why implicit global variables (e.g. undeclared variables) are a really, really bad practice.

A: Try using var and parents():
$('.clickthis').click(function(){
    var parent = $(this).parents('.the-table');
    alert(parent.html());
});

Live demo: http://jsfiddle.net/JhwcZ/

A: This will work in IE 11
$("#grid").kendoGrid({
    change: function(e) {
    var selected = this.select();
     selectedDataItems = [];
      for (var i = 0; i < selected.length; i++) {
        var dataItem = this.dataItem($(selected[i]).closest("tr"));
        selectedDataItems.push(dataItem);
       }
      }
    });


text:
Q: SMC and/or T2 chip issue after MacOS 12.5.1 update Two days back, I tried to update my Macbook Pro 2019 (Intel chip, T2 chip) with macOS Monterey 12.5.1. During the installation, it got shut down and didn't power on. I tried many basic techniques to power it on like Power Cycle, reset NVRAM/PRAM, and reset SMC. Nothing helped.
After many hours of (re)search, I found this video (https://youtu.be/1hYxBb-M7lU), and it worked. I revived using another MacBook with the DFU technique (in Apple Configurator). Now, I am able to boot/power on my MacBook using this technique. But, if I try to restart again, I won't turn on.
Also, I am not able to connect my external SSD or monitor (But I am able to charge the MacBook.  I tried to reset SMC, but no help.
I am not sure what could be the problem, can someone help me with this?
These are my system details.

*

*Model Name:   MacBook Pro

*Model Identifier: MacBookPro16,2

*Processor Name:   Quad-Core Intel Core i5

*Processor Speed: 2 GHz

*Number of Processors:    1

*Total Number of Cores:   4

*L2 Cache (per Core): 512 KB

*L3 Cache:    6 MB

*Hyper-Threading Technology:  Enabled

*Memory:  16 GB

*System Firmware Version: 1731.140.2.0.0 (iBridge: 19.16.16066.0.0,0)

*OS Loader Version:   540.120.3~19

*Serial Number (system):  C17D927JML7H

*Hardware UUID:   5954A7CC-AB67-5DC4-AF8B-4EA2E5FACD14

*Provisioning UDID:   5954A7CC-AB67-5DC4-AF8B-4EA2E5FACD14

*Activation Lock Status:  Enabled

Thanks,
Santhosh


text:
Q: MacBook mouse pointer lockup MacBook Pro (Retina, 15-inch, Mid 2014)
In recent days the mouse pointer will be inoperable after waking from sleep. If I cmd tab I can find the pointer, but it will not respond to trackpad movement or clicks. It does not recover if I close applications, open the force quit window or resleep. Only a reboot will bring it back.
Just now it froze as I was typing. Additionally, the character I was typing repeated, as if I was holding my finger on the key combination (it was the '$' character). Again, only a reboot would stop it.
SMC reset did not fix it.
How can I resolve this so that it does not happen again?

A: I had a problem similar to this and it was because of a bluetooth mouse which had been left switched on in a bag. The button was held down by something resting on it and it was overriding the trackpad. If you use the keyboard shortcut (usually cmd+spacebar) to bring up spotlight and type bluetooth you can use the down arrow key to select the bluetooth system preference and you will be able to see if there is a connected mouse there causing the problem.


text:
Q: Slow Postgres 9.3 queries I'm trying to figure out if I can speed up two queries on a database storing email messages. Here's the table:
\d messages;
                             Table "public.messages"
     Column     |  Type   |                       Modifiers
----------------+---------+-------------------------------------------------------
 id             | bigint  | not null default nextval('messages_id_seq'::regclass)
 created        | bigint  |
 updated        | bigint  |
 version        | bigint  |
 threadid       | bigint  |
 userid         | bigint  |
 groupid        | bigint  |
 messageid      | text    |
 date           | bigint  |
 num            | bigint  |
 hasattachments | boolean |
 placeholder    | boolean |
 compressedmsg  | bytea   |
 revcount       | bigint  |
 subject        | text    |
 isreply        | boolean |
 likes          | bytea   |
 isspecial      | boolean |
 pollid         | bigint  |
 username       | text    |
 fullname       | text    |
Indexes:
    "messages_pkey" PRIMARY KEY, btree (id)
    "idx_unique_message_messageid" UNIQUE, btree (groupid, messageid)
    "idx_unique_message_num" UNIQUE, btree (groupid, num)
    "idx_group_id" btree (groupid)
    "idx_message_id" btree (messageid)
    "idx_thread_id" btree (threadid)
    "idx_user_id" btree (userid)

Output from SELECT relname, relpages, reltuples::numeric, pg_size_pretty(pg_table_size(oid)) FROM pg_class WHERE oid='messages'::regclass;
is
 relname  | relpages | reltuples | pg_size_pretty
----------+----------+-----------+----------------
 messages |  1584913 |   7337880 | 32 GB

Some possibly relevant postgres config values:
shared_buffers = 1536MB
effective_cache_size = 4608MB
work_mem = 7864kB
maintenance_work_mem = 384MB

Here are the explain analyze outputs:
explain analyze SELECT * FROM messages WHERE groupid=1886 ORDER BY id ASC LIMIT 20 offset 4440;
                                                                      QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=479243.63..481402.39 rows=20 width=747) (actual time=14167.374..14167.408 rows=20 loops=1)
   ->  Index Scan using messages_pkey on messages  (cost=0.43..19589605.98 rows=181490 width=747) (actual time=14105.172..14167.188 rows=4460 loops=1)
         Filter: (groupid = 1886)
         Rows Removed by Filter: 2364949
 Total runtime: 14167.455 ms
(5 rows)

The second query:
explain analyze SELECT * FROM messages WHERE groupid=1886 ORDER BY created ASC LIMIT 20 offset 4440;
                                                                        QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=538650.72..538650.77 rows=20 width=747) (actual time=671.983..671.992 rows=20 loops=1)
   ->  Sort  (cost=538639.62..539093.34 rows=181490 width=747) (actual time=670.680..671.829 rows=4460 loops=1)
         Sort Key: created
         Sort Method: top-N heapsort  Memory: 7078kB
         ->  Bitmap Heap Scan on messages  (cost=7299.11..526731.31 rows=181490 width=747) (actual time=84.975..512.969 rows=200561 loops=1)
               Recheck Cond: (groupid = 1886)
               ->  Bitmap Index Scan on idx_unique_message_num  (cost=0.00..7253.73 rows=181490 width=0) (actual time=57.239..57.239 rows=203423 loops=1)
                     Index Cond: (groupid = 1886)
 Total runtime: 672.787 ms
(9 rows)

This is on an SSD, 8GB Ram instance, load average is usually around 0.15.
I'm definitely no expert. Is this a case of the data just being spread throughout the disk? Is my only solution to use CLUSTER?
One thing I don't understand is why is it using idx_unique_message_num as the index for the second query. And why is ordering by ID so much slower?

A: If there are many records with groupid=1886 (from comment: there are 200,563), to get to records at an OFFSET of a sorted subset of rows, would require sorting (or an equivalent heap algorithm) which is slow.
This could be solved by adding an index. In this case, one on (groupid,id) and another on (groupid,created).
From comment: This indeed helped, taking down the runtime to 5ms-10ms.


text:
Q: slow select query mysql table I have a table with 8 million of records which has 10 columns and one of the column is 'text' type while other are mainly timestamps or varchar(10). I have all the necessary index created . Table size ~10GB while index ~4GB.  While running a point query my select are performing well but when i select 50% of the rows it takes ages to complete ~30mins . I am not selecting text column . Query plan says atleast one index used.
Any reason why table is not performing ? is it due to text column which stores a blob(generally ~32KB)


text:
Q: Using scipy.optimize.minimize with a quantized integer range Can I use scipy.optimize.minimize to only restrict its answer to for example 2, 3, 4, 6, 8, 10? Just those values and not float values?

A: If the question is, if you can use discrete/integer/categorical design variables in scipy.optimize.minimize, the answer is no. It is mainly focused on gradient-based optimization, and it assumes continues design variables and continuous objective function. You can implement some continuous approximation, or branch-and-bound or similar methods to solve for discrete design variables.

A:
Can I use scipy.optimize.minimize to only restrict its answer to for example 2, 3, 4, 6, 8, 10?

scipy.optimize.minimize doesn't support this directly, but the wrapdisc package uses rounding to restrict the answer as per your need. It works as a thin wrapper over scipy.optimize. It supports a quantized integer variable. With it, you can define the example as QrandintVar(2, 10, 2). There is a usage example in its readme.