PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
30k
β | Tag1
stringlengths 1
25
β | Tag2
stringlengths 1
25
β | Tag3
stringlengths 1
25
β | Tag4
stringlengths 1
25
β | Tag5
stringlengths 1
25
β | PostClosedDate
stringlengths 19
19
β | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,567,820 | 07/19/2012 19:20:09 | 892,134 | 08/12/2011 16:23:05 | 474 | 0 | login authentification token php .. stuck | When the user registers an account, a table is created with columns; userid and token. This is because if the user checks remember me when logging in on different computers, each computer has a different token.
register.php
//user specific table created
$create = $connectdb->prepare("CREATE TABLE `user-:username` (userid INT, token varchar(200)");
$executequery = $create->execute(array("username"=>$username));
Here is a snippet of login.php; I create the token, store the token in a cookie and insert the token to that user specific table
if($remember==1) {
$token = md5(uniqid('',true));
setcookie('token',$token,time()+60*60*24*365);
$rememberquery = $connectdb->prepare("INSERT INTO `user-:username` VALUES ('',:username,:token)");
$rememberquery->execute(array(":username"=>$username,":token"=>$token));
$_SESSION['username'][0] = $username;
$_SESSION['username'][1] = $userid;
}
Now i'm stuck(assuming i have done the previous correctly). When do i check the cookie token to the database token?
Also, I need the session data many times throughout the code. So if the session expires, what do i do to retrieve the userid, username? I used to store username/userid of a logged in user in a cookie. So to quickly display the logged in user i'd do `echo $_COOKIE['username'];` | php | null | null | null | null | null | open | login authentification token php .. stuck
===
When the user registers an account, a table is created with columns; userid and token. This is because if the user checks remember me when logging in on different computers, each computer has a different token.
register.php
//user specific table created
$create = $connectdb->prepare("CREATE TABLE `user-:username` (userid INT, token varchar(200)");
$executequery = $create->execute(array("username"=>$username));
Here is a snippet of login.php; I create the token, store the token in a cookie and insert the token to that user specific table
if($remember==1) {
$token = md5(uniqid('',true));
setcookie('token',$token,time()+60*60*24*365);
$rememberquery = $connectdb->prepare("INSERT INTO `user-:username` VALUES ('',:username,:token)");
$rememberquery->execute(array(":username"=>$username,":token"=>$token));
$_SESSION['username'][0] = $username;
$_SESSION['username'][1] = $userid;
}
Now i'm stuck(assuming i have done the previous correctly). When do i check the cookie token to the database token?
Also, I need the session data many times throughout the code. So if the session expires, what do i do to retrieve the userid, username? I used to store username/userid of a logged in user in a cookie. So to quickly display the logged in user i'd do `echo $_COOKIE['username'];` | 0 |
11,567,823 | 07/19/2012 19:20:20 | 1,538,902 | 07/19/2012 19:18:22 | 1 | 0 | Print a line 10 times in obj-c? | I know that print line is `NSLog`. How do I print a line 10 times in obj-c? | objective-c | null | null | null | null | null | open | Print a line 10 times in obj-c?
===
I know that print line is `NSLog`. How do I print a line 10 times in obj-c? | 0 |
11,567,776 | 07/19/2012 19:17:08 | 971,602 | 09/29/2011 16:51:01 | 71 | 1 | Working with d3.js and raphael | I am having a very hard time since there is not much documentation on [d34raphael][1] tool.
I am trying to reproduce this example from d3.js: [http://bl.ocks.org/d/1249394/][2] using raphael. The idea is to be able to run this into ie8 which doesn't support svg.
My biggest concern is replacing the "g" svg nodes with raphael code.
For example how to convert these statemetns into d34raphael:
var node = vis.selectAll("g.node")
.data(nodes, function(d) { return d.id || (d.id = ++i); });
or
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", click);
I have read the documentation on d34raphael but it hasn't been useful.
Thanks for the help.
[1]: http://webmonarch.github.com/d34raphael/usage.html
[2]: http://bl.ocks.org/d/1249394/ | javascript | jquery | raphael | d3.js | null | null | open | Working with d3.js and raphael
===
I am having a very hard time since there is not much documentation on [d34raphael][1] tool.
I am trying to reproduce this example from d3.js: [http://bl.ocks.org/d/1249394/][2] using raphael. The idea is to be able to run this into ie8 which doesn't support svg.
My biggest concern is replacing the "g" svg nodes with raphael code.
For example how to convert these statemetns into d34raphael:
var node = vis.selectAll("g.node")
.data(nodes, function(d) { return d.id || (d.id = ++i); });
or
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", click);
I have read the documentation on d34raphael but it hasn't been useful.
Thanks for the help.
[1]: http://webmonarch.github.com/d34raphael/usage.html
[2]: http://bl.ocks.org/d/1249394/ | 0 |
11,567,777 | 07/19/2012 19:17:18 | 346,279 | 05/20/2010 15:30:01 | 11 | 0 | Is there a way to automatically convert programs to Hadoop-based code? | Say if I have a legacy single-thread program. Is there a way I can convert/transform it to a Hadoop-based program automatically? Through static analysis, maybe.
| hadoop | mapreduce | translation | null | null | 07/21/2012 05:59:26 | not a real question | Is there a way to automatically convert programs to Hadoop-based code?
===
Say if I have a legacy single-thread program. Is there a way I can convert/transform it to a Hadoop-based program automatically? Through static analysis, maybe.
| 1 |
11,567,713 | 07/19/2012 19:12:03 | 1,350,351 | 04/23/2012 02:10:03 | 16 | 1 | ruby Array.inspect vs. Array[element].to_s | I'm working with an array, which we'll call `books`, of complex objects, which we'll call `Book`. The problem is when I call `puts "#{books.inspect}"`, ruby outputs a stream of binary (unreadable utf8 characters). However, when I call `puts #{books[0].to_str}"`, I get a brief, pretty output that describes the `book` in question. Not sure if it is relevant, but `Book` is a subclass (we can call it's parent class `Item`), and `books.length=1`
[Ruby][1] implies that `.to_s` and `.inspect` are synonymous, but they are clearly providing different results in practice. Does anyone know why this is happening and can you provide a suggestion for how to get the nice output I want out of the whole books collection?
Misc info:
[chester ~ ]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
[1]: http://ruby-doc.org/core-1.9.2/Array.html | ruby | linux | arrays | string | null | null | open | ruby Array.inspect vs. Array[element].to_s
===
I'm working with an array, which we'll call `books`, of complex objects, which we'll call `Book`. The problem is when I call `puts "#{books.inspect}"`, ruby outputs a stream of binary (unreadable utf8 characters). However, when I call `puts #{books[0].to_str}"`, I get a brief, pretty output that describes the `book` in question. Not sure if it is relevant, but `Book` is a subclass (we can call it's parent class `Item`), and `books.length=1`
[Ruby][1] implies that `.to_s` and `.inspect` are synonymous, but they are clearly providing different results in practice. Does anyone know why this is happening and can you provide a suggestion for how to get the nice output I want out of the whole books collection?
Misc info:
[chester ~ ]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
[1]: http://ruby-doc.org/core-1.9.2/Array.html | 0 |
11,410,667 | 07/10/2012 09:48:21 | 922,895 | 09/01/2011 05:52:03 | 6 | 1 | Running logstash with monit | I am trying to start logstash with monit.
I have a directory where i have logstash in which /home/slee/PROJECT/logstash.
First I create a bash script(wrapper) to run logstash in as suggested in the monit site.
I created this:
#!/bin/bash
export JAVA_HOME=/usr/local/java/
#CLASSPATH=/root/lo2/logstash/logstash-1.1.0-monolithic.jar
#CONFIG=/root/lo2/logstash/stag_conf.conf
CLASSPATH=/home/slee/PROJECT/logstash/logstash-1.1.0-monolithic.jar
CONFIG=/home/slee/PROJECT/logstash/local.conf
case $1 in
start)
echo $$ > /var/run/logstash.pid;
#exec 2>&1 java -jar $CLASSPATH agent -f $CONFIG -- web --backend elasticsearch:///?local 1> /var/log/apache2/logstash.log
exec java -jar $CLASSPATH agent -f $CONFIG --log /var/log/logstash-indexer.out -- web --log /var/log/logstash-web.out --backend elasticsearch://localhost/
;;
stop)
kill `cat /var/run/logstash.pid` ;;
*)
echo "usage: logstash {start|stop}" ;;
esac
exit 0
If I run this with ./logstash start. It works like a charm but if I add it to monit as such:
check process logstash with pidfile /var/run/logstash.pid
group system
start program = "/bin/bash /home/slee/PROJECT/twyxt/logstash/logstash.sh"
stop program = "/bin/bash /home/slee/PROJECT/twyxt/logstash/logstash.sh"
if failed host localhost port 9292
protocol http then restart
if 5 restarts within 5 cycles then timeout
It does not start logstash at all. Can anyone tell me why? Or give me an Idea on how to solve this.
I sent an email to the logstash group and they gave me this link http://cookbook.logstash.net/recipes/using-upstart/#upstart%20logstash%20config
I tried it but I kept getting a
slee@ubuntu:~/PROJECT/logstash/upstart/backup$ sudo initctl start logstash
initctl: Unknown job: logstash
I dont know what could be wrong with the logstash config since I changed the directory to my own. Please help.
Best Regards,
Stevenson Lee | ubuntu | monit | null | null | null | null | open | Running logstash with monit
===
I am trying to start logstash with monit.
I have a directory where i have logstash in which /home/slee/PROJECT/logstash.
First I create a bash script(wrapper) to run logstash in as suggested in the monit site.
I created this:
#!/bin/bash
export JAVA_HOME=/usr/local/java/
#CLASSPATH=/root/lo2/logstash/logstash-1.1.0-monolithic.jar
#CONFIG=/root/lo2/logstash/stag_conf.conf
CLASSPATH=/home/slee/PROJECT/logstash/logstash-1.1.0-monolithic.jar
CONFIG=/home/slee/PROJECT/logstash/local.conf
case $1 in
start)
echo $$ > /var/run/logstash.pid;
#exec 2>&1 java -jar $CLASSPATH agent -f $CONFIG -- web --backend elasticsearch:///?local 1> /var/log/apache2/logstash.log
exec java -jar $CLASSPATH agent -f $CONFIG --log /var/log/logstash-indexer.out -- web --log /var/log/logstash-web.out --backend elasticsearch://localhost/
;;
stop)
kill `cat /var/run/logstash.pid` ;;
*)
echo "usage: logstash {start|stop}" ;;
esac
exit 0
If I run this with ./logstash start. It works like a charm but if I add it to monit as such:
check process logstash with pidfile /var/run/logstash.pid
group system
start program = "/bin/bash /home/slee/PROJECT/twyxt/logstash/logstash.sh"
stop program = "/bin/bash /home/slee/PROJECT/twyxt/logstash/logstash.sh"
if failed host localhost port 9292
protocol http then restart
if 5 restarts within 5 cycles then timeout
It does not start logstash at all. Can anyone tell me why? Or give me an Idea on how to solve this.
I sent an email to the logstash group and they gave me this link http://cookbook.logstash.net/recipes/using-upstart/#upstart%20logstash%20config
I tried it but I kept getting a
slee@ubuntu:~/PROJECT/logstash/upstart/backup$ sudo initctl start logstash
initctl: Unknown job: logstash
I dont know what could be wrong with the logstash config since I changed the directory to my own. Please help.
Best Regards,
Stevenson Lee | 0 |
11,410,674 | 07/10/2012 09:49:00 | 169 | 08/02/2008 22:51:03 | 2,714 | 78 | How do I diagnose cause of failover in a replicated RavenDB setup? | I have created a data migration tool that reads data from a legacy SQL database, transforms it into something a lot more sensible and then stores it in RavenDB.
When I try to write 22500 1KB objects in a single Raven session, I get the following error:
`System.InvalidOperationException: Could not replicate POST operation to secondary node, failover behavior is: AllowReadsFromSecondaries`
The message suggests Master Raven instance encountered a fatal error and migration tool failed over to Slave Slave Raven instance and tried to write to it. What I don't know is why.
Background information:
- .NET 4.0
- RavenDB #2025-Unstable (can't use stable build because of dependency on Json.NET)
- Using RavenDB Replication bundle (replication is configured correctly)
- Write operations are wrapped in a TransactionScope (there are writes happening elsewhere in the migration tool using a separate Raven session)
- No errors in Windows Event Log
Log on Master Raven instance contains the following error:
System.Threading.ThreadAbortException: Thread was being aborted.
at Microsoft.Isam.Esent.Interop.Implementation.NativeMethods.JetSeek(IntPtr sesid, IntPtr tableid, UInt32 grbit)
at Microsoft.Isam.Esent.Interop.Implementation.JetApi.JetSeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\JetApi.cs:line 3172
at Microsoft.Isam.Esent.Interop.Api.TrySeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\MoveHelpers.cs:line 127
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.EnsureDocumentIsNotCreatedInAnotherTransaction(String key, Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Util.cs:line 77
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.AddDocument(String key, Nullable`1 etag, RavenJObject data, RavenJObject metadata) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Documents.cs:line 296
at Raven.Database.DocumentDatabase.<>c__DisplayClass37.<Put>b__30(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 480
at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 328
at Raven.Database.DocumentDatabase.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 468
at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__64(DocumentInTransactionData doc) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 654
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.CompleteTransaction(Guid txId, Action`1 perDocumentModified) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\General.cs:line 272
at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__63(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 658
at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 374
at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 334
at Raven.Database.DocumentDatabase.Commit(Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 668
at Raven.Database.Server.Responders.TransactionCommit.Respond(IHttpContext context) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\Responders\TransactionCommit.cs:line 28
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 582
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 347
Is there an upper limit on number of writes per session when using transactions with replication?<br />
Could this, perhaps, be a result of using an unstable build? | c# | .net-4.0 | ravendb | null | null | null | open | How do I diagnose cause of failover in a replicated RavenDB setup?
===
I have created a data migration tool that reads data from a legacy SQL database, transforms it into something a lot more sensible and then stores it in RavenDB.
When I try to write 22500 1KB objects in a single Raven session, I get the following error:
`System.InvalidOperationException: Could not replicate POST operation to secondary node, failover behavior is: AllowReadsFromSecondaries`
The message suggests Master Raven instance encountered a fatal error and migration tool failed over to Slave Slave Raven instance and tried to write to it. What I don't know is why.
Background information:
- .NET 4.0
- RavenDB #2025-Unstable (can't use stable build because of dependency on Json.NET)
- Using RavenDB Replication bundle (replication is configured correctly)
- Write operations are wrapped in a TransactionScope (there are writes happening elsewhere in the migration tool using a separate Raven session)
- No errors in Windows Event Log
Log on Master Raven instance contains the following error:
System.Threading.ThreadAbortException: Thread was being aborted.
at Microsoft.Isam.Esent.Interop.Implementation.NativeMethods.JetSeek(IntPtr sesid, IntPtr tableid, UInt32 grbit)
at Microsoft.Isam.Esent.Interop.Implementation.JetApi.JetSeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\JetApi.cs:line 3172
at Microsoft.Isam.Esent.Interop.Api.TrySeek(JET_SESID sesid, JET_TABLEID tableid, SeekGrbit grbit) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\MoveHelpers.cs:line 127
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.EnsureDocumentIsNotCreatedInAnotherTransaction(String key, Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Util.cs:line 77
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.AddDocument(String key, Nullable`1 etag, RavenJObject data, RavenJObject metadata) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\Documents.cs:line 296
at Raven.Database.DocumentDatabase.<>c__DisplayClass37.<Put>b__30(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 480
at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 328
at Raven.Database.DocumentDatabase.Put(String key, Nullable`1 etag, RavenJObject document, RavenJObject metadata, TransactionInformation transactionInformation) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 468
at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__64(DocumentInTransactionData doc) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 654
at Raven.Storage.Esent.StorageActions.DocumentStorageActions.CompleteTransaction(Guid txId, Action`1 perDocumentModified) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\StorageActions\General.cs:line 272
at Raven.Database.DocumentDatabase.<>c__DisplayClass67.<Commit>b__63(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 658
at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 374
at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Storage.Esent\TransactionalStorage.cs:line 334
at Raven.Database.DocumentDatabase.Commit(Guid txId) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\DocumentDatabase.cs:line 668
at Raven.Database.Server.Responders.TransactionCommit.Respond(IHttpContext context) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\Responders\TransactionCommit.cs:line 28
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 582
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\RavenDB-Unstable-v1.2\Raven.Database\Server\HttpServer.cs:line 347
Is there an upper limit on number of writes per session when using transactions with replication?<br />
Could this, perhaps, be a result of using an unstable build? | 0 |
11,410,679 | 07/10/2012 09:49:31 | 1,448,274 | 06/11/2012 06:26:36 | 20 | 1 | How connect to a database at 9 O'clock in android? | In android i'm trying to access a database at a predefined time. In my application it runs a simple android service and inside that i want to check the external database(MySQL) at a specific time. I'm using a java web service to access the database.
public class DBService extends Service {
private static final String SOAP_ACTION = "http://dbconnectivity.com/test/";
private static final String METHOD_NAME = "test";
private static final String NAMESPACE = "http://dbconnectivity.com";
private static final String URL = "http://10.0.2.2:8089/DB_Connectivity/services/SqlConnectivity?wsdl";
String str;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
//Toast.makeText(this, "Test", Toast.LENGTH_LONG).show();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("time",0);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
SoapPrimitive s = response;
str = s.toString();
} catch (Exception e) {
e.printStackTrace();
}
Toast.makeText(this, "Test "+str, Toast.LENGTH_LONG).show();
}
@Override
public void onDestroy() {
super.onDestroy();
Toast.makeText(this, "Service destroyed ...", Toast.LENGTH_LONG).show();
}
}
How to do this task ?
| android | android-service | null | null | null | null | open | How connect to a database at 9 O'clock in android?
===
In android i'm trying to access a database at a predefined time. In my application it runs a simple android service and inside that i want to check the external database(MySQL) at a specific time. I'm using a java web service to access the database.
public class DBService extends Service {
private static final String SOAP_ACTION = "http://dbconnectivity.com/test/";
private static final String METHOD_NAME = "test";
private static final String NAMESPACE = "http://dbconnectivity.com";
private static final String URL = "http://10.0.2.2:8089/DB_Connectivity/services/SqlConnectivity?wsdl";
String str;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
//Toast.makeText(this, "Test", Toast.LENGTH_LONG).show();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("time",0);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
SoapPrimitive s = response;
str = s.toString();
} catch (Exception e) {
e.printStackTrace();
}
Toast.makeText(this, "Test "+str, Toast.LENGTH_LONG).show();
}
@Override
public void onDestroy() {
super.onDestroy();
Toast.makeText(this, "Service destroyed ...", Toast.LENGTH_LONG).show();
}
}
How to do this task ?
| 0 |
11,571,760 | 07/20/2012 01:47:22 | 1,350,602 | 04/23/2012 06:03:14 | 35 | 1 | How to connect to proxy server using Java | I want to write a java(SE) program to connect to a proxy server, lets say 123.123.123.123:8080. How am I going to achieve that? What is the protocol between my machine and the proxy server? What is the Java framework's class could be in use? | java | network-programming | null | null | null | null | open | How to connect to proxy server using Java
===
I want to write a java(SE) program to connect to a proxy server, lets say 123.123.123.123:8080. How am I going to achieve that? What is the protocol between my machine and the proxy server? What is the Java framework's class could be in use? | 0 |
11,571,764 | 07/20/2012 01:47:46 | 312,785 | 04/09/2010 12:55:38 | 1,123 | 39 | Node-based automated testing of browser key events | I'm trying to write automated tests for [Hashify Editor][1]. Here are the sorts of assertions I'd like to make:
1. Assert that a textarea matches a particular selector.
2. Assert that the textarea is currently empty.
3. Type "_" into the textarea. Assert that it now contains `__`, and that the caret is positioned between the two underscores.
4. Type "hello" into the textarea. Assert that it now contains `_hello_`, and that the caret is positioned before the second underscore.
5. Type "_" into the textarea. Assert that it still contains `_hello_`, and that the caret is now positioned after the second underscore.
I've spent the day playing with [Soda][2] and [Zombie.js][3], trying to get this work in either. I've managed to get close with Soda:
soda = require 'soda'
browser = soda.createClient ...
browser
.chain
.session()
.open('/')
.typeKeys('editor', '_')
.assertValue('editor', '__')
This assertion success, but the following doesn't:
.typeKeys('editor', 'hello')
.assertValue('editor', '_hello_')
# ERROR: Actual value '__' did not match '_hello_'
Using `.type` fails in a different manner:
.type('editor', 'hello')
.assertValue('editor', '_hello_')
# ERROR: Actual value 'hello' did not match '_hello_'
The suggestion on [#275][4] of assaf/zombie got my hopes up, but I wasn't able to trigger the textarea's keypress handler using this approach.
Perhaps I'm going about this in the wrong way. Has anyone had success testing keypress handlers using Node? What's the best tool for the job?
[1]: https://bitbucket.org/davidchambers/hashify-editor
[2]: https://github.com/LearnBoost/soda
[3]: http://zombie.labnotes.org/
[4]: https://github.com/assaf/zombie/issues/275
| node.js | automated-testing | zombie.js | key-events | soda | null | open | Node-based automated testing of browser key events
===
I'm trying to write automated tests for [Hashify Editor][1]. Here are the sorts of assertions I'd like to make:
1. Assert that a textarea matches a particular selector.
2. Assert that the textarea is currently empty.
3. Type "_" into the textarea. Assert that it now contains `__`, and that the caret is positioned between the two underscores.
4. Type "hello" into the textarea. Assert that it now contains `_hello_`, and that the caret is positioned before the second underscore.
5. Type "_" into the textarea. Assert that it still contains `_hello_`, and that the caret is now positioned after the second underscore.
I've spent the day playing with [Soda][2] and [Zombie.js][3], trying to get this work in either. I've managed to get close with Soda:
soda = require 'soda'
browser = soda.createClient ...
browser
.chain
.session()
.open('/')
.typeKeys('editor', '_')
.assertValue('editor', '__')
This assertion success, but the following doesn't:
.typeKeys('editor', 'hello')
.assertValue('editor', '_hello_')
# ERROR: Actual value '__' did not match '_hello_'
Using `.type` fails in a different manner:
.type('editor', 'hello')
.assertValue('editor', '_hello_')
# ERROR: Actual value 'hello' did not match '_hello_'
The suggestion on [#275][4] of assaf/zombie got my hopes up, but I wasn't able to trigger the textarea's keypress handler using this approach.
Perhaps I'm going about this in the wrong way. Has anyone had success testing keypress handlers using Node? What's the best tool for the job?
[1]: https://bitbucket.org/davidchambers/hashify-editor
[2]: https://github.com/LearnBoost/soda
[3]: http://zombie.labnotes.org/
[4]: https://github.com/assaf/zombie/issues/275
| 0 |
11,571,768 | 07/20/2012 01:48:48 | 1,433,268 | 06/03/2012 07:21:15 | 148 | 12 | Access new web site via browser with IP address? | Ive set up a new site with WHM but havent got the DNS set up yet. I want to be able to access the site via a browser so I can set up a CMS. Usually, I can just do this by entering the IP address into the browser, but this time I just get a page saying that Apache is working on the server.
Does anyone know a way round this?
Thanks!
![Apache][1]
[1]: http://i.stack.imgur.com/x3qTp.gif | apache | hosting | ip | cpanel | whm | 07/20/2012 17:12:06 | off topic | Access new web site via browser with IP address?
===
Ive set up a new site with WHM but havent got the DNS set up yet. I want to be able to access the site via a browser so I can set up a CMS. Usually, I can just do this by entering the IP address into the browser, but this time I just get a page saying that Apache is working on the server.
Does anyone know a way round this?
Thanks!
![Apache][1]
[1]: http://i.stack.imgur.com/x3qTp.gif | 2 |
11,499,407 | 07/16/2012 06:54:22 | 1,514,163 | 07/10/2012 08:26:03 | 1 | 0 | How to make GWT Spring project as maven enabled | I have a project which we implemented using GWT and Spring.
I want to make the project as maven enabled.
How can i achieve that?
I have seen GWT maven plugin. Is it definately required?
Thanks,
Saritha. | gwt | spring-mvc | gwt-2.4 | gwt-maven-plugin | null | null | open | How to make GWT Spring project as maven enabled
===
I have a project which we implemented using GWT and Spring.
I want to make the project as maven enabled.
How can i achieve that?
I have seen GWT maven plugin. Is it definately required?
Thanks,
Saritha. | 0 |
11,499,409 | 07/16/2012 06:54:28 | 1,073,033 | 11/30/2011 09:35:42 | 25 | 1 | /dev/zero or /dev/random - what is more secure and why? | Gentlemen!
Can anyone tell me why is /dev/random is preferred for security while wiping data from a hard drive?
Thanks in Advance! | linux | random | dev | zero | null | null | open | /dev/zero or /dev/random - what is more secure and why?
===
Gentlemen!
Can anyone tell me why is /dev/random is preferred for security while wiping data from a hard drive?
Thanks in Advance! | 0 |
11,499,410 | 07/16/2012 06:54:33 | 606,559 | 02/07/2011 14:18:58 | 509 | 18 | Designing a view combination of TextView and ImageView | I want to develop a view which can works as both ImageView and TextView.Generally its possible by extending the both class but Java doesn't supports the Multiple Inheritance.
Then is it possible to do this ? and how ? | android | views | null | null | null | null | open | Designing a view combination of TextView and ImageView
===
I want to develop a view which can works as both ImageView and TextView.Generally its possible by extending the both class but Java doesn't supports the Multiple Inheritance.
Then is it possible to do this ? and how ? | 0 |
11,571,772 | 07/20/2012 01:49:17 | 890,417 | 08/11/2011 17:27:03 | 8 | 0 | How can I run stuff in the background and redirect their output in Perl? | my $pm = new Parallel::ForkManager(4);
foreach my $array (@lines) {
$pm->start and next;
$cmd = 'command';
print "\n$cmd\n\n";
exec($cmd);
$pm->finish; }
$pm->wait_all_children;
As you can see my code runs 4 things at once. It's ffmpeg piping video to x264. Its output is messy and jumps around on a single line between the 4 outputs. Is there a way to totally run these in the background and redirect its output so I can cleanly print and update the 4 separate outputs? It would be nice so I could tell how far along each process is.
If it absolutely can't be done in perl, I would gladly accept any help given to direct me to another language that would make this easier. This is under Linux, by the way. Thank you. | linux | perl | background-process | null | null | null | open | How can I run stuff in the background and redirect their output in Perl?
===
my $pm = new Parallel::ForkManager(4);
foreach my $array (@lines) {
$pm->start and next;
$cmd = 'command';
print "\n$cmd\n\n";
exec($cmd);
$pm->finish; }
$pm->wait_all_children;
As you can see my code runs 4 things at once. It's ffmpeg piping video to x264. Its output is messy and jumps around on a single line between the 4 outputs. Is there a way to totally run these in the background and redirect its output so I can cleanly print and update the 4 separate outputs? It would be nice so I could tell how far along each process is.
If it absolutely can't be done in perl, I would gladly accept any help given to direct me to another language that would make this easier. This is under Linux, by the way. Thank you. | 0 |
11,571,773 | 07/20/2012 01:49:22 | 1,530,434 | 07/17/2012 01:53:23 | 42 | 5 | inserting yes or no values based on fields in different tables being equal | I have a field created titled LeadInventor,
what I want SQL Server to do is insert yes into the LeadInventor field if the names from the first inventor table match the inventor table. The first inventor table has the names as one field, the inventor table has them separated first and last
this is the coding I have so far, which I know is wrong.
if inventor.InventorFirst + ' ' +inventor.InventorLast = firstinventor.firstinventorname
insert into Inventor(LeadInventor) values ('Yes')
else insert into Inventor(leadinventor) values ('No');
What I would like to know is how do I fix it, or re-write it so that it will do what I ask it to? | sql | sql-server | sql-server-2008 | insert | null | null | open | inserting yes or no values based on fields in different tables being equal
===
I have a field created titled LeadInventor,
what I want SQL Server to do is insert yes into the LeadInventor field if the names from the first inventor table match the inventor table. The first inventor table has the names as one field, the inventor table has them separated first and last
this is the coding I have so far, which I know is wrong.
if inventor.InventorFirst + ' ' +inventor.InventorLast = firstinventor.firstinventorname
insert into Inventor(LeadInventor) values ('Yes')
else insert into Inventor(leadinventor) values ('No');
What I would like to know is how do I fix it, or re-write it so that it will do what I ask it to? | 0 |
11,571,777 | 07/20/2012 01:50:01 | 85,733 | 04/01/2009 15:07:40 | 3,377 | 97 | Ember-data and MongoDB, how to handle _id | I'm using ember-data with rails and MongoDB and am having problem with the way IDs are stored in MongoDB - in a _id field.
Ember-data will use id as the default field for ID so I tried to override it like this:
App.User = DS.Model.extend
primaryKey: "_id"
name: DS.attr "string"
image: DS.attr "string"
This seems to work most of the time but in some instances I get exceptions from ember saying:
> Uncaught Error: assertion failed: Your server returned a hash with the
> key _id but you have no mappings
I suspect this might be a bug in ember-data because it's still heavily under development, but I was trying to find a way to get to map _id to id on the server side in rails? I'm using mongoid to do the mongo mapping. | ruby-on-rails | mongodb | mongoid | emberjs | emberdata | null | open | Ember-data and MongoDB, how to handle _id
===
I'm using ember-data with rails and MongoDB and am having problem with the way IDs are stored in MongoDB - in a _id field.
Ember-data will use id as the default field for ID so I tried to override it like this:
App.User = DS.Model.extend
primaryKey: "_id"
name: DS.attr "string"
image: DS.attr "string"
This seems to work most of the time but in some instances I get exceptions from ember saying:
> Uncaught Error: assertion failed: Your server returned a hash with the
> key _id but you have no mappings
I suspect this might be a bug in ember-data because it's still heavily under development, but I was trying to find a way to get to map _id to id on the server side in rails? I'm using mongoid to do the mongo mapping. | 0 |
11,571,779 | 07/20/2012 01:50:15 | 844,182 | 07/14/2011 09:01:30 | 37 | 0 | java force JTextField to be uppercase only | is there a way to force all user input in a JTextField to be uppercase in Java?
| java | swing | null | null | null | null | open | java force JTextField to be uppercase only
===
is there a way to force all user input in a JTextField to be uppercase in Java?
| 0 |
11,401,484 | 07/09/2012 19:09:27 | 1,471,003 | 06/21/2012 04:21:16 | 1 | 0 | Videos are there in array how to play the that videos. iphone | Videos are there in array. I want to play that videos.
Means Videos are there in server. And videos are come in an array. I stored that array i a dictionary from the dictionary how to play videos
is the below code is right or wrong if its wrong please tell me correct one
enter code here NSMutableDictionary *dict;
dict =[Videoarray objectAtIndex:0];
NSURL *Movie = [[NSURL alloc] initWithString:[dict valueForKey:@"url"]];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
MPMoviePlayerController *movie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
movie.view.frame = CGRectMake(5,5,310, 165);
movie.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[scroll addSubview:movie.view];
[movie play];
| video | null | null | null | null | null | open | Videos are there in array how to play the that videos. iphone
===
Videos are there in array. I want to play that videos.
Means Videos are there in server. And videos are come in an array. I stored that array i a dictionary from the dictionary how to play videos
is the below code is right or wrong if its wrong please tell me correct one
enter code here NSMutableDictionary *dict;
dict =[Videoarray objectAtIndex:0];
NSURL *Movie = [[NSURL alloc] initWithString:[dict valueForKey:@"url"]];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
[theMovie play];
MPMoviePlayerController *movie = [[MPMoviePlayerController alloc] initWithContentURL:Movie];
movie.view.frame = CGRectMake(5,5,310, 165);
movie.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight |
UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
[scroll addSubview:movie.view];
[movie play];
| 0 |
11,401,428 | 07/09/2012 19:06:14 | 357,587 | 06/03/2010 14:28:11 | 434 | 7 | ADF - Bind multiple data controls to a Carousel Item | I am currently trying to bind 3 different graphs to a carousel item in a carousel. But I am not sure how to bind 3 different data controls to it.
Every thing I've read only has you bind 1 data control to a carousel item. | carousel | oracle-adf | jspx | null | null | null | open | ADF - Bind multiple data controls to a Carousel Item
===
I am currently trying to bind 3 different graphs to a carousel item in a carousel. But I am not sure how to bind 3 different data controls to it.
Every thing I've read only has you bind 1 data control to a carousel item. | 0 |
11,401,519 | 07/09/2012 19:11:55 | 1,152,399 | 01/16/2012 17:55:30 | 54 | 0 | Delphi DirectX Imgae not show on OnCreate | I am having one Delphi DirectX Project wit "DXDraw01", "DXDIB01", "DXDIB02", "Background", "BitBtn01", "BitBtn02, "DXTimer01". My requirement is that the Image stored in "Background" will be displayed when the application will run. According to the DelphiX Tutorial, I have implemented the following codes:
unit KoushikHalder01;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Winapi.DirectDraw,
DXClass, DXDraws, DIB, Math, Menus;
type
TForm01 = class(TDXForm)
DXDraw01: TDXDraw;
DXDIB01: TDXDIB;
DXDIB02: TDXDIB;
Background: TDXDIB;
BitBtn01: TBitBtn;
BitBtn02: TBitBtn;
DXTimer01: TDXTimer;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure DXTimer01Timer(Sender: TObject; LagCount: Integer);
procedure FormDestroy(Sender: TObject);
procedure DXDraw01Finalize(Sender: TObject);
procedure DXDraw01Initialize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form01: TForm01;
Closing: Boolean;
implementation
{$R *.dfm}
procedure TForm01.DXDraw01Finalize(Sender: TObject);
begin
DXTimer01.Enabled := false;
end;
procedure TForm01.DXDraw01Initialize(Sender: TObject);
begin
DXTimer01.Enabled := true;
end;
procedure TForm01.DXTimer01Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw01.CanDraw then exit;
DXDraw01.Surface.Fill(0);
with DXDraw01.Surface.Canvas do
begin
DXDraw01.Surface.Assign(Background.DIB);
Brush.Style := bsClear;
Font.Color := clWhite;
Font.Size := 30;
Textout(130, 30, DateTimeToStr(Now));
Release; { Indispensability }
end;
DXDraw01.Flip;
Application.ProcessMessages;
end;
procedure TForm01.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Closing := True;
end;
procedure TForm01.FormCreate(Sender: TObject);
begin
DXTimer01.Enabled := true;
end;
procedure TForm01.FormDestroy(Sender: TObject);
begin
DXDIB01.Free;
DXDIB02.Free;
DXDraw01.Free;
Background.Free;
end;
end.
but it is not happening so. The settings are as follows:
![DXDraw Setting][1] ![DXTimer Setting][2]
[1]: http://i.stack.imgur.com/zpxnx.jpg
[2]: http://i.stack.imgur.com/SoFjy.jpg
The "Background" is always in back buffer and not flippint to front buffer and it show on "Desktop" after closing the application unles i refresh my "Desktop". Please, please help me. | delphi-xe2 | null | null | null | null | null | open | Delphi DirectX Imgae not show on OnCreate
===
I am having one Delphi DirectX Project wit "DXDraw01", "DXDIB01", "DXDIB02", "Background", "BitBtn01", "BitBtn02, "DXTimer01". My requirement is that the Image stored in "Background" will be displayed when the application will run. According to the DelphiX Tutorial, I have implemented the following codes:
unit KoushikHalder01;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Winapi.DirectDraw,
DXClass, DXDraws, DIB, Math, Menus;
type
TForm01 = class(TDXForm)
DXDraw01: TDXDraw;
DXDIB01: TDXDIB;
DXDIB02: TDXDIB;
Background: TDXDIB;
BitBtn01: TBitBtn;
BitBtn02: TBitBtn;
DXTimer01: TDXTimer;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure DXTimer01Timer(Sender: TObject; LagCount: Integer);
procedure FormDestroy(Sender: TObject);
procedure DXDraw01Finalize(Sender: TObject);
procedure DXDraw01Initialize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form01: TForm01;
Closing: Boolean;
implementation
{$R *.dfm}
procedure TForm01.DXDraw01Finalize(Sender: TObject);
begin
DXTimer01.Enabled := false;
end;
procedure TForm01.DXDraw01Initialize(Sender: TObject);
begin
DXTimer01.Enabled := true;
end;
procedure TForm01.DXTimer01Timer(Sender: TObject; LagCount: Integer);
begin
if not DXDraw01.CanDraw then exit;
DXDraw01.Surface.Fill(0);
with DXDraw01.Surface.Canvas do
begin
DXDraw01.Surface.Assign(Background.DIB);
Brush.Style := bsClear;
Font.Color := clWhite;
Font.Size := 30;
Textout(130, 30, DateTimeToStr(Now));
Release; { Indispensability }
end;
DXDraw01.Flip;
Application.ProcessMessages;
end;
procedure TForm01.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Closing := True;
end;
procedure TForm01.FormCreate(Sender: TObject);
begin
DXTimer01.Enabled := true;
end;
procedure TForm01.FormDestroy(Sender: TObject);
begin
DXDIB01.Free;
DXDIB02.Free;
DXDraw01.Free;
Background.Free;
end;
end.
but it is not happening so. The settings are as follows:
![DXDraw Setting][1] ![DXTimer Setting][2]
[1]: http://i.stack.imgur.com/zpxnx.jpg
[2]: http://i.stack.imgur.com/SoFjy.jpg
The "Background" is always in back buffer and not flippint to front buffer and it show on "Desktop" after closing the application unles i refresh my "Desktop". Please, please help me. | 0 |
11,401,520 | 07/09/2012 19:12:04 | 1,079,225 | 12/03/2011 17:37:12 | 115 | 2 | `xdotool type ` - randomly repeats characters | I'm writing a script to automate work environment preparation.
I need to open 4 terminal window, arrange them at screen and execute commands in each of them.
It works, but sometimes I get nasty fails - `xdotoll type` **randomly repeats some characters**.
rvm use ruby-1.99999999999999999999999999999999.3-p194@ro && rails c
~/my_src/ruby_apps/ro > rvm use ruby-1.99999999999999999999999999999999.3-p194@ro && rails c
ruby-1.99999999999999999999999999999999.3-p194 is not installed.
To install do: 'rvm install ruby-1.99999999999999999999999999999999.3-p194'
~/my_src/ruby_apps/ro >
or in the other window:
tail -fn 100 looooooog/thin.0.log
~/my_src/ruby_apps/ro > tail -fn 100 looooooog/thin.0.log
tail: could not open Β«looooooog/thin.0.logΒ» for reading: No such file or directory
tail: no more files
~/my_src/ruby_apps/ro >
I guess it depends on CPU load, cause I have really big .bashrc processed by ATOM and its load is high during script processing.
I use `wait` and `sleep` and special order of `open_lxterminal_execute_hold()` function invocations in the script toexecute simple simple commands first. That minimizes errors, but doesn't prevent them at all.
What would you suggest to get stable result regardless of CPU load(whatever)? It would be great to get rid of `sleep`s as well.
#!/bin/bash
#
# prepares work environment for rails project
# Opens lxterminal with title if windows with such title
# doesn't exist, executes command and stays open.
# Otherwise does nothing.
#
function open_lxterminal_execute_hold(){
local winid=`xwininfo -name $title 2>/dev/null |grep 'Window id:' |cut -d" " -f4`
if [ -n "$winid" ]; then
echo "Window for title '$title' exists with '$winid'"
else
lxterminal -t $title
sleep 1
wmctrl -i -a "$winid" # bring the window to front, activate
wait
xdotool type "$command"
wait
xdotool key Return # run the command
wait
fi
}
pkill devilspie
cd ~/my_src/ruby_apps/ro # TODO param
title='rails-commandline'; command='ls'; open_lxterminal_execute_hold
title='rails-development.log'; command='tail -fn 100 log/development.log'; open_lxterminal_execute_hold
title='rails-user_case'; command='tail -fn 100 log/thin.0.log'; open_lxterminal_execute_hold
sleep 5
title='rails-console'; command='rvm use ruby-1.9.3-p194@ro && rails c'; open_lxterminal_execute_hold
/usr/bin/devilspie -a 2>/dev/null & # arrange windows
| bash | automation | null | null | null | null | open | `xdotool type ` - randomly repeats characters
===
I'm writing a script to automate work environment preparation.
I need to open 4 terminal window, arrange them at screen and execute commands in each of them.
It works, but sometimes I get nasty fails - `xdotoll type` **randomly repeats some characters**.
rvm use ruby-1.99999999999999999999999999999999.3-p194@ro && rails c
~/my_src/ruby_apps/ro > rvm use ruby-1.99999999999999999999999999999999.3-p194@ro && rails c
ruby-1.99999999999999999999999999999999.3-p194 is not installed.
To install do: 'rvm install ruby-1.99999999999999999999999999999999.3-p194'
~/my_src/ruby_apps/ro >
or in the other window:
tail -fn 100 looooooog/thin.0.log
~/my_src/ruby_apps/ro > tail -fn 100 looooooog/thin.0.log
tail: could not open Β«looooooog/thin.0.logΒ» for reading: No such file or directory
tail: no more files
~/my_src/ruby_apps/ro >
I guess it depends on CPU load, cause I have really big .bashrc processed by ATOM and its load is high during script processing.
I use `wait` and `sleep` and special order of `open_lxterminal_execute_hold()` function invocations in the script toexecute simple simple commands first. That minimizes errors, but doesn't prevent them at all.
What would you suggest to get stable result regardless of CPU load(whatever)? It would be great to get rid of `sleep`s as well.
#!/bin/bash
#
# prepares work environment for rails project
# Opens lxterminal with title if windows with such title
# doesn't exist, executes command and stays open.
# Otherwise does nothing.
#
function open_lxterminal_execute_hold(){
local winid=`xwininfo -name $title 2>/dev/null |grep 'Window id:' |cut -d" " -f4`
if [ -n "$winid" ]; then
echo "Window for title '$title' exists with '$winid'"
else
lxterminal -t $title
sleep 1
wmctrl -i -a "$winid" # bring the window to front, activate
wait
xdotool type "$command"
wait
xdotool key Return # run the command
wait
fi
}
pkill devilspie
cd ~/my_src/ruby_apps/ro # TODO param
title='rails-commandline'; command='ls'; open_lxterminal_execute_hold
title='rails-development.log'; command='tail -fn 100 log/development.log'; open_lxterminal_execute_hold
title='rails-user_case'; command='tail -fn 100 log/thin.0.log'; open_lxterminal_execute_hold
sleep 5
title='rails-console'; command='rvm use ruby-1.9.3-p194@ro && rails c'; open_lxterminal_execute_hold
/usr/bin/devilspie -a 2>/dev/null & # arrange windows
| 0 |
11,401,521 | 07/09/2012 19:12:04 | 1,490,145 | 06/29/2012 02:42:01 | 71 | 0 | adding and removing class is not working correctly | I have a php code where it displays buttons from A-Z:
<table id="optionAndAnswer" class="optionAndAnswer">
<tr class="answer">
<td>3. Answer</td>
<td>
<?php
$a = range("A","Z");
?>
<table id="answerSection">
<tr>
<?php
$i = 1;
foreach($a as $key => $val){
if($i%7 == 1) echo"<tr><td>";
echo"<input type=\"button\" onclick=\"btnclick(this);\" value=\"$val\" id=\"answer".$val."\" name=\"answer".$val."Name\" class=\"answerBtns answers answerBtnsOff\">";
if($i%7 == 0) echo"</td></tr>";
$i++;
}
?>
...
Now these buttons should turn on and turn off using ".answerBtnsOn" and ".answerBtnsOff"
E.g If the letter is "B", then highlight button B and unhighlight the other buttons. If there are multiple letters such as A C, then highlight buttons A and C and unhighlight all the other buttons.
The problem I have is that it highlights the buttons which should be turned on, but it doesn't unhighlight (turn off) the other buttons. So if button B was highlighted but now the answer is A and C, it should turn on only buttons A and C and all other buttons should be turned off but this doesn't happen as button B is still turned on along with A and C.
So my question is that how can I turn off the buttons that should turned off. At the moment it is turning on the correct buttons but not turning off the other buttons.
Below is current code:
var answers = $.map(btn.split(''),function(chr){ return "#answer"+chr; }).join(', ');
$(answers).removeClass('answerBtnsOn').addClass('answerBtnsOff');
$(answers).addClass("answerBtnsOn").siblings().addClass('answerBtnsOff'); | jquery | null | null | null | null | null | open | adding and removing class is not working correctly
===
I have a php code where it displays buttons from A-Z:
<table id="optionAndAnswer" class="optionAndAnswer">
<tr class="answer">
<td>3. Answer</td>
<td>
<?php
$a = range("A","Z");
?>
<table id="answerSection">
<tr>
<?php
$i = 1;
foreach($a as $key => $val){
if($i%7 == 1) echo"<tr><td>";
echo"<input type=\"button\" onclick=\"btnclick(this);\" value=\"$val\" id=\"answer".$val."\" name=\"answer".$val."Name\" class=\"answerBtns answers answerBtnsOff\">";
if($i%7 == 0) echo"</td></tr>";
$i++;
}
?>
...
Now these buttons should turn on and turn off using ".answerBtnsOn" and ".answerBtnsOff"
E.g If the letter is "B", then highlight button B and unhighlight the other buttons. If there are multiple letters such as A C, then highlight buttons A and C and unhighlight all the other buttons.
The problem I have is that it highlights the buttons which should be turned on, but it doesn't unhighlight (turn off) the other buttons. So if button B was highlighted but now the answer is A and C, it should turn on only buttons A and C and all other buttons should be turned off but this doesn't happen as button B is still turned on along with A and C.
So my question is that how can I turn off the buttons that should turned off. At the moment it is turning on the correct buttons but not turning off the other buttons.
Below is current code:
var answers = $.map(btn.split(''),function(chr){ return "#answer"+chr; }).join(', ');
$(answers).removeClass('answerBtnsOn').addClass('answerBtnsOff');
$(answers).addClass("answerBtnsOn").siblings().addClass('answerBtnsOff'); | 0 |
11,401,525 | 07/09/2012 19:12:16 | 1,171,848 | 01/26/2012 17:34:46 | 9 | 0 | eclipse juno bold filenames in open resources dropdown | Eclipse Indigo offered bold filenames in the drop-down list of open resources. A bold filename indicated that the file was open but not an active tab. If I remember correctly, the list of filenames was also sorted alphabetically.
Eclipse Juno by default doesn't bold any of the filenames in this list, and they are also sorted by most recently opened. I assume that the addition quick access search bar had something to do with this.
The quick access bar is a useful new feature; however, is there any way of re-enabling the options for bolded filenames in the drop-down and sorting of resources alphabetically?
| eclipse-juno | null | null | null | null | null | open | eclipse juno bold filenames in open resources dropdown
===
Eclipse Indigo offered bold filenames in the drop-down list of open resources. A bold filename indicated that the file was open but not an active tab. If I remember correctly, the list of filenames was also sorted alphabetically.
Eclipse Juno by default doesn't bold any of the filenames in this list, and they are also sorted by most recently opened. I assume that the addition quick access search bar had something to do with this.
The quick access bar is a useful new feature; however, is there any way of re-enabling the options for bolded filenames in the drop-down and sorting of resources alphabetically?
| 0 |
11,373,157 | 07/07/2012 07:29:14 | 1,233,542 | 02/26/2012 07:57:21 | 1 | 1 | One-page website + AJAX + History.js + googlebot | I am building a sliding one-page website with the following structure:
<div id="wrapper">
<div id="ajax_content">
// AJAX action fires on document ready (jquery) and loads ALL pages in here
// then I slide to the correct page-panel found via URL
</div>
<noscript>
// Normal rendering of the SINGLE page that was requested by the url
</noscript>
</div>
I am using History.js, so I don't have hashbanged URLs. All (menu-)links to the several pages are just normal links with a `data-page` attribute that `return false` by JS.
**I want google to index all pages seperately.**
The problem I am facing is that all documentation I found about ajaxed websites state that google needs hashbangs.
So if I only have normal URLs in my `href` tags, google won't do any ajax actions, right?
Other question: Google will read the `<noscript>` tag. But as the content of the noscript is different than content shown to users, will google see this approach as cloaking?
Google states:
> Ensure that you provide the same content in both elements (for instance, provide the same text in the JavaScript as in the noscript tag). Including substantially different content in the alternate element may cause Google to take action on the site.
What do you think about this approach? | html | ajax | google | cloaking | null | null | open | One-page website + AJAX + History.js + googlebot
===
I am building a sliding one-page website with the following structure:
<div id="wrapper">
<div id="ajax_content">
// AJAX action fires on document ready (jquery) and loads ALL pages in here
// then I slide to the correct page-panel found via URL
</div>
<noscript>
// Normal rendering of the SINGLE page that was requested by the url
</noscript>
</div>
I am using History.js, so I don't have hashbanged URLs. All (menu-)links to the several pages are just normal links with a `data-page` attribute that `return false` by JS.
**I want google to index all pages seperately.**
The problem I am facing is that all documentation I found about ajaxed websites state that google needs hashbangs.
So if I only have normal URLs in my `href` tags, google won't do any ajax actions, right?
Other question: Google will read the `<noscript>` tag. But as the content of the noscript is different than content shown to users, will google see this approach as cloaking?
Google states:
> Ensure that you provide the same content in both elements (for instance, provide the same text in the JavaScript as in the noscript tag). Including substantially different content in the alternate element may cause Google to take action on the site.
What do you think about this approach? | 0 |
11,373,205 | 07/07/2012 07:37:13 | 870,448 | 07/30/2011 07:50:13 | 23 | 1 | parse json array to normal array in android | i have JSON data from php -it's one dimensional array-:
{pair:["-8.5745000,115.3735700","-8.5683300,115.3733700","-8.5683300,115.3733700","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5764900,115.4007400","-8.5764900,115.4007400","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5656400,115.4156400","-8.5656400,115.4156400","-8.5565200,115.4122800","-8.5565200,115.4122800","-8.5566200,115.4110500","-8.5566200,115.4110500","-8.5560700,115.4112200","-8.5560700,115.4112200","-8.5554200,115.4112800","-8.5554200,115.4112800","-8.5527200,115.4025400","-8.5527200,115.4025400","-8.5424000,115.4027000","-8.5424000,115.4027000","-8.5426600,115.4055800","-8.5426600,115.4055800","-8.5377000,115.4057200","-8.5377000,115.4057200","-8.5375900,115.4034500","-8.5375900,115.4034500","-8.5358900,115.4036500","-8.5358900,115.4036500","-8.5358800,115.4033400"]}
and in android i want to save that JSON array to an array so i would like to get array like this
pair=["-8.5745000,115.3735700","-8.5683300,115.3733700","-8.5683300,115.3733700","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5764900,115.4007400","-8.5764900,115.4007400","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5656400,115.4156400","-8.5656400,115.4156400","-8.5565200,115.4122800","-8.5565200,115.4122800","-8.5566200,115.4110500","-8.5566200,115.4110500","-8.5560700,115.4112200","-8.5560700,115.4112200","-8.5554200,115.4112800","-8.5554200,115.4112800","-8.5527200,115.4025400","-8.5527200,115.4025400","-8.5424000,115.4027000","-8.5424000,115.4027000","-8.5426600,115.4055800","-8.5426600,115.4055800","-8.5377000,115.4057200","-8.5377000,115.4057200","-8.5375900,115.4034500","-8.5375900,115.4034500","-8.5358900,115.4036500","-8.5358900,115.4036500","-8.5358800,115.4033400"]
im trying this
String []pairs=null;
String hasil = "";
hasil = getRequest(url);
try
{
jObject = new JSONObject(hasil);
JSONArray myArray = jObject.getJSONArray("pair");
for(int i = 0; i < myArray.length(); i++)
{
pairs[i]= myArray.get(i).toString();
}
}
catch (JSONException e)
{
e.printStackTrace();
}
teks1 = (TextView)findViewById(R.id.textView1);
teks1.setText(hasil);
but still didnt work | android | arrays | json | null | null | null | open | parse json array to normal array in android
===
i have JSON data from php -it's one dimensional array-:
{pair:["-8.5745000,115.3735700","-8.5683300,115.3733700","-8.5683300,115.3733700","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5764900,115.4007400","-8.5764900,115.4007400","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5656400,115.4156400","-8.5656400,115.4156400","-8.5565200,115.4122800","-8.5565200,115.4122800","-8.5566200,115.4110500","-8.5566200,115.4110500","-8.5560700,115.4112200","-8.5560700,115.4112200","-8.5554200,115.4112800","-8.5554200,115.4112800","-8.5527200,115.4025400","-8.5527200,115.4025400","-8.5424000,115.4027000","-8.5424000,115.4027000","-8.5426600,115.4055800","-8.5426600,115.4055800","-8.5377000,115.4057200","-8.5377000,115.4057200","-8.5375900,115.4034500","-8.5375900,115.4034500","-8.5358900,115.4036500","-8.5358900,115.4036500","-8.5358800,115.4033400"]}
and in android i want to save that JSON array to an array so i would like to get array like this
pair=["-8.5745000,115.3735700","-8.5683300,115.3733700","-8.5683300,115.3733700","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5764900,115.4007400","-8.5764900,115.4007400","-8.5687800,115.3997700","-8.5687800,115.3997700","-8.5656400,115.4156400","-8.5656400,115.4156400","-8.5565200,115.4122800","-8.5565200,115.4122800","-8.5566200,115.4110500","-8.5566200,115.4110500","-8.5560700,115.4112200","-8.5560700,115.4112200","-8.5554200,115.4112800","-8.5554200,115.4112800","-8.5527200,115.4025400","-8.5527200,115.4025400","-8.5424000,115.4027000","-8.5424000,115.4027000","-8.5426600,115.4055800","-8.5426600,115.4055800","-8.5377000,115.4057200","-8.5377000,115.4057200","-8.5375900,115.4034500","-8.5375900,115.4034500","-8.5358900,115.4036500","-8.5358900,115.4036500","-8.5358800,115.4033400"]
im trying this
String []pairs=null;
String hasil = "";
hasil = getRequest(url);
try
{
jObject = new JSONObject(hasil);
JSONArray myArray = jObject.getJSONArray("pair");
for(int i = 0; i < myArray.length(); i++)
{
pairs[i]= myArray.get(i).toString();
}
}
catch (JSONException e)
{
e.printStackTrace();
}
teks1 = (TextView)findViewById(R.id.textView1);
teks1.setText(hasil);
but still didnt work | 0 |
11,373,216 | 07/07/2012 07:38:39 | 1,501,969 | 07/04/2012 15:27:53 | 4 | 0 | Password recovery not sending email. | I have a hyperlink which is build inside a LoginView and the text is set to "forgot password".
Upon clicking the hyperlink, the password recovery control will pops up (with the implementation of AJAX ModalPopUp extender).The modalpopup work well. But the problem is, after entering username and in step2 after the user had answered his/her security answer and when on hit on the "submit" button, it does not proceed to step 3 and no email was send.
However, the password was changed in the database (I tried to log in with the username and old password and it did not work).
Here is the code at passwordrecover.aspx :
<asp:HyperLink ID="HyperLink2" runat="server"
style="margin-top:15px; text-align: right;">Forget Password</asp:HyperLink>
<asp:ModalPopupExtender
ID="HyperLink2_ModalPopupExtender"
runat="server"
BackgroundCssClass="modalBackground"
DynamicServicePath=""
Enabled="True"
PopupControlID="Panel1"
TargetControlID="HyperLink2" >
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1"
runat="server"
BackColor="White"
BorderColor="Black"
BorderStyle="Solid"
BorderWidth="2px"
Height="200px"
Width="360px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"
onsendingmail="PasswordRecovery1_SendingMail">
<MailDefinition BodyFileName="~/EmailTemplates/ResetPassword.htm"
From="[email protected]" IsBodyHtml="True" Priority="High"
Subject="Request on the password reset for BedOfRoses's account.">
</MailDefinition>
</asp:PasswordRecovery>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
Here is the code behind:
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
System.Web.UI.WebControls.PasswordRecovery PasswordRecovery1 = (System.Web.UI.WebControls.PasswordRecovery)LoginView1.FindControl("PasswordRecovery1");
MembershipUser pwRecover = Membership.GetUser(PasswordRecovery1.UserName);
Guid userInfoId2 = (Guid)pwRecover.ProviderUserKey;
//Create an url that will link to a UserProfile.aspx and
//accept a query string that is the user's id
//setup the base of the url
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
//setup the second half of the url
string confirmationPage = "/Members/UserProfile.aspx?ID=" + userInfoId2.ToString();
//combine to make the final url
string url = domainName + confirmationPage;
// Replace <%VerifyUrl%> placeholder with url value
e.Message.Body = e.Message.Body.Replace("<%ResetPassword%>", url);
}
* If I remove the password recovery control from the ModalPopUp, the whole control work perfectly. Only when it is build inside the ModalPopUp, it could not proceed to the last step and no email was send. Yet the user could not logged in when his/her username and old password.
| c# | asp.net | ajax | forgot-password | password-recovery | null | open | Password recovery not sending email.
===
I have a hyperlink which is build inside a LoginView and the text is set to "forgot password".
Upon clicking the hyperlink, the password recovery control will pops up (with the implementation of AJAX ModalPopUp extender).The modalpopup work well. But the problem is, after entering username and in step2 after the user had answered his/her security answer and when on hit on the "submit" button, it does not proceed to step 3 and no email was send.
However, the password was changed in the database (I tried to log in with the username and old password and it did not work).
Here is the code at passwordrecover.aspx :
<asp:HyperLink ID="HyperLink2" runat="server"
style="margin-top:15px; text-align: right;">Forget Password</asp:HyperLink>
<asp:ModalPopupExtender
ID="HyperLink2_ModalPopupExtender"
runat="server"
BackgroundCssClass="modalBackground"
DynamicServicePath=""
Enabled="True"
PopupControlID="Panel1"
TargetControlID="HyperLink2" >
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1"
runat="server"
BackColor="White"
BorderColor="Black"
BorderStyle="Solid"
BorderWidth="2px"
Height="200px"
Width="360px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"
onsendingmail="PasswordRecovery1_SendingMail">
<MailDefinition BodyFileName="~/EmailTemplates/ResetPassword.htm"
From="[email protected]" IsBodyHtml="True" Priority="High"
Subject="Request on the password reset for BedOfRoses's account.">
</MailDefinition>
</asp:PasswordRecovery>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
Here is the code behind:
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
System.Web.UI.WebControls.PasswordRecovery PasswordRecovery1 = (System.Web.UI.WebControls.PasswordRecovery)LoginView1.FindControl("PasswordRecovery1");
MembershipUser pwRecover = Membership.GetUser(PasswordRecovery1.UserName);
Guid userInfoId2 = (Guid)pwRecover.ProviderUserKey;
//Create an url that will link to a UserProfile.aspx and
//accept a query string that is the user's id
//setup the base of the url
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
//setup the second half of the url
string confirmationPage = "/Members/UserProfile.aspx?ID=" + userInfoId2.ToString();
//combine to make the final url
string url = domainName + confirmationPage;
// Replace <%VerifyUrl%> placeholder with url value
e.Message.Body = e.Message.Body.Replace("<%ResetPassword%>", url);
}
* If I remove the password recovery control from the ModalPopUp, the whole control work perfectly. Only when it is build inside the ModalPopUp, it could not proceed to the last step and no email was send. Yet the user could not logged in when his/her username and old password.
| 0 |
11,373,217 | 07/07/2012 07:38:49 | 1,394,586 | 05/14/2012 20:00:34 | 1 | 0 | Virtuemart and automatic import of a file in my database |
I would like to convert a txt file to excel and then modify certain data inside the excel file and then import this new excel file to a database using PHP. The contents of the excel file, for example, will be with products and prices of them and the modification will be on the prices.So the update of the products on the database and on the website will be automatic.So I am planning to use Joomla with Virtuemart and I would like to ask if virtuemart allows me to do this? | php | excel | joomla | convert | virtuemart | null | open | Virtuemart and automatic import of a file in my database
===
I would like to convert a txt file to excel and then modify certain data inside the excel file and then import this new excel file to a database using PHP. The contents of the excel file, for example, will be with products and prices of them and the modification will be on the prices.So the update of the products on the database and on the website will be automatic.So I am planning to use Joomla with Virtuemart and I would like to ask if virtuemart allows me to do this? | 0 |
11,373,215 | 07/07/2012 07:38:32 | 1,091,511 | 12/10/2011 18:06:45 | 17 | 0 | json string becomes null in action class in struts 1.3.8 | i am developing a web application in struts 1.3.8 i am using $.ajax() jquery to post json data into my action class but i am receiving null .my code
var dataobj={data:[{code:code1,hd1:h1,hd2:h2}]};
$.ajax(
{
url: "EditablePage.do?data="+dataobj,
dataType: "json",
method:"POST",
data:dataobj
});
java code
String data=request.getParameter("data");
JSONObject jObj = new JSONObject();
JSONObject newObj=jObj.getJSONObject(data);
**String data=request.getParameter("data");**
this is becoming null not understanding where i am doing wrong iam new in Jquery, any hint would be a great help for me | java | ajax | null | null | null | null | open | json string becomes null in action class in struts 1.3.8
===
i am developing a web application in struts 1.3.8 i am using $.ajax() jquery to post json data into my action class but i am receiving null .my code
var dataobj={data:[{code:code1,hd1:h1,hd2:h2}]};
$.ajax(
{
url: "EditablePage.do?data="+dataobj,
dataType: "json",
method:"POST",
data:dataobj
});
java code
String data=request.getParameter("data");
JSONObject jObj = new JSONObject();
JSONObject newObj=jObj.getJSONObject(data);
**String data=request.getParameter("data");**
this is becoming null not understanding where i am doing wrong iam new in Jquery, any hint would be a great help for me | 0 |
11,373,223 | 07/07/2012 07:40:38 | 1,262,638 | 03/11/2012 17:48:03 | 10 | 2 | SQLite syntax error: while compiling: UPDATE contacts SET name=? WHERE phone=+34 | In my project, there's a peace of code that is waiting to be called by ContentObserver when there's a change on the contact table. When it happens, i check every contact in the table one by one if had been changed or one had been created. Then depending on this I save my changes on my own table. But it gives me errors. There's my code:
while (phones.moveToNext()) {
try {
name = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
phoneNumber = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
JSONObject jobject = db.select_contact(name, phoneNumber);
String type1 = jobject.getString("type");
if (type1.equals("upload")) {
Log.i("********", "Upload on the db" + name + " "
+ phoneNumber);
db.contact_table(name, phoneNumber);
} else if (type1.equals("change_name")) {
db.update_name(name, phoneNumber);
Log.i("********", "Change name and upload " + name);
} else if (type1.equals("change_phone")) {
db.update_name(name, phoneNumber);
Log.i("********", "Change phone and upload "
+ phoneNumber);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
And there's the part where i upload it to my own table created by me:
public long update_name(String name, String number) {
ContentValues cv = new ContentValues();
cv.put(NAME, name);
return ourDatabase.update(DATABASE_TABLE_4, cv, NUMBER + "=" + number,
null);
}
public long update_number(String name, String number) {
ContentValues cv = new ContentValues();
cv.put(NUMBER, number);
return ourDatabase
.update(DATABASE_TABLE_4, cv, NAME + "=" + name, null);
}
The problem is that on the part of upload changes on the DB, it gives me this errors:
> 07-07 09:28:41.412: W/System.err(11667): android.database.sqlite.SQLiteException: near "629": syntax error: , while compiling: UPDATE contacts SET name=? WHERE phone=+34 629 21 00 80
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:260)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:84)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1936)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1887)
07-07 09:28:41.412: W/System.err(11667): at com.background.Database.update_name(Database.java:215)
07-07 09:28:41.417: W/System.err(11667): at com.extract.Contacts.onChange(Contacts.java:69)
07-07 09:28:41.417: W/System.err(11667): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:43)
07-07 09:28:41.417: W/System.err(11667): at android.os.Handler.handleCallback(Handler.java:605)
07-07 09:28:41.417: W/System.err(11667): at android.os.Handler.dispatchMessage(Handler.java:92)
07-07 09:28:41.417: W/System.err(11667): at android.os.Looper.loop(Looper.java:137)
07-07 09:28:41.417: W/System.err(11667): at android.app.ActivityThread.main(ActivityThread.java:4507)
07-07 09:28:41.422: W/System.err(11667): at java.lang.reflect.Method.invokeNative(Native Method)
07-07 09:28:41.422: W/System.err(11667): at java.lang.reflect.Method.invoke(Method.java:511)
07-07 09:28:41.422: W/System.err(11667): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-07 09:28:41.422: W/System.err(11667): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-07 09:28:41.422: W/System.err(11667): at dalvik.system.NativeStart.main(Native Method)
Thanks for advanced! :) | android | sqlite | contacts | null | null | null | open | SQLite syntax error: while compiling: UPDATE contacts SET name=? WHERE phone=+34
===
In my project, there's a peace of code that is waiting to be called by ContentObserver when there's a change on the contact table. When it happens, i check every contact in the table one by one if had been changed or one had been created. Then depending on this I save my changes on my own table. But it gives me errors. There's my code:
while (phones.moveToNext()) {
try {
name = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
phoneNumber = phones
.getString(phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
JSONObject jobject = db.select_contact(name, phoneNumber);
String type1 = jobject.getString("type");
if (type1.equals("upload")) {
Log.i("********", "Upload on the db" + name + " "
+ phoneNumber);
db.contact_table(name, phoneNumber);
} else if (type1.equals("change_name")) {
db.update_name(name, phoneNumber);
Log.i("********", "Change name and upload " + name);
} else if (type1.equals("change_phone")) {
db.update_name(name, phoneNumber);
Log.i("********", "Change phone and upload "
+ phoneNumber);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
And there's the part where i upload it to my own table created by me:
public long update_name(String name, String number) {
ContentValues cv = new ContentValues();
cv.put(NAME, name);
return ourDatabase.update(DATABASE_TABLE_4, cv, NUMBER + "=" + number,
null);
}
public long update_number(String name, String number) {
ContentValues cv = new ContentValues();
cv.put(NUMBER, number);
return ourDatabase
.update(DATABASE_TABLE_4, cv, NAME + "=" + name, null);
}
The problem is that on the part of upload changes on the DB, it gives me this errors:
> 07-07 09:28:41.412: W/System.err(11667): android.database.sqlite.SQLiteException: near "629": syntax error: , while compiling: UPDATE contacts SET name=? WHERE phone=+34 629 21 00 80
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:260)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:84)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1936)
07-07 09:28:41.412: W/System.err(11667): at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1887)
07-07 09:28:41.412: W/System.err(11667): at com.background.Database.update_name(Database.java:215)
07-07 09:28:41.417: W/System.err(11667): at com.extract.Contacts.onChange(Contacts.java:69)
07-07 09:28:41.417: W/System.err(11667): at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:43)
07-07 09:28:41.417: W/System.err(11667): at android.os.Handler.handleCallback(Handler.java:605)
07-07 09:28:41.417: W/System.err(11667): at android.os.Handler.dispatchMessage(Handler.java:92)
07-07 09:28:41.417: W/System.err(11667): at android.os.Looper.loop(Looper.java:137)
07-07 09:28:41.417: W/System.err(11667): at android.app.ActivityThread.main(ActivityThread.java:4507)
07-07 09:28:41.422: W/System.err(11667): at java.lang.reflect.Method.invokeNative(Native Method)
07-07 09:28:41.422: W/System.err(11667): at java.lang.reflect.Method.invoke(Method.java:511)
07-07 09:28:41.422: W/System.err(11667): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-07 09:28:41.422: W/System.err(11667): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-07 09:28:41.422: W/System.err(11667): at dalvik.system.NativeStart.main(Native Method)
Thanks for advanced! :) | 0 |
11,373,238 | 07/07/2012 07:43:25 | 1,508,411 | 07/07/2012 07:38:38 | 1 | 0 | java.lang.RuntimeException: An error occured while executing doInBackground() | java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 695): at android.os.AsyncTask$3.done(AsyncTask.java:200)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime( 695): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
E/AndroidRuntime( 695): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
E/AndroidRuntime( 695): at java.lang.Thread.run(Thread.java:1096)
E/AndroidRuntime( 695): Caused by: java.lang.NoClassDefFoundError: com.google.gson.Gson
E/AndroidRuntime( 695): at com.amphisoft.mebox.LoginActivity$LoginTask.doInBackground(LoginActivity.java:167)
E/AndroidRuntime( 695): at com.amphisoft.mebox.LoginActivity$LoginTask.doInBackground(LoginActivity.java:1)
E/AndroidRuntime( 695): at android.os.AsyncTask$2.call(AsyncTask.java:185)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime( 695): ... 4 more
This is my code..
protected User doInBackground(User... user) {
HttpClient httpClient = new DefaultHttpClient();
try {
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("username", user[0].username);
parameters.put("password", user[0].password);
String response = HTTPUtil.post("/user/login.json", parameters,
null);
System.out.println("Response:" + response);
Gson gson = new Gson();
User userObj = gson.fromJson(response, User.class);
Store.getInstance().user = userObj;
}
I tried adding gson-2.1jar many times in the library.. But getting the same error as class definition not found.. Please help me. Thanks in advance.. | android | null | null | null | null | null | open | java.lang.RuntimeException: An error occured while executing doInBackground()
===
java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 695): at android.os.AsyncTask$3.done(AsyncTask.java:200)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime( 695): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
E/AndroidRuntime( 695): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
E/AndroidRuntime( 695): at java.lang.Thread.run(Thread.java:1096)
E/AndroidRuntime( 695): Caused by: java.lang.NoClassDefFoundError: com.google.gson.Gson
E/AndroidRuntime( 695): at com.amphisoft.mebox.LoginActivity$LoginTask.doInBackground(LoginActivity.java:167)
E/AndroidRuntime( 695): at com.amphisoft.mebox.LoginActivity$LoginTask.doInBackground(LoginActivity.java:1)
E/AndroidRuntime( 695): at android.os.AsyncTask$2.call(AsyncTask.java:185)
E/AndroidRuntime( 695): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime( 695): ... 4 more
This is my code..
protected User doInBackground(User... user) {
HttpClient httpClient = new DefaultHttpClient();
try {
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("username", user[0].username);
parameters.put("password", user[0].password);
String response = HTTPUtil.post("/user/login.json", parameters,
null);
System.out.println("Response:" + response);
Gson gson = new Gson();
User userObj = gson.fromJson(response, User.class);
Store.getInstance().user = userObj;
}
I tried adding gson-2.1jar many times in the library.. But getting the same error as class definition not found.. Please help me. Thanks in advance.. | 0 |
11,373,239 | 07/07/2012 07:43:30 | 568,651 | 01/09/2011 08:38:42 | 57 | 2 | How to match part of a field with data in another field with wuery? | I have 2 tables table1 and table2
table1 contains a field named `id` with a value `1212`(example) in it.
table2 has a field named `action` with a data like `added 1212` or `updated 1212`.
now check this query.
SELECT t1.*, t2.name
FROM table1 t1, table2 t2
WHERE t2.action LIKE 'added t1.id'
want to add the `name` field in the second table, to first one with the `added`(`updated` not needed) data only.
what is the where clause for this condition?
how can I query this?
please help. | mysql | sql | null | null | null | null | open | How to match part of a field with data in another field with wuery?
===
I have 2 tables table1 and table2
table1 contains a field named `id` with a value `1212`(example) in it.
table2 has a field named `action` with a data like `added 1212` or `updated 1212`.
now check this query.
SELECT t1.*, t2.name
FROM table1 t1, table2 t2
WHERE t2.action LIKE 'added t1.id'
want to add the `name` field in the second table, to first one with the `added`(`updated` not needed) data only.
what is the where clause for this condition?
how can I query this?
please help. | 0 |
11,373,240 | 07/07/2012 07:43:36 | 1,448,567 | 06/11/2012 09:17:57 | 1 | 0 | Android Error java.lang.OutOfMemoryError: bitmap size exceeds VM budget | Am getting Exception error when loading images from assets to arraylist<drawable>.
this is the error in log cat:
***E/AndroidRuntime(2837): java.lang.OutOfMemoryError: bitmap size exceeds VM budget***
Please some one help me with this,Thanks in advance
| android | null | null | null | null | null | open | Android Error java.lang.OutOfMemoryError: bitmap size exceeds VM budget
===
Am getting Exception error when loading images from assets to arraylist<drawable>.
this is the error in log cat:
***E/AndroidRuntime(2837): java.lang.OutOfMemoryError: bitmap size exceeds VM budget***
Please some one help me with this,Thanks in advance
| 0 |
11,542,064 | 07/18/2012 13:03:37 | 231,216 | 12/14/2009 11:59:17 | 4,657 | 142 | REST URI Templates for Query and Command operations | We have an application that is split into two parts:
1. Admin - Where data is changed
2. Public - Where data is read
I'm looking at creating a REST API to provide this functionality. It's very easy to see how CRUD operations can be represented but I am not sure about specific operations (commands) on an individual resource. For example to "Publish" a `Project` we send a "PublishCommand". We don't PUT the full `Project` back to the server with its `Published` property set to `true`.
On a similar note, I am a little confused at how we should represent more advanced query operations on resources without being classed as a RPC type service.
Below I've listed the URI templates for my `Project` resource. Am I on the right track for creating a truly RESTful API?
ADMIN API
---------
// Project Resources
GET /projects -- get all projects
POST /projects -- create a new project
// Project Resource
GET /projects/10 -- get project with id 10
PUT /projects/10 -- update project with id 10
DELETE /projects/10 -- delete project with id 10
// Project Resource Operations
POST: /projects/10/publish -- publish project with id 10
POST: /projects/10/unpublish -- unpublish project with id 10
POST: /projects/10/setposition/2 -- move to position 2 in projects list
// Project Sub resources (identity is local to project)
POST: /projects/10/media -- adds media to project with id 10
PUT: /projects/10/media/5 -- updates media id 5 for project id 10
DELETE: /projects/10/media/5 -- deletes media id 5 from project id 10
PUBLIC API
----------
GET: /projects -- gets all projects (with default limit e.g. first 10)
GET: /projects?skip=10&take=10 -- gets projects 11 to 20
GET: /projects/tagged/rest OR /taggedprojects/rest -- gets projects tagged with "REST"
GET: /projects?orderbydesc=publishdate OR /latestprojects -- gets latest projects
GET: /projects/10 -- gets project with id 10
| rest | asp.net-web-api | null | null | null | null | open | REST URI Templates for Query and Command operations
===
We have an application that is split into two parts:
1. Admin - Where data is changed
2. Public - Where data is read
I'm looking at creating a REST API to provide this functionality. It's very easy to see how CRUD operations can be represented but I am not sure about specific operations (commands) on an individual resource. For example to "Publish" a `Project` we send a "PublishCommand". We don't PUT the full `Project` back to the server with its `Published` property set to `true`.
On a similar note, I am a little confused at how we should represent more advanced query operations on resources without being classed as a RPC type service.
Below I've listed the URI templates for my `Project` resource. Am I on the right track for creating a truly RESTful API?
ADMIN API
---------
// Project Resources
GET /projects -- get all projects
POST /projects -- create a new project
// Project Resource
GET /projects/10 -- get project with id 10
PUT /projects/10 -- update project with id 10
DELETE /projects/10 -- delete project with id 10
// Project Resource Operations
POST: /projects/10/publish -- publish project with id 10
POST: /projects/10/unpublish -- unpublish project with id 10
POST: /projects/10/setposition/2 -- move to position 2 in projects list
// Project Sub resources (identity is local to project)
POST: /projects/10/media -- adds media to project with id 10
PUT: /projects/10/media/5 -- updates media id 5 for project id 10
DELETE: /projects/10/media/5 -- deletes media id 5 from project id 10
PUBLIC API
----------
GET: /projects -- gets all projects (with default limit e.g. first 10)
GET: /projects?skip=10&take=10 -- gets projects 11 to 20
GET: /projects/tagged/rest OR /taggedprojects/rest -- gets projects tagged with "REST"
GET: /projects?orderbydesc=publishdate OR /latestprojects -- gets latest projects
GET: /projects/10 -- gets project with id 10
| 0 |
11,542,070 | 07/18/2012 13:03:47 | 859,154 | 07/23/2011 09:23:42 | 15,139 | 721 | Skype dial from Android Hangup? | I have installed `skype` (`2.8.0.920`) my `Android` (2.2 || 4.04 {*i have 2 mobiles*}) :
when I initiate a call by the following code :
Intent skype_intent = new Intent("android.intent.action.CALL_PRIVILEGED");
skype_intent.setClassName("com.skype.raider", "com.skype.raider.Main");
skype_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
skype_intent.setData(Uri.parse("tel:PassportCard"));
act.startActivity(skype_intent);
it starts dialign *and* hang up after 2 sec.
However , when i remove the current (`2.8.0.920`) skype app , and install the *previous* version , its working fine.
any help ?
| java | android | skype | null | null | null | open | Skype dial from Android Hangup?
===
I have installed `skype` (`2.8.0.920`) my `Android` (2.2 || 4.04 {*i have 2 mobiles*}) :
when I initiate a call by the following code :
Intent skype_intent = new Intent("android.intent.action.CALL_PRIVILEGED");
skype_intent.setClassName("com.skype.raider", "com.skype.raider.Main");
skype_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
skype_intent.setData(Uri.parse("tel:PassportCard"));
act.startActivity(skype_intent);
it starts dialign *and* hang up after 2 sec.
However , when i remove the current (`2.8.0.920`) skype app , and install the *previous* version , its working fine.
any help ?
| 0 |
11,542,073 | 07/18/2012 13:03:50 | 1,312,499 | 04/04/2012 09:52:51 | 5 | 0 | align ImageView 10dp left from center of Layout | Hi I want to position an ImageView which 10dp from centre of the layout. please suggest me to do it. I am using RelativeLayout. | android | android-layout | android-imageview | null | null | null | open | align ImageView 10dp left from center of Layout
===
Hi I want to position an ImageView which 10dp from centre of the layout. please suggest me to do it. I am using RelativeLayout. | 0 |
11,542,075 | 07/18/2012 13:03:52 | 1,065,754 | 11/25/2011 14:00:27 | 51 | 1 | sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.String | I'm using java 6 javax.script feature but I have an issue :
Before I call the ScriptEngine.eval() method I put some attributes to the ScriptContext:
scriptContext.setAttribute("Utils", utils, ScriptContext.ENGINE_SCOPE);
In the script I call :
var s = utils.getMyString()
The Java getMyString() method returns a String (java.lang.String).
The type of 's' in the scriptContext is sun.org.mozilla.javascript.internal.NativeJavaObject that wrap the Java String instance.
When I try to get the attribute from the context in Java with:
(String) scriptContext.getAttribute("s");
I got
java.lang.ClassCastException:
sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.String
When I write in the script:
var s = "hello world"
or
var s = "" + utils.getMyString()
or
var s = String(utils.getMyString())
all is well because these are javascript Strings that can be get from the scriptContext thanks to an internal conversion.
I think that NativeJavaObjects should be unwrapped (see sun.org.mozilla.javascript.internal.Wrapper.unwrap()) when they are released from the scriptContext.
So, is it a bug ? I have the same issue with java7u5.
I don't beleive that I would have to do :
var s = String(utils.getMyString())
to convert a Java String to a JavaScript String to be able to get it back as a Java String...
Thanks for your point of view. | java | javascript | rhino | javax.script | null | null | open | sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.String
===
I'm using java 6 javax.script feature but I have an issue :
Before I call the ScriptEngine.eval() method I put some attributes to the ScriptContext:
scriptContext.setAttribute("Utils", utils, ScriptContext.ENGINE_SCOPE);
In the script I call :
var s = utils.getMyString()
The Java getMyString() method returns a String (java.lang.String).
The type of 's' in the scriptContext is sun.org.mozilla.javascript.internal.NativeJavaObject that wrap the Java String instance.
When I try to get the attribute from the context in Java with:
(String) scriptContext.getAttribute("s");
I got
java.lang.ClassCastException:
sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.String
When I write in the script:
var s = "hello world"
or
var s = "" + utils.getMyString()
or
var s = String(utils.getMyString())
all is well because these are javascript Strings that can be get from the scriptContext thanks to an internal conversion.
I think that NativeJavaObjects should be unwrapped (see sun.org.mozilla.javascript.internal.Wrapper.unwrap()) when they are released from the scriptContext.
So, is it a bug ? I have the same issue with java7u5.
I don't beleive that I would have to do :
var s = String(utils.getMyString())
to convert a Java String to a JavaScript String to be able to get it back as a Java String...
Thanks for your point of view. | 0 |
11,542,078 | 07/18/2012 13:04:02 | 653,511 | 03/10/2011 12:26:42 | 793 | 25 | Try - Catch with spawn_link in Erlang | I'm new to Erlang. Right now, I'm learning about linking of processes.
I've confused a bit after next experiments:
1> process_flag( trap_exit, true ).
false
2> spawn_link( unknown_module, unknown_function, [] ).
<0.34.0>
3>
=ERROR REPORT==== 18-Jul-2012::15:55:00 ===
Error in process <0.34.0> with exit value: {undef,[{unknown_module,unknown_function,[],[]}]}
3> flush().
Shell got {'EXIT',<0.34.0>,{undef,[{unknown_module,unknown_function,[],[]}]}}
ok
4>
As I expected - first of all I've got Pid from created process, and it fails - because of unknown module and function - I've got back message about it. After that I've tried next:
4> try 1+1, spawn_link( unknown_module, unknown_function, [] ) of
4> Pid -> Pid
4> catch
4> _:_ -> err
4> end.
<0.37.0>
5>
=ERROR REPORT==== 18-Jul-2012::16:01:32 ===
Error in process <0.37.0> with exit value: {undef,[{unknown_module,unknown_function,[],[]}]}
5>
5> flush().
Shell got {'EXIT',<0.37.0>,{undef,[{unknown_module,unknown_function,[],[]}]}}
ok
I've got expected behaviour too.
But after this I've tried next:
6> try spawn_link( unknown_module, unknown_function, [] ) of
6> Pid -> Pid
6> catch
6> _:_ -> err
6> end.
** exception error: no try clause matching <0.40.0>
And I don't understand why interpreter process can't extract Pid and fails
Thanks | erlang | spawn | erlang-shell | null | null | null | open | Try - Catch with spawn_link in Erlang
===
I'm new to Erlang. Right now, I'm learning about linking of processes.
I've confused a bit after next experiments:
1> process_flag( trap_exit, true ).
false
2> spawn_link( unknown_module, unknown_function, [] ).
<0.34.0>
3>
=ERROR REPORT==== 18-Jul-2012::15:55:00 ===
Error in process <0.34.0> with exit value: {undef,[{unknown_module,unknown_function,[],[]}]}
3> flush().
Shell got {'EXIT',<0.34.0>,{undef,[{unknown_module,unknown_function,[],[]}]}}
ok
4>
As I expected - first of all I've got Pid from created process, and it fails - because of unknown module and function - I've got back message about it. After that I've tried next:
4> try 1+1, spawn_link( unknown_module, unknown_function, [] ) of
4> Pid -> Pid
4> catch
4> _:_ -> err
4> end.
<0.37.0>
5>
=ERROR REPORT==== 18-Jul-2012::16:01:32 ===
Error in process <0.37.0> with exit value: {undef,[{unknown_module,unknown_function,[],[]}]}
5>
5> flush().
Shell got {'EXIT',<0.37.0>,{undef,[{unknown_module,unknown_function,[],[]}]}}
ok
I've got expected behaviour too.
But after this I've tried next:
6> try spawn_link( unknown_module, unknown_function, [] ) of
6> Pid -> Pid
6> catch
6> _:_ -> err
6> end.
** exception error: no try clause matching <0.40.0>
And I don't understand why interpreter process can't extract Pid and fails
Thanks | 0 |
11,542,079 | 07/18/2012 13:04:03 | 511,029 | 11/17/2010 16:31:10 | 42 | 0 | Ios create pdf from array of byte | i want create a pdf from a stream of byte (that i receive from a wsdl), i have insert this stream of byte on NSArray but i don't know how write the pdf.
(This stream of byte is a pdf)
Thanks! | iphone | ios | ipad | pdf | null | null | open | Ios create pdf from array of byte
===
i want create a pdf from a stream of byte (that i receive from a wsdl), i have insert this stream of byte on NSArray but i don't know how write the pdf.
(This stream of byte is a pdf)
Thanks! | 0 |
11,542,080 | 07/18/2012 13:04:05 | 1,069,816 | 11/28/2011 17:15:13 | 46 | 2 | How do I set the Name of Net Named Pipes in WCF when hosted in ASP .NET? | First a bit of background:
I have a web server which runs 4 instances of the same ASP .NET application each one in a different culture (set in the web.config). Each of them has a webmethod "DoWork" which I would like to called via a single scheduled task. I have a simple exe which calls this method on each of the four cultures, simplified code:
Dim AUSclient As New AUSAutomated.AUSAutomatedClient()
AUSclient.DoWork
Dim GBRclient As New GBRAutomated.GBRAutomatedClient()
GBRclient.DoWork
Dim IRLclient As New IRLAutomated.IRLAutomatedClient()
IRLclient.DoWork
Dim NZLclient As New NZLAutomated.NZLAutomatedClient()
NZLclient.DoWork
In the task which is consuming the methods the app.config looks like this:
<endpoint address="net.pipe://localhost/Services/AUS/AUSAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IAUSAutomated"
contract="AUSAutomated.IAUSAutomated" name="NetNamedPipeBinding_IAUSAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/GBR/GBRAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IGBRAutomated"
contract="GBRAutomated.IGBRAutomated" name="NetNamedPipeBinding_IGBRAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/IRL/IRLAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IIRLAutomated"
contract="IRLAutomated.IIRLAutomated" name="NetNamedPipeBinding_IIRLAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/NZL/NZLAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_INZLAutomated"
contract="NZLAutomated.INZLAutomated" name="NetNamedPipeBinding_INZLAutomated">
</endpoint>
The application exposes the web method via WCF using a net named pipes binding. Each of the cultures has an entry in the web.config to point to the correct service. For example the Ireland one is:
<service name="Web.IRLAutomated">
<endpoint address="net.pipe://localhost/Services/IRL/IRLAutomated.svc" binding="netNamedPipeBinding" contract="Web.IIRLAutomated" />
</service>
So the exposed method for each culture has a different contract and address.
When the task runs it calls the Australian Method all 4 times. It seems to ignore the settings in the web.configs and call the method with the correct contract on the first application. So my question is:
**How can I set a unique pipe name for the method in each culture?**
I tried setting hostNameComparisonMode="Exact" on the binding but this doesn't seem to have made any difference.
| asp.net | .net | wcf | iis | named-pipes | null | open | How do I set the Name of Net Named Pipes in WCF when hosted in ASP .NET?
===
First a bit of background:
I have a web server which runs 4 instances of the same ASP .NET application each one in a different culture (set in the web.config). Each of them has a webmethod "DoWork" which I would like to called via a single scheduled task. I have a simple exe which calls this method on each of the four cultures, simplified code:
Dim AUSclient As New AUSAutomated.AUSAutomatedClient()
AUSclient.DoWork
Dim GBRclient As New GBRAutomated.GBRAutomatedClient()
GBRclient.DoWork
Dim IRLclient As New IRLAutomated.IRLAutomatedClient()
IRLclient.DoWork
Dim NZLclient As New NZLAutomated.NZLAutomatedClient()
NZLclient.DoWork
In the task which is consuming the methods the app.config looks like this:
<endpoint address="net.pipe://localhost/Services/AUS/AUSAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IAUSAutomated"
contract="AUSAutomated.IAUSAutomated" name="NetNamedPipeBinding_IAUSAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/GBR/GBRAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IGBRAutomated"
contract="GBRAutomated.IGBRAutomated" name="NetNamedPipeBinding_IGBRAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/IRL/IRLAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IIRLAutomated"
contract="IRLAutomated.IIRLAutomated" name="NetNamedPipeBinding_IIRLAutomated">
</endpoint>
<endpoint address="net.pipe://localhost/Services/NZL/NZLAutomated.svc"
binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_INZLAutomated"
contract="NZLAutomated.INZLAutomated" name="NetNamedPipeBinding_INZLAutomated">
</endpoint>
The application exposes the web method via WCF using a net named pipes binding. Each of the cultures has an entry in the web.config to point to the correct service. For example the Ireland one is:
<service name="Web.IRLAutomated">
<endpoint address="net.pipe://localhost/Services/IRL/IRLAutomated.svc" binding="netNamedPipeBinding" contract="Web.IIRLAutomated" />
</service>
So the exposed method for each culture has a different contract and address.
When the task runs it calls the Australian Method all 4 times. It seems to ignore the settings in the web.configs and call the method with the correct contract on the first application. So my question is:
**How can I set a unique pipe name for the method in each culture?**
I tried setting hostNameComparisonMode="Exact" on the binding but this doesn't seem to have made any difference.
| 0 |
11,542,084 | 07/18/2012 13:04:22 | 969,613 | 09/28/2011 17:22:04 | 985 | 18 | ASP.Net - Update controls inside an Update Panel from another thread | ASP.Net noob here trying to update a control inside an UpdatePanel from another thread, with no luck.
Some background, I have written a DLL that interfaces with a standard POTS telephone and I have mapped various occurences on the phone end (phone being picked up, phone ringing etc) to .Net events.
In my ASP.Net solution, I have added my DLL, instantiated my phone and, in methods subscribing to my events I want to update various labels inside an UpdatePanel with information inside the EventArgs objects being passed into my methods.
Using breakpoints, I can see that my Phone object is functioning as expected, the events are being raised when they are supposed to and the EventArgs contain the information they are supposed to.
But the labels inside the UpdatePanel never update. I wrote the previous version of the application as a Windows Form, and I recall that whenever updating the UI from another thread, I had to check whether `InvokeRequired` was true first, and if so call the `Invoke` method but I don't know what the equivalent to this is in ASP.Net (if there is one).
Markup is below (this is just an example project I have created to get my head around the basics):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#form1
{
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" style="text-align: center" Text="Label"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ScriptManager1" EventName="Load" />
</Triggers>
</asp:UpdatePanel>
</form>
</body>
</html>
Now for the code:
using System;
//My DLL
using Maximiser;
namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{
//My Phone Object
private Phone _ThisPhone { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
//Instantiating Phone Object with IP Address and Port
_ThisPhone = new Phone("8.8.8.8", 8888);
//Hookstate event indicates phone is off/on the hook
_ThisPhone.HookState += new EventHandler<Maximiser.Events.Hookstate>(thisPhone_HookState);
}
void thisPhone_HookState(object sender, Maximiser.Events.Hookstate e)
{
//I want to update my Label with the phones current HookState
Label1.Text = e.State;
//Now I want to refresh the UpdatePanel but not reload the page
UpdatePanel1.Update();
}
}
}
| c# | asp.net | ajax | multithreading | null | null | open | ASP.Net - Update controls inside an Update Panel from another thread
===
ASP.Net noob here trying to update a control inside an UpdatePanel from another thread, with no luck.
Some background, I have written a DLL that interfaces with a standard POTS telephone and I have mapped various occurences on the phone end (phone being picked up, phone ringing etc) to .Net events.
In my ASP.Net solution, I have added my DLL, instantiated my phone and, in methods subscribing to my events I want to update various labels inside an UpdatePanel with information inside the EventArgs objects being passed into my methods.
Using breakpoints, I can see that my Phone object is functioning as expected, the events are being raised when they are supposed to and the EventArgs contain the information they are supposed to.
But the labels inside the UpdatePanel never update. I wrote the previous version of the application as a Windows Form, and I recall that whenever updating the UI from another thread, I had to check whether `InvokeRequired` was true first, and if so call the `Invoke` method but I don't know what the equivalent to this is in ASP.Net (if there is one).
Markup is below (this is just an example project I have created to get my head around the basics):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#form1
{
text-align: center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" style="text-align: center" Text="Label"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ScriptManager1" EventName="Load" />
</Triggers>
</asp:UpdatePanel>
</form>
</body>
</html>
Now for the code:
using System;
//My DLL
using Maximiser;
namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{
//My Phone Object
private Phone _ThisPhone { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
//Instantiating Phone Object with IP Address and Port
_ThisPhone = new Phone("8.8.8.8", 8888);
//Hookstate event indicates phone is off/on the hook
_ThisPhone.HookState += new EventHandler<Maximiser.Events.Hookstate>(thisPhone_HookState);
}
void thisPhone_HookState(object sender, Maximiser.Events.Hookstate e)
{
//I want to update my Label with the phones current HookState
Label1.Text = e.State;
//Now I want to refresh the UpdatePanel but not reload the page
UpdatePanel1.Update();
}
}
}
| 0 |
11,542,087 | 07/18/2012 13:04:31 | 722,453 | 04/24/2011 08:34:03 | 40 | 0 | Simulink Aerospace - Using the Accelerometer Block | I am struggling to use the aerospace accelerometer and gyroscope blocks, and can't get to actually building a working (simple) model.
Can anyone please make a simple model for me so I can follow and build my own model?
I am interested in something like this: I have a vectors representing Time, Position, Attitude etc. of an aircraft. I would like to receive the accelerometer readings.
Using Matlab 2012a, but any other version would do.
Thanks!
| matlab | block | accelerometer | simulink | null | null | open | Simulink Aerospace - Using the Accelerometer Block
===
I am struggling to use the aerospace accelerometer and gyroscope blocks, and can't get to actually building a working (simple) model.
Can anyone please make a simple model for me so I can follow and build my own model?
I am interested in something like this: I have a vectors representing Time, Position, Attitude etc. of an aircraft. I would like to receive the accelerometer readings.
Using Matlab 2012a, but any other version would do.
Thanks!
| 0 |
11,542,088 | 07/18/2012 13:04:34 | 1,534,843 | 07/18/2012 12:59:34 | 1 | 0 | [Urgent Please..]PHP Script to add contact to google(gmail), yahoo, aol and hotmail | Dear Everyone and partners, I am stuck with google, yahoo, hotmail and aol code. I need the user of my website could add the contact us page to contactbook in google, yahoo, hotmail and aol.. Please if you have something value so much about this that will be very appreciated. Thanx so much | google | add | yahoo | hotmail | aol | 07/18/2012 20:58:48 | not a real question | [Urgent Please..]PHP Script to add contact to google(gmail), yahoo, aol and hotmail
===
Dear Everyone and partners, I am stuck with google, yahoo, hotmail and aol code. I need the user of my website could add the contact us page to contactbook in google, yahoo, hotmail and aol.. Please if you have something value so much about this that will be very appreciated. Thanx so much | 1 |
11,472,168 | 07/13/2012 14:10:05 | 752,540 | 05/13/2011 14:19:00 | 54 | 0 | dijit.menu css selector | anyone know the custom css selector for dijit.MenuItem label?
here's the js that adds the dijit.MenuItem's:
dojo.forEach(basemapGallery.basemaps, function(basemap) {
//Add a menu item for each basemap
dijit.byId("bingMenu").addChild(new dijit.MenuItem({
label: basemap.title,
iconClass: basemap.title,
onClick: function(){basemapGallery.select(basemap.id)}
}));
});
here's the static html:
<td align="center" style="width: 50px;" valign="middle">
<button id="dropdownButton" iconClass="btnImgBaseMap" title="Switch Basemap" dojoType="dijit.form.DropDownButton">
<div dojoType="dijit.Menu" id="bingMenu">
<!--The menu items are dynamically created using the basemap gallery layers-->
</div>
</button>
</td>
thanks!! | dojo | dijit | null | null | null | null | open | dijit.menu css selector
===
anyone know the custom css selector for dijit.MenuItem label?
here's the js that adds the dijit.MenuItem's:
dojo.forEach(basemapGallery.basemaps, function(basemap) {
//Add a menu item for each basemap
dijit.byId("bingMenu").addChild(new dijit.MenuItem({
label: basemap.title,
iconClass: basemap.title,
onClick: function(){basemapGallery.select(basemap.id)}
}));
});
here's the static html:
<td align="center" style="width: 50px;" valign="middle">
<button id="dropdownButton" iconClass="btnImgBaseMap" title="Switch Basemap" dojoType="dijit.form.DropDownButton">
<div dojoType="dijit.Menu" id="bingMenu">
<!--The menu items are dynamically created using the basemap gallery layers-->
</div>
</button>
</td>
thanks!! | 0 |
11,472,162 | 07/13/2012 14:09:47 | 901,336 | 08/18/2011 20:14:14 | 44 | 1 | Is it bad to have 3 levels of divs on the z-axis | As a general rule of design is it looked down upon to have more than one div ontop of the page contents? I have a table with records and a div that sits ontop of the table which moves to the vertical position of that record which contains sub-records upon the click. These sub-records in the div also have a level of sub-records themselves and I wish to put another div ontop of the first displaying info about them. Would that be too ridiculous?
gracias de antemano, | html | design | webpage | null | null | 07/15/2012 01:26:10 | not constructive | Is it bad to have 3 levels of divs on the z-axis
===
As a general rule of design is it looked down upon to have more than one div ontop of the page contents? I have a table with records and a div that sits ontop of the table which moves to the vertical position of that record which contains sub-records upon the click. These sub-records in the div also have a level of sub-records themselves and I wish to put another div ontop of the first displaying info about them. Would that be too ridiculous?
gracias de antemano, | 4 |
11,472,174 | 07/13/2012 14:10:58 | 656,100 | 03/11/2011 22:45:57 | 119 | 10 | Make independent copy of UIBezierPath? | I have a complex UIBezierCurve which I need to draw once with some particular line parameters, and then draw it again as overlay with other line parameters, but also I need the last part of the curve to be slightly shorter than in previous one.
To do this I want to create the curve by `addLineToPoint:`, `moveToPoint:` up to the last part, then make a copy of this curve and add the final segments of the line differently in original and copied curves. And then I stroke the original curve, and the copied one.
The problem is that it doesn't work as I expected.
I create a copy of the curve by:
UIBezierPath* copyCurve = [originalCurve copy];
And the drawing which I do in the originalCurve after that, is applied also to the copyCurve, so I can't do independent drawing for any of this curves.
What is the reason for this connection between original and copy and how can I get rid of it? | objective-c | cocoa | drawing | copy | uibezierpath | null | open | Make independent copy of UIBezierPath?
===
I have a complex UIBezierCurve which I need to draw once with some particular line parameters, and then draw it again as overlay with other line parameters, but also I need the last part of the curve to be slightly shorter than in previous one.
To do this I want to create the curve by `addLineToPoint:`, `moveToPoint:` up to the last part, then make a copy of this curve and add the final segments of the line differently in original and copied curves. And then I stroke the original curve, and the copied one.
The problem is that it doesn't work as I expected.
I create a copy of the curve by:
UIBezierPath* copyCurve = [originalCurve copy];
And the drawing which I do in the originalCurve after that, is applied also to the copyCurve, so I can't do independent drawing for any of this curves.
What is the reason for this connection between original and copy and how can I get rid of it? | 0 |
11,472,175 | 07/13/2012 14:10:58 | 1,523,725 | 07/13/2012 13:46:58 | 1 | 0 | ComboBox do not display data | I parsed data , stored them in a combobox but they are not displayed? can you please fix thre problem? ( the load datasource method is for loading data and the action when i press parse button i should see data il the combobox), I implemented the combo box delagates and the parser gelegates
-(BOOL)parseDocumentWithData:(NSData *)data {
//NSString * filePath = [[NSBundle mainBundle] pathForResource:@"Users" ofType:@"xml"];
//data = [NSData dataWithContentsOfFile:filePath];
if (data == nil)
return NO;
// this is the parsing machine
xmlparser = [[NSXMLParser alloc] initWithData:data];
// this class will handle the events
[xmlparser setDelegate:self];
[xmlparser setShouldResolveExternalEntities:NO];
// now parse the document
BOOL ok = [xmlparser parse];
if (ok == NO)
NSLog(@"error");
else
NSLog(@"OK");
[xmlparser release];
return ok;
}
- (void)parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {
if ([elementName isEqualToString:@"user"]) {
NSLog(@"user element found β create a new instance of User class...");
user = [[User alloc] init];
}
}
-(void) loadDataSource {
comboarray = [NSMutableArray arrayWithArray: users];
mutableDS = [[NSMutableArray alloc] init];
[mutableDS addObjectsFromArray:comboarray];
mutableDS = [[mutableDS sortedArrayUsingSelector:@selector(compare:)] retain];
}
-(void)awakeFromNib {
[self loadDataSource];
}
- (IBAction)pparser:(id)sender {
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"Users" ofType:@"xml"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
[self parseDocumentWithData:data];
[self loadDataSource];
}
| objective-c | cocoa | binding | nsxmlparser | nscombobox | null | open | ComboBox do not display data
===
I parsed data , stored them in a combobox but they are not displayed? can you please fix thre problem? ( the load datasource method is for loading data and the action when i press parse button i should see data il the combobox), I implemented the combo box delagates and the parser gelegates
-(BOOL)parseDocumentWithData:(NSData *)data {
//NSString * filePath = [[NSBundle mainBundle] pathForResource:@"Users" ofType:@"xml"];
//data = [NSData dataWithContentsOfFile:filePath];
if (data == nil)
return NO;
// this is the parsing machine
xmlparser = [[NSXMLParser alloc] initWithData:data];
// this class will handle the events
[xmlparser setDelegate:self];
[xmlparser setShouldResolveExternalEntities:NO];
// now parse the document
BOOL ok = [xmlparser parse];
if (ok == NO)
NSLog(@"error");
else
NSLog(@"OK");
[xmlparser release];
return ok;
}
- (void)parser:(NSXMLParser *)parser
didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {
if ([elementName isEqualToString:@"user"]) {
NSLog(@"user element found β create a new instance of User class...");
user = [[User alloc] init];
}
}
-(void) loadDataSource {
comboarray = [NSMutableArray arrayWithArray: users];
mutableDS = [[NSMutableArray alloc] init];
[mutableDS addObjectsFromArray:comboarray];
mutableDS = [[mutableDS sortedArrayUsingSelector:@selector(compare:)] retain];
}
-(void)awakeFromNib {
[self loadDataSource];
}
- (IBAction)pparser:(id)sender {
NSString * filePath = [[NSBundle mainBundle] pathForResource:@"Users" ofType:@"xml"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
[self parseDocumentWithData:data];
[self loadDataSource];
}
| 0 |
11,472,176 | 07/13/2012 14:11:01 | 264,273 | 02/02/2010 11:25:23 | 1,241 | 44 | IS this causing Abandoned memory? | I'm looking at heap shots in memory. This function seems to be a culprit for abandoned memory.
It'S part of view building code for one of my view , 'MyView'.
If I create and destroy 'MyView' 100 times with this function commented memory size always returns to it base line. However if I leave this function in my memory continually increases.
As far as I can see I dont take ownership of anything in the function.
What am I doing wrong?
-(void)drawPointAroundCircle:(CGPoint)centerpoint radius:(int)radius amount:(int)amount
{
CGPoint pointarray[amount];
float thetaarray[7]={270.0,315.0,0.0,45.0,135,180.0,225.0};
int i=-1;
UIGraphicsBeginImageContext(CGSizeMake(self.frame.size.width,self.frame.size.height));
CGContextRef context=UIGraphicsGetCurrentContext();
for (i=0; i<7; i++) {
float x=cosf(D2R( thetaarray[i]))*radius;
float y =sinf( D2R(thetaarray[i]))*radius;
x=x+centerpoint.x;
y=y+centerpoint.y;
pointarray[i].x=x;
pointarray[i].y=y;
UIBezierPath *path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(x, y) radius:2 startAngle:D2R(0) endAngle:D2R(360) clockwise:YES];
CGContextSetFillColorWithColor(context, [UIColor grayColor].CGColor);
[path fill];
[path closePath];
}
UIImage *bezierimage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *bezierImageView=[[UIImageView alloc]initWithImage:bezierimage];
[self addSubview:bezierImageView];
} | ios | ios5 | memory-management | abandoned-memory | null | null | open | IS this causing Abandoned memory?
===
I'm looking at heap shots in memory. This function seems to be a culprit for abandoned memory.
It'S part of view building code for one of my view , 'MyView'.
If I create and destroy 'MyView' 100 times with this function commented memory size always returns to it base line. However if I leave this function in my memory continually increases.
As far as I can see I dont take ownership of anything in the function.
What am I doing wrong?
-(void)drawPointAroundCircle:(CGPoint)centerpoint radius:(int)radius amount:(int)amount
{
CGPoint pointarray[amount];
float thetaarray[7]={270.0,315.0,0.0,45.0,135,180.0,225.0};
int i=-1;
UIGraphicsBeginImageContext(CGSizeMake(self.frame.size.width,self.frame.size.height));
CGContextRef context=UIGraphicsGetCurrentContext();
for (i=0; i<7; i++) {
float x=cosf(D2R( thetaarray[i]))*radius;
float y =sinf( D2R(thetaarray[i]))*radius;
x=x+centerpoint.x;
y=y+centerpoint.y;
pointarray[i].x=x;
pointarray[i].y=y;
UIBezierPath *path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(x, y) radius:2 startAngle:D2R(0) endAngle:D2R(360) clockwise:YES];
CGContextSetFillColorWithColor(context, [UIColor grayColor].CGColor);
[path fill];
[path closePath];
}
UIImage *bezierimage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *bezierImageView=[[UIImageView alloc]initWithImage:bezierimage];
[self addSubview:bezierImageView];
} | 0 |
11,472,179 | 07/13/2012 14:11:12 | 1,012,669 | 10/25/2011 12:01:33 | 1 | 0 | Instance of Container used in Funq | I am waching the screencast of Funq but I don't understand something with the following lambda in the testing code :
var container = new Container();
container.Register<IBar>(c => new Bar());
the declaration :
public void Register<TService>(Func<Container, TService> factory) { ... }
In the lambda, the **new Bar()** acts as the **TService** and the **c** as the **Container** for the Func used in Register method.
During the execution, when is this c delcared ? Is it the **container** created at the beginning because I do not understand when an instance of a Container is passed to the **Register** method. | c# | .net | lambda | funq | null | null | open | Instance of Container used in Funq
===
I am waching the screencast of Funq but I don't understand something with the following lambda in the testing code :
var container = new Container();
container.Register<IBar>(c => new Bar());
the declaration :
public void Register<TService>(Func<Container, TService> factory) { ... }
In the lambda, the **new Bar()** acts as the **TService** and the **c** as the **Container** for the Func used in Register method.
During the execution, when is this c delcared ? Is it the **container** created at the beginning because I do not understand when an instance of a Container is passed to the **Register** method. | 0 |
11,472,183 | 07/13/2012 14:11:16 | 131,874 | 07/01/2009 17:59:18 | 3,774 | 215 | Convert nullable numeric into string | I want to convert a nullable numeric into a string **maintaining** the null value. This is what I'm doing:
int? i = null;
string s = i == null ? null : i.ToString();
Is there something shorter? | c# | type-conversion | null | null | null | null | open | Convert nullable numeric into string
===
I want to convert a nullable numeric into a string **maintaining** the null value. This is what I'm doing:
int? i = null;
string s = i == null ? null : i.ToString();
Is there something shorter? | 0 |
11,350,270 | 07/05/2012 18:23:05 | 265,877 | 02/04/2010 03:58:20 | 1,201 | 54 | FirstOrAddNew extension method | Sometime you need to get the first value from a collection that a property of another object. If there are no values in the collection, of if the collection is null you have to write extra code to create the new object and add it to the collection. You may also have to instantiate the collection itself if it's null. I wrote a nice little extension method that you can use to do all of this in one line. See the answer below. | c# | .net | extension-methods | null | null | 07/10/2012 13:54:46 | not a real question | FirstOrAddNew extension method
===
Sometime you need to get the first value from a collection that a property of another object. If there are no values in the collection, of if the collection is null you have to write extra code to create the new object and add it to the collection. You may also have to instantiate the collection itself if it's null. I wrote a nice little extension method that you can use to do all of this in one line. See the answer below. | 1 |
11,350,272 | 07/05/2012 18:23:15 | 808,723 | 06/21/2011 15:14:24 | 364 | 15 | Create UI from class | I'am looking for a tool, which can generate a user Interface from a class.
Let me have an example.
This class with some pseudo attributes:
class BussinessModel
{
[UiReadOnly]
[UiSingleLine]
public int Id { get; set; }
[UiSingleLine]
public string Tile { get; set; }
[UiMultiLine]
public string Description { get; set; }
}
could generate a UI (XAML for the ui) like this:
![The generated ui][1]
**Is there any tool out there which can do something like this (with a single click)?**
[1]: http://i.stack.imgur.com/D7m85.png | c# | xaml | code-generation | null | null | null | open | Create UI from class
===
I'am looking for a tool, which can generate a user Interface from a class.
Let me have an example.
This class with some pseudo attributes:
class BussinessModel
{
[UiReadOnly]
[UiSingleLine]
public int Id { get; set; }
[UiSingleLine]
public string Tile { get; set; }
[UiMultiLine]
public string Description { get; set; }
}
could generate a UI (XAML for the ui) like this:
![The generated ui][1]
**Is there any tool out there which can do something like this (with a single click)?**
[1]: http://i.stack.imgur.com/D7m85.png | 0 |
11,350,205 | 07/05/2012 18:19:22 | 1,192,228 | 02/06/2012 12:05:46 | 19 | 0 | Aptana Studio 3: Specific (Fav_orite) File/Folder View | first of all: Sorry for the bad title, but stackoverflow doesn't like the word "favorite".
My Question: Is there any ability or plugin to have a view which contains favorite files/folder in a project ? PHPStorm has a similar feature.
Or maybe ther is another solution, but actually it's really hard to work productive with large projects because i spend too much time for seraching through the tree. | plugins | view | workflow | aptana | null | null | open | Aptana Studio 3: Specific (Fav_orite) File/Folder View
===
first of all: Sorry for the bad title, but stackoverflow doesn't like the word "favorite".
My Question: Is there any ability or plugin to have a view which contains favorite files/folder in a project ? PHPStorm has a similar feature.
Or maybe ther is another solution, but actually it's really hard to work productive with large projects because i spend too much time for seraching through the tree. | 0 |
11,350,273 | 07/05/2012 18:23:29 | 1,470,313 | 06/20/2012 19:44:43 | 3 | 0 | Android: stoping music doesnt work with incoming call | I know there are 2 or 3 topics about this but i can't get working the code. i'm always getting an error, after starting my code. THE PROGRAM STARTS, but after a while the error occurrs. So i think i have the false position for the telephone code!
I want to stop the bg music when a call comes in and i want to start it again, after the call is over (i've used a piece of code from the forum, but i dont know where i should build in this code blocks).
So long, all works fine without the telephony code pieces! So where do i biuld in this telephony code?
THX A LOT 4 HELP!
**my code :**
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
public class GameActivity extends Activity {
private MediaPlayer mp;
Button menubutton_start;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.game);
menubutton_start = (Button) findViewById(R.id.menustart);
mp = MediaPlayer.create(this,R.raw.menusong_worldquizzer);
mp.start();
mp.setLooping(true);
PhoneStateListener phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
mp.pause();
} else if(state == TelephonyManager.CALL_STATE_IDLE) {
mp.start();
} else if(state == TelephonyManager.CALL_STATE_OFFHOOK) {
mp.pause();
}
super.onCallStateChanged(state, incomingNumber);
}
};
TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if(mgr != null) {
mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
.
.
.
.
.
public void onClick(View v) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Intent myIntent = new Intent(GameActivity.this, QuizActivity.class);
GameActivity.this.startActivity(myIntent);
}
}, 500); // end of Handler new Runnable()
} // end of OnClick()
}); // end of setOnClickListener
} // end of onCreate()
@Override
public void onDestroy() {
super.onDestroy();
mp.stop();
mp.release();
System.exit(0);
}
} // end of Activity
| android | null | null | null | null | null | open | Android: stoping music doesnt work with incoming call
===
I know there are 2 or 3 topics about this but i can't get working the code. i'm always getting an error, after starting my code. THE PROGRAM STARTS, but after a while the error occurrs. So i think i have the false position for the telephone code!
I want to stop the bg music when a call comes in and i want to start it again, after the call is over (i've used a piece of code from the forum, but i dont know where i should build in this code blocks).
So long, all works fine without the telephony code pieces! So where do i biuld in this telephony code?
THX A LOT 4 HELP!
**my code :**
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
public class GameActivity extends Activity {
private MediaPlayer mp;
Button menubutton_start;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.game);
menubutton_start = (Button) findViewById(R.id.menustart);
mp = MediaPlayer.create(this,R.raw.menusong_worldquizzer);
mp.start();
mp.setLooping(true);
PhoneStateListener phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
mp.pause();
} else if(state == TelephonyManager.CALL_STATE_IDLE) {
mp.start();
} else if(state == TelephonyManager.CALL_STATE_OFFHOOK) {
mp.pause();
}
super.onCallStateChanged(state, incomingNumber);
}
};
TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if(mgr != null) {
mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
.
.
.
.
.
public void onClick(View v) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Intent myIntent = new Intent(GameActivity.this, QuizActivity.class);
GameActivity.this.startActivity(myIntent);
}
}, 500); // end of Handler new Runnable()
} // end of OnClick()
}); // end of setOnClickListener
} // end of onCreate()
@Override
public void onDestroy() {
super.onDestroy();
mp.stop();
mp.release();
System.exit(0);
}
} // end of Activity
| 0 |
11,350,276 | 07/05/2012 18:23:50 | 534,349 | 08/23/2010 10:58:34 | 96 | 1 | Entity per property authoriation | I have a ListItem (Sharepoint), but lets think of it as a simple class/entity. Now this entity has a property name Status and other properties.
I need to implement per property/role/status authorization.
Example:
**Role** = Manager, **Field**=RequestName, **Status**=01
Permissions: Read, Update
**Role** = Manager, **Field**=RequestName, **Status**=05
Permissions: Read
As you can see the authorization i basically based on 3 variables: Role, Status, Property
Now, i need in UI to disable/hide some controls based on the fact that a user can see it, or edit it. This can be done easily with a couple of sql tables and some joins.
Given that the entity could have 30-100 Properties, and i need to know whenever to disable/hide controls in UI.
What do you think it would be the best approach:
1. query the database 30 times and find if the user can read a
certain property
2. load permissions for all fields given Role and Status, loop in
memory over the collection and get current field permissions.
I'm interested in performance/memory balance. I'm also opened to other authorization algorithms giving that the 3 variables (Role/Status/Property) decide permissions.
Thank you | c# | sql | sharepoint | authentication | properties | null | open | Entity per property authoriation
===
I have a ListItem (Sharepoint), but lets think of it as a simple class/entity. Now this entity has a property name Status and other properties.
I need to implement per property/role/status authorization.
Example:
**Role** = Manager, **Field**=RequestName, **Status**=01
Permissions: Read, Update
**Role** = Manager, **Field**=RequestName, **Status**=05
Permissions: Read
As you can see the authorization i basically based on 3 variables: Role, Status, Property
Now, i need in UI to disable/hide some controls based on the fact that a user can see it, or edit it. This can be done easily with a couple of sql tables and some joins.
Given that the entity could have 30-100 Properties, and i need to know whenever to disable/hide controls in UI.
What do you think it would be the best approach:
1. query the database 30 times and find if the user can read a
certain property
2. load permissions for all fields given Role and Status, loop in
memory over the collection and get current field permissions.
I'm interested in performance/memory balance. I'm also opened to other authorization algorithms giving that the 3 variables (Role/Status/Property) decide permissions.
Thank you | 0 |
11,350,279 | 07/05/2012 18:23:56 | 825,822 | 07/02/2011 06:37:01 | 120 | 11 | Socket.io does not work on Firefox & Chrome | I'm trying to develop a simple chat application.
Here is my **chat.js** file.
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs');
app.listen(8124);
function handler (req, res) {
fs.readFile(__dirname + '/chat.html',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading chat.html');
}
res.writeHead(200);
res.end(data);
});
}
io.sockets.on('connection', function (socket) {
socket.on('addme',function(username) {
socket.username = username;
socket.emit('chat', 'SERVER', 'You have connected');
socket.broadcast.emit('chat', 'SERVER', username + ' is on deck');
});
socket.on('sendchat', function(data) {
io.sockets.emit('chat', socket.username, data);
});
socket.on('disconnect', function() {
io.sockets.emit('chat', 'SERVER', socket.username + ' has left the building');
});
});
And my **chat.html** file.
<head>
<meta charset="utf-8">
<title>bi-directional communication</title>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(document).ready(function(e) {
var socket = io.connect('http://localhost:8124/');
$('#submit').click(function(e) {
e.preventDefault();
v = $('#uname').val();
$('#username').html('');
socket.emit('addme', v);
});
socket.on('chat',function(username, data) {
var p = document.createElement('p');
p.innerHTML = username + ': ' + data;
document.getElementById('output').appendChild(p);
});
window.addEventListener('load',function() {
document.getElementById('sendtext').addEventListener('click',
function() {
var text = document.getElementById('data').value;
socket.emit('sendchat', text);
}, false);
}, false);
});
</script>
</head>
<body>
<div id="output"></div>
<div id="username">
<input type="text" name="uname" id="uname">
<input type="submit" name="submit" id="submit" value="Submit">
</div>
<div id="send">
<input type="text" id="data" size="100" /><br />
<input type="button" id="sendtext" value="Send Text" />
</div>
</body>
</html>
I test the code by typing **node chat.js** in node.js command prompt & then typing `http://localhost:8124/` in my browser address bar. The problem is that while this works perfectly on IE9, nothing happens on Firefox and Chrome. Please help.
| node.js | socket.io | null | null | null | null | open | Socket.io does not work on Firefox & Chrome
===
I'm trying to develop a simple chat application.
Here is my **chat.js** file.
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs');
app.listen(8124);
function handler (req, res) {
fs.readFile(__dirname + '/chat.html',
function (err, data) {
if (err) {
res.writeHead(500);
return res.end('Error loading chat.html');
}
res.writeHead(200);
res.end(data);
});
}
io.sockets.on('connection', function (socket) {
socket.on('addme',function(username) {
socket.username = username;
socket.emit('chat', 'SERVER', 'You have connected');
socket.broadcast.emit('chat', 'SERVER', username + ' is on deck');
});
socket.on('sendchat', function(data) {
io.sockets.emit('chat', socket.username, data);
});
socket.on('disconnect', function() {
io.sockets.emit('chat', 'SERVER', socket.username + ' has left the building');
});
});
And my **chat.html** file.
<head>
<meta charset="utf-8">
<title>bi-directional communication</title>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(document).ready(function(e) {
var socket = io.connect('http://localhost:8124/');
$('#submit').click(function(e) {
e.preventDefault();
v = $('#uname').val();
$('#username').html('');
socket.emit('addme', v);
});
socket.on('chat',function(username, data) {
var p = document.createElement('p');
p.innerHTML = username + ': ' + data;
document.getElementById('output').appendChild(p);
});
window.addEventListener('load',function() {
document.getElementById('sendtext').addEventListener('click',
function() {
var text = document.getElementById('data').value;
socket.emit('sendchat', text);
}, false);
}, false);
});
</script>
</head>
<body>
<div id="output"></div>
<div id="username">
<input type="text" name="uname" id="uname">
<input type="submit" name="submit" id="submit" value="Submit">
</div>
<div id="send">
<input type="text" id="data" size="100" /><br />
<input type="button" id="sendtext" value="Send Text" />
</div>
</body>
</html>
I test the code by typing **node chat.js** in node.js command prompt & then typing `http://localhost:8124/` in my browser address bar. The problem is that while this works perfectly on IE9, nothing happens on Firefox and Chrome. Please help.
| 0 |
11,350,281 | 07/05/2012 18:24:15 | 1,504,860 | 07/05/2012 18:20:58 | 1 | 0 | Scrollbar now appearing in Firefox, not in any other browser. Just started July 5th | This is a firefox specific bug that just started today. IE and Chrome do not show any scrollbars. I'm making all the appropriate Facebook calls to autogrow the page.
I have in place
FB.Canvas.setAutoGrow();
FB.Canvas.setSize(true);
Inserting css: Overflow : hidden on the html tag will fix the problem but breaks many of my pages.
and nothing is working. Even with css: Overflow:hidden the vertical/horizontal scrollbars still appears but is disabled.
Previously, firefox had always displayed a disabled bottom scrollbar, but now it is displaying a enabled vertical scrollbar as well. The vertical scrollbar just crept up over night and is now displaying on the live version of my app. Something changed on the Facebook end to have the vertical scrollbar start showing up.
Aside from the vertical scrollbar now appearing, firefox also displays a disabled bottom scrollbar that is impossible to get rid of, I've seen this bottom scrollbar on every app on facebook in Firefox.
You can see the bug live in action by going to
apps.facebook.com/Ovrlap-App I also went around checking out other FB apps and found another example on BranchOut (an app with 2mill + users).
Firefox has always had a disabled bottom scrollbar which I'm totally clueless as to how to get rid of it. But this new vertical scrollbar just showed up today.
Thanks in advance,
-Rob
| facebook | firefox | application | canvas | scrollbar | null | open | Scrollbar now appearing in Firefox, not in any other browser. Just started July 5th
===
This is a firefox specific bug that just started today. IE and Chrome do not show any scrollbars. I'm making all the appropriate Facebook calls to autogrow the page.
I have in place
FB.Canvas.setAutoGrow();
FB.Canvas.setSize(true);
Inserting css: Overflow : hidden on the html tag will fix the problem but breaks many of my pages.
and nothing is working. Even with css: Overflow:hidden the vertical/horizontal scrollbars still appears but is disabled.
Previously, firefox had always displayed a disabled bottom scrollbar, but now it is displaying a enabled vertical scrollbar as well. The vertical scrollbar just crept up over night and is now displaying on the live version of my app. Something changed on the Facebook end to have the vertical scrollbar start showing up.
Aside from the vertical scrollbar now appearing, firefox also displays a disabled bottom scrollbar that is impossible to get rid of, I've seen this bottom scrollbar on every app on facebook in Firefox.
You can see the bug live in action by going to
apps.facebook.com/Ovrlap-App I also went around checking out other FB apps and found another example on BranchOut (an app with 2mill + users).
Firefox has always had a disabled bottom scrollbar which I'm totally clueless as to how to get rid of it. But this new vertical scrollbar just showed up today.
Thanks in advance,
-Rob
| 0 |
11,660,494 | 07/26/2012 00:03:06 | 1,394,898 | 05/14/2012 23:55:56 | 94 | 10 | When I load a file into a div, the div jumps down | I have a page that looks like this:
<body>
<div class="pollid" >
<select class="pollid" id="pollid" size="[2]" >
[options]
</select></div>
<div class="seperator"></div>
<div class="options">
<select class="options" id="options" disabled="disabled" size="2">
<option id="deadoption">Select a poll to enable this box.</option>
</select></div>
<div class="seperator"></div>
<div class="options2" id="options2">
</div>
</body>
I also have a bit of jquery that just does this when a specific option in the second div is selected:
$("#options2").load("ajax/newOption.html");
And newOption.html looks like this:
<input type="text" id="newopt" label="Option: " />
<button id="submit" type="button" value="Submit" />
The CSS I have looks like this:
select {
height: 100%;
width: 100%;
}
div.pollid {
height: 100%;
width: 30%;
display: inline-block;
}
div.options {
height: 100%;
width: 30%;
display: inline-block;
}
div.options2 {
height: 100%;
width: 30%;
display: inline-block;
}
.seperator {
height: 100%;
width: 3%;
display: inline-block;
}
Now, this works. However, when I click the option that loads that page, the div jumps down so that the bottom of the input is at the bottom of my screen. This is not what I want. I want the div to stay where it is, taking up 30% of the screen. I don't want the screen to scroll at all, which it does once the html is loaded. How might I be able to fix this? | javascript | jquery | html | css | null | null | open | When I load a file into a div, the div jumps down
===
I have a page that looks like this:
<body>
<div class="pollid" >
<select class="pollid" id="pollid" size="[2]" >
[options]
</select></div>
<div class="seperator"></div>
<div class="options">
<select class="options" id="options" disabled="disabled" size="2">
<option id="deadoption">Select a poll to enable this box.</option>
</select></div>
<div class="seperator"></div>
<div class="options2" id="options2">
</div>
</body>
I also have a bit of jquery that just does this when a specific option in the second div is selected:
$("#options2").load("ajax/newOption.html");
And newOption.html looks like this:
<input type="text" id="newopt" label="Option: " />
<button id="submit" type="button" value="Submit" />
The CSS I have looks like this:
select {
height: 100%;
width: 100%;
}
div.pollid {
height: 100%;
width: 30%;
display: inline-block;
}
div.options {
height: 100%;
width: 30%;
display: inline-block;
}
div.options2 {
height: 100%;
width: 30%;
display: inline-block;
}
.seperator {
height: 100%;
width: 3%;
display: inline-block;
}
Now, this works. However, when I click the option that loads that page, the div jumps down so that the bottom of the input is at the bottom of my screen. This is not what I want. I want the div to stay where it is, taking up 30% of the screen. I don't want the screen to scroll at all, which it does once the html is loaded. How might I be able to fix this? | 0 |
11,660,499 | 07/26/2012 00:03:25 | 1,020,719 | 10/30/2011 13:46:34 | 61 | 2 | Sorting dictionary using a tuple and operator.itemgetter | I am before my last milestone preparing suitable output. Its quite simple, I think, but my approach doesn't work:
Given an dictionary like
mydict={x1 : (val1, dist1, (lat1,lon1)), x2 : (val2, dist2, (lat2,lon2)), ...}
I tried to sort this in a nested way in an array, first using the "values" and if equals, sorting for "dist".
However, I did my homework and tried it using this way:
import operator
s= sorted(mydict.iteritems(), key=operator.itemgetter(1)).
The thing ist that if the sort methode would be appliable to tuples, it would be quite easy, because it's already in the right order.
Unfortunately I get:
> 'list' object is not callable
Do you have an idea?
| python | numpy | null | null | null | null | open | Sorting dictionary using a tuple and operator.itemgetter
===
I am before my last milestone preparing suitable output. Its quite simple, I think, but my approach doesn't work:
Given an dictionary like
mydict={x1 : (val1, dist1, (lat1,lon1)), x2 : (val2, dist2, (lat2,lon2)), ...}
I tried to sort this in a nested way in an array, first using the "values" and if equals, sorting for "dist".
However, I did my homework and tried it using this way:
import operator
s= sorted(mydict.iteritems(), key=operator.itemgetter(1)).
The thing ist that if the sort methode would be appliable to tuples, it would be quite easy, because it's already in the right order.
Unfortunately I get:
> 'list' object is not callable
Do you have an idea?
| 0 |
11,660,500 | 07/26/2012 00:03:32 | 483,486 | 10/21/2010 19:53:46 | 3,440 | 134 | Word wrapping algorithm LWS | I was researching word wrapping algorithms, and via [wikipedia](http://en.wikipedia.org/wiki/Word_wrap#Minimum_raggedness) I ran across a `O(n)` algorithm to minimize raggedness. Which I've reproduced below:
F[0] <- c <- r <- 0.
while (c < n)
begin
Step 1: p <- min(2c - r + 1, n)
Step 2: Apply the SMAWK algorithm to find the minimum in each column of submatrix G[r, c; c+1, p]. For j \elem [c+1, p] let F[j] = the minimum value found in G[r, c; j].
Step 3: Apply the SMAWK algorithm to find the minimum in each column of submatrix G[c+1, p-1; c+2, p]. For j \elem [c+2, p] let H[j] = the minimum value found in G[c+1, p-1; j].
Step 4: If there is an integer j \elem [c+2, p] such that H[j] < F[j] then set j_0 to the smallest such integer. Otherwise j_0 <- p+1.
Step 5: if (j_0 = p+1)
then c <- p.
else F[j_0] <- H[j_0]; r <- c + 1; c <- j_0.
end
It's as terse as published papers tend to be and makes reference to a SMAWK algorithm which is from another paper.
Does anyone out there have or know of a separate explanation of this algorithm that I can compare against the published paper to try to wrap my head around what is trying to be done and figure out how it works before I start implementation? | algorithm | word-wrap | pseudocode | null | null | null | open | Word wrapping algorithm LWS
===
I was researching word wrapping algorithms, and via [wikipedia](http://en.wikipedia.org/wiki/Word_wrap#Minimum_raggedness) I ran across a `O(n)` algorithm to minimize raggedness. Which I've reproduced below:
F[0] <- c <- r <- 0.
while (c < n)
begin
Step 1: p <- min(2c - r + 1, n)
Step 2: Apply the SMAWK algorithm to find the minimum in each column of submatrix G[r, c; c+1, p]. For j \elem [c+1, p] let F[j] = the minimum value found in G[r, c; j].
Step 3: Apply the SMAWK algorithm to find the minimum in each column of submatrix G[c+1, p-1; c+2, p]. For j \elem [c+2, p] let H[j] = the minimum value found in G[c+1, p-1; j].
Step 4: If there is an integer j \elem [c+2, p] such that H[j] < F[j] then set j_0 to the smallest such integer. Otherwise j_0 <- p+1.
Step 5: if (j_0 = p+1)
then c <- p.
else F[j_0] <- H[j_0]; r <- c + 1; c <- j_0.
end
It's as terse as published papers tend to be and makes reference to a SMAWK algorithm which is from another paper.
Does anyone out there have or know of a separate explanation of this algorithm that I can compare against the published paper to try to wrap my head around what is trying to be done and figure out how it works before I start implementation? | 0 |
11,658,110 | 07/25/2012 20:30:34 | 1,186,035 | 02/02/2012 19:57:27 | 42 | 1 | Browser Loses my session | I might not know what lies underneath browser's behavior.
I go to my page and I log in, so in ASP.NET I have a HttpContext.User.Identity.Name value. Now if I just navigate to lets say www.yahoo.com and browse to a link AND Then come back to my logged in page I am Logging.
The problem is that on Windows XP It does not always happens.
I am logging into my site then issuing a PAYPAL transfer which let me redirect back to my page after payment. So my session should pick me up??....It does happen to me on Windows 7 FF and IE, however on Windows XP it does not.
Anyone knows the difference and is it possible to have this behavior on windows XP? | asp.net | windows-xp | null | null | null | null | open | Browser Loses my session
===
I might not know what lies underneath browser's behavior.
I go to my page and I log in, so in ASP.NET I have a HttpContext.User.Identity.Name value. Now if I just navigate to lets say www.yahoo.com and browse to a link AND Then come back to my logged in page I am Logging.
The problem is that on Windows XP It does not always happens.
I am logging into my site then issuing a PAYPAL transfer which let me redirect back to my page after payment. So my session should pick me up??....It does happen to me on Windows 7 FF and IE, however on Windows XP it does not.
Anyone knows the difference and is it possible to have this behavior on windows XP? | 0 |
11,658,111 | 07/25/2012 20:30:36 | 515,774 | 11/22/2010 07:59:12 | 410 | 3 | Find the type of Windows Processing ID | I am given with a Windows Processing ID and password. How can I check , if that is the correct type of account to impersonate and transfer files between servers in asp.net?
| c# | asp.net | impersonation | null | null | 07/26/2012 13:42:08 | not a real question | Find the type of Windows Processing ID
===
I am given with a Windows Processing ID and password. How can I check , if that is the correct type of account to impersonate and transfer files between servers in asp.net?
| 1 |
11,617,357 | 07/23/2012 17:21:53 | 384,882 | 07/06/2010 19:11:19 | 33 | 2 | MSSQL give new primary key in table 1 and update corresponding keys in table 2 | I have a product and product_detail table pair that I need to copy the data from and update the primary key. Essentially what I'm trying to do is copy last night's data from both tables, give them new primary keys so they don't clash with the current data and insert back into the table with some of the information updated - pk/fk, update_date, and two fields flagged as something different.
I can't make changes to the tables, so I can't use update cascade. We have a file that does an End of Day batch and inserts the data into the tables. We also have a file that is updated every time a transaction happens during the day, so what I thought I could do is copy last nights data, update the keys so they didn't clash, and update that new set of data with whatever comes in from the file during the day. The way it is now, our users have to wait until the end of the day to see where we are. With updating during the day, they can see the balance as the day progresses.
I believe I will have to grab the information out of the main table, get a new pk, update the other info, and pass that new pk to the second table to replace the original fk it has and do it row by row.
Am I heading in the right direction? | sql | foreign-keys | primary-key | null | null | null | open | MSSQL give new primary key in table 1 and update corresponding keys in table 2
===
I have a product and product_detail table pair that I need to copy the data from and update the primary key. Essentially what I'm trying to do is copy last night's data from both tables, give them new primary keys so they don't clash with the current data and insert back into the table with some of the information updated - pk/fk, update_date, and two fields flagged as something different.
I can't make changes to the tables, so I can't use update cascade. We have a file that does an End of Day batch and inserts the data into the tables. We also have a file that is updated every time a transaction happens during the day, so what I thought I could do is copy last nights data, update the keys so they didn't clash, and update that new set of data with whatever comes in from the file during the day. The way it is now, our users have to wait until the end of the day to see where we are. With updating during the day, they can see the balance as the day progresses.
I believe I will have to grab the information out of the main table, get a new pk, update the other info, and pass that new pk to the second table to replace the original fk it has and do it row by row.
Am I heading in the right direction? | 0 |
11,617,358 | 07/23/2012 17:21:55 | 256,007 | 01/21/2010 17:10:22 | 1,794 | 98 | QImage copy on write | is `QImage` based on `QSharedData` ? Do `Qimage` follow `pimpl` or `copy on write` ?
e.g. would copying an Qimage make a deep copy of pixels ? | qt | pimpl-idiom | copy-on-write | null | null | null | open | QImage copy on write
===
is `QImage` based on `QSharedData` ? Do `Qimage` follow `pimpl` or `copy on write` ?
e.g. would copying an Qimage make a deep copy of pixels ? | 0 |
11,617,359 | 07/23/2012 17:21:54 | 1,477,388 | 06/23/2012 21:35:13 | 19 | 0 | Orchard CMS: Help Building 1 to n Relationship | I was reading http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations#Building_an_iN-Ni_Relationship_34 but it doesn't seem to say what files should be created and where. For instance, the first part says, "Here is the code for the Address part" but it doesn't say what name to save the file as and where to put it. Can someone tell me what to do? Thanks. | asp.net-mvc | orchardcms | null | null | null | null | open | Orchard CMS: Help Building 1 to n Relationship
===
I was reading http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations#Building_an_iN-Ni_Relationship_34 but it doesn't seem to say what files should be created and where. For instance, the first part says, "Here is the code for the Address part" but it doesn't say what name to save the file as and where to put it. Can someone tell me what to do? Thanks. | 0 |
11,660,111 | 07/25/2012 23:18:14 | 1,516,426 | 07/11/2012 02:10:31 | 1 | 0 | phonegap facebook connect with blackberry | I'm trying to do a facebook connect with phonegap for Blackberry. I'm trying to do a simple login with facebook, authenticate, redirect to app. After that be able to like anything that I want.
I've done this with iPhone using Hackbook, but I haven't found any working solution for Blacbkerry. Any ideas? | blackberry | phonegap | null | null | null | null | open | phonegap facebook connect with blackberry
===
I'm trying to do a facebook connect with phonegap for Blackberry. I'm trying to do a simple login with facebook, authenticate, redirect to app. After that be able to like anything that I want.
I've done this with iPhone using Hackbook, but I haven't found any working solution for Blacbkerry. Any ideas? | 0 |
11,660,502 | 07/26/2012 00:04:13 | 527,085 | 12/01/2010 19:54:46 | 575 | 9 | Jquery Ajax post | When I post base64 string over 1.2 mb apache tomcat giving the error: "The request sent by the client was syntactically incorrect"
When it is under 1.2 mb it works fine, I receive the data at the server side.
Is there size restriction and how am I going to past this issue? Any help will be appreciated.
Thanks a lot :)
$.ajax({ type: 'POST',
url: 'http://localhost/testServer/image',
data: {imageData : result} ,
async: true,
success: function(data) {
},
error: function (xhr, textStatus, errorThrown) {
alert(xhr.responseText);
}
});
| jquery | ajax | post | null | null | null | open | Jquery Ajax post
===
When I post base64 string over 1.2 mb apache tomcat giving the error: "The request sent by the client was syntactically incorrect"
When it is under 1.2 mb it works fine, I receive the data at the server side.
Is there size restriction and how am I going to past this issue? Any help will be appreciated.
Thanks a lot :)
$.ajax({ type: 'POST',
url: 'http://localhost/testServer/image',
data: {imageData : result} ,
async: true,
success: function(data) {
},
error: function (xhr, textStatus, errorThrown) {
alert(xhr.responseText);
}
});
| 0 |
11,660,513 | 07/26/2012 00:05:24 | 1,546,458 | 07/23/2012 17:01:12 | 6 | 0 | Scaling images in Android not working like supposed to | I have a long vertical image (224x1600). I want it to fit the image width, and scroll vertically. It needs to be scroll-able. I have tried everything and can't get it to work :\
Here is what I have
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android1:id="@+id/tab3"
android1:layout_width="fill_parent"
android1:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/tiles" />
</LinearLayout>
</ScrollView>
Second question is: Is there a way to PREVENT image scaling? The image is 224x1632 and shows that way on my galaxy nexus. On the Nexus 7 (much larger screen but lower DP) it goes to 199x1440. A weird scaling of 88%. Can I prevent this? I need it to display 224x1632 on all machines and scale the width accordingly.
Many thanks! | java | android | xml | eclipse | imageview | null | open | Scaling images in Android not working like supposed to
===
I have a long vertical image (224x1600). I want it to fit the image width, and scroll vertically. It needs to be scroll-able. I have tried everything and can't get it to work :\
Here is what I have
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android1:id="@+id/tab3"
android1:layout_width="fill_parent"
android1:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/tiles" />
</LinearLayout>
</ScrollView>
Second question is: Is there a way to PREVENT image scaling? The image is 224x1632 and shows that way on my galaxy nexus. On the Nexus 7 (much larger screen but lower DP) it goes to 199x1440. A weird scaling of 88%. Can I prevent this? I need it to display 224x1632 on all machines and scale the width accordingly.
Many thanks! | 0 |
11,430,374 | 07/11/2012 10:12:23 | 847,064 | 07/15/2011 19:34:20 | 1,271 | 62 | Association or usage-arrow between class and use-case? | I have the following use-case diagram:
![enter image description here][1]
I want to say, that the actor can execute a use-case calle "add two numbers". When this use-case is executed, two instances of the class "Number" are involved. Is this represented in the diagram above?
What is the difference when I use usage-arrows like here:
![enter image description here][2]
[1]: http://i.stack.imgur.com/jVykk.png
[2]: http://i.stack.imgur.com/2Tps2.png | uml | diagram | use-case | modeling | null | null | open | Association or usage-arrow between class and use-case?
===
I have the following use-case diagram:
![enter image description here][1]
I want to say, that the actor can execute a use-case calle "add two numbers". When this use-case is executed, two instances of the class "Number" are involved. Is this represented in the diagram above?
What is the difference when I use usage-arrows like here:
![enter image description here][2]
[1]: http://i.stack.imgur.com/jVykk.png
[2]: http://i.stack.imgur.com/2Tps2.png | 0 |
11,430,375 | 07/11/2012 10:12:28 | 305,189 | 03/30/2010 14:21:14 | 1,908 | 88 | SonataUser - Extending Admin | I'm trying to modify the default admin of the `User` entity.
Just need to remove certain fields from the form actually.
I imagine [this doc][1] will be usefull for me when it'll be available.
For now I have created this admin and tried to override the default `User` one.
__app/Application/Sonata/UserBundle/Admin/Model/UserAdmin.php__
namespace Application\Sonata\UserBundle\Admin\Model;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseType;
class UserAdmin extends BaseType
{
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('username')
->add('groups')
->add('enabled')
;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('username')
->add('email')
->add('plainPassword', 'text', array('required' => false))
->end()
->with('Groups')
->add('groups', 'sonata_type_model', array('required' => false))
->end()
->with('Profile')
->add('firstname', null, array('required' => false))
->add('lastname', null, array('required' => false))
->end()
;
}
/**
* {@inheritdoc}
*/
public function preUpdate($user)
{
$this->getUserManager()->updateCanonicalFields($user);
$this->getUserManager()->updatePassword($user);
}
/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}
/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}
public function getName()
{
return 'sonata.admin.extension';
}
}
__app/config/config.yml__
services:
sonata.admin.extension:
class: Application\Sonata\UserBundle\Admin\Model\UserAdmin
tags:
- { name: sonata.admin.extension, target: sonata.user.admin.user }
But I'm getting
> Cannot import resource "/var/www/Symfony/app/config/." from "/var/www/Symfony/app/config/routing.yml".
> ...
> ErrorException: Runtime Notice: Declaration of Application\Sonata\UserBundle\Admin\Model\UserAdmin::configureListFields() should be compatible with that of Sonata\UserBundle\Admin\Model\UserAdmin::configureListFields() in /var/www/Symfony/app/Application/Sonata/UserBundle/Admin/Model/UserAdmin.php line 84
What am I doing ?
[1]: http://sonata-project.org/bundles/admin/master/doc/reference/advance.html#admin-extension | php | symfony-2.0 | symfony-sonata | sonata-admin | null | null | open | SonataUser - Extending Admin
===
I'm trying to modify the default admin of the `User` entity.
Just need to remove certain fields from the form actually.
I imagine [this doc][1] will be usefull for me when it'll be available.
For now I have created this admin and tried to override the default `User` one.
__app/Application/Sonata/UserBundle/Admin/Model/UserAdmin.php__
namespace Application\Sonata\UserBundle\Admin\Model;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseType;
class UserAdmin extends BaseType
{
/**
* {@inheritdoc}
*/
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('username')
->add('groups')
->add('enabled')
;
}
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('username')
->add('email')
->add('plainPassword', 'text', array('required' => false))
->end()
->with('Groups')
->add('groups', 'sonata_type_model', array('required' => false))
->end()
->with('Profile')
->add('firstname', null, array('required' => false))
->add('lastname', null, array('required' => false))
->end()
;
}
/**
* {@inheritdoc}
*/
public function preUpdate($user)
{
$this->getUserManager()->updateCanonicalFields($user);
$this->getUserManager()->updatePassword($user);
}
/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}
/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}
public function getName()
{
return 'sonata.admin.extension';
}
}
__app/config/config.yml__
services:
sonata.admin.extension:
class: Application\Sonata\UserBundle\Admin\Model\UserAdmin
tags:
- { name: sonata.admin.extension, target: sonata.user.admin.user }
But I'm getting
> Cannot import resource "/var/www/Symfony/app/config/." from "/var/www/Symfony/app/config/routing.yml".
> ...
> ErrorException: Runtime Notice: Declaration of Application\Sonata\UserBundle\Admin\Model\UserAdmin::configureListFields() should be compatible with that of Sonata\UserBundle\Admin\Model\UserAdmin::configureListFields() in /var/www/Symfony/app/Application/Sonata/UserBundle/Admin/Model/UserAdmin.php line 84
What am I doing ?
[1]: http://sonata-project.org/bundles/admin/master/doc/reference/advance.html#admin-extension | 0 |
11,430,378 | 07/11/2012 10:12:38 | 112,931 | 05/27/2009 06:28:01 | 123 | 5 | What is the best way to create deployable package with database creation for Windows Azure? | I am working on an ASP.NET web application. The idea is that it will be sold as a "package" for simple deployment. I've made webdeploy based ZIP package for deploying directly from IIS (Import Application feature). It allows user to specify all settings (names, users, passwords) in a text fields. Then everything (even database) is deployed, configured and ready to use without any deep knowledge or manual configuration.
I would like to have the same experience when someone would like to deploy my application to Azure. I mean everything should be in one package and person responsible for deployment should only fill in few text boxes to configure and deploy whole application (with database its structure and initial data)
The question is: Is it possible? If yes where can I find any information?
Thanks,
Marcin | asp.net | .net | azure | cloud | webdeploy | null | open | What is the best way to create deployable package with database creation for Windows Azure?
===
I am working on an ASP.NET web application. The idea is that it will be sold as a "package" for simple deployment. I've made webdeploy based ZIP package for deploying directly from IIS (Import Application feature). It allows user to specify all settings (names, users, passwords) in a text fields. Then everything (even database) is deployed, configured and ready to use without any deep knowledge or manual configuration.
I would like to have the same experience when someone would like to deploy my application to Azure. I mean everything should be in one package and person responsible for deployment should only fill in few text boxes to configure and deploy whole application (with database its structure and initial data)
The question is: Is it possible? If yes where can I find any information?
Thanks,
Marcin | 0 |
11,430,383 | 07/11/2012 10:12:54 | 676,437 | 03/25/2011 09:31:04 | 11 | 0 | After using javascript to click button, submit button doesn't post back | Got a very weird problem that seems to be IE specific.
I have a form with a FileUpload control on it. However, its not possible (as far as I know) to style the button and textbox of this control individually, so what I've done is add a second button to the page, styled as I want it. Within the OnClientClick event of this button it simply clicks the "Browse" button of the FileUpload control and I select the file. I then have an "Import" button which posts back and imports the file.
In Chrome and Firefox this all works great. However, I've just tested it in IE, and the first time I hit the "Import" button, nothing happens, except for clearing the FileUpload control. Click the button again and it posts back, but there is now no file to upload. I've put an alert on the button on client click and this fires, but it doesn't post back.
If however I use the "Browse" button direct, it all works fine, so it seems to be something to do with Javascript clicking the button for me, however I cannot see why this would be, and again it seems to be IE specific. (IE9).
Does anyone know what might be causing this, and how I might fix it (without hopefully going back to just using the not very stylish FileUpload control)?
Code is as follows:
<script>
function SelectFile() {
$("#<%= uplFile.ClientID %>").click();
}
</script>
<asp:Button runat="server" ID="btnSelectFile" OnClientClick="SelectFile();return false;" Text="Select File" />
<asp:FileUpload runat="server" ID="uplFile" Width="250" CssClass="FileUpload" OnChange="ShowSelectedFilename(this.value)" />
<asp:Button runat="server" ID="btnImport" Text="Import" OnClick="btnImport_Click" />
NB: I have also tried it without the "return false;" inside the OnClientClick event on the btnSelectFile button. I've also tried using document.getElementById instead of JQuery to do the click but get the same issue.
Any help would be much appreciated. | javascript | asp.net | null | null | null | null | open | After using javascript to click button, submit button doesn't post back
===
Got a very weird problem that seems to be IE specific.
I have a form with a FileUpload control on it. However, its not possible (as far as I know) to style the button and textbox of this control individually, so what I've done is add a second button to the page, styled as I want it. Within the OnClientClick event of this button it simply clicks the "Browse" button of the FileUpload control and I select the file. I then have an "Import" button which posts back and imports the file.
In Chrome and Firefox this all works great. However, I've just tested it in IE, and the first time I hit the "Import" button, nothing happens, except for clearing the FileUpload control. Click the button again and it posts back, but there is now no file to upload. I've put an alert on the button on client click and this fires, but it doesn't post back.
If however I use the "Browse" button direct, it all works fine, so it seems to be something to do with Javascript clicking the button for me, however I cannot see why this would be, and again it seems to be IE specific. (IE9).
Does anyone know what might be causing this, and how I might fix it (without hopefully going back to just using the not very stylish FileUpload control)?
Code is as follows:
<script>
function SelectFile() {
$("#<%= uplFile.ClientID %>").click();
}
</script>
<asp:Button runat="server" ID="btnSelectFile" OnClientClick="SelectFile();return false;" Text="Select File" />
<asp:FileUpload runat="server" ID="uplFile" Width="250" CssClass="FileUpload" OnChange="ShowSelectedFilename(this.value)" />
<asp:Button runat="server" ID="btnImport" Text="Import" OnClick="btnImport_Click" />
NB: I have also tried it without the "return false;" inside the OnClientClick event on the btnSelectFile button. I've also tried using document.getElementById instead of JQuery to do the click but get the same issue.
Any help would be much appreciated. | 0 |
11,430,391 | 07/11/2012 10:13:15 | 1,435,159 | 06/04/2012 12:34:08 | 20 | 0 | Circle size does not change on changing intrsic height and width in ShapeDrawable android | I am working to draw circle on imageview using shape drawable..
Code:-
ShapeDrawable sd = new ShapeDrawable(new OvalShape());
sd.setIntrinsicWidth(10);
sd.setIntrinsicHeight(10);
sd.getPaint().setColor(Color.BLUE);
iv.setBackgroundDrawable(sd);
Although I change the intrinsic height and width there is no change in the size of circle and the size of circle fills the whole imageview .
| android | width | circle | intrinsics | shapedrawable | null | open | Circle size does not change on changing intrsic height and width in ShapeDrawable android
===
I am working to draw circle on imageview using shape drawable..
Code:-
ShapeDrawable sd = new ShapeDrawable(new OvalShape());
sd.setIntrinsicWidth(10);
sd.setIntrinsicHeight(10);
sd.getPaint().setColor(Color.BLUE);
iv.setBackgroundDrawable(sd);
Although I change the intrinsic height and width there is no change in the size of circle and the size of circle fills the whole imageview .
| 0 |
11,430,346 | 07/11/2012 10:11:11 | 1,230,036 | 02/24/2012 05:45:40 | 26 | 10 | make folder in sand box of osx | using the code below to get the file path:
NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
path = [path stringByAppendingPathComponent:executableName];
then I want to save data to the file (settings.bundle)
NSString *filePath = [path stringByAppendingPathComponent:@"settings.bundle"];
[someString writeToFile:settingsPath atomically:YES encoding:NSUTF8StringEncoding error:&error];
the error:
Error Domain=NSCocoaErrorDomain Code=4 "The folder βsettings.bundleβ doesnβt exist." UserInfo=0x7ff8894cecc0 {NSFilePath=/Users/xxxx/Library/Application Support/AppName/settings.bundle, NSUserStringVariant=Folder, NSUnderlyingError=0x7ff8894a1750 "The operation couldnβt be completed. No such file or directory"}
but if I mkdir AppName manual there is no error:
mkdir /Users/xxxx/Library/Application Support/AppName
So My question is : Cocoa can NOT create folder automatic in osx? | osx | cocoa | sandbox | null | null | null | open | make folder in sand box of osx
===
using the code below to get the file path:
NSString *executableName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleExecutable"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
path = [path stringByAppendingPathComponent:executableName];
then I want to save data to the file (settings.bundle)
NSString *filePath = [path stringByAppendingPathComponent:@"settings.bundle"];
[someString writeToFile:settingsPath atomically:YES encoding:NSUTF8StringEncoding error:&error];
the error:
Error Domain=NSCocoaErrorDomain Code=4 "The folder βsettings.bundleβ doesnβt exist." UserInfo=0x7ff8894cecc0 {NSFilePath=/Users/xxxx/Library/Application Support/AppName/settings.bundle, NSUserStringVariant=Folder, NSUnderlyingError=0x7ff8894a1750 "The operation couldnβt be completed. No such file or directory"}
but if I mkdir AppName manual there is no error:
mkdir /Users/xxxx/Library/Application Support/AppName
So My question is : Cocoa can NOT create folder automatic in osx? | 0 |
11,479,471 | 07/13/2012 23:08:11 | 1,497,417 | 07/03/2012 00:28:34 | 1 | 0 | Looking for a search string in a file and using those lines for processing in TCL | To be more precise:
I need to be looking into a file abc.txt which has contents something like this:
files/f1/atmp.c 98 100
files/f1/atmp1.c 89 100
files/f1/atmp2.c !! 75 100
files/f2/btmp.c 92 100
files/f2/btmp2.c !! 85 100
files/f3/xtmp.c 92 100
The script needs to find "!!" and use those lines to print out the following as output:
atmp2.c 75
btmp2.c 85
Any help?
| script | tcl | null | null | null | null | open | Looking for a search string in a file and using those lines for processing in TCL
===
To be more precise:
I need to be looking into a file abc.txt which has contents something like this:
files/f1/atmp.c 98 100
files/f1/atmp1.c 89 100
files/f1/atmp2.c !! 75 100
files/f2/btmp.c 92 100
files/f2/btmp2.c !! 85 100
files/f3/xtmp.c 92 100
The script needs to find "!!" and use those lines to print out the following as output:
atmp2.c 75
btmp2.c 85
Any help?
| 0 |
11,479,478 | 07/13/2012 23:09:14 | 1,061,413 | 11/23/2011 08:04:56 | 118 | 0 | Correct syntax for get requests with rest-client | Right now I can make a request as follows:
<code>user = 'xxx'
token = 'xxx'
survey_id = 'xxx'
response = RestClient.get "https://survey.qualtrics.com/WRAPI/ControlPanel/api.php?Request=getLegacyResponseData&User=#{user}&Token=#{token}&Version=2.0&SurveyID=#{survey_id}&Format=XML"</code>
But there should be some nicer way to do this. I've tried things like:
<code>response = RestClient.get "https://survey.qualtrics.com/WRAPI/ControlPanel/api.php", :Request => 'getLegacyResponseData', :User => user, :Token => token, :Version => '2.0', :SurveyID => survey_id, :Format => 'XML'</code>
and variations thereof (strings instead of symbols for keys, including \{ and \}, making the keys lower case, etc.) but none of the combinations I tried seemed to work. What's the correct syntax here? | ruby | rest-client | null | null | null | null | open | Correct syntax for get requests with rest-client
===
Right now I can make a request as follows:
<code>user = 'xxx'
token = 'xxx'
survey_id = 'xxx'
response = RestClient.get "https://survey.qualtrics.com/WRAPI/ControlPanel/api.php?Request=getLegacyResponseData&User=#{user}&Token=#{token}&Version=2.0&SurveyID=#{survey_id}&Format=XML"</code>
But there should be some nicer way to do this. I've tried things like:
<code>response = RestClient.get "https://survey.qualtrics.com/WRAPI/ControlPanel/api.php", :Request => 'getLegacyResponseData', :User => user, :Token => token, :Version => '2.0', :SurveyID => survey_id, :Format => 'XML'</code>
and variations thereof (strings instead of symbols for keys, including \{ and \}, making the keys lower case, etc.) but none of the combinations I tried seemed to work. What's the correct syntax here? | 0 |
11,479,485 | 07/13/2012 23:09:55 | 1,524,638 | 07/13/2012 20:59:39 | 6 | 0 | Average Rainfall Calculator | The program I have written so far is:
# This program averages rainfall per month. It asks the user for the number
# of years. It will then display the number of months, the total inches of
# rainfaill, and the average rainfall per month for the entire period.
# Get the number of years.
total_years = int(input('Enter the amount of years: '))
# Get the amount of rainfall for each month of each year.
for years in range(total_years):
# Initialize the accumulator.
total = 0.0
print('Year', years + 1)
print('----------------')
for month in ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'):
inches = float(input('Enter the inches measured in month', month))
total += inches
# Calculate the average number of rainfall this month.
average = total / month
# Display the average.
print('The average of rainfall for each year', years + 1, 'is:', average)
print()
This is the error message I am getting when attempting to test the code:
Traceback (most recent call last):
File "C:/Users/Alex/Desktop/Programming Concepts/Homework 2/Chapter 5/Average Rainfall maybe.py", line 17, in <module>
inches = float(input('Enter the inches measured in month', month))
TypeError: input expected at most 1 arguments, got 2"
Any ideas on how to fix/improve this code? Thank you in advance! | python | homework | average | null | null | null | open | Average Rainfall Calculator
===
The program I have written so far is:
# This program averages rainfall per month. It asks the user for the number
# of years. It will then display the number of months, the total inches of
# rainfaill, and the average rainfall per month for the entire period.
# Get the number of years.
total_years = int(input('Enter the amount of years: '))
# Get the amount of rainfall for each month of each year.
for years in range(total_years):
# Initialize the accumulator.
total = 0.0
print('Year', years + 1)
print('----------------')
for month in ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'):
inches = float(input('Enter the inches measured in month', month))
total += inches
# Calculate the average number of rainfall this month.
average = total / month
# Display the average.
print('The average of rainfall for each year', years + 1, 'is:', average)
print()
This is the error message I am getting when attempting to test the code:
Traceback (most recent call last):
File "C:/Users/Alex/Desktop/Programming Concepts/Homework 2/Chapter 5/Average Rainfall maybe.py", line 17, in <module>
inches = float(input('Enter the inches measured in month', month))
TypeError: input expected at most 1 arguments, got 2"
Any ideas on how to fix/improve this code? Thank you in advance! | 0 |
11,479,490 | 07/13/2012 23:10:34 | 1,524,691 | 07/13/2012 21:34:18 | 1 | 0 | Multi Store Open Source E-Commerce Solution for ASP.NET? | I realize this is asking for a lot, but I've been researching this for my senior project and haven't come up with any viable results.
There are plenty of open source shopping carts for ASP.NET, but none of them support multiple vendors or storefronts.
The project involves creating a fictitious company, similar to bigcartel, where users can sign up and create virtual storefronts to sell their products on. Each store would only need to house about 5 products, and have a biography page for the store owner.
Each storefront could be stand alone, they don't need to be able to communicate with each other and there doesn't need to be any search capabilities or cross store functionality.
I've been looking at nopCommerce, but the closest I can get with that platform is a plug-in that is still in beta and doesn't function very well.
I realize there are a few PHP options out there that support multiple vendors like Magento, but the course is focusing on ASP.NET platforms exclusively.
Any guidance would be greatly appreciated! | asp.net | open-source | e-commerce | shopping-cart | null | null | open | Multi Store Open Source E-Commerce Solution for ASP.NET?
===
I realize this is asking for a lot, but I've been researching this for my senior project and haven't come up with any viable results.
There are plenty of open source shopping carts for ASP.NET, but none of them support multiple vendors or storefronts.
The project involves creating a fictitious company, similar to bigcartel, where users can sign up and create virtual storefronts to sell their products on. Each store would only need to house about 5 products, and have a biography page for the store owner.
Each storefront could be stand alone, they don't need to be able to communicate with each other and there doesn't need to be any search capabilities or cross store functionality.
I've been looking at nopCommerce, but the closest I can get with that platform is a plug-in that is still in beta and doesn't function very well.
I realize there are a few PHP options out there that support multiple vendors like Magento, but the course is focusing on ASP.NET platforms exclusively.
Any guidance would be greatly appreciated! | 0 |
11,479,502 | 07/13/2012 23:12:09 | 1,524,792 | 07/13/2012 23:04:17 | 1 | 0 | Bash script to launch app and login - gets stuck, cursor doesn't move down the page | What I want to do: Clear data, launch my app, on the first page tab down and agree to conditions, then on next page tab down to signin textfields, enter username, password, then tap sign in.
What happens is data is cleared, app is launched, then the app just sits on the terms/conditions screen, the cursor does not move down to the buttons.
What am I missing? Do I need to bring focus to the screen so that the cursor gets a location before I move it?
Thanks!!
#!/bash/src
adb shell pm clear com.myapp.package
adb shell am start -n com.myapp.package/com.myapp.package.Main
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 21
adb shell input keyevent 66
adb shell input text "username"
adb shell input keyevent 20
adb shell input text "password"
adb shell input keyevent 20
adb shell input keyevent 66
| android | bash | shell | input | adb | null | open | Bash script to launch app and login - gets stuck, cursor doesn't move down the page
===
What I want to do: Clear data, launch my app, on the first page tab down and agree to conditions, then on next page tab down to signin textfields, enter username, password, then tap sign in.
What happens is data is cleared, app is launched, then the app just sits on the terms/conditions screen, the cursor does not move down to the buttons.
What am I missing? Do I need to bring focus to the screen so that the cursor gets a location before I move it?
Thanks!!
#!/bash/src
adb shell pm clear com.myapp.package
adb shell am start -n com.myapp.package/com.myapp.package.Main
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 20
adb shell input keyevent 21
adb shell input keyevent 66
adb shell input text "username"
adb shell input keyevent 20
adb shell input text "password"
adb shell input keyevent 20
adb shell input keyevent 66
| 0 |
11,479,503 | 07/13/2012 23:12:09 | 1,464,621 | 06/18/2012 19:22:43 | 1 | 0 | can i do a limited beta of a spotify app? | Was wondering, once I submit a concept and it is approved, whether I am able to test my app with real Spotify users before submitting it for general availability. If so, how would I do that? I'd expect I could have a page that people can accept the conditions and click to accept, then it would install the app in their installation but it would not be visible in the general app store. Is this possible?
Thanks,
JohnC | spotify | null | null | null | null | null | open | can i do a limited beta of a spotify app?
===
Was wondering, once I submit a concept and it is approved, whether I am able to test my app with real Spotify users before submitting it for general availability. If so, how would I do that? I'd expect I could have a page that people can accept the conditions and click to accept, then it would install the app in their installation but it would not be visible in the general app store. Is this possible?
Thanks,
JohnC | 0 |
11,479,504 | 07/13/2012 23:12:21 | 1,523,887 | 07/13/2012 14:46:44 | 11 | 1 | Variable assign from csv file for WMIC uninstallation bat file | I'm trying to get the csv input from "file.txt" (created from the code below) and assign variables to each row of data to use in a uninstallation program
wmic /output:file.txt product get name /format:csv
I'm able to generate a file called "file.txt" from the above code. I need to now get that csv data and assign variables like:
1 this is the first installed program
2 this is the second installed program
3 this is the third installed program
then I'll run:
@echo Pick a number:
choice /c:12345
if "%errorlevel%"=="1" wmic product where name="First program" call uninstall
if "%errorlevel%"=="2" wmic product where name="Second program" call uninstall
if "%errorlevel%"=="3" wmic product where name="Third program" call uninstall
if "%errorlevel%"=="4" wmic product where name="Fourth program" call uninstall
if "%errorlevel%"=="5" wmic product where name="Fifth program" call uninstall
I'll only have to type a number instead of typing in the whole name to use wmic uninstall command.
-George
| variables | csv | menu | assign | wmic | null | open | Variable assign from csv file for WMIC uninstallation bat file
===
I'm trying to get the csv input from "file.txt" (created from the code below) and assign variables to each row of data to use in a uninstallation program
wmic /output:file.txt product get name /format:csv
I'm able to generate a file called "file.txt" from the above code. I need to now get that csv data and assign variables like:
1 this is the first installed program
2 this is the second installed program
3 this is the third installed program
then I'll run:
@echo Pick a number:
choice /c:12345
if "%errorlevel%"=="1" wmic product where name="First program" call uninstall
if "%errorlevel%"=="2" wmic product where name="Second program" call uninstall
if "%errorlevel%"=="3" wmic product where name="Third program" call uninstall
if "%errorlevel%"=="4" wmic product where name="Fourth program" call uninstall
if "%errorlevel%"=="5" wmic product where name="Fifth program" call uninstall
I'll only have to type a number instead of typing in the whole name to use wmic uninstall command.
-George
| 0 |
11,479,505 | 07/13/2012 23:12:26 | 239,916 | 12/29/2009 01:52:35 | 4,023 | 143 | Get all function parameter names | An example of what I want is this:
char const * bar (T1 x, T2 y) {
return "bar";
}
char const * foo (T1 z, T2 w) {
return bar(__PARAMS__);
}
should expand to
char const * bar (T1 x, T2 y) {
return "bar";
}
char const * foo (T1 z, T2 w) {
return bar(z, w);
}
Is there any way to achieve anything remotely like this without hand-writing it? | c++ | null | null | null | null | null | open | Get all function parameter names
===
An example of what I want is this:
char const * bar (T1 x, T2 y) {
return "bar";
}
char const * foo (T1 z, T2 w) {
return bar(__PARAMS__);
}
should expand to
char const * bar (T1 x, T2 y) {
return "bar";
}
char const * foo (T1 z, T2 w) {
return bar(z, w);
}
Is there any way to achieve anything remotely like this without hand-writing it? | 0 |
11,479,506 | 07/13/2012 23:12:27 | 633,445 | 02/25/2011 02:13:05 | 1 | 0 | How to extract the attribute's value in python? | I have a html file say:
<html>...
<li id="123"></li>
<li id="3455"></li>
....
</html>
how do I get the value for all the ids alone in python using BeautifulSoup ?
the desired o/p is : ["123","3455"]
Thanks
| python | attributes | beautifulsoup | values | null | null | open | How to extract the attribute's value in python?
===
I have a html file say:
<html>...
<li id="123"></li>
<li id="3455"></li>
....
</html>
how do I get the value for all the ids alone in python using BeautifulSoup ?
the desired o/p is : ["123","3455"]
Thanks
| 0 |
11,479,507 | 07/13/2012 23:12:31 | 122,769 | 06/14/2009 16:17:08 | 891 | 34 | Calculate in which UIView in Superview subviews a dragged UIView occupies bigger area | I would like to find out in row and column ordered UIViews, subviews inside a superview, while dragging one of them and then let it go with which one of all the others intersects its bigger area.
I need this to insert the draggable UIView between the UIViews that intersects.
Do I have to calculate frame.origin values? If yes could I have an example? Or this could happen using iOS SDK ?
I already aware of CGRectIntersectsRect but this gives me the first UIView that intersects. Though its most possible need to place the UIView between other UIViews.
I had an example using pointInside with no luck.
Code:
CGPoint centerInView = [viewDragged convertPoint:viewDragged.center toView:view]; // Checking with the views inside NSMutableArray in a for in statement
if ([view pointInside:centerInView withEvent:nil]) // This if statement almost never is true sometimes only
Other approach:
if (CGRectIntersectsRect(viewDragged.frame, view.frame)) // This always happens for the first UIView in subviews that intersects. Not so applicable for information
Basically the idea is to insert the draggable view between the nearest UIViews.
Imagine 1,2,3,4,5 same size views in the screen and try to drag the first let it go between 4,5 and then have 2,3,4,1,5. You get the idea.
This all should happen without the help of any new Grid. The only part I need is calculate that you put the 1 UIView between 4,5.
I could start calculating frames,origins but this does not sound efficient to me. Any thoughts?
Thank you. | objective-c | uiview | position | null | null | null | open | Calculate in which UIView in Superview subviews a dragged UIView occupies bigger area
===
I would like to find out in row and column ordered UIViews, subviews inside a superview, while dragging one of them and then let it go with which one of all the others intersects its bigger area.
I need this to insert the draggable UIView between the UIViews that intersects.
Do I have to calculate frame.origin values? If yes could I have an example? Or this could happen using iOS SDK ?
I already aware of CGRectIntersectsRect but this gives me the first UIView that intersects. Though its most possible need to place the UIView between other UIViews.
I had an example using pointInside with no luck.
Code:
CGPoint centerInView = [viewDragged convertPoint:viewDragged.center toView:view]; // Checking with the views inside NSMutableArray in a for in statement
if ([view pointInside:centerInView withEvent:nil]) // This if statement almost never is true sometimes only
Other approach:
if (CGRectIntersectsRect(viewDragged.frame, view.frame)) // This always happens for the first UIView in subviews that intersects. Not so applicable for information
Basically the idea is to insert the draggable view between the nearest UIViews.
Imagine 1,2,3,4,5 same size views in the screen and try to drag the first let it go between 4,5 and then have 2,3,4,1,5. You get the idea.
This all should happen without the help of any new Grid. The only part I need is calculate that you put the 1 UIView between 4,5.
I could start calculating frames,origins but this does not sound efficient to me. Any thoughts?
Thank you. | 0 |
11,479,508 | 07/13/2012 23:12:31 | 1,052,390 | 11/17/2011 17:50:47 | 66 | 0 | Why is my SQL query not working? | I'm posting this, and getting this error:
c.execute("""update resulttest set category=""" + key + ", value=""" + str(value))
OperationalError: (1054, "Unknown column 'composed' in 'field list'")
I am trying to update the columns category and field, composed is simply a value in category.
Why is this error coming up? | python | sql | null | null | null | null | open | Why is my SQL query not working?
===
I'm posting this, and getting this error:
c.execute("""update resulttest set category=""" + key + ", value=""" + str(value))
OperationalError: (1054, "Unknown column 'composed' in 'field list'")
I am trying to update the columns category and field, composed is simply a value in category.
Why is this error coming up? | 0 |
11,350,002 | 07/05/2012 18:04:13 | 1,504,751 | 07/05/2012 17:22:59 | 1 | 0 | Class tree structure - cascading delete | I've got class(db) structure like this:
system
+----todo
+----event
+----document
+----action
| +----field
| +----window
|
+----and many other
+----which name isn't known
+----dynamically created db tables
+----there can be another class inside
Every table(db) has parent's field named after parent's table name, but sometimes it differs from 'parent'.
Every table(db) has corresponding class in php, where relations are in array variable
Eg:
class system extends mainclass
{
private $_relation = array(
'todo' => array(),
'event' => array('show'=>false),
'action' => array('join'=>'action_rowid'),
);
}
class action extends mainclass
{
private $_relation = array(
'field' => array(),
'window' => array()
);
}
In this example array key 'join' tells system which relation field should use; 'show' tells to print in treeview or not.
Now i want to create treeview of all data from db or create cascade delete (if i delete system, delete all children) or change status (system's status change to active - change status to active to all children).
Using recursive check is waste of time, i dont want to create separate class with struct, or should i?
What would you suggest to build treeview of all data and made some operations on it?
Remember - i dont know the structure - it's building on-line, and tables in db have different structure (only rowid and status are common).
And as you say in Poland: Thanks from the mountain. | php | sql | class | tree-structure | null | null | open | Class tree structure - cascading delete
===
I've got class(db) structure like this:
system
+----todo
+----event
+----document
+----action
| +----field
| +----window
|
+----and many other
+----which name isn't known
+----dynamically created db tables
+----there can be another class inside
Every table(db) has parent's field named after parent's table name, but sometimes it differs from 'parent'.
Every table(db) has corresponding class in php, where relations are in array variable
Eg:
class system extends mainclass
{
private $_relation = array(
'todo' => array(),
'event' => array('show'=>false),
'action' => array('join'=>'action_rowid'),
);
}
class action extends mainclass
{
private $_relation = array(
'field' => array(),
'window' => array()
);
}
In this example array key 'join' tells system which relation field should use; 'show' tells to print in treeview or not.
Now i want to create treeview of all data from db or create cascade delete (if i delete system, delete all children) or change status (system's status change to active - change status to active to all children).
Using recursive check is waste of time, i dont want to create separate class with struct, or should i?
What would you suggest to build treeview of all data and made some operations on it?
Remember - i dont know the structure - it's building on-line, and tables in db have different structure (only rowid and status are common).
And as you say in Poland: Thanks from the mountain. | 0 |
11,350,287 | 07/05/2012 18:24:37 | 675,383 | 03/24/2011 17:29:12 | 3,116 | 138 | onGetViewFactory only called once for multiple widgets | I have an appwidget which uses `ListView`.
I have created a class that extends `RemoteViewsService`:
public class AppWidgetService extends RemoteViewsService {
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return (new AppWidgetListFactory(this.getApplicationContext(), intent));
}
}
In my `AppWidgetProvider`, I call the following method for each instance of the widget (for each `appWidgetId`):
private static void fillInList(RemoteViews widget, Context context, int appWidgetId) {
Intent intent = new Intent(context, AppWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
widget.setRemoteAdapter(R.id.appwidget_listview, intent);
}
Now the problem is, that the `fillInList` method gets called just as often as there are instances of the widget, but the `onGetViewFactory` method only gets called once. This results in all the widgets showing the same data.
How can I fix this? | android | android-appwidget | null | null | null | null | open | onGetViewFactory only called once for multiple widgets
===
I have an appwidget which uses `ListView`.
I have created a class that extends `RemoteViewsService`:
public class AppWidgetService extends RemoteViewsService {
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return (new AppWidgetListFactory(this.getApplicationContext(), intent));
}
}
In my `AppWidgetProvider`, I call the following method for each instance of the widget (for each `appWidgetId`):
private static void fillInList(RemoteViews widget, Context context, int appWidgetId) {
Intent intent = new Intent(context, AppWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
widget.setRemoteAdapter(R.id.appwidget_listview, intent);
}
Now the problem is, that the `fillInList` method gets called just as often as there are instances of the widget, but the `onGetViewFactory` method only gets called once. This results in all the widgets showing the same data.
How can I fix this? | 0 |
11,349,419 | 07/05/2012 17:26:22 | 862,132 | 07/25/2011 18:10:21 | 170 | 3 | Split throwing 500 error | I am very new to Classic ASP and Visual Basic. I am having trouble doing a simple split. I have the following code:
Dim sFileName, startDate, fsObject, filObject, oArray, oSplit
oArray = Split(Replace(Request.Form("txtOutput"),vbCrLf, "|"),"|")
For Idx = 0 To Ubound(oArray)
oSplit = Split(oArray(Idx), ",")
response.Write(oSplit & "</br>")
Next
My `txtOutput` looks something like:
0342-John Doe,0,0,0,,
0134-Jane Doe,15,0,0,,
0343-John Smith,44.5,0,0,,
Am I doing something wrong? | asp-classic | vb6 | null | null | null | null | open | Split throwing 500 error
===
I am very new to Classic ASP and Visual Basic. I am having trouble doing a simple split. I have the following code:
Dim sFileName, startDate, fsObject, filObject, oArray, oSplit
oArray = Split(Replace(Request.Form("txtOutput"),vbCrLf, "|"),"|")
For Idx = 0 To Ubound(oArray)
oSplit = Split(oArray(Idx), ",")
response.Write(oSplit & "</br>")
Next
My `txtOutput` looks something like:
0342-John Doe,0,0,0,,
0134-Jane Doe,15,0,0,,
0343-John Smith,44.5,0,0,,
Am I doing something wrong? | 0 |
11,349,420 | 07/05/2012 17:26:23 | 1,504,721 | 07/05/2012 17:06:59 | 1 | 0 | Change default button name of Browse in ace:FileEntry | I am trying to use ace:fileEntry component to upload images to my database but now, I want to change the name of the button "Browse" in my case "Seleccionar archivo" but I don't know where that name is stored.
<ace:fileEntry id="ImageFileEntry"
fileEntryListener="#{usuarioBean.sampleListener}"
useSessionSubdir="true">
</ace:fileEntry>
<h:commandButton id="submit" value="subir"></h:commandButton>
I attached a screenshot
http://i.stack.imgur.com/8b817.png
thanks
| java-ee | jsf-2.0 | icefaces | icefaces-3 | null | null | open | Change default button name of Browse in ace:FileEntry
===
I am trying to use ace:fileEntry component to upload images to my database but now, I want to change the name of the button "Browse" in my case "Seleccionar archivo" but I don't know where that name is stored.
<ace:fileEntry id="ImageFileEntry"
fileEntryListener="#{usuarioBean.sampleListener}"
useSessionSubdir="true">
</ace:fileEntry>
<h:commandButton id="submit" value="subir"></h:commandButton>
I attached a screenshot
http://i.stack.imgur.com/8b817.png
thanks
| 0 |
11,349,421 | 07/05/2012 17:26:25 | 726,706 | 04/27/2011 07:05:58 | 534 | 7 | how can I get past information on twitter? | I need to do some comparison on twitter trends and therefore I need to get past statistics.
for example, how many followers user X had 2 years ago.
Any idea of how to achieve this? or any point to the right direction?
thanks.
| twitter | twitter-api | null | null | null | null | open | how can I get past information on twitter?
===
I need to do some comparison on twitter trends and therefore I need to get past statistics.
for example, how many followers user X had 2 years ago.
Any idea of how to achieve this? or any point to the right direction?
thanks.
| 0 |
11,348,903 | 07/05/2012 16:47:58 | 145,988 | 07/27/2009 20:18:17 | 405 | 3 | recreate directory structure and recursively process each file with gnu make | I have a directory tree like this:
βββ dir_a
βΒ Β βββ file_1.txt
βββ dir_b
βΒ Β βββ dir_c
βΒ Β βββ file_2.txt
| βββ file_3.txt
βββ file_4.txt
I want to mirror this directory structure to hold the results of a command that processes each text file. I.e., the output would look like this:
βββ build
βΒ Β βββ dir_a
βΒ Β βΒ Β βββ processed_file_1.txt
βΒ Β βββ dir_b
βΒ Β βΒ Β βββ dir_c
βΒ Β βΒ Β βββ processed_file_2.txt
βΒ Β | βββ processed_file_3.txt
βΒ Β βββ processed_file_4.txt
βββ dir_a
βΒ Β βββ file_1.txt
βββ dir_b
βΒ Β βββ dir_c
βΒ Β βββ file_2.txt
| βββ file_3.txt
βββ file_4.txt
I'm not very adept with Makefiles, so my question is: how can I get a Makefile to recreate the directory structure and recursively process all text files to place them into the right place inside the build directory? I'll be running this repeatedly as the input files change, so a Makefile that doesn't process unchanged files seems like the right way to go. | makefile | null | null | null | null | null | open | recreate directory structure and recursively process each file with gnu make
===
I have a directory tree like this:
βββ dir_a
βΒ Β βββ file_1.txt
βββ dir_b
βΒ Β βββ dir_c
βΒ Β βββ file_2.txt
| βββ file_3.txt
βββ file_4.txt
I want to mirror this directory structure to hold the results of a command that processes each text file. I.e., the output would look like this:
βββ build
βΒ Β βββ dir_a
βΒ Β βΒ Β βββ processed_file_1.txt
βΒ Β βββ dir_b
βΒ Β βΒ Β βββ dir_c
βΒ Β βΒ Β βββ processed_file_2.txt
βΒ Β | βββ processed_file_3.txt
βΒ Β βββ processed_file_4.txt
βββ dir_a
βΒ Β βββ file_1.txt
βββ dir_b
βΒ Β βββ dir_c
βΒ Β βββ file_2.txt
| βββ file_3.txt
βββ file_4.txt
I'm not very adept with Makefiles, so my question is: how can I get a Makefile to recreate the directory structure and recursively process all text files to place them into the right place inside the build directory? I'll be running this repeatedly as the input files change, so a Makefile that doesn't process unchanged files seems like the right way to go. | 0 |
11,350,300 | 07/05/2012 18:25:15 | 12,386 | 09/16/2008 14:11:53 | 1,372 | 64 | I have a hashmap that I synchronize around yet my program doesn't work in a threaded environment. Can anybody see what I'm doing wrong? | I know you have to synchronize around anything that would change the structure of a hashmap (put or remove) but it seems to me you also have to synchronize around reads of the hashmap otherwise you might be reading while another thread is changing the structure of the hashmap.
So I sync around gets and puts to my hashmap.
The only machines I have available to me to test with all only have one processor so I never had any real concurrency until the system went to production and started failing. Items were missing out of my hashmap. I assume this is because two threads were writing at the same time, but based on the code below, this should not be possible. When I turned down the number of threads to 1 it started working flawlessly, so it's definitely a threading problem.
Details:
// something for all the threads to sync on
private static Object EMREPORTONE = new Object();
synchronized (EMREPORTONE)
{
reportdatacache.put("name.." + eri.recip_map_id, eri.name);
reportdatacache.put("subjec" + eri.recip_map_id, eri.subject);
etc...
}
... and elsewhere....
synchronized (EMREPORTONE)
{
eri.name = (String)reportdatacache.get("name.." + eri.recip_map_id);
eri.subject = (String)reportdatacache.get("subjec" + eri.recip_map_id);
etc...
}
and that's it. I pass around reportdatacache between functions, but that's just the reference to the hashmap.
Another important point is that this is running as a servlet in an appserver (iplanet to be specific, but I know none of you have ever heard of that)
But regardless, EMREPORTONE is global to the webserver process, no two threads should be able to step on each other, yet my hashmap is getting wrecked. Any thoughts?
| java | multithreading | null | null | null | null | open | I have a hashmap that I synchronize around yet my program doesn't work in a threaded environment. Can anybody see what I'm doing wrong?
===
I know you have to synchronize around anything that would change the structure of a hashmap (put or remove) but it seems to me you also have to synchronize around reads of the hashmap otherwise you might be reading while another thread is changing the structure of the hashmap.
So I sync around gets and puts to my hashmap.
The only machines I have available to me to test with all only have one processor so I never had any real concurrency until the system went to production and started failing. Items were missing out of my hashmap. I assume this is because two threads were writing at the same time, but based on the code below, this should not be possible. When I turned down the number of threads to 1 it started working flawlessly, so it's definitely a threading problem.
Details:
// something for all the threads to sync on
private static Object EMREPORTONE = new Object();
synchronized (EMREPORTONE)
{
reportdatacache.put("name.." + eri.recip_map_id, eri.name);
reportdatacache.put("subjec" + eri.recip_map_id, eri.subject);
etc...
}
... and elsewhere....
synchronized (EMREPORTONE)
{
eri.name = (String)reportdatacache.get("name.." + eri.recip_map_id);
eri.subject = (String)reportdatacache.get("subjec" + eri.recip_map_id);
etc...
}
and that's it. I pass around reportdatacache between functions, but that's just the reference to the hashmap.
Another important point is that this is running as a servlet in an appserver (iplanet to be specific, but I know none of you have ever heard of that)
But regardless, EMREPORTONE is global to the webserver process, no two threads should be able to step on each other, yet my hashmap is getting wrecked. Any thoughts?
| 0 |
11,350,304 | 07/05/2012 18:25:42 | 522,169 | 11/27/2010 10:25:53 | 372 | 21 | Populating a Facebook comments-box social plugin (fb:comments) with comments to a Facebook post | The Facebook comments social plug-in is usually associated via its **href** attribute. <br /> Is it possible to associate it with a Facebook **object_id** - thereby automatically populating the comments-box plugin with comments that were left on this post from within Facebook?
For example, these are comments users left on a [photo-post][1] that Facebook made on their ["Facebook" Facebook page][2]: <br /><br />
https://developers.facebook.com/tools/explorer?method=GET&path=10151287511951729%2Fcomments
The object_id of the post is 10151287511951729, and the comments are retrieved using the Graph API '/comments' connection (and can also be retrieved using FQL by querying the comment table).
So any way, if I have the relevant accessToken for the post (and all that..) - can I use an fb:comments comments-box with comments of that post?
Or, is the only way for me to show those comments in my own external place would be to create some GUI for it myself and populate it "manually" (by polling from the Graph or FQL)?
[1]: https://www.facebook.com/photo.php?fbid=10151287511951729&set=a.376995711728.190761.20531316728&type=1&theater
[2]: https://www.facebook.com/facebook | facebook | post | comments | facebook-comments | null | null | open | Populating a Facebook comments-box social plugin (fb:comments) with comments to a Facebook post
===
The Facebook comments social plug-in is usually associated via its **href** attribute. <br /> Is it possible to associate it with a Facebook **object_id** - thereby automatically populating the comments-box plugin with comments that were left on this post from within Facebook?
For example, these are comments users left on a [photo-post][1] that Facebook made on their ["Facebook" Facebook page][2]: <br /><br />
https://developers.facebook.com/tools/explorer?method=GET&path=10151287511951729%2Fcomments
The object_id of the post is 10151287511951729, and the comments are retrieved using the Graph API '/comments' connection (and can also be retrieved using FQL by querying the comment table).
So any way, if I have the relevant accessToken for the post (and all that..) - can I use an fb:comments comments-box with comments of that post?
Or, is the only way for me to show those comments in my own external place would be to create some GUI for it myself and populate it "manually" (by polling from the Graph or FQL)?
[1]: https://www.facebook.com/photo.php?fbid=10151287511951729&set=a.376995711728.190761.20531316728&type=1&theater
[2]: https://www.facebook.com/facebook | 0 |
11,350,308 | 07/05/2012 18:25:54 | 1,493,103 | 06/30/2012 14:14:11 | 17 | 1 | Error in a dynamic text view based on the xml file | i am having a dynamic text view based on the xml file.....Please help me for my code......
my codes
MessageViewPage.java
public class MessageViewPage extends Activity {
TextView sender_text,body_text;
ScrollView sv;
String nickname,body;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
Bundle b = getIntent().getExtras();
nickname= b.getString("nick");
body=b.getString("body");
sv = new ScrollView(this);
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(R.layout.message_view_page, null);
// fill in any details dynamically here
TextView sender_text = (TextView) v.findViewById(R.id.textViewSender);
sender_text.setText(" Sender : "+ nickname);
// insert into main view
View insertPoint = findViewById(R.id.textViewSender);
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));;
}
}
my xml file as follows
message_view_page.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp"
android:background="@drawable/view">
<TextView
android:id="@+id/textViewSender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginTop="35dp"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<TextView
android:id="@+id/textViewBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textViewSender"
android:layout_below="@+id/textViewSender"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:textSize="15dp"
android:textColor="#F69DD1" />
<Button
android:id="@+id/buttonReply"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="45dp"
android:layout_marginBottom="50dp"
android:text="Reply" />
<Button
android:id="@+id/buttonListen"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="45dp"
android:layout_marginBottom="50dp"
android:text="LIsten" />
</RelativeLayout>
i am having an error in
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
Please any one tell me the solution.....
| android | textview | null | null | null | null | open | Error in a dynamic text view based on the xml file
===
i am having a dynamic text view based on the xml file.....Please help me for my code......
my codes
MessageViewPage.java
public class MessageViewPage extends Activity {
TextView sender_text,body_text;
ScrollView sv;
String nickname,body;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
Bundle b = getIntent().getExtras();
nickname= b.getString("nick");
body=b.getString("body");
sv = new ScrollView(this);
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = vi.inflate(R.layout.message_view_page, null);
// fill in any details dynamically here
TextView sender_text = (TextView) v.findViewById(R.id.textViewSender);
sender_text.setText(" Sender : "+ nickname);
// insert into main view
View insertPoint = findViewById(R.id.textViewSender);
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));;
}
}
my xml file as follows
message_view_page.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp"
android:background="@drawable/view">
<TextView
android:id="@+id/textViewSender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginTop="35dp"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<TextView
android:id="@+id/textViewBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textViewSender"
android:layout_below="@+id/textViewSender"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:textSize="15dp"
android:textColor="#F69DD1" />
<Button
android:id="@+id/buttonReply"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="45dp"
android:layout_marginBottom="50dp"
android:text="Reply" />
<Button
android:id="@+id/buttonListen"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="45dp"
android:layout_marginBottom="50dp"
android:text="LIsten" />
</RelativeLayout>
i am having an error in
insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
Please any one tell me the solution.....
| 0 |
11,350,310 | 07/05/2012 18:26:06 | 187,902 | 10/11/2009 07:13:10 | 165 | 5 | wget and special characters | I am using wget locally to take a static snapshot of a small web app. When I do, the resulting html files come back with strange characters in place of quotation marks and apostrophes.
What can I do to avoid this behavior?
Thanks. | character-encoding | wget | null | null | null | null | open | wget and special characters
===
I am using wget locally to take a static snapshot of a small web app. When I do, the resulting html files come back with strange characters in place of quotation marks and apostrophes.
What can I do to avoid this behavior?
Thanks. | 0 |
11,404,417 | 07/09/2012 22:58:45 | 1,431,643 | 06/01/2012 21:24:42 | 18 | 0 | Getting weather information working on wifi but not on 3g (Android) | I'm trying to parse weather information from googles API and it works just fine when WIFI is connected, but not when then phone is connected to the Internet via 3g.
import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.Toast;
public class GetWeather2 extends Activity{
static final String baseURL = "http://www.google.com/ig/api?weather=";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.getweather2);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll().penaltyLog().build();
StrictMode.setThreadPolicy(policy);
String c = "mycity";
StringBuilder URL = new StringBuilder(baseURL);
URL.append(c);
String fullURL = URL.toString();
try{
URL website = new URL(fullURL);
//getting xmlreader to parse data
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
HandlingXMLStuff doingWork = new HandlingXMLStuff();
xr.setContentHandler(doingWork);
xr.parse(new InputSource(website.openStream()));
String[] weatherInfo = new String[] {};
weatherInfo = doingWork.getInformation();
information[5] = weatherInfo[0];
information[3] = weatherInfo[1];
//tv.setText(information);
Intent i = new Intent("blabla");
i.putExtra("information", information);
startActivity(i);
finish();
}catch (Exception e){
Toast.makeText(this, "error weather", Toast.LENGTH_SHORT).show();
Intent i = new Intent("com.blaabla");
i.putExtra("information", information);
startActivity(i);
finish();
}
}
}
(I've scaled down the code for readability)
I've checked the full URL in the phones web browser, and the XML-document looks fine with wifi on but when it's off a page appears telling it's not avalible. | android | eclipse | parsing | weather | null | null | open | Getting weather information working on wifi but not on 3g (Android)
===
I'm trying to parse weather information from googles API and it works just fine when WIFI is connected, but not when then phone is connected to the Internet via 3g.
import java.net.URL;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.Toast;
public class GetWeather2 extends Activity{
static final String baseURL = "http://www.google.com/ig/api?weather=";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.getweather2);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.detectAll().penaltyLog().build();
StrictMode.setThreadPolicy(policy);
String c = "mycity";
StringBuilder URL = new StringBuilder(baseURL);
URL.append(c);
String fullURL = URL.toString();
try{
URL website = new URL(fullURL);
//getting xmlreader to parse data
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
HandlingXMLStuff doingWork = new HandlingXMLStuff();
xr.setContentHandler(doingWork);
xr.parse(new InputSource(website.openStream()));
String[] weatherInfo = new String[] {};
weatherInfo = doingWork.getInformation();
information[5] = weatherInfo[0];
information[3] = weatherInfo[1];
//tv.setText(information);
Intent i = new Intent("blabla");
i.putExtra("information", information);
startActivity(i);
finish();
}catch (Exception e){
Toast.makeText(this, "error weather", Toast.LENGTH_SHORT).show();
Intent i = new Intent("com.blaabla");
i.putExtra("information", information);
startActivity(i);
finish();
}
}
}
(I've scaled down the code for readability)
I've checked the full URL in the phones web browser, and the XML-document looks fine with wifi on but when it's off a page appears telling it's not avalible. | 0 |
11,410,680 | 07/10/2012 09:49:34 | 347,790 | 05/22/2010 12:40:34 | 2,550 | 80 | How to select div in parent page from an iframe | I want to select a div which is in parent aspx page from a page which is called in an iframe. What i have tried is
`$(parent.document.getElementById('dvwdgloader2')).hide();`
but it only works in IE but not in other browser? how to solve this issue? | jquery | asp.net | iframe | null | null | null | open | How to select div in parent page from an iframe
===
I want to select a div which is in parent aspx page from a page which is called in an iframe. What i have tried is
`$(parent.document.getElementById('dvwdgloader2')).hide();`
but it only works in IE but not in other browser? how to solve this issue? | 0 |
11,410,682 | 07/10/2012 09:49:53 | 1,514,124 | 07/10/2012 08:12:53 | 1 | 0 | Fade entire page except certain class | I want to fade the whole page opacity out then in except a certain class on page load. (timer)
I'll be able tweak it into my current code. | javascript | jquery | css | css3 | null | null | open | Fade entire page except certain class
===
I want to fade the whole page opacity out then in except a certain class on page load. (timer)
I'll be able tweak it into my current code. | 0 |
11,410,683 | 07/10/2012 09:49:53 | 529,206 | 12/03/2010 10:00:06 | 292 | 21 | ActiveMQ delete specific message | I use the following code to recieve messages without deletion. Now I need to add some filtering and delete some of the messages. My question is how to delete a specific message while other messages should stay in the queue?
Uri connecturi = new Uri("activemq:tcp://model.net:61616");
IConnectionFactory factory = new NMSConnectionFactory(connecturi);
List<ModelBuilderBase> result = new List<ModelBuilderBase>();
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination = SessionUtil.GetDestination(session, "queue://cidModelbuilderQ");
using (IMessageConsumer consumer = session.CreateConsumer(destination))
{
connection.Start();
var q = session.GetQueue("cidModelbuilderQ");
var b = session.CreateBrowser(q);
var msgs = b.GetEnumerator();
while (msgs.MoveNext())
{
ITextMessage message = msgs.Current as ITextMessage;
if (message.Properties[MANDATOR] == null || message.Properties[REFCODE] == null)
continue;
var mandator = message.Properties[MANDATOR].ToString();
var refCode = message.Properties[REFCODE].ToString();
result.Add(ModelBuilderFactory.Instance.GetInstance(refCode, mandator));
}
}
} | c# | activemq | null | null | null | null | open | ActiveMQ delete specific message
===
I use the following code to recieve messages without deletion. Now I need to add some filtering and delete some of the messages. My question is how to delete a specific message while other messages should stay in the queue?
Uri connecturi = new Uri("activemq:tcp://model.net:61616");
IConnectionFactory factory = new NMSConnectionFactory(connecturi);
List<ModelBuilderBase> result = new List<ModelBuilderBase>();
using (IConnection connection = factory.CreateConnection())
using (ISession session = connection.CreateSession())
{
IDestination destination = SessionUtil.GetDestination(session, "queue://cidModelbuilderQ");
using (IMessageConsumer consumer = session.CreateConsumer(destination))
{
connection.Start();
var q = session.GetQueue("cidModelbuilderQ");
var b = session.CreateBrowser(q);
var msgs = b.GetEnumerator();
while (msgs.MoveNext())
{
ITextMessage message = msgs.Current as ITextMessage;
if (message.Properties[MANDATOR] == null || message.Properties[REFCODE] == null)
continue;
var mandator = message.Properties[MANDATOR].ToString();
var refCode = message.Properties[REFCODE].ToString();
result.Add(ModelBuilderFactory.Instance.GetInstance(refCode, mandator));
}
}
} | 0 |
11,410,684 | 07/10/2012 09:49:53 | 317,603 | 04/15/2010 14:36:26 | 1,096 | 17 | XSLT comma separation of elements | **I have the following XML document:**
<?xml version="1.0" encoding="UTF-8"?>
<cars>
<car>
<entrydata columnnumber="4" name="Colour">
<text>Red</text>
</entrydata>
</car>
<car>
<entrydata columnnumber="4" name="Colour">
<textlist>
<text>Yellow</text>
<text>Blue</text>
</textlist>
</entrydata>
</car>
</cars>
**And the following XSLT stylesheet:**
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com: xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<records>
<xsl:apply-templates select="//cars"/>
</records>
</xsl:template>
<!--Top level template -->
<xsl:template match="cars">
<!-- Loop through each document (viewentry) and apply create the rows for each one-->
<xsl:for-each select="car">
<record>
<xsl:attribute name="Colour">
<xsl:value-of select="entrydata[@name='Colour']"/>
</xsl:attribute>
</record>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
**This produces the following output:**
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record Colour="Red"/>
<record Colour="YellowBlue"/>
</records>
How would I modify the XSLT file so that the output becomes (note the comma separation of `<textlist>`):
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record Colour="Red"/>
<record Colour="Yellow, Blue"/>
</records> | xml | xslt | null | null | null | null | open | XSLT comma separation of elements
===
**I have the following XML document:**
<?xml version="1.0" encoding="UTF-8"?>
<cars>
<car>
<entrydata columnnumber="4" name="Colour">
<text>Red</text>
</entrydata>
</car>
<car>
<entrydata columnnumber="4" name="Colour">
<textlist>
<text>Yellow</text>
<text>Blue</text>
</textlist>
</entrydata>
</car>
</cars>
**And the following XSLT stylesheet:**
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com: xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<records>
<xsl:apply-templates select="//cars"/>
</records>
</xsl:template>
<!--Top level template -->
<xsl:template match="cars">
<!-- Loop through each document (viewentry) and apply create the rows for each one-->
<xsl:for-each select="car">
<record>
<xsl:attribute name="Colour">
<xsl:value-of select="entrydata[@name='Colour']"/>
</xsl:attribute>
</record>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
**This produces the following output:**
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record Colour="Red"/>
<record Colour="YellowBlue"/>
</records>
How would I modify the XSLT file so that the output becomes (note the comma separation of `<textlist>`):
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record Colour="Red"/>
<record Colour="Yellow, Blue"/>
</records> | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.