Core Text or not Core Text?
I'm building a Bible app. I read that Core Text does not aid you in
searching or bookmarking, and I'm not sure how to display a text document.
I have the documentation in .pages format, and I display it with a
webView, but I'm not sure if this can solve my problems. Can someone give
me a suggestion on these questions, please?
1) Which framework should I use for displaying the text documentation
(bible) and still cover searching, bookmarking...
2) Should I change the document type to handle it better?
Tuesday, 10 September 2013
mysql select statement with alias fails with column not found
mysql select statement with alias fails with column not found
mysql select statement with alias fails with column not found
Developemt Environment Reference: Fedora FC18 Tomcat Server 7.0.39
(localhost config) Eclipse Juno Release 2 Mysql-connecor-java Ver. 5.1.26
(jar) Mysql-server Ver. 5.5.32 (jar)
The following select statment fails with "column 'depth' not found:
"select node.subEntityID, node.lft, node.rgt, (count(parent.subEntityID) -
1) as depth from ENTITY as node, ENTITY as parent where node.lft between
parent.lft and parent.rgtgroup by node.subEntityID order by node.lft";
This select statement succeeds using command level mysql as use dbName;
select node.subEntityID, node.lft, node.rgt, (count(parent.subEntityID) -
1) as depth from ENTITY as node, ENTITY as parent where node.lft between
parent.lft and parent.rgtgroup by node.subEntityID order by node.lft;
The select statement also succeeds when using an sql query in Mysql
Workbench Ver. 5.2.4.7
The relevant java code fragment is given below:
rs = stmt.executeQuery(typeEntityList);
// The depth alias does not print out in this for loop
for (int i=1; i<rs.getMetaData().getColumnCount()+1; i++) {
System.out.println(rs.getMetaData().getColumnName(i));
System.out.println(rs.getMetaData().getColumnLabel(i));
}
while (rs.next()) {
// "depth" fails at the following statement
System.out.println("depth: " + rs.getInt("depth"));
String s = rs.getString("lft") + " "
+ rs.getString("subEntityID") + " "
+ rs.getString("rgt");
System.out.println(s);
entityList.add(s);
}
Also, I found on a Google search that mysql alias behavior changed in
recent versions of mysql. A suggested fix was to append
"?useOldAliasMetadataBehavior=true" to the mysql connection string to
revert back to the original behavior, but that did not correct the problem
Any help with this problem is greatly appreciated.
Thanks, Roy W. roycwhitt@gmail.com
mysql select statement with alias fails with column not found
Developemt Environment Reference: Fedora FC18 Tomcat Server 7.0.39
(localhost config) Eclipse Juno Release 2 Mysql-connecor-java Ver. 5.1.26
(jar) Mysql-server Ver. 5.5.32 (jar)
The following select statment fails with "column 'depth' not found:
"select node.subEntityID, node.lft, node.rgt, (count(parent.subEntityID) -
1) as depth from ENTITY as node, ENTITY as parent where node.lft between
parent.lft and parent.rgtgroup by node.subEntityID order by node.lft";
This select statement succeeds using command level mysql as use dbName;
select node.subEntityID, node.lft, node.rgt, (count(parent.subEntityID) -
1) as depth from ENTITY as node, ENTITY as parent where node.lft between
parent.lft and parent.rgtgroup by node.subEntityID order by node.lft;
The select statement also succeeds when using an sql query in Mysql
Workbench Ver. 5.2.4.7
The relevant java code fragment is given below:
rs = stmt.executeQuery(typeEntityList);
// The depth alias does not print out in this for loop
for (int i=1; i<rs.getMetaData().getColumnCount()+1; i++) {
System.out.println(rs.getMetaData().getColumnName(i));
System.out.println(rs.getMetaData().getColumnLabel(i));
}
while (rs.next()) {
// "depth" fails at the following statement
System.out.println("depth: " + rs.getInt("depth"));
String s = rs.getString("lft") + " "
+ rs.getString("subEntityID") + " "
+ rs.getString("rgt");
System.out.println(s);
entityList.add(s);
}
Also, I found on a Google search that mysql alias behavior changed in
recent versions of mysql. A suggested fix was to append
"?useOldAliasMetadataBehavior=true" to the mysql connection string to
revert back to the original behavior, but that did not correct the problem
Any help with this problem is greatly appreciated.
Thanks, Roy W. roycwhitt@gmail.com
How does Javascript return work?
How does Javascript return work?
pThis is what I have/p precode$wrapper.find('li').sort(function (a, b) {
return +a.getAttribute('data-val') - +b.getAttribute('data-val'); });
/code/pre pIt works, as I see in Chrome dev tool an array of objects is
indeed returned but...my question is: What's up with that return? How can
I use that array? /p pWhat I want to do i to take the returned array, and
stick it inside a tag./p
pThis is what I have/p precode$wrapper.find('li').sort(function (a, b) {
return +a.getAttribute('data-val') - +b.getAttribute('data-val'); });
/code/pre pIt works, as I see in Chrome dev tool an array of objects is
indeed returned but...my question is: What's up with that return? How can
I use that array? /p pWhat I want to do i to take the returned array, and
stick it inside a tag./p
Add the same calculated property to every Symfony2 Controller in bundle
Add the same calculated property to every Symfony2 Controller in bundle
I'm converting an application over from a legacy framework to Symfony2.
One of the things the app has is a tiny little message in the bottom
corner of the rendered page that says
served by appserver3 in 200ms
or similar. It changes depending on the appserver you're on and the amount
of time it took to serve the request. The value for the appserver is set
in
Should I create a BaseController type class that extends Controller and
then have all my controllers extend that? If so, how would I go about
making sure that the BaseController always adds the responseTime and
appServerName to the list of variables that will be passed to my twig
template without having to add it manually in every controller like this:
return $this->render('MyBundle:Default:index.html.twig', array('var1' =>
$var1, 'appServerName' => $this->getAppServerName(), 'responseTime' =>
$this->getResponseTime()));
(Obviously this would assume that I created the getAppServerName and
getResponseTime methods in my BaseController.)
This seems like a lot of copypasta and my whole reason for moving to
Symfony2 is to avoid that :\
I'm converting an application over from a legacy framework to Symfony2.
One of the things the app has is a tiny little message in the bottom
corner of the rendered page that says
served by appserver3 in 200ms
or similar. It changes depending on the appserver you're on and the amount
of time it took to serve the request. The value for the appserver is set
in
Should I create a BaseController type class that extends Controller and
then have all my controllers extend that? If so, how would I go about
making sure that the BaseController always adds the responseTime and
appServerName to the list of variables that will be passed to my twig
template without having to add it manually in every controller like this:
return $this->render('MyBundle:Default:index.html.twig', array('var1' =>
$var1, 'appServerName' => $this->getAppServerName(), 'responseTime' =>
$this->getResponseTime()));
(Obviously this would assume that I created the getAppServerName and
getResponseTime methods in my BaseController.)
This seems like a lot of copypasta and my whole reason for moving to
Symfony2 is to avoid that :\
ERROR 1006 (HY000) Can't create database (errno: 13) MySQL 5.6.12
ERROR 1006 (HY000) Can't create database (errno: 13) MySQL 5.6.12
I am facing problem in creating the database and it results in following
error.
mysql> show grants for 'admin'@'%';
+---------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin@%
|
+---------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY PASSWORD
'*4ACFE3202A5FF5CF467898FC58AAB1D615029441' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> create database abc;
ERROR 1006 (HY000): Can't create database 'abc' (errno: 13)
mysql>
Here are my users table.
SELECT * FROM mysql.`user` u;
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| Host | User | Password |
Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv |
Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv |
Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv |
Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv |
Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv |
Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv |
Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher |
x509_issuer | x509_subject | max_questions | max_updates | max_connections
| max_user_connections | plugin | authentication_string | password_expired
|
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| localhost | root | *0ED7CCB23F57AFBB530688A270C080BD4956882B | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
|test_dat-DGW | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| 127.0.0.1 | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| ::1 | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| % | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
| localhost | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
6 rows in set (0.00 sec)
I can create and remove table in the existing database.
The data directory already has mysql:mysql privileges and also the logged
in user has privilege to create the new database.
Please guide what configuration is missed here.
Thank you in advance.
I am facing problem in creating the database and it results in following
error.
mysql> show grants for 'admin'@'%';
+---------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin@%
|
+---------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY PASSWORD
'*4ACFE3202A5FF5CF467898FC58AAB1D615029441' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> create database abc;
ERROR 1006 (HY000): Can't create database 'abc' (errno: 13)
mysql>
Here are my users table.
SELECT * FROM mysql.`user` u;
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| Host | User | Password |
Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv |
Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv |
Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv |
Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv |
Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv |
Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv |
Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher |
x509_issuer | x509_subject | max_questions | max_updates | max_connections
| max_user_connections | plugin | authentication_string | password_expired
|
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
| localhost | root | *0ED7CCB23F57AFBB530688A270C080BD4956882B | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
|test_dat-DGW | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| 127.0.0.1 | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| ::1 | root | *292891EE28681A07B26BD53600C18994D66E8583 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| Y |
| % | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
| localhost | admin | *4ACFE3202A5FF5CF467898FC58AAB1D615029441 | Y
| Y | Y | Y | Y | Y |
Y | Y | Y | Y | Y | Y
| Y | Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| Y | Y | Y | Y
| | | | |
0 | 0 | 0 | 0 | |
| N |
+-------------+-------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+--------+-----------------------+------------------+
6 rows in set (0.00 sec)
I can create and remove table in the existing database.
The data directory already has mysql:mysql privileges and also the logged
in user has privilege to create the new database.
Please guide what configuration is missed here.
Thank you in advance.
edit view without modifying file cakePHP
edit view without modifying file cakePHP
View(edit) is displaying all the fields correctly and updating modified
fields but it cant handle files. i.e., if new file is uploaded then it has
to be updated if not old file name has to be retained.
controller:
public function edit($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
$post = $this->Student->findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
if ($this->request->is('post') || $this->request->is('put')) {
$this->Student->id = $id;
if ($this->Student->save($this->request->data)) {
$this->Session->setFlash(__('Your post has been updated.'));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Unable to update your post.'));
}
if (!$this->request->data) {
$this->request->data = $post;
}
}
View:
<h1>Edit student record</h1>
<?php
echo $this->Form->create('Student',array('type'=>'file'));
echo $this->Form->input('first_name');
echo $this->Form->input('current_address');
echo 'resume'.$this->Form->file('resume');
echo $this->Form->input ('comments');
echo 'photo'.$this->Form->file('photo');
echo $this->Form->input('id', array('type' => 'hidden'));
//echo $this->Form->input('resume', array('type' => 'hidden'));
//echo $this->Form->input('photo', array('type' => 'hidden'));
echo $this->Form->end('Save Post');
Can someone suggest me how to handle the upload thing
View(edit) is displaying all the fields correctly and updating modified
fields but it cant handle files. i.e., if new file is uploaded then it has
to be updated if not old file name has to be retained.
controller:
public function edit($id = null) {
if (!$id) {
throw new NotFoundException(__('Invalid post'));
}
$post = $this->Student->findById($id);
if (!$post) {
throw new NotFoundException(__('Invalid post'));
}
if ($this->request->is('post') || $this->request->is('put')) {
$this->Student->id = $id;
if ($this->Student->save($this->request->data)) {
$this->Session->setFlash(__('Your post has been updated.'));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Unable to update your post.'));
}
if (!$this->request->data) {
$this->request->data = $post;
}
}
View:
<h1>Edit student record</h1>
<?php
echo $this->Form->create('Student',array('type'=>'file'));
echo $this->Form->input('first_name');
echo $this->Form->input('current_address');
echo 'resume'.$this->Form->file('resume');
echo $this->Form->input ('comments');
echo 'photo'.$this->Form->file('photo');
echo $this->Form->input('id', array('type' => 'hidden'));
//echo $this->Form->input('resume', array('type' => 'hidden'));
//echo $this->Form->input('photo', array('type' => 'hidden'));
echo $this->Form->end('Save Post');
Can someone suggest me how to handle the upload thing
How to extract conditional statements from linq query?
How to extract conditional statements from linq query?
I want to be able to extract conditional statements from following query
inside a function. It's a linq to EF query. How should i do that? is there
any alternative way so that object oriented principles be applied (like
open/closed)?
var query = new UvwRequestAssignmentManagementBO().GetAll().Where(uvw
=> (uvw.FK_ProcessStep == 2)
&& (uvw.FK_Entity == SecurityContext.Current.User.FK_Entity)
&& (uvw.FK_Manager == 15))
.Select(p => new ReqSupAdminGridVm()
{
NameFamily = p.NameFamily,
RequestDate = p.RequestDate,
RequestNo = p.RequestNo,
RequestType = p.RequestType == 1 ?"a"
: (p.RequestType == 2 ? "b"
: (p.RequestType == 3 ? "c" :
(p.RequestType == 4 ? "d" : ""))),
RequestEvaluationStatus =
p.RequestEvaluationStatus_Aggregation == 1 ? "a"
:
(p.RequestEvaluationStatus_Aggregation
== 2 ? "b"
:
(p.RequestEvaluationStatus_Aggregation
== 3 ?"c"
:(p.RequestEvaluationStatus_Aggregation
== 4 ? "d" : ""))),
});
For Example instead of writing :
RequestType = p.RequestType == 1 ?"a"
: (p.RequestType == 2 ? "b"
: (p.RequestType == 3 ? "c" :
(p.RequestType == 4 ? "d" : ""))),
i want to be able to write this inside another class :
RequestType = ReqType.GetReqType(p.RequestType);
string GetReqType(int type){
switch(type){
case 1:
return "a";
case 2:
return "b";
}
}
I want to be able to extract conditional statements from following query
inside a function. It's a linq to EF query. How should i do that? is there
any alternative way so that object oriented principles be applied (like
open/closed)?
var query = new UvwRequestAssignmentManagementBO().GetAll().Where(uvw
=> (uvw.FK_ProcessStep == 2)
&& (uvw.FK_Entity == SecurityContext.Current.User.FK_Entity)
&& (uvw.FK_Manager == 15))
.Select(p => new ReqSupAdminGridVm()
{
NameFamily = p.NameFamily,
RequestDate = p.RequestDate,
RequestNo = p.RequestNo,
RequestType = p.RequestType == 1 ?"a"
: (p.RequestType == 2 ? "b"
: (p.RequestType == 3 ? "c" :
(p.RequestType == 4 ? "d" : ""))),
RequestEvaluationStatus =
p.RequestEvaluationStatus_Aggregation == 1 ? "a"
:
(p.RequestEvaluationStatus_Aggregation
== 2 ? "b"
:
(p.RequestEvaluationStatus_Aggregation
== 3 ?"c"
:(p.RequestEvaluationStatus_Aggregation
== 4 ? "d" : ""))),
});
For Example instead of writing :
RequestType = p.RequestType == 1 ?"a"
: (p.RequestType == 2 ? "b"
: (p.RequestType == 3 ? "c" :
(p.RequestType == 4 ? "d" : ""))),
i want to be able to write this inside another class :
RequestType = ReqType.GetReqType(p.RequestType);
string GetReqType(int type){
switch(type){
case 1:
return "a";
case 2:
return "b";
}
}
Subscribe to:
Posts (Atom)