lundi 1 août 2016

ExtJS ComponentQuery and Dynamic content

I have a layout with multiple grids, and they all use RowEditing plugin. I am trying to use Ext.ComponentQuery.query to get access to the embedded RowEditor buttons on specific grids, but am unable to figure out how to properly traverse things. I wonder if it has to do with the RowEditor and buttons being added dynamically - though I cannot find anything to confirm that is expected or not.

// #update is Never found Ext.ComponentQuery.query("#myGrid")[0].down("#update");

// Will find all the RowEditor update buttons on the page Ext.ComponentQuery.query("#update");

// I can find xtype roweditorbuttons, but up() doesn't point to anything (expected something about my target grid) Ext.ComponentQuery.query("roweditorbuttons")[0].up()

How can I get access to these button controls

Gaussian elimination using C

I want to find the determinant of a square matrix of size 3x3 for this I am using Gaussian elimination so that I can multiply diagonal elements and get the determinant. The code used is given. It is converting the matrix into upper triangular but not giving the solution pls give me a solution.

    #include<stdio.h>
    void determinant (float A[3][3]);
    void main()
    { 
      int i,j;
      float A[3][3]={1,2,3,0,1,1,4,1,2};
      determinant(A);
      for(i=0;i<3;i++)
      {
         for(j=0;j<3;j++)
         { 
           printf("%ft",A[i][j]);
         }
         printf("n");
      }
    }

    void determinant (float A[3][3])
     {
      int i,j,k;
      for(k=0;k<2;k++)
      {
         for(i=k+1;i<3;i++)
        {
         for(j=0;j<3;j++)
          {
            A[i][j]=A[i][j]-(A[k][j]*(A[i][k]/A[k][k];
           }
         }
      }
    }

PHP - Cannot Assign String Value to Input with Pattern

I want to assign mysql_result strings to text inputs, but I can't figure out how the pattern attribute messes it up.

$id = $_GET['id'];
$q = mysql_query("SELECT * FROM employees WHERE id=".$id);

if(mysql_num_rows($q)!=0)
{
    $address = mysql_result($q, 0, 3);
}

Sample result would be: 1034 Wildwood Street Stow, OH 44224. My pattern regex only accepts alpha-numeric characters, period, comma, pound sign, hyphen, and spaces.

echo "<input type='text' class='form-control' name='address' value=".$address." pattern='[a-zA-Z0-9.,#- ]+' title='Letters, numbers, pound sign, period, and comma only' required>";

The text input will only display 1034. I don't know why it ignores the space and the characters after it.

Acts_as_commentable_with_threading javascript toggle not working with rails 5

I've been trying to get this tutorial to work with my rails 5 project, but apparently there has been some change in javascript since rails 4, which causes the reply field to immediately close upon clicking "reply". It's supposed to stay open until you've typed in a message and clicked the "Post comment" button next to it.
There is a comment from 6 days ago suggesting js code that works with rails 5, but it does not work for me. (do I have to change something with the anchor and span he mentions?)

I have followed the guide exactly, even made an entirely new project, and still no luck.

What change needs to be made to the javascript code to make it compatible with rails 5?

How correctly hide/show html by ng-if/ng-show/ng-hide from app.run function?

I try to make correct view loading app.

HTML:

<body>
   <loading outerWidth='1000' outerHeight='1000' display='isReady'></loading>
   <div class='wrapper' ng-show='isReady'>
   </div>
</dody>

JS:

app.run(['$rootScope', '$state', '$stateParams', '$location', '$http', 'userData', function($rootScope, $state, $stateParams, $location, $http, userData) {
     $rootScope.isReady = false;
     $http.post('services/enter.php', {

     }).then(function(response) {
          $rootScope.isReady = true;
     });
 }]);

Basic idea: when app loading show some image/loading gif 'please wait'. Next post request to get data and after request show html. But I have problem to manipulate html from app.rum functiuon - I try use $rootScope. Need suggestions how I can do it better.

Nginx proxy incorrect fastcgi_script_name for static files

server {
    listen loc.app:80;    

    root /app/frontend/web;

    index index.php;

    location / {        
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ ^/admin {
        proxy_pass http://127.0.0.1:81;     
    }

    location ~* .php$ {    
        #php conf
    }                    
}

server {
    listen 127.0.0.1:81;

    root /app/backend/web;

    index index.php;

    location / {        
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ .(js|css)$ {    
        echo "$document_root"; # /app/backend/web;

        echo "$fastcgi_script_name"; # /admin/assets/569a8b41/css/bootstrap.css         
        ############################## ISSUE ##############################
        # $fastcgi_script_name must be /assets/569a8b41/css/bootstrap.css #
        ###################################################################
    }

    location ~* .php$ {    
        #php conf
    }
}

http://loc.app/admin - ok
http://loc.app/admin/style.css - returns 404

How to force nginx to correctly handle static files ?

How to convert file into encoded data and concatenate with other javacsript variables?

hey i want to convert the file which has been uploaded by users from html front end. i prefer to convert bse64 format and converted file data should concatenate with other form data eg: firstName, lastName, email id. i want all those field values in single string firstName+lastName+emailID+fileData(base64encode or anyother encoding format to store in database) Please help me out from this,. I have tried fileReader to get base64 format but i don't know how to concatenate encoded data and filedata.
Thanks in advance .

code:

var gbyte = [];    

function handleFileSelect(evt) {
    var files = evt.target.files[0]; // FileList object

    var reader = new FileReader();
    reader.onload = (function (reader) {
        return function () {
            gbyte = reader.result;
        }
    })(reader);

    reader.readAsDataURL(files);
}

var x = gybte[] (i need the fileReader data here );