text:
Q: in-memory-only modifications to an SQLite database I'm using perl with an externally supplied sqlite database to pre-generate about 9k pages for a statically-served website.
I have some algorithmic improvements to the original data, but for consistency sake, I think it'll make more sense if my scripts leave the original database alone, and modify the data only in memory (if needed, even the whole database should fit into RAM without any issues), prior to generating the web-pages.
How do I do this?
I smell that I could benefit from some kind of an SQL transaction feature here (which should be abandoned after my scripts are done), is that correct?  Does it sound like a good idea, given the constraint of wanting to keep the original database file unmodified?  (E.g., where and how the data from ongoing transactions is stored when using SQLite from Perl?)  Any other way to accomplish what I need?  (I'm perl and sql novice -- looking for annotated code samples.)
I guess as a last resort I could always make a copy of the database file within the filesystem, but that would seem like an ugly and inefficient solution.

A: I haven't tested this, but you should be able to use the SQLite backup API to load your database into memory.
You'd likely open :memory: (or "" if you want a temporary, file backed DB), and then call sqlite_backup_from_file to load the database in one shot.
e.g. (untested)
my $db = DBI->connect("dbi:SQLite:dbname=:memory:", '', '', {});
$db->sqlite_backup_from_file($ENV{DATABASE});
#Database should be loaded into the current memory DB at this point.

A: You could create a RAM disk and put the database path on that. The details will depend on your OS.


text:
Q: Me salen barras iguales al intentar modificar el eje en ggplot Modifiqué el eje, para que en lugar de los conteos me muestre los porcentajes.
library(dplyr)
library(ggplot2)
library(scales)
library(gridExtra)
uno = c(3337,998)
calif = c("paso","no paso")

df = data.frame(calif,uno)

p1 <- ggplot(df, aes(x = calif, y=..count../sum(..count..), fill = calif)) +
  guides(fill=FALSE, color=FALSE) +
  ggtitle("Distribución de notas para estudiantes que tomaron Precálculo la primera vez") +
  theme(plot.title = element_text(hjust = 0.5)) + scale_x_discrete("Nota")  +
  geom_bar()+scale_y_continuous(labels=percent, limits = c(0,.95),("Porcentaje")) +
  geom_text(stat='count', aes(label=..count..), vjust=-1)

Sin embargo, solo me salen dos barras iguales.

A: Es razonable que sean dos barras del mismo tamaño, esto: ..count../sum(..count..) siempre es 1. También son algo extraños los datos desde dónde partes, pareciera que es una estadística completamente precalculada, no es lo más habitual, pero claro, puede también graficarse con ggplot, simplemente precalcularía también el porcentaje:
df$porc <- df$uno/sum(df$uno)

Y, claro no podemos usar stat="count"  sino stat="identity" ya que justamente viene todo precalculado:
ggplot(df, aes(x = factor(calif), y=porc, fill = calif)) +
  guides(fill=FALSE, color=FALSE) +
  ggtitle("Distribución de notas para estudiantes que tomaron Precálculo la primera vez") +
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_x_discrete("Nota")  +
  geom_bar(stat="identity") +
  geom_text(stat='identity', aes(label=round(porc,2)), vjust=-1)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there an equivalent in Java to C#'s Lookup data structure? .Net's LINQ has the Lookup<TKey, TElements> data structure where for a given key, multiple values can be stored.
What is an equivalent data structure in Java?

A: Guava's MultiMap seems to be a good parallel to LINQ's Lookup.


text:
Q: MongoDB: A refers to B. Get A's whose B's satisfy some conditions Setup
We have two collections:

*

*maps: Each document has an _id and coordinates fields. The coordinates field is a GeoJSON LineString that represents a route.
We have around 200K maps

*segments: Each document holds details about a route (elevation, athelete count etc) and has a map field which holds the _id of a certain map.
We have around 230K segments (some of them are not ignored).
The relationship between maps and segments is a one-to-one relationship.
Use case
Our server receives query which specifies:

*

*The view/rectangular bound in GeoJSON format

*Other filters like range of athlete count etc

Current solution
Right now our process looks like this:

*

*Get all the maps whose any point lies inside the rectangular bounds
The query looks something like this:

   {
          coordinates: {
              $geoIntersects: {
                  $geometry: {
                    type: "Polygon",
                    coordinates: [bounds],
                  }
              },
            }
   }

*Get an array of the maps _id s  that satisfy this constraint

*Get the segments that contain an id of those _ids :

    {
         map: { $in: mapIds }
    }

*Populate their map field on the server directly

Problem
The problem is that our query is too slow.
Our collections are properly indexed. We have a 2dsphere indexing on the coordinates field of the map
The bottleneck seems to be in step 3). The mapIds array may be too big and the database might be doing too many comparisons.
Question
Is there a way, maybe another operator we can use, to make this query more efficient?
I am not even sure what type of query this would fall under, but it some kind of a reverse populate where the condition is not on the populated but on the populated by, if that makes sense.
I was thinking maybe I could use the aggregate operation with some $lookup but I am not sure how to use it.
Any help is welcome.


text:
Q: How to extract a JWT generated by Cognito, and store as HTTPonly cookie and use with subsequent API requests (React) I am using cognito for user authentication. Upon successful authentication (userEmail and password) Cognito generates id, access and refresh tokens which I can see in my console.log responses.
My question is, how can  extract these tokens and store them as a 'global scope variable' for use (potentially as a HTTPOnly Cookie) with API calls in various React components in my application?
(I am open to any suggested 'fixes' to my current approach, or equally, sugestions on more efficient ways of managing this):
What I have tried..
Defining the JWT token as a variable in a JWTutils.js component and importing it to the login.js where I assign the value of the response from cognito. My thinking is that this would allow me to use the token value throughout the application. All, this does however, is interrupt a successful login. So even when I enter correct details, my console.log actually shows onSuccess, but immediately after my browser renders the cognito Modal saying Failure : Username or password are incorrect.
What is the best way to deal with and manage the JWT from the client side?
My code is attached below:
Login.js
import React from 'react'
import poolData from '../Userpool';
import { CognitoUser, AuthenticationDetails } from 'amazon-cognito-identity-js';
import { useState, useEffect } from 'react';
import { useHistory } from 'react-router-dom';
import JWT from '../utils/JWTutils';

const Login = () => {

    const[email,setEmail]=useState("");
    const[password,setPassword]=useState("");

    let isAuth = false;

    let history = useHistory();

    const onSubmit =(event)=>{
        event.preventDefault();

        const user= new CognitoUser({
            Username: email,
            Pool: poolData,
        } );

        const authDetails = new AuthenticationDetails({
            Username: email,
            Password : password,
        } );

        console.log("authDetails", authDetails)
        console.log("user", user )

        user.authenticateUser(authDetails,{
            onSuccess: (data)=>{
                console.log("On Success: " , data)
                console.log("JWT", data.idToken.jwtToken)
                JWT=data.idToken.jwtToken
                isAuth =true;
                JWT = (data.idToken.jwtToken) // <----this is where the modal 'pops up' and the //application fails
                    history.push("/secure");
            }  ,
            onFailure:(err)=>{
                alert("Failure : Username or password are incorrect")
                history.push("/")
            } ,
            newPasswordRequired: (data)=>{
                console.log("New Password Required: ", data)
            }
        }  )
    }

    return (

Login

            <form onSubmit={onSubmit} >
            Email

            <input type="email" value={email}
            onChange={(event)=>setEmail(event.target.value)} />

            Password

            <input type="password" value={password}
            onChange={(event=>setPassword(event.target.value))} />

             <button>Login</button>
            </form>

    )
}

export default Login;

JWTutils.js
  const JWT =""
export default JWT;

A: The way you have it, JWT is a const and cannot be reassigned. This is likely why your current approach blows up.
You could easily convert JWTUtils to a simple "store" that allows getting/setting of the token:
// JWTUtils
let token;

export default {
  setToken: t => token = t,
  getToken: () => token,
}

And then use that in your success handler:
onSuccess: (data) => {
  JWT.setToken(data.idToken.jwtToken)
  // ...whatever else you need to do...
}

Anything else that needs it can then access it via getToken:
import JWT from '../JWTUtils';

const token = JWT.getToken();

if (token) {
  // do whatever you need to do
}

You could extend the JWTUtil to stash it in local storage so it would persist across page reloads, etc.

Note: You could just change const JWT = "" to let JWT = "", but this would allow any code anywhere to change its value, which is A Bad Idea™ and could lead to problems that are difficult to diagnose.
By sending it through a well-defined API (getToken, setToken) and keeping the variable itself private you can enforce rules around how it's accessed, set debugging breakpoints whenever it changes, swap out the actual implementation without affecting existing usage, etc.


text:
Q: Sort PivotTable VBA OBJECTIVE
Sort Pivot Table Values by Descending order.
APPROACH

*

*Delete previous PivotTable (PIVOT)

*Set up new PivotTable location (target)

*Create PivotCache (pvtCache)

*Deply PivotTable (pvt)

*Add PivotTable Fields (pvt.PivotFields(_))

