text:
Q: Get the day name and time on posting automatically using JavaScript This will result in a javascript format: 9 Aug, 2012
var month = [1,2,3,4,5,6,7,8,9,10,11,12];
var month2 = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var day = postdate.split(-)[2].substring(0,2);
var m = postdate.split(-)[1];
var y = postdate.split(-)[0];
for(var u2=0;u2<month.length;u2++){
if(parseInt(m)==month[u2]) {
m = month2[u2] ; break;
}
}
var daystr = day+ ' ' + m + ', ' + y ;

How to add the day name and time in javascript above?
Ex: Thursday, 9 Aug, 2012 5:28 PM

A: getDay(); will return the dayname
getTime() will return the time in milliscond since 1970.

A: You can get the day name using gatDay();
and here is a function to display time.
function displayTime() {
            var currentTime = new Date();
            var currentHours = currentTime.getHours();
            var currentMinutes = currentTime.getMinutes();
            var currentSeconds = currentTime.getSeconds();

            // Pad the minutes and seconds with leading zeros, if required
            currentMinutes = (currentMinutes < 10 ? "0" : "" ) + currentMinutes;
            currentSeconds = (currentSeconds < 10 ? "0" : "" ) + currentSeconds;

            // Choose either "AM" or "PM" as appropriate
            var timeOfDay = (currentHours < 12 ) ? "AM" : "PM";

            // Convert the hours component to 12-hour format if needed
            currentHours = (currentHours > 12 ) ? currentHours - 12 : currentHours;

            // Convert an hours component of "0" to "12"
            currentHours = (currentHours == 0 ) ? 12 : currentHours;

            // Compose the string for display
            var currentTimeString = currentHours + ":" + currentMinutes + " " +currentSeconds+" "+ timeOfDay;

            $("#clock").html(currentTimeString);

        }


text:
Q: IValueConverter - Casting generic Collections I want to create a type independent Converter for counting the elements in a collection with a generic type.
    public class CollectionCountConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return ((SomeCastingType)value).Count;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException(); // not used for oneway binding
    }
}

value in this case is a Collection of any type. The problem is to find the correct casting type and cast the object. What I want to have is something like
Type t = value.GetType();
ICollection<t> c = (ICollection<t>) value;
int count = c.Count();

but this does not work. I also tried to use Object as generic type, but then I get an InvalidCastException. Is there any elegant way to do it?

A: Since IEnumerable<T> is covariant, you can use this.
return ((System.Collections.Generic.IEnumerable<object>)value).Count();

From MSDN:

