text:
Q: Filter Azure Search query result with a big list of IDs I have 2 indexes in Azure Search:
// index-1. record type
{
  "id": "123456"
}

// index-2. records group type
{
  "groupId": "1",
  "groupRecords": [ "123456" ]
}

I need to query all records from index-1 that belong to the group in index-2.
From ElasticSearch documentation I see it supports cross-index queries.
Is that possible to do a similar query with Azure Search? Or is that possible to filter out Search result with a dataset from Cosmos?
p.s. I may have hundreds of millions of records, groups of millions of records, thousands of groups.

A:
Is that possible to do a similar query with Azure Search?

As far as I know, cross-index searches are not supported in Azure Search. Search is scoped/limited to a single index only.
I found this feedback from 2016 that asked for this feature and it has been under review for almost 2 years now.
https://feedback.azure.com/forums/263029-azure-search/suggestions/16700506-search-multiple-indexes-at-once

A: The common approach with search engines is to flatten the record while consuming the data. I.e. you would read the data from both sources and combine them into a new, flat record that contains all the data.
// index-x, flat records
{
  "id": "123456",
  "groupRecords": [ "123456" ]
}

I'm not sure I understand exactly what you are trying to do, but flattening the data is common practice when you need to join data.


text:
Q: How to store (and read) large arrays/maps/whatever in Java? Can anyone help me with following problem?
I need to permanently save what I today have in arrays, to later use the data for calculations. I explain an example below.
1, I generate a long[][] which is far too big for my computers RAM. It is generated one row after the other.
2, I calculate something from my long[][] and save the results in a double[][] - also too big for my RAM. I do not need the entire long[][] at the same time, as a small batch of rows are used in the calculations at the same time, and one row in the double[][] is filled for each batch.
3, I need to sort the double[][], and do a lot of other things not important here.
4, I repeat step 2 and 3 in a number of iterations (largish, >10000), which means I care about the speed of both access and sorting.
I know the size of the arrays, but obviously I cannot initialize them as they are too big, and also because it must be initialized by an int (so far, I can only run "small" calculations). Ofcourse, I can use Maps etc, but I have failed to get this working, and I do not understand which kind(s) I should use. I have never used maps/collections etc before. In the latter case I can use one of the columns in the arrays as keys, as they are identical (except from the type). The key could simply be the row number (expressed as a long).
Preferably, I want to solve this without using a database that needs installation of a server, as my program will be used by others than me.
I am more than grateful for any help and advice!

A: If the arrays are larger than can be stored in your computer's RAM, then, obviously, you should store part of the array or its entirety on disk.
For this purpose, you can use a database. Now that you don't want to install a server, you can use an embedded database such as HSQLDB. You can configure HSQLDB to delete all data when your application terminates or to retain them for future use.
An alternative is to use a custom Map implementation that flushes the data to secondary storage whenever its size increases more than a threshold defined by you. For this purpose, multiple strategies are available: FIFO, LIFO, LRU, etc. Also whenever you need to access a certain element of the map, again you can load a bulk of adjacent elements from the disk (or again, use a strategy that is more appropriate for your use case) to reduce excessive disk I/O.

A: For storing this data you could use netcdf or hdf5. You can get and save subsets of arrays.

A: Managing subset of data is likely to be the best solution.
However, You should ask yourself if you are using the right machine for the job.  You can buy a new PC, Core 2 Duo 2.5 GHz with 4 Gb of memory for £225. You can buy a Quad core AMD with 8 GB for £380.  You can buy 16 GB of memory for £320.
My point being that your time with worth something and you need to trade off how much work it will take you now and in the future to save some memory and how much that memory is worth.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Как при помощи JS определить, рабочая ссылка на файл или нет? Здравствуйте.
Как при помощи JavaScript определить, ссылка на картинку рабочая или нет?
A: Пишешь файл test_link.php, в котором curl'ом проверяешь, работает ли ссылка. Далее ,в js делаешь запрос на test_link.php через ajax. Получаешь результат, радуешься :) С помощью чистого js никак такого не сделаешь.
A: Например, на jQuery:
$(function(){ //On DOM ready
    $('#img').error(function(){
        alert('error');
    });
});

HTML:
<img src="fafav.jpg" id="img" />

Пример
A: Для ссылок в пределах одного домена:
function TestURL(url) {
    var request = new XMLHttpRequest();

    request.open('HEAD', url, false);
    request.send();

    return request.status != 404;
}


text:
Q: Plotting Co2 Emissions Over Time Using Python The prompt of the project is as follows:
Project Overview:
This project will test your ability to read and interpret data from a .csv file, plot and analyze the data. The provided file "co2_data.csv" contains monthly atmospheric CO2 concentrations from January 1960 until
October 2022 (ref: https://climate.nasa.gov/vital-signs/carbon-dioxide/). The file contains 3 comma
separated values per row (year, month, ppm CO2). You will need to utilize file system operators such as
open() and csv.reader() to read and interpret the given data. Be sure to import "matplotlib", "math", and
"numpy" as needed.

*

*(40 points) Develop python code to read and plot the values for CO2 concentrations for the entire
data set. Be sure to choose line types/weights/markers to allow for clear reading of the data. Plot
the data on a single graph and include axis titles and value markers.

*(40 points) Develop code to determine the average CO2 concentrations for each calendar year.
Plot this new data set on the same graph as generated in Part 1. Select a new line
type/weight/marker to distinguish this data from the full data set plot.

*(10 points) Format the graph outputs to easily view and interpret both graphical outputs. Include
a legend for the full data set and average output on your graph.
Heres what I tried
import matplotlib.pyplot as plt
import csv
import numpy as np

emissions = []
date = []
with open('co2_data.csv','r') as csvfile:
    data = csv.reader(csvfile, delimiter = ',')

    for row in data:
        date.append(float(row[0]))
        emissions.append(float(row[2]))

plt.plot(date, emissions, 'r-')
plt.show()

This is what I tried but I get 12 values at the same point, 1960, when I would like them to be separated by month.


text:
Q: Laravel Toast in JavaScript im using the https://xvelopers.com/demos/html/paper-panel/panel-element-toast.html
panel... and i trying to show toast after a function..
if i use
<div class="toast"
    data-title="Hi, there!"
    data-message="Hope you like paper panel."
    data-type="success">
</div>

it show a toast correctly at page load...
now, im trying to add this at:
$.ajax({
      url: "asd/store-asd",
      type: "POST",
      data: fd,
      processData: false,
      contentType: false
    }).done(function(resp){
      if(resp&& resp.ok){
        calendar.refetchEvents();
        alert("OK"); **change alert to toast**
        clean();
      }else {
        alert("FAIL");
      }
    });

how can add it?
PS.:  using @if(session('status')) @endif... work too, but i need implement it without reload a page

A: hey if you've no document how to implement their toaster a work around you can do it place the HTML with display none attribute i.e
<button class="btn btn-primary btn-lg toast-action" data-title="Hey, Bro!" data-message="Paper Panel has toast as well." data-type="info" data-position-class="toast-bottom-right" style='display:none;'>Info Toast</button>

Then you can trigger click on this button by targetting class ".toast-action" also you can update the attributes like message, title etc hope this will work,,, again this is only a work around since you don't have any documentation available and js is also compiled version.


text:
Q: Isomorphism in the study of 'local fields' I have a simple question, this is an isomorphism I don't understand
What does the following line mean? This can be interpreted as taking the class of f(z) in the ring $\mathbb{C}[z]/(z-a) \cong \mathbb{C}[z] = \mathbb{C}.$ I don't understand the isomorphism, how and why does this happen?

A: You have some things wrong. I assume your question is give a $a \in \Bbb{C}$, why is $\Bbb{C}[z]/(z-a) \cong  = \Bbb{C}$?
Well first of all we have the evaluation homomorphism that sends the indeterminate $z$ to $a \in \Bbb{C}$. Since $\Bbb{C}$ is a field, the division algorithm tells us that the kernel of this homomorphism is precisely $(z-a)$. Now the homomorphism is also surjective because for any $w \in \Bbb{C}$, I can write $w = w + a - a$ and so $w$ is the image of the polynomial $z+ (w - a)$.
By the First Isomorphism Theorem it follows that $\Bbb{C}[z]/(z-a) \cong \Bbb{C}$.


text:
Q: How to change label size according to device Text Size - Swift 3? I change my text size like following image.
But my app doesn't change the the font size.
Have any idea to me?
label.font = UIFont.systemFont(ofSize: 16.0)
label.adjustsFontForContentSizeCategory = YES
label.text = string

A: From iOS 10 onwards you can support dynamic font sizes using one line :)
Change your
label.font = UIFont.systemFont(ofSize: 16.0)

to use,
label.font = UIFont.preferredFont(forTextStyle: UIFontTextStyle.headline)

You can specify the font style you need for your label :)
Refer : https://developer.apple.com/documentation/uikit/uifont/1619030-preferredfont

A: There is a simpler solution. Just add below lines-
SWIFT 3:
label.minimumScaleFactor = 0.1    //or whatever suits your need
label.adjustsFontSizeToFitWidth = true
label.lineBreakMode = .byClipping
label.numberOfLines = 0


text:
Q: Have I understood Compact Set correctly In our current Measure Theory Class, we bought up the notion for a function $f:\mathbb R \to \mathbb R$ that is continuous to have a compact support, is equivalent to the fact that $\overline{\{x \in \mathbb R: f(x)\neq 0\}}$ needs to be compact.
Note $C_{c}(\mathbb R)=\{ f: \mathbb R \to \mathbb R:f$ is continuous and $supp f$ compact $\}$
I assume the most important aspect to take out of the notion of compact support (at least for my class in Measure Theory) is the fact that: $\forall p \in [1,\infty]:$

$C_{c}(\mathbb R)\subseteq L^{p}$

So if I need to prove a function is $p-$integrable then I can simply show that it has compact support $supp f$.
Is this the most applicable case to use the notion of a compact support in Measure Theory?
Other Question:
Considering the factor $\partial \{x \in \mathbb R: f(x)\neq 0\}$, does this mean that the set $\overline{\{x \in \mathbb R: f(x)\neq 0\}}$ can contain points $y \in \mathbb R$ such $f(y)=0$ but these sets of points need to be countable? Or can they be uncountably infinite?

A: In measure theory in isolation the concern is really more about finite measure support (where support has no closure operation in that setting, in part because there is no guarantee that a topology has been defined on the measure space). The point there is that a bounded measurable function with finite measure support is in all of the $L^p$ spaces. Compact support is important for other reasons but it starts to involve topics that are not strictly measure-theoretic in nature (e.g. distribution theory).
Your other question (how "big" can the boundary of the support of a continuous function be?) should probably be asked separately.