*ISSUE: Sort PivotTable field (PivotField("Base Expense")) in descending order
CODE
Sub createPivot()

Dim ws As Worksheet
Dim pvtCache As pivotCache
Dim pvt As pivotTable
Dim srcData As String
Dim lastRow As Long
Dim startPvt As String
Dim target As Worksheet

'Delete previous pivottable
Worksheets("PIVOT").PivotTables("PivotTable1").TableRange2.Clear

'Select pivot table data
Worksheets("CONSOLIDATED").Activate
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
srcData = ActiveSheet.Name & "!" & Range("A1:H" & lastRow).Address(ReferenceStyle:=xlR1C1)

'Set pivot table location
Set target = ThisWorkbook.Worksheets("PIVOT")
startPvt = target.Name & "!" & target.Range("A1").Address(ReferenceStyle:=xlR1C1)

'Create pivot cache
Set pvtCache = ActiveWorkbook.PivotCaches.Create( _
    SourceType:=xlDatabase, _
    SourceData:=srcData)

'Deploy pivot table
Set pvt = pvtCache.CreatePivotTable( _
    TableDestination:=startPvt, _
    TableName:="PivotTable1")

    'Add Pivot Fields
    pvt.PivotFields("Fiscal Year").Orientation = xlColumnField
    pvt.PivotFields("Fiscal Year").Position = 1

    pvt.PivotFields("Fiscal Month").Orientation = xlColumnField
    pvt.PivotFields("Fiscal Month").Position = 2

    pvt.PivotFields("Unit").Orientation = xlRowField
    pvt.PivotFields("Unit").Position = 1

    pvt.PivotFields("Project").Orientation = xlRowField
    pvt.PivotFields("Project").Position = 2

    pvt.PivotFields("Base Expense").Orientation = xlDataField

   'Sort by largest !!!ERROR!!!
    pvt.PivotField("Base Expense") _
        .AutoSort xlDescending, "Base Expense"

End Sub

ERROR

"Object doesn't support this property or method"

@ Line
 'Sort by largest !!!ERROR!!!
    pvt.PivotField("Base Expense") _
        .AutoSort xlDescending, "Base Expense"

QUESTIONS

*

*Unsure why this error is being thrown. I've searched documentation that leads me to believe this should work (https://msdn.microsoft.com/en-us/library/office/ff834371.aspx) NOTE: ActiveSheet != to the sheet the pivot table is on, but I dont think that should create an issue here

*Any recommendations on code-refactoring is appreciated.

A: The problem you are having is that you are trying to sort the values in the data field.  It doesn't know which other field to sort by.
The PivotField that you want to run the AutoSort method on is the field that you want sorted.  The Field parameter of the method is the key that you want to sort it on.
In this case, you want something like this:
 pvt.PivotField("Project") _
    .AutoSort xlDescending, "sum of Base Expense"


text:
Q: dynamic filter with dynamic content Angularjs I would like to apply filter on products by catergory but i don't know how to do.
Here my HTML

And here my filter :

 {{category.name}}

Here my controller where i receive data :
$http.get('http://localhost:3000/api/allProducts').
success(function(data, status, headers, config) {
    console.log('------------ ProductsCtrl', data);
    console.log(data);

    $scope.products = data.products;
    $scope.categories = data.category;

    $scope.productsLength = data.products.length;
}).
error(function(data, status, headers, config) {
    //
});

Someone can explain me how to do please i tried many things / times but nothing work for me...
thanks

A: I assume your list of products contain product objects with a category property. Add a select for your categories:
<select ng-model="selectedCategory" >
   <option ng-repeat="category in categories" value="{{category}}">{{category}}</option>
</select>

Then you can filter the products like this:

  ...


text:
Q: How to group imports in Rust with conditional compilation? I am looking to group all my imports with conditional compilation.
I know that the #[cfg(target_os = "windows")] attribute organises the import, but it only works for one import.
How can I import multiple packages with one conditional compilation attribute?
I am looking for something like:
#[cfg(target_os = "windows")]
{
    use windows_lib1;
    use windows_lib2;
}

#[cfg(target_os = "linux")]
{
    use linux_lib1;
    use linux_lib2;
}

A: You can group use imports this way:
#[cfg(target_os = "windows")]
use {
    windows_lib1,
    windows_lib2,
};


text:
Q: Access Appcelerator Properties in an iOS module I am attempting to save a property in javascript, and then access it in a native objective-c module. I am sure this is simple enough, but it isn't working for me. Here is the js:
Ti.App.Properties.setString('testkey', 'testvalue');

And then in Obj-C:
for (NSString* key in [TiApp tiAppProperties])
{
    NSLog(@"[INFO] %@ = %@", key, [[TiApp tiAppProperties] objectForKey:key]);
}

A list of properties does print out, but none of my own. testkey is not there. Is there something I am not accounting for?

A: I figured it out myself. User added properties are added to [NSUserDefaults standardUserDefaults]. TiApp tiAppProperties appears to be for the built-in settings only.


text:
Q: read_csv file loads column names as one long string When I load a csv file, I receive a "KeyError" when setting the index. I see that the column names are not loaded as desired. For example:
   cleaned_sql = cleaned_sql.set_index('a')
print(cleaned_sql.columns.tolist())

Looks like so (desired):
 ['a', 'b', 'c', 'd']

And the code not okay:
col_names = pd.read_csv(in_file, nrows=0).columns
print(col_names)

Looks like so (NOT desired):
Index(['"e","f","g"'])

The csv column row:
"e","f","g"

Do I need to set another attribute in read_csv file? It's here I suspect the problem is. As you see from the print statement the result is wrapped in the list, in single quotes (so all 3 e,f,g are in a string together).

A: I couldn't resole this the way I wanted to (directly in read_csv), so here's what I came up with as a cheap workaround:
col_names = pd.read_csv(in_file, nrows=0).columns
col_names = col_names[0].split(",")
rev_col_name = []
for i in range(len(col_names)):
    rev_col_name.append(col_names[i].strip('"'))

df = pd.read_csv(in_file, names=rev_col_name, encoding='latin-1', delimiter=",")


text:
Q: who can addimperonators in useradmin for a user in aem 6.3 I tested to find that only a user can add other to his imperonators list for the other to impersonate. But the other user cannot add by himself to users impersonators list and impersonate. Either a member of adminstrator group or the user himself can add others to the user impersonators list. Is this documented any where and how can we customize any user to addimpersonators like the administrator group?

A: First, your analysis is right. The list of impersonators is a property at the target user. So the target user can grant another user (the impersonator) the right to act as himself. There is no "impersonation right", that a specific user group is allowed to impersonate to anybody.
So the use case "Support User Group", where a group of support users are allowed to impersonate as other business users will not work. Every individual business user must grant impersonation rights to the support user group.
To change the list of impersonators, you just need write access at the target users. Either it is the target user itself, or members of the "user administrators" group, or member of the "administrators" group, or any other user or user group that your project has granted write access on the target user.
If you wanna have the support users group model, you have 2 options:

*

*If you are using LDAP Integration, you can add a static value for the impersonation property in the "User Sync" Config. So every LDAP user gets this automatically assigned when he logs in.

*Write your own service, that uses the UserAdmin-API to assign the impersonators silently in the background. This allows you also to use any business logic you want.
PS:  I haven't found any good official documentation. Neither at Adobe, nor at Jackrabbit.


text:
Q: How to annotate subplots with ggplot from rpy2? I'm using Rpy2 to plot dataframes with ggplot2. I make the following plot:
p = ggplot2.ggplot(iris) + \
    ggplot2.geom_point(ggplot2.aes_string(x="Sepal.Length", y="Sepal.Width")) + \
    ggplot2.facet_wrap(Formula("~Species"))
p.plot()
r["dev.off"]()

I'd like to annotate each subplot with some statistics about the plot. For example, I'd like to compute the correlation between each x/y subplot and place it on the top right corner of the plot.  How can this be done?  Ideally I'd like to convert the dataframe from R to a Python object, compute the correlations and then project them onto the scatters. The following conversion does not work, but this is how I'm trying to do it:
# This does not work
#iris_df = pandas.DataFrame({"Sepal.Length": rpy2.robjects.default_ri2py(iris.rx("Sepal.Length")),
#                            "Sepal.Width": rpy2.robjects.default_ri2py(iris.rx("Sepal.Width")),
#                            "Species": rpy2.robjects.default_ri2py(iris.rx("Species"))})
# So we access iris using R to compute the correlation
x = iris_py.rx("Sepal.Length")
y = iris_py.rx("Sepal.Width")
# compute r.cor(x, y) and divide up by Species
# Assume we get a vector of length Species saying what the
# correlation is for each Species' Petal Length/Width
p = ggplot2.ggplot(iris) + \
    ggplot2.geom_point(ggplot2.aes_string(x="Sepal.Length", y="Sepal.Width")) + \
    ggplot2.facet_wrap(Formula("~Species")) + \
    # ...
    # How to project correlation?
p.plot()
r["dev.off"]()

But assuming I could actually access the R dataframe from Python, how could I plot these correlations?  thanks.

