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,244,102
6,244,145
Problems with RGB and NSColor
I am using this code: #define MAATTACHEDWINDOW_DEFAULT_BACKGROUND_COLOR [NSColor colorWithCalibratedRed:59 green:89 blue:152 alpha:0.75] And trying to obtain a background color using RGB but it's giving me the color white. What did I do wrong?
The values you have passed in are incorrect for what it expects; they have to be between 0 and 1. Anything above 1 is set to 1.0.
Problems with RGB and NSColor I am using this code: #define MAATTACHEDWINDOW_DEFAULT_BACKGROUND_COLOR [NSColor colorWithCalibratedRed:59 green:89 blue:152 alpha:0.75] And trying to obtain a background color using RGB but it's giving me the color white. What did I do wrong?
TITLE: Problems with RGB and NSColor QUESTION: I am using this code: #define MAATTACHEDWINDOW_DEFAULT_BACKGROUND_COLOR [NSColor colorWithCalibratedRed:59 green:89 blue:152 alpha:0.75] And trying to obtain a background color using RGB but it's giving me the color white. What did I do wrong? ANSWER: The values you have...
[ "cocoa", "macos" ]
0
2
388
1
0
2011-06-05T16:10:19.480000
2011-06-05T16:17:29.563000
6,244,103
6,244,211
Scala Backward Compatibility
What changes or code evolution break backward compatibility (mainly binary compatibility)? Is it fully specified anywhere? I checked the Scala language specification, but didn't see any section on the matter like Java Language Specification Ch. 13 Binary Compatibility.
According to the mailing list, the spec documenting detailing backward compatibility issues does not yet exist but is in the works. For current status and oulook of binary compatibility (mainly of the scala library), see Martin's message to scala-user mailing list. For a migration manager preview, see this page http://...
Scala Backward Compatibility What changes or code evolution break backward compatibility (mainly binary compatibility)? Is it fully specified anywhere? I checked the Scala language specification, but didn't see any section on the matter like Java Language Specification Ch. 13 Binary Compatibility.
TITLE: Scala Backward Compatibility QUESTION: What changes or code evolution break backward compatibility (mainly binary compatibility)? Is it fully specified anywhere? I checked the Scala language specification, but didn't see any section on the matter like Java Language Specification Ch. 13 Binary Compatibility. AN...
[ "scala", "compatibility", "binary-compatibility" ]
3
5
2,092
2
0
2011-06-05T16:10:20.240000
2011-06-05T16:27:04.397000
6,244,105
6,244,363
qt "resource" string
I am wanting to have a place where i can store all the strings used in my applicaton, so i can modify them in one place and not all the places. Something like a resource file, where i can put a label on the strings and just call the label. I am not aware of anything offered by QT for this, so would I just need to creat...
I haven't used it yet, but I think, that the Qt Internationalization would allow you to do something like this, since one of it's options is to take all strings out of the application code so they can be replaced by translations. Even if you don't want to use any other features of this module, it would allow you to sol...
qt "resource" string I am wanting to have a place where i can store all the strings used in my applicaton, so i can modify them in one place and not all the places. Something like a resource file, where i can put a label on the strings and just call the label. I am not aware of anything offered by QT for this, so would...
TITLE: qt "resource" string QUESTION: I am wanting to have a place where i can store all the strings used in my applicaton, so i can modify them in one place and not all the places. Something like a resource file, where i can put a label on the strings and just call the label. I am not aware of anything offered by QT ...
[ "string", "qt" ]
9
6
4,930
2
0
2011-06-05T16:10:21.430000
2011-06-05T16:52:11.027000
6,244,115
6,244,148
Warning about making pointer from integer without a cast -- explanation needed
I have this code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic NSLog(@"didSelectRowAtIndexPath"); //The hud will dispable all input on the view HUD = [[MBProgressHUD alloc] initWithView:self.view]; // Add HUD to screen [self.view addSubview:HUD]; /...
The problem is that showWhileExecuting:onTarget:withObject:animated: takes an object as its third argument. To get aroung this, you can wrap integers as objects using the NSNumber class [NSNumber numberWithInt:i] You will then have to unwrap the argument in the loadData: method by calling [argument intValue]
Warning about making pointer from integer without a cast -- explanation needed I have this code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic NSLog(@"didSelectRowAtIndexPath"); //The hud will dispable all input on the view HUD = [[MBProgressHUD alloc...
TITLE: Warning about making pointer from integer without a cast -- explanation needed QUESTION: I have this code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic NSLog(@"didSelectRowAtIndexPath"); //The hud will dispable all input on the view HUD = [[M...
[ "objective-c", "cocoa-touch", "ios", "casting", "int" ]
1
3
669
4
0
2011-06-05T16:12:01.990000
2011-06-05T16:17:54.400000
6,244,116
6,244,141
Combined div elements combined with jQuery
I got an html page like this: first second Now, I want to use the jQuery click method but should only work when clicking first, not second. But if doing something like $("#foo").click(function() { do things }); If I click inside the second, its like clicking also on the first and the above function will run. Can I avoi...
Yes you can! $("#foo div.second").click(function(event) { event.stopPropagation(); }); That will stop propagation to elements "above" in the tree.
Combined div elements combined with jQuery I got an html page like this: first second Now, I want to use the jQuery click method but should only work when clicking first, not second. But if doing something like $("#foo").click(function() { do things }); If I click inside the second, its like clicking also on the first ...
TITLE: Combined div elements combined with jQuery QUESTION: I got an html page like this: first second Now, I want to use the jQuery click method but should only work when clicking first, not second. But if doing something like $("#foo").click(function() { do things }); If I click inside the second, its like clicking ...
[ "jquery", "html" ]
0
3
45
2
0
2011-06-05T16:12:07.053000
2011-06-05T16:16:24.620000
6,244,123
6,244,164
Directory listing for one folder htaccess
I've a folder structure like: home | snippets---other----bla | | | a--b--c d--e--f g--h--i | | | | | | | | | filesfilesfilesfilesfilesfiles I've default files (index.html) in most folders, but for the folders without default files, I used "Options -Indexes" in the home.htaccess to generate a 403 error. In the snippets ...
Assuming you have access to the httpd.conf file or your virtual host configuration, You can add Directory sections with Wildcards, or DirectoryMatch sections to accomplish this in your httpd.conf file. You're probably looking for something akin to: Options -Indexes Make sure you read up on how various configuration set...
Directory listing for one folder htaccess I've a folder structure like: home | snippets---other----bla | | | a--b--c d--e--f g--h--i | | | | | | | | | filesfilesfilesfilesfilesfiles I've default files (index.html) in most folders, but for the folders without default files, I used "Options -Indexes" in the home.htaccess...
TITLE: Directory listing for one folder htaccess QUESTION: I've a folder structure like: home | snippets---other----bla | | | a--b--c d--e--f g--h--i | | | | | | | | | filesfilesfilesfilesfilesfiles I've default files (index.html) in most folders, but for the folders without default files, I used "Options -Indexes" in...
[ ".htaccess", "directory-listing" ]
2
2
4,753
1
0
2011-06-05T16:12:55.527000
2011-06-05T16:20:39.773000
6,244,125
6,244,212
translate timestamp date of birth - in the name of the day
i'm trying to translate a birth date in the "name" of the day, like monday, tuesday, etc. but i have some doubts on how to do it, i thought first: take the two timestamps (date of birth and current timestamp) and then use a "modulo" like %7, then with the "rest" of the modulo looking through an array of names. But, act...
If you have a real Date object, you can use the getDay() method of it in combination with an array of weekdays. Same goes for months. Here's a function to return the formatted actual birthday, the original day of birth and the day for the birthday this year: function birthDAY(dat){ var result = {}, birthday = new Date(...
translate timestamp date of birth - in the name of the day i'm trying to translate a birth date in the "name" of the day, like monday, tuesday, etc. but i have some doubts on how to do it, i thought first: take the two timestamps (date of birth and current timestamp) and then use a "modulo" like %7, then with the "rest...
TITLE: translate timestamp date of birth - in the name of the day QUESTION: i'm trying to translate a birth date in the "name" of the day, like monday, tuesday, etc. but i have some doubts on how to do it, i thought first: take the two timestamps (date of birth and current timestamp) and then use a "modulo" like %7, t...
[ "javascript", "date", "timestamp", "modulo" ]
1
0
658
2
0
2011-06-05T16:13:12.077000
2011-06-05T16:27:27.190000
6,244,132
6,249,548
Change in Facebook graph api, posts?
I'm making an app with uses the facebook graph api to fetch a users posts, like this: [facebook requestWithGraphPath:@"2439131959/posts" andParams:params andDelegate:self]; This worked for a couple of months now, but like 3 days ago it suddenly stopped working. After an error log from the api it gave me the following: ...
Facebook did change something: developers.facebook.com/blog/post/509. That's a bummer:(.
Change in Facebook graph api, posts? I'm making an app with uses the facebook graph api to fetch a users posts, like this: [facebook requestWithGraphPath:@"2439131959/posts" andParams:params andDelegate:self]; This worked for a couple of months now, but like 3 days ago it suddenly stopped working. After an error log fr...
TITLE: Change in Facebook graph api, posts? QUESTION: I'm making an app with uses the facebook graph api to fetch a users posts, like this: [facebook requestWithGraphPath:@"2439131959/posts" andParams:params andDelegate:self]; This worked for a couple of months now, but like 3 days ago it suddenly stopped working. Aft...
[ "iphone", "objective-c", "ios", "facebook-graph-api" ]
0
0
479
2
0
2011-06-05T16:14:45.103000
2011-06-06T08:45:23.983000
6,244,147
6,244,215
spring mvc: don't redirect after login - need two models?
I coded a wee login controller. It has an onSubmit method which logs in the user. If the login is successful I want to show the front page without having to redirect. The front page needs content from some other model. Because my LoginController already has a LoginModel it can't also have the InformationModel. Is there...
I',m not sure if I get your question correctly, but a.) You can add multiple models on your ModelAndView object. Use: modelAndView.addObject("informationModel", informationModelObject); b.) If successful login, set the view to your front page view: modelAndView.setView("frontPageView"); To access your InformationContro...
spring mvc: don't redirect after login - need two models? I coded a wee login controller. It has an onSubmit method which logs in the user. If the login is successful I want to show the front page without having to redirect. The front page needs content from some other model. Because my LoginController already has a Lo...
TITLE: spring mvc: don't redirect after login - need two models? QUESTION: I coded a wee login controller. It has an onSubmit method which logs in the user. If the login is successful I want to show the front page without having to redirect. The front page needs content from some other model. Because my LoginControlle...
[ "java", "model-view-controller", "spring", "modelandview" ]
0
2
964
1
0
2011-06-05T16:17:54.223000
2011-06-05T16:27:52.540000
6,244,150
6,246,037
How to rename an image
I have an image, person1.png, and four other images, person2.png, person3.png, person5.png, and person4.png. I want to rename these images in C# code. How would I do this?
Since the PNG files are in your XAP, you can save them into your IsolatedStorage like this: //make sure PNG_IMAGE is set as 'Content' build type var pngStream= Application.GetResourceStream(new Uri(PNG_IMAGE, UriKind.Relative)).Stream; int counter; byte[] buffer = new byte[1024]; using (IsolatedStorageFile isf = Isola...
How to rename an image I have an image, person1.png, and four other images, person2.png, person3.png, person5.png, and person4.png. I want to rename these images in C# code. How would I do this?
TITLE: How to rename an image QUESTION: I have an image, person1.png, and four other images, person2.png, person3.png, person5.png, and person4.png. I want to rename these images in C# code. How would I do this? ANSWER: Since the PNG files are in your XAP, you can save them into your IsolatedStorage like this: //make...
[ "c#", "visual-studio", "visual-studio-2010", "windows-phone-7" ]
1
3
5,736
4
0
2011-06-05T16:17:58.003000
2011-06-05T21:37:58.610000
6,244,157
6,244,391
jquery modal form
i try to do a jquery modal form. the problem is, i include myform.php into the jquery's DIV. the reason why i put myform.php into jquery's div because i want the php do some input validation/checking exiting data in the database instead of using jquery validation. everything works fine. But the problem is, after i save...
You could try and not submit the form and send the $_POST data through AJAX.
jquery modal form i try to do a jquery modal form. the problem is, i include myform.php into the jquery's DIV. the reason why i put myform.php into jquery's div because i want the php do some input validation/checking exiting data in the database instead of using jquery validation. everything works fine. But the proble...
TITLE: jquery modal form QUESTION: i try to do a jquery modal form. the problem is, i include myform.php into the jquery's DIV. the reason why i put myform.php into jquery's div because i want the php do some input validation/checking exiting data in the database instead of using jquery validation. everything works fi...
[ "php", "jquery", "forms", "modal-dialog" ]
0
0
490
2
0
2011-06-05T16:19:57.830000
2011-06-05T16:56:56.957000
6,244,169
6,244,765
Understanding the Lazy fetch
@Entity public class Bid { @Id @GeneratedValue @Column(name = "bid_id") private Long bidId; @Column(name = "bid_amt") private double bidAmount; @Basic(fetch = FetchType.LAZY, optional = false) private String person; @ManyToOne(targetEntity = Item.class, fetch = FetchType.LAZY) @JoinColumn(name = "bid_item", referen...
To make the person attribute (as opposed to association) truly lazy, you must bytecode instrument your classes at build time. The reference documentation has some information on how to do it. http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#performance-fetching-lazyproperties
Understanding the Lazy fetch @Entity public class Bid { @Id @GeneratedValue @Column(name = "bid_id") private Long bidId; @Column(name = "bid_amt") private double bidAmount; @Basic(fetch = FetchType.LAZY, optional = false) private String person; @ManyToOne(targetEntity = Item.class, fetch = FetchType.LAZY) @JoinColu...
TITLE: Understanding the Lazy fetch QUESTION: @Entity public class Bid { @Id @GeneratedValue @Column(name = "bid_id") private Long bidId; @Column(name = "bid_amt") private double bidAmount; @Basic(fetch = FetchType.LAZY, optional = false) private String person; @ManyToOne(targetEntity = Item.class, fetch = FetchTy...
[ "java", "hibernate", "lazy-loading" ]
1
2
387
3
0
2011-06-05T16:21:16.393000
2011-06-05T18:01:04.607000
6,244,170
6,244,328
Concurrency model: Erlang vs Clojure
We are going to write a concurrent program using Clojure, which is going to extract keywords from a huge amount of incoming mail which will be cross-checked with a database. One of my teammates has suggested to use Erlang to write this program. Here I want to note something that I am new to functional programming so I ...
The two languages and runtimes take different approaches to concurrency: Erlang structures programs as many lightweight processes communicating between one another. In this case, you will probably have a master process sending jobs and data to many workers and more processes to handle the resulting data. Clojure favors...
Concurrency model: Erlang vs Clojure We are going to write a concurrent program using Clojure, which is going to extract keywords from a huge amount of incoming mail which will be cross-checked with a database. One of my teammates has suggested to use Erlang to write this program. Here I want to note something that I a...
TITLE: Concurrency model: Erlang vs Clojure QUESTION: We are going to write a concurrent program using Clojure, which is going to extract keywords from a huge amount of incoming mail which will be cross-checked with a database. One of my teammates has suggested to use Erlang to write this program. Here I want to note ...
[ "concurrency", "clojure", "erlang" ]
58
51
17,490
5
0
2011-06-05T16:21:22.433000
2011-06-05T16:46:56.687000
6,244,171
6,244,185
Given two lists in python one with strings and one with objects, how do you map them?
I have a list of strings string_list = ["key_val_1", "key_val_2", "key_val_3", "key_val_4",...] and a list with objects object_list = [object_1, object_2, object_3,...] Every object object_i has an attribute key. I want to sort the objects in object_list by the order of string_list. I could do something like new_list =...
First, create a dictionary mapping object keys to objects: d = dict((x.key, x) for x in object_list) Next create the sorted list using a list comprehension: new_list = [d[key] for key in string_list]
Given two lists in python one with strings and one with objects, how do you map them? I have a list of strings string_list = ["key_val_1", "key_val_2", "key_val_3", "key_val_4",...] and a list with objects object_list = [object_1, object_2, object_3,...] Every object object_i has an attribute key. I want to sort the ob...
TITLE: Given two lists in python one with strings and one with objects, how do you map them? QUESTION: I have a list of strings string_list = ["key_val_1", "key_val_2", "key_val_3", "key_val_4",...] and a list with objects object_list = [object_1, object_2, object_3,...] Every object object_i has an attribute key. I w...
[ "python", "list", "sorting" ]
4
8
107
3
0
2011-06-05T16:21:22.730000
2011-06-05T16:23:54.147000
6,244,176
6,244,299
Dynamic allocation of 2 dimensional array in c /linux
I just can't figure out how to do a malloc. The following code just types the first 5 lines and then stops, any help would be appreciated! // Read query points from query file------------------------------ double **queryPoint; token=(char*)malloc(40); int qp_count=0; i=0; qp_count=0; while(fgets(line,sizeof(line),que...
Initialize at the beginning: double **queryPoint = 0; int qp_count = 0; For every line call: // call realloc to make the space for points larger by one element queryPoint = realloc(queryPoint, sizeof(double*)*(qp_count+1)); // allocate space for the new point queryPoint[qp_count] = malloc(sizeof(double)*2); // increa...
Dynamic allocation of 2 dimensional array in c /linux I just can't figure out how to do a malloc. The following code just types the first 5 lines and then stops, any help would be appreciated! // Read query points from query file------------------------------ double **queryPoint; token=(char*)malloc(40); int qp_count=...
TITLE: Dynamic allocation of 2 dimensional array in c /linux QUESTION: I just can't figure out how to do a malloc. The following code just types the first 5 lines and then stops, any help would be appreciated! // Read query points from query file------------------------------ double **queryPoint; token=(char*)malloc(...
[ "c", "memory", "dynamic", "multidimensional-array", "allocation" ]
1
3
3,628
8
0
2011-06-05T16:22:10.367000
2011-06-05T16:40:56.410000
6,244,178
6,244,198
Whenever I run this code It crashes in the android Emulator
I consistantly get an error when I run this line moreContent.addView(findViewById(moreViews[0]), 0); extra code: private int[] moreViews={ 0x7f060006, 0x7f060007, 0x7f060009, 0x7f06000a, 0x7f06000b };
You should not reference the ids by the hex number, but using R.id.xxx. Without the logcat is impossible to tell, but most probably there is no resource found.
Whenever I run this code It crashes in the android Emulator I consistantly get an error when I run this line moreContent.addView(findViewById(moreViews[0]), 0); extra code: private int[] moreViews={ 0x7f060006, 0x7f060007, 0x7f060009, 0x7f06000a, 0x7f06000b };
TITLE: Whenever I run this code It crashes in the android Emulator QUESTION: I consistantly get an error when I run this line moreContent.addView(findViewById(moreViews[0]), 0); extra code: private int[] moreViews={ 0x7f060006, 0x7f060007, 0x7f060009, 0x7f06000a, 0x7f06000b }; ANSWER: You should not reference the ids...
[ "android", "android-emulator", "crash" ]
0
0
82
3
0
2011-06-05T16:22:13.610000
2011-06-05T16:25:47.800000
6,244,182
6,244,206
jquery click listener on remote javascript file
I have a simple link: Test Link I want to get an alert whenever this link is pressed, so I add: and it works fine, but when i move this code to a remote javascript file, it doesn't work.. any idea why? I've also tried this code: $(document).ready(function() { $('#test').click(function() { alert('clicked!'); }); });
Your second example, using the ready function, should be working. Your first example should also work provided you include the script below the element with the ID "test" (the element has to already exist when your script runs, since you're not waiting for DOM ready). In both cases, your script must be included below (...
jquery click listener on remote javascript file I have a simple link: Test Link I want to get an alert whenever this link is pressed, so I add: and it works fine, but when i move this code to a remote javascript file, it doesn't work.. any idea why? I've also tried this code: $(document).ready(function() { $('#test').c...
TITLE: jquery click listener on remote javascript file QUESTION: I have a simple link: Test Link I want to get an alert whenever this link is pressed, so I add: and it works fine, but when i move this code to a remote javascript file, it doesn't work.. any idea why? I've also tried this code: $(document).ready(functio...
[ "javascript", "jquery", "click", "event-listener" ]
2
2
2,945
1
0
2011-06-05T16:23:05.190000
2011-06-05T16:26:36.270000
6,244,187
6,244,352
Java Server and chunked data
I am writing a http server in java using ServerSocket and Socket respectively. In specification it says that the request can be of "chunked" type. So how could I enable this option in any browser to test the parsing of the request?
You can easily make up the request on your own: POST /search HTTP/1.1 Host: www.example.com Transfer-Encoding: chunked Content-Length: 25 000a q=23456789 000a 0123456789 0005 01234 0 This request is split into three parts, and your server should receive q=23456789012345678901234 as the POST data. Note: you need anothe...
Java Server and chunked data I am writing a http server in java using ServerSocket and Socket respectively. In specification it says that the request can be of "chunked" type. So how could I enable this option in any browser to test the parsing of the request?
TITLE: Java Server and chunked data QUESTION: I am writing a http server in java using ServerSocket and Socket respectively. In specification it says that the request can be of "chunked" type. So how could I enable this option in any browser to test the parsing of the request? ANSWER: You can easily make up the reque...
[ "java", "http" ]
0
1
1,199
2
0
2011-06-05T16:24:14.510000
2011-06-05T16:50:27.770000
6,244,192
6,244,225
How to initialize django database when using django and south
I try to write a script that will reset and reinitialize the database for a new django application. In order to detect any error I want to check the return code of each command. #! /bin/env python import sys, os def execute⌘: print(cmd) ret = os.system(cmd) if not ret: sys.exit("Last command failed") if __name__ == "...
You're using sys.exit() improperly. You could raise Exception("error message"). Also, an error message as to what you're seeing would be helpful to better answer your question. Does:./manage.py syncdb --migrate --noinput solve your issue? Perhaps you should be checking: if ret!= 0: raise Exception("error")
How to initialize django database when using django and south I try to write a script that will reset and reinitialize the database for a new django application. In order to detect any error I want to check the return code of each command. #! /bin/env python import sys, os def execute⌘: print(cmd) ret = os.system(cmd)...
TITLE: How to initialize django database when using django and south QUESTION: I try to write a script that will reset and reinitialize the database for a new django application. In order to detect any error I want to check the return code of each command. #! /bin/env python import sys, os def execute⌘: print(cmd) re...
[ "django", "django-south" ]
3
2
8,177
1
0
2011-06-05T16:24:37.997000
2011-06-05T16:29:42.353000
6,244,194
6,244,238
How to measure the number of dropped UDP messages?
I have an assignment to measure the number of UDP messages dropped between client(s) and a server. The client and server are wrote in Java. The assignment is to measure how many packets are lost using varying sizes and numbers. The assignment says the 'server' should count how many messages have been dropped. I don't s...
If a datagram from the client, saying how many datagrams it sent so far, would reach the server, the server could calculate it, couldn't it?
How to measure the number of dropped UDP messages? I have an assignment to measure the number of UDP messages dropped between client(s) and a server. The client and server are wrote in Java. The assignment is to measure how many packets are lost using varying sizes and numbers. The assignment says the 'server' should c...
TITLE: How to measure the number of dropped UDP messages? QUESTION: I have an assignment to measure the number of UDP messages dropped between client(s) and a server. The client and server are wrote in Java. The assignment is to measure how many packets are lost using varying sizes and numbers. The assignment says the...
[ "java", "sockets" ]
0
0
318
2
0
2011-06-05T16:24:46.107000
2011-06-05T16:31:48.640000
6,244,196
6,244,990
How to make a Drupal 7 module use up a .tpl.php template in the theme folder
I have created a module for Drupal 7 which has a hook_theme function that tells it to use usertemp.tpl.php template. I have the template placed in the module folder as well as the theme folder. The problem is that the function is ONLY picking up the template from the module folder but not from the theme folder. I have ...
This is a tricky one, but.. your theme hook must match your template name. Weird, but I tested this on my local and it worked once I set it up that way. So.. change your hook_theme() to: function usuar_theme() { return array( 'usuarbuild' => array( 'variables' => array('profilesloaded' => array()), 'template' => 'usuar...
How to make a Drupal 7 module use up a .tpl.php template in the theme folder I have created a module for Drupal 7 which has a hook_theme function that tells it to use usertemp.tpl.php template. I have the template placed in the module folder as well as the theme folder. The problem is that the function is ONLY picking ...
TITLE: How to make a Drupal 7 module use up a .tpl.php template in the theme folder QUESTION: I have created a module for Drupal 7 which has a hook_theme function that tells it to use usertemp.tpl.php template. I have the template placed in the module folder as well as the theme folder. The problem is that the functio...
[ "drupal", "drupal-modules", "drupal-7", "drupal-themes" ]
4
8
8,125
1
0
2011-06-05T16:25:06.923000
2011-06-05T18:38:04.977000
6,244,208
6,244,224
Accessibility of members of top level class in inner class?
I have a query regarding accessibility of top level class from member inner class. I have just read the reason why local or anonymous inner classes can access only final variables.The reason being JVM handles these two classes as entirely different classes and so, if value of variable in one class changes, it can't be ...
They're separate classes, but there's an implicit reference to the instance of the "outer" class in the "inner" class. It basically acts as a variable which you can get at either implicitly or via special syntax of ContainingClassname.this. Note that if you don't want such an implicit reference, you should declare the ...
Accessibility of members of top level class in inner class? I have a query regarding accessibility of top level class from member inner class. I have just read the reason why local or anonymous inner classes can access only final variables.The reason being JVM handles these two classes as entirely different classes and...
TITLE: Accessibility of members of top level class in inner class? QUESTION: I have a query regarding accessibility of top level class from member inner class. I have just read the reason why local or anonymous inner classes can access only final variables.The reason being JVM handles these two classes as entirely dif...
[ "java", "accessibility", "inner-classes", "nested-class" ]
0
5
1,385
2
0
2011-06-05T16:26:44.710000
2011-06-05T16:29:28.980000
6,244,214
6,244,237
Adding MySQL accounts via PHP
I'm trying find a way to create mysql users with passwords using php code, i.e. without using phpmyadmin, mysql wizard or any else. Is there a way to do this?
You can send any of the account management commands to the database just like any other query. Of course, it may not be good from a security perspective if your website user account has the privileges in the database to do these things. (Accounts used for public application purposes should generally be kept to minimum ...
Adding MySQL accounts via PHP I'm trying find a way to create mysql users with passwords using php code, i.e. without using phpmyadmin, mysql wizard or any else. Is there a way to do this?
TITLE: Adding MySQL accounts via PHP QUESTION: I'm trying find a way to create mysql users with passwords using php code, i.e. without using phpmyadmin, mysql wizard or any else. Is there a way to do this? ANSWER: You can send any of the account management commands to the database just like any other query. Of course...
[ "php", "mysql", "database" ]
0
2
96
3
0
2011-06-05T16:27:49.850000
2011-06-05T16:31:45.507000
6,244,217
6,244,310
Subset dataframe by multiple logical conditions of rows to remove
I would like to subset (filter) a dataframe by specifying which rows not (! ) to keep in the new dataframe. Here is a simplified sample dataframe: data v1 v2 v3 v4 a v d c a v d d b n p g b d d h c k d c c r p g d v d x d v d c e v d b e v d c For example, if a row of column v1 has a "b", "d", or "e", I want to get rid...
The! should be around the outside of the statement: data[!(data$v1 %in% c("b", "d", "e")), ] v1 v2 v3 v4 1 a v d c 2 a v d d 5 c k d c 6 c r p g
Subset dataframe by multiple logical conditions of rows to remove I would like to subset (filter) a dataframe by specifying which rows not (! ) to keep in the new dataframe. Here is a simplified sample dataframe: data v1 v2 v3 v4 a v d c a v d d b n p g b d d h c k d c c r p g d v d x d v d c e v d b e v d c For exampl...
TITLE: Subset dataframe by multiple logical conditions of rows to remove QUESTION: I would like to subset (filter) a dataframe by specifying which rows not (! ) to keep in the new dataframe. Here is a simplified sample dataframe: data v1 v2 v3 v4 a v d c a v d d b n p g b d d h c k d c c r p g d v d x d v d c e v d b ...
[ "r", "dataframe", "subset" ]
39
42
151,971
8
0
2011-06-05T16:28:32.367000
2011-06-05T16:42:20.717000
6,244,220
6,252,579
running Ruby script from Maven
We have a large legacy Maven project that tries to do a org.codehaus.mojo.exec-maven-plugin on a script.rb file. This runs fine on *nix systems, because the script.rb file starts with: #!/usr/bin/env ruby (Note that I know next to nothing about Ruby.) Of course this doesn't work on Windows, even with Ruby installed, in...
According to this and that you could try de.saumya.mojo gem-maven-plugin 0.25.1 which is the latest version my nexus offers.
running Ruby script from Maven We have a large legacy Maven project that tries to do a org.codehaus.mojo.exec-maven-plugin on a script.rb file. This runs fine on *nix systems, because the script.rb file starts with: #!/usr/bin/env ruby (Note that I know next to nothing about Ruby.) Of course this doesn't work on Window...
TITLE: running Ruby script from Maven QUESTION: We have a large legacy Maven project that tries to do a org.codehaus.mojo.exec-maven-plugin on a script.rb file. This runs fine on *nix systems, because the script.rb file starts with: #!/usr/bin/env ruby (Note that I know next to nothing about Ruby.) Of course this does...
[ "ruby", "windows", "maven" ]
0
1
1,823
1
0
2011-06-05T16:28:34.750000
2011-06-06T13:17:29.980000
6,244,230
6,245,084
Multiplayer HTML5, Node.js, Socket.IO
I trying create simple Multi-player with HTML5 Canvas, JavaScript(too using John Resig simple Inheritance library) and Node.js with Socket.IO. My client code: var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var socket = new io.Socket('127.0.0.1', {port: 8080}); var player = null; ...
First, check out http://www.google.com/events/io/2011/sessions/super-browser-2-turbo-hd-remix-introduction-to-html5-game-development.html it explains how to use requestAnimationFrame among other things. Second, the game state should exist on the server and be mirrored on the clients. When a player clicks down, the clie...
Multiplayer HTML5, Node.js, Socket.IO I trying create simple Multi-player with HTML5 Canvas, JavaScript(too using John Resig simple Inheritance library) and Node.js with Socket.IO. My client code: var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var socket = new io.Socket('127.0.0.1'...
TITLE: Multiplayer HTML5, Node.js, Socket.IO QUESTION: I trying create simple Multi-player with HTML5 Canvas, JavaScript(too using John Resig simple Inheritance library) and Node.js with Socket.IO. My client code: var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var socket = new io....
[ "html", "node.js", "canvas", "socket.io" ]
18
14
16,275
4
0
2011-06-05T16:30:20.047000
2011-06-05T18:55:29.953000
6,244,242
6,262,165
Incomplete setter for set field+mappedBy
Scenario: entity --class ~.domain.Team entity --class Person field reference --fieldName team --type Team focus --class Team field set --fieldName members --type Person --mappedBy team controller all --package ~.web This generates standard CRUD scaffolding for People and Teams. When creating/updating a Team, there is a...
I think this is a known blocker Spring Roo bug: https://jira.springsource.org/browse/ROO-2365.
Incomplete setter for set field+mappedBy Scenario: entity --class ~.domain.Team entity --class Person field reference --fieldName team --type Team focus --class Team field set --fieldName members --type Person --mappedBy team controller all --package ~.web This generates standard CRUD scaffolding for People and Teams. ...
TITLE: Incomplete setter for set field+mappedBy QUESTION: Scenario: entity --class ~.domain.Team entity --class Person field reference --fieldName team --type Team focus --class Team field set --fieldName members --type Person --mappedBy team controller all --package ~.web This generates standard CRUD scaffolding for ...
[ "spring-mvc", "spring-roo" ]
3
2
124
1
0
2011-06-05T16:32:25.693000
2011-06-07T07:52:35.203000
6,244,245
6,244,269
Inconsistent results from write, then read with byte array and DataOutputStream
Short Version: I write an 8 byte, byte array filled with random bytes to disk using a DataOutputStream, and then read it back in with a DataInputStream in another method. The data does not appear to be the same. Where should I start looking for problems? Long Version: I have a piece of code that is doing password based...
You're printing out a byte array just by using its toString() implementation - which doesn't show the data, just a hash code. Try using Arrays.toString(salt) instead: System.out.println("Recovered salt: " + Arrays.toString(salt)); (And likewise when writing it out.) I suspect you'll now see that you've actually been re...
Inconsistent results from write, then read with byte array and DataOutputStream Short Version: I write an 8 byte, byte array filled with random bytes to disk using a DataOutputStream, and then read it back in with a DataInputStream in another method. The data does not appear to be the same. Where should I start looking...
TITLE: Inconsistent results from write, then read with byte array and DataOutputStream QUESTION: Short Version: I write an 8 byte, byte array filled with random bytes to disk using a DataOutputStream, and then read it back in with a DataInputStream in another method. The data does not appear to be the same. Where shou...
[ "java", "cryptography", "dataoutputstream" ]
1
2
969
1
0
2011-06-05T16:33:40.837000
2011-06-05T16:37:21.583000
6,244,247
6,244,297
Storing data for iPhone app
What is the best way to store data for the iPhone? I will be developing an iPhone app in Objective-C which will take data from end users. This data will need to be save and loaded at various points. Essentially, what is the best combination of languages and frameworks to use in order to develop the above (i.e. should I...
Hey, the best way to store and manage data is Core Data framework, you can read about it in official docs.
Storing data for iPhone app What is the best way to store data for the iPhone? I will be developing an iPhone app in Objective-C which will take data from end users. This data will need to be save and loaded at various points. Essentially, what is the best combination of languages and frameworks to use in order to deve...
TITLE: Storing data for iPhone app QUESTION: What is the best way to store data for the iPhone? I will be developing an iPhone app in Objective-C which will take data from end users. This data will need to be save and loaded at various points. Essentially, what is the best combination of languages and frameworks to us...
[ "iphone", "objective-c", "ios", "sqlite" ]
4
5
923
4
0
2011-06-05T16:33:54.937000
2011-06-05T16:40:37.790000
6,244,258
6,244,283
Missing Return Statement
i am attempting to take the value of a textfield and make apply it to a method in order to search a textfile for that value. But in my method i am shown a Missing Return Value error and cannot seem to make it work. below is my code: submitsearch.addActionListener(new ActionListener() { public void actionPerformed(Actio...
Add a return null; after catch block. The method signature says that it returns a String. That implies no matter what flow your code takes, the method should return a value. But when an exception happens, there is no return. Hence you must specify a return value in the case when an exception happens
Missing Return Statement i am attempting to take the value of a textfield and make apply it to a method in order to search a textfile for that value. But in my method i am shown a Missing Return Value error and cannot seem to make it work. below is my code: submitsearch.addActionListener(new ActionListener() { public v...
TITLE: Missing Return Statement QUESTION: i am attempting to take the value of a textfield and make apply it to a method in order to search a textfile for that value. But in my method i am shown a Missing Return Value error and cannot seem to make it work. below is my code: submitsearch.addActionListener(new ActionLis...
[ "java", "swing" ]
0
3
1,916
2
0
2011-06-05T16:35:53.027000
2011-06-05T16:39:26.590000
6,244,261
6,244,365
Chrome not displaying text properly
Any ideas on why this code works perfectly in Firefox (that is, if the text is longer than the width it continues below) but in Chrome it doesn't work? (e.g the text keeps going to the right) The CSS: #leftnav { width: 18%; float: left; background-color: #fff; margin: 15px 0 0 0; margin-left: 5px; border: 1px solid #dd...
Use word-wrap: break-word: #leftnav h2 { font: normal 17px "Geneva", Helvetica, Arial, Tahoma, Verdana; letter-spacing: 0px; color: #ff4800; margin: 20px 0 5px 10px; word-wrap: break-word; } http://jsfiddle.net/7nruR/2/ http://webdesignerwall.com/tutorials/word-wrap-force-text-to-wrap
Chrome not displaying text properly Any ideas on why this code works perfectly in Firefox (that is, if the text is longer than the width it continues below) but in Chrome it doesn't work? (e.g the text keeps going to the right) The CSS: #leftnav { width: 18%; float: left; background-color: #fff; margin: 15px 0 0 0; mar...
TITLE: Chrome not displaying text properly QUESTION: Any ideas on why this code works perfectly in Firefox (that is, if the text is longer than the width it continues below) but in Chrome it doesn't work? (e.g the text keeps going to the right) The CSS: #leftnav { width: 18%; float: left; background-color: #fff; margi...
[ "html", "css", "google-chrome" ]
0
0
699
1
0
2011-06-05T16:36:06.217000
2011-06-05T16:52:31.847000
6,244,263
6,244,592
MVC: How to display a column in a Html:Grid only when there is a value in it?
i'm wondering how to control whether a column is visible in a Html.Grid if nothing has been returned in the list. So if in the below example Model.Comment doesn't have a value in the ExampleList, then the column should not be rendered. @Html.Grid(Model.ExampleList).Columns(c => { c.For(a => string.Format("{0:dd/MM/yyyy...
You should use a view model and inside this view model you should have a boolean property indicating whether something should be visible or not. Obviously all the logic about determining its value is not the view responsibility => it's the controller or the model. So for example you could have the following view model:...
MVC: How to display a column in a Html:Grid only when there is a value in it? i'm wondering how to control whether a column is visible in a Html.Grid if nothing has been returned in the list. So if in the below example Model.Comment doesn't have a value in the ExampleList, then the column should not be rendered. @Html....
TITLE: MVC: How to display a column in a Html:Grid only when there is a value in it? QUESTION: i'm wondering how to control whether a column is visible in a Html.Grid if nothing has been returned in the list. So if in the below example Model.Comment doesn't have a value in the ExampleList, then the column should not b...
[ "c#", "asp.net-mvc", "asp.net-mvc-3" ]
1
2
639
1
0
2011-06-05T16:36:20.827000
2011-06-05T17:31:09.270000
6,244,265
6,244,327
strange behaviour when comparing floating points in rspec
the 3rd of the following tests fails: specify { (0.6*2).should eql(1.2) } specify { (0.3*3).should eql(0.3*3) } specify { (0.3*3).should eql(0.9) } # this one fails Why is that? Is this a floating point issue or a ruby or rspec issue?
Don't compare floating point numbers for equality The problem is that neither 0.3 nor 0.9 has an exact representation 1 in the floating point format, and so when multiplying 0.3 * 3 you get a number that is very, very close to 0.9, and which will round to 0.9 for printing, but it isn't 0.9. And your 0.9 constant is als...
strange behaviour when comparing floating points in rspec the 3rd of the following tests fails: specify { (0.6*2).should eql(1.2) } specify { (0.3*3).should eql(0.3*3) } specify { (0.3*3).should eql(0.9) } # this one fails Why is that? Is this a floating point issue or a ruby or rspec issue?
TITLE: strange behaviour when comparing floating points in rspec QUESTION: the 3rd of the following tests fails: specify { (0.6*2).should eql(1.2) } specify { (0.3*3).should eql(0.3*3) } specify { (0.3*3).should eql(0.9) } # this one fails Why is that? Is this a floating point issue or a ruby or rspec issue? ANSWER: ...
[ "ruby", "rspec", "floating-point" ]
5
8
1,915
2
0
2011-06-05T16:36:50.577000
2011-06-05T16:46:29.917000
6,244,272
6,245,589
Drawing sections of a Bezier curve
I was writing code to approximate a quarter ellipse to a Bézier curve. Now having done that, I am encountering trouble drawing sections of this curve. I need some help choosing the control points. Initially, I had taken the ratio of distance of control point to distance of start of curve as 0.51. Edited: pseudo code im...
To approximate a circle quarter using a single cubic arc what is normally done is making the middle point being exactly on the circle and using tangent starting and ending directions. This is not formally the "best" approximation in any reasonable metric but is very easy to compute... for example the magic number for a...
Drawing sections of a Bezier curve I was writing code to approximate a quarter ellipse to a Bézier curve. Now having done that, I am encountering trouble drawing sections of this curve. I need some help choosing the control points. Initially, I had taken the ratio of distance of control point to distance of start of cu...
TITLE: Drawing sections of a Bezier curve QUESTION: I was writing code to approximate a quarter ellipse to a Bézier curve. Now having done that, I am encountering trouble drawing sections of this curve. I need some help choosing the control points. Initially, I had taken the ratio of distance of control point to dista...
[ "c++", "python", "bezier" ]
1
5
2,569
3
0
2011-06-05T16:37:31.443000
2011-06-05T20:17:24.310000
6,244,275
6,284,631
Rails 3 - Asset Pipeline -- What does it mean to me?
I am struggling to find any real documentation on the new Rails 3 asset pipeline. I know there is a video, but I do not wish to watch an hour video in this format. I watched about 10 minutes and gained no knowledge. So, what do I need to know about Rails 3 asset pipelines? What does this mean to my previous projects, a...
It means you will now be able to write css and javascript in separate files using sass and coffeescript if you want and they will be compiled into one single file in the end. If you have like, 4 css files on your assets/stylesheets they will be concatenated and compressed and delivered on production with a single appli...
Rails 3 - Asset Pipeline -- What does it mean to me? I am struggling to find any real documentation on the new Rails 3 asset pipeline. I know there is a video, but I do not wish to watch an hour video in this format. I watched about 10 minutes and gained no knowledge. So, what do I need to know about Rails 3 asset pipe...
TITLE: Rails 3 - Asset Pipeline -- What does it mean to me? QUESTION: I am struggling to find any real documentation on the new Rails 3 asset pipeline. I know there is a video, but I do not wish to watch an hour video in this format. I watched about 10 minutes and gained no knowledge. So, what do I need to know about ...
[ "ruby-on-rails-3", "asset-pipeline" ]
8
8
2,943
2
0
2011-06-05T16:38:02.877000
2011-06-08T20:10:36.110000
6,244,277
6,245,786
Blank space in the start of the Text in Listview
Hey, I have a simple list which contains Strings in Arabic, the problem is that some strings get a blank space on the begging of the word, so not all the words are allaigned properly.. Here is a screen shot of what I mean: As you can see in the 3rd and 4th line, there is a blank space before the name, and the source of...
It does not seem that you are doing anything wrong there. Try another font, as this might be a font issue. If that does not work, a workaround I would suggest you to set that text in code in the meantime. If it is reproducible with several fonts, I believe you should post a bug report here: http://code.google.com/p/and...
Blank space in the start of the Text in Listview Hey, I have a simple list which contains Strings in Arabic, the problem is that some strings get a blank space on the begging of the word, so not all the words are allaigned properly.. Here is a screen shot of what I mean: As you can see in the 3rd and 4th line, there is...
TITLE: Blank space in the start of the Text in Listview QUESTION: Hey, I have a simple list which contains Strings in Arabic, the problem is that some strings get a blank space on the begging of the word, so not all the words are allaigned properly.. Here is a screen shot of what I mean: As you can see in the 3rd and ...
[ "java", "android", "string" ]
1
0
299
1
0
2011-06-05T16:38:22.580000
2011-06-05T20:54:03.580000
6,244,286
6,244,316
openoffice headless commands documentation/references
anyone can point me to documentation/tutorials of how to use the openoffice headless version for document conversions? (from ppt to pdf, from doc to pdf etc..) and if is there any hint of how to use it with php, even better:) Regards, Shadow.
There's a PHP module written to interface with the Open Office programming API called PUNO that would be a useful first step. Instructions for configuring OO and building PUNO can be found here
openoffice headless commands documentation/references anyone can point me to documentation/tutorials of how to use the openoffice headless version for document conversions? (from ppt to pdf, from doc to pdf etc..) and if is there any hint of how to use it with php, even better:) Regards, Shadow.
TITLE: openoffice headless commands documentation/references QUESTION: anyone can point me to documentation/tutorials of how to use the openoffice headless version for document conversions? (from ppt to pdf, from doc to pdf etc..) and if is there any hint of how to use it with php, even better:) Regards, Shadow. ANSW...
[ "php", "linux", "command-line", "openoffice.org" ]
1
1
1,126
1
0
2011-06-05T16:39:38.837000
2011-06-05T16:43:53.100000
6,244,307
6,244,371
concatenate two strings
Let's say I have a string obtained from a cursor,this way: String name = cursor.getString(numcol); and another String like this one: String dest=cursor.getString(cursor.getColumnIndexOrThrow(db.KEY_DESTINATIE)); If finally I wanna obtain a String from the two of them,something like: name - dest Let say if name=Malmo an...
The best way in my eyes is to use the concat() method provided by the String class itself. The useage would, in your case, look like this: String myConcatedString = cursor.getString(numcol).concat('-'). concat(cursor.getString(cursor.getColumnIndexOrThrow(db.KEY_DESTINATIE)));
concatenate two strings Let's say I have a string obtained from a cursor,this way: String name = cursor.getString(numcol); and another String like this one: String dest=cursor.getString(cursor.getColumnIndexOrThrow(db.KEY_DESTINATIE)); If finally I wanna obtain a String from the two of them,something like: name - dest ...
TITLE: concatenate two strings QUESTION: Let's say I have a string obtained from a cursor,this way: String name = cursor.getString(numcol); and another String like this one: String dest=cursor.getString(cursor.getColumnIndexOrThrow(db.KEY_DESTINATIE)); If finally I wanna obtain a String from the two of them,something ...
[ "android", "string" ]
19
15
120,872
3
0
2011-06-05T16:41:35.003000
2011-06-05T16:53:53.213000
6,244,311
6,244,345
direct SQL Query working and and sql query via php not?
I'm trying to execute the following query via php's mysql_query function but it's not working. When I execute it directly (via phpMyAdmin's sql tab) it does work. Any idea what's going on? Update t1 SET r ='[{"Ia":36.009,"Ja":-78.93},{"Ia":36.01,"Ja":-78.93}]' WHERE id=1 Thanks!
It depends on how you use it. You have to escape your quotes. So it should be: mysql_query('Update t1 SET r =\'[{"Ia":36.009,"Ja":-78.93},{"Ia":36.01,"Ja":-78.93}]\' WHERE id=1'); OR mysql_query("Update t1 SET r ='[{\"Ia\":36.009,\"Ja\":-78.93},{\"Ia\":36.01,\"Ja\":-78.93}]' WHERE id=1"); Anyway, that is not pretty saf...
direct SQL Query working and and sql query via php not? I'm trying to execute the following query via php's mysql_query function but it's not working. When I execute it directly (via phpMyAdmin's sql tab) it does work. Any idea what's going on? Update t1 SET r ='[{"Ia":36.009,"Ja":-78.93},{"Ia":36.01,"Ja":-78.93}]' WHE...
TITLE: direct SQL Query working and and sql query via php not? QUESTION: I'm trying to execute the following query via php's mysql_query function but it's not working. When I execute it directly (via phpMyAdmin's sql tab) it does work. Any idea what's going on? Update t1 SET r ='[{"Ia":36.009,"Ja":-78.93},{"Ia":36.01,...
[ "php", "mysql", "sql", "phpmyadmin" ]
0
2
295
2
0
2011-06-05T16:42:33.477000
2011-06-05T16:49:26.663000
6,244,315
6,245,095
Elegant map implementation
having a list of ordered string to be compared to another list, I decided to implement one as a map in with the key is the first char of the string and the value the list of strings with the same first char. In short I have something as this: var list1:Map[Char, List[String]] = Map('a' -> List("alone", "away")) var lis...
From all I have seen you really want just a list. So use a List. (Or possibly a SortedSet http://www.scala-lang.org/api/current/scala/collection/SortedSet.html ) You seem to be concerned about performance but you neither state what part of which algorithm is to slow, nor how much faster it needs to go, nor do you provi...
Elegant map implementation having a list of ordered string to be compared to another list, I decided to implement one as a map in with the key is the first char of the string and the value the list of strings with the same first char. In short I have something as this: var list1:Map[Char, List[String]] = Map('a' -> Lis...
TITLE: Elegant map implementation QUESTION: having a list of ordered string to be compared to another list, I decided to implement one as a map in with the key is the first char of the string and the value the list of strings with the same first char. In short I have something as this: var list1:Map[Char, List[String]...
[ "list", "scala", "collections", "dictionary", "set" ]
0
4
404
2
0
2011-06-05T16:43:36.400000
2011-06-05T18:56:36.853000
6,244,326
6,244,338
Initialize radio button as checked
I am having trouble initializing a radio button as checked. What I mean is when I open the form, none of my 2 radio buttons are checked, but they work fine after I check on of them. I tried setting one of them as checked in the Form constructor, but it still appears as unchecked: public frmPreferences(Capitals capit) {...
radEnglish.Enabled = true This does not set the CheckBox to a Checked state, it enables the control. You could do this in the designer, or you could use the line radEnglish.Checked = true; For WPF it's radEnglish.IsChecked = true;
Initialize radio button as checked I am having trouble initializing a radio button as checked. What I mean is when I open the form, none of my 2 radio buttons are checked, but they work fine after I check on of them. I tried setting one of them as checked in the Form constructor, but it still appears as unchecked: publ...
TITLE: Initialize radio button as checked QUESTION: I am having trouble initializing a radio button as checked. What I mean is when I open the form, none of my 2 radio buttons are checked, but they work fine after I check on of them. I tried setting one of them as checked in the Form constructor, but it still appears ...
[ "c#", "winforms" ]
5
10
4,993
2
0
2011-06-05T16:46:29.047000
2011-06-05T16:48:32.540000
6,244,329
6,244,351
jquery does not work on loaded html
I'm appending HTML tags from html file to body using jQuery.After I loaded html tags I am loading JS file that doing something on html tags.jQuery does not work on loaded html but when I putting html tags statically on page jQuery working on it right. I use this code to append html tags to body What's the problem? Its ...
If I understood your question correctly, then you need to add the LoadNewScript() function inside a complete event for the.load() function. Like this: function DisplayLoginPanel() { $('Body').load('Resources/HTMLContents/Login.htm', function() { LoadNewScript("Resources/OtherTools/js/slide.js"); }); } The reason for th...
jquery does not work on loaded html I'm appending HTML tags from html file to body using jQuery.After I loaded html tags I am loading JS file that doing something on html tags.jQuery does not work on loaded html but when I putting html tags statically on page jQuery working on it right. I use this code to append html t...
TITLE: jquery does not work on loaded html QUESTION: I'm appending HTML tags from html file to body using jQuery.After I loaded html tags I am loading JS file that doing something on html tags.jQuery does not work on loaded html but when I putting html tags statically on page jQuery working on it right. I use this cod...
[ "jquery", "ajax" ]
4
4
435
1
0
2011-06-05T16:47:11.423000
2011-06-05T16:50:20.757000
6,244,330
6,244,952
Is ArrayAdapter thread safe in android? If not, what can I do to make it thread safe?
Lets say I extend ArrayAdapter and in the code where I am overriding getView(int i, View v, ViewGroup g), I retrieve the current item using getItem(i). Can I be sure that getItem(i) will return an item even if other threads manipulate the same ArrayAdapter? I am not sure, but I think the answer is no. If it is, what do...
It's not a matter of ArrayAdapter being thread safe. ListView and other such UI widgets that work with an Adapter do not allow the contents of the adapter to change unexpectedly on them. And this is more than just due to other threads -- you need to tell the ListView about the change you make before it next tries to in...
Is ArrayAdapter thread safe in android? If not, what can I do to make it thread safe? Lets say I extend ArrayAdapter and in the code where I am overriding getView(int i, View v, ViewGroup g), I retrieve the current item using getItem(i). Can I be sure that getItem(i) will return an item even if other threads manipulate...
TITLE: Is ArrayAdapter thread safe in android? If not, what can I do to make it thread safe? QUESTION: Lets say I extend ArrayAdapter and in the code where I am overriding getView(int i, View v, ViewGroup g), I retrieve the current item using getItem(i). Can I be sure that getItem(i) will return an item even if other ...
[ "android", "multithreading", "android-arrayadapter" ]
13
32
10,421
2
0
2011-06-05T16:47:15.877000
2011-06-05T18:32:41.817000
6,244,331
6,244,372
MySQL query equivalent of "AND", whereas "IN" is "OR"?
I'm trying to find a query that selects every row of an associative table where the second column indicates different values that must all be matched with the first column's. Example: I have column X and Y. I want to get the values of X where X is defined with every Y specified. x y ====== a 1 a 2 b 1 a 3 c 2 c 3 SELEC...
I hope this is what you're looking for. If you confirm it,I'll explain you the query. select x from table where y in (2,3) group by x having count(distinct(y)) = 2
MySQL query equivalent of "AND", whereas "IN" is "OR"? I'm trying to find a query that selects every row of an associative table where the second column indicates different values that must all be matched with the first column's. Example: I have column X and Y. I want to get the values of X where X is defined with ever...
TITLE: MySQL query equivalent of "AND", whereas "IN" is "OR"? QUESTION: I'm trying to find a query that selects every row of an associative table where the second column indicates different values that must all be matched with the first column's. Example: I have column X and Y. I want to get the values of X where X is...
[ "mysql", "sql" ]
5
11
962
1
0
2011-06-05T16:47:20.247000
2011-06-05T16:54:01.993000
6,244,341
6,244,355
Hostname of the current machine in Perl
How can I get the current machine hostname in Perl? I'm looking for a way that works both in Linux and Windows. With a websearch I found the module Sys::Hostname, however I can't install it install Sys::Hostname Going to read '/home/stivlo/.cpan/Metadata' Database was generated on Sat, 04 Jun 2011 15:27:16 GMT Running ...
It's telling you that it's already installed; Sys::Hostname has been part of the Perl distribution for years. You can rely on it being installed unless the machine was last updated somewhere in the early 90s.
Hostname of the current machine in Perl How can I get the current machine hostname in Perl? I'm looking for a way that works both in Linux and Windows. With a websearch I found the module Sys::Hostname, however I can't install it install Sys::Hostname Going to read '/home/stivlo/.cpan/Metadata' Database was generated o...
TITLE: Hostname of the current machine in Perl QUESTION: How can I get the current machine hostname in Perl? I'm looking for a way that works both in Linux and Windows. With a websearch I found the module Sys::Hostname, however I can't install it install Sys::Hostname Going to read '/home/stivlo/.cpan/Metadata' Databa...
[ "windows", "linux", "perl" ]
1
7
3,119
1
0
2011-06-05T16:49:02.567000
2011-06-05T16:51:24.510000
6,244,342
6,244,366
Can/should I implement Python methods by assignment to attributes?
Is there any stylistic taboo or other downside to implementing trivial methods by assignment to class attributes? E.g. like bar and baz below, as opposed to the more ususal foo. class MyClass(object): def hello(self): return 'hello' def foo(self): return self.hello() bar = lambda self: self.hello() baz = hello I find m...
Personally, I think things like __str__ = __repr__ = hello are fine, but bar = lambda self: self.hello() is evil. You cannot easily give a lambda a docstring, and the.func_name attribute will have the meaningless value. Both those problems don't occur for the first line.
Can/should I implement Python methods by assignment to attributes? Is there any stylistic taboo or other downside to implementing trivial methods by assignment to class attributes? E.g. like bar and baz below, as opposed to the more ususal foo. class MyClass(object): def hello(self): return 'hello' def foo(self): retur...
TITLE: Can/should I implement Python methods by assignment to attributes? QUESTION: Is there any stylistic taboo or other downside to implementing trivial methods by assignment to class attributes? E.g. like bar and baz below, as opposed to the more ususal foo. class MyClass(object): def hello(self): return 'hello' de...
[ "python", "coding-style" ]
6
8
117
2
0
2011-06-05T16:49:07.663000
2011-06-05T16:53:03.730000
6,244,358
6,258,614
Quartz.NET and AdoJobStore
I have created database for Quartz.NET. Configured it to use AdoJobStore this way: properties["quartz.scheduler.instanceName"] = "TestScheduler"; properties["quartz.scheduler.instanceId"] = "instance_one"; properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; properties["quartz.threadPool.thre...
I agree with NinjaNye. You have to submit your jobs using the API cause it needs to bind the the namespace of your classes in runtime. The process is very simple: // construct job info JobDetail jobDetail = new JobDetail("myJob", null, typeof(HelloJob)); // fire every hour Trigger trigger = TriggerUtils.MakeHourlyTrigg...
Quartz.NET and AdoJobStore I have created database for Quartz.NET. Configured it to use AdoJobStore this way: properties["quartz.scheduler.instanceName"] = "TestScheduler"; properties["quartz.scheduler.instanceId"] = "instance_one"; properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool, Quartz"; propert...
TITLE: Quartz.NET and AdoJobStore QUESTION: I have created database for Quartz.NET. Configured it to use AdoJobStore this way: properties["quartz.scheduler.instanceName"] = "TestScheduler"; properties["quartz.scheduler.instanceId"] = "instance_one"; properties["quartz.threadPool.type"] = "Quartz.Simpl.SimpleThreadPool...
[ ".net", "quartz-scheduler", "quartz.net" ]
2
3
2,683
2
0
2011-06-05T16:51:31.473000
2011-06-06T22:09:47.907000
6,244,376
6,263,964
How to upgrade php 5.2.10 to 5.2.11 using YUM on centOS
I can't find the commands anywhere. Thanks!
Just in case you don't have the software in your existing repositories, a great source is the "Remi" repository To import the repository su - cd /etc/yum.repos.d wget http://rpms.famillecollet.com/enterprise/remi.repo The repository is disabled by default so when you want to use install something you will need to type ...
How to upgrade php 5.2.10 to 5.2.11 using YUM on centOS I can't find the commands anywhere. Thanks!
TITLE: How to upgrade php 5.2.10 to 5.2.11 using YUM on centOS QUESTION: I can't find the commands anywhere. Thanks! ANSWER: Just in case you don't have the software in your existing repositories, a great source is the "Remi" repository To import the repository su - cd /etc/yum.repos.d wget http://rpms.famillecollet....
[ "php", "centos", "yum" ]
0
1
1,283
2
0
2011-06-05T16:54:41.520000
2011-06-07T10:33:12.317000
6,244,379
6,244,512
Codeigniter securely delete db entries
What is the safest way to delete rows in a database table using Codeigniter? I am using the following method. HTML: Retrieves links submitted by user (link title, url, and description). Adds Remove link to each entry. The link has a third segment that is the entry id from the db, link_id. link_title;?> link_url, 'url',...
You can use either form helper and POST request with CSRF protection instead of url method: http://codeigniter.com/user_guide/libraries/security.html or your method with links but add some code to: 1 sanitize uri segment, 2 add a token described in cabaret's link
Codeigniter securely delete db entries What is the safest way to delete rows in a database table using Codeigniter? I am using the following method. HTML: Retrieves links submitted by user (link title, url, and description). Adds Remove link to each entry. The link has a third segment that is the entry id from the db, ...
TITLE: Codeigniter securely delete db entries QUESTION: What is the safest way to delete rows in a database table using Codeigniter? I am using the following method. HTML: Retrieves links submitted by user (link title, url, and description). Adds Remove link to each entry. The link has a third segment that is the entr...
[ "php", "mysql", "database", "codeigniter" ]
1
2
1,794
1
0
2011-06-05T16:54:50.270000
2011-06-05T17:17:50.643000
6,244,380
6,244,484
LuaSocket socket/core.dll required location?
When I use local socket = require("socket.core") It works fine, the dll is located at "dir/socket/core.dll" but when I move the dll to say "dir/folder/core.dll" and use local socket = require("folder.core.") It returns that it was found however it could not find the specific module in folder.core. How do I use Luasocke...
If you want to require("socket.core"), the shared library (dll) has to have an exported function called luaopen_socket_core (which the LuaSocket library has). Thus, it always needs to be called as require("socket.core"). If you want to move the DLL into some other folder, you have to modify package.cpath, which contain...
LuaSocket socket/core.dll required location? When I use local socket = require("socket.core") It works fine, the dll is located at "dir/socket/core.dll" but when I move the dll to say "dir/folder/core.dll" and use local socket = require("folder.core.") It returns that it was found however it could not find the specific...
TITLE: LuaSocket socket/core.dll required location? QUESTION: When I use local socket = require("socket.core") It works fine, the dll is located at "dir/socket/core.dll" but when I move the dll to say "dir/folder/core.dll" and use local socket = require("folder.core.") It returns that it was found however it could not...
[ "windows", "lua", "winsock", "require", "luasocket" ]
2
7
3,753
2
0
2011-06-05T16:54:53.587000
2011-06-05T17:13:36.573000
6,244,381
6,244,434
Issue with SQL thinking my table name is a full table when I cast or convert it to a string
So I got a problem looks like with string conversion. I have tried everything under the sun. My goal is to inert the values from the loop into the table. However I can get the field value but I can not get the table name value due to sql thinks I am calling a table rather than a string. I have tried casting converting ...
You need to quote it to make it a constant, which requires doubling up because of dynamic SQL EXEC(' SELECT ' + @FieldName + ', ''' + @C + ''' FROM ' + @tblName +' ') Whether the use of dynamic SQL is a good idea or not is a different matter...
Issue with SQL thinking my table name is a full table when I cast or convert it to a string So I got a problem looks like with string conversion. I have tried everything under the sun. My goal is to inert the values from the loop into the table. However I can get the field value but I can not get the table name value d...
TITLE: Issue with SQL thinking my table name is a full table when I cast or convert it to a string QUESTION: So I got a problem looks like with string conversion. I have tried everything under the sun. My goal is to inert the values from the loop into the table. However I can get the field value but I can not get the ...
[ "sql", "sql-server", "t-sql" ]
1
3
296
3
0
2011-06-05T16:55:04.780000
2011-06-05T17:04:10.417000
6,244,387
6,244,397
How can this same result be achieved via a foreach loop in Java
I am trying to make a DeleteRecord() that takes any number of String[][] type arguments. I have made a sort of test function just to see what kind of logice iwould need to apply to make that function. I made it work but I want to use a foreach loop. how can I do that. I have this code: public void testSomething(String[...
You need to loop through the String[] s in the outer array of strings-arrays: for (String[] arr: enteredStrings) { for (String str: arr) {... } }
How can this same result be achieved via a foreach loop in Java I am trying to make a DeleteRecord() that takes any number of String[][] type arguments. I have made a sort of test function just to see what kind of logice iwould need to apply to make that function. I made it work but I want to use a foreach loop. how ca...
TITLE: How can this same result be achieved via a foreach loop in Java QUESTION: I am trying to make a DeleteRecord() that takes any number of String[][] type arguments. I have made a sort of test function just to see what kind of logice iwould need to apply to make that function. I made it work but I want to use a fo...
[ "java", "multidimensional-array", "foreach" ]
0
4
135
2
0
2011-06-05T16:56:05.347000
2011-06-05T16:57:51.073000
6,244,398
6,244,424
Tool/API to extract keyword(s) in a sentence in .net
I am looking for a tool/api in.net, which can roughly extract the key words in a sentence. For example, if i have a article with title "PIX: World's thinnest 15-inch laptop, Dell XPS 15z", i want to extract keyword(s), e.g. DELL, XPS 15z, laptop etc. so that i can search those keywords in other articles and present the...
Take a look here: Keyword Extraction in C# with Word Co-occurrence Algorithm Atrax Keyword Extraction Algorithm How do I extract keywords used in text?
Tool/API to extract keyword(s) in a sentence in .net I am looking for a tool/api in.net, which can roughly extract the key words in a sentence. For example, if i have a article with title "PIX: World's thinnest 15-inch laptop, Dell XPS 15z", i want to extract keyword(s), e.g. DELL, XPS 15z, laptop etc. so that i can se...
TITLE: Tool/API to extract keyword(s) in a sentence in .net QUESTION: I am looking for a tool/api in.net, which can roughly extract the key words in a sentence. For example, if i have a article with title "PIX: World's thinnest 15-inch laptop, Dell XPS 15z", i want to extract keyword(s), e.g. DELL, XPS 15z, laptop etc...
[ ".net", "search", "text", "dictionary", "keyword" ]
1
2
3,789
4
0
2011-06-05T16:58:14.597000
2011-06-05T17:02:38.380000
6,244,403
6,282,381
How to create global function on Coldfusion Flash Form page
How do I create a global function that I can call from my actionscript code in a Coldfusion Flash Forms page. Currently, all actionscript functionality on the page is linked to an event, for example, how do I create a GetCustomDate method that can be accessed by both cfsavecontents below. Currently, I have to do whatev...
I'm not familiar with ActionScript at all, but after defining your function you can assign it to a different scope: So after doing that, your code would change as follows: var customdate = request.GetCustomDate(); //do other stuff var newdate = request.GetCustomDate(); //do other stuff Sorry if I didn't address your qu...
How to create global function on Coldfusion Flash Form page How do I create a global function that I can call from my actionscript code in a Coldfusion Flash Forms page. Currently, all actionscript functionality on the page is linked to an event, for example, how do I create a GetCustomDate method that can be accessed ...
TITLE: How to create global function on Coldfusion Flash Form page QUESTION: How do I create a global function that I can call from my actionscript code in a Coldfusion Flash Forms page. Currently, all actionscript functionality on the page is linked to an event, for example, how do I create a GetCustomDate method tha...
[ "coldfusion", "actionscript-2" ]
0
1
1,139
2
0
2011-06-05T16:59:15.987000
2011-06-08T16:53:06.137000
6,244,409
6,244,541
external php form results
I have created dynamic pricing forms within a e-commerce site using javascript and it works fine. However I would prefer my more complex pricing computations to be in a PHP file external to the HTML form. The calculations are fairly complex and I have got them all working using PHP however I am new to PHP and for the l...
PHP script: JavaScript: function Ajax() { this.instance = window.XMLHttpRequest? new XMLHttpRequest(): new ActiveXObject('Microsoft.XMLHTTP'); this.request = function(url, callback) { this.instance.open('GET', url, true); this.instance.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { ...
external php form results I have created dynamic pricing forms within a e-commerce site using javascript and it works fine. However I would prefer my more complex pricing computations to be in a PHP file external to the HTML form. The calculations are fairly complex and I have got them all working using PHP however I a...
TITLE: external php form results QUESTION: I have created dynamic pricing forms within a e-commerce site using javascript and it works fine. However I would prefer my more complex pricing computations to be in a PHP file external to the HTML form. The calculations are fairly complex and I have got them all working usi...
[ "php", "html" ]
0
3
2,139
1
0
2011-06-05T17:00:16.503000
2011-06-05T17:22:56.793000
6,244,416
6,244,564
Castle Windsor: Register components across multiple projects in solution
I would like to use Castle Windsor for dependency injection for my solution consisting of the following projects: Mvc [ASP.NET MVC 3 Web Application]: presentation layer (depends on Business and Models ) Business [Class Library]: business layer (depends on DataAccess and Models ) DataAccess [Class Library]: data access...
You should configure the DI container in the MVC project. This is where everything comes into live. This where all the assemblies must be referenced including the data access layer of course (without referencing a concrete data access your MVC application simply cannot work). So the MVC application knows all about the ...
Castle Windsor: Register components across multiple projects in solution I would like to use Castle Windsor for dependency injection for my solution consisting of the following projects: Mvc [ASP.NET MVC 3 Web Application]: presentation layer (depends on Business and Models ) Business [Class Library]: business layer (d...
TITLE: Castle Windsor: Register components across multiple projects in solution QUESTION: I would like to use Castle Windsor for dependency injection for my solution consisting of the following projects: Mvc [ASP.NET MVC 3 Web Application]: presentation layer (depends on Business and Models ) Business [Class Library]:...
[ "asp.net-mvc", "asp.net-mvc-3", "dependency-injection", "castle-windsor" ]
4
1
4,633
4
0
2011-06-05T17:01:54.407000
2011-06-05T17:26:51.457000
6,244,421
6,244,432
How do I make one form load before the other in C#?
I have two forms in a visual C# forms application. I want to load one form before the other, however it automatically loads form1 first (even though that's the one I want to have load second). How do I change that?
Look at Program.cs, which will probably have something like: Application.Run(new Form1()); Change that to start with the second form.
How do I make one form load before the other in C#? I have two forms in a visual C# forms application. I want to load one form before the other, however it automatically loads form1 first (even though that's the one I want to have load second). How do I change that?
TITLE: How do I make one form load before the other in C#? QUESTION: I have two forms in a visual C# forms application. I want to load one form before the other, however it automatically loads form1 first (even though that's the one I want to have load second). How do I change that? ANSWER: Look at Program.cs, which ...
[ "c#", "winforms" ]
9
11
3,685
3
0
2011-06-05T17:02:14.863000
2011-06-05T17:04:09.117000
6,244,423
6,250,610
2D UIScrollView in javascript for mobiles?
I'm trying to simulate the behavior of 2 dimensional UIScrollView in javascript for a mobile web app. While 2d scrolling is by default working on mobile webkit, the scroll events seem very buggy. For example, I need to track the left and top offset while dragging the screen around. Most of the js libs I found work in 1...
An example/further explanation. Basics; A panel with an image, ID of 'plattegrond' I attach a listener to this "plattegrond" When the user taps on the map, a separate element is added which the user can position and drag around. The scroller function is a reference to the PANEL (imagePanel). The drag a reference to the...
2D UIScrollView in javascript for mobiles? I'm trying to simulate the behavior of 2 dimensional UIScrollView in javascript for a mobile web app. While 2d scrolling is by default working on mobile webkit, the scroll events seem very buggy. For example, I need to track the left and top offset while dragging the screen ar...
TITLE: 2D UIScrollView in javascript for mobiles? QUESTION: I'm trying to simulate the behavior of 2 dimensional UIScrollView in javascript for a mobile web app. While 2d scrolling is by default working on mobile webkit, the scroll events seem very buggy. For example, I need to track the left and top offset while drag...
[ "jquery", "ios", "mobile", "uiscrollview", "sencha-touch" ]
1
1
794
1
0
2011-06-05T17:02:32.523000
2011-06-06T10:20:05.083000
6,244,429
6,244,451
Passing Objects Via Web Service
I have a simple question about passing custom objects via a webservice. I created a class library called UserLibrary, compiled it and created a dll for it. Then I created a web service in another project and referenced this dll. Now I am passing in and returning an object from the dll in my WebMethod When I consume the...
You don't need to reference the.dll with object types your service consumes. Instead, when you add a service reference to your project in Visual Studio, all the necessary types will be generated for you based on service's meta data.
Passing Objects Via Web Service I have a simple question about passing custom objects via a webservice. I created a class library called UserLibrary, compiled it and created a dll for it. Then I created a web service in another project and referenced this dll. Now I am passing in and returning an object from the dll in...
TITLE: Passing Objects Via Web Service QUESTION: I have a simple question about passing custom objects via a webservice. I created a class library called UserLibrary, compiled it and created a dll for it. Then I created a web service in another project and referenced this dll. Now I am passing in and returning an obje...
[ ".net", "web-services" ]
0
2
753
1
0
2011-06-05T17:04:00.953000
2011-06-05T17:07:33.057000
6,244,431
6,244,446
Can someone explain this C++ syntax?
I'm going through someone else's code and came across the following syntax: typedef struct abc { abc(): member(0){} unsigned int member } It seems like a class with member variable and a constructor, except it is declared struct. I have two questions here. Is this syntax supported in C? What would be a reason to use...
This is not valid C. In C++, struct and class are essentially synonyms. The only difference is that members and inheritance are public by default in a struct, and private by default in a class. There are no hard guidelines on whether to choose struct or class. However, you'll often find people using struct only for sim...
Can someone explain this C++ syntax? I'm going through someone else's code and came across the following syntax: typedef struct abc { abc(): member(0){} unsigned int member } It seems like a class with member variable and a constructor, except it is declared struct. I have two questions here. Is this syntax supporte...
TITLE: Can someone explain this C++ syntax? QUESTION: I'm going through someone else's code and came across the following syntax: typedef struct abc { abc(): member(0){} unsigned int member } It seems like a class with member variable and a constructor, except it is declared struct. I have two questions here. Is th...
[ "c++" ]
2
8
314
6
0
2011-06-05T17:04:07.273000
2011-06-05T17:06:36.407000
6,244,454
6,245,693
android Dialog inside TabHost's activity
Here is the issue i am having. i have a tab host with 4 tab activities. I want to show a simple progress dialog in one of my activities but made so that the user can still move through the rest of the tabs (clicking the tabWidget should be still possible and the dialog will only show on the one activity). is something ...
If you want it inside only one activity, use a PrograssBar instead of a dialog. Add it to your layout as with any other View.
android Dialog inside TabHost's activity Here is the issue i am having. i have a tab host with 4 tab activities. I want to show a simple progress dialog in one of my activities but made so that the user can still move through the rest of the tabs (clicking the tabWidget should be still possible and the dialog will only...
TITLE: android Dialog inside TabHost's activity QUESTION: Here is the issue i am having. i have a tab host with 4 tab activities. I want to show a simple progress dialog in one of my activities but made so that the user can still move through the rest of the tabs (clicking the tabWidget should be still possible and th...
[ "android", "android-activity", "dialog", "tabs" ]
1
1
551
1
0
2011-06-05T17:08:09.247000
2011-06-05T20:34:56.217000
6,244,459
6,247,175
How to use schema for multiple sqlite db for Zend_Db_Table
So I have multiple sqlite database. /path/database1.db /path/database2.db When i make a Zend_Db_Table for it, how do I specify which db to use? class Application_Model_DbTable_User extends Zend_Db_Table_Abstract { protected $_schema = 'database1.db'; protected $_name = 'user'; } This don't seem to work. My current solu...
Easiest thing I can think of is to override Zend_Db_Table_Abstract::_setupDatabaseAdapter(), eg protected function _setupDatabaseAdapter() { if (!$this->_db) { $multiDb = Zend_Registry::get('multidb'); $this->_setAdapter($multiDb->getDb('database1')); } } You won't need to add anything to your Bootstrap as application ...
How to use schema for multiple sqlite db for Zend_Db_Table So I have multiple sqlite database. /path/database1.db /path/database2.db When i make a Zend_Db_Table for it, how do I specify which db to use? class Application_Model_DbTable_User extends Zend_Db_Table_Abstract { protected $_schema = 'database1.db'; protected ...
TITLE: How to use schema for multiple sqlite db for Zend_Db_Table QUESTION: So I have multiple sqlite database. /path/database1.db /path/database2.db When i make a Zend_Db_Table for it, how do I specify which db to use? class Application_Model_DbTable_User extends Zend_Db_Table_Abstract { protected $_schema = 'databas...
[ "zend-framework", "sqlite", "schema", "zend-db-table" ]
1
1
959
1
0
2011-06-05T17:08:46.463000
2011-06-06T01:52:03.923000
6,244,462
6,244,499
Extract text from a file object using .read()
I'm trying to read the source of a website with this code: import urllib2 z=urllib2.urlopen('http://skreemr.com/results.jsp?q=said+the+whale&search=SkreemR+Search') z.read() print z txt = open('music.txt','w') txt.write(str(z)) txt.close() for i in open('music.txt','r'): if '''onclick="javascript:pageTracker._trackPage...
z is a file object. In fact your codes prints the object description. You need to put the result of z.read() inside a variable (or print it directly). You should do import urllib2 z=urllib2.urlopen('http://skreemr.com/results.jsp?q=said+the+whale&search=SkreemR+Search') i = z.read() print i
Extract text from a file object using .read() I'm trying to read the source of a website with this code: import urllib2 z=urllib2.urlopen('http://skreemr.com/results.jsp?q=said+the+whale&search=SkreemR+Search') z.read() print z txt = open('music.txt','w') txt.write(str(z)) txt.close() for i in open('music.txt','r'): if...
TITLE: Extract text from a file object using .read() QUESTION: I'm trying to read the source of a website with this code: import urllib2 z=urllib2.urlopen('http://skreemr.com/results.jsp?q=said+the+whale&search=SkreemR+Search') z.read() print z txt = open('music.txt','w') txt.write(str(z)) txt.close() for i in open('m...
[ "python", "urllib2", "urlopen" ]
1
4
3,551
5
0
2011-06-05T17:09:04.467000
2011-06-05T17:15:54.900000
6,244,475
6,244,520
Why won't this ajax call work in this simple object literal ajax frame work for javascript
var ajax = { xmlHTTP: function() { xml = new XMLHttpRequest(); return xml; }, xmlHTTPfunction: function() { if (xml.readyState == 4 && xml.status == 200) { document.getElementById("te").innerHTML = xml.responseText; alert(xml.status); alert(xml.responseText); } }, xmlHTTPopen: function(url) { xml.open("POST", url, tru...
Most of the functions refer to the xml variable which is poorly scoped. That is to say, when you call ajax.xmlHTTPopen there's nothing to say that the xml variable has any value inside said function. The simplest way to provide better scoping would be to define the xml variable as a property of the ajax object; here is...
Why won't this ajax call work in this simple object literal ajax frame work for javascript var ajax = { xmlHTTP: function() { xml = new XMLHttpRequest(); return xml; }, xmlHTTPfunction: function() { if (xml.readyState == 4 && xml.status == 200) { document.getElementById("te").innerHTML = xml.responseText; alert(xml.sta...
TITLE: Why won't this ajax call work in this simple object literal ajax frame work for javascript QUESTION: var ajax = { xmlHTTP: function() { xml = new XMLHttpRequest(); return xml; }, xmlHTTPfunction: function() { if (xml.readyState == 4 && xml.status == 200) { document.getElementById("te").innerHTML = xml.responseT...
[ "javascript" ]
0
2
490
2
0
2011-06-05T17:12:07.680000
2011-06-05T17:19:06.523000
6,244,491
6,247,335
Profiling a method in C# to know how long does it take to run
I need to get a timing report to know how long does it take to run a C# method in a class. I think about using profiler to do that. The input is the name of a method in a class, the output is What method/class calls this method. The amount of time to run the method. What tools/commercial products are available for that...
Another opensource profiler is slimtune http://code.google.com/p/slimtune/ Alternatively you can create your own profiler using COM and the ICorProfilerCallback interfaces, but I would do this if you wanted a very customized profiler gathering.
Profiling a method in C# to know how long does it take to run I need to get a timing report to know how long does it take to run a C# method in a class. I think about using profiler to do that. The input is the name of a method in a class, the output is What method/class calls this method. The amount of time to run the...
TITLE: Profiling a method in C# to know how long does it take to run QUESTION: I need to get a timing report to know how long does it take to run a C# method in a class. I think about using profiler to do that. The input is the name of a method in a class, the output is What method/class calls this method. The amount ...
[ "c#", "visual-studio", "visual-studio-2010", "mono", "profiling" ]
1
2
5,289
3
0
2011-06-05T17:14:43.627000
2011-06-06T02:31:21.157000
6,244,496
6,244,535
ListBox Winform question
I use OpenFileDialog class, to open and display a filename chosen. List paths; private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { label1.Text = "Now you can save the file paths or remove them from the list above"; paths.Add(openFileDialog1.FileName); listBox1.DataSource=paths;//Only one file is dis...
You have to set Multiselect in your file dialog to true and then use the FileNames property: private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { string[] files = openFileDialog1.FileNames; paths.AddRange(files); listBox1.DataSource=paths; Refresh(); }
ListBox Winform question I use OpenFileDialog class, to open and display a filename chosen. List paths; private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { label1.Text = "Now you can save the file paths or remove them from the list above"; paths.Add(openFileDialog1.FileName); listBox1.DataSource=pat...
TITLE: ListBox Winform question QUESTION: I use OpenFileDialog class, to open and display a filename chosen. List paths; private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { label1.Text = "Now you can save the file paths or remove them from the list above"; paths.Add(openFileDialog1.FileName); listB...
[ "c#", "winforms", "listbox" ]
2
2
357
2
0
2011-06-05T17:15:19.380000
2011-06-05T17:21:34.110000
6,244,500
6,244,666
How can I nest a layout within a Relative Layout or create two Relative Layouts?
The emulator keeps on crashing when I run this It works fine If I take out the LinearLayout can someone please help me with formatting it to run properly. Thanks in advance.
Try adding a default android:layout_width, android:layout_height, and android:orientation to your LinearLayout. EDIT: Also, add an ID to the View above the LinearLayout.
How can I nest a layout within a Relative Layout or create two Relative Layouts? The emulator keeps on crashing when I run this It works fine If I take out the LinearLayout can someone please help me with formatting it to run properly. Thanks in advance.
TITLE: How can I nest a layout within a Relative Layout or create two Relative Layouts? QUESTION: The emulator keeps on crashing when I run this It works fine If I take out the LinearLayout can someone please help me with formatting it to run properly. Thanks in advance. ANSWER: Try adding a default android:layout_wi...
[ "android", "xml", "android-layout" ]
0
1
1,227
1
0
2011-06-05T17:15:56.570000
2011-06-05T17:45:43.377000
6,244,509
6,244,668
Similar to Axis X, Y - multiple values which needs to be checked, how to do it?
I got many tables which need to be checked for specific values I will need to input specific numbers and then I need a function to check if the square block is found in the particular region, if so, what number that region got (70 or 75). Values are: 0.00 till -12.00 (left vertical metter) 0.00 till +4.00 (upper horizo...
You have the right idea. From the picture it looks like the functions are liner in the region you specified so you can use y = mx + b to get the equation for each line (I see at least 4). This page http://www.purplemath.com/modules/slopgrph.htm explains how to compute the line equations you need. Once you have the form...
Similar to Axis X, Y - multiple values which needs to be checked, how to do it? I got many tables which need to be checked for specific values I will need to input specific numbers and then I need a function to check if the square block is found in the particular region, if so, what number that region got (70 or 75). V...
TITLE: Similar to Axis X, Y - multiple values which needs to be checked, how to do it? QUESTION: I got many tables which need to be checked for specific values I will need to input specific numbers and then I need a function to check if the square block is found in the particular region, if so, what number that region...
[ "php", "algorithm", "function", "math" ]
2
1
172
1
0
2011-06-05T17:17:24.603000
2011-06-05T17:46:19.040000
6,244,513
6,244,531
What does --ascii option do for zip command?
In Mac OS X 10.5, $ man zip shows -a --ascii [Systems using EBCDIC] Translate file to ASCII format. and Info-ZIP 16 June 2008 (v3.0) ZIP(1L) What does it mean? If I want to revision control some.zip files using git and hg, what options should I consider using with zip command?
As the description says, it's only for computers that use EBCDIC. If you've never heard of EBCDIC, that won't apply to you. i.e., don't bother using --ascii. If you're curious, EBCDIC is a family of character encodings that are totally incompatible with ASCII, used on some IBM systems.
What does --ascii option do for zip command? In Mac OS X 10.5, $ man zip shows -a --ascii [Systems using EBCDIC] Translate file to ASCII format. and Info-ZIP 16 June 2008 (v3.0) ZIP(1L) What does it mean? If I want to revision control some.zip files using git and hg, what options should I consider using with zip comman...
TITLE: What does --ascii option do for zip command? QUESTION: In Mac OS X 10.5, $ man zip shows -a --ascii [Systems using EBCDIC] Translate file to ASCII format. and Info-ZIP 16 June 2008 (v3.0) ZIP(1L) What does it mean? If I want to revision control some.zip files using git and hg, what options should I consider usi...
[ "zip" ]
1
4
1,960
1
0
2011-06-05T17:17:54.940000
2011-06-05T17:20:50.503000
6,244,516
6,244,547
special characters display proper in Java IDE, but not in program launched from jar file
I'm trying to build a Chinese flashcards program in Java to help myself learn Chinese. I'm using intelliJ IDEA 10. The basic process is that my program will read a file saved on the local machine to generate the flashcards. The file is written using the File class in java. When opened in notepad, it displays all charac...
IntelliJ doesn't use the platform default encoding, it autodetects it based on the encoding of the source files. When running the code outside IntelliJ, you need to ensure that you explicitly specify the proper encoding when reading/writing the file. You can do that by specifying it as 2nd constructor argument of Input...
special characters display proper in Java IDE, but not in program launched from jar file I'm trying to build a Chinese flashcards program in Java to help myself learn Chinese. I'm using intelliJ IDEA 10. The basic process is that my program will read a file saved on the local machine to generate the flashcards. The fil...
TITLE: special characters display proper in Java IDE, but not in program launched from jar file QUESTION: I'm trying to build a Chinese flashcards program in Java to help myself learn Chinese. I'm using intelliJ IDEA 10. The basic process is that my program will read a file saved on the local machine to generate the f...
[ "java", "character-encoding", "jar", "intellij-idea" ]
3
5
2,253
2
0
2011-06-05T17:18:11.850000
2011-06-05T17:24:02.427000
6,244,519
6,244,575
a good beginner's graphic tutorial?
i was wondering if any of you image processing gurus know a good tutorial to get me going from scratch with graphics and image processing in java? The type of things i'd like to learn is matrix transformatons, using a src image and applying a matrix to the dst image. Thanks in advance Matt.
Here's quite a nice introduction tutorial in Image Processing with Java. It has theory, which is transferable to Android (and other platforms). Once you know some of the theory, this tutorial explains how to manipulate images and pixels on Android. There are some existing libraries which you can use as well such as a J...
a good beginner's graphic tutorial? i was wondering if any of you image processing gurus know a good tutorial to get me going from scratch with graphics and image processing in java? The type of things i'd like to learn is matrix transformatons, using a src image and applying a matrix to the dst image. Thanks in advanc...
TITLE: a good beginner's graphic tutorial? QUESTION: i was wondering if any of you image processing gurus know a good tutorial to get me going from scratch with graphics and image processing in java? The type of things i'd like to learn is matrix transformatons, using a src image and applying a matrix to the dst image...
[ "java", "android", "graphics", "image-processing", "transformation" ]
1
0
643
1
0
2011-06-05T17:18:35.607000
2011-06-05T17:28:57.553000
6,244,523
6,247,942
Linux: what is the most scalable design for making a system call like fadvise in a thread?
My server has the following requirements: 1) each new connection to the server will trigger a series of N posix_fadvise calls. 2) the first few fadvise calls per connection should happen ASAP 3) ability to re-order the fadvise calls if the client makes a subsequent requests. I am thinking: thread pool with shared queue...
There is no point in having multiple threads blocking in fadvise at the same time for the same underlying device, since they're all sharing the same request queue anyway. This means that you should only need a single readahead thread, that takes readahead requests from a queue and executes them sequentially.
Linux: what is the most scalable design for making a system call like fadvise in a thread? My server has the following requirements: 1) each new connection to the server will trigger a series of N posix_fadvise calls. 2) the first few fadvise calls per connection should happen ASAP 3) ability to re-order the fadvise ca...
TITLE: Linux: what is the most scalable design for making a system call like fadvise in a thread? QUESTION: My server has the following requirements: 1) each new connection to the server will trigger a series of N posix_fadvise calls. 2) the first few fadvise calls per connection should happen ASAP 3) ability to re-or...
[ "linux", "multithreading", "posix", "scalability", "fread" ]
1
0
306
2
0
2011-06-05T17:19:32.390000
2011-06-06T05:03:28.260000
6,244,532
6,244,895
Can't open more than 28234 sockets?
I'm writing a network service and I'm aiming for high concurrency. For some reason, when I try to connect to the 28,234th socket I get: [Errno 99] Cannot assign requested address The client is written in python and the server side is written in haskell. I'm running this on ubuntu 11.04, and: $ ulimit -n 1048576 How can...
The usual workaround is to create additional IP addresses on the host, each IP will gain you an additional ephemeral port range as per dan_waterworth's answer as long as you bind the socket to the interface. Microsoft have a discussion on the topic here: http://msdn.microsoft.com/en-us/library/cc150670(v=vs.85).aspx
Can't open more than 28234 sockets? I'm writing a network service and I'm aiming for high concurrency. For some reason, when I try to connect to the 28,234th socket I get: [Errno 99] Cannot assign requested address The client is written in python and the server side is written in haskell. I'm running this on ubuntu 11....
TITLE: Can't open more than 28234 sockets? QUESTION: I'm writing a network service and I'm aiming for high concurrency. For some reason, when I try to connect to the 28,234th socket I get: [Errno 99] Cannot assign requested address The client is written in python and the server side is written in haskell. I'm running ...
[ "linux", "networking" ]
4
1
632
2
0
2011-06-05T17:21:03.730000
2011-06-05T18:23:36.017000
6,244,537
6,244,610
Android SQL error, wont create the table
I'm new to programming android, I'm trying to make a SQLite DAtabase but i keep get this error 06-05 17:10:59.164: ERROR/AndroidRuntime(268): FATAL EXCEPTION: main 06-05 17:10:59.164: ERROR/AndroidRuntime(268): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.c.notes/com.c.notes.Notes}: android.d...
The table you're querying is saved as "note" in your database table name variable. You create the table as "notes" with an "s."
Android SQL error, wont create the table I'm new to programming android, I'm trying to make a SQLite DAtabase but i keep get this error 06-05 17:10:59.164: ERROR/AndroidRuntime(268): FATAL EXCEPTION: main 06-05 17:10:59.164: ERROR/AndroidRuntime(268): java.lang.RuntimeException: Unable to start activity ComponentInfo{...
TITLE: Android SQL error, wont create the table QUESTION: I'm new to programming android, I'm trying to make a SQLite DAtabase but i keep get this error 06-05 17:10:59.164: ERROR/AndroidRuntime(268): FATAL EXCEPTION: main 06-05 17:10:59.164: ERROR/AndroidRuntime(268): java.lang.RuntimeException: Unable to start activ...
[ "android", "database", "sqlite", "syntax-error", "notepad" ]
0
4
523
1
0
2011-06-05T17:21:44.750000
2011-06-05T17:37:09.430000
6,244,542
6,254,500
VSTO Excel: Triggering automatic backups
I have a rather involved Excel add-in that's begun exhibiting some bugs after being deployed. This is not unexpected, but one of the bugs is proving really hard to reproduce (and therefore to fix), and it does lock up the application instance, potentially leading to loss of data. So I'd like to trigger an automatic bac...
Why not just invoke the Workbook.Save function for all sheets where Saved is false? Or maybe SaveCopyAs... I looked but didn't see anyway to forcible trigger the "backup" process, But, since you can query the AutoRecover object for a path, you could just use SaveCopyAs to do the same thing.
VSTO Excel: Triggering automatic backups I have a rather involved Excel add-in that's begun exhibiting some bugs after being deployed. This is not unexpected, but one of the bugs is proving really hard to reproduce (and therefore to fix), and it does lock up the application instance, potentially leading to loss of data...
TITLE: VSTO Excel: Triggering automatic backups QUESTION: I have a rather involved Excel add-in that's begun exhibiting some bugs after being deployed. This is not unexpected, but one of the bugs is proving really hard to reproduce (and therefore to fix), and it does lock up the application instance, potentially leadi...
[ "c#", "excel", "backup", "vsto" ]
1
1
337
1
0
2011-06-05T17:23:04.697000
2011-06-06T15:41:28.110000
6,244,543
6,245,707
GAE: Model loses track of parent->child relationship
I'm having what seems like a very strange problem with an Entity relationship in the google app engine data store. I'm work on a Python/GAE webapp (learning exercise), the full code to which can be found on sourceforge. I have 2 models: Gallery - a search term and (indirectly) a list of photos Photo - information about...
So, after much digging around, I believe I found an answer... When a file is modified (the timestamp changes), the app engine invalidates the compiled/cached files it has When the Photo class is defined, it adds a property to the Gallery based on the collection of ids it has for them When it needs the Gallery class, th...
GAE: Model loses track of parent->child relationship I'm having what seems like a very strange problem with an Entity relationship in the google app engine data store. I'm work on a Python/GAE webapp (learning exercise), the full code to which can be found on sourceforge. I have 2 models: Gallery - a search term and (i...
TITLE: GAE: Model loses track of parent->child relationship QUESTION: I'm having what seems like a very strange problem with an Entity relationship in the google app engine data store. I'm work on a Python/GAE webapp (learning exercise), the full code to which can be found on sourceforge. I have 2 models: Gallery - a ...
[ "python", "database", "google-app-engine" ]
2
2
154
1
0
2011-06-05T17:23:20.097000
2011-06-05T20:36:48.880000
6,244,544
6,244,574
Zend Framework switchting to native namespace
since PHP 5.3 Zend Framework definetly supports namespace as I assume. But the tutorials, examples, and also the ZF.sh tools still uses the old "fake" namespacing. My question is, how do I get Zend using the new, real namespace system?
There is nothing to do, their autoloader can find My_Namespace_Class1 as well as My\Namespace\Class1 (by replacing the namespace separator by "/" to find the file). So you just have to use their autoloader and configure it the same way you would with old/fake namespaces.
Zend Framework switchting to native namespace since PHP 5.3 Zend Framework definetly supports namespace as I assume. But the tutorials, examples, and also the ZF.sh tools still uses the old "fake" namespacing. My question is, how do I get Zend using the new, real namespace system?
TITLE: Zend Framework switchting to native namespace QUESTION: since PHP 5.3 Zend Framework definetly supports namespace as I assume. But the tutorials, examples, and also the ZF.sh tools still uses the old "fake" namespacing. My question is, how do I get Zend using the new, real namespace system? ANSWER: There is no...
[ "php", "zend-framework", "namespaces" ]
0
2
147
2
0
2011-06-05T17:23:34.440000
2011-06-05T17:28:41.427000
6,244,548
6,244,677
Synchronous JQuery.post()
I'm writing a little script that makes individual AJAX calls through a loop and I came across a, most likely obvious, problem. It seems that the loop is going to fast to handle the data that is received with ajax, causing it to only load the last piece of data in the loop. I added an alert box that steps through the it...
I actually found that adding this snippet worked so I didn't have to change my.post() to.ajax() $.ajaxSetup({ async: false }); I'm not sure if it will also change the settings of my other ajax calls though
Synchronous JQuery.post() I'm writing a little script that makes individual AJAX calls through a loop and I came across a, most likely obvious, problem. It seems that the loop is going to fast to handle the data that is received with ajax, causing it to only load the last piece of data in the loop. I added an alert box...
TITLE: Synchronous JQuery.post() QUESTION: I'm writing a little script that makes individual AJAX calls through a loop and I came across a, most likely obvious, problem. It seems that the loop is going to fast to handle the data that is received with ajax, causing it to only load the last piece of data in the loop. I ...
[ "javascript", "jquery", "ajax", "synchronization" ]
8
5
4,285
4
0
2011-06-05T17:24:02.863000
2011-06-05T17:47:20.120000
6,244,557
6,244,572
How to write a callback handler function in jQuery plugin
I'm writing a jQuery plug-in to handle a callback function after an event is fired. (function($){ return $.fn.myPlugin = function (options) { var defaults = { callback:defaultCallback, many_more_params:'default etc', many_more_params2:'default etc', etc:'default etc' } var settings = $.extend(defaults, options); var d...
Change the order of your code. Put: var defaultCallback = function (params) { // do default actions with params } before var defaults = { callback:defaultCallback, many_more_params:'default etc', many_more_params2:'default etc', etc:'default etc' } and it should work they way you want it to. Example: http://jsfiddle.ne...
How to write a callback handler function in jQuery plugin I'm writing a jQuery plug-in to handle a callback function after an event is fired. (function($){ return $.fn.myPlugin = function (options) { var defaults = { callback:defaultCallback, many_more_params:'default etc', many_more_params2:'default etc', etc:'default...
TITLE: How to write a callback handler function in jQuery plugin QUESTION: I'm writing a jQuery plug-in to handle a callback function after an event is fired. (function($){ return $.fn.myPlugin = function (options) { var defaults = { callback:defaultCallback, many_more_params:'default etc', many_more_params2:'default ...
[ "javascript", "jquery", "jquery-plugins" ]
4
4
1,977
1
0
2011-06-05T17:25:30.923000
2011-06-05T17:28:26.713000
6,244,578
6,259,361
curl post file behind a proxy returns error
I am trying to post an image file to a server. Initially I tested my script without proxy at my home and it worked fine. But when I used the same script in my college it is throwing some error. The function for uploading images is as below function upload($filepath,$dir) { $ch = curl_init(); curl_setopt($ch, CURLOPT_H...
The problem is the proxy our institute using is "SQUID". And Squid doesn't support Expect: 100-continue. So finally added this to my options curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); and its all working fine.
curl post file behind a proxy returns error I am trying to post an image file to a server. Initially I tested my script without proxy at my home and it worked fine. But when I used the same script in my college it is throwing some error. The function for uploading images is as below function upload($filepath,$dir) { $...
TITLE: curl post file behind a proxy returns error QUESTION: I am trying to post an image file to a server. Initially I tested my script without proxy at my home and it worked fine. But when I used the same script in my college it is throwing some error. The function for uploading images is as below function upload($f...
[ "php", "post", "curl", "proxy" ]
8
12
8,573
3
0
2011-06-05T17:29:22.797000
2011-06-06T23:58:40.833000
6,244,580
6,246,405
How to change size of BitmapDrawable in accordance with size of TextView?
I have TextView with background picture in my layout and would like to apply an animation to the text only. So, as I was advised in the separate question: you could try embedding a TextView and a BitmapDrawable in a FrameLayout, then apply the animation to the TextView. So, the question is what should be the layout tha...
Try setting the drawable on the FrameLayout itself. The FrameLayout will be the same size as the text, because of wrap_content, and so the background will be as well. The animation should only affect the drawing, not the actual layout, so this should still work when you animate it.
How to change size of BitmapDrawable in accordance with size of TextView? I have TextView with background picture in my layout and would like to apply an animation to the text only. So, as I was advised in the separate question: you could try embedding a TextView and a BitmapDrawable in a FrameLayout, then apply the an...
TITLE: How to change size of BitmapDrawable in accordance with size of TextView? QUESTION: I have TextView with background picture in my layout and would like to apply an animation to the text only. So, as I was advised in the separate question: you could try embedding a TextView and a BitmapDrawable in a FrameLayout,...
[ "android", "bitmap", "textview" ]
0
1
522
1
0
2011-06-05T17:29:33
2011-06-05T22:44:54.217000
6,244,581
6,244,679
Replacement for _PyString_Resize in Python 3
I'm porting a module that uses C to extend Python's functionality from 2.x to 3, and can't find in the documents any references on how to resize a string, only how to get its size: http://docs.python.org/py3k/c-api/unicode.html?highlight=pyunicode#PyUnicode_GetSize How do I convert this code: _PyString_Resize(&buffer, ...
While it's not documented in the page you linked, unicodeobject.c does contain both int _PyUnicode_Resize(PyUnicodeObject **unicode, Py_ssize_t length) and the wrapper int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) { return _PyUnicode_Resize((PyUnicodeObject **)unicode, length); } I don't know if the lack ...
Replacement for _PyString_Resize in Python 3 I'm porting a module that uses C to extend Python's functionality from 2.x to 3, and can't find in the documents any references on how to resize a string, only how to get its size: http://docs.python.org/py3k/c-api/unicode.html?highlight=pyunicode#PyUnicode_GetSize How do I ...
TITLE: Replacement for _PyString_Resize in Python 3 QUESTION: I'm porting a module that uses C to extend Python's functionality from 2.x to 3, and can't find in the documents any references on how to resize a string, only how to get its size: http://docs.python.org/py3k/c-api/unicode.html?highlight=pyunicode#PyUnicode...
[ "python", "python-3.x" ]
3
5
410
1
0
2011-06-05T17:29:43.517000
2011-06-05T17:48:10.413000
6,244,600
6,244,624
How do I find the position of the max value in an array?
If I have ary = [7, 8, 0, 1, nil, 6] How do I find the position of the max value in the array? I can do this but it would take more than one line.
This returns the index of the first max value in the array: ary = [7, 8, 0, 1, nil, 6, 8] ary.index(ary.compact.max) => 1
How do I find the position of the max value in an array? If I have ary = [7, 8, 0, 1, nil, 6] How do I find the position of the max value in the array? I can do this but it would take more than one line.
TITLE: How do I find the position of the max value in an array? QUESTION: If I have ary = [7, 8, 0, 1, nil, 6] How do I find the position of the max value in the array? I can do this but it would take more than one line. ANSWER: This returns the index of the first max value in the array: ary = [7, 8, 0, 1, nil, 6, 8]...
[ "ruby-on-rails", "ruby" ]
3
5
1,916
4
0
2011-06-05T17:33:02.437000
2011-06-05T17:39:02.560000
6,244,605
6,244,658
How to dynamically clone class methods but be able to tell them apart in Python
I'm trying to write a wrapper for an external module in python. The module provides a method to conjugate a verb that expects 2 arguments. I would like to wrap it into several methods and I was wondering if there was a way to do it programatically. i.e. instead of: class X: def a(self,arg): return module.do(arg,'a') de...
You're simply setting all the b to z attributes of your class to point to the a method. This means that whenever somebody accesses instance.b, it gives back the a method (which is why the co_name is always a ). You can accomplish what you want like this: import string class X(object): def __getattr__(self, name): if n...
How to dynamically clone class methods but be able to tell them apart in Python I'm trying to write a wrapper for an external module in python. The module provides a method to conjugate a verb that expects 2 arguments. I would like to wrap it into several methods and I was wondering if there was a way to do it programa...
TITLE: How to dynamically clone class methods but be able to tell them apart in Python QUESTION: I'm trying to write a wrapper for an external module in python. The module provides a method to conjugate a verb that expects 2 arguments. I would like to wrap it into several methods and I was wondering if there was a way...
[ "python", "class" ]
1
1
97
2
0
2011-06-05T17:35:17.397000
2011-06-05T17:44:14.443000
6,244,606
6,244,619
PHP/MYSQL action on updated field
I am running into a slight problem, I need to generate a report that focuses on the changes on certain fields in a database. What I figured to do, is something like this "If Updated, Insert today's date in seperate field" that way, when I generate the report, I can verify which entries have been modified by checking th...
You could add a timestamp field to your table structure your_field timestamp default current_timestamp on update current_timestamp Take a look at the manual for the available syntax http://dev.mysql.com/doc/refman/5.0/en/timestamp.html edit. If you need to update the time only if specific fields change, then you need a...
PHP/MYSQL action on updated field I am running into a slight problem, I need to generate a report that focuses on the changes on certain fields in a database. What I figured to do, is something like this "If Updated, Insert today's date in seperate field" that way, when I generate the report, I can verify which entries...
TITLE: PHP/MYSQL action on updated field QUESTION: I am running into a slight problem, I need to generate a report that focuses on the changes on certain fields in a database. What I figured to do, is something like this "If Updated, Insert today's date in seperate field" that way, when I generate the report, I can ve...
[ "php", "mysql", "codeigniter", "if-statement" ]
0
3
456
1
0
2011-06-05T17:35:30.570000
2011-06-05T17:38:23.767000
6,244,607
6,244,618
Is this plausible in C/C++ socket communication?
I currently have a basic client/server setup. The server needs to take requests from client(s) and need to respond to different request message types. An example of client request could be get list of files available, how many other clients are connected to the server, etc. I would obviously have to figure out a way to...
This is perfectly possible. Not recommended, though, because now you're using the same environment for the client and the server, but you may change in the future, and you'll have to change this code to be more platform/implementation independent. Options? boost::serialization, XML-RPC, even HTTP/REST or any other high...
Is this plausible in C/C++ socket communication? I currently have a basic client/server setup. The server needs to take requests from client(s) and need to respond to different request message types. An example of client request could be get list of files available, how many other clients are connected to the server, e...
TITLE: Is this plausible in C/C++ socket communication? QUESTION: I currently have a basic client/server setup. The server needs to take requests from client(s) and need to respond to different request message types. An example of client request could be get list of files available, how many other clients are connecte...
[ "c", "sockets" ]
3
4
198
3
0
2011-06-05T17:35:37.507000
2011-06-05T17:38:23.510000
6,244,611
6,244,681
Need help testing data on an array
Im new on GM. Iv'e run into an problem on an array segment. Here is the code: var A1_rest= ''; var A1reset_go = false; var auctiontyp = 0 var myJson = '{"d":[["","","y","ZAR","1","49517","6458, 8270, 8270, 8270, 7635",null,"1.40","6458","0:13:30","","12","","C","30",null],["y","-00:00","y","ZAR","2","49593","6458, 645...
You are expecting a "text value of null", but I think the actual value is just null, or nothing, rather than the text 'null'.
Need help testing data on an array Im new on GM. Iv'e run into an problem on an array segment. Here is the code: var A1_rest= ''; var A1reset_go = false; var auctiontyp = 0 var myJson = '{"d":[["","","y","ZAR","1","49517","6458, 8270, 8270, 8270, 7635",null,"1.40","6458","0:13:30","","12","","C","30",null],["y","-00:0...
TITLE: Need help testing data on an array QUESTION: Im new on GM. Iv'e run into an problem on an array segment. Here is the code: var A1_rest= ''; var A1reset_go = false; var auctiontyp = 0 var myJson = '{"d":[["","","y","ZAR","1","49517","6458, 8270, 8270, 8270, 7635",null,"1.40","6458","0:13:30","","12","","C","30"...
[ "jquery", "ajax", "json", "greasemonkey" ]
0
1
61
1
0
2011-06-05T17:37:15.140000
2011-06-05T17:48:28.493000
6,244,613
6,244,627
Binding TabControl to collection of ViewModels
how to bind TabControl to ObservableCollection of ViewModels? I can't write DataTemplates... more precisely, how to specify what's in the title and what's in the body of each TabItem. I would appreciate mini XAML example, please.
Header is specified by ItemTemplate, body is specified by ContentTemplate. e.g. If you have trouble with bindings and datatemplates read the overviews first: Data Binding Overview Data Templating Overview
Binding TabControl to collection of ViewModels how to bind TabControl to ObservableCollection of ViewModels? I can't write DataTemplates... more precisely, how to specify what's in the title and what's in the body of each TabItem. I would appreciate mini XAML example, please.
TITLE: Binding TabControl to collection of ViewModels QUESTION: how to bind TabControl to ObservableCollection of ViewModels? I can't write DataTemplates... more precisely, how to specify what's in the title and what's in the body of each TabItem. I would appreciate mini XAML example, please. ANSWER: Header is specif...
[ "c#", ".net", "wpf" ]
2
3
327
1
0
2011-06-05T17:37:32.950000
2011-06-05T17:39:39.713000
6,244,614
6,244,661
Help encoding JSON with User Info (MySQL)
I am currently getting the accountID's from my followers database and outputting them into JSON. But instead of just getting the accountID's from the db, how could I get the user information from another table "Accounts" and append that to the JSON? My current code to do so is: $accountID = NULL; if (isset($_GET['accou...
I will go on a limb and assume a few things: You have 2 tables: Following followingId, followingUserID, someOtherColumns Accounts userID, someOtherAccountCollumns Given that, the fix is easy: // Switch this: $query = mysql_query("SELECT * FROM Following WHERE `followingUserID` = '$accountID`"); // By this: $query = mys...
Help encoding JSON with User Info (MySQL) I am currently getting the accountID's from my followers database and outputting them into JSON. But instead of just getting the accountID's from the db, how could I get the user information from another table "Accounts" and append that to the JSON? My current code to do so is:...
TITLE: Help encoding JSON with User Info (MySQL) QUESTION: I am currently getting the accountID's from my followers database and outputting them into JSON. But instead of just getting the accountID's from the db, how could I get the user information from another table "Accounts" and append that to the JSON? My current...
[ "php", "mysql", "database", "json" ]
0
2
113
1
0
2011-06-05T17:37:46.423000
2011-06-05T17:45:07.123000
6,244,615
6,245,381
Naming convention: singular vs plural for classes describing entities in PHP
I think that the standard practice to name tables in MySQL is to use plural names. The classes refering to those tables should also be plural? For example, imagine that you have a table called Users, that is used for authentication purposes. This table would be described in an entity class more or less like this using ...
Class representing one database row (an entity) should have singular name. Doctrine 2 default behaviour is to name database tables the same way. You can reconfigure it in every @Table annotation if you'd like to, but I suggest you to stick with Doctrine naming conventions - singular name for database table is also acce...
Naming convention: singular vs plural for classes describing entities in PHP I think that the standard practice to name tables in MySQL is to use plural names. The classes refering to those tables should also be plural? For example, imagine that you have a table called Users, that is used for authentication purposes. T...
TITLE: Naming convention: singular vs plural for classes describing entities in PHP QUESTION: I think that the standard practice to name tables in MySQL is to use plural names. The classes refering to those tables should also be plural? For example, imagine that you have a table called Users, that is used for authenti...
[ "php", "orm", "naming-conventions", "doctrine-orm", "entities" ]
4
5
6,493
4
0
2011-06-05T17:38:10.427000
2011-06-05T19:41:14.297000
6,244,623
6,244,808
ReferenceError: CoffeeScript + JsTestDriver + Qunit
Currently I'm looking into TDD with CoffeeScript and JsTestDriver however I'm stuck on a ReferenceError thrown by JsTestDriver. Some info: Using the IntelliJ JsTestDriver plugin Testing via Chrome Configured JsTestDriver the same way as on: http://code.google.com/p/js-test-driver/wiki/QUnitAdapter Writing the tests in ...
Sounds like you need to make PortfolioController a global, perhaps by adding root = window? global root.PortfolioController = PortfolioController the end of the file, or by simply replacing class PortfolioController extends Backbone.Controller with class @PortfolioController extends Backbone.Controller taking advantage...
ReferenceError: CoffeeScript + JsTestDriver + Qunit Currently I'm looking into TDD with CoffeeScript and JsTestDriver however I'm stuck on a ReferenceError thrown by JsTestDriver. Some info: Using the IntelliJ JsTestDriver plugin Testing via Chrome Configured JsTestDriver the same way as on: http://code.google.com/p/js...
TITLE: ReferenceError: CoffeeScript + JsTestDriver + Qunit QUESTION: Currently I'm looking into TDD with CoffeeScript and JsTestDriver however I'm stuck on a ReferenceError thrown by JsTestDriver. Some info: Using the IntelliJ JsTestDriver plugin Testing via Chrome Configured JsTestDriver the same way as on: http://co...
[ "javascript", "tdd", "coffeescript", "qunit", "js-test-driver" ]
1
3
1,511
1
0
2011-06-05T17:39:02.183000
2011-06-05T18:08:40.310000
6,244,632
6,244,792
text auto font size
I have a div tag for a title, as below, it may be multi lined and I would like the text to be as big as possible to fit neatly in the box. Thanks for any ideas.
I won't code it up for you, but I'm sure you could do it with javascript or jQuery. You'd want to set the overflow property of the div you have coded there. And you'd want to create a separate div for the title text inside the div that you already have. Then with javascript you can check to see if the height of the inn...
text auto font size I have a div tag for a title, as below, it may be multi lined and I would like the text to be as big as possible to fit neatly in the box. Thanks for any ideas.
TITLE: text auto font size QUESTION: I have a div tag for a title, as below, it may be multi lined and I would like the text to be as big as possible to fit neatly in the box. Thanks for any ideas. ANSWER: I won't code it up for you, but I'm sure you could do it with javascript or jQuery. You'd want to set the overfl...
[ "javascript", "jquery", "html", "css", "font-size" ]
2
0
1,035
2
0
2011-06-05T17:40:27.167000
2011-06-05T18:05:45.327000
6,244,633
6,244,927
EF4 CTP5 CodeFirst modeling problem
i am new at EF4 CTP5 and i want to create a model below like,each table are same fields(id,text,value),i dont want to put all of them in one table,can i use a base class?but i dont know that how is it be my domain model? public class BaseSearchType { public int Id {get;set;} public int text{get;set;} public int value {...
They will not be mapped into one table until you instruct EF to do that. Simply define your classes like: public abstract class BaseSearchType { public int Id { get; set; } public string text { get; set; } public int value { get; set; } } public class BooleanSearchTypeTable: BaseSearchType { } public class JobStatusS...
EF4 CTP5 CodeFirst modeling problem i am new at EF4 CTP5 and i want to create a model below like,each table are same fields(id,text,value),i dont want to put all of them in one table,can i use a base class?but i dont know that how is it be my domain model? public class BaseSearchType { public int Id {get;set;} public i...
TITLE: EF4 CTP5 CodeFirst modeling problem QUESTION: i am new at EF4 CTP5 and i want to create a model below like,each table are same fields(id,text,value),i dont want to put all of them in one table,can i use a base class?but i dont know that how is it be my domain model? public class BaseSearchType { public int Id {...
[ "c#", "entity-framework", "entity-framework-4", "entity-framework-4.1", "ef-code-first" ]
0
2
83
2
0
2011-06-05T17:40:32.547000
2011-06-05T18:29:05.060000
6,244,645
6,244,656
CSS Selectors: Possible to select ONLY the second element?
Is this even possible? The following CSS selector gets the one I've marked "Definitely not this DIV!"..column div:last-child { background-color:red; } The following CSS selector gets the one I want AND the one I've marked "Definitely not this DIV!"..column div + div { background-color:red; } Same goes for this one: It ...
This should do it. #column > div:first-child + div You were using a class selector to select an element with an ID. You may want to look through the CSS Selectors, as it's the direct descendant & sibling selectors that gives you the finesse to choose a particular DOM element.
CSS Selectors: Possible to select ONLY the second element? Is this even possible? The following CSS selector gets the one I've marked "Definitely not this DIV!"..column div:last-child { background-color:red; } The following CSS selector gets the one I want AND the one I've marked "Definitely not this DIV!"..column div ...
TITLE: CSS Selectors: Possible to select ONLY the second element? QUESTION: Is this even possible? The following CSS selector gets the one I've marked "Definitely not this DIV!"..column div:last-child { background-color:red; } The following CSS selector gets the one I want AND the one I've marked "Definitely not this ...
[ "html", "css", "internet-explorer-7", "css-selectors" ]
12
13
12,368
3
0
2011-06-05T17:42:34.483000
2011-06-05T17:44:06.287000
6,244,647
6,244,955
Android - Intent ACTION_CALL without call log
I want to invoke call action from my Activity, but after call action is finished my app stays on call log screen. To avoid this situation I decide to intent my activity from PhoneStateListener, and I do it like this: Intent intent = new Intent(MainActivity.this, MainActivity.class); intent.setFlag(...); startActivity(i...
Have a read at the launchMode attribute for your Activity that can be set in the AndroidManifest. http://developer.android.com/guide/topics/manifest/activity-element.html#lmode I believe what you're looking for is singleInstance.
Android - Intent ACTION_CALL without call log I want to invoke call action from my Activity, but after call action is finished my app stays on call log screen. To avoid this situation I decide to intent my activity from PhoneStateListener, and I do it like this: Intent intent = new Intent(MainActivity.this, MainActivit...
TITLE: Android - Intent ACTION_CALL without call log QUESTION: I want to invoke call action from my Activity, but after call action is finished my app stays on call log screen. To avoid this situation I decide to intent my activity from PhoneStateListener, and I do it like this: Intent intent = new Intent(MainActivity...
[ "android", "android-intent" ]
2
3
1,417
2
0
2011-06-05T17:42:42.843000
2011-06-05T18:33:06.333000
6,244,652
6,244,702
How do you use max_by with an enumerable if you need to filter out values?
How would I do this? Right now it's creating nil values when user is male, and then the <==> operation is failing. @user.max_by{|user_id, user| user.height if user.female?}
You can chain these together, so do your selection before your aggregation @user.select{|user| user.female?}.max_by{|user_id, user| user.height} Also, you should be able to simplify (just a little syntax sugar): @user.select(&:female?).max_by(&:height)
How do you use max_by with an enumerable if you need to filter out values? How would I do this? Right now it's creating nil values when user is male, and then the <==> operation is failing. @user.max_by{|user_id, user| user.height if user.female?}
TITLE: How do you use max_by with an enumerable if you need to filter out values? QUESTION: How would I do this? Right now it's creating nil values when user is male, and then the <==> operation is failing. @user.max_by{|user_id, user| user.height if user.female?} ANSWER: You can chain these together, so do your sele...
[ "ruby-on-rails", "ruby" ]
2
4
1,384
1
0
2011-06-05T17:43:39.847000
2011-06-05T17:52:07.963000
6,244,653
6,244,795
Map Programing in C# windows application
I Want to write a Windows Application that uses an map and when a user clicks on a location in the map,the application shows some information about the location which are saved in a a database file. how can i write codes for map? what component can i use? what library can i use? any information can help me...
There is no built in map control in C#. You'll have to use some third party library. For a straight up map, I would suggest OpenStreetMaps, Bing Maps or Google Maps. There is a pretty good blog post with how to develop a C# maps API here. There's also a pretty good Bing Maps / vs Google Maps comparison here. If you wan...
Map Programing in C# windows application I Want to write a Windows Application that uses an map and when a user clicks on a location in the map,the application shows some information about the location which are saved in a a database file. how can i write codes for map? what component can i use? what library can i use?...
TITLE: Map Programing in C# windows application QUESTION: I Want to write a Windows Application that uses an map and when a user clicks on a location in the map,the application shows some information about the location which are saved in a a database file. how can i write codes for map? what component can i use? what ...
[ "c#", ".net", "winforms", "dictionary" ]
5
2
6,848
3
0
2011-06-05T17:43:40.223000
2011-06-05T18:06:11.563000
6,244,664
6,269,389
Compiling Eigen library for iPhone with vectorisation
I am struggling with the compilation of Eigen library for iPhone 4 which has an ARM processor with armv7 instruction set. Everything works fine so far when I specify the preprocessor define EIGEN_DONT_VECTORIZE. But due to some performance issues I would like to use armv7 optimised code. Regardless which compiler I use...
After fiddling around with different compiler settings hours and hours I found myself a satisfying solution and came to following conclusion. There is a surprisingly huge difference between debug and release settings regarding Eigen's template library approach: Release settings with usual optimisation flags enabled let...
Compiling Eigen library for iPhone with vectorisation I am struggling with the compilation of Eigen library for iPhone 4 which has an ARM processor with armv7 instruction set. Everything works fine so far when I specify the preprocessor define EIGEN_DONT_VECTORIZE. But due to some performance issues I would like to use...
TITLE: Compiling Eigen library for iPhone with vectorisation QUESTION: I am struggling with the compilation of Eigen library for iPhone 4 which has an ARM processor with armv7 instruction set. Everything works fine so far when I specify the preprocessor define EIGEN_DONT_VECTORIZE. But due to some performance issues I...
[ "iphone", "performance", "compiler-construction", "eigen", "armv7" ]
3
1
1,303
1
0
2011-06-05T17:45:15.023000
2011-06-07T17:40:50.130000
6,244,669
6,244,868
Codeigniter CSRF - how does it work
Recently I found out about CSRF attacks and was happy to find out that CSRF protection was added to Codeigniter v 2.0.0. I enabled the feature and saw that a hidden input with a token is added in forms and I assume that it stores the token in a session too. On POST requests does CI automatically compare tokens or do I ...
The CSRF token is added to the form as a hidden input only when the form_open() function is used. A cookie with the CSRF token's value is created by the Security class, and regenerated if necessary for each request. If $_POST data exists, the cookie is automatically validated by the Input class. If the posted token doe...
Codeigniter CSRF - how does it work Recently I found out about CSRF attacks and was happy to find out that CSRF protection was added to Codeigniter v 2.0.0. I enabled the feature and saw that a hidden input with a token is added in forms and I assume that it stores the token in a session too. On POST requests does CI a...
TITLE: Codeigniter CSRF - how does it work QUESTION: Recently I found out about CSRF attacks and was happy to find out that CSRF protection was added to Codeigniter v 2.0.0. I enabled the feature and saw that a hidden input with a token is added in forms and I assume that it stores the token in a session too. On POST ...
[ "php", "security", "codeigniter", "token" ]
25
40
56,531
4
0
2011-06-05T17:46:19.360000
2011-06-05T18:17:54.663000
6,244,670
6,244,796
Java - Using multiple delimiters in a scanner
I'm using a scanner to take input and, hopefully, split it into chunks. I want it to split it up using whole word delimiters. So right now I have: Scanner scanner = new Scanner("1 imported bottle of perfume at 27.99"); scanner.useDelimiter("\\sdelimitOne\\s"); So with input "word word delimitOne word word delimitTwo wo...
From wikipedia: |: The choice (aka alternation or set union) operator matches either the expression before or the expression after the operator. For example, abc|def matches "abc" or "def". so, scanner.useDelimiter("\\sdelimitOne\\s|\\sdelimitTwo\\s"); is what you need.
Java - Using multiple delimiters in a scanner I'm using a scanner to take input and, hopefully, split it into chunks. I want it to split it up using whole word delimiters. So right now I have: Scanner scanner = new Scanner("1 imported bottle of perfume at 27.99"); scanner.useDelimiter("\\sdelimitOne\\s"); So with input...
TITLE: Java - Using multiple delimiters in a scanner QUESTION: I'm using a scanner to take input and, hopefully, split it into chunks. I want it to split it up using whole word delimiters. So right now I have: Scanner scanner = new Scanner("1 imported bottle of perfume at 27.99"); scanner.useDelimiter("\\sdelimitOne\\...
[ "java", "java.util.scanner", "delimiter" ]
15
21
30,957
1
0
2011-06-05T17:46:20.287000
2011-06-05T18:06:18.687000