text:
Q: Create a slider to dynamically display distance two lines in an image
I am new jQuery. I want to create a slider which will move the green line along the x axis of the image as you can see in the image. From the image you can see there are two lines (line 1, line 2). I have the values (x,y) of the lines in a JSON objects.
As I move the slider, I want to show the distance between the two lines in the text box provided right next to the image by iterating through the JSON objects provided. I want the distance to change dynamically as I move around the slider over the image.
I came across different kinds of jQuery UI sliders. I couldn't find any examples related to my need. Therefore, asking for help here. Thank you in advance.

A:

.tooltip {
 width: 1px;
 height: 512;
    position: absolute;
    bottom:100%;
}

<title>
 This is an example of slider feature
</title>

 <input id="distance" type="text">

<link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/flick/jquery-ui.css">

I could not post the entire JSON here due to some limitations. But the feature is working for me currently. Hopefully, this helps someone.


text:
Q: Why does bash behave differently, when it is called as sh? I have an ubuntu machine with default shell set to bash and both ways to the binary in $PATH:
$ which bash
/bin/bash
$ which sh
/bin/sh
$ ll /bin/sh
lrwxrwxrwx 1 root root 4 Mar  6  2013 /bin/sh -> bash*

But when I try to call a script that uses the inline file descriptor (that only bash can handle, but not sh) both calls behave differently:
$ . ./inline-pipe
reached
$ bash ./inline-pipe
reached
$ sh ./inline-pipe
./inline-pipe: line 6: syntax error near unexpected token `<'
./inline-pipe: line 6: `done < <(echo "reached")'

The example-script I am referring to looks like that
#!/bin/sh
while read line; do
if [[ "$line" == "reached" ]]; then echo "reached"; fi
done < <(echo "reached")

the real one is a little bit longer:
#!/bin/sh
declare -A elements
while read line
do
    for ele in $(echo $line | grep -o "[a-z]*:[^ ]*")
    do
        id=$(echo $ele | cut -d ":" -f 1)
        elements["$id"]=$(echo $ele | cut -d ":" -f 2)
    done
done < <(adb devices -l)
echo ${elements[*]}

A: When bash is invoked as sh, it (mostly) restricts itself to features found in the POSIX standard. Process substitution is not one of those features, hence the error.

A: I believe sh on ubuntu is actually dash which is smaller than bash with fewer features.

A: Theoretically, it is a feature of bash: if you call as "sh", it by default switches off all of its features. And the root shell is by default "/bin/sh".
Its primary goal is the security. Secondary is the produce some level of compatibility between some shells of the system, because it enables the system scripts to run in alternate (faster? more secure?) environment.
This is the theory.
Practically goes this so, that there are always people in a development team, who want to reduce and eliminate everything with various arguments (security, simplicity, safety, stability - but these arguments are going somehow always to the direction of the removal, deletion, destroying).
This is because the bash in debian doesn't have network sockets, this is because debian wasn't able in 20 years to normally integrate the best compressors (bz2, xz) - and this is because the root shell is by default so primitive, as of the PDP11 of the eighties.


text:
Q: Resizing window causing problems I want to position a button somewhere on my webpage, but resizing the window is causing the button to move.
Here's the CSS:
    .btn-success{
        position: absolute;
        left: 37%;
        bottom: 20%;
    {

and HTML:
    <button class="btn btn-success btn-large">Buy now!</button>

What can I do to prevent this from happening?  If there's anything else I can post that will help, just let me know.  Thanks.

A: As prodigitalson suggested don't use percent. Based on my experience using a percentage will ruin you web design when changing different screen resolution. Use a fix width or height(use .px or .em) instead. In my website I'm using margin: 0 auto; to center it and I use a fixed height and width, so on any screen resolution my web design isn't affected.  Here is a guide that helps me to avoid screen resolution problem. How to Center a Website With CSS.

A: I guess this button is nested in some content container in HTML. Assuming this container has max-width or width set, you may add position: relative to this container' css.
You need to know that your button will position in relation to first parent that has position relative or absolute.


text:
Q: Remove negative results from SUM I am using the following code below to group and sum stock for my inventory. For some of my stock I can get negative results if there are more shipments than inventory, but I would like for these negative quantity items not to show in the "stock page" I have. Is there a way to remove the rows that are equal or less than 0 for quantity?
-------------------------------------------------------------------
ProductID   |  Color  | Timestamp          |  Quantity  |  RowID  |
-------------------------------------------------------------------
25          |  Red    | 10/10/10 06:22:15  |  -250      |  1      |
-------------------------------------------------------------------
32          |  Green  | 10/10/10 06:23:45  |  100       |  2      |
-------------------------------------------------------------------

$query = "SELECT productid, color, SUM(Quantity) AS TotalQuantity FROM inventory GROUP BY productid, color";
$result = mysql_query($query) or die(mysql_error());

   // Table markup here
   echo '
'. $row['productid'] . '	' . $row['color']. '	'. $row['TotalQuantity'];
   // Table markup here

A: $query = "Select * from
  (SELECT productid, color,
   SUM(Quantity) AS TotalQuantity FROM inventory
   GROUP BY productid, color) AS alias
where TotalQuantity  > 0";


text:
Q: How to use Google Cloud Messaging(GCM) for dependibility between 2 devices? I have an android application which is GCM based. I have an concept in mind but don't know how to go about it. What I want to do is that, suppose, My application server has 2 devices(1 and 2) as its clients. If I send a message to device 1 through GCM and it responds with an answer, I want the application server to send a message to device B based on the response from device A. For eg. If the response from device 1 is X, it should send abc as the message to device 2 and If the response from device 1 is Y, it should send efg as the message to device 2. Any idea how to go about this problem?

A: When you receive a GCM message in device 1, make a request to your API with your desired response and make your server store that response somewhere(database), if needed. Then use that stored response, when you need to send GCM message to device 2.

*

*Device 1 waits for GCM message

*Device 1 sends a request to your api with response string

*Server stores your response string

*Server sends GCM message to device 2 with that stored response string.


text:
Q: Excel filter calendar values from data Attached screenshot has data which is A11:C17 and week calendar B4:H6. I want to match calendar dates from data and showing all activities for that date to calendar cells. For sample, I have put manually E6,F6 and G6 but I want to know how to achieve using excel scripts ie. match the calendar date to data table and concatenate all activities to calendar cell next to date.
Thanks

A: Use TEXTJOIN() as an array formula:
=TEXTJOIN(CHAR(10),TRUE,IF($C$11:$C$16 = C$4,$B$11:$B$16,""))

Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
TEXTJOIN was introduced with a subscription to Office 365 Excel.


text:
Q: What is the best practice for handling collection relationships through a REST API? This is my first question here so here it goes :)
I am developing messaging application with Android with a Node.js Express backend supported by a MongoDB database. I currently have 2 collection models: User and Message where the message schema looks like this:
var messageSchema = mongoose.Schema({
  source: {type: Schema.Types.ObjectId, ref: 'User', required: true},
  destination: {type: Schema.Types.ObjectId, ref: 'User', required: true},
  text: {type: String, required: true}
});

My question is whether I should return a message object through the API as:
{source: <objectId>, destination: <ObjectId>, text: 'Hello World'}
or as:
{source: {username:'David', password:'abcd'}, destination: {username:'Jeff', password: 'aaaa'}, text: 'Hello World'}
In other words: Should the referenced fields be populated/resolved on the server side, or should that be up to the client?
Thanks and cheers!

A: My two cents:
ObjectId is an artefact of the database, not of the application.  Revealing these to the user is sometimes (not always) a smell.  Whether it is or not it down to you and your knowledge of the domain.
As far as what's best, it depends on your use cases.  Is there ever a use case where the user will only want to know the IDs?  I imagine that they'll be at least wanting one or the other.  If that's the case then I'd implement two resources, one for getting the source and one for getting the destination.
If the user will always want both, or will want both a large percentage of the time, return both or, again, add another resource that provides this.
If you do return both, what will you be filtering the set on?  An identifier of some kind, pagination or will you just be returning everything in the database?


text:
Q: How can I get coloredlogs in PyCharm Python Console to format properly? My logging setup is:
import coloredlogs
import logging
import sys

# Create a logger object.
# logger = logging.getLogger(__name__)

# By default the install() function installs a handler on the root logger,
# this means that log messages from your code and log messages from the
# libraries that you use will all show up on the terminal.
coloredlogs.install(level='DEBUG')

logging.basicConfig(
    format='%(asctime)s %(levelname)-8s %(message)s',
    level=logging.INFO,
    stream=sys.stdout,
    datefmt='%Y-%m-%d %H:%M:%S')

If I configure the console to use python for output, all lines start at column 0, but all output is red. But if I specify use terminal, the colors are there, but the lines don't start at column 1. They all start with the end column of the line before.
How can I get all log messages starting at column 0 AND in color?

A: Try adding isatty to your call to install.  This overrides the whatever auto-detection is doing to attempt at determining what type of terminal is being used.
import coloredlogs
import logging
import sys

logger = logging.getLogger(__name__)
coloredlogs.install(level=logging.DEBUG, logger=logger, isatty=True,
                    fmt="%(asctime)s %(levelname)-8s %(message)s",
                    stream=sys.stdout,
                    datefmt='%Y-%m-%d %H:%M:%S')

logger.debug("this is a debugging message")
logger.info("this is an informational message")
logger.warning("this is a warning message")
logger.error("this is an error message")
logger.critical("this is a critical message")

explanation:
If I understood the problem correctly, you are seeing the logging handler default to using sys.stderr instead of sys.stdout.  (this is why the text would appear in red)
There are likely two issues going on.

*

*coloredlogs.install needs to be told what type of rules you want in the handler, not logging.basicConfig.

*The automatic terminal detection would fail unless you either force the formatter to think it's a terminal or you set pycharm to 'simulate' a terminal. Fixed by passing in stream=sys.stdout


text:
Q: Reset iOS Simulator with Applescript Im trying to reset the iOS-Simulator using AppleScript. When I just run a script to Reset Content and Settings it just resets the current version of the iOS-Simulator (e.g. 6.0). I need to reset each iOS version in the iOS Simulator to remove all the apps. I can only use Applescript and cant delete the apps from the Simulator using bash (deleting the app folders)
Thanks

A: I present,
The Definitive iOS Simulator Reset Script (link)

Based on Oded Regev's code from this SO question (which was based on Jacob Rus's fine "menu_click" code)

A: Stian's script has not been updated for iOS 7 and the dialog isn't necessarily useful for build scripts. I've borrowed heavily from his code and written a version that is relatively future-proof to new devices and iOS versions.
https://github.com/michaelpatzer/ResetAllSimulators