A: The solution is to create a dataframe with a label for each sample plotted. The dataframe's column should match the corresponding column name of the dataframe with the original data. Then this can be plotted with:
p += ggplot2.geom_text(data=labels_df, mapping=ggplot2.aes_string(x="1", y="1", mapping="labels"))
where labels_df is the dataframe containing the labels and labels is the column name of labels_df with the labels to be plotted. (1,1) in this case will be the coordinate position of the label in each subplot.

A: I found that @user248237dfsf's answer didn't work for me. ggplot got confused between the data frame I was plotting and the data frame I was using for labels.
Instead, I used
    ggplot2_env = robjects.baseenv'as.environment'
class GBaseObject(robjects.RObject):
  @classmethod
  def new(*args, **kwargs):
    args_list = list(args)
    cls = args_list.pop(0)
    res = cls(cls._constructor(*args_list, **kwargs))
    return res

class Annotate(GBaseObject):
  _constructor = ggplot2_env['annotate']
annotate = Annotate.new

Now, I have something that works just like the standard annotate.
annotate(geom = "text", x = 1, y = 1, label = "MPC")

One minor comment: I don't know if this will work with faceting.


text:
Q: how to check which player disconnected in a game? i'm making a multiplayer game with unity.
i'm using master server .player1(server) will be server and player2(client) will connect to player1.
now i need to understand which player disconnected?
 player1 can use OnPlayerDisconnected(NetworkPlayer) to check if player2 disconnected or not .but can't use this function in client side (only work in server side)
what player2 can do to understand player1 is disconnected or not ?

A: Network broadcasts another message, OnDisconnectedFromServer. It is called on the client when it is disconnected from the server.
Network.OnDisconnectedFromServer
It is passed a NetworkDisconnect object that gives you information about the disconnect event, such as whether it was a lost connection or an intentional disconnect. The Unity Script Reference page has examples for that as well.


text:
Q: iGUI for Unity 3D Well,I am working on my graduation project with unity 3d pro v4.5.0 ..I was using the normal method OnGUI() in my scripts but now i want to make a better interface for my project and i didn't anderstand how can i replace for example  these lines in  my "Database" Script:
            if (GUILayout.Button ("Add to database"))
            {
                    // Insert the data
                    InsertRow (FirstName,LastName);
                    // And update the readout of the database
                    databaseData = ReadFullTable ();

             }

With just calling a Button1_click for example from my iGUI Class specially that every thing related to interface and buttons exists in OnGUI() method so how can i change all of that in my "Database" Script..i did anderstand how to make a button in iGUI that LOAD a scene or set an other function in the same iGUI Class but i just want to make buttons and iGUI field texts in iGUI MonoBehaviour Class and call them later whenever i need in my pricipal script "Database" if it is possible.Please am so in need for help. Thank you in advance.

A: You need do this:

*

*create a public method in any script.

*add the script to a GameObject.

*Click the button and add the object with the script in the method
OnClick located in the inspector.

*Choose your script and the public method where said No function.
Boala!!, when you click, your method run.


text:
Q: Boostrap - Border padding too wide I'm trying to complete a project as an exercise using bootstrap. The page I have to recreate is here: https://codepen.io/freeCodeCamp/full/NNvBQW
I'm stuck at putting a border around the image. Here's my code:
https://codepen.io/krassheit/pen/mxmdWG?editors=1100
HTML

Dr. Norman Borlaug

The man who saved a billion lives

 Dr. Norman Borlaug, third from left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.

CSS
body {background-color: gray;}

#mainbox {
  background-color: #eed2ee;
}

.image-box{
    padding: 2px 2px 2px 2px;
    background-color: red;
    margin-left: 100px;
}

However I get the issue of the border expanding all the way to the margins of the main outer frame when the window I view it in is too wide. Only when I resize the window to be smaller than the native picture size the borders get resized to the actual padding. See attached screenshots:
Wide
Narrow

A: Drop the figure element just use

The padding should be on the outer element (outside #mainbox, inside .container). You might want to check .jumbotron since that is what gets used in the example page...
You could go with
, but using the .mx-auto class will have no effect unless the parent element is using flexbox (can be activated by .d-flex)
Check out .img-thumbnail in the Bootstrap docs. That is what you need isn't it? :)

A: I'm not sure why the padding shouold be on the outer element? Could you explain?
I've rewritten the code using the thumbnail class, but it still looks the same. Here's the code:

Dr. Norman Borlaug

The man who saved a billion lives

Dr. Norman Borlaug, third from left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.

I explicitly don't want to use the jumbotron class since I thought there should be a basic way to do this.

A: The reason for your problem seems to be because you didn't assign left and right padding to the outer div. Try this html code.

Dr. Norman Borlaug

The man who saved a billion lives

Dr. Norman Borlaug, third from left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.

And this css code
body {background-color: gray;}
    #mainbox {
      background-color: #eed2ee;
      padding: 30px 60px;
    }
    .image-box{
      background-color: red;
      padding: 5px 5px 5px 5px;
    }
    .image-box img {
      width: 100%;
    }

A: The problem is the class .image-box is display:block; , that means the div of that class is full-width, so when you view on the wide screen, that class will expand to full-width base on the resolution of that screen.
The solution is very simple, you just need to set .imade-box to display:inline-block; and it works !
When you have set it to inline-block, your image will not be centered anymore, so my next solution is set the parent div to text-align:center, and that is all you need ! :)
Check this : https://codepen.io/anon/pen/oqQZoe?editors=1100

A: Try to apply the border-style
you can use this style directly to the image class ".img-fluid"
.img-fluid{
    border-color: blue;
    border-style: solid;
}

Or first try to have the figure section a width same as the image and apply the style to the figure section and you will get the same effect as you apply to the image.


text:
Q: How can I create a generic class that only works for classes that support certain interface? Class cacheable(Of T As haveTimeStampandMainStringKey)
    Public ReadOnly Property Cache As T
    Public ReadOnly Property timestamp As Date

    Public Shared Function create(cache1 As T) As cacheable(Of T)
        Dim a = New cacheable(Of T)
        a._Cache = cache1
        a._timestamp = Now
        Dim key = T.mainkey 'this things fail to compile
        Return a
    End Function
End Class

Interface haveTimeStampandMainStringKey
    ReadOnly Property TimeStamp As DateTime
    ReadOnly Property mainKey As String
End Interface

Basically I want class cacheable to work only with classes that support haveTimeStampandMainStringKey
Yet
Dim key = T.mainkey produces an error
Clearly T supports haveTimeStampandMainStringKey interface. So I should be able to access T.mainkey. I can't. Why? What's wrong with the code?
Why?

A: It doesn't work because T is a type, not an instance.  You need to have an instance to refer to mainKey.  You probably want either a.Cache.mainKey or cache1.mainKey.
(If you really want something Shared rather than something attached to an instance, unfortunately, there isn't a good way to do it as it's not supported by .NET except through various reflection-based approaches, see various lamentations about the absence of "static interfaces" over the years.)


text:
Q: Hide "action bar" in lollipop , API 21 For some reason, in API 21, the app crashes every time i use a theme of "no action bar".
I saw here in another question that i should add this.getActionBar().hide();, so i tried it with a several different themes but it's not working.
Can someone explain to me why this is happening and what's the solution for that?

A: If you're getting a NullPointerException on
    this.getActionBar().hide();

then that means your Activity has no Action Bar.
Hiding the system bars has been changed since KitKat. If you're trying to go into full screen mode you'll probably have to play around with the System UI Visibility flags. Check out the training pages here: https://developer.android.com/training/system-ui/status.html

A: Modify your styles.xml using this theme
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    </style>
</resources>

If your Activity extends ActionBarActivity then
getSupportActionBar().hide();
Hope it helps!!!


text:
Q: How can I size the marker (square) to let its scale value be its actual area? I want to have a square for each administrative area.
A value tells its area in reality.
For each administrative area the square should be as big as in reality.
So if I zoom in and out it should not change in size.
If I measure the width of the square using the scale of the map, and take it to the square (^2), I end up with the area value used at the beginning.
Proportional Circles may be related to what I try to accomplish, however I need a square, not a circle.

A: This seems to be doable as long as your polygons have a cartesian coordinate system (not Lat-long).
Change the style to a single symbol, centroid fill, simple marker. Set the Size to 1, the units to "Map Units" and click the expression button and Edit... and set the value to "sqrt($area)".
Choose a square symbol from the list above "Layer Rendering". It should look a bit like this:

That gives me the pink squares here:

The underlying polygons are in another layer, and also shown. They look about the right size.


text:
Q: Is there a way to change the significance level (alpha) in R? Im trying to perform a simple hypothesis test but now I need t-values for alpha = 0.01 instead of 0.05 (the default). Is there a way to do this in R?
This is what I am trying to get for alpha = 0.01:
enter image description here

A: If you used the t.test function in R, you can use the argument conf.level = 0.99, since the confidence level is equivalent to 1 – the alpha level. You can also read this page on Rdocumentation on the t.test function for more information on what arguments can be used

A: This seems to be a statistical question rather than a programming question, and as such probably belongs on CrossValidated ...
Results table:
            Estimate Std. Error   t value     Pr(>|t|)
