text:
Q: Утечка памяти на java Можете подсказать, есть ли в программах утечка памяти?
//Oracle_time.java
 import java.sql.*;
 import java.time.LocalDateTime;

    public class Oracle_time {
    private static final String url = "jdbc:oracle:thin:elvira/elvira@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = viumdbtest)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = iumdb)))";
    public static void main(String args[]) throws SQLException {
    String query1 = "UPDATE elvira.pgw_lastfiletimedownload set LastTime='"+ LocalDateTime.now()+"'";

    try(Connection con = DriverManager.getConnection(url);PreparedStatement stmt = con.prepareStatement(query1))
    {
        stmt.executeUpdate(query1);
    }
    catch (SQLException sqlEx) {
        sqlEx.printStackTrace();
    }
}

}
//Oracle_export.java
 import com.cloudera.sqoop.SqoopOptions;
 import org.apache.sqoop.tool.ExportTool;

 import java.sql.*;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;

 public class Oracle_export {

   private static final String url = "jdbc:oracle:thin:elvira/elvira@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = viumdbtest)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = iumdb)))";

  static boolean flag = false;

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

  String query1 = "UPDATE elvira.PGW_INPUTDATA set STATE='2' where STATE='1'";
    try(Connection con = DriverManager.getConnection(url);PreparedStatement stmt = con.prepareStatement(query1))
    {
        System.out.println(export());
        if(flag) {
            stmt.executeUpdate(query1);
        }

    }
    catch (SQLException sqlEx)
    {
        sqlEx.printStackTrace();
    }
}

public static int export() throws SQLException
{
    SqoopOptions options = new SqoopOptions();
    try(Connection con = DriverManager.getConnection(url))
    {
        //con = DriverManager.getConnection(url);
        //options.setDriverClassName("oracle.jdbc.driver.OracleDriver");
        options.setConnectString("jdbc:oracle:thin:elvira/elvira@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = viumdbtest)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = iumdb)))");

        options.setTableName("elvira.PGW_OUT");

        options.setColumns(new String[]
                {
                        "numrec",
                        "TypeOfRec",
                        "accesspointnameni",
                        "apnselectionmode",
                        "causeforrecordclosing",
                        "chargingcharact",
                        "chargingchmode",
                        "chargingid",
                        "chargingrulebasename",
                        "datavolumefbcdownlink",
                        "datavolumefbcuplink",
                        "duration",
                        "dynamicaddressflag",
                        "dynamicaddressflag2",
                        "localsequencenumber",
                        "localsequencenumber2",
                        "mstimezone",
                        "networkinit1",
                        "nodeid",
                        "pgwaddress",
                        "pgwplmnidentifier",
                        "pdnconnectionchargingid",
                        "pdptypeorganization",
                        "pdptypenumber",
                        "qosinformationneg",
                        "ratinggroup",
                        "rattype",
                        "rattype2",
                        "recordopeningtime",
                        "recordsequencenumber",
                        "recordtype",
                        "served3gpp2meid",
                        "servedimeisv",
                        "servedimsi",
                        "servedmsisdn",
                        "servedpdp_pdnaddress",
                        "serviceconditionchange",
                        "servingnodeaddress",
                        "servingnode2",
                        "servingnodetype",
                        "sgsnaddress",
                        "sgsnplmnidentifier",
                        "starttime",
                        "stoptime",
                        "timeoffirstusage",
                        "timeoflastusage",
                        "timeofreport",
                        "timeusage",
                        "userlocationinformation",
                        "userlocationinformation2",
                        "id"
                }
        );
        Configuration config = new Configuration();
        config.addResource(new Path("/Users/tat100alar/hadoop_files/core-site.xml"));
        config.addResource(new Path("/Users/tat100alar/hadoop_files/hdfs-site.xml"));

        options.setConf(config);

        options.setExportDir("/user/hive/warehouse/pgw_impala.db/pgw_oracle/*.*");

        options.setNumMappers(1);

        options.setNullStringValue("null");
        options.setNullNonStringValue("null");
        options.setInputLinesTerminatedBy('\n');
        options.setInputFieldsTerminatedBy('\001');
    }
    catch(SQLException ee)
    {
        //con = DriverManager.getConnection(url);
        ee.printStackTrace();
    }
    int ret = new ExportTool().run(options);
    if (0 != ret) {

        flag=false;

    }
    else
    {
        flag=true;
    }
    return ret;
}

}
//Oracle_import.java
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.fs.Path;
  import org.apache.sqoop.tool.ImportTool;
  import com.cloudera.sqoop.*;

  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.sql.*;

  public class Oracle_import {

  private static final String url = "jdbc:oracle:thin:elvira/elvira@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = viumdbtest)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = iumdb)))";
  static boolean flag = false;

  public static void main(String[] args) throws SQLException, InterruptedException, IOException {

    String query1 = "UPDATE elvira.PGW_INPUTDATA set STATE='1' where STATE='0'";
    Process proc = Runtime.getRuntime().exec("sh/home/progr/work/test1.sh");
    try(BufferedReader read = new BufferedReader(new InputStreamReader(
            proc.getInputStream()));)
    {
        try {
            proc.waitFor();
        } catch (InterruptedException e) {
            System.out.println(e.getMessage());
        }
        while (read.ready()) {
            System.out.println(read.readLine());
        }
    } catch (IOException e) {
        System.out.println(e.getMessage());
    }

    try(Connection con = DriverManager.getConnection(url);PreparedStatement stmt = con.prepareStatement(query1))
    {
        System.out.println(export());
        if(flag) {
            stmt.executeUpdate(query1);
        }
    }
    catch (SQLException sqlEx)
    {
        sqlEx.printStackTrace();
    }
}

public static int export() throws SQLException
{
    SqoopOptions options = new SqoopOptions();
    try(Connection con = DriverManager.getConnection(url);)
    {   options.setConnectString("jdbc:oracle:thin:elvira/elvira@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = viumdbtest)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = iumdb)))");
        String query = "select ID,SERVEDIMEISV,SERVEDIMSI,FIRSTDATETIME,SECONDDATETIME " +
                "from elvira.PGW_INPUTDATA where $CONDITIONS and STATE='0' order by DATA_ID";

        options.setSqlQuery(query);

        Configuration config = new Configuration();
        config.addResource(new Path("/Users/tat100alar/hadoop_files/core-site.xml"));
        config.addResource(new Path("/Users/tat100alar/hadoop_files/hdfs-site.xml"));

        options.setConf(config);
        options.setNumMappers(1);

        options.setTargetDir("/user/abulal/test");

        options.setHiveDatabaseName("pgw");
        options.setOverwriteHiveTable(true);
        options.setHiveTableName("pgw_oracle");
        options.setHiveImport(true);

        options.setFieldsTerminatedBy('\001');
        options.setLinesTerminatedBy('\n');
        options.setDeleteMode(true);
    }
    catch(SQLException ee)
    {
        ee.printStackTrace();
    }
    int ret = new ImportTool().run(options);
    if (0 != ret) {

        flag=false;

    }
    else
    {
        flag=true;
    }
    return ret;
}

}

A: Кроме тучи стилистических и прочих проблем, есть одна глобальная проблема с вашим кодом.
Вы нигде не закрываете Statement/Connection - в принципе конечно сборщик мусора за вами все равно подберет, но по вашим словам:

код работает на нагруженном сервере и память увеличивается

это явно следствие этой проблемы.
Архитектурно обычно делается так:

*

*В одном месте грузится драйвер JDBC

*Далее в одном месте открывается Connection

*Перед вызовом, готовится Statement

*Делаем вызов, обрабатываем результаты

*Закрываем Statement

*Если Connection более не нужен то его тоже закрываем ну или держим в ожидании новых Statement
Как то так.
Update
Немного всмотрелся в код внимательнее и обнаружил еще пару мест где есть не очень оптимальные места:

*

*Вы используете прекомпилируемую версию Statement, а именно PreparedStatement, по хорошему ее надо создавать 1 раз и прогонять много раз меняя только параметры. У вас как минимум 2 запроса, которые ложатся в 1 PreparedStatement:

UPDATE elvira.PGW_INPUTDATA set STATE='2' where STATE='1'
и
UPDATE elvira.PGW_INPUTDATA set STATE='1' where STATE='0'
они хорошо лягут в запрос типа:
UPDATE elvira.PGW_INPUTDATA set STATE='?' where STATE='?'
тогда вам достаточно создать 1 PreparedStatement и менять его параметры перед вызовом.


text:
Q: Run task before repositories are added and dependencies are resolved I'm working on compiling python bindings using gradle.
There is a plugin by linkedin that facilitates that.
They also include a project called the pivy-importer that converts python dependencies into an ivy repository.
I've created a gradle plugin that wraps the pivy-importer so that it can run as a python task.
My repositories are declared like this:
repositories {
    pyGradlePyPi()
    ivy {
        name 'pypi-local'   //optional, but nice
        url "${project.buildDir.path}/pythonIvy"
        layout "pattern", {
            ivy "[organisation]/[module]/[revision]/[module]-[revision].ivy"
            artifact "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
            m2compatible = true
        }
    }
}

The problem, however, is that the repositories are being loaded before the plugin executes.
The first task that the python task runs is pinRequirements so I was adding my cusom pythonImporter task before that like this:
pinRequirements.dependsOn pythonImporter

However, even when I do that, the console shows that the pythonImporter task is running before but as soon as it tries to assemble the dependencies, it can't find them even though they do exist in the file system.
If you rerun the task again, however, it passes because the first run added the repository to the file system.
TL;DR
I need a way to run a task before dependencies are looked up under using a project's configured repositories are loaded.

A: I moved the tasks execution to my buildSrc subproject and made the build task depend upon its execution.
This works because the buildSrc project is always evaluated before the rest of the projects so you can do "before build" logic there.

redpajama_set_name: RedPajamaStackExchange