Type Parameters
out T
The type of objects to enumerate.
This type parameter is covariant. That is, you can use either the type
you specified or any type that is more derived.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Performance issue in Xpath grammar file using antlr I am running into a performance issue while creating the grammar for Xpath.
The whole grammar was working fine till we added support for the xpaths like:
((div)[1]//span)[1]

or
((//div)[1]/div)[last()]

After adding support for this in the grammar file, the above xpaths started working fine but other xpaths started giving performance issues.
Like this one :
//label[normalize-space(.)='Phone']/parent::lightning-input/parent::slot/parent::slot/parent::span/parent::div/parent::force-record-layout-item/parent::slot/parent::force-record-layout-row/parent::slot/parent::div/parent::div/parent::div/parent::force-record-layout-section/parent::slot/parent::force-record-layout-block/parent::forcegenerated-detailpanel_contact___012b0000000jhhvia4___full___view___recordlayout2/parent::records-lwc-record-layout/parent::slot/parent::records-record-layout-event-broker/parent::div/parent::div/following-sibling::force-form-footer//button

which started taking 30 seconds in parsing (it took 170ms earlier).
These were the lines of code added/modified in the attached grammar file which started giving performance issue:
union
 : expressions+=pathExpression (WS? operator='|' WS? expressions+=pathExpression)*
 ;

pathExpression
 : expressionAtom
 | expressionAtom nodeSet
 ;

expressionAtom
 : functionCall
 | nodeSet
 | literal
 | parenthesis
 ;

Earlier it was:
union
 : expressions+=expressionAtom (WS? operator='|' WS? expressions+=expressionAtom)*
 ;

expressionAtom
 : functionCall
 | nodeSet
 | literal
 | parenthesis
 ;

and used to give no performance issues.
On debugging the XpathParser I figured out that it is because the DFAState has** requiresFullContext as true **in this case.
The documentation states that the true value of this "Indicates that this state was created during SLL prediction that discovered a conflict between the configurations in the state."
Can you help me resolve this issue and what is causing it to search the full context which takes time?

A: I don't know Antlr well, but how about replacing
pathExpression
 : expressionAtom
 | expressionAtom nodeSet
 ;

with
pathExpression
 : expressionAtom nodeSet?
 ;


text:
Q: In Orcs Must Die, do guardians count as traps? In the game Orcs Must Die, the achievement Tunnel Vision requires that the player

Win an act 2 or 3 level using a single trap type

For the purposes of this achievement, do guardians count as traps, or can I use both a single type of trap and a guardian (such as an archer)?

A: As per my experience and this thread:

you can also use any weapons, magic, guardians and boom barels since they don't count as traps

So no, guardians do not count as traps. I believe barricades do not count either. If you're really ambitious, you might try for the no traps achievement at the same time, killing two birds with one stone.
Additionally, beware not to activate any of the traps in the environment because those do count as traps and will negate the achievement.


text:
Q: How to pass value from nested if statmant in flask? I'm new at programing, and I wanted to ask question. It seems that I cant pass values from nested if statments and global values dont work in flask. I'm a bit confused and would like to get some help
@app.route("/app_main_page/preke/<int:p_id>",  methods=["GET", "POST"])
@login_required
def viena_preke(p_id):
    form = UpdateItemForm()
    preke = Preke.query.get(p_id)
    if form.validate_on_submit():
        if form.prekes_nuotrauka.data:
            file = save_pict(form.prekes_nuotrauka.data)
        preke.pavadinimas = form.pavadinimas.data
        preke.apibudinimas = form.apibudinimas.data
        preke.author = current_user
        db.session.commit()
        flash("Jusu preke buvo atnaujinta", "success")
        return redirect(url_for("visos_prekes"))
    else:
        form.pavadinimas.data = preke.pavadinimas
        form.apibudinimas.data = preke.apibudinimas
    return render_template("VienaPreke.html", title="Viena preke", preke=preke, form=form, image = file)

I'm trying to run image file trough function to reduse size and change name of the file. But I always get "Unresolved reference 'file'", because the flask seems not to recognise value from nested if statment.
Error

return render_template("VienaPreke.html", title="Viena preke", preke=preke, form=form, image = file) UnboundLocalError: local variable 'file' referenced before assignment

A: Solved it. Just needed to learn how to use global variables(its not that easy as it seems). You need to assign value x before function, then you need to say global x in function and then you assign value to variable.


text:
Q: From local to AWS Lambda Node:js I have a folder working into my local MAC OSX, the node.js is working properly.
Now I want to export to AWS Lambda and execute code from there.
I tried to pack the code and upload, but I found issues.
I did this:
moved to the dir locally
zip with zip -r ../polly.zip *
then upload with
aws lambda update-function-code --function-name FUNCTIONNAME —region eu-west-1 --zip-file fileb://~/aws/FUNCTIONNAME.zip

The function is on Lambda, I see dependencies, node_modules, but when I test I obtain error :
{
  "errorType": "Runtime.HandlerNotFound",
  "errorMessage": "index.handler is undefined or not exported",
  "trace": [
    "Runtime.HandlerNotFound: index.handler is undefined or not exported",
    "    at Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:979:15)",
    "    at async start (file:///var/runtime/index.mjs:1137:23)",
    "    at async file:///var/runtime/index.mjs:1143:1"
  ]
}

What is wrong?


text:
Q: Post method never returns in Xamarin Forms iOS I am using the below code snippet:
public async Task<LoginUser[]> GetUserAsync()
{
    var client = new System.Net.Http.HttpClient();
    client.BaseAddress =
        new Uri("http://developer-platform.com/dutyfreebuzz/web_services/Login");
    StringContent str = new StringContent("username=admin&password=12345", Encoding.UTF8, "application/x-www-form-urlencoded");
    var response = await client.PostAsync(new Uri("http://developer-platform.com/dutyfreebuzz/web_services/Login/loginJSON"), str);
    var loginJson = await response.Content.ReadAsStringAsync();
    Rootobject rootobject = new Rootobject();
    if (loginJson != "")
    {
        //rootobject = JsonConvert.DeserializeObject<Rootobject>(loginJson);
    }
    //return rootobject.loginusers;
}

I have set the breakpoint to this function. During execution, the debugger is not moving to
PostAsync call and it is moving out of the function.

A: This answer is a summary of comments by Cheesebaron and OP, as the solution was provided in the comments.
There is a currently known issue with setting breakpoints in async/await code in portable class libraries if the linker is enabled on iOS.

41836: For iOS apps, breakpoints within async methods in PCL projects
  are not hit if the linker is enabled. Partial temporary workaround:
  Set Project Properties > iOS Build > Linker behavior to Don't link.
  (For device builds this workaround does unfortunately create
  significantly larger .app bundles and can lengthen deployment times.)

As a work around set the break point in the WriteLine():
System.Diagnostics.Debug.WriteLine(response);


text:
Q: Proving there are arbitrarily large limit ordinals I want to prove that there are arbitrarily large limit ordinals. What does arbitrarily large limit ordinals mean?
I think the idea of the proof of the statement is by using contradiction. So, we suppose that there are not arbitrarily large limit ordinals and we denote the largest limit ordinal by lets's say $\alpha$. Then I show that there can be another limit ordinal that is larger than $\alpha$. So, this is a contradiction and by the same argument it can be shown that basically there are arbitrarily large limit ordinals. Now, I think my argument shows that there are infinitely many large limit ordinals. I'm not sure I understand it.

A: If $x\in On$ then $x+\omega=\bigcup \{x+n:n\in \omega\}$ is a limit ordinal which is larger than $x$.


text:
Q: Unresolved reference 'tkinter' My only code which i written is causing errors. Any ideas?
Here is my error:
C:\Python27\python.exe "C:/Users/USER/Desktop/Python/AB-Windows.py"
Traceback (most recent call last):
  File "C:/Users/USER/Desktop/Python/AB-Windows.py", line 1, in <module>
    from tkinter import *
ImportError: No module named tkinter

Here's the code:
from tkinter import *

root = Tk()
root.mainloop()

A: In python 2,  replace import tkinter with import Tkinter with a capital T
from Tkinter import *

root = Tk()

root.mainloop()


text:
Q: How to use color() instead of facet_grid() to 'split' your data but keep it on the same plot I'm having trouble substituting color() for facet_grid() when I want to 'split' my data by a variable. Instead of generating individual plots with regression lines, I'm looking to generate a single plot with all regression lines.
Here's my code:
ggplot(data, aes(x = Rooms, y = Price)) +
    geom_point(size = 1, alpha = 1/100) +
    geom_smooth(method = "lm", color = Type) # Single plot with all regression lines
ggplot(data, aes(x = Rooms, y = Price)) +
    geom_point(size = 1, alpha = 1/100) +
    geom_smooth(method = "lm") + facet_grid(. ~ Type) # Individual plots with regression lines

(The first plot doesn't work) Here's the output:
"Error in grDevices::col2rgb(colour, TRUE) : invalid color name 'Type'
In addition: Warning messages:
1: Removed 12750 rows containing non-finite values (stat_smooth).
2: Removed 12750 rows containing missing values (geom_point)."
Here's a link to the data:
Dataset

A: You need to supply an aesthetic mapping to geom_smooth, not just a parameter, which means you need to put colour inside aes(). This is what you need to do any time you want to have an graphical element correspond to something in the data rather than a fixed parameter.
Here's an example with the built-in iris dataset. In fact, if you move colour to the ggplot call so it is inherited by geom_point as well, then you can colour the points as well as the lines.

library(ggplot2)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
  geom_point() +
  geom_smooth(aes(colour = Species), method = "lm")

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) +
  geom_point() +
  geom_smooth(method = "lm")

Created on 2018-07-20 by the reprex package (v0.2.0).


text:
Q: Huffman text compression tree traverse algorithm I'm trying to reverse engineer text compression algorithm and I've stuck in one place for about a month already.
In general, here's the code of decoder in C. It works perfectly but I still don't understand how compression scheme works.
The problem part is GetNextChararacter function.
I don't understand this iteration bitstream format. It looks like a binary huffman tree serialized in a strange way.
So iteration bitstream is like recursion tree, and algorithm searches when current node is traversed through all leafs and outputs leaf count. After that, source bitstream skips forward some bits in iterationBitStream. And if iterBit at current position is set, we traverse the remainder of iteration stream and add result to the previous offset. And so on, until we reach leaf in iteration offset. Total count of reached leafs is the offset in a characters list for decoding character.
So that's the first time I see tree is used for storing just total amount of leafs in it. The compression looks overcomplicated with this scheme. In the same time, I feel, the code does something very basic, but my understanding of the algorithm is just wrong.
Can someone tell me if there is another, more logical explanation of that algorithm or maybe it's simply described somewhere else?

A: Thanks everybody, who was involved.
I've figured it out once I've constructed tree and tried to crawl in it by hands.
In general, iteration bitstream is a binary tree, serialized in pre-order traversal. Looks like it's hard to recognize tree traversal in assembler code.
Source stream is a plain path in that tree.
Whole compression scheme is just a Huffman, with individual tree for each character. Next character of text is decoded based on prevous char's tree.


text:
Q: In Cardy-Verlinde generalized uncertainty principle (GUP), how we know that the alpha is a constant of order one? The GUP equation [1] is,
$$\Delta x_i\geq\frac{\hbar}{\Delta p_i}+\alpha^2l_p^2\frac{\Delta p_i}{\hbar},$$
where $l_p$ is the Planck length.
How do we know that $\alpha$ has a order of unity [1]? What's the proof?
Reference:

*

*Setare, M. R. "Corrections to the Cardy-Verlinde formula from the generalized uncertainty principle." Physical Review D 70 no. 8 (2004): 087501, arXiv:hep-th/0410044.


text:
Q: Suggestions to Optimize MySQL Query based on query plan Here is my query running on MySQL database. The query is taking more time as we have more no.of records in the orders table. Please suggest tips to optimize the query based on the query plan.

mysql> explain SELECT DISTINCT
  dt.customer_id,dt.email,dt.title,dt.fname,dt.lname,dt.
  work_phone,dt.mobile_phone,dt.home_phone,dt.blacklist_reason,dt.
  domain,dt.domain_group,dt.my_account_flag,dt.marketing_preference,dt.
  city,dt.address1,dt.address2,dt.state,dt.
  country,dt.zip,dt.country_code FROM (SELECT
  cc.customer_id,cc.email,cc.title,cc.fname,cc.lname,
  cc.work_phone,cc.mobile_phone,cc.home_phone,cc.blacklist_reason,
  cc.domain,cc.domain_group,cc.my_account_flag,cc.marketing_preference,
  ca.city,ca.address1,ca.address2,ca.state,
  ca.country,ca.zip,ca.country_code,odd.order_date FROM customer cc
  INNER JOIN customer_address ca ON cc.customer_id=ca.customer_id left
  outer join order_delivery_details odd on
  cc.customer_id=odd.customer_id WHERE   cc.lname = 'XXXXXX' and
  ca.address_purpose='XXXX'   and  ( cc.domain in ( 'XXXXXX_IE' ) ||
  cc.domain_group in  ( 'XXXXX' , 'YYYYYY' ) )   order by odd.order_date
  desc) dt LIMIT 0,500;

The SQL:
SELECT
    DISTINCT dt.customer_id,
    dt.email,
    dt.title,
    dt.fname,
    dt.lname,
    dt. work_phone,
    dt.mobile_phone,
    dt.home_phone,
    dt.blacklist_reason,
    dt. domain,
    dt.domain_group,
    dt.my_account_flag,
    dt.marketing_preference,
    dt. city,
    dt.address1,
    dt.address2,
    dt.state,
    dt. country,
    dt.zip,
    dt.country_code
    FROM (
        SELECT
            cc.customer_id,
            cc.email,
            cc.title,
            cc.fname,
            cc.lname,
            cc.work_phone,
            cc.mobile_phone,
            cc.home_phone,
            cc.blacklist_reason,
            cc.domain,
            cc.domain_group,
            cc.my_account_flag,
            cc.marketing_preference,
            ca.city,
            ca.address1,
            ca.address2,
            ca.state,
            ca.country,
            ca.zip,
            ca.country_code,
            odd.order_date
        FROM
            customer cc
        INNER JOIN customer_address ca ON cc.customer_id=ca.customer_id
        left outer join order_delivery_details odd on cc.customer_id=odd.customer_id
        WHERE   cc.lname = 'XXXXXX'
        and     ca.address_purpose='XXXX'
        and  ( cc.domain in ( 'XXXXXX_IE' )
            or cc.domain_group in  ( 'XXXXX' , 'YYYYYY' )
            )
        order by odd.order_date desc
    ) dt
    LIMIT 0,500;

Thanks for your response. I cannot move order by outside of subquery because the main query doesn't include order_date column.
Here is the requirement. We should search the customer based on search criteria and order the customers based on his latest order_date. Customers can have mutliple orders, we have to pick the latest order's order_date and sort the customer.
First I'm listing all customers joining with orders table and ordering all the records based on order_date.
Once all the records are ordered based on order_date, there is a much chance that there are multiply records for same customer if customer has multiple orders.
Now I'm applying distinct on top of it excluding the order_date in order to get dictinct customer details.
Thanks,
Chandu

A: Rewrite the query so it matches your description of what it shall do: You want to see a list of customer addresses ordered by the customer's last order. To get an entry per address, you group by address. And to order by last order date descending, you order by max(order_date) desc.
SELECT
  cc.customer_id,
  cc.email,
  cc.title,
  cc.fname,
  cc.lname,
  cc.work_phone,
  cc.mobile_phone,
  cc.home_phone,
  cc.blacklist_reason,
  cc.domain,
  cc.domain_group,
  cc.my_account_flag,
  cc.marketing_preference,
  ca.city,
  ca.address1,
  ca.address2,
  ca.state,
  ca.country,
  ca.zip,
  ca.country_code
FROM  customer cc
INNER JOIN customer_address ca ON cc.customer_id = ca.customer_id
LEFT OUTER JOIN order_delivery_details odd on cc.customer_id = odd.customer_id
WHERE cc.lname = 'XXXXXX'
AND ca.address_purpose='XXXX'
AND (cc.domain in ( 'XXXXXX_IE' ) OR cc.domain_group in ('XXXXX', 'YYYYYY'))
GROUP BY ca.id
order by max(odd.order_date) desc
LIMIT 0,500;

This should be faster, because you simply tell the dbms what you want to see and the dbms can find the best way how to achieve this.

A: It looks like the index it is choosing to use on the customer table is just for the lname field, but that doesn't seem to narrow the results down much. Think you would need to add a couple of indexes, one covering lname and domain and the other covering lname and domain_group. Then you can have 2 unioned queries.
SELECT
    DISTINCT dt.customer_id,
    dt.email,
    dt.title,
    dt.fname,
    dt.lname,
    dt. work_phone,
    dt.mobile_phone,
    dt.home_phone,
    dt.blacklist_reason,
    dt. domain,
    dt.domain_group,
    dt.my_account_flag,
    dt.marketing_preference,
    dt. city,
    dt.address1,
    dt.address2,
    dt.state,
    dt. country,
    dt.zip,
    dt.country_code
    FROM (
        SELECT
            cc.customer_id,
            cc.email,
            cc.title,
            cc.fname,
            cc.lname,
            cc.work_phone,
            cc.mobile_phone,
            cc.home_phone,
            cc.blacklist_reason,
            cc.domain,
            cc.domain_group,
            cc.my_account_flag,
            cc.marketing_preference,
            ca.city,
            ca.address1,
            ca.address2,
            ca.state,
            ca.country,
            ca.zip,
            ca.country_code,
            odd.order_date
        FROM
            customer cc
        INNER JOIN customer_address ca ON cc.customer_id=ca.customer_id
        LEFT OUTER JOIN order_delivery_details odd on cc.customer_id=odd.customer_id
        WHERE   cc.lname = 'XXXXXX'
        AND     ca.address_purpose='XXXX'
        AND  cc.domain_group in  ( 'XXXXX' , 'YYYYYY' )
        UNION
        SELECT
            cc.customer_id,
            cc.email,
            cc.title,
            cc.fname,
            cc.lname,
            cc.work_phone,
            cc.mobile_phone,
            cc.home_phone,
            cc.blacklist_reason,
            cc.domain,
            cc.domain_group,
            cc.my_account_flag,
            cc.marketing_preference,
            ca.city,
            ca.address1,
            ca.address2,
            ca.state,
            ca.country,
            ca.zip,
            ca.country_code,
            odd.order_date
        FROM
            customer cc
        INNER JOIN customer_address ca ON cc.customer_id=ca.customer_id
        LEFT OUTER JOIN order_delivery_details odd on cc.customer_id=odd.customer_id
        WHERE   cc.lname = 'XXXXXX'
        AND     ca.address_purpose='XXXX'
        AND  cc.domain in ( 'XXXXXX_IE' )
        ORDER BY odd.order_date desc
    ) dt
    LIMIT 0,500;

I am not sure your original query needed an inner and an outer query. MySQL will let you sort on a column you are not returning. However it looks like the major issue is indexing, and you can't order the results of a unioned query by a column that isn't being returned from the 2 unioned queries.

A: Have you tried a query like this:
SELECT DISTINCT
    cc.customer_id,
    cc.email,
    cc.title,
    cc.fname,
    cc.lname,
    cc.work_phone,
    cc.mobile_phone,
    cc.home_phone,
    cc.blacklist_reason,
    cc.domain
    cc.domain_group,
    cc.my_account_flag,
    cc.marketing_preference,
    ca.city,
    ca.address1,
    ca.address2,
    ca.state,
    ca.country,
    ca.zip,
    ca.country_code,
FROM
    customer cc
INNER JOIN customer_address ca ON cc.customer_id=ca.customer_id
left outer join order_delivery_details odd on cc.customer_id=odd.customer_id
WHERE
    cc.lname = 'XXXXXX'
    AND ca.address_purpose='XXXX'
    AND ( cc.domain in ( 'XXXXXX_IE' ) OR cc.domain_group in  ( 'XXXXX' , 'YYYYYY' ) )
ORDER BY odd.order_date DESC
LIMIT 0,500

You don't need a sub-select to get what you want.


text:
Q: RequireJS not loading a file or module named "module.js" I just started using RequireJS. I tried a simple code but one way works but the other doesn't.
folder "script" has "main.js", "module.js", "require.js"
<script data-main="script/main.js" src="script/require.js"></script>
in main.js
requirejs( ['module'], function( mod ) {
    mod.sayHello();
} );

in module.js:
define( {
    name : "value",
    sayHello : function() {
        alert( "Hello" );
    },
    sayBye : function() {
        alert( "Bye" );
    }
} );

I expect baseUrl to be "script" as mentioned in here:
http://requirejs.org/docs/api.html#jsfiles

The baseUrl is normally set to the same directory as the script used in a data-main attribute for the top level script to load for a page.

So, I thought there would be no problem, but doesn't mod.sayHello() nor sayBye() and console.log( mod.name ) = undefined.
I tried console.log( mod ) and it prints something like this:
Object {id: "_@r6", uri: "script/_@r6.js", exports: Object}
When I use ["script/module.js"] instead of ["module"], console.log( mod ) prints like the following:
Object {name: "value"}
name: "value"
sayBye: ()
sayHello: ()
__proto__: Object

and mod.sayHello(), mod.sayBye(), mod.name all works.
including the following in the beginning of main.js is the same:
requirejs.config( {
    baseUrl: "script"
} );

What am I doing wrong... Please help.

A: Use a different name than module for your module. For one thing, it is a terribly uninformative name, but the module named module is a special module for RequireJS. It is a module that gives information about the module you are currently in. For instance if foo.js contains this code:
define(['module'], function (module) {
    console.log(module.id);
});

and this file is loaded when you request the module named foo, then console.log will show "foo" on the console.
The documentation does not highlight the existence of module but it talks about it when explaining what the configuration option config does. Because you get to access the config of your module through module.config().
The reason requiring "script/module.js" works is because when you do this you require a module named script/module.js rather than module.

A: I continued reading the documentation:
http://requirejs.org/docs/api.html
and it led to a github that has information about this:
https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#magic
It turns out that "module" is a kind of "magic modules" along as "require", "export".
And "module" ... :

gives you information about the module ID and location of the current module

https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module


text:
Q: unable to delete data using gridview I am building a document uploader web system using asp.net 4.0 .
I am stuck in gridview. I can delete the data from gridview. The data gets deleted in the sql table, but the document, which is stored in my folder remains.
I want the document to get deleted when user clicks delete in gridview..is it possible..have been working days on this..
Thanks in advance.

A: There is a RowDeleted event of gridview which is fired after the deletion of a row, you have to write logic in this event. like...
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
    if (System.IO.File.Exists("DocumentPath"))
    {
        System.IO.File.Delete("DocumentPath");
    }
}

A: You can simply call the following line at the end of your GridView's OnRowDeleting event:
if (System.IO.File.Exists("PathToYourDoc")) { System.IO.File.Delete("PathToYourDoc"); }

About how to find a document path, you can visit the following link to see different examples:
http://www.dotnetperls.com/path


text:
Q: Gerrit: Pushing for code review a commit that's already on Gerrit My workplace started using Gerrit to manage all of our projects. I've never used Gerrit before. I'm trying to figure out a good workflow for using it for submitting code for review.
I created a branch foo. I made a commit on it, and pushed it to Gerrit. Then I started a branch bar starting from foo, and made another commit on it. I pushed the branch bar to Gerrit as well.
I am now on branch bar:
$ git branch
* bar
foo

Now I wanted to start a code review for a merge from bar to foo. I was told that this command should do it:
$ git push gerrit HEAD:refs/for/foo
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Processing changes: refs: 1, done
To ssh://ram@gerrit/acme/my_project
 ! [remote rejected] HEAD -> refs/for/foo (no new changes)
error: failed to push some refs to 'ssh://ram@gerrit/acme/my_project'

As you can see, I'm getting the error (no new changes). I asked our local Gerrit champion why, and he says that as far as he knows, you can't push for code review code that's already on Gerrit, even if that code is on a different branch.
It looks like if I'd avoid pushing the branch bar to Gerrit, my problem would go away and the code review would work. But I would prefer to be able to push whatever the %&@# I want without it interfering with code reviews. I like pushing branches. I like having my branches on Gerrit, because then I can also send them to other people to see on the web interface.
Is it possible to make code reviews in Gerrit work without forbidding me from pushing my branches to Gerrit?

A: Gerrit will not allow you to push the same commit with the same change-id twice. That leaves you with two options:

*

*Amend the existing commit to change the change-id

*Create a new commit that will have a different change-id, and contain all changes from branch foo.

Either way, you'll have to change the commit's change-id, in option 1 using git commit --amend or in option 2 using git rebase foo bar -i, squashing all commits into 1 and then changing it's message.
This is actually a reasonable behavior - Gerrit is a code review tool, so it doesn't make sense to push commits directly to branches.
If you really need a remote just to show your code to others, then you'll have to make a new one for that purpose.

A: I think you need to do the merge in different way
- first, merge the branches locally - git checkout foo then git merge origin/bar
- second, push the merge commit from local foo to remote foo - git push gerrit HEAD:refs/for/foo
Dont forget to put changeId into merge commit.
In general there is no need to review a commit twice. Isntead you need to review merge commits or rebase method. Consider using rebase if your branches not specific ones, like dev vs. release

A: When doing a merge, git doesn't add a change-Id. You have to amend the merge commit to make git to add a new change-id.
This will allow you to push to gerrit the merge commit.
The default behavior of gerrit hook is to not add a change-id to a git merge.
Another solution that I would recommand is to do a rebase instead of a merge. You could rebase bar onto foo with git rebase foo from branch bar


text:
Q: Question involving inflection points in projective space
Recall that a point on the curve $F = 0$ in $\mathbb P^2_k$ is called an inflection point if $\operatorname{Hess}(F) = 0$, where $\operatorname{Hess}(F)$ is the determinant of the $3\times 3$ matrix $\left( \frac{\partial ^2 F}{\partial x_i \partial x_j}\right)$.  Find infection point on the curve $F = x^4 + y^4 + z^4=0$ in $\mathbb P^2_{\mathbb C}$.

I am having difficulty solving the problem above. I understand that I need to find the points of intersection of $\operatorname{Hess}(F) = 0$ and $F = 0$. $\operatorname{Hess}(F)$ is given by $12^3(xyz)^2$. From here, how do I deduce which points in $\mathbb P^2_{\mathbb C}$ satisfy the equation?

A: Setting $\operatorname{Hess}(F) = 0$ gives you either $x=0, y=0$ or $z=0$.
For $x=0$, using $F = 0$ we have $y^4 = -z^4$, which is the same as
$$ y = \pm e^{i\pi/4}  z,\ \  \pm ie^{i\pi/4}  z, $$
which gives rises to the four points
$$ [0,1, \pm e^{i\pi/4}], [0,1,\pm ie^{i\pi/4}].$$
One works similarly for $y=0$, $z=0$ to find that there are 12 inflection points on the curve.


text:
Q: Android heap size limit, do we still really need to design applications with a 16 MB limit in mind? Like the title says, should I still be designing my application around a 16 MB heap size limit? The reason I ask is that I've been developing a game recently that runs fine on my nearly 2 year old Droid 2. But when I test my app using an AVD with a 16 MB heap size limit, I get out of memory errors. Monitoring my application with DDMS shows that the total memory allocated for my game is around 20 MB. It isn't a huge difference, but getting my game to work under that 16 MB limit would really hurt the visuals.
Now, if this was 2008, I wouldn't even be asking this question. But it's 2012, nearly 4 years after the G1 debuted. Is it safe to say that most phones made in the past year allow applications to allocate more than 16 MB of memory? Or am I really screwing myself by not designing my application with a 16 MB limit in mind?

A: The heap limit varies depending on the device resolution (and probably also other factors). So on a high resolution device the heap limit may be 30MB while on a low resolution G1 it is 16MB. Generally you should change your graphics accordingly so low resolution devices uses low resolution graphics (which takes up less space) and high resolution devices uses high resolution graphics (which takes up more space).

A: Yes we still need it but not in every case.
If you are using native code then memory allocated by c compiler does not include in this limit.So you can provide more memory to your application essential component.
and second way is to using Texture to draw images using OpenGL.then memory for these Texture does not include from limited memory.
But these technique can not be implement in every case
One more important thing , you can not use these 30 MB completely also.Only 30 % of it is usable for one application .


text:
Q: What is the best/easiest way to change the RAID configuration of a Windows Server and Restore it to its last working configuration with more space? I have a Dell Server with 6 1TB Drives in it. Currently the drives are configured into two RAID groups:
Existing
Group 1: 2 x 1TB in RAID 1  (1TB Usable) C: Drive (Windows 2008 r2 Boot Partition NTFS)
Group 2: 4 x 1TB in RAID 10 (2TB Usable) E: Drive (NTFS)
I would like to change the RAID Configuration to
After
Group 1: 6 x 1TB in RAID 5 (5TB Usable) with 2 NTFS partitions on it.
What is the best way to do this?
I am currently thinking of this:

*

*Use clonezilla to image each of the partitions separately.

*Reconfigure the RAID

*Use GParted to create the partitions

*Use Clonezilla to restore the partitions

Is this the best way? Or is there an easier way?

A: Using 3rd party tools to write NTFS filesystems scares me, personally.
I'd copy the contents of the RAID-10 partition to another machine (probably two machines, actually) using something like ROBOCOPY or XCOPY to preserve the permissions and metadata. I'd also make sure I had a good backup.
Then I'd take two backups of the RAID-1 boot volume using the built-in Windows Backup.  I'd probably test restore one of the backups to another machine (using the restore functionality built into the W2K8 installation media) just to make sure it's good.
Then I'd reconfigure the RAID on the server and restore the Windows Backup of the boot volume (partitioning as I'd see fit... personally I wouldn't make two partitions but you can do what you want).
Finally, I'd copy back over the data from the backup copy I made of the RAID-10 volume using the same tools to preserve the permissions and metadata.
That can all be accomplished using Microsoft tools only and doesn't use any unsupported NTFS implementations. Call me paranoid if you will.
As an aside: I'd create a RAID-6 volume on those disks but not a RAID-5. That's just too big to trust to RAID-5 and bit-error rates.

A: If this is a hardware-level RAID reconfiguration (going into the PERC config and rebuilding the RAID volume) as opposed to just a partition resizing, you are going to have to rebuild the server with the RAID-5 config.  Doing what you said in steps 1 and 4 will help this go faster though since you can back up the data per-partition and restore it on the new partitions.  The OS doesn't know or care what the underlying RAID config is, it just knows about the partitions available to it.


text:
Q: How to Get SubView I have a UIScrollView which has added viewController.view .How to get subview in scroll view.
Everyone Any ideas?
Thanks

A: if you want to add your view in scroll view then:
[yourScrollView addSubview:yourSubView];

and if you want to get that view then you can :
if ([yourScrollView subviews])
    {
        for (UIView *subview in [yourScrollView subviews])
        {
            if ([subview isKindOfClass:yourClassName])
            {
                //Code
            }
        }
    }

A: Since UIScrollView inherits from UIView, you can use -addSubview:.

A: [yourscrollview subviews]; // This gives you all subviews added

If you want to add subviews then you can use the -addSubview method.
You can get all this info from the documentation.


text:
Q: Card flip not showing back. Front stays visible when flipped I am trying to create a flip card to maximize space on a webpage. When I toggle the flipCard function, the card flips but doesn't show the back and the front remains visible but is mirrored. Does anyone know why this is happening? The front of the card will consist of headings and the back is a UL.
Thanks for any help and your time!

const card = document.getElementById("card")

card.addEventListener("click", flipCard);

function flipCard() {
  card.classList.toggle("flipCard");
}
.cards {
    background: linear-gradient(
    to bottom,
    rgba(52, 52, 52, 0.4),
    rgba(52, 52, 52, 0.1));
    backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.8s ease;
    z-index: 10;
    perspective: 1000px;
    width: 400px;
}

.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    backface-visibility: hidden;
    z-index: 0;
}

.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    z-index: 0;
}