text:
Q: Configuring WebSphere SIB Components in Jetty for Application Use I want to use remote messaging from my Spring JMS application running on Jetty to place messages onto queues that are configured in a Service Integration Bus on WebSphere 8.5.  I have a working example of my jetty-env.xml using ActiveMQ.
<New id="cf" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jms/connectionFactory</Arg>
    <Arg>
        <New class="org.apache.activemq.ActiveMQConnectionFactory">
            <Arg>tcp://localhost:61616</Arg>
        </New>
     </Arg>
</New>

I have the port for the SIB_ENDPOINT in WebSphere, and I think remoting will use the IIOP protocol:
<New id="cf" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jms/connectionFactory</Arg>
    <Arg>
        <New class="com.ibm.ws.sib.api.jms.impl.JmsConnectionFactoryImpl">
            <Arg>iiop://localhost:7280</Arg>
        </New>
    </Arg>
</New>

Trying this, however, yields an IllegalStateException as apparently this class does not contain a constructor.  What am I doing wrong?  How can I configure the appropriate broker in my Spring app on Jetty to access a SIB on a local WAS85 instance?


text:
Q: Service bus gateway high memory on SharePoint Server I have service bus high memory on my sharepoint server?
i have 10gb mem. Is this normal?

A: depends because so many services use it so anything could be taking up resources. is it constant or peaks?
Check the performance monitor on the server:

To access the Service Bus performance counters, open the Performance
  Monitor. In the Perfomance pane, expand Monitoring Tools, and then
  click Performance Monitor. In the main pane click the green plus (+)
  icon. In the Add Counters window, scroll to the Service Bus
  performance counter groups.
To open the Performance Monitor on Windows Server, click Start, then
  Administrative Tools, then Performance Monitor. To open the
  Performance Monitor application on Windows Server 2012, type
  Performance Monitor in the Start screen, then click the Performance
  Monitor icon.

I would advise you look at the following url to check against set values.
https://msdn.microsoft.com/en-us/library/jj192996.aspx
also here for the architecture:
https://msdn.microsoft.com/en-us/library/jj193012.aspx
as you can see its dependent on how your system was setup would determine resource allocation.
if your asking for my input ;) , 2.2gb for Service bus gateway is quite high if its constant. If its during high usage like workflows,  access (permissions), SQL traffic then its ok for a short period due to bottleneck.


text:
Q: Android finger detection - Orientation and ellipse I've been looking for a way to detect the finger orientation together with a simplification of the touch area in the form of an ellipse, when using a mobile touch device. I choose Android rather than iOS since I found three usefull methods (getTouchMajor(), getTouchMinor(), and getOrientation()) in the Android reference for the MotionEvent class.
But I've tried to implement these three methods in my app, and sadly they does not return the wanted values. The orientation stays at 0, no matter what, while the getTouchMajor and getTouchMinor is exactly the same each time.
So my question is: Am I doing somethign wrong or is these methods just not implemented yet?
(I've tried the functions on several different devices including: Nexus 5, Nexus 7, and HTC One)

A: As we work together I know you know this answer, but I just wanted to put it up such that fellow users of Stackoverflow can have it as well.
We have found suggestive comments that maybe the touch screen drivers for most devices do not provide this data to the system.
We originally tested: Samsung Galaxy S2, HTC One, Nexus 5 (by LG) and Nexus 7 (by Asus), Samsung Galaxy Tap 3.
As opposed to the others the Samsung Galaxy Tap 3, gave different values for getTouchMajor() and getTouchMinor(), but this relationship was seen getTouchMajor() = getTouchMinor() * 3, and getOrientation() was always 0, as with all the other devices.
About 2 months later we discovered that the Google Nexus 10 can show an ellipse with a direction line, when you activate Input: Pointer Location under developer settings.
The initial conclusion was that most devices do not support, getTouchMajor(), getTouchMinor(). or getOrientation(), Which could be a limitation of the capacitative touch screens.
But seeing the Nexus 10, and the tracking of the ellipse and orientation gives hope for new interaction design.
It indicates to me that some devices do deliver on getTouchMinor and getTouchMajor as well as orientation. (or historical versions of the same functions).
I have not had the chance to code anything for the device myself but it seems plausible.


text:
Q: Installing Ubuntu when multiple Windows 7 partitions exist, and permissions My laptop has two partitions C: and D: , with Windows 7 installed on the C: partition, D: containing very important files and documents.
As I want to start using ubuntu, I'm confused whether to copy these files in a USB or an external hard drive, or just let them there in D: and start my installation.
For the record, I have already an extracted copy of ubuntu installation on D: partition. and My questions are :
1- Can I install ubuntu from that partition D:?
2- Is it okey to let the important files in D: partition, and install ubuntu on C: partition
3- Most important, what about permissions?? can I have some permissions problems when opening files on ubuntu?? (it happened to me many times when installing windows over windows)

A: 0 Backup is ALWAYS good
1 You must install Ubuntu from a bootable device. Make a LiveCD, LiveDVD or LiveUSB using the .ISO of Ubuntu you downloaded.  http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows explains how to download the Windows utility to make a LiveUSB, and how to use it, step by step, to make a LiveUSB.
2 Yes, leave your data on D: which you can then mount in Ubuntu. However, unless you wish to completely eliminate Windows, I would instead let Ubuntu's install routine rearrange the drives so it could make space for Ubuntu in its own partitions, so you can continue using Windows while learning Ubuntu.
Normally, there are two major partitions for Linux, / (aka 'root') where everything goes except for the second 'swap' partition, which should be at least the size of the RAM in the machine, perhaps larger.
3 When you boot with Ubuntu, you can open and save files in your NTFS partition D: with no problem.  Edit /etc/fstab to add lines like:

/dev/sda2 /media/windata ntfs-3g  rw,nodev,noexec,auto,nouser,async,locale=en_US.utf8,uid=1000,gid=1000,umask=0002 0 0
/media/windata    /home/me/windata    ntfs-3g rbind,user,rw,nodev,noexec,auto,async,uid=1000,gid=1000,umask=0002 0 0

A: 1 - I do not know any way to install ubuntu from disk, specially from fat32/ntfs.
2 - If you have nothing important on C: drive, then it's not a problem.
3 - You can access any files on the ntfs/fat32 after you've installed Ubuntu. If I'm right there will be 777 permission on all files on the NTFS patition.
But if you take my advice, "always have a proper galvanically separated backup of all important data", e.g. on another USB stick or DVD, or another HDD if possible.

A: I strongly recommend backing up your data. I did the same thing that you're gonna do but in a little different way. I had 2 partitions on my PC as Windows in C: and important things in D: as usual. Anyway, I created another partition with one of those applications which let you create additional partitions. And after it I had 3 partitions.
I decided to install Ubuntu on the 3rd partition. So my D: part was gonna be my backup part. But after installing Ubuntu, I just realized that my existing D: part just turned into RAW file system.
The difference between your system and mine is I had to keep Windows on C:. I hope you will not face any issues. Best luck.


text:
Q: Can you prevent std::regex from throwing exception on invalid expressions? std::regex regex("*", std::regex_constants::icase);

This will throw an exception. If I have exceptions disabled, it will terminate the application, and that means I cannot catch it and do nothing with it like I normally would do.
Is there anyway to prevent invalid regex from throwing exceptions when it is constructed? Or some kind of std::regex::isvalid("*") check that exists?
I was thinking maybe I could come up with a separate regex that parses the input regex expression string before I attempt the constructor, but I would much prefer an alternative.

A: You can't. There's no standard way to do it. Exceptions are an intrinsic part of the standard library, and even interfaces that don't throw their own exceptions (such as the infamous error_code-based interface for <filesystem>) can throw exceptions for other operations.
Your best bet is using a library that is designed to be exception-free, such as Boost.Regex with the no_except flag enabled. You can then check for errors after construction of a boost::basic_regex, using the member function status.


text:
Q: Obj-C: Clone object with a mutated property I would like to a create convenience initiator by cloning an existing object with a mutation, while keeping the original object intact.
For example:

*

*Given a Person object person1 with a name (Tom) and age (10)

*I would like to clone the person1 object, but with 0 age.
I have following code in Obj-C, but not sure if there's a better way to do it:
Person.h
@interface Person : NSObject
@property (nonatomic, readonly) NSString *name;
@property (nonatomic, readonly) NSUInteger age;

- (instancetype)initWithName:(NSString *)name age:(NSUInteger)age;

- (instancetype)cloneWithZeroAge;
@end

Person.m
@implementation Person

- (instancetype)initWithName:(NSString *)name age:(NSUInteger)age
{
    if (self = [super init]) {
        _name = name;
        _age = age;
    }
    return self;
}

- (instancetype)cloneWithZeroAge
{
    if (self) {
        // mutate age to 0
        return [self initWithName:_name age:0];
    }
    return self;
}

@end

A: Let's start with the constructor. For you specific scenario it doesn't make much difference, but in order to be functionally independent, you better ensure that the name gets a copy of the data passed. You also want to specify this part as memory storage modifier of the property, so the contract is apparent to the client code:
@interface Person : NSObject
@property (copy, nonatomic, readonly) NSString *name;
...
@end

@implementation Person

- (instancetype)initWithName:(NSString *)name age:(NSUInteger)age
{
    if (self = [super init]) {
        _name = [name copy];
        _age = age;
    }
    return self;
}

Now for the actual "copy" method. In order to be more consistent with existing NSCopying protocol and Objective-C naming convention, and, which is more important, the memory management ownership convention, you should start the method name with the word "copy", so the calling side knows it's responsible for releasing the object. The most important part now, is that if you want to keep the original object untouched, you have to allocate and create a new object. In your implementation, however, you just change the self into the new object entirely. Here is how I would implement such a method:
- (instancetype)copyWithZeroAge {
    Person *copy = [[Person alloc] initWithName:_name age:0];
    return copy;
}

If you prefer to keep the name property memory modifier strong instead of copy, don't forget to copy the instance:
- (instancetype)copyWithZeroAge {
    Person *copy = [[Person alloc] initWithName:[_name copy]
                                            age:0];
    return copy;
}


text:
Q: How can I transform my array to 0 or 1 elements? [[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
 [0 1 1 1 0 0 0 0 0 1 1 0 0 3 3 0 0 0 4 4 0 0 0 5 5 5 5 0 0 2 2 2 2 2 0 2 2 2 2 2 0 0 0 6 6 6 6 6 6 0 6 6 6 6]
 [0 1 1 0 0 0 0 0 0 0 0 0 0 3 3 0 0 0 4 4 0 0 5 5 5 5 5 5 0 2 2 2 2 2 2 2 2 2 2 2 2 0 0 6 6 6 6 6 6 6 6 6 6 6]
 [1 1 1 0 0 0 0 0 0 0 0 0 0 3 3 0 0 0 4 4 0 5 5 5 0 0 5 5 5 0 2 2 0 0 2 2 0 0 0 2 2 0 0 6 6 0 0 6 6 6 0 0 6 6]
 [1 1 1 0 0 0 0 0 0 0 0 0 0 3 3 0 0 0 4 4 0 5 5 5 5 0 0 0 0 0 2 2 0 2 2 2 0 0 0 2 2 2 0 6 6 0 0 0 6 6 0 0 6 6]
 [1 1 1 0 0 0 0 0 0 0 0 0 0 3 3 0 0 0 4 4 0 0 5 5 5 5 5 5 0 0 2 2 0 2 2 2 0 0 0 2 2 2 0 6 6 0 0 0 6 6 0 0 6 6]
 [0 1 1 0 0 0 0 0 0 7 0 0 0 3 3 0 0 0 4 4 0 0 0 0 5 5 5 5 5 0 2 2 0 2 2 2 0 0 0 2 2 2 0 6 6 0 0 0 6 6 0 0 6 6]]

what i want is to change the value of every none 0 number to 1.
what i can do:
for element in list:
    for sub_element in element:
        if sub_element != 0:
           sub_element = 1

How can i do that in numpy?

A: If your numpy array is named a, you can use something like this:
a[a!=0.0] = 1

proof:
>>> a = numpy.array([0.0, 1.0, 2.0, 3.0, 0.0, 10.0])
>>> a
array([  0.,   1.,   2.,   3.,   0.,  10.])
>>> a[a!=0.0] = 1
>>> a
array([ 0.,  1.,  1.,  1.,  0.,  1.])

This works because a != 0.0 will return array with True/False values
where the condition is met and then the assignment is performed only on those
elements where there is True:
>>> a != 0
array([False,  True,  True,  True, False,  True], dtype=bool)

Also, this works with any other condition.

A: Given a NumPy array A:
res = A.astype(bool).astype(int)

For efficiency, and most use cases, you can keep your array as Boolean, omitting the integer conversion.
This works because 0 is the only integer considered False; all others are True. Converting a Boolean array to int is then a trivial mapping of False to 0 and True to 1.


text:
Q: Create new product variation and add selected variation to cart Create new product with two variations and add selected to the cart
Desired outcome:
Form selects between variations and adds the corresponding variation to cart.
Current outcome:
The second variation is added to the cart regardless of which is selected
Notes: Adding the variation_id should be pretty straight forward but since the variation id has yet to be created I need a way to associate the variation terms in the form with the newly assigned variation_id
<form name="new-prod" method="post" action="">
<input type="radio" name="attribute_pa_size" value="11oz" id="pa_size_v_11oz">
<input type="radio" name="attribute_pa_size" value="15oz" checked="checked" id="pa_size">

PHP:
$post_size = $_POST['attribute_pa_size'];

Multiple variations created:
First Variation
$parent_id = $product_ID;
$variation = array(
'post_title'   => 'Product #' . $parent_id . ' Variation',
'post_content' => '',
'post_status'  => 'publish',
'post_parent'  => $parent_id,
'post_type'    => 'product_variation'
);
$variation_id = wp_insert_post( $variation );
update_post_meta( $variation_id, '_regular_price', 21.95 );
update_post_meta( $variation_id, '_price', 21.95 );
update_post_meta( $variation_id, 'attribute_' . $mythis->size_tax, '15oz' );
WC_Product_Variable::sync( $parent_id );

Second Variation
$parent_id = $product_ID;
$variation = array(
'post_title'   => 'Product #' . $parent_id . ' Variation',
'post_content' => '',
'post_status'  => 'publish',
'post_parent'  => $parent_id,
'post_type'    => 'product_variation'
);
$variation_id = wp_insert_post( $variation );
update_post_meta( $variation_id, '_regular_price', 18.95 );
update_post_meta( $variation_id, '_price', 18.95 );
update_post_meta( $variation_id, 'attribute_' . $mythis->size_tax, '11oz' );
WC_Product_Variable::sync( $parent_id );

Add variation to cart
$quantity     = 1;
$variation    = $post_size;
$woocommerce->cart->add_to_cart( $product_ID, $quantity, $variation_id, $variation  );

A: Replaced all references of $variation_id with $elevenvariation_id for the first variation.
Then replaced the "add variation to cart" block with the following, and it managed to work from my initial testing:
  $quantity     = 1;
  $variation    = $post_size;

$answer = $_POST['attribute_pa_size'];
if ($answer == "15oz") {
$woocommerce->cart->add_to_cart( $product_ID, $quantity, $variation_id, $variation  );
}
    else {
        $woocommerce->cart->add_to_cart( $product_ID, $quantity, $elevenvariation_id, $variation  );
        }


text:
Q: Cocos2d View not sizing properly in UISplitViewController I've got a cocos2d 2 view as the Detail View in a UISplitViewController.  For some reason, it's sizing the view as if it had the entire screen, both initially and when I rotate the screen. Here's some made up background:

Here's what it looks like when I run it in the simulator:

Here are all the relevant files:
Game1ViewController.h
#import <UIKit/UIKit.h>
#import "cocos2d/cocos2d.h"

@class Game1Scene;

@interface Game1ViewController : UIViewController {
    //  Game1Scene *_scene;
}

@property (nonatomic, retain) Game1Scene *scene;

@end

Game1ViewController.m

#import "cocos2d/cocos2d.h"
#import "Game1Scene.h"
#import "Game1ViewController.h"
#import "CCSpriteExtensions.h"

@implementation Game1ViewController
@synthesize scene = _scene;

- (CGRect)getRotatedBounds:(UIInterfaceOrientation)toInterfaceOrientation  {
    CGRect screenRect = [self.view bounds];
//    NSLog(@"%f, %f\n", [UIScreen mainScreen].bounds.size.width, self.view.frame.size.height - 88);

    CGRect rect = CGRectZero;

    if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        rect = screenRect;
    } else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        rect.size = CGSizeMake( screenRect.size.height, screenRect.size.width );
    }
    return rect;
}

