text:
Q: DataBase Insertion In my app i want to get password from the edit text and i want to store it in the data base on button Click
In my main Activity i am getting the password value,Code is..
  db_obj = new OpenHelper(getApplicationContext()) {};
      okBtn = (Button)findViewById(R.id.okbtn);
      passwordTxt = (TextView)findViewById(R.id.editText1);
      passwordTxtValue = passwordTxt.getText().toString();

     okBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            String id1 = Integer.toString(id);
              passwordTxtValue = passwordTxt.getText().toString();
              Toast.makeText(SetteingsPage.this, passwordTxtValue, Toast.LENGTH_SHORT).show();
              System.out.println("pa"+passwordTxtValue);

              db_obj.password_varification(id1, passwordTxtValue);

        }

In openHelper i had created the dataBase as...
static final String password_table = "password_db";
static final String table_id = "table_id";
static final String password = "password";

  public void onCreate(SQLiteDatabase db)
{
    db.execSQL("CREATE TABLE "+password_table+"("+table_id+" INTEGER PRIMARY KEY, "+password+" TEXT)");

}

 public void password_varification(String tableid ,String paswrd )
{
    SQLiteDatabase db=this.getWritableDatabase();
    ContentValues cv=new ContentValues();

     cv.put(table_id, tableid);
     cv.put(password, paswrd);

     db.insert(password_table, table_id, cv);

     db.close();
     Log.v("DB", "Inset_User OK" + tableid + " " + paswrd);
}
 // password Data retrive here
public ArrayList<HashMap<String, String>> password_records()
{
     SQLiteDatabase db=getReadableDatabase();
     ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

     Cursor cursor=db.rawQuery("SELECT "+table_id+" as _id,  "+password+" from "+password_table,new String [] {});
    //Cursor cursor=db.rawQuery("SELECT "+row+" as _id, "+twitter+" from "+winery_info_2,new String [] {});

         if(cursor!=null)
         {
             if(cursor.moveToFirst())  // movies first column
             {
                 do
                 {
                     HashMap<String, String> map = new HashMap<String, String>();

                     String  fnam        = cursor.getString(cursor.getColumnIndex("password"));

                     map.put (password      ,fnam);

                     list.add(map);
                 }
                 while(cursor.moveToNext()); // move to next row

             }
         }

         if (cursor != null && !cursor.isClosed())

         {
            cursor.close();
         }

         return list;
   }

But still When i am tring to insert the value it showing the error that "No such table"..how can i solve it
The logCat ouput is
   01-08 16:06:33.273: E/Database(12305): Error inserting password_db
  01-08 16:06:33.273: E/Database(12305): android.database.sqlite.SQLiteException: no            such table: password_db: , while compiling: INSERT INTO password_db(table_id, password) VALUES(?, ?);
 01-08 16:06:33.273: E/Database(12305):     at       android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
01-08 16:06:33.273: E/Database(12305):  at   android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
01-08 16:06:33.273: E/Database(12305):  at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
 01-08 16:06:33.273: E/Database(12305):     at android.database.sqlite.SQLiteProgram.  <init>(SQLiteProgram.java:83)
 01-08 16:06:33.273: E/Database(12305):     at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:41)
 01-08 16:06:33.273: E/Database(12305):     at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1151)
 01-08 16:06:33.273: E/Database(12305):     at com.example.security.database.OpenHelper.password_varification(OpenHelper.java:98)
 01-08 16:06:33.273: E/Database(12305):     at com.example.security.Setting.SetteingsPage$2.onClick(SetteingsPage.java:51)
 01-08 16:06:33.273: E/Database(12305):     at android.view.View.performClick(View.java:2485)
 01-08 16:06:33.273: E/Database(12305):     at android.view.View$PerformClick.run(View.java:9080)
01-08 16:06:33.273: E/Database(12305):  at android.os.Handler.handleCallback(Handler.java:587)
01-08 16:06:33.273: E/Database(12305):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-08 16:06:33.273: E/Database(12305):  at android.os.Looper.loop(Looper.java:130)
01-08 16:06:33.273: E/Database(12305):  at android.app.ActivityThread.main(ActivityThread.java:3687)
01-08 16:06:33.273: E/Database(12305):  at java.lang.reflect.Method.invokeNative(Native Method)
01-08 16:06:33.273: E/Database(12305):  at   java.lang.reflect.Method.invoke(Method.java:507)
01-08 16:06:33.273: E/Database(12305):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-08 16:06:33.273: E/Database(12305):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-08 16:06:33.273: E/Database(12305):  at dalvik.system.NativeStart.main(Native Method)

