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,245,930
6,262,907
What is wrong in my RC6 implmentation?
can anyone see where i made a mistake here? I know that the algorithm will properly decrypt the encrypted data. however, most of the encrypted data is not the correct output, according to the RC6 paper. // hexlify(string) turns a string into its hex representation: hexlify("AB") -> "4142" // unhexlify(string) turns a s...
I think I figured it out. Can anyone corroborate? I think that because I set b = 16 by default, I'm causing the errors. My harddrive is dead or I would have tested this already
What is wrong in my RC6 implmentation? can anyone see where i made a mistake here? I know that the algorithm will properly decrypt the encrypted data. however, most of the encrypted data is not the correct output, according to the RC6 paper. // hexlify(string) turns a string into its hex representation: hexlify("AB") -...
TITLE: What is wrong in my RC6 implmentation? QUESTION: can anyone see where i made a mistake here? I know that the algorithm will properly decrypt the encrypted data. however, most of the encrypted data is not the correct output, according to the RC6 paper. // hexlify(string) turns a string into its hex representatio...
[ "c++", "math", "encryption", "cryptography", "encryption-symmetric" ]
4
0
2,526
1
0
2011-06-05T21:16:45.947000
2011-06-07T08:59:53.933000
6,245,931
6,254,449
How to temporarily apply (or archive) PATCH/DIFF changes from Tortoise SVN?
I've been using Tortoise SVN + Visual SVN for about a year since left the corporate world to do my own startup. There's one feature in Tortoise SVN that I've never figured out: How can I bundle up a bunch of changes into a PATCH or DIFF file and either: A) share them with my co-founder; or B) archive them into a standa...
Reluctantly answering my own question. This feature is available with Tortoise SVN. Basically, you make a PATCH file, distribute it or archive it, and then you apply the PATCH. The only trick is to make sure you're in the right location in the WC (Working Copy) when you do the "apply". When you apply, you'll get a popu...
How to temporarily apply (or archive) PATCH/DIFF changes from Tortoise SVN? I've been using Tortoise SVN + Visual SVN for about a year since left the corporate world to do my own startup. There's one feature in Tortoise SVN that I've never figured out: How can I bundle up a bunch of changes into a PATCH or DIFF file an...
TITLE: How to temporarily apply (or archive) PATCH/DIFF changes from Tortoise SVN? QUESTION: I've been using Tortoise SVN + Visual SVN for about a year since left the corporate world to do my own startup. There's one feature in Tortoise SVN that I've never figured out: How can I bundle up a bunch of changes into a PAT...
[ "tortoisesvn", "diff", "patch", "visualsvn" ]
1
1
1,223
1
0
2011-06-05T21:16:46.443000
2011-06-06T15:36:53.330000
6,245,933
6,245,963
jQuery .hover() seems to "disappear" after a while
$('img.questSign').hover( function() { $('img.questSign').attr('src', '/media/quest-sign-small-hover.png'); }, function(){ $('img.questSign').attr('src', '/media/quest-sign-small.png'); }); This code works quite awesome, when the page has been loaded freshly. But after a while it seems to be stop working. The picture d...
Try this: $('img.questSign').hover(function() { $(this).attr('src', '/media/quest-sign-small-hover.png'); }, function() { $(this).attr('src', '/media/quest-sign-small.png'); }); Your old code would misbehave with multiple img.questSign s on the page.
jQuery .hover() seems to "disappear" after a while $('img.questSign').hover( function() { $('img.questSign').attr('src', '/media/quest-sign-small-hover.png'); }, function(){ $('img.questSign').attr('src', '/media/quest-sign-small.png'); }); This code works quite awesome, when the page has been loaded freshly. But after...
TITLE: jQuery .hover() seems to "disappear" after a while QUESTION: $('img.questSign').hover( function() { $('img.questSign').attr('src', '/media/quest-sign-small-hover.png'); }, function(){ $('img.questSign').attr('src', '/media/quest-sign-small.png'); }); This code works quite awesome, when the page has been loaded ...
[ "javascript", "jquery", "firefox", "jquery-selectors", "jquery-events" ]
0
3
200
2
0
2011-06-05T21:17:16.087000
2011-06-05T21:24:30.037000
6,245,945
6,246,470
wcf 401 and asking for login/password in RESTful service
I'm writing RESTful service with basic authorization. Here is what I do when no authorization header present or when there is wrong UN/Password //Get authorization header var auth = HttpContext.Current.Request.Headers.GetValues("Authorization"); if (auth == null) { outgoingResponse.StatusCode = HttpStatusCode.Unauthori...
I figured it out. I needed to put HTTP header along with 401 like this: WWW-Authenticate: Basic realm="Secure Area" Then browser knows and displays login window to user
wcf 401 and asking for login/password in RESTful service I'm writing RESTful service with basic authorization. Here is what I do when no authorization header present or when there is wrong UN/Password //Get authorization header var auth = HttpContext.Current.Request.Headers.GetValues("Authorization"); if (auth == null)...
TITLE: wcf 401 and asking for login/password in RESTful service QUESTION: I'm writing RESTful service with basic authorization. Here is what I do when no authorization header present or when there is wrong UN/Password //Get authorization header var auth = HttpContext.Current.Request.Headers.GetValues("Authorization");...
[ "c#", "wcf", "http", "rest" ]
1
0
630
1
0
2011-06-05T21:20:53.153000
2011-06-05T22:58:11.583000
6,245,948
6,246,046
How do I select for something with a colon with Zend_Db_Select?
I have a query where I need to select text with a colon inside, basically it looks like this: $select = $this->db->select() ->from('table') ->where(sprintf('tag = "%s"','foursquare:venue=12345')); Now when I run this, I get the exception "Invalid bind-variable name:venue" which is obviously because the Mysqli adapter d...
Why are you using sprintf? You're overriding the built-in quoting mechanism that would normally handle this situation for you: $select = $this->db->select() ->from('table') ->where('tag =?', $tag);
How do I select for something with a colon with Zend_Db_Select? I have a query where I need to select text with a colon inside, basically it looks like this: $select = $this->db->select() ->from('table') ->where(sprintf('tag = "%s"','foursquare:venue=12345')); Now when I run this, I get the exception "Invalid bind-vari...
TITLE: How do I select for something with a colon with Zend_Db_Select? QUESTION: I have a query where I need to select text with a colon inside, basically it looks like this: $select = $this->db->select() ->from('table') ->where(sprintf('tag = "%s"','foursquare:venue=12345')); Now when I run this, I get the exception ...
[ "php", "mysql", "zend-framework", "zend-db-select" ]
0
1
200
1
0
2011-06-05T21:21:13.837000
2011-06-05T21:40:11.160000
6,245,950
6,245,977
UIActionSheet to open up Mail Application iPhone
This issue is something which has me stumped, so hopefully someone can help. I have an UIActionSheet on a view which has three options in. One which takes my user to a new view, one to share via email and one to share via SMS. I have the UIActionSheet created which works without issue, the new view part of the AlertShe...
looks like all your needed methods are there already.. just add [self showMailPicker:nil] or [self showSMSPicker:nil] to if(buttonIndex == 1) { } if(buttonIndex == 2) { } if your second button from the top is your sms button, add showSMSPicker to buttonIndex == 1
UIActionSheet to open up Mail Application iPhone This issue is something which has me stumped, so hopefully someone can help. I have an UIActionSheet on a view which has three options in. One which takes my user to a new view, one to share via email and one to share via SMS. I have the UIActionSheet created which works...
TITLE: UIActionSheet to open up Mail Application iPhone QUESTION: This issue is something which has me stumped, so hopefully someone can help. I have an UIActionSheet on a view which has three options in. One which takes my user to a new view, one to share via email and one to share via SMS. I have the UIActionSheet c...
[ "iphone", "objective-c", "xcode", "uiactionsheet", "mfmailcomposeviewcontroller" ]
0
1
2,697
1
0
2011-06-05T21:21:25.473000
2011-06-05T21:27:47.780000
6,245,966
6,246,630
How to generate records and spread them among pairs from a table?
I have to generate about a million random trips between about 40K destinations. Each destination has it's own weight ( total_probability ), the more it is, the more trips should start or end in this place. Either the trips should be generated randomly, but destinations (start and end points) should be weighted by proba...
In 9.1, you can use TRIGGER s on VIEW s, which effectively let you create materialized views (albeit manually). I think your first run may be expensive, but using a loop is probably the way to go, but then after that, I'd use a series of TRIGGER s to maintain the data in a table. At the end of the day you need to decid...
How to generate records and spread them among pairs from a table? I have to generate about a million random trips between about 40K destinations. Each destination has it's own weight ( total_probability ), the more it is, the more trips should start or end in this place. Either the trips should be generated randomly, b...
TITLE: How to generate records and spread them among pairs from a table? QUESTION: I have to generate about a million random trips between about 40K destinations. Each destination has it's own weight ( total_probability ), the more it is, the more trips should start or end in this place. Either the trips should be gen...
[ "sql", "postgresql" ]
2
0
209
2
0
2011-06-05T21:24:59.170000
2011-06-05T23:31:29.950000
6,245,967
6,251,779
How to install the new Urban Airship Push Library for Android in a Phonegap Project
I'm building an app using Phonegap and I'm using Urban Airship for iOS and Android. For Android I was using it with AirMail, but now they are planning the deprecate AirMail and have published a new library ( http://urbanairship.com/docs/android-client-overview.html ). I'm trying to make it work but I can't initialize i...
Somebody already replied to my question on Phonegap's mailing list providing this blog post which was written today: http://minimoesfuerzo.org/2011/06/6/urban-airship-10-integration-android-phonegap-app/
How to install the new Urban Airship Push Library for Android in a Phonegap Project I'm building an app using Phonegap and I'm using Urban Airship for iOS and Android. For Android I was using it with AirMail, but now they are planning the deprecate AirMail and have published a new library ( http://urbanairship.com/docs...
TITLE: How to install the new Urban Airship Push Library for Android in a Phonegap Project QUESTION: I'm building an app using Phonegap and I'm using Urban Airship for iOS and Android. For Android I was using it with AirMail, but now they are planning the deprecate AirMail and have published a new library ( http://urb...
[ "android", "cordova", "push-notification", "urbanairship.com" ]
0
0
1,633
1
0
2011-06-05T21:24:59.137000
2011-06-06T12:09:35.757000
6,245,971
6,245,978
Accurate way to measure execution times of php scripts
I want to know how many milliseconds a PHP for-loop takes to execute. I know the structure of a generic algorithm, but no idea how to implement it in PHP: Begin init1 = timer(); // where timer() is the amount of milliseconds from midnight the loop begin some code the loop end total = timer() - init1; End
You can use the microtime function for this. From the documentation: microtime — Return current Unix timestamp with microseconds If get_as_float is set to TRUE, then microtime() returns a float, which represents the current time in seconds since the Unix epoch accurate to the nearest microsecond. Example usage: $start ...
Accurate way to measure execution times of php scripts I want to know how many milliseconds a PHP for-loop takes to execute. I know the structure of a generic algorithm, but no idea how to implement it in PHP: Begin init1 = timer(); // where timer() is the amount of milliseconds from midnight the loop begin some code t...
TITLE: Accurate way to measure execution times of php scripts QUESTION: I want to know how many milliseconds a PHP for-loop takes to execute. I know the structure of a generic algorithm, but no idea how to implement it in PHP: Begin init1 = timer(); // where timer() is the amount of milliseconds from midnight the loop...
[ "php" ]
352
698
379,995
17
0
2011-06-05T21:25:41.850000
2011-06-05T21:28:08.430000
6,245,980
6,246,026
Binary plist structure
What is Mac OS X binary plist structure? I could easy understand the XML plist structure because it’s self explanatory, but I have no idea where to start with the binary one. My ultimate goal is to read binary plists in C# programs.
Maybe this helps you: http://explanatorygap.net/2009/10/30/apple-have-documented-the-binary-plist-format/ and the linked source file, explaining the format: http://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c
Binary plist structure What is Mac OS X binary plist structure? I could easy understand the XML plist structure because it’s self explanatory, but I have no idea where to start with the binary one. My ultimate goal is to read binary plists in C# programs.
TITLE: Binary plist structure QUESTION: What is Mac OS X binary plist structure? I could easy understand the XML plist structure because it’s self explanatory, but I have no idea where to start with the binary one. My ultimate goal is to read binary plists in C# programs. ANSWER: Maybe this helps you: http://explanat...
[ "c#", "macos", "plist" ]
0
2
950
1
0
2011-06-05T21:28:09.823000
2011-06-05T21:35:45.287000
6,245,981
6,246,076
how to parse repeated elements with nokogiri
I'm new to Nokogiri, so how do I parse the "data" and it's text, as well as the "name" from the "method" in the following xml: Team alert 1 Threat level at least High level Task run status changed Done status Email team@example.org to_address admin@example.org from_address 0 notice...
There's several ways to do this, here's one: doc = Nokogiri::XML("your_xml_document") doc.search("data").each do |data| name = data.search("name").remove # remove the name element from data element name_text = name.text data_text = data.text # do stuff with text end You can search for specific nested elements like this...
how to parse repeated elements with nokogiri I'm new to Nokogiri, so how do I parse the "data" and it's text, as well as the "name" from the "method" in the following xml: Team alert 1 Threat level at least High level Task run status changed Done status Email team@example.org to_address admin@example.org from_address 0...
TITLE: how to parse repeated elements with nokogiri QUESTION: I'm new to Nokogiri, so how do I parse the "data" and it's text, as well as the "name" from the "method" in the following xml: Team alert 1 Threat level at least High level Task run status changed Done status Email team@example.org to_address admin@example....
[ "ruby-on-rails", "ruby", "xml", "nokogiri" ]
2
0
645
2
0
2011-06-05T21:28:25.520000
2011-06-05T21:47:03.727000
6,245,982
6,246,073
Implementing take with F# by translating ML's equivalent
I'd like to translate this ML code into F#. fun take ([], i) = [] | take (x::xs, i) = if i > 0 then x::take(xs, i-1) else []; I tried this one let rec take n i = match n,i with | [], i -> [] | x::xs, i -> if i > 0 then x::take(xs, i-1) else []; let val = take [1;2;3;4] 3 and this one let rec take input = match input w...
Since val is a reserved keyword in F#, you can't use it as a value. Your first version of take is wrong because the type of take(xs, i-1) (tuple form) is different from the type of take n i (curried form). This works: let rec take n i = match n, i with | [], i -> [] | x::xs, i -> if i > 0 then x::(take xs (i-1)) else [...
Implementing take with F# by translating ML's equivalent I'd like to translate this ML code into F#. fun take ([], i) = [] | take (x::xs, i) = if i > 0 then x::take(xs, i-1) else []; I tried this one let rec take n i = match n,i with | [], i -> [] | x::xs, i -> if i > 0 then x::take(xs, i-1) else []; let val = take [1...
TITLE: Implementing take with F# by translating ML's equivalent QUESTION: I'd like to translate this ML code into F#. fun take ([], i) = [] | take (x::xs, i) = if i > 0 then x::take(xs, i-1) else []; I tried this one let rec take n i = match n,i with | [], i -> [] | x::xs, i -> if i > 0 then x::take(xs, i-1) else []; ...
[ "f#", "sml", "ml", "take" ]
3
7
247
2
0
2011-06-05T21:28:45.373000
2011-06-05T21:46:31.867000
6,245,984
6,290,031
Blueprint CSS compress.rb errors
I'm trying to use the Ruby compressor for custom layout and I was just using the examples bundled with Blueprint. I installed both Bundler and ChunkyPNG, this is what I've got: D:\bp\lib>ruby compress.rb -p project1 C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/spec_set.rb:87:in `block in materialize':...
At last Joshua Clayton (Blueprint css author) helped me with that: http://groups.google.com/group/blueprintcss/browse_thread/thread/c19b41c2f8ea06fc/7cc3f1a0f2031295?show_docid=7cc3f1a0f2031295 The solution was to use "bundle install --without test": pretty tricky...
Blueprint CSS compress.rb errors I'm trying to use the Ruby compressor for custom layout and I was just using the examples bundled with Blueprint. I installed both Bundler and ChunkyPNG, this is what I've got: D:\bp\lib>ruby compress.rb -p project1 C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/spec_set...
TITLE: Blueprint CSS compress.rb errors QUESTION: I'm trying to use the Ruby compressor for custom layout and I was just using the examples bundled with Blueprint. I installed both Bundler and ChunkyPNG, this is what I've got: D:\bp\lib>ruby compress.rb -p project1 C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/li...
[ "ruby", "compression", "blueprint-css" ]
0
0
810
2
0
2011-06-05T21:29:02.097000
2011-06-09T08:26:01.630000
6,245,990
6,245,996
What assembly is ValidationRule in?
I'm trying to build a validation rule for a C# WPF application by creating a class that implements ValidationRule. My problem is that I can't find the System.Windows.Controls assembly which - acconding to the documentation - contains it. Does anybody know the right assembly in the 3.5 runtime? Thanks
Namespace: System.Windows.Controls Assembly: PresentationFramework (in PresentationFramework.dll The documentation is your friend. (Namespace!= assembly)
What assembly is ValidationRule in? I'm trying to build a validation rule for a C# WPF application by creating a class that implements ValidationRule. My problem is that I can't find the System.Windows.Controls assembly which - acconding to the documentation - contains it. Does anybody know the right assembly in the 3....
TITLE: What assembly is ValidationRule in? QUESTION: I'm trying to build a validation rule for a C# WPF application by creating a class that implements ValidationRule. My problem is that I can't find the System.Windows.Controls assembly which - acconding to the documentation - contains it. Does anybody know the right ...
[ "c#", "wpf", "validation", "assemblies" ]
1
1
233
1
0
2011-06-05T21:29:31.793000
2011-06-05T21:30:52.090000
6,246,003
6,246,085
setNetworkActivityIndicatorVisible spinner not displaying
As the title says, here's some code: - (void)refreshMap { NSLog(@"refreshing"); [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; lat = [[NSNumber numberWithDouble:myUserLocation.coordinate.latitude] stringValue]; lon = [[NSNumber numberWithDouble:myUserLocation.coordinate.longitude] stringVal...
The UI won't be updated unless your code returns control to the runloop. So if you enable and disable the network indicator in the same method, it will never actually show. The solution is to call [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; in your url connection delegate methods ( conect...
setNetworkActivityIndicatorVisible spinner not displaying As the title says, here's some code: - (void)refreshMap { NSLog(@"refreshing"); [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; lat = [[NSNumber numberWithDouble:myUserLocation.coordinate.latitude] stringValue]; lon = [[NSNumber numbe...
TITLE: setNetworkActivityIndicatorVisible spinner not displaying QUESTION: As the title says, here's some code: - (void)refreshMap { NSLog(@"refreshing"); [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; lat = [[NSNumber numberWithDouble:myUserLocation.coordinate.latitude] stringValue]; lon ...
[ "ios", "nsurlconnection", "uiapplication" ]
2
7
6,246
1
0
2011-06-05T21:31:48.910000
2011-06-05T21:48:35.370000
6,246,005
6,246,655
JCombobox change another JCombobox
I'm trying to combine 2 jcomboboxes. 1 combobox is for showing category of expences. and second combobox is reading file from text file to show types of products. If I change first combobox I would like that second combobox will change based on what user select in the first one. Is there any chance that i can still loa...
for example import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class ComboBoxTwo extends JFrame implements ActionListener, ItemListener { private static final long serialVersionUID = 1L; private JComboBox mainComboBox; private JComboBox subComboBox; private Hashtable subItems...
JCombobox change another JCombobox I'm trying to combine 2 jcomboboxes. 1 combobox is for showing category of expences. and second combobox is reading file from text file to show types of products. If I change first combobox I would like that second combobox will change based on what user select in the first one. Is th...
TITLE: JCombobox change another JCombobox QUESTION: I'm trying to combine 2 jcomboboxes. 1 combobox is for showing category of expences. and second combobox is reading file from text file to show types of products. If I change first combobox I would like that second combobox will change based on what user select in th...
[ "java", "jcombobox" ]
4
5
9,546
3
0
2011-06-05T21:31:59.193000
2011-06-05T23:37:58.267000
6,246,007
6,246,231
WebView - can a custom listener be set up for handling a webpage-forwarding action?
In my app, I have to display a specific webpage in a WebView that handles payment. The user has to mess around in this page, and if the transaction was successful, the webpage will initiate a forwarding to a specific url. I have to intercept this forwarding call in the android app, and handle it properly. Is this possi...
Can you detect forwarding in here: webview.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { //handle stuff here //e.g. view.loadUrl(url); return true; } public void onPageFinished(WebView view, String url) { //dismiss the indeterminate progress dialog Log.d(TA...
WebView - can a custom listener be set up for handling a webpage-forwarding action? In my app, I have to display a specific webpage in a WebView that handles payment. The user has to mess around in this page, and if the transaction was successful, the webpage will initiate a forwarding to a specific url. I have to inte...
TITLE: WebView - can a custom listener be set up for handling a webpage-forwarding action? QUESTION: In my app, I have to display a specific webpage in a WebView that handles payment. The user has to mess around in this page, and if the transaction was successful, the webpage will initiate a forwarding to a specific u...
[ "android", "android-webview" ]
1
4
2,262
1
0
2011-06-05T21:32:39.493000
2011-06-05T22:10:51.787000
6,246,008
6,246,021
Catching 'NoneType' exceptions in the work with DateTimeFields
I have the following views.py code. now_time = datetime.datetime.now() for r in requests: hmt = r.date_of_notification - now_time if hmt <= datetime.timedelta(days = 1): r.time_action_status = 'staction_day' else: r.time_action_status = 'non_staction_day' Sometimes I get an error, because some date_of_notification in r...
if r.date_of_notification is not None: do_something_useful() else: field_is_null()
Catching 'NoneType' exceptions in the work with DateTimeFields I have the following views.py code. now_time = datetime.datetime.now() for r in requests: hmt = r.date_of_notification - now_time if hmt <= datetime.timedelta(days = 1): r.time_action_status = 'staction_day' else: r.time_action_status = 'non_staction_day' S...
TITLE: Catching 'NoneType' exceptions in the work with DateTimeFields QUESTION: I have the following views.py code. now_time = datetime.datetime.now() for r in requests: hmt = r.date_of_notification - now_time if hmt <= datetime.timedelta(days = 1): r.time_action_status = 'staction_day' else: r.time_action_status = 'n...
[ "django" ]
0
2
648
1
0
2011-06-05T21:32:39.787000
2011-06-05T21:35:25.100000
6,246,009
6,246,091
InkCanvas Load/Save operations
I've never used InkCanvas control before. What I need is to load up a file into InkCanvas, draw some scribbles and get ther resulting image. And I want to make some additional operations with gotten image. As for saving Correct me if I'm wrong. I've found a link: http://www.centrolutions.com/Blog/post/2008/12/09/Conver...
Saving: If you want to be able to manipulate strokes after saving, then you need to save the strokes. You can do this by using the StrokeCollection.Save method. var fs = new FileStream(inkFileName, FileMode.Create); inkCanvas1.Strokes.Save(fs); You can then load this again and have the individual strokes accessible. Ho...
InkCanvas Load/Save operations I've never used InkCanvas control before. What I need is to load up a file into InkCanvas, draw some scribbles and get ther resulting image. And I want to make some additional operations with gotten image. As for saving Correct me if I'm wrong. I've found a link: http://www.centrolutions....
TITLE: InkCanvas Load/Save operations QUESTION: I've never used InkCanvas control before. What I need is to load up a file into InkCanvas, draw some scribbles and get ther resulting image. And I want to make some additional operations with gotten image. As for saving Correct me if I'm wrong. I've found a link: http://...
[ "c#", "wpf", "file", "bitmap", "inkcanvas" ]
4
5
10,040
1
0
2011-06-05T21:32:57.603000
2011-06-05T21:49:33.397000
6,246,010
6,246,034
Display message when no HTML is returned to jQuery search script
I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script is blank. How can I make it so my jQuery script displays a message when no HTML code is returned? My code jQuery code is: $(document).ready(functi...
Change this line $("#result").html(response); To if(response!= "") $("#result").html(response); else $("#result").html("No html returned."); Hope this helps.
Display message when no HTML is returned to jQuery search script I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script is blank. How can I make it so my jQuery script displays a message when no HTML c...
TITLE: Display message when no HTML is returned to jQuery search script QUESTION: I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script is blank. How can I make it so my jQuery script displays a mess...
[ "javascript", "jquery", "html" ]
0
1
570
2
0
2011-06-05T21:32:58.573000
2011-06-05T21:37:27.950000
6,246,013
6,246,036
About jQuery .ready() function
In terms of execution time and resources employed, is it more convenient to load as much stuff as possible with jQuery.ready() or the bare essentials?
just use it as trigger for you init functions... Don't put all your code in it: don't do: $(function(){ var someFunction = function(){ $("a").click(function(event){ event.preventDefault(); }); }; someFunction(); }); do: var someFunction = function(){ $("a").click(function(event){ event.preventDefault(); }); }; $(functi...
About jQuery .ready() function In terms of execution time and resources employed, is it more convenient to load as much stuff as possible with jQuery.ready() or the bare essentials?
TITLE: About jQuery .ready() function QUESTION: In terms of execution time and resources employed, is it more convenient to load as much stuff as possible with jQuery.ready() or the bare essentials? ANSWER: just use it as trigger for you init functions... Don't put all your code in it: don't do: $(function(){ var som...
[ "jquery", "dom" ]
0
3
79
1
0
2011-06-05T21:33:36.597000
2011-06-05T21:37:48.897000
6,246,020
6,246,221
Why are some of the photos from my iphone is rotated when I display it on the computer?
I use some test images for my iphone app, and the app mysterious breaks when it shouldn't. I finally opened up the photo with an image viewer and noticed that the photos are rotated. I did not expect this at all. How do I know an image is rotated?
UIImage has an imageOrientation property. That returns the orientation defined in the image's metadata or UIImageOrientationUp as a default. But really, if your app breaks because of the orientation, you might be doing some things in a way you shouldn't do.. (can't remember how often i got EXEC_BAD_ACCESS oO) i suggest...
Why are some of the photos from my iphone is rotated when I display it on the computer? I use some test images for my iphone app, and the app mysterious breaks when it shouldn't. I finally opened up the photo with an image viewer and noticed that the photos are rotated. I did not expect this at all. How do I know an im...
TITLE: Why are some of the photos from my iphone is rotated when I display it on the computer? QUESTION: I use some test images for my iphone app, and the app mysterious breaks when it shouldn't. I finally opened up the photo with an image viewer and noticed that the photos are rotated. I did not expect this at all. H...
[ "ios", "image-processing" ]
0
1
65
1
0
2011-06-05T21:35:21.460000
2011-06-05T22:09:27.677000
6,246,022
6,246,121
symfony 1.4 doctrine 1.2 - create userfriendly query/update
I have table in mysql: id | num1 | num2| num 3| num3| num5| 1 | 6 | 3 | 4 | 2 | 1 | in sql I do for example: $num = num2; $val = 2; $id = 2; $sql = "update TABLE set '$num'='$val' where id='$id'"; mysql_query( $sql); I can do with $val and $id, but I have a problem with $num... how to do this in Doctrine 1.2?
Try something like this: $q = Doctrine_Query::create() ->update('TABLE') ->set($num, '?', $val) ->where('id =?', $id) ->execute();
symfony 1.4 doctrine 1.2 - create userfriendly query/update I have table in mysql: id | num1 | num2| num 3| num3| num5| 1 | 6 | 3 | 4 | 2 | 1 | in sql I do for example: $num = num2; $val = 2; $id = 2; $sql = "update TABLE set '$num'='$val' where id='$id'"; mysql_query( $sql); I can do with $val and $id, but I have a p...
TITLE: symfony 1.4 doctrine 1.2 - create userfriendly query/update QUESTION: I have table in mysql: id | num1 | num2| num 3| num3| num5| 1 | 6 | 3 | 4 | 2 | 1 | in sql I do for example: $num = num2; $val = 2; $id = 2; $sql = "update TABLE set '$num'='$val' where id='$id'"; mysql_query( $sql); I can do with $val and $...
[ "php", "mysql", "sql", "symfony1", "doctrine-1.2" ]
2
11
6,830
1
0
2011-06-05T21:35:28.197000
2011-06-05T21:54:41.697000
6,246,030
6,248,166
LDAP authorization
I'm starting to implement authorization and authentication mechanism using LDAP, for some existing system. On the development stage, I'm facing a difficult design decision: where should user roles be stored? If I used RDBMS, it looks like there will be three tables: user, role and user_role to map roles and users. Plea...
On the architectural point of view, you've got multiples solutions. Here is a solution that keeps all your data into a Directory. In your Directory you can code your 'Roles' with objects from a class with the meaning of "group" like groupOfNames or group (depending on you Directory). Users Distinguisched Names (DN) wil...
LDAP authorization I'm starting to implement authorization and authentication mechanism using LDAP, for some existing system. On the development stage, I'm facing a difficult design decision: where should user roles be stored? If I used RDBMS, it looks like there will be three tables: user, role and user_role to map ro...
TITLE: LDAP authorization QUESTION: I'm starting to implement authorization and authentication mechanism using LDAP, for some existing system. On the development stage, I'm facing a difficult design decision: where should user roles be stored? If I used RDBMS, it looks like there will be three tables: user, role and u...
[ "authentication", "ldap", "authorization", "roles", "security-roles" ]
8
8
10,351
1
0
2011-06-05T21:37:09.040000
2011-06-06T05:42:48.070000
6,246,031
6,246,098
Span regex replacement
I have a text in my databse. For example: Dummy Text Here... nmkW544sK9U Dummy Text Here... yUBKZvq5G2g...and I need it to be replaced with: Dummy Text Here... Dummy Text Here... But I don't know regular expressions well enough and ask you to help me.
Something along these lines should work. $replacement = ' '; preg_replace('/ (\w+)<\/span>/', $replacement, $string);
Span regex replacement I have a text in my databse. For example: Dummy Text Here... nmkW544sK9U Dummy Text Here... yUBKZvq5G2g...and I need it to be replaced with: Dummy Text Here... Dummy Text Here... But I don't know regular expressions well enough and ask you to help me.
TITLE: Span regex replacement QUESTION: I have a text in my databse. For example: Dummy Text Here... nmkW544sK9U Dummy Text Here... yUBKZvq5G2g...and I need it to be replaced with: Dummy Text Here... Dummy Text Here... But I don't know regular expressions well enough and ask you to help me. ANSWER: Something along th...
[ "php", "regex", "youtube", "preg-replace" ]
0
0
171
2
0
2011-06-05T21:37:15.477000
2011-06-05T21:50:34.103000
6,246,032
6,246,102
jQuery ui autocomplete
I'm using the jQuery ui from google repository. I'm getting the data in the following format: [{name:"test", param1:"test"},{name:"test2", param1:"test2"}...] but the jQuery autocomplete are searching in the field named "label" So how could I change the "label" to "name" because I want to filter the information where t...
Reading between the lines on your post, I see that you can't edit the portion that's providing the data to the page, so you have to manipulate what you have. but it would be so much easier to just change what's being provided to match what you need I believe to get this to work you're going to have to rework the option...
jQuery ui autocomplete I'm using the jQuery ui from google repository. I'm getting the data in the following format: [{name:"test", param1:"test"},{name:"test2", param1:"test2"}...] but the jQuery autocomplete are searching in the field named "label" So how could I change the "label" to "name" because I want to filter ...
TITLE: jQuery ui autocomplete QUESTION: I'm using the jQuery ui from google repository. I'm getting the data in the following format: [{name:"test", param1:"test"},{name:"test2", param1:"test2"}...] but the jQuery autocomplete are searching in the field named "label" So how could I change the "label" to "name" because...
[ "jquery-ui", "autocomplete" ]
1
2
350
1
0
2011-06-05T21:37:16.857000
2011-06-05T21:51:48.110000
6,246,033
6,246,118
How to get values in similar but little bit different nodes with xpath in one query?
I want to create xpath query to get url from link1 and link 2 with requirement to not change the order in results. First situation link 1 Second Situation link 2 (...Above situation can happen more times on site in any order...) The problem in my case is as i shown in code that nodes are similar but sometimes can have ...
What about something like this, using // on the "variable" hierarchy div[@id='id']/span[@class]//a[@href]
How to get values in similar but little bit different nodes with xpath in one query? I want to create xpath query to get url from link1 and link 2 with requirement to not change the order in results. First situation link 1 Second Situation link 2 (...Above situation can happen more times on site in any order...) The pr...
TITLE: How to get values in similar but little bit different nodes with xpath in one query? QUESTION: I want to create xpath query to get url from link1 and link 2 with requirement to not change the order in results. First situation link 1 Second Situation link 2 (...Above situation can happen more times on site in an...
[ "html", "xpath" ]
1
2
58
1
0
2011-06-05T21:37:20.957000
2011-06-05T21:54:15.387000
6,246,039
6,247,363
Is this possible with .htaccess?
I've purchased a new domain (let's call this domain1.com) and I'd like to use my existing hosting package (let's call this domain0.com) to host the website (powered by Wordpress) - I can re-direct domain1.com to domain0.com/domain1 or domain1.domain0.com. Is it possible, using.htaccess to do this? Bear in mind that thi...
What you're asking is not possible using mod_rewrite only. Please understand that Apache doesn't do internal redirect if HOSTNAME is changing in the target of a RewriteRule. In that case it has to be an external redirect using R flag. And if there is an external redirect then domain name of URL in the browser will chan...
Is this possible with .htaccess? I've purchased a new domain (let's call this domain1.com) and I'd like to use my existing hosting package (let's call this domain0.com) to host the website (powered by Wordpress) - I can re-direct domain1.com to domain0.com/domain1 or domain1.domain0.com. Is it possible, using.htaccess ...
TITLE: Is this possible with .htaccess? QUESTION: I've purchased a new domain (let's call this domain1.com) and I'd like to use my existing hosting package (let's call this domain0.com) to host the website (powered by Wordpress) - I can re-direct domain1.com to domain0.com/domain1 or domain1.domain0.com. Is it possibl...
[ ".htaccess" ]
0
1
49
3
0
2011-06-05T21:38:41.137000
2011-06-06T02:40:22.623000
6,246,042
6,246,067
JPanel not repainting, even when calling repaint() and revalidate()
Hey guys. I have got a JPanel which changes color when it is clicked (this is handled correctly in another class). Unfortunately, when I call the repaint() method, it doesn't paint (or it calls the paintComponent method with the old Color value for var currentBGColor -> see code below) public class MyClass extends JPan...
If you call newColor from a non-EDT thread, the Swing thread might never know the new value of currenBGColor. You could try making currentBGColor volatile. Edit: trying volatile was meant as a debugging tool to see if it is a threading issue. If it is a threading issue, in order to follow the correct Swing threading mo...
JPanel not repainting, even when calling repaint() and revalidate() Hey guys. I have got a JPanel which changes color when it is clicked (this is handled correctly in another class). Unfortunately, when I call the repaint() method, it doesn't paint (or it calls the paintComponent method with the old Color value for var...
TITLE: JPanel not repainting, even when calling repaint() and revalidate() QUESTION: Hey guys. I have got a JPanel which changes color when it is clicked (this is handled correctly in another class). Unfortunately, when I call the repaint() method, it doesn't paint (or it calls the paintComponent method with the old C...
[ "java", "colors", "jpanel", "paintcomponent" ]
0
1
817
1
0
2011-06-05T21:39:03.350000
2011-06-05T21:46:14.203000
6,246,052
6,246,142
http.Server doesn't have addListener in node.js? It isn't a event emitter?
I am just beginning to play around with node.js and was looking through the documentation. This code doesn't even run: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Node.js\n'); }).listen(80, "127.0.0.1"); http.Server.addListener('...
It looks like listen isn't chainable, and you're not storing your server object. Try: var http = require('http'); var myServer = http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Node.js\n'); }); myServer.listen(80, "127.0.0.1"); myServer.addListener('request', f...
http.Server doesn't have addListener in node.js? It isn't a event emitter? I am just beginning to play around with node.js and was looking through the documentation. This code doesn't even run: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.en...
TITLE: http.Server doesn't have addListener in node.js? It isn't a event emitter? QUESTION: I am just beginning to play around with node.js and was looking through the documentation. This code doesn't even run: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'tex...
[ "node.js" ]
3
5
2,882
1
0
2011-06-05T21:41:28.687000
2011-06-05T21:58:09.973000
6,246,064
6,247,130
Creating Location Awareness in Website
Hi I have created the core parts of a web app with Google Maps V3 API and Codeigniter and now I want to make the website aware of the location of the user. From my current knowledge, I will be able to get it from the GPS sensor of the user if he is on a phone/tablet with a GPS sensor, or get it from the IP address of t...
Read all about how to get the user's location at the Google Maps API v3 documentation here: http://code.google.com/apis/maps/documentation/javascript/basics.html#DetectingUserLocation It does not matter if the source is a GPS sensor or something else--you still get it the same way. It seems to me that the documentation...
Creating Location Awareness in Website Hi I have created the core parts of a web app with Google Maps V3 API and Codeigniter and now I want to make the website aware of the location of the user. From my current knowledge, I will be able to get it from the GPS sensor of the user if he is on a phone/tablet with a GPS sen...
TITLE: Creating Location Awareness in Website QUESTION: Hi I have created the core parts of a web app with Google Maps V3 API and Codeigniter and now I want to make the website aware of the location of the user. From my current knowledge, I will be able to get it from the GPS sensor of the user if he is on a phone/tab...
[ "php", "google-maps", "codeigniter", "geolocation", "google-maps-api-3" ]
1
1
2,282
1
0
2011-06-05T21:45:23.087000
2011-06-06T01:41:23.387000
6,246,065
6,246,115
Javascript onclick needs to be clicked twice for function to run
Javascript onclick needs to be clicked twice for function to run. I need it to run on the first click, That is my problem. I've googled and searched for 2 days now without finding a reply that worked or that I understood. The code for the javascript can be found here: http://enji.se/windows8/js/script.js And the site w...
The problem is inside your click handler boxBegin - the click event is received and passed to your method correctly on the first click, but inside boxBegin you are switching behaviour on the value of box.style.display - in IE9 this is initially "", which triggers your close code rather than the open code you want. Chan...
Javascript onclick needs to be clicked twice for function to run Javascript onclick needs to be clicked twice for function to run. I need it to run on the first click, That is my problem. I've googled and searched for 2 days now without finding a reply that worked or that I understood. The code for the javascript can b...
TITLE: Javascript onclick needs to be clicked twice for function to run QUESTION: Javascript onclick needs to be clicked twice for function to run. I need it to run on the first click, That is my problem. I've googled and searched for 2 days now without finding a reply that worked or that I understood. The code for th...
[ "javascript", "html", "onclick", "windows-8" ]
1
8
11,582
3
0
2011-06-05T21:45:25.683000
2011-06-05T21:54:05.330000
6,246,079
6,246,113
Objective-C delegate methods with more specific parameter types
In Objective-C, is it considered good or bad practice to replace argument types with more specific (subclass) argument types in your implementation of a delegate/protocol method? For instance, according to the documentation for UIGestureRecognizer: The action methods invoked must conform to one of the following signatu...
Protocols won't let you do this, because the argument types are part of the protocol specification. But you can, and often should, do this with action methods. I have seen code for action methods that looks like this: - (void)somethingOrOtherAction:(id)sender { UIButton *button = (UIButton *)sender; /* do something wit...
Objective-C delegate methods with more specific parameter types In Objective-C, is it considered good or bad practice to replace argument types with more specific (subclass) argument types in your implementation of a delegate/protocol method? For instance, according to the documentation for UIGestureRecognizer: The act...
TITLE: Objective-C delegate methods with more specific parameter types QUESTION: In Objective-C, is it considered good or bad practice to replace argument types with more specific (subclass) argument types in your implementation of a delegate/protocol method? For instance, according to the documentation for UIGestureR...
[ "objective-c" ]
1
2
443
1
0
2011-06-05T21:48:06.973000
2011-06-05T21:53:48.687000
6,246,080
6,246,280
How can I link to and object's parent in Rails 3?
If I have the following models: class Section < ActiveRecord::Base has_many:pages,:dependent =>:destroy end class Page < ActiveRecord::Base belongs_to:section end And I had a section owning a page, how could I add a link_to that would link to that pages parent? Or, how could I find a page's owner?
@page = Page.find(params[:id]) # or whatever the criteria @page_link = link_to "section", @page.section Or, in the view: <%= link_to "section", @page.section %>
How can I link to and object's parent in Rails 3? If I have the following models: class Section < ActiveRecord::Base has_many:pages,:dependent =>:destroy end class Page < ActiveRecord::Base belongs_to:section end And I had a section owning a page, how could I add a link_to that would link to that pages parent? Or, how...
TITLE: How can I link to and object's parent in Rails 3? QUESTION: If I have the following models: class Section < ActiveRecord::Base has_many:pages,:dependent =>:destroy end class Page < ActiveRecord::Base belongs_to:section end And I had a section owning a page, how could I add a link_to that would link to that pag...
[ "ruby-on-rails", "ruby-on-rails-3" ]
1
5
243
1
0
2011-06-05T21:48:10.747000
2011-06-05T22:20:23.513000
6,246,081
6,246,821
How to create tabs in a Rails 3 app using Sass/Haml or Coffee Script
I'd like to create some tabbed views for displaying content in a Rails 3 app I'm working on. Since I'm relatively new, I figured I'd try to use tools/resources that are core to Rails 3/3.1. With Sass and Coffe Script being adopted in 3.1, I figured I'd start with those two. Can anyone direct me to some examples or tuto...
jQuery UI is good, as is jQuery Tools. It's also not very hard to home-grow your own solution (with jQuery). Basically, you just want to show a different div each time a different li is clicked. Let's say that each li has an id that's just the div 's plus -tab, e.g. there's an #about div and a #about-tab list item. Her...
How to create tabs in a Rails 3 app using Sass/Haml or Coffee Script I'd like to create some tabbed views for displaying content in a Rails 3 app I'm working on. Since I'm relatively new, I figured I'd try to use tools/resources that are core to Rails 3/3.1. With Sass and Coffe Script being adopted in 3.1, I figured I'...
TITLE: How to create tabs in a Rails 3 app using Sass/Haml or Coffee Script QUESTION: I'd like to create some tabbed views for displaying content in a Rails 3 app I'm working on. Since I'm relatively new, I figured I'd try to use tools/resources that are core to Rails 3/3.1. With Sass and Coffe Script being adopted in...
[ "css", "ruby-on-rails-3", "tabs", "sass", "coffeescript" ]
1
3
1,127
2
0
2011-06-05T21:48:13.730000
2011-06-06T00:15:24.520000
6,246,084
6,246,179
Sanitize python slice?
I am using Python/ctypes to wrap a C library. One of the structures I am wrapping resembles a numerical vector, and I would like the getitem () method of the corresponding Python class to support slices. At the C - level I have slice-aware function like this: void * slice_copy( void * ptr, int index1, int index2, int s...
There is indeed a function in the interface. slice objects have an indices() method that accepts the length of the sequence as parameter and returns the normalised start, stop and step values as a tuple.
Sanitize python slice? I am using Python/ctypes to wrap a C library. One of the structures I am wrapping resembles a numerical vector, and I would like the getitem () method of the corresponding Python class to support slices. At the C - level I have slice-aware function like this: void * slice_copy( void * ptr, int in...
TITLE: Sanitize python slice? QUESTION: I am using Python/ctypes to wrap a C library. One of the structures I am wrapping resembles a numerical vector, and I would like the getitem () method of the corresponding Python class to support slices. At the C - level I have slice-aware function like this: void * slice_copy( ...
[ "python", "ctypes" ]
4
2
376
1
0
2011-06-05T21:48:31.447000
2011-06-05T22:03:15.783000
6,246,090
6,259,456
Can IIS Media Services run on IIS Express?
Can I use IIS Express to stream video (by using IIS Media Services, for example)?
IIS Express is primarily for local development. probably/theoretically you could run iis media services on IIS Express but there is no UI for configuring it on IIS Express. Take a look at some other limitations of IIS Express What is to prevent me from using IIS Express exclusively on my development box?
Can IIS Media Services run on IIS Express? Can I use IIS Express to stream video (by using IIS Media Services, for example)?
TITLE: Can IIS Media Services run on IIS Express? QUESTION: Can I use IIS Express to stream video (by using IIS Media Services, for example)? ANSWER: IIS Express is primarily for local development. probably/theoretically you could run iis media services on IIS Express but there is no UI for configuring it on IIS Expr...
[ "iis-express" ]
0
2
345
1
0
2011-06-05T21:49:26.180000
2011-06-07T00:14:12.217000
6,246,093
6,246,684
Units of cuda registers
Can anyone tell me what the units of NVIDIA cuda registers are? When I have 8192 registers per block, it means is in bytes or bits?
Each of the registers is a 32-bit register, i.e. there are 4 bytes per register.
Units of cuda registers Can anyone tell me what the units of NVIDIA cuda registers are? When I have 8192 registers per block, it means is in bytes or bits?
TITLE: Units of cuda registers QUESTION: Can anyone tell me what the units of NVIDIA cuda registers are? When I have 8192 registers per block, it means is in bytes or bits? ANSWER: Each of the registers is a 32-bit register, i.e. there are 4 bytes per register.
[ "cuda", "size", "units-of-measurement" ]
6
14
2,289
1
0
2011-06-05T21:49:59.813000
2011-06-05T23:43:05.267000
6,246,094
6,246,109
can I compare two fractions if both have denominator with power of 2
I know it's not "possible" to compare two real, but is it true for real which have denominator power of 2 Is equality of this king always return true if( 3/4. == 6/8. ) {}
This kind of expression should always evaluate to true, with a few caveats: The numerators don't exceed 2^52; otherwise they'll lose precision. The denominators don't exceed the range provided by double-precision. You must be working on a platform that uses radix-2 floating-point (which is basically all modern machines...
can I compare two fractions if both have denominator with power of 2 I know it's not "possible" to compare two real, but is it true for real which have denominator power of 2 Is equality of this king always return true if( 3/4. == 6/8. ) {}
TITLE: can I compare two fractions if both have denominator with power of 2 QUESTION: I know it's not "possible" to compare two real, but is it true for real which have denominator power of 2 Is equality of this king always return true if( 3/4. == 6/8. ) {} ANSWER: This kind of expression should always evaluate to tr...
[ "c++", "floating-point" ]
4
4
473
4
0
2011-06-05T21:50:10.597000
2011-06-05T21:53:01.603000
6,246,096
6,246,362
How can Python regex ignore case inside a part of a pattern but not the entire expression?
Say I have a string containing foobar fooBAR FOObar FOOBAR, and I want to search all instances containing a case insensitive "foo" or "FOO" but a lowercase "bar". In this case, re.findall should return ['foobar', 'FOObar']. The accepted answer for this question explains that it can be done in C# with (?i)foo(?-i)bar, b...
The re module doesn't support scoped flags, but there's an alternative regex implementation which does: http://pypi.python.org/pypi/regex
How can Python regex ignore case inside a part of a pattern but not the entire expression? Say I have a string containing foobar fooBAR FOObar FOOBAR, and I want to search all instances containing a case insensitive "foo" or "FOO" but a lowercase "bar". In this case, re.findall should return ['foobar', 'FOObar']. The a...
TITLE: How can Python regex ignore case inside a part of a pattern but not the entire expression? QUESTION: Say I have a string containing foobar fooBAR FOObar FOOBAR, and I want to search all instances containing a case insensitive "foo" or "FOO" but a lowercase "bar". In this case, re.findall should return ['foobar'...
[ "python", "regex", "case-sensitive", "case-insensitive" ]
8
4
2,781
2
0
2011-06-05T21:50:23.600000
2011-06-05T22:33:41.100000
6,246,106
6,246,196
Advantages/Disadvantages of a Inheritance, composition and multiple member variables
I am looking at Ogre3D code and WildMagic code and I found that both deal with their core classes a bit differently. Since I am creating my own core, I was wondering which would be better practice and could potentially be better in terms of resources. In WildMagic, there is a Matrix class which inherits from a Table cl...
Very good, complicated questions with many, many answers. I'll try to address them as best I can, but at least in my opinion the overall answer is going to do more with what your needs are than what a single individual might do. 1) There is always a cost to inheritance, though it is very minute. There really isn't an e...
Advantages/Disadvantages of a Inheritance, composition and multiple member variables I am looking at Ogre3D code and WildMagic code and I found that both deal with their core classes a bit differently. Since I am creating my own core, I was wondering which would be better practice and could potentially be better in ter...
TITLE: Advantages/Disadvantages of a Inheritance, composition and multiple member variables QUESTION: I am looking at Ogre3D code and WildMagic code and I found that both deal with their core classes a bit differently. Since I am creating my own core, I was wondering which would be better practice and could potentiall...
[ "c++", "inheritance", "composition" ]
3
2
4,113
3
0
2011-06-05T21:52:18.030000
2011-06-05T22:05:39.597000
6,246,107
6,246,152
PHP - Storing multiple attributes the most efficient way
Just wondered if anyone could point me in the right direction of storing multiple attributes and their values in SQL? Say I've got like First Name, Last Name, Company, Twitter, Facebook etc etc. with more attributes that could be added in the future. There's a couple of methods that have crossed my mind, one is to stor...
If what you are looking for is a way of having variable attributes attached to a given user and you don't want to modify the table everytime there is a new type of attribute. Maybe EAV will help you. It's a tiny bit complex for reporting if your not used to it. But it gives you a very flexible structure. Read more abou...
PHP - Storing multiple attributes the most efficient way Just wondered if anyone could point me in the right direction of storing multiple attributes and their values in SQL? Say I've got like First Name, Last Name, Company, Twitter, Facebook etc etc. with more attributes that could be added in the future. There's a co...
TITLE: PHP - Storing multiple attributes the most efficient way QUESTION: Just wondered if anyone could point me in the right direction of storing multiple attributes and their values in SQL? Say I've got like First Name, Last Name, Company, Twitter, Facebook etc etc. with more attributes that could be added in the fu...
[ "php", "mysql" ]
3
5
520
3
0
2011-06-05T21:52:19.847000
2011-06-05T21:59:39.903000
6,246,108
6,246,145
PHP include depending on account
Im having a issue with my code i am working on. I am trying to get a include loaded depending on the status of the user (if they paid and if they have a invalid email. The NULL value is being pulled form the database however it only sends to the entermail.php Here is my code does anyone see whats wrong? function is_pre...
You're not actually storing the string "NULL" in the database are you? Null is not the same as string "NULL" -- perhaps you want something like: if (empty($validemail)) { return false; } else { return true; } Or shorter: return!empty($validemail);
PHP include depending on account Im having a issue with my code i am working on. I am trying to get a include loaded depending on the status of the user (if they paid and if they have a invalid email. The NULL value is being pulled form the database however it only sends to the entermail.php Here is my code does anyone...
TITLE: PHP include depending on account QUESTION: Im having a issue with my code i am working on. I am trying to get a include loaded depending on the status of the user (if they paid and if they have a invalid email. The NULL value is being pulled form the database however it only sends to the entermail.php Here is m...
[ "php", "sql" ]
0
2
72
6
0
2011-06-05T21:52:46.063000
2011-06-05T21:58:31.727000
6,246,117
6,246,190
C++, point and line position in 2D robust to rounding errors and position
A line is defined by two end points P1[x1, y1], P2[x2, y2]. Let Q [xq, yq] be a tested point. Both coordinates are double. Differencies: dx1 = x2 - x1 dy1 = y2 - y1 dx2 = xq - x1 dy2 = yq - y1 Norms double n1_sq = sqrt(dx1 * dx1 + dy1 * dy1); double n2_sq = sqrt(dx2 * dx2 + dy2 * dy2); My assumption: test with normaliz...
I don't understand your test. It doesn't seem to involve the coordinates of Q at all. Also, for two values u and v, the norm is computed with minimum rounding as M * sqrt(1 + m / M), where M = max(|u|, |v|) and m = min(|u|, |v|). As for a dist function, that is the best approach, although you might want to make the thr...
C++, point and line position in 2D robust to rounding errors and position A line is defined by two end points P1[x1, y1], P2[x2, y2]. Let Q [xq, yq] be a tested point. Both coordinates are double. Differencies: dx1 = x2 - x1 dy1 = y2 - y1 dx2 = xq - x1 dy2 = yq - y1 Norms double n1_sq = sqrt(dx1 * dx1 + dy1 * dy1); dou...
TITLE: C++, point and line position in 2D robust to rounding errors and position QUESTION: A line is defined by two end points P1[x1, y1], P2[x2, y2]. Let Q [xq, yq] be a tested point. Both coordinates are double. Differencies: dx1 = x2 - x1 dy1 = y2 - y1 dx2 = xq - x1 dy2 = yq - y1 Norms double n1_sq = sqrt(dx1 * dx1...
[ "c++", "algorithm", "position", "rounding" ]
0
0
562
2
0
2011-06-05T21:54:11.113000
2011-06-05T22:04:49.480000
6,246,119
6,246,422
Adjusting line-height of label elements in HTML forms
I have a form with a wrapping element, but the space between the 's two lines is too big and I can't seem to adjust the line-height of the. Here is an example of a and a, both with the same CSS applied. As you can see, the adjusts correctly, while the remains unchanged. http://jsfiddle.net/QYzPa/ CODE: form label, for...
All the HTML tags are classified in categories that describe their nature. This classification can be related to semantics, behavior, interaction and many other aspects. Both p and label tags are classified in "flow content" tags category. But there is one slight difference between then: the label tag is also classifie...
Adjusting line-height of label elements in HTML forms I have a form with a wrapping element, but the space between the 's two lines is too big and I can't seem to adjust the line-height of the. Here is an example of a and a, both with the same CSS applied. As you can see, the adjusts correctly, while the remains unchan...
TITLE: Adjusting line-height of label elements in HTML forms QUESTION: I have a form with a wrapping element, but the space between the 's two lines is too big and I can't seem to adjust the line-height of the. Here is an example of a and a, both with the same CSS applied. As you can see, the adjusts correctly, while ...
[ "html", "label", "forms", "css" ]
23
52
58,673
3
0
2011-06-05T21:54:20.620000
2011-06-05T22:49:26.717000
6,246,122
6,246,160
Can Thread.Sleep(Timespan.Zero) be used sensibly in this scenario?
I am writing a program that reads data packets from a file, and assigns each packet to a specified pipeline for processing. Each pipeline object has a blocking queue and a filter class. There can be several such pipelines in operation simultaneously. The blocking queue just collects packets on the input side until it r...
Real programs don't Sleep(). Your suggestion, Sleep(0) has an additional problem with allowing only threads with the same priority to run. Generally Sleep(1) is considered a little safer. See Joe Duffy. But in either case your resolution is ~20ms, which could be way too long. Your loop as stated does a tiny bit of work...
Can Thread.Sleep(Timespan.Zero) be used sensibly in this scenario? I am writing a program that reads data packets from a file, and assigns each packet to a specified pipeline for processing. Each pipeline object has a blocking queue and a filter class. There can be several such pipelines in operation simultaneously. Th...
TITLE: Can Thread.Sleep(Timespan.Zero) be used sensibly in this scenario? QUESTION: I am writing a program that reads data packets from a file, and assigns each packet to a specified pipeline for processing. Each pipeline object has a blocking queue and a filter class. There can be several such pipelines in operation ...
[ "c#", ".net", "multithreading", ".net-3.5" ]
2
3
849
4
0
2011-06-05T21:54:45.350000
2011-06-05T22:00:36.797000
6,246,125
6,246,150
View html, htm, etc as plain text
I was wondering if there is a way to link to a page like domain.com/index.htm and view it as plain text / code instead of the browser actually rendering the page. Even better yet, if this is possible with php scripts, that would be incredible. (This would not be a link to an external page, but rather one on my own ftp ...
you could create a php handler to do it, eg getHtml.php?file=index.html, then use file_get_contents and htmlspecialchars to output it.
View html, htm, etc as plain text I was wondering if there is a way to link to a page like domain.com/index.htm and view it as plain text / code instead of the browser actually rendering the page. Even better yet, if this is possible with php scripts, that would be incredible. (This would not be a link to an external p...
TITLE: View html, htm, etc as plain text QUESTION: I was wondering if there is a way to link to a page like domain.com/index.htm and view it as plain text / code instead of the browser actually rendering the page. Even better yet, if this is possible with php scripts, that would be incredible. (This would not be a lin...
[ "html", "plaintext" ]
0
0
923
4
0
2011-06-05T21:55:08.063000
2011-06-05T21:58:56.457000
6,246,126
6,246,175
Help with a Simple 5 star rating control
I have set up a fairly easy way to apply a 5 star rating in Xcode, it's technically working but has a behavior I don't like and would like to change. I started out with a radio group in Xcode, set custom images for the on and off states, and then applied an IBAction for selector action of each one. For example the thir...
Have you given any thought to using an NSLevelIndicator? That's what iTunes uses for its star-rating control. The star images are built in, and you can set your own image if you don't like that. No need to build your own. Whatever action you set the control to have can query the indicator for its current level: - (IBAc...
Help with a Simple 5 star rating control I have set up a fairly easy way to apply a 5 star rating in Xcode, it's technically working but has a behavior I don't like and would like to change. I started out with a radio group in Xcode, set custom images for the on and off states, and then applied an IBAction for selector...
TITLE: Help with a Simple 5 star rating control QUESTION: I have set up a fairly easy way to apply a 5 star rating in Xcode, it's technically working but has a behavior I don't like and would like to change. I started out with a radio group in Xcode, set custom images for the on and off states, and then applied an IBA...
[ "objective-c", "cocoa", "macos", "controls" ]
1
4
1,956
1
0
2011-06-05T21:55:36.970000
2011-06-05T22:02:48.217000
6,246,127
6,246,164
Can't access Tomcat using IP address
I'm running a Tomcat 5.5 instance (port 8089) on Windows 7. The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on http://192.168.1.100:8089/ I thought it was a firewall issue, so I disabled it, but I still have no luck.
You need to make Tomcat listen to 192.168.1.100 address also. If you want it to listen to all interfaces (IP-s) just remove "address=" from Connector string in your configuration file and restart Tomcat. Or just use your IP to listen to that address address=192.168.1.100 in the Connector string
Can't access Tomcat using IP address I'm running a Tomcat 5.5 instance (port 8089) on Windows 7. The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on http://192.168.1.100:8089/ I thought it was a firewall issue, so I disabled it, but I still have no luck.
TITLE: Can't access Tomcat using IP address QUESTION: I'm running a Tomcat 5.5 instance (port 8089) on Windows 7. The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on http://192.168.1.100:8089/ I thought it was a firewall issue, so I disabled it, but I still have ...
[ "tomcat", "localhost" ]
48
23
201,232
13
0
2011-06-05T21:55:40.590000
2011-06-05T22:01:11.213000
6,246,131
6,246,165
Displaying message only when text in search box with jQuery
I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script displays a message saying "No results were found.". However, when there are no search terms in the search box and the query string is empty this m...
The request is still firing even when there is nothing in the search field. Only make the request if the field isn't empty.
Displaying message only when text in search box with jQuery I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script displays a message saying "No results were found.". However, when there are no search ...
TITLE: Displaying message only when text in search box with jQuery QUESTION: I have a Google Instant style search script written in jQuery which queries a PHP file. Currently, when no results are found, the PHP file returns no HTML code so the script displays a message saying "No results were found.". However, when th...
[ "javascript", "jquery", "html" ]
1
0
297
1
0
2011-06-05T21:56:28.313000
2011-06-05T22:01:12.070000
6,246,133
6,246,140
JSON to string with jQuery
I know jQuery automatically turns JSON into string when sending AJAX POST requests. Is it possible to convert JSON to string the same way without sending it via AJAX?
Use the JSON stringifier at JSON.org http://www.json.org/js.html BTW I don't think jQuery is converting JSON to a string. I think the conversion of the JSON to a POST message is done internally by the browser as part of the XmlHttpRequest.... but could be wrong... haven't really looked at the code in jQuery for few ver...
JSON to string with jQuery I know jQuery automatically turns JSON into string when sending AJAX POST requests. Is it possible to convert JSON to string the same way without sending it via AJAX?
TITLE: JSON to string with jQuery QUESTION: I know jQuery automatically turns JSON into string when sending AJAX POST requests. Is it possible to convert JSON to string the same way without sending it via AJAX? ANSWER: Use the JSON stringifier at JSON.org http://www.json.org/js.html BTW I don't think jQuery is conver...
[ "jquery", "json" ]
0
4
651
2
0
2011-06-05T21:56:35.863000
2011-06-05T21:57:47.267000
6,246,139
6,246,168
How NOT to redirect when using window.document.href
Hey. I do use jQuery to "replace" content of page with new informations, but i'Ve got a problem. I DO NOT WANT TO USE HASH! So for example, I've got this page: http://mydomain.com/ user clicks to "Cool page" and ajax sends request to: http://mydomain.com/coolpage and I want to change link (adress bar) to: http://mydoma...
It's only supported in some web browsers. It's a new technology in HTML5. You can read more about it here: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
How NOT to redirect when using window.document.href Hey. I do use jQuery to "replace" content of page with new informations, but i'Ve got a problem. I DO NOT WANT TO USE HASH! So for example, I've got this page: http://mydomain.com/ user clicks to "Cool page" and ajax sends request to: http://mydomain.com/coolpage and ...
TITLE: How NOT to redirect when using window.document.href QUESTION: Hey. I do use jQuery to "replace" content of page with new informations, but i'Ve got a problem. I DO NOT WANT TO USE HASH! So for example, I've got this page: http://mydomain.com/ user clicks to "Cool page" and ajax sends request to: http://mydomain...
[ "javascript", "jquery", "ajax", "location" ]
3
4
685
4
0
2011-06-05T21:57:40.480000
2011-06-05T22:01:30.980000
6,246,158
6,246,860
100% CPU usage when overriding QGraphicsLineItem::paint()
I have a class inheriting from QGraphicsLineItem and as soon as I override the paint method, it looks like Qt starts painting it at every "main loop", instead of drawing according to some events (like moving the item, etc). Does anyone know more about the good practices when inheriting from a QGraphicsItem? I look at o...
You probably shouldn't call methods like setPos, setRect, setPolygon or update inside your paint() method. These methods are likely to schedule a new paint event which will lead to infinite recursion.
100% CPU usage when overriding QGraphicsLineItem::paint() I have a class inheriting from QGraphicsLineItem and as soon as I override the paint method, it looks like Qt starts painting it at every "main loop", instead of drawing according to some events (like moving the item, etc). Does anyone know more about the good p...
TITLE: 100% CPU usage when overriding QGraphicsLineItem::paint() QUESTION: I have a class inheriting from QGraphicsLineItem and as soon as I override the paint method, it looks like Qt starts painting it at every "main loop", instead of drawing according to some events (like moving the item, etc). Does anyone know mor...
[ "c++", "qt", "qt4" ]
3
4
617
1
0
2011-06-05T22:00:32.947000
2011-06-06T00:25:18.040000
6,246,159
6,246,186
How to sort a data frame by date
I need to sort a data frame by date in R. The dates are all in the form of "dd/mm/yyyy". The dates are in the 3rd column. The column header is V3. I have seen how to sort a data frame by column and I have seen how to convert the string into a date value. I can't combine the two in order to sort the data frame by date.
Assuming your data frame is named d, d[order(as.Date(d$V3, format="%d/%m/%Y")),] Read my blog post, Sorting a data frame by the contents of a column, if that doesn't make sense.
How to sort a data frame by date I need to sort a data frame by date in R. The dates are all in the form of "dd/mm/yyyy". The dates are in the 3rd column. The column header is V3. I have seen how to sort a data frame by column and I have seen how to convert the string into a date value. I can't combine the two in order...
TITLE: How to sort a data frame by date QUESTION: I need to sort a data frame by date in R. The dates are all in the form of "dd/mm/yyyy". The dates are in the 3rd column. The column header is V3. I have seen how to sort a data frame by column and I have seen how to convert the string into a date value. I can't combin...
[ "r", "sorting", "date", "dataframe" ]
70
161
200,118
8
0
2011-06-05T22:00:35.690000
2011-06-05T22:04:25.177000
6,246,161
6,246,255
Accessing relative elements in jquery ui autocomplete?
I am attempting to send additional parameters with jqueryUI's autocomplete using an abstract approach. A stripped down version of the html being used is: What I need is to be able to find the id of the parent relative to any autocomplete input (as there can be multiple on one page). The code I have so far is: $(".autoc...
Why don't you do like the following code? It can give you an idea... $(".autocomplete").each(function() { var ac = $(this); var parentId = $(this).parent().attr('id'); ac.autocomplete({ minLength: 3, source: function(request, response) { findSuggestions(request, response, 'artist', artist_cache, parentId); } }); });
Accessing relative elements in jquery ui autocomplete? I am attempting to send additional parameters with jqueryUI's autocomplete using an abstract approach. A stripped down version of the html being used is: What I need is to be able to find the id of the parent relative to any autocomplete input (as there can be mult...
TITLE: Accessing relative elements in jquery ui autocomplete? QUESTION: I am attempting to send additional parameters with jqueryUI's autocomplete using an abstract approach. A stripped down version of the html being used is: What I need is to be able to find the id of the parent relative to any autocomplete input (as...
[ "javascript", "jquery", "html", "user-interface", "jquery-autocomplete" ]
1
0
825
1
0
2011-06-05T22:00:39.590000
2011-06-05T22:15:25.547000
6,246,170
6,246,192
Problem with foreach () Invalid Argument Supplied
I am trying to delete every follower from an array using PHP. However I am receiving the error: Warning: Invalid argument supplied for foreach() in /home/nucleusi/public_html/maxkdevelopment.co.uk/SocialPic/socialPic.php Please can you tell me where I am going wrong? $arg = mysql_query("SELECT `followerUserID` FROM Fol...
MySQL will not return arrays in a field, indexing an array retrieved from a query will return a single field, and foreach() expects an array. What you have written cannot work. Use a while() loop to iterate through the query results as one would normally do.
Problem with foreach () Invalid Argument Supplied I am trying to delete every follower from an array using PHP. However I am receiving the error: Warning: Invalid argument supplied for foreach() in /home/nucleusi/public_html/maxkdevelopment.co.uk/SocialPic/socialPic.php Please can you tell me where I am going wrong? $a...
TITLE: Problem with foreach () Invalid Argument Supplied QUESTION: I am trying to delete every follower from an array using PHP. However I am receiving the error: Warning: Invalid argument supplied for foreach() in /home/nucleusi/public_html/maxkdevelopment.co.uk/SocialPic/socialPic.php Please can you tell me where I ...
[ "php", "mysql", "foreach" ]
0
1
250
5
0
2011-06-05T22:01:51.010000
2011-06-05T22:05:19.120000
6,246,172
6,246,189
calling function - variables
i have: echo $test->getNum1(); echo $test->getNum2(); echo $test->getNum9(); how can i make something: for(i=0;i<10;i++){ echo $test->getNum. $i.(); }?
for(i=0;i<10;i++){ $method = 'getNum'. $i; echo $test->$method(); }
calling function - variables i have: echo $test->getNum1(); echo $test->getNum2(); echo $test->getNum9(); how can i make something: for(i=0;i<10;i++){ echo $test->getNum. $i.(); }?
TITLE: calling function - variables QUESTION: i have: echo $test->getNum1(); echo $test->getNum2(); echo $test->getNum9(); how can i make something: for(i=0;i<10;i++){ echo $test->getNum. $i.(); }? ANSWER: for(i=0;i<10;i++){ $method = 'getNum'. $i; echo $test->$method(); }
[ "php", "oop", "variables", "object", "call" ]
2
7
101
4
0
2011-06-05T22:02:11.143000
2011-06-05T22:04:37.997000
6,246,176
6,246,191
JAVA Linked List Search Linked List to compare data with user inputted data?
I have a linked list. Everything is going great inside of it. My only problem is how do I compare a variable to the contents to see if their is a match. For instance I have a linked list full of names. I want the user to be able to enter a name in and search to see if that name exists in the Linked List. User enters: J...
Use the contains() method in the List interface. if (NameList1.contains("Johnny")) { // code to execute if Johnny is in the list }
JAVA Linked List Search Linked List to compare data with user inputted data? I have a linked list. Everything is going great inside of it. My only problem is how do I compare a variable to the contents to see if their is a match. For instance I have a linked list full of names. I want the user to be able to enter a nam...
TITLE: JAVA Linked List Search Linked List to compare data with user inputted data? QUESTION: I have a linked list. Everything is going great inside of it. My only problem is how do I compare a variable to the contents to see if their is a match. For instance I have a linked list full of names. I want the user to be a...
[ "java", "linked-list" ]
0
5
2,387
2
0
2011-06-05T22:03:03.710000
2011-06-05T22:04:53.460000
6,246,199
6,246,289
Make text to have background + border
If I have a label with its content "White, Yellow, Black" and I want to make "yellow" to have a white background color + border with black line around the word "Yellow". What XAML code is needed?
You need to split the content: ( If this is not what you want you should express yourself more clearly )
Make text to have background + border If I have a label with its content "White, Yellow, Black" and I want to make "yellow" to have a white background color + border with black line around the word "Yellow". What XAML code is needed?
TITLE: Make text to have background + border QUESTION: If I have a label with its content "White, Yellow, Black" and I want to make "yellow" to have a white background color + border with black line around the word "Yellow". What XAML code is needed? ANSWER: You need to split the content: ( If this is not what you wa...
[ "c#", "wpf", "xaml" ]
0
4
206
1
0
2011-06-05T22:06:12.617000
2011-06-05T22:21:22.600000
6,246,202
6,246,385
Rails 3 paperclip install, now get LoadError
I am very new to Rails, I am running Rails 3 I recently installed ImageMagick via Homebrew and then ran 'sudo plugin install git://github.com/thoughtbot/paperclip.git' I added "gem 'rmagick'" to my root Gemfile. Immediately after doing so I found that no rails commands worked anymore (error below). I tried adding "conf...
I cloned your repo and ran the app but didn't get any of those errors. Have you tried installing paperclip as a gem instead of a plugin? This is the setup I have working in one of my apps (using Amazon S3 for storage): # Gemfile gem 'paperclip' gem 'aws-s3' #MyModel migration class MyModel < ActiveRecord::Migration de...
Rails 3 paperclip install, now get LoadError I am very new to Rails, I am running Rails 3 I recently installed ImageMagick via Homebrew and then ran 'sudo plugin install git://github.com/thoughtbot/paperclip.git' I added "gem 'rmagick'" to my root Gemfile. Immediately after doing so I found that no rails commands worke...
TITLE: Rails 3 paperclip install, now get LoadError QUESTION: I am very new to Rails, I am running Rails 3 I recently installed ImageMagick via Homebrew and then ran 'sudo plugin install git://github.com/thoughtbot/paperclip.git' I added "gem 'rmagick'" to my root Gemfile. Immediately after doing so I found that no ra...
[ "paperclip" ]
3
3
1,423
2
0
2011-06-05T22:06:42.133000
2011-06-05T22:39:51.020000
6,246,219
6,257,320
changing a lists sort order inline
I have a list Each row has a common input field "sort_order" that's stored in MySQL db. I want to be able to change the sort order inline, without going into the edit form. How do I get all the values into the database. I think I need to loop through each row adding the sort_order[row_id] and value to an array. But I a...
Ok this seems to work: Controller: public function updateCatSortOrder(){ $sortvals = $this->request->post['sort_order']; //$this->request->post same as $_POST $row = $this->request->post['cat_id']; $n = count($this->request->post['cat_id']); $sortorder = array(); for($i=0; $i<$n; $i++){ $sortorder[] = array( 'cat_id'...
changing a lists sort order inline I have a list Each row has a common input field "sort_order" that's stored in MySQL db. I want to be able to change the sort order inline, without going into the edit form. How do I get all the values into the database. I think I need to loop through each row adding the sort_order[row...
TITLE: changing a lists sort order inline QUESTION: I have a list Each row has a common input field "sort_order" that's stored in MySQL db. I want to be able to change the sort order inline, without going into the edit form. How do I get all the values into the database. I think I need to loop through each row adding ...
[ "php", "mysql" ]
0
0
502
3
0
2011-06-05T22:08:52.317000
2011-06-06T19:57:30.110000
6,246,222
6,246,349
How to use a c# method in a sql stored procedure
I wanted to use linq as so: MyDBEntities context = new MyDBEntities(); context.MyTable.Where(i => MyMethod(i.column, valueToTest).ToList(); with public bool MyMethod(Object a, Object b) but apparently using such a method with isn't possible so I was hopping I could use the methode in a stored procedure I would be able ...
Generally it is possible to create C# function and use it in SQL Server (2005 and newer) but it is not so simple - you must use SQL CLR which means separate project for your function, special references, special types, etc. At last you must deploy the assembly to SQL server to be able to use the function in SQL. Genera...
How to use a c# method in a sql stored procedure I wanted to use linq as so: MyDBEntities context = new MyDBEntities(); context.MyTable.Where(i => MyMethod(i.column, valueToTest).ToList(); with public bool MyMethod(Object a, Object b) but apparently using such a method with isn't possible so I was hopping I could use t...
TITLE: How to use a c# method in a sql stored procedure QUESTION: I wanted to use linq as so: MyDBEntities context = new MyDBEntities(); context.MyTable.Where(i => MyMethod(i.column, valueToTest).ToList(); with public bool MyMethod(Object a, Object b) but apparently using such a method with isn't possible so I was hop...
[ "c#", "sql", "sql-server", "linq", "stored-procedures" ]
2
4
948
3
0
2011-06-05T22:09:50.570000
2011-06-05T22:30:47.017000
6,246,226
6,249,595
MSXML2.XSLTemplate documentation
I can't find any documentation regarding this line of ASP classic code; Set objTemplate = Server.CreateObject("MSXML2.XSLTemplate.6.0") The line is from this Microsoft page; http://msdn.microsoft.com/en-us/library/ms762312(VS.85).aspx Specifically, I can't find any info regarding "MSXML2.XSLTemplate". Can anyone help?
objTemplate is a COM object that supports the IXSLTemplate interface. You can use it by setting the stylesheet property to a DOM document object loaded from your XSLT and then calling the createProcessor method to return an object that supports the IXSLProcessor interface.
MSXML2.XSLTemplate documentation I can't find any documentation regarding this line of ASP classic code; Set objTemplate = Server.CreateObject("MSXML2.XSLTemplate.6.0") The line is from this Microsoft page; http://msdn.microsoft.com/en-us/library/ms762312(VS.85).aspx Specifically, I can't find any info regarding "MSXML...
TITLE: MSXML2.XSLTemplate documentation QUESTION: I can't find any documentation regarding this line of ASP classic code; Set objTemplate = Server.CreateObject("MSXML2.XSLTemplate.6.0") The line is from this Microsoft page; http://msdn.microsoft.com/en-us/library/ms762312(VS.85).aspx Specifically, I can't find any inf...
[ "msxml" ]
2
2
2,484
1
0
2011-06-05T22:10:27.773000
2011-06-06T08:48:56.913000
6,246,233
6,246,267
File Loading in irb
I have a Ruby method that should load a specified file when called: def self.from_file(file_name, origin = nil) MyFile.new(File.read(file_name), file_name.split('/').last, origin) end But, when I try and use MyFile.from_file('path/to/file') in irb I get a "LoadError: no such file to load" message. Using Ruby 1.9.2p180 ...
The file_name you're loading needs to either be relative to your current path, or a full path. If you're using a relative path, in irb you can check the output of Dir.pwd to see where File.read is trying to load your relative path from.
File Loading in irb I have a Ruby method that should load a specified file when called: def self.from_file(file_name, origin = nil) MyFile.new(File.read(file_name), file_name.split('/').last, origin) end But, when I try and use MyFile.from_file('path/to/file') in irb I get a "LoadError: no such file to load" message. U...
TITLE: File Loading in irb QUESTION: I have a Ruby method that should load a specified file when called: def self.from_file(file_name, origin = nil) MyFile.new(File.read(file_name), file_name.split('/').last, origin) end But, when I try and use MyFile.from_file('path/to/file') in irb I get a "LoadError: no such file t...
[ "ruby", "file", "file-io", "irb" ]
0
3
913
1
0
2011-06-05T22:11:08.123000
2011-06-05T22:17:38.367000
6,246,236
6,246,270
How to stop executing FOR loop until code is completed
I made this thing. It has no purpose other than for demonstration to myself. Essentially, I'm moving a view that I created around the screen in a loop. The problem is that it doesn't wait until it's done with one animation before starting the other, and so the view bypasses the first two and ends up at the last toastRe...
I think you need to use + (void)setAnimationDidStopSelector:(SEL)selector. Take a closer look at http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html if you want.
How to stop executing FOR loop until code is completed I made this thing. It has no purpose other than for demonstration to myself. Essentially, I'm moving a view that I created around the screen in a loop. The problem is that it doesn't wait until it's done with one animation before starting the other, and so the view...
TITLE: How to stop executing FOR loop until code is completed QUESTION: I made this thing. It has no purpose other than for demonstration to myself. Essentially, I'm moving a view that I created around the screen in a loop. The problem is that it doesn't wait until it's done with one animation before starting the othe...
[ "objective-c", "ios", "animation", "for-loop" ]
0
3
539
2
0
2011-06-05T22:11:28.203000
2011-06-05T22:18:04.517000
6,246,238
6,246,248
How to list contents of a directory IN ORDER with node.js?
I'm a fairly experienced programmer and I've just recently discovered node.js. I love JavaScript because that's where I started (Web Development) so being able to write server-side code with its is amazing. Currently, I'm working on a simple exercise, a WebSocket/HTTP server, and I began to add a directory list functio...
If you want them ordered by name, you can just call sort() on the array first. files.sort().forEach(printBr); If, for example, you'd like to sort directories first, then you need to get more information. A naive implementation would be to query the stats of each file in the sort comparison function: files.sort(function...
How to list contents of a directory IN ORDER with node.js? I'm a fairly experienced programmer and I've just recently discovered node.js. I love JavaScript because that's where I started (Web Development) so being able to write server-side code with its is amazing. Currently, I'm working on a simple exercise, a WebSock...
TITLE: How to list contents of a directory IN ORDER with node.js? QUESTION: I'm a fairly experienced programmer and I've just recently discovered node.js. I love JavaScript because that's where I started (Web Development) so being able to write server-side code with its is amazing. Currently, I'm working on a simple e...
[ "javascript", "list", "node.js", "directory", "inorder" ]
13
15
23,961
1
0
2011-06-05T22:11:46.373000
2011-06-05T22:15:01.807000
6,246,240
6,246,354
Keeping track of touched points in mutable array
UPDATE: I realized that the "initWithFrame" method is never called, so I placed my array's init elsewhere. Thanks for reading. (for anyone, what's the point of initWithFrame if it is not called?" I've been staring at this code for about an hour and am probably missing a simple and obvious issue. I'm merely trying to ke...
Your initWithFrame: never gets called,* and drawn is never created. From the Resource Management Guide: In iOS, any object that conforms to the NSCoding protocol is initialized using the initWithCoder: method. This includes all subclasses of UIView [...] Custom views in iOS do not use the initWithFrame: method for init...
Keeping track of touched points in mutable array UPDATE: I realized that the "initWithFrame" method is never called, so I placed my array's init elsewhere. Thanks for reading. (for anyone, what's the point of initWithFrame if it is not called?" I've been staring at this code for about an hour and am probably missing a ...
TITLE: Keeping track of touched points in mutable array QUESTION: UPDATE: I realized that the "initWithFrame" method is never called, so I placed my array's init elsewhere. Thanks for reading. (for anyone, what's the point of initWithFrame if it is not called?" I've been staring at this code for about an hour and am p...
[ "objective-c", "cocoa-touch", "ios", "uiview" ]
1
3
296
2
0
2011-06-05T22:12:39.873000
2011-06-05T22:32:07.453000
6,246,243
6,247,526
Can Observable.Timer() lead to memory leaks?
Recently I noticed a small bug in my code which uses Reactive Extensions. I was subscribing to Timer but I never disposed my subscription. This resulted in a memory leak. I created snippet which highlights this danger: while (true) { Observable.Timer(TimeSpan.Zero, TimeSpan.FromMinutes(1)).Subscribe(Console.WriteLine);...
This is normal, and is a feature. The semantics for Subscribe() are listen forever, or until Disposed() or OnCompleted(), or OnError(), which ever comes first.
Can Observable.Timer() lead to memory leaks? Recently I noticed a small bug in my code which uses Reactive Extensions. I was subscribing to Timer but I never disposed my subscription. This resulted in a memory leak. I created snippet which highlights this danger: while (true) { Observable.Timer(TimeSpan.Zero, TimeSpan....
TITLE: Can Observable.Timer() lead to memory leaks? QUESTION: Recently I noticed a small bug in my code which uses Reactive Extensions. I was subscribing to Timer but I never disposed my subscription. This resulted in a memory leak. I created snippet which highlights this danger: while (true) { Observable.Timer(TimeSp...
[ ".net", "timer", "system.reactive", "observable" ]
5
4
2,301
3
0
2011-06-05T22:13:36.753000
2011-06-06T03:27:25.427000
6,246,245
6,246,292
Using syntax highlight from GitHub
What syntax highlighting is used on GitHub (for HTML, CSS, JavaScript, C#) when viewing source code-file and is it available for the public to use? It works on the page and it works when embedding on a page (from a Gist), like this: But can I just include their JavaScript-library and let it highlight my code?
Github uses pygments to highlight syntax. Pygments is running on the server, instead of a pure Javascript client solution. If you're looking for a Javascript solution check out this review of the various options.
Using syntax highlight from GitHub What syntax highlighting is used on GitHub (for HTML, CSS, JavaScript, C#) when viewing source code-file and is it available for the public to use? It works on the page and it works when embedding on a page (from a Gist), like this: But can I just include their JavaScript-library and ...
TITLE: Using syntax highlight from GitHub QUESTION: What syntax highlighting is used on GitHub (for HTML, CSS, JavaScript, C#) when viewing source code-file and is it available for the public to use? It works on the page and it works when embedding on a page (from a Gist), like this: But can I just include their JavaS...
[ "html", "github", "syntax-highlighting" ]
35
43
20,214
5
0
2011-06-05T22:13:50.480000
2011-06-05T22:21:49.020000
6,246,250
6,246,294
Access static final variables on a class in one app, from another app
While I continue to ponder this for the technical consequences that hitting 'compile' generates, shouldn't I be able to access static final variables on a class in one project/app, from another project/app? The one project is in the build path of the other. It compiles but throws a NoClassDefFound error at runtime. Bot...
Each app instance is sandboxed, so you can't get directly at the memory of another process. Unencumbered data sharing between apps as you suggest would amount to a gaping security hole. If you need to communicate between apps to share data, look into the ContentProvider From the docs: Content providers store and retrie...
Access static final variables on a class in one app, from another app While I continue to ponder this for the technical consequences that hitting 'compile' generates, shouldn't I be able to access static final variables on a class in one project/app, from another project/app? The one project is in the build path of the...
TITLE: Access static final variables on a class in one app, from another app QUESTION: While I continue to ponder this for the technical consequences that hitting 'compile' generates, shouldn't I be able to access static final variables on a class in one project/app, from another project/app? The one project is in the...
[ "android", "static", "dependencies", "share" ]
0
3
1,149
1
0
2011-06-05T22:15:03.537000
2011-06-05T22:21:57.397000
6,246,258
6,246,278
use attr linux command from Java program
I want to attach meta data to a file in Unix file system. attr command lets me do that but the command syntax requires the path of the attached variable to be in double qoutes. attr -s outpipe0 "/mnt/FUse/FileB" FileA how can i Use System.Runtime.exec in java to run the above command. When ever i try to run using a str...
You can escape the quotes within your literal string in Java, like this: "\"/mnt/FUse/FileB\"" That will address your question of how to include double quotes in a string, but I doubt it will solve your program. That's because I doubt the attr program actually wants (or accepts) double quotes. Instead, the shell eats t...
use attr linux command from Java program I want to attach meta data to a file in Unix file system. attr command lets me do that but the command syntax requires the path of the attached variable to be in double qoutes. attr -s outpipe0 "/mnt/FUse/FileB" FileA how can i Use System.Runtime.exec in java to run the above co...
TITLE: use attr linux command from Java program QUESTION: I want to attach meta data to a file in Unix file system. attr command lets me do that but the command syntax requires the path of the attached variable to be in double qoutes. attr -s outpipe0 "/mnt/FUse/FileB" FileA how can i Use System.Runtime.exec in java t...
[ "java", "attr", "runtime.exec" ]
1
2
211
1
0
2011-06-05T22:16:01.927000
2011-06-05T22:20:19.587000
6,246,261
6,246,524
CodeIgniter ActiveRecord Multiply
I'm trying to work out the total value of all the products in my inventory. Each product in the table has a price and quantity. So I need to multiply each product's price by the quantity and then add all of these together to get a total for all products. From a previous question, I now have the MySQL query to do this: ...
Try this: $this->db->select('sum(`product_price`*`product_quantity`) as stockvalue', FAlSE); I'm not sure if you need the second argument. I haven't worked with CI for quite awhile.
CodeIgniter ActiveRecord Multiply I'm trying to work out the total value of all the products in my inventory. Each product in the table has a price and quantity. So I need to multiply each product's price by the quantity and then add all of these together to get a total for all products. From a previous question, I now...
TITLE: CodeIgniter ActiveRecord Multiply QUESTION: I'm trying to work out the total value of all the products in my inventory. Each product in the table has a price and quantity. So I need to multiply each product's price by the quantity and then add all of these together to get a total for all products. From a previo...
[ "codeigniter", "activerecord" ]
2
6
2,781
2
0
2011-06-05T22:16:22.787000
2011-06-05T23:07:41.353000
6,246,269
6,246,283
php regex split string by [%%%]
Hi I need a preg_split regex that will split a string at substrings in square brackets. This example input: $string = 'I have a string containing [substrings] in [brackets].'; should provide this array output: [0]= 'I have a string containing ' [1]= '[substrings]' [2]= ' in ' [3]= '[brackets]' [4]= '.'
After reading your revised question: This might be what you want: $string = 'I have a string containing [substrings] in [brackets].'; preg_split('/(\[.*?\])/', $string, null, PREG_SPLIT_DELIM_CAPTURE); You should get: Array ( [0] => I have a string containing [1] => [substrings] [2] => in [3] => [brackets] [4] =>. ) Or...
php regex split string by [%%%] Hi I need a preg_split regex that will split a string at substrings in square brackets. This example input: $string = 'I have a string containing [substrings] in [brackets].'; should provide this array output: [0]= 'I have a string containing ' [1]= '[substrings]' [2]= ' in ' [3]= '[brac...
TITLE: php regex split string by [%%%] QUESTION: Hi I need a preg_split regex that will split a string at substrings in square brackets. This example input: $string = 'I have a string containing [substrings] in [brackets].'; should provide this array output: [0]= 'I have a string containing ' [1]= '[substrings]' [2]= ...
[ "php", "regex" ]
3
7
2,252
2
0
2011-06-05T22:17:48.793000
2011-06-05T22:20:35.983000
6,246,285
6,249,961
Checking if ForeignKeys are equal to one another
I have a list of tuples of foreign keys of the form [(3,2),(2,3)]. And I want to insert the items into a ManyToMany table within a model: class Place(models.Model): data=models.IntegerField() connected_to=models.ManyToManyField('self') class PlaceMeta(models.Model): place=models.ForeignKey("places.Place") and I am ins...
You have one parameter too much in you call to add(). It should look like this: if place.data == conn_1 and conn_1!= conn_2: # place is the Place instance described by conn_1. # Let's connect it to conn_2! place.connected_to.add(conn_2) And you don't need to iterate through all the Places, instead use objects.get or ob...
Checking if ForeignKeys are equal to one another I have a list of tuples of foreign keys of the form [(3,2),(2,3)]. And I want to insert the items into a ManyToMany table within a model: class Place(models.Model): data=models.IntegerField() connected_to=models.ManyToManyField('self') class PlaceMeta(models.Model): pla...
TITLE: Checking if ForeignKeys are equal to one another QUESTION: I have a list of tuples of foreign keys of the form [(3,2),(2,3)]. And I want to insert the items into a ManyToMany table within a model: class Place(models.Model): data=models.IntegerField() connected_to=models.ManyToManyField('self') class PlaceMeta(...
[ "python", "mysql", "django", "foreign-keys" ]
0
1
99
1
0
2011-06-05T22:20:53.160000
2011-06-06T09:24:57.443000
6,246,293
6,246,313
How can I make sure that my PHP api can only be used by a specific javascript page
I have a PHP page ("An API") that does server-side stuff (e.g. entering info into a database) based on GET string input. Would it be possible for me to secure it so that only the JavaScript code on a specific site can access the api, including securing it against, for example, someone typing into a JavaScript console w...
No, it is impossible to completely protect against that. You may, however, make it more difficult. For example: Require the Referer header to point to that page (some browsers don't send Referer, however) You could also check for X-Requested-With being equal to XMLHttpRequest if the JS library you're using sets that.
How can I make sure that my PHP api can only be used by a specific javascript page I have a PHP page ("An API") that does server-side stuff (e.g. entering info into a database) based on GET string input. Would it be possible for me to secure it so that only the JavaScript code on a specific site can access the api, inc...
TITLE: How can I make sure that my PHP api can only be used by a specific javascript page QUESTION: I have a PHP page ("An API") that does server-side stuff (e.g. entering info into a database) based on GET string input. Would it be possible for me to secure it so that only the JavaScript code on a specific site can a...
[ "php", "javascript", "get", "security" ]
0
3
134
3
0
2011-06-05T22:21:56.347000
2011-06-05T22:25:02.977000
6,246,301
6,246,357
Java Inner Classes
Possible Duplicates: Cannot refer to a non-final variable inside an inner class defined in a different method Why inner classes require “final” outer instance variables [Java]? class MyOuter { private String x = "Outer"; void doStuff(){ final String z = "local variable"; class MyInner { public void seeOuter(){ System....
Your class myInner cannot actually "see" the method scope variable z that you're referencing. The compiler just gives the inner class its own private copy of z. Thus if you were to change z later, your program could "break" in mysterious ways, since the code makes it "look like" it's the same variable. Thus, the compil...
Java Inner Classes Possible Duplicates: Cannot refer to a non-final variable inside an inner class defined in a different method Why inner classes require “final” outer instance variables [Java]? class MyOuter { private String x = "Outer"; void doStuff(){ final String z = "local variable"; class MyInner { public void ...
TITLE: Java Inner Classes QUESTION: Possible Duplicates: Cannot refer to a non-final variable inside an inner class defined in a different method Why inner classes require “final” outer instance variables [Java]? class MyOuter { private String x = "Outer"; void doStuff(){ final String z = "local variable"; class MyIn...
[ "java" ]
5
3
248
2
0
2011-06-05T22:22:44.097000
2011-06-05T22:32:52.253000
6,246,302
6,246,408
Java - threads + action
I'm new to Java so I have a simple question that I don't know where to start from - I need to write a function that accepts an Action, at a multi-threads program, and only the first thread that enter the function do the action, and all the other threads wait for him to finish, and then return from the function without ...
If you want all threads arriving at a method to wait for the first, then they must synchronize on a common object. It could be the same instance (this) on which the methods are invoked, or it could be any other object (an explicit lock object). If you want to ensure that the first thread is the only one that will perfo...
Java - threads + action I'm new to Java so I have a simple question that I don't know where to start from - I need to write a function that accepts an Action, at a multi-threads program, and only the first thread that enter the function do the action, and all the other threads wait for him to finish, and then return fr...
TITLE: Java - threads + action QUESTION: I'm new to Java so I have a simple question that I don't know where to start from - I need to write a function that accepts an Action, at a multi-threads program, and only the first thread that enter the function do the action, and all the other threads wait for him to finish, ...
[ "java" ]
2
3
1,652
4
0
2011-06-05T22:22:56.780000
2011-06-05T22:46:05.780000
6,246,304
6,246,312
Is there function for displaying text in R window?
Is there function for displaying text in R window? and how to display text written with HTML formating?
See https://www.rdocumentation.org/packages/gplots/topics/textplot As for HTML, I'm not sure how that makes sense--is your R window a web browser?
Is there function for displaying text in R window? Is there function for displaying text in R window? and how to display text written with HTML formating?
TITLE: Is there function for displaying text in R window? QUESTION: Is there function for displaying text in R window? and how to display text written with HTML formating? ANSWER: See https://www.rdocumentation.org/packages/gplots/topics/textplot As for HTML, I'm not sure how that makes sense--is your R window a web ...
[ "r" ]
4
1
10,381
3
0
2011-06-05T22:23:25.867000
2011-06-05T22:24:46.140000
6,246,310
6,246,374
Inline assembly in Haskell
Can I somehow use inline assembly in Haskell (similar to what GCC does for C)? I want to compare my Haskell code to the reference implementation (ASM) and this seems the most straightforward way. I guess I could just call Haskell from C and use GCC inline assembly, but I'm still interested if I can do it the other way ...
There are two ways: Call C via the FFI, and use inline assembly on the C side. Write a CMM fragment that calls C (without the FFI), and uses inlined assembly. Both solutions use inline assembly on the C side. The former is the most idiomatic. Here's an example, from the rdtsc package: cycles.h: static __inline__ ticks ...
Inline assembly in Haskell Can I somehow use inline assembly in Haskell (similar to what GCC does for C)? I want to compare my Haskell code to the reference implementation (ASM) and this seems the most straightforward way. I guess I could just call Haskell from C and use GCC inline assembly, but I'm still interested if...
TITLE: Inline assembly in Haskell QUESTION: Can I somehow use inline assembly in Haskell (similar to what GCC does for C)? I want to compare my Haskell code to the reference implementation (ASM) and this seems the most straightforward way. I guess I could just call Haskell from C and use GCC inline assembly, but I'm s...
[ "haskell", "compiler-construction", "assembly", "inline-assembly", "ghc" ]
13
14
3,345
1
0
2011-06-05T22:24:20
2011-06-05T22:36:54.517000
6,246,315
6,247,520
Binary Data in sqlite database versus Image in Applications Folder or Storing images from internet
I was just thinking what is the best way to keep images in IPhone/iPad (XCODE) application if I'm getting them from internet dynamically. My main concern is if I'm storing it in my database as Binary data, will it decrease my efficiency when creating the queries to database? In that case is it better to store them in A...
Apple dev forums has some good discussion on this. A good post can be found here. General guideline from the post: less than 16kb data blob ok, 100k ok as well, approaching 1MB and it is better to store outside of Core Data or any database. In terms of fetching performance, it will boil down to how you have normalized ...
Binary Data in sqlite database versus Image in Applications Folder or Storing images from internet I was just thinking what is the best way to keep images in IPhone/iPad (XCODE) application if I'm getting them from internet dynamically. My main concern is if I'm storing it in my database as Binary data, will it decreas...
TITLE: Binary Data in sqlite database versus Image in Applications Folder or Storing images from internet QUESTION: I was just thinking what is the best way to keep images in IPhone/iPad (XCODE) application if I'm getting them from internet dynamically. My main concern is if I'm storing it in my database as Binary dat...
[ "xcode", "core-data", "uiimage", "nsdata", "binary-data" ]
0
0
820
1
0
2011-06-05T22:25:25.553000
2011-06-06T03:25:17.547000
6,246,322
6,246,341
how do you find out what android resource is 0x7f040000 in eclipse?
Over the course of programming I get errors that give a resource number like "0x7f040000" (or sometimes in decimal form) My question is simple: Is there an easy way to tell what resource that is in eclipse? i know i could manually identify every resource and print them out, but then every time i make a change to the pr...
YOu look up the R class in the gen folder for example public final class R { public static final class attr { } public static final class drawable { public static final int block=0x7f020000; block is part or the drawables in the R file. if you want to do this at runtime (and not just in the IDE of eclispe you can try g...
how do you find out what android resource is 0x7f040000 in eclipse? Over the course of programming I get errors that give a resource number like "0x7f040000" (or sometimes in decimal form) My question is simple: Is there an easy way to tell what resource that is in eclipse? i know i could manually identify every resour...
TITLE: how do you find out what android resource is 0x7f040000 in eclipse? QUESTION: Over the course of programming I get errors that give a resource number like "0x7f040000" (or sometimes in decimal form) My question is simple: Is there an easy way to tell what resource that is in eclipse? i know i could manually ide...
[ "android", "resources" ]
0
4
1,403
4
0
2011-06-05T22:26:10.757000
2011-06-05T22:29:41.177000
6,246,329
6,253,230
Yii 1.1.7 - cannot find gii page
I want to use Gii in Yii. My protected/config/main.php for my first webapp has this part uncommented, as instructed in the Yii documentation to enable Gii (123.45.67.123 is my public IP address from the computer I am trying to access): 'modules'=>array( // uncomment the following to enable the Gii tool 'gii'=>array( 'c...
Try: http://www.example.org/index.php/gii It seems you have the same rules as I do for url. If http://www.example.org brings you to your main yii webapp page then the above link should work. You were going to http://www.example.org/gii which is incorrect.
Yii 1.1.7 - cannot find gii page I want to use Gii in Yii. My protected/config/main.php for my first webapp has this part uncommented, as instructed in the Yii documentation to enable Gii (123.45.67.123 is my public IP address from the computer I am trying to access): 'modules'=>array( // uncomment the following to ena...
TITLE: Yii 1.1.7 - cannot find gii page QUESTION: I want to use Gii in Yii. My protected/config/main.php for my first webapp has this part uncommented, as instructed in the Yii documentation to enable Gii (123.45.67.123 is my public IP address from the computer I am trying to access): 'modules'=>array( // uncomment th...
[ "php", "url-routing", "yii" ]
6
17
14,114
7
0
2011-06-05T22:27:44.143000
2011-06-06T14:05:26.037000
6,246,330
6,248,137
Maven2 + Eclipse 3.5 web Project Errors
I'm using Maven 2.2 to build Simple Web Project and Integrate it to Eclipse: I'm doing it the following way: 1) Going to my workspace directory using command line: 2) Create Project using the following command: mvn archetype:generate -DgroupId=com.vanilla.test -DartifactId=myTest -DarchetypeArtifactId=maven-archetype-w...
Perhaps you should configure the workspace before converting to Eclipse project. mvn eclipse:configure-workspace -Declipse.workspace=
Maven2 + Eclipse 3.5 web Project Errors I'm using Maven 2.2 to build Simple Web Project and Integrate it to Eclipse: I'm doing it the following way: 1) Going to my workspace directory using command line: 2) Create Project using the following command: mvn archetype:generate -DgroupId=com.vanilla.test -DartifactId=myTest...
TITLE: Maven2 + Eclipse 3.5 web Project Errors QUESTION: I'm using Maven 2.2 to build Simple Web Project and Integrate it to Eclipse: I'm doing it the following way: 1) Going to my workspace directory using command line: 2) Create Project using the following command: mvn archetype:generate -DgroupId=com.vanilla.test -...
[ "eclipse", "maven-2", "jakarta-ee", "maven" ]
2
1
177
1
0
2011-06-05T22:27:51.797000
2011-06-06T05:35:58.800000
6,246,332
6,247,196
JSON viewer for firebug not working properly
in firebug it says the headers are content type: application/json, but I only have headers and response tabs (no json tab) my response is valid json: [{"id":"1","date":"2011-05-21 22:00:00","location":"roppongi","description":"blah","extra":"lbah"}] But why can't I use the json viewer in firebug to see it. It bother's ...
If I understand your question, it works for me in Firebug 1.7.2: For what it's worth, Firebug doesn't require a proper content-type be set for the JSON viewer to kick in.
JSON viewer for firebug not working properly in firebug it says the headers are content type: application/json, but I only have headers and response tabs (no json tab) my response is valid json: [{"id":"1","date":"2011-05-21 22:00:00","location":"roppongi","description":"blah","extra":"lbah"}] But why can't I use the j...
TITLE: JSON viewer for firebug not working properly QUESTION: in firebug it says the headers are content type: application/json, but I only have headers and response tabs (no json tab) my response is valid json: [{"id":"1","date":"2011-05-21 22:00:00","location":"roppongi","description":"blah","extra":"lbah"}] But why...
[ "php", "jquery", "ajax", "json", "firebug" ]
0
0
590
1
0
2011-06-05T22:28:03.440000
2011-06-06T01:56:36.230000
6,246,344
6,246,377
std::transform behavior when iterating past container.end()
Code: static int counter = 0; int add(int x) { counter++; return ++x; } int main() { vector b; b.push_back(1); b.push_back(1); b.push_back(1); transform(b.begin(),b.end(),b.begin()+2,add); for (vector::iterator it = b.begin(); it!= b.end(); it++) cout << (*it) << endl; cout << "counter: " << counter << endl; } For ...
Yes, it's undefined behavior. It's your responsibility to avoid running past the end of the vector, not the compiler's. What do you mean by, " b.end() is not overwritten"? If you mean that you expected the vector to change length, then no, it didn't, you can't change a vector's length this way.
std::transform behavior when iterating past container.end() Code: static int counter = 0; int add(int x) { counter++; return ++x; } int main() { vector b; b.push_back(1); b.push_back(1); b.push_back(1); transform(b.begin(),b.end(),b.begin()+2,add); for (vector::iterator it = b.begin(); it!= b.end(); it++) cout << (...
TITLE: std::transform behavior when iterating past container.end() QUESTION: Code: static int counter = 0; int add(int x) { counter++; return ++x; } int main() { vector b; b.push_back(1); b.push_back(1); b.push_back(1); transform(b.begin(),b.end(),b.begin()+2,add); for (vector::iterator it = b.begin(); it!= b.end(...
[ "c++" ]
1
1
298
2
0
2011-06-05T22:30:10.463000
2011-06-05T22:37:42.807000
6,246,345
6,246,533
Does F# treat parameter matching differently when there is only one input parameter?
The function matching is based on the definition of the file in F#: let f2 x y = x + y let value5 = f2 10 20 let value = f2(10, 20) <-- Error let f3 (x, y) = x + y let value6 = f3(10, 20) let value = f3 10 20 <-- Error However, I can use in both ways with one parameter with F#: let f n = n + 10 let value3 = f 10 let v...
As ashays correctly explains, the two ways of declaring functions are different. You can see that by looking at the type signature. Here is an F# interactive session: > let f1 (x, y) = x + y;; val f1: int * int -> int > let f2 x y = x + y;; val f2: int -> int -> int The first function takes a tuple of type int * int a...
Does F# treat parameter matching differently when there is only one input parameter? The function matching is based on the definition of the file in F#: let f2 x y = x + y let value5 = f2 10 20 let value = f2(10, 20) <-- Error let f3 (x, y) = x + y let value6 = f3(10, 20) let value = f3 10 20 <-- Error However, I can ...
TITLE: Does F# treat parameter matching differently when there is only one input parameter? QUESTION: The function matching is based on the definition of the file in F#: let f2 x y = x + y let value5 = f2 10 20 let value = f2(10, 20) <-- Error let f3 (x, y) = x + y let value6 = f3(10, 20) let value = f3 10 20 <-- Err...
[ "f#", "parameters" ]
2
4
108
2
0
2011-06-05T22:30:13.120000
2011-06-05T23:09:40.087000
6,246,356
6,247,053
Launching R gui from the command line and setting the working directory to the current folder
On a Mac, is there a way to launch the default R gui from the command line, with the working directory set to the current folder?
assuming R.app is in your Applications folder: open -a /Applications/R.app.
Launching R gui from the command line and setting the working directory to the current folder On a Mac, is there a way to launch the default R gui from the command line, with the working directory set to the current folder?
TITLE: Launching R gui from the command line and setting the working directory to the current folder QUESTION: On a Mac, is there a way to launch the default R gui from the command line, with the working directory set to the current folder? ANSWER: assuming R.app is in your Applications folder: open -a /Applications/...
[ "r" ]
6
7
1,143
1
0
2011-06-05T22:32:44.163000
2011-06-06T01:20:00.430000
6,246,360
6,246,395
In Django, how can I use a request to determine its URLconf viewname?
I can get the view function from request.path: from django.core.urlresolvers import resolve view_func, _args, _kwargs = resolve(request.path) However, I need something more. I need to take a list of view names, like ['edit_foo', 'delete_foo'], and find out if the current URL is for one of those. I've come up with a cou...
After writing that long question, I figured it out:/ (posting for whoever else runs into this, by chance). It's quite simple: >>> resolve(request.path).url_name 'edit_foo' I must have been mistaken about the resolve function's usefulness, which is vast.
In Django, how can I use a request to determine its URLconf viewname? I can get the view function from request.path: from django.core.urlresolvers import resolve view_func, _args, _kwargs = resolve(request.path) However, I need something more. I need to take a list of view names, like ['edit_foo', 'delete_foo'], and fi...
TITLE: In Django, how can I use a request to determine its URLconf viewname? QUESTION: I can get the view function from request.path: from django.core.urlresolvers import resolve view_func, _args, _kwargs = resolve(request.path) However, I need something more. I need to take a list of view names, like ['edit_foo', 'de...
[ "python", "django", "django-urls" ]
2
5
1,011
1
0
2011-06-05T22:33:27.673000
2011-06-05T22:42:30.710000
6,246,365
6,258,431
Base class holding a reference to Derived
I'd like to do this: struct Derived; struct Base{ Derived const& m_ref; Base(Derived const& ref): m_ref(ref){} }; struct Derived: Base{ Derived(): Base(*this){} }; But I seem to get unreliable behaviour (when used later on, m_ref points to things that aren't valid Derived). Is it permissible to construct a reference ...
3.8/1 says: The lifetime of an object of type T begins when: — storage with the proper alignment and size for type T is obtained, and — if T is a class type with a non-trivial constructor (12.1), the constructor call has completed. 3.8/5 says: Before the lifetime of an object has started but after the storage which the...
Base class holding a reference to Derived I'd like to do this: struct Derived; struct Base{ Derived const& m_ref; Base(Derived const& ref): m_ref(ref){} }; struct Derived: Base{ Derived(): Base(*this){} }; But I seem to get unreliable behaviour (when used later on, m_ref points to things that aren't valid Derived). I...
TITLE: Base class holding a reference to Derived QUESTION: I'd like to do this: struct Derived; struct Base{ Derived const& m_ref; Base(Derived const& ref): m_ref(ref){} }; struct Derived: Base{ Derived(): Base(*this){} }; But I seem to get unreliable behaviour (when used later on, m_ref points to things that aren't...
[ "c++" ]
5
3
752
5
0
2011-06-05T22:34:35.410000
2011-06-06T21:49:06.463000
6,246,381
6,250,925
Getting localized message from resourceBundle via annotations in Spring Framework
Is it possible to do this? Currently it is done like this: content.Language @Autowired protected MessageSource resource; protected String getMessage(String code, Object[] object, Locale locale) { return resource.getMessage(code, object, locale); } Is there a way for it to be like getting properties via @Value annotati...
The point is that this is really useful only for Unit Testing. In real application, Locale is a runtime information that cannot be hardcoded in the annotation. Locale is decided based on Users locales in Runtime. Btw you can easily implement this by yourself, something like: @Retention(RetentionPolicy.RUNTIME) @Target(...
Getting localized message from resourceBundle via annotations in Spring Framework Is it possible to do this? Currently it is done like this: content.Language @Autowired protected MessageSource resource; protected String getMessage(String code, Object[] object, Locale locale) { return resource.getMessage(code, object, ...
TITLE: Getting localized message from resourceBundle via annotations in Spring Framework QUESTION: Is it possible to do this? Currently it is done like this: content.Language @Autowired protected MessageSource resource; protected String getMessage(String code, Object[] object, Locale locale) { return resource.getMess...
[ "java", "spring", "localization", "annotations", "resourcebundle" ]
15
5
49,289
2
0
2011-06-05T22:38:27.747000
2011-06-06T10:49:22.910000
6,246,382
6,246,400
Unable to refresh jQueryMobile lists using jQueryTemplate
I'm unable to refresh lists in jQueryMobile. $('ul').listview('refresh'); The code above generates the following error: uncaught exception: cannot call methods on listview prior to initialization; attempted to call method 'refresh'
Make sure that you're not calling refresh(); until the DOM is loaded $(document).ready() ensures this. Lists are not initialized until the DOM has finished loading and so you'd be calling refresh on something that is not initialized explaining your error.
Unable to refresh jQueryMobile lists using jQueryTemplate I'm unable to refresh lists in jQueryMobile. $('ul').listview('refresh'); The code above generates the following error: uncaught exception: cannot call methods on listview prior to initialization; attempted to call method 'refresh'
TITLE: Unable to refresh jQueryMobile lists using jQueryTemplate QUESTION: I'm unable to refresh lists in jQueryMobile. $('ul').listview('refresh'); The code above generates the following error: uncaught exception: cannot call methods on listview prior to initialization; attempted to call method 'refresh' ANSWER: Mak...
[ "refresh", "jquery-mobile", "html-lists" ]
0
0
2,303
1
0
2011-06-05T22:38:42.317000
2011-06-05T22:44:00.007000
6,246,384
6,246,566
How to hide the border and background color of the drop-down arrow of a HTML <select> element?
I found that in the center of Mozilla home page, there is a element (drop-down list) whose arrow has no border and background color. While on facebook sign-up page, the drop-down arrow has the windows standard border and background color. I am wondering what makes this difference? I tried to set border to none in CSS, ...
When the border css property of the select element isn't overridden, then it's rendered as native as possible (the mozilla's case). When, on the other hand, the border property is specified, browser tries to render select with a border and sacrifices some native look of it (facebook's case). Or, maybe, it tries to rend...
How to hide the border and background color of the drop-down arrow of a HTML <select> element? I found that in the center of Mozilla home page, there is a element (drop-down list) whose arrow has no border and background color. While on facebook sign-up page, the drop-down arrow has the windows standard border and back...
TITLE: How to hide the border and background color of the drop-down arrow of a HTML <select> element? QUESTION: I found that in the center of Mozilla home page, there is a element (drop-down list) whose arrow has no border and background color. While on facebook sign-up page, the drop-down arrow has the windows standa...
[ "css", "windows", "firefox", "firefox4" ]
2
2
2,428
2
0
2011-06-05T22:39:29.993000
2011-06-05T23:15:27.137000
6,246,406
6,246,457
codeigniter textfield with disappearing default text
I am creating a form using codeigniter, I wanted to know whether there is a way that we can create atext field having a default text and as soon as user clicks on that field the default text disappears. I was wondering whether there is any method in codeigniter that allows us to do this? Thanks Any efforts will be appr...
Important Note: This solution was posted many years ago and is no longer applicable. Please see the edits below for an alternative solution using HTML5. You need jQuery for DOM functionalities. The cool thing about jQuery is that many of the functionalities we see everyday on Web 2.0 sites already have their jQuery plu...
codeigniter textfield with disappearing default text I am creating a form using codeigniter, I wanted to know whether there is a way that we can create atext field having a default text and as soon as user clicks on that field the default text disappears. I was wondering whether there is any method in codeigniter that ...
TITLE: codeigniter textfield with disappearing default text QUESTION: I am creating a form using codeigniter, I wanted to know whether there is a way that we can create atext field having a default text and as soon as user clicks on that field the default text disappears. I was wondering whether there is any method in...
[ "codeigniter" ]
1
2
172
2
0
2011-06-05T22:45:23.797000
2011-06-05T22:55:46.850000
6,246,430
6,246,771
Attaching listeners to body doesn't work?
I can't figure out why this piece of code isn't working: There isn't even any error whatsoever.. it just does nothing. amazingly if I change 'mousedown' to 'keydown' it works (I'm using Chrome btw)
The value of this in listeners attached to the body element behaves a little differently in different browsers. Try the following in Firefox and an older version of IE (note that it's specifically for this case, it isn't meant to be a general "what is this?" function): Some "this" tests this In all browsers, the onload...
Attaching listeners to body doesn't work? I can't figure out why this piece of code isn't working: There isn't even any error whatsoever.. it just does nothing. amazingly if I change 'mousedown' to 'keydown' it works (I'm using Chrome btw)
TITLE: Attaching listeners to body doesn't work? QUESTION: I can't figure out why this piece of code isn't working: There isn't even any error whatsoever.. it just does nothing. amazingly if I change 'mousedown' to 'keydown' it works (I'm using Chrome btw) ANSWER: The value of this in listeners attached to the body e...
[ "javascript", "events", "dom-events", "mouseevent" ]
0
2
2,912
4
0
2011-06-05T22:50:56.483000
2011-06-06T00:01:59.923000
6,246,434
6,246,499
Counting Pi in threads
I have two implementations of counting pi with Monte-Carlo method: with and without threads. Implementation without threads working just fine, but method with threads have problems with accuracy and perfomance. Here is code: Without threads: #include #include #include int main() { srand(time(NULL)); unsigned long N = ...
rand is not thread-safe; simultaneously using it in multiple threads will result in undefined behavior. You can either wrap it with a function that acquires and holds a mutex while calling rand, or you can use rand_r or (better yet) write a decent PRNG to use in its place.
Counting Pi in threads I have two implementations of counting pi with Monte-Carlo method: with and without threads. Implementation without threads working just fine, but method with threads have problems with accuracy and perfomance. Here is code: Without threads: #include #include #include int main() { srand(time(NULL...
TITLE: Counting Pi in threads QUESTION: I have two implementations of counting pi with Monte-Carlo method: with and without threads. Implementation without threads working just fine, but method with threads have problems with accuracy and perfomance. Here is code: Without threads: #include #include #include int main()...
[ "c", "pthreads", "pi" ]
6
11
2,435
3
0
2011-06-05T22:51:45.650000
2011-06-05T23:03:19.177000
6,246,442
6,247,376
Proper HTTP method for updating resource without affecting sub-resources in REST
Let's assume I have two entities - project team and employee. Each employee could be part of multiple teams and each team can have multiple employees as team members. I need to provide REST API to manipulate teams, employees and relationships between them. I have identified 3 resources - team, employee and member (asso...
Looks like PUT is natural choice but semantics of PUT is pretty clear - I have to replace whole resource, which in this case means replacing all members sub-resources as well. I have never heard anyone make this association before. If do PUT /Foo in my opinion it says absolutely nothing about /Foo/bar. Just because res...
Proper HTTP method for updating resource without affecting sub-resources in REST Let's assume I have two entities - project team and employee. Each employee could be part of multiple teams and each team can have multiple employees as team members. I need to provide REST API to manipulate teams, employees and relationsh...
TITLE: Proper HTTP method for updating resource without affecting sub-resources in REST QUESTION: Let's assume I have two entities - project team and employee. Each employee could be part of multiple teams and each team can have multiple employees as team members. I need to provide REST API to manipulate teams, employ...
[ "web-services", "api", "rest" ]
3
5
1,313
3
0
2011-06-05T22:53:54.827000
2011-06-06T02:44:21.093000
6,246,454
6,246,466
rails for zombies lab3 excercise 3, stuck?
The question asks: Use an each block to print the names of all the Zombies. I tried the following code, and it says that the content isn't being rendered. <% zombies = Zombie.all %> <% zombies.each do |zombie| %> <=% zombies.name %> <% end%> Is something wrong with this Rails code?
Your HTML-Structure is messed up: <% zombies.each do |zombie| %> <=% zombies.name %> <% end%> should be <% zombies.each do |zombie| %> <%= zombie.name %> <% end %>
rails for zombies lab3 excercise 3, stuck? The question asks: Use an each block to print the names of all the Zombies. I tried the following code, and it says that the content isn't being rendered. <% zombies = Zombie.all %> <% zombies.each do |zombie| %> <=% zombies.name %> <% end%> Is something wrong with this Rails ...
TITLE: rails for zombies lab3 excercise 3, stuck? QUESTION: The question asks: Use an each block to print the names of all the Zombies. I tried the following code, and it says that the content isn't being rendered. <% zombies = Zombie.all %> <% zombies.each do |zombie| %> <=% zombies.name %> <% end%> Is something wron...
[ "ruby-on-rails", "ruby" ]
1
4
825
3
0
2011-06-05T22:55:15.990000
2011-06-05T22:57:48.363000
6,246,458
6,246,478
Import all classes in directory?
I found this, but that's not quite what I want to do. I want to import all the classes in all the files in a directory. Basically, I want to replace this: from A import * from B import * from C import * With something dynamic, so that I don't have keep editing my __init__.py every time I add another file. The glob solu...
You can do something like this, although keep in mind isinstance(cls, type) only works with new-style classes. import os, sys path = os.path.dirname(os.path.abspath(__file__)) for py in [f[:-3] for f in os.listdir(path) if f.endswith('.py') and f!= '__init__.py']: mod = __import__('.'.join([__name__, py]), fromlist=[...
Import all classes in directory? I found this, but that's not quite what I want to do. I want to import all the classes in all the files in a directory. Basically, I want to replace this: from A import * from B import * from C import * With something dynamic, so that I don't have keep editing my __init__.py every time ...
TITLE: Import all classes in directory? QUESTION: I found this, but that's not quite what I want to do. I want to import all the classes in all the files in a directory. Basically, I want to replace this: from A import * from B import * from C import * With something dynamic, so that I don't have keep editing my __ini...
[ "python" ]
14
15
23,557
2
0
2011-06-05T22:56:08.307000
2011-06-05T22:59:25.573000
6,246,469
6,246,507
MySQL Num Rows Warning in if statement?
I am getting the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in.... on line.. Please can you tell me what I am doing wrong to cause this. I don't believe that I am. if (mysql_num_rows(mysql_query("SELECT * FROM Likes WHERE `postID` = '$postID' AND `userID` = '$accountID'")) ...
you can also simplify your sql by selecting the count directly from the database, which is more efficient then selecting all the rows, and then calculating the count $res = mysql_query("SELECT COUNT(*) FROM Likes WHERE `postID` = '$postID' AND `userID` = '$accountID'"); // check for mysql errors if (mysql_error()) { d...
MySQL Num Rows Warning in if statement? I am getting the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in.... on line.. Please can you tell me what I am doing wrong to cause this. I don't believe that I am. if (mysql_num_rows(mysql_query("SELECT * FROM Likes WHERE `postID` = '...
TITLE: MySQL Num Rows Warning in if statement? QUESTION: I am getting the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in.... on line.. Please can you tell me what I am doing wrong to cause this. I don't believe that I am. if (mysql_num_rows(mysql_query("SELECT * FROM Likes ...
[ "php", "mysql" ]
0
2
320
4
0
2011-06-05T22:58:02.497000
2011-06-05T23:04:35.203000
6,246,471
6,246,586
How to read tcp packets, which have been redirected to localhost?
I use iptables (PREROUTING) to redirect all TCP Traffic to a local port. Now I want to capture these packets using a C program. I tried lots of socket variations (UDP / TCP /...) but I cannot make a connection to localhost using the port I specified in iptables. I can see all the packets being redirected, but how can I...
You could just use libpcap which will capture any traffic occurring on the ethernet device, and then just filter out what you want/need. You cant make a connection to a port if there is no service listening on it, even with DNAT. You need to explain exactly what your trying to accomplish, explain your network setup and...
How to read tcp packets, which have been redirected to localhost? I use iptables (PREROUTING) to redirect all TCP Traffic to a local port. Now I want to capture these packets using a C program. I tried lots of socket variations (UDP / TCP /...) but I cannot make a connection to localhost using the port I specified in i...
TITLE: How to read tcp packets, which have been redirected to localhost? QUESTION: I use iptables (PREROUTING) to redirect all TCP Traffic to a local port. Now I want to capture these packets using a C program. I tried lots of socket variations (UDP / TCP /...) but I cannot make a connection to localhost using the por...
[ "linux", "sockets", "network-programming", "iptables" ]
2
1
874
2
0
2011-06-05T22:58:23.773000
2011-06-05T23:19:50.270000