- (void)startCocos2D {

    CCDirector *director = [CCDirector sharedDirector];
    CGSize screenSize = [[CCDirector sharedDirector] winSize];
    NSLog(@"\n===========Size=%f, %f\n\n",screenSize.height, screenSize.width);

    // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
    if( ! [director enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");

    NSLog(@"self.view bounds width, height: %f %f", [self.view bounds].size.width, [self.view bounds].size.height);

    CGRect rotatedBounds = [self getRotatedBounds:[UIApplication sharedApplication].statusBarOrientation];

    CCGLView *glview  = [ CCGLView  viewWithFrame:rotatedBounds
                                    pixelFormat:kEAGLColorFormatRGB565  // kEAGLColorFormatRGBA8
                                    depthFormat:0                       // GL_DEPTH_COMPONENT16_OES
                        ];

    [self.view addSubview:glview];

    [director setView:glview];

    [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

    self.scene = [Game1Scene nodeWithBounds:rotatedBounds];
    CCScene *scene = [CCScene node];
    [scene addChild: self.scene];
    [director runWithScene: scene];

}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    self.title = @"Play Game1";
//    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
//    self.view.autoresizingMask = 1;
    [super viewDidLoad];

    [self startCocos2D];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    CGRect rotatedBounds = [self getRotatedBounds: toInterfaceOrientation];

    CCDirector *director = [CCDirector sharedDirector];
    CCGLView *glView = [director view];
    float contentScaleFactor = [director contentScaleFactor];

    if ( contentScaleFactor != 1 ) {
        rotatedBounds.size.width *= contentScaleFactor;
        rotatedBounds.size.height *= contentScaleFactor;
    }
    glView.frame = rotatedBounds;

    [self.scene setBounds:rotatedBounds];
}

- (void)stopCocos2D {

    CCDirector *director = [CCDirector sharedDirector];

    CCGLView *view = [director view];
    [view removeFromSuperview];
    //[director detach];

    [director stopAnimation];
    [director pause];
    //[director setOpenGLView:nil];

    // kill the director
    [director end];
}

- (void)viewDidDisappear:(BOOL)animated {
    [self stopCocos2D];
    [super viewDidDisappear:animated];
}
@end

Game1Scene.h
#import <Foundation/Foundation.h>
#import "cocos2d/cocos2d.h"

@interface Game1Scene : CCLayer {
    CGRect bounds_;
}

+ (id) nodeWithBounds:(CGRect)bounds;
- (void)setBounds:(CGRect)bounds;
@end

Game1Scene.m
#import "Game1Scene.h"
#import "CCSpriteExtensions.h"
#import "cocos2d/CCMenuItem.h"

@interface Game1Scene (Private)

- (void)startGame;
- (void)createUI;
- (id)initWithBounds:(CGRect)bounds;

@end

@implementation Game1Scene

+(id) nodeWithBounds:(CGRect)bounds {
    return  [[self alloc] initWithBounds:bounds];
}

- (void) setBounds:(CGRect)bounds {
    NSLog(@"bounds.width, bounds.height: %f , %f", bounds.size.width, bounds.size.height);
    bounds_ = bounds;
    [self createUI];
}

- (id) initWithBounds:(CGRect)bounds {
    if( (self=[super init] )) {
        srand ( time(NULL) );

        bounds_ = bounds;

        [self startGame];
    }
    return self;
}

- (void) createUI {

    [self removeAllChildrenWithCleanup:TRUE];

    // Plain dark purple background
    CCSprite *background = [CCSprite spriteWithFile:@"game1-background.png"];
    background.position = ccp(0, 0);
    background.anchorPoint = ccp(0, 0);
    NSLog(@"\n=== bounds= %f, %f\n", bounds_.size.width, bounds_.size.height);
    [background resizeTo:CGSizeMake(bounds_.size.width, bounds_.size.height)];
    [self addChild:background];

}

- (void)startGame {
    [self createUI];
}

@end

CCSpriteExtensions.h
/*
 CCSpriteExtensions.h

 http://www.learn-cocos2d.com/tag/ccspriteextensions/
 */
#import "cocos2d/cocos2d.h"

@interface CCSprite (Xtensions)

// Resize to the specified size by setting the scale factors correctly.
- (void)resizeTo:(CGSize) theSize;

@end

CCSpriteExtension.m
/*
 CCSpriteExtensions.m

 Source: http://www.learn-cocos2d.com/tag/ccspriteextensions/
 */
#import "CCSpriteExtensions.h"

@implementation CCSprite (Xtensions)

- (void)resizeTo:(CGSize) theSize
{
    CGFloat newWidth = theSize.width;
    CGFloat newHeight = theSize.height;

    float startWidth = self.contentSize.width;
    float startHeight = self.contentSize.height;

    float newScaleX = newWidth/startWidth;
    float newScaleY = newHeight/startHeight;

    self.scaleX = newScaleX;
    self.scaleY = newScaleY;

}
@end

I took the idea as explained in this question: UISplitViewController on iPad with Storyboards by creating a couple of Cocos2D Scenes in the DetailViews.
Update
I updated to 2.0.  My problem sounds like something similar to this: http://www.cocos2d-iphone.org/forum/topic/30797

A: I'm using cocos2d v2, and I'm not sure about 1.1, but in v2, CCScene and CCLayer are initing with screen's size:
@implementation CCScene
-(id) init
{
    if( (self=[super init]) ) {
        CGSize s = [[CCDirector sharedDirector] winSize];
        self.ignoreAnchorPointForPosition = YES;
        anchorPoint_ = ccp(0.5f, 0.5f);
        [self setContentSize:s];
    }

    return self;
}
@end

...
 @implementation CCLayer

    #pragma mark Layer - Init

        -(id) init
        {
            if( (self=[super init]) ) {

                CGSize s = [[CCDirector sharedDirector] winSize];
                anchorPoint_ = ccp(0.5f, 0.5f);
                [self setContentSize:s];
                self.ignoreAnchorPointForPosition = YES;

                isTouchEnabled_ = NO;

        }

            return self;
        }

If you whant to change it, just set contentSize property to it.

A: Have you tried using some standard UIViews just for comparison?
Implement the same getRotatedBounds but without all the Cocos2D stuff. This way you could make sure whether the error lies with the SplitViewController/Storyboards or within your Cocos2D handling?
Here's a tutorial on  Splitviewcontrollers with Storyboards.


text:
Q: How to fix image wrap size with the same size of Lazy Load image? I'm looking for to show background-color image before lazy-loading with exactly the same dimension of the image. My script gest width and height of each images and applises on image-wrap.
Here is my code:

$(document).ready(function() {
  $('section .lazywrap').each(function() {

    var lazyWrap = $(this);
    var img = $(lazyWrap, this);

    lazyWrap.width(img.width());
    lazyWrap.height(img.height());

    console.log(lazyWrap.height());
  });
});

Web browser can get height value even if it's not implemented in , BUT only for images who are visible in the viewport when the page is loading, because of lazy Load.
I read lot of things about responsive background image with the padding-bottom trick, but in my case I really need the real width and height value on this "background preview" and not a ratio. All my image have different height value.

A: Finally, I found an alternative solution with de lazy load plugin call lazysizes. It allows to use an background color with exactly the size instead of the image is being loading.


text:
Q: java cast LinkedHashMap to class extending LinkedHashMap I have a class (EntireFile) that extends the LinkedHashMap. I try to cast:
EntireFile old = (EntireFile) functionReturningLinkedHashMap();

It throws exception with message: "java.util.LinkedHashMap cannot be cast to com.gmail.maximsmol.YAML.GroupMap".
public class EntireFile extends LinkedHashMap<String, GroupMap>

public class GroupMap extends LinkedHashMap<String, CategoryMap>

public class CategoryMap extends LinkedHashMap<String, LinkedHashMap<String, Integer>>

Please help me to solve the error!

A: The problem is that the reference returned simply isn't a reference to an instance of EntireFile. If functionReturningLinkedHashMap just returns a LinkedHashMap, it can't be cast to an EntireFile, because it isn't one - how would it get any extra information about it?
(Judging by your exception, you're actually talking about GroupMap rather than EntireFile, but the same thing applies.)
There's nothing special about LinkedHashMap here - the same is always true in Java:
Object foo = new Object();
String bar = (String) foo; // Bang! Exception

A: Instead of casting you can copy the data to the type of map you need.
EntireFile old = new EntireFile(functionReturningLinkedHashMap());

or
EntireFile old = new EntireFile();
old.putAll(functionReturningLinkedHashMap());


text:
Q: incorrect start asyncio script with systemd I have python script with ioloop based on asyncio which work with web and have some crawlers inside which should start by scheduler. I make new task in systemd which start it, but - when script is started on system start only first coroutine is started, when I restart task manually - all coroutines are started.
Please see my config below. I tried to set type = forking, but on this case task is restarted by ubuntu. How should I make config for correct work?
[Unit]

Description=Stocks

After=network.target

[Install]

WantedBy=multi-user.target

[Service]

ExecStart=/home/user/Projects/stocks/venv/bin/python /home/user/Projects/project/manage.py runserver

Type=simple

Restart=on_failure


text:
Q: Qualitative study of $ \dot x = - y^2$, $\dot y= x^2 $ Make the qualitative study of the ODE on the plane
$$ \begin{cases}\dot x = - y^2\\ \dot y= x^2 \end{cases} $$
and determine how many solutions satisfy $y(0) = x(1) = 0$.

My attempt.
Let $f(x,y):=\begin{pmatrix}-y^2\\x^2 \end{pmatrix}$ be the vectorial field. It is well defined on all plane and $C^1$, then every Cauchy Problem has a unique local solution and every one of these solution can be extended in unique way to a maximal solution (not necessary globally defined). Now I note that the function $$E(x,y):=\frac{x^3}{3}+\frac{y^3}{3}$$ is a constant of motion, i.e. $\dot E(x(t),y(t))=c$, where $(x(t),y(t))$ is a solution. The orbits are the level sets of $E$, that are open curves like this: https://m.wolframalpha.com/input/?i=plot+x%5E3+%2B+y%5E3+%3D+10, or https://m.wolframalpha.com/input/?i=plot+x%5E3+%2B+y%5E3+%3D+-10.

*

*It is all correct?

*Do you think that it is enough ? The task "Make the qualitative study" is very generic. What would you add?

*I don't know how to determine how many solutions satisfy $y(0) = x(1) = 0$.

A: If $y(0)=x(1)=0$ then $x(0)=y(1)=a$ for some nonnegative $a$ and it remains to enmerate the values of $a$ such that it takes a time $1$ to follow the curve $x^3+y^3=a^3$ from $(x,y)=(a,0)$ to $(x,y)=(0,a)$.
To do so, note that, along this curve, $$dt=\frac{dy}{x^2}=\frac{dy}{(a^3-y^3)^{2/3}}$$ hence one needs to solve for $a$ the identity $$1=\int_0^a\frac{dy}{(a^3-y^3)^{2/3}}=\frac1a\int_0^1\frac{dy}{(1-y^3)^{2/3}}$$ Finally, for every $a$, consider the curve
$$C(a)\ :\ x^3+y^3=a^3$$
Then, each solution stays on a given curve $C(a)$. There is exactly one solution such that $y(0)=x(1)=0$, and it stays on $C(a^*)$, where $$a^*=\int_0^1\frac{dy}{(1-y^3)^{2/3}}\approx1.76639\ldots$$
The curves $C(a)$ for $a>0$ are in the halfplane $x+y>0$, the curve $C(0)$ is the line $x+y=0$ and the curves $C(a)$ for $a<0$ are in the halfplane $x+y<0$. Each solution stays on a given curve $C(a)$ and moves on it from the SE quadrant to the NW quadrant, passing by the NE quadrant if $a>0$ and by the SW quadrant if $a<0$, see below for a sketch of the solutions of the dynamical system.


text:
Q: Updating ProgressBar using Service through out all the Activities I have an application in which as per the requirements, images are being downloaded from the background thread processing. As per the needs, I want to show the horizontal progress bar on all the activities, while photos are being downloaded. Also this is the class which is responsible for whole Json parsing of my application.
For that I implemented a class which extends Service and called its onCreate method. But I am still not clear about how do I update the progress bar in the current and also if the user switches on other screen, the progress bar should update accordingly.
Previously I tried using the IntentService class, but it requires
MyService (String name){
  super(name);
}

But unfortunately its not fitting in my situation and I stuck getting the logcat exception like 'cant instantiate the default constructor of IntentService'
I am really stuck at this situation. Please suggest me some way/ code snippet if this situation has been faced by anyone out there.
Here is my current sample code : http://pastebin.com/HCWFPtbb

A: public final class DownloadThread extends Thread
    {

        private static final String       TAG           = DownloadThread.class.getSimpleName();

        private Handler                   handler;

        private int                       totalQueued;

        private int                       totalCompleted;

        private final DownloadThreadListener listener;

        private boolean                   isRunning   = false;

        protected boolean                   isStop;

        private TaskInitiator               mtaskInitiator = null;

        /**
         * @return the isRunning
         */
        public boolean isRunning()
            {
                return isRunning;
            }

        public DownloadThread(DownloadThreadListener listener)
            {
                this.listener = listener;
                isStop = false;
            }

        @Override
        public void run()
            {
                try
                    {

                        Looper.prepare();

                        mtaskInitiator = new TaskInitiator();
                        handler = new Handler();
                        isRunning = true;

                        Looper.loop();

                    }
                catch (Throwable t)
                    {
                        Log.e(TAG, "DownloadThread halted due to an error", t);
                    }
            }

        public synchronized void requestStop()
            {

                isStop = true;

            }

        public synchronized void enqueueDownload(DownloadTask task)
            {

                mtaskInitiator = new TaskInitiator();
                mtaskInitiator.setTask(task);
                handler.post(mtaskInitiator);
                totalQueued++;

            }

        public synchronized void removeTasks()
            {

                if (mtaskInitiator != null)
                    {

                        handler.removeCallbacks(mtaskInitiator);
                        totalQueued = 0;
                        totalCompleted = 0;
                    }
            }

        class TaskInitiator implements Runnable
            {

                private DownloadTask task = null;

                public DownloadTask getTask()
                    {
                        return task;
                    }

                public void setTask(DownloadTask task)
                    {
                        this.task = task;
                    }

                public TaskInitiator()
                    {
                        // TODO Auto-generated constructor stub
                    }

                @Override
                public void run()
                    {
                        try
                            {
                                task.run();

                            }
                        finally
                            {

                                if (isStop)
                                    {
                                        Looper.myLooper().quit();
                                    }
                                synchronized (DownloadThread.this)
                                    {
                                        signalUpdate(task.getCurrentBitmap(), task.getCurrentFeedUrl());
                                        task.setCurrentBitmap(null);
                                        totalCompleted++;

                                    }

                            }

                    }

            }

        public synchronized int getTotalQueued()
            {
                return totalQueued;
            }

        public synchronized int getTotalCompleted()
            {
                return totalCompleted;
            }

        public void signalUpdate(Bitmap bmap, String bmapUrl)
            {

                if (listener != null)
                    {
                        listener.handleDownloadThreadUpdate(bmap, bmapUrl);
                    }
            }

    }

And let your Activity component implement the below interface for callback from Thread class.
public interface DownloadThreadListener {

void handleDownloadThreadUpdate(Bitmap bmap,String bmapUrl);

Map<String, Bitmap> giveImages_Map();

ConcurrentHashMap<String, SoftReference<Bitmap>> giveSoftImages_Map();

}


text:
Q: Script# 0.8 changes in generated code I've built the latest script# source from Github and started using it in a project. It looks like the way code is generated has changed.
How do I make the compiler go back to the old way of generating code? (the 0.7.x way)

A: There isn't a flag to go back to the old output. The new output brings the AMD pattern for creating script modules to script# generated output, and takes advantage of it to streamline things and make generated script more consistent with accepted patterns.
First is use of the module scope to generate private types better so they are more minimizable. Specifically the whole identifier using '$' as separator is minimized, rather than being left as unminimizable because of the "."... eventually I'll be using that for private members as well.
Public types are exposed in the same way outside the module if you were using the assembly ScriptNamespace attribute previously to minimizing typically longer c# namespaces.
If you weren't using ScriptNamespace, and instead previously you were exposing type such as SomeNamespace.SomeSubnamespace.SomeType, then there is a change on the public surface area as well - the same type is now exposed as SomeModule.MyType (like you would with a ScriptNamespace = SomeModule). Every c# assembly maps to a module.
Again, this is to minimize better, as well as being in sync with patterns that most other script frameworks have adopted. Hope that provides some of the context for the change.
Was there a particular aspect of the old output that you need, rather than essentially the need to keep it the same? If you need exactly the same output as before, then 0.7.x is going to be the version to use.


text:
Q: regex split by block filter by content I want to remove every bloc starting by X, finishing by Y and containing value Z
http://regex101.com/r/jS7eA5
Text:
BEGIN
DESCRIPTION: 1234
BOOL:TRUE
END
BEGIN
DESCRIPTION: 4568
BOOL:TRUE
END
BEGIN
DESCRIPTION: 715310
BOOL:FALSE
END
BEGIN
DESCRIPTION: 12489453
BOOL:TRUE
END
BEGIN
DESCRIPTION: 41543
BOOL:FALSE
END

Result :
BEGIN
DESCRIPTION: 1234
BOOL:TRUE
END
BEGIN
DESCRIPTION: 4568
BOOL:TRUE
END
BEGIN
DESCRIPTION: 12489453
BOOL:TRUE
END

Here, we want to remove every bloc starting by "BEGIN", ENDING BY "END", WITH "BOOL:FALSE" INSIDE.
another point of view : I want to keep every bloc  starting by "BEGIN", ENDING BY "END", WITH "BOOL:TRUE" INSIDE.
This one take the first begin and searche the first bool:false before search the end. That's not right.
    (?s)(BEGIN.?BOOL:FALSE.?END)
What I want its like using a filter on
(?s)(BEGIN.*?BOOL\:FALSE.*?END)

filter by BOOL:FALSE
(?s)(BEGIN.*?BOOL\:FALSE.*?END)[.FILTERBY_BOOL:FALSE

A: You can use a negative lookahead for this:
BEGIN((?!TRUE).)*?END

This checks for every dot that you have whether there's not TRUE ahead, until END. So, all the other blocks without TRUE will be removed.
You can also insert a [\r\n]? to make things a little cleaner:
[\r\n]?BEGIN((?!TRUE).)*?END

Updated the regex101.
EDIT:
If you want to only pinpoint FALSE, you can use this regex, which is a bit longer:
[\r\n]?BEGIN(?:(?!FALSE|END).)*?FALSE(?:(?!FALSE|END).)*?END

Updated regex101 with this one.


text:
Q: How to render Backbone el correctly into the view page I'm trying to working correctly with my first Backbone app and trying to render it into my page.
I've wrote this app but I didn't got how I shoud put the app html rendered in the html view:
<script type="text/javascript">
$(function(){
    var SearchApp = new Search.Views.App({
        id:"product-name-results"
    });
    SearchApp.render();
});
<script>

This is my app
var Search = {
    Models: {},
    Collections: {},
    Views: {},
    Templates:{}
}

Search.Views.App = Backbone.View.extend({
    initialize:function () {
        console.log('Search.Views.App initialize')
    },
    render:function (options) {
        this.$el.html('hello world');
    }
});

Obviously this render method not appending in the html view, but how to append it into the view?

A: See this Fiddle
Basically, I changed id: '' to el: '', and added HTML container


text:
Q: Is there a way in Jira to allow the screen attachment screen to be hooked up to a new issue screen? In Jira, while in the basic view issue page, there is a drop-down under "More..." for "Attach screenshot". Is there any way to attach the attach screenshot fields to a screen such as the Comment screen?

A: You can use the Wiki markup to display thumbnails of attachments inside comments.

A: That is configurable in the screen options( Attachment field )
If you want a nicer gui, you may install the "Drag and Drop Attachment" plugin ...


text:
Q: Can't copy a file to an external drive with filemaneger.default.copyItem in Swift? I am trying to write a function that takes a source and a destination URL to copy files with swiftUI.
Here is my function so far:
func copyFile(_ fileURL : URL, _ folder : URL) -> Bool {
    let filename = fileURL.lastPathComponent
    let finalDestination = folder.appendingPathComponent(filename)

    do {
        print("Trying to create " + finalDestination.deletingLastPathComponent().path)
        try FileManager.default.createDirectory(atPath: finalDestination.deletingLastPathComponent().path, withIntermediateDirectories: true, attributes: nil)
        print("Creating folder ok !")
    } catch let error {
        print(error.localizedDescription)
        print("Couldn't create directory")
    }

    let original_hash = hashFile(fileURL)
    do {
        try FileManager.default.copyItem(at: fileURL, to: finalDestination)
    } catch {
        return false
    }

    let destination_hash = hashFile(finalDestination)

    if original_hash == destination_hash
    { return true }

    else { return false }
}

It works when I try to copy files to the folders inside my app, however I cannot manage to copy the files anywhere else. Is there a special permission that I need to ask? I'm not sure how.
Thank you,


text:
Q: How to get first, max, min, last records in a group by with mysql can anyone help me to know first record from open column, max of from high, min of from low, and last record from close column with 5 minutes interval format group
https://drive.google.com/open?id=1HMDECnuReJbnmRj0o_Gevn1ePMdpDoNy

I tried the below query for interval wise group by
SELECT
    timestamp,
    symbol,
    open,
    MAX(high) as high,
    MIN(low) as low,
    close
FROM ohlc_database
WHERE `symbol` LIKE 'AMBUJACEM'
GROUP BY
UNIX_TIMESTAMP(timestamp) DIV 300, symbol

Expected Output

A: One of the tricks to get the first & last values in MySql 5.x is to combine GROUP_CONCAT (with an order by) & SUBSTRING_INDEX.
Example:

SELECT
 symbol,
 FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP (`timestamp`)/300)*300) AS `timestamp`,
 CAST(SUBSTRING_INDEX(GROUP_CONCAT(`open` ORDER BY `timestamp` ASC SEPARATOR '|'),'|',1) AS DECIMAL(10,2)) AS `open`,
 MAX(`high`) AS `high`,
 MIN(`low`) AS `low`,
 CAST(SUBSTRING_INDEX(GROUP_CONCAT(`close` ORDER BY `timestamp` DESC SEPARATOR '|'),'|',1) AS DECIMAL(10,2)) AS `close`
FROM ohlc_database
WHERE symbol LIKE 'AMBUJACEM'
GROUP BY symbol, FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP (`timestamp`)/300)*300);