A: DBAdapter Class #
this is my example code it works fine.IN AddActivity i will get some values from edit text and using DBAdapter i will save in sqlite.
package gps.profile.changer;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DBAdapter {
    public static final String KEY_ROWID = "_id";
    public static final String KEY_LAT = "latcol";
    public static final String KEY_LON = "loncol";
    public static final String KEY_LOCNAME = "locnamecol";
    public static final String KEY_PROTYPE="protypecol";
    private static final String TAG = "DBAdapter";

    private static final String DATABASE_NAME = "gps";
    private static final String DATABASE_TABLE = "locationtb";
    private static final int DATABASE_VERSION = 1;

    private static final String DATABASE_CREATE =
    "create table locationtb (_id integer autoincrement primary key,latcol real not null,"
    + "loncol real not null,locnamecol varchar not null, "
    + "protypecol varchar not null);";

    private final Context context;

    private DatabaseHelper DBHelper;
    private SQLiteDatabase db;

    public DBAdapter(Context ctx) {
        // TODO Auto-generated constructor stub
        this.context = ctx;
        DBHelper = new DatabaseHelper(context);
    }

    private static class DatabaseHelper extends SQLiteOpenHelper
    {
    DatabaseHelper(Context context)
    {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
    db.execSQL(DATABASE_CREATE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion,
    int newVersion)
    {
    Log.w(TAG, "Upgrading database from version " + oldVersion
    + " to "
    + newVersion + ", which will destroy all old data");
    db.execSQL("DROP TABLE IF EXISTS locationtb");
    onCreate(db);
    }
    }

    //---opens the database---
    public DBAdapter open() throws SQLException
    {
    db = DBHelper.getWritableDatabase();

    return this;
    }

    //---closes the database---
    public void close()
    {
    DBHelper.close();
    }

    //---insert a title into the database---
    public long insertTitle(double latcol, double loncol, String locnamecol,String protypecol)
    {
    ContentValues initialValues = new ContentValues();
    initialValues.put(KEY_LAT, latcol);
    initialValues.put(KEY_LON, loncol);
    initialValues.put(KEY_LOCNAME, locnamecol);
    initialValues.put(KEY_PROTYPE, protypecol);

    return db.insert(DATABASE_TABLE, null, initialValues);
    }

    //---deletes a particular title---
    public boolean deleteTitle(String rowId)
    {
    return db.delete(DATABASE_TABLE, KEY_LOCNAME  +
    "=" + rowId, null) > 0;
    }

    //---retrieves all the titles---
    public Cursor getAllTitles()
    {
    return db.query(DATABASE_TABLE, new String[] {

    KEY_LAT,
    KEY_LON,
    KEY_LOCNAME,
    KEY_PROTYPE},
    null,null,null,null,null);//put extra null if not work
    }

    //---retrieves a particular title---
    public Cursor getTitle(String gen) throws SQLException
    {
    Cursor mCursor =
     db.query(true, DATABASE_TABLE, new String[] {

    KEY_LAT,
    KEY_LON,
    KEY_LOCNAME,
    KEY_PROTYPE
    },
    KEY_PROTYPE + "=" + gen,
    null,null,null,null,null);
    if (mCursor != null)
    {
    mCursor.moveToFirst();
    Log.e("","");
    }

    return mCursor;
    }
    //checking  profile saved for that latitude and longitude in db

    public Cursor getprofilelist(String gen) throws SQLException
    {

     Cursor mcursor = db.rawQuery("select * from locationtb where protypecol=? " ,new String [] {gen});
     if (mcursor != null)
       {
      mcursor.moveToFirst();
       Log.e("","");
       }
     return mcursor;
    }

    public Cursor getLocationProfile(Double a,Double b ) throws SQLException
    {

     Cursor mcursor = db.rawQuery("select * from locationtb where latcol=? and loncol=?" ,new String [] {String.valueOf(a),String.valueOf(b)});
     if (mcursor != null)
       {
      mcursor.moveToFirst();
       Log.e("","");
       }
     return mcursor;
    }

    //---updates a title---
    public boolean updateTitle(long rowId, String latcol,
    String loncol, String locnamecol,String protypecol)
    {
    ContentValues args = new ContentValues();
    args.put(KEY_LAT, latcol);
    args.put(KEY_LON, loncol);
    args.put(KEY_LOCNAME,locnamecol);
    args.put(KEY_PROTYPE, protypecol);
    return db.update(DATABASE_TABLE, args,
    KEY_LOCNAME + "=" + rowId, null) > 0;
    }

}

AddActivity
package gps.profile.changer;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.location.LocationManager;
import android.media.AudioManager;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.Toast;

public class AddActivity extends Activity
{
      public EditText locationname;
      public EditText latit,longit;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.addlayout);

        latit = (EditText) findViewById(R.id.lat1);
        longit = (EditText) findViewById(R.id.long1);
        locationname = (EditText) findViewById(R.id.locname);
        adddata=(ImageView)findViewById(R.id.imageadd);
        spinn= (Spinner) findViewById(R.id.spinner1);

        locatname=locationname.getText().toString();
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
                R.array.profiles, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinn.setAdapter(adapter);

        spinn.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
                spinsave=spinn.getSelectedItem().toString();
                //Toast.makeText(AddActivity.this, spinsave, Toast.LENGTH_SHORT ).show();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parentView) {
                // your code here
            }
        });

    }

 }

      public void connect(View v)
      {

        latitude=latit.getText().toString();
         longitude=longit.getText().toString();
          latdou=Double.parseDouble(latitude);
          longdou=Double.parseDouble(longitude);
         locatname=locationname.getText().toString();
         int latlen=latitude.length();
         int lonlen=longitude.length();
         int namlen=locatname.length();
          if(latlen!=0&&lonlen!=0&&namlen!=0)
             {
              Toast.makeText(AddActivity.this, "added", Toast.LENGTH_SHORT ).show();
              db = new DBAdapter(this);

              insert();
              startService(new Intent(this, LocationAddActivity.class));
              Log.e("added","added");
              //  update();

             // dis("'Vibrate'");
              //  del("1");
             // disAll();
             //   getlocationpro(latlaa1,lnglaa1);

            }
          else
          {
              Toast.makeText(AddActivity.this, "fill all fields", Toast.LENGTH_SHORT ).show();
              startService(new Intent(this, LocationAddActivity.class));
          }
  }

    /*  private void update(){

            db.open();
            if (db.updateTitle(1,
                    "1",
                    "java ",
                    "ravi"))
                Toast.makeText(this, "Update successful.",
                    Toast.LENGTH_LONG).show();
            else
                Toast.makeText(this, "Update failed.",
                    Toast.LENGTH_LONG).show();
            //-------------------

            //---retrieve the same title to verify---
            Cursor c = db.getTitle(1);
            if (c.moveToFirst())
                DisplayTitle(c);
            else
                Toast.makeText(this, "No title found",
                        Toast.LENGTH_LONG).show();
            //-------------------
            db.close();

        }*/
        public void insert(){

            db.open();

          long  id = db.insertTitle(
                    latlaa1,
                    lnglaa1,
                    locatname,
                    spinsave
                    );

            db.close();

        }

    /*    private void disAll(){
             Toast.makeText(AddActivity.this, "disall", Toast.LENGTH_SHORT ).show();
             //db = new DBAdapter(this);
            db.open();

                Cursor c = db.getAllTitles();
                if (c.moveToFirst())
                {
                    do {
                        System.out.println("bool2");
                       if(latdou==c.getDouble(0)&&longdou==c.getDouble(1))
                       {
                           Toast.makeText(AddActivity.this, "Location Already Exist in the Name of:"+c.getString(2), Toast.LENGTH_LONG).show();
                          // startService(new Intent(this, LocationAddActivity.class));

                        if(locatname==c.getString(2))
                         {
                           Toast.makeText(AddActivity.this, "Location Name Already Exist:"+c.getString(2), Toast.LENGTH_LONG ).show();
                          // startService(new Intent(this, LocationAddActivity.class));
                         }

                       }
                    } while (c.moveToNext());

                }
                insert();
            db.close();
        }*/

        private void dis(String j){

            db.open();

            try{
                Cursor c = db.getTitle(j);
                if (c.moveToFirst())
                {
                    do {

                        System.out.println("bool2");
                        DisplayTitle(c);
                    } while (c.moveToNext());
                }
            }catch(Exception e){
                System.out.println(e);
            }
            db.close();
        }

      /* private void getlocationpro(Double a,Double b){

            db.open();

            try{
                Cursor c = db.getLocationProfile(a,b);
                if (c.moveToFirst())
                {
                    do {

                        System.out.println("bool2");
                        DisplayTitle(c);
                    } while (c.moveToNext());
                }
            }catch(Exception e){
                System.out.println(e);
            }
            db.close();
        }        */

        /*
         private void del(String j){

            db.open();
            if (db.deleteTitle(j))
                Toast.makeText(this, "Delete successful.",
                    Toast.LENGTH_LONG).show();
            else
                Toast.makeText(this, "Delete failed.",
                    Toast.LENGTH_LONG).show();
            db.close();

        }*/

        public void DisplayTitle(Cursor c)
        {

            Toast.makeText(this,

                    "LAITUDE: " + c.getDouble(0) + "\n" +
                    "LONGITUDE: " + c.getDouble(1) + "\n" +
                    "LOCATION NAME:  " + c.getString(2)+"\n"+
                    "PROFILE TYPE:  " + c.getString(3),
                    Toast.LENGTH_LONG).show();
        }

       private class MyReceiver extends BroadcastReceiver{

             @Override
             public void onReceive(Context arg0, Intent arg1) {

              // TODO Auto-generated method stub
                 latit = (EditText) findViewById(R.id.lat1);
                 longit = (EditText) findViewById(R.id.long1);

                 latlaa1 =arg1.getDoubleExtra("latlaa", 0);
                   lnglaa1=arg1.getDoubleExtra("lnglaa", 1);

                   latit.setText(String.valueOf(latlaa1));
                  longit.setText(String.valueOf(lnglaa1));

               get1();
               //startService(new Intent(AddActivity.this, LocationAddActivity.class));

            //LocationAddActivity laa=new LocationAddActivity();
           // laa.get(null);

          Toast.makeText(AddActivity.this, "receiver ", Toast.LENGTH_SHORT ).show();
       //   Intent intent=new Intent(AddActivity.this, LocationAddActivity.class);
       //   startService(intent);

               }

        public void get1()
            {

                db = new DBAdapter(AddActivity.this);
                db.open();

                     Cursor c = db.getLocationProfile(latlaa1,lnglaa1);
                    if (c.moveToFirst())
                    {
                        do {

                              if(c!=null)
                                {

                             // Initialize the location fields

                                if(c.getString(3).equals("Vibrate"))
                                     {

                                        Toast.makeText(getBaseContext(),"VIBRATE profile activated ",Toast.LENGTH_SHORT).show();

                                     }
                                    else if (c.getString(3).equals("Silent"))
                                     {

                                        Toast.makeText(getBaseContext(),"silent profile activated !",Toast.LENGTH_SHORT).show();

                                     }
                                    else if (c.getString(3).equals("General"))
                                     {
                                        Toast.makeText(getBaseContext(),"Loud profile activated !",Toast.LENGTH_SHORT).show();

                                     }

                                }

                        } while (c.moveToNext());
                    }
                    else
                    {

                           Toast.makeText(getBaseContext(),"else vibrate activated !",Toast.LENGTH_SHORT).show();
                         mobilemode.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
                    }

             db.close();

       }

   }

}


text:
Q: Integrate/embed java applet to openerp I need to integrate into my Openerp application a third party developed java applet to sign documents electronicaly. I tried to implement the following solution but it didn't work for me:
https://stackoverflow.com/questions/24204467/applet-java-integration-with-openerp-odoo
I have the following java applet embeded into my xml view:
<openerp>
<data>

    <record id="view_firma_form" model="ir.ui.view">
        <field name="name">firma.form</field>
        <field name="model">x_firma</field>
        <field name="priority" eval="8" />
        <field name="arch" type="xml">
            <form string="Firma" version="7.0">

                <sheet>
                    <![CDATA[
                        <html>
                            <body>

                                <object id="signApplet" width="600" height="400" archive="ini4j-0.5.2-1.0.jar, icepdf-core-4.3.2-1.0.jar, icepdf-viewer-4.3.2-1.0.jar, AgesicFirmaApplet-AgesicFirmaApplet-2.5.jar, bcprov-jdk15-1.46-1.0.jar, commons-codec-1.2-1.0.jar, bcmail-jdk15-1.46-1.0.jar,log4j-1.2.14-1.0.jar,swing-layout-1.0.3-1.0.jar,commons-io-2.1-1.0.jar,bcprov-jdk15-1.46-1.0.jar,MITyCLibAPI-1.0.4-1.0.jar,MITyCLibCert-1.0.4-1.0.jar,MITyCLibXADES-1.0.4-1.0.jar,MITyCLibTSA-1.0.4-1.0.jar,jss-4.2.5-1.2.jar,commons-logging-1.1-1.0.jar, UserAgentUtils-1.2.4-1.0.jar,itextpdf-5.2.0-1.0.jar,bctsp-jdk15-1.46-1.0.jar,xmlsec-1.4.2-ADSI-1.0-1.0.jar">
                                    <param name="type"  value="application/x-java-applet;jpi-version=1.5.0"/>
                                    <param name="java_arguments"  value="-Xmx128m"/>
                                    <param name="classloader_cache"  value="false"/>
                                    <param name="codebase"  value="http://server/appletFirmaAgesic">
                                    <param name="code"  value="uy.gub.agesic.firma.cliente.applet.SignApplet"/>
                                </object>
                            </body>
                        </html>
                    ]]>
                </sheet>

            </form>
        </field>
    </record>

When I try to execute that (it was installed with no problems), it throws the following error:
Uncaught Error: Invalid XML: <form string="Firma" version="7.0"><sheet>

Is there any way to do that or do I have to take another type of implementation.
Thanks

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I write this code to not show default on label_submit? I am programming a comments section on a WordPress theme I am developing, here is the code in comments.php:

