text:
Q: CSS circular menu I get some HTML and CSS code.
https://codepen.io/lbebber/pen/pvwZJp
.menu-item,
.menu-open-button {
  background: #00bcd4;
  border-radius: 100%;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  position: absolute;
  color: white;
  text-align: center;
  line-height: 80px;
  transform: translate3d(0, 0, 0);
  transition: transform ease-out 200ms;
}

I tried to use this code, but I did not succeed pushing the hamburger menu to be at the bottom-left corner.
I think something outside the part I copied here is blocking the menu to get it to the bottom.
The second thing, I wanted to use little pictures instead of icons.
Do you have an idea how?
When I add a picture, I am getting weird behavior.
Thank you for your help in advance.

A: Code is Fixed!
So in your .menu attribute, I added the following. These attributes move your menu (.menu) in a fixed position in the bottom left of the screen.
position: fixed;
bottom: 0;
left: 0;
z-index: 998;

I removed the margin-left:-80px; as this caused your menu to warp halfway off the left of the screen when I added the other attributes above. So your .menu attribute should look like this when the proper attributes are edited:
.menu{
  @extend %goo;
  $width:650px;
  $height:150px;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 998;
  padding-top:20px;
  padding-left:80px;
  width:$width;
  height:$height;
  box-sizing:border-box;
  font-size:20px;
  text-align:left;
}

This resulted (on codepen) with your site looking like this. Of course, the gooey menu opens as shown below. I cannot insert the code into stack overflow as there were issues with layout and content. But if you make the changes to your CSS code above, you can see your menu working