text:
Q: aws cloudformation freez and Rollback requested by user im try to create stack but all time my all stack in cloudformation freeze on KubectlAssumeRoleCustomResource and the Failed
Logical ID:
KubectlAssumeRoleCustomResource: Custom Resource failed to stabilize in expected time
Logical ID:
app: The following resource(s) failed to create: "KubectlAssumeRoleCustomResource" Rollback requested by user
Role:
{ "Version": "2012-10-17",
"Statement":[{
   "Effect": "Allow",
   "Principal": {"AWS":"arn:aws:iam::<ACCOUNT_ID>:root"},
   "Action": "sts:AssumeRole"
}]
}

Permission Role:
{
 "Version": "2012-10-17",
 "Statement":[{
     "Effect": "Allow",
     "Action": ["eks:Describe*", "ssm:GetParameters"],
     "Resource":"*"
 }]
}

my : ci-cd-codepipeline.cfn.yml
---
AWSTemplateFormatVersion: 2010-09-09

Description: EKSWSV1

Parameters:

  EksClusterName:
    Type: String
    Description: The name of the EKS cluster created
    Default: simple-jwt-api
    MinLength: 1
    MaxLength: 100
    ConstraintDescription: You must enter the EKS cluster name

  GitSourceRepo:
    Type: String
    Description: GitHub source repository - must contain a Dockerfile and buildspec.yml in the base
    Default:
    MinLength: 1
    MaxLength: 100
    ConstraintDescription: You must enter a GitHub repository name

  GitBranch:
    Type: String
    Default: main
    Description: GitHub git repository branch - change triggers a new build
    MinLength: 1
    MaxLength: 100
    ConstraintDescription: You must enter a GitHub repository branch name

  GitHubToken:
    Type: String
    NoEcho: true
    Description: GitHub API token - see https://github.com/blog/1509-personal-api-tokens
    MinLength: 3
    MaxLength: 100
    ConstraintDescription: You must enter a GitHub personal access token

  GitHubUser:
    Type: String
    Default: ifahd
    Description: GitHub username or organization
    MinLength: 3
    MaxLength: 100
    ConstraintDescription: You must enter a GitHub username or organization

  CodeBuildDockerImage:
    Type: String
    Default: aws/codebuild/standard:4.0
    Description: AWS CodeBuild Docker optimized image
    MinLength: 3
    MaxLength: 100
    ConstraintDescription: You must enter a CodeBuild Docker image

  KubectlRoleName:
    Type: String
    Default: UdacityFlaskDeployCBKubectlRole
    Description: IAM role used by kubectl to interact with EKS cluster
    MinLength: 3
    MaxLength: 100
    ConstraintDescription: You must enter a kubectl IAM role

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: GitHub
        Parameters:
          - GitHubUser
          - GitHubToken
          - GitSourceRepo
          - GitBranch
      - Label:
          default: CodeBuild
        Parameters:
          - CodeBuildDockerImage
      - Label:
          default: IAM
        Parameters:
          - KubectlRoleName
      - Label:
          default: EKS
        Parameters:
          - EksClusterName
    ParameterLabels:
      GitHubUser:
        default: Username
      GitHubToken:
        default: Access token
      GitSourceRepo:
        default: Repository
      GitBranch:
        default: Branch
      CodeBuildDockerImage:
        default: Docker image
      KubectlRoleName:
        default: kubectl IAM role
      EksClusterName:
        default: EKS cluster name