Comments

   <?php $args = array(
        'walker'                => null,
        'max_depth'             => '',
        'style'                 => 'ul',
        'callback'              => null,
        'end-callback'          => null,
        'type'                  => 'all',
        'reply_text'            => 'Reply',
        'page'                  => '',
        'per_page'              => '',
        'avatar_size'           => 80,
        'reverse_top_level'     => null,
        'reverse_children'      => '',
        'format'                => 'html5', // or 'xhtml' if no 'HTML5' theme support
        'short_ping'            => false, // @since 3.6
        'echo'                  => true // boolean, default is true
     );
   ?>

   <?php wp_list_comments($args, $comments); ?>

   <?php
        $form_args = array(
                'label_submit'          => 'Send',
                'title_reply'           => 'Write a Reply or Comment',
                'comment_notes_after'   => '',
                'comment_field'         => '
'._x('Comment','noun').'
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',
        );

        comment_form($forms_args);
   ?>

Do you see how under the $form_args array 'label_submit' => 'Send'. However, it is still rendering the default which is 'Post Comment' on the browser. I have tried different ways, but I cannot seem to get my 'Send' to override the 'Post Comment'.

A: I researched the WordPress Codex some more and analyzed the code I posted here and if you look at the top where it says $form_args, but then in comment_form($forms_args):
<?php
        $form_args = array(
                'label_submit'          => 'Send',
                'title_reply'           => 'Write a Reply or Comment',
                'comment_notes_after'   => '',
                'comment_field'         => '
'._x('Comment','noun').'
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',
        );

        comment_form($forms_args);
   ?>

So I just needed to remove the s from what I passed into comment_form:
<?php
        $form_args = array(
                'label_submit'          => 'Send',
                'title_reply'           => 'Write a Reply or Comment',
                'comment_notes_after'   => '',
                'comment_field'         => '
'._x('Comment','noun').'
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',
        );

        comment_form($form_args);


text:
Q: Where to define callback functions so that the calling object is still in scope? I want my ESP8266-based device to create an accesspoint that allows the user to input their home ssid and password. There is a device object that holds most of the data defined elsewhere.
I'm trying to use the ESP8266WebServer library. It requires me to define parameterless callback functions. Where should I declare and define these callback functions so that they can access the server object? In all the example code, the server object is global. I'd want to avoid that, and I'd also like to avoid having a server object as a permanent Device class member.
How should I go about this? It is not allowed to define the callback functions inside Device::getWifiCredentials, and if I declare them outside then server isn't in scope.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

// Function to create AccessPoint to get ssid and password
int Device::getWifiCredentials() {

    ESP8266WebServer server(80);
    server.begin();

    // define callbacks
    server.on("/", handleRoot); // initial page

    server.on("/ssid", handleCredentials); // catch response from initial page

    // wait for credentials to be delivered
    server.handleClient();

    while( WiFi.status() != WL_CONNECTED){
        Serial.print(".");
        delay(500);
    }

    return ACTION_SUCCESSFUL;

}

// **Where can these functions be defined to allow them to access the server object?**

void handleRoot() {
};

void handleCredentials() {

    String ssid;
    String pw;

    if( server.hasArg() ){
        ssid = server.arg("ssid");
        pw = server.arg("pw");
    }
};


text:
Q: Jump to the next line that has a statement after an if() A previous dev liked to put single statements on the same lines as their relevant if()s. I'm trying to find these lines now to fix them! I thought that the following regex would find them, but it isn't:
/\^\s*if\.*;\$

/    Start search
\^   Beginning of line
\s*  Any amount of whitespace
if   Beginning of the if() statement
\.*  Any amount of characters
;    The end of the single statement
\$   End of the line

So, where did I go wrong?