[


text:
Q: CAShapeLayer Stroke Color Not Reading Hex Color Code Conversion I am using a UIPickerView that reads from an array that has a list of hex color codes, which are then used to fill each row of the picker view with all the different colors. I am using a method that converts the hex codes into RGB codes, and a UIlabel to change the color of each row. My for loop to change the UILabel color in each row of the UIPickerView works just fine, but when I try to perform the same color change using the same hex code conversion with the stroke color of a circle I'm drawing with CAShapeLayer in the view, nothing happens . It seems that UIColor isn't accepting the hex code conversion, although the UILabel's background for each row in the UIPickerView does. Anyone have an idea of why this isn't working?
Here's the for loop that changes the UILabel's background color for each row in the UIPickerView:
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{

UILabel *pickerLabel = [[UILabel alloc]init];

for (int currentIndex=0; currentIndex<[self.colorArray count]; currentIndex++) {

    [pickerLabel setBackgroundColor: [self colorWithHexString:[self.colorArray objectAtIndex:row]]];

}

return pickerLabel;
}

Here's the UIPickerView delegate method where I'm trying to change the stroke color of the CAShapeLayer I'm working with:
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row   inComponent:(NSInteger)component{

NSString *rowColorHex = [self.colorArray objectAtIndex:[self.picker selectedRowInComponent:0]];

[self.circleLayer setStrokeColor: [self colorWithHexString: rowColorHex];

//NSLog(@"%@", rowColorHex);
}

Here is how I create the circle shape. Notice that I've omitted the initial stroke color. I can assign a stroke color in the same manner within the UIPickerView's delegate method where my issue is, and it works just fine:
CAShapeLayer *circleLayer = [CAShapeLayer layer];
circleLayer.lineWidth = 50;
circleLayer.fillColor = [[UIColor clearColor] CGColor];
//circleLayer.strokeColor = [[UIColor redColor] CGColor];
[self.imageToBeCropped.layer addSublayer:circleLayer];
self.circleLayer = circleLayer;

And finally, here is the hex conversion method:
-(UIColor*)colorWithHexString:(NSString*)hex{
NSString *cString = [[hex stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];

// String should be 6 or 8 characters
if ([cString length] < 6) return [UIColor grayColor];

// strip 0X if it appears
if ([cString hasPrefix:@"0X"]) cString = [cString substringFromIndex:2];

if ([cString length] != 6) return  [UIColor grayColor];

// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
NSString *rString = [cString substringWithRange:range];

range.location = 2;
NSString *gString = [cString substringWithRange:range];

range.location = 4;
NSString *bString = [cString substringWithRange:range];

// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];

return [UIColor colorWithRed:((float) r / 255.0f)
                       green:((float) g / 255.0f)
                        blue:((float) b / 255.0f)
                       alpha:1.0f];
}

A: Core Animation layers don't accept UIKit types—you need to use the Core Graphics equivalent, in this case CGColorRef. You're doing that in the code where you create it already, but your -colorWithHexString: method returns a UIColor.
[self.circleLayer setStrokeColor:[[self colorWithHexString: rowColorHex] CGColor]];

redpajama_set_name: RedPajamaStackExchange


text:
Q: prestart scripts in Loopback I need to create an ssh tunnel to connect to my database, so the logical point would be to add the shell command in package.json under scripts/prestart.
However, as it seems, slc run does not execute this script, npm start does, but of course doesn't run the loopback module.
I could think of a few workarounds such as writing a startup script that both creates the ssh tunnel and calls slc run, or running slc run in package.json scripts/start, but all these workarounds stink.
Is there a better way to do this?

A: I'm not sure how useful this is but 1 option I thought of was that if you don't really make use of slc run features you could just define your own npm start run script and hit the server script directly and add in whatever other tooling you need such as nodemon or supervisor etc.:
"start": "node server/server.js"

If you do need to use slc run, I think I would tend toward just wrapping slc run in your start script as you mentioned in your question. It kinda stinks... but not that badly.


text:
Q: MATLAB - plot multiple unconnected lines with patch and specify linecolor I want to use patch to plot multiple unconnectes lines within one command. These lines have different colors that I want to specify. Unfortunately patch uses random colors in the yellow to blue area instead of my defined colors - how can I solve this?
clear all
close all
cla;

x=[];
y=[];
CC=[];
n=10;
for i=1:n
    % define start and end from i-th line
    x(end+1)=i;
    x(end+1)=i+1;
    % add nan to seperate lines
    x(end+1)=nan;

    % define start and end from i-th line
    y(end+1)=i;
    y(end+1)=1;
    % add nan to seperate lines
    y(end+1)=nan;

    CC(end+1,1:3)=0.1.*i;
end

%funktioniert
figure(1)
subplot(1,2,1)
h = patch(x', y', 0);
set(h,'LineWidth',2);
set(h,'cdata', CC, 'edgecolor','flat','facecolor','none')
title('wrong colors')

subplot(1,2,2)
for i=1:n
    xx=[1:3];
    yy=[i i i];
    line(xx,yy,'Color',CC(i,:))
    hold on
end
title('wanted colors')

Thanks a lot!
smaica

A: If you want to plot lines, use the functions dedicated for this purpose, plot or line, instead of using patch. Just change the 'ColorOrder' to your desired colors.
n = 10;
%Starting and ending point of lines in each col of x and y
x = [1:n; 2:n+1];
y = [1:n; ones(1,n)];
CC = repmat(0.1:0.1:1,3,1).';   %Required colors
%Changing ColorOrder to required colors ( and turning the box (optional) )
set(gca, 'ColorOrder', CC, 'box', 'on');
line(x,y);    %or plot(x,y)

Result:


text:
Q: Lambda1 > SNS > SQS > Lambda2: Receiving oddly formatted events I have the following architecture on AWS:

*

*A Lambda function (let's call it Lambda1), which publishes message onto...

*An SNS topic, which is subscribed to by...

*An SQS queue, which is subscribed to by...

*Another Lambda function (let's call it Lambda2).

The event being received by Lambda2 looks like this:
{
    "message": "{'Records': [{'messageId': 'REDACTED', 'receiptHandle': 'REDACTED', 'body': '{\\n  \"Type\" : \"Notification\",\\n  \"MessageId\" : \"REDACTED\",\\n  \"SequenceNumber\" : \"10000000000000054000\",\\n  \"TopicArn\" : \"arn:aws:sns:REDACTED\",\\n  \"Subject\" : \"Blackout\",\\n  \"Message\" : \"{\\\\\"channel\\\\\": \\\\\"REDACTED\\\\\", \\\\\"blackout\\\\\": {\\\\\"id\\\\\": 2452, \\\\\"name\\\\\": \\\\\"Name Goes Here\\\\\", \\\\\"location_id\\\\\": 2, \\\\\"reason\\\\\": \\\\\"Approaching capacity (9/1)\\\\\", \\\\\"start_date\\\\\": \\\\\"2022-08-05 00:00:00\\\\\", \\\\\"end_date\\\\\": \\\\\"2022-08-06 00:00:00\\\\\", \\\\\"blackout_scope\\\\\": \\\\\"product\\\\\", \\\\\"status\\\\\": \\\\\"pending create\\\\\", \\\\\"inventory_id\\\\\": 2444894}}\",\\n  \"Timestamp\" : \"2022-08-03T19:40:15.540Z\",\\n  \"UnsubscribeURL\" : \"https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=REDACTED\"\\n}', 'attributes': {'ApproximateReceiveCount': '3', 'SentTimestamp': '1659555615567', 'SequenceNumber': '18871590311294705152', 'MessageGroupId': '2452_create', 'SenderId': 'REDACTED', 'MessageDeduplicationId': 'REDACTED', 'ApproximateFirstReceiveTimestamp': '1659555615567'}, 'messageAttributes': {}, 'md5OfBody': '1be1a5ee5146faf13cb7cb5bb7f678d0', 'eventSource': 'aws:sqs', 'eventSourceARN': 'arn:aws:sqs:us-west-2:659966244640:BlackoutsWorkerSpotHeroQueueNew.fifo', 'awsRegion': 'us-west-2'}]}",
    "levelname": "INFO",
    "name": "REDACTED",
    "asctime": "2022-08-03 20:46:58,732",
    "trace_id": null
}

Note the body in the message. It's been JSON-stringified and then escaped (which is expected – right?). But the body contains its own nested message key – which has also been JSON-stringified and then escaped. So the whole thing is a riot of backslashes.
Is this normal and expected? Or does it suggest a problem with the configuration of the various AWS resources? This is my first time implementing something like this.
Thanks!


text:
Q: Filter wrong Nodes i have the following code:
<?xml version="1.0" encoding="UTF-8"?>
<A_Random>
    <A_RandomType>
     <RandomType>T4fV</RandomType>
        <RandomOrganization>1012</RandomOrganization>
        <RandomChannel>12</RandomChannel>
        <RandomDivision>00</RandomDivision>
        <RandomGroup>112</RandomGroup>
        <to_Item>
            <A_RandomItemType>
                <RandomChrgItemText>null</RandomChrgItemText>
                <Material/>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>STK</RequestedQuantityUnit>
                <Plant>1088</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material>1111</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1088</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material>594172</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1010</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material/>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1010</Plant>
            </A_RandomTypeItemType>
                <RandomChrgItemText>null</RandomtChrgItemText>
                <Material/>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1044</Plant>
            </A_RandomItemType>
            <A_RandomeItemType>
                <Material>482803</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1788</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material>594172</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1788</Plant>
            </A_RandomItemType>
        </to_Item>
    </A_RandomType>
</A_Random>

I want to accomplish the following output:
<?xml version="1.0" encoding="UTF-8"?>
<A_Random>
    <A_RandomType>
     <RandomType>T4fV</RandomType>
        <RandomOrganization>1012</RandomOrganization>
        <RandomChannel>12</RandomChannel>
        <RandomDivision>00</RandomDivision>
        <RandomGroup>112</RandomGroup>
        <to_Item>
            <A_RandomItemType>
                <Material>1111</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1088</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material>594172</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1010</Plant>
            </A_RandomItemType>
            <A_RandomeItemType>
                <Material>482803</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1788</Plant>
            </A_RandomItemType>
            <A_RandomItemType>
                <Material>594172</Material>
                <RequestedQuantity>1</RequestedQuantity>
                <RequestedQuantityUnit>PC</RequestedQuantityUnit>
                <Plant>1788</Plant>
            </A_RandomItemType>
        </to_Item>
    </A_RandomType>
</A_Random>

In short, I want to copy everything except nodes where Material is empty or A_RandomItemType is set to null. I have nothing working but one of my tries was the following.
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output omit-xml-declaration="yes" indent="yes" method="xml"/>

   <xsl:template match="@* | node()">
      <xsl:copy>
      <xsl:apply-templates select="*[name(  ) != 'Material:null']"/>
      <xsl:apply-templates select="*[name(  ) != 'SalesOrderWthoutChrgItemText:null']"/>
      </xsl:copy>
<xsl:copy>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

Tanks for your help. Can you pleas explein me why my code dont work?

A: The standard approach for this type of problem is to use the identity transform template to copy everything as is, and add an empty template (or templates) for the nodes you want to remove - for example:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<!-- remove A_RandomItemType where Material is empty -->
<xsl:template match="A_RandomItemType[not(Material/text())]"/>

</xsl:stylesheet>

A: Sorry for the late reply. Thanks this solved my problem. Here ist the fully solution i used:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<!-- remove A_RandomItemType where Material is empty -->
<xsl:template match="A_RandomItemType[not(Material/text())]"/>
<xsl:template match="A_RandomItemType[(RandomChrgItemText/text() = 'null')]"/>
</xsl:stylesheet>


text:
Q: how use more than one routings file in django-channels? I am making a project in which i use channels in two different apps.but how can i make two  different routings files for each app
import os
from channels.routing import ProtocolTypeRouter,URLRouter
from django.core.asgi import get_asgi_application
from channels.http import AsgiHandler
from channels.auth import AuthMiddlewareStack
from consultation import routings as consultation_routings
from chat import routings as chat_routings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sqh.settings._base')

application = ProtocolTypeRouter({
    "http":AsgiHandler(),
    "websocket":AuthMiddlewareStack(
        URLRouter(
            consultation_routings.websocket_urlpatterns,
            chat_routings.websocket_urlpatterns,
        )
    )
})

when i add a second routings file address to URLRouter in asgi.py it raises following error :
    URLRouter(
TypeError: __init__() takes 2 positional arguments but 3 were given


text:
Q: XML deserialize to same object different element names I am trying to deserialize an xml to an object to use. We have created templates and would like to keep the xml the same standard if possible. The problem I am trying to figure out is how to look within a standard node in the xml and all subnodes are the same object type, just with different node names.
For example:
<Account>
    <AccountNumber>12345</AccountNumber>
    <Balance>12.52</Balance>
    <LateFee>0</LateFee>
</Account>

The Account level is always within the template, but everything below that is variable. Is there a way to deserialize all nodes within the Account level to be the same object?
Public Class AccountNode
{
   Public String Name { get; set; }
   Public String Value { get; set; }
}

Based on my research, it appears, they have to have a standard naming schema and then you can have an attribute to assign to the Name value. I just haven't been able to confirm that. If someone has a link that I haven't been able to find, or is knowledgeable and can confirm whether or not this is a possibility, I would like to know.
EDIT:
I have a much larger xml than listed above, so I'm trying to see how I can deserialize it.
<AccountNumber>
  <KeyWord Name="Customer Account" isRegex="False" errorAllowance="10" LookFor="Customer Account">
    <Rectangle>
      <Left>200</Left>
      <Bottom>350</Bottom>
      <Right>600</Right>
      <Top>690</Top>
    </Rectangle>
    <Relations KwName="Charges">
      <Relation>above.0</Relation>
    </Relations>
  </KeyWord>
  <Capture DataType="String" FindIfKeywordMissing="false">
    <Rectangle>
      <Left>200</Left>
      <Bottom>350</Bottom>
      <Right>600</Right>
      <Top>690</Top>
    </Rectangle>
    <Relations anchorName="ChargeSection">
      <Relation>rightOf.0</Relation>
      <Relation>below.-20</Relation>
      <Relation>above.20</Relation>
      <Relation>width.150</Relation>
    </Relations>
    <Regex>Customer account\s+(\S+)</Regex>
  </Capture>
</AccountNumber>

So with this one, I assume it is similar, but basically the Account Number node is the variable one and everything above and below it is standard.

A: You could use a surrogate [XmlAnyElement] public XElement[] AccountNodesXml property in your Account class to manually convert your AccountNode objects from and to XML nodes.  Marking the property with XmlAnyElement ensures that the elements will taken verbatim from the XML:
public class Account
{
    public Account() { this.AccountNodes = new List<AccountNode>(); }

    [XmlIgnore]
    public List<AccountNode> AccountNodes { get; set; }

    [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
    [XmlAnyElement]
    public XElement[] AccountNodesXml
    {
        get
        {
            if (AccountNodes == null)
                return null;
            return AccountNodes.Select(a => new XElement((XName)a.Name, a.Value)).ToArray();
        }
        set
        {
            if (value != null)
                AccountNodes = value.Select(e => new AccountNode { Name = e.Name.LocalName, Value = (string)e }).ToList();
        }
    }
}

Sample fiddle which successfully deserialized and re-serializes the following XML:
<Account>
  <AccountNumber>12345</AccountNumber>
  <Balance>12.52</Balance>
  <LateFee>0</LateFee>
</Account>


text:
Q: Can move windows out of desktop in Ubuntu 17.10 Today I installed Ubuntu 17.10 and currently I am trying to use it with 4 displays in the following orientation:

The problem is that I can move windows outside of my screen into the red area, so I cannot see them anymore. Especially it is impossible to maximize the windows through moving them to the top of the screen, which is very annoying. Does anyone have a solution to that problem?
With my old Ubuntu 14.04 it was possible to define the displays in the compiz settings to get it working correctly, but  in 17.10 the compiz settings are changing nothing...


text:
Q: set value for first tab in tabbar after segue I have the following situation.

Like you see I have a segue that goes to the tabbarController. But I need to set an id in de VC that is pointed on the screen. Have you guys any idea how I can achieve this.
Normally you would use this code.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if ([segue.identifier isEqualToString:@"showTab"]) {
        [segue.destinationViewController setPersonId:personobject.cu_id];
    }
}

But this goes to my tabbarController and not to my FirstTabController. Any help?
Kind regards

A: Your destination view controller is a UITabBarController. You'll have to get an instance from that tab controller to the controller in the first tab.
UITabBarController *tabController = (UITabBarController *) segue.destinationViewController;
FirstTabController *firstController = [tabController.viewControllers objectAtIndex:0];

[firstController setPersonId:personobject.cu_id];

A: Oké,
I fixed my problem by just saving my personId into NSUserDefaults at the following way.
 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
                             [prefs setInteger:[personObject.cu_id intValue] forKey:@"personId"];
                             [prefs synchronize];

Now I can get access to it in every VC by calling the following.
 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    _personId = [NSNumber numberWithInt:[prefs integerForKey:@"personId"]];


text:
Q: What is the StreamSets architecture? I am not very clear about the architecture even after going through tutorials. How do we scale streamset in a distributed environment? Let's say, our input data velocity increases from origin then how to ensure that SDC doesn't give performance issues? How many daemons will be running? Will it be Master worker architecture or peer to peer architecture?
If there are multiple daemons running on multiple machines (e.g. one sdc along with one NodeManager in YARN) then how it will show centralized view of data i.e. total record count etc.?
Also please do let me know architecture of Dataflow performance manager. Which all daemons are there in this product?

A: StreamSets Data Collector (SDC) scales by partitioning the input data. In some cases, this can be done automatically, for example Cluster Batch mode runs SDC as a MapReduce job on the Hadoop / MapR cluster to read Hadoop FS / MapR FS data, while Cluster Streaming mode leverages Kafka partitions and executes SDC as a Spark Streaming application to run as many pipeline instances as there are Kafka partitions.
In other cases, StreamSets can scale by multithreading - for example, the HTTP Server and JDBC Multitable Consumer origins run multiple pipeline instances in separate threads.
In all cases, Dataflow Performance Manager (DPM) can give you a centralized view of the data, including total record count.


text:
Q: php nginx X-Accel-Redirect headers i have an issue regarding protecting folder with static files using nginx
so basically i have root folder on nginx setup to :
/home/rise/rises/wwwdir

and the secured folder is :
/home/rise/rises/videop

as we can see i moved that folder outside root folder to prevent/allow only specific to see under criteria
when i first made a search before posting i read some ideas that to access the videop folder outside the root , i need to create alias in nginx conf like this which i made
and access internal
location /videop {
        root /home/rise/rises/;
         internal;
        }

however i have an issue on php side to load the video...
$aliasedFile = '/videop/5_.m3u8';
$filename = '5_.m3u8';
header("Content-Description: File Transfer");
header("Content-Type application/x-mpegURL ");
header('Content-Disposition: attachment; filename='.$filename.'');
header('X-Accel-Redirect: '. $aliasedFile);
readfile($aliasedFile);

i'm missing something ?

A: Your root directive has a trailing / which will be followed by the leading / of the URL, so use:
location /videop {
  root /home/rise/rises;
  internal;
}

Your PHP has a badly formed header, which should include a : after Content-Type.
The PHP should should not include a body. The readfile is wrong. The whole purpose of the PHP is to issue an internal redirect which is picked up by nginx. So the PHP should return headers only.


text:
Q: How to read list of query params I have a method that takes a list of userIDs and return a list of users' details.
func ListUser(userIDs []interface{}) (users []User, err error) {
    // query on DB based on userID and return list of users
    return users, nil
}

Now I want to expose an API endpoint for it. So, I am trying to get the userIDs from my URL.
func ListUserProfile(w http.ResponseWriter, r *http.Request) {
    // I know I can get the single value using
         //r.URL.Query().Get("user-id")

    // but here List user takes []interface{} as a argument
    users, err := users.ListUser(userIDs)
}

Is there have any way I can get the list of userIDS from my URL.

A: Parse the form and copy the []string in the form to an []interface{}. The Go FAQ explains why copy is required.
r.ParseForm()
userIDs := make([]interface{}, len(r.Form["user-id"]))
for i, s := range r.Form["user-id"] {
   userIDs[i] = s
}

users, err := users.ListUser(userIDs)

(The question and a comment disagree on the name of the query parameter. Adjust the code in the answer to match the actual name.)


text:
Q: How to get the differentiation from onChange method vs data loading first time from service in nuxt I am getting issues while handling the onChange event on VueJs select,
Below is my logic:
I am using the country dropdown and if Country Canada got selected I would like to use the province dropdown otherwise I am using the input field for the user to add dropdown values.
When the user selects the country dropdown, I would like to clear the values from the input field or dropdown.
Problem: It works fine in normal scenarios but when I fetch data from the service and If the country is not Canada, the data is getting cleared due to my onChange functions written in the country dropdown.
How I can separate this logic without adding a new field? Is there any lifecycle hook that I can use here?

const eventBus = new Vue ()

Vue.component('ChildA',{
  template:`

  <select name="country" v-on:change="onChange($event)" class="form-control" v-model="val.contry">
    <option value="CA">Canada</option>
    <option value="Other">Other</option>
  </select>
  <select v-if="val.country == 'CA'" name="province"  class="form-control" v-model="val.province">
    <option value="ON">ON</option>
    <option value="PN">PN</option>
  </select>

    <input v-model="val.province">

`,
  props: ["val"],
  methods: {
    onChange(e) {
    console.log("called")

      if (this.val.country == 'CA'){
        //logics
      } else {
        this.val.province = '';
      }
    }
  }
})

Vue.component('ParentA',{
  template:`

      <child-a :val="val"/>

`,
  data() {
    return {
     val: {
        country: "",
        province: ""
      }
    }
  },
created() {
     setTimeout(() => {
          this.val = {country: "Other",
        province: "test"};
      }, 1000);
  },
})

new Vue ({
    el: '#app',
})

  <parent-a/>

A: If I understood you correctly, maybe something like following snippet:

new Vue({
  el: "#demo",
  data() {
    return {
      key: {
        country: "Other",
        province: "test"
      }
    }
  },
  methods: {
    onChange(e) {
      this.key.country = e.target.value
      if (e.target.value == 'CA'){
        //logics
      } else {
        this.key.province = '';
      }
    }
  }
})

  <select name="country" v-on:change="onChange($event)" class="form-control" v-model="key.contry">
    <option value="CA">Canada</option>
    <option value="Other">Other</option>
  </select>
  <select v-if="key.country == 'CA'" name="province"  class="form-control" v-model="key.province">
    <option value="ON">ON</option>
    <option value="PN">PN</option>
  </select>

    <input v-model="key.province">

A: Here is some pseudo-code regarding your issue.
<template>

    <select
      v-model="key.country"
      name="country"
      class="form-control"
      @change="onChange"
    >
      <option value="CA">Canada</option>
      <option value="Other">Other</option>
    </select>
    <select
      v-if="key.country == 'CA'"
      v-model="key.province"
      name="province"
      class="form-control"
    >
      <option value="ON">ON</option>
      <option value="PN">PN</option>
    </select>

      <input v-model="key.province" />

</template>


text:
Q: How do I leverage teamcity git settings I just wanted to do git push origin dev:testing as a build step. I had to jump through all kinds of hoops to get it working and making sure id_rsa files are located in the right place and settings environment variables and what have you.
We are already using git tagging which works out of the box. Is there a way to leverage the git settings with arbitrary git commands as a build step?

A: Arbitrary git commands are not supported unless git is installed on the box. However in order to do git push just add one or more "Automatic merge" build features. These are run after all build steps are done, so not as flexible as build steps which can run in any order, but at least it works out of the box,


text:
Q: the row values updated or deleted either do not make the row unique or they alter multiple rows I want to delete row and I get this error:

the row values updated or deleted either do not make the row unique or
  they alter multiple rows

A: There are duplicate rows in your table. When this is the case you cannot edit table using UI. first delete rows with matching data using SQL then try and edit. Delete rows with matching data one by one until you are left with one row. Use the following query for deleting matching rows where column IdSeminar has value 1 :
Delete top(1) from tab where IdSeminar=1

do the same with other matching rows.

A: This might be a bit late but it could help someone. I ran into the same issue today but Akshey's code didn't work for me. My database table didn't contain an ID column, so I added one in and set it's 'Identity Specification' to 'Yes'. I reloaded the table with this new column in it and then was able to delete whichever rows I wanted. Afterwards I deleted the ID column, reloaded and the table and everything was fine.

A: SQL Studio cautiously tries to delete exactly one row but finds no way to identify it. Contrary to what it's UI may tempt you to suppose, row can't be identified by it's position in the result set.


text:
Q: ios7 blank screen from framework I have a framework that creates some views, the app that uses the framework calls a method from it and pass in the current view controller, the framework then calls presentModalViewController to display a view.
It was working just fine with iOS 6.1 SDK but when I updated to Xcode 5 and iOS 7 SDK I don't see the modal view anymore, instead all I get is a blank screen.
EDIT
Heres some code:
The Framework is called "testityi"
testityi.m
#import "TestViewController.h"

@implementation testitiy

- (NSString*) sayHi : (NSString*) name {
    return [NSString stringWithFormat:@"Hello %@", name];
}

- (void) displayView:(UIViewController *)parentController {
    TestViewController* controller = [[TestViewController alloc] init];
    [parentController presentViewController:controller animated:YES completion:nil];
}

TestViewController is simply a view with a label that says "View from framework"
The framework itself works fine, calling sayHi method works just fine.
The third party app has a view with a label and a button which calls sayHi method and then displayView method, heres the view controller code:
MainViewController.m
- (IBAction)buttonPressed:(id)sender {
    testitiy* framework = [[testitiy alloc] init];
    NSString* msg = [NSString stringWithFormat:@"Calling sayHi method on framework...\n     result: %@", [framework sayHi:@"John"]];
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"sayHi method call"     message:msg delegate:self cancelButtonTitle:@"Ok, show me the view" otherButtonTitles:nil, nil];
    [alert show];
}

-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if(buttonIndex == [alertView cancelButtonIndex]) {
        testitiy* framework = [[testitiy alloc] init];
        [framework displayView:self];
    }
}

The alert button action is also working correctly, I added a NSLog before and its working.
After clicking the alert button a view is presented but instead of containing the label "View from framework" I get a blank screen.
You can see the code on Github
EDIT 2
I got it... I wasn't calling initWithBundle on the ViewController from the framework, I added the a custom init method that calls:
framework: TestViewController.m
+ (NSBundle *)frameworkBundle {
    static NSBundle* frameworkBundle = nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        NSString* mainBundlePath = [[NSBundle mainBundle] resourcePath];
        NSString* frameworkBundlePath = [mainBundlePath     stringByAppendingPathComponent:@"testity.bundle"];
        frameworkBundle = [NSBundle bundleWithPath:frameworkBundlePath];
    });
    return frameworkBundle;
}

- (id) initWithFramework {
    NSBundle* bundle = [[self class] frameworkBundle];
    self = [super initWithNibName:@"TestViewController" bundle: bundle];
    return self;
}

And changed testitiy.m
- (void) displayView:(UIViewController *)parentController {
    TestViewController* controller = [[TestViewController alloc] initWithFramework];
    [parentController presentViewController:controller animated:YES completion:nil];
    //[parentController.navigationController pushViewController:controller animated:YES];
}

And now its working...
I hope this helps someone else but I'm guessing it was a stupid mistake of mine.
Sorry for all the trouble and thanks for your time!

A: So after a while I finally understand the issue:
When using a custom framework, all resources like images and NIB files have to be manually included in the third-party app so that it has access to those files.
My problem was that I was including the resources (stored in a bundle) into the third-party app but the framework was trying to display the View based on its own resources, which the app couldn't access, for that reason I was getting a blank screen.
I just needed to tell the framework to use the included bundle into the third-party app to display that View (using the initWithNibName: Bundle method).
See EDIT 2 in the question to see the code that solved my problem.
Hope this helps someone. :-)


text:
Q: How to return more than a string from a webservice? I have made webservice in asp.net using C# and MySQL. I want to return multiple values from this service. I am using the following code:
[WebMethod]
public string RegisterUserViaFacebook(string fbid, string fbmailid,string devicetype)
{
    string success = "Already Registered";
    string id="", name="";

    if (!ExistsFBID(fbid))
    {
        name = GenerateUserName();

        string password = generatePassword(10);

        string insertUser = "Insert into tbl_userinfo(UserName,Password,Facebook_ID,Facebook_EmailID,DeviceType) values";
        insertUser += "( '" + name + "' ,'" + password + "','" + fbid + "','" + fbmailid + "','" + devicetype + "' )";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd = new MySqlCommand(insertUser, con);
        success = cmd.ExecuteNonQuery().ToString();
        con.Close();

        string getID = "SELECT UserID from tbl_userinfo where UserName='" + name + "'  ";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd1 = new MySqlCommand(getID, con);
        id = cmd1.ExecuteScalar().ToString();
        con.Close();

        if (Convert.ToInt16(success) > 0)
        {
            SendMail(fbmailid, name, password);
            success = "New User"  ;
        }
        else
            success = "Error in Insertion";
    }
    else
    {
        string getID1 = "SELECT UserID, UserName from tbl_userinfo where Facebook_ID='" + fbid + "' ";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd2 = new MySqlCommand(getID1, con);
        MySqlDataReader info = cmd2.ExecuteReader();

        while (info.Read())
        {
            id = info.GetString(0);
            name = info.GetString(1);

        }
        con.Close();
    }

    string jsonString = JsonConvert.SerializeObject(success);
    String finalString = "{\"USER IS\":";
    finalString += jsonString;
    finalString += "}";

    string jsonString1 = JsonConvert.SerializeObject(id);
    String finalString1 =finalString + "{\"ID IS\":";
    finalString1 += jsonString1;
    finalString1 += "}" ;

    string jsonString2 = JsonConvert.SerializeObject(name);
    String finalString2 = finalString1 + "{\"NAME IS\":";
    finalString2 += jsonString2;
    finalString2 += "}";
    return finalString2;

 }

But it returns all values in single string. I want to return the values individually as Succeess, ID and Name.
How can I do this?

A: Create a simple class to hold Succeess, id and name and return an serialized instance of it.
public class RegistrationResult
{
   public string Success { get; set; }
   public string Name { get; set; }
   public int Id { get; set; }
}

You could do this:
var result = new RegistrationResult { Success = success, Name = name, Id = id} ;
return JsonConvert.SerializeObject(success);

A: You probably want to return a singel object in the JSON.
return "{user: "+JsonConvert.SerializeObject(success)+", id: "+JsonConvert.SerializeObject(id)+", name: "+JsonConvert.SerializeObject(name)+"}";

The answer by Oded is fine too. It's a bit more clear, but also needs an extra class.


text:
Q: Update of Table when I don't have the key value I am developing a .net core api using entity framework.  I have done development for a while but am new to entity framework.  In addition I am attempting to implement using DTO objects to restrict and reduce the amount of information available.  My problem is this.  If I do not pass my unique id from the DB back to the end user how can I perform an update against that object?
For example I have a class that has
ID, FirstName, LastName, Age
My DTO back to the end user is:
FirstName, LastName, Age
How can I implement Update and Delete without the ID?
I know this is probably a dumb question and I am missing the obvious so please be gentle.  I have looked for the answer but every time I search I just keep finding questions about tables that don't have a primary key.

A: You can't update a record without using Id or another primary key.  For example to update the user you need to find an existed user record, update some or all properties and save. The only way to find the user without using Id would be
var existedUser = Context.Set<User>().Where(u=> u.FirstName==dto.FirstName
&& u.LastName==dto.LastName
&& u.Age==dto.Age).FirstOrDefault();

but since you have to update user properties it means FirstName or LastName or Age or all of them are changed in your Dto already, so you can't  use them to find a user record to update.
You can use this code to find a user to delete, but it is not the best idea too, since can be a differet user with the same name and age.


text:
Q: semantic xhtml markup for date on news detail page? is there a more semantic way than this markup FOR THE DATE on news detail pages?

Lorem ipsum 12.12.2010

Lorem ipsum dolor sit amet

A: HTML 5 has a <time> tag.  If not using HTML 5, I would do this:  to indicate it is similar to HTML 5 time.  This would make it easy to style and find with Javascript automation.


text:
Q: Suggestions for particular client-server system I have a quite specific client-server design case and I want to ask for
suggestions. The task is about enhancing an existing system with new
functionality.
The system is composed of a server with public IP, 10 -
1000 CLDC clients with dynamic IP, and a device that
communicates with the server over the serial port (COM).
Client(J2ME):
Logs into the server and stays logged in, spontaneously asks
server for some data, but mainly waits for server requests. The client is
(probably, first thought) responsible for keeping the connection with server
alive.
Server (preferably windows, Java): Waits for clients to
connect, stores and maintains all client connections (in case the server
wanted to send a request to the client, as clients have dynamic IP
addresses). The server stores data coming from the COM device. Waits for
requests from clients and provides them with desired (previously stored)
data. It also waits for COM device requests.
COM device: Provides the server with
data (this is the data that clients spontaneously ask for). It also sends
requests (server should pass those requests to particular clients). The COM
device drives the whole system.
What I need to design is the server and software for clients. Serial device
is unchangeable.
Do you have any suggestions for the best approach here?
Regards!

A: J2ME
I have developed many systems involving J2ME and a backend. The one thing you need to watch out for is that the client connection that the server holds may not always be "open" because GPRS/3G is not very reliable (depending on the service provider/country).  So you are right that the client is responsible for keeping the connection open.
Server
In general you can treat this like a normal multi threaded socket server.
On a windows system (assuming you programming in java) have a look at opening a java.io.File to a file name "COM1" in order to communicate with your serial device. This will make your life much easier instead of truing to do native serial communication.
It seems pretty straight forward so i am not sure what one can suggest.


text:
Q: Relative magnitude(s) of $x,y,z$ in hypothetical counterexamples to FLT Let $0 < x < y < z$ be integers, and let $n \ge 1$ be an integer, such that $$x^n+y^n=z^n.  \tag{$\star$}$$ I'm hoping to find upper bounds on the magnitude $x/y$, either in terms of $n$ or otherwise. In his 13 Lectures on Fermat's Last Theorem, Ribenboim states that "$z,y$ are relatively close together and therefore the size of $x$ should be much smaller" — my goal is to find out how much smaller.
In Fermat's Last Theorem for Amateurs [p. 199], Ribenboim references the following result of Catalan (1886):

If $p$ is an odd prime, and $0 < x < y$ are integers such that $x^p + y^p = (y+1)^p$, then $x$ is the only integer such that $$\bigl(py^{\ p-1}\bigr)^{1/p} < x < \bigl(p(y+1)^{\ p-1}\bigr)^{1/p}.$$

Using this, one can get a bound in that special case. But as far as I can tell, this is the only explicit magnitude-based result in the whole book (other than trivial ones like $x+y>z$, etc.).
Perisastri (1969) showed that in ($\star$) we must have $z < x^2$.
What other results exist — or can be easily proven — with respect to the relative magnitude of the components of a hypothetical counterexample to the Fermat equation ($\star$), and in particular $x/y$?


text:
Q: Reference Placeholder from class file? I've created a function in my vb class file that creates dynamic tables. I'm planning to use this to create tables dependent on a button being clicked. The function references a placeholder in my aspx page but I'm getting "placeHolder1 is not declared".
How can I access controls on my form from my class file?
Thanks
Class file snippet as follows:
Public Shared Function CreateTable() As Table
    'handle either total or breakdown
    Select Case format
        Case "breakdown"
            placePayDetails.Controls.Clear()
            Dim tblPayDetails As Table = New Table()
            placePayDetails.Controls.Add(tblPayDetails)

etc

A: According to your updated version of the question, your CreateTable function needs to receive a placePayDetails (presumably of type ContentPlaceHolder) as parameter.
The page calling this function needs to have this place holder defined somewhere in the markup.
Example:
Public Shared Function CreateTable(byVal placePayDetails as ContentPlaceHolder) As Table
    'handle either total or breakdown
    Select Case format
        Case "breakdown"
            placePayDetails.Controls.Clear()
            Dim tblPayDetails As Table = New Table()
            placePayDetails.Controls.Add(tblPayDetails)

A: the class file has no concept of your page. if you have a function in your class where you want the results of that function to return to the page, on the aspx backend have the function's results returned to as string and then set the contents
Dim tblPayDetails As Table = DoSomething()
placePayDetails.Controls.Add(tblPayDetails)


text:
Q: Preg_match use for bot i have a bot for daily match. But i can't figure out how it will be exactly replace tags,
for example i have data like this;
{"id":"45961","title":"Independien - Sporting Cri","type":"1","flag":"tr","date":"2017-03-17 03:45:00","date":"03\/17\/2017 04:32:55","live":"1"},{"id":"45962","title":"Independien - Sporting Cri","type":"1","flag":"tr","date":"2017-03-17 03:45:00","date":"03\/17\/2017 04:32:55","live":"1"}

Code:
$connect = sanitize_output(connect("h****"));

preg_match_all('@{"id":"(.*?)","title":"(.*?)","type":"(.*?)","flag":"(.*?)","time":"(.*?)","time":"(.*?)","live":"(.*?)"}@si',$connect,$football_t);

$id=$football_t[0][0];
$title=$football_t[0][1];

vs.
With this use i can't select datas,
I want to do table with foreach but i can't figure out how it will be.

A: Use json_decode() to parse a JSON string, not a regular expression.
$data = json_decode($connect);
$id = $data->id;
$title = $data->title;

You also shouldn't sanitize JSON, that may prevent json_decode() from parsing it properly.


text:
Q: What is a "free parameter" in a computational model? In many articles regarding computational models of some particular phenomenon, there seems to be a consensus: "the smaller the number of 'free parameters' in the model, the better". So, what is meant by "free parameter", and why is it less desirable to model something with such a parameter?
Thanks!

A: A free parameter is one that can be adjusted to make the model fit the data.  If I make a model that says $A$ is proportional to $B$, there is one free parameter, the proportionality constant.  If my model has a specific value of the proportionality constant, there are no free parameters.If I say that $A$ is a quadratic function of $B$, there are three free parameters, $a,b,c$ in $A=aB^2+bB+c$.  That makes it easier to fit the data, even if my model is not correct, so it is less impressive.

A: The following marvellous quote from Freeman Dyson's "A meeting with Enrico Fermi" contains both an example for your first question and an answer to your second.

[Enrico Fermi] delivered his verdict in a quiet, even voice. . . . "To reach your calculated results, you had to introduce arbitrary cut-off procedures that are not based either on solid physics or on solid mathematics."
In desperation I asked Fermi whether he was not impressed by the agreement between our calculated numbers and his measured numbers. He replied, "How many arbitrary parameters did you use for your calculations?" I thought for a moment about our cut-off procedures and said, "Four." He said, "I remember my friend Johnny von Neumann used to say, with four parameters I can fit an elephant, and with five I can make him wiggle his trunk." With that, the conversation was over. . . .


text:
Q: Computing the Fourier transform of $\cos(x/2)$ How can I prove that $\int_{-\pi}^{\pi} \cos(x/2)e^{ixt} dx=\frac{4\cos(\pi t)}{1-4t^2}$?

A: You can utilize the exponential form of the cosine to combine exponentials
$$\begin{align}\int_{-\pi}^\pi \cos(\frac{x}{2})e^{ixt}dx&=\frac{1}{2}\int_{-\pi}^\pi (e^{\frac{ix}{2}}+e^{-\frac{ix}{2}})e^{ixt}dx\\ \\
&=\frac{1}{2}\int_{-\pi}^\pi e^{ix(t+\frac{1}{2})}dx+\frac{1}{2}\int_{-\pi}^\pi e^{ix(t-\frac{1}{2})}dx\\ \\
&=\frac{1}{2}\left(\frac{e^{i\pi(t+\frac{1}{2})}-e^{-i\pi(t+\frac{1}{2})}}{i(t+\frac{1}{2})}+\frac{e^{i\pi(t-\frac{1}{2})}-e^{-i\pi(t-\frac{1}{2})}}{i(t-\frac{1}{2})}\right)\end{align}$$ Adding the two terms together inside and using the exponential definition of the cosine again yields the answer.

A: By parts, as hinted by @projectilemotion.
$$I=\int\cos\frac x2e^{ixt}dx=2\sin\frac x2e^{ixt}-i2t\int\sin\frac x2e^{ixt}dx
\\=2\sin\frac x2e^{ixt}+i2t\cos\frac x2e^{ixt}dx+4t^2I.$$
When integrating from $-\pi$ to $\pi$, the first term equals
$$2(e^{ixt}+e^{-ixt})$$ and the second vanishes.


text:
Q: Tag popup disappears when trying to mouse over it I don't try to click tag popups too often, so I have no idea how long this has been going on, but I recently observed some rather annoying behavior while trying to favorite a tag on a beta site.  Since an animation speaks more than 210 words (or something like that), let me include a screencast:

It appears that sometimes there's some kind of a narrow gap between the tag link and the popup, and if the mouse cursor happens to hit that gap while moving the mouse over the popup, the popup disappears.  Moving the mouse fast enough sometimes allows the cursor to skip the gap.
This doesn't happen with all tags on a page: in the animation above, the tags on the topmost post work fine, while those on the second-topmost one are buggy. As far as I can tell, if the bug affects one of the tags on a given post, it affects all of them.  Scrolling the page appears not to have any effect on the behavior (unless I scroll the tag so close to the bottom of the window that the popup opens above the tag instead).
Curiously, while the working popup in the animation does have a visible one-pixel gap above it, the broken one doesn't.  In general, I have not noticed a strong correlation between this bug and the visible positioning of the popup relative to the tag, even if I'd logically expect one.
The behavior also seems to be both browser- and site-dependent: I've observed it on Firefox 29.0 on Kubuntu Linux; it does not seem to happen with Chromium 34.0 on the same platform.  As for sites this happens on, I've been able to reproduce this bug on:

*

*all SE beta sites I've tested (e.g. crypto.SE, codegolf.SE and anime.SE),

*meta.SE (which the animation above is from), and

*rpg.SE.

Typically, on sites where this happens, about half the posts on the front page are affected.
I have not been able to reproduce this on SO, SU, SF, MO, StackApps, gaming.SE, academia.SE, ubuntu.SE, electronics.SE, math.SE, english.SE, webmasters.SE, workplace.SE, skeptics.SE, cooking.SE, scifi.SE, physics.SE, graphicsdesign.SE or tex.SE.
Given that I first noticed this on a beta site, it's not really a surprise that it happens on all of them, and on MSE, which shares essentially the same tag styling.  The appearance on rpg.SE surprised me, just as I was ready to conclude that this issue was only restricted to beta sites and MSE.  I have so far not found any other affected sites, although there might be some.

Edit: I took a look at the code, and it seems that the tag popups are implemented using StackExchange.helpers.MagicPopup(), which features a hardcoded 5 ms (yes, that's 1/200 of a second) time span during which the mouse cursor must move from the tag link to the popup in order to avoid it closing.  Whatever the root cause of this issue is, I suspect that simply increasing the delay to, say 100 ms (= 1/10 of a second) would effectively make it disappear.

A: Fixed in the next build.
The 5ms delay has nothing to do with this; that's just there because when moving the cursor from the popup to the tag, you'll get a mouseout event from the popup and (immediately following) a mousein event from the tag, even if there's no gap. A 0-ms delay (i.e. a nextTick if you will) should be enough here; I just like to give myself a few extra ms for things where you rely on the browser's implementation of event delivery.
But there shouldn't be a gap in the first place; the reason it was (sometimes) there came from the browser's handling of fractional pixels, which is always a fun source of cross-browser weirdness. This also explains the inconsistency you observed between the gap being visible and the gap being there (as in: the popup disappears). When you position something at a y-coordinate of 521.1549274 pixels, you're at the mercy of all kinds of interesting rounding behavior in the browser.
From the next build on, when we measure where exactly the tag menu should appear below the tag, we round this coordinate down to the next integer.


text:
Q: Is it possible to "hold" an event for later firing? What I'm trying to do is: when the user presses a cancel button, or navigates away of the page through a link or a menu option, I check if there are unsaved changes. If so, I ask the user if he/she wants to save. I can't do this with a javascript confirm window because I sometimes have more than two options, so I can't "hold" everything until the user makes a selection like confirm would. So I though to "save" the event, cancel it's current execution, whait until user makes up his/her mind, then take the action needed according to their answer, then raise back the original event.
So, as a code example of what I thought:
I have this piece of code:
var executingEvent;
function someFunction() {
    ...
    if(existUnsavedChanges) {
        showConfirmMessage();
        executingEvent = window.event;
        if (executingEvent.stopPropagation) { executingEvent.stopPropagation(); } else { executingEvent.cancelBubble = true; }
        ...
    }
}

Is there a way to later on do something like this?
raise (executingEvent);

Sounds a bit complex, I'd also welcome other options :)

A: to fire an event use
elem.dispatchEvent(event)
Where elem is either the element you bound to or below it in the DOM (so it bubbles up).
Of course if you already stopped propagation the event wont bubble up, so you may want to create a new event object instead.
var ev = document.createEvent("Event");
ev.initEvent(type, true, true);
ev.origEv = originalEvent;
elem.dispatchEvent(ev);

A: It sounds to me like you're overthinking it - you could just raise the same type of event as the original event (which you would have cancelled) once the user has taken the action that you prompted for.
You can work out what the original event raised was by inspecting properties on the event object e.g. the type of event, the original target, etc.


text:
Q: How to make sure all excel cells formatted as text in a column actually are I have a column of content submitted by multiple users, generally pasted into a sheet, from multiple sources. This column has numbers that should always be formatted as text.
In fact, no matter how this is done, there are always a few items that never have the indicator in the left corner warning that these are formatted as text (which we want to see in all cases)
Checking the individual cell, it does show as formatted text, but in reality on an import into a datatable, if the indicator is missing, the datatype is imported as a number.
Clicking after the number and hitting Enter will change the indicator to text.
How can I do that in VBA? I don't want to visit each cell, click on the end of the content and hit enter.Cutting and paste special in no combination reliably fixes these.
What does excel look at, which gets the format issue right with these text format warning indicators, and yet doesn't seem to get it right when you look at the cell format properties?

Excel 2003 but have had the same issue in later versions too.

A: What worked for me was to check the error indicator, which seemed more reliable than the cell format itself. This looks for anything missing the indicator and forces it to be text.
Unless someone knows something further concerning why this should NOT be done, it solves my issue.
Sub check4textformat()
 For Each cell In Range("E2:E15000")
 If cell.Errors.Item(xlNumberAsText).Value = False Then cell.Formula = cell.Text
 Next
End Sub

A: You really only need to prepend the text indicator character "'" before every number. Assuming that your values are in the first column, in the first 120 rows, you can do it like this:
For i = 1 To 120
    Me.Cells(i, 1).Value = "'" & Me.Cells(i, 1).Value
Next i

If the cell already has a text value, the prepending is ignored. When copying (and when obtaining the value in VBA) the "'" is completely ignored as it only indicates the "type" of the cell contents.

A: Since your main target is not visiting each cell, I will suggest an easier way than VBA (actually, it's probably the easiest way).

*

*Select the desired column.

*Go to Data > Text to Columns.

*Select "Delimited" (should be already selected by default) and press "Next".

*Uncheck all delimiters and press "Next" (you can also leave the default state of "Tab" as the only delimiter).

*Under "Column Data Format", select "Text" and click "Finish".

Done. All the numbers in the column should be stored as text now.


text:
Q: No deadlock while incrementing synchronized Integer objects I am tried to implement deadlock in my program and all was ok except one issue which I can't explain.
public class Test {
    public static void main(String[] args) throws InterruptedException {
        Integer balanceA = 10000;
        Integer balanceB = 10000;

        Thread t1 = new Thread(() -> {
            while (true) {
                Processor.run(balanceA, balanceB);
            }
        });

        Thread t2 = new Thread(() -> {
            while (true) {
                Processor.run(balanceB, balanceA);
            }
        });

        t1.start();
        t2.start();
        t1.join();
        t2.join();
    }
}

class Processor {
    public static void run(Integer balanceA, Integer balanceB) {
        synchronized (balanceA) {
            synchronized (balanceB) {
                System.out.println(balanceA++ + "; " + balanceB--);
            }
        }
    }
}

Why it always show me the same result as if I did't modify Integer values:
10000; 10000
10000; 10000
...

A: balanceA++ is equivalent to balanceA = balance + 1. It doesn't modify the Integer (it can't, because Integer is immutable). It just changes the value of the balanceA parameter to refer to a different object.
If you use AtomicInteger and call either incrementAndGet or getAndIncrement, then you'll see the values changing. You also won't need any synchronization.


text:
Q: Node.js worker for vsivsi/meteor-job-collection fails on job.done(): "Exception while invoking method 'jobs_jobDone' Error: Match error..." I'm writing a Meteor app that adds jobs to a queue that are to be processed by one or more external workers. I'm using vsivsi/meteor-job-collection (https://github.com/vsivsi/meteor-job-collection) and everything worked fine when I was (initially) processing jobs using method-based (i.e., non external) workers from within the Meteor app itself (which queues, creates and manages the jobs).
However, I want an external process, i.e., a Node.js program (not even a Meteor app) to listen for and subsequently process posted jobs instead and saw that this is indeed possible at https://github.com/vsivsi/meteor-job-collection#quick-example (third code block; "node.js Worker") - after all, this enables a more generic and Meteor-agnostic job-processing approach.
I created a separate Node.js program, successfully connected it to my running Meteor app using dpp, ddp-login and meteor-job and started the job listener in exactly the same fashion as I originally did within the Meteor app (when using method-based workers), but I get the following inexplicable error (only) when calling job.done() (other job methods seem to work flawlessly):
"Exception while invoking method 'jobs_jobDone' Error: Match error: Failed Match.OneOf or Match.Optional validation"
The code:
var DDP = require('ddp');
var DDPlogin = require('ddp-login');
var Job = require('meteor-job');
var ddp = new DDP({
    host: "localhost",
    port: 3000,
    use_ejson: true
});

Job.setDDP(ddp);
ddp.connect(connectCB);

function connectCB(err) {
    if (err)
        throw err;
    var options = { //Needed to be able to log in; METEOR_TOKEN is set as an environment variable and this works fine.
        env: 'METEOR_TOKEN',
        method: 'account',
        account: null,
        pass: null,
        retry: 5,
        plaintext: false
    };
    DDPlogin(ddp, options, ddpLoginCB);
}

function ddpLoginCB(err) {
    if (err)
        throw err;
    Job.processJobs('jobs', 'dataGatherJob', {
        concurrency: 8,
        pollInterval: 250
    }, processJobsCB);
}

function processJobsCB(job, cb) {
    //This is where the actual work gets done; this callback works fine,
    //is triggered when my Meteor app adds a new job, and the job object
    //conforms to my expectations; just some example calls on/usages of the
    //job object that work fine and are reactively updated and handled by my
    //Meteor app:
    //console.log(job); //Works fine.
    //job.progress(50, 100); //Works fine.
    //job.fail(); //Works fine.
    job.done(); //Causes the Meteor-app (server) to generate an "Exception while invoking method 'jobs_jobDone' Error: Match error: Failed Match.OneOf or Match.Optional validation" error.
    cb();
}

I do not understand why this is happening. The job id is identical to the one in the actual Mongo collection (the queue uses a Mongo collection to manage jobs) set by the server (I checked this) and besides that, other job operations (e.g., job.fail()) do work. I furthermore reset the "autopublish" and "insecure" packages for my Meteor app intermittently just to be sure that they are not causing the problem and this was not the case.
Any thoughts on this?
Many thanks in advance,
Danny.


text:
Q: run javascript of HTML page without to open HTML page I have tried my best to find the solution but failed. I want to run the JavaScript from an HTML page without opening that page. I have uploaded the page to my domain and want to auto update my database user vehicle distance at 12 a.m.
Can anyone help me understand how to run the JavaScript without opening this page?
<script>
    setInterval(autoIncrease, 1000*60*3);
    function autoIncrease() {
       var date = new Date();
       var h=date.getHours();
       var m=date.getMinutes();
       if(h==0 && m==0){
            $.ajax({
               type: "POST",
               url:"http://mobilapps.zicoil.pk/autoUpdate.php",
               async: false,
               crossDomain: true,
               cache: false,
               success: function(data){
                  alert(data);
               }
           });
        }
   }
</script>

A: From my understanding you need the HTML to run the code, because the webpage contains the code. Do you mean that you want to run the code without opening the webpage? I do not think that you can do that. You must run code in a console or similar. You must use HTML to use it in a browser. Does that answer your question?

A: From your question, it looks like you want to periodically (at 12:00 am?) create an HTTP POST request to the server URL mentioned in your snippet. IF that is true the approach you are trying (i.e from javascript embedded in an HTML page) is not the right approach. The easiest solution would be to convert this to a shell script and invoke from a cron job.

A: From what I understand, you want to run the script without having to open the page in the browser, right?
If Yes, it will not be possible in this way because javascript is interpreted browser side, the interpreters V8, SpriderMonkey, etc ... as we can see here https://en.wikipedia.org/wiki/JavaScript_engine
There are other ways to do this through languages like node.js that runs on a server your javascript code, you can host your node easily and free in '' Now Project '-> https://zeit.co/now or Heroku -> https://www.heroku.com
in my github I have a basic server in node.js to run on heroku -> https://github.com/navarrojava/heroku_node
in 15 minutes you can solve your problem.
I hope to have helped.

A: https://nodejs.org - Have a lot of extra stuff as well as compiler. But theres no html so you have to use console.log . Ajax would not work. But you could use modules like express or request
jsfiddle.net - Browser based
jsdb .org - standalone console just plain javascript
From what  it sounds like you don't want to open it from the browser. In that case you sound try nodejs. It is based off the v8 javascript engine. Which is used in the chrome browser.

Here is a example on how it would work in nodejs.
Note I changed the interval to every 10 second just for the example
https://runkit.com/5818b2f97f47d000133fa878/5818b2f97f47d000133fa879


text:
Q: CSS Filter removes H1 I'm trying to overlay an h1 over an image, using Grid;
for better contrast, I thought about using filter:brightness(80%)
on the image, which, unfortunately, removes the h1 altogether.
Is there any workaround to this? ( without pasting in image URLs in CSS)
(filter is commented for you to apply and see)

body{
  background: grey;
  margin: 10px;
  color: white;
  text-align: center;
}
img{
  max-width: 100%;
  max-height: 100%;
}
.gridcontainer{
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 10px;
  max-width: 100vw;
  align-items: center;
}

.griditem{
  background: black;
}

.headingcover{
  grid-column: 1/3;
  grid-row: 1/2;
  /* filter: brightness(80%); */
}
h1{
  grid-column: 1/3;
  grid-row: 1/2;
}

b

c

d

Foxy

A: other than filter you can use
text-shadow property of css for better contrast.

A: Try adding a z-index to your h1 to put it above your filter in the element stack.
h1 {
    grid-column: 1/3;
    grid-row: 1/2;
    z-index: 10;
}


text:
Q: Want to get the entire document in couchbase after applying group by clause I have multiple json document like this
{
  "event": "eb1518fb-81d1-49aa-9854-405267a7828f",
  "identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
  "bookingCode": "ABCDE",
  "status": "SUCCESS",
  "clientId": "DESKTOP",
  "created": "2021-04-15T04:16:35+00:00",
  "locationType": "STORE"
},
{
  "event": "eb1518fb-81d1-49aa-9854-405267a7828f",
  "identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
  "bookingCode": "ABCDE",
  "status": "FAILURE",
  "clientId": "MOBILE",
  "created": "2021-04-15T04:16:35+00:00",
  "locationType": "STORE"
},
{
  "event": "eb1518fb-81d1-49aa-9854-405267a7828f",
  "identityId": "q1244b44-d5ce-4473-815c-591a4ff1bea3",
  "bookingCode": "BCD",
  "status": "SUCCESS",
  "clientId": "MOBILE,
  "created": "2021-04-15T04:16:35+00:00",
  "locationType": "STORE"
},
...

I want to apply group by identity id and booking code to get the unique records and need to get the entire JSON document after filtering, something like this
select *, count(*) from eventbooking where event = "eb1518fb-81d1-49aa-9854-405267a7828f"
group by bookingCode, identityId

This is giving me an error Expression self must depend only on group keys or aggregates
Is there any way that i can get the entire json document after filtering with group by?
I'm expecting an output similar to this.
{
      "event": "eb1518fb-81d1-49aa-9854-405267a7828f",
      "identityId": "5eb44b44-d5ce-4473-815c-591a4ff1bea3",
      "bookingCode": "ABCDE",
      "status": "FAILURE",
      "clientId": "MOBILE",
      "created": "2021-04-15T04:16:35+00:00",
      "locationType": "STORE"
    },
    {
      "event": "eb1518fb-81d1-49aa-9854-405267a7828f",
      "identityId": "q1244b44-d5ce-4473-815c-591a4ff1bea3",
      "bookingCode": "BCD",
      "status": "SUCCESS",
      "clientId": "MOBILE,
      "created": "2021-04-15T04:16:35+00:00",
      "locationType": "STORE"
    }

A: Query uses GROUP BY or Aggregates then projection can only contain

*

*Group keys

*Aggregates

*Expression on GROUP keys or Aggregates

*Constants

Assume each group has less documents you can aggregate all of them as ARRAY. If need different format, get via  array subscript or use UNNEST in parent query. If it has lot use covered query and ARRAY_AGG document keys then parent query get those document (streamed the documents).
SELECT COUNT(1) AS cnt,
       ARRAY_AGG(e) AS docs
FROM eventbooking AS e
WHERE e.event = "eb1518fb-81d1-49aa-9854-405267a7828f"
GROUP BY e.bookingCode, e.identityId;

If you need latest created document in the group only.
SELECT COUNT(1) AS cnt,
       MAX([e.created,e])[1].*
FROM eventbooking AS e
WHERE e.event = "eb1518fb-81d1-49aa-9854-405267a7828f"
GROUP BY e.bookingCode, e.identityId;

A: A Query will never return a document.  It always returns a Map<KeyString, Value> of the projection in your SELECT clause (in this case, "*", all the values).
If you need the document (in order to modify it), you can query for the Meta.Id for documents matching your WHERE clause and then iterate over them, getting, altering and saving the document.


text:
Q: Primeng P-Card Conditional styling not working after version upgrade Updated primeng version from 9 to 15 and the conditional styling in P-card stopped working.
 <p-card align="center" [style]="{backgroundColor: (owner === 'A' && isEnableA)  ? '#005DAA' : '#b3ddff' , color: (owner === 'A' && isEnableA) ? 'white' : 'grey'}">

Is there any format change ?


text:
Q: Why the debugger is inconsistent in showing @State properties? In the picture below I see the following inconsistencies:

*

*The string "(username)" is printed as expected by the program but the debugger throws an error: error: Couldn't lookup symbols:
FWSNewsReader.LoginView2.username.getter : Swift.String

*The automatically synthesized _username property is shown in the view variable windows of the debug as having an undocumented internal "value" property but the wrappedValue public property is not shown. Why is that?

*assigning a new value to the state variable with e _username.wrappedValue = "newVal" is possible ( although correctly throwing a warning Modifying state during view update, this will cause undefined behavior) but trying to do the same with e username = "newVal" throws an error : Couldn't lookup symbols:
FWSNewsReader.LoginView2.username.setter : Swift.String
the code:
struct LoginView: View {
    @State private var username: String = ""
    @State private var password: String = ""

    var body: some View {
        NavigationView {
            VStack{
                VStack(spacing: 10){
                    TextField("Username", text: $username)
                        .padding(10).background(Color.gray.opacity(0.2))
                    TextField("Password", text: $password)
                        .padding(10).background(Color.gray.opacity(0.2))
                }
                .padding()
            }
            .navigationViewStyle(.stack)
        }
        .frame(width: 400, height: 500)
    }
}


text:
Q: Creating custom init method for UIView to add a UILabel At the moment I have a custom UIView class which completes the following:
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self setupView];
    }
    return self;
}
-(void)setupView {
    self.layer.cornerRadius = 4;
    self.layer.masksToBounds= YES;
    self.backgroundColor = [UIColor whiteColor];
    self.layer.borderWidth = 1;
    self.layer.borderColor = [UIColor lightGrayColor].CGColor;
}