Result:
symbol      timestamp           open    high    low     close
---------   ------------------- ------  ------  ------  ------
AMBUJACEM   24.01.2019 03:45:00 213,10  213,5   213,1   213,50
AMBUJACEM   24.01.2019 03:50:00 213,70  213,8   212     212,40
AMBUJACEM   24.01.2019 03:55:00 212,40  212,75  211,85  211,90

In MySql 8, you could also use the window function FIRST_VALUE for this.
SELECT
 symbol,
 ts05 as `timestamp`,
 MIN(first_open) as `open`,
 MAX(`high`) as `high`,
 MIN(`low`) as `low`,
 MAX(last_close) as `close`
FROM
(
  SELECT
   id, symbol, `timestamp`, `low`, `high`,
   FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP (`timestamp`)/300)*300) AS ts05,
   FIRST_VALUE(`open`) OVER (PARTITION BY symbol, FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP (`timestamp`)/300)*300) ORDER BY `timestamp` ASC) as first_open,
   FIRST_VALUE(`close`) OVER (PARTITION BY symbol, FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP (`timestamp`)/300)*300) ORDER BY `timestamp` DESC) AS last_close
  FROM ohlc_database
  WHERE symbol LIKE 'AMBUJACEM'
) q
GROUP BY symbol, ts05;