A: The backslashed caret \^ matches a literal caret ^ not the start of a line
Generally characters with special meanings are called metacharacters, escaped metacharacters usually match the literal character and lose any special meaning.
Though beware of other contexts, in Perl regex ( is a capturing parenthesis metacharacter but in awk that role is given to \(


text:
Q: What does orthogonal mean in matrix theory? I know orthogonal involves right angles. However, in matrix theory,the concept still  doesn't make sense to me. I was given a definition  that vectors $x_1,...,x_k$
which belong to $\mathbb{C}^n$ form an orthogonal set if $x_i^* x_j=0$ for all pairs, $1\leq i<j\leq k$.

A: As it turns out: in $\Bbb C^n$, defining the orthogonality of vectors in terms of the angle between them is not exactly the "correct" thing to do.
To start, let's talk about the situation in $\Bbb R^n$. Note that the way we measure angles between two vectors $x,y \in \Bbb R^n$ is by looking at the dot-product $x^Ty$.  More specifically, we can say that
$$
x^Ty = \|x\| \cdot \|y\| \cdot \cos \theta.
$$
If $x$ and $y$ are non-zero, then they will be perpendicular (i.e. orthogonal) iff (if and only if) $\theta = 90^\circ$, which happens iff $\cos \theta = 0$, which happens iff $x^Ty = 0$.
With that in mind, it is convenient to say that in $\Bbb R^n$, two vectors are defined to be orthogonal when their dot-product $x^Ty = 0$. The natural generalization of this definition is to say that two vectors in $\Bbb C^n$ are orthogonal if and only if their "dot-product" $x^*y$ is equal to zero.
Interestingly, it is no longer the case in $\Bbb C^n$ that non-zero vectors are orthogonal iff the angle between them is $90^\circ$.

A: This is really just the "nicest" way to extend the definition of orthogonal in real spaces to complex spaces. Note that in real vector spaces, $x\cdot y=\vert x\vert\vert y\vert \cos(\theta)$ where $\theta$ is the angle between the vectors $x$ and $y$. So as you say, if the angle between them is a right angle, then $\cos(\theta)=0$, so $x\cdot y=0$, and the vectors are orthogonal. Now also clearly for real vectors in a complex vector space, when we complex-conjugated the first vector, it doesn't change it, and so the same angle based orthogonality definition holds. But we can now also tell if a pair of complex vectors are "orthogonal", where it isn't so intuitively clear what orthogonal should mean (what is the angle between a pair of complex vectors?).
There are good reasons for conjugating the first argument, but I think the most intuitive one is that it means that the inner product of a vector with itself is always the square of its magnitude (because we know intuitively what the magnitude of a complex vector should be), so this property gets carried over from the dot product in real vector spaces.


text:
Q: How can I check if text content on page changed? I want to check if the text content in the var cart changes its on this page: https://www.supremenewyork.com/shop/all
let cart = document.getElementById('items-count').textContent;

console.log(cart);
cart.addEventListener('change', function() {
 console.log("cart");
 window.location.replace("http://stackoverflow.com");
});

I get this error

Uncaught TypeError: cart.addEventListener is not a function
at chrome-extension://ljhadajgdcijdfoopfbkjibfebkilieh/supreme.js:11:6

The script starts when I enter the page.
I already tried to Monitor it with a while loop like in the following code but then the website freezes and I cant use it anymore until the var change
let carted = 0
let cart = document.getElementById('items-count').textContent;
while (carted < 1 ) {
console.log(cart);
if (cart.length > 2) {
    cart ++;
    window.location.replace("http://stackoverflow.com");
    }
}

A: Because you are trying to add an event listener to your element's textContent, not to your element, and you can't do that. Just do this
let cart = document.getElementById('items-count');

console.log(cart);
cart.addEventListener('change', function() {
 console.log(`cart content has changed — ${cart.textContent}`);
 window.location.replace("http://stackoverflow.com");
});

A: If you want to add a listener, you can't do it to textContent.
let cart = document.getElementById('items-count'); //.textContent

console.log(cart);
cart.addEventListener('change', function() {
 console.log("cart");
 window.location.replace("http://stackoverflow.com");
});

If you need that value, you can store it on another variable:
var content = cart.textContent

A: You could
var item = document.getElementById('items-count');
item.addEventListener("change", DoStuff);
function DoStuff(){
//do what do you want to do.
}


text:
Q: cocoa: know the position of the app icon in the dock I need to show a special menu when the dock icon is hovered. In order to do this I need to find a way to get the coordinate of the app icon in the dock.
Do you know how I can get this info?
Thanks and regards,

A: Expanding the answer of Mike Abdullah: have a start with http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103
Greetings

A: There is no public API for this. File a request asking for it. In the meantime don't attempt it. Look at a custom dock item menu instead.


text:
Q: Data.MemoCombinators; unexpected running time import qualified Data.MemoCombinators as Memo
import System.Environment

single = fib' 80000
  where fib' = Memo.integral fib''
        fib'' 0 = 0
        fib'' 1 = 1
        fib'' x = fib' (x-1) + fib' (x-2)

doubleFast = fib' 80000 + fib' 80000
  where fib' = Memo.integral fib''
        fib'' 0 = 0
        fib'' 1 = 1
        fib'' x = fib' (x-1) + fib' (x-2)

doubleSlow = g 80000 + g 80000
  where g x = fib' x
          where fib' = Memo.integral fib''
                fib'' 0 = 0
                fib'' 1 = 1
                fib'' x = fib' (x-1) + fib' (x-2)

main = do
  args <- getArgs
  case args of
    ["single"]     -> print single
    ["doubleFast"] -> print doubleFast
    ["doubleSlow"] -> print doubleSlow

./file single +RTS -s

yields
1,085,072,320 bytes allocated in the heap
387,297,448 bytes copied during GC
265,811,512 bytes maximum residency (10 sample(s))
99,107,440 bytes maximum slop
433 MB total memory in use (0 MB lost due to fragmentation)

Total   time    2.78s  (  2.78s elapsed)

./file doubleFast +RTS -s

yields the same result. This makes sense to me: Since fib' is in the scope of doubleFast, fib' is not discarded after calculating the first fib' 80000 and can be used to directly give the second fib' 80000.
What I do not understand is the following:

./file doubleSlow +RTS -s

2,166,532,752 bytes allocated in the heap
551,826,896 bytes copied during GC
263,793,848 bytes maximum residency (11 sample(s))
204,460,968 bytes maximum slop
818 MB total memory in use (0 MB lost due to fragmentation)

Total   time   14.22s  ( 14.24s elapsed)

Please correct me if I am wrong: fib' is used to calculate the first g 80000 = fib' 80000. The function g is left, and because g is not memorized, it cannot be reused to calculate the second g 80000 directly. Furthermore, after leaving the first call of g 80000 the lookup table of  fib' is discarded because it is not in the scope of doubleSlow.
800 MB make sense to me, because the look up table has to be build twice. However, why does it take 14.22s compared to 2.78s? I expected roughly twice as much, approx. 5.8s.

A: When compiling with optimisations, I get nearly identical figures for all three ways - fib' and fib'' are then hoisted to the top-level also for doubleSlow, as they are for the two others even without optimisation, so the difference is just a lookup, an addition of two large numbers, and the result of that addition for the doubleX vs. single.
When compiling without optimisations, doubleSlow takes about 4.5 times as long, and allocates roughly twice as much as the two others. The bulk of the difference is due to longer GC,
MUT     time    1.64s  (  1.64s elapsed)
GC      time    7.09s  (  7.10s elapsed)

MUT     time    0.75s  (  0.75s elapsed)
GC      time    1.07s  (  1.07s elapsed)

and the computation time (MUT) is about twice as long, which fits the fact that the lookup data structure is built twice (your reasoning is more or less correct, the lookup table is local to g, then, and g 80000 is called twice).
I'm not familiar enough with GHC's garbage collector to explain why collecting the first lookup table takes that long with the default settings, but the time it takes is very dependent on the size of the allocation area, I got the best results setting it to 3MB,
$ ./memfib +RTS -s -A3M -RTS doubleSlow > /dev/null
   2,166,534,656 bytes allocated in the heap
     599,670,152 bytes copied during GC
     161,411,104 bytes maximum residency (13 sample(s))
      99,163,664 bytes maximum slop
             414 MB total memory in use (0 MB lost due to fragmentation)

                                    Tot time (elapsed)  Avg pause  Max pause
  Gen  0       562 colls,     0 par    0.49s    0.49s     0.0009s    0.0041s
  Gen  1        13 colls,     0 par    0.62s    0.62s     0.0477s    0.0841s

  INIT    time    0.00s  (  0.00s elapsed)
  MUT     time    1.61s  (  1.62s elapsed)
  GC      time    1.11s  (  1.11s elapsed)
  EXIT    time    0.03s  (  0.03s elapsed)
  Total   time    2.76s  (  2.76s elapsed)

  %GC     time      40.2%  (40.2% elapsed)

  Alloc rate    1,343,022,682 bytes per MUT second

  Productivity  59.8% of total user, 59.7% of total elapsed

compared to
$ ./memfib +RTS -s -A3M -RTS doubleFast > /dev/null
   1,085,085,832 bytes allocated in the heap
     311,633,528 bytes copied during GC
     165,830,256 bytes maximum residency (9 sample(s))
      99,121,736 bytes maximum slop
             389 MB total memory in use (0 MB lost due to fragmentation)

                                    Tot time (elapsed)  Avg pause  Max pause
  Gen  0       280 colls,     0 par    0.22s    0.22s     0.0008s    0.0042s
  Gen  1         9 colls,     0 par    0.34s    0.34s     0.0376s    0.0792s

  INIT    time    0.00s  (  0.00s elapsed)
  MUT     time    0.79s  (  0.79s elapsed)
  GC      time    0.55s  (  0.56s elapsed)
  EXIT    time    0.03s  (  0.03s elapsed)
  Total   time    1.38s  (  1.38s elapsed)

  %GC     time      40.3%  (40.3% elapsed)

  Alloc rate    1,378,141,985 bytes per MUT second

  Productivity  59.7% of total user, 59.7% of total elapsed

it's almost exactly a factor of two.


text:
Q: How to get rid of 'new' to instantiate Ruby objects? Just for cosmetic reasons, I'd like to provide a syntax for object instantiation from some of my classes, without the keyword 'new'. I never tried that, but I know it possible : for instance Matrix gem provides a syntax like :
Matrix [ [1,2], [3,4] ]

How could I do the same ?

A: Just define a method with the same name (that of a class) that will invoke .new.
class User
  def initialize(name)
    @name = name
  end

  attr_reader :name
end

def User(name)
  User.new(name)
end

u = User("Sergio")
u.name # => "Sergio"

NOTE: I personally don't like this technique. Leads to harder to understand code. The "just looks better" reason does not excuse you to use this.
Actually, it's a pattern in ruby, called "conversion method". If you look closer, all of the upper-case methods in ruby stdlib are converting values from one form to another. Unless you're writing a conversion method, don't do this.

*

*Kernel#Array

*Kernel#Hash

*and so on...

A: You can overload self.[]:
class Foo
    attr_accessor :bar

    def initialize(bar)
        self.bar=bar
    end

    def self.[](*args)
        return Foo.new(*args)
    end
end

puts Foo[1].bar

A:
Just for cosmetic reasons, I'd like to provide a syntax for object instantiation from some of my classes, without the keyword 'new'.

new isn't a keyword. It's a method just like any other method. And you don't have to call it new, you can call it anything you like. For example, you can call it call:
class Foo
  def initialize(val)
    puts "Initialized with #{val}!"
  end

  class << self; alias_method :call, :new end
end

foo = Foo.(42)
# Initialized with 42!

In Ruby, implementing call is equivalent to saying "this is a function". Anything which implements call is basically a function or can be treated as one. And if you think of Classes as factory functions for objects, then it even makes sense to do this.
If you think of Classes as functions, then you should also implement to_proc so that you can use them in place of blocks:
class << Foo
  def to_proc
    -> var { new(var) }
  end
end

[23, 42].map(&Foo)
# Initialized with 23!
# Initialized with 42!
# => [#<Foo:0xdeadbeef081523>, #<Foo:0xdeadbeef081542>]

In fact, you could do it globally:
class Class
  alias_method :call, :new

  def to_proc
    -> (*args, &block) { new(*args, &block) }
  end
end

Or you can call your factory method []:
class << Foo; alias_method :[], :new end

foo = Foo[42]
# Initialized with 42!

In fact, this latter one is common practice for anything collection-like: Array and Hash from the core library, Set, SortedSet and Matrix from the standard library have such factory methods.
Another possibility is to define a method on Kernel with the same name as your class:
module Kernel
  private

  def Foo(obj)
    Foo.new(obj)
  end
end

Foo(42)
# Initialized with 42!

Note, however, that this pattern is usually reserved for conversion methods that convert an object to an object of a different class unless that object is already of that class (see Kernel#Array, Kernel#Integer etc. for examples).
So, you would rather implement it like this (if at all):
module Kernel
  private

  def Foo(obj)
    return obj if obj.is_a?(Foo)

    begin
      return obj.to_foo
    rescue NoMethodError => e
      return Foo.new(obj) if e.name == 'to_foo'
      raise
    end
  end
end

Foo(42)
# Initialized with 42!


text:
Q: How to remove the first 3 latter in string of column in SQL I have a column with below data and I need to remove latter till'_' and rest part will be saved as another column in sql. Please provide the solution on below requirement
BCA_Article_Europ_corona,
MCCD_Article_Key World,
WSGJ_Article_Yourchoice on pages,
MOL_Article_Rex Newark,
MWBA_Article_Key World,

Result should be
Article_Europ_corona,
Article_Key World,
Article_Yourchoice on pages,
Article_Rex Newark,
Article_Key World,

Thanks
Ng

A: I don't know about Spark SQL, but documentation is quite easy to understand. You can get additional info at this url where examples of the different functions available can be found.
https://spark.apache.org/docs/2.3.0/api/sql/index.html#substr
I suppose somethins like this SQL should work.
Example with direct string
SELECT substring('BCA_Article_Europ_corona', instr('BCA_Article_Europ_corona','-')+1)

Example with column
SELECT substring(yourcolumnhere, instr(yourcolumnhere,'-')+1) from yourtablehere

Example with both fields
SELECT substring(yourcolumnhere, 1, instr(yourcolumnhere,'-')-1) as PREFIX,
substring(yourcolumnhere, instr(yourcolumnhere,'-')+1) as WITHOUT_PREFIX
from yourtablehere

Hope it helps!


text:
Q: Is it possible to automate sewer service line creation? I am a GIS Tech working for a utility company, part of the asset maintenance program entails running a camera down gravity mains (sewer pipes) from the upstream manhole to the downstream manhole.
Every time the camera finds a sewer lateral (service line) it records its distance and the angle it leaves the gravity main.
I have been able to use ArcMap to plot the distances as points by converting the gravity mains to a route layer and using the create route events too on the original excel file given to me which contains the distances for each service line.
Now here is my main question - most of our gravity mains currently do not have the sewer laterals (service lines) digitized yet. With the location of the sewer lateral (point file) i also have the direction it leaves the gravity main.
Is it possible some how in arcpy to automate the creation of the sewer laterals, for example, just make all the sewer lines 20 ft and set a predetermined direction (the original points have an angle measurement for the sewer lateral direction leaving the gravity main).
Could anyone give me any direction on how I might go about automating the creation of the sewer laterals


text:
Q: Codeigniter 404 error not found assets folder I have problem with my codeiginiter project.
I use xamp and I have my project folder in htdocs.
To see my project i must type http://localhost/myproject/
I want to add some assets to project and I crete folder to do that.
- htdocs
-- myproject
---- application
-----controllers
-----models
----- views
----- assets // folder with js, css ect
---- system
---- index.php
----  .htaccess

Now when I want to load script in specyfic view, like this
 <script src="../assets/js/app.js"></script>

I got error 404 and in console
GET http://localhost/assets/app.js

As you can see CodeIgniter want to download assets from the wrong place.
My htaccess looks like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ index.php/$1 [L]

A: Wrong place to have your assets folder. Your assets folder should be in the main directory and not your application directory. As the htaccess file in application blocks css and images etc
Place your assets
application
assets
assets > css
assets > images
assets > js
index.php
.htaccess <-- Main directory htaccess file

Then autoload the url helper http://www.codeigniter.com/user_guide/helpers/url_helper.html
And then you would be able to use <?php echo base_url('assets/js/app.js');?> you don't have to autoload the url helper but it would save you time other wise you will have to load it in each controller you need it in.

A: codeigniter has some function for this purpose like : base_url() or site_url()
those function have some difference that you can see it in :
what is the difference between site_url() and base_url()?
you can use this for your script src :
<?php
echo '<script src="'.base_url('assets/js/app.js').'"></script>';
?>

A: Try this once. This is better way to access your scripts
<script src="<?php echo site_url('assets/js/app.js'); ?>"></script>


text:
Q: Determine if a certain score is possible from combining individual scores Let's say I want to achieve a certain total score S and there are individual 'pots' from which I can obtain certain individual scores, stored as lists of positive integers. I'd like to know if it is possible to obtain the desired score after at-most n_i attempts from pot i. The scores accumulate.
E.g.

*

*I'm trying to obtain exactly S=10 points

*Pot 1 is [1,2], pot 2 is [4,5,6]

*If n_1=0, n_2=1 then it wouldn't be possible

*If n_1=1, n_2=1 then it wouldn't be possible

*If n_1=0, n_2=2 then it would be possible (6 + 4)

*If n_1=2, n_2=1 then it would be possible (6 + 2 + 2)

I'm trying to write a code in python to figure this out.
I think I'd start by finding all combinations of obtaining the score S with length less-than-or-equal-to the sum of the n_is; e.g. for S=10, n_1=1, n_2=1 I'd find [(10), (9,1), (8,2), (7,3), (6,4), (5,5)] (I'm unsure currently whether I'd need (4,6) etc as well), and iterate over them. So, Question 1: how can I easily obtain this data? Perhaps with something from itertools?
Then, if there wasn't a limit on how many times you could try each pot, I'd simply check if each element of the combination is in any of the pots; if so then it's possible and break the loop, if not then move on to the next combination; if you try every combination and none work then it's not possible.
The complication arises from limiting the number of attempts per pot; Question 2: how might I modify the above approach to account for this?
And, finally Question 3: is there a different approach I can take to solve this?

A: Regarding question 1, yes, you should have a look at itertools.product().
This allows you to combine your two lists exactly as you want.
This function also comes with a repeat parameter, which allows you to solve question 2 if I understand it correctly.
Finally, the docs give an alternative version not using itertools to generate cartesian products, so they solve question 3 for you.


text:
Q: Sqlalchemy + mysql, incremental key reuse i have an api-key that i need to assign to users, they need to be unique per user, but may be reused starting as 0 [0,1,2,3,4,5...] but they have a limit, and it's feature-specific (not all users need them unless requested).
for now I've been adding 1 to the highest number as user request keys:
[ 0, 1, null, 3, 6, 7, null, 10, 11, 12, null, null...]
but this is incrementally getting to the limit, and i need to reuse them: [ 2, 4, 5, 8, 9...]
how can i get the lowest unused value in sqlalchemy to always reuse the keys?

A: I'm not entirely sure of the SQLAlchemy syntax on this one, but sql-wise I think you might want to do something like as suggested in this answer. Quoted:
SELECT MIN(t1.ID + 1) AS nextID
FROM tablename t1 LEFT JOIN tablename t2
ON t1.ID + 1 = t2.ID
WHERE t2.ID IS NULL

If you're having trouble finding the proper SQLAlchemy way, you can always use the with_statement or execute methods on the session object (lets you freely define the SQL statement). In general, consult this page for information on how you might go about building this.


text:
Q: Android scene transition issue I am trying to change one scene to another scene using transition framework.
MainActivity.java
mSceneRoot = (ViewGroup) findViewById(R.id.root_scene);
        calendarScene = Scene.getSceneForLayout(mSceneRoot, R.layout.content_main_scene1,this);
        searchScene = Scene.getSceneForLayout(mSceneRoot, R.layout.content_main_scene2,this);

searchTextView = (TextView) findViewById(R.id.searchTextEdit);
        searchTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    TransitionManager.go(searchScene);
                } else
                {
                    TransitionManager.go(calendarScene);
                }
            }
        });