I also have another UIView Category that creates a new UIView and makes it so that I can use autolayout which is the following:
@implementation UIView (Autolayout)
+(id)autolayoutView
{
    UIView *view = [self new];
    view.translatesAutoresizingMaskIntoConstraints = NO;
    return view;
}

Both are fairly simple. What I would like to do now is create a custom init method for the UIView.
Question
I would like the custom init method to be used to create a UILabel and it to the UIView. However, I would like the init method to use the UIView category that I have already created? I am sure this is fairly simple, just not sure how to complete this?
EDIT
At present to create a custom autolayout view I call UIView *myView = [MyCustomViewClass autoLayoutView]
What I would like to do is update the custom view class init method to create a label, but still have it called in the same way so that the category is being used and I get the auto layout information being called too.
EDIT 2
What would be really useful is if I could pass in a parameter to determine if the UIView should have a UILabel. So a custom init method that could be called if the view should have a label. I know the code to create and add a label/constraints I am just not to sure on the subclassing/category link and creating custom init methods. As well as how this is called in conjunction with the autoLayoutView call?

A: If what i'm getting from your question is correct, then this is what you want to do:
just use the already created init method that you have, and add more onto it.
 +(id)autolayoutViewWithAddedLabel:(BOOL)addedLabel
 {
     UIView *view = [self new];
     view.translatesAutoresizingMaskIntoConstraints = NO;

     if(addedLabel) {
        // do your label stuff here
        [self addSubview://label];
     }
     return view;
 }

then if you wanted to call this method, you could do just as you had done with the method in your question by saying
  MyClass *mc = [MyClass autolayoutViewWithAddedLabel:YES];

and that'll add the label onto your custom view
hope that helps!

A: The problem with this approach is that you are using a category on a generic UIView to create the UIView with UIView *myView = [MyCustomViewClass autoLayoutView].
Since it's a UIView and not the custom subclass you made, it won't have reference to any custom init methods you make. So one solution would be... Why not add all the customization into the category?
+(id)autolayoutViewWithCustomization:(BOOL)customize addLabel:(BOOL)addLabel
{
    UIView *view = [self new];
    view.translatesAutoresizingMaskIntoConstraints = NO;

    if (customize) {
       view.layer.cornerRadius = 4;
       view.layer.masksToBounds= YES;
       view.backgroundColor = [UIColor whiteColor];
       view.layer.borderWidth = 1;
       view.layer.borderColor = [UIColor lightGrayColor].CGColor;
    }

    if (addLabel) {
       // Create a label here
       [self addSubview:label];
    }

    return view;
}


text:
Q: QGraphicsItem interactive resizing i've forked the project https://github.com/cesarbs/sizegripitem that is a intercative QGraphicsItem resizing with 8 handlers, the problem is that if i set my main QGraphicsItem to be Selectable, when i drag the handlers, the main QGraphicsItem moves rather then being resized, bellow is the source for SizeGripItem.cpp
/*
 * SizeGripItem - A size grip QGraphicsItem for interactive resizing.
 *
 * Copyright (c) 2011 Cesar L. B. Silveira
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#include <QBrush>
#include "SizeGripItem.h"

SizeGripItem::HandleItem::HandleItem(int positionFlags, SizeGripItem* parent)
    : QGraphicsRectItem(-4, -4, 8, 8, parent),
      positionFlags_(positionFlags),
      parent_(parent)
{
    setBrush(QBrush(Qt::lightGray));
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);
}

int SizeGripItem::HandleItem::positionFlags() const
{
    return positionFlags_;
}

QVariant SizeGripItem::HandleItem::itemChange(GraphicsItemChange change,
                                              const QVariant &value)
{
    QVariant retVal = value;

    if (change == ItemPositionChange)
    {
        retVal = restrictPosition(value.toPointF());
    }
    else if (change == ItemPositionHasChanged)
    {
        QPointF pos = value.toPointF();

        switch (positionFlags_)
        {
            case TopLeft:
                parent_->setTopLeft(pos);
                break;
            case Top:
                parent_->setTop(pos.y());
                break;
            case TopRight:
                parent_->setTopRight(pos);
                break;
            case Right:
                parent_->setRight(pos.x());
                break;
            case BottomRight:
                parent_->setBottomRight(pos);
                break;
            case Bottom:
                parent_->setBottom(pos.y());
                break;
            case BottomLeft:
                parent_->setBottomLeft(pos);
                break;
            case Left:
                parent_->setLeft(pos.x());
                break;
        }
    }

    return retVal;
}

QPointF SizeGripItem::HandleItem::restrictPosition(const QPointF& newPos)
{
    QPointF retVal = pos();

    if (positionFlags_ & Top || positionFlags_ & Bottom)
        retVal.setY(newPos.y());

    if (positionFlags_ & Left || positionFlags_ & Right)
        retVal.setX(newPos.x());

    if (positionFlags_ & Top && retVal.y() > parent_->rect_.bottom())
        retVal.setY(parent_->rect_.bottom());
    else if (positionFlags_ & Bottom && retVal.y() < parent_->rect_.top())
        retVal.setY(parent_->rect_.top());

    if (positionFlags_ & Left && retVal.x() > parent_->rect_.right())
        retVal.setX(parent_->rect_.right());
    else if (positionFlags_ & Right && retVal.x() < parent_->rect_.left())
        retVal.setX(parent_->rect_.left());

    return retVal;
}

SizeGripItem::SizeGripItem(Resizer* resizer, QGraphicsItem* parent)
    : QGraphicsItem(parent),
      resizer_(resizer)
{
    if (parentItem())
        rect_ = parentItem()->boundingRect();

    handleItems_.append(new HandleItem(TopLeft, this));
    handleItems_.append(new HandleItem(Top, this));
    handleItems_.append(new HandleItem(TopRight, this));
    handleItems_.append(new HandleItem(Right, this));
    handleItems_.append(new HandleItem(BottomRight, this));
    handleItems_.append(new HandleItem(Bottom, this));
    handleItems_.append(new HandleItem(BottomLeft, this));
    handleItems_.append(new HandleItem(Left, this));
    updateHandleItemPositions();
}

SizeGripItem::~SizeGripItem()
{
    if (resizer_)
        delete resizer_;
}

QRectF SizeGripItem::boundingRect() const
{
    return rect_;
}

void SizeGripItem::paint(QPainter* painter,
                         const QStyleOptionGraphicsItem* option,
                         QWidget* widget)
{
}

#define IMPL_SET_FN(TYPE, POS)                  \
    void SizeGripItem::set ## POS (TYPE v)      \
    {                                           \
        rect_.set ## POS (v);                   \
        doResize();                             \
    }

IMPL_SET_FN(qreal, Top)
IMPL_SET_FN(qreal, Right)
IMPL_SET_FN(qreal, Bottom)
IMPL_SET_FN(qreal, Left)
IMPL_SET_FN(const QPointF&, TopLeft)
IMPL_SET_FN(const QPointF&, TopRight)
IMPL_SET_FN(const QPointF&, BottomRight)
IMPL_SET_FN(const QPointF&, BottomLeft)

void SizeGripItem::doResize()
{
    if (resizer_)
    {
        (*resizer_)(parentItem(), rect_);
        updateHandleItemPositions();
    }
}

void SizeGripItem::updateHandleItemPositions()
{
    foreach (HandleItem* item, handleItems_)
    {
        item->setFlag(ItemSendsGeometryChanges, false);

        switch (item->positionFlags())
        {
            case TopLeft:
                item->setPos(rect_.topLeft());
                break;
            case Top:
                item->setPos(rect_.left() + rect_.width() / 2 - 1,
                             rect_.top());
                break;
            case TopRight:
                item->setPos(rect_.topRight());
                break;
            case Right:
                item->setPos(rect_.right(),
                             rect_.top() + rect_.height() / 2 - 1);
                break;
            case BottomRight:
                item->setPos(rect_.bottomRight());
                break;
            case Bottom:
                item->setPos(rect_.left() + rect_.width() / 2 - 1,
                             rect_.bottom());
                break;
            case BottomLeft:
                item->setPos(rect_.bottomLeft());
                break;
            case Left:
                item->setPos(rect_.left(),
                             rect_.top() + rect_.height() / 2 - 1);
                break;
        }

        item->setFlag(ItemSendsGeometryChanges, true);
    }
}

A: Setting the parent positions in SizeGripItem::HandleItem::itemChange looks odd here. I think that the itemChange function probably should not be setting the position of the parent item. It should only adjust coordinates and return a value.
In the past, I've done this a little differently. Firstly, remove the ItemSendsGeometryChanges flag in the HandleItem.
Then implement mousePressEvent, mouseMoveEvent and mouseReleaseEvent for HandleItem. In mouseMoveEvent, update the parent's bounding rect as the handle is moved.
This allows both the main GraphicsItem and its handles to be set as selectable and moveable.


text:
Q: I R ,how to summarise numeric columns automaticaly. Thanks I R ,how to summarise numeric columns automaticaly. Thanks
library(tidyverse)
df <- tibble(label=LETTERS[1:8],
             x = rep(2:5, each = 2) / 2,
             y = rep(2:3, each = 4) / 2)

df %>% sum(across(where(is.numeric))) #can't work
df %>% sum(where(is.numeric)) #can't work

A: You need to use across inside a dplyr verb, such as mutate or summarize, then you need to define the function you want to apply in .fns, I used mean as an example in your data.
df %>% summarize(across(.cols = where(is.numeric),.fns = mean))

# A tibble: 1 x 2
      x     y
  <dbl> <dbl>
1  1.75  1.25


text:
Q: Is there a way in Lightning to get a dynamic input type like  in VF In Visualforce I loved it not to think about types of input-fields and go instead totally blind with an <apex:inputField ... /> letting the platform bother if a field is a textfield, checkbox, picklist or whatever. Workarounds to enforce different types where also possible in VF for the rare occasions where it was necessary.
In the lightning documentation and in the examples I read now, that the input type is expressed explicitly, no longer implicitly, like so
<ui:inputText ... />
<ui:inputNumber ... />
<ui:inputDateTime ... />

Is there a way to get dynamically the best-matched input type as in VF? If not, are there any plan to add this in the future?

A: Maybe.
Reading this article Lightning - How to use force:inputField?, it should be exactly what we need. The basic syntax is
 <force:inputField value="{!v.account.Name}" />

The documentation is here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_force_inputField.htm

An abstract component that provides a concrete type-specific input
  component implementation based on the data to which it is bound.

But it seems to fall short in documentation and examples plus it behaves very buggy during my tests. See details in the link above.


text:
Q: Encoding issue asp.net mvc 4 I´m trying to render a dynamic database title in asp.net mvc view. So I have something like this in my view.
@section meta {

    <meta name="title" content="@Model.title" />
}

When model has special characters like Misión in spanish it shows in title something like
Misi&#243;n ... I´m using meta charset utf8 in my layout. Is there a special encoding I´m missing ?
How can I render Misión in title page ?

A: Using @someproperty will assume you're rendering out HTML and make sure it gets encoded to prevent things like cross site scripting. In this instance you want it to render the raw value, in which case you need to use Html.Raw(...) to render your content in it's raw form.
@section meta {
    <meta name="title" content="@Html.Raw(Model.title)" />
}

However, just be aware that if the Model.title can come from user generated content (or some other untrusted source), you could be opening yourself up to security issues (for example if your Model.title's value was "test" /> <script ...etc...", a malicious user could use it to inject code into your pages.
Edit: Just including the content of my comment below for future googlers, since it appears that was the actual solution...
If you put the @Html.Raw(Model.title) directly in the page somewhere (i.e. not in the meta tag) and it works correctly there, you may be facing the same problem discussed here, in which case you could work around it by using the slightly uglier:
@section meta {
    <meta name="title" @Html.Raw("content=\" + Model.title + "\"") />
}

A: Approach - 1
string value1 = "<html>";                  // <html>
string value2 = HttpUtility.HtmlDecode(value1);  // <html>        //While getting
string value3 = HttpUtility.HtmlEncode(value2);  // <html>  //While saving

Approach - 2
Html.Raw("PKKG   StackOverFlow");           // PKKG StackOverFlow


text:
Q: .htaccess allow access to files only from includes I have various subfolders on my website and I would like for the user not to be able to access them through URL but on the same time my main PHP files to be able to include them or use them as actions on forms or links.
I tried using an .htaccess with
<Files *>
    Order Allow,Deny
    Deny from All
</Files>

but it denied all access even from within my own scripts. Logical as I found out, but I cannot know how to make it work. Any ideas?
P.S. My main concern is that some of the files are not included in main PHP files BUT they are linked there and their code ends up with a header('Location: ../index.php'); returning to the main page of the project.

A: Do this:
<Files *>
    Order Deny,Allow
    Allow from 192.168.100.123 127.0.0.1
    Deny from all
</Files>

The list of IP's will be specific hosts you allow, like localhost.
This also works with the  directive, not just file, if you want only certain directories blocked.

A: There is an even safer method.  Store your include files below the web accessible folders.  So if your web files are here...

/var/www/mysite.com/

Store your include files here:

/var/includes/

Then include them with a full path...
include '/var/includes/myincludes.inc.php';

From the web, the myincludes.inc.php file is completely inaccessible.

A: I see a lot of answers with Allow,Deny not Deny,Allow
The order of this matters and is causing the problem. You are telling the computer that deny is more important than allow, because it is listed last. To show you... if you say:
<Files .htaccess>
Order Allow,Deny
Deny From All
Allow From xxx.xxx.xxx.xxx 127.0.0.1
</Files>

You are saying first Allow anyone Allowed, then Deny All... Which still Denies ALL.
If you reverse to Deny,Allow you are saying Deny All, then Allow anyone Allowed.
<Files .htaccess>
Order Deny,Allow
Deny From All
Allow From xxx.xxx.xxx.xxx 127.0.0.1
</Files>

Allow command, being more important, because it is the final command, is therefore allowing those listed after Allow From command.
xxx.xxx.xxx.xxx = Your IP

A: Usually to protect these logic files from public access you can

*

*put it in protected directory, above htdocs

*add a check for public constant.. if(!is_defined(some_root_const)){die();}

*change extension to .inc or something.. and deny with .htaccess based on that

A: put your application code outside of your public html folder. then you can add an include path at the top of your scripts to allow your script to access them as if they were in the same folder.
http://php.net/manual/en/function.set-include-path.php

A: In you .htaccess you will have to specify which IP's, hosts you want to allow and you can do it per directory as well. for e.g.
<Directory /dir/to/block>
    Order Allow,Deny
    Allow from 192.168.0.1 4.4.4.4
    Deny from All
</Directory>
<Directory /dir/to/allow>
    Order Allow, Deny
    Allow from All
</Directory>


text:
Q: Loading file via BCP with |*| delimiter I have a file with |*| delimiter. In bcp, using -t|*| does not work. can we set delimiter with more than 1 character?

A: You can use -t '|*|' and that will work fine for that delimiter. Single quotes work for multiple character delimiters for both row and field delimiter.


text:
Q: TradingView resolveSymbol method called twice I'm trying to integrate TradingView library with my web app. The chart is loading fine, but when loading both, resolveSymbol method is called twice.
Datafeed.Container.prototype.resolveSymbol = function (
    symbolName,
    onSymbolResolvedCallback,
    onResolveErrorCallback
  ) {
    this._send(
      datafeedUrl + this._symbolResolveURL,
      {
        symbol: symbolName ,
      },
      function (dataObj) {
          onSymbolResolvedCallback(dataObj);
      }
    );
  };

Actually the data returned on both times are the same. The Chrome dev tools network tab shows the calls as below

What is that going wrong? Somehow the library assumes the symbol is not resolved. How to rectify that?


text:
Q: Help with a limit involving exponential Find  the following limit :
$$\lim_{x \to \infty}\dfrac{3^{x+1}+2^{x}}{2^{x+1}-3^x}$$
Any further links for studying this type of limits would be much appreciated

A: Just divide everything by $3^x$. You'll see the limit is the same as
$$
\lim_{x \to \infty}\dfrac{3+(2/3)^{x}}{2 (2/3)^x - 1} = \frac{3+0}{0-1} = -3.
$$
I'm assuming that $x \to \infty$ means $x \to +\infty$... If not, also consider
$$
\lim_{x \to -\infty} \frac{2^x(3 (3/2)^x+1)}{2^x(2-(3/2)^x)}=\frac 12
$$

A: As has been already shown, for these kind of limits a good strategy is to factor out from numerator and denominator the "stronger" terms that is $3^x$ in this case
$$\lim_{x \to \infty}\dfrac{3^{x+1}+2^{x}}{2^{x+1}-3^x}=\lim_{x \to \infty} \frac{3^x}{3^x}\dfrac{3^{}+(2/3)^{x}}{2\cdot (2/3)^{x}-1}=\cdots$$
Se also the following examples:

*

*limit of $a_n= \frac{7^n + 6^n -n^{100}}{(7.1)^n-7^n+n^{101}}$ as n goes to infinity

*Find the limit of $\frac{3^{2n + 1} + 2^{3n + 1}}{7^{n+2} + 9^n}$ when $n$ goes to infinity

*How can i get the limit of $(10(n!)+10^n)/(n^{10}+n!)$ when $n$ goes to $\infty$?


text:
Q: navigation on media cant get 100% width My navigation cant get a full width on media, I tried every way and cant locate where my mistake is, so I attached you the code, please if any one have an idea how to solve this, and set the width to full width = 100%?
The HTML

home

second

third

menu

The CSS:
nav {
width:100%;
margin-top: 0;
padding: 10px;
text-align: center;
font-family: arial;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
position:fixed;

text-align:right;
z-index:10;

}

nav li{
    display: inline;

}
nav ul{
min-height:20px;

}
.navi{
background: rgba(0,0, 0, 0.5);

}
.navi:hover{
background-color: rgba(0,0,0, 1);
}

.link-1 {
transition: 0.3s ease;
color: #fff;
font-size: 16px;
text-decoration: none;
border-top: 1px solid ;
text-align:right;
padding: 20px 0px;
margin: 0 20px;
font-weight: italic;
letter-spacing:2px;
}
.link-1:hover {
border-top: 2px solid #fff;

text-decoration: none;
color:#fff;

padding: 3px 6px;

}

.logo{
text-align:left;
margin-left:35px;
margin-top:-25px;
}

.menu {display:block;

}
.handle {display:none;}

/*media try*/

@media (max-width: 580px) {

#target{

}
nav {
width:100%;
margin-top: 0;
display:block;
max-height:0;
margin-top:-20px;
padding-top:18px;
padding-right:-20%;

}

nav li{
display:block;
padding:10px;
background:#000;
}
.navi{
background: rgba(0,0, 0, 0.9);
text-align:center;
border:0;
background:#000;
}
.navi:hover{
background-color: rgba(0,0,0, 1);
border:0;

}

.link-1 {
border:0px solid #bbb;
font-size:18px;

}
.link-1:hover {
text-decoration:underline;
border:0px solid #bbb;

}

.logo{
text-align:left;
margin-left:35px;
margin-top:-25px;
    display: none;
}
.menu {display:none;

}
.handle {display:block;
color:#fff;
font-size:40px;
text-decoration:none;
text-align:right;

}
.handle:hover{

}
.handle  p{
color:#fff;
cursor: pointer;
   -webkit-text-stroke: 1px black;
    -webkit-font-smoothing: antialiased;

}

}