Resources:

  EcrDockerRepository:
    Type: AWS::ECR::Repository
    DeletionPolicy: Retain

  CodePipelineArtifactBucket:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain

  CustomResourceLambda:
    Type: AWS::Lambda::Function
    Properties:
      Code:
        ZipFile: |
          import json
          import boto3
          from botocore.vendored import requests
          def handler(event, context):
            response = {
              'Status': 'SUCCESS',
              "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name,
              'PhysicalResourceId': context.log_stream_name,
              'StackId': event['StackId'],
              'RequestId': event['RequestId'],
              'LogicalResourceId': event['LogicalResourceId'],
              'Data': {"Message": "Resource creation successful!"},
            }
            client = boto3.client('iam')
            try:
              if event['RequestType'] == 'Create':
                kubectl_role_name = event['ResourceProperties']['KubectlRoleName']
                build_role_arn = event['ResourceProperties']['CodeBuildServiceRoleArn']
                assume = client.get_role(RoleName = kubectl_role_name)
                assume_doc = assume['Role']['AssumeRolePolicyDocument']
                roles = [ { 'Effect': 'Allow', 'Principal': { 'AWS': build_role_arn }, 'Action': 'sts:AssumeRole' } ]
                for statement in assume_doc['Statement']:
                  if 'AWS' in statement['Principal']:
                    if statement['Principal']['AWS'].startswith('arn:aws:iam:'):
                      roles.append(statement)
                assume_doc['Statement'] = roles
                update_response = client.update_assume_role_policy(RoleName = kubectl_role_name, PolicyDocument = json.dumps(assume_doc))
            except Exception as e:
              print(e)
              response['Status'] = 'FAILED'
              response["Reason"] = e
              response['Data'] = {"Message": "Resource creation failed"}
            response_body = json.dumps(response)
            headers = {'content-type': '', "content-length": len(response_body) }
            put_response = requests.put(event['ResponseURL'], headers=headers, data=response_body)
            return response

      Handler: index.handler
      Role: !GetAtt CustomResourceLambdaExecutionRole.Arn
      Runtime: python2.7
      Timeout: 300

  CustomResourceLambdaExecutionRole:
    Type: AWS::IAM::Role
    Properties:
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
        - arn:aws:iam::aws:policy/service-role/AWSLambdaENIManagementAccess
      Path: /
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action: sts:AssumeRole
            Principal:
              Service:
                - lambda.amazonaws.com
      Policies:
        - PolicyName: codepipeline-access
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Resource: !Sub arn:aws:iam::${AWS::AccountId}:role/${KubectlRoleName}
                Effect: Allow
                Action:
                  - iam:GetRole
                  - iam:UpdateAssumeRolePolicy

  KubectlAssumeRoleCustomResource:
    Type: Custom::CustomResource
    Properties:
      ServiceToken: !GetAtt CustomResourceLambda.Arn
      KubectlRoleName: !Ref KubectlRoleName
      CodeBuildServiceRoleArn: !GetAtt CodeBuildServiceRole.Arn
    DependsOn:
      - CustomResourceLambda
      - CodeBuildServiceRole

  CodePipelineServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Path: /
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: codepipeline.amazonaws.com
            Action: sts:AssumeRole
      Policies:
        - PolicyName: codepipeline-access
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Resource: "*"
                Effect: Allow
                Action:
                  - codebuild:StartBuild
                  - codebuild:BatchGetBuilds
                  - codecommit:GetBranch
                  - codecommit:GetCommit
                  - codecommit:UploadArchive
                  - codecommit:GetUploadArchiveStatus
                  - codecommit:CancelUploadArchive
                  - iam:PassRole
              - Resource: !Sub arn:aws:s3:::${CodePipelineArtifactBucket}/*
                Effect: Allow
                Action:
                  - s3:PutObject
                  - s3:GetObject
                  - s3:GetObjectVersion
                  - s3:GetBucketVersioning
    DependsOn: CodePipelineArtifactBucket

  CodeBuildServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Path: /
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: codebuild.amazonaws.com
            Action: sts:AssumeRole
      Policies:
        - PolicyName: root
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Resource: !Sub arn:aws:iam::${AWS::AccountId}:role/${KubectlRoleName}
                Effect: Allow
                Action:
                  - sts:AssumeRole
              - Resource: '*'
                Effect: Allow
                Action:
                  - eks:Describe*
              - Resource: '*'
                Effect: Allow
                Action:
                  - ssm:GetParameters
              - Resource: '*'
                Effect: Allow
                Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutLogEvents
              - Resource: '*'
                Effect: Allow
                Action:
                  - ecr:GetAuthorizationToken
              - Resource: '*'
                Effect: Allow
                Action:
                  - ec2:CreateNetworkInterface
                  - ec2:DescribeDhcpOptions
                  - ec2:DescribeNetworkInterfaces
                  - ec2:DeleteNetworkInterface
                  - ec2:DescribeSubnets
                  - ec2:DescribeSecurityGroups
                  - ec2:DescribeVpcs
                  - ec2:CreateNetworkInterfacePermission
              - Resource: !Sub arn:aws:s3:::${CodePipelineArtifactBucket}/*
                Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:PutObject
                  - s3:GetObjectVersion
              - Resource: !Sub arn:aws:ecr:${AWS::Region}:${AWS::AccountId}:repository/${EcrDockerRepository}
                Effect: Allow
                Action:
                  - ecr:GetDownloadUrlForLayer
                  - ecr:BatchGetImage
                  - ecr:BatchCheckLayerAvailability
                  - ecr:PutImage
                  - ecr:InitiateLayerUpload
                  - ecr:UploadLayerPart
                  - ecr:CompleteLayerUpload

  CodeBuildProject:
    Type: AWS::CodeBuild::Project
    Properties:
      Artifacts:
        Type: CODEPIPELINE
      Source:
        Type: CODEPIPELINE
      Environment:
        ComputeType: BUILD_GENERAL1_SMALL
        Type: LINUX_CONTAINER
        Image: !Ref CodeBuildDockerImage
        EnvironmentVariables:
          - Name: REPOSITORY_URI
            Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${EcrDockerRepository}
          - Name: REPOSITORY_NAME
            Value: !Ref GitSourceRepo
          - Name: REPOSITORY_BRANCH
            Value: !Ref GitBranch
          - Name: EKS_CLUSTER_NAME
            Value: !Ref EksClusterName
          - Name: EKS_KUBECTL_ROLE_ARN
            Value: !Sub arn:aws:iam::${AWS::AccountId}:role/${KubectlRoleName}
        PrivilegedMode: true
      Name: !Ref AWS::StackName
      ServiceRole: !GetAtt CodeBuildServiceRole.Arn
    DependsOn: KubectlAssumeRoleCustomResource

  CodePipelineGitHub:
    Type: AWS::CodePipeline::Pipeline
    Properties:
      RoleArn: !GetAtt CodePipelineServiceRole.Arn
      ArtifactStore:
        Type: S3
        Location: !Ref CodePipelineArtifactBucket
      Stages:
        - Name: Source
          Actions:
            - Name: App
              ActionTypeId:
                Category: Source
                Owner: ThirdParty
                Version: 1
                Provider: GitHub
              Configuration:
                Owner: !Ref GitHubUser
                Repo: !Ref GitSourceRepo
                Branch: !Ref GitBranch
                OAuthToken: !Ref GitHubToken
              OutputArtifacts:
                - Name: App
              RunOrder: 1
        - Name: Build
          Actions:
            - Name: Build
              ActionTypeId:
                Category: Build
                Owner: AWS
                Version: 1
                Provider: CodeBuild
              Configuration:
                ProjectName: !Ref CodeBuildProject
              InputArtifacts:
                - Name: App
              OutputArtifacts:
                - Name: BuildOutput
              RunOrder: 1
    DependsOn: CodeBuildProject


text:
Q: How to loop through multiple polymorphic models? I don't know how to make a loop that goes through 2 models apart of the polymorphic association I have. I have the models User, Follow, Dad and Mom.
class User
 has_many :follows
end

class Mom
  has_many :follows, as: :followable
  # columns: name, :address
end

class Dad
  has_many :follows, as: :followable
  # columns: name
end

class Follow
 belongs_to :user
 belongs_to :followable, polymorphic: true
 # columns: user_id, followable_id, followable_type
end

My goal is to loop through the moms and dads that the user is following and get there specific attributes like this:
# FollowsController

index
 # follows = dads and moms
 @follows = current_user.follows.paginate(page: params[:page])
end

# follows/index.html.erb

<% @follows.each do |f| %>
 <%= f.dad.name %>
 <%= f.mom.name %>
 <%= f.mom.address %>
<% end %>

How would this be done?

A: You just need to use
f.followable.name
f.followable.address

If you want to check if it is dad or mom then you can check it like this
f.followable_type == 'Dad'

Or
f.followable.kind_of?(Dad)


text:
Q: .htaccess rewrite to unmounted folder resource Im trying to use a .htaccess file on an apache server to point /cmsfiles/flipbooks/thisFlipBook/ to /thisFlipBook
Ive tried:
RewriteRule ^/thisFlipBook/ /cmsfiles/flipbooks/thisFlipBook[L,R=302]

as well as:
RewriteRule ^/thisFlipBook/cmsfiles/flipbooks/thisFlipBook[L]

(without the R tag so that mod_rewrite knows its an internal apache redirect instead of having the browser send a new request for the rewritten resources.)
The first rule results in a 404, and the second results in:
/thisFlipBook/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/

However if you manually navigate to /cmsfiles/flipbooks/thisFlipBook it manages to find the index.html file and load it successfully.
Am i doing something wrong?
Also: server side apache redirects and unmounted folder are the correct way to be doing this right? Client started requesting so many flipbooks that we've moved them out of the project for deployments sake.


text:
Q: Can a person be described as "squeaky"? In one of our tests here at the school where I work we had the following question:
Which adjective can be used to describe a person?
The correct answer was wacky, but among the incorrect ones, there was the adjective squeaky. Based on the dictionary definition I concluded that the latter would also be possible. When I sent an e-mail to our headquarter, they answered that squeaky would not be right because we would have to understand the adjective figuratively if we were to accept it. I confess I didn't understand their explanation.
Can we say "he is squeaky" or would we have to say "he has a squeaky voice"?
I was thinking of a meaning close to what the person sounds like.
It's worth mentioning that one member of the Manson family was Lynette Alice "Squeaky" Fromme. ( from Wikipedia: George Spahn gave her the nickname "Squeaky", because of the sound she made when he touched her.)
I also thought about a possible connection with the adjective and the saying "The squeaky wheel gets the grease."
In the case of Lynette, couldn't squeaky mean someone who speaks in squeaky sounds? And, in the second case, could it mean someone who complains a lot?

A: Saying that an adjective could never apply to a particular noun seems misleading since the term can be used creatively to imply something about it.  In this case I could say something like:

He was a squeaky sort of administrator, the kind who always locked himself in his office whenever there was any kind of conflict.

Here the term "squeaky" implies "like a mouse", i.e. "timid and furtive, in a manner that belied his authority".
More commonly we could describe someone as having a "squeaky voice".  Or "squeaky-clean" to either literally mean very clean or having a strong set of moral values.  Or a "squeaky wheel" meaning someone who is always complaining or asking for special help.

A: I don't think a person can be "squeaky". In the case of "someone who complains a lot" this could refer to a "squeaky wheel":

George tends to be the squeaky wheel when we get together.

The idea is that a squeaky wheel just making noise on and on and never stops.
Also, there is the type of high-pitched voice typical of anime characters in Japan, referred to IIRC as "anime voice" (アニメ声).


text:
Q: add 10 step at the end of a datetimeindex I creat a df with datetimeindex like this
index                               value
2020-03-04T16:00:00.000000000        5
2020-03-04T16:05:00.000000000        8
2020-03-04T16:10:00.000000000        4
2020-03-04T16:15:00.000000000        1

I want to extend the range of my df by adding 10 rows at the end with respecting the 5min step
I try something like this, with no success

A: Use date_range for new DatetimeIndex by maximal index with next 5 minutes and then use DataFrame.append with DataFrame constructor:
r = pd.date_range(df.index.max() + pd.Timedelta(5, 'Min'), freq='5Min', periods=10)

df = df.append(pd.DataFrame(index=r), sort=True)
print (df)
                     value
2020-03-04 16:00:00    5.0
2020-03-04 16:05:00    8.0
2020-03-04 16:10:00    4.0
2020-03-04 16:15:00    1.0
2020-03-04 16:20:00    NaN
2020-03-04 16:25:00    NaN
2020-03-04 16:30:00    NaN
2020-03-04 16:35:00    NaN
2020-03-04 16:40:00    NaN
2020-03-04 16:45:00    NaN
2020-03-04 16:50:00    NaN
2020-03-04 16:55:00    NaN
2020-03-04 17:00:00    NaN
2020-03-04 17:05:00    NaN

If need specify value:
df = df.append(pd.DataFrame({'value': 0}, index=r), sort=True)
print (df)
                     value
2020-03-04 16:00:00      5
2020-03-04 16:05:00      8
2020-03-04 16:10:00      4
2020-03-04 16:15:00      1
2020-03-04 16:20:00      0
2020-03-04 16:25:00      0
2020-03-04 16:30:00      0
2020-03-04 16:35:00      0
2020-03-04 16:40:00      0
2020-03-04 16:45:00      0
2020-03-04 16:50:00      0
2020-03-04 16:55:00      0
2020-03-04 17:00:00      0
2020-03-04 17:05:00      0


text:
Q: Php version update on osx I am using wordpress to build an website with Jupiter theme, but it says my php version is too old.
So I tried to update php version from 5.3.3 to the higher version by following the guide on this site http://php-osx.liip.ch/
I updated to version 7, however when I get into the wordpress to activate the Jupiter theme, it still says I have php 5.3.3
When I type in $php -v on terminal it says I have the version 7, but it doesn't seem to work.
Can you help me to update php version to the higher version? It doesn't have to 7, but 5.5 would be good too.
Thank you!
updated version check by php -v


text:
Q: Cannot open file unless in administrator mode I wrote a python program that takes CSV file as input and saves all its lines as list (there is one value in each line so eventually I save a list of strings).
when I run the program from the CMD in the folder of the program\venv\scripts It is not working but it is working from Pycharm when I press "run".
The code of the function is:
def __read_from_csv_file(self):
    if pathlib.Path(self.input_file_path).exists():
        try:
            with open(self.input_file_path, 'r', newline='') as csv_file:
                csv_reader = csv.reader(csv_file)
                for line in csv_reader:
                    # Each line is a list so I take the line[0] to extract the key itself from the first cell
                    # of the line.
                    self.strings_to_check.append(line[0])
        except Exception as e:
            print('CryptoDetect::__read_from_csv_file::Exception caught: ' + "There was an error while trying "
                                                                             "the file: " +
                  self.input_file_path)
            print('The error is ' + e)
    else:
        raise Exception('CryptoDetect::__read_from_csv_file::Exception caught: ' + "The argument of input file is "
                                                                                "not a valid path, either the "
                                                                                "file not exist or the program "
                                                                                "does not has permission to "
                                                                                "open or read it.")

The problem is with the first line of the function, the if result is false.
Can someone please help me to understand why this is happening and how to fix it?
Thank you.


text:
Q: How to send email from PHP without SMTP server installed? I have a classic LAMP platform (Debian, Apache2, PHP5 and MySQL) on a dedicated server.
I heard PHPMailer can send email without having installed SMTP. Is PHPMailer the best choice for this?

A: Yes, PHPMailer is a very good choice.
For example, if you want, you can use the googles free SMTP server (it's like sending from your gmail account.), or you can just skip the smtp part and send it as a typical mail() call, but with all the correct headers etc. It offers multipart e-mails, attachments.
Pretty easy to setup too.
<?php

$mail = new PHPMailer(true);

//Send mail using gmail
if($send_using_gmail){
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->SMTPAuth = true; // enable SMTP authentication
    $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
    $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
    $mail->Port = 465; // set the SMTP port for the GMAIL server
    $mail->Username = "your-gmail-account@gmail.com"; // GMAIL username
    $mail->Password = "your-gmail-password"; // GMAIL password
}

//Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $name_from);
$mail->Subject = "My Subject";
$mail->Body = "Mail contents";

try{
    $mail->Send();
    echo "Success!";
} catch(Exception $e){
    //Something went bad
    echo "Fail - " . $mail->ErrorInfo;
}

?>

A: You can use phpmailer to send using the default php mail() function as well.
I recommend not trying to do things manually using the mail() function, use phpmailer instead and configure it to use mail().
I'd like to point out that even though you're not using an SMTP connection to send the mails yourself, the mail() function will use either an SMTP connection or the server's sendmail program to send out the emails anyways, so that will have to be configured for it to work correctly.

A: Without SMTP, you can use the PHP mail function:
http://php.net/manual/en/function.mail.php
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )


text: Q: проект на Yii2, проблема наверное с типами в базе данных Пробовал заливать на хостинг где тип таблиц InnoDB всё работает, но на хостинге где тип таблиц MyISAM и естественно не работает. Пробовал поменять тип на хостинге не помогло. Подскажите как решить данную проблему.


text:
Q: Group-Object - divide large group into chunks I have a Powershell script that retrieves some data from a database, uses Group-Object to collect it into similar groups, then uses foreach to act on each group.
The trouble is that some groups have more than 100 items, but my process can only act on 100 at once. It was written specifically to handle the items in the Group-Object results and I'd rather not rewrite that part.
Is there some elegant way to have Group-Object break up the groups into at most 100 items at a time? Or do I have to collect them with a for loop?

A: Here's what I came up with, partially thanks to this answer:
# create hashtable with unique basedomain as key and zero as value
$NameHash = @{};
foreach ($i in $tbl.rows | Group-Object basedomain) {
  $NameHash[$i.Name]=0;
}
# regroup using the hashtable as a counter source
$result = $tbl.rows | Group-Object basedomain, { [math]::Floor($NameHash[$_.basedomain]++ / 100) }


text:
Q: Error building Ada Web Server (AWS) on macOS Sierra I have updated my gnat to the latest version from AdaCore and trying to rebuild the latest AWS (Ada Web Server) also downloaded from AdaCore. I got some errors when building:
   aws-services-web_block-context.ads:106:21: argument of pragma "SUPPRESS" is not valid check name
aws-services-web_block-context.ads:106:21: argument of pragma "SUPPRESS" is not valid check name

   compilation of aws-services-web_block-context.adb failed
   compilation of aws-services-web_block-registry.adb failed

gprbuild: *** compilation phase failed
make: *** [build-native] Error 4

What could have been wrong? Or, have I overlook something?
Thanks.
Adrian

A: The check that is invalid is Tampering_Check, which is to do with the resource-intensive ARM-specified checks on improper use of Containers (basically, is one part of the code trying to change the structure of a Container that another is already using?)
I don't know why you've had this problem: both GNAT GPL 2016 and FSF GCC 6.1.0 are OK with the pragma. Are you sure you're using the latest compiler?
One other thing to watch out for is that the master branch at Github may rely on compiler features not available in compiler releases available to unsupported customers; if using GNAT GPL 2016, maybe the gpl-2016 branch would be safer, if not up to date.


text:
Q: Open modern image file dialog in SPFx web part By using the "Quick links" client-side web part on a modern site page it is possible to add a new link and set an optional image by a file dialog.

Is it possible to use this kind of file dialog in any other custom web part or was it built just for the "Quick links" web part?

A: I think its from custom fields library for SPFx
from here


text:
Q: Dynamic Content with AMPscript: Reference data in a DE not used for sending I am super new to the forum and new to AMPscript as well, so sorry if there's some imprecision in my question. :-)
I am trying to build some Dynamic Content for an email. I have 3 dynamic content blocks in total. The data for 2 of the blocks is contained in the same DE I will be using for the send out (A), and it works properly. I am having issues with the third block, which should use data located in another data extension (B - non-sendable). If I remove the third block (IF statement), then I do not get any error messages.
The logic is very simple and it's the same for all three blocks.
If a = b, show content block x. If not, show content block y.
I know that B is NOT connected to the Main DE "Contacts" in Audience Builder. Also, "Hvilken_type_bolig" is not a boleean, while "Mode" and "Winner" are. Could that be the issue? Or is there a problem with my code?
Thank you and cheers :)
EDIT: The record I am trying to generate a Subscriber Preview with exists in all the above-mentioned DEs (Contacts, A, B) with the same SubscriberKey.
Error code:
An error occurred when attempting to parse HtmlEmailBody content for HTML content. MemberID: 100009251 JobID: 0 ListID: 0 Content Begins With: {{.block g432s5hg96 codesnippetblock}}{{.data}}{ "email": { "options": { "generateFro

Code:
%%[ Var @Winner, @SubscriberKey
Set @SubscriberKey = Lookup('Contacts','SubscriberKey','SubscriberKey', @SubscriberKey),
Set @Winner = Lookup('A','Winner','SubscriberKey', @SubscriberKey)

%%[ Var @Create_Lead, @SubscriberKey
Set @SubscriberKey = Lookup('Contacts','SubscriberKey','SubscriberKey', @SubscriberKey),
Set @Create_Lead = Lookup('A','Create_Lead','SubscriberKey', @SubscriberKey)

%%[ Var @Hvilken_type_bolig, @SubscriberKey
Set @SubscriberKey = Lookup('Contacts','SubscriberKey','SubscriberKey', @SubscriberKey),
Set @Hvilken_type_bolig = Lookup('B','Hvilken_type_bolig','SubscriberKey', @SubscriberKey)

%%[IF (([Winner] == "True")) THEN]%% %%=ContentBlockById("1832577")=%% %%[ELSE]%% %%=ContentBlockById("1832580")=%%%%[ENDIF]%%
%%[IF (([Create_Lead] == "True")) THEN]%% %%=ContentBlockById("1836190")=%% %%[ELSE]%% %%=ContentBlockById("1836192")=%%%%[ENDIF]%%
%%[IF (([Hvilken_type_bolig] == "Andelsbolig")) THEN]%% %%=ContentBlockById("1836189")=%% %%[ELSE]%% %%=ContentBlockById("1836193")=%%%%[ENDIF]%%

A: Try this:
%%[
Set @SubscriberKey = AttributeValue("SubscriberKey")
Set @Winner = Lookup('A','Winner','SubscriberKey', @SubscriberKey)
Set @Create_Lead = Lookup('A','Create_Lead','SubscriberKey', @SubscriberKey)
Set @Hvilken_type_bolig = Lookup('B','Hvilken_type_bolig','SubscriberKey', @SubscriberKey)

IF @Winner == "True" THEN]%%
%%=ContentBlockById("1832577")=%%
%%[ELSE]%%
%%=ContentBlockById("1832580")=%%
%%[ENDIF]%%

%%[IF @Create_Lead == "True" THEN]%%
%%=ContentBlockById("1836190")=%%
%%[ELSE]%%
%%=ContentBlockById("1836192")=%%
%%[ENDIF]%%

%%[IF @Hvilken_type_bolig == "Andelsbolig" THEN]%%
%%=ContentBlockById("1836189")=%%
%%[ELSE]%%
%%=ContentBlockById("1836193")=%%
%%[ENDIF]%%

Here's a couple of issues you had in your script:

*

*The SubscriberKey variable was set to do a lookup based on the SubscriberKey variable, which essentially wouldn't work. I have set it to take the SubscriberKey from the SubscriberKey attribute in your Sendable DE. If the SubscriberKey field is called something else in your sendable DE, please change the name inside the AttributeValue function.

*You had some AMPscript blocks that were not closed with a ]%%

*In the conditional statements, you forgot to include the @ symbol at the beginning of the variable names.

A: Just in case my comment is correct, I wanted to move it to an answer so it is clearer:
You are referencing Hvilken_type_bolig as a field from your sendable data (the data source you attached to the send) and from what you mentioned previously, this is not a field on there. You are retrieving it from a relational DE.
I see the setting of a variable of the same name prior to your conditional statements, so I think the major issue is that [Hvilken_type_bolig] should instead be @Hvilken_type_bolig.
There were some other not necessarily 'wrong' aspects to your code, but parts that can be optimized, which I did below for a final example.
%%[
Set @SubscriberKey = AttributeValue("_subscriberkey")
/* There is no need to do a lookup, the Subscriberkey is automatically a field you can grab */