.flipCard {
    transform: rotateY(180deg);
}

.card.b {
    flex-direction: column;
}

.ul-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    font-size: 12px;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    padding: 3px;
    grid-gap: 0.5rem;
    position: relative;
}

.d {
    grid-column: 2;
    grid-row: 6;
    padding: 0 2rem;
}

.d li {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
}

                    This is the front!

SM.PINKY

(1) $1.50

(6) $8.50

(12) $16

PINKY

(1) $1.50

(6) $8.50

(12) $16

FUZZY

(1) $2.00

(6) $11.50

(12) $22

HOPPER

(1) $2.50

(6) $14.50

(12) $28

SMALL

(1) $3.00

(6) $17.50

(12) $34

MEDIUM

(1) $3.50

(6) $20.50

(12) $40

LARGE

(1) $4.00

(6) $23.50

(12) $46

JUMBO

(1) $4.50

(6) $26.50

(12) $52

A: I am not sure why but removing the backdrop-filter makes it work.
Please read more about this problem from this post
You can use -webkit-backdrop-filter: blur(10px); as a work around,
I haveupdated the code...

const card = document.getElementById("card")

card.addEventListener("click", flipCard);

function flipCard() {
  card.classList.toggle("flipCard");
}
.cards {
    background: linear-gradient(
    to bottom,
    rgba(52, 52, 52, 0.4),
    rgba(52, 52, 52, 0.1));
    /*backdrop-filter: blur(10px);*/
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.8s ease;
    z-index: 10;
    perspective: 1000px;
    width: 400px;
}