A test on db<>fiddle here

A: Use a subquery to get the minimum and maximum timestamps for each each period and symbol.  Then use conditional aggregation to capture the values at those timestamp.
SELECT UNIX_TIMESTAMP(timestamp) DIV 300 as ts,
       symbol,
       MAX(CASE WHEN timestamp = min_ts THEN open END) as open,
       MAX(high) as high,
       MIN(low) as low,
       MAX(CASE WHEN timestamp = max_ts THEN close END) as close
FROM ohlc_database o JOIN
     (SELECT symbol,
             UNIX_TIMESTAMP(timestamp) DIV 300 as ts,
             MIN(timestamp) as min_ts, MAX(timestamp) as max_ts
      FROM ohlc_database
      WHERE symbol LIKE 'AMBUJACEM'
      GROUP BY symbol, UNIX_TIMESTAMP(timestamp) DIV 300
     ) o2
     ON o2.ts = UNIX_TIMESTAMP(o.timestamp) DIV 300 AND
        o2.symbol = o.symbol
WHERE symbol LIKE 'AMBUJACEM'
GROUP BY UNIX_TIMESTAMP(timestamp) DIV 300, symbol

A: The posted dataset appears to be different. Anyway, does this help:
SELECT FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(`timestamp`)/300)*300) x FROM ohlc_database;
+---------------------+
| x                   |
+---------------------+
| 2019-01-24 03:45:00 |
| 2019-01-24 03:45:00 |
| 2019-01-24 03:45:00 |
| 2019-01-24 03:45:00 |
| 2019-01-24 03:45:00 |
| 2019-01-24 03:50:00 |
| 2019-01-24 03:50:00 |
| 2019-01-24 03:50:00 |
| 2019-01-24 03:50:00 |
| 2019-01-24 03:50:00 |
| 2019-01-24 03:55:00 |
| 2019-01-24 03:55:00 |
| 2019-01-24 03:55:00 |
| 2019-01-24 03:55:00 |
| 2019-01-24 03:55:00 |
+---------------------+