/* Could probably do a lookuprows instead of two lookups here, but this works as well*/
Set @Winner = Lookup('A','Winner','SubscriberKey', @SubscriberKey)
Set @Create_Lead = Lookup('A','Create_Lead','SubscriberKey', @SubscriberKey)

Set @Hvilken_type_bolig = Lookup('B','Hvilken_type_bolig','SubscriberKey', @SubscriberKey)
]%%

%%[IF @Winner == "True" THEN]%%
  %%=ContentBlockById("1832577")=%%
%%[ELSE]%%
  %%=ContentBlockById("1832580")=%%
%%[ENDIF]%%

%%[IF @Create_Lead == "True" THEN]%%
  %%=ContentBlockById("1836190")=%%
%%[ELSE]%%
  %%=ContentBlockById("1836192")=%%
%%[ENDIF]%%

%%[IF @Hvilken_type_bolig == "Andelsbolig" THEN]%%
  %%=ContentBlockById("1836189")=%%
%%[ELSE]%%
  %%=ContentBlockById("1836193")=%%
%%[ENDIF]%%


text:
Q: is it possible to replace the Phone App or the Lockscreen? just a stupid question.
Is it possible to write an app that replaces the standard functions of Android like the Phone App or the lockscreen. I've never saw any kind of this Apps. Is there a restriction of Google?

A:
Is it possible to write an app that replaces the standard functions of Android like the... lockscreen.

Not as an SDK application. A lockscreen can only be replaced by creating your own firmware.

A: No restriction from Google.
Actually, some VOIP dialers are there to replace the phone application.
There are not much examples, because, there is not much scope of development in the apps you mentioned.
For example, why would someone install a new app when he can make calls and do everything related to phone calls using the existing app?
Professional developers first estimate number of prospective users before developing.


