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,185,807
6,186,161
Display all sub category product when click main category in magento?
Display all sub category product when click main category in magento. like Sub category name(subcategory 1) product 1 of sub category 1 product 2 of sub category 1 product3 of sub category 1 Sub category 2 product 1 of sub category 2 product 2 of sub category 2
Get Sub Categories:- $this->getCurrentCategory()->getChildrenCategories() Change in: template/catalog/category/view.phtml Get products of sub-categories: Get Sub Categories and Products Hope it helps.
Display all sub category product when click main category in magento? Display all sub category product when click main category in magento. like Sub category name(subcategory 1) product 1 of sub category 1 product 2 of sub category 1 product3 of sub category 1 Sub category 2 product 1 of sub category 2 product 2 of s...
TITLE: Display all sub category product when click main category in magento? QUESTION: Display all sub category product when click main category in magento. like Sub category name(subcategory 1) product 1 of sub category 1 product 2 of sub category 1 product3 of sub category 1 Sub category 2 product 1 of sub categor...
[ "magento" ]
2
5
8,572
2
0
2011-05-31T09:51:41.443000
2011-05-31T10:24:51.427000
6,185,808
6,185,835
Get all methods of an Interface or Abstract class using Reflection
How can I use reflection on an interface/abstract class to get all of its methods?
E.g., MyInterfaceOrAbstractClass.class.getDeclaredMethods();
Get all methods of an Interface or Abstract class using Reflection How can I use reflection on an interface/abstract class to get all of its methods?
TITLE: Get all methods of an Interface or Abstract class using Reflection QUESTION: How can I use reflection on an interface/abstract class to get all of its methods? ANSWER: E.g., MyInterfaceOrAbstractClass.class.getDeclaredMethods();
[ "java", "reflection" ]
9
18
16,548
2
0
2011-05-31T09:51:45.670000
2011-05-31T09:53:53.483000
6,185,815
6,187,725
Regex but maintain font formatting?
Previously I asked for help with a word VBA macro regex. Is there a way to maintain font formatting when doing this?
Not very elegant, but is this not what you want (or do you mean that you want to replace the entire contents with a single '0')? Sub Macro1() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find.Text = "^$*".Replacement.Text = "0".Forward = True.Wrap = wdFindContinue.Format = Fa...
Regex but maintain font formatting? Previously I asked for help with a word VBA macro regex. Is there a way to maintain font formatting when doing this?
TITLE: Regex but maintain font formatting? QUESTION: Previously I asked for help with a word VBA macro regex. Is there a way to maintain font formatting when doing this? ANSWER: Not very elegant, but is this not what you want (or do you mean that you want to replace the entire contents with a single '0')? Sub Macro1(...
[ "regex", "vba", "ms-word" ]
0
1
909
1
0
2011-05-31T09:52:20.367000
2011-05-31T12:41:58.747000
6,185,829
6,188,173
How to disable automatic ModelState Validation for a specific Controller / Action?
As the title mentioned, i want to disable automatic ModelState Validation for a specific Controller / Action. Is that possible?
I think it is possible. Create custom ModelValidatorProvider. public class CustomModelValidatorProvider: DataAnnotationsModelValidatorProvider { protected override IEnumerable GetValidators( ModelMetadata metadata, ControllerContext context, IEnumerable attributes) { return Enumerable.Empty (); } } and set this provide...
How to disable automatic ModelState Validation for a specific Controller / Action? As the title mentioned, i want to disable automatic ModelState Validation for a specific Controller / Action. Is that possible?
TITLE: How to disable automatic ModelState Validation for a specific Controller / Action? QUESTION: As the title mentioned, i want to disable automatic ModelState Validation for a specific Controller / Action. Is that possible? ANSWER: I think it is possible. Create custom ModelValidatorProvider. public class CustomM...
[ "asp.net-mvc", "asp.net-mvc-3" ]
6
2
2,080
2
0
2011-05-31T09:53:14.670000
2011-05-31T13:15:33.203000
6,185,840
6,185,893
issue including external js scripts in php
so please take into account I am a newbie. I currently use the following script throughout my pages to display the time: var currenttime = ' ' //PHP method of getting server date var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") var s...
You have to serve the JavaScript file through PHP otherwise will not be parsed. It might be as simple as setting.php as file suffix (instead of.js ) and adding at the top.
issue including external js scripts in php so please take into account I am a newbie. I currently use the following script throughout my pages to display the time: var currenttime = ' ' //PHP method of getting server date var montharray=new Array("January","February","March","April","May","June","July","August","Septem...
TITLE: issue including external js scripts in php QUESTION: so please take into account I am a newbie. I currently use the following script throughout my pages to display the time: var currenttime = ' ' //PHP method of getting server date var montharray=new Array("January","February","March","April","May","June","July...
[ "php", "javascript" ]
0
1
126
2
0
2011-05-31T09:54:03.177000
2011-05-31T09:58:23.170000
6,185,846
6,185,895
Double value validation in objective c
Possible Duplicates: How to check if NSString is numeric or not iphone how to check that a string is numeric only I would like to validate a UITextField input. I want that the input must be a double, and I want to detect if there are any strange characters as "()? etc. Is there an easy way to detect that the input is a...
I think you must validate " amount " string value before casting it to double, for example you can check if it contains ". " or something else... Or you do conversation in try catch and if your string will contain "(" or "()" or... it will catch exception.
Double value validation in objective c Possible Duplicates: How to check if NSString is numeric or not iphone how to check that a string is numeric only I would like to validate a UITextField input. I want that the input must be a double, and I want to detect if there are any strange characters as "()? etc. Is there an...
TITLE: Double value validation in objective c QUESTION: Possible Duplicates: How to check if NSString is numeric or not iphone how to check that a string is numeric only I would like to validate a UITextField input. I want that the input must be a double, and I want to detect if there are any strange characters as "()...
[ "objective-c", "cocoa-touch" ]
1
1
1,037
2
0
2011-05-31T09:54:36.967000
2011-05-31T09:58:37.680000
6,185,847
6,189,837
Correct llvm target triple for iPhone simulator
I have written a small piece of code to generate an LLVM module containing a few global variables. I am converting the module to LLVM assembly code using the LLVM assembler and then to native binary before linking it to other libraries to produce the final binary which is an iPhone app. Everything work fine when I buil...
Looks like you're feeding the arm assembler code the i386 assembler (".syntax unified" is ARM-only thing). So, yes, you should generate the code for x86. Most probably - for i386-apple-darwin10. Not sure about the simulator though.
Correct llvm target triple for iPhone simulator I have written a small piece of code to generate an LLVM module containing a few global variables. I am converting the module to LLVM assembly code using the LLVM assembler and then to native binary before linking it to other libraries to produce the final binary which is...
TITLE: Correct llvm target triple for iPhone simulator QUESTION: I have written a small piece of code to generate an LLVM module containing a few global variables. I am converting the module to LLVM assembly code using the LLVM assembler and then to native binary before linking it to other libraries to produce the fin...
[ "iphone", "code-generation", "llvm" ]
2
2
1,306
1
0
2011-05-31T09:54:37.417000
2011-05-31T15:22:19.290000
6,185,878
6,291,510
Double colons in function declaration in Javascript?
Today I found this code snippet: … I can't find anything relevant to explain this syntax. Is it really javascript? Is it correct? If not, how the code should look like? This is a single page without external script links. Note that function declarations are directly inside
Thanks for everyone who looked into this. Anyway, just as one could expect, not after five minutes after submitting the question, I found How to handle an ActiveX event in Javascript question about ActiveX callback handlers in IE, so it answers the main part of the question. As well, as the question that @outis has lin...
Double colons in function declaration in Javascript? Today I found this code snippet: … I can't find anything relevant to explain this syntax. Is it really javascript? Is it correct? If not, how the code should look like? This is a single page without external script links. Note that function declarations are directly ...
TITLE: Double colons in function declaration in Javascript? QUESTION: Today I found this code snippet: … I can't find anything relevant to explain this syntax. Is it really javascript? Is it correct? If not, how the code should look like? This is a single page without external script links. Note that function declarat...
[ "javascript", "html", "activex" ]
5
4
2,065
1
0
2011-05-31T09:56:54.753000
2011-06-09T10:39:28.397000
6,185,882
6,186,406
Is there a browser on android accepting extensions?
I know how to make java programs on android, and I've yet included Browsers in my programs, but I'm more looking for the kind of extension system (with code in javascript) that we have on our desktop versions of Firefox and Chrome. Is there something similar on Android? My goal would be to port one of my Chrome extensi...
You can try Firefox for Android. You can write extensions for it.
Is there a browser on android accepting extensions? I know how to make java programs on android, and I've yet included Browsers in my programs, but I'm more looking for the kind of extension system (with code in javascript) that we have on our desktop versions of Firefox and Chrome. Is there something similar on Androi...
TITLE: Is there a browser on android accepting extensions? QUESTION: I know how to make java programs on android, and I've yet included Browsers in my programs, but I'm more looking for the kind of extension system (with code in javascript) that we have on our desktop versions of Firefox and Chrome. Is there something...
[ "android" ]
14
8
24,354
8
0
2011-05-31T09:57:28.867000
2011-05-31T10:46:21.230000
6,185,884
6,186,125
Stopping Anchors from Scrolling to the Top!
I'm trying to build a website where all the 'pages' are in a single document. Each 'page' is an anchored section, so when I call it from the main navigation which is placed at the top of the site, the section slides into view. But I have two issues: 1) when I link from outside the site, I want to be able to link to any...
Are you willing to use jQuery? If so, maybe this snippet can help: $(function() { // assigns click action for the a's $('#topnav a').click(function(e) { // prevent default behavior so clicking the won't go up e.preventDefault(); // get the anchor in the and change the window hash // e.g. http://site.com/#link4 window.l...
Stopping Anchors from Scrolling to the Top! I'm trying to build a website where all the 'pages' are in a single document. Each 'page' is an anchored section, so when I call it from the main navigation which is placed at the top of the site, the section slides into view. But I have two issues: 1) when I link from outsid...
TITLE: Stopping Anchors from Scrolling to the Top! QUESTION: I'm trying to build a website where all the 'pages' are in a single document. Each 'page' is an anchored section, so when I call it from the main navigation which is placed at the top of the site, the section slides into view. But I have two issues: 1) when ...
[ "javascript", "scroll", "anchor" ]
0
0
1,437
2
0
2011-05-31T09:57:54.620000
2011-05-31T10:20:55.447000
6,185,889
6,186,285
adb unable to show / open / connect database
I try to use adb to query my sqlite3 db. I use this db with my app on emulator without any problems, but I'm not able to query it from the adb shell. I have read a lot here and on Android developer guide to understand my problem/error but I have not solved anything. Here's a trace of what happens when I try to query th...
adb doesn't have permission to look inside /data on the phone. The emulator doesn't have this restriction. It's part of the security model that prevents people from accessing data belonging to third-party applications. There are two ways to get around this: the official way is to set your application as debuggable (by ...
adb unable to show / open / connect database I try to use adb to query my sqlite3 db. I use this db with my app on emulator without any problems, but I'm not able to query it from the adb shell. I have read a lot here and on Android developer guide to understand my problem/error but I have not solved anything. Here's a...
TITLE: adb unable to show / open / connect database QUESTION: I try to use adb to query my sqlite3 db. I use this db with my app on emulator without any problems, but I'm not able to query it from the adb shell. I have read a lot here and on Android developer guide to understand my problem/error but I have not solved ...
[ "android", "adb" ]
0
2
5,917
4
0
2011-05-31T09:58:02.887000
2011-05-31T10:35:32.263000
6,185,898
6,186,165
HttpWebRequest keeps socket in TIME WAIT
I'm having a hard time figuring out while a HttpWebRequest in.NET 4.0 creates a socket connection for each request but isn't able to close the socket afterwards. When I execute e.g 50 HttpWebRequests I see 50 TCP socket connections in the WAIT state in netstat. I already reduced the code to a minimum: Dim webReq As Htt...
Do you mean 'TIME_WAIT'? If so, do your 50 requests, go for a coffee, come back to your box, recheck with netstat. Closing a TCP socket performs the terminate handshake and queues the socket object for release. The socket is not actually released for some minutes by TCP design - some packets may still be on their way b...
HttpWebRequest keeps socket in TIME WAIT I'm having a hard time figuring out while a HttpWebRequest in.NET 4.0 creates a socket connection for each request but isn't able to close the socket afterwards. When I execute e.g 50 HttpWebRequests I see 50 TCP socket connections in the WAIT state in netstat. I already reduced...
TITLE: HttpWebRequest keeps socket in TIME WAIT QUESTION: I'm having a hard time figuring out while a HttpWebRequest in.NET 4.0 creates a socket connection for each request but isn't able to close the socket afterwards. When I execute e.g 50 HttpWebRequests I see 50 TCP socket connections in the WAIT state in netstat....
[ ".net", "vb.net", "httpwebrequest" ]
1
0
3,738
2
0
2011-05-31T09:58:49.613000
2011-05-31T10:25:03.640000
6,185,904
6,185,928
getting "xxx is not a function" in JS
here's a little code I try to run on Firefox: Ex4: My Sequence Finder Input section Query Sequence As you can see one of the button calls searchInput() and that works fine, the other is supposed to call action(), but I get "action() is not a function". Btw they both just call alert() at this point, so I know it got in ...
Form elements have an action attribute (specifying the URI that should process the form data). This attribute name "overrides" the javascript function name, causing the error you see. Rename your function to something else and it will work.
getting "xxx is not a function" in JS here's a little code I try to run on Firefox: Ex4: My Sequence Finder Input section Query Sequence As you can see one of the button calls searchInput() and that works fine, the other is supposed to call action(), but I get "action() is not a function". Btw they both just call alert...
TITLE: getting "xxx is not a function" in JS QUESTION: here's a little code I try to run on Firefox: Ex4: My Sequence Finder Input section Query Sequence As you can see one of the button calls searchInput() and that works fine, the other is supposed to call action(), but I get "action() is not a function". Btw they bo...
[ "javascript", "html" ]
1
2
283
3
0
2011-05-31T09:59:23.187000
2011-05-31T10:01:33.230000
6,185,907
6,185,946
Create an object via reflection from a satellite assembly
I have two assemblies / projects with DLL as output: Models and Logic Inside the Logic DLL I want to create an object of a specific model via reflection (The project is referenced and I am able to manually create an instance) MyNameSpace.Models.Foo foo = new MyNameSpace.Models.Foo(); // works Type type = Type.GetType("...
You could look at using Activator.CreateInstance. For example: Assembly assembly = Assembly.LoadFrom("Foo.dll"); Type type = assembly.GetType("TheNamspace.TheType"); object instanceOfMyType = Activator.CreateInstance(type);
Create an object via reflection from a satellite assembly I have two assemblies / projects with DLL as output: Models and Logic Inside the Logic DLL I want to create an object of a specific model via reflection (The project is referenced and I am able to manually create an instance) MyNameSpace.Models.Foo foo = new MyN...
TITLE: Create an object via reflection from a satellite assembly QUESTION: I have two assemblies / projects with DLL as output: Models and Logic Inside the Logic DLL I want to create an object of a specific model via reflection (The project is referenced and I am able to manually create an instance) MyNameSpace.Models...
[ "c#", "asp.net", "reflection" ]
1
1
953
3
0
2011-05-31T09:59:33.357000
2011-05-31T10:03:10.547000
6,185,927
6,185,965
How can I learn how many days passed from a specific date?
How can I learn how many days passed from a spesific date? Which package i need to use and how?
EDIT My previous answer was only valid within a year. You can use the milliseconds difference like this: Date date1 = // some date Date date2 = // some other date long difference = date2.getTime() - date1.getTime(); long differenceDays = difference / (1000 * 60 * 60 * 24); Basically the same as timbooo answered, just a...
How can I learn how many days passed from a specific date? How can I learn how many days passed from a spesific date? Which package i need to use and how?
TITLE: How can I learn how many days passed from a specific date? QUESTION: How can I learn how many days passed from a spesific date? Which package i need to use and how? ANSWER: EDIT My previous answer was only valid within a year. You can use the milliseconds difference like this: Date date1 = // some date Date da...
[ "java" ]
6
4
5,158
5
0
2011-05-31T10:01:29.410000
2011-05-31T10:05:17.633000
6,185,932
6,186,683
Sliding Frame effect in Java Swing
Is there already workable example of a swing component which allows adding boxes/panels and then animate them to produce a sliding frame effect? What I am looking for is a simple component. It should have something like circle buttons at the bottom which when clicked will slide the view to the right place. Thanks.
Have a look at Animated Transitions. It is a library explained in Chet Haase & Romain Guy's Filthy Rich Clients book. BSD licensed sources are available here.
Sliding Frame effect in Java Swing Is there already workable example of a swing component which allows adding boxes/panels and then animate them to produce a sliding frame effect? What I am looking for is a simple component. It should have something like circle buttons at the bottom which when clicked will slide the vi...
TITLE: Sliding Frame effect in Java Swing QUESTION: Is there already workable example of a swing component which allows adding boxes/panels and then animate them to produce a sliding frame effect? What I am looking for is a simple component. It should have something like circle buttons at the bottom which when clicked...
[ "java", "swing", "effect" ]
4
4
3,844
2
0
2011-05-31T10:02:04.067000
2011-05-31T11:10:30.393000
6,185,945
6,186,059
Execute iconv inside java application
I want to convert a big csv file from gb2312 encoding to UTF-8 encoding. Here is the code I used: Process process = Runtime.getRuntime().exec( String.format("iconv -c -f %1$s -t %2$s %3$s > %4$s", sourceEncoding, targetEncoding, source, target)); process.waitFor(); The problem is the proccess.waitFor() method never end...
The redirection sign ( > ) is shell/cmd feature, not java, you cannot use it when executing a process from java. You can grab the OutputStream of the process ( InputStream is = process.getInputStream() ) and save it to file.
Execute iconv inside java application I want to convert a big csv file from gb2312 encoding to UTF-8 encoding. Here is the code I used: Process process = Runtime.getRuntime().exec( String.format("iconv -c -f %1$s -t %2$s %3$s > %4$s", sourceEncoding, targetEncoding, source, target)); process.waitFor(); The problem is t...
TITLE: Execute iconv inside java application QUESTION: I want to convert a big csv file from gb2312 encoding to UTF-8 encoding. Here is the code I used: Process process = Runtime.getRuntime().exec( String.format("iconv -c -f %1$s -t %2$s %3$s > %4$s", sourceEncoding, targetEncoding, source, target)); process.waitFor()...
[ "java", "iconv" ]
1
2
2,219
2
0
2011-05-31T10:03:04.417000
2011-05-31T10:14:01.057000
6,185,947
6,186,101
How would one go about unit testing javascript?
What is the recommended way of unit testing javascript and jQuery? What frameworks? Does the framework integrate with build tools? (CI, maven and such) Please share your experiences in this field.
I'm using this: jQuery QUnit jQuery unit testing library Samples for QUnit Manual to start Maven plugin Also, can check this solution (found in my bookmarks): js-test-driver
How would one go about unit testing javascript? What is the recommended way of unit testing javascript and jQuery? What frameworks? Does the framework integrate with build tools? (CI, maven and such) Please share your experiences in this field.
TITLE: How would one go about unit testing javascript? QUESTION: What is the recommended way of unit testing javascript and jQuery? What frameworks? Does the framework integrate with build tools? (CI, maven and such) Please share your experiences in this field. ANSWER: I'm using this: jQuery QUnit jQuery unit testing...
[ "javascript", "jquery", "unit-testing" ]
1
2
126
2
0
2011-05-31T10:03:12.480000
2011-05-31T10:18:16.087000
6,185,957
6,186,019
Rethrowing exceptions
Why doesn't the following doesn't handle the exception that was rethrown? I tried all the combinations but none of them would show the output in last catch so I'm confused! Derived D; try { throw D; } catch ( const Derived &d) { throw; } catch (const Base &b) { cout << "caught!" << endl; } Derived D; try { throw D; }...
The re-throw is not handled by the same try-catch block. It's thrown up to the calling scope. In [except.throw] (2003 wording): A throw-expression with no operand rethrows the exception being handled. and: When an exception is thrown, control is transferred to the nearest handler with a matching type (15.3); “nearest” ...
Rethrowing exceptions Why doesn't the following doesn't handle the exception that was rethrown? I tried all the combinations but none of them would show the output in last catch so I'm confused! Derived D; try { throw D; } catch ( const Derived &d) { throw; } catch (const Base &b) { cout << "caught!" << endl; } Derive...
TITLE: Rethrowing exceptions QUESTION: Why doesn't the following doesn't handle the exception that was rethrown? I tried all the combinations but none of them would show the output in last catch so I'm confused! Derived D; try { throw D; } catch ( const Derived &d) { throw; } catch (const Base &b) { cout << "caught!"...
[ "c++", "exception" ]
15
19
31,396
3
0
2011-05-31T10:04:20.623000
2011-05-31T10:10:25.323000
6,185,966
6,186,006
Converting a Date object to a calendar object
So I get a date attribute from an incoming object in the form: Tue May 24 05:05:16 EDT 2011 I am writing a simple helper method to convert it to a calendar method, I was using the following code: public static Calendar DateToCalendar(Date date ) { Calendar cal = null; try { DateFormat formatter = new SimpleDateFormat("...
Here's your method: public static Calendar toCalendar(Date date){ Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } Everything else you are doing is both wrong and unnecessary. BTW, Java Naming conventions suggest that method names start with a lower case letter, so it should be: dateToCalendar or...
Converting a Date object to a calendar object So I get a date attribute from an incoming object in the form: Tue May 24 05:05:16 EDT 2011 I am writing a simple helper method to convert it to a calendar method, I was using the following code: public static Calendar DateToCalendar(Date date ) { Calendar cal = null; try {...
TITLE: Converting a Date object to a calendar object QUESTION: So I get a date attribute from an incoming object in the form: Tue May 24 05:05:16 EDT 2011 I am writing a simple helper method to convert it to a calendar method, I was using the following code: public static Calendar DateToCalendar(Date date ) { Calendar...
[ "java", "date", "calendar", "nullpointerexception" ]
228
522
403,550
3
0
2011-05-31T10:05:17.727000
2011-05-31T10:09:33.597000
6,185,975
6,186,210
Prevent user process from being killed with "End Process" from Process Explorer
I noticed that GoogleToolbarNotifier.exe cannot be killed from Process Explorer. It returns "Access Denied". It runs as the user, it runs "Normal" priority, and it runs from Program Files. How did they do it? I think there might be a way to modify the ACL, or mark the process as 'critical', but I cannot seem to locate ...
When running my copy of that has Deny set on the Terminate permission (Process Explorer shows this). Presumably they call SetKernelObjectSecurity to change/remove the ACLs when their process loads.
Prevent user process from being killed with "End Process" from Process Explorer I noticed that GoogleToolbarNotifier.exe cannot be killed from Process Explorer. It returns "Access Denied". It runs as the user, it runs "Normal" priority, and it runs from Program Files. How did they do it? I think there might be a way to...
TITLE: Prevent user process from being killed with "End Process" from Process Explorer QUESTION: I noticed that GoogleToolbarNotifier.exe cannot be killed from Process Explorer. It returns "Access Denied". It runs as the user, it runs "Normal" priority, and it runs from Program Files. How did they do it? I think there...
[ "c++", "windows", "process" ]
17
9
18,856
3
0
2011-05-31T10:06:06.717000
2011-05-31T10:27:37.350000
6,185,987
6,186,039
Howto build a SQL statement with using IDs that might not be available in the table?
Using Microsoft SQL Server 2008, let's say there is a table1 that keeps the selected ids of provinces, districts, communes and villages. And then there is table2 with the ids and names of provinces, districts, communes and villages. Provinces and districts are required fields and will always be filled. Communes and vil...
An OUTER JOIN won't work here, because you don't want to have all elements from table2, but only those where a corresponding element exists in table 1. You would want to do something like this: SELECT tbl1.province, tbl1.district, tbl1.commune, tbl1.village FROM dbo.table2 AS tbl2 INNER JOIN dbo.table1 AS tbl1 ON tbl1....
Howto build a SQL statement with using IDs that might not be available in the table? Using Microsoft SQL Server 2008, let's say there is a table1 that keeps the selected ids of provinces, districts, communes and villages. And then there is table2 with the ids and names of provinces, districts, communes and villages. Pr...
TITLE: Howto build a SQL statement with using IDs that might not be available in the table? QUESTION: Using Microsoft SQL Server 2008, let's say there is a table1 that keeps the selected ids of provinces, districts, communes and villages. And then there is table2 with the ids and names of provinces, districts, commune...
[ "sql", "sql-server", "t-sql", "sql-server-2008", "dynamic-sql" ]
3
4
129
1
0
2011-05-31T10:07:01.650000
2011-05-31T10:12:23.537000
6,185,992
6,186,102
preventDefault in Safari
I have a textbox which has the code; Now there is no encloding form tag on this page.. When user types in this textbox and presses Enter, the table on this page is updated (via AJAX call) In Safari, the behavior is slightly different in the sense that even though it updates the table correctly, it kind of reloads the p...
Just to be sure, terminate your callback function with a return false. That should do the trick. function(e) { e.preventDefault(); // some awesome code return false; } Oh, and another thing: in the future, to avoid such random behavior.. respect the standards, use a form:)
preventDefault in Safari I have a textbox which has the code; Now there is no encloding form tag on this page.. When user types in this textbox and presses Enter, the table on this page is updated (via AJAX call) In Safari, the behavior is slightly different in the sense that even though it updates the table correctly,...
TITLE: preventDefault in Safari QUESTION: I have a textbox which has the code; Now there is no encloding form tag on this page.. When user types in this textbox and presses Enter, the table on this page is updated (via AJAX call) In Safari, the behavior is slightly different in the sense that even though it updates th...
[ "javascript", "jquery", "html", "safari", "webkit" ]
1
6
14,376
3
0
2011-05-31T10:07:37.383000
2011-05-31T10:18:19.853000
6,185,993
6,186,227
How to load and run different xib file from main.xib in iphone
I have one MainWindow.xib file. I have one label and one button on first MainWindow.xib file screen. I have secondview.xib file, i want to load secondview.xib file if user will click on main screen button. I have written a method to load Secondview by the following code.. self.second=[[[SecondWindow alloc]initWithNibNa...
Try this code: self.second=[[[SecondWindow alloc]initWithNibName:@" HarbourFront" bundle:nil]autorelease]; [self.navigationController pushViewController:self.second animated:YES]; Hope it helps you....
How to load and run different xib file from main.xib in iphone I have one MainWindow.xib file. I have one label and one button on first MainWindow.xib file screen. I have secondview.xib file, i want to load secondview.xib file if user will click on main screen button. I have written a method to load Secondview by the f...
TITLE: How to load and run different xib file from main.xib in iphone QUESTION: I have one MainWindow.xib file. I have one label and one button on first MainWindow.xib file screen. I have secondview.xib file, i want to load secondview.xib file if user will click on main screen button. I have written a method to load S...
[ "iphone", "uiviewcontroller" ]
0
1
1,193
2
0
2011-05-31T10:07:40.153000
2011-05-31T10:28:51.187000
6,185,994
6,186,687
Unix find: list of files from stdin
I'm working in Linux & bash (or Cygwin & bash). I have a huge-- huge --directory structure, and I have to find a few needles in the haystack. Specifically, I'm looking for these files (20 or so): foo.c bar.h... quux.txt I know that they are in a subdirectory somewhere under.. I know I can find any one of them with find...
If your directory structure is huge but not changing frequently, it is good to run cd /to/root/of/the/files find. -type f -print >../LIST_OF_FILES.txt #and sometimes handy the next one too find. -type d -print >../LIST_OF_DIRS.txt after it you can really FAST find anything (with grep, sed, etc..) and update the file-li...
Unix find: list of files from stdin I'm working in Linux & bash (or Cygwin & bash). I have a huge-- huge --directory structure, and I have to find a few needles in the haystack. Specifically, I'm looking for these files (20 or so): foo.c bar.h... quux.txt I know that they are in a subdirectory somewhere under.. I know ...
TITLE: Unix find: list of files from stdin QUESTION: I'm working in Linux & bash (or Cygwin & bash). I have a huge-- huge --directory structure, and I have to find a few needles in the haystack. Specifically, I'm looking for these files (20 or so): foo.c bar.h... quux.txt I know that they are in a subdirectory somewhe...
[ "bash", "unix", "find" ]
14
12
15,506
5
0
2011-05-31T10:07:49.423000
2011-05-31T11:10:48.247000
6,186,008
6,191,655
ASP.NET MVC IgnoreRoute method doesn't work correctly when URL starts with "/Views/"
I use ASP.NET MVC in my application. Users can specify their own images, styles, scripts by including them on the page. But when they specify URL to the file which not exists then routing mechanism tries to find controller and action by URL to image or styles etc. I've added a method IgnoreRoute and specified there all...
MVC by default will not allow you to directly address items under the /Views folder because of the mapping of all file types to the System.Web.HttpNotFoundHandler. To get around this change your definition in your /Views/web.config to tell it to ignore basically everything else in that location I wrote up a blog entry ...
ASP.NET MVC IgnoreRoute method doesn't work correctly when URL starts with "/Views/" I use ASP.NET MVC in my application. Users can specify their own images, styles, scripts by including them on the page. But when they specify URL to the file which not exists then routing mechanism tries to find controller and action b...
TITLE: ASP.NET MVC IgnoreRoute method doesn't work correctly when URL starts with "/Views/" QUESTION: I use ASP.NET MVC in my application. Users can specify their own images, styles, scripts by including them on the page. But when they specify URL to the file which not exists then routing mechanism tries to find contr...
[ "asp.net-mvc", "asp.net-mvc-routing", "ignoreroute" ]
1
3
3,782
2
0
2011-05-31T10:09:39.907000
2011-05-31T18:09:31.477000
6,186,011
6,186,111
How to draw a stroke in a Bitmap using canvas?
I need to round the corners of a Bitmap. After that, I need to add a border for it. I have done the source below to round the corners but I don't know how to draw a border in the Bitmap using Canvas. Is there any way to do it? Thanks Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB...
try this Method and pass bitmap it will return bitmap with border with angle: Bitmap rotateAndFrame(Bitmap bitmap,float angle) { // final boolean positive = sRandom.nextFloat() >= 0.5f; // final float angle = (ROTATION_ANGLE_MIN + sRandom.nextFloat() * // ROTATION_ANGLE_EXTRA) * (positive? 1.0f: -1.0f); final double ra...
How to draw a stroke in a Bitmap using canvas? I need to round the corners of a Bitmap. After that, I need to add a border for it. I have done the source below to round the corners but I don't know how to draw a border in the Bitmap using Canvas. Is there any way to do it? Thanks Bitmap output = Bitmap.createBitmap(bit...
TITLE: How to draw a stroke in a Bitmap using canvas? QUESTION: I need to round the corners of a Bitmap. After that, I need to add a border for it. I have done the source below to round the corners but I don't know how to draw a border in the Bitmap using Canvas. Is there any way to do it? Thanks Bitmap output = Bitma...
[ "android", "android-canvas", "android-bitmap" ]
0
2
7,891
1
0
2011-05-31T10:09:48.967000
2011-05-31T10:19:14.433000
6,186,012
6,186,951
wxPython SetMinSize problem
Having problems setting the SetMinSize in wxPython. Can someone please help me getting this window not getting any smaller than it is in the startup? And/or making the window not allowing resize? I tried self.SetMinSize(GetSize()) after self.SetSizerAndFit(SizerH) in the MainPanel class. Did not work. I've looked and s...
Fix: ###---- SHOW THE WINDOW self.Show(True) self.SetMinSize(self.GetSize()) General comments: The code is not bad. Just a few comments: use object properties for the widgets, so you do not loose track of them ( self.ChooseRoot =... ) use more desriptive widget names ( self.labelChooseRoot ) drop IDs, when not needed, ...
wxPython SetMinSize problem Having problems setting the SetMinSize in wxPython. Can someone please help me getting this window not getting any smaller than it is in the startup? And/or making the window not allowing resize? I tried self.SetMinSize(GetSize()) after self.SetSizerAndFit(SizerH) in the MainPanel class. Did...
TITLE: wxPython SetMinSize problem QUESTION: Having problems setting the SetMinSize in wxPython. Can someone please help me getting this window not getting any smaller than it is in the startup? And/or making the window not allowing resize? I tried self.SetMinSize(GetSize()) after self.SetSizerAndFit(SizerH) in the Ma...
[ "wxpython" ]
0
3
2,021
1
0
2011-05-31T10:09:51.480000
2011-05-31T11:36:24.247000
6,186,031
6,189,224
Attaching to ProjectName
I am struggling to get my project to build. I have been fiddling with the build settings and now when I run the project it says 'Attaching to ProjectName' and it stays in this stay indefinitely. Anyone have any ideas?
This is what worked for me: In Xcode navigate to the Product menu and choose EDIT SCHEMES. In the list on the left choose Run YourAppName.app. From the Executable menu choose OTHER. Navigate and choose your.app file in your project directory. Now run and it works:)
Attaching to ProjectName I am struggling to get my project to build. I have been fiddling with the build settings and now when I run the project it says 'Attaching to ProjectName' and it stays in this stay indefinitely. Anyone have any ideas?
TITLE: Attaching to ProjectName QUESTION: I am struggling to get my project to build. I have been fiddling with the build settings and now when I run the project it says 'Attaching to ProjectName' and it stays in this stay indefinitely. Anyone have any ideas? ANSWER: This is what worked for me: In Xcode navigate to t...
[ "iphone", "xcode4" ]
1
0
399
1
0
2011-05-31T10:11:56.440000
2011-05-31T14:35:44.700000
6,186,032
6,186,788
Is the default constructor really necessary for nhibernate to persist an object?
for some reason I don't wanna let user to create an instance of the object, without sending a property to the constructor but as I know the object should have default constructor and so it would be possible to create an instance with out sending requierd property. is there any way to prevent this problem? and if yes do...
Just use a protected default constructor: public class Product { protected Product() { } public Product(Category category) { this.Category = category; } }
Is the default constructor really necessary for nhibernate to persist an object? for some reason I don't wanna let user to create an instance of the object, without sending a property to the constructor but as I know the object should have default constructor and so it would be possible to create an instance with out s...
TITLE: Is the default constructor really necessary for nhibernate to persist an object? QUESTION: for some reason I don't wanna let user to create an instance of the object, without sending a property to the constructor but as I know the object should have default constructor and so it would be possible to create an i...
[ "nhibernate" ]
4
6
3,311
2
0
2011-05-31T10:12:00.003000
2011-05-31T11:19:18.560000
6,186,034
6,213,932
yet another clearInterval in javascript not working
Belive me i ve seen many solutions i still dont know why this doesnt work. timerId = 0; $("#dumpStartId").click(function(){ var proId = $("#curProfileId").val(); timerId = setInterval(function(){ showact(); showactdat(); },1000); }); $("#dumpStopId").click(function(){ clearInterval(timerId); document.getElementById('cu...
It was because the function the setInterval is calling was problematic which polls a rest service at a varied interval from the setIntervals interval causing it to conflict. I ve corrected it and that fixed it.
yet another clearInterval in javascript not working Belive me i ve seen many solutions i still dont know why this doesnt work. timerId = 0; $("#dumpStartId").click(function(){ var proId = $("#curProfileId").val(); timerId = setInterval(function(){ showact(); showactdat(); },1000); }); $("#dumpStopId").click(function(){...
TITLE: yet another clearInterval in javascript not working QUESTION: Belive me i ve seen many solutions i still dont know why this doesnt work. timerId = 0; $("#dumpStartId").click(function(){ var proId = $("#curProfileId").val(); timerId = setInterval(function(){ showact(); showactdat(); },1000); }); $("#dumpStopId")...
[ "javascript", "jquery" ]
0
0
480
2
0
2011-05-31T10:12:11.690000
2011-06-02T11:29:50.667000
6,186,035
6,187,956
checkin using fbgraph in facebook
I am bit confused in using checkin api. Every time when I call "me/checkins" the response i get is empty. I have no idea how actually checkin works. Thanks.
I believe to view checkin's of a user, your application will have to request for "user_checkins" access from the user. This is probably why it is coming back empty. Just add "user_checkins" as another permission you will need granted. http://developers.facebook.com/docs/reference/api/checkin/
checkin using fbgraph in facebook I am bit confused in using checkin api. Every time when I call "me/checkins" the response i get is empty. I have no idea how actually checkin works. Thanks.
TITLE: checkin using fbgraph in facebook QUESTION: I am bit confused in using checkin api. Every time when I call "me/checkins" the response i get is empty. I have no idea how actually checkin works. Thanks. ANSWER: I believe to view checkin's of a user, your application will have to request for "user_checkins" acces...
[ "iphone", "facebook", "facebook-graph-api" ]
2
2
1,824
1
0
2011-05-31T10:12:15.667000
2011-05-31T13:01:11.223000
6,186,038
6,186,100
Question regarding index
I have the following query: SELECT M.Col7, M.Col8, M.Col9, M.Col10 FROM [MyTable] M WHERE M.Col1 = COALESCE(@Col1, M.Col1) AND M.Col2 = COALESCE(@Col2, M.Col2) AND M.Col3 = COALESCE(@Col3, M.Col3) AND M.Col4 = COALESCE(@Col4, M.Col4) AND M.Col5 = COALESCE(@Col5, M.Col5) AND M.Col6 LIKE COALESCE(@Col6, M.Col6) +'%' I ...
Try this to have a covering index CREATE INDEX IX_foo ON MyTable (Col1,Col2,Col3,Col4,Col5,Col6) INCLUDE (Col7,Col8,Col9,Col10) Other thoughts: ISNULL is better then COALESCE because of how datatypes are handled See Why IsNull is twice slow as coalesce (same query)? The (ISNULL OR..) pattern has been optimised (to a po...
Question regarding index I have the following query: SELECT M.Col7, M.Col8, M.Col9, M.Col10 FROM [MyTable] M WHERE M.Col1 = COALESCE(@Col1, M.Col1) AND M.Col2 = COALESCE(@Col2, M.Col2) AND M.Col3 = COALESCE(@Col3, M.Col3) AND M.Col4 = COALESCE(@Col4, M.Col4) AND M.Col5 = COALESCE(@Col5, M.Col5) AND M.Col6 LIKE COALES...
TITLE: Question regarding index QUESTION: I have the following query: SELECT M.Col7, M.Col8, M.Col9, M.Col10 FROM [MyTable] M WHERE M.Col1 = COALESCE(@Col1, M.Col1) AND M.Col2 = COALESCE(@Col2, M.Col2) AND M.Col3 = COALESCE(@Col3, M.Col3) AND M.Col4 = COALESCE(@Col4, M.Col4) AND M.Col5 = COALESCE(@Col5, M.Col5) AND ...
[ "sql-server", "sql-server-2005", "sql-server-2008", "indexing" ]
0
3
540
4
0
2011-05-31T10:12:23.180000
2011-05-31T10:18:16.013000
6,186,042
6,201,436
QT QML import ListModel from C++ to QML
How can i change the model of a PathView with c++ code? i add an objectName to my pathView to find it, then i change the property like this, but when i do that, my list is empty: QDeclarativeItem *listSynergie = myClass.itemMain->findChild ("PathViewInscription"); listSynergie->setProperty("model", QVariant::fromValue(...
I have never used QdeclarativeItem to set model in QML. Try this instead QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("model", QVariant::fromValue(dataList)); Declare the model as a property of the root. This way you can set model.Or add a function that takes model as argument and sets the m...
QT QML import ListModel from C++ to QML How can i change the model of a PathView with c++ code? i add an objectName to my pathView to find it, then i change the property like this, but when i do that, my list is empty: QDeclarativeItem *listSynergie = myClass.itemMain->findChild ("PathViewInscription"); listSynergie->s...
TITLE: QT QML import ListModel from C++ to QML QUESTION: How can i change the model of a PathView with c++ code? i add an objectName to my pathView to find it, then i change the property like this, but when i do that, my list is empty: QDeclarativeItem *listSynergie = myClass.itemMain->findChild ("PathViewInscription"...
[ "qt", "qml", "qt-quick" ]
2
3
7,073
1
0
2011-05-31T10:12:31.813000
2011-06-01T12:52:49.380000
6,186,045
6,203,458
ant java task : redirecting output with spawn=true
Greetings, a rather clear question here. I have to launch a java job with, which is to be run in parallel with ant and it's okay if the job outlives the ant process, hence spawn="true". I have to see the job output in a designated file. This is perfectly achievable via output="job.out" for spawn="false", but I am kinda...
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; public class StreamRedirector { public static void main(String[] args) throws FileNotFoundException, ClassNotFoundException, NoSuchMethodExcept...
ant java task : redirecting output with spawn=true Greetings, a rather clear question here. I have to launch a java job with, which is to be run in parallel with ant and it's okay if the job outlives the ant process, hence spawn="true". I have to see the job output in a designated file. This is perfectly achievable via...
TITLE: ant java task : redirecting output with spawn=true QUESTION: Greetings, a rather clear question here. I have to launch a java job with, which is to be run in parallel with ant and it's okay if the job outlives the ant process, hence spawn="true". I have to see the job output in a designated file. This is perfec...
[ "java", "ant", "shellexecute" ]
4
3
3,128
1
0
2011-05-31T10:12:49.847000
2011-06-01T15:13:21.987000
6,186,051
6,186,270
Get HTML Content Upon Submit
In Jsp while i press submit button instead of passing values to action. I want the HTML content of that form with all values it is possible?? If possible give an example. Let me know if any clarification is needed.
It isnt clear where do you need this html content? If on browser, use an alert in an onSubmit event - alert(document.myForm.innerHTML); To get this on to server side, you will need to pass this content as part of form submission, maybe in a hidden field. in onSubmit() event: myForm.myHiddenHtmlContent = myForm.innerHTM...
Get HTML Content Upon Submit In Jsp while i press submit button instead of passing values to action. I want the HTML content of that form with all values it is possible?? If possible give an example. Let me know if any clarification is needed.
TITLE: Get HTML Content Upon Submit QUESTION: In Jsp while i press submit button instead of passing values to action. I want the HTML content of that form with all values it is possible?? If possible give an example. Let me know if any clarification is needed. ANSWER: It isnt clear where do you need this html content...
[ "html", "jsp" ]
1
2
608
1
0
2011-05-31T10:13:28.780000
2011-05-31T10:33:31.903000
6,186,055
6,187,417
Generic factory: cache vs. repetitive instantination
I have a generic factory which caches an instance before return it (simplified code): static class Factory where T: class { private static T instance; public static T GetInstance() { if (instance == null) instance = new T(); return instance; } } I want to replace such approach with non-caching one to show that caching...
Sounds to me that your colleague want's to do premature optimizations. Caching objects are seldom a good idea. Instantiation is cheap and I would only cache objects where it's proven that it will be faster. A high performance socket server would be such case. But to answer your question: Caching objects will always be ...
Generic factory: cache vs. repetitive instantination I have a generic factory which caches an instance before return it (simplified code): static class Factory where T: class { private static T instance; public static T GetInstance() { if (instance == null) instance = new T(); return instance; } } I want to replace su...
TITLE: Generic factory: cache vs. repetitive instantination QUESTION: I have a generic factory which caches an instance before return it (simplified code): static class Factory where T: class { private static T instance; public static T GetInstance() { if (instance == null) instance = new T(); return instance; } } I ...
[ "c#", ".net", "mstest", "factory-pattern", "load-testing" ]
1
1
1,954
2
0
2011-05-31T10:13:46.903000
2011-05-31T12:14:17.100000
6,186,058
6,186,409
Does Paypal send an IPN message when payment is captured?
We are using Paypal's Authorisation/Capture. When a user manually captures the payment (on the Paypal website), does Paypal send any notification? We want our backend to recognise payments that have been captured and authorised versus payments that haven't been captured yet. We would also like to be notified about paym...
OK, found out that there is no special variable for this, it is simply stored in the 'payment_status' in the IPN message from Paypal. The statuses relevant to authorisation/capture are: Completed (when the payment is captured) Refunded (when the payment is refunded) Pending (after the user makes payment but before the ...
Does Paypal send an IPN message when payment is captured? We are using Paypal's Authorisation/Capture. When a user manually captures the payment (on the Paypal website), does Paypal send any notification? We want our backend to recognise payments that have been captured and authorised versus payments that haven't been ...
TITLE: Does Paypal send an IPN message when payment is captured? QUESTION: We are using Paypal's Authorisation/Capture. When a user manually captures the payment (on the Paypal website), does Paypal send any notification? We want our backend to recognise payments that have been captured and authorised versus payments ...
[ "paypal", "paypal-ipn" ]
0
0
314
1
0
2011-05-31T10:14:00.553000
2011-05-31T10:46:56.893000
6,186,060
6,186,112
php, sessions, arrays - how to assign strign to the end of the session array
I have this small code, why it does not work and how to make it correctly? $temp = $_SESSION['contactPersonInterest'][$i]; $temp += ',Medlemskort'; //$_SESSION['contactPersonInterest'][$i] = $temp; I am testing it with?> And what i get is: blbla,blll----------0 Whats wrong? Thank you
String concatenation is done with. in PHP. Try: $temp.= ',Medlemskort'; Otherwise you perform addition, and if both strings don't start with numbers, they will be converted to 0 and 0 + 0 = 0:) Have a look at Type Juggling.
php, sessions, arrays - how to assign strign to the end of the session array I have this small code, why it does not work and how to make it correctly? $temp = $_SESSION['contactPersonInterest'][$i]; $temp += ',Medlemskort'; //$_SESSION['contactPersonInterest'][$i] = $temp; I am testing it with?> And what i get is: blb...
TITLE: php, sessions, arrays - how to assign strign to the end of the session array QUESTION: I have this small code, why it does not work and how to make it correctly? $temp = $_SESSION['contactPersonInterest'][$i]; $temp += ',Medlemskort'; //$_SESSION['contactPersonInterest'][$i] = $temp; I am testing it with?> And ...
[ "php", "arrays", "session" ]
0
2
91
4
0
2011-05-31T10:14:04.963000
2011-05-31T10:19:31.403000
6,186,063
6,187,462
Dynamically calculate size of View elements
I have a unknown number of TextView elements some EditText elements and so on, that are all placed in one linear layout... And I want to calculate the height of the layout at run time so I can get the exact size in pixels for different resolution screens. Some editboxes can contain more text then other so their size wi...
To get height of layout you have to write the code in onWindowFocusChanged() method. First get the layout in onCreate() method then write the following code. @Override public void onWindowFocusChanged(boolean hasFocus) { // TODO Auto-generated method stub super.onWindowFocusChanged(hasFocus); System.out.println("...111...
Dynamically calculate size of View elements I have a unknown number of TextView elements some EditText elements and so on, that are all placed in one linear layout... And I want to calculate the height of the layout at run time so I can get the exact size in pixels for different resolution screens. Some editboxes can c...
TITLE: Dynamically calculate size of View elements QUESTION: I have a unknown number of TextView elements some EditText elements and so on, that are all placed in one linear layout... And I want to calculate the height of the layout at run time so I can get the exact size in pixels for different resolution screens. So...
[ "android", "dynamic", "view", "size", "android-linearlayout" ]
3
3
3,493
2
0
2011-05-31T10:14:29.660000
2011-05-31T12:18:26.117000
6,186,066
6,186,117
how to remove some words from a string in java
im working on android platform,I use a string variable to fill the html content after that i want to delete some words(Specifically- delete whatever words are there in between.. tag. Any solution?
String newHtml = oldHtml.replaceFirst("(?s)( )(.*?)( )","$1$3"); Explanation: oldHtml.replaceFirst(" // we want to match only one occurrance (?s) // we need to turn Pattern.DOTALL mode on // (. matches everything, including line breaks) ( ) // match the start tag and store it in group $1 (.*?) // put contents in group ...
how to remove some words from a string in java im working on android platform,I use a string variable to fill the html content after that i want to delete some words(Specifically- delete whatever words are there in between.. tag. Any solution?
TITLE: how to remove some words from a string in java QUESTION: im working on android platform,I use a string variable to fill the html content after that i want to delete some words(Specifically- delete whatever words are there in between.. tag. Any solution? ANSWER: String newHtml = oldHtml.replaceFirst("(?s)( )(.*...
[ "java", "android", "string", "replace" ]
4
4
3,578
3
0
2011-05-31T10:14:43.030000
2011-05-31T10:20:07.823000
6,186,085
6,186,526
How to replace random number in asp.net/c with pictures?
I am trying to replace random number with pictures. for example If random number is 1 show picture black.jpg: Cache[diceKey] = r.Next(1, 5); // random (1-4) if (r.Next(1, 2) == 1 ) image.BackImageUrl = "Images/black.png"; is there any solutions that I can show my picture if random number is 1?
As I already said in my comment r.Next(1, 2) will always return 1, so you will always show that black image... I think you should change your code to this: var randomValue = r.Next(1, 5); // random (1-4) Cache[diceKey] = randomValue; if (randomValue == 1) image.BackImageUrl = "Images/black.png"; else image.BackImageUr...
How to replace random number in asp.net/c with pictures? I am trying to replace random number with pictures. for example If random number is 1 show picture black.jpg: Cache[diceKey] = r.Next(1, 5); // random (1-4) if (r.Next(1, 2) == 1 ) image.BackImageUrl = "Images/black.png"; is there any solutions that I can show m...
TITLE: How to replace random number in asp.net/c with pictures? QUESTION: I am trying to replace random number with pictures. for example If random number is 1 show picture black.jpg: Cache[diceKey] = r.Next(1, 5); // random (1-4) if (r.Next(1, 2) == 1 ) image.BackImageUrl = "Images/black.png"; is there any solutions...
[ "c#", "asp.net", "c#-4.0" ]
2
2
606
2
0
2011-05-31T10:16:23.293000
2011-05-31T10:58:10.023000
6,186,088
6,249,771
Continuously scroll text in a div with jQuery
Does anyone know of any jQuery plugins that can achieve the scrolling effect like the one seen here? I'm not too well-up on javascript or jQuery and want to find something simple that just works. I've found examples on the net that I either can't understand or plugins that don't work. Don't need any fancy effects, just...
Removal of Lightbox using Prototype got my JQuery stuff working ok.
Continuously scroll text in a div with jQuery Does anyone know of any jQuery plugins that can achieve the scrolling effect like the one seen here? I'm not too well-up on javascript or jQuery and want to find something simple that just works. I've found examples on the net that I either can't understand or plugins that ...
TITLE: Continuously scroll text in a div with jQuery QUESTION: Does anyone know of any jQuery plugins that can achieve the scrolling effect like the one seen here? I'm not too well-up on javascript or jQuery and want to find something simple that just works. I've found examples on the net that I either can't understan...
[ "jquery", "jquery-plugins" ]
0
0
7,677
4
0
2011-05-31T10:16:53.887000
2011-06-06T09:06:28.257000
6,186,091
6,187,136
PyQt: best way to do the trick "start at boot" for my program in Windows
I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot. I'm releasing this software with PyInstaller as a single executable file; i don't have a proper "installer". Which is the best way to achieve this? ( = starting at boot) A possible solution is to add a link...
try this code (it works for me with py2exe): import sys from PyQt4.QtCore import QSettings from PyQt4.QtGui import (QApplication, QWidget, QCheckBox, QPushButton, QVBoxLayout) RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" class MainWidget(QWidget): def __init__(self,parent=None): ...
PyQt: best way to do the trick "start at boot" for my program in Windows I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot. I'm releasing this software with PyInstaller as a single executable file; i don't have a proper "installer". Which is the best way to...
TITLE: PyQt: best way to do the trick "start at boot" for my program in Windows QUESTION: I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot. I'm releasing this software with PyInstaller as a single executable file; i don't have a proper "installer". Which ...
[ "python", "windows", "pyqt", "startup", "pyinstaller" ]
6
9
3,343
2
0
2011-05-31T10:17:10.460000
2011-05-31T11:51:44.843000
6,186,122
6,192,086
REST service in Ejabberd; DELETE and PUT Method
I am using the request handlers found in ejabberd to build a REST service. Is it possible to invoke the ejabberd request_handlers with a PUT and DELETE HTTP Method? If so how? I have been able to invoke request_handlers with POST and GET HTTP Methods successfully but can't seem to be able to do the same with PUT or DEL...
At the moment I haven't done either since I can't do rigth now. But the problem seems to be the that the ejabberd server only accepts DELETE and PUT http method after ejabberd 2.1.0 and I am using ejabberd 2.0.5 has is stated in EJAB-662 So to make a DELETE and PUT to work I will need to update ejabberd to 2.1.0 or hig...
REST service in Ejabberd; DELETE and PUT Method I am using the request handlers found in ejabberd to build a REST service. Is it possible to invoke the ejabberd request_handlers with a PUT and DELETE HTTP Method? If so how? I have been able to invoke request_handlers with POST and GET HTTP Methods successfully but can'...
TITLE: REST service in Ejabberd; DELETE and PUT Method QUESTION: I am using the request handlers found in ejabberd to build a REST service. Is it possible to invoke the ejabberd request_handlers with a PUT and DELETE HTTP Method? If so how? I have been able to invoke request_handlers with POST and GET HTTP Methods suc...
[ "rest", "curl", "erlang", "ejabberd" ]
1
0
1,575
1
0
2011-05-31T10:20:51.080000
2011-05-31T18:48:33.033000
6,186,123
6,186,239
Android - How do I get sharedpreferences from another activity?
In my app there is a button (activity1). When user clicks it, I want no sound in the game. I thought I should do this by using sharedpreferences in activity1 in the onClick method of the button: SharedPreferences.Editor editor = mPrefs.edit(); editor.putString("sound","1"); editor.commit(); The sound and the game start...
Use the following functions to add shared preferences and to fetch the saved values from all activities. public static void setDefaults(String key, String value, Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = preferences.edit(...
Android - How do I get sharedpreferences from another activity? In my app there is a button (activity1). When user clicks it, I want no sound in the game. I thought I should do this by using sharedpreferences in activity1 in the onClick method of the button: SharedPreferences.Editor editor = mPrefs.edit(); editor.putSt...
TITLE: Android - How do I get sharedpreferences from another activity? QUESTION: In my app there is a button (activity1). When user clicks it, I want no sound in the game. I thought I should do this by using sharedpreferences in activity1 in the onClick method of the button: SharedPreferences.Editor editor = mPrefs.ed...
[ "android", "sharedpreferences" ]
41
77
100,368
11
0
2011-05-31T10:20:51.897000
2011-05-31T10:30:06.833000
6,186,124
6,186,156
How do move controllers that's not in an area to an area?
I started programming with MVC3 without any knowledge of areas. As the application grows bigger, I would like to use areas to organize my code, but most of my controllers are not inside any areas at all. How do I quickly move an existing controller into an area?
Create an Area, move your controller class file into the the Controllers folder of that area and then edit your controller namespace to match the Area. Then move your views into the area Views directory. But be aware you have to update all links to that controller by having the area name in the URL.
How do move controllers that's not in an area to an area? I started programming with MVC3 without any knowledge of areas. As the application grows bigger, I would like to use areas to organize my code, but most of my controllers are not inside any areas at all. How do I quickly move an existing controller into an area?
TITLE: How do move controllers that's not in an area to an area? QUESTION: I started programming with MVC3 without any knowledge of areas. As the application grows bigger, I would like to use areas to organize my code, but most of my controllers are not inside any areas at all. How do I quickly move an existing contro...
[ "asp.net-mvc", "asp.net-mvc-3" ]
3
5
2,201
1
0
2011-05-31T10:20:51.923000
2011-05-31T10:24:29.133000
6,186,126
6,186,145
Issue with: "Warning: Invalid argument supplied for foreach"
I'm having some woes with the above stated warning on an array. I completely understand what the warning is, and what causes it, and I have taken every step I can to prevent it, but alas, none are having any effect. Steps taken: I have Checked for the array, declared it if not exists. if(!$this->theVariables['associate...
try: if (is_array($this->theVariables['associated'])) { // your foreach here } bacause for example if $this->theVariables['associated'] would be 1 this array assignment would never be reached: if(!$this->theVariables['associated']){ $this->theVariables['associated'] = array(); } (The same goes for your second test) As ...
Issue with: "Warning: Invalid argument supplied for foreach" I'm having some woes with the above stated warning on an array. I completely understand what the warning is, and what causes it, and I have taken every step I can to prevent it, but alas, none are having any effect. Steps taken: I have Checked for the array, ...
TITLE: Issue with: "Warning: Invalid argument supplied for foreach" QUESTION: I'm having some woes with the above stated warning on an array. I completely understand what the warning is, and what causes it, and I have taken every step I can to prevent it, but alas, none are having any effect. Steps taken: I have Check...
[ "php", "foreach", "reporting", "warnings" ]
0
1
431
4
0
2011-05-31T10:21:26.527000
2011-05-31T10:23:24.480000
6,186,135
6,186,883
XSL <node/> and <node></node> diff
Is it possible to distinguish and with xsl?
XSLT works on the parsed XML data model (XML tree). XML data model makes no difference between self-closing elements and empty elements with separate start and end tags. They are both just elements that have no child nodes at all (text, element, comment, etc). So in the phase where XSLT processor gets it hands down to ...
XSL <node/> and <node></node> diff Is it possible to distinguish and with xsl?
TITLE: XSL <node/> and <node></node> diff QUESTION: Is it possible to distinguish and with xsl? ANSWER: XSLT works on the parsed XML data model (XML tree). XML data model makes no difference between self-closing elements and empty elements with separate start and end tags. They are both just elements that have no chi...
[ "xslt", "xpath" ]
1
0
155
2
0
2011-05-31T10:22:03.800000
2011-05-31T11:29:12.753000
6,186,144
6,186,331
JSON object -> array? how should I convert it?
Take two:) I have a jquery's autocomplete texbox and, upon a click of a button, I need to check if the value entered has come from the autocomplete or is it a completely new value. The problems is that 'cache' is some sort of an array of JSON objects, but to be able to use if ( input in cache ) {... } I need to convert...
(Replacement answer, I hadn't meant the last one to be a CW.) The problems is that 'cache' is some sort of an array of JSON objects Actually, it's not an array. It's an object. (It's created via var cache = {};, which is how we can tell.)...but to be able to use if ( input in cache ) {... } I need to convert it to a si...
JSON object -> array? how should I convert it? Take two:) I have a jquery's autocomplete texbox and, upon a click of a button, I need to check if the value entered has come from the autocomplete or is it a completely new value. The problems is that 'cache' is some sort of an array of JSON objects, but to be able to use...
TITLE: JSON object -> array? how should I convert it? QUESTION: Take two:) I have a jquery's autocomplete texbox and, upon a click of a button, I need to check if the value entered has come from the autocomplete or is it a completely new value. The problems is that 'cache' is some sort of an array of JSON objects, but...
[ "javascript", "jquery", "ajax", "json" ]
0
2
789
2
0
2011-05-31T10:23:22.510000
2011-05-31T10:40:53.480000
6,186,155
6,186,187
CSS Select Selector
Selecting for buttons works fine: input[type="submit"] { background:#efefef; width:auto; padding:5px; color:#666; font-size:16px; font-weight:bold; padding:5px 15px; } But I can't seem to get anything to work for drop down boxes, this doesn't work: input[type="select"] { background:#000; } Am I selecting it correctly? ...
Try this: select { background:#000; } As I know, there is no, just.
CSS Select Selector Selecting for buttons works fine: input[type="submit"] { background:#efefef; width:auto; padding:5px; color:#666; font-size:16px; font-weight:bold; padding:5px 15px; } But I can't seem to get anything to work for drop down boxes, this doesn't work: input[type="select"] { background:#000; } Am I sele...
TITLE: CSS Select Selector QUESTION: Selecting for buttons works fine: input[type="submit"] { background:#efefef; width:auto; padding:5px; color:#666; font-size:16px; font-weight:bold; padding:5px 15px; } But I can't seem to get anything to work for drop down boxes, this doesn't work: input[type="select"] { background...
[ "html", "css", "css-selectors" ]
6
24
16,494
2
0
2011-05-31T10:24:18.193000
2011-05-31T10:26:13.683000
6,186,166
6,186,220
Any chance of failing one query while using two queries in ExecuteScalar
I have written a query which is a composite query like one update query and one insert query is there. I am using ExecuteScalar. Is there a possibility that one query will fail and other will be succeeded. It will be a whole failure or partial failure, if one of the queries is wrong. can someone please help:)
No matter how you invoke it; for a composite operation it is entirely possible that the first operation will succeed and the second operation will fail (for example, a unique key violation or a foreign key violation). If you need to ensure all-or-nothing, then surround the call to Execute* with a transaction, and only ...
Any chance of failing one query while using two queries in ExecuteScalar I have written a query which is a composite query like one update query and one insert query is there. I am using ExecuteScalar. Is there a possibility that one query will fail and other will be succeeded. It will be a whole failure or partial fai...
TITLE: Any chance of failing one query while using two queries in ExecuteScalar QUESTION: I have written a query which is a composite query like one update query and one insert query is there. I am using ExecuteScalar. Is there a possibility that one query will fail and other will be succeeded. It will be a whole fail...
[ "c#", "asp.net", "sql", "executescalar" ]
1
3
110
2
0
2011-05-31T10:25:05.777000
2011-05-31T10:28:07.200000
6,186,168
6,198,048
Using global.asa on Windows 2008
We have an old asp solution with VB6 components, which we are trying to install on Windows 2008. There is a connection string that is assigned to a varibale in the global.asa. When we try to use this the variable is not set. It appears that the global.asa is not run. Anyone know how to fix this?
Global.asa should work in the same way as before. Can you try a simple.asp page, that doesn't use VB6 components, but just displays the variable you set in the global.asa? My guess is that classic ASP might not be enabled at all on your 2008 server.
Using global.asa on Windows 2008 We have an old asp solution with VB6 components, which we are trying to install on Windows 2008. There is a connection string that is assigned to a varibale in the global.asa. When we try to use this the variable is not set. It appears that the global.asa is not run. Anyone know how to ...
TITLE: Using global.asa on Windows 2008 QUESTION: We have an old asp solution with VB6 components, which we are trying to install on Windows 2008. There is a connection string that is assigned to a varibale in the global.asa. When we try to use this the variable is not set. It appears that the global.asa is not run. A...
[ "asp-classic", "windows-server-2008", "global.asa" ]
1
0
1,342
2
0
2011-05-31T10:25:07.107000
2011-06-01T08:03:40.263000
6,186,185
6,201,451
Eclipse CDT: How to write to .cproject file and read back
How to write programmatically to.cproject file and read back (in Eclipse CDT)? A class implementing AbstractCPropertyTab has checkboxes and name and boolean state of these should be saved to.cproject.
I solved my own question. Maybe someone finds this useful. I will introduce two methods: one for saving checked state of the checkboxes on the table and one to initialize the checkbox values. /** * Saves checked state of the packages. */ private void saveChecked() { ICConfigurationDescription desc = getResDesc().getCon...
Eclipse CDT: How to write to .cproject file and read back How to write programmatically to.cproject file and read back (in Eclipse CDT)? A class implementing AbstractCPropertyTab has checkboxes and name and boolean state of these should be saved to.cproject.
TITLE: Eclipse CDT: How to write to .cproject file and read back QUESTION: How to write programmatically to.cproject file and read back (in Eclipse CDT)? A class implementing AbstractCPropertyTab has checkboxes and name and boolean state of these should be saved to.cproject. ANSWER: I solved my own question. Maybe so...
[ "java", "eclipse", "plugins", "eclipse-cdt" ]
1
2
1,489
1
0
2011-05-31T10:26:04.437000
2011-06-01T12:54:00.413000
6,186,189
6,186,475
Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered
I am getting this error every time I run the page. What could be wrong? Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered. Please let me know.
It's a confirmed bug that will be fixed in the next release. Basically, it has to do with how the PageRequestManager detects which scripts have already been loaded on the page see this link
Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered I am getting this error every time I run the page. What could be wrong? Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered. Please let me know.
TITLE: Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered QUESTION: I am getting this error every time I run the page. What could be wrong? Microsoft JScript runtime error: Sys.InvalidOperationException: TypeSys.UI._Timer has already been registered. Please le...
[ "javascript", "asp.net", ".net", "timer", "dom-events" ]
0
1
1,195
1
0
2011-05-31T10:26:26.540000
2011-05-31T10:52:39.280000
6,186,202
6,186,266
Loading a 32-bit dll on a 64-bit server OS
I am trying to use a third-party DLL that is on the 32-bit architecture. I understand that targeting my.NET executable to be 32-bit should help, but unfortunately that DLL has a dependency on "msvcr100.dll" (the C runtime). If i don't provide this dll i get a DllNotFound exception (which i am able to catch at runtime)....
You need to install the 32-bit version of the VC runtime on your 64-bit OS. You can find it here.
Loading a 32-bit dll on a 64-bit server OS I am trying to use a third-party DLL that is on the 32-bit architecture. I understand that targeting my.NET executable to be 32-bit should help, but unfortunately that DLL has a dependency on "msvcr100.dll" (the C runtime). If i don't provide this dll i get a DllNotFound excep...
TITLE: Loading a 32-bit dll on a 64-bit server OS QUESTION: I am trying to use a third-party DLL that is on the 32-bit architecture. I understand that targeting my.NET executable to be 32-bit should help, but unfortunately that DLL has a dependency on "msvcr100.dll" (the C runtime). If i don't provide this dll i get a...
[ ".net", "dll", "64-bit", "32-bit", "visual-c++-installer" ]
2
4
372
1
0
2011-05-31T10:27:05.527000
2011-05-31T10:33:00.710000
6,186,206
6,188,210
How to handle circular references with Autofac 2.4.5?
The autofac wiki page about Circular References says to use: cb.Register ().OnActivated(ActivatedHandler.InjectUnsetProperties); But it looks like ActivatedHandler does not exist anymore in 2.4.5. Digging around in the source, I found the implementation of that class, and so I put in the method implementation in the On...
The Autofac documentation for circular dependencies states: Note, it doesn't make sense to set up this scenario if both classes are registered with Factory scope. Both your M and VM registrations are InstancePerDependency (previously known as FactoryScope ) so this statement applies to your scenario. As a result, you g...
How to handle circular references with Autofac 2.4.5? The autofac wiki page about Circular References says to use: cb.Register ().OnActivated(ActivatedHandler.InjectUnsetProperties); But it looks like ActivatedHandler does not exist anymore in 2.4.5. Digging around in the source, I found the implementation of that clas...
TITLE: How to handle circular references with Autofac 2.4.5? QUESTION: The autofac wiki page about Circular References says to use: cb.Register ().OnActivated(ActivatedHandler.InjectUnsetProperties); But it looks like ActivatedHandler does not exist anymore in 2.4.5. Digging around in the source, I found the implement...
[ "dependency-injection", "autofac", "circular-dependency", "property-injection" ]
5
7
5,456
2
0
2011-05-31T10:27:22.933000
2011-05-31T13:19:01.560000
6,186,212
6,186,244
What's the quickest way to import a large data set into a database?
The two options I'm considering are index and then import vs importing and then indexing. Is there one method that is significantly faster?
In general, for large inserts, it is better to insert then index. Otherwise the insert process will need to insert while indexing, which will be slow and get slower and slower as more items are added. Consider an shuffled deck of cards - what would be faster? Taking all of the cards and sorting them in place or taking ...
What's the quickest way to import a large data set into a database? The two options I'm considering are index and then import vs importing and then indexing. Is there one method that is significantly faster?
TITLE: What's the quickest way to import a large data set into a database? QUESTION: The two options I'm considering are index and then import vs importing and then indexing. Is there one method that is significantly faster? ANSWER: In general, for large inserts, it is better to insert then index. Otherwise the inser...
[ "database" ]
0
1
107
1
0
2011-05-31T10:27:44.603000
2011-05-31T10:30:48.723000
6,186,224
6,186,402
How to take a picture and save in SQLite database on iOS
I have a camera application in which when I click on the camera button the camera opens and user can take picture from camera or from photo-library. I have done the camera part such that when user clicks on the button the camera opens and he can take a picture. The problem is the picture the user has taken from the cam...
If you are using the UIImagePickerController, you can get the image in its imagePickerController:didFinishPickingMediaWithInfo: delegate method. The image you get is an UIImage object. UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage]; NSData *data = UIImageJPEGRepresentation(image, 1.0); Now NSDa...
How to take a picture and save in SQLite database on iOS I have a camera application in which when I click on the camera button the camera opens and user can take picture from camera or from photo-library. I have done the camera part such that when user clicks on the button the camera opens and he can take a picture. T...
TITLE: How to take a picture and save in SQLite database on iOS QUESTION: I have a camera application in which when I click on the camera button the camera opens and user can take picture from camera or from photo-library. I have done the camera part such that when user clicks on the button the camera opens and he can...
[ "iphone", "objective-c", "ios", "sqlite" ]
1
3
5,824
3
0
2011-05-31T10:28:26.650000
2011-05-31T10:46:12.040000
6,186,230
6,195,421
Recursive grammars in FParsec
I've decided to check out FParsec, and tried to write a parser for λ expressions. As it turns out, eagerness makes recursive parsing difficult. How can I solve this? Code: open FParsec type λExpr = | Variable of char | Application of λExpr * λExpr | Lambda of char * λExpr let rec FV = function | Variable v -> Set.sin...
As you pointed out, the problem is that your parser for application calls expr recursively and so there is an infinite loop. The parser needs to be written such that it always consumes some input and then decides what to do. In case of lambda calculus, the tricky thing is recognizing an application and a variable becau...
Recursive grammars in FParsec I've decided to check out FParsec, and tried to write a parser for λ expressions. As it turns out, eagerness makes recursive parsing difficult. How can I solve this? Code: open FParsec type λExpr = | Variable of char | Application of λExpr * λExpr | Lambda of char * λExpr let rec FV = fu...
TITLE: Recursive grammars in FParsec QUESTION: I've decided to check out FParsec, and tried to write a parser for λ expressions. As it turns out, eagerness makes recursive parsing difficult. How can I solve this? Code: open FParsec type λExpr = | Variable of char | Application of λExpr * λExpr | Lambda of char * λExp...
[ "parsing", "f#", "parsec", "fparsec" ]
11
10
2,223
1
0
2011-05-31T10:29:03.527000
2011-06-01T01:46:22.703000
6,186,231
6,186,318
Mapping collisions in vim
Is there a way to find out that my new mapping won't collide with some keyboard shortcut already set in vim? For example I will want to map gg to something because I don't know that vim uses it to go to the beginning of the file. How to get know that this mapping is already used for another purpose? thank you
I tend to run:help gg or:help _ or:help ctrl-y to see if the mapping I'm thinking of over-writing is useful to me or not. The ^D completion command can be helpful, try this::help ctrl^D That's typing ctrl with four letters, then hitting Control + D to get completion list. It shows help topics matching ctrl. Typically, ...
Mapping collisions in vim Is there a way to find out that my new mapping won't collide with some keyboard shortcut already set in vim? For example I will want to map gg to something because I don't know that vim uses it to go to the beginning of the file. How to get know that this mapping is already used for another pu...
TITLE: Mapping collisions in vim QUESTION: Is there a way to find out that my new mapping won't collide with some keyboard shortcut already set in vim? For example I will want to map gg to something because I don't know that vim uses it to go to the beginning of the file. How to get know that this mapping is already u...
[ "vim", "mapping" ]
2
2
510
3
0
2011-05-31T10:29:09.110000
2011-05-31T10:39:26.740000
6,186,234
6,186,439
WPF VisualStateManger - How to rewind a Storyboard or go back to previous State?
The title describes it at best. I want to switch back to a default state after a specific State is completed. I tried this by using an EventTrigger for the Completed event of the Storyboard, but that doesn't work, because the Storyboard is in a frozen (IsFrozen) state (in order to allow cross-thread access to it) and c...
You can use the StateChangedTrigger with the Completed parameter set to true from http://expressionblend.codeplex.com/wikipage?title=Behaviors%20and%20Effects&referringTitle=Documentation Only thing is, if you're using WPF4, you'll need the fixed code: http://expressionblend.codeplex.com/workitem/8148
WPF VisualStateManger - How to rewind a Storyboard or go back to previous State? The title describes it at best. I want to switch back to a default state after a specific State is completed. I tried this by using an EventTrigger for the Completed event of the Storyboard, but that doesn't work, because the Storyboard is...
TITLE: WPF VisualStateManger - How to rewind a Storyboard or go back to previous State? QUESTION: The title describes it at best. I want to switch back to a default state after a specific State is completed. I tried this by using an EventTrigger for the Completed event of the Storyboard, but that doesn't work, because...
[ "wpf", "storyboard", "visualstatemanager" ]
1
2
640
1
0
2011-05-31T10:29:21.703000
2011-05-31T10:49:51.253000
6,186,258
6,186,272
Access Various pages of Website using Perl
I need to navigate websites and perform various actions like logging in, browse to a specific page, fill out forms, extract certain text and corresponding js in respective files automatically. For an example, I have to logged in one site and then access controls in navigated pages etc. Some controls are controlled by j...
Either reverse engineer the JS and do what it does in your Perl, or use something like WWW::Mechanize::Firefox
Access Various pages of Website using Perl I need to navigate websites and perform various actions like logging in, browse to a specific page, fill out forms, extract certain text and corresponding js in respective files automatically. For an example, I have to logged in one site and then access controls in navigated p...
TITLE: Access Various pages of Website using Perl QUESTION: I need to navigate websites and perform various actions like logging in, browse to a specific page, fill out forms, extract certain text and corresponding js in respective files automatically. For an example, I have to logged in one site and then access contr...
[ "perl" ]
0
4
406
2
0
2011-05-31T10:31:59.440000
2011-05-31T10:34:13.947000
6,186,268
6,237,010
Changing image projection using Python
Image corner coordinates are known: Top left: (70.20315, 20.92749) Top right: (70.20315, 31.45240) Bottom left: (59.70571, 20.92749) Bottom right: (59.70571, 31.45240) (Basically map over Finland and a little bit of Sweden/Norway/Russia) I couldn't find a way to change image projection to Google maps overlay image, pre...
(Copy-paste from gis answer) Extensive trial-and-error showed it worked fine without specifying source projection. Same can be achieved using only GDAL Python API. Steps to reproduce: Adding control points to TIF (of course, first convert mapimage.png mapimage.tif ): gdal_translate mapimage.tif mapimage_georeffed.tif -...
Changing image projection using Python Image corner coordinates are known: Top left: (70.20315, 20.92749) Top right: (70.20315, 31.45240) Bottom left: (59.70571, 20.92749) Bottom right: (59.70571, 31.45240) (Basically map over Finland and a little bit of Sweden/Norway/Russia) I couldn't find a way to change image proje...
TITLE: Changing image projection using Python QUESTION: Image corner coordinates are known: Top left: (70.20315, 20.92749) Top right: (70.20315, 31.45240) Bottom left: (59.70571, 20.92749) Bottom right: (59.70571, 31.45240) (Basically map over Finland and a little bit of Sweden/Norway/Russia) I couldn't find a way to ...
[ "python", "dictionary", "google-maps", "map-projections" ]
1
0
1,248
1
0
2011-05-31T10:33:20.780000
2011-06-04T13:31:06.433000
6,186,271
6,191,599
CodeIgniter passing variables to the views
In my CodeIgniter controller, I call a template view: if($this->form_validation->run() == FALSE) { $data['content'] = 'form'; $this->load->view('includes/template', $data); } template.php view contains more view files, For example: template.php: load->view('includes/header');?> load->view($content);?> load->view('inclu...
The data passed into 'includes/template' from the $data array should also be passed into the views loaded inside this view by CodeIgniter, automatically. It can then be used in 'includes/sidebar1' in the same way as it is used in 'includes/template'.
CodeIgniter passing variables to the views In my CodeIgniter controller, I call a template view: if($this->form_validation->run() == FALSE) { $data['content'] = 'form'; $this->load->view('includes/template', $data); } template.php view contains more view files, For example: template.php: load->view('includes/header');?...
TITLE: CodeIgniter passing variables to the views QUESTION: In my CodeIgniter controller, I call a template view: if($this->form_validation->run() == FALSE) { $data['content'] = 'form'; $this->load->view('includes/template', $data); } template.php view contains more view files, For example: template.php: load->view('i...
[ "codeigniter" ]
0
1
3,787
1
0
2011-05-31T10:33:54.260000
2011-05-31T18:03:47.780000
6,186,274
6,187,262
sql server express: no connection from pool available on developer machine with a single user
I'm currently porting a DB-backed web application from MS Access to SQL Server (Express, for the time being). While expecting improved availability of the DB, I'm getting timeouts when connecting, error message "couldn't get connection from pool in time" (sorry original error message is in German so I'm only paraphrasi...
You're leaving connections open somewhere. It's best if every use of a database connection is wrapped in a using statement, so that you're guaranteed that they're closed/disposed when they're no longer being used. Not knowing what data access layer you're using, I can't suggest specific code.
sql server express: no connection from pool available on developer machine with a single user I'm currently porting a DB-backed web application from MS Access to SQL Server (Express, for the time being). While expecting improved availability of the DB, I'm getting timeouts when connecting, error message "couldn't get c...
TITLE: sql server express: no connection from pool available on developer machine with a single user QUESTION: I'm currently porting a DB-backed web application from MS Access to SQL Server (Express, for the time being). While expecting improved availability of the DB, I'm getting timeouts when connecting, error messa...
[ "sql-server", "connection", "sql-server-express", "connection-pooling" ]
0
2
281
1
0
2011-05-31T10:34:29.300000
2011-05-31T12:00:25.600000
6,186,283
6,186,503
Reading Xml element value and display it in Textbox control using vb.net
I have a sample.xml file like this: 'root element 'FilePath element 'FilePath element value C:\Users\Desktop I need to read the FilePath value, that is "C:\Users\Ram\Desktop\auto" and display it in textBox1 control. If possible code snippets in VB.net please Any suggestions please? Many Thanks in advance
You can make: Dim filePath as String = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "sample.xml") Dim xml as XElement = XElement.Load(filePath) textBox1.Text = xml.ToString()
Reading Xml element value and display it in Textbox control using vb.net I have a sample.xml file like this: 'root element 'FilePath element 'FilePath element value C:\Users\Desktop I need to read the FilePath value, that is "C:\Users\Ram\Desktop\auto" and display it in textBox1 control. If possible code snippets in ...
TITLE: Reading Xml element value and display it in Textbox control using vb.net QUESTION: I have a sample.xml file like this: 'root element 'FilePath element 'FilePath element value C:\Users\Desktop I need to read the FilePath value, that is "C:\Users\Ram\Desktop\auto" and display it in textBox1 control. If possible...
[ "vb.net" ]
0
0
3,877
1
0
2011-05-31T10:35:22.153000
2011-05-31T10:56:41.350000
6,186,284
6,186,293
sending date as parameter from JSP to servlet
How do I send a date type as a parameter from JSP to servlet so as to insert to MySQL database. When I use getParameter() in the servlet, it shows that I'm using incompartible types. Actually I declared a variable of java.sql.Date type which I assign to the request parameter in the servlet but I get an error that the t...
Pass it as String and parse it to server using SimpleDateFormat to get the Date back For example: Date date = new SimpleDateFormat("dd-MM-yyyy").parse("10-10-2010");
sending date as parameter from JSP to servlet How do I send a date type as a parameter from JSP to servlet so as to insert to MySQL database. When I use getParameter() in the servlet, it shows that I'm using incompartible types. Actually I declared a variable of java.sql.Date type which I assign to the request paramete...
TITLE: sending date as parameter from JSP to servlet QUESTION: How do I send a date type as a parameter from JSP to servlet so as to insert to MySQL database. When I use getParameter() in the servlet, it shows that I'm using incompartible types. Actually I declared a variable of java.sql.Date type which I assign to th...
[ "java", "jsp", "servlets" ]
3
8
11,569
1
0
2011-05-31T10:35:23.213000
2011-05-31T10:36:39.423000
6,186,288
6,186,376
What is the equivalent of php array() in objective-c
How can I do this: PHP: $arr1 = array( 'a', 1, 'b', 5, 'z' ); $arr2 = array( 'key1' => 'value1', 'key2' => 'value2' ); $arr3 = array( 'key1' => 'value1', 'value2', 'value3' ); and this: foreach ($arr1 as $value) { echo "Value: $value \n"; } foreach ($arr2 as $key => $value) { echo "Key: $key; Value: $value \n"; } In Ob...
For an array NSMutableArray *arr1 = [NSMutableArray arrayWithObjects:@"1", @"2", @"a", @"b", nil]; for (NSString *obj in arr1) { // do stuff } And for a map NSMutableArray *keys = [NSMutableArray arrayWithObjects:@"1", @"2", @"3", @"4", nil]; NSMutableArray *values = [NSMutableArray arrayWithObjects:@"a", @"b", @"c", @...
What is the equivalent of php array() in objective-c How can I do this: PHP: $arr1 = array( 'a', 1, 'b', 5, 'z' ); $arr2 = array( 'key1' => 'value1', 'key2' => 'value2' ); $arr3 = array( 'key1' => 'value1', 'value2', 'value3' ); and this: foreach ($arr1 as $value) { echo "Value: $value \n"; } foreach ($arr2 as $key => ...
TITLE: What is the equivalent of php array() in objective-c QUESTION: How can I do this: PHP: $arr1 = array( 'a', 1, 'b', 5, 'z' ); $arr2 = array( 'key1' => 'value1', 'key2' => 'value2' ); $arr3 = array( 'key1' => 'value1', 'value2', 'value3' ); and this: foreach ($arr1 as $value) { echo "Value: $value \n"; } foreach ...
[ "php", "objective-c", "arrays", "xcode", "multidimensional-array" ]
1
0
618
2
0
2011-05-31T10:35:45.787000
2011-05-31T10:44:22.590000
6,186,289
6,186,321
AS2: Flash run function on drag
I am using the following code... I want to run the function Food_scroll_ratio() only when the draggable movieclip is being moved and not while it is just pressed but can't work out how to do it. onClipEvent (load) { Symptoms_sliders = new Array(this._parent.slider1.slider, this._parent.slider2.slider, this._parent.slid...
You should use onMouseMove instead of onEnterFrame for dragging or it will become choppy! That will also solve your problem, if you check for onMouseMove + onMouseDown. Or alternatively you can use the built in onDrag.
AS2: Flash run function on drag I am using the following code... I want to run the function Food_scroll_ratio() only when the draggable movieclip is being moved and not while it is just pressed but can't work out how to do it. onClipEvent (load) { Symptoms_sliders = new Array(this._parent.slider1.slider, this._parent.s...
TITLE: AS2: Flash run function on drag QUESTION: I am using the following code... I want to run the function Food_scroll_ratio() only when the draggable movieclip is being moved and not while it is just pressed but can't work out how to do it. onClipEvent (load) { Symptoms_sliders = new Array(this._parent.slider1.slid...
[ "function", "actionscript", "actionscript-2" ]
0
0
936
1
0
2011-05-31T10:35:52.700000
2011-05-31T10:39:55.683000
6,186,295
6,186,327
Decorator design pattern using inheritance vs interfaces
I'd like to implement the Decorator design pattern using inheritance ( Decorator extends Component ) because i need access to the protected fields/methods of the Component class. The problem is that the Component class represents an algorithm, it performs some preprocessing upon construction and holds a significant amo...
I'm not sure if this would count as the decorator pattern at all actually. Sounds more like plain old inheritance. Am i right to worry about the waste of resources when extending the Component class? Obviously depends on how much resources you're wasting. And if so, how can i avoid it without losing access to the infor...
Decorator design pattern using inheritance vs interfaces I'd like to implement the Decorator design pattern using inheritance ( Decorator extends Component ) because i need access to the protected fields/methods of the Component class. The problem is that the Component class represents an algorithm, it performs some pr...
TITLE: Decorator design pattern using inheritance vs interfaces QUESTION: I'd like to implement the Decorator design pattern using inheritance ( Decorator extends Component ) because i need access to the protected fields/methods of the Component class. The problem is that the Component class represents an algorithm, i...
[ "java", "design-patterns", "decorator" ]
6
2
1,410
2
0
2011-05-31T10:36:54.397000
2011-05-31T10:40:26.003000
6,186,296
6,186,647
Display topmenu in left side in magento.?
I have choose one column page for my site in magento. Now i want to show topmenu in left side. Please tell me what to do.
If i understood your question correctly,this is how navigation can be created.But i wonder how do you display navigation when you set one column layout. Create a template file(left_nav.phtml) in /your_theme/template/catalog/navigation/ __('Categories')?> getStoreCategories() as $_category):?> drawItem($_category)?> If ...
Display topmenu in left side in magento.? I have choose one column page for my site in magento. Now i want to show topmenu in left side. Please tell me what to do.
TITLE: Display topmenu in left side in magento.? QUESTION: I have choose one column page for my site in magento. Now i want to show topmenu in left side. Please tell me what to do. ANSWER: If i understood your question correctly,this is how navigation can be created.But i wonder how do you display navigation when you...
[ "xml", "layout", "magento", "php" ]
0
4
4,208
2
0
2011-05-31T10:37:03.230000
2011-05-31T11:07:33.653000
6,186,301
6,189,661
Pouring Water, where goes wrong?
I have finished Pouring Water from SPOJ. However, the system keeps giving wrong answer. But I cannot find out where goes wrong. Please give a hint. Test cases are also appreciated. #include int countFromA (int a, int b, int c); int main() { int t; std::cin>>t; std::cin.ignore(5, '\n'); // SPOJ error: iostream limit wh...
Here is a hint. Since this is a coding exercise for your benefit I won't give you the full answer. You have 4 different operations that you might need to combine in any sequence to get your answer. Suppose that your numbers are 21, 3, 15. You need to look at both repeatedly dumping b into a until you have 15 in there, ...
Pouring Water, where goes wrong? I have finished Pouring Water from SPOJ. However, the system keeps giving wrong answer. But I cannot find out where goes wrong. Please give a hint. Test cases are also appreciated. #include int countFromA (int a, int b, int c); int main() { int t; std::cin>>t; std::cin.ignore(5, '\n');...
TITLE: Pouring Water, where goes wrong? QUESTION: I have finished Pouring Water from SPOJ. However, the system keeps giving wrong answer. But I cannot find out where goes wrong. Please give a hint. Test cases are also appreciated. #include int countFromA (int a, int b, int c); int main() { int t; std::cin>>t; std::ci...
[ "c++", "algorithm" ]
2
3
1,594
1
0
2011-05-31T10:37:42.667000
2011-05-31T15:08:17.343000
6,186,304
6,186,337
In a Python program, why can't I cat a file right after writing it?
I tried to cat a file, using Popen(), right after creating and writing to it. It doesn't work. Print p gives two empty tuples ('',''). Why? I've used rename to ensure an atomic write, as discussed here. #!/usr/bin/env python import sys,os,subprocess def run(cmd): try: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, ...
You did not call close. Use fd.close() (you forgot the parentheses there to make it an actual function call). This could have been prevented by using the with -statement: with open("__q", "w") as fd: fd.write(t) # will automatically be closed here
In a Python program, why can't I cat a file right after writing it? I tried to cat a file, using Popen(), right after creating and writing to it. It doesn't work. Print p gives two empty tuples ('',''). Why? I've used rename to ensure an atomic write, as discussed here. #!/usr/bin/env python import sys,os,subprocess d...
TITLE: In a Python program, why can't I cat a file right after writing it? QUESTION: I tried to cat a file, using Popen(), right after creating and writing to it. It doesn't work. Print p gives two empty tuples ('',''). Why? I've used rename to ensure an atomic write, as discussed here. #!/usr/bin/env python import sy...
[ "python" ]
1
11
606
1
0
2011-05-31T10:38:12.917000
2011-05-31T10:41:07.580000
6,186,305
6,192,771
using redis giving error
I have installed redis by following links. https://github.com/mranney/node_redis and trying var redis = require("redis"), client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("string key", "string val", redis.print); client.hset("hash key", "hashtest 1", "some...
You need to make sure the server is running before you can not access it in Node.Js
using redis giving error I have installed redis by following links. https://github.com/mranney/node_redis and trying var redis = require("redis"), client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("string key", "string val", redis.print); client.hset("hash ...
TITLE: using redis giving error QUESTION: I have installed redis by following links. https://github.com/mranney/node_redis and trying var redis = require("redis"), client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("string key", "string val", redis.print); ...
[ "node.js", "redis" ]
4
6
3,229
2
0
2011-05-31T10:38:19.343000
2011-05-31T19:51:51.200000
6,186,312
6,186,893
Java: HtmlUnit efficiency relacing PHP CURL?
I have a spider class which on a user request spiders websites for content. Each search results in loading about 30 websites, spidering them for the information and then standardizing this information. I have written this in PHP using CURL, since PHP is lacking multitasking I would like to switch to Java (I am aware of...
Perhaps take a look at Apache Http Client? You can create a HttpClient per thread and use that to do your requests while (running) { HttpClient client = new DefaultHttpClient(); HttpGet GET = new HttpGet("mydomain.com/path.html"); HttpResponse response = client.execute(GET); // do stuff with response } Even better, i...
Java: HtmlUnit efficiency relacing PHP CURL? I have a spider class which on a user request spiders websites for content. Each search results in loading about 30 websites, spidering them for the information and then standardizing this information. I have written this in PHP using CURL, since PHP is lacking multitasking ...
TITLE: Java: HtmlUnit efficiency relacing PHP CURL? QUESTION: I have a spider class which on a user request spiders websites for content. Each search results in loading about 30 websites, spidering them for the information and then standardizing this information. I have written this in PHP using CURL, since PHP is lac...
[ "java", "php", "http", "curl", "htmlunit" ]
1
3
738
3
0
2011-05-31T10:39:02.077000
2011-05-31T11:30:10.310000
6,186,314
6,186,430
Array of constants in php
I am a starter in web development. My requirement in a bit unique here. I have a set of scores, score_1 to score_n. Each score is associated with a factor with which it affects the grand score. Now I wish to write a configuration.php file as: and then I wish to iterate over these values like this: Well I know that this...
If you have constants with fancy names, you need to use constant() to call them: constant('FACT_SCORE['. $i. ']') Of course, given that it isn't an array, it may be less confusing to get rid of square brackets: define("FACT_SCORE_1",0.2,TRUE); define("FACT_SCORE_2",0.6,TRUE); define("FACT_SCORE_3",0.8,TRUE); define("FA...
Array of constants in php I am a starter in web development. My requirement in a bit unique here. I have a set of scores, score_1 to score_n. Each score is associated with a factor with which it affects the grand score. Now I wish to write a configuration.php file as: and then I wish to iterate over these values like t...
TITLE: Array of constants in php QUESTION: I am a starter in web development. My requirement in a bit unique here. I have a set of scores, score_1 to score_n. Each score is associated with a factor with which it affects the grand score. Now I wish to write a configuration.php file as: and then I wish to iterate over t...
[ "php", "html" ]
4
2
2,212
6
0
2011-05-31T10:39:09.080000
2011-05-31T10:48:37.520000
6,186,315
6,186,378
Extract name, season and episode from tv show filename
I have filenames like Tv.Show.Name.S01E02.somthing.not.needed.avi How can I extract it to get separate variables like: $name - Tv Show Name (without dots) $season - 1 (if there's leading zero ignore it) $episode - 2 (if there's leading zero ignore it)
I would do it like this: if (preg_match("'^(.+)\.S([0-9]+)E([0-9]+).*$'i",$filename,$n)) { $name = preg_replace("'\.'"," ",$n[1]); $season = intval($n[2],10); $episode = intval($n[3],10); }
Extract name, season and episode from tv show filename I have filenames like Tv.Show.Name.S01E02.somthing.not.needed.avi How can I extract it to get separate variables like: $name - Tv Show Name (without dots) $season - 1 (if there's leading zero ignore it) $episode - 2 (if there's leading zero ignore it)
TITLE: Extract name, season and episode from tv show filename QUESTION: I have filenames like Tv.Show.Name.S01E02.somthing.not.needed.avi How can I extract it to get separate variables like: $name - Tv Show Name (without dots) $season - 1 (if there's leading zero ignore it) $episode - 2 (if there's leading zero ignore...
[ "php", "regex" ]
3
7
3,182
1
0
2011-05-31T10:39:17.613000
2011-05-31T10:44:36.757000
6,186,317
6,187,671
Why copy and paste in finder doesn't work when I use RegisterEventHotKey (Cocoa)?
I use function RegisterEventHotKey() and when I try registering Cmd + C or Cmd + V, I notice that copy and paste in finder doesn't work. I insert parameter inOptions = 0 to function RegisterEventHotKey() so it should non-exclusiv but why finder seem not to receive this hot key? EventTypeSpec eventType; eventType.eventC...
It doesn't work because when you install a hot key handler, you replace the default functionality of that key combination in every app.
Why copy and paste in finder doesn't work when I use RegisterEventHotKey (Cocoa)? I use function RegisterEventHotKey() and when I try registering Cmd + C or Cmd + V, I notice that copy and paste in finder doesn't work. I insert parameter inOptions = 0 to function RegisterEventHotKey() so it should non-exclusiv but why ...
TITLE: Why copy and paste in finder doesn't work when I use RegisterEventHotKey (Cocoa)? QUESTION: I use function RegisterEventHotKey() and when I try registering Cmd + C or Cmd + V, I notice that copy and paste in finder doesn't work. I insert parameter inOptions = 0 to function RegisterEventHotKey() so it should non...
[ "objective-c", "cocoa", "macos-carbon", "hotkeys", "finder" ]
1
3
643
1
0
2011-05-31T10:39:26.303000
2011-05-31T12:36:48.693000
6,186,323
6,186,913
Is asp.net mvc worse than traditional asp.net site on such of situation?
Today, I have a debate with my colleague on the topic. For his opinion, He doesn't think that an ASP.NET MVC is appropriate to build a website which is small and constantly updated. Instead, He believe that a traditional asp.net website is just for the situation. Because ASP.NET MVC will requires to compile first to ge...
First you need to remember that there are no strict rules and you can use whatever works for you. Now to clarify, there are 3 options (not 2): ASP.NET MVC Project (your option) ASP.NET Web Application Project (WebForms) ASP.NET WebSite Project (WebForms as well; apparently your colleague's option) Now, I'm greatly simp...
Is asp.net mvc worse than traditional asp.net site on such of situation? Today, I have a debate with my colleague on the topic. For his opinion, He doesn't think that an ASP.NET MVC is appropriate to build a website which is small and constantly updated. Instead, He believe that a traditional asp.net website is just fo...
TITLE: Is asp.net mvc worse than traditional asp.net site on such of situation? QUESTION: Today, I have a debate with my colleague on the topic. For his opinion, He doesn't think that an ASP.NET MVC is appropriate to build a website which is small and constantly updated. Instead, He believe that a traditional asp.net ...
[ "asp.net", "asp.net-mvc" ]
0
4
211
4
0
2011-05-31T10:40:13.760000
2011-05-31T11:32:35.133000
6,186,334
6,188,807
Convert SVG image path to Image Map coordinates?
Can I convert SVG image paths to Image map coordinates? Lets assume that I have this SVG Image http://www.openclipart.org/people/ArtFavor/anatomy26.svg i want to convert the paths in the SVG somehow to Imagemap coordinates so i can make an effect/script http://www.netzgesta.de/mapper/ on it!! Meaning i want to make tha...
You might be interested by this script: creating-an-image-map-from-svg
Convert SVG image path to Image Map coordinates? Can I convert SVG image paths to Image map coordinates? Lets assume that I have this SVG Image http://www.openclipart.org/people/ArtFavor/anatomy26.svg i want to convert the paths in the SVG somehow to Imagemap coordinates so i can make an effect/script http://www.netzge...
TITLE: Convert SVG image path to Image Map coordinates? QUESTION: Can I convert SVG image paths to Image map coordinates? Lets assume that I have this SVG Image http://www.openclipart.org/people/ArtFavor/anatomy26.svg i want to convert the paths in the SVG somehow to Imagemap coordinates so i can make an effect/script...
[ "svg", "imagemap" ]
6
0
12,339
3
0
2011-05-31T10:40:59.250000
2011-05-31T14:06:17.033000
6,186,335
6,186,726
How to display interactive SVG in a window on Linux?
I really like SVG, it's very nice to draw with it. So far i've made static images using Inkscape. I'd like to make them interactive though. I did some trials, following tutorials like this one. But i can see a SVG and interact with it in my web browser only. I'd like to make such things in a window on the desktop. Ther...
The problem is that the effects require javascript and cascading style-sheets, which basically means complete web rendering engine. So the easiest way is to use one, either webkit or gecko (webkit has probably better support for SVG these days, plus I can't find package of gecko right now).
How to display interactive SVG in a window on Linux? I really like SVG, it's very nice to draw with it. So far i've made static images using Inkscape. I'd like to make them interactive though. I did some trials, following tutorials like this one. But i can see a SVG and interact with it in my web browser only. I'd like...
TITLE: How to display interactive SVG in a window on Linux? QUESTION: I really like SVG, it's very nice to draw with it. So far i've made static images using Inkscape. I'd like to make them interactive though. I did some trials, following tutorials like this one. But i can see a SVG and interact with it in my web brow...
[ "python", "linux", "opengl", "svg", "cairo" ]
4
2
3,836
1
0
2011-05-31T10:41:00.037000
2011-05-31T11:13:41.540000
6,186,338
6,186,367
C# Overriding the GetHashCode method
In this example, the poster has overridden the get hash code method. I understand that this has been done in order to provide a better hash value for the returned object, to reduce the number of collisions, and therefore reduce the number of occasions it will be necessary to call Equals(). What i would like to know, is...
Generally you should choose primes. This helps you to avoid getting the same hash-value for different input parameters.
C# Overriding the GetHashCode method In this example, the poster has overridden the get hash code method. I understand that this has been done in order to provide a better hash value for the returned object, to reduce the number of collisions, and therefore reduce the number of occasions it will be necessary to call Eq...
TITLE: C# Overriding the GetHashCode method QUESTION: In this example, the poster has overridden the get hash code method. I understand that this has been done in order to provide a better hash value for the returned object, to reduce the number of collisions, and therefore reduce the number of occasions it will be ne...
[ "c#", "algorithm", "hashcode", "state-machine" ]
7
4
2,070
3
0
2011-05-31T10:41:10.310000
2011-05-31T10:43:51.933000
6,186,340
6,186,382
How to decide between using if/else vs try/catch?
When writing code, how does one decide between using if / else or try / catch? For example, in checking for a file, should this be based on a method such as: if (File.Exists("file.txt")) { //do stuff } or a try / catch block? Another example: writing to a file can be handled via an if / else block to create a file and ...
You should never use try/catch for flow control. Generating an exception is an extremely expensive action. If/else is much faster and cleaner.
How to decide between using if/else vs try/catch? When writing code, how does one decide between using if / else or try / catch? For example, in checking for a file, should this be based on a method such as: if (File.Exists("file.txt")) { //do stuff } or a try / catch block? Another example: writing to a file can be ha...
TITLE: How to decide between using if/else vs try/catch? QUESTION: When writing code, how does one decide between using if / else or try / catch? For example, in checking for a file, should this be based on a method such as: if (File.Exists("file.txt")) { //do stuff } or a try / catch block? Another example: writing t...
[ "c#" ]
46
43
32,673
15
0
2011-05-31T10:41:24.880000
2011-05-31T10:44:49
6,186,341
6,187,554
Post custom message to facebook wall
I'm working on a script for post a message on a visitors wall. The visitor can enter there own message in a form en then send it to facebook. index.php: message This sends "t_update" to "wall.php". The wall.php script is working fine I tested it with static text. but when I try to insert the "t_update" text into the va...
I did test the code and can confirm that it's not working. The reason its not is because when you first hit wall.php, you get redirected to Facebook to authenticate, it then redirects back to your application script "wall.php" with a GET - so you lose your POST variables on the redirect. That's why it ends up empty. Yo...
Post custom message to facebook wall I'm working on a script for post a message on a visitors wall. The visitor can enter there own message in a form en then send it to facebook. index.php: message This sends "t_update" to "wall.php". The wall.php script is working fine I tested it with static text. but when I try to i...
TITLE: Post custom message to facebook wall QUESTION: I'm working on a script for post a message on a visitors wall. The visitor can enter there own message in a form en then send it to facebook. index.php: message This sends "t_update" to "wall.php". The wall.php script is working fine I tested it with static text. b...
[ "php", "facebook" ]
0
2
5,343
2
0
2011-05-31T10:41:26.713000
2011-05-31T12:27:21.397000
6,186,344
6,190,492
Style to choose suitable foreground according to background color
I have a WPF application which ships with a set of default styles for Label, TextBox etc. defined by item types (no explicit keys defined). Within the application there are two main containers used, one with dark background and one with light background, such that sometimes it's right to use black as the foreground col...
This question seems to imply a deeper issue. I would guess that you haven't consolidated the management of foreground colors, and so you have an application that has code or styles that set foreground colors all over the place. And now you're dealing with one of the implications of that. I'd face the deeper issue and f...
Style to choose suitable foreground according to background color I have a WPF application which ships with a set of default styles for Label, TextBox etc. defined by item types (no explicit keys defined). Within the application there are two main containers used, one with dark background and one with light background,...
TITLE: Style to choose suitable foreground according to background color QUESTION: I have a WPF application which ships with a set of default styles for Label, TextBox etc. defined by item types (no explicit keys defined). Within the application there are two main containers used, one with dark background and one with...
[ "wpf", "styles", "background-color", "foreground" ]
2
4
4,438
3
0
2011-05-31T10:41:40.090000
2011-05-31T16:15:39.850000
6,186,348
6,187,282
Win32 Dialog Box Button Style not windows 7 themed
I've created a modal dialog box, like this IDD_FORMVIEW DIALOGEX 500, 200, 257, 98 STYLE DS_ABSALIGN | DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN LTEXT "xxx",IDC_STATIC,31,32,194,16 PUSHBUTTON "OK",IDOK,92,65,76,26 END Is there any way to make the button Win...
This is a clear duplicate of existing questions. The canonical answer by Microsoft is the MSDN article on Enabling Visual Styles. Basically, your application needs to have an application manifest file that lists the Microsoft.Windows.Common-Controls 6.0.0.0 assembly as a dependentAssembly.
Win32 Dialog Box Button Style not windows 7 themed I've created a modal dialog box, like this IDD_FORMVIEW DIALOGEX 500, 200, 257, 98 STYLE DS_ABSALIGN | DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN LTEXT "xxx",IDC_STATIC,31,32,194,16 PUSHBUTTON "OK",IDOK,92,6...
TITLE: Win32 Dialog Box Button Style not windows 7 themed QUESTION: I've created a modal dialog box, like this IDD_FORMVIEW DIALOGEX 500, 200, 257, 98 STYLE DS_ABSALIGN | DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN LTEXT "xxx",IDC_STATIC,31,32,194,16 PUSHBUT...
[ "windows", "winapi", "visual-c++" ]
1
3
4,485
1
0
2011-05-31T10:42:03.340000
2011-05-31T12:02:00.590000
6,186,363
6,188,391
Does on-select trigger fire during/after query-procedure trigger fires?
I have a form that I'm looking at, which makes use of stored procedures as data block source. I'm trying to find when/where the block gets populated. The block as query data source type as Procedure, but the procedure listed as the data source name does nothing - literally nothing. The code in the procedure is begin nu...
From the Forms on-line help for ON_SELECT: Fires when Oracle Forms would normally execute the open cursor, parse, and execute phases of a query, to identify the records in the database that match the current query criteria. Use an On-Select trigger to open and execute the database cursor. Specifically, use this trigger...
Does on-select trigger fire during/after query-procedure trigger fires? I have a form that I'm looking at, which makes use of stored procedures as data block source. I'm trying to find when/where the block gets populated. The block as query data source type as Procedure, but the procedure listed as the data source name...
TITLE: Does on-select trigger fire during/after query-procedure trigger fires? QUESTION: I have a form that I'm looking at, which makes use of stored procedures as data block source. I'm trying to find when/where the block gets populated. The block as query data source type as Procedure, but the procedure listed as th...
[ "oracle", "plsql", "oracleforms" ]
1
3
2,294
1
0
2011-05-31T10:43:41.783000
2011-05-31T13:34:12.590000
6,186,365
6,189,377
Generate core dump in android
I'm developping a android's aplication using some shared libraries written by me and compiled with ndk-r5b. The application works, y and the calls to the libraries works too, but I detected some errors, segmentations faults, and I need to debug it, but, I don't know how debug native code from android and I don't know i...
The ndk comes with ndk-gdb, which supposedly allows you to debug native applications. Also, if you download the whole andriod open source project, they also have some version of gdb used for debugging. Look in the docs/ folder of the ndk to learn about using it. This tutorial might also prove helpful: http://vilimpoc.o...
Generate core dump in android I'm developping a android's aplication using some shared libraries written by me and compiled with ndk-r5b. The application works, y and the calls to the libraries works too, but I detected some errors, segmentations faults, and I need to debug it, but, I don't know how debug native code f...
TITLE: Generate core dump in android QUESTION: I'm developping a android's aplication using some shared libraries written by me and compiled with ndk-r5b. The application works, y and the calls to the libraries works too, but I detected some errors, segmentations faults, and I need to debug it, but, I don't know how d...
[ "android", "debugging", "android-ndk", "coredump" ]
10
5
19,790
1
0
2011-05-31T10:43:47.687000
2011-05-31T14:47:28.970000
6,186,384
6,187,503
Pre-fill vaule when adding new row in ASPxGridView
I got this ASPxGridView which is populated by a LinqServerModeDataSource. What I want to do is when creating a new row one (or more) of the fields should have their values generated by code-behind. I figured something like protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEve...
Figured it out I'd have to add a reference to oninitnewrow="ASPxGridView1_InitNewRow" in the control and add the method protected void ASPxGridView1_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { e.NewValues["CompanyGuid"] = Guid.NewGuid(); }
Pre-fill vaule when adding new row in ASPxGridView I got this ASPxGridView which is populated by a LinqServerModeDataSource. What I want to do is when creating a new row one (or more) of the fields should have their values generated by code-behind. I figured something like protected void ASPxGridView1_RowInserting(obje...
TITLE: Pre-fill vaule when adding new row in ASPxGridView QUESTION: I got this ASPxGridView which is populated by a LinqServerModeDataSource. What I want to do is when creating a new row one (or more) of the fields should have their values generated by code-behind. I figured something like protected void ASPxGridView1...
[ "aspxgridview" ]
2
3
4,700
1
0
2011-05-31T10:44:55.820000
2011-05-31T12:23:02.847000
6,186,386
6,186,708
XSLT last position within attribute
I need to check whether a node with certain attribute is the last in the loop, and accordingly insert and ampersand before the last node. I tried using the doesn't seem to take into consideration the attribute value. Here's the XML Roche, R.L. Moulin, D. James, K. CEA Centre d'Etudes Nucleaires de Saclay, 91 - Gif-sur-...
Why not counting the followng siblings inside the matching template? The last count creator[@type='personal'] node following sibling will be zero. XSLT 2.0 tested under Saxon-HE 9.2.1.1J (also wroking as XSLT 1.0 on MSXSL 4.0 ) &, Applied on your input, produces: Roche, R.L., Moulin, D., & James, K. According to the te...
XSLT last position within attribute I need to check whether a node with certain attribute is the last in the loop, and accordingly insert and ampersand before the last node. I tried using the doesn't seem to take into consideration the attribute value. Here's the XML Roche, R.L. Moulin, D. James, K. CEA Centre d'Etudes...
TITLE: XSLT last position within attribute QUESTION: I need to check whether a node with certain attribute is the last in the loop, and accordingly insert and ampersand before the last node. I tried using the doesn't seem to take into consideration the attribute value. Here's the XML Roche, R.L. Moulin, D. James, K. C...
[ "xslt", "string-formatting" ]
2
1
1,277
5
0
2011-05-31T10:45:06.063000
2011-05-31T11:12:03.133000
6,186,390
6,186,499
C# Filetype association
How can I prgramatically add an application to the Open With menu for a given file type? E.g. I've made a simple text file viewer, I've made setup project for the same, I want associate the text file viewer with all.txt files in system, When a user double clicks any.txt file then my application should open. Open with m...
You can use this great class for that: http://www.mentalis.org/soft/class.qpx?id=5
C# Filetype association How can I prgramatically add an application to the Open With menu for a given file type? E.g. I've made a simple text file viewer, I've made setup project for the same, I want associate the text file viewer with all.txt files in system, When a user double clicks any.txt file then my application ...
TITLE: C# Filetype association QUESTION: How can I prgramatically add an application to the Open With menu for a given file type? E.g. I've made a simple text file viewer, I've made setup project for the same, I want associate the text file viewer with all.txt files in system, When a user double clicks any.txt file th...
[ "c#", "windows", "winforms" ]
1
2
444
3
0
2011-05-31T10:45:19.973000
2011-05-31T10:56:14.523000
6,186,393
6,187,473
Archive Mercurial Changeset Files
I'm using Mercurial 1.7.2. on Windows and I want to extract all files within a specified change set (in my case tip). This is so I can upload only the files that I have changed to my web server. If I want to take an un-versioned copy of the entire repo then I use hg arhive however I can't find a way to get just the fil...
If you're using TortoiseHg you can do this from the Repository Explorer - in fact I do exactly what you're trying to do for a Wordpress install. thg log will bring up the log of the repository in TortoiseHg. You can then right-click on a changeset and select (from memory, sorry) Archive. There are a few options, but yo...
Archive Mercurial Changeset Files I'm using Mercurial 1.7.2. on Windows and I want to extract all files within a specified change set (in my case tip). This is so I can upload only the files that I have changed to my web server. If I want to take an un-versioned copy of the entire repo then I use hg arhive however I ca...
TITLE: Archive Mercurial Changeset Files QUESTION: I'm using Mercurial 1.7.2. on Windows and I want to extract all files within a specified change set (in my case tip). This is so I can upload only the files that I have changed to my web server. If I want to take an un-versioned copy of the entire repo then I use hg a...
[ "windows", "mercurial" ]
2
2
178
2
0
2011-05-31T10:45:27.380000
2011-05-31T12:19:41.567000
6,186,407
6,187,498
Change Image source inside a Button template
I have a button in WPF application. I am presenting an image instead of a button. When my app comes up, all the controls are disabled, until a user logs in. I want my app to start with button that it's image is gray-->disabled. and when someone logged in, i want to change to color image.but i can't access the image in ...
You can hook up the image with the IsEnabled property via trigger, then you probably don't need code behind access.
Change Image source inside a Button template I have a button in WPF application. I am presenting an image instead of a button. When my app comes up, all the controls are disabled, until a user logs in. I want my app to start with button that it's image is gray-->disabled. and when someone logged in, i want to change to...
TITLE: Change Image source inside a Button template QUESTION: I have a button in WPF application. I am presenting an image instead of a button. When my app comes up, all the controls are disabled, until a user logs in. I want my app to start with button that it's image is gray-->disabled. and when someone logged in, i...
[ "c#", ".net", "wpf", "image", "button" ]
2
3
1,930
2
0
2011-05-31T10:46:34.570000
2011-05-31T12:22:29.007000
6,186,408
6,186,515
Regular Expression to check if a string has HTML code
can some one give me the Regular Expression that can check if a given string has any HTML code in it, and coming to think of it I would be bothered with something exactly.
Should be something like this var pattern:RegExp = / /; var index = str.search(pattern); if (index!= -1) // we have a match
Regular Expression to check if a string has HTML code can some one give me the Regular Expression that can check if a given string has any HTML code in it, and coming to think of it I would be bothered with something exactly.
TITLE: Regular Expression to check if a string has HTML code QUESTION: can some one give me the Regular Expression that can check if a given string has any HTML code in it, and coming to think of it I would be bothered with something exactly. ANSWER: Should be something like this var pattern:RegExp = / /; var index =...
[ "regex", "actionscript-3" ]
0
2
2,272
2
0
2011-05-31T10:46:45.613000
2011-05-31T10:57:35.413000
6,186,415
6,186,516
Preventing cache overflow
At the moment I'm working on a system that caches dynamically created files, nothing too new there. Basically how it works is that it will go through the $_GET array and will create a directory structure based on querystring variables. Off course it's a little more secure than that, but you get the picture. The problem...
I would recommend you write some small API to let the CMS and the plugin developers register pages in the database they are going to create (read: allow). This way you also solve the problem of cache-flushing as you really know what is about to be deleted and when.
Preventing cache overflow At the moment I'm working on a system that caches dynamically created files, nothing too new there. Basically how it works is that it will go through the $_GET array and will create a directory structure based on querystring variables. Off course it's a little more secure than that, but you ge...
TITLE: Preventing cache overflow QUESTION: At the moment I'm working on a system that caches dynamically created files, nothing too new there. Basically how it works is that it will go through the $_GET array and will create a directory structure based on querystring variables. Off course it's a little more secure tha...
[ "php" ]
0
0
1,280
4
0
2011-05-31T10:47:26.653000
2011-05-31T10:57:36.107000
6,186,420
6,186,881
how to query a http request from a vc++ project
I am writing a sample program to get a file from some site. but it is replying me file not found errors,i dont know how to make an http header. anyone help me in writing http headers. AND i am trying to print the ip in this way(printf("%s\n",ptr->ai_addr->sa_data);) but not getting it how to print ip address??,am i doi...
If you're going to use Microsoft Windows functions, the HTTP functions in WinInet are a lot easier. See HttpOpenRequest/HttpSendRequest/HttpQueryInfo/InternetReadFile
how to query a http request from a vc++ project I am writing a sample program to get a file from some site. but it is replying me file not found errors,i dont know how to make an http header. anyone help me in writing http headers. AND i am trying to print the ip in this way(printf("%s\n",ptr->ai_addr->sa_data);) but n...
TITLE: how to query a http request from a vc++ project QUESTION: I am writing a sample program to get a file from some site. but it is replying me file not found errors,i dont know how to make an http header. anyone help me in writing http headers. AND i am trying to print the ip in this way(printf("%s\n",ptr->ai_addr...
[ "c++", "sockets", "visual-c++", "networking" ]
1
1
2,512
4
0
2011-05-31T10:47:51.947000
2011-05-31T11:29:10.130000
6,186,433
6,198,068
Clear back stack using fragments
I ported my Android app to honeycomb and I did a big refactor in order to use fragments. In my previous version, when I pressed the Home button I used to do a ACTIVITY_CLEAR_TOP in order to reset the back stack. Now my app is just a single Activity with multiple fragments, so when I press the Home button I just replace...
I posted something similar here From Joachim's answer, from Dianne Hackborn: http://groups.google.com/group/android-developers/browse_thread/thread/d2a5c203dad6ec42 I ended up just using: FragmentManager fm = getActivity().getSupportFragmentManager(); for(int i = 0; i < fm.getBackStackEntryCount(); ++i) { fm.popBackSta...
Clear back stack using fragments I ported my Android app to honeycomb and I did a big refactor in order to use fragments. In my previous version, when I pressed the Home button I used to do a ACTIVITY_CLEAR_TOP in order to reset the back stack. Now my app is just a single Activity with multiple fragments, so when I pre...
TITLE: Clear back stack using fragments QUESTION: I ported my Android app to honeycomb and I did a big refactor in order to use fragments. In my previous version, when I pressed the Home button I used to do a ACTIVITY_CLEAR_TOP in order to reset the back stack. Now my app is just a single Activity with multiple fragme...
[ "android", "android-fragments" ]
279
471
291,452
16
0
2011-05-31T10:49:01.307000
2011-06-01T08:05:47.247000
6,186,434
6,186,814
Why is the program header executable?
I used readelf on several binaries on my linux box and saw something that surprised me in the program headers. This eample is from the 'ld' utility, but it also occurs with anything I compile with gcc. PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4 This segment spans the entirety of the program headers. Wh...
The PHDR pointing to the PHDRs tells the loader that the PHDRs themselves should be mapped to the process address space, in order to make them accessible to the program itself. This is useful mainly for dynamic linking. The reason the memory is marked as executable is because the PHDRs are smaller than one page, and li...
Why is the program header executable? I used readelf on several binaries on my linux box and saw something that surprised me in the program headers. This eample is from the 'ld' utility, but it also occurs with anything I compile with gcc. PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4 This segment spans t...
TITLE: Why is the program header executable? QUESTION: I used readelf on several binaries on my linux box and saw something that surprised me in the program headers. This eample is from the 'ld' utility, but it also occurs with anything I compile with gcc. PHDR 0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4 Th...
[ "linux", "elf" ]
7
7
1,024
2
0
2011-05-31T10:49:04.287000
2011-05-31T11:21:26.580000
6,186,451
6,186,591
How do checkboxes work in Rails?
I was wondering how check boxes work in Rails? What would the table be inside of the database( integer, string,etc)? How would you give 3 different values to check boxes and the user only can choose 1(favorite color: red,green or blue)? I'm new to rails and it would help to have an explanation from the beginning to end...
There is a distinction between checkboxes and the database. Checkboxes are HTML. Database is connected to your Models, and it has nothing to do with checkboxes. When you use a checkbox in your HTML view, your form will send some parameter. By default this parameter will have the value "1" (as String). Rails helpers als...
How do checkboxes work in Rails? I was wondering how check boxes work in Rails? What would the table be inside of the database( integer, string,etc)? How would you give 3 different values to check boxes and the user only can choose 1(favorite color: red,green or blue)? I'm new to rails and it would help to have an expl...
TITLE: How do checkboxes work in Rails? QUESTION: I was wondering how check boxes work in Rails? What would the table be inside of the database( integer, string,etc)? How would you give 3 different values to check boxes and the user only can choose 1(favorite color: red,green or blue)? I'm new to rails and it would he...
[ "ruby-on-rails" ]
5
4
1,398
1
0
2011-05-31T10:51:02.003000
2011-05-31T11:03:30.967000