.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    backface-visibility: hidden;
    z-index: 0;
}

.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    backface-visibility: hidden;
    z-index: 0;
}

.flipCard {
    transform: rotateY(180deg);
}

.card.b {
    flex-direction: column;
}

.ul-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    font-size: 12px;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    padding: 3px;
    grid-gap: 0.5rem;
    position: relative;
}

.d {
    grid-column: 2;
    grid-row: 6;
    padding: 0 2rem;
}

.d li {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
}

                    This is the front!

SM.PINKY

(1) $1.50

(6) $8.50

(12) $16

PINKY

(1) $1.50

(6) $8.50

(12) $16

FUZZY

(1) $2.00

(6) $11.50

(12) $22

HOPPER

(1) $2.50

(6) $14.50

(12) $28

SMALL

(1) $3.00

(6) $17.50

(12) $34

MEDIUM

(1) $3.50

(6) $20.50

(12) $40

LARGE

(1) $4.00

(6) $23.50

(12) $46

JUMBO

(1) $4.50

(6) $26.50

(12) $52

A: Might not be 100% efficient but this does what you describe

const card = document.getElementById("card")

card.addEventListener("click", flipCard);

function flipCard() {
  let cInner = card.querySelector('.card-flip-inner');
  let cfront = card.querySelector('.card-front');
  let cback = card.querySelector('.card-back');
  cInner.classList.toggle("flipped");
  cfront.classList.toggle("hidden-card");
  cback.classList.toggle("shown-card");
}
.cards {
  background: linear-gradient( to bottom, rgba(52, 52, 52, 0.4), rgba(52, 52, 52, 0.1));
  backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
  transform-style: preserve-3d;
  z-index: 10;
  perspective: 1000px;
  width: 400px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: all 0.8s ease;
  /*transition: transform 0.8s;*/
  transform-style: preserve-3d;
}

.flipped {
  transform: rotateY(180deg);
}

.card-front {
  position: absolute;
  width: 100%;
  height: 100%;
  text-align: center;
  backface-visibility: hidden;
  z-index: 0;
}

.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  z-index: 0;
}

.flipCard {
  transform: rotateY(180deg);
}

.card.b {
  flex-direction: column;
}

.ul-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  font-size: 12px;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  padding: 3px;
  grid-gap: 0.5rem;
  position: relative;
}

.d {
  grid-column: 2;
  grid-row: 6;
  padding: 0 2rem;
}

.d li {
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
}

.shown-card {
  visibiiity: visible;
  backface-visibility: hidden;
}

.hidden-card {
  visibiiity: visible;
  backface-visibility: hidden;
}

        This is the front!

SM.PINKY

(1) $1.50

(6) $8.50

(12) $16

PINKY

(1) $1.50

(6) $8.50

(12) $16

FUZZY

(1) $2.00

(6) $11.50

(12) $22

HOPPER

(1) $2.50

(6) $14.50

(12) $28

SMALL

(1) $3.00

(6) $17.50

(12) $34

MEDIUM

(1) $3.50

(6) $20.50

(12) $40

LARGE

(1) $4.00

(6) $23.50

(12) $46

JUMBO

(1) $4.50

(6) $26.50

(12) $52


text:
Q: Android Image Recognition API/library (not in the cloud) I have searched for a good Android Image Recognition API/library. I found some but they don't suit me because we have to put images on their server. I want one that allows you to search on your own server.
I have a list of products (name + image) in my database. I want to allow the user to snap a picture with his mobile and get related products images.
EDIT
After searching, I haven't found a library that can completely suit my need (searching on your own server). But I found one that is perfect compared to others (attach metadata to images with json, upload multiple images for an item): Kooaba. Unfortunately, there is not an Android library for Kooaba. Would be awesome if you can recommend something like Kooaba for Android.

A: Opencv is  a computer vision set of libraries written in C++ by intel.It has a version for android i have used it but u need to have android phone as latest as possible.because with the version 2.2 and 2.3 you will only be able to run CV Camera App.So i would say a device with API level 11 or higher is better.
It is best suited if you use it in linux

*

*setup linux(Ubuntu)

*Download the Android SDK for Linux

*Download the Android NDK for linux

*Download the OpenCV for Android

*Here are tutorials For-API8 and For-API11 for Stanford University to get you started with opencv and android

*Another page from stanford to get some help

Hope that it helps

A: You can use OpenCV sdk for image detection. If you just wanted to recognise face then use androids own class refer this link http://www.developer.com/ws/android/programming/face-detection-with-android-apis.html

A: What about moodstocks.com ? It's a nice library and works like a charm


text:
Q: Object Required on Copy Paste from Different Sheet I'm trying to copy a range from a sheet and then transpose + paste it into another sheet in the same workbook but for some reason am getting an

object required error

on the initial .Copy line. Could someone explain this to me?
Sub Clean()
    Dim tRow As Double
    Dim bRow As Double
    Dim PasteRange As Double

    tRow = 5

    With ThisWorkbook.Worksheets("Canadian").Activate
        bRow = Cells(Rows.Count, "A").End(xlUp).row
        Worksheets("Canadian").Range(.Cells(tRow, "A"), .Cells(bRow, "A")).Copy
        PasteRange = (bRow - tRow)
    End With

    With ThisWorkbook.Worksheets("SectorSort").Activate
        .Range(.Cells(7, "D"), .Cells(7, PasteRange + 4)).PasteSpecial (xlPasteValues), Transpose:=True
    End With
End Sub

A: There were a couple changes needed:
Sub Clean()

    Dim tRow As Long: tRow = 5
    Dim bRow As Long

    With ThisWorkbook.Worksheets("Canadian")
        bRow = .Cells(.Rows.Count, "A").End(xlUp).row
        .Range(.Cells(tRow, "A"), .Cells(bRow, "A")).Copy
    End With

    With ThisWorkbook.Worksheets("SectorSort")
        .Range("D7").PasteSpecial Paste:=xlPasteValues, Transpose:=True
    End With

End Sub

Needed to remove .Activate
Add the . before Range and Cells because you are in a With statement
And also you can just target a single cell when pasting

A: change
With ThisWorkbook.Worksheets("Canadian").Activate

into
With ThisWorkbook.Worksheets("Canadian")

Same for the next With (regarding "SectorSort")