text:
Q: Cannot login Magento service using C# [Magento 1.9.3.3] Error: Premature end of data in tag html line 7 I'm developing a C# Winapp to communicate with the Magento Server. I'm trying to login into Magento service to add customer data but I can't get pass the login sequence.
This is my login code in C#
PortTypeClient mservice = new PortTypeClient();
string mlogin = mservice.login("user", "password");

And this is my app.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
    </configSections>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BTVBinding" maxReceivedMessageSize="2000000">
                    <security mode="Transport" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
          <endpoint address="https://admin.mywebsite.com/index.php/api/v2_soap/index"
              binding="basicHttpBinding" bindingConfiguration="BTVBinding"
              contract="BTVMagento.PortType" name="Port1" >
          </endpoint>
        </client>
    </system.serviceModel>

I always got this error
System.ServiceModel.FaultException: 'SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://admin.mywebsite.com/index.php/api/v2_soap/index/?wsdl=1' : Premature end of data in tag html line 7

A: Found out the error caused by my endpoint redirected my API request to the website's homepage. The homepage's HTML code started at line 7 (Below 6 lines of comments). That's why it said Error: Premature end of data in tag html line 7.


text:
Q: site wide variables per user I have an MVC4 site that needs to maintain some information while (and ONLY while) the user is logged in. For example, once the user logs in, I get a 'user token' back that allows me access to several off site services.
I've tried two different approaches. The first was to use a public static class that accesses the user session. However, after reading up on static classes, I'm hesitant to use them. According to what I'm reading, static classes should only be used for read only objects, and I wasn't using it that way. Although the site site did seem to be working fine with a limited number of users (currently there's 10).
(If someone would like to explain to me why this is a bad idea in MVC4, please tell me and/or link to an article)
public class SessionAccessorClasses
{
    public const string SessionAccessorSessionVariablesString = "_SessionAccessorSessionVariables";
    public static SessionAccessorModel SessionVariables
    {
        get { return System.Web.HttpContext.Current.Session != null ? (SessionAccessorModel)System.Web.HttpContext.Current.Session[SessionAccessorSessionVariablesString] : null; }
        set { System.Web.HttpContext.Current.Session.Add(SessionAccessorSessionVariablesString, value); }
    }
}

My second (and current) approach is to use Session variables and access them using a globally available class.
public class SessionAccessorClasses
{
    private const string SessionAccessorSessionVariablesString = "_SessionAccessorSessionVariables";
    public SessionAccessorModel GetSessionVariables()
    {
        return System.Web.HttpContext.Current.Session != null ? (SessionAccessorModel)System.Web.HttpContext.Current.Session[SessionAccessorSessionVariablesString] : null;
    }
    public void SetSessionVariables(SessionAccessorModel value)
    {
        System.Web.HttpContext.Current.Session.Add(SessionAccessorSessionVariablesString, value);
    }
    public void ClearSessionVariables()
    {
        System.Web.HttpContext.Current.Session.Remove(SessionAccessorSessionVariablesString);
    }
}

This works fine, but I hesitate to call it good is because I don't fully understand why the public static class was such a bad idea, and because I now have to instantiate my new class at the beginning of nearly every function, and call the Set/Update function at the end of every function; which feels wrong somehow.
So first, since my original static class was accessing the users session, is it really that bad?
Second, is my second class a more appropriate way of doing things? Can you suggest improvements?
Third, if nothing else, can you give me the positive/negative aspects of doing it either way?

A: You want to use Session in ASP.net.  It was created for the purpose you describe.

ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session. By default, ASP.NET session state is enabled for all ASP.NET applications.

I'm a fan of strongly-typed reusable session variables, so I wrote the following extensions to store whatever variables you want to create without the need to constantly remember magic strings.
public static class SessionExtensions
{
    public static bool TryGetValue<T>(this HttpSessionStateBase session, out T value)
      where T : class
    {
        var name = typeof(T).FullName;

        value = session[name] as T;

        var result = value != null;

        return result;
    }

    public static void SetValue<T>(this HttpSessionStateBase session, T value)
    {
        var name = typeof(T).FullName;

        session[name] = value;
    }

    public static void RemoveValue<T>(this HttpSessionStateBase session)
    {
        var name = typeof(T).FullName;

        session[name] = null;
    }

    public static bool ValueExists(this HttpSessionStateBase session, Type objectType)
    {
        var name = objectType.FullName;

        var result = session[name] != null;

        return result;
    }
}

So if you have a class:
public MyClass
{
  public int MyInt { get; set; }
}

You can store it by simply:
Session.SetValue(MyClass);

that needs to maintain some information while (and ONLY while) the user is logged in.

These methods could be updated a few ways to fulfill this requirement.  Here is one way:
public static bool TryGetAuthenticatedValue<T>(this HttpSessionStateBase session,
  out T value)
  where T : class
{
    value = null;

    if (HttpContext.Current.User != null
        && HttpContext.Current.User.Identity != null
        && HttpContext.Current.User.IsAuthenticated)
    {
      var name = typeof(T).FullName;

      value = session[name] as T;
    }

    var result = value != null;

    return result;
}

I would also recommend that whatever classes you store in session, be serializable.  That is to say it has a parameterless constructor and marked as [Serializable].


text:
Q: User interactive animation in matlab I am trying to make a user interactive animation in matlab.  It is a square that translates and rotates across the screen and the user has to click on it.  If they click on it, they will receive points and the animation will repeat.  If they click on the whitespace (eg. anywhere except within the square) The animation will exit and YOU LOSE will be displayed.  I have the animation almost finished using two functions.  One to create the animation and another that registers the mouse click.  So far I can recognize the mouse click and the animation will stop if the user clicks on the whitespace but the animation will not repeat if the user clicks within the polygon.  I am unsure how to modify my code so that the animation will repeat until the user clicks the white space.  I have pasted my code below.  Any help would be greatly appreciated.
Animation function:
function movingPolygon
global gUserHitPolygon;
global gCurrentXVertices;
global gCurrentYVertices;
gUserHitPolygon = true;
nSides =4;
%Polar points
r=1;
theta = pi/nSides * (1:2:2*nSides-1);

%Cartesisn points
x0 = r * cos(theta);
y0 = r * sin(theta);
nFrames = 100;
xx = linspace(0,10, nFrames);
yy = xx;

rr = linspace(0, 2*pi, nFrames);
h = figure;
set(h,'WindowButtonDownFcn',   @mouseDownCallback);

for i = 1:nFrames

    rX = [cos(rr(i)), -sin(rr(i))];
    rY = [sin(rr(i)), cos(rr(i))];

    x1 = rX * [x0; y0];
    y1 = rY * [x0; y0];

    x2= x1 + xx(i);
    y2= y1 + yy(i);
    gCurrentXVertices=x2;
    gCurrentYVertices=y2;
    y=fill(x2, y2, 'b');

    xlim([0,10]); ylim([0,10]);
    hold on;
    pause(0.000000003);
    if ~gUserHitPolygon
        clear GLOBAL gUserHitPolygon gCurrentXVertices gCurrentYVertices;
        break;
    end
    delete(y);

end
end

Callback Function:
function mouseDownCallback(~,~)

global UserHitPolygon;
global CurrentXVertices;
global CurrentYVertices;

xVertices = gCurrentXVertices;
yVertices = gCurrentYVertices;

% if we have valid (so non-empty) sets of x- and y-vertices then...
if ~isempty(xVertices) && ~isempty(yVertices)

    % get the coordinate on the current axis
    coordinates = get(gca,'CurrentPoint');
    coordinates = coordinates(1,1:2);

    % if the coordinate is not in the polygon, then change the
    % flag
    if ~inpolygon(coordinates(1),coordinates(2),xVertices,yVertices)
       gUserHitPolygon = false;
    end
end
end

Edit: fixed some bugs in the callback function.

A: Short answer
include your animation in a while loop
Long Answer
No matter what a user does, the animation will only play once, because it doesn't know to repeat. The answer to this is to use a while loop, which will repeat your animation until you tell it to stop. Your main loop then becomes
done = false; % your stopping condition
while ~done
    for i = 1:nFrames

        rX = [cos(rr(i)), -sin(rr(i))];
        rY = [sin(rr(i)), cos(rr(i))];

        x1 = rX * [x0; y0];
        y1 = rY * [x0; y0];

        x2= x1 + xx(i);
        y2= y1 + yy(i);
        gCurrentXVertices=x2;
        gCurrentYVertices=y2;
        y=fill(x2, y2, 'b');

        xlim([0,10]); ylim([0,10]);
        hold on;
        pause(0.000000003);
        if ~gUserHitPolygon
            clear GLOBAL gUserHitPolygon gCurrentXVertices gCurrentYVertices;
            done = true; % set your stopping condition
            break;
        end
        delete(y);

    end
end


text:
Q: jQuery Sortable using mouseup, mousedown i trying to use the jQuery Sortable and works :)
so i found HERE a way to do using mousedown and mouseup to take off the button, works but the count of the list is wrong, for example, i have 4 items in my list but when i move one, only 3 as reordered
the complete code this:
$(function() {

        var isDragging = false;
        $("#sortable").mousedown(function() {
            isDragging = false;
        })
        $("#sortable").mousemove(function () {
            isDragging = true;
        })
        $("#sortable").mouseup(function () {
            var order = $("#sortable").sortable('serialize');

            var r = $("#sortable").sortable("toArray");
            var a = $("#sortable").sortable("serialize", {
                attribute: "id"
            });
            console.log(r, a);
            $.ajax({
                data: order,
                type: 'POST',
                url: 'salvar.php', // save.php - file with database update
                success: function (order) {

                },
            });
            var wasDragging = isDragging;
            isDragging = false;
            if (!wasDragging) {
                $("#throbble").toggle();
            }
        });
    });

Html:

1

2

3

4

Running code:
Running Code

A: Simply use the events sortable itself provides. Way easier then trying to implement that yourself:
$('#sortable').on('sortupdate', function() {
    // Send to server
});

Updated fiddle