text:
Q: react-select: can't map values after selecting an option This example of react-tables uses react-select as a custom filter, but after upgrading the version of react-select from v1.2.1 to v2.1.1, I get the error entry.map is not a function on selecting an option from the dropdown.
The select component is below, anyone know why .map no-longer works?
    <Select
      style={{ width: "50%", marginBottom: "20px" }}
      onChange={entry => {
        console.log(entry);
        this.setState({ select2: entry });
        this.onFilteredChangeCustom(
          entry.map(o => {
             return o.value
          }),
          "firstName"
        );
      }}
      value={this.state.select2}
      multi={true}
      options={this.state.data.map((o, i) => {
        return { id: i, value: o.firstName, label: o.firstName };
      })}
    />

A: Entry is an object, not an array, so you can't use map on it. using entry's value property seems to work.
<Select
      style={{ width: "50%", marginBottom: "20px" }}
      onChange={entry => {
        this.setState({ select2: entry });
        this.onFilteredChangeCustom(
          entry.value,
          "firstName"
        );
      }}
      value={this.state.select2}
      multi={true}
      options={this.state.data.map((o, i) => {
        return { id: i, value: o.firstName, label: o.firstName };
      })}
    />

A: Remove the multi={true} prop and replace it with isMulti.
I had the same error, this has worked for me


text:
Q: Reading csv file with Unicode charcters throws exception Csv file might have multilingual characters.
Below is my code to read it in DataView
List<BulkUser> _lstBulkUser = new List<BulkUser>();
            DataView BlukUserView;

            try
            {
                using (SqlDataSource _SqlDataSource = new SqlDataSource())
                {
                    //_SqlDataSource.ConnectionString = "Dsn=outlook;dbq=D:\\selvam\\projectlist\\lates\\trunk\\SLVconsoleApp\\SLVconsoleApp.Web\\Uploads\\CSVFiles;defaultdir=D:\\selvam\\projectlist\\lates\\trunk\\SLVconsoleApp\\SLVconsoleApp.Web\\Uploads\\CSVFiles;driverid=27;fil=text;maxbuffersize=2048;pagetimeout=5";
                    _SqlDataSource.ConnectionString = "Dsn=" + ConfigurationManager.AppSettings["OutlookDns"].ToString() + ";dbq=" + ConfigurationManager.AppSettings["OutlookFileFolder"].ToString() + ";defaultdir=" + ConfigurationManager.AppSettings["OutlookFileFolder"].ToString() + ";driverid=27;fil=text;maxbuffersize=2048;pagetimeout=5";
                    _SqlDataSource.SelectCommand = "SELECT [First Name] As First_Name, [Last Name] AS LAST_NAME, Company, [E-mail Address] AS EMAILID FROM [" + Filename + "]";
                    _SqlDataSource.ProviderName = "System.Data.Odbc";
                    BlukUserView = (DataView)_SqlDataSource.Select(DataSourceSelectArguments.Empty);
                    int i = 1;
                    _lstBulkUser = (from value in BlukUserView.Table.Select() select new BulkUser { ID = Convert.ToString(i++), FirstName = Convert.ToString(Encoding.UTF8.GetString((byte[])value["First_Name"])), LastName = value["LAST_NAME"].ToString(), EmailId = value["EMAILID"].ToString(), Company = value["Company"].ToString() }).ToList();
                    if (File.Exists(ConfigurationManager.AppSettings["OutlookFileFolder"].ToString() + "\\" + Filename))
                    {
                        File.Delete(ConfigurationManager.AppSettings["OutlookFileFolder"].ToString() + "\\" + Filename);
                    }
                }
            }
            catch (Exception ex)
            {
            }

it throws Unable to cast object of type 'System.String' to type 'System.Byte[]'.
Even if i tried Unicode characters it is not! how do i overcome this issue ?
Below is the screenshot of the csv file

A: CSV doesn't support with multilingual characters. i have checked up to Ms-office 2010.
It is better to save as xls or xlsx. the easiest way to handle this situation.


text:
Q: zjsonpatch diff results in a flat format for add operation I am trying to get the JSON diff using the zjsonpatch library. The library provides the results for add, remove and replace operations. The results are coming as expected.
But for add operation, the values output is sometimes a map of key/value pairs like below. In this case, the path is also an array element.
{
  "op": "add",
  "path": "/Entity1/0/Entity2/Entity3/2",
  "value": {
    "Field1": "ABC",
    "Field2": "BBC",
    "Field3": 999
  }
}

Is it possible to get output in a flat structure for each field? like below
[
  {
    "op": "add",
    "path": "/Entity1/0/Entity2/Entity3/2/Field1",
    "value": "ABC"
  },
  {
    "op": "add",
    "path": "/Entity1/0/Entity2/Entity3/2/Field2",
    "value": "BBC"
  },
  {
    "op": "add",
    "path": "/Entity1/0/Entity2/Entity3/2/Field3",
    "value": 999
  }
]


text:
Q: I need to block PUT request to server using apache2.2 Basically request is like http://<IP>/server/elements/planning?xyz where it updating my details which don't want to edit. How do I block that? Any suggestion is most welcome. I tried to add be below string in /sites-available/default but it blocks all the string.
RewriteCond %{REQUEST_URI} "/server/elements/planning?customerid="     [NC,OR]
RewriteCond %{REQUEST_METHOD} ^(PUT) [NC]
RewriteRule ^(.*)$ - [F,L]

SO please help me. I am new to apache2 so please be specific where to add.


text:
Q: Simple linear regression - understanding given The question is to fill out the missing numbers (A-L) of a simple linear regression model.
I am having problems with converting and interpreting the given table in terms of variables. Would it be possible for someone to confirm and clarify things for me.
The first table represents regression statistics

True model
$$
Y_t = \beta_o + \beta_1X_t + \mu_t
$$
Estimated model
$$
\hat Y_t = \hat\beta_0 + \hat\beta_1x_t
$$
This is what I am confused about

*

*Does the first standard error (12.8478) mean $\sum\hat\mu_t^2$ ?

*Does the standard error for the intercept in last table (14.6208) mean $\sum\mu_t^2$ ?

*Does 3.8508 equal $\hat\beta_1$ ?

*In order to calculate RSS (for J) I need $\sum \hat\mu_t^2$ does this confirm that my first two points are incorrect

*I know $G=\hat\beta_1^2\sum x_t^2$, how do I find $\sum x_t^2$

If I am wrong, would it be possible to know what those numbers mean in terms of variables

A: *

*The standard error here refers to the standard error of the model as a whole, and it is the standard deviation divided by the square root of the sample size.

*Here the standard error refers to the individual standard error for the intercept. The formula is same as that in the first point.
(To get the answer for K and L; use this -> T stat = Coefficient / Std .Error)

*Yes its the estimated coefficient of X variable 1
For the rest of the confusion, watch this youtube video!
http://www.youtube.com/watch?v=zwr0bs8znEE
EDIT:
I used some identities to figure out G H I J, so i cant guarantee this is what your lecturer wants.
Calculating D, E, F:
these are the degrees of freedom, some formulas here,
D -> 1
E -> 13
F -> 14
Calculating H, G:

*

*F statistic(=24.15) =  I / J.

*I is G/D; similarly J is H/E

*You know D and E so just some math will get you the value for G and H.

This is a really weird approach, but I don't think you can get the sum of squares for regression and residual without the actual observations.


text:
Q: let X has a finite dimensional show that X is reflexive. We know If a normed space X is reflexive, then $X'$ is reflexive.and also Reflexive normed spaces are Banach.
but can you proof if X has a finite dimensional Then X is reflexive.

A: We have $\mathrm{dim}(X) = \mathrm{dim}(X^*) = \mathrm{dim}(X^{**})$. Since the canonical embedding $J : X \to X^{**}$ is an isometry, it is surjective (consider the dimensions). Hence, by definition, $X$ is reflexive.


text:
Q: Page permalink redirects to home page I've recently switched to Linux Fedora, and I moved all my xampp files to my new installation, as well as importing the databases.
Now I'm facing an odd problem, a couple of weeks ago I've created a new page on Windows and called it Resources, and created the page-resources.php file for it, it was working well.
I'm trying to access the url localhost/site/resources which was the permalink for the page I created, however, it's redirecting me to localhost/site/ which is the home page, I tried changing the permalink settings, turning off all plugins, resetting my .htaccess file, even changing my site url, but no chance, and I don't know what to do.
Note: if I change the page permalink and the page slug from files, it actually works !, like if I added a letter to the name to be localhost/site/resourcess as well as changing the php page slug file, it's loading the page.
UPDATE: Fixed by clearing browser's cache data and cookies :3 :D

A: UPDATE: I fixed it by clearing my browser's cache, it was caching files so it used the old copy.
BONUS: You can load a web page without loading your caches by using Ctrl + F5

A: Change your permalinks settings to something different, and save it. Then go back to the original settings, and save it. That should clean up your htaccess file.


text:
Q: Can Java interfaces have constructors? ActionListener is a interface but why can i create instance object?
   JButton button = new JButton("Button1");

   ActionListener me = new ActionListener(){
        public void actionPerformed(ActionEvent ae){
            JOptionPane.showMessageDialog(null,ae.getActionCommand());
        }
    };
    button.addActionListener(me);

Or what else? I am not sure. Please help me.

A: What you're seeing here is called an anonymous class: me will be assigned an instance of an anonymous (un-named) class that implements the ActionListener interface.

A: Unlike say C#, Java's interfaces cannot prescribe a constructor.
What you are doing in your code is creating an anonymous class that extends java.lang.Object (which does have a default constructor) and implementing the interface.

A: What you have instantiated is an Anonymous Inner Class.  In short, it's an in-line way to both define a class that has no name and instantiate an instance of that class in one statement.  You'll only ever be able to refer to anonymous inner classes by the super class they implement or extend.  In the case of this question, the super class is the ActionListener interface.
When you compile your code, there will be an extra .class file that exists with a name like this: OuterClass$1.class.  That is the class file that represents the anonymous inner class you've defined.
If you want to learn more, check out this section in the JLS http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5

A: Because you're implementing the interface with your anonymous class

A: ActionListener itself is an interface, indeed.
However, the construct in your code is an anonymous inner class, meaning that your interface was implemented by that inner class.

A: Actually, what you are creating is an anonymous subclass of Object.class that implements the interface. So you are "inheriting" the Constructor from Object, not from the interface.

A: You are not creating an instance of ActionListener. You are creating an anonymous class which implements ActionListener and you are providing that implementation.

A: ActionListener is in fact an interface which can not be instantiated.
However, by defining public void actionPerformed() locally you are allowing the interface to act like a class.
This is legal:
 ActionListener me = new ActionListener(){
      public void actionPerformed(...){...};
 };

This is not:
ActionListener me = new ActionListener();