I fixed the HTML.

A: Add box-sizing: border-box; for nav.
ul tag is missing in your html.
Also make sure to remove the default padding and margin for ul.
nav ul{ padding: 0; margin:0;}
To stretch menu to full width of the window, apply the bg colour for nav, Or remove the  padding:10px from nav.


text:
Q: Loopback accessToken not persisted to database The access tokens created are not being persisted to the postgresql database.  I created extended users and access_tokens models using the strongloop controller interface using the User and AccessToken models as parents.  On login the user is successfully queried from the database, login is successful, and the access token is created.  However the access token is not persisted in the database and so essentially the login fails.
Inside my model_config.json I have the following entries:
"access_tokens": {
  "dataSource": "postgresdb",
  "public": true
},
"users": {
  "dataSource": "postgresdb",
  "public": true
}

When investigating, the create function is called and the accessToken.beforeCreate() properly triggered and successfully returned.  However the database does not store the token.  When altering the access_tokens database to use db (memory) the access token created still cannot be used for authentication.
I am certain the database settings are correct because the access_tokens table is on the same db as the users and the users successfully grabs all the user information.


text:
Q: ELANTech Touchpad no cursor movement/right-click after upgrade from 14.04 to 14.10 (Xubuntu) I upgraded from Xubuntu 14.04 to 14.10 on my ASUS UX305F and the cursor on my touchpad no longer moves and only the left-click functionality works.
It's still recognized:
$ xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                     id=10   [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                  id=14   [slave  pointer  (2)]

And it's enabled:
$ xinput list-props 14
Device 'ETPS/2 Elantech Touchpad':
Device Enabled (136):   1
Coordinate Transformation Matrix (138): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (267): 0
Device Accel Constant Deceleration (268):   1.000000
Device Accel Adaptive Deceleration (269):   1.000000
Device Accel Velocity Scaling (270):    10.000000
Device Product ID (254):    2, 14
Device Node (255):  "/dev/input/event7"
Evdev Axis Inversion (271): 0, 0
Evdev Axis Calibration (272):   <no items>
Evdev Axes Swap (273):  0
Axis Labels (274):  "Abs MT Position X" (294), "Abs MT Position Y" (295), "Abs MT Pressure" (296), "Abs Tool Width" (292), "Abs MT Touch Major" (293), "None" (0), "None" (0), "None" (0)
Button Labels (275):    "Button Left" (139), "Button Unknown" (257), "Button Unknown" (257), "Button Wheel Up" (142), "Button Wheel Down" (143)
Evdev Scrolling Distance (276): 0, 0, 0
Evdev Middle Button Emulation (277):    0
Evdev Middle Button Timeout (278):  50
Evdev Third Button Emulation (279): 0
Evdev Third Button Emulation Timeout (280): 1000
Evdev Third Button Emulation Button (281):  3
Evdev Third Button Emulation Threshold (282):   20
Evdev Wheel Emulation (283):    0
Evdev Wheel Emulation Axes (284):   0, 0, 4, 5
Evdev Wheel Emulation Inertia (285):    10
Evdev Wheel Emulation Timeout (286):    200
Evdev Wheel Emulation Button (287): 4
Evdev Drag Lock Buttons (288):  0

I don't know what driver is installed, but I've tried to install the synaptics driver and it apt-get tries to uninstall some xorg packages (xorg, xserver-xorg-core-lts-utopic, xserver-xorg-input-evdev-lts-utopic, xserver-xorg-lts-utopic, xserver-xorg-video-intel-lts-utopic, xubuntu-desktop) and installing xserver-xorg-core.
THat makes me think there are some uneven versions of things installed, but even if I accept apt-get's solution, it fails, complaining:

E: Unable to correct problems, you have held broken packages.
E: Unable to lock the download directory

I don't need to install synaptics if I can just get the touchpad working, but I suspect I will need to. Any ideas?