text:
Q: How to use Navigation Drawer without duplicate code? I have created a Navigation Drawer following a tutorial, but now I have a problem. How can I use it in multiple activities without duplicating the code?
I tried extending the main activity, but I found some problems with Toolbar. There's some other way?
Thanks, this is my code.
MainActivity.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    class NavItem {
        String mTitle;
        int mIcon;

        public NavItem(String title, int icon) {
            mTitle = title;
            mIcon = icon;
        }
    }

    class DrawerListAdapter extends BaseAdapter {

        Context mContext;
        ArrayList<NavItem> mNavItems;

        public DrawerListAdapter(Context context, ArrayList<NavItem> navItems) {
            mContext = context;
            mNavItems = navItems;
        }

        public int getCount() {
            return mNavItems.size();
        }

        public Object getItem(int position) {
            return mNavItems.get(position);
        }

        public long getItemId(int position) {
            return 0;
        }

        public View getView(int position, View convertView, ViewGroup parent) {
            View view;

            if (convertView == null) {
                LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                view = inflater.inflate(R.layout.drawer_item, parent, false);
            }
            else {
                view = convertView;
            }

            TextView titleView = (TextView) view.findViewById(R.id.title);
            ImageView iconView = (ImageView) view.findViewById(R.id.icon);

            titleView.setText( mNavItems.get(position).mTitle );
            iconView.setImageResource(mNavItems.get(position).mIcon);

            return view;
        }
    }

    ListView mDrawerList;
    RelativeLayout mDrawerPane;

    private static String TAG = MainActivity.class.getSimpleName();

    private ActionBarDrawerToggle mDrawerToggle;
    private DrawerLayout mDrawerLayout;

    ArrayList<NavItem> mNavItems = new ArrayList<>();

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        assert getSupportActionBar() != null;
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        mNavItems.add(new NavItem(getString(R.string.home), R.drawable.ic_action_home));
        mNavItems.add(new NavItem(getString(R.string.company), R.drawable.ic_action_company));
        mNavItems.add(new NavItem(getString(R.string.services), R.drawable.ic_action_services));
        mNavItems.add(new NavItem(getString(R.string.solutions), R.drawable.ic_action_solutions));
        mNavItems.add(new NavItem(getString(R.string.case_history), R.drawable.ic_action_case_history));
        mNavItems.add(new NavItem(getString(R.string.contacts), R.drawable.ic_action_contacts));

        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
        mDrawerPane = (RelativeLayout) findViewById(R.id.drawerPane);
        mDrawerList = (ListView) findViewById(R.id.navList);
        DrawerListAdapter adapter = new DrawerListAdapter(this, mNavItems);
        mDrawerList.setAdapter(adapter);

        mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                mDrawerLayout.closeDrawer(mDrawerPane);

                if (position == 0) {
                    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                    startActivity(intent);
                } else if (position == 1) {
                    Intent intent = new Intent(getApplicationContext(), CompanyActivity.class);
                    startActivity(intent);
                }
            }
        });

        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);

                invalidateOptionsMenu();
            }

            public void onDrawerClosed(View drawerView) {
                super.onDrawerClosed(drawerView);
                Log.d(TAG, "onDrawerClosed: " + getTitle());

                invalidateOptionsMenu();
            }
        };

        mDrawerLayout.setDrawerListener(mDrawerToggle);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        return mDrawerToggle.onOptionsItemSelected(item);
    }

    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        mDrawerToggle.syncState();
    }
}

activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" >

        <ImageView
            android:contentDescription="@string/app_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/logo" />
    </RelativeLayout>

    <include layout="@layout/side_menu" />
    <include layout="@layout/toolbar" />
</android.support.design.widget.CoordinatorLayout>

side_menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?attr/actionBarSize" >

    <RelativeLayout
        android:id="@+id/mainContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <RelativeLayout
    android:layout_width="280dp"
    android:layout_height="match_parent"
    android:id="@+id/drawerPane"
    android:layout_gravity="start">

        <ListView
            android:id="@+id/navList"
            android:layout_width="280dp"
            android:layout_height="match_parent"
            android:choiceMode="singleChoice"
            android:background="#FFF" />
    </RelativeLayout>
</android.support.v4.widget.DrawerLayout>

toolbar.xml:
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay" >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>

A: Here is part of real code from my project. @Bind is from awesome Butterknife library. AbstractToolbarActivity it's a sub class of the AppCompatActivity that follows the same logic (avoiding duplicating code of initializing toolbars)
public abstract class AbstractDrawerActivity extends AbstractToolbarActivity {

  @Bind(R.id.drawer_layout) DrawerLayout mDrawerLayout;

  ActionBarDrawerToggle mDrawerToggle;

  protected void initDrawer() {

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open,
        R.string.drawer_close);
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (getSupportActionBar() != null) {
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setHomeButtonEnabled(true);
    }
  }

  @Override protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    initDrawer();
    mDrawerToggle.syncState();
  }

  @OnClick(R.id.drawer_user_name) protected void openProfile() {
    final Intent profile = new Intent(this, ProfileActivity.class);
    startActivity(profile);
  }

  // here some onclicks etc, other methods

  @Override protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
      mDrawerLayout.closeDrawers();
    }
  }

  @Override public void onBackPressed() {
    if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
      mDrawerLayout.closeDrawers();
    } else {
      super.onBackPressed();
    }
  }

  @Override protected void onPause() {
    super.onPause();

    if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
      mDrawerLayout.closeDrawers();
    }
  }
}

And AbstractToolbarActivity.java:
public abstract class AbstractToolbarActivity extends AppCompatActivity {

  @Bind(R.id.action_bar) Toolbar mToolbar;

  @Override protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    initToolbar();
  }

  protected void initToolbar() {
    setSupportActionBar(mToolbar);
  }
}

A: Create a baseactivity with your drawer inside and then extend base activity to all activities in which you want drawer.
And instead of calling setcontentview() in oncreate inheriting activities use layout inflator
Check this post
How to Display Navigation Drawer in all activities?


text:
Q: Firebase Cloud Messaging fails authentication for SDK 31+ on Android 12+ I set up FCM for my app. And it works perfectly for devices run under Android 11 and less. But for devices under Android 12 and greater I can't receive token by using
FirebaseMessaging.getInstance().token.addOnCompleteListener {
            ...
        }

I receive an error: java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED instead of token
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.boltic28.learnmultiplying">

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.LearnMultiplying"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name=".services.firebase.AppFirebaseMessagingService"
            android:exported="false">

            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id" />

    </application>

</manifest>

app:
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.boltic28.learnmultiplying"
        minSdk 26
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
    ...
}

dependencies {
    ...
    implementation 'com.google.firebase:firebase-messaging:23.0.4'
    ...
}

service:
class AppFirebaseMessagingService : FirebaseMessagingService() {

    override fun onNewToken(token: String) {
        super.onNewToken(token)

        println("->> new token: $token")
    }

    override fun onMessageReceived(message: RemoteMessage) {
        super.onMessageReceived(message)

        println("->> new message: ${message.notification?.title} - ${message.notification?.body}")
    }
}

Does anybody have some suggestions?
Data:
App targeted: SDK33
Run under   : SDK31
FCM version : 23.0.6

A: The issue was with an emulator, FCM doesn't provide a token for devices under SDK31+ without Google play services. To solve the issue and get a token you have to use an emulator or device with installed Google play services, Google APIs are not enough.


text: Q: Tabular splitting in cells with automatic split and words fitting I need to create a 3 columns of the same width and split it into cells of the same hight, so when I print text and formulas it will automatically placed in the next cell if it doesn't fit. So when I print something in the bottom cell and it doesn't fit, it should be placed in next right up cell. How can I do this?


text:
Q: conversion of numeric string into md5 with jquery I am using jQuery plug in for converting the string into md5.following is the link of jquery md5 plug in.
"http://code.google.com/p/openfire-websockets/source/browse/trunk/plugin/ofchat/js/background/jquery.md5.js?r=7"
But the problem is, I can convert only string into md5 by this.but when I am using numeric value such as time stamp.it produces error.
is there any other method or plug in by which I can convert numeric value in md5 by jquery.


text:
Q: Serving a large CSS file I have a large minified CSS file at around 50k, this is referenced by about 30 pages.
Would separating the CSS into one base file with separate CSS files for each page significantly reduce load time, or is serving one large file practically the same? Thank you.

A: I'm not entirely sure what you mean, but serving one large file and caching it properly is definitely the way to go - ideally, that  will cause only one HTTP request per client.

A: 50k really isn't that large - especially with most people's internet connections.
I'd keep the single file, because:

*

*You only need a single HTTP request to load the entire CSS

*CSS will be loaded for your entire website as soon as a single page is visited (which is nice for further browsing)

A similar topic would be the use of sprite sheets - which is essentially the same thing in that one large file containing multiple images is favourable over many smaller images nowadays.

A: Assuming that the majority of the css is being used by each page the ideal way to serve it is as a large file. HTTP Requests take time so having several small files requested by a page takes a while to load, not to mention the cap on the number of simultaneous connections. Second of all, and even more importantly, proper caching means that they only need to download the entire file once.

A: Yes separating them for each page would reduce the load time for each page since each page would only be pulling the css that it needs.


text:
Q: How to create a column with all the values in a range given by another column in PySpark I have a problem with the following scenario using PySpark version 2.0, I have a DataFrame with a column contains an array with start and end value, e.g.
[1000, 1010]
I would like to know how to create and compute another column which contains an array that holds all the values for the given range? the result of the generated range values column will be:
    +--------------+-------------+-----------------------------+
    |   Description|     Accounts|                        Range|
    +--------------+-------------+-----------------------------+
    |       Range 1|   [101, 105]|    [101, 102, 103, 104, 105]|
    |       Range 2|   [200, 203]|         [200, 201, 202, 203]|
    +--------------+-------------+-----------------------------+

A: Try this.
define the udf
def range_value(a):
    start = a[0]
     end = a[1] +1
     return list(range(start,end))

from pyspark.sql import functions as F
from pyspark.sql import types as pt