content_root.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_main" tools:context=".MainActivity">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/root_scene">
        <include layout="@layout/content_main_scene1"/>
    </FrameLayout>
</RelativeLayout>

content_main_scene2 has additional listView.
Finally I got the exception:
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/InputEventReceiver: Exception dispatching input event.
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI: java.lang.NullPointerException
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2413)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2373)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.rootViewRequestFocus(View.java:4746)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4042)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.removeAllViews(ViewGroup.java:3971)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.Scene.enter(Scene.java:163)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.TransitionManager.changeScene(TransitionManager.java:193)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.transition.TransitionManager.go(TransitionManager.java:342)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.freelance.wwtlf.info.MainActivity$2.onFocusChange(MainActivity.java:71)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.onFocusChanged(View.java:4836)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.widget.TextView.onFocusChanged(TextView.java:7641)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.handleFocusGainInternal(View.java:4617)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocusNoSearch(View.java:6999)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6978)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.onTouchEvent(View.java:8653)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.widget.TextView.onTouchEvent(TextView.java:7693)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.View.dispatchTouchEvent(View.java:7706)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.app.Activity.dispatchTouchEvent(Activity.java:2458)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:     at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/MessageQueue-JNI:   at
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info D/AndroidRuntime: Shutting down VM
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4d17b20)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: FATAL EXCEPTION: main
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: Process: com.freelance.wwtlf.info, PID: 5937
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime: java.lang.NullPointerException
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2413)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2370)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2414)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.requestFocus(ViewGroup.java:2373)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.requestFocus(View.java:6945)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.requestFocus(View.java:6924)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.View.rootViewRequestFocus(View.java:4746)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:4042)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.view.ViewGroup.removeAllViews(ViewGroup.java:3971)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.Scene.enter(Scene.java:163)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.TransitionManager.changeScene(TransitionManager.java:193)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at android.transition.TransitionManager.go(TransitionManager.java:342)
11-06 03:14:13.848 5937-5937/com.freelance.wwtlf.info E/AndroidRuntime:     at com.freelance.wwtlf.info.MainActivity$2.onFocusChange(MainActivity.java:71)

...
What object is pointing to null?
Update:
When I have changed OnFocusChangeListener to onClickListener everything worked fine. But I still don't understand why...


text:
Q: Main field name (document=True) Django Haystack docs say:
**Warning**
When you choose a document=True field, it should be consistently named across all of your SearchIndex classes to avoid confusing the backend. The convention is to name this field text.

There is nothing special about the text field name used in all of the examples. It could be anything; you could call it pink_polka_dot and it won't matter. It's simply a convention to call it text.

But I don't get what it means. This is their example model:
import datetime
from haystack import indexes
from myapp.models import Note
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    author = indexes.CharField(model_attr='user')
    pub_date = indexes.DateTimeField(model_attr='pub_date')

    def get_model(self):
        return Note

    def index_queryset(self, using=None):
        """Used when the entire index for model is updated."""
        return self.get_model().objects.filter(pub_date__lte=datetime.datetime.now())

Is the text I quoted referring to MY model main field and saying I should call it "text" or to the class defined in search_indexes.py?
If to the class in search_indexes.py, where is the field name it's attached to in the example above? It doesn't have model_attr!
text = indexes.CharField(document=True, use_template=True)

And if to my actual app models, how I am expected to refactor a project with many many apps to call their main text field "text"!
Please advise. Thanks.

A: Your SearchIndex definition does not need to reflect your model definition, it needs to map data from different models to a common search document.

*

*Why does the text field need to be named consistently?

*How is map content sourced? (Why is there no model_attr keyword)

The Haystack documentation is advising that your SearchIndex field should be named consistently across your SearchIndex definitions - not that your model fields need to be named consistently. There's a major distinction between the search index definitions and model definitions. You do not need to and probably should not worry about a 1-1 mapping between model fields and search fields.
Step back from your models and think first about what you want to search. Will you be searching several different models through a common search view? Let's say your have two models:
class Note(models.Model):
    title = models.CharField(max_length=40)
    body = models.TextField()