text:
Q: Using Ajax to display CSS and HTML from external webpage I am developing a portfolio website. A friend of mine happens to have a lot of the same projects and hackathons. To make it easier to manage, we are going to host the 'Blog' data on one website and both me and him want to display the data on our domains. We are trying to use ajax for this. Here is my current code:
    $(document).ready(function(){
    $("button").click(function(){
        $("#box").load("http://individual.utoronto.ca/jollyredflames/ #Education");
    });
});

This is just a tester to get a simple text element which points to an
Education
. However, the code above does not retrieve this content. I believe this is due to some error in writing the URL to tell it to go to an external page (very similar code to get content from the local domain works fine). How can I fix this code?
Is there a better plugin or architecture so both me and my friend can pull from a common blog and host it on our individual websites?
Thank You


text:
Q: How to send both a file and JSON data to the server tl;dr:
Using Angular 6 on the front end and PHP with Phalcon on the backend, I can send JSON data or a File with no problem but I am having a problem sending both in the same request.

Previously I was sending JSON data to the server using something like this
const HTTP_OPTIONS = {
  headers: new HttpHeaders({
    'Content-Type': 'application/json'
  }),
  observe: 'response'
};

post(endPoint: string, body: object): Observable<any> {
    return this.http.post<any>(this.apiUrl + endPoint, body, HTTP_OPTIONS)
      .pipe(
        tap(result => this.log(JSON.stringify(result, null, 2))),
        catchError(this.handleError('post', []))
      );
}

And I was able to get the data from PHP using Phalcon with
$app = new \Phalcon\Mvc\Micro();
$app->post('/upload', function() use ($app) {

    $input = $app->request->getJsonRawBody();
    // $input now contains my JSON data
});

Some time later, I needed to send a file so I used this answer with some minor modifications:
postFile(fileToUpload: File, endpoint: string): Observable<any> {
    const formData: FormData = new FormData();
    formData.append('fileKey', fileToUpload, fileToUpload.name);
    return this.httpClient
      .post(endpoint, formData, { headers: {'Authorization': this.jwt} }).pipe(
        tap(result => this.log(JSON.stringify(result, null, 2))),
        catchError(this.handleError('post', []))
      );
  }

And I received my file with no problems using the documentation as a guide:
$app->post('/uploads', function() use ($app) {
    if ($app->request->hasFiles() == true) {
        foreach ($app->request->getUploadedFiles() as $file) {
            $file->moveTo('files/' .$file->getname());
        }
    } else {
      $app->response->setStatusCode(400)->sendHeaders();
      $app->response->setJsonContent(['error' => 'no file']);
      return $app->response;
    }
});

The problem: Now I would like to send both a file and some JSON data at the same time. I can always just upload the file and then send the data separately but I don't think that's the right way to do it. I don't want to make more than the minimum number of network calls.
What I've tried: Using the file upload code and simply appending another field to my FormData object with my JSON data
formData.append('fileKey', fileToUpload, fileToUpload.name);
formData.append('data', JSON.stringify(data));

and a variation of that
formData.append('fileKey', fileToUpload, fileToUpload.name);
formData.append('data', new Blob([JSON.stringify(data), {type: 'application/json'}]);

Either way, on the backend I can get the file but $app->request->getJsonRawBody and $app->request->getRawBody are empty.
I also tried using the original JSON-sending code and just changing a bit to include the file but with no success.
post(fileToUpload: File, data: CustomData): Observable<any> {
    this.messageService.add('uploaded file');

    const formData: FormData = new FormData();
    formData.append('fileKey', fileToUpload, fileToUpload.name);
    formData.append('data', JSON.stringify(data), 'data');

    return this.http
      .post(this.apiUrl + 'uploads/', {'data': data, 'file': fileToUpload}, HTTP_OPTIONS).pipe( // file is empty on the server like this
        tap(result => this.log('POST file :\n' + JSON.stringify(result, null, 2))),
        catchError(this.handleError('post', [], 'fileUpload'))
      );
  }

I can easily send either my JSON data or the file but not both.
I searched the Phalcon documentation and several QAs on sending files and/or JSON with Angular but I cannot figure out how to make this work.

A: You are sending json as text in post request, so instead of $app->request->getJsonRawBody you should try something like
$rawJson=$app->request->getPost('data');
$object=json_decode($rawJson);

A: you can get your json as @Błażej Kowalczyk said
$this->request->getPost()

and you can check for files and get them
if ($this->request->hasFiles()) {
    foreach ($this->request->getUploadedFiles() as $file) {
        // $file is an instance of Phalcon\Http\Request\File
        var_dump($file->getName());
    }
}

check these pages for more information
https://docs.phalconphp.com/3.4/en/api/phalcon_http_request
https://docs.phalconphp.com/3.4/en/api/phalcon_http_request_file


text:
Q: How to override Web service url in http request node in IIB I'm trying to override the default RequestURL on an HTTP request node in an IIB request flow but it doesn't work.
I have tried setting the following value in a computation esql node before I call the "request node" but it doesn't work.

SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://mytseturl.com/sadf'

A: Check a Compute Mode property for used compute node. It must consists LocalEnvironment. More about Compute Mode here - Setting the mode

A: Double Click on the HTTP request node and insert the URL.


text:
Q: RGeo::Geos.supported? true in irb but false with bundler in macOS mojave In macOS mojave gem install rgeo installs and in irb RGeo::Geos.supported? returns true
Now after doing bundle install and going to rails console via bundle exec rails c, it returns false.
How to resolve this issue with bundler and rgeo geos support?

A: I was having the same problem and I solved it by deleting my bootsnap cache, so if you're also using bootsnap this might work:
rm -rf tmp/cache/bootsnap-*


text:
Q: oledbcommandbuilder.driveparameters get duplicate stored proceduer parameters count After importing new dump to oracle db, oledbcommandbuilder.driveparameters which exist in sqlhelperparametercache class return duplicate parameter count which cause exception:

parameter count doesn't match parameter value count

Currently I have to use schema/owner name  to get valid parameter count number for a procedure
while I wasn't before .
Any suggestion?

A: You must use owner name if you have multiple schemas with the same structure or it will get this error because it considers each procedure in each schema diffrent so it will return the sum of thier input parameters.


text:
Q: Combination of various powers of $\sin\theta$. I'm confusing about a question:

For three positive constants $A$, $B$, $C$, find $\theta$ (express in $A$, $B$ and $C$).
$$A\sin^6\theta - A\sin^4\theta + B\sin^2\theta -C = 0$$

So, when I do it the trigonometric way,
$A\sin^4\theta(\sin^2\theta-1) + B\sin^2\theta - C = 0$
$-A\sin^4\theta\cos^2\theta + B\sin^2\theta -C = 0$
$-\frac{A}{4}\sin^2\theta\sin^22\theta +B\sin^2\theta -C = 0$
I found myself unable to continue.
Anyone get some ideas? Appreciate your help.

A: Taking $x=\sin \theta\implies$ $$Ax^3-Ax^2+Bx-C=0\\\implies x^3-x^2+Dx-E=0,\ D:=\frac{B}{A},\ E:\frac{C}{A}$$ Now use Cardano's method to solve this cubic equation to solve for $x$ and hence finally get $\theta$.


text:
Q: Relative cup product commute with restriction operator This is a followup to my previous question here.
Let $A$ and $B$ be subspaces of a space $X$. We have the relative cup product$$H^p(X, A) \otimes H^q(X, B) \to H^{p+q}(X, A \cup B).$$How do I see that the following diagram is commutative?$$\require{AMScd}
\begin{CD}
H^q(X, A) \otimes H^q(X, B) @>>> H^{p+q}(X, A \cup B)\\
@VVV     @VVV     \\
H^p(X) \otimes H^q(X) @>>> H^{p+q}(X)
\end{CD}
$$The horizontal arrows are cup products; the vertical arrows are induced from $X \to (X, A)$, and so forth. Here, we take cohomology with coefficients in a commutative ring $R$ and we write $\otimes$ for $\otimes_R$.

A: It's completely immediate from the definition of the relative cup-product (cf. the answer to your other question). The relative cup-product is defined as the map induced in cohomology by the unique map that makes the following diagram commute (it's the upper horizontal one, the second horizontal map is a quasi-isomorphism so you can invert it in cohomology):
$$\require{AMScd}
\begin{CD}
C^p(X,A) \otimes C^q(X,B) @>{\smile}>> C^{p+q}(X, A+B) @<{\sim}<< C^{p+q}(X, A \cup B) \\
@VVV @VVV @VVV \\
C^p(X) \otimes C^q(X) @>{\smile}>> C^{p+q}(X) @<{=}<< C^{p+q}(X)
\end{CD}$$
and so the diagram in cohomology commutes too.


text:
Q: Safari does not load the javascript on my website I have created a website that works fine on chrome. However, when trying to view the website on safari the website does not load the javascript for some reason and I have no idea what to do.
You can view the website here

A: Safari is extremely picky with syntax errors (which will give you a notorious blank white screen), including HTML parsing errors, for which Chromium will compensate by overlooking them. Read your code closely and ensure no syntax errors. It would be helpful to have an example.


text:
Q: QT 5.2 'QObject' is an ambiguous base of FilmInput I am trying to use 'QMetaObject' to print the information in a 'Film' class using the function in another class  called 'FilmWriter' drawing information from a GUI coded in a third class, 'FilmInput'.
However, ever since I added the Q_PROPERTIES in the base Film class, I am getting an "'QObject' is an ambiguous base of FilmInput'" error message located in both lines where I connected the QPushButtons to the Print_Data() and quit() functions.
My Film.h file:
#ifndef FILM_H
#define FILM_H

#include <QDate>
#include <QObject>

class Film : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString title READ getTitle WRITE setTitle)
    Q_PROPERTY(QString director READ getDirector WRITE setDirector)
    Q_PROPERTY(QDate releaseDate READ getReleaseDate WRITE setDate)
    Q_PROPERTY(int length READ getLength WRITE setLength)

public:
    Film();
    Film(QString MN, QString DIR, int LEN, QDate RD);

    void setTitle(QString t);
    void setDirector(QString dir);
    void setDate(QDate rd);
    void setLength(int len);

    QString getTitle() const;
    QString getDirector()const;
    QDate getReleaseDate() const;
    int getLength() const;

private:
    QString title;
    QString director;
    QDate releaseDate;
    int length;
};
#endif // FILM_H

My Film.cpp file
#include "film.h"

//basic constructor
Film::Film()
{
    title = QString();
    director = QString();
    releaseDate = QDate();
    length = 0;
}
//overloaded constructor
Film::Film(QString MN, QString DIR, int LEN, QDate RD)
{
    title = MN;
    director = DIR;
    releaseDate = RD;
    length = LEN;
}

//4 accessors
QString Film::getTitle() const
{
    return title;
}

QString Film::getDirector() const
{
    return director;
}

QDate Film::getReleaseDate() const
{
    return releaseDate;
}