df = spark.createDataFrame([("Range 1", list([101,105])), ("Range 2", list([200, 203]))],("Description", "Accounts"))

range_value= F.udf(range_value, pt.ArrayType(pt.IntegerType()))
df = df.withColumn('Range', range_value(F.col('Accounts')))

Output

A: you should use UDF (UDF sample)
Consider your pyspark data frame name is df, your data frame could be like this:
df = spark.createDataFrame(
[("Range 1", list([101,105])),
 ("Range 2", list([200, 203]))],
("Description", "Accounts"))

And your solution is like this:
import pyspark.sql.functions as F
import numpy as np

def make_range_number(arr):
    number_range = np.arange(arr[0], arr[1]+1, 1).tolist()
    return number_range

range_udf = F.udf(make_range_number)

df = df.withColumn("Range", range_udf(F.col("Accounts")))

Have a fun time!:)


text:
Q: Django Query Result Structure I'm fairly new to Django and have been trying to get it to structure a query result in a certain way. After a few hours of trying, I'm hoping someone can show me how to improve the desired result.
In this simplified example, a word is created, users submit definitions for that word, and vote on each definition (funniest, saddest, wtf, etc.):
models.py
from django.db import models

class Word(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    word = models.CharField()
    timestamp = models.DateTimeField()

class Definition(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    word = models.ForeignKey(Word, on_delete=models.CASCADE)
    definition = models.CharField()
    timestamp = models.DateTimeField()

class Vote_category(models.Model):
    category = models.CharField()

class Vote_history(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    definition = models.ForeignKey(Definition, on_delete=models.CASCADE)
    timestamp = models.DateTimeField()
    vote = models.ForeignKey(Vote_category, on_delete=models.CASCADE)

Expected Query Result Structure
word: 'hello',
definitions: {
    {
        user: 'alice',
        definition: 'an expression of greeting',
        votes: {
            funny: 3,
            sad: 1,
            wtf: 7
        },
        votes_total: 11
    },
    etc...
}

Current Query
Get the word that was created on a specific date. Then get all its definitions:
Word.objects.filter(timestamp__date=datetime.date(2017, 2, 5)).values('definition__definition')

Current Result
<QuerySet [{'definition__definition': 'an expression of greeting'}, {'definition__definition': 'blah blah blah'}]>

Thanks for any help you can provide.


text:
Q: Add additional data to RecyclerView items I have a functioning RecyclerView which works fine with the given data I provide via ListAdapter as shown below. What I now want is to add additional data to my list items.
class IngredientAdapter(
    private val ingredientClickListener: IngredientClickListener
) : ListAdapter<Ingredient, RecyclerView.ViewHolder>(EventDiffCallback()) {

    private val adapterScope = CoroutineScope(Dispatchers.Default)

    fun submitIngredientsList(list: List<Ingredient>?) {
        adapterScope.launch {
            withContext(Dispatchers.Main) {
                submitList(list)
            }
        }
    }

I have no idea how to do that properly or if RecyclerViews are even capable of doing this. The only way I am able to see is merging both data classes (Ingredient plus the new one) together and submit them as list together to the adapter but this seems messy and I am looking for a better way.
So my question is: How to feed data into my list items without merging it together with the data I already have? Is RecyclerView the wrong choice in my case?
Thanks in advance!

A: Ok I found a solution: I submitted the additional data list just how like the other one but did not attach it directly to the ListAdapter since this is not possible.
In the function onBindViewHolder after getting the item for the current position I use this information to retrieve the correct element from the new data list. Then I attach the data to the view by calling using the viewholders view binding
    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        when (holder) {
            is ViewHolder -> {
                val resources = holder.itemView.context.resources
                val ingredientItem = getItem(position)
                holder.bind(ingredientClickListener, ingredientItem)
                val groceryInStock: GroceryInStock? = availableGroceries.firstOrNull{

                    ingredientItem.grocery.groceryId == it.grocery.groceryId
                }

                holder.binding.listItemAvailableAmount.text = groceryInStock.amount
            }
        }
    }

Since the data I add fully depends on the already existing item being displayed I did not make any changes to the functions areItemsTheSame and areContentsTheSame in my overriden DiffUtil.ItemCallback class.


text:
Q: DocuSign Send on Behalf Of (SOBO): User Names with Commas I have a ColdFusion code implementing DocuSign REST API calls. They are working fine except when the user's name in DocuSign is like: LastName, FirstName format. So basically, Doe, John is failing in the sense that the Reply To Email in both Desktop OutLook and online OutLook--and possibly other clients-- becomes like: Doe@mydomain.com; john@mydomain.com in the Reply to address bar in the email clients.
But... if the user's name was like John Doe then no problem.
Anyway, my relevant code is inside a CFHTTP call as:
<SendOnBehalfOf>#SOBOEMAIL#;#SOBONAME#</SendOnBehalfOf></DocuSignCredentials>">

but it shouldn't matter what programming envrironment--the comma in the user name is the problem, always. I have tried to just be #SOBONAME# or just #SOBOEMAIL# but no luck.
Any idea?
Thanks!

A: Just a thought- have you tried escaping the comma (,) character in XML?  Something like:
<SendOnBehalfOf>#SOBOEMAIL#;Doe,John</SendOnBehalfOf></DocuSignCredentials>">

A: I don't know why exactly, but I managed to massage the name in the Reply to using ColdFusion's string manipulation and then used the following in the Envelope's JSON code.
  ""emailSettings"": {
      ""replyEmailAddressOverride"": ""#SOBOEMAIL#"",
      ""replyEmailNameOverride"": ""#fullnameProper#"",

    },

No problem now. The fullnameproper is the one result of the CF string work.
HTH.


text:
Q: Words to describe the state of being in a marriage Just a brief question about marriage-related words in English.
You see, in Russian language we have two words to describe "state of being in marriage", one for man (женатый мужчина = married man), and different word for woman (замужняя женщина = married woman).
In English, so far as I know, there is no such variations. Am I right?

In Russian we can make some jokes or give an extra meaning, based on using these two words, for example one can say "замужний мужчина", which may mean:

*

*man who married on strong, masculine, or feminist-like woman;

*man who spend too many time with one particular man (gay-related joke);

*real gay couple (gay marriage are prohibited in Russia, so we use in more "figurative" sense)

*and so on...
Same is true for "женатая женщина".

So I am wondering, does English have a special word to describe:

*

*Man who married masculine (strong, independent) woman

*Woman who married feminine (weak, spineless)  man

*Man who married man

*Woman who married woman

I think we can use "lesbians couple" and "gay couple" words in third and forth cases, but they describe more "state of being the lovers", not "state of being in a marriage", are they?
Maybe some idioms exist?
Thanks.

A: English does not make the same distinction between male and female gendered nouns. For example in French there is "le" and "la", and in German there is "die" and "der", this does not happen in English.
In marriage, if Lisa married David Klein, in many Slavic languages her name would become Lisa Klein"ova". This does not happen in English, it would simply be "Lisa Klein".  For "state of being in marriage", English only has "Mrs." and "Miss" for women as titles, whereas French has "madame" and "mademoiselle", but even "madame" may be ambiguous.
Usually in English, the description of marriage is given by additional surrounding context (additional adjectives such as "gay", "straight", "vanilla") as opposed to using a specific noun.  However, there is the word "cuckhold" which has certain power/sexual/fetish meanings for a husband.

A: As Peter mentions, in general English has no distinction between male and female with verbs relating to marriage or relationships.  For example, "married", "dating", "seeing each other", "in a relationship", "partners", "having a fling", "friends with benefits", "casual sex", "one-night stand", and many others, all are gender-neutral and can apply equally to straight or gay couples.
However there are many words to characterize the nuances of married life, many of which are colloquial or vulgar.  Aside from the basic honorifics (Mr., Mrs. Miss, and Ms.) there are these:
A "henpecked" husband is one whose wife constantly nags him and orders him around, and who is generally the subordinate in the relationship.  The vulgar term is "whipped", short for "pussy-whipped", although this can apply to married or unmarried men in a relationship with a demanding woman.
A "matriarch" is a strong woman who is the head of a (usually large) family, and who is usually controlling.  A "patriarch" is similar for men, although there can be some religious overtones, as with the male leader of a religious group.
For gay male couples, there is often some distinction between the "top" and the "bottom" in the relationship..  More crudely this can be referred to using baseball metaphors as "pitcher" and "catcher".
A man who supports a (often much younger) woman financially, usually as his mistress, would be called a "sugar daddy".  A woman who is in a relationship simply because the other person is wealthy would be called a "gold-digger".  Note these terms can also be used for the opposite gender ("sugar momma/mommy"), or for gay relationships.
As far as I know there is no special term for a homosexual marriage.  We just call it a "marriage".  Since it's not always clear how to refer to the two people in the marriage, "partner" is a good catch-all term instead of "husband" or "wife".  Note "partner"can also be used for heterosexual relationships, married or otherwise, so it can be somewhat ambiguous.
(Edit): Or "spouse" for a married couple. (thanks BradC!)

A: English has almost no gender-specific adjectives, so you would say "married" either way. A masculine woman (that shows stereotypically male traits) would be referred to as a "tomboy". Even as a native speaker I find the titles for females confusing, so here's a cheat sheet:
Miss: Unmarried Woman (young, 30 and under)
Mrs.: Married Woman
Ms.: Married Woman that kept her maiden name, divorced woman, older unmarried woman (30's and up)


text:
Q: Having trouble adding objects to NSMutableArray Im having truble adding objects to my 2 NSMutableArrays. The data comes from a database and I know that my parsing is correct because I get valid outputs when I use the NSLog. However I can't figur out how to add the 2 different objects to my 2 different NSMutableArrays. Here is my code
-(void)connectionDidFinishLoading:(NSURLConnection *)connection {

     allDataDictionary = [NSJSONSerialization JSONObjectWithData:webData options:0 error:nil];
     feed = [allDataDictionary objectForKey:@"feed"];
     arrayOfEntry = [feed objectForKey:@"entry"];

     for (NSDictionary *dictionary in arrayOfEntry) {

         NSDictionary *title = [dictionary objectForKey:@"title"];
         NSString     *labelTitle = [title objectForKey:@"label"];

         [arrayLabel addObject:labelTitle];

         NSDictionary *summary = [dictionary objectForKey:@"summary"];
         NSString     *labelSummary = [summary objectForKey:@"label"];

         [arraySummary addObject:labelSummary]; //This line makes the application crash

     }

}

for some reason when I want to add labelSummary to arraySummary I get this error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

Any help is appreciated.

A: Your parsing is indeed correct. However, when the parser comes across an empty field it returns nil.  The problem is the that NSArrays cannot accept nils, because nil is not an object, it's equivalent to 0. Therefore, you most add an object.  This the role of NSNull.
Must test to see if the parser returns nil, and if so add [NSNull null].
NSString* labelSummary = [summary objectForKey:@"label"];

[arraySummary addObject:(labelSummary!=nil)?labelSummary:[NSNull null];

A: The error message tells you that one of the objects you are trying to add to the array is nil.
You have to replace
[arrayLabel addObject:labelTitle];

with
if (labelTitle != nil) {
   [arrayLabel addObject:labelTitle];
}

and
[arraySummary addObject:labelSummary];
with
if (labelSummary != nil) {
   [arraySummary addObject:labelSummary];
}

If you really need to include a nil object, then use NSNull.


text:
Q: Why can't I add objects to my NSMutableArray For some reason since last night Xcode just stopped working properly, it doesn't autocorrect, provide code hints, and doesn't recognize errors until built. And now I can't even get my code to work 100% properly.
My objects won't add to my array.
.h
  NSMutableArray *notesTitle;
  NSMutableArray *notesBody;

.m
- (void)viewDidLoad
{
    [super viewDidLoad];
    notesTitle = [[NSMutableArray alloc]init];
    notesBody = [[NSMutableArray alloc]init];
}

...
 [notesTitle addObject:noteTitle.text];
 [notesBody addObject:noteText.text];

///noteTitle.text and noteText.text do contain Text

And Both Array's turn out as null

A:
For some reason since last night Xcode just stopped working properly,
  it doesn't autocorrect, provide code hints, and doesn't recognize
  errors until built. And now I can't even get my code to work 100%
  properly.

Unrelated;  try removing your derived data directory entirely and rebuilding.

And Both Array's turn out as null

Are you sure your viewDidLoad method has been invoked?  Set a breakpoint (or print something out).


text:
Q: Trying to reuse a redux-form with functional component I'm trying to build a reusable component to create simple forms, having validation and handling submit actions. I able to use it by it self, but when I try to make a functional component to inject props I got stuck in this error.

This class uses the component to build forms

import React from 'react';
import CustomReduxForm from './CustomReduxForm';

class LoginForm extends React.Component {
  getFields() {
    return [
      {
        name : 'username',
        type : 'text',
        label : 'User',
        mandatory : true
      },
      {
        name : 'password',
        type : 'password',
        label : 'Password',
        mandatory : true
      }
    ];
  }

  handleFormSubmit(values) {
    console.log(values)
  }

  render() {
    return (

Test

        <CustomReduxForm
          formName="LoginForm"
          fields={this.getFields()}
          onSubmit={this.handleFormSubmit}
        />

    );
  }
}

export default LoginForm;

This is the component to build forms

import React from 'react';
import { reduxForm, Field } from 'redux-form';

function CustomReduxForm(props) {

  class CustomForm extends React.Component {
    render() {
      const { handleSubmit } = this.props;
      return (

          <form onSubmit={handleSubmit(props.onSubmit)}>
            {fields.map(myField => renderFieldset(myField))}
            <button className="btn btn-primary" type="submit">Submit</button>
          </form>

      );
    }
  }

  const renderInput = field => {
    return (
        <div className={`form-group ${field.meta.touched && field.meta.invalid ? 'has-danger' : ''}`}>
          <input
            {...field.input}
            type={field.type}
            className="form-control"
          />

          {field.meta.touched && field.meta.error &&
{field.meta.error}
}

    );
  }

  const renderFieldset = customField => {
      return (

          {customField.label}
          <Field
            name={customField.name}
            component={renderInput}
            type={customField.type} />

      );
  }

  const validate = values => {
    const errors = {}

    props.fields.forEach((customField) =>
    {
      if(customField.mandatory && ! values[customField.name]) {
        errors[customField.name] = `You must enter a valid value for ${customField.label}!`;
      }
    });

    return errors
  }

  return reduxForm({
    form: props.formName,
    validate
  })(CustomForm);

};

export default CustomReduxForm;

I already tried different ways to export the created form on CustomReduxForm, but still nothing!

return reduxForm({
  form: props.formName,
  validate
})(CustomForm);

// or

const FormWrapped = reduxForm({
  form: props.formName,
  validate
})(CustomForm);

// Non sense, but ..
return FormWrapped;

// or
return <FormWrapped />;

Thanks!

A: The problem is the return statement of CustomReduxForm.
The correct one is to assign it to a variable and use JSX syntax like what you did in the last snippet.
const WrappedForm = reduxForm(...)(CustomForm);
return <WrappedForm />

The only thing you missed is to also pass the props of CustomReduxForm to the WrappedForm.
You'll need to use return <WrappedForm {...props} />
Now it's a matter of fixing the other errors in your code like...
const { fields, handleSubmit } = this.props
Instead of using const renderFieldset and doing {fields.map(myFieldset => renderFieldset(myFieldset)
You might want to use const Fieldset = ... then {fields.map((myFieldset, index) => <Fieldset key={index} />)}
It should now work as expected.

A: Every React component has to have render() method.
So make sure your functional component CustomReduxForm has render method.
I guess you have to wrap the return in the render method:
function render() {
    return reduxForm({
        form: props.formName,
        validate
    })(CustomForm);
}

However, I'm not sure why you create a functional component, that wraps another class component and so on.
Look at the official redux form documentation, how is the conventional way of creating forms:
import React from 'react'
import { Field, reduxForm } from 'redux-form'

const SimpleForm = (props) => {
  const { handleSubmit, pristine, reset, submitting } = props
  return (
    <form onSubmit={handleSubmit}>

        First Name

          <Field name="firstName" component="input" type="text" placeholder="First Name"/>

        Last Name

          <Field name="lastName" component="input" type="text" placeholder="Last Name"/>

        Email

          <Field name="email" component="input" type="email" placeholder="Email"/>

        Sex

          <Field name="sex" component="input" type="radio" value="male"/> Male
          <Field name="sex" component="input" type="radio" value="female"/> Female

        Favorite Color

          <Field name="favoriteColor" component="select">
            <option></option>
            <option value="ff0000">Red</option>
            <option value="00ff00">Green</option>
            <option value="0000ff">Blue</option>
          </Field>

        Employed

          <Field name="employed" id="employed" component="input" type="checkbox"/>

        Notes

          <Field name="notes" component="textarea"/>

        <button type="submit" disabled={pristine || submitting}>Submit</button>
        <button type="button" disabled={pristine || submitting} onClick={reset}>Clear Values</button>

    </form>
  )
}

export default reduxForm({
  form: 'simple'  // a unique identifier for this form
})(SimpleForm)


text:
Q: DAO Connection throws ISAM Error I can connect to an access database via ADO w/o issue, but if I attempt to connect using a DAO connection it throws the error of Could not find installable ISAM  I am  using VS2013 and it is communicating with Access 2000.  This is the syntax I am using (DAO) to connect to my database.  This syntax works with VS2010...
DAO.Database dd;
DAO.DBEngine db = new DAO.DBEngine()
DAO.TableDef tdf1;
string sourceTable = "dbo.Master";
string linkedTable = "Master";
string database = "C:\\Test.mdb;"
string sqlconnection = "ODBC;DRIVER=SQL SERVER; SERVER=TinyOne;Database=InterWebDB;Trusted_Connection=Yes";

dd.OpenDatabase(database);
tdf1.dd.CreateTableDef(linkedTable);
tdf1.Connect = sqlconnection;
tdf1.SourceTableName = sourcetable;
//The below line produces the ISAM error
dd.TableDefs.Append(tdf1);


text:
Q: How to tell if PDO found a match to my UPDATE query, and updated or not? UPDATE users SET 'name'='john' WHERE users.ID = 54;

actually all this question is about pdo::rowCount, as I need to know that a match to the query was:
1. found, but need not to update (matching values)
2. found, and updated
3. not found at all, (not updated)
I am looking for a way to tell in PHP one of those three options

A: As documented under UPDATE Syntax:

UPDATE returns the number of rows that were actually changed. The mysql_info() C API function returns the number of rows that were matched and updated and the number of warnings that occurred during the UPDATE.

In particular, after an UPDATE query mysql_info() returns ER_UPDATE_INFO.  The MySQL Command-Line Tool displays such information immediately after a command is issued.  For example:
mysql> UPDATE users SET name='john' WHERE ID=54;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0
MySQLi provides direct access to this function, through mysqli::$info.  Even the Original MySQL API provided access thereto, through its own mysql_info() function.
Unfortunately, PDO provides no access to this function—a search of the codebase confirms that it never calls mysql_info().
Alternatively, clients can set the CLIENT_FOUND_ROWS connection flag—then UPDATE will return the number of rows that matched rather than the number that were changed.  PDO does provide access to set this connection flag, via the PDO::MYSQL_ATTR_FOUND_ROWS driver-specific attribute.
However this connection flag is of little use to you, as instead of being unable to differentiate between "not found at all" and "found but no update", it will leave you unable to differentiate between "found but no update" and "found and updated".
Thus, as others have already suggested, your only option in this case would be to perform a separate SELECT query to differentiate between the possible conditions.  In order to avoid race hazards, you should be careful to perform the SELECT within the same transaction and to use a locking read if reading before updating.