(Intercept) 93.10386  44.482243  2.093057 3.647203e-02
       educ 39.82828   3.314467 12.016497 3.783286e-32

When you change alpha (the cutoff value for significance testing), nothing in the table above — neither the t-statistic (t value) nor the p-value (Pr(>|t|)) — changes. The only thing that changes is the judgment of whether you rejected or failed to reject the null hypothesis. In this case, since the p-value for the intercept (0.036) is between 0.01 and 0.05, the conclusion would change from "reject H0" (alpha=0.05) to "fail to reject H0" (alpha=0.01). The p-value for educ is way less than 0.01, so the conclusion would be "reject" either way.
In most cases, base-R functions don't specify an alpha value; they let you make the decision yourself.  If you do have a vector of p-values, you could implement an alpha threshold by saying
result <- ifelse(pval<alpha, "reject H0", "fail to reject H0")


text:
Q: Removing "Edit with Pythonwin" from right click menu Recently I installed pywin32, and decided that I didn't need it. So I uninstalled the application and packages using control panel, then removed the remaining folder. However, when I right clicked a .py file the Edit with Pythonwin was still there. I tried restarting my computer, but with no avail. I have googled it but found no answer. Is there some way I coud remove this option from the right click menu, or do I just have to deal with it? I use windows 7. Thanks in advance.

A: You just need to delete the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.py

From PowerShell, you can use this
rd hklm:software/classes/.py

A: The more appropriate manner is to open with Regedit, head to the following path:
\HKEY_CLASSES_ROOT\Python.File\shell
There, you need to remove the folder "Edit with PythonWin".
You can find this via the Find function.  You also may be able to remove the ability to run the Python file, or edit it with IDLE.

A: Try using ShellExView. You can remove or disable shell-extensions with it.


text:
Q: Django use private S3 storage only in production environment I have set up my django REST API to use local storage when in DEBUG mode and S3 storage when in production environment. This works well for public files, because I override the DEFAULT_FILE_STORAGE like so:
if IS_DEBUG:
    DEFAULT_FILE_STORAGE = 'api.storage_backends.PublicMediaStorage'

and every FileField uses it automatically. Now I want to use private S3 storage the same way, but because I have to define the storage explicitly (FileField(storage=PrivateMediaStorage())), the S3 storage is always used.
How can I use the local storage instead of S3 storage when in DEBUG mode?
PS: I have already thought about changing the model to either use a FileField with or without an explicit storage depending on the DEBUG mode. This did not fully solve my problem, because my migrations are created in DEBUG mode and thus always contain the model without the private storage class.
UPDATE:
I am looking for a solution that can share the same migrations in both environments and only during runtime lazily instantiates the actual storageclass. Just like django handles the DEFAULT_FILE_STORAGE already.

A: It sounds like the tricky part here is having both public and private media storage in a single project.
The example below assumes you are using django storages, but the technique should work regardless.
Define a private storage by extending the S3BotoStorage class.
If using S3, it is probably prudent to store private and public public in different S3 buckets. This custom storage allows you to specify this parameter via settings.
# yourapp.custom_storage.py

from django.conf import settings
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage

class S3PrivateStorage(S3BotoStorage):
    """
    Optional
    """
    default_acl = "private"               # this does the trick

    def __init__(self):
        super(S3PrivateStorage, self).__init__()
        self.bucket_name = settings.S3_PRIVATE_STORAGE_BUCKET_NAME

# important
private_storage_class = get_storage_class(settings.PRIVATE_FILE_STORAGE)

private_storage = private_storage_class() # instantiate the storage

The important part is the last 2 lines of this file - it declares private_storage for use in your FileField:
from yourappp.custom_storage import private_storage
...
class YourModel(Model):

    the_file = models.FileField(
                   upload_to=...,
                   storage=private_storage)
...

Finally, in your setting file, something like this should do.
# settings.py

if DEBUG:
    # In debug mode, store everything on the filestystem
    DEFAULT_FILE_STORAGE = 'django.files.storage.FileSystemStorage'
    PRIVATE_FILE_STORAGE = 'django.files.storage.FileSystemStorage'
else:
    # In production store public things using S3BotoStorage and private things
    # in a custom storage
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
    PRIVATE_FILE_STORAGE = 'yourapp.custom_storage.S3PrivateStorage'

As a last piece of unsolicited advice: it is often useful to decouple the storage settings from DEBUG mode and allow all of the parameters above to be specified in environment variables. It is likely that at some point you will want to run your app in debug mode using a production-like storage configuration.

A: The best solution is to use FileField without explicit storage class.
# settings.py

if DEBUG:
    DEFAULT_FILE_STORAGE = 'api.storage_backends.PublicMediaStorage'
else:
    DEFAULT_FILE_STORAGE = 'api.storage_backends.PrivateMediaStorage'

# models.py
class Foo(models.Model):
    file = models.FileField() # without storage

During the file upload process, Django will call the DEFAULT_FILE_STORAGE class in a lazy fashion.
Note
These settings won't create a migration file with storage parameter

UPDATE-1
If you want more controll over the storage, create your own custom file field and wire-up in the models
def get_storage():
    """
    Change this function to whatever way as you need
    """
    from api.storage_backends import PublicMediaStorage, PrivateMediaStorage
    if DEBUG:
        return PublicMediaStorage()
    else:
        return PrivateMediaStorage()

class CustomFileField(models.FileField):
    def __init__(self, *args, **kwargs):
        kwargs['storage'] = get_storage() # calling external function
        super().__init__(*args, **kwargs)

class Foo(models.Model):
    file = CustomFileField() # use custom filefield here