int Film::getLength() const
{
    return length;
}

//4 setters
void Film::setTitle(QString t)
{
    title = t;
}

void Film::setDirector(QString dir)
{
    director = dir;
}

void Film::setDate(QDate rd)
{
    releaseDate = rd;
}

void Film::setLength(int len)
{
    length = len;
}

My FilmInput.h file:
#ifndef FILMINPUT_H
#define FILMINPUT_H

#include <QWidget>
#include <QApplication>

#include <QLabel>
#include <QSpinBox>
#include <QDateEdit>
#include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QLine>

#include "film.h"
#include <filmwriter.h>

class FilmInput : public QApplication, public Film, public FilmWriter
{
    Q_OBJECT
public:
    FilmInput(int argc, char* argv[]);

    void obtain_Film_Data();

public slots:
    //creating a SLOT function
    void Print_Data();

private:
    //initializing an Object of Type Film
    Film T2;

    //creating the pointers for the input boxes
    QLineEdit *NMX;
    QSpinBox *LENX;
    QLineEdit *DIRX;
    QDateEdit *RDX;

};
#endif // FILMINPUT_H

My FilmInput.cpp file:
#include "filminput.h"
#include <QDebug>
#include <QVBoxLayout>

FilmInput::FilmInput(int argc, char* argv[]) : QApplication(argc, argv)
{
    QWidget *w = new QWidget;
    w->resize(350,200);
    w->setWindowTitle("Film Data");
    w->show();

    //create Headers
    QLabel *NML = new QLabel("Name of Movie:");
    QLabel *DIRL = new QLabel("Name of Director");
    QLabel *LENL = new QLabel("Length:");
    QLabel *RDL = new QLabel("Release Date:");

    //initializing the input functions
    NMX = new QLineEdit;
    LENX = new QSpinBox;
    DIRX = new QLineEdit;
    RDX = new QDateEdit;

    //create Buttons
    QPushButton *Print = new QPushButton("Print"); //Prints/saves to File
    QPushButton *Exit = new QPushButton("Exit"); //closes Program. Just adding for convenience

    //creating a grid to build the layout
    QGridLayout *Grid1 = new QGridLayout;

    //placing labels, buttons and input slots in the grid
    Grid1->addWidget(NMX,0,1);
    Grid1->addWidget(NML,0,0);
    Grid1->addWidget(DIRX,1,1);
    Grid1->addWidget(DIRL,1,0);
    Grid1->addWidget(LENX,2,1);
    Grid1->addWidget(LENL,2,0);
    Grid1->addWidget(RDX,3,1);
    Grid1->addWidget(RDL,3,0);
    Grid1->addWidget(Print,4,3);
    Grid1->addWidget(Exit,5,3);

    w->setLayout(Grid1);

    //connecting the 2 Buttons
    w->connect(Print,SIGNAL(clicked()),this,SLOT(Print_Data()));  //Error found here
    w->connect(Exit,SIGNAL(clicked()),this,SLOT(quit()));         //Error found here

}

void FilmInput::obtain_Film_Data()
{
    T2.setDirector(DIRX->text());
    T2.setTitle(NMX->text());
    T2.setLength(LENX->value());
    T2.setDate(RDX->date());
}

//setting up the SLOT function
    //Print_Data will run the obtain_Film_Data function to get the data, then runs the saveFilm
    //Function to print it to the file
void FilmInput::Print_Data()
{
    obtain_Film_Data();
    saveFilm();
}

My FilmWriter.h file:
#ifndef FILMWRITER_H
#define FILMWRITER_H

#include "film.h"

#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QMetaObject>
#include <QVariant>

class FilmWriter: public Film
{
    Q_OBJECT
public:
    FilmWriter();

    void saveFilm(/*Film f*/ QObject *f);

};

#endif // FILMWRITER_H

my FilmWriter.cpp file:
#include "filmwriter.h"

FilmWriter::FilmWriter()
{

}

void FilmWriter::saveFilm(/*Film f*/ QObject *f)
{

    //create a text file to store the data if there isn't one already present. It will be found in the 'build' file
    //new Data will be added at the end of the file
    QFile Text_File_Name("Saved_Movie_Data.txt");
    Text_File_Name.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text);

    //storing the Data in the File
    QTextStream Text_Out(&Text_File_Name);
    QMetaObject Data = f->metaObject();
    for(int i = Data->propertyOffset();i<Data->propertyCount(); i++)
    {
        const QMetaProperty prop = Data->property(i);
        QString name = prop.name();
        QVariant value = prop.read(Data);
        QString valStr = value.toString();
    }
    //below is old code from before trying to use QMetaObject class
//    Text_Out <<endl << endl << "Movie Name: " << f.getTitle() << endl;
//    Text_Out << "Director Name: " << f.getDirector() << endl;
//    Text_Out << "Movie Length: " << f.getLength() << " Minutes" << endl;
//    Text_Out << "Release Date: " << f.getReleaseDate().toString("yyyy-MM-dd") << endl;

    //closing the text file
    Text_File_Name.close();
}

lastely my main.cpp file which I use to get the program going
#include <QApplication>
#include "filminput.h"

int main(int argc, char* argv[])
{
    FilmInput app(argc, argv);
    return app.exec();
}

as mentioned above, QT creator detects an error in the two 'connect' functions in the FilmInput.cpp file.
Could anyone tell me how to resolve those 2 issues please?


text:
Q: Is there any way to get ONLY the selects inputs from a form? I need to get the name and value from many selects with POST, like this:
foreach ($_POST as $key => $value) {
    // do stuff
}

The problem is I have other input types in this same form, like a checkbox, for example. I want to get in this foreach only the selects (I can't call by name cuz' each select have one name)

A: I guess if all your parameters are in an array yes you can, for example, in your HTML you have something like :
<input type="text" name="data['first_name']" value="something"/>
<input type="text" name="data['last_name']" value="somethingElse"/>

in your PHP code, you can use a foreach like so :
foreach( $_POST['data'] as $data )
{
    var_dump($data);
}

A: The input element types are not sent to the server with your POST data.  Only the names and values are.
The only way to differentiate would be to send additional data, such as a list, or by naming the inputs differently.
Really though, you shouldn't be POSTing data that you don't care about anyway.  Save bandwidth, hide the elements that go nowhere with JavaScript on POST.

A: Only way to do that server side is to know exactly which inputs are selects and iterate through these.
$selects = array('select1', 'select2', ...);
foreach ($selects as $select) {
    $value = $_POST[$select];
    // do stuff
}

A: If you know the name of the select inside form you can do this
Your HTML:
<form>
<select name='selectName1'>
<option value='xx'>xx</option>
<option value='xx'>xx</option>
</select>
<select name='selectName2'>
<option value='xx'>xx</option>
<option value='xx'>xx</option>
</select>
</form>

Your PHP code
$arraySelect = array('selectName1', 'selectName2', ...);

foreach($_POST as $key=>$value)
    if(in_array($key, $arraySelect))
       $$key = $value; //this will create a variable with the name you use, in this case $selectName1, $selectName2. And the option the user selected will be assigned.


text:
Q: Setting image for tabbarcontroller? Is any way to set image for tabbarcontroller ? Means a common background image for all the tab ?
Thanks

A: The TabBar Controller is not visible to the user. What the user can see is the TabBar itself. That's just to avoid misunderstandings. For your question: There is no officialy supported way, sorry.


text:
Q: How do I make a thread wait until a file is created? I need a thread to wait until a file is exist or created.
I have the following code so far:
while(!receivedDataFile.isFileExists("receiveddata.txt"))
{
    try {
        Thead.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
        return null;
    }
}

When I run it, the following exception appears, and the thread ends:
java.lang.InterruptedException: sleep interrupted

A: A thread is interrupted when it is blocking (the call to sleep) and another thread calls its interrupt method.  The call to interrupt must be made explicitly for this to happen.
Seems that repeating the check for the file would be the logical thing to do if the thread is interrupted, but without knowing the cause of the interruption it's hard to say.
As usual, when it comes to threading, Brian Goetz has something to say on the matter of InterruptedException:
http://www-128.ibm.com/developerworks/java/library/j-jtp05236.html