A: 1. You can't have constructor in Interface in java.
2. What you saw here is an Anonymous Class, which is declared and initialized simultaneously, and it must extend or implement a class or interface respectively.


text:
Q: How to capture truncate statement information in SQL Server 2012 I would like to capture the truncate statements information along with the user/Login information for all database in my production server.
Example:
Use mydb
go
truncate table deleteme_table

I would like to capture the information into the table like the below
Table           Operation   Database    Login              Time
deleteme_table  Truncate    mydb        sandeep.pulikonda  17-12-2014 17:50:00

If the above scenario is not possible please suggest possible ways to capture it
I am using SQL Server 2012 Standard version. So granular level audit are not supported for that version.

A: you can use the SQL Server Audit functionality and add an audit for those queries.
this article explains in detail how to obtain this.
Another good way of profiling your SQL Server is using SQL Profiler. Here is a SO question similar to yours and an answer describing how to use SQL Profiler to achieve the results.
SQL Server Profiler - How to filter trace to only display TSQL containing a DELETE statement?


text:
Q: webpack mangle options changed umd library name I want to create a umd library and uglify it, when I uglify it with below options it changed my library API name,
module.exports = {
  entry: [
    './JS/example/index.js'
 ],
  //devtool: 'inline-source-map',
  //devtool:'source-map',
  plugins: [

    new CleanWebpackPlugin(['dist'])
  ],

  mode: 'production',

  module: {
   rules: [
     {
      test: /\.js$/,
      exclude: /(node_modules|bower_components)/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: ['es2015'],
          plugins: [],
        }
      }
    }
   ]
  },

  output: {
    path: path.resolve(__dirname, 'JS/example/dist/umd'),
    library: "GlobeApi",
    libraryTarget: 'umd',
    umdNamedDefine: true

  },
  optimization: {
    minimizer: [
      new UglifyJsPlugin({
        uglifyOptions:{
          compress:{ecma:5},
          mangle:{
            "properties":true,
            "reserved":['Draw', 'mylibrary','myapi'],
            "keep_fnames": true,
            "keep_classnames": true,
          },
          output: {
            comments: false,
          },

        }
      }),
    ]
  }

};

It exported like this:
    s: Object { ah: CSGlobe(), … }
in Class object prototype functions are undefined I try to use exported class but it gives type error obj t.eb is not defined.
I tried many ways but when I add properties mangle options it mangles everything even if it is reserved.
packages versions :
"babel-preset-es2015": "^6.24.1"
"uglifyjs-webpack-plugin": "^1.2.7"
"webpack": "^4.4.1"


text:
Q: how to get the point when a textbox starts hiding the character on left side in javascript i want to get the point when the textbox start hiding the character to the left side
hw is it posible in javascript

A: You would get the width of the textbox, approximate the width of a char, and when (char_amounts * char_width > textbox_width), you got yourself an overflow.


text:
Q: DAE model not showing applied textures within iOS app I am using a few DAE models in a SceneKit scene in my app.  However, textures do not show up on the models in the application even though they are shown in Xcode.  I am also using the textures that I include in the app's asset catalogue.
Here is the texture I applying to the diffuse channel of the model. I am dragging this to the model in Xcode to apply it, and Xcode shows the model with the texture in its model view.

And the model itself:
https://www.dropbox.com/s/lzqkgoumu9yshcf/amalthea.dae?dl=0
The model was exported (in Blender) from this Blender file:
https://www.dropbox.com/s/kt3n9f2kn6w6cij/amalthea.blend?dl=0
I am loading the model into my scene as follows:
let scene = SCNScene(named: "amalthea.dae")

Anything obvious that I am overlooking?

A: Revised answer:
After downloading  the dae file.
The most likely cause is that your textures are not on a path that is reachable relative to the model location.
The texture reference in the dae file is:
 <init_from>Assets.xcassets/jupiter/amalthea/amaltheamap.imageset/amalthea.jpg</init_from>

I think it should be relative to model location.  Try changing the texture reference in the dae (using any text editor) to just "amalthea.jpg".  Then copy the jpg to same folder where the model is.
 <init_from>amalthea.jpg</init_from>

A more detailed discussion can be found here.


text:
Q: How to send filled pdf form to a url address and get field data? I have a pdf form prepared with Scribus. It has two fields "name" and "telephone" and a submit button for trying. I uploaded pdf to local server using Flask and showed on the web browser, but when I filled the form and click submit button nothing happens(form does not go to url that I gave while preparing the pdf form). I tried this with Okular and Document Viewer, but nothing happens again.
How can I send filled data to an address and access field values within python
code?


text:
Q: dplyr standard evaluation: summarise_ with variable name for summed variable I went through a lot of questions that are similar to mine but only addressed one part of my problem. I am using dplyr with standard evaluation to accommodate variable names. This works fine for filter_ and group_by_ in a pipe. However, for summarize I cannot have a variable name for the metric I'm summing. An example will make it clear.
library(dplyr)
library(lazyeval)

# create data
a <- data.frame(
  x = c(2010, 2010, 2011, 2011, 2011),
  y_zm = c(rep(10, 5)),
  y_r2 = c(rep(20, 5)))

# define variable names
tag <- "2011"
metric <- "y"
run1 <- "zm"
run2 <- "r2"

# working example for a pipe with fixed variable name
a %>%
  filter_(~x == tag) %>%
  group_by_(tag) %>%
  summarise_(variable_name = interp(~sum(var, na.rm = T),
                                    var = as.name(paste0(metric,"_",run1))))

# non-working example of what I want to do
a %>%
  filter_(~x == tag) %>%
  group_by_(tag) %>%
  summarise_(as.name(paste0(metric,"_",run1)) =
               interp(~sum(var, na.rm = T),
                      var = as.name(paste0(metric,"_",run1))))

I tried a lot of different things involving as.name() or interp() but nothing seems to work.

A: After poring over the NSE vignette for awhile and poking at things, I found you can use setNames within summarise_ if you use the .dots argument and put the interp work in a list.
a %>%
    filter_(~x == tag) %>%
    group_by_(tag) %>%
    summarise_(.dots = setNames(list(interp(~sum(var, na.rm = TRUE),
                                            var = as.name(paste0(metric,"_",run1)))),
                                                            paste0(metric,"_",run1)))

Source: local data frame [1 x 2]

  2011 y_zm
1 2011   30

You could also add a rename_ step to do the same thing.  I could see this being less ideal, as it relies on knowing the name you used in summarise_.  But if you always use the same name, like variable_name, this does seem like a viable alternative for some situations.
a %>%
    filter_(~x == tag) %>%
    group_by_(tag) %>%
    summarise_(variable_name = interp(~sum(var, na.rm = T),
                                         var = as.name(paste0(metric,"_",run1)))) %>%
    rename_(.dots = setNames("variable_name", paste0(metric,"_",run1)))

Source: local data frame [1 x 2]

  2011 y_zm
1 2011   30


text:
Q: $V= \{ f \in \mathbb F(\mathbb N) | f(n) = f(n+3)\forall n \geq 0\}$ is a subspace of $F(\mathbb N) $ I must prove that this is a subspace of $\mathbb F (\mathbb N)$ but also find a spanning set of V.
My attempt at the problem :
I don't understand which functions are part of this subset... I can take $ f(n) = (n-5/2)^2$ which is equal at n=1 and n=4 , but isn't equal $\forall n \in \mathbb N \geq 0$ I would guess constant functions satisfy the criteria ? Such that taking y=c gives always the same output  $\forall n$, then my guess of a spanning set of that would be {1} since it's just a constant function ?
thanks for help.


text:
Q: How to dynamically edit env.roledefs in Fabric? I have checked this question but it doesn't answer to my problem.
I would like to do something like:
@task
def setEnv(environment):
    if environment == 'prod':
        env.roledefs['nginx'] = [ 'www@tnginx01', 'www@tnginx02' ]
        env.roledefs['middle'] = [ 'www@tmiddle01', 'www@tmiddle02' ]
    elif environment == 'preprod':
        env.roledefs['nginx'] = [ 'www@pnginx01', 'www@pnginx02' ]
        env.roledefs['middle'] = [ 'www@pmiddle01', 'www@pmiddle02' ]
    else:
        puts(red("This environment doesn't exist. Possible values are 'preprod' and 'prod'", True))
        sys.exit()

    env.first_middle = env.roledefs['middle'][0]

@task
@roles(env.first_middle)
def deploy():
    run('pwd')

But it seems that it's not possible to change the value of env.roledefs after the Fabfile has been loaded into memory.
When you try to run fab setEnv:prod deploy, it won't work:

No hosts found. Please specify (single) host string for connection

Does anyone know how to do that? Note that I cannot use roledefs to represent environments. I already use roledefs to store servers belonging to a same 'cluster', and each environment has several clusters with several servers.

A: I just found the solution to my problem.
The key is that env.roledefs cannot be edited from within a Fabric task. So, the code editing it has to be at the beginning in the global scope.
if env.get('env') == 'prod':
    env.roledefs['nginx'] = [ 'www@tnginx01', 'www@tnginx02' ]
    env.roledefs['middle'] = [ 'www@tmiddle01', 'www@tmiddle02' ]
elif env.get('env') == 'preprod':
    env.roledefs['nginx'] = [ 'www@pnginx01', 'www@pnginx02' ]
    env.roledefs['middle'] = [ 'www@pmiddle01', 'www@pmiddle02' ]
else:
    puts(red("This environment doesn't exist. Possible values are 'preprod' and 'prod'", True))
    sys.exit()

    env.first_middle = env.roledefs['middle'][0]

@task
@roles(env.first_middle)
def deploy():
    run('pwd')

And then I just call the fabfile like this:
fab --set env=preprod deploy

My answer is inspired from this link which gave me the idea.


text:
Q: How to use NSLayoutConstraint in iOS 6? My app should support both iPhone resolutions (5 and older) using iOS 5 and iOS 6. When I use autolayouts in IB, on iOS 5 app crashes like this: link
So, I am trying to use NSLayoutConstraint in code, but unsuccessfully yet.
Subquestions:

*

*I am adding constraints in viewDidLoad method, but is it correct?

*Does updateViewConstraints invoke by framework? I have never seen that it was invoked.

*I tried to use examples from apple's docs, but it was without effect to view.

Anybody knows how to do it?
PS: I know it's possible to make it manually by setting frames, but I would like to use NSLayoutConstraints.
UDP: Yes, I know, that's why i use NSLayoutConstraint in code. I can make condition for determining iOS version. The question is about iOS6.

A: The AutoLayout feature is only compatible with iOS6 and is not supported in iOS5. Thus the crash
If you intend your app to be compatible with iOS5, you can't use AutoLayout in your XIB files.
You can only use older methods, like the AutoResizingMask for example (which is often sufficient for most cases anyway).