class Memo(models.Model):
    subject = models.CharField(max_length=50)
    content = models.TextField()
    author = models.ForeignKey(StaffMember)

We want to create a simple search view that searches only the primary content of the model as well as the title or name of the content object (name, title, subject, etc.).
Here's a bad example (do NOT do this):
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
    body = indexes.CharField(document=True, use_template=True)
    title = indexes.CharField(model_attr='title')

    def get_model(self):
        return Note

class MemoIndex(indexes.SearchIndex, indexes.Indexable):
    content = indexes.CharField(document=True, use_template=True)
    subject = indexes.CharField(model_attr='subject')

    def get_model(self):
        return Memo

In this bad example, each search index does define a primary content field and a content name field (title or subject). But how do you search it now? If you run a query against content based on the subject you'll miss Note content, and similarly if you query against the body.
Better example (do this):
class NoteIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    title = indexes.CharField(model_attr='title')

    def get_model(self):
        return Note

class MemoIndex(indexes.SearchIndex, indexes.Indexable):
    text = indexes.CharField(document=True, use_template=True)
    title = indexes.CharField(model_attr='subject')

    def get_model(self):
        return Memo

Note that the field names do not necessarily match the model field names. You just define which model attribute from which the SearchIndex field should source its data.
You search documents in the search engine, not rows in the database, so the SeachIndex definition maps content from the database (one table or a query over many) to a search document. The SearchIndex definition is a transformation, and each SearchField transforms data as you specify.
As to your question about the missing model_attr, that's just one way to pull in the content. You can also render textual content from a template, which is what the text field above does (see the SearchField API documentation on that one). The model_attr source works well for simple character fields.


text:
Q: How do I redirect output of echo command in bash script to script's directory? Fairly simple, I have an echo statement in my shell (bash) script that I want to redirect to an external file as a means of logging. The script is run by the root user's crontab every hour (via sudo crontab -e).
I want this log file to reside in the same directory as the script.
My first attempt was,
echo "$(date) | blah blah" >> "$(pwd)/script.log"

However, this clearly does not work as the working directory of the root crontab (/root/) is not the same as the directory of the script. So following some advice on SO I did instead,
script_dir=$(dirname $0)
echo "$(date) | blah blah" >> "$(script_dir)/script.log"

This time, for reasons I do not yet understand, the log file is saved under /, as in /script.log.
Logically one would assume that the variable script_dir was evaluated to an empty string and so "$(script_dir)/script.log" was evaluated as "/script.log".
But as a test, I wrote a simple test script,
echo "$(dirname $0)"

and ran it from /. Sure enough, I get a proper non-empty output: /home/pi/scripts/testscripts/dirname.sh (where the test script I wrote resides).
So what's the deal, and how do I get this to work?

p.s. bash --version says I am currently running GNU bash, version 4.3.30(1)-release

A: You need the curly braces within double-quotes to expand variables in bash, something like,
echo "$(date) | blah blah" >> "${script_dir}/script.log"

Shell Parameter Expansion
The '$' character introduces parameter expansion, command substitution, or arithmetic expansion.
The basic form of parameter expansion is ${parameter}. The value of parameter is substituted. The braces are required when parameter is a positional parameter with more than one digit, or when parameter is followed by a character that is not to be interpreted as part of its name.

More on Parameter expansion
${PARAMETER}

The easiest form is to just use a parameter's name within braces. This is identical to using $FOO like you see it everywhere, but has the advantage that it can be immediately followed by characters that would be interpreted as part of the parameter name otherwise. Compare these two expressions (WORD="car" for example), where we want to print a word with a trailing "s":
echo "The plural of $WORD is most likely $WORDs"
echo "The plural of $WORD is most likely ${WORD}s"

Why does the first one fail? It prints nothing, because a parameter (variable) named "WORDs" is undefined and thus printed as "" (nothing). Without using braces for parameter expansion, Bash will interpret the sequence of all valid characters from the introducing "$" up to the last valid character as name of the parameter. When using braces you just force Bash to only interpret the name inside your braces.

A: This line has an error :
echo "$(date) | blah blah" >> "$(script_dir)/script.log"

It should be :
echo "$(date) | blah blah" >> "$script_dir/script.log"

The "$(script_dir)" syntax tries to execute a command named script_dir and capture its output to use as a value inside the string.  What you need is a simple variable expansion, $script_dir, which simply extracts the value of a variable named script_dir.


text:
Q: ArcPad 10 dependent fields Am trying to create an ArcPAD project when one entry with a specific value e.g.. Lamp post creates a mandatory field entry for material of the lamp post.

A: this link has the answer to what I was looking for:
http://help.arcgis.com/en/arcpad/10.0/help/index.html#/Steps_to_explore_your_data/00s1000000vr000000/


text:
Q: div problem why is line break inserted? I want to display one image which is 300px by 300px and then i want to display some text. Unfortunately the text i want to display begins on the next line after image. This is the bare code :-

some text which is too long probably a big paragraph

How can display everything in smooth flow layout?
Thanks in advance :)

A:

     text

Just float the image.
div { overflow:auto; }
img { float:left; }

A: I think the float suggestion is correct but apply to the div in this case ie


text:
Q: Kurento Media Server automatically creates an extra account "kurento" on installation On installing kurento-media-server-6.0, it automatically created an extra account "kurento" and the password is still unknown. Although it does not have sudo access, but still an unwanted user account is a security concern.
On deleting user account, kurento-media-server does not function properly and has to be reinstalled. What is the significance of that account or why this account is being created?

OS: Ubuntu 16.04.3 LTS 64-bit

A: That is how almost all "service" applications work on Ubuntu, and is actually a security feature. Installation of an application creates a user that is used only by that application and can have its privileges limited to only what that application needs.
For example, Apache uses www-data, Nginx uses nginx (or www-data if you install from certain sources), PostgreSQL uses postgres, MySQL uses mysql, Postfix mail server uses postfix, etc.
There's no reason for this to be a security concern. The password isn't "unknown" as you say, there is actually an invalid password -- meaning that it is impossible to log in to this account unless you give it SSH keys or use sudo -u (which only administrators can do anyway).
Just leave the account the way it is.


text:
Q: Does iOS 5 support blur CoreImage fiters? According to the documentation it should support blurring, note the "Available in iOS 5.0 and later":
CIFilter Class Reference
But according to the device, it doesn't:
[CIFilter filterNamesInCategory:kCICategoryBlur];

returns nothing.
According to the following only these filters are available on my iPhone and Simulator (which are both running 5.0):
[CIFilter filterNamesInCategory:kCICategoryBuiltIn]

CIAdditionCompositing,
CIAffineTransform,
CICheckerboardGenerator,
CIColorBlendMode,
CIColorBurnBlendMode,
CIColorControls,
CIColorCube,
CIColorDodgeBlendMode,
CIColorInvert,
CIColorMatrix,
CIColorMonochrome,
CIConstantColorGenerator,
CICrop,
CIDarkenBlendMode,
CIDifferenceBlendMode,
CIExclusionBlendMode,
CIExposureAdjust,
CIFalseColor,
CIGammaAdjust,
CIGaussianGradient,
CIHardLightBlendMode,
CIHighlightShadowAdjust,
CIHueAdjust,
CIHueBlendMode,
CILightenBlendMode,
CILinearGradient,
CILuminosityBlendMode,
CIMaximumCompositing,
CIMinimumCompositing,
CIMultiplyBlendMode,
CIMultiplyCompositing,
CIOverlayBlendMode,
CIRadialGradient,
CISaturationBlendMode,
CIScreenBlendMode,
CISepiaTone,
CISoftLightBlendMode,
CISourceAtopCompositing,
CISourceInCompositing,
CISourceOutCompositing,
CISourceOverCompositing,
CIStraightenFilter,
CIStripesGenerator,
CITemperatureAndTint,
CIToneCurve,
CIVibrance,
CIVignette,
CIWhitePointAdjust

A: Unfortunately, it does not support any blurs. For that, you'll have to roll your own.

A: UPDATE: As of iOS 6 [CIFilter filterNamesInCategory:kCICategoryBlur]; returns CIGaussianBlur meaning that this filter is available on the device. Even though this is true, you (probably) will get better performance and more flexibility using GPUImage.

A: While Core Image on iOS 5.0 lacks blur filters, there is still a way to get GPU-accelerated blurs of images and video. My open source GPUImage framework has multiple blur types, including Gaussian (using the GPUImageGaussianBlurFilter for a general Gaussian or the GPUImageFastBlurFilter for a hardware-optimized 9-hit Gaussian), box (using a GPUImageBoxBlurFilter), median (using a GPUImageMedianFilter), and a bilateral blur (using a GPUImageBilateralBlurFilter).
I describe the shaders used to pull off the hardware-optimized Gaussian blur in this answer, and you can examine the code I use for the rest within the framework. These filters run tens of times faster than any CPU-bound routine I've tried yet.
I've also incorporated these blurs into multi-stage processing effects, like unsharp masking, tilt-shift filtering, Canny edge detection, and Harris corner detection, all of which are available as filters within this framework.