A: I must agree Bombes comment: threads don't get interrupted on their own. Contrary to Jokis comment - they're not interrupted when a thread context swap takes place either (in fact, if a thread sleeps, it will surrender it's quantum to any thread that has work to do, but I digress).
Furthermore, I would advise an alternative means of communication than polling for files. You cannot be certain, for example, that once you have spotted a file, that it has been completely written without extra work from the file-writer (such as renaming it when ready, or creating a 'ready' file).
Consider using something more 'data push' such as RMI, HTTP-POST, JMS queues, etc.

A: You should find out which thread interrupts that thread. Threads don't do that on their own.

A: If all you want is a notification when a file is created, AND you can (and willing) to go native (JNI) AND you want only win32 support, you could use the code here.

A: Well, if you don't know what InterruptedException is and/or don't want to do anything about it, obviously you should at least do something besides returning and exiting your loop.  Take out the return, and then you'll keep waiting.
But I'd check into why you're getting interrupted.  Something is trying to cancel your thread.


text:
Q: writing to sdcard not working I am running Android in Eclipse. the following line (from Camera.demo)
outStream = new FileOutputStream(String.format("/sdcard/%d.jpg",
    System.currentTimeMillis()));

fails and returns the following error:-
FileNotFound - permission denied.

Is there anything I can do to correct this?    I have assumed that the sdcard directory is present in the emulator.
Thanks
Ron

A: The AVD you're running has to be explicitly configured with SD card support or it will behave as if there isn't one.  More information here.
Your application also needs the WRITE_EXTERNAL_STORAGE permission.
Side note:  You should be calling Environment.getExternalStorageDirectory() to get the SD card's path instead of hard-coding /sdcard.  It returns null if there's no storage available.  You can use the canWrite() method on the returned value to determine if it's actually something you can use for storage.


text:
Q: Laravel Lighthouse pass data from parent to child Having a nested field will call a few methods with this signature:
        $_,
        array $args,
        GraphQLContext $context,
        ResolveInfo $resolveInfo

$_ would be the parent data but you can't send anything from parent to the child, using that obviously so you have to use $resolveInfo somehow I guess.
Here's an example let's say we have a parent at properties and a child at properties.data
Here are the two functions
<?php

namespace App\GraphQL\Queries;

use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;

final class PropertiesFiltered
{
    /**
     * @param null $_
     * @param array{} $args
     */
    public function parent(
        $_,
        array $args,
        GraphQLContext $context,
        ResolveInfo $resolveInfo
    ) {
        // Attempt 1
        $resolveInfo->lookAhead()->queryPlan()["data"]["args"]["ok"] = true;
        // Attempt 2
        $resolveInfo->argumentSet->addValue("properties.data.ok", true);

        return [
            "facets" => [
                "rooms" => [
                    "step" => "1",
                ],
            ],
        ];
    }

    /**
     * @param null $_
     * @param array{} $args
     */
    public function child(
        $_,
        array $args,
        GraphQLContext $context,
        ResolveInfo $resolveInfo
    ) {
        dd($resolveInfo->argumentSet->toArray());
    }
}

None of my attempts worked in the child I always get:
array:2 [
  "first" => 0
  "page" => 10
]

which means ok doesn't get added.

A: $_, the first argument is the actual parent,
So for the parent resolver, let's say you have:
    public function parent(
        $_,
        array $args,
        GraphQLContext $context,
        ResolveInfo $resolveInfo
    ) {
        return [
            "ok" => true,
            "facets" => [
                "rooms" => [
                    "step" => "1",
                ],
            ],
        ];
    }

Don't worry, in the final json response, the ok property will be cleaned up by lighthouse.
However, before that, it is passed "as-id" to the child resolvers as the parent argument. So you can get back your value in you child resolver as following:
    /**
     * @param null $_
     * @param array{} $args
     */
    public function child(
        $parent,
        array $args,
        GraphQLContext $context,
        ResolveInfo $resolveInfo
    ) {
        dd($parent['ok']); // true
    }

Of course, this only works as direct parent->child relation


text:
Q: Using R for web scraping I need to get the list from a lot of webpages like this: https://fossilplants.info/genus.htm?page=3
I tried to do that using several R packages, such as rvest and XML, but didn't figure out how to make it work. Could anyone help me on that? Thanks so much.

A: We can use rvest like :
library(rvest)
library(purrr)

url <- 'https://fossilplants.info/genus.htm?page=3'

url %>%
  read_html() %>%
  html_nodes('h1') %>%
  html_text() %>%
  gsub('[\r\n\t]', '', .)

# [1] "Genus Abies-pollenites Thierg. in Raatz Abh. Preuss. Geol. Landesanst., Neue Folge, (183): 16.  26 Jan 1938"
# [2] "Genus Abieticedripites Maljavk. Trudy Vsesoyuzn. Neft. Nauchno-Issl. Geol.-Razved.  Inst., N. S., (119): 103.  11 Jul 1958"
# [3] "Genus Abietineae-pollenites R. Potonié Palaeontographica, Abt. B, Paläophytol., 91(5-6): 144, 145.  Apr 1951"
# [4] "Genus Abietineaepollenites R. Potonié in Delcourt, Sprumont Mém. Soc. Belge Géol.,  N. Sér. 4°, (5): 51.  1955"
# [5] "Genus Abietipites Wodehouse Bull. Torrey Bot. Club, 60(7): 491.  Oct 1933"
# [6] "Genus Abietites Maljavk. Trudy Vsesoyuzn. Neft. Nauchno-Issl. Geol.-Razved.  Inst., N. S., (231): 142.  10 Aug 1964"
# [7] "Genus Abietites Hising. Lethaea Svecica 110.  7 Dec 1836"
# [8] "Genus Abietopitys Kräusel Beitr. Geol. Erforsch. Deutsch. Schutzgeb., (20): 32.  11 Aug 1928"
# [9] "Unranked Abietosaccites Erdtman Svensk Bot. Tidskr., 41(1): 110.  26 Mar 1947"
#[10] "Genus Abietoxylon  73.  "

If you want to do this for multiple pages, you can change the url like and perform the same function.
map(1:3, ~{
   url <- sprintf('https://fossilplants.info/genus.htm?page=%d', .x)
   url %>%
     read_html() %>%
     html_nodes('h1') %>%
     html_text() %>%
     gsub('[\r\n\t]', '', .)
}) %>% flatten_chr()


text:
Q: Git does not recognize user.name and user.mail (Windows 10) I have run into a weird situation with git in windows 10.
Although I have set my details using
git config --global user.name "My name"
git config --global user.email my@email.com

I keep getting this warning message whenever I try to commit:
Committer: "my_pc_username" <"my_pc_hostname">
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.

The the commit author is indeed set with these details instead of the ones I set.
I have also run git config with --system as well as with no option switch just to be sure. Still the message persists.
I have also checked and both the .gitconfig file in C:/Users/myuser and the config file within the repo have the following section
[user]
    name = My Name
    mail = my@email.com

Finally, whenever I check with:
git config user.name
git config --global user.name
git config --system user.name

I get the right answer (My Name). Same for user.mail.
I am using git bash 2.7.3.
I would really appreciate your help.

A: Your .gitconfig show a "mail" not "email" field, i think you like me falled in a duplicated of this
the right field is "email" perhaps you like me mistyped it when issued the command


text:
Q: Excel - How can you find the exact match of a table row in a separate table if it exists? I have a spread sheet with two tables:

I want to find every "row" in table1 that exists as an exact match in table2 using a formula. For example, you can see I have one row in the "matches" table to the right.
So far, I can check for exact matches on a per row basis(this is an Array formula entered using ctrl+shift+enter):
=AND(EXACT(A3:B3,D3:E3))

How can I do that for the entire range in Excel?

A: Using a helper column.  In F3 put this formula:
=IF(COUNTIFS(A:A,D3,B:B,E3)>0,MAX($F$2:F2)+1,"")

and copy down.  It will fill all duplicates with an increasing number.

Then you can use this formula in G3:
=IFERROR(INDEX(D:D,MATCH(ROW(1:1),$F:$F,0)),"")

Copy it over one column and down sufficient for your needs.

It will populate the list with all duplicates.


text:
Q: Adding Overloaded Constructors to Implicit F# Type I have created the following type using implicit type construction:
open System

type Matrix(sourceMatrix:double[,]) =
  let rows = sourceMatrix.GetUpperBound(0) + 1
  let cols = sourceMatrix.GetUpperBound(1) + 1
  let matrix = Array2D.zeroCreate<double> rows cols
  do
    for i in 0 .. rows - 1 do
    for j in 0 .. cols - 1 do
      matrix.[i,j] <- sourceMatrix.[i,j]

  //Properties

  ///The number of Rows in this Matrix.
  member this.Rows = rows

  ///The number of Columns in this Matrix.
  member this.Cols = cols

  ///Indexed Property for this matrix.
  member this.Item
    with get(x, y) = matrix.[x, y]
     and set(x, y) value =
        this.Validate(x,y)
        matrix.[x, y] <- value

  //Methods
  /// Validate that the specified row and column are inside of the range of the matrix.
  member this.Validate(row, col) =
    if(row >= this.Rows || row < 0) then raise (new ArgumentOutOfRangeException("row is out of range"))
    if(col >= this.Cols || col < 0) then raise (new ArgumentOutOfRangeException("column is out of range"))

However now I need to add the following overloaded constructor to this type (which is in C# here):
public Matrix(int rows, int cols)
    {
        this.matrix = new double[rows, cols];
    }

The problem that I have is that it seems any overloaded constructors in an implicit type must have a parameter list that is a subset of the first constructor.  Obviously the constructor I want to add does not meet this requirement.  Is there any way to do this using implicit type construction?  Which way should I do this?  I'm pretty new to F# so if you could show the whole type with your changes in it I would greatly appreciate it.
Thanks in advance,
Bob
P.S. If you have any other suggestions to make my class more in the functional style please feel free to comment on that as well.

A: I would probably just do this:
type Matrix(sourceMatrix:double[,]) =
  let matrix = Array2D.copy sourceMatrix
  let rows = (matrix.GetUpperBound 0) + 1
  let cols = (matrix.GetUpperBound 1) + 1

  new(rows, cols) = Matrix( Array2D.zeroCreate rows cols )

unless we are talking about very large arrays which are created very often (i.e. copying the empty array becomes a performance bottleneck).
If you want to emulate the C# version, you need an explicit field that can be accessed from both constructors, like so:
type Matrix(rows,cols) as this =

  [<DefaultValue>]
  val mutable matrix : double[,]
  do this.matrix <- Array2D.zeroCreate rows cols

  new(source:double[,]) as this =
    let rows = source.GetUpperBound(0) + 1
    let cols = source.GetUpperBound(1) + 1
    Matrix(rows, cols)
    then
      for i in 0 .. rows - 1 do
        for j in 0 .. cols - 1 do
          this.matrix.[i,j] <- source.[i,j]

BTW, there is also a matrix type in the F# PowerPack.


text:
Q: HD Videos are laggy with Mobility HD 4250 in 11.10 I have an Mobility HD 4250 graphics on my computer. Im trying to watch HD videos 1080p from YouTube, but when watching them, they are very laggy. I have proprietary drivers. I have disabled Sync to VBlank and Detect freshrate from CCSM, and my Ubuntu works fine with those settings, but HD video lag is the only problem with this. When i had Windows, i was able to watch 1080p videos smoothly. Possible to fix this? I use Chrome and i have installed Flash when i installed 11.10.

A: I do the process explained in this answer, and got a little better performance.
Anyway, ATI driver still suck.

A: Just type "VLC" in Ubuntu Software Center to download VLC Media Player.
This multimedia player will enhance bitrate and HD video runs in FLOW.


text:
Q: Excel Clear Office Clipboard after paste multiple I am having an issue where data is not being consistently pasted into my spreadsheet from an outside program.  I have 10 data points that should be pasted into 10 cells, but sometimes I will be missing some.
I recently found that all of the values are being copied to the Office clipboard, I am looking to modify my current macro (below) to check each cell in the row for if it is blank and to then paste the correct value from the clipboard.  I would then like to clear the clipboard so that the code is consistent for each row.
How can I paste multiple/specific items from the clipboard and also how can I clear it afterwards.
I have scoured stack overflow and many other Excel/VBA forums but none of them have a question/answer for clearing the OFFICE clipboard in office 365.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.Calculation = xlCalculationManual
    Dim MyRange As Range
    Dim CurrentRange As Range
    Dim currentrow As Integer

    Set MyRange = Range("R56:R1056")

    If Not Intersect(Target, MyRange) Is Nothing Then

        currentrow = ActiveCell.Row     ' Find the current row in integer format (i.e. 6)
        Columnstart = "C" & currentrow  ' Collate into the start column (i.e. C6)
        Columnend = "P" & currentrow    ' Collate into the End column (i.e. M6)
        ' Print values for verification
        ' MsgBox "Current row: " & currentrow & vbNewLine & "Column Start Value 'C': " & Columnstart & vbNewLine & "End Column Value 'M': " & Columnend

        Set CurrentRange = Range(Columnstart & ":" & Columnend)
        'MsgBox CurrentRange ' Check for current range (i.e. C6:M6)
        DataCells = WorksheetFunction.Count(CurrentRange)
        'MsgBox blanks ' Check for how many
        If DataCells < 10 Then
            ' Set the cell value to missing and color to Red
            Range("Q" & ActiveCell.Row).Interior.ColorIndex = 3
            Range("Q" & ActiveCell.Row).Value = "Incomplete"
        Else
            ' Set the cell value to complete then color it green
            Range("Q" & ActiveCell.Row).Interior.ColorIndex = 4
            Range("Q" & ActiveCell.Row).Value = "Complete"
        End If
        Range("C" & ActiveCell.Row + 1).Select ' Move to beginning of next row for next data input
        Calculate
    End If
End Sub

Thanks,
Office 365 Ver2102    (Build 13801.20864)
| Windows 10 Enterprise (Build 19042.1165 )


text:
Q: Getting width and height of image from UIImageView after aspect fit I'm trying to get the width and height of an image from UIImageView after it gets scaled to aspect fit. This is how I got its width and height:
let imageHeight = AVMakeRect(aspectRatio: (transferImage.size), insideRect: imageView.frame).height
let imageWidth = AVMakeRect(aspectRatio: (transferImage.size), insideRect: imageView.frame).width

let imageYposition = AVMakeRect(aspectRatio: (transferImage.size), insideRect: imageView.frame).origin.y
let imageXposition = AVMakeRect(aspectRatio: (transferImage.size), insideRect: imageView.frame).origin.x

Apparently, this gives me the width and height. However, after trying to size an UIView to the same dimensions, they are not the same size. This is how I set the UIView to the width and height of the image:
boundariesRectangle.frame = CGRect(x: imageXposition, y: imageYposition, width: imageWidth, height: imageHeight)

This is what happens:

A: Try this:
guard let image = imageView.image else { return }

// Calculate the scaled size of the image
let scaledRect = AVMakeRect(aspectRatio: image.size, insideRect: imageView.bounds)

// Create the overlay view
let overlayView = UIView(frame: .zero)
overlayView.backgroundColor = UIColor.red.withAlphaComponent(0.5)
overlayView.translatesAutoresizingMaskIntoConstraints = false

// Add the overlay
// To use relate 2 views by auto-layout constraints, they must have the
// same parent view
imageView.superView!.addSubview(overlayView)
overlayView.widthAnchor.constraint(equalToConstant: scaledRect.width).isActive = true
overlayView.heightAnchor.constraint(equalToConstant: scaledRect.height).isActive = true
overlayView.centerXAnchor.constraint(equalTo: imageView.centerXAnchor).isActive = true
overlayView.centerYAnchor.constraint(equalTo: imageView.centerYAnchor).isActive = true


text:
Q: Incrontab output to file not working I've got an incrontab rule set up to react to a file being added to a particular directory on my ubuntu box, and run a script. This works fine, but my goal is to print the output of that script to a file.
I've tried a few different ways to go about it, and the only way I've been able to get it working so far is to take the generated command that incrontab creates, and run it myself. So my thinking is that its possible, I'm likely just missing something obvious to an experience linux user.
I've shortened some of the commands for brevity's sake. "watchdir" "scriptPath" and "arg1" are all paths. I am bringing in two arguments to the script, arg1, and the filename wildcard from the cron job.
I've tried:
(These run the script, but don't output to file)

watchdir IN_CREATE scriptPath arg1 $# >> /home/ubuntu/logs/log-$# 2>&1
watchdir IN_CREATE scriptPath arg1 $# &>> /home/ubuntu/logs/log-$#

(These do nothing at all)

watchdir IN_CREATE /bin/bash scriptPath arg1 $# >>
  /home/ubuntu/log/log-$# 2>&1
watchdir IN_CREATE /bin/bash scriptPath arg1 $# &>>
  /home/ubuntu/log/log-$#

If I run 'tail /var/log/syslog' and grab the command generated from the incrontab below and paste it into the shell, it works fine

watchdir IN_CREATE scriptPath arg1 $# &>> /home/ubuntu/logs/log-$#

This works

scriptPath arg1 mission-LHPUQ7ezcF0s0UwVgUR.txt &>>
  /home/ubuntu/logs/log-mission-LHPUQ7ezcF0s0UwVgUR.txt

Any insight as to what I could be missing?

A: I had a similar problem and found out, that incron simply ignores the output redirection and hands them over to the script as arguments:
https://askubuntu.com/questions/1164166/incrond-does-not-execute-custom-script
So your solution may be to first call a wrapper script that does the output redirection to the log file.

A: If you watch a directory, then $@ holds the directory path and $# the file that triggered the event. If you watch a file, then $@ holds the complete path to the file and $# is empty. Reference.


text:
Q: MSDTC Cancelling EntityFramework Transaction We have an issue where MSDTC is cancelling a transaction from EntityFramework(EF) but unable to find a solution.

ERROR
System.Data.Enity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

Essentially EF is executing a stored procedure on Server A however the stored procedure on Server A also takes data from another server - Server B
I should add this started failing with this error when the stored procedure on server A was amended and transactions to server B were added.
Is this possible under EF? If so, how can we get this to work.
We have tried:

*

*Amending SQL server account permissions for the connection account

*Changing MSDTC timeout config settings


text:
Q: Has Google Talk implemented XEP-0079? Google Talk has implemented XMPP (jabber portocol) but has it implemented XEP-0079 too?
XEP-0079 is an XMPP extention about "Advanced Message Processing".

A: No.
We can use XEP-0030 (Service Discovery) to ask the server at talk.google.com what it features it provides.
XEP-0079 specifies a <feature> of http://jabber.org/protocol/amp but, as we can see from the request/response below, the gmail.com service does not include this feature in its response.

<iq to='gmail.com' type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>

<iq xmlns='jabber:client' from='gmail.com' type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <identity category='server' type='im' name='Google Talk'/>
    <feature var='http://jabber.org/protocol/disco#info'/>
    <feature var='google:jingleinfo'/>
    <feature var='google:roster'/>
    <feature var='google:nosave'/>
    <feature var='google:setting'/>
    <feature var='google:shared-status'/>
    <feature var='http://jabber.org/protocol/archive#otr'/>
    <feature var='google:mail:notify'/>
    <feature var='http://jabber.org/protocol/archive#save'/>
    <feature var='http://jabber.org/protocol/rosterx'/>
  </query>
</iq>

A: To amplify Christopher's answer, not only does Google not implement AMP, there are few others who do, since it doesn't solve enough of the problem.  For something hop-by-hop, consider XEP-0198: Stream Management, which also provides quick reconnect.


text:
Q: Script throws some error at some point within the execution I've created a script in python using pyppeteer to collect the links of different posts from a webpage and then parse the title of each post by going in their target page reusing those collected links. Although the content are static, I like to know how pyppeteer works in such cases.
I tried to supply this browser variable from main() function to fetch() and browse_all_links() function so that I can reuse the same browser over and over again.
My current approach:
import asyncio
from pyppeteer import launch

url = "https://stackoverflow.com/questions/tagged/web-scraping"

async def fetch(page,url):
    await page.goto(url)
    linkstorage = []
    await page.waitForSelector('.summary .question-hyperlink')
    elements = await page.querySelectorAll('.summary .question-hyperlink')
    for element in elements:
        linkstorage.append(await page.evaluate('(element) => element.href', element))
    return linkstorage

async def browse_all_links(page,link):
    await page.goto(link)
    await page.waitForSelector('h1 > a')
    title = await page.querySelectorEval('h1 > a','(e => e.innerText)')
    print(title)

async def main():
    browser = await launch(headless=False,autoClose=False)
    [page] = await browser.pages()
    links = await fetch(page,url)
    tasks = [await browse_all_links(page,url) for url in links]
    await asyncio.gather(*tasks)

if __name__ == '__main__':
    asyncio.run(main())

The above script fetches some titles but spits out the following error at some point within the execution:
Possible to select <a> with specific text within the quotes?
Crawler Runs Too Slow
How do I loop a list of ticker to scrape balance sheet info?
How to retrive the url of searched video from youtbe using python
VBA-JSON to import data from all pages in one table
Is there an algorithm that detects semantic visual blocks in a webpage?
find_all only scrape the last value

#ERROR STARTS

Future exception was never retrieved
future: <Future finished exception=NetworkError('Protocol error (Runtime.releaseObject): Cannot find context with specified id')>
pyppeteer.errors.NetworkError: Protocol error (Runtime.releaseObject): Cannot find context with specified id
Future exception was never retrieved

A: AS it's been two days since this question has been posted but no one yet to answer, I will take this opportunity to address this issue what I
think might be helpful to you.

*

*There are 15 links but you are getting only 7, this is probably websockets is loosing connection and page is not reachable anymore

*List comprehension
tasks = [await browse_all_links(page,url) for url in links] What do expect is this list? If it's succesful, it will be a list
of none element. So your next line of code will throw error!

*

*Solution
downgrade websockets 7.0 to websockets 6.0
remove this line of code await asyncio.gather(*tasks)
I am using python 3.6, so I had to change last line of code.
You don't need change it if you are using python 3.7 which I think you are using
import asyncio
from pyppeteer import launch

url = "https://stackoverflow.com/questions/tagged/web-scraping"

async def fetch(page,url):
    await page.goto(url)
    linkstorage = []
    await page.waitForSelector('.summary .question-hyperlink')
    elements = await page.querySelectorAll('.summary .question-hyperlink')
    for element in elements:
        linkstorage.append(await page.evaluate('(element) => element.href', element))
    return linkstorage

async def browse_all_links(page,link):
    await page.goto(link)
    await page.waitForSelector('h1 > a')
    title = await page.querySelectorEval('h1 > a','(e => e.innerText)')
    print(title)
async def main():
    browser = await launch(headless=False,autoClose=False)
    [page] = await browser.pages()
    links = await fetch(page,url)
    tasks = [await browse_all_links(page,url) for url in links]
    #await asyncio.gather(*tasks)
    await browser.close()
if __name__ == '__main__':
    #asyncio.run(main())
    asyncio.get_event_loop().run_until_complete(main())

*

*Output

(testenv) C:\Py\pypuppeteer1>python stack3.py
Scrapy Shell response.css returns an empty array
Scrapy real-time spider
Why do I get KeyError while reading data with get request?
Scrapy spider can't redefine custom_settings according to args
Custom JS Script using Lua in Splash UI
Can someone explain why and how this piece of code works [on hold]
How can I extract required data from a list of strings?
Scrapy CrawlSpider rules for crawling single page
how to scrape a web-page with search bar results, when the search query does not
appear in the url
Nested for loop keeps repeating
Get all tags except a list of tags BeautifulSoup
Get current URL using Python and webbot
How to login to site and send data
Unable to append value to colums. Getting error IndexError: list index out of ra
nge
NextSibling.Innertext not working. "Object doesn't support this property"