question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,223,349
6,224,795
Interface between Octave and R
Could anyone kindly update the status on the interface between Octave and R? ROctave package was developed in 2002, but no new updates after that. I like to call some functions from Octave in R such as "roots". How to do it? Thanks for your help.
I do not know of any active R/octave project, but if you're just after finding roots for a given polynomial you can use one of the polynom or PolynomF package: Here is an example with P(x)= 6 + 5*x + 4*x^2 + 3*x^3 + 2*x^4 + x^5. In octave, octave[2] > p = 1:6; octave[3] > roots(p) ans = 0.55169 + 1.25335i 0.55169 - 1....
Interface between Octave and R Could anyone kindly update the status on the interface between Octave and R? ROctave package was developed in 2002, but no new updates after that. I like to call some functions from Octave in R such as "roots". How to do it? Thanks for your help.
TITLE: Interface between Octave and R QUESTION: Could anyone kindly update the status on the interface between Octave and R? ROctave package was developed in 2002, but no new updates after that. I like to call some functions from Octave in R such as "roots". How to do it? Thanks for your help. ANSWER: I do not know o...
[ "r", "octave" ]
6
4
2,867
3
0
2011-06-03T05:32:31.297000
2011-06-03T08:36:53.630000
6,223,355
6,223,371
Static variables in member functions
Can someone please explain how static variables in member functions work in C++. Given the following class: class A { void foo() { static int i; i++; } } If I declare multiple instances of A, does calling foo() on one instance increment the static variable i on all instances? Or only the one it was called on? I assumed...
Since class A is a non-template class and A::foo() is a non-template function. There will be only one copy of static int i inside the program. Any instance of A object will affect the same i and lifetime of i will remain through out the program. To add an example: A o1, o2, o3; o1.foo(); // i = 1 o2.foo(); // i = 2 o3....
Static variables in member functions Can someone please explain how static variables in member functions work in C++. Given the following class: class A { void foo() { static int i; i++; } } If I declare multiple instances of A, does calling foo() on one instance increment the static variable i on all instances? Or onl...
TITLE: Static variables in member functions QUESTION: Can someone please explain how static variables in member functions work in C++. Given the following class: class A { void foo() { static int i; i++; } } If I declare multiple instances of A, does calling foo() on one instance increment the static variable i on all...
[ "c++", "static", "scope" ]
218
230
121,707
4
0
2011-06-03T05:33:53.487000
2011-06-03T05:37:31.630000
6,223,357
6,223,813
NSubstitute 'Do' event not firing
I have an issue with NSubstitute compiling using its inference typing. When I set it up with more than a return type in my.Do() statement and then try and use a counter to see how many times it is called, the counter isn't updated. I am mocking a method that returns a string (it's basically an abstraction of File.ReadA...
This works for me in NSubstitute 1.1: public interface IFileDataSource { string ReadAllText(string s); } [Test] public void TestName() { int fileReadCount = 0; var fs = Substitute.For (); fs.ReadAllText("test").ReturnsForAnyArgs(x => { fileReadCount++; return "test"; }); fs.ReadAllText("sdf"); fs.ReadAllText("sdf"); ...
NSubstitute 'Do' event not firing I have an issue with NSubstitute compiling using its inference typing. When I set it up with more than a return type in my.Do() statement and then try and use a counter to see how many times it is called, the counter isn't updated. I am mocking a method that returns a string (it's basi...
TITLE: NSubstitute 'Do' event not firing QUESTION: I have an issue with NSubstitute compiling using its inference typing. When I set it up with more than a return type in my.Do() statement and then try and use a counter to see how many times it is called, the counter isn't updated. I am mocking a method that returns a...
[ "c#", "nsubstitute" ]
0
1
1,043
1
0
2011-06-03T05:34:38.450000
2011-06-03T06:39:06.207000
6,223,360
6,223,381
To draw circle in which color change time to time in android
How can i draw circle in which circle will fill with different color slowly & one bell ring when circle is completely fill.
Try to use methods provided by timer class. Use timer.schedule() and there are many more. Explore and use them.
To draw circle in which color change time to time in android How can i draw circle in which circle will fill with different color slowly & one bell ring when circle is completely fill.
TITLE: To draw circle in which color change time to time in android QUESTION: How can i draw circle in which circle will fill with different color slowly & one bell ring when circle is completely fill. ANSWER: Try to use methods provided by timer class. Use timer.schedule() and there are many more. Explore and use th...
[ "android" ]
0
0
473
1
0
2011-06-03T05:35:13.960000
2011-06-03T05:39:31.897000
6,223,365
6,223,481
building a simple directory browser using php RecursiveDirectoryIterator
Hi i am trying to build simple directory browser to browse folders and sub-folders uing php RecursiveDirectoryIterator.. i need help of how to create this. i have started with the following code. $dir = dirname(__FILE__); //path of the directory to read $iterator = new RecursiveDirectoryIterator($dir); foreach (new Rec...
Allow me to code that for you...... '; foreach (glob($root.$path.'/*') as $file) { $file = realpath($file); $link = substr($file, strlen($root) + 1); echo ' '.basename($file).' '; }
building a simple directory browser using php RecursiveDirectoryIterator Hi i am trying to build simple directory browser to browse folders and sub-folders uing php RecursiveDirectoryIterator.. i need help of how to create this. i have started with the following code. $dir = dirname(__FILE__); //path of the directory t...
TITLE: building a simple directory browser using php RecursiveDirectoryIterator QUESTION: Hi i am trying to build simple directory browser to browse folders and sub-folders uing php RecursiveDirectoryIterator.. i need help of how to create this. i have started with the following code. $dir = dirname(__FILE__); //path ...
[ "php", "browser", "directory" ]
0
21
21,310
1
0
2011-06-03T05:35:40.200000
2011-06-03T05:54:47.903000
6,223,369
6,223,396
Where should I save Photo in web application like Photo Blog?
Where should I save Photo in web application like Photo blog? I mean should I use physical path or database. I planned to use ASP.NET MVC and MSSQL. If you have any idea, please suggest to me. and any sample db design or app links can provide to me? Thanks
This is a matter of opinion, but I personally think it makes much more sense to store a photo as a file, and just store the path in the database, than to store BLOBs. I haven't explored the performance penalties if any. In fact, I haven't ever found the need to use a database for a photoblog. Files for the photos and a...
Where should I save Photo in web application like Photo Blog? Where should I save Photo in web application like Photo blog? I mean should I use physical path or database. I planned to use ASP.NET MVC and MSSQL. If you have any idea, please suggest to me. and any sample db design or app links can provide to me? Thanks
TITLE: Where should I save Photo in web application like Photo Blog? QUESTION: Where should I save Photo in web application like Photo blog? I mean should I use physical path or database. I planned to use ASP.NET MVC and MSSQL. If you have any idea, please suggest to me. and any sample db design or app links can provi...
[ "jquery", "asp.net", "sql-server", "asp.net-mvc", "ajax" ]
0
1
136
2
0
2011-06-03T05:37:00.267000
2011-06-03T05:42:01.340000
6,223,370
6,226,354
When to use Paxos (real practical use cases)?
Could someone give me a list of real use cases of Paxos. That is real problems that require consensus as part of a bigger problem. Is the following a use case of Paxos? Suppose there are two clients playing poker against each other on a poker server. The poker server is replicated. My understanding of Paxos is that it ...
Real life use cases: The Chubby lock service for loosely-coupled distributed systems Apache ZooKeeper
When to use Paxos (real practical use cases)? Could someone give me a list of real use cases of Paxos. That is real problems that require consensus as part of a bigger problem. Is the following a use case of Paxos? Suppose there are two clients playing poker against each other on a poker server. The poker server is rep...
TITLE: When to use Paxos (real practical use cases)? QUESTION: Could someone give me a list of real use cases of Paxos. That is real problems that require consensus as part of a bigger problem. Is the following a use case of Paxos? Suppose there are two clients playing poker against each other on a poker server. The p...
[ "algorithm", "distributed", "paxos", "consensus" ]
28
5
11,585
5
0
2011-06-03T05:37:05.223000
2011-06-03T11:11:20.527000
6,223,372
6,223,394
best way to start learning socket programming in objective c
i am a beginner in objective c and iphone and i have undertaken a project of 'client server program'. but i m not having any idea about sockets in iphone. can anyone plz suggest me some books or links from where i can easily understand the sockets and their programming in objective c. i recently studied this tutorial b...
Apple doc's are best to learn any concept related to iOS. Setting Up Socket Streams, Networking and Multitasking Check the below link, Example socket programming in iphone Socket programming in iPhone
best way to start learning socket programming in objective c i am a beginner in objective c and iphone and i have undertaken a project of 'client server program'. but i m not having any idea about sockets in iphone. can anyone plz suggest me some books or links from where i can easily understand the sockets and their p...
TITLE: best way to start learning socket programming in objective c QUESTION: i am a beginner in objective c and iphone and i have undertaken a project of 'client server program'. but i m not having any idea about sockets in iphone. can anyone plz suggest me some books or links from where i can easily understand the s...
[ "iphone", "objective-c", "sockets" ]
8
5
11,974
2
0
2011-06-03T05:37:39.073000
2011-06-03T05:41:49.467000
6,223,377
6,230,602
Send php variables to flash using flashvars
I have a flash player embedded on page page.php?user=john using swfobject. The player calls the xml file content.php to get the results. I'm trying to get the user name from the url id. and fetch results based on that. I can get the username on page.php by doing $_GET['user'], but how can i pass that to content.php. Ha...
Embed like so with SWFObject v2.2 Loading Content... put alt. content here // in actionscript 3 var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; var user: String = String( paramObj[user] ); trace( user ); [EDIT] // in actionscript 2 // _level0 will have the global flashvar on it // trace(user); REFERE...
Send php variables to flash using flashvars I have a flash player embedded on page page.php?user=john using swfobject. The player calls the xml file content.php to get the results. I'm trying to get the user name from the url id. and fetch results based on that. I can get the username on page.php by doing $_GET['user']...
TITLE: Send php variables to flash using flashvars QUESTION: I have a flash player embedded on page page.php?user=john using swfobject. The player calls the xml file content.php to get the results. I'm trying to get the user name from the url id. and fetch results based on that. I can get the username on page.php by d...
[ "php", "javascript", "flash", "actionscript", "flashvars" ]
0
2
2,345
2
0
2011-06-03T05:38:37.297000
2011-06-03T17:35:31.240000
6,223,390
6,223,483
How can I use std::hex for my custom uint128 type?
What is the correct syntax to overload (or whatever is actually is) std::hex, so that its functionality can be extended to non standard integers? i wrote this version of uint128_t
std::hex is just a manipulator which set some of the formatting flags on the stream. You can get them using ios_base::flags() and use the result in your operator<<. You probably should also use ios_base::width and ios_base::precision. If you want more settings than what is provided, ios_base::xalloc, ios_base::iword, i...
How can I use std::hex for my custom uint128 type? What is the correct syntax to overload (or whatever is actually is) std::hex, so that its functionality can be extended to non standard integers? i wrote this version of uint128_t
TITLE: How can I use std::hex for my custom uint128 type? QUESTION: What is the correct syntax to overload (or whatever is actually is) std::hex, so that its functionality can be extended to non standard integers? i wrote this version of uint128_t ANSWER: std::hex is just a manipulator which set some of the formattin...
[ "c++", "hex" ]
7
8
835
1
0
2011-06-03T05:40:58.670000
2011-06-03T05:54:56.197000
6,223,405
6,223,439
Displaying a div over the top of an img
I have a relatively simple HTML layout where a div is meant to be displayed over the top of an img. But what actually happens is that the div gets displayed below the image. Do you know how I can get the div with the id 'main' to be displayed over the top of the img with the id 'mainImg' (but the div also needs to be/r...
you must use the css property position: absolute for your div and then tamper with margins of the div to position it properly.
Displaying a div over the top of an img I have a relatively simple HTML layout where a div is meant to be displayed over the top of an img. But what actually happens is that the div gets displayed below the image. Do you know how I can get the div with the id 'main' to be displayed over the top of the img with the id '...
TITLE: Displaying a div over the top of an img QUESTION: I have a relatively simple HTML layout where a div is meant to be displayed over the top of an img. But what actually happens is that the div gets displayed below the image. Do you know how I can get the div with the id 'main' to be displayed over the top of the...
[ "javascript", "html", "css" ]
2
0
1,220
4
0
2011-06-03T05:43:04.603000
2011-06-03T05:48:22.803000
6,223,407
6,301,071
EXC_BAD_ACCESS thrown if files are edited, must be committed before running
I get EXC_BAD_ACCES S from starting my program, sometimes if I edit the files. It never used to do this until recently when I removed a PNG/PLIST file from the resource folder (by deleting it). But I did replace it with the same name. After that whenever I changed my code I get the EXC_BAD_ACCESS thrown as soon as it g...
Solved the problem. I was going to post the code but it'll be hard to decipher since it spans a few classes. I used Zombie to help me locate the culprit and turns out I was over-releasing one of my dictionary objects. It had nothing to do with those resources (which cleaning fixed), I must've added an extra release whi...
EXC_BAD_ACCESS thrown if files are edited, must be committed before running I get EXC_BAD_ACCES S from starting my program, sometimes if I edit the files. It never used to do this until recently when I removed a PNG/PLIST file from the resource folder (by deleting it). But I did replace it with the same name. After tha...
TITLE: EXC_BAD_ACCESS thrown if files are edited, must be committed before running QUESTION: I get EXC_BAD_ACCES S from starting my program, sometimes if I edit the files. It never used to do this until recently when I removed a PNG/PLIST file from the resource folder (by deleting it). But I did replace it with the sa...
[ "iphone", "objective-c", "debugging", "exc-bad-access" ]
0
0
64
1
0
2011-06-03T05:43:29.003000
2011-06-10T01:28:37.537000
6,223,410
6,223,444
make a **beep sound** in my application?
Possible Duplicate: How do you make an Iphone beep hi, i have text box and a image view. i have two images named as CAT and DOG. when i entered texts in my text box,image view will display the curresponding named images. if i entered a word that is not DOG and CAT(means: there is no image in my app same as text box val...
See this thread How do you make an iPhone beep? Another thread on this is has Iphone built in beep sound effect You may also wanted to see this video http://www.youtube.com/watch?v=iUDnUAveqtU
make a **beep sound** in my application? Possible Duplicate: How do you make an Iphone beep hi, i have text box and a image view. i have two images named as CAT and DOG. when i entered texts in my text box,image view will display the curresponding named images. if i entered a word that is not DOG and CAT(means: there i...
TITLE: make a **beep sound** in my application? QUESTION: Possible Duplicate: How do you make an Iphone beep hi, i have text box and a image view. i have two images named as CAT and DOG. when i entered texts in my text box,image view will display the curresponding named images. if i entered a word that is not DOG and ...
[ "objective-c", "cocoa-touch", "ipad" ]
0
1
5,644
2
0
2011-06-03T05:44:48.253000
2011-06-03T05:48:54.770000
6,223,412
6,232,168
salesforce cast from sObject to custom object
I have written a Base controller that I want to use to manage data pagination on sever controllers. I have an abstract method like so public abstract List getPagedData(); Then each of my controllers that extend the base controller implement their own version of getPagedData. But return a specific customer object e.g Fo...
Been there. Unfortunately, there isn't a way to cast objects directly in the visualforce page. The way I've addressed this is to move all the pagination logic into your base controller in generic form and then have the child controllers take on the responsibility for casting the data into the form your visualforce page...
salesforce cast from sObject to custom object I have written a Base controller that I want to use to manage data pagination on sever controllers. I have an abstract method like so public abstract List getPagedData(); Then each of my controllers that extend the base controller implement their own version of getPagedData...
TITLE: salesforce cast from sObject to custom object QUESTION: I have written a Base controller that I want to use to manage data pagination on sever controllers. I have an abstract method like so public abstract List getPagedData(); Then each of my controllers that extend the base controller implement their own versi...
[ "salesforce", "apex-code", "visualforce" ]
3
4
19,120
1
0
2011-06-03T05:44:56.553000
2011-06-03T20:14:04.753000
6,223,415
6,258,961
How do you migrate Amazon RDS from MySQL 5.1 to MySQL 5.5?
RDS supports MySQL 5.5 and offers a lot of automated feature such as scaling up, expanding disk space, and upgrading the minor version of the database (e.g., from 5.1.49 to 5.1.50). However, is there a way to upgrade from 5.1.x to 5.5, either through the command line tools or the web GUI?
The RDS FAQ says: Currently, a direct upgrade from MySQL 5.1 to MySQL 5.5 is not supported. so you'll have to do it the more traditional way. For example a simplistic approach would be to start a 5.5 RDS instance and pipe the 5.1 database into it like this: mysqldump -h mysql5.1.database.host database_name|mysql -h mys...
How do you migrate Amazon RDS from MySQL 5.1 to MySQL 5.5? RDS supports MySQL 5.5 and offers a lot of automated feature such as scaling up, expanding disk space, and upgrading the minor version of the database (e.g., from 5.1.49 to 5.1.50). However, is there a way to upgrade from 5.1.x to 5.5, either through the comman...
TITLE: How do you migrate Amazon RDS from MySQL 5.1 to MySQL 5.5? QUESTION: RDS supports MySQL 5.5 and offers a lot of automated feature such as scaling up, expanding disk space, and upgrading the minor version of the database (e.g., from 5.1.49 to 5.1.50). However, is there a way to upgrade from 5.1.x to 5.5, either ...
[ "mysql", "amazon-rds" ]
4
4
2,295
3
0
2011-06-03T05:45:32.327000
2011-06-06T23:00:21.577000
6,223,420
6,223,729
Android GZIPInputStream not recognizing gzip format
This has really been annoying me and it is quite important for me to find the problem here. The android code below is not unzipping for me. HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet("http://www**************/get.php"); get.addHeader("Accept-Encoding", "gzip"); try { HttpResponse response = ...
The stream looks wrong, as it should start with '1f8b'. The reason might be a stray 'a' in your php-file. But the posted samples seem to be all right.
Android GZIPInputStream not recognizing gzip format This has really been annoying me and it is quite important for me to find the problem here. The android code below is not unzipping for me. HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet("http://www**************/get.php"); get.addHeader("Accep...
TITLE: Android GZIPInputStream not recognizing gzip format QUESTION: This has really been annoying me and it is quite important for me to find the problem here. The android code below is not unzipping for me. HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet("http://www**************/get.php"); ge...
[ "php", "android", "gzip" ]
2
2
4,236
1
0
2011-06-03T05:46:06.503000
2011-06-03T06:30:26.777000
6,223,427
6,223,661
Ruby on Rails Model / Database Associations
I have a user model, farmer model, doctor model, and education model. A farmer has a user and many educations. A doctor has a user and many educations. How do I setup the database for the education model? Should it have a farmer_id AND a doctor_id? But a education cannot belong to a farmer AND and doctor at the same ti...
I see two possible solutions for this scenario. The first one is to make use of polymorphic associations for education. That could look like this: class Farmer < ActiveRecord::Base belongs_to:user has_many:educations,:as =>:profession end class Doctor < ActiveRecord::Base belongs_to:user has_many:educations,:as =>:pro...
Ruby on Rails Model / Database Associations I have a user model, farmer model, doctor model, and education model. A farmer has a user and many educations. A doctor has a user and many educations. How do I setup the database for the education model? Should it have a farmer_id AND a doctor_id? But a education cannot belo...
TITLE: Ruby on Rails Model / Database Associations QUESTION: I have a user model, farmer model, doctor model, and education model. A farmer has a user and many educations. A doctor has a user and many educations. How do I setup the database for the education model? Should it have a farmer_id AND a doctor_id? But a edu...
[ "ruby-on-rails", "associations" ]
0
2
189
2
0
2011-06-03T05:46:51.210000
2011-06-03T06:21:20.433000
6,223,428
6,223,636
-webkit-transition/-moz-transition vs jQuery
This is a two-part question: What applied style takes priority: a -webkit-transition rule in CSS or a similar $.css() method in jQuery? Is there any point to including a -webkit-transition rule in my stylesheet if I am also using the.css method in jQuery? That is, will adding -webkit-transition make the animation any m...
I say its good to use both even if they do the same. If someone comes along with javascript disabled, there is good chance they will still see the intended transitions via CSS if they are on latest browsers to supports transitions and such. Just my point of thought on this. Edit: Okay, so my droopy eyes mistook the que...
-webkit-transition/-moz-transition vs jQuery This is a two-part question: What applied style takes priority: a -webkit-transition rule in CSS or a similar $.css() method in jQuery? Is there any point to including a -webkit-transition rule in my stylesheet if I am also using the.css method in jQuery? That is, will addin...
TITLE: -webkit-transition/-moz-transition vs jQuery QUESTION: This is a two-part question: What applied style takes priority: a -webkit-transition rule in CSS or a similar $.css() method in jQuery? Is there any point to including a -webkit-transition rule in my stylesheet if I am also using the.css method in jQuery? T...
[ "jquery", "css", "animation", "webkit", "mozilla" ]
3
1
1,257
2
0
2011-06-03T05:46:54.647000
2011-06-03T06:17:18.527000
6,223,430
6,223,448
Best practices for trapping a unhandle runtime Exception for JAVA on the Android os?
During a process that I have firing off during a e3roid scene population on the android I keep coming across exceptions that I want to completely trap. Perhaps I need to create a back exception tracker that i can transverse through at my leisure instead of an immediate dialogue that takes away a user experience. W/dalv...
Use Thread.setUncaughtExceptionHandler: It takes an Thread.UncaughtExceptionHandler as argument which is an interface of one method: uncaughtException(Thread t, Throwable e). From the documentation: Set the handler invoked when this thread abruptly terminates due to an uncaught exception. Needless to say however, you'r...
Best practices for trapping a unhandle runtime Exception for JAVA on the Android os? During a process that I have firing off during a e3roid scene population on the android I keep coming across exceptions that I want to completely trap. Perhaps I need to create a back exception tracker that i can transverse through at ...
TITLE: Best practices for trapping a unhandle runtime Exception for JAVA on the Android os? QUESTION: During a process that I have firing off during a e3roid scene population on the android I keep coming across exceptions that I want to completely trap. Perhaps I need to create a back exception tracker that i can tran...
[ "java", "android", "exception", "concurrentmodification" ]
4
3
1,177
2
0
2011-06-03T05:47:08.033000
2011-06-03T05:49:17.533000
6,223,433
6,223,492
F# replace first element in list?
Hey, I'm trying to learn some f# basics and am stumbling along. I'm wondering how you would go about "replacing" the first element in a list. Any help would be appreciated!
You could 'cons' (using the:: -operator) the new first element to the tail ( List.tail ) of the original list: let theList = [1; 2; 3; 4] let firstReplaced = 0:: (List.tail a) Note that this will leave the original list ( theList ) untouched.
F# replace first element in list? Hey, I'm trying to learn some f# basics and am stumbling along. I'm wondering how you would go about "replacing" the first element in a list. Any help would be appreciated!
TITLE: F# replace first element in list? QUESTION: Hey, I'm trying to learn some f# basics and am stumbling along. I'm wondering how you would go about "replacing" the first element in a list. Any help would be appreciated! ANSWER: You could 'cons' (using the:: -operator) the new first element to the tail ( List.tail...
[ "list", "f#", "replace", "element" ]
1
1
1,565
2
0
2011-06-03T05:47:31.587000
2011-06-03T05:57:03.103000
6,223,449
6,223,471
Why is it frowned upon to modify JavaScript object's prototypes?
I've come across a few comments here and there about how it's frowned upon to modify a JavaScript object's prototype? I personally don't see how it could be a problem. For instance extending the Array object to have map and include methods or to create more robust Date methods?
The problem is that prototype can be modified in several places. For example one library will add map method to Array's prototype and your own code will add the same but with another purpose. So one implementation will be broken.
Why is it frowned upon to modify JavaScript object's prototypes? I've come across a few comments here and there about how it's frowned upon to modify a JavaScript object's prototype? I personally don't see how it could be a problem. For instance extending the Array object to have map and include methods or to create mo...
TITLE: Why is it frowned upon to modify JavaScript object's prototypes? QUESTION: I've come across a few comments here and there about how it's frowned upon to modify a JavaScript object's prototype? I personally don't see how it could be a problem. For instance extending the Array object to have map and include metho...
[ "javascript", "monkeypatching" ]
23
29
10,792
5
0
2011-06-03T05:49:21.817000
2011-06-03T05:53:36.113000
6,223,453
6,223,626
How to enable linking floating point library in TurboC?
I'm newbie in C language... Just want to ask how to enable linking floating point library in TurboC?
From the comp.os.msdos.programmer FAQ: "Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++). Borland's compilers try to be smart and not link in the floating- point (f-p) library unless you need it. Alas, they all get the decision wrong. One common case is where you don't c...
How to enable linking floating point library in TurboC? I'm newbie in C language... Just want to ask how to enable linking floating point library in TurboC?
TITLE: How to enable linking floating point library in TurboC? QUESTION: I'm newbie in C language... Just want to ask how to enable linking floating point library in TurboC? ANSWER: From the comp.os.msdos.programmer FAQ: "Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++...
[ "c", "floating-point", "turbo-c" ]
3
6
3,397
1
0
2011-06-03T05:49:43.463000
2011-06-03T06:15:16.407000
6,223,455
6,223,721
Converting a polymorphic type to a string ( 'a -> string)
Given the following type definition: type 'a range = Full | Range of ('a * 'a);; How do I convert values of this type to strings? I currently have: let string_of_range r = match r with | Full -> "Full" | Range(a,b) -> "Range("^(string_of_int a)^","^(string_of_int b)^")";; But of course, this says that a and b are of ty...
Change your function to accept a string converter and use it in your implementation. Then when you call it, pass in an appropriate converter and range. Something like: let string_of_range str_conv = function | Full -> "Full" | Range(a, b) -> "Range (" ^ (str_conv a) ^ ", " ^ (str_conv b) ^ ")" It will have the type: st...
Converting a polymorphic type to a string ( 'a -> string) Given the following type definition: type 'a range = Full | Range of ('a * 'a);; How do I convert values of this type to strings? I currently have: let string_of_range r = match r with | Full -> "Full" | Range(a,b) -> "Range("^(string_of_int a)^","^(string_of_in...
TITLE: Converting a polymorphic type to a string ( 'a -> string) QUESTION: Given the following type definition: type 'a range = Full | Range of ('a * 'a);; How do I convert values of this type to strings? I currently have: let string_of_range r = match r with | Full -> "Full" | Range(a,b) -> "Range("^(string_of_int a)...
[ "ocaml" ]
3
8
2,962
3
0
2011-06-03T05:50:10
2011-06-03T06:29:11.367000
6,223,456
6,223,469
How to leftshift an ArrayList
I'm using an ArrayList to hold a history of objects. Each new object I add using the.add method, like: if(event.getAction() == MotionEvent.ACTION_UP) { if(currentWord!= null) { wordHist.add(currentWord); } if(wordHist.size() > WORDHIST_MAX_COUNT) { wordHist.remove(0); } } However I don't want this to grow indefinitely...
ArrayList is not really a good choice in this case, but it can by done by calling remove(0) method. But if you want to do that efficiently, a linked list is better (edited to make it clear that LinkedList is not generally better than ArrayList, but only in this case)
How to leftshift an ArrayList I'm using an ArrayList to hold a history of objects. Each new object I add using the.add method, like: if(event.getAction() == MotionEvent.ACTION_UP) { if(currentWord!= null) { wordHist.add(currentWord); } if(wordHist.size() > WORDHIST_MAX_COUNT) { wordHist.remove(0); } } However I don't ...
TITLE: How to leftshift an ArrayList QUESTION: I'm using an ArrayList to hold a history of objects. Each new object I add using the.add method, like: if(event.getAction() == MotionEvent.ACTION_UP) { if(currentWord!= null) { wordHist.add(currentWord); } if(wordHist.size() > WORDHIST_MAX_COUNT) { wordHist.remove(0); } ...
[ "java", "android", "arraylist" ]
4
2
6,456
7
0
2011-06-03T05:50:33.760000
2011-06-03T05:53:34.863000
6,223,473
6,223,582
Entity types cannot be generic
I am using the following function in the Domain Service, public IQueryable >> GetDiscussion_categoriesWithBoards() { return new[] { GetDiscussion_categories().Select(c => new { Category = c, Boards = GetDiscussion_boardsByCategory(c.ID).ToList() }).ToDictionary(i => i.Category, i => i.Boards.ToList()) }.AsQueryable(); ...
The type Dictionary > is not a valid type to send over Ria services, unfortunately you can only send IQueryable (As far as I can remember) If you want to send something else, you might want to have a look at the InvokeOperation and creating Complex Types (see Complex types in this blog ).
Entity types cannot be generic I am using the following function in the Domain Service, public IQueryable >> GetDiscussion_categoriesWithBoards() { return new[] { GetDiscussion_categories().Select(c => new { Category = c, Boards = GetDiscussion_boardsByCategory(c.ID).ToList() }).ToDictionary(i => i.Category, i => i.Boa...
TITLE: Entity types cannot be generic QUESTION: I am using the following function in the Domain Service, public IQueryable >> GetDiscussion_categoriesWithBoards() { return new[] { GetDiscussion_categories().Select(c => new { Category = c, Boards = GetDiscussion_boardsByCategory(c.ID).ToList() }).ToDictionary(i => i.Ca...
[ "c#", ".net", "silverlight", "exception" ]
0
2
596
1
0
2011-06-03T05:53:46.673000
2011-06-03T06:07:58.210000
6,223,478
6,223,505
Why many servers change its uid and gid,what's the benefit?
I see such logic in many open source projects: if (setuid() == 0) { if (setgid(ccf->group) == -1) {... if (initgroups(ccf->username, ccf->group) == -1) { I have 2 questions on this: What's the benifit to change to another gid and uid? And what's initgroups for? IMO,to change gid and uid, setuid() and setgid() will be e...
Most of the time, system daemons are spawned by init scripts and therefore run as root. Calling setuid() and setgid() allows them to drop their superuser privileges and impersonate another user on the system (generally far less powerful than root ). That way, bugs and security holes become less lethal to the system. Co...
Why many servers change its uid and gid,what's the benefit? I see such logic in many open source projects: if (setuid() == 0) { if (setgid(ccf->group) == -1) {... if (initgroups(ccf->username, ccf->group) == -1) { I have 2 questions on this: What's the benifit to change to another gid and uid? And what's initgroups for...
TITLE: Why many servers change its uid and gid,what's the benefit? QUESTION: I see such logic in many open source projects: if (setuid() == 0) { if (setgid(ccf->group) == -1) {... if (initgroups(ccf->username, ccf->group) == -1) { I have 2 questions on this: What's the benifit to change to another gid and uid? And wha...
[ "c", "security", "unix" ]
7
5
647
3
0
2011-06-03T05:54:10.807000
2011-06-03T05:59:26.233000
6,223,485
6,223,533
iPhone : How to display a common button on my all view?
I want to put button which should be displayed on my all view. The way we are implementing Tab Bar. I want to implement buttons. Where should I put that button? And where should I give its functionality?
Create your button on main window (i.e. UIWindow) and keep front always after when you loading view.
iPhone : How to display a common button on my all view? I want to put button which should be displayed on my all view. The way we are implementing Tab Bar. I want to implement buttons. Where should I put that button? And where should I give its functionality?
TITLE: iPhone : How to display a common button on my all view? QUESTION: I want to put button which should be displayed on my all view. The way we are implementing Tab Bar. I want to implement buttons. Where should I put that button? And where should I give its functionality? ANSWER: Create your button on main window...
[ "iphone", "objective-c", "cocoa-touch", "ios4" ]
0
1
338
2
0
2011-06-03T05:55:08.527000
2011-06-03T06:02:16.230000
6,223,487
6,223,502
Session data disappear when using sess_use_database in codeigniter
Im creating a authentication for my web (currently im using codeigniter as my php framework). How come when i set TRUE in the $config['sess_use_database'] = TRUE; my session data's disappears and doesn't display in part of the page. Im trying to display the username of the person who login to the site. When the $config...
You need to create database table to store session data: CREATE TABLE IF NOT EXISTS `ci_sessions` ( session_id varchar(40) DEFAULT '0' NOT NULL, ip_address varchar(16) DEFAULT '0' NOT NULL, user_agent varchar(50) NOT NULL, last_activity int(10) unsigned DEFAULT 0 NOT NULL, user_data text DEFAULT '' NOT NULL, PRIMARY KE...
Session data disappear when using sess_use_database in codeigniter Im creating a authentication for my web (currently im using codeigniter as my php framework). How come when i set TRUE in the $config['sess_use_database'] = TRUE; my session data's disappears and doesn't display in part of the page. Im trying to display...
TITLE: Session data disappear when using sess_use_database in codeigniter QUESTION: Im creating a authentication for my web (currently im using codeigniter as my php framework). How come when i set TRUE in the $config['sess_use_database'] = TRUE; my session data's disappears and doesn't display in part of the page. Im...
[ "php", "session", "codeigniter" ]
1
0
1,852
2
0
2011-06-03T05:55:33.317000
2011-06-03T05:58:35.330000
6,223,508
6,223,555
selecting part of text from output of another command
The following is the output of "grep" command. grep -R 'table="transaction"' /home/shantanu/* /home/shantanu/conf/transaction/Transaction.hbm.xml: I want to grab the class name from the above line: com.common.core.transaction.entity.Transaction It is the first variable in double quotes.
Some variant of this: grep -R 'table="transaction"' /home/shantanu/* \ | sed 's/.*name="\(.*\)" table.*/\1/' should get you there. You'll want to adjust the stuff before and after \(.*\) to be tighter or looser depending on all the data you end having to process.
selecting part of text from output of another command The following is the output of "grep" command. grep -R 'table="transaction"' /home/shantanu/* /home/shantanu/conf/transaction/Transaction.hbm.xml: I want to grab the class name from the above line: com.common.core.transaction.entity.Transaction It is the first varia...
TITLE: selecting part of text from output of another command QUESTION: The following is the output of "grep" command. grep -R 'table="transaction"' /home/shantanu/* /home/shantanu/conf/transaction/Transaction.hbm.xml: I want to grab the class name from the above line: com.common.core.transaction.entity.Transaction It ...
[ "sed", "awk", "grep" ]
2
1
89
4
0
2011-06-03T05:59:33.847000
2011-06-03T06:04:58.120000
6,223,514
6,227,395
Module not found
I developed a game which is running on any device which have OS 6. When we run this game on lower OS 6 then a problem occur: Module 'net_rim_ui_api' not found Please tell me the solution of this problem.
Generally this error comes when the module is missing, i think you have used some API and it create two or more ".cod" file please check in you deliverables folder in your project and install all ".cod" files. I hope it will help you.
Module not found I developed a game which is running on any device which have OS 6. When we run this game on lower OS 6 then a problem occur: Module 'net_rim_ui_api' not found Please tell me the solution of this problem.
TITLE: Module not found QUESTION: I developed a game which is running on any device which have OS 6. When we run this game on lower OS 6 then a problem occur: Module 'net_rim_ui_api' not found Please tell me the solution of this problem. ANSWER: Generally this error comes when the module is missing, i think you have ...
[ "blackberry" ]
0
0
237
2
0
2011-06-03T05:59:52.363000
2011-06-03T12:59:03.573000
6,223,518
6,223,607
Ruby does not 'ensure' when I 'retry' in 'rescue'
Consider this begin-rescue-ensure block: attempts=0 begin make_service_call() rescue Exception retry unless attempts>2 exit -1 ensure attemps += 1 end If you run that code as it is, it raises an exception because there is no function called 'make_service_call()'. So, it retries. But it would be stuck in infinite loop b...
The ensure section is executed when leaving the begin statement (by any means) but when you retry, you're just moving around inside the statement so the ensure section will not be executed. Try this version of your example to get a better idea of what's going on: attempts = 0 begin make_service_call() rescue Exception ...
Ruby does not 'ensure' when I 'retry' in 'rescue' Consider this begin-rescue-ensure block: attempts=0 begin make_service_call() rescue Exception retry unless attempts>2 exit -1 ensure attemps += 1 end If you run that code as it is, it raises an exception because there is no function called 'make_service_call()'. So, it...
TITLE: Ruby does not 'ensure' when I 'retry' in 'rescue' QUESTION: Consider this begin-rescue-ensure block: attempts=0 begin make_service_call() rescue Exception retry unless attempts>2 exit -1 ensure attemps += 1 end If you run that code as it is, it raises an exception because there is no function called 'make_servi...
[ "ruby", "rescue" ]
11
19
5,473
2
0
2011-06-03T06:00:25.663000
2011-06-03T06:12:12.050000
6,223,519
6,223,593
How to add more message in MFMailComposeViewController
I am working on an app in which user have to send an email, i have implemented the email functionality and it is working, however the only thing which i need to do is to write multiple message in message body. i have used the code below to write multiple message [mailController setMessageBody:@"Hey" isHTML:YES]; [mailC...
NSString *temp =[NSString stringWithFormat:@"%@%@%@%@%@%@%@",@"Hey",@"\n",delegate.tripName,@"\n",delegate.resultString,@"\n",delegate.messageDetails]; [mailController setMessageBody:temp isHTML:YES];
How to add more message in MFMailComposeViewController I am working on an app in which user have to send an email, i have implemented the email functionality and it is working, however the only thing which i need to do is to write multiple message in message body. i have used the code below to write multiple message [m...
TITLE: How to add more message in MFMailComposeViewController QUESTION: I am working on an app in which user have to send an email, i have implemented the email functionality and it is working, however the only thing which i need to do is to write multiple message in message body. i have used the code below to write m...
[ "iphone", "message" ]
0
1
863
2
0
2011-06-03T06:00:33.307000
2011-06-03T06:09:44.450000
6,223,530
6,223,938
Storing #define macro value in temporary and re-use it
Is there any way to store a macro value into a temporary and reuse it. pseudo Example: #define X 0 #ifdef X #define T X #undef X #define X (T + 1) // now X should be 1 #endif
I don't see a way to achieve what you ask for. Depending on what you want to do with that, the use of __COUNTER__, a common extension, could help you.
Storing #define macro value in temporary and re-use it Is there any way to store a macro value into a temporary and reuse it. pseudo Example: #define X 0 #ifdef X #define T X #undef X #define X (T + 1) // now X should be 1 #endif
TITLE: Storing #define macro value in temporary and re-use it QUESTION: Is there any way to store a macro value into a temporary and reuse it. pseudo Example: #define X 0 #ifdef X #define T X #undef X #define X (T + 1) // now X should be 1 #endif ANSWER: I don't see a way to achieve what you ask for. Depending on wh...
[ "c++", "c-preprocessor" ]
1
0
389
1
0
2011-06-03T06:01:58.087000
2011-06-03T06:52:46.283000
6,223,534
6,223,612
How do you create a Drag Thumb on a WPF Window Status bar?
I suppose I might be looking for too simple an answer, but in WinForms, the StatusBar had a thumb on the right hand side, that allowed the user to resize the form quicker without having to try and grab the border. I am looking for a simple built in solution in WPF which replicates this visually and functionally that wi...
It's a little counter-intuitive if you're coming from WinForms but the solution is very simple by using Window.ResizeMode: This works with or without a status bar. Here's an article with more information: StatusBar SizingGrip in WPF
How do you create a Drag Thumb on a WPF Window Status bar? I suppose I might be looking for too simple an answer, but in WinForms, the StatusBar had a thumb on the right hand side, that allowed the user to resize the form quicker without having to try and grab the border. I am looking for a simple built in solution in ...
TITLE: How do you create a Drag Thumb on a WPF Window Status bar? QUESTION: I suppose I might be looking for too simple an answer, but in WinForms, the StatusBar had a thumb on the right hand side, that allowed the user to resize the form quicker without having to try and grab the border. I am looking for a simple bui...
[ "wpf", "slider", "statusbar" ]
2
3
1,379
1
0
2011-06-03T06:02:17.670000
2011-06-03T06:12:40.900000
6,223,545
6,223,726
twitter api returning: Not authorized to use this endpoint
EDIT: I was hoping abraham was wrong, but unfortunately for the time being he is absolutely correct. Its not part of the official API. I'm trying to use the twitter api to accept a follow request on a protected account. I have used oAuth to authenticate myself and all api endpoints work as expected. But when I try and ...
I've run into this issue before and it is a bug with Twitter's API. A temporary solution I found to work was switching to https. You should also file a bug report with Twitter. Update: friendships/accept is not an official Twitter API method. I was thinking Twitter had implemented it but they have not. You will have to...
twitter api returning: Not authorized to use this endpoint EDIT: I was hoping abraham was wrong, but unfortunately for the time being he is absolutely correct. Its not part of the official API. I'm trying to use the twitter api to accept a follow request on a protected account. I have used oAuth to authenticate myself ...
TITLE: twitter api returning: Not authorized to use this endpoint QUESTION: EDIT: I was hoping abraham was wrong, but unfortunately for the time being he is absolutely correct. Its not part of the official API. I'm trying to use the twitter api to accept a follow request on a protected account. I have used oAuth to au...
[ "twitter" ]
1
2
3,846
1
0
2011-06-03T06:03:52.910000
2011-06-03T06:29:53.643000
6,223,553
6,223,668
program crashing when i use Random() function
I am using Random() function in my application.When i click on button i have to display a random number in 0-8 range as the text of my button.But when it runs if i click on this button the program will crash.given below is my code snippet. Random scorenumber=new Random(); OnClickListener clickball=new OnClickListener()...
You are calling void setText (int resid) here. This will crash when Android does not find a string resource with the same ID as the contents of the score variable. Use setText(Integer.toString(score));.
program crashing when i use Random() function I am using Random() function in my application.When i click on button i have to display a random number in 0-8 range as the text of my button.But when it runs if i click on this button the program will crash.given below is my code snippet. Random scorenumber=new Random(); O...
TITLE: program crashing when i use Random() function QUESTION: I am using Random() function in my application.When i click on button i have to display a random number in 0-8 range as the text of my button.But when it runs if i click on this button the program will crash.given below is my code snippet. Random scorenumb...
[ "android", "random", "crash" ]
0
0
500
2
0
2011-06-03T06:04:42.817000
2011-06-03T06:22:13.117000
6,223,557
6,223,861
How can I put validations on a SQL table column?
Problem Assumption: I have a table in SQL Server, with the structure as follows; Column 1: Id | INT | NOT NULL | Auto-Identity Column 2: Name | VARCHAR(20) | NOT NULL Column 3: Number | SMALLINT | NOT NULL Solution Scenario: What I want is that whenever some value is entered in a column, then it should be verified or v...
I think your number column should be fixed-width text e.g. CREATE TABLE MyTable ( Id INTEGER NOT NULL IDENTITY, Name VARCHAR(20) NOT NULL UNIQUE, -- presumably a candidate key Number CHAR(10) NOT NULL CHECK (Number LIKE '4[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]') )
How can I put validations on a SQL table column? Problem Assumption: I have a table in SQL Server, with the structure as follows; Column 1: Id | INT | NOT NULL | Auto-Identity Column 2: Name | VARCHAR(20) | NOT NULL Column 3: Number | SMALLINT | NOT NULL Solution Scenario: What I want is that whenever some value is ent...
TITLE: How can I put validations on a SQL table column? QUESTION: Problem Assumption: I have a table in SQL Server, with the structure as follows; Column 1: Id | INT | NOT NULL | Auto-Identity Column 2: Name | VARCHAR(20) | NOT NULL Column 3: Number | SMALLINT | NOT NULL Solution Scenario: What I want is that whenever...
[ "sql", "sql-server", "database" ]
1
2
7,139
2
0
2011-06-03T06:05:02.880000
2011-06-03T06:44:15.713000
6,223,561
6,223,663
**kwargs vs 10 arguments in a python function?
I am starting out with python and trying to construct an XML request for an ebay web service: Now, my question is: Say, this is my function: def findBestMatchItemDetailsAcrossStores(): request = """ 50 50 true ipod <-----REQUIRED PriceMin 50 Currency USD PriceMax 100 """ return get_response(findBestMatchItemDetailsAcro...
A good idea is to put all the parameters with appropriate defaults (or just None defaults) in the function signature. Yeah, it will require a little more typing in the function itself, but the interface will be clean, self-documented and simple to use, as you won't have to look up possible parameters in ebay docs or fu...
**kwargs vs 10 arguments in a python function? I am starting out with python and trying to construct an XML request for an ebay web service: Now, my question is: Say, this is my function: def findBestMatchItemDetailsAcrossStores(): request = """ 50 50 true ipod <-----REQUIRED PriceMin 50 Currency USD PriceMax 100 """ r...
TITLE: **kwargs vs 10 arguments in a python function? QUESTION: I am starting out with python and trying to construct an XML request for an ebay web service: Now, my question is: Say, this is my function: def findBestMatchItemDetailsAcrossStores(): request = """ 50 50 true ipod <-----REQUIRED PriceMin 50 Currency USD ...
[ "python", "xml", "ebay-api" ]
5
7
443
3
0
2011-06-03T06:05:32.793000
2011-06-03T06:21:41.273000
6,223,564
6,230,895
Retrieve single field rather than whole pojo in hibernate
I have some query regarding hibernate, Table: Employee_Master Id Number Name Varchar Salary long POJO: EmployeeMaster.java public class EmployeeMaster { private int id; private String name; private long salary; //... all field s getter/ setter methods } Now I want to get only name from such id. SQL query like like: ...
In HQL, you can simply ask for the one field: String employeeName = session.createQuery("select empMaster.name from EmployeeMaster empMaster where empMaster.id =:id").setInteger("id",10).uniqueResult();
Retrieve single field rather than whole pojo in hibernate I have some query regarding hibernate, Table: Employee_Master Id Number Name Varchar Salary long POJO: EmployeeMaster.java public class EmployeeMaster { private int id; private String name; private long salary; //... all field s getter/ setter methods } Now I...
TITLE: Retrieve single field rather than whole pojo in hibernate QUESTION: I have some query regarding hibernate, Table: Employee_Master Id Number Name Varchar Salary long POJO: EmployeeMaster.java public class EmployeeMaster { private int id; private String name; private long salary; //... all field s getter/ sette...
[ "hibernate" ]
8
13
33,578
6
0
2011-06-03T06:05:42.287000
2011-06-03T18:03:24.660000
6,223,565
6,223,735
Elegantly checking whether a HTTPSession reference is still valid
I'm storing all established HTTPSession objects in a hash-map. Is there anyway of determining whether a HTTPSession is still valid before en-queuing a message? Example: if I am iterating over the hash- map, I only want to enqueue messages for HTTPSession objects that are valid. UPDATE If anyone is interested, I needed ...
Unfortunately there is no explicit API for this. But it is easy to workaround in clean and elegant manner. Implement HttpSessionListener storing every newly created session in a concurrent map and removing it when session is destroyed. This way your map will always contain only valid sessions. Much cleaner, don't you t...
Elegantly checking whether a HTTPSession reference is still valid I'm storing all established HTTPSession objects in a hash-map. Is there anyway of determining whether a HTTPSession is still valid before en-queuing a message? Example: if I am iterating over the hash- map, I only want to enqueue messages for HTTPSession...
TITLE: Elegantly checking whether a HTTPSession reference is still valid QUESTION: I'm storing all established HTTPSession objects in a hash-map. Is there anyway of determining whether a HTTPSession is still valid before en-queuing a message? Example: if I am iterating over the hash- map, I only want to enqueue messag...
[ "java", "httpsession" ]
0
2
1,495
1
0
2011-06-03T06:05:45.693000
2011-06-03T06:31:07.807000
6,223,570
6,223,662
Creation of Marquee in .NET windows application
I have to create a marquee in a.NET windows application. What is the best to do this with C#?
here is the simple code on how you can do marquee in C# private int xPos=0; public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { if (this.Width == xPos) { //repeat marquee this.lblMarquee.Location = new System.Drawing.Point(0, 40); xPos = 0; } else { this.lblMarquee.Locatio...
Creation of Marquee in .NET windows application I have to create a marquee in a.NET windows application. What is the best to do this with C#?
TITLE: Creation of Marquee in .NET windows application QUESTION: I have to create a marquee in a.NET windows application. What is the best to do this with C#? ANSWER: here is the simple code on how you can do marquee in C# private int xPos=0; public Form1() { InitializeComponent(); } private void timer1_Tick(object...
[ "c#", ".net", "marquee" ]
0
4
13,985
3
0
2011-06-03T06:06:16.670000
2011-06-03T06:21:26.800000
6,223,571
6,223,628
Ruby: Ubuntu Gedit Problem possible with Spaces
can someone tell me why this works in my gedit on ubuntu def initialize (product_id,category_id,category_name) but this does not. It thows a syntax error and says that I am missing a ")" def initialize (product_id, category_id, category_name) I spent about 2 hours running through all the rest of my code and this is wha...
You're not supposed to have a space between the method name and the arguments list for that method. It should be: def initialize(product_id, category_id, category_name)
Ruby: Ubuntu Gedit Problem possible with Spaces can someone tell me why this works in my gedit on ubuntu def initialize (product_id,category_id,category_name) but this does not. It thows a syntax error and says that I am missing a ")" def initialize (product_id, category_id, category_name) I spent about 2 hours running...
TITLE: Ruby: Ubuntu Gedit Problem possible with Spaces QUESTION: can someone tell me why this works in my gedit on ubuntu def initialize (product_id,category_id,category_name) but this does not. It thows a syntax error and says that I am missing a ")" def initialize (product_id, category_id, category_name) I spent abo...
[ "ruby", "syntax", "ubuntu", "gedit" ]
1
3
119
2
0
2011-06-03T06:06:20.370000
2011-06-03T06:16:26.110000
6,223,572
6,273,810
Emma reports 0% coverage
I want to get code coverage when running unit tests. I run ant coverage using standard android build.xml for tests. Tests run well. The last strings from ant coverage are Tests run: 59, Failures: 1, Errors: 4 Generated code coverage data to /data/data/my.package/files/coverage.ec But the coverage.ec file is only 37 by...
Finally, after many hours of fighting, question resolved. Resolution is very simple and unexpectable. In build.properties of the TEST project I had something like: tested.project.dir=.. env.WORKSPACE= /bla/bla source.dir=${env.WORKSPACE}/first/src;${env.WORKSPACE}/second/src;${env.WORKSPACE}/andsoon/src; But! I should ...
Emma reports 0% coverage I want to get code coverage when running unit tests. I run ant coverage using standard android build.xml for tests. Tests run well. The last strings from ant coverage are Tests run: 59, Failures: 1, Errors: 4 Generated code coverage data to /data/data/my.package/files/coverage.ec But the cover...
TITLE: Emma reports 0% coverage QUESTION: I want to get code coverage when running unit tests. I run ant coverage using standard android build.xml for tests. Tests run well. The last strings from ant coverage are Tests run: 59, Failures: 1, Errors: 4 Generated code coverage data to /data/data/my.package/files/coverag...
[ "android", "ant", "code-coverage", "emma" ]
2
0
2,492
2
0
2011-06-03T06:06:31.413000
2011-06-08T03:13:01.703000
6,223,576
6,223,613
view based application
hii... I am making a view based application in which I have tabbar controller but this application has no of pages. And I am adding these pages as subview due to which stack get increase each. I want to put navigation bar controller too in this application to decrease the memory allocation. Can it possible to have tabb...
But of course, in AppDelegate.m, include - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ViewController1 *vc1 = [[ViewController1 alloc] init]; UINavigationController *nc1 = [[UINavigationController alloc] initWithRootViewController:vc1]; ViewController2 *v...
view based application hii... I am making a view based application in which I have tabbar controller but this application has no of pages. And I am adding these pages as subview due to which stack get increase each. I want to put navigation bar controller too in this application to decrease the memory allocation. Can i...
TITLE: view based application QUESTION: hii... I am making a view based application in which I have tabbar controller but this application has no of pages. And I am adding these pages as subview due to which stack get increase each. I want to put navigation bar controller too in this application to decrease the memory...
[ "iphone" ]
0
0
156
1
0
2011-06-03T06:06:55.517000
2011-06-03T06:12:44.777000
6,223,580
6,224,724
RelativeLayout changes at run time
I have a puzzle game where the board is a rectangle and the border is made up of piece that are one grid unit long. I have a method that randomizes the images and wraps them around the level, but... it's really terrible. And it has the strangest bug: Depending on what version of Android is running it behaves differentl...
I'd agree with Gangnus about redrawing everything in this case. My main reason for replying was for the "if you have a better suggestion on how to wrap these random border pieces, I'd be glad to hear it!" part. It's not that your code is that bad, but you're right that it'll need some work if you want to do non-rectang...
RelativeLayout changes at run time I have a puzzle game where the board is a rectangle and the border is made up of piece that are one grid unit long. I have a method that randomizes the images and wraps them around the level, but... it's really terrible. And it has the strangest bug: Depending on what version of Andro...
TITLE: RelativeLayout changes at run time QUESTION: I have a puzzle game where the board is a rectangle and the border is made up of piece that are one grid unit long. I have a method that randomizes the images and wraps them around the level, but... it's really terrible. And it has the strangest bug: Depending on wha...
[ "java", "android", "android-layout" ]
2
1
902
2
0
2011-06-03T06:07:54.697000
2011-06-03T08:28:04.320000
6,223,603
6,223,625
storing images in array
I'm trying to store my images in an array named "_images" but if I use NSLog() to view the data stored in image array, I get only one image. Would you guys help me out? Here's my code: _images =[NSMutableArray arrayWithObject:[UIImage imageNamed:@"logo1.png"]]; _images =[NSMutableArray arrayWithObject:[UIImage imageNam...
You're creating a new array on each line; you lose the reference to the old array and thus the image within it. You want to add new images to an existing array. Change lines 2 and onwards to the following: [_images addObject:[UIImage imageNamed:...]];
storing images in array I'm trying to store my images in an array named "_images" but if I use NSLog() to view the data stored in image array, I get only one image. Would you guys help me out? Here's my code: _images =[NSMutableArray arrayWithObject:[UIImage imageNamed:@"logo1.png"]]; _images =[NSMutableArray arrayWith...
TITLE: storing images in array QUESTION: I'm trying to store my images in an array named "_images" but if I use NSLog() to view the data stored in image array, I get only one image. Would you guys help me out? Here's my code: _images =[NSMutableArray arrayWithObject:[UIImage imageNamed:@"logo1.png"]]; _images =[NSMuta...
[ "iphone", "objective-c", "ios", "xcode" ]
1
9
7,621
2
0
2011-06-03T06:11:06.967000
2011-06-03T06:14:50.400000
6,223,616
6,223,635
Javascript Math.cos and Math.sin are inaccurate. Is there any solution?
JavaScript Math trigonometrical methods return wrong results. alert(Math.sin(Math.PI)); // sin(180) in degrees should return 0, but above code doesn't it doesn't return 0. Maybe problem is with JavaScript decimal number precision. Is there any workaround to get correct results?
It's very, very close to zero, though. (~ 10^-16) And alert(Math.sin(Math.PI/2)) does return 1. It's just one of things you have to be careful of when dealing with floating point arithmetic. Rounding errors pop up all over the place.
Javascript Math.cos and Math.sin are inaccurate. Is there any solution? JavaScript Math trigonometrical methods return wrong results. alert(Math.sin(Math.PI)); // sin(180) in degrees should return 0, but above code doesn't it doesn't return 0. Maybe problem is with JavaScript decimal number precision. Is there any work...
TITLE: Javascript Math.cos and Math.sin are inaccurate. Is there any solution? QUESTION: JavaScript Math trigonometrical methods return wrong results. alert(Math.sin(Math.PI)); // sin(180) in degrees should return 0, but above code doesn't it doesn't return 0. Maybe problem is with JavaScript decimal number precision....
[ "javascript", "math" ]
22
16
9,790
3
0
2011-06-03T06:12:52.197000
2011-06-03T06:17:13.643000
6,223,633
6,223,741
how to get plain but formated html using mechanize/nokogiri?
require 'rubygems' require 'mechanize' rational = Mechanize.new { |agent| agent.user_agent_alias = 'Windows Mozilla' } results = rational.get(ARGV[0]) puts results.content gives me html but I want plain text. The best would be if it can be formatted.
This code will give you plain unformatted text of the entire document: require 'mechanize' require 'nokogiri' rational = Mechanize.new { |agent| agent.user_agent_alias = 'Windows Mozilla' } document = Nokogiri::HTML(rational.get(ARGV[0]).content) #This will give you very dirty result #results = document.inner_text ...
how to get plain but formated html using mechanize/nokogiri? require 'rubygems' require 'mechanize' rational = Mechanize.new { |agent| agent.user_agent_alias = 'Windows Mozilla' } results = rational.get(ARGV[0]) puts results.content gives me html but I want plain text. The best would be if it can be formatted.
TITLE: how to get plain but formated html using mechanize/nokogiri? QUESTION: require 'rubygems' require 'mechanize' rational = Mechanize.new { |agent| agent.user_agent_alias = 'Windows Mozilla' } results = rational.get(ARGV[0]) puts results.content gives me html but I want plain text. The best would be if it can be ...
[ "ruby", "nokogiri", "mechanize" ]
2
5
4,754
1
0
2011-06-03T06:17:10.787000
2011-06-03T06:31:36.250000
6,223,652
6,223,687
How convert xaml to code behind?
I could only translate var binding = new MultiBinding() { TargetProperty = "Text", Converter = new Restaurant.Helpers.Converter.ConcatConverter(), Bindings = new ObservableCollection () { new Binding("name"), new Binding("name") } };
You are looking for how to set Attached Property. In your case it will be something like BindingUtil.SetMultiBinding(Block, binding);
How convert xaml to code behind? I could only translate var binding = new MultiBinding() { TargetProperty = "Text", Converter = new Restaurant.Helpers.Converter.ConcatConverter(), Bindings = new ObservableCollection () { new Binding("name"), new Binding("name") } };
TITLE: How convert xaml to code behind? QUESTION: I could only translate var binding = new MultiBinding() { TargetProperty = "Text", Converter = new Restaurant.Helpers.Converter.ConcatConverter(), Bindings = new ObservableCollection () { new Binding("name"), new Binding("name") } }; ANSWER: You are looking for how to...
[ "c#", ".net", "xaml", "code-behind" ]
2
2
902
1
0
2011-06-03T06:20:03.900000
2011-06-03T06:24:07.253000
6,223,655
6,223,752
Best way to combine multiple advanced mysql select queries
I have multiple select statements from different tables on the same database. I was using multiple, separate queries then loading to my array and sorting (again, after ordering in query). I would like to combine into one statement to speed up results and make it easier to "load more" (see bottom). Each query uses SELEC...
easiest way might be a UNION here ( http://dev.mysql.com/doc/refman/5.0/en/union.html ): (SELECT a,b,c FROM t1) UNION (SELECT d AS a, e AS b, f AS c FROM t2) ORDER BY a DESC
Best way to combine multiple advanced mysql select queries I have multiple select statements from different tables on the same database. I was using multiple, separate queries then loading to my array and sorting (again, after ordering in query). I would like to combine into one statement to speed up results and make i...
TITLE: Best way to combine multiple advanced mysql select queries QUESTION: I have multiple select statements from different tables on the same database. I was using multiple, separate queries then loading to my array and sorting (again, after ordering in query). I would like to combine into one statement to speed up ...
[ "mysql", "multiple-select", "multiple-select-query" ]
3
2
4,061
1
0
2011-06-03T06:20:13.660000
2011-06-03T06:32:34.143000
6,223,656
6,224,381
excel, viewing which "data connections have been disabled"
I have an excel project that currently has "data connections" disabled. How can I see what that data connection is, such as destination IP address within excel, without loading a packet analyzer like Wireshark (and enabling the connection).
In Excel 2007 and above, click 'Data' -> 'Connections' to show a list, and click 'Properties' to look at the connection string etc.
excel, viewing which "data connections have been disabled" I have an excel project that currently has "data connections" disabled. How can I see what that data connection is, such as destination IP address within excel, without loading a packet analyzer like Wireshark (and enabling the connection).
TITLE: excel, viewing which "data connections have been disabled" QUESTION: I have an excel project that currently has "data connections" disabled. How can I see what that data connection is, such as destination IP address within excel, without loading a packet analyzer like Wireshark (and enabling the connection). A...
[ "excel", "security", "connection", "warnings" ]
2
3
5,474
1
0
2011-06-03T06:20:26.160000
2011-06-03T07:49:12.563000
6,223,657
6,223,740
Nullable optional parameter
I am using the entity framework 4 with edmx files and POCOs within an asp.net mvc application. First of all I have a person class which is mapped to a table in the database. public class Person { public Int32 ID{get;set;} public string Name{get;set;} public Int32? ParentID{get;set;} } Then in my service layer I have th...
I suspect it's to do with how equality is being handled. Try this: public List Get(int? parentPersonID = null) { var persons = Repository().GetAll(parentPersonID == null? c =>!c.ParentID.HasValue: c => c.ParentID == parentPersonID);... } This will change the predicate to be an explicit nullity check when you pass in a ...
Nullable optional parameter I am using the entity framework 4 with edmx files and POCOs within an asp.net mvc application. First of all I have a person class which is mapped to a table in the database. public class Person { public Int32 ID{get;set;} public string Name{get;set;} public Int32? ParentID{get;set;} } Then i...
TITLE: Nullable optional parameter QUESTION: I am using the entity framework 4 with edmx files and POCOs within an asp.net mvc application. First of all I have a person class which is mapped to a table in the database. public class Person { public Int32 ID{get;set;} public string Name{get;set;} public Int32? ParentID{...
[ "c#", ".net", "entity-framework-4", "linq-to-entities" ]
3
2
4,415
1
0
2011-06-03T06:20:37.503000
2011-06-03T06:31:34.177000
6,223,664
6,223,683
JS Operator with String
Hii All, "Aardvark" < "Zoroaster" # return "true" I think, this is very basic. But I can't understand above statement which is collected one of the js article. Shall u explained them.
You can compare strings using the equality, greater-than and less-than operators. Using either greater-than or less-than will perform a dictionary style comparison, ie which comes first in the dictionary?
JS Operator with String Hii All, "Aardvark" < "Zoroaster" # return "true" I think, this is very basic. But I can't understand above statement which is collected one of the js article. Shall u explained them.
TITLE: JS Operator with String QUESTION: Hii All, "Aardvark" < "Zoroaster" # return "true" I think, this is very basic. But I can't understand above statement which is collected one of the js article. Shall u explained them. ANSWER: You can compare strings using the equality, greater-than and less-than operators. Usi...
[ "javascript" ]
1
2
191
2
0
2011-06-03T06:21:41.760000
2011-06-03T06:23:39.387000
6,223,678
6,224,124
Identify whether HTTP requests from Android App or not? and then respond appropriately
My Android App has an App Widget associated with it which is updated every 10 minutes on an Android Device. These updates send HTTP requests for data to the servers and parse the server response and updates the App as required. As of now if you ping that URL from the browsers on your laptop or PC the server will respon...
You can add a signature to the request and then check it on server-side. Just take the query and add one secret word at the end, then make a MD5 of it that you can send as an header (or use as a user-agent). And on the server you do the same and check if the checksum is the same. To make it a bit safer you can make a t...
Identify whether HTTP requests from Android App or not? and then respond appropriately My Android App has an App Widget associated with it which is updated every 10 minutes on an Android Device. These updates send HTTP requests for data to the servers and parse the server response and updates the App as required. As of...
TITLE: Identify whether HTTP requests from Android App or not? and then respond appropriately QUESTION: My Android App has an App Widget associated with it which is updated every 10 minutes on an Android Device. These updates send HTTP requests for data to the servers and parse the server response and updates the App ...
[ "java", "php", "android", "http" ]
7
9
8,122
4
0
2011-06-03T06:23:10.743000
2011-06-03T07:16:59.830000
6,223,680
6,223,990
Disabling error messages when using the JQuery validator extension
I've searched around for a way to disable the error messages that are displayed next to invalid form elements and I have only found ways to customize the messages, not prevent them altogether. I tried: jQuery.extend(jQuery.validator.messages, { required: "" } But that still places a blank space next to my text boxes an...
You could use CSS to hide them label.error { display:none; } It's not a perfect solution, but it'll work
Disabling error messages when using the JQuery validator extension I've searched around for a way to disable the error messages that are displayed next to invalid form elements and I have only found ways to customize the messages, not prevent them altogether. I tried: jQuery.extend(jQuery.validator.messages, { required...
TITLE: Disabling error messages when using the JQuery validator extension QUESTION: I've searched around for a way to disable the error messages that are displayed next to invalid form elements and I have only found ways to customize the messages, not prevent them altogether. I tried: jQuery.extend(jQuery.validator.me...
[ "javascript", "jquery", "html" ]
2
3
4,242
3
0
2011-06-03T06:23:27.153000
2011-06-03T06:58:25.987000
6,223,684
6,223,699
What specific languages does the character encoding EUC-JP cover?
I want to know what very specific languages the encoding EUC-JP actually cover?
Short answer: Japanese. Longer answer: http://en.wikipedia.org/wiki/Extended_Unix_Code#EUC-JP
What specific languages does the character encoding EUC-JP cover? I want to know what very specific languages the encoding EUC-JP actually cover?
TITLE: What specific languages does the character encoding EUC-JP cover? QUESTION: I want to know what very specific languages the encoding EUC-JP actually cover? ANSWER: Short answer: Japanese. Longer answer: http://en.wikipedia.org/wiki/Extended_Unix_Code#EUC-JP
[ "character-encoding" ]
0
1
845
2
0
2011-06-03T06:23:41.803000
2011-06-03T06:25:58.087000
6,223,696
6,223,756
Which is the better way to read/write txt file
What I want to do is to read/write text file as follows: Display the.txt file content in a control, such as RichTextBox Save the text in RichTextBox to a specified.txt file The txt file size won't be large. There are several methods that could do the job, but I am not sure which one is better TextReader/TextWriter File...
If you are using RichTextBox, the control itself support, reading and writing files. - RichTextBox Class
Which is the better way to read/write txt file What I want to do is to read/write text file as follows: Display the.txt file content in a control, such as RichTextBox Save the text in RichTextBox to a specified.txt file The txt file size won't be large. There are several methods that could do the job, but I am not sure...
TITLE: Which is the better way to read/write txt file QUESTION: What I want to do is to read/write text file as follows: Display the.txt file content in a control, such as RichTextBox Save the text in RichTextBox to a specified.txt file The txt file size won't be large. There are several methods that could do the job,...
[ "c#", "file" ]
3
3
512
3
0
2011-06-03T06:25:23.080000
2011-06-03T06:32:57.173000
6,223,705
6,223,815
Cannot get rid of breakpoint in JdbcOdbcDriver.finalize()
I use MyEclipse 8.6 + Apache Tomcat 5.5.27 + JRockit 1.6.0 05 for web development. Every time I start up Tomcat in debug mode from MyEclipse, it suspends on a NullPointerException in JdbcOdbcDriver.finalize():96". The stack trace is only Thread.run (of course, finalizer): protected synchronized void finalize() { if (Od...
Try to disable Suspend execution on uncaught exceptions Window->Prefs->Java->Debug
Cannot get rid of breakpoint in JdbcOdbcDriver.finalize() I use MyEclipse 8.6 + Apache Tomcat 5.5.27 + JRockit 1.6.0 05 for web development. Every time I start up Tomcat in debug mode from MyEclipse, it suspends on a NullPointerException in JdbcOdbcDriver.finalize():96". The stack trace is only Thread.run (of course, f...
TITLE: Cannot get rid of breakpoint in JdbcOdbcDriver.finalize() QUESTION: I use MyEclipse 8.6 + Apache Tomcat 5.5.27 + JRockit 1.6.0 05 for web development. Every time I start up Tomcat in debug mode from MyEclipse, it suspends on a NullPointerException in JdbcOdbcDriver.finalize():96". The stack trace is only Thread...
[ "java", "debugging", "breakpoints" ]
2
7
1,616
2
0
2011-06-03T06:26:27.593000
2011-06-03T06:39:33.390000
6,223,709
6,230,165
Hudson - Install as windows service Initialisation failure
Hudson - Install as Windows Service I am trying to install hudson build server on a windows xp. Path to the Hudson folder in the E:\Hudson. The Hudson directory contains the hudson.war file. I use the following command to navigate to Hudson dashboard. java -jar E:\hudon\Hudson.war. Then I can navigate to http://localho...
The only case of "Initialization failure" I know about (regarding WMI) is when the WMI repository is corrupted: see " Rebuilding WMI Repository ". Your context is a bit different, and the script detailed in the article might not be the right one for you, but before executing any script anyway, it is still worth to chec...
Hudson - Install as windows service Initialisation failure Hudson - Install as Windows Service I am trying to install hudson build server on a windows xp. Path to the Hudson folder in the E:\Hudson. The Hudson directory contains the hudson.war file. I use the following command to navigate to Hudson dashboard. java -jar...
TITLE: Hudson - Install as windows service Initialisation failure QUESTION: Hudson - Install as Windows Service I am trying to install hudson build server on a windows xp. Path to the Hudson folder in the E:\Hudson. The Hudson directory contains the hudson.war file. I use the following command to navigate to Hudson da...
[ "hudson" ]
1
1
596
1
0
2011-06-03T06:27:44.563000
2011-06-03T16:52:31.323000
6,223,710
6,223,930
Redirecting page based on script outcome
I'm working on the following script. Basically I want to redirect a page to one of two choices, based on whether the browser has allowed a popup. I know that the following won't work because window.location needs to be called as the DOM loads, but I'm wondering if there is something I can use or if I need to rethink my...
It isn't necessary to call it as the DOM loads. it works both when DOM is loading and when it is fully loaded: // during DOM loading:
Redirecting page based on script outcome I'm working on the following script. Basically I want to redirect a page to one of two choices, based on whether the browser has allowed a popup. I know that the following won't work because window.location needs to be called as the DOM loads, but I'm wondering if there is somet...
TITLE: Redirecting page based on script outcome QUESTION: I'm working on the following script. Basically I want to redirect a page to one of two choices, based on whether the browser has allowed a popup. I know that the following won't work because window.location needs to be called as the DOM loads, but I'm wondering...
[ "javascript" ]
2
2
91
1
0
2011-06-03T06:27:50.943000
2011-06-03T06:52:14.097000
6,223,716
6,226,707
how to get all users in redis
I have the following code. var redis = require("redis"), client = redis.createClient(); user_rahul = { username: 'rahul' }; user_namita = { username: 'namita' }; client.hmset('users.rahul', user_rahul); client.hmset('users.namita', user_namita); var username = "rahul"; // From a POST perhaps client.hgetall("users", f...
You are setting the users in their own hash, so when you do hgetall users, you are trying to get all the members of the users hash. You should do: var redis = require("redis"), client = redis.createClient(); user_rahul = { username: 'rahul' }; user_namita = { username: 'namita' }; client.hset('users', user_rahul, 'Anot...
how to get all users in redis I have the following code. var redis = require("redis"), client = redis.createClient(); user_rahul = { username: 'rahul' }; user_namita = { username: 'namita' }; client.hmset('users.rahul', user_rahul); client.hmset('users.namita', user_namita); var username = "rahul"; // From a POST per...
TITLE: how to get all users in redis QUESTION: I have the following code. var redis = require("redis"), client = redis.createClient(); user_rahul = { username: 'rahul' }; user_namita = { username: 'namita' }; client.hmset('users.rahul', user_rahul); client.hmset('users.namita', user_namita); var username = "rahul"; ...
[ "node.js", "redis" ]
3
5
8,497
3
0
2011-06-03T06:28:40.320000
2011-06-03T11:47:40.327000
6,223,720
6,223,771
save imgares from access database to hard disk with php automatically
In access DB we have more then 1000 images saved as clob. I can read this clob by php but i do not know if i can automaticaly save files to disk. Is this possible to save all 1000 files to disk from DB?
Without any more limitations the answer would appear to be something along the lines of: $i = 0; foreach ($clob as $data) { file_put_contents('image'. $i++. '.jpg', $data); }
save imgares from access database to hard disk with php automatically In access DB we have more then 1000 images saved as clob. I can read this clob by php but i do not know if i can automaticaly save files to disk. Is this possible to save all 1000 files to disk from DB?
TITLE: save imgares from access database to hard disk with php automatically QUESTION: In access DB we have more then 1000 images saved as clob. I can read this clob by php but i do not know if i can automaticaly save files to disk. Is this possible to save all 1000 files to disk from DB? ANSWER: Without any more lim...
[ "php" ]
0
1
84
1
0
2011-06-03T06:29:00.707000
2011-06-03T06:35:00.550000
6,223,739
6,223,785
How do I get my application Version in Android
Can anyone tell me how to get the application version in Android?
This page has a tips on how to do it from java: PackageManager manager = context.getPackageManager(); PackageInfo info = manager.getPackageInfo( context.getPackageName(), 0); String version = info.versionName; Also, this link has official information on how to properly set up your application versioning.
How do I get my application Version in Android Can anyone tell me how to get the application version in Android?
TITLE: How do I get my application Version in Android QUESTION: Can anyone tell me how to get the application version in Android? ANSWER: This page has a tips on how to do it from java: PackageManager manager = context.getPackageManager(); PackageInfo info = manager.getPackageInfo( context.getPackageName(), 0); Strin...
[ "android" ]
57
150
82,241
13
0
2011-06-03T06:31:32.410000
2011-06-03T06:36:31.097000
6,223,745
6,223,823
Print CSS - Avoid cutting DIV's
I am developing an application which generates barcodes, I want to print them but the barcode div is getting cutted in some pages. CSS: Code: ouvintes as $ouvinte):?> nome?> instituicao?> Cod. Barras: codigo_barras?> Does anyone know how could i avoid this cut? Thanks
How about trying the page-break-after / page-break-before CSS properties? You could set it up to break after every 9 barcodes like this: ouvintes as $ouvinte): $i++; $pageBreakStyle = ($i % 9 == 0)? ' style="page-break-after:always"': '';?> > nome?> instituicao?> Cod. Barras: codigo_barras?>
Print CSS - Avoid cutting DIV's I am developing an application which generates barcodes, I want to print them but the barcode div is getting cutted in some pages. CSS: Code: ouvintes as $ouvinte):?> nome?> instituicao?> Cod. Barras: codigo_barras?> Does anyone know how could i avoid this cut? Thanks
TITLE: Print CSS - Avoid cutting DIV's QUESTION: I am developing an application which generates barcodes, I want to print them but the barcode div is getting cutted in some pages. CSS: Code: ouvintes as $ouvinte):?> nome?> instituicao?> Cod. Barras: codigo_barras?> Does anyone know how could i avoid this cut? Thanks ...
[ "html", "css", "printing" ]
4
6
2,571
4
0
2011-06-03T06:32:06.763000
2011-06-03T06:40:18.023000
6,223,762
6,224,907
How to save a video taken from camera into SQLite database in iPhone?
I have an application in which there is button named video. When a user clicks on the button a new view opens which consists of 4 other buttons namely take video and browse for video. When he clicks on take video the camera opens which allows him to take video and the video gets inserted on the view. This all has been ...
Trying to put Roberto's suggestion in code: 1) generate a unique Id (generated by time stamp/ hash / CFUUIDCreate...). CFStringRef uStr = CFUUIDCreateString(kCFAllocatorDefault,CFUUIDCreate(kCFAllocatorDefault)); NSString *uniqueId = [[NSString alloc] initWithString:uStr]; 2) save the file in with this unique name. Now...
How to save a video taken from camera into SQLite database in iPhone? I have an application in which there is button named video. When a user clicks on the button a new view opens which consists of 4 other buttons namely take video and browse for video. When he clicks on take video the camera opens which allows him to ...
TITLE: How to save a video taken from camera into SQLite database in iPhone? QUESTION: I have an application in which there is button named video. When a user clicks on the button a new view opens which consists of 4 other buttons namely take video and browse for video. When he clicks on take video the camera opens wh...
[ "iphone", "objective-c", "sqlite", "camera" ]
1
0
1,787
2
0
2011-06-03T06:33:48.757000
2011-06-03T08:48:34.303000
6,223,765
6,223,935
Start a Java process at low priority using Runtime.exec / ProcessBuilder.start?
I'm trying to start an external process via Java using the ProcessBuilder class, and that much works. Currently running using the command: new ProcessBuilder("java", "-jar", jarfile, args); What I would like to do is just this, but to start the process with low priority. My program is currently only running on Windows,...
Use start command. It is windows dependent but does what you need. I have read there is no cross platform way for this. ProcessBuilder pb = new ProcessBuilder("cmd", "/C start /B /belownormal javaws -version"); System.out.println("Before start"); Process start = pb.start(); It is even possible to read Input end Error s...
Start a Java process at low priority using Runtime.exec / ProcessBuilder.start? I'm trying to start an external process via Java using the ProcessBuilder class, and that much works. Currently running using the command: new ProcessBuilder("java", "-jar", jarfile, args); What I would like to do is just this, but to start...
TITLE: Start a Java process at low priority using Runtime.exec / ProcessBuilder.start? QUESTION: I'm trying to start an external process via Java using the ProcessBuilder class, and that much works. Currently running using the command: new ProcessBuilder("java", "-jar", jarfile, args); What I would like to do is just ...
[ "java", "windows", "processbuilder", "windows-task-scheduler" ]
13
16
16,710
1
0
2011-06-03T06:34:08.150000
2011-06-03T06:52:34.737000
6,223,776
6,223,939
Threads and file descriptors
Do different threads within a single process have distinct independent file descriptor tables? If multiple threads within the same process concurrently access a single file, will the offset into the file for two different calls to open performed by different threads be thread-specific?
The file descriptors are shared between the threads. If you want "thread specific" offsets, why not have each thread use a different file descriptor ( open(2) multiple times)?
Threads and file descriptors Do different threads within a single process have distinct independent file descriptor tables? If multiple threads within the same process concurrently access a single file, will the offset into the file for two different calls to open performed by different threads be thread-specific?
TITLE: Threads and file descriptors QUESTION: Do different threads within a single process have distinct independent file descriptor tables? If multiple threads within the same process concurrently access a single file, will the offset into the file for two different calls to open performed by different threads be thr...
[ "c", "linux", "pthreads" ]
24
13
29,034
4
0
2011-06-03T06:35:31.667000
2011-06-03T06:52:52.427000
6,223,779
6,223,829
phpmyadmin stopped working after installing wamp server 2
hi had a working phpmyadmin which stopped working when i installed a new version of wamp 2 for windows 32bit. Now i have mysqlBuddy appearing in my localhost homepage and it mysqlBuddy works but when i click on phpmyadmin it doesn't work. The error i am getting is Access Denied. please read below error. > Error > > MyS...
Just to cover all bases - Have you tried restarting WAMP server after changing PHPMyAdmin's configuration? If you still cannot connect, try resetting your MySQL root password by following the instructions here.
phpmyadmin stopped working after installing wamp server 2 hi had a working phpmyadmin which stopped working when i installed a new version of wamp 2 for windows 32bit. Now i have mysqlBuddy appearing in my localhost homepage and it mysqlBuddy works but when i click on phpmyadmin it doesn't work. The error i am getting ...
TITLE: phpmyadmin stopped working after installing wamp server 2 QUESTION: hi had a working phpmyadmin which stopped working when i installed a new version of wamp 2 for windows 32bit. Now i have mysqlBuddy appearing in my localhost homepage and it mysqlBuddy works but when i click on phpmyadmin it doesn't work. The e...
[ "php", "phpmyadmin" ]
0
1
2,585
1
0
2011-06-03T06:36:01.770000
2011-06-03T06:41:29.407000
6,223,782
6,224,293
How its made such as digicoder vcr dvd players graphical user interfaces from poweron till user interface?
I have C/Java knowledge but i never understand yet, how some hardwares show there own screens/graphics from poweron stage to user interface (where it never shows linux/unix boot screen nor it shows windows booting screens). My question is, Compared to VCR/TV digicoders poweron till user interfaces, how its made? Do we ...
A device will start the bootloader right after the CPU comes out of reset (usually milliseconds after power-on at most). The bootloader code can initialize the display and show a splash screen if it wants (in the same way most modern non-embedded Linux distributions have a graphical grub splashscreen). The kernel can a...
How its made such as digicoder vcr dvd players graphical user interfaces from poweron till user interface? I have C/Java knowledge but i never understand yet, how some hardwares show there own screens/graphics from poweron stage to user interface (where it never shows linux/unix boot screen nor it shows windows booting...
TITLE: How its made such as digicoder vcr dvd players graphical user interfaces from poweron till user interface? QUESTION: I have C/Java knowledge but i never understand yet, how some hardwares show there own screens/graphics from poweron stage to user interface (where it never shows linux/unix boot screen nor it sho...
[ "c", "embedded", "linux-kernel", "hardware", "kernel" ]
1
0
115
3
0
2011-06-03T06:36:13.863000
2011-06-03T07:37:29.540000
6,223,795
6,224,074
How to implement this button in HTML / CSS?
This is a button that has been originally implemented and styled in Silverlight. How to implement this button in HTML/CSS? Note the different gradients in the border and the button background and also the rounder corners in the border. The border width should be adjustable but uniform size around the button. The red co...
I know it's not the most helpful thing to spoon-feed sometimes, but I had needed a break from work. Demo: http://jsfiddle.net/wesley_murch/SzHQZ/ Looks nice in FF4 and Chrome, IE falls back to decent looking (though you could fix it with PIE ). Here's the CSS I used, I got the gradient code from some random online gene...
How to implement this button in HTML / CSS? This is a button that has been originally implemented and styled in Silverlight. How to implement this button in HTML/CSS? Note the different gradients in the border and the button background and also the rounder corners in the border. The border width should be adjustable bu...
TITLE: How to implement this button in HTML / CSS? QUESTION: This is a button that has been originally implemented and styled in Silverlight. How to implement this button in HTML/CSS? Note the different gradients in the border and the button background and also the rounder corners in the border. The border width shoul...
[ "html", "css", "button" ]
1
5
1,908
3
0
2011-06-03T06:37:24.350000
2011-06-03T07:10:15.077000
6,223,799
6,257,687
rails 3: is there a way to put a gem's config params in environment.rb instead of foo.yml?
My rails app uses a gem that requires some config params to be specified in foo.yml: development: username: MyDevUserName password: MyDevPassword production: username: MyPRODUserName password: MyPRODPassword I dont want the password in my source code and want to do something like: development: username: <%= ENV['THE_US...
EDIT: Since you are on Heroku... Heroku is a different story. Your use of ENV may be conflicting with some functionality built into Heroku for handling config vars such as the ones you are working with. You need (drumroll, please)... CONFIG VARS. See this page in the Heroku Dev Center for information on how to set conf...
rails 3: is there a way to put a gem's config params in environment.rb instead of foo.yml? My rails app uses a gem that requires some config params to be specified in foo.yml: development: username: MyDevUserName password: MyDevPassword production: username: MyPRODUserName password: MyPRODPassword I dont want the passw...
TITLE: rails 3: is there a way to put a gem's config params in environment.rb instead of foo.yml? QUESTION: My rails app uses a gem that requires some config params to be specified in foo.yml: development: username: MyDevUserName password: MyDevPassword production: username: MyPRODUserName password: MyPRODPassword I d...
[ "ruby-on-rails", "environment-variables", "yaml" ]
3
3
205
1
0
2011-06-03T06:37:56.077000
2011-06-06T20:30:46.197000
6,223,800
6,223,909
node.js and browser code reuse: importing constants into modules
I have some constants in JavaScript that I'd like to reuse in several files while saving typing, reducing bugs from mistyping, keeping runtime performance high, and being useful on either the node.js server scripts or on the client web browser scripts. example: const cAPPLE = 17; const cPEAR = 23; const cGRAPE = 38;......
I would just make them global keys:...(module consts.js)... global.APPLE = 17; global.PEAR = 23; global.GRAPE = 38;...(some later js file)... var C = require('./const.js'); for (var i = 0; i < something.length; i++) { if (deliciousness[i][global.APPLE] > 45) { blah(); } } They wouldn't be enforced constants, but if ...
node.js and browser code reuse: importing constants into modules I have some constants in JavaScript that I'd like to reuse in several files while saving typing, reducing bugs from mistyping, keeping runtime performance high, and being useful on either the node.js server scripts or on the client web browser scripts. ex...
TITLE: node.js and browser code reuse: importing constants into modules QUESTION: I have some constants in JavaScript that I'd like to reuse in several files while saving typing, reducing bugs from mistyping, keeping runtime performance high, and being useful on either the node.js server scripts or on the client web b...
[ "javascript", "node.js" ]
4
4
4,651
3
0
2011-06-03T06:37:58.713000
2011-06-03T06:49:31.607000
6,223,802
6,223,866
API to parse PSD files
I am trying to parse Photoshop PSD files and I want to extract layer information, including text. Is there any API in Objective-C that can help me to extract this information from PSD files?
There is no framework or 3rd party parser available for parsing the PSD file in Objective-C But there is one available in C language, Which you could use with your objective-C code Forum Source: Is there a PSD file parser for Objective-C? I want to replace a layer image and output the result as an NSImage. load layers ...
API to parse PSD files I am trying to parse Photoshop PSD files and I want to extract layer information, including text. Is there any API in Objective-C that can help me to extract this information from PSD files?
TITLE: API to parse PSD files QUESTION: I am trying to parse Photoshop PSD files and I want to extract layer information, including text. Is there any API in Objective-C that can help me to extract this information from PSD files? ANSWER: There is no framework or 3rd party parser available for parsing the PSD file in...
[ "c++", "objective-c", "c" ]
2
5
5,081
1
0
2011-06-03T06:38:10.130000
2011-06-03T06:44:49.803000
6,223,803
6,226,282
Execute sql script inside seed.rb in rails3
I want to execute this sql script inside my seed.rb LOAD DATA LOCAL INFILE '/home/list-38.csv' INTO TABLE list FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n' (email,name,password); I checked this link but unable to figure out the solution.So that once we run rake db:seed How to seed mysql database by running sql scr...
Try this in db/seeds.rb to execute raw SQL with rake db:seed connection = ActiveRecord::Base.connection() connection.execute("*_YOUR_SQL_HERE_*")
Execute sql script inside seed.rb in rails3 I want to execute this sql script inside my seed.rb LOAD DATA LOCAL INFILE '/home/list-38.csv' INTO TABLE list FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n' (email,name,password); I checked this link but unable to figure out the solution.So that once we run rake db:seed H...
TITLE: Execute sql script inside seed.rb in rails3 QUESTION: I want to execute this sql script inside my seed.rb LOAD DATA LOCAL INFILE '/home/list-38.csv' INTO TABLE list FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n' (email,name,password); I checked this link but unable to figure out the solution.So that once we ...
[ "ruby-on-rails", "seed" ]
17
33
10,385
4
0
2011-06-03T06:38:19.910000
2011-06-03T11:05:06.113000
6,223,811
6,223,841
Getting emails and phone numbers from contact without extending Activity
I'm trying to get the email adresses and phone numbers from a contact. My class doesn't extend Activity and now I'm stuck. How can I overcome this problem?
for getting email contacts public void getEmailContacts() { try { String name; ContentResolver cr = getContentResolver(); cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,null, null, null); emailIndex=0; if (cur.getCount() > 0) { ArrayList emailNameList=new ArrayList (); ArrayList emailPhoneList=new ArrayLi...
Getting emails and phone numbers from contact without extending Activity I'm trying to get the email adresses and phone numbers from a contact. My class doesn't extend Activity and now I'm stuck. How can I overcome this problem?
TITLE: Getting emails and phone numbers from contact without extending Activity QUESTION: I'm trying to get the email adresses and phone numbers from a contact. My class doesn't extend Activity and now I'm stuck. How can I overcome this problem? ANSWER: for getting email contacts public void getEmailContacts() { try ...
[ "android" ]
3
6
2,304
1
0
2011-06-03T06:38:40.213000
2011-06-03T06:42:31.800000
6,223,817
6,223,845
Matching files with various extensions using for loop
I am trying to match and loop through files with extensions.txt.h.py. in specific folder ${arg}. Here is what I did for file in ${arg}/*.{txt, h, py}; do... done However I got no such file for all extensions even though I have such files. line 24: dir1/*.{txt,: No such file or directory line 24: h,: No such file or di...
Lose the spaces; bash cares. for file in "${arg}"/*.{txt,h,py}; do
Matching files with various extensions using for loop I am trying to match and loop through files with extensions.txt.h.py. in specific folder ${arg}. Here is what I did for file in ${arg}/*.{txt, h, py}; do... done However I got no such file for all extensions even though I have such files. line 24: dir1/*.{txt,: No ...
TITLE: Matching files with various extensions using for loop QUESTION: I am trying to match and loop through files with extensions.txt.h.py. in specific folder ${arg}. Here is what I did for file in ${arg}/*.{txt, h, py}; do... done However I got no such file for all extensions even though I have such files. line 24:...
[ "bash" ]
5
13
6,614
3
0
2011-06-03T06:39:49.990000
2011-06-03T06:42:37.517000
6,223,818
6,224,133
ASP.NET MVC 3 validation order
As part of our ASP.NET MVC3 project, we have implemented some custom validation. On a particular entity e.g. UniqueMandatoryCode, we have got [Required] and our [CustomValidationDataAnnotation]. They both work but I would like to know what is happening under the hood in terms of the order of execution for validation. T...
I guess the validation order cannot be easily controlled. The common technique is to ignore the empty/unspecified case in all other validators (ignore = you treat it as valid). You will anyway add a required validator if the value is mandatory that will handle that case. If the value is optional, why would you apply th...
ASP.NET MVC 3 validation order As part of our ASP.NET MVC3 project, we have implemented some custom validation. On a particular entity e.g. UniqueMandatoryCode, we have got [Required] and our [CustomValidationDataAnnotation]. They both work but I would like to know what is happening under the hood in terms of the order...
TITLE: ASP.NET MVC 3 validation order QUESTION: As part of our ASP.NET MVC3 project, we have implemented some custom validation. On a particular entity e.g. UniqueMandatoryCode, we have got [Required] and our [CustomValidationDataAnnotation]. They both work but I would like to know what is happening under the hood in ...
[ "validation", "asp.net-mvc-3" ]
1
0
903
1
0
2011-06-03T06:39:49.967000
2011-06-03T07:18:03.560000
6,223,821
6,223,844
Get Option label using Mootools
High School University Elementary Schools console.log(element.getElement('value')); will return selected option value, any body can help me to get the label of the same ie, instead of 8,9,10 prefer to get High School, University, Elementary Schools. console.log(element.getElement('value')); is not working. Any idea???
Use element.get('text'). Okay, so you're using a JavaScript framework - it's time to start writing unobtrusive JavaScript. Remove that onchange attribute from the, and then... $('15_4_19').addEvent('change', function() { var selected = this.getSelected(), text = selected.get('text'); console.log(text); }); API referenc...
Get Option label using Mootools High School University Elementary Schools console.log(element.getElement('value')); will return selected option value, any body can help me to get the label of the same ie, instead of 8,9,10 prefer to get High School, University, Elementary Schools. console.log(element.getElement('value'...
TITLE: Get Option label using Mootools QUESTION: High School University Elementary Schools console.log(element.getElement('value')); will return selected option value, any body can help me to get the label of the same ie, instead of 8,9,10 prefer to get High School, University, Elementary Schools. console.log(element....
[ "javascript", "mootools" ]
0
1
774
1
0
2011-06-03T06:39:56.953000
2011-06-03T06:42:35.370000
6,223,822
6,223,848
NullReferenceException even when after "new MyType[]"?
I am using MSChart and I am creating array like this DataPoint[] datapoint = new DataPoint[10]; datapoint[0].SetValueY(86); but it is giving error NullReferenceException: Object reference not set to an instance of an object. Why is it giving error?
Your array initially contains 10 null references. You have to populate it with actual object references before using it. Try something like: DataPoint[] datapoint = new DataPoint[10]; for (int i = 0; i < datapoint.Length; ++i) { datapoint[i] = new DataPoint(); } datapoint[0].SetValueY(86);
NullReferenceException even when after "new MyType[]"? I am using MSChart and I am creating array like this DataPoint[] datapoint = new DataPoint[10]; datapoint[0].SetValueY(86); but it is giving error NullReferenceException: Object reference not set to an instance of an object. Why is it giving error?
TITLE: NullReferenceException even when after "new MyType[]"? QUESTION: I am using MSChart and I am creating array like this DataPoint[] datapoint = new DataPoint[10]; datapoint[0].SetValueY(86); but it is giving error NullReferenceException: Object reference not set to an instance of an object. Why is it giving error...
[ "c#", "arrays", "nullreferenceexception" ]
1
3
344
4
0
2011-06-03T06:39:57.640000
2011-06-03T06:42:53.140000
6,223,826
6,223,895
What is the most appropriate way to handle corrupt input data in a C# constructor?
I'm reading data in from a file and creating objects based on this data. The data format is not under my control and is occasionally corrupt. What is the most appropriate way of handling these errors when constructing the objects in C#? In other programming languages I have returned a null, but that does not appear to ...
I would do something along the lines of option 3): class ObjectClass { protected ObjectClass(...constructor parameters your object depends on...) { } public static ObjectClass CreateFromFile(FileStream sourceFile) {.. parse source file if (parseOk) { return new ObjectClass(my, constructor, parameters); } return null; ...
What is the most appropriate way to handle corrupt input data in a C# constructor? I'm reading data in from a file and creating objects based on this data. The data format is not under my control and is occasionally corrupt. What is the most appropriate way of handling these errors when constructing the objects in C#? ...
TITLE: What is the most appropriate way to handle corrupt input data in a C# constructor? QUESTION: I'm reading data in from a file and creating objects based on this data. The data format is not under my control and is occasionally corrupt. What is the most appropriate way of handling these errors when constructing t...
[ "c#", "parsing", "exception", "constructor" ]
24
19
2,019
5
0
2011-06-03T06:40:52.817000
2011-06-03T06:48:28.613000
6,223,828
6,233,803
NoClassDefFoundError but class exists
Here is the error: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sfclocator/UpdateNameForm at sfclocator.SFCViewer.(SFCViewer.java:68) at sfclocator.SFCViewer$10.run(SFCViewer.java:1823) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(Ev...
I have solved my problem by creating a new netbeans project from the existing sources. In my opinion, this is not a good way to do things (especially on large projects) but none of the existing answers provided a solution.
NoClassDefFoundError but class exists Here is the error: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sfclocator/UpdateNameForm at sfclocator.SFCViewer.(SFCViewer.java:68) at sfclocator.SFCViewer$10.run(SFCViewer.java:1823) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) a...
TITLE: NoClassDefFoundError but class exists QUESTION: Here is the error: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sfclocator/UpdateNameForm at sfclocator.SFCViewer.(SFCViewer.java:68) at sfclocator.SFCViewer$10.run(SFCViewer.java:1823) at java.awt.event.InvocationEvent.dispatch(Invocatio...
[ "java", "noclassdeffounderror", "netbeans-7" ]
10
0
27,757
5
0
2011-06-03T06:41:23.233000
2011-06-04T00:12:13.007000
6,223,835
6,223,973
Adding a URL to instant JSON search script
I have a search script like Google Instant search which displays the relevant results as you type. It is written in JSON and currently does not form a URL when a user types a search, instead it stays the same. How can I make it so each search has a URL? I hope you can understand what I am trying to describe. Here is my...
You can use javascript location.hash to store the query-string and make the URL unique. Remember any change in the location.hash gets recorded in the browser-history and that makes a difference. When user submits the button add the search keyword in the location-hash like $("#search").keyup(function(){ var search=$(thi...
Adding a URL to instant JSON search script I have a search script like Google Instant search which displays the relevant results as you type. It is written in JSON and currently does not form a URL when a user types a search, instead it stays the same. How can I make it so each search has a URL? I hope you can understa...
TITLE: Adding a URL to instant JSON search script QUESTION: I have a search script like Google Instant search which displays the relevant results as you type. It is written in JSON and currently does not form a URL when a user types a search, instead it stays the same. How can I make it so each search has a URL? I hop...
[ "jquery", "html", "json" ]
0
2
1,058
2
0
2011-06-03T06:42:16.227000
2011-06-03T06:56:13.297000
6,223,843
6,231,436
Mercurial: How can a user clone another user's repository on Windows?
I have two users A and B on a Windows 7 machine. A has a Mercurial repository named Foo in a directory where both A and B have read-write access. When B tries to clone this repository he gets this error: D:\Code>hg clone Foo FooClone abort: D:\Code\Foo\.hg\requires: Access is denied What is the cause of this error? How...
You might decide this is too restrictive compared to cloning directly from the file system, but you could set up a web server on the machine, and have each user set up a directory containing repositories to serve over HTTP. Once the infrastructure is up and running, it should be no more difficult to use this setup day ...
Mercurial: How can a user clone another user's repository on Windows? I have two users A and B on a Windows 7 machine. A has a Mercurial repository named Foo in a directory where both A and B have read-write access. When B tries to clone this repository he gets this error: D:\Code>hg clone Foo FooClone abort: D:\Code\F...
TITLE: Mercurial: How can a user clone another user's repository on Windows? QUESTION: I have two users A and B on a Windows 7 machine. A has a Mercurial repository named Foo in a directory where both A and B have read-write access. When B tries to clone this repository he gets this error: D:\Code>hg clone Foo FooClon...
[ "windows", "mercurial" ]
0
0
422
2
0
2011-06-03T06:42:33.420000
2011-06-03T18:56:29.020000
6,223,846
6,223,975
Android: adding text color,background and font size to optionsmenu
I tried a lot to add the font size, text color and background for my options menu but couldn't able to solve, how to do this for the following code?Help is always appreciated.....!, Thanks. @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add("Share In Heart Club!"); menu...
Try the following code @Override public boolean onCreateOptionsMenu(android.view.Menu menu) { // MenuInflater inflater = getMenuInflater(); // inflater.inflate(R.menu.menu, menu); // setContentView(R.layout.menu); menu.clear(); setMenuBackground(); menu.add(0, MobilePagesConstant.MenuConstant.MENU_ABOUT, 0, R.string.me...
Android: adding text color,background and font size to optionsmenu I tried a lot to add the font size, text color and background for my options menu but couldn't able to solve, how to do this for the following code?Help is always appreciated.....!, Thanks. @Override public boolean onCreateOptionsMenu(Menu menu) { super...
TITLE: Android: adding text color,background and font size to optionsmenu QUESTION: I tried a lot to add the font size, text color and background for my options menu but couldn't able to solve, how to do this for the following code?Help is always appreciated.....!, Thanks. @Override public boolean onCreateOptionsMenu(...
[ "android", "font-size", "options-menu", "textcolor" ]
1
2
5,293
6
0
2011-06-03T06:42:38.323000
2011-06-03T06:56:51.347000
6,223,851
6,223,961
pass my table name as parameter in sql query
I need help with a query. In my query I want to pass my table name as parameter. This is my query: SELECT DISTINCT CONVERT (varchar, InspectDateTime) AS 'Inspect Date Time', CONVERT (varchar, SynDateTime) AS 'Sync Date Time', Employee, ROUND(OverAllPercentage, 2) AS Grade FROM Table_Name WHERE (DATEADD(dd, DATEDIFF(dd,...
If you are working with MS SQL you can do: CREATE PROCEDURE sp_GetMyStuff ( @From datetime, @To datetime, @TableName nvarchar(100) ) AS exec(' SELECT DISTINCT CONVERT (varchar, InspectDateTime) AS ''Inspect Date Time'', CONVERT (varchar, SynDateTime) AS ''Sync Date Time'', Employee, ROUND(OverAllPercentage, 2) AS Grad...
pass my table name as parameter in sql query I need help with a query. In my query I want to pass my table name as parameter. This is my query: SELECT DISTINCT CONVERT (varchar, InspectDateTime) AS 'Inspect Date Time', CONVERT (varchar, SynDateTime) AS 'Sync Date Time', Employee, ROUND(OverAllPercentage, 2) AS Grade FR...
TITLE: pass my table name as parameter in sql query QUESTION: I need help with a query. In my query I want to pass my table name as parameter. This is my query: SELECT DISTINCT CONVERT (varchar, InspectDateTime) AS 'Inspect Date Time', CONVERT (varchar, SynDateTime) AS 'Sync Date Time', Employee, ROUND(OverAllPercenta...
[ "sql", "dynamic-sql" ]
1
3
249
4
0
2011-06-03T06:43:08.953000
2011-06-03T06:55:25.667000
6,223,857
6,242,390
GTK+ Warning: Can't set a parent on widget which has a parent
I am trying to write the interface for my music manager using GTK+. The program was compiled successfully. However, when I executed it, the machine returned errors: (dingo_draft:6462): Gtk-WARNING **: Can't set a parent on widget which has a parent (dingo_draft:6462): Gtk-CRITICAL **: gtk_widget_realize: assertion `GT...
You are trying to put songinfo into two different containers: into infohbox and into vpaned. As Havoc says, gdb can help you find the exact code that is giving you a warning. I can offer two additional suggestions: Build your interface in Glade. This will help you to see what's going on with it as you build it. It will...
GTK+ Warning: Can't set a parent on widget which has a parent I am trying to write the interface for my music manager using GTK+. The program was compiled successfully. However, when I executed it, the machine returned errors: (dingo_draft:6462): Gtk-WARNING **: Can't set a parent on widget which has a parent (dingo_d...
TITLE: GTK+ Warning: Can't set a parent on widget which has a parent QUESTION: I am trying to write the interface for my music manager using GTK+. The program was compiled successfully. However, when I executed it, the machine returned errors: (dingo_draft:6462): Gtk-WARNING **: Can't set a parent on widget which has ...
[ "c++", "c", "gtk" ]
3
5
7,834
2
0
2011-06-03T06:43:49.613000
2011-06-05T10:41:01.963000
6,223,863
6,223,902
GCC inline assembly error: Cannot take the address of 'this', which is an rvalue expression
I'm still fighting with GCC - compiling the following inline assembly code (with -fasm-blocks, which enables Intel style assembly syntax) nets me a strange error Cannot take the address of 'this', which is an rvalue expression... MyClass::MyFunction() { _asm { //... mov ebx, this // error: Cannot take the address of 't...
That's because the compiler might decide on its own to store this in a register (generally ECX ) instead of a memory cell, for optimization purposes, or because the calling convention explicitly specifies it should do that. In that case, you cannot take its address, because registers are not addressable memory.
GCC inline assembly error: Cannot take the address of 'this', which is an rvalue expression I'm still fighting with GCC - compiling the following inline assembly code (with -fasm-blocks, which enables Intel style assembly syntax) nets me a strange error Cannot take the address of 'this', which is an rvalue expression.....
TITLE: GCC inline assembly error: Cannot take the address of 'this', which is an rvalue expression QUESTION: I'm still fighting with GCC - compiling the following inline assembly code (with -fasm-blocks, which enables Intel style assembly syntax) nets me a strange error Cannot take the address of 'this', which is an r...
[ "c++", "xcode", "gcc", "assembly", "inline-assembly" ]
6
1
857
3
0
2011-06-03T06:44:31.517000
2011-06-03T06:48:59.250000
6,223,864
6,223,931
How to install Punjabi Language font in android samsung galaxy?
i have an Android Phone, Samsung Galaxy Pop and I want my phone to read the Punjabi font too. So can you tell me how to install Punjabi font in my mobile Phone. suggest me any solution for it.
I think you should check out this app: http://www.androidzoom.com/android_applications/productivity/gurmukhi-keyboard_rppe.html The app provides an input method in Gurmukhi Locale with dictionary support. Hopefully it is what you're looking for! (btw I have the same phone, good choice)
How to install Punjabi Language font in android samsung galaxy? i have an Android Phone, Samsung Galaxy Pop and I want my phone to read the Punjabi font too. So can you tell me how to install Punjabi font in my mobile Phone. suggest me any solution for it.
TITLE: How to install Punjabi Language font in android samsung galaxy? QUESTION: i have an Android Phone, Samsung Galaxy Pop and I want my phone to read the Punjabi font too. So can you tell me how to install Punjabi font in my mobile Phone. suggest me any solution for it. ANSWER: I think you should check out this ap...
[ "android-emulator" ]
0
1
67,700
2
0
2011-06-03T06:44:47.450000
2011-06-03T06:52:18.667000
6,223,870
6,223,911
java method prevent from concurrent access
How can I prevent from concurrent access. I have code like this public class MC implements Runnable { public void run() { sync(); } public static void main(String p[]){ MC mc = new MC(); MC mc2 = new MC(); MC mc3 = new MC(); MC mc4 = new MC(); Thread t = new Thread(mc); t.start(); Thread t2 = new Thread(mc2); t2.star...
make your method static: private static synchronized void sync(); your method as coded is synchronized on the instance, but each thread has its own instance, so there's no synchronization. static methods are synchronized on the Class object, of which there is only one per class, so all instances will synchronize on sta...
java method prevent from concurrent access How can I prevent from concurrent access. I have code like this public class MC implements Runnable { public void run() { sync(); } public static void main(String p[]){ MC mc = new MC(); MC mc2 = new MC(); MC mc3 = new MC(); MC mc4 = new MC(); Thread t = new Thread(mc); t.st...
TITLE: java method prevent from concurrent access QUESTION: How can I prevent from concurrent access. I have code like this public class MC implements Runnable { public void run() { sync(); } public static void main(String p[]){ MC mc = new MC(); MC mc2 = new MC(); MC mc3 = new MC(); MC mc4 = new MC(); Thread t = ne...
[ "java", "multithreading" ]
8
13
10,986
6
0
2011-06-03T06:45:25.037000
2011-06-03T06:49:49.433000
6,223,891
6,224,560
Android animating an animation-list
My question, is it possible to animate an item in an animation-list. Specifically, say you have: I want to fade the alpha of each rather than simply jump from one image to the next, is it possible?
You'll need to use tweened animations to do this. Essentially what you need to do is have two ImageView objects, one for the current image, and one for the new image. Create two tweened animations for res/anim/fadeout.xml: and res/anim/fadein.xml: Then use an ImageSwitcher widget to switch between the views: @Override ...
Android animating an animation-list My question, is it possible to animate an item in an animation-list. Specifically, say you have: I want to fade the alpha of each rather than simply jump from one image to the next, is it possible?
TITLE: Android animating an animation-list QUESTION: My question, is it possible to animate an item in an animation-list. Specifically, say you have: I want to fade the alpha of each rather than simply jump from one image to the next, is it possible? ANSWER: You'll need to use tweened animations to do this. Essential...
[ "android", "animation" ]
6
3
6,188
1
0
2011-06-03T06:48:06.830000
2011-06-03T08:09:42.627000
6,223,893
6,278,446
How to set up ReSharper to allow you to navigate to third-party DLL files and view source lines of code?
This confusing feature in ReSharper claims to let you browse external sources from within Visual Studio, see External Sources (ReSharper Web Help). But, I don't understand what values to set for the folder substitution option. (Resharper - Options - External Sources - Advanced) When I try navigating to source, I keep g...
This is tricky, and I finally figured it out: Click "Show current path settings and PDB files binding" and look at where the PDB points to for source. Add a folder substitution where the source code is where the PDB says the source code is (probably a path not on your computer, but on the system that compiled the DLL f...
How to set up ReSharper to allow you to navigate to third-party DLL files and view source lines of code? This confusing feature in ReSharper claims to let you browse external sources from within Visual Studio, see External Sources (ReSharper Web Help). But, I don't understand what values to set for the folder substitut...
TITLE: How to set up ReSharper to allow you to navigate to third-party DLL files and view source lines of code? QUESTION: This confusing feature in ReSharper claims to let you browse external sources from within Visual Studio, see External Sources (ReSharper Web Help). But, I don't understand what values to set for th...
[ "visual-studio", "resharper" ]
20
27
8,416
1
0
2011-06-03T06:48:22.463000
2011-06-08T12:08:19.770000
6,223,925
6,224,071
how do I only allow one selected button at a time? / make button know if i click somewhere else
how do i make these buttons so that only one can be used at a time? Im not getting any errors right now when i run btw. Im just looking for a solution to my challenge. Thanks for any help they are generated in a for loop like this: for (int l=0; l And then the action for when a button is clicked is: - (void) buttonClic...
I would suggest to put all ur buttons to Array in your button initialisation NSMutableArray* buttons = [NSMutableArray arrayWithCapacity: list.length]; for (int l=0; l and every time buttonClicked triggered, then do your logic: for (UIButton* button in buttons) { if (button!= sender) { [button setSelected: FALSE]; [bu...
how do I only allow one selected button at a time? / make button know if i click somewhere else how do i make these buttons so that only one can be used at a time? Im not getting any errors right now when i run btw. Im just looking for a solution to my challenge. Thanks for any help they are generated in a for loop lik...
TITLE: how do I only allow one selected button at a time? / make button know if i click somewhere else QUESTION: how do i make these buttons so that only one can be used at a time? Im not getting any errors right now when i run btw. Im just looking for a solution to my challenge. Thanks for any help they are generated...
[ "iphone", "objective-c", "select", "uibutton" ]
1
5
4,507
2
0
2011-06-03T06:51:43.687000
2011-06-03T07:09:26.617000
6,223,944
6,224,012
Partial view inside a View?
In Zend Framework, is it possible to include (call) a Partial view from within a View? Cheers,
From the Docs for Partial View Helper: The Partial view helper is used to render a specified template within its own variable scope. The primary use is for reusable template fragments with which you do not need to worry about variable name clashes. Additionally, they allow you to specify partial view scripts from speci...
Partial view inside a View? In Zend Framework, is it possible to include (call) a Partial view from within a View? Cheers,
TITLE: Partial view inside a View? QUESTION: In Zend Framework, is it possible to include (call) a Partial view from within a View? Cheers, ANSWER: From the Docs for Partial View Helper: The Partial view helper is used to render a specified template within its own variable scope. The primary use is for reusable templ...
[ "php", "zend-framework" ]
1
7
2,822
2
0
2011-06-03T06:53:16.950000
2011-06-03T07:01:54.310000
6,223,948
6,224,156
How do you judge the (real world) distance of an object in a picture?
I am building a recognition program in C++ and to make it more robust, I need to be able to find the distance of an object in an image. Say I have an image that was taken 22.3 inches away of an 8.5 x 11 picture. The system correctly identifies that picture in a box with the dimensions 319 pixels by 409 pixels. What is ...
I don't know if you changed your question at some point but my first answer it quite complicated for what you want. You probably can do something simpler. 1) Long and complicated solution (more general problems) First you need the know the size of the object. You can to look at computer vision algorithms. If you know t...
How do you judge the (real world) distance of an object in a picture? I am building a recognition program in C++ and to make it more robust, I need to be able to find the distance of an object in an image. Say I have an image that was taken 22.3 inches away of an 8.5 x 11 picture. The system correctly identifies that p...
TITLE: How do you judge the (real world) distance of an object in a picture? QUESTION: I am building a recognition program in C++ and to make it more robust, I need to be able to find the distance of an object in an image. Say I have an image that was taken 22.3 inches away of an 8.5 x 11 picture. The system correctly...
[ "c++", "math", "computer-vision", "mathematical-expressions" ]
17
5
5,699
3
0
2011-06-03T06:53:56.960000
2011-06-03T07:21:37.490000
6,223,949
6,224,013
Get Records from Current Date in SQLite
In MSSQL using where DateDiff(Day,CurrentDate,getdate())=0 shows all Records Created from CurrentDate How to do it in Sqlite?
I'd suggest that using DATEDIFF or any other functions that involve your CurrentDate field will result in a query that cannot take advantage of any indexes you may have on that field. Much better is to write the WHERE clause as WHERE CurrentDate >= DATEADD(DAY, DATEDIFF(DAY, '2000-01-01', GETDATE(), '2000-01-01')) - or...
Get Records from Current Date in SQLite In MSSQL using where DateDiff(Day,CurrentDate,getdate())=0 shows all Records Created from CurrentDate How to do it in Sqlite?
TITLE: Get Records from Current Date in SQLite QUESTION: In MSSQL using where DateDiff(Day,CurrentDate,getdate())=0 shows all Records Created from CurrentDate How to do it in Sqlite? ANSWER: I'd suggest that using DATEDIFF or any other functions that involve your CurrentDate field will result in a query that cannot t...
[ "sql", "sqlite" ]
1
0
4,670
2
0
2011-06-03T06:54:36.653000
2011-06-03T07:01:58.960000
6,223,959
6,224,035
Must override val variable in scala
I meet a weird problem in scala. Following is my code, class Employee extends class Person But this piece of code can not been compiled, I have explicit define firstName and lastName as val variable. Why is that? Does it mean I have to override val variable in base class? And what is the purpose? class Person( firstNam...
The input parameters for the constructor are not vals unless you say they are. And if they are already, why override them? class Person(val firstName: String, val lastName: String) {} class Strange( override val firstName: String, override val lastName: String ) extends Person("John","Doe") {} class Employee(fn: String...
Must override val variable in scala I meet a weird problem in scala. Following is my code, class Employee extends class Person But this piece of code can not been compiled, I have explicit define firstName and lastName as val variable. Why is that? Does it mean I have to override val variable in base class? And what is...
TITLE: Must override val variable in scala QUESTION: I meet a weird problem in scala. Following is my code, class Employee extends class Person But this piece of code can not been compiled, I have explicit define firstName and lastName as val variable. Why is that? Does it mean I have to override val variable in base ...
[ "scala" ]
11
10
24,095
4
0
2011-06-03T06:55:14.643000
2011-06-03T07:04:33.247000
6,223,972
6,224,025
How to display an HTML page with the ColorBox jQuery plugin
How do I display an HTML page with ColorBox?
If you want to open an outside HTML here is the sample http://colorpowered.com/colorbox/core/example1/index.html Code would be something like HTML Outside HTML (Ajax) jQuery $(".example5").colorbox();
How to display an HTML page with the ColorBox jQuery plugin How do I display an HTML page with ColorBox?
TITLE: How to display an HTML page with the ColorBox jQuery plugin QUESTION: How do I display an HTML page with ColorBox? ANSWER: If you want to open an outside HTML here is the sample http://colorpowered.com/colorbox/core/example1/index.html Code would be something like HTML Outside HTML (Ajax) jQuery $(".example5")...
[ "javascript", "jquery", "colorbox" ]
2
3
14,010
3
0
2011-06-03T06:56:09.803000
2011-06-03T07:03:12.410000
6,223,977
6,224,167
Finding the object that belongs to two other objects in Rails
If I have a class that belongs_to two other classes (and each of those has_many of this class), is there an easy way to find the object that belongs to both? eg. User has_many posts Article has_many posts Post belongs_to User and Article I want the post that belongs to, say, current_user and @article (there will only e...
As I said above you can do Post.find_by_user_id_and_article_id(current_user.id, @article.id) or you could try it with conditions as said in this answer How can I pass multiple attributes to find_or_create_by in Rails 3? conditions = {:user_id => current_user.id,:article_id => @article.id} Post.find(:conditions => cond...
Finding the object that belongs to two other objects in Rails If I have a class that belongs_to two other classes (and each of those has_many of this class), is there an easy way to find the object that belongs to both? eg. User has_many posts Article has_many posts Post belongs_to User and Article I want the post that...
TITLE: Finding the object that belongs to two other objects in Rails QUESTION: If I have a class that belongs_to two other classes (and each of those has_many of this class), is there an easy way to find the object that belongs to both? eg. User has_many posts Article has_many posts Post belongs_to User and Article I ...
[ "ruby-on-rails", "ruby-on-rails-3" ]
0
1
1,229
2
0
2011-06-03T06:57:20.727000
2011-06-03T07:22:50.603000
6,223,979
6,224,122
delay images for display purposes not efficiency using javascript?
I have run into numerous sites that use a delay in loading images one after the other and am wondering how to do the same. So i have a portfolio page with a number of images 3 rows of 4, what i want to happen is for the page to load,except for the images in img tags. Once the page has loaded i want images 1 of each row...
This is very easy to do in jQuery $('img').each(function(i) { $(this).delay((i + 1) * 500).fadeIn(); }); Fiddle: http://jsfiddle.net/garreh/Svs7p/3 For fading in rows one after the other in a table it just means changing the selector slightly. Remember to change from div to img -- I just used div for testing $('tr').ea...
delay images for display purposes not efficiency using javascript? I have run into numerous sites that use a delay in loading images one after the other and am wondering how to do the same. So i have a portfolio page with a number of images 3 rows of 4, what i want to happen is for the page to load,except for the image...
TITLE: delay images for display purposes not efficiency using javascript? QUESTION: I have run into numerous sites that use a delay in loading images one after the other and am wondering how to do the same. So i have a portfolio page with a number of images 3 rows of 4, what i want to happen is for the page to load,ex...
[ "javascript", "jquery" ]
2
1
766
4
0
2011-06-03T06:57:29.287000
2011-06-03T07:16:41.357000
6,223,992
6,224,837
How to close the PopUp window in TelerikRadGrid on save?
I am using TelerikRadGrid in ASP.NET. When I press edit or add new, a new PopUp window appears, when I fill the data and save everything is OK, but the popup window stays. So how can I save and close the window at the same time (I know how to save, but I don't know how to close the window after saving?)
Did you search the Telerik's forum? Popup Edit form not closing
How to close the PopUp window in TelerikRadGrid on save? I am using TelerikRadGrid in ASP.NET. When I press edit or add new, a new PopUp window appears, when I fill the data and save everything is OK, but the popup window stays. So how can I save and close the window at the same time (I know how to save, but I don't kn...
TITLE: How to close the PopUp window in TelerikRadGrid on save? QUESTION: I am using TelerikRadGrid in ASP.NET. When I press edit or add new, a new PopUp window appears, when I fill the data and save everything is OK, but the popup window stays. So how can I save and close the window at the same time (I know how to sa...
[ "c#", "asp.net", "telerik-grid" ]
2
1
2,269
3
0
2011-06-03T06:58:45.980000
2011-06-03T08:40:11.593000