A: Again, in an attempt to save all iOS blur isses, here is my contribution:
https://github.com/tomsoft1/StackBluriOS
A simple blur library based on Stack Blur. Stack Blur is very similar to Gaussian Blur, but much faster (see http://incubator.quasimondo.com/processing/fast_blur_deluxe.php )
use it like this:
UIImage *newIma=[sourceIma stackBlur:radius]

Hope this help

A: I too was disappointed to find that Core Image in iOS doesn't support blurs.  Here's the function I wrote to do a 9-tap Gaussian blur on a UIImage.  Call it repeatedly to get stronger blurs.
@interface UIImage (ImageBlur)
- (UIImage *)imageWithGaussianBlur9;
@end

@implementation UIImage (ImageBlur)
- (UIImage *)imageWithGaussianBlur9 {
    float weight[5] = {0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162};
    // Blur horizontally
    UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
    [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[0]];
    for (int x = 1; x < 5; ++x) {
        [self drawInRect:CGRectMake(x, 0, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[x]];
        [self drawInRect:CGRectMake(-x, 0, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[x]];
    }
    UIImage *horizBlurredImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    // Blur vertically
    UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
    [horizBlurredImage drawInRect:CGRectMake(0, 0, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[0]];
    for (int y = 1; y < 5; ++y) {
        [horizBlurredImage drawInRect:CGRectMake(0, y, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[y]];
        [horizBlurredImage drawInRect:CGRectMake(0, -y, self.size.width, self.size.height) blendMode:kCGBlendModePlusLighter alpha:weight[y]];
    }
    UIImage *blurredImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    //
    return blurredImage;
}

Just call it on an existing image like this:
UIImage *blurredImage = [originalImage imageWithGaussianBlur9];

and repeat it to get stronger blurring, like this:
blurredImage = [blurredImage imageWithGaussianBlur9];

A: Here is the link to our tutorial on making blur effect in iOS application with different approaches. http://blog.denivip.ru/index.php/2013/01/blur-effect-in-ios-applications/?lang=en

A: If you can use OpenGL ES in your iOS app, this is how you calculate the median in a pixel neighborhood radius of your choosing (the median being a type of blur, of course):
kernel vec4 medianUnsharpKernel(sampler u) {
vec4 pixel = unpremultiply(sample(u, samplerCoord(u)));
vec2 xy = destCoord();
int radius = 3;
int bounds = (radius - 1) / 2;
vec4 sum  = vec4(0.0);
for (int i = (0 - bounds); i <= bounds; i++)
{
    for (int j = (0 - bounds); j <= bounds; j++ )
    {
        sum += unpremultiply(sample(u, samplerTransform(u, vec2(xy + vec2(i, j)))));
    }
}
vec4 mean = vec4(sum / vec4(pow(float(radius), 2.0)));
float mean_avg = float(mean);
float comp_avg = 0.0;
vec4 comp  = vec4(0.0);
vec4 median  = mean;
for (int i = (0 - bounds); i <= bounds; i++)
{
    for (int j = (0 - bounds); j <= bounds; j++ )
    {
        comp = unpremultiply(sample(u, samplerTransform(u, vec2(xy + vec2(i, j)))));
        comp_avg = float(comp);
        median = (comp_avg < mean_avg) ? max(median, comp) : median;
    }
}

return premultiply(vec4(vec3(abs(pixel.rgb - median.rgb)), 1.0));
}

A brief description of the steps
1. Calculate the mean of the values of the pixels surrounding the source pixel in a 3x3 neighborhood;
2. Find the maximum pixel value of all pixels in the same neighborhood that are less than the mean.
3. [OPTIONAL] Subtract the median pixel value from the source pixel value for edge detection.
If you're using the median value for edge detection, there are a couple of ways to modify the above code for better results, namely, hybrid median filtering and truncated media filtering (a substitute and a better 'mode' filtering). If you're interested, please ask.

A: Because I'm using Xamarin, I converted John Stephen's answer to C#:
    private UIImage ImageWithGaussianBlur9(UIImage image)
    {
        var weight = new nfloat[]
        {
            0.2270270270f, 0.1945945946f, 0.1216216216f, 0.0540540541f, 0.0162162162f
        };

        var width = image.Size.Width;
        var height = image.Size.Height;
        // Blur horizontally
        UIGraphics.BeginImageContextWithOptions(image.Size, false, 1f);

        image.Draw(new CGRect(0f, 0f, width, height), CGBlendMode.PlusLighter, weight[0]);

        for (int x = 1; x < 5; ++x)
        {
            image.Draw(new CGRect(x, 0, width, height), CGBlendMode.PlusLighter, weight[x]);
            image.Draw(new CGRect(-x, 0, width, height), CGBlendMode.PlusLighter, weight[x]);
        }

        var horizBlurredImage = UIGraphics.GetImageFromCurrentImageContext();
        UIGraphics.EndImageContext();

        // Blur vertically
        UIGraphics.BeginImageContextWithOptions(image.Size, false, 1f);

        horizBlurredImage.Draw(new CGRect(0, 0, width, height), CGBlendMode.PlusLighter, weight[0]);

        for (int y = 1; y < 5; ++y)
        {
            horizBlurredImage.Draw(new CGRect(0, y, width, height), CGBlendMode.PlusLighter, weight[y]);
            horizBlurredImage.Draw(new CGRect(0, -y, width, height), CGBlendMode.PlusLighter, weight[y]);
        }

        var blurredImage = UIGraphics.GetImageFromCurrentImageContext();
        UIGraphics.EndImageContext();

        return blurredImage;
    }


text:
Q: creating simulated uiTabBarController? anyone have a solution to simulate uiTabBarController, can open multiple webview interfaces and retain the current pages there... but without the tabbar.so it can be controlled with a splitview tableview menu.

A: I think your question has been answered in another SO question:
How to Create a Custom tabBarController to simulate uiTabBarController
HTH - wg


text:
Q: How to retrieve context parameters in Spring 3.1 xml context It seems like there's been a few iterations of property support in spring it's hard to tell what's best practice and the manuals are written from the point of view of someone who is familiar with every other iteration. I feel like this should be a simple and common requirement but given how hard it's been please correct me if there's a more idiomatic way.
What I want is to pass an additional properties file to my spring web app based on a context property which the client is setting using a tomcat descriptor like so
<Context path="/foo" reloadable="true">
  <Parameter name="foo.config" value="file:${catalina.base}/conf/foo.properties"/>
</Context>

In spring for the live profile I have this
<beans profile="live">
            <context:property-placeholder location="classpath:timetabling.live.properties,${timetabling.config}"
    ignore-resource-not-found="true" />
</beans>

So I'd assumed this doesn;t work because I'm trying to configure placeholder suppport with a placeholder. If I use a system property however then this works fine. I know that spring 3.1 has baked in support for system and environment properties so I guess my question is how can I augment this support with something context aware before the placeholder is resolved?
--Update--
looking at http://blog.springsource.org/2011/02/15/spring-3-1-m1-unified-property-management/ particularly at footnote 1, I would expect to have a DefaultWebEnvironment which should already have aceess to context init params. Now I am more confused, can someone provide me with a concrete example of context property retrieval? At this point I feel like I've read every javadoc available and they are just not helpful.

A: <context:property-placeholder /> sets up a PropertyPlaceholderConfigurer which reads from .properties, system properties and environment variables. A Tomcat context.xml however sets up a servlet context init parameter. So what you need is a ServletContextPropertyPlaceholderConfigurer.


text:
Q: Unable to find expand option in virtualbox I have a ubuntu installed in my virtual box which is running out of space
I am following this to solve my problem,the command given below worked fine
VBoxManage.exe modifyhd "C:\Users\ABC\VirtualBox VMs\Ubuntu.vdi" –resize 20480

In the next step they instructed to go on virtual machine settings->hard disk->utilities->expand
But i cant find the expand option in my virtual machine->settings->storage.
It shows me a virtual memory 20 GB and actual size of 7.98 GB
How can i expand thr actual size to 20 GB
Thanks in advance

A: You misunderstand the instructions that you linked to. The "virtual machine settings->hard disk->utilities->expand" section is for VMWare users. You're not using VMWare, you're using Virtualbox. You have already enlarged the virtual hard drive using the Virtualbox utility. The hard disk file isn't 20GB in size because nothing has been written to the additional space yet.
Your actual next step is to go into the guest and get the guest to use the additional space. You could try following the instructions in your article in the section "Enlarge the Virtual Machine's Partition". Here are some other pages that also describe the process:

*

*https://askubuntu.com/questions/126153/how-to-resize-partitions

*https://help.ubuntu.com/community/HowtoPartition/ResizingPartition

*http://howtoubuntu.org/how-to-resize-partitions-with-the-ubuntu-or-gparted-live-cd


text:
Q: HERE Geocoder Autocomplete API - No suggestion for an existing location I have an issue with a location I need to find with HERE API : 194 avenue de la Gare Sud de France, 34970 Lattes
I'm not able to find it.
As it's an existing, could you please advice on what I need to do to fix this issue?
I'm using the Geocoder Autocomplete API and Here is my request :
https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json
?apiKey={MYAPIKEY}
&query=194%20avenue%20de%20la%20Gare%20Sud%20de%20France%2034970%20Lattes

Unfortunately, I don't have any suggestion in response :
{
    "suggestions": []
}


text:
Q: Why do I get Page Not Found (404) when using path() instead of url()? I am working a new Django app following a YouTube tutorial, and so far in my 'urls.py' I've used this code:
urlpatterns = [
path('', views.index, name='index'),]

and it just worked. However, now I've reached a point where I'm making subdomains (localhost:8000/accounts/register) and using the following code:
urlpatterns = [
path('register', views.register, name='register'),
]

gives me the following error:

However, when instead of using path() I use url(), like so:
urlpatterns = [
url('register', views.register, name='register')]

it works as expected.
What is the difference between path() and url(), and which one should I use (in general or in any specific cases)?
Thank you for your help guys, I really appreciate it.


text:
Q: How to correctly upload Amazon S3 Images in ASP.Net Core 2 There are a few questions about this, but somehow none of them have fixed my issue. All I want to do is to display Amazon S3 images on my website.
Some info:
I'm hard-coding the direct link to the image source attribute (for test purposes), but the image never appears.
Whenever I access the direct link, i get a grey square tiny image (not the same image i tried to upload).
I have also made my bucket policy public and updated CORS. Here's their setup:
Bucket Policy
    {
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::testbucket/*"
        }
    ]
}

CORS policy
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>

How I am uploading:
  var request = new PutObjectRequest
        {
            BucketName = "testbucket",
            Key = "test",
            InputStream = new MemoryStream(image.Content),
            ContentType = image.MimeType // "image/png"
        };

  var response = await Client.PutObjectAsync(request);

I believe the uploading is wrong, but i haven't found any ASP.NET Core tutorials on how to successfully upload a byte[] image file. What could possibly be wrong ? Any help would be greatly appreciated.

A: I finally understand what was the issue. I was using Angular to send a base64 string to ASP.NET Core 2 and then was converting it to byte[] and sending to Amazon S3. For those who tried to upload a byte[] (from a base64) and got a small tiny squared image on amazon S3, maybe you're using the wrong part of base64 string.
Basically, you shouldn't use the first part of the string, the one with content similar to: image/png;base64. You should only convert to byte array the content after the " , ". I did not know that.
There are several tutorials on converting from base64 to byte array.


text:
Q: Get the layout of other running apps in Android? Is there a way I can get the hierchary view/layout of other running android apps? If that's not possible, could I possibly unpack the app's .apk file and get the information there? For example, there's a setting in developer options that allows you to get the bounds of every elememt on the screen like so
EDIT
I have come to realize that this is not allowed and goes completely against the Android SDK. I apologize for this error and will look more closely in the future.

A: I have found out that Google blocks any of this because it would require me to inject my own code into other apps, which is not allowed due to malicious behavior in past apps.


text:
Q: temporal autocorrelation and perfect fit in glmm I get some troubles with temporal autocorrelation and the way to implement it in glmm.
Here (https://cran.r-project.org/web/packages/glmmTMB/vignettes/covstruct.html), with an autoregressive process (AR1), they fit time series with one point by time step.
However, when I am doing that I get surprisingly high R², with simulated data and with empirical data,for example:
>library(glmmTMB)
>library(MASS)
>library(data.table)
>myfile <- "https://raw.githubusercontent.com/f-duchenne/data_for_test/master/data_for_test.txt"
>dat<- fread(myfile)
>dat$Annee=numFactor(dat$Annee)
>model <- glmmTMB(pheno_derivs2 ~ ratio+urban+ar1(Annee + 0 | species), data=dat)
>MuMIn::r.squaredGLMM(model)
            R2m R2c
[1,] 0.002107069   1
1-var(residuals(model))/var(dat$pheno_derivs2)
[1] 1
cor(dat$pheno_derivs2,predict(model))^2
[1] 1

How is it possible that the model fits perfectly the data while the fixed effect is far from overfitting ?
Is it normal that including the temporal autocorrelation process gives such R² and almost a perfect fit ? (largely due to the random part, fixed part often explains a small part of the variance in my data). Is the model still interpretable ?


text:
Q: HAProxy stops accepting connections I've been using HAProxy to loadbalance my appservers for many months without problems.  Recently some traffic spikes have lead me to setting the maxconn parameter to rate-limit connections to my backend servers.
It works great for several hours, and then it seems to stop accepting any connections.
I've looked at my system resource graphs, and both loadavg and RAM usage seem to be under control with no big spikes before the freeze.  EDIT: Loadavg does seem to spike from about 0.13 to 1.0 right before the freeze.  There are 4 cores on this system, I'm only running HAProxy as a single process -- when I view it in htop after the freeze, that CPU is pegged at 100%.
# HA-Proxy version 1.4.16 2011/08/04
global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log 127.0.0.1   local1 debug
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option forwardfor
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen  platform-cache 0.0.0.0:80
        mode http
        maxconn 10000
        option abortonclose
        #balance uri
        hash-type consistent
        balance hdr(Host)
        server varnish1 10.176.129.245 weight 20 maxconn 64 check
        server varnish2 10.176.129.29 weight 40  maxconn 64 check
        contimeout 60000

# HTTP response : 'HTTP/1.0 200 OK'
listen http_health_check 0.0.0.0:60001
        mode health
        option httpchk

listen  stats_for_scout 127.0.0.1:8081
        mode http
        stats uri /stats

listen  public_stats :8080
        mode http
        stats uri /stats
        stats realm   Haproxy\ Statistics
        stats auth    ****************

Here are the logs from one restart to the next freeze and restart a few hours laters:
Feb  5 08:57:15 localhost haproxy[31950]: Proxy platform-cache started.
Feb  5 08:57:15 localhost haproxy[31950]: Proxy http_health_check started.Feb  5 08:57:15 localhost haproxy[31950]: Proxy stats_for_scout started.
Feb  5 08:57:15 localhost haproxy[31950]: Proxy public_stats started.
Feb  5 09:43:47 localhost haproxy[31951]: Pausing proxy platform-cache.
Feb  5 09:43:47 localhost haproxy[31951]: Pausing proxy http_health_check.
Feb  5 09:43:47 localhost haproxy[31951]: Pausing proxy stats_for_scout.
Feb  5 09:43:47 localhost haproxy[31951]: Pausing proxy public_stats.
Feb  5 09:43:47 localhost haproxy[32746]: Proxy platform-cache started.
Feb  5 09:43:47 localhost haproxy[32746]: Proxy http_health_check started.
Feb  5 09:43:47 localhost haproxy[32746]: Proxy stats_for_scout started.
Feb  5 09:43:47 localhost haproxy[32746]: Proxy public_stats started.
Feb  5 09:43:47 localhost haproxy[31951]: Stopping proxy platform-cache in 0 ms.
Feb  5 09:43:47 localhost haproxy[31951]: Stopping proxy http_health_check in 0 ms.
Feb  5 09:43:47 localhost haproxy[31951]: Stopping proxy stats_for_scout in 0 ms.
Feb  5 09:43:47 localhost haproxy[31951]: Stopping proxy public_stats in 0 ms.
Feb  5 09:43:47 localhost haproxy[31951]: Proxy platform-cache stopped (FE: 32540 conns, BE: 30334 conns).
Feb  5 09:43:47 localhost haproxy[31951]: Proxy http_health_check stopped (FE: 0 conns, BE: 0 conns).
Feb  5 09:43:47 localhost haproxy[31951]: Proxy stats_for_scout stopped (FE: 16 conns, BE: 0 conns).
Feb  5 09:43:47 localhost haproxy[31951]: Proxy public_stats stopped (FE: 4 conns, BE: 2 conns).
Feb  5 17:52:27 localhost haproxy[26610]: Proxy platform-cache started.
Feb  5 17:52:27 localhost haproxy[26610]: Proxy http_health_check started.
Feb  5 17:52:27 localhost haproxy[26610]: Proxy stats_for_scout started.
Feb  5 17:52:27 localhost haproxy[26610]: Proxy public_stats started.
~

Original configuration that has worked flawlessly for over a year
global
        log 127.0.0.1   local0
        log 127.0.0.1   local1 notice
        #log 127.0.0.1   local1 debug
        #log loghost    local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        user haproxy
        group haproxy
        daemon
        #debug
        #quiet

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option forwardfor
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

listen  platform-cache 0.0.0.0:80
        mode http
        #balance uri
        hash-type consistent
        balance hdr(Host)
        server varnish1 10.176.129.245 weight 20 check
        server varnish2 10.176.129.29 weight 40 check

# HTTP response : 'HTTP/1.0 200 OK'
listen http_health_check 0.0.0.0:60001
        mode health
        option httpchk

listen  stats_for_scout 127.0.0.1:8081
        mode http
        stats uri /stats

listen  public_stats :8080
        mode http
        stats uri /stats
        stats realm   Haproxy\ Statistics
        stats auth    *******

Thanks for your help!

A: I just ran into what I think is the same issue or a similar issue.  I was running haproxy and suddenly it would stop accepting new connections.  I tried bumping up the max connections from 32k to 65k, and when I restarted it looked better, but then would stop accepting new connections way before the max connections limit in the haproxy.cfg file.  I could see the change taking effect in the haproxy stats webpage.
I then looked in /proc//limits and saw this:
...
Max open files            4026                 4026                 files
...
I then checked in /proc//fd and saw that when haproxy stopped I had about that number of files open.  SO I think the problem is the underlying unix limits not haproxy.  I increased the process limits and so far in my tests it looks better.
I hope that helps if your issue is being caused by the same underlying issue.

A: If you are hitting the configured limit, that should be normal. You can read this from haproxy documentation:
maxconn <number>
  Sets the maximum per-process number of concurrent connections to <number>. It
  is equivalent to the command-line argument "-n". Proxies will stop accepting
  connections when this limit is reached.