A: Thomas's accepted answer is almost perfect. It has a small migration problem when you work with different settings for local development and production.
Suppose you set storage to FileSystemStorage in local environment and S3PrivateStorage in production. If you run makemigrations in the local environment, the migration file will set the storage field for your FileField to a different value than if you run makemigrations in the production environment.
Fortunately a new feature from Django 3.1 allows us to solve this easily with a slight change to Thomas's answer. Instead of using private_storage, which is an instance of a storage class, let's use the fact that you can use a callable as storage and create a function that will return the proper storage.
Then, the code (adapted from Thomas's answer) would be:
# yourapp.custom_storage.py

from django.conf import settings
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage

class S3PrivateStorage(S3BotoStorage):
    """
    Optional
    """
    default_acl = "private"               # this does the trick

    def __init__(self):
        super(S3PrivateStorage, self).__init__()
        self.bucket_name = settings.S3_PRIVATE_STORAGE_BUCKET_NAME

def select_private_storage():
    # important
    private_storage_class = get_storage_class(settings.PRIVATE_FILE_STORAGE)
    return private_storage_class() # instantiate the storage

and then in your field set the storage accordingly
from yourappp.custom_storage import select_private_storage
...
class YourModel(Model):

    the_file = models.FileField(
        upload_to=...,
        storage=select_private_storage # notice we're using the callable
    )
...


text:
Q: Prestashop not working with my JS code in Prestashop 1.5.x my slider is not working. However in a simple HTML page it works.
I found that the problem is with this Jquery code:
       $(document).ready(function(){
            $('#demo1').skdslider ({delay:5000, animationSpeed: 2000,showNextPrev:true,showPlayButton:true,autoSlide:true,animationType:'fading'});

            $('#responsive').change(function(){
              $('#responsive_wrapper').width($(this).val());
            });

        });

when i place this code on my page, after refreshing the page it goes WHITE. If I delete it the page opens.
the problem is in this:
$('#demo1').skdslider ({delay:5000, animationSpeed: 2000,showNextPrev:true,showPlayButton:true,autoSlide:true,animationType:'fading'});

Why prestashop dont like it? Is there anything I can change in order to make it work?
Thanks!

A: I think you forgot the quotes. You should try this:
$('#demo1').skdslider ({'delay':5000,'animationSpeed': 2000,'showNextPrev':true,'showPlayButton':true,'autoSlide':true,'animationType':'fading'});


text:
Q: Firebase login failed I'm having troubles trying to migrate to new firebase console.
I'm doing exactly what is on this link: https://firebase.google.com/support/guides/firebase-web#import_your_project_to_the_firebase_console_numbered
And this is what happened in the step 2:
Firebase login failed
The Firebase CLI login request was rejected or an error occurred. Please run firebase login again or contact support if you continue to have difficulty logging in.
Any ideas? Thanks since now.

A: A possible reason may be that you are using a proxy.
There is a issue on firebase: Unable to deploy behind a proxy
If you are using proxy, you can refer to this question to: Firebase in NodeJS with HTTP Proxy.

A: This will work most certainly!!!
Please try this command
set "NODE_TLS_REJECT_UNAUTHORIZED=0"

and then re-run,
firebase login

A: You should try the following:
firebase login --no-localhost

A: Not really an answer but further details that don't get formatted correctly in the Comments
I have the same issue at an initial login
The steps I do are (from a cygwin terminal on Windows 10 Professional)
firebase login --no-localhost

After this I get the message "
Visit the URL on any device....
Paste authentication code here:

Then, on my browser, I see Google asking if I give Firebase CLI access rights. I say yes and then I get an authorization code displayed on the browser.
I copy this code into the cygwin console and then......
Error: Authentication Error.

A:
The Firebase CLI does not currently work behind a proxy.

We're aware of the issue but don't have a timeline for a fix. You can follow along with the tracked issue here: https://github.com/firebase/firebase-tools/issues/155

A: Note firebase CLI uses HTTP_PROXY variable if it is set in your environment. (you can run echo $HTTP_PROXY to verify) So make sure you are EITHER in a network with access to your proxy (e.g. corporate network) OR that you unset HTTP_PROXY in the terminal that you use for firebase. Otherwise you will get this misleading error that says "Authentication Error: Your credentials are no longer valid."

A: You can logout with firebase logout and login in with firebase login. It solves the problem with ease.

A: For me this problem was coming due to network proxy before identification I tried all available solutions on internet.
This issue was there due to network proxy, due to proxy it could not get correct SSL. I requested my network team to direct my connection without proxy.
Hence, problem got solved!

A: On CLI following worked for me:
Try out For Windows :

*

*Search for PowerShell

*run as PowerShell administrator

*npm install -g firebase-tools

*firebase login

*firebase deploy

A: Guessing that you are at workplace or behind a proxy. This a know error. You can follow the status of this issue here - https://github.com/firebase/firebase-tools/issues/155

A: For anyone else who might run across this issue and think to themselves, "But, I'm not behind a proxy...": I generally run Little Snitch. (Note, I don't work for LS, just use the product. This isn't intended as an ad.) After a few minutes of consideration, I realized that it is, in essence, a proxy. I switched it off (by clicking the "Stop Network Filter" option), and presto, I was able to login. Then I switched Little Snitch back on.
[Update]
I was trying to test Cloud Functions locally using firebase serve --only functions. Once I turned Little Snitch back on, I started getting:
Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

So apparently, you can't serve functions locally from behind a proxy, either. Turning LS filtering back off fixed the issue. There's probably a whitelisting option I could use, but I haven't explored that yet. I'm just trying to get back to work at the moment.

A: For anyone who is forced to use a VPN provider to connect, like Astrill for example, you cant use OpenWeb protocol.
Use StealthVPN. That solved the issue for me

A: You need to first add and enable Google provider in Authentication tab of your App before CLI for existing remote project created.
On CLI following worked for me :

*

*npm install -g firebase-tools

*firebase login

*firebase init

On Firebase login you get Web interface login to Google account on web browser, then you are logged in.

A: You need to write your email like this :
firebase login exmple@email.com

A: I have tried all of the suggestions above. None of them were successful.
The only thing that worked for me was rebooting my machine (restarting the terminal was not sufficient). Logging in worked flawlessly after that.


text:
Q: mbed compiler: how to programatically read & write flash STM32F091RC on Nucleo eval board I need to write and read back configuration parameters to the STM32F091RC flash.
What are the read and write functions/methods?

A: I got it working.
Here is a discussion how.  Click "Import program" next to 00_eeprom_emulation_f091.


text:
Q: How can I atomically reorder array items in MongoDB? I have a playlists collection. Each document in the collection contains an entries field, that is an array.
How can I change the order of entries in a playlist, atomically?
(e.g. If another user tries at the same time to $push a new entry, I want to make sure that the new entry is $pushed only after the reordering has happened)
If I do a find(), then reorder in PHP, then update(), I might lose the new $pushed entry if the operation is not atomic.
This is a sample playlist object:
{
    "_id" : "playlist1",
    "title" : "Playlist One",
    "entries" : [
            {
                    "class" : "song",
                    "identifier" : "song1"
            },
            {
                    "class" : "song",
                    "identifier" : "song2"
            },
            {
                    "class" : "song",
                    "identifier" : "song3"
            }
    ]
}

Edit:
I think I found a possible solution, using execute():

Running JavaScript in the database takes a write lock, meaning it blocks other operations.

(from http://php.net/manual/en/mongodb.execute.php)
I just need to execute the code (find() + reorder() + update()) on the MongoDB Server.
Still, if you have another idea that doesn't involve "code within a string" (e.g. $func = "function() { do_something(); return \"something else\" }"), please share it.
Thanks!

A: Using eval() to block operations is a side effect of the current implementation, not a feature to rely on.
The MongoDB wiki has a page with information on Atomic Operations.
A relevant strategy for your use case would be "update if current":

*

*Fetch the object.

*Modify the object locally.

*Send an update request that says "update the object to this new value if it still matches its old value".


text:
Q: Liferay 6.0.6 CE login takes upto 25 sec to login after upgarde from Liferay 5.2.3 CE Old setup (Liferay 5.2.3) login time was around 3-5 sec but for Liferay 6.0.0 CE it is taking time around 20 sec.
I am upgrading my portal by using following properties in portal-ext.properties:
permissions.user.check.algorithm=5
image.hook.impl=com.liferay.portal.image.DatabaseHook

After upgrade I am converting the legacy permission to new algorithm by using Data-Migration tab in Control panel and restarting it with following properties in portal-ext.properties:
permissions.user.check.algorithm=6
image.hook.impl=com.liferay.portal.image.DatabaseHook

A: we faced similar issue when upgrading from 5.2.X to Liferay 6, in our case the issue was that the permission algorithm was changed by us in the upgradation, in version 6, there is a new permission algorithm available.
If you run Liferay 6 with permission algorithm 5, you login process will be slow.


text:
Q: Change text label where inside there are an input checkbox element I have this part of html on my form:

    <input id="pagamento_8" class="_input " type="checkbox" onclick="half(this,value);" checked="" value="980" name="pagamento[]" style="position: absolute; left: -9999px;" autocomplete="off">

    988 (980-980 €)

It is a checkbox input button that call the function half() to make something like call the next function:
function setClickedLabel(clicked,new_value){
    label_e=$(clicked).parent();
    label_t=$(label_e).text();
    labels_t=label_t.split('-');
    $(label_e).html(labels_t[0]+'-'+new_value+' €)');          <-- 1
    //$(label_e).text(labels_t[0]+'-'+new_value+' €)');        <-- 2
    //$(label_e).innerHTML = labels_t[0]+'-'+new_value+' €)';  <-- 3
}

Here i would change a part of the label "988 (980-980 €)" (the last 980) and the "clicked" variable is the input object that you can see inside the label element.
Using one of the three methods reported i got 2 effect. Whit 1,2 it changes the label but it removes the input element. Whit 3 it doesn't make nothing.
What function i can use? How i must fix the code to get what i need?
Html can't be changed.
Maybe another alternative without appending.
tnx,
j.

A: Adapting the script on jsfindle left on the comment from adeneo i have wrote that solution. Maybe can be other better solutions.
function setClickedLabel(clicked,new_value,old_value){
    label = $(clicked).parent().contents().filter(function() {
        return this.nodeType === 3 && this.nodeValue.trim().length;
    }).get(0);

    label.nodeValue = label.nodeValue.replace(new RegExp("-"+old_value), "-"+new_value);
}


text:
Q: how to open a grails 3.3 app in netbeans 9? I cant find a way to open a grails 3.3.8 project in netbeans 9 on the mac.
I have found several posts (see below) but none of them work.
This one says create the project via the command line, e.g. "grails create-app hello", then use The "open project" dialog to open the hello directory. However, when I open the hello grails application directory, the project name field is greyed out, and hitting the open button has no effect.
This article says to create the project using the grails plugin for netbeans.  It says to go the plugins dialog in netbeans and search for grails. There is no grails plugin.
grails and java are installed with the required exports.
Note, I installed netbeans from https://github.com/carljmosca/netbeans-macos-bundle as recommended in the official netbeans install guide.
Suggestions anyone?

A: Well, I found an obscure post which lead to the answer.
It seems that they removed most of the plugins from netbeans 9, including the grails one.
A work around (not sure how safe it is) is to add the netbeans 8.2 provider:

Go to Tools | Plugins in Apache NetBeans (incubating) 9.0 and, in the
  Settings tab, register the NetBeans IDE 8.2 update center:
http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz

Thanks to: https://blogs.apache.org/netbeans/entry/what-s-happened-to-my
I can now open a grails project, but I cant run it.  It says "Grails home has not been set.  Use menu Tools/Options/Groovy to set the environment."
The problem is, I have already set GRIALS_HOME in my .bash_profile,and that there is no options under tools menu.

After some effort, I found the grails home setting in Netbeans Menu->preferences->Miscellaneous-Groovy:

Now I can run grails programs, and also use the menus to create domain objects etc.  Nice!


text:
Q: Import of android.hardware.camera2 cannot be resolved On using import android.hardware.camera2. I am getting import cannot be resolved. How to clear this problem. I tried everything mentioned in other solution but I am not able to fix this up. Please do help. Thanks in advance.

A:
I want to use new api android.hardware.Camera2

There is no Java class in Android named android.hardware.Camera2. There is a Java package named android.hardware.camera2. You are welcome to use classes out of that Java package, such as android.hardware.camera2.CameraManager.

"The import android. hardware. Camera2 cannot be resolved"

That is because there is no Java class in Android named android.hardware.Camera2. There is a Java package named android.hardware.camera2. You are welcome to use classes out of that Java package, such as android.hardware.camera2.CameraManager, via import statements like:
import android.hardware.camera2.CameraManager;

or even:
import android.hardware.camera2.*;


text:
Q: Is it good practice to get product collections in helper function and calling in phtml file custom module Magento 2
Hi all, i wanted to know either is it good practice to get product
  collections in helper function and calling that function in phtml file
  within custom module Magento 2
Because in my case helper function not working properly.

Please check below Code

app\code\Vendor\Module\Helper\Data.php

<?php
namespace Vendor\Module\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{

    protected $_objectManager;
    const NEWMEMBER = "NEWMEMBER";

    public function __construct(
        \Magento\Framework\App\Helper\Context $context,
        \Magento\Framework\ObjectManagerInterface $objectmanager
    ) {
        $this->_objectManager = $objectmanager;
        parent::__construct($context);
    }

    public function getProductCollections(){
        $productSku = self::NEWMEMBER;
        $loggedInProducts = $this->_objectManager->get('Magento\Catalog\Model\Product')
            ->getCollection()
            ->addAttributeToFilter('sku', array('in' => $productSku));
        return $loggedInProducts;
    }

}

app\code\Vendor\Module\view\frontend\templates\Member.phtml

$helper = $this->helper('Vendor\Module\Helper\Data');
$getProductCollections = $helper->getProductCollections();

A: As per the Magento architecture MVC - Model View Controller  it is not good practice to use the logic code in helper file.
Follow Model-View-Control (MVC) pattern
Make sure your extension adheres to the MVC Pattern, and that it does not violate any of its principles.
Some important things to check in your extensions:

*

*Make sure your Business Logic, Configuration, and SQL are implemented in the correct places.

*Make sure that CSS, JavaScript, HTML, and XML code are all in the appropriate files (i.e. they should not be inline).

*Use appropriate logic in a Block, Helper, Template, Controller, or Model.

*Ensure correct module design.

Below are some other things to know while customization and create extension.
Use dependency injection:
Direct class instantiation is not recommended because the class can be rewritten. If the class is created directly, any rewrites will not be applied and it breaks Magento's class rewrite capability. We encourage you to become familiar with how we use dependency injection to get an instance of a class.
Use the PHP_CodeSniffer tool:
PHP_CodeSniffer is a set of PHP scripts that checks your code for violations of a particular coding standard. It can be used in conjunction with the Magento Coding Standard to check your code for some of the more common Magento and PHP problems. Using these two tools will ensure that your extension code meets many of Magento's coding standards. It also has the added benefits of keeping your code clean and maintainable.
I hope it helps!


text:
Q: Android Studio KMM Project with c/c++ module Error We are trying to build a KMM (Kotlin Multiplatform Mobile) app for ios and android. There are c/c++ modules included in this project.
At iOS build we are getting this error from a .h file:
error: use of '@import' when modules are disabled

In xcode this seems like an easy problem to fix, but in Android studio, we can't find a solution. I'm thinking this is a Podfile/.podspec issue, but I haven't been able to find any working solution.

A: instead of :
@import MyModule;

just try :
#import <MyModule/MyModule.h>


text:
Q: css:change between two images while hovering I'm tring to change between two images in this site http://www.easy-send.net/home

*

*section "who we are" : I'm tring to make the background of the circle blue and the icon white(I got the white image also).

I tried to hide the first image and also to undisplay it...but whenever I do it, the second images won't show up...someone told me there is a little bit problem because the image is a background-image...
glad if someone could help me:)
there is the code:

A: Use these icons and do an image swap

e.g.


text:
Q: detect if file descriptor is socket in solaris 11.0 and extract ip address In Solaris, I need to get IP address a specific process is using (sshd session), I have his ID.
How do they do it on linux ? After reading netstat.c source, this is the flow:
Iterate the process file descriptors, located at /proc/ProcessId/fd/,
If iterated file descriptor is a socket, they readlink, open and finally read the file descriptor.
So in solaris, I can detect the socket file descriptor of the process.
int fd=NULL;
struct dirent *dentp;
while ((dentp = readdir(dirp)) != NULL) { //iterate file descriptors
   fd = atoi(dentp->d_name);
   struct stat statb;
   char temp_dir_path [100];
   if (stat(temp_dir_path, &statb) != -1)
   {
       if (S_ISSOCK(statb.st_mode))
       {
         //What to do here ?? temp_dir_path is /proc/12345/fd/4

I saw there are methods like getpeername(..),getsockname(..) they receive as param the file descriptor of the current context process, I want to read file descriptor for another process.
Can I open the file descriptor and cast it to struct sockaddr_in ?
The socket file descriptor structure is different between linux and solaris.. I guess i need to do whatever they do in pfiles / lsof

A:
I saw there are methods like getpeername(..),getsockname(..) they receive as param the file descriptor of the current context process, I want to read file descriptor for another process.
  Can I open the file descriptor and cast it to struct sockaddr_in ?

No.  You can open() it and use the file descriptor open() returns and try using getpeername() and getsockname() on the file descriptor you get.  It might even work.
You'll probably be better served by using the method pfiles uses.  Per the pfiles man page:

pfiles
Report fstat(2) and fcntl(2) information for all open files in
  each process. For network endpoints, the local (and peer if
  connected) address information is also provided. For sockets, the
  socket type, socket options and send and receive buffer sizes are also
  provided. In addition, a path to the file is reported if the
  information is available from /proc/pid/path. This is not necessarily
  the same name used to open the file. See proc(4) for more information.

The pfiles source code can be found at http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/ptools/pfiles/pfiles.c
Solaris provides a libproc interface library that does what you need.  pfiles uses that - the library provides calls such as pr_getpeername() and pr_getsockname(). You can see the implementations in http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libproc/common/pr_getsockname.c
Note that there are actual system calls to get what you need directly from the kernel.
The OpenSolaris man pages for the libproc library can be found at http://illumos.org/man/3proc/all  They are likely to be substantially similar to the Solaris 11 libproc implementation.
To use these tools, you have to be really careful.  From the Pgrab man page for the function used to grab a process:

Grabbing a process is a destructive action. Stopping a process stops
  execution of all its threads. The impact of stopping a process depends
  on the purpose of that process. For example, if one stops a process
  that's primarily doing computation, then its computation is delayed
  the entire time that it is stopped. However, if instead this is an
  active TCP server, then the accept backlog may fill causing connection
  errors and potentially connection time out errors.

There are options to not stop the grabbed process, and to grab it read-only.


text:
Q: SMTPClient email sometimes going to Junk Mail I'm having a difficult time understanding why email I send from my website by using SMTP is going to Outlook's junk mail.  Here is my code:
       Dim windowsLoginName As System.String = HttpContext.Current.User.Identity.Name

    Dim split As String() = Nothing
    Dim vname As String

    'Get network login name (name only)
    split = windowsLoginName.Split("\".ToCharArray)
    vname = split(1)

'create the mail message
    Dim mail As New MailMessage()

    'set the addresses
    mail.From = New MailAddress(vname & "@x.com")
    mail.To.Add(txtWhoApproves.Text)

    'set the content
    Dim varstreason, vartxt, vartxt2, varbody As String
    varstreason = DropDownList1.SelectedItem.Text

    If TextBox1.Text = TextBox2.Text Then

        If CheckBox1.Checked = True Then
            varbody = TextBox3.Text & " has requested the following time off:  " & System.Environment.NewLine & varstreason & " - " & TextBox1.Text & " - All Day"
        Else
            vartxt = varstreason & " - " & TextBox1.Text
            vartxt2 = DropDownList2.SelectedValue & " to " & DropDownList3.SelectedValue
            varbody = TextBox3.Text & " has requested the following time off:  " & vartxt & " - " & vartxt2
        End If

    Else
        varbody = TextBox3.Text & " has requested the following time off:  " & varstreason & " - " & TextBox1.Text & " to " & TextBox2.Text
    End If

    mail.Subject = "Time Off Approval Requested"
    mail.Body = varbody

    'send the message
    Dim smtp As New SmtpClient("(IP Address of email server)")

    'to authenticate we set the username and password properites on the SmtpClient
    'smtp.Credentials = New NetworkCredential("username", "secret")
    smtp.Send(mail)

I have the email coming from whoever is logged onto the network.  Since it's multiple people, I remarked out smtp.Credentials because the password is different for each user (and changes periodically).  I'm thinking that this is somehow causing the email to sometimes go into the junk email.
And ideas?  How can I prevent these emails from going into junk?  We are using an Exchange 2010 server, and Outlook 2007, 2010, or 2013.  Thanks in advance!

A: May be your website is listed as spamming in outlook security systems, or your email contain some spam words or links that causes emails to go in junk or spam box.

A: Spam filtering for email is based on the content of the subject, message, and attachments.  It also filters based on things such as what host/IP you're sending from.  If you attempt to send an email via SMTP using a host such as gmail, you'll likely notice it will inbox.

A: Based on your comments:

*

*The email is coming from your website's SMTP using your domain.

*The email is being received by your Exchange server which also uses the same domain.

*The emails are only for an internal audience.

From here I would recommend 2 different solutions:
First Solution:
Instead of using your website's SMTP, instead use your Exchange server to send the email. This will work the same as joe@yourcompany.com sending an email to bob@yourcompany.com.  The email will never need to leave the server or hit any filters(unless you set up internal filters), so it will not hit the spam box (unless an end user specifically sets it up this way). Check out this site for some help in how to accomplish this: https://www.emailarchitect.net/easendmail/kb/vbnet.aspx
Second Solution:
Use group policies to add the email address to safe senders list for all your users.(https://social.technet.microsoft.com/Forums/office/en-US/c0714d7d-2a42-4b0f-9f1d-63234c7278a0/appending-outlook-safe-senders-list-via-gpo) This seems like it should be an easy solution, but the issue is that it still may not work since you have 2 different servers using the same domain.  So although the address may be added in, Outlook may view it as being a different address since it is not coming from the Exchange server. The other option in this solution is to have everyone that gets your email to add it to safe senders directly from the email they receive.  That would do it, but hugely inefficient and manual.
For some more in-depth info into the processes and technology behind email, I would recommend checking out the "How Email Works" series of articles by Click-Z (part 1 - https://www.clickz.com/clickz/column/2411041/how-email-works-part-one-the-story-of-send)


text:
Q: Scudo Error in Android logfile during closing an App created with Delphi 10.4.1 I have created a Musicplayer App for Android (and Windows) for private usage in Delphi 10.4.1 which runs fine without any error messages. However: I discovered that in the logfile from Android I receive a SIGABRT error 'Scudo ERROR: invalid chunk state when deallocating address xxx' everytime the app is closed. No error message is visible from within the app or within the IDE.
I have no idea where to start to find the error. Any suggestions?
Here is an example of the error message in the logfile:
06-02 17:48:26.641 F/libc    ( 1748): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 1748 (cadero.MusicBox), pid 1748 (cadero.MusicBox)
06-02 17:48:27.953 F/DEBUG   ( 9352): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-02 17:48:27.953 F/DEBUG   ( 9352): Build fingerprint: 'samsung/...'
06-02 17:48:27.953 F/DEBUG   ( 9352): Revision: '5'
06-02 17:48:27.953 F/DEBUG   ( 9352): ABI: 'arm64'
06-02 17:48:27.953 F/DEBUG   ( 9352): Processor: '0'
06-02 17:48:27.953 F/DEBUG   ( 9352): Timestamp: 2022-06-02 17:48:26.810314587+0200
06-02 17:48:27.953 F/DEBUG   ( 9352): Process uptime: 3416s
06-02 17:48:27.953 F/DEBUG   ( 9352): Cmdline: com.embarcadero.MusicBox
06-02 17:48:27.953 F/DEBUG   ( 9352): pid: 1748, tid: 1748, name: cadero.MusicBox  >>> com.embarcadero.MusicBox <<<
06-02 17:48:27.953 F/DEBUG   ( 9352): uid: 10558
06-02 17:48:27.953 F/DEBUG   ( 9352): signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
06-02 17:48:27.953 F/DEBUG   ( 9352): Abort message: 'Scudo ERROR: invalid chunk state when deallocating address 0x20000716f5a5fb0
06-02 17:48:27.953 F/DEBUG   ( 9352): '
06-02 17:48:27.954 F/DEBUG   ( 9352):     x0  0000000000000000  x1  00000000000006d4  x2  0000000000000006  x3  0000007fe80f02d0
06-02 17:48:27.954 F/DEBUG   ( 9352):     x4  0000000000808080  x5  0000000000808080  x6  0000000000808080  x7  8080800000000000
06-02 17:48:27.954 F/DEBUG   ( 9352):     x8  00000000000000f0  x9  50e5665ba3ea522b  x10 0000000000000000  x11 ffffff80fffffbdf
06-02 17:48:27.954 F/DEBUG   ( 9352):     x12 0000000000000001  x13 000015c77efd3502  x14 00260f368244e36c  x15 0000000000000070
06-02 17:48:27.954 F/DEBUG   ( 9352):     x16 00000073dcc4a060  x17 00000073dcc26890  x18 0000007fe80ef808  x19 00000000000006d4
06-02 17:48:27.954 F/DEBUG   ( 9352):     x20 00000000000006d4  x21 00000000ffffffff  x22 0000000000000000  x23 b40000729f54e0c0
06-02 17:48:27.954 F/DEBUG   ( 9352):     x24 0000000070a925d8  x25 0000000000000003  x26 0000000000000069  x27 00000073e51e5000
06-02 17:48:27.954 F/DEBUG   ( 9352):     x28 000000712d217000  x29 0000007fe80f0350
06-02 17:48:27.954 F/DEBUG   ( 9352):     lr  00000073dcbd6a10  sp  0000007fe80f02b0  pc  00000073dcbd6a3c  pst 0000000000001000
06-02 17:48:27.954 F/DEBUG   ( 9352): backtrace:
06-02 17:48:27.954 F/DEBUG   ( 9352):       #00 pc 0000000000051a3c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)
06-02 17:48:27.954 F/DEBUG   ( 9352):       #01 pc 000000000004165c  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::die()+12) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)
06-02 17:48:27.954 F/DEBUG   ( 9352):       #02 pc 0000000000041d74  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+36) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)
06-02 17:48:27.954 F/DEBUG   ( 9352):       #03 pc 0000000000041fc8  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::reportInvalidChunkState(scudo::AllocatorAction, void*)+80) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)
06-02 17:48:27.954 F/DEBUG   ( 9352):       #04 pc 0000000000043654  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::Allocator<scudo::AndroidConfig, &(scudo_malloc_postinit)>::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long)+316) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)
06-02 17:48:27.954 F/DEBUG   ( 9352):       #05 pc 0000000001185304  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #06 pc 00000000011842fc  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #07 pc 000000000117f52c  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #08 pc 00000000011a52b8  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #09 pc 00000000011866cc  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #10 pc 00000000011a451c  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #11 pc 000000000117f680  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #12 pc 000000000118c528  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #13 pc 0000000001185850  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #14 pc 0000000001185640  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #15 pc 000000000118c0f4  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #16 pc 000000000118c090  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #17 pc 0000000001186728  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #18 pc 000000000118d720  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #19 pc 000000000118c538  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #20 pc 0000000001185850  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.955 F/DEBUG   ( 9352):       #21 pc 000000000141e83c  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/lib/arm64/libMusicBox.so
06-02 17:48:27.956 F/DEBUG   ( 9352):       #22 pc 00000000000d5c54  /system/lib64/libandroid_runtime.so (android::NativeCode::~NativeCode()+52) (BuildId: edc253edfe592db0b4e2bf94710d709d)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #23 pc 00000000000d53b4  /system/lib64/libandroid_runtime.so (android::unloadNativeCode_native(_JNIEnv*, _jobject*, long)+32) (BuildId: edc253edfe592db0b4e2bf94710d709d)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #24 pc 00000000002743a4  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (art_jni_trampoline+100)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #25 pc 00000000002ca764  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #26 pc 00000000002ee6b0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+312) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #27 pc 000000000040ade4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+820) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #28 pc 0000000000409ce0  /apex/com.android.art/lib64/libart.so (MterpInvokeDirect+1580) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #29 pc 00000000002c4f94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #30 pc 0000000000251ea8  /system/framework/framework.jar (android.app.NativeActivity.onDestroy+64)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #31 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #32 pc 000000000035a9e4  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+148) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #33 pc 000000000040b05c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1452) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #34 pc 00000000002ec494  /apex/com.android.art/lib64/libart.so (MterpInvokeSuper+3772) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #35 pc 00000000002c4f14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_super+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #36 pc 0000000000064276  /data/app/~~09NKSX_VIdCyNCpP8V7KSg==/com.embarcadero.MusicBox-Hlf3SdKPmfMhPE7KQqLtMQ==/oat/arm64/base.vdex (com.embarcadero.firemonkey.FMXNativeActivity.onDestroy+0)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #37 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.956 F/DEBUG   ( 9352):       #38 pc 000000000035a9e4  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+148) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #39 pc 000000000040b05c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1452) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #40 pc 00000000002c0ea4  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+5380) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #41 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #42 pc 00000000001c4ad2  /system/framework/framework.jar (android.app.Activity.performDestroy+102)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #43 pc 00000000002c0294  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+2292) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #44 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #45 pc 00000000002484d4  /system/framework/framework.jar (android.app.Instrumentation.callActivityOnDestroy+0)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #46 pc 00000000002bfcf4  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+852) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #47 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #48 pc 00000000001bc7ec  /system/framework/framework.jar (android.app.ActivityThread.performDestroyActivity+224)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #49 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #50 pc 000000000035a9e4  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+148) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #51 pc 000000000035a2fc  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<true, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+3020) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #52 pc 0000000000358600  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtualRange+480) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #53 pc 00000000002c5194  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual_range+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #54 pc 00000000001b94ec  /system/framework/framework.jar (android.app.ActivityThread.handleDestroyActivity+0)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #55 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.957 F/DEBUG   ( 9352):       #56 pc 000000000035a9e4  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+148) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #57 pc 000000000035b048  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<true, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1032) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #58 pc 0000000000358978  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtualRange+1368) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #59 pc 00000000002c5194  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual_range+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #60 pc 00000000002ed9b8  /system/framework/framework.jar (android.app.servertransaction.DestroyActivityItem.execute+32)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #61 pc 00000000002c0294  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+2292) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #62 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #63 pc 00000000002ecc88  /system/framework/framework.jar (android.app.servertransaction.ActivityTransactionItem.execute+8)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #64 pc 00000000002c0294  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+2292) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #65 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #66 pc 00000000002f0fbc  /system/framework/framework.jar (android.app.servertransaction.TransactionExecutor.executeLifecycleState+64)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #67 pc 000000000040a2d4  /apex/com.android.art/lib64/libart.so (MterpInvokeDirect+3104) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #68 pc 00000000002c4f94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #69 pc 00000000002f0e64  /system/framework/framework.jar (android.app.servertransaction.TransactionExecutor.execute+152)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #70 pc 00000000002c0294  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+2292) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #71 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #72 pc 00000000001b0ef8  /system/framework/framework.jar (android.app.ActivityThread$H.handleMessage+276)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #73 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.958 F/DEBUG   ( 9352):       #74 pc 000000000027c9e8  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1176) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #75 pc 00000000002d4178  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #76 pc 000000000203c4d8  /memfd:jit-cache (deleted) (android.os.Handler.dispatchMessage+168)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #77 pc 000000000203cd40  /memfd:jit-cache (deleted) (android.os.Looper.loopOnce+992)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #78 pc 000000000201fb60  /memfd:jit-cache (deleted) (android.os.Looper.loop+464)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #79 pc 00000000002caa7c  /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+60) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #80 pc 0000000000779fb0  /apex/com.android.art/lib64/libart.so (MterpMaybeDoOnStackReplacement+860) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #81 pc 00000000002c99d0  /apex/com.android.art/lib64/libart.so (MterpHelpers+240) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #82 pc 00000000004ca900  /system/framework/framework.jar (android.os.Looper.loop+160)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #83 pc 000000000076c840  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+620) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #84 pc 00000000002c5014  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #85 pc 00000000001bc586  /system/framework/framework.jar (android.app.ActivityThread.main+214)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #86 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #87 pc 000000000027c9e8  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1176) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #88 pc 00000000002d4178  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #89 pc 00000000002ca9e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #90 pc 000000000035b5d0  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+608) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.959 F/DEBUG   ( 9352):       #91 pc 000000000035b348  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #92 pc 00000000000b2f74  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+132) (BuildId: ad9ee401645a5135206a62ff86fc2ef5cdc29120)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #93 pc 00000000002ca764  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #94 pc 00000000002ee6b0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+312) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #95 pc 000000000040ade4  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+820) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #96 pc 00000000002c0ea4  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+5380) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #97 pc 00000000002c4e94  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #98 pc 00000000004598a2  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #99 pc 000000000027d840  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.3351068054637636664)+644) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #100 pc 000000000027c9e8  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+1176) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #101 pc 00000000002d4178  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #102 pc 0000000000b437b8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2376)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #103 pc 00000000002ca9e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #104 pc 000000000044ca04  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+464) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #105 pc 000000000062cf30  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+268) (BuildId: 34e3dd028e2e682b63a512d6a4f1b5eb)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #106 pc 00000000000b3bf8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124) (BuildId: edc253edfe592db0b4e2bf94710d709d)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #107 pc 00000000000c01e4  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+852) (BuildId: edc253edfe592db0b4e2bf94710d709d)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #108 pc 00000000000025a8  /system/bin/app_process64 (main+1360) (BuildId: 391e8f4ff82befde30d19b25efde721d)
06-02 17:48:27.960 F/DEBUG   ( 9352):       #109 pc 0000000000049f14  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100) (BuildId: 2eccdd45647af1cc8350cd505ceb730b)


text:
Q: Why is my question not being answered? I asked Data feed from Google Docs API and it got 9 views, but no responses. Why is this? I have tagged it with javascript, php, xml, ajax and google-docs-api. There should be a lot of people who can answer questions on this subject. It is a clearly written question, explaining what I have already tried and examples of the code.
I just don't understand why there are not more views, and why there are no answers or even comments.
How do questions just drop off the radar on Stack Overflow, where other questions provoke a huge response?

A: Looks like your question got answered now.
Why not earlier? Some ideas:

*

*Your question has the title Data feed from google docs API, which does not really indicate what your problem might be. This way less people are looking at it (which coincides with your 9 views).

*You asked at Friday afternoon/evening (depending on time zone), when less people are there.

*The answer is really specific for neither php, xml, javascript nor ajax, so if specialists of either of these fields looked at it, and didn't know anything about the Google docs API (and didn't care enough to try it themselves), they couldn't really help you.

*You actually said in your question that you can access the URL from the browser even if not logged in, which seems to be not quite true (if reading the accepted answer). This might have deterred someone from posting this idea as an answer.


text:
Q: Belongs_to based on value of a field I have a table with entries, and each entries can have different account-types. I'm trying to define and return the account based on the value of cindof
Each account type has one table, account_site and account_page. So a regular belongs_to won't do.
So is there any way to return something like:
belongs_to :account, :class_name => "AccountSite", :foreign_key => "account_id" if cindof = 1
belongs_to :account, :class_name => "AccountPage", :foreign_key => "account_id" if cindof = 2

Have tried to do that in a method allso, but no luck. Really want to have just one accountand not different belongs_to names.
Anyone that can figure out what I want? Hard to explain in English.
Terw

A: You should be able to do what you want with a polymorphic association. This won't switch on cindof by default, but that may not be a problem.
class ObjectWithAccount < ActiveRecord::Base
  belongs_to :account, :polymorphic => true
end

class AccountSite < ActiveRecord::Base
  has_many :objects_with_accounts,
        :as => :account,
        :class_name => 'ObjectWithAccount'
end

class AccountPage < ActiveRecord::Base
  has_many :objects_with_accounts,
        :as => :account,
        :class_name => 'ObjectWithAccount'
end

You will need both an account_id column and a account_type column. The type of the account object is then stored in the extra type column.
This will let you do:
obj.account = AccountPage.new

or
obj.account = AccountSite.new

A: I would look into Single Table Inheritance. Not 100% sure, but I think it would solve your problem http://code.alexreisner.com/articles/single-table-inheritance-in-rails.html
If that isn't good, this isn't too hard to implement yourself.
def account
  case self.cindof
    when 1 then AccountSite.find self.account_id
    when 2 then AccountPage.find self.account_id
  end
end


text:
Q: StandardSetController.getRecords() is returning unrelated records In an VisualForce page I am using a standardController on the Quote object. I also have an extension that has a constructor that takes in a standardSetController. The standardSetController.getRecords() returns unrelated records.
VisualForce Page:
<apex:page id="SmallBusinessRenewalQuote" standardController="Quote"
recordSetVar="quotes" extensions="SmallBusinessRenewalQuoteController">

Controller:
public List<Quote> quoteList { get; set; }
public ApexPages.StandardSetController controller { get; set; }

public SmallBusinessRenewalQuoteController(ApexPages.StandardSetController standardSetController){
    controller = standardSetController;
    quoteList = (List<Quote>)controller.getRecords();
    System.debug('Quote List: + quoteList);
    System.debug('Quote List Size: + quoteList.size());
}

There is a button on a related list of quotes that we use to access the Visual Force page. There is only 1 quote on this specific related list, and the getRecords() method is returning 22.

A: I can see why this functionality does not work in a related list. It's frustrating, but there is no list view to filter by, and that's really what the StandardSetController is using to figure out the results for getRecords().
All hope is not lost, however. You can use the page headers to figure out what the previous url is. This information can be parsed to get the parent Id. The following constructor will work whether used on a related list button or list view button:
public with sharing class MyObjectListExtension
{
    public List<MyObject__c> records { get; private set; }
    public MyObjectListExtension(ApexPages.StandardSetController controller)
    {
        String referer = ApexPages.currentPage().getHeaders().get('Referer');
        try
        {
            String substring = referer.contains('?') ?
                referer.substringBetween('.com/', '?') : referer.substringAfter('.com/');
            Id parentId = Id.valueOf(substring);
            records = [SELECT Name FROM MyObject__c WHERE Parent__c = :parentId];
        }
        catch (StringException se)
        {
            records = controller.getRecords();
        }
    }
}

You can add the following to your constructor to get a better idea of what's going on under the hood. When you click the related list button, you should see the All list view with an Id of 000000000000000AAA.
public MyObjectListExtension(ApexPages.StandardSetController controller)
{
    system.debug(controller.getFilterId());
    for (SelectOption option : controller.getListViewOptions())
        if (option.getValue() == controller.getFilterId())
            system.debug(option.getLabel());
}