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,207,620
6,207,700
PHP Cookie management
here is what my client requirements are: 1> There is a common web page that lets each of the customer login. On successful login, a cookie is created and the customer is redirected to a "Waiting area" page. I need to create a cookie that would last for 10 secs and keep refreshing the time until the customer has closed ...
I would advise to use the session_start functionality and keep the users associated with their session ID in a database. In the session table you keep track of the created timestamp and can easily check which users are waiting using a single query. If you implement it only cookie based, you will not know who waits, bec...
PHP Cookie management here is what my client requirements are: 1> There is a common web page that lets each of the customer login. On successful login, a cookie is created and the customer is redirected to a "Waiting area" page. I need to create a cookie that would last for 10 secs and keep refreshing the time until th...
TITLE: PHP Cookie management QUESTION: here is what my client requirements are: 1> There is a common web page that lets each of the customer login. On successful login, a cookie is created and the customer is redirected to a "Waiting area" page. I need to create a cookie that would last for 10 secs and keep refreshing...
[ "php", "mysql", "session", "cookies" ]
2
1
311
3
0
2011-06-01T20:58:51.290000
2011-06-01T21:06:39.743000
6,207,625
6,207,694
different mock objects to compare objects in unit tests
I have Equals method that I am trying to tests. this method return true if object passed to is is same as this object. I test true condition as following. var mocks = new MockRepository(); var mockActionAlert = mocks.StrictMock (); var mockActionAlert2 = mocks.StrictMock (); bool comparer = mockActionAlert.Equals(mockA...
What you have shown doesn't appear to make any sense at all. You only have mocks in your test code - no real implementations at all. Not only are you not testing anything real, but since you are using mocks, your can even decide whether your pretend tests should fail or not. To do what (I think) you want, simply create...
different mock objects to compare objects in unit tests I have Equals method that I am trying to tests. this method return true if object passed to is is same as this object. I test true condition as following. var mocks = new MockRepository(); var mockActionAlert = mocks.StrictMock (); var mockActionAlert2 = mocks.Str...
TITLE: different mock objects to compare objects in unit tests QUESTION: I have Equals method that I am trying to tests. this method return true if object passed to is is same as this object. I test true condition as following. var mocks = new MockRepository(); var mockActionAlert = mocks.StrictMock (); var mockAction...
[ "c#", ".net", "xunit.net", "xunit" ]
2
1
2,577
1
0
2011-06-01T20:59:27.593000
2011-06-01T21:06:22.167000
6,207,635
6,251,387
.inc File Not Included Reliably
I am working on some HTML code that was inherited from another programmer, which uses include statements of the form: ~inc:filename.inc~ However, the problem I am encountering is that this include statement does not work reliably. About 90% of the time, all information in the included file is imported with no problem, ...
OK, so I downloaded the application library documentation and looked in TCPIP Stack Help.chm and found the HTTPIncFile function: void HTTPIncFile(ROM BYTE* cFile); Users should not call this function directly, but should instead add dynamic variables in the form of ~inc:filename.ext~ in their HTML code to include (for ...
.inc File Not Included Reliably I am working on some HTML code that was inherited from another programmer, which uses include statements of the form: ~inc:filename.inc~ However, the problem I am encountering is that this include statement does not work reliably. About 90% of the time, all information in the included fi...
TITLE: .inc File Not Included Reliably QUESTION: I am working on some HTML code that was inherited from another programmer, which uses include statements of the form: ~inc:filename.inc~ However, the problem I am encountering is that this include statement does not work reliably. About 90% of the time, all information ...
[ "html", "include", "pic", "firmware", "microchip" ]
3
0
799
1
0
2011-06-01T21:00:13.460000
2011-06-06T11:31:51.720000
6,207,644
6,207,898
Java for Iphone App Development?
I have been primarily using Java and have experience with it. I want to develop some iphone apps and wanted to know if there a way to develop iphone app using Java or iphone development can be only done using Objective-C? Also if Objective-C is the only way to go then would really appreciate if you can recommend some b...
From your comments, here is a book found through a quick google search for java developers to learn objective C. I used other books in this series (Learn Objective-C on the Mac, and Beginning iPhone Development) to learn iPhone development, so I assume it is good. And here is a link to a well done powerpoint presentati...
Java for Iphone App Development? I have been primarily using Java and have experience with it. I want to develop some iphone apps and wanted to know if there a way to develop iphone app using Java or iphone development can be only done using Objective-C? Also if Objective-C is the only way to go then would really appre...
TITLE: Java for Iphone App Development? QUESTION: I have been primarily using Java and have experience with it. I want to develop some iphone apps and wanted to know if there a way to develop iphone app using Java or iphone development can be only done using Objective-C? Also if Objective-C is the only way to go then ...
[ "java", "iphone" ]
5
1
3,636
7
0
2011-06-01T21:01:29.830000
2011-06-01T21:24:43.113000
6,207,647
6,209,242
Redirecting old permalink structure to the new one
I had a wordpress site installed in a sub folder with category/post-title permalink structure, which resulted in the following url structure http://www.mysite.com/subfolder/category/post-title However as I needed to move my site to the root folder and changed the permalink structure to year/month/post-title, which look...
Use WordPress › Redirection « WordPress Plugins, which will 301 redirect, import a csv of redirects and log 404s without having to deal with mod_rewrite and.htaccess.
Redirecting old permalink structure to the new one I had a wordpress site installed in a sub folder with category/post-title permalink structure, which resulted in the following url structure http://www.mysite.com/subfolder/category/post-title However as I needed to move my site to the root folder and changed the perma...
TITLE: Redirecting old permalink structure to the new one QUESTION: I had a wordpress site installed in a sub folder with category/post-title permalink structure, which resulted in the following url structure http://www.mysite.com/subfolder/category/post-title However as I needed to move my site to the root folder and...
[ "wordpress", "redirect", "permalinks" ]
1
3
1,941
3
0
2011-06-01T21:01:50.633000
2011-06-02T00:32:59.770000
6,207,648
6,207,685
jquery how to figure out what the JSON Object contains
I'm using JQuery with CodeIgniter PHP to figure make AJAX calls and return data via JSON. I want to figure out what my JSON object has returned, but I'm not sure what the syntax might be. Is there a way to just alert or log all the contents of the JSON object somehow? This is my code: $.ajax({ type: "GET", url: groups_...
Learn to love the Javascript console. The console.log method covers almost every eventuality -- giving you a nicely formatted summary of the object (or array, string, number, or boolean) that you're concerned with. console.log(parent); You can see the log by a console built into your browser (e.g. Chrome console, the F...
jquery how to figure out what the JSON Object contains I'm using JQuery with CodeIgniter PHP to figure make AJAX calls and return data via JSON. I want to figure out what my JSON object has returned, but I'm not sure what the syntax might be. Is there a way to just alert or log all the contents of the JSON object someh...
TITLE: jquery how to figure out what the JSON Object contains QUESTION: I'm using JQuery with CodeIgniter PHP to figure make AJAX calls and return data via JSON. I want to figure out what my JSON object has returned, but I'm not sure what the syntax might be. Is there a way to just alert or log all the contents of the...
[ "javascript", "debugging" ]
2
2
134
6
0
2011-06-01T21:01:54.633000
2011-06-01T21:06:02.853000
6,207,656
6,207,675
jquery choosing methods
I love using the hide() and show() methods, but I've come across someone's scripting where they never use it. Instead I see them using attr() for anything related to display. $("#element").attr("style", "visibility:hidden"); $("#element").attr("style", "visibility:visible"); Is this just purely preferential? Or is it m...
There is a difference. Take.hide() for example: This is roughly equivalent to calling.css('display', 'none'), (...) visibility and display are two different CSS properties. Using visibility: hidden; leaves space for the element in the layout but does not display it. Another (minor) difference is that calling.attr("styl...
jquery choosing methods I love using the hide() and show() methods, but I've come across someone's scripting where they never use it. Instead I see them using attr() for anything related to display. $("#element").attr("style", "visibility:hidden"); $("#element").attr("style", "visibility:visible"); Is this just purely ...
TITLE: jquery choosing methods QUESTION: I love using the hide() and show() methods, but I've come across someone's scripting where they never use it. Instead I see them using attr() for anything related to display. $("#element").attr("style", "visibility:hidden"); $("#element").attr("style", "visibility:visible"); Is...
[ "jquery-attributes" ]
3
3
47
3
0
2011-06-01T21:03:00.517000
2011-06-01T21:05:26.747000
6,207,669
6,207,866
Receiving commandline input while listening for connections in Python
I am trying to write a program that has clients connect to it while the server is still able to send commands to all of the clients. I am using the "Twisted" solution. How can I go about this? Here is the code I have so far (I understand that Twisted already uses non-blocking sockets): import threading print 'threading...
Since you're already using twisted, you should also use it for the console part, instead of using raw_input in a thread. Twisted's event loop can monitor any file descriptor for changes, including the standard input, so you can get event-based callbacks on a new line entered -- It works asynchronously without need for ...
Receiving commandline input while listening for connections in Python I am trying to write a program that has clients connect to it while the server is still able to send commands to all of the clients. I am using the "Twisted" solution. How can I go about this? Here is the code I have so far (I understand that Twisted...
TITLE: Receiving commandline input while listening for connections in Python QUESTION: I am trying to write a program that has clients connect to it while the server is still able to send commands to all of the clients. I am using the "Twisted" solution. How can I go about this? Here is the code I have so far (I under...
[ "python", "sockets", "client", "twisted" ]
6
6
1,624
1
0
2011-06-01T21:04:25.427000
2011-06-01T21:21:56.187000
6,207,671
6,208,785
Help with traversing a complex XSD document
My ultimate goal is to traverse an XSD document and display a TreeView (Silverlight 4.0) representation of all the XML elements in order as described by the XSD document. So, if I had an XSD file that describes a set of elements that would look like then I would want to display a TreeView like: a |_b | |_att1 | |_att2 ...
I'm not familiar with the XmlSchema API you refer to. Another way to tackle this would be to use the Saxon schema processor to generate an SCM file, which is an XML representation of the schema component model - effectively the compiled schema in "canonical" form, which is an XML representation that is much easier to n...
Help with traversing a complex XSD document My ultimate goal is to traverse an XSD document and display a TreeView (Silverlight 4.0) representation of all the XML elements in order as described by the XSD document. So, if I had an XSD file that describes a set of elements that would look like then I would want to displ...
TITLE: Help with traversing a complex XSD document QUESTION: My ultimate goal is to traverse an XSD document and display a TreeView (Silverlight 4.0) representation of all the XML elements in order as described by the XSD document. So, if I had an XSD file that describes a set of elements that would look like then I w...
[ "c#", "xml", "silverlight-4.0", "treeview", "xsd" ]
1
0
1,732
2
0
2011-06-01T21:04:45.127000
2011-06-01T23:11:12.070000
6,207,684
6,207,837
Qt: Storing a custom object in a collection by value
Let's say I have this class: class Bear { public: Bear (); Bear (Bear &other); //... methods private: BearInfo* m_pInfo; }; Can I store Bear objects in a QList by value? According to the documentation: Internally, QList is represented as an array of pointers to items of type T. If T is itself a pointer type or a basi...
Use a QVector, the Qt Documentation states this: QList, QLinkedList, and QVarLengthArray provide similar functionality. Here's an overview: For most purposes, QList is the right class to use. Operations like prepend() and insert() are usually faster than with QVector because of the way QList stores its items in memory ...
Qt: Storing a custom object in a collection by value Let's say I have this class: class Bear { public: Bear (); Bear (Bear &other); //... methods private: BearInfo* m_pInfo; }; Can I store Bear objects in a QList by value? According to the documentation: Internally, QList is represented as an array of pointers to ite...
TITLE: Qt: Storing a custom object in a collection by value QUESTION: Let's say I have this class: class Bear { public: Bear (); Bear (Bear &other); //... methods private: BearInfo* m_pInfo; }; Can I store Bear objects in a QList by value? According to the documentation: Internally, QList is represented as an array ...
[ "c++", "qt", "qlist" ]
0
2
3,184
3
0
2011-06-01T21:06:01.443000
2011-06-01T21:18:13.817000
6,207,688
6,217,309
Getting real-time call info on Cisco phones
I'm interested in getting only 3 bits of information for all calls that come-in to our call center: the caller, the number they dialed, and the number of the person that actually picked-up the call (different than the number the outside world dials). Until recently, we were accomplishing this by listening for JTAPI log...
if your moving to a linux only environment i am assuming you will be porting your existing applications to mono as.net does not run natively on linux why not use the the mono implementation of filesystemwatcher to accomplish the task the same way you have been doing or is this
Getting real-time call info on Cisco phones I'm interested in getting only 3 bits of information for all calls that come-in to our call center: the caller, the number they dialed, and the number of the person that actually picked-up the call (different than the number the outside world dials). Until recently, we were a...
TITLE: Getting real-time call info on Cisco phones QUESTION: I'm interested in getting only 3 bits of information for all calls that come-in to our call center: the caller, the number they dialed, and the number of the person that actually picked-up the call (different than the number the outside world dials). Until r...
[ "c#", ".net", "cisco", "jtapi" ]
3
0
1,978
1
0
2011-06-01T21:06:05.643000
2011-06-02T16:25:08.123000
6,207,689
6,207,830
Notification from IntentService - NullPointerException while obtaining Context
I am unable to generate the notification (in the notification area) from an IntentService. I get a NullPointerException while obtaining NotificationManager. The problem is with Context. 06-01 16:46:05.910: ERROR/AndroidRuntime(14745): Caused by: java.lang.NullPointerException 06-01 16:46:05.910: ERROR/AndroidRuntime(14...
Move your call to getSystemService out of the constructor and into onCreate. The base Context in the ContextWrapper has not been set yet, which is causing the NullPointerException.
Notification from IntentService - NullPointerException while obtaining Context I am unable to generate the notification (in the notification area) from an IntentService. I get a NullPointerException while obtaining NotificationManager. The problem is with Context. 06-01 16:46:05.910: ERROR/AndroidRuntime(14745): Caused...
TITLE: Notification from IntentService - NullPointerException while obtaining Context QUESTION: I am unable to generate the notification (in the notification area) from an IntentService. I get a NullPointerException while obtaining NotificationManager. The problem is with Context. 06-01 16:46:05.910: ERROR/AndroidRunt...
[ "android", "android-service", "android-notifications" ]
7
21
4,186
1
0
2011-06-01T21:06:13.720000
2011-06-01T21:17:36.607000
6,207,696
6,207,977
Apply function with outer taking the columns of two matrices as the elements of interest
Consider matrices d and r with dim(d) = J x D and dim(r) = J x R. Let fun(a, b) be a function that takes two vectors of the same length and returns some number. I want to treat the columns of d and r respectively as my units of interest and apply outer to them. The following code accomplishes this by creating lists of ...
You are pretty close. As described in this related question, all you need is the Vectorize() function to convert your Fun() function into a vectorized version: VecFun <- Vectorize( Fun ) Then you can simply do: outer(d.cols, r.cols, VecFun ) E.g. if you define Fun <- function(a,b) sum(a+b) and r,d matrices are defined ...
Apply function with outer taking the columns of two matrices as the elements of interest Consider matrices d and r with dim(d) = J x D and dim(r) = J x R. Let fun(a, b) be a function that takes two vectors of the same length and returns some number. I want to treat the columns of d and r respectively as my units of int...
TITLE: Apply function with outer taking the columns of two matrices as the elements of interest QUESTION: Consider matrices d and r with dim(d) = J x D and dim(r) = J x R. Let fun(a, b) be a function that takes two vectors of the same length and returns some number. I want to treat the columns of d and r respectively ...
[ "r" ]
8
11
6,935
1
0
2011-06-01T21:06:26.483000
2011-06-01T21:32:42.757000
6,207,701
6,207,920
Converting from dip to px
I currently have this running with the stack output below as it is throwing up an error. Resources r = getResources(); float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics()); > Uncaught handler: thread main exiting due to uncaught exception java.lang.RuntimeException: Unable to s...
I don't even really see what your question is, but the error seems as though it's caused by a String resource that isn't being found (Maybe try Fixing Android project properties?) Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xe at Maybe if you explain more what you want, I can try to...
Converting from dip to px I currently have this running with the stack output below as it is throwing up an error. Resources r = getResources(); float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics()); > Uncaught handler: thread main exiting due to uncaught exception java.lang.Run...
TITLE: Converting from dip to px QUESTION: I currently have this running with the stack output below as it is throwing up an error. Resources r = getResources(); float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics()); > Uncaught handler: thread main exiting due to uncaught excep...
[ "android" ]
0
0
1,001
1
0
2011-06-01T21:06:48.650000
2011-06-01T21:26:52.500000
6,207,702
6,207,953
Find unique name of device?
I'm developing an app that uses zeroconf (bonjour) to discover devices - so I need to give each android device some kind of name (not just a bunch of numbers and letters, but something meaningful like "Alex's Device"). In iOS it can be easily done - is this possible in android?
There can be many accounts linked to the device. You can use the AccountManager to get them. For example, emails on google accounts: AccountManager am = AccountManager.get(this); Account[] ac = am.getAccountsByType("com.google"); for (Account account: ac) { Log.d ("Account", ac.name); } Alternatively, you can use and...
Find unique name of device? I'm developing an app that uses zeroconf (bonjour) to discover devices - so I need to give each android device some kind of name (not just a bunch of numbers and letters, but something meaningful like "Alex's Device"). In iOS it can be easily done - is this possible in android?
TITLE: Find unique name of device? QUESTION: I'm developing an app that uses zeroconf (bonjour) to discover devices - so I need to give each android device some kind of name (not just a bunch of numbers and letters, but something meaningful like "Alex's Device"). In iOS it can be easily done - is this possible in andr...
[ "android", "networking", "bonjour", "zeroconf" ]
0
1
2,539
4
0
2011-06-01T21:06:52.900000
2011-06-01T21:30:13.590000
6,207,707
6,207,756
How to handle a linq query that returns zero rows and have it return decimal value?
When a this function is given an id that in SQL returns 0 rows I get the error below: The null value cannot be assigned to a member with type System.Decimal which is a non-nullable value type. What is the best way to modify the query to prevent this. I am pulling the value from a different table than I am querying here...
you should be able to either return: return (from o in _context.Details where o.CustomerID == companyId select o).Sum(p => p.SomeValue)?? -1.0; or decimal? temp = (from o in _context.Details where o.CustomerID == companyId select o).Sum(p => p.SomeValue); return temp?? -1.0; The?? operator will check for null, and if n...
How to handle a linq query that returns zero rows and have it return decimal value? When a this function is given an id that in SQL returns 0 rows I get the error below: The null value cannot be assigned to a member with type System.Decimal which is a non-nullable value type. What is the best way to modify the query to...
TITLE: How to handle a linq query that returns zero rows and have it return decimal value? QUESTION: When a this function is given an id that in SQL returns 0 rows I get the error below: The null value cannot be assigned to a member with type System.Decimal which is a non-nullable value type. What is the best way to m...
[ "c#", "linq", "linq-to-sql" ]
0
4
1,729
1
0
2011-06-01T21:07:25.233000
2011-06-01T21:11:14.907000
6,207,711
6,208,191
logrotate says permission denied when rotating log / re-creating log file
I'm new to logrotate on linux machines... here's what I have set up in my app's logrotate.d file: /var/log/myapp.log { daily missingok create 0660 root utmp rotate 1 } I set owner permissions on the myapp.log file for the account that runs the app in question, using chmod, directly from the bash shell. when the app fir...
I set owner permissions on the myapp.log file for the account that runs the app in question, using chmod, directly from the bash shell....so unless "the account that runs the app in question" is root, the config option create 0660 root utmp is wrong, because that is asking logrotate to create a new myapp.log (after it ...
logrotate says permission denied when rotating log / re-creating log file I'm new to logrotate on linux machines... here's what I have set up in my app's logrotate.d file: /var/log/myapp.log { daily missingok create 0660 root utmp rotate 1 } I set owner permissions on the myapp.log file for the account that runs the ap...
TITLE: logrotate says permission denied when rotating log / re-creating log file QUESTION: I'm new to logrotate on linux machines... here's what I have set up in my app's logrotate.d file: /var/log/myapp.log { daily missingok create 0660 root utmp rotate 1 } I set owner permissions on the myapp.log file for the accoun...
[ "linux", "file-permissions", "chmod", "permission-denied", "logrotate" ]
5
8
19,625
1
0
2011-06-01T21:07:41.507000
2011-06-01T21:54:59.663000
6,207,715
6,210,230
Altering Web.Config SessionTimeout value from within application
I am trying to work out a way to alter the session timeout dynamically, as my customer has requested that this be a value they can easily change (as though it were a database transaction). Here is a truncated version of the value I am trying to change: I'm working with C#/.Net 3.5 with all of this. For the record, I am...
Instead of trying to change web.config, how about changing Session.Timeout in code at runtime? More info: http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout.aspx
Altering Web.Config SessionTimeout value from within application I am trying to work out a way to alter the session timeout dynamically, as my customer has requested that this be a value they can easily change (as though it were a database transaction). Here is a truncated version of the value I am trying to change: I'...
TITLE: Altering Web.Config SessionTimeout value from within application QUESTION: I am trying to work out a way to alter the session timeout dynamically, as my customer has requested that this be a value they can easily change (as though it were a database transaction). Here is a truncated version of the value I am tr...
[ "c#", "asp.net", "web-config", "timeout" ]
2
1
4,430
3
0
2011-06-01T21:08:00.683000
2011-06-02T04:04:38.603000
6,207,717
6,207,743
:last-child is not being recognized
I have a scroll to function that I need to execute to scroll to the last message in its container, which is the container with chunk_id. The problem is that it works as is for going to the container, but if I add last-child into the mix the function does not work. Any ideas what I am doing wrong? Works $.scrollTo('div[...
I think you want to find the last child element of the div. Your code is currently selecting the last div with a particular chunk_id that is also the last child of its parent. This may well not exist. You should use the child selector > combined with:last-child to find the last child element of the element already sele...
:last-child is not being recognized I have a scroll to function that I need to execute to scroll to the last message in its container, which is the container with chunk_id. The problem is that it works as is for going to the container, but if I add last-child into the mix the function does not work. Any ideas what I am...
TITLE: :last-child is not being recognized QUESTION: I have a scroll to function that I need to execute to scroll to the last message in its container, which is the container with chunk_id. The problem is that it works as is for going to the container, but if I add last-child into the mix the function does not work. A...
[ "jquery" ]
2
3
151
2
0
2011-06-01T21:08:05.300000
2011-06-01T21:10:29.060000
6,207,723
6,207,940
How do I launch a webpage from a XUL app within XULRunner?
What is the XULRunner equivalent of the following button handler? function launch_page() { var win = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser'); win.openUILinkIn('http://www.google.com', 'window'); } This doe...
This works for now: // first construct an nsIURI object using the ioservice var ioservice = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var uriToOpen = ioservice.newURI("http://www.google.com/", null, null); var extps = Components.classes["@mozilla.org/urilo...
How do I launch a webpage from a XUL app within XULRunner? What is the XULRunner equivalent of the following button handler? function launch_page() { var win = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser'); win....
TITLE: How do I launch a webpage from a XUL app within XULRunner? QUESTION: What is the XULRunner equivalent of the following button handler? function launch_page() { var win = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigat...
[ "javascript", "xul", "xpcom", "xulrunner" ]
0
1
580
1
0
2011-06-01T21:08:36.937000
2011-06-01T21:28:53.847000
6,207,738
6,208,109
Running MySQL Query in Wordpress Causes HTML Markup to Disappear?
We're having an issue adding MySQL queries to our page. It seems that whenever something is run at the top of the page, the rest of the markup and php functions to follow don't show up/aren't run. Here's a sample query that causes this issue: global $wpdb; $add_query = "CREATE TABLE thetesttable ( id INT NOT NULL AUTO...
The problem is that your query is returning 0 which is interpreted as false in your statment: $wpdb->query($add_query) or die(mysql_error()); From the wpdb class reference: The function returns an integer corresponding to the number of rows affected/selected. If there is a MySQL error, the function will return FALSE. (...
Running MySQL Query in Wordpress Causes HTML Markup to Disappear? We're having an issue adding MySQL queries to our page. It seems that whenever something is run at the top of the page, the rest of the markup and php functions to follow don't show up/aren't run. Here's a sample query that causes this issue: global $wpd...
TITLE: Running MySQL Query in Wordpress Causes HTML Markup to Disappear? QUESTION: We're having an issue adding MySQL queries to our page. It seems that whenever something is run at the top of the page, the rest of the markup and php functions to follow don't show up/aren't run. Here's a sample query that causes this ...
[ "php", "mysql", "html", "wordpress" ]
1
3
728
2
0
2011-06-01T21:10:09.090000
2011-06-01T21:45:26.373000
6,207,740
6,207,846
PHP EOF shows only one result from loop
I am using in my PHP EOF. The problem is that it does display only one item coming from a mySQL loop. It shows only the last result. Is this necessary in EOF? or can I avoid this issue? Thanks function getYiBAdminBanner() { global $site; global $dir; $queryYiBmenu = "SELECT * FROM `(YiB)_cPanel_Menu` WHERE Type = 'top'...
Edit: based on your code sample: try $menu.= or $menu = $menu. rather than $menu =. But its unclear if you are expecting multiple results or not If you are looping through the results of a mySQL query you should be doing something like this: $query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE ...
PHP EOF shows only one result from loop I am using in my PHP EOF. The problem is that it does display only one item coming from a mySQL loop. It shows only the last result. Is this necessary in EOF? or can I avoid this issue? Thanks function getYiBAdminBanner() { global $site; global $dir; $queryYiBmenu = "SELECT * FRO...
TITLE: PHP EOF shows only one result from loop QUESTION: I am using in my PHP EOF. The problem is that it does display only one item coming from a mySQL loop. It shows only the last result. Is this necessary in EOF? or can I avoid this issue? Thanks function getYiBAdminBanner() { global $site; global $dir; $queryYiBme...
[ "php", "loops", "eof" ]
0
2
3,653
1
0
2011-06-01T21:10:17.823000
2011-06-01T21:19:08.947000
6,207,748
6,207,820
Does this method cause concurrency problems?
I have a CoreDataUtilities class with a class method that saves a managed object context and takes care of any errors: + (void)saveContext:(NSManagedObjectContext*)moc { NSError *error = nil; if (moc!= nil) { if ([moc hasChanges] &&![moc save:&error]) { NSLog(@"MOC save error: %@, %@", error, [error userInfo]); } } } I...
Why don't you put a @synchronize(...) block around the save operation. This will ensure that a managed object context won't be saved if it's already saving. + (void)saveContext:(NSManagedObjectContext*)moc { if (moc == nil) return; @synchronized(moc) { NSError *error = nil; if ([moc hasChanges] &&![moc save:&error]) N...
Does this method cause concurrency problems? I have a CoreDataUtilities class with a class method that saves a managed object context and takes care of any errors: + (void)saveContext:(NSManagedObjectContext*)moc { NSError *error = nil; if (moc!= nil) { if ([moc hasChanges] &&![moc save:&error]) { NSLog(@"MOC save erro...
TITLE: Does this method cause concurrency problems? QUESTION: I have a CoreDataUtilities class with a class method that saves a managed object context and takes care of any errors: + (void)saveContext:(NSManagedObjectContext*)moc { NSError *error = nil; if (moc!= nil) { if ([moc hasChanges] &&![moc save:&error]) { NSL...
[ "iphone", "ios", "core-data", "concurrency", "nsmanagedobjectcontext" ]
0
3
229
2
0
2011-06-01T21:10:52.720000
2011-06-01T21:17:01.680000
6,207,757
6,207,777
php.ini Error Reporting problem
I get this error: Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. In php.ini I have error reporting set as error_reporting = E_ALL & ~E_NOTICE. Any idea how I can get rid of those warnings? EDIT: I want to fix the Error Reporting as there's other kinds of Warnings showing up. ...
Find this section in the php.ini file: [Date]; Defines the default timezone used by the date functions; http://php.net/date.timezone date.timezone = Some/Timezone Uncomment it (remove the;) and change it to be the correct timezone. For a list of supported timezones: http://php.net/manual/en/timezones.php
php.ini Error Reporting problem I get this error: Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. In php.ini I have error reporting set as error_reporting = E_ALL & ~E_NOTICE. Any idea how I can get rid of those warnings? EDIT: I want to fix the Error Reporting as there's othe...
TITLE: php.ini Error Reporting problem QUESTION: I get this error: Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. In php.ini I have error reporting set as error_reporting = E_ALL & ~E_NOTICE. Any idea how I can get rid of those warnings? EDIT: I want to fix the Error Reporti...
[ "php", "ini", "error-reporting" ]
1
3
3,528
4
0
2011-06-01T21:11:17.470000
2011-06-01T21:13:08.260000
6,207,763
6,208,090
MySQL: Insert if this ip dont have any records
I use: INSERT INTO `rating` (`name`, `user`, `rating`, `section`, `ip`) VALUES ('$name', '{$_SESSION['user']}', '$rate', '$section', '{$_SERVER['REMOTE_ADDR']}');"; I would like to add an if condition in the IF statement so that. IF SELECT ip from rating where ip={$_SERVER['REMOTE_ADDR']} AND section=$section AND name=...
To expand on Eric's excellent answer. To add a unique constraint on each of the columns ip, name, section run the following code on the database ALTER TABLE `test`.`rating` ADD UNIQUE INDEX `name`(`name`), ADD UNIQUE INDEX `section`(`section`), ADD UNIQUE INDEX `ip`(`ip`); To run a unique constraint on the combination ...
MySQL: Insert if this ip dont have any records I use: INSERT INTO `rating` (`name`, `user`, `rating`, `section`, `ip`) VALUES ('$name', '{$_SESSION['user']}', '$rate', '$section', '{$_SERVER['REMOTE_ADDR']}');"; I would like to add an if condition in the IF statement so that. IF SELECT ip from rating where ip={$_SERVER...
TITLE: MySQL: Insert if this ip dont have any records QUESTION: I use: INSERT INTO `rating` (`name`, `user`, `rating`, `section`, `ip`) VALUES ('$name', '{$_SESSION['user']}', '$rate', '$section', '{$_SERVER['REMOTE_ADDR']}');"; I would like to add an if condition in the IF statement so that. IF SELECT ip from rating ...
[ "php", "mysql", "sql" ]
2
3
210
2
0
2011-06-01T21:11:58.557000
2011-06-01T21:43:07.167000
6,207,771
6,216,112
Svn to git: How to deal with our not-standard, probably wrongly branched svn
Our current svn structure looks like this: trunk -- project -- projectDao -- projectResources branches -- project-1.0 -- projectDao-1.0 -- projectResources-1.0 -- project-2.0 -- projectDao-2.0 -- projectResources-2.0 tags -- project-1.0.0 --... To make things worse project-1.0 was branched from project projectDao-1.0 f...
If I understand correctly, you want to change the imported branches to directories in a 1.0 branch. Furtheron you don't mention if this is a permanent migration or a git-svn checkout while you maintain your svn repository. In case this is just a git-svn checkout and the goal is to keep working with the original SVN as ...
Svn to git: How to deal with our not-standard, probably wrongly branched svn Our current svn structure looks like this: trunk -- project -- projectDao -- projectResources branches -- project-1.0 -- projectDao-1.0 -- projectResources-1.0 -- project-2.0 -- projectDao-2.0 -- projectResources-2.0 tags -- project-1.0.0 --.....
TITLE: Svn to git: How to deal with our not-standard, probably wrongly branched svn QUESTION: Our current svn structure looks like this: trunk -- project -- projectDao -- projectResources branches -- project-1.0 -- projectDao-1.0 -- projectResources-1.0 -- project-2.0 -- projectDao-2.0 -- projectResources-2.0 tags -- ...
[ "svn", "git", "branch" ]
5
5
198
2
0
2011-06-01T21:12:28.320000
2011-06-02T14:45:35.073000
6,207,775
6,207,791
iOS - same .app name
I've uploaded several.app's the the iTunes store, where the "executable" file (ie. filename.app) is the same. What are the repercussion's of this on an actual device, when an actual person downloads both onto their iPad/Phone/Touch, and possibly is running both? The best answer would be that it is inconsequential since...
The name you give the app is irrelevant. All that matters is the bundle ID. These must be unique. From the iTunesConnect Developer's Guide: An identifier used by iOS and Mac OS X to recognize any future updates to your app. Your Bundle ID must be registered with Apple and unique to your app. Bundle IDs are app-type spe...
iOS - same .app name I've uploaded several.app's the the iTunes store, where the "executable" file (ie. filename.app) is the same. What are the repercussion's of this on an actual device, when an actual person downloads both onto their iPad/Phone/Touch, and possibly is running both? The best answer would be that it is ...
TITLE: iOS - same .app name QUESTION: I've uploaded several.app's the the iTunes store, where the "executable" file (ie. filename.app) is the same. What are the repercussion's of this on an actual device, when an actual person downloads both onto their iPad/Phone/Touch, and possibly is running both? The best answer wo...
[ "ios" ]
0
3
597
1
0
2011-06-01T21:12:57.183000
2011-06-01T21:14:42.380000
6,207,778
6,207,821
call a php function from jquery
I'm trying to figure out the best way to do this...I am using JQuery to submit data to a PHP function, which sends back data from the DB as JSON, which is working. The thing is, on success, I want the JQuery to execute a PHP function...and I'd rather not have to make yet another AJAX call on top of the first AJAX succe...
In your php script that builds your response, just add an extra property to your object that is the html string you want to put into your page and then have javascript put it where it needs to go. You have no choice but to run php functions on the server.
call a php function from jquery I'm trying to figure out the best way to do this...I am using JQuery to submit data to a PHP function, which sends back data from the DB as JSON, which is working. The thing is, on success, I want the JQuery to execute a PHP function...and I'd rather not have to make yet another AJAX cal...
TITLE: call a php function from jquery QUESTION: I'm trying to figure out the best way to do this...I am using JQuery to submit data to a PHP function, which sends back data from the DB as JSON, which is working. The thing is, on success, I want the JQuery to execute a PHP function...and I'd rather not have to make ye...
[ "php", "jquery", "ajax", "json", "codeigniter" ]
1
3
504
4
0
2011-06-01T21:13:08.513000
2011-06-01T21:17:08.040000
6,207,784
6,208,184
c# SslStream.Read Loop problem
I've been learning C# by creating an app and i've hit a snag i'm really struggling with. Basicly i have the code below which is what im using to read from a network stream I have setup. It works but as its only reading 1 packet for each time the sslstream.Read() unblocks. It's causes a big backlog of messages. What im ...
If you are using.Net 3.5 or later I would highly suggest you look into Windows Communication Foundation (wcf). It will simply anything you are trying to do over a network. On the other hand, if you are doing this purely for educational purposes. Take a look at this link. Your best bet is to read from the stream in some...
c# SslStream.Read Loop problem I've been learning C# by creating an app and i've hit a snag i'm really struggling with. Basicly i have the code below which is what im using to read from a network stream I have setup. It works but as its only reading 1 packet for each time the sslstream.Read() unblocks. It's causes a bi...
TITLE: c# SslStream.Read Loop problem QUESTION: I've been learning C# by creating an app and i've hit a snag i'm really struggling with. Basicly i have the code below which is what im using to read from a network stream I have setup. It works but as its only reading 1 packet for each time the sslstream.Read() unblocks...
[ "c#", ".net", "networkstream", "sslstream" ]
0
0
1,980
1
0
2011-06-01T21:13:45.577000
2011-06-01T21:53:40.143000
6,207,785
6,207,844
how to convert csv into dict format
I have a.csv file as below: OLD,NEW AA,XX BB,YY CC,ZZ I wanna convert it to dict format, say dict1 = {'AA':'XX','BB':'YY','CC':'ZZ'} Should I use DictReader or join string?
with open('file.csv') as f: f.readline() # ignore first line (header) mydict = dict(csv.reader(f, delimiter=',')) print mydict
how to convert csv into dict format I have a.csv file as below: OLD,NEW AA,XX BB,YY CC,ZZ I wanna convert it to dict format, say dict1 = {'AA':'XX','BB':'YY','CC':'ZZ'} Should I use DictReader or join string?
TITLE: how to convert csv into dict format QUESTION: I have a.csv file as below: OLD,NEW AA,XX BB,YY CC,ZZ I wanna convert it to dict format, say dict1 = {'AA':'XX','BB':'YY','CC':'ZZ'} Should I use DictReader or join string? ANSWER: with open('file.csv') as f: f.readline() # ignore first line (header) mydict = dict(...
[ "python", "csv" ]
5
13
6,004
1
0
2011-06-01T21:13:53.913000
2011-06-01T21:18:55.313000
6,207,788
6,207,865
How to map a MySQL char(n) column to an instance variable using a JPA/Hibernate annotation?
I encounter a JPA/Hibernate mapping problem on a column "language" in a MySQL table whose type is char(7). In my entity, the code generated for the field is: private String language; this causes the following exception at runtime:... 43 more Caused by: javax.persistence.PersistenceException: [PersistenceUnit: prosvetaP...
Try this: @Column(name="language",columnDefinition="char(7)") see if that works.
How to map a MySQL char(n) column to an instance variable using a JPA/Hibernate annotation? I encounter a JPA/Hibernate mapping problem on a column "language" in a MySQL table whose type is char(7). In my entity, the code generated for the field is: private String language; this causes the following exception at runtim...
TITLE: How to map a MySQL char(n) column to an instance variable using a JPA/Hibernate annotation? QUESTION: I encounter a JPA/Hibernate mapping problem on a column "language" in a MySQL table whose type is char(7). In my entity, the code generated for the field is: private String language; this causes the following e...
[ "mysql", "hibernate", "jpa-2.0" ]
20
34
21,947
2
0
2011-06-01T21:14:28.687000
2011-06-01T21:21:44.563000
6,207,796
6,256,809
How to submit non English extension to Mozilla Add-ons website?
I have written extension for Firefox, this extension is not in English language. When uploading extension to Google Chrome gallery I just have to select the language in which the extension is, but when uploading to Mozilla Add-ons website it seems that my extension will automatically fall back to English language. Is t...
Addons.Mozilla.Org supports falling back to any locale. You need to go to "Edit Add-on Listing" for your add-on and then click Edit for the "Add-on Details" section. There you have a field called "Default Locale" - change it to your preferred fallback language. If you have trouble finding the field in your language, yo...
How to submit non English extension to Mozilla Add-ons website? I have written extension for Firefox, this extension is not in English language. When uploading extension to Google Chrome gallery I just have to select the language in which the extension is, but when uploading to Mozilla Add-ons website it seems that my ...
TITLE: How to submit non English extension to Mozilla Add-ons website? QUESTION: I have written extension for Firefox, this extension is not in English language. When uploading extension to Google Chrome gallery I just have to select the language in which the extension is, but when uploading to Mozilla Add-ons website...
[ "firefox", "firefox-addon", "add-on" ]
1
1
132
1
0
2011-06-01T21:15:18.443000
2011-06-06T19:08:07.130000
6,207,800
6,271,695
<rich:tree> NullPointerException on Node Click
I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a im using for navigation. When I click on a node in the tree my selectionListener should navigate me to the page associated with that node. But when I click on a node I get a NullPointerException: SEVERE: java.lang.NullPointerException javax.fa...
I managed to get my application working. I added rowKeyConverter="org.richfaces.IntegerSequenceRowKeyConverter" to my which seems to have overcome the issue and is calling my selection listener.
<rich:tree> NullPointerException on Node Click I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a im using for navigation. When I click on a node in the tree my selectionListener should navigate me to the page associated with that node. But when I click on a node I get a NullPointerException: ...
TITLE: <rich:tree> NullPointerException on Node Click QUESTION: I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a im using for navigation. When I click on a node in the tree my selectionListener should navigate me to the page associated with that node. But when I click on a node I get a Null...
[ "jsf", "richfaces" ]
1
4
1,694
1
0
2011-06-01T21:15:33.927000
2011-06-07T21:09:13.703000
6,207,802
6,208,019
Adding Outlook appointment using ASP.Net
I am creating an ASP.Net MVC project where users will add Outlook appointments to other users calendars. I other words; I wish for a user of my web app to be able to add an appointment directly in another persons calendar. This means sending it via email with no need for the receiver to accept it. It should be as if th...
You can create an ICS file that the user can double click and store the appointment. If multiple users, it can be sent to others. If you can get access to their exchange server (sounds like you can't), as SLaks asked, you can use something like this (http://goo.gl/G2nrd). If you have no access to Exchange directly, the...
Adding Outlook appointment using ASP.Net I am creating an ASP.Net MVC project where users will add Outlook appointments to other users calendars. I other words; I wish for a user of my web app to be able to add an appointment directly in another persons calendar. This means sending it via email with no need for the rec...
TITLE: Adding Outlook appointment using ASP.Net QUESTION: I am creating an ASP.Net MVC project where users will add Outlook appointments to other users calendars. I other words; I wish for a user of my web app to be able to add an appointment directly in another persons calendar. This means sending it via email with n...
[ "asp.net-mvc", "outlook", "exchange-server", "icalendar" ]
0
1
2,307
1
0
2011-06-01T21:15:42.100000
2011-06-01T21:36:12.980000
6,207,806
6,207,869
How do I reference a textarea value in another table cell?
I want to reference the content of a text area, but I keep getting undefined: $(".send-comment").click(function(e) { e.preventDefault(); var data = $(this).siblings(".comment-text").val(); alert(data); }); #textAreaTag(label=false, name="comment[text]", class="comment-text")# #submitTag(value="Send", class="send-commen...
Try this: $(".send-comment").click(function(e) { e.preventDefault(); var prevCell = $(this).parent().prev(); var data = $(".comment-text", prevCell).val(); alert(data); }); Alternate: $(".send-comment").click(function(e) { e.preventDefault(); var data = $(".comment-text", $(this).closest("tr")).val(); alert(data); });
How do I reference a textarea value in another table cell? I want to reference the content of a text area, but I keep getting undefined: $(".send-comment").click(function(e) { e.preventDefault(); var data = $(this).siblings(".comment-text").val(); alert(data); }); #textAreaTag(label=false, name="comment[text]", class="...
TITLE: How do I reference a textarea value in another table cell? QUESTION: I want to reference the content of a text area, but I keep getting undefined: $(".send-comment").click(function(e) { e.preventDefault(); var data = $(this).siblings(".comment-text").val(); alert(data); }); #textAreaTag(label=false, name="comme...
[ "jquery", "jquery-selectors" ]
0
1
256
3
0
2011-06-01T21:16:08.380000
2011-06-01T21:22:04.173000
6,207,810
6,207,923
rails and sql where IS NOT NULL not working properly with join. Rails 2.3.5 and Ruby 1.8.7 - mysql 5
I have 3 tables & models: brands brand_data_records and brand_data_records_brands - the join table In rails i want all brand_data_records for a given date range for a given brand where a given attribute is not null in the db. So I have: BrandDataRecord.find(:all,:select => column_match,:joins =>:brands,:conditions => [...
You probably mean to reference the column: `sentiment` IS NOT NULL What you're doing inadvertently is asserting that the string 'sentiment' is not null, which of course it will never be. Passing in:sentiment or 'sentiment'.to_sym' in your conditions should fix this as symbols get escaped with backquotes on conversion.
rails and sql where IS NOT NULL not working properly with join. Rails 2.3.5 and Ruby 1.8.7 - mysql 5 I have 3 tables & models: brands brand_data_records and brand_data_records_brands - the join table In rails i want all brand_data_records for a given date range for a given brand where a given attribute is not null in t...
TITLE: rails and sql where IS NOT NULL not working properly with join. Rails 2.3.5 and Ruby 1.8.7 - mysql 5 QUESTION: I have 3 tables & models: brands brand_data_records and brand_data_records_brands - the join table In rails i want all brand_data_records for a given date range for a given brand where a given attribut...
[ "sql", "ruby-on-rails", "inner-join" ]
2
1
1,956
1
0
2011-06-01T21:16:17.053000
2011-06-01T21:27:11.753000
6,207,812
6,209,066
MVC2 in jsp/servlet application
Here's the scenario, I am working on a web-based application develped used JSP/Servlet technique, and we adopt MVC2 as an architectural design pattern, we put all the methods that make manipulation on database into one class, for example, addNewUser(), updateUserInfo (), all methods that make connection to db and manip...
That's the (business) model. The controller should be the servlet and the view should be the JSP.
MVC2 in jsp/servlet application Here's the scenario, I am working on a web-based application develped used JSP/Servlet technique, and we adopt MVC2 as an architectural design pattern, we put all the methods that make manipulation on database into one class, for example, addNewUser(), updateUserInfo (), all methods that...
TITLE: MVC2 in jsp/servlet application QUESTION: Here's the scenario, I am working on a web-based application develped used JSP/Servlet technique, and we adopt MVC2 as an architectural design pattern, we put all the methods that make manipulation on database into one class, for example, addNewUser(), updateUserInfo ()...
[ "jsp", "servlets" ]
0
1
613
1
0
2011-06-01T21:16:20.367000
2011-06-01T23:59:44.313000
6,207,815
6,237,937
Issue Loading Google +1 Widget Asynchronously
I have a few widgets on the site I'm developing and I load them all asynchronously from a javascript file so it does not hold up the DOM from finishing. For instance, I do this with the Digg and Buzz widgets and it works fine: // Buzz Share function buzzShare() { $jQ('.sharebox').append(' '); $jQ.getScript('http://www....
The method I described in my question works perfectly. There was merely some sort of bug on Google's end if I am correct. I was trying to get the feature working just a few hours after they announced it. About two days later, it now works perfectly. The.getScript method is a good way to load the +1 via AJAX.
Issue Loading Google +1 Widget Asynchronously I have a few widgets on the site I'm developing and I load them all asynchronously from a javascript file so it does not hold up the DOM from finishing. For instance, I do this with the Digg and Buzz widgets and it works fine: // Buzz Share function buzzShare() { $jQ('.shar...
TITLE: Issue Loading Google +1 Widget Asynchronously QUESTION: I have a few widgets on the site I'm developing and I load them all asynchronously from a javascript file so it does not hold up the DOM from finishing. For instance, I do this with the Digg and Buzz widgets and it works fine: // Buzz Share function buzzSh...
[ "jquery", "google-buzz", "google-plus-one" ]
5
1
4,070
7
0
2011-06-01T21:16:35.890000
2011-06-04T16:28:06.020000
6,207,817
6,207,969
Regular expression syntax
I have a similar problem, to a previously asked question. But similar practices apparently do not produce similar results. Previous Question New question - I want to match the lines beginning in T as the first match, and the following lines beginning with X as the second match (as a whole string, to be later matched by...
Try this instead: ^(T[^\s]+)[\n\r\s]((?:(?:X\S+)[\n\r\s])+) It makes the groups for the X lines into non-capturing groups, then puts all the repetitions of the final pattern into a single group. All the X lines will be in a single capture. You can test this using Rubular (an indispensable tool for developing regular ex...
Regular expression syntax I have a similar problem, to a previously asked question. But similar practices apparently do not produce similar results. Previous Question New question - I want to match the lines beginning in T as the first match, and the following lines beginning with X as the second match (as a whole stri...
TITLE: Regular expression syntax QUESTION: I have a similar problem, to a previously asked question. But similar practices apparently do not produce similar results. Previous Question New question - I want to match the lines beginning in T as the first match, and the following lines beginning with X as the second matc...
[ "ruby", "regex" ]
2
2
154
3
0
2011-06-01T21:16:45.747000
2011-06-01T21:31:51.550000
6,207,819
6,208,938
Boyer Moore Algorithm Understanding and Example?
I am facing issues in understanding Boyer Moore String Search algorithm. I am following the following document. Link I am not able to work out my way as to exactly what is the real meaning of delta1 and delta2 here, and how are they applying this to find string search algorithm. Language looked little vague.. Kindly if...
The algorithm is based on a simple principle. Suppose that I'm trying to match a substring of length m. I'm going to first look at character at index m. If that character is not in my string, I know that the substring I want can't start in characters at indices 1, 2,..., m. If that character is in my string, I'll assum...
Boyer Moore Algorithm Understanding and Example? I am facing issues in understanding Boyer Moore String Search algorithm. I am following the following document. Link I am not able to work out my way as to exactly what is the real meaning of delta1 and delta2 here, and how are they applying this to find string search al...
TITLE: Boyer Moore Algorithm Understanding and Example? QUESTION: I am facing issues in understanding Boyer Moore String Search algorithm. I am following the following document. Link I am not able to work out my way as to exactly what is the real meaning of delta1 and delta2 here, and how are they applying this to fin...
[ "algorithm", "string-search" ]
34
48
40,995
2
0
2011-06-01T21:16:50.050000
2011-06-01T23:36:49.823000
6,207,838
6,207,902
How to get a list of the arguments a method is called with
How do I get a list of the arguments passed to a method, preferably one that I can iterate through? For example something like def foo(a,b,c) puts args.inspect end foo(1,2,3) => [1,2,3]? Thanks!
You can always define a method that takes an arbitrary number of arguments: def foo(*args) puts args.inspect end This does exactly what you want, but only works on methods defined in such a manner. The *args notation means "zero or more arguments" in this context. The opposite of this is the splat operator which expand...
How to get a list of the arguments a method is called with How do I get a list of the arguments passed to a method, preferably one that I can iterate through? For example something like def foo(a,b,c) puts args.inspect end foo(1,2,3) => [1,2,3]? Thanks!
TITLE: How to get a list of the arguments a method is called with QUESTION: How do I get a list of the arguments passed to a method, preferably one that I can iterate through? For example something like def foo(a,b,c) puts args.inspect end foo(1,2,3) => [1,2,3]? Thanks! ANSWER: You can always define a method that ta...
[ "ruby-on-rails", "ruby" ]
4
3
6,901
3
0
2011-06-01T21:18:17.127000
2011-06-01T21:25:00.723000
6,207,840
6,208,125
bash script to find unique value in a file with index
I have a text file,test.txt, like shekhar cbv ravi cbv ravi sdf asd df ravi Df ravi dfg ravi df ravi dfg ravi df afas cvb sdf hgh sasdg cfg I want to sort based on 2nd field and want to write 2nd field only on "result.txt" Currently I am doing following: sort -k 2,2 test.txt| uniq -i -f 1 | cut -d ' ' -f2 > result.txt ...
Try this command to print column with all original indexes: awk '{k=tolower($2); arr[k]=arr[k] " " NR} END{for(v in arr) print v, arr[v]}' test.txt | sort -f -k 1,1 OUTPUT cbv 1 2 cfg 12 cvb 10 df 4 5 7 9 dfg 6 8 hgh 11 sdf 3 Update: using awk only solution awk '{k=tolower($2); arr[k]=arr[k] " " NR} END{n=asorti(arr, d...
bash script to find unique value in a file with index I have a text file,test.txt, like shekhar cbv ravi cbv ravi sdf asd df ravi Df ravi dfg ravi df ravi dfg ravi df afas cvb sdf hgh sasdg cfg I want to sort based on 2nd field and want to write 2nd field only on "result.txt" Currently I am doing following: sort -k 2,2...
TITLE: bash script to find unique value in a file with index QUESTION: I have a text file,test.txt, like shekhar cbv ravi cbv ravi sdf asd df ravi Df ravi dfg ravi df ravi dfg ravi df afas cvb sdf hgh sasdg cfg I want to sort based on 2nd field and want to write 2nd field only on "result.txt" Currently I am doing foll...
[ "linux", "bash" ]
2
2
2,086
4
0
2011-06-01T21:18:30.150000
2011-06-01T21:46:45.407000
6,207,842
6,207,917
cocos2d coordinates system
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Score: #" fontName:@"Arial" fontSize:14]; // ask director the the window size CGSize size = [[CCDirector sharedDirector] winSize]; // position the label on the center of the screen label.position = ccp( size.width + 0, size.height + 0 ); // add the label as a child t...
In codos2d, the point (0,0) is the bottom left corner of the screen. Think of it as quadrant 1 on a x,y plane where x increases as you go right, and y increases as you go up. So to get the label in the bottom left just do label.position = ccp(0, 0); but this might be the default so you might not have to do anything.
cocos2d coordinates system CCLabelTTF *label = [CCLabelTTF labelWithString:@"Score: #" fontName:@"Arial" fontSize:14]; // ask director the the window size CGSize size = [[CCDirector sharedDirector] winSize]; // position the label on the center of the screen label.position = ccp( size.width + 0, size.height + 0 ); //...
TITLE: cocos2d coordinates system QUESTION: CCLabelTTF *label = [CCLabelTTF labelWithString:@"Score: #" fontName:@"Arial" fontSize:14]; // ask director the the window size CGSize size = [[CCDirector sharedDirector] winSize]; // position the label on the center of the screen label.position = ccp( size.width + 0, size...
[ "iphone", "ios4", "cocos2d-iphone" ]
1
3
2,253
3
0
2011-06-01T21:18:46.187000
2011-06-01T21:26:41.307000
6,207,848
6,207,880
Problem mapping multiple relations using Entity Framework code-first
Scenario I have a model that has the following setup: A member can be member of multiple memberlists. A memberlist can have multiple members. I also defined that a memberlist can have a seperate set of optional members. Basically I have a double n-m relationship between member and memberlist. What's more, a memberlist ...
All your mappings contain.WithMany(member => member.MemberLists). That is incorrect. You need separate navigation property for each relation = you can use each navigation property only for one relation mapping.
Problem mapping multiple relations using Entity Framework code-first Scenario I have a model that has the following setup: A member can be member of multiple memberlists. A memberlist can have multiple members. I also defined that a memberlist can have a seperate set of optional members. Basically I have a double n-m r...
TITLE: Problem mapping multiple relations using Entity Framework code-first QUESTION: Scenario I have a model that has the following setup: A member can be member of multiple memberlists. A memberlist can have multiple members. I also defined that a memberlist can have a seperate set of optional members. Basically I h...
[ "c#", ".net", "entity-framework", "entity-framework-4.1", "ef-code-first" ]
4
8
6,802
1
0
2011-06-01T21:19:11.940000
2011-06-01T21:23:14.143000
6,207,852
6,208,402
Automating outlook
a task was thrown in my lap that requires me to: Iterate through many (1000's) of message folders in outlook 2010 for each folder in a specific subfolder, right click a menu, select export as pdf (this is a plugin "DocumentExporter"), and click the ok button I use outlook rarely, so I've never automated it to this exte...
I do not have Outlook here so the following is air-code. Sub DoIt() Recurse ActiveExplorer.CurrentFolder ' select relevant folder in Outlook first End Sub Sub Recurse(f as MAPIFolder) Dim sf As MAPIFolder PrintPdf For Each sf In f.Folders ' open a potential sub-tree of folders, and move down one folder in the UI Sen...
Automating outlook a task was thrown in my lap that requires me to: Iterate through many (1000's) of message folders in outlook 2010 for each folder in a specific subfolder, right click a menu, select export as pdf (this is a plugin "DocumentExporter"), and click the ok button I use outlook rarely, so I've never automa...
TITLE: Automating outlook QUESTION: a task was thrown in my lap that requires me to: Iterate through many (1000's) of message folders in outlook 2010 for each folder in a specific subfolder, right click a menu, select export as pdf (this is a plugin "DocumentExporter"), and click the ok button I use outlook rarely, so...
[ ".net", "vba", "outlook" ]
4
2
483
1
0
2011-06-01T21:19:37.677000
2011-06-01T22:16:25.413000
6,207,868
6,208,871
How to redirect a page and disguise its url?
I need to do the following on my apache webserver: Redirect any URL starting with: http://mydomain1.com/archive to http://mydomain2.com/archive Is there a way using mod-rewrite or RewriteEngine to disguise that URL, so that the URL that appears in the browser is mydomain1.com? I don't want to give away the fact that we...
Try adding this in the.htaccess from domain1.com/archive RewriteEngine On RewriteRule (.*) http://mydomain2.com/archive [P] Edit: Tell me if you've tried this and if it worked or not.
How to redirect a page and disguise its url? I need to do the following on my apache webserver: Redirect any URL starting with: http://mydomain1.com/archive to http://mydomain2.com/archive Is there a way using mod-rewrite or RewriteEngine to disguise that URL, so that the URL that appears in the browser is mydomain1.co...
TITLE: How to redirect a page and disguise its url? QUESTION: I need to do the following on my apache webserver: Redirect any URL starting with: http://mydomain1.com/archive to http://mydomain2.com/archive Is there a way using mod-rewrite or RewriteEngine to disguise that URL, so that the URL that appears in the brows...
[ "apache", "mod-rewrite", "redirect", "webserver" ]
2
1
493
3
0
2011-06-01T21:22:03.907000
2011-06-01T23:25:46.907000
6,207,870
6,207,993
How do I write text to the username/password input controls of a 3rd party page using ASP.NET?
My title is pretty much the question: "How do I write text to the username/password input controls of a 3rd party web page using ASP.NET?" Just for examples sake, if I wanted to write an ASP.NET page that would initially authenticate a user on my end, and then redirect to a 3rd party site and log into it using the fiel...
Basically you need to use the WebRequest class and simulate a user controlling a web browser and manually execute each GET and POST operation that is required to log into the site.
How do I write text to the username/password input controls of a 3rd party page using ASP.NET? My title is pretty much the question: "How do I write text to the username/password input controls of a 3rd party web page using ASP.NET?" Just for examples sake, if I wanted to write an ASP.NET page that would initially auth...
TITLE: How do I write text to the username/password input controls of a 3rd party page using ASP.NET? QUESTION: My title is pretty much the question: "How do I write text to the username/password input controls of a 3rd party web page using ASP.NET?" Just for examples sake, if I wanted to write an ASP.NET page that wo...
[ ".net", "asp.net" ]
0
1
153
2
0
2011-06-01T21:22:21.363000
2011-06-01T21:34:14.533000
6,207,871
6,208,545
number of php query results does not match terminal results from Oracle's Toad
I got the fix but I need the explanation why and leaving this as a references for other people: The Problem is we got this view, say A, that is built upon another view B. If you do a select * from view A, you get say 37 records. Great, now if you run this via PHP adobdb, it gives you 525 records! The reason why this ha...
The bug was this line: AND p.created_on > TO_DATE ('23-SEP-10') The fix is: AND p.created_on > TO_DATE ('2010/09/23', 'YYYY/MM/DD')
number of php query results does not match terminal results from Oracle's Toad I got the fix but I need the explanation why and leaving this as a references for other people: The Problem is we got this view, say A, that is built upon another view B. If you do a select * from view A, you get say 37 records. Great, now i...
TITLE: number of php query results does not match terminal results from Oracle's Toad QUESTION: I got the fix but I need the explanation why and leaving this as a references for other people: The Problem is we got this view, say A, that is built upon another view B. If you do a select * from view A, you get say 37 rec...
[ "php", "oracle10g" ]
0
0
52
1
0
2011-06-01T21:22:32.143000
2011-06-01T22:36:47.333000
6,207,877
6,215,441
How to provide X11 with a wm_name for a Qt4 window?
Background I am about to resolve another issue, which consists in reserving screen-space for a Qt Window on X11. For this i use PyQt4 and Python-Xlib. Situation The application i want to save screen space for is a frameless Qt Window, 25px high and screen-wide, it's a panel in fact. The simplified code looks like this:...
Although i don't quite know what the unnamed window is (and it seems related to launching the QtPanel application, the Xlib script is not able to find the window on display because it is queried before the event loop QApplication._exec(). A thread may be required to do that outside of the main loop.
How to provide X11 with a wm_name for a Qt4 window? Background I am about to resolve another issue, which consists in reserving screen-space for a Qt Window on X11. For this i use PyQt4 and Python-Xlib. Situation The application i want to save screen space for is a frameless Qt Window, 25px high and screen-wide, it's a...
TITLE: How to provide X11 with a wm_name for a Qt4 window? QUESTION: Background I am about to resolve another issue, which consists in reserving screen-space for a Qt Window on X11. For this i use PyQt4 and Python-Xlib. Situation The application i want to save screen space for is a frameless Qt Window, 25px high and s...
[ "python", "pyqt4", "x11", "xlib" ]
2
0
1,097
1
0
2011-06-01T21:23:01.790000
2011-06-02T13:50:50.183000
6,207,879
6,208,089
Java: HttpResponse headers never have "Content-Encoding" but do have "Vary: Accept-Encoding"
I'm using the following example: http://www.devdaily.com/java/jwarehouse/commons-httpclient-4.0.3/httpclient/src/examples/org/apache/http/examples/client/ClientGZipContentCompression.java.shtml While adding "Accept-Encoding: gzip" to the headers is expected to tell the server you can receive gxip encoding back, it does...
Your server is probably not configured to return gzip'ped content. EDIT: against http://apache.org/, the code works as described. The paste is at http://pastebin.com/Ajj4XBb1
Java: HttpResponse headers never have "Content-Encoding" but do have "Vary: Accept-Encoding" I'm using the following example: http://www.devdaily.com/java/jwarehouse/commons-httpclient-4.0.3/httpclient/src/examples/org/apache/http/examples/client/ClientGZipContentCompression.java.shtml While adding "Accept-Encoding: gz...
TITLE: Java: HttpResponse headers never have "Content-Encoding" but do have "Vary: Accept-Encoding" QUESTION: I'm using the following example: http://www.devdaily.com/java/jwarehouse/commons-httpclient-4.0.3/httpclient/src/examples/org/apache/http/examples/client/ClientGZipContentCompression.java.shtml While adding "A...
[ "java", "gzip", "httpclient", "httpresponse", "content-encoding" ]
0
1
3,985
1
0
2011-06-01T21:23:14.213000
2011-06-01T21:43:06.283000
6,207,888
6,208,343
Large performance difference: Using sysdate vs using pre-formatted date
Why is there such a huge performance difference between these two queries? -- (89 seconds) SELECT max(mydate) FROM mytable WHERE eqpid = 'ABCDEFG' AND mydate < sysdate - 5 vs. -- (0.6 seconds) SELECT max(mydate) FROM mytable WHERE eqpid = 'ABCDEFG' AND mydate < TO_DATE('05/27/2011 03:13:00', 'MM/DD/YYYY HH24:MI:SS') --...
Jonathan Lewis has written about issues with sysdate in 9i; have a look at the 'surprising sysdate' section here, for example. Essentially the arithmetic on sysdate seems to confuse the optimizer, so in this case it thinks the index on mydate is more selective. This seems like quite an extreme example though. (Original...
Large performance difference: Using sysdate vs using pre-formatted date Why is there such a huge performance difference between these two queries? -- (89 seconds) SELECT max(mydate) FROM mytable WHERE eqpid = 'ABCDEFG' AND mydate < sysdate - 5 vs. -- (0.6 seconds) SELECT max(mydate) FROM mytable WHERE eqpid = 'ABCDEFG'...
TITLE: Large performance difference: Using sysdate vs using pre-formatted date QUESTION: Why is there such a huge performance difference between these two queries? -- (89 seconds) SELECT max(mydate) FROM mytable WHERE eqpid = 'ABCDEFG' AND mydate < sysdate - 5 vs. -- (0.6 seconds) SELECT max(mydate) FROM mytable WHERE...
[ "sql", "performance", "oracle", "oracle9i" ]
8
6
1,940
2
0
2011-06-01T21:24:19.293000
2011-06-01T22:10:14.167000
6,207,916
6,207,991
How to get currently active item`s index number (and not active item`s id) on a card layout on Extjs?
How do I get the currently active item's index number (and not active item's id) on a card layout? The following code will return active item's id: Ext.getCmp('my-wizard').getLayout().activeItem.id]; What if I don't want to define an id for my component items and I just want to access active item's index number?
I couldn't find a built-in quick and easy way, but the following would work: var wiz = Ext.getCmp('my-wizard'); var activeItem = wiz.getLayout().activeItem; var activeIndex = wiz.items.indexOf(activeItem); If this was something that you wanted to do often, you could add it to the CardLayout prototype: Ext.override(Ext....
How to get currently active item`s index number (and not active item`s id) on a card layout on Extjs? How do I get the currently active item's index number (and not active item's id) on a card layout? The following code will return active item's id: Ext.getCmp('my-wizard').getLayout().activeItem.id]; What if I don't wa...
TITLE: How to get currently active item`s index number (and not active item`s id) on a card layout on Extjs? QUESTION: How do I get the currently active item's index number (and not active item's id) on a card layout? The following code will return active item's id: Ext.getCmp('my-wizard').getLayout().activeItem.id]; ...
[ "javascript", "extjs", "extjs4" ]
12
24
10,337
1
0
2011-06-01T21:26:34.113000
2011-06-01T21:33:50.070000
6,207,921
6,210,838
Why does this example TCP Server throw exceptions if it's not closed?
This is written in Groovy by the way I haven't messed with my TCP Server script in awhile and decided that I want it to stay open and continue listening even after it is used rather than only be good for one use. However, when I do this, it throws an exception and then closes the script anyways. My example script is as...
Try modifying your server code as: def server = new ServerSocket(2000) println("Waiting for connection") while (true) { server.accept() { socket -> socket.withStreams { input, output -> def w = new BufferedWriter(new OutputStreamWriter(output)) String message = "Connection was successful" def r = new BufferedReader(ne...
Why does this example TCP Server throw exceptions if it's not closed? This is written in Groovy by the way I haven't messed with my TCP Server script in awhile and decided that I want it to stay open and continue listening even after it is used rather than only be good for one use. However, when I do this, it throws an...
TITLE: Why does this example TCP Server throw exceptions if it's not closed? QUESTION: This is written in Groovy by the way I haven't messed with my TCP Server script in awhile and decided that I want it to stay open and continue listening even after it is used rather than only be good for one use. However, when I do ...
[ "tcp", "groovy", "client" ]
0
2
921
1
0
2011-06-01T21:27:01.167000
2011-06-02T05:34:49.960000
6,207,922
6,208,171
How to prevent NSManagedObjectContext from corrupting the database when a thread gets killed while saving?
In this question, octy wrote: BTW, if you save on a background thread, you also need to consider what happens when your app is terminated while a save operation is in progress. Background threads get killed right away, whereas the watchdog waits 5 seconds for the main thread to finish up. Now I've spent all day impleme...
The main power of MOC is that represents an abstract storage that is independent from the format. It stores all it's objects in the memory and uses the mechanism of transactions to commit any changes. So when you're inserting/deleting/editing some objects that in MOC they are only changed in memory and not in persisten...
How to prevent NSManagedObjectContext from corrupting the database when a thread gets killed while saving? In this question, octy wrote: BTW, if you save on a background thread, you also need to consider what happens when your app is terminated while a save operation is in progress. Background threads get killed right ...
TITLE: How to prevent NSManagedObjectContext from corrupting the database when a thread gets killed while saving? QUESTION: In this question, octy wrote: BTW, if you save on a background thread, you also need to consider what happens when your app is terminated while a save operation is in progress. Background threads...
[ "iphone", "ios", "core-data", "concurrency", "nsmanagedobjectcontext" ]
1
1
621
1
0
2011-06-01T21:27:08.873000
2011-06-01T21:52:04.983000
6,207,936
6,208,032
C++ typecasting vs implicit constructor
I'm implementing a c++-class representing a fraction. Here goes my code. class Fraction { public: Fraction(char i); Fraction(int i); Fraction(short i); Fraction(long int l); #ifdef __LP64__ Fraction(long long l); #endif Fraction(float f); Fraction(double d); Fraction(double x, double y); Fraction operator +() const; F...
By definition the conversion operators are implicit. You can't make them explicit. The normal solution is named member functions to do the conversion. I think you could also create a specialized template method that would look just like a static_cast and call through to the explicit class method.
C++ typecasting vs implicit constructor I'm implementing a c++-class representing a fraction. Here goes my code. class Fraction { public: Fraction(char i); Fraction(int i); Fraction(short i); Fraction(long int l); #ifdef __LP64__ Fraction(long long l); #endif Fraction(float f); Fraction(double d); Fraction(double x, do...
TITLE: C++ typecasting vs implicit constructor QUESTION: I'm implementing a c++-class representing a fraction. Here goes my code. class Fraction { public: Fraction(char i); Fraction(int i); Fraction(short i); Fraction(long int l); #ifdef __LP64__ Fraction(long long l); #endif Fraction(float f); Fraction(double d); Fra...
[ "c++", "casting", "type-conversion", "implicit-conversion" ]
4
3
1,640
2
0
2011-06-01T21:28:06.840000
2011-06-01T21:37:45.840000
6,207,943
6,209,186
Do I need OAuth to get public twitter status updates?
I just need to retrieve a public user feed, but some aspects of Twitter's documentation are terrible (unless someone else knows of a "What you can do with the API" page). Do I need to use OAuth for something as simple as that? Does registering an application with Twitter make it public in any way? (I would expect not, ...
Using Twitter API v1 you do not need OAuth to retrieve public user_timelines. OAuth could be useful for an increased rate limit however. In Twitter API v1.1 authentication with OAuth is required for all API requests.
Do I need OAuth to get public twitter status updates? I just need to retrieve a public user feed, but some aspects of Twitter's documentation are terrible (unless someone else knows of a "What you can do with the API" page). Do I need to use OAuth for something as simple as that? Does registering an application with Tw...
TITLE: Do I need OAuth to get public twitter status updates? QUESTION: I just need to retrieve a public user feed, but some aspects of Twitter's documentation are terrible (unless someone else knows of a "What you can do with the API" page). Do I need to use OAuth for something as simple as that? Does registering an a...
[ "twitter", "twitter-oauth", "twitter-feed" ]
2
3
577
1
0
2011-06-01T21:29:17.400000
2011-06-02T00:21:41.870000
6,207,949
6,208,820
Django ForeignKey on a View
i'm building a django app from an existing database. for better or worse, i have a couple of views that i would like to base my models off. they look something like this: class Device(Model): id = models.IntegerField( primary_key=True, db_column='node_id' ) name = models.CharField(max_length=127, db_column='node' ) cla...
have you try.select_related() in your view? entities = Entity.objects.select_related('device').filter(...) in the other hand, if it is and old database, and no autogenerated by django, probably node_id may not be an index in the database, this will slow down a lot any JOIN.
Django ForeignKey on a View i'm building a django app from an existing database. for better or worse, i have a couple of views that i would like to base my models off. they look something like this: class Device(Model): id = models.IntegerField( primary_key=True, db_column='node_id' ) name = models.CharField(max_length...
TITLE: Django ForeignKey on a View QUESTION: i'm building a django app from an existing database. for better or worse, i have a couple of views that i would like to base my models off. they look something like this: class Device(Model): id = models.IntegerField( primary_key=True, db_column='node_id' ) name = models.Ch...
[ "database", "django", "view", "foreign-keys" ]
1
0
3,184
1
0
2011-06-01T21:29:51.520000
2011-06-01T23:17:13.503000
6,207,951
6,207,983
Bash: wrong pipe output when using "sudo sh -c"
I have a pipe of commands and I use "sudo sh -c" for getting sudo permission throughout the whole pipe commands. The problem that I am facing is that commands like awk have different behaviour when "sudo sh -c" is used. In particular, sudo wc -c Mybib.bin |sudo awk '{print $1;}' gives 1509644 while sudo sh -c "wc -c My...
It is, but the double quotes are allowing the $1 to be replaced before invocation, resulting in {print;}. sudo sh -c "wc -c Mybib.bin |awk '"'{print $1;}'"'" Also... sudo sh -c "wc -c < Mybib.bin"
Bash: wrong pipe output when using "sudo sh -c" I have a pipe of commands and I use "sudo sh -c" for getting sudo permission throughout the whole pipe commands. The problem that I am facing is that commands like awk have different behaviour when "sudo sh -c" is used. In particular, sudo wc -c Mybib.bin |sudo awk '{prin...
TITLE: Bash: wrong pipe output when using "sudo sh -c" QUESTION: I have a pipe of commands and I use "sudo sh -c" for getting sudo permission throughout the whole pipe commands. The problem that I am facing is that commands like awk have different behaviour when "sudo sh -c" is used. In particular, sudo wc -c Mybib.bi...
[ "linux", "redirect", "pipe", "sudo" ]
1
3
2,574
2
0
2011-06-01T21:30:02.990000
2011-06-01T21:33:13.277000
6,207,956
6,208,025
Zepto.js doesn't return false?
I'm trying to bind an event handler to a click function using zepto.js. Normally in JQuery I can just say return false and the actual click will never go through. Does Zepto not support this? And if so, how to get around this?
To duplicate the behaviour of returning false in a jQuery event handler you need to call event.preventDefault() and event.stopPropagation().
Zepto.js doesn't return false? I'm trying to bind an event handler to a click function using zepto.js. Normally in JQuery I can just say return false and the actual click will never go through. Does Zepto not support this? And if so, how to get around this?
TITLE: Zepto.js doesn't return false? QUESTION: I'm trying to bind an event handler to a click function using zepto.js. Normally in JQuery I can just say return false and the actual click will never go through. Does Zepto not support this? And if so, how to get around this? ANSWER: To duplicate the behaviour of retur...
[ "javascript", "jquery", "zepto" ]
3
5
2,296
1
0
2011-06-01T21:30:33.767000
2011-06-01T21:36:58.857000
6,207,957
6,208,453
Make CSS Drop Down Menu 2 Columns
I currently have a CSS dropdown menu that uses the following code. Unfortunately I want the sub menus to display in 2 columns as there are about 16 items in that submenu. Does anyone know how to use the following code to make this drop down menu 2 columns?.menu { border: none; border: 0px; margin: 0px; padding: 0px; fo...
2018 edit Hey, 7 years later the columns css property is well supported ul{ columns: 2; } first item second item third item fourth item fifth item You could probably get a similar effect with the very robust grid 2011 original answer Make the ul twice as wide as the li 's and float the li's left http://www.behemothda...
Make CSS Drop Down Menu 2 Columns I currently have a CSS dropdown menu that uses the following code. Unfortunately I want the sub menus to display in 2 columns as there are about 16 items in that submenu. Does anyone know how to use the following code to make this drop down menu 2 columns?.menu { border: none; border: ...
TITLE: Make CSS Drop Down Menu 2 Columns QUESTION: I currently have a CSS dropdown menu that uses the following code. Unfortunately I want the sub menus to display in 2 columns as there are about 16 items in that submenu. Does anyone know how to use the following code to make this drop down menu 2 columns?.menu { bord...
[ "html", "css", "drop-down-menu" ]
9
25
42,415
3
0
2011-06-01T21:30:44.653000
2011-06-01T22:23:25.937000
6,207,958
6,208,017
Complex action on Django menu
I have a small app for a local hockey league, I wanted to know if it was possible to write an action on the admin of the games, so that when I check 2 games, it exchanges the teams that are about to play. Example team A vs team B -- team C vs team D, if I swap this with the action menu it should be team C vs team B -- ...
You have to define a method like this: def exchange_team(modeladmin, request, queryset): if queryset.count() == 2: #your interchange code... And reference it in your admin class: class TeamAdmin(admin.ModelAdmin):... actions = ['exchange_team'] admin.register(Team, TeamAdmin)
Complex action on Django menu I have a small app for a local hockey league, I wanted to know if it was possible to write an action on the admin of the games, so that when I check 2 games, it exchanges the teams that are about to play. Example team A vs team B -- team C vs team D, if I swap this with the action menu it ...
TITLE: Complex action on Django menu QUESTION: I have a small app for a local hockey league, I wanted to know if it was possible to write an action on the admin of the games, so that when I check 2 games, it exchanges the teams that are about to play. Example team A vs team B -- team C vs team D, if I swap this with t...
[ "python", "django", "django-admin" ]
0
1
154
1
0
2011-06-01T21:30:46.953000
2011-06-01T21:36:11.180000
6,207,961
6,208,133
DropDownListFor why it gets the Key and Nothing else
I have a property in my model very simple one: Now this dropDown doesn't work right @Html.DropDownListFor(m => m.Camp, new SelectList(ViewBag.Camps, "Id", "Name")) it returns null instead of a chosen Camp, but if I change that into: @Html.DropDownListFor(m => m.Camp.Id, new SelectList(ViewBag.Camps, "Id", "Name")) It w...
That's normal. Only the Id is posted to the controller action. That's how dropdown inside forms work. So that's all you can hope to get there. You will then use this Id to get the corresponding Camp object from the database: [HttpPost] public ActionResult Foo([Bind(Prefix = "Camp")]int id) { Camp camp = Repository.GetC...
DropDownListFor why it gets the Key and Nothing else I have a property in my model very simple one: Now this dropDown doesn't work right @Html.DropDownListFor(m => m.Camp, new SelectList(ViewBag.Camps, "Id", "Name")) it returns null instead of a chosen Camp, but if I change that into: @Html.DropDownListFor(m => m.Camp....
TITLE: DropDownListFor why it gets the Key and Nothing else QUESTION: I have a property in my model very simple one: Now this dropDown doesn't work right @Html.DropDownListFor(m => m.Camp, new SelectList(ViewBag.Camps, "Id", "Name")) it returns null instead of a chosen Camp, but if I change that into: @Html.DropDownLi...
[ "asp.net-mvc-3", "drop-down-menu" ]
0
1
228
1
0
2011-06-01T21:31:17.850000
2011-06-01T21:47:40.270000
6,207,972
6,208,376
SQL query to pull out form entries where each value is a separate row
I have a models for a user built form as follows: Form id title FormField id type name label FormEntry id form_id date FormFieldEntry id form_entry_id form_field_id value I am trying to formulate a sql query on Form that will have the FormField labels as column names and the FormFieldEntry's as the values.
The only way to accomplish what you seek is to use dynamic SQL. You must assemble the SQL statement string in code by querying for the column names and send it to the database. The resulting SQL statement you build might look something like: Select FFE.form_entry_id, Min( Case When FF.name = 'Foo' Then FFE.value End ) ...
SQL query to pull out form entries where each value is a separate row I have a models for a user built form as follows: Form id title FormField id type name label FormEntry id form_id date FormFieldEntry id form_entry_id form_field_id value I am trying to formulate a sql query on Form that will have the FormField la...
TITLE: SQL query to pull out form entries where each value is a separate row QUESTION: I have a models for a user built form as follows: Form id title FormField id type name label FormEntry id form_id date FormFieldEntry id form_entry_id form_field_id value I am trying to formulate a sql query on Form that will hav...
[ "mysql", "sql" ]
0
1
89
1
0
2011-06-01T21:32:04.323000
2011-06-01T22:14:07.737000
6,207,978
6,208,055
Which function should I define as live and how would I do it without click event?
I have a refresh function that is set to refresh on a time interval. There is a function within that function called scrollTo which scrolls to the last element of the box. The problem is that elements are constantly being added to the box so without the use of 'live' the scrollTo will find a div and stick to it instead...
would this do the same?: function refresh() { var div = $('div[chunk_id="'+autoscroll+'"] >:last-child'); $.scrollTo(div, 800, {easing:'elasout',offset:-250} ); } I don't think it will since you are explicitly creating a scoped variable. It should recalculate that value on each run of the function.
Which function should I define as live and how would I do it without click event? I have a refresh function that is set to refresh on a time interval. There is a function within that function called scrollTo which scrolls to the last element of the box. The problem is that elements are constantly being added to the box...
TITLE: Which function should I define as live and how would I do it without click event? QUESTION: I have a refresh function that is set to refresh on a time interval. There is a function within that function called scrollTo which scrolls to the last element of the box. The problem is that elements are constantly bein...
[ "jquery" ]
0
1
42
1
0
2011-06-01T21:32:43.723000
2011-06-01T21:39:59.680000
6,207,985
6,208,103
Python - Threading, Timing, or function use?
I am having an issue formulating an idea on how to work this problem. Please help. My project consists of an N x N grid with a series of blocks that are supposed to move in a random direction and random velocity within this grid (every.1 seconds, the location of the block is updated with the velocity). I have three "sp...
Your best bet is probably to handle all of them at once in a single update function rather than attempting to use Threads. This is primarily because the Global Interpreter Lock will prevent multiple threads from processing concurrently anyway. What you're after then is something like this: def tick(): for box in random...
Python - Threading, Timing, or function use? I am having an issue formulating an idea on how to work this problem. Please help. My project consists of an N x N grid with a series of blocks that are supposed to move in a random direction and random velocity within this grid (every.1 seconds, the location of the block is...
TITLE: Python - Threading, Timing, or function use? QUESTION: I am having an issue formulating an idea on how to work this problem. Please help. My project consists of an N x N grid with a series of blocks that are supposed to move in a random direction and random velocity within this grid (every.1 seconds, the locati...
[ "java", "python", "multithreading", "timing" ]
4
2
337
2
0
2011-06-01T21:33:28.737000
2011-06-01T21:44:55.013000
6,207,988
6,208,062
Inheriting from linked classes
This question is about OOP in any statically typed language. Suppose I have two classes whose instances maintain pointers/references to each other. In my case, one class is a container, and the other a wrapper around a contained object which maintains a pointer to the container in which it lives. class Container { Elem...
Yep, this is the right way to do it, without any more information, IMHO. It makes sense if you think that all of the methods in Element can apply to every Element, but the only classes that should know anything about the Derived set of functionality are (ideally only) DerivedElement and (if necessary) DerivedContainer....
Inheriting from linked classes This question is about OOP in any statically typed language. Suppose I have two classes whose instances maintain pointers/references to each other. In my case, one class is a container, and the other a wrapper around a contained object which maintains a pointer to the container in which i...
TITLE: Inheriting from linked classes QUESTION: This question is about OOP in any statically typed language. Suppose I have two classes whose instances maintain pointers/references to each other. In my case, one class is a container, and the other a wrapper around a contained object which maintains a pointer to the co...
[ "oop" ]
1
1
60
3
0
2011-06-01T21:33:42.690000
2011-06-01T21:40:23.820000
6,207,996
6,208,057
How to prevent duplicate form submission in ASP.NET MVC 3?
I have a razor view that renders a html form and it posts to the server. If the form values are right then it gets saved to database. After insertion, I redirect to another view where user can make further changes. Right now the user can hit browser back button and resubmit the form to create another record in db. How ...
One solution is to put a hidden "token" field on the form that's generated randomly when the form loads. When you see that token come back on creation store it somewhere temporarily (in session if you're using sessions for example). If you see the same one again, you can assume the same form was submitted twice quickly...
How to prevent duplicate form submission in ASP.NET MVC 3? I have a razor view that renders a html form and it posts to the server. If the form values are right then it gets saved to database. After insertion, I redirect to another view where user can make further changes. Right now the user can hit browser back button...
TITLE: How to prevent duplicate form submission in ASP.NET MVC 3? QUESTION: I have a razor view that renders a html form and it posts to the server. If the form values are right then it gets saved to database. After insertion, I redirect to another view where user can make further changes. Right now the user can hit b...
[ "asp.net-mvc-3", "form-submit" ]
3
5
5,426
4
0
2011-06-01T21:34:22.980000
2011-06-01T21:40:05.297000
6,208,003
6,208,266
Ruby: Is there a way to get the enclosing Module const of a Class?
I'm doing some metaprogramming in Ruby, and I need to dynamically generate a sibling class inside of a module. In doing so, I want to call const_set on the module, but I don't know which Module constant to call that on until runtime. An example: Given classes Foo::Bar::Baz Foo::Quox::Quack I want to be able to call a f...
This should get you on track: module Foo module Bar class Baz def initialize @nesting = Module.nesting end def enclosing_module @nesting.last end end end end puts Foo::Bar::Baz.new.enclosing_module #=> Foo Relevant documentation: http://ruby-doc.org/core/classes/Module.html#M000441
Ruby: Is there a way to get the enclosing Module const of a Class? I'm doing some metaprogramming in Ruby, and I need to dynamically generate a sibling class inside of a module. In doing so, I want to call const_set on the module, but I don't know which Module constant to call that on until runtime. An example: Given c...
TITLE: Ruby: Is there a way to get the enclosing Module const of a Class? QUESTION: I'm doing some metaprogramming in Ruby, and I need to dynamically generate a sibling class inside of a module. In doing so, I want to call const_set on the module, but I don't know which Module constant to call that on until runtime. A...
[ "ruby", "metaprogramming" ]
14
19
10,078
5
0
2011-06-01T21:34:52.950000
2011-06-01T22:01:12.950000
6,208,006
6,209,279
Any way to create the unmemo-monad?
Suppose someone makes a program to play chess, or solve sudoku. In this kind of program it makes sense to have a tree structure representing game states. This tree would be very large, "practically infinite". Which isn't by itself a problem as Haskell supports infinite data structures. An familiar example of an infinit...
Same trick as with a stream -- don't capture the remainder directly, but instead capture a value and a function which yields a remainder. You can add memoization on top of this as necessary. data UTree a = Leaf a | Branch a (a -> [UTree a]) I'm not in the mood to figure it out precisely at the moment, but this structur...
Any way to create the unmemo-monad? Suppose someone makes a program to play chess, or solve sudoku. In this kind of program it makes sense to have a tree structure representing game states. This tree would be very large, "practically infinite". Which isn't by itself a problem as Haskell supports infinite data structure...
TITLE: Any way to create the unmemo-monad? QUESTION: Suppose someone makes a program to play chess, or solve sudoku. In this kind of program it makes sense to have a tree structure representing game states. This tree would be very large, "practically infinite". Which isn't by itself a problem as Haskell supports infin...
[ "performance", "haskell" ]
10
4
478
1
0
2011-06-01T21:35:08.357000
2011-06-02T00:39:57.863000
6,208,008
6,208,321
iOS images galleriers
I'd like to develop an app to visualize galleries and I really like the Flickr official app or Instabam app style. Basically, something like this (instabam app) my idea was to use a scrollview with buttons to easily handle touch event. Is this a good approach? Are there better approaches?
Have you considered using an open source library such as AQGridView?
iOS images galleriers I'd like to develop an app to visualize galleries and I really like the Flickr official app or Instabam app style. Basically, something like this (instabam app) my idea was to use a scrollview with buttons to easily handle touch event. Is this a good approach? Are there better approaches?
TITLE: iOS images galleriers QUESTION: I'd like to develop an app to visualize galleries and I really like the Flickr official app or Instabam app style. Basically, something like this (instabam app) my idea was to use a scrollview with buttons to easily handle touch event. Is this a good approach? Are there better ap...
[ "ios", "image", "uiscrollview", "uiimage", "gallery" ]
0
0
244
1
0
2011-06-01T21:35:16.683000
2011-06-01T22:08:33.473000
6,208,014
6,208,145
Why does singleton class survive Activity exit?
I have a Singleton class which I use with the one of the activities of my application. When I exit the activity - which brings me back to the menu activity - and then reopen the activity I find that when I try to access the singleton it is still the same. Surely it should have been destroyed with the Activity? I saw th...
Surely it should have been destroyed with the Activity? No. When I press the return button on my device (or use finish within the Activity itself) is the Activity kept alive for future use? The activity is not. The process is. Singletons are part of the virtual machine and will live as long as the process does. Exiting...
Why does singleton class survive Activity exit? I have a Singleton class which I use with the one of the activities of my application. When I exit the activity - which brings me back to the menu activity - and then reopen the activity I find that when I try to access the singleton it is still the same. Surely it should...
TITLE: Why does singleton class survive Activity exit? QUESTION: I have a Singleton class which I use with the one of the activities of my application. When I exit the activity - which brings me back to the menu activity - and then reopen the activity I find that when I try to access the singleton it is still the same...
[ "android", "android-activity", "singleton" ]
9
14
1,808
1
0
2011-06-01T21:36:00.860000
2011-06-01T21:49:13.030000
6,208,015
6,208,076
Using Httprequest to get pictures from given URL
I'm trying to get pictures from webcams. There is a php-python web service to get the pictures from webcams and serve them: it serves the picture like http://ip/jpeg/camera=1. private HttpWebRequest request; private HttpWebResponse response; private CookieContainer container; private Uri uri; private string _user; priv...
The code to fetch the images is synchronous. I would suggest modifying your code to use HttpWebRequest.BeginGetResponse() to fetch your images as detailed in this answer. So when your (single) timer fires, begin the async requests to your cams, then (as they complete) the callback will fire for each completed request, ...
Using Httprequest to get pictures from given URL I'm trying to get pictures from webcams. There is a php-python web service to get the pictures from webcams and serve them: it serves the picture like http://ip/jpeg/camera=1. private HttpWebRequest request; private HttpWebResponse response; private CookieContainer conta...
TITLE: Using Httprequest to get pictures from given URL QUESTION: I'm trying to get pictures from webcams. There is a php-python web service to get the pictures from webcams and serve them: it serves the picture like http://ip/jpeg/camera=1. private HttpWebRequest request; private HttpWebResponse response; private Coo...
[ "c#", "performance", "get", "httprequest", "image" ]
1
1
8,551
2
0
2011-06-01T21:36:03.187000
2011-06-01T21:41:36.747000
6,208,018
6,222,835
Set background color of the deletion control of a UITableViewCell
In an iPhone/iPad app, I'm using a UITableView to display a list of items that can be edited. I can successfully alternate the background color of the rows in my table view. However, when I turn on "editing mode" (i.e., display the deletion control), each cell appears to be shifted to the right, and the deletion contro...
One answer is to, in the getCellContentView function, where you create frames/labels and add them as subviews, add an additional label that is much wider and starts with a negative X value. Then, this can be colored. Since it's drawn "underneath" the deletion control, the color shows through. The trick is to understand...
Set background color of the deletion control of a UITableViewCell In an iPhone/iPad app, I'm using a UITableView to display a list of items that can be edited. I can successfully alternate the background color of the rows in my table view. However, when I turn on "editing mode" (i.e., display the deletion control), eac...
TITLE: Set background color of the deletion control of a UITableViewCell QUESTION: In an iPhone/iPad app, I'm using a UITableView to display a list of items that can be edited. I can successfully alternate the background color of the rows in my table view. However, when I turn on "editing mode" (i.e., display the dele...
[ "iphone", "uitableview" ]
5
4
2,450
2
0
2011-06-01T21:36:11.507000
2011-06-03T04:02:02.600000
6,208,021
6,208,053
jQuery get img width after src change and before fadeIn
I've got quite the problem with jQuery and a custom photo gallery I am building. I've searched high and low and tried endlessly different solutions but nothing is working perfectly. So let me present the information: This photo gallery has thumbnails on the left side and a big image in the center. Every thumbnail can b...
I've encountered this before; what seems to be the easiest solution is to quickly show the image, grab it's width, and hide it again. This operation occurs so quickly users will never notice. In your case, i believe the code would be: $("#big-picture").show(); alert($('#big-picture').width()); //this should be the real...
jQuery get img width after src change and before fadeIn I've got quite the problem with jQuery and a custom photo gallery I am building. I've searched high and low and tried endlessly different solutions but nothing is working perfectly. So let me present the information: This photo gallery has thumbnails on the left s...
TITLE: jQuery get img width after src change and before fadeIn QUESTION: I've got quite the problem with jQuery and a custom photo gallery I am building. I've searched high and low and tried endlessly different solutions but nothing is working perfectly. So let me present the information: This photo gallery has thumbn...
[ "javascript", "jquery", "css" ]
0
1
3,540
3
0
2011-06-01T21:36:24.310000
2011-06-01T21:39:54.610000
6,208,043
6,217,641
box2d b2_staticBody position problem
I've encountered a weird problem about positioning bodies in cocos2d/box2d. If I set b2BodyDef type as b2_staticBody, I can't set bodies on any position out of multipliers of PTM_RATIO. Let me explain: #define PTM_RATIO 32.0... myBodyDef_1.type = b2_staticBody; myBodyDef_1.position.Set(320.0/PTM_RATIO, 320.0/PTM_RATIO)...
try adding explicit conversation: 358.0/((float)PTM_RATIO). try myBodyDef_1.position = b2Vec2(333.0/PTM_RATIO, 333.0/PTM_RATIO); and explicit conversation here. try float x = 333.0/PTM_RATIO; float y = 333.0/PTM_RATIO; myBodyDef_1.position = b2Vec2(x, y); Let me know the result please
box2d b2_staticBody position problem I've encountered a weird problem about positioning bodies in cocos2d/box2d. If I set b2BodyDef type as b2_staticBody, I can't set bodies on any position out of multipliers of PTM_RATIO. Let me explain: #define PTM_RATIO 32.0... myBodyDef_1.type = b2_staticBody; myBodyDef_1.position....
TITLE: box2d b2_staticBody position problem QUESTION: I've encountered a weird problem about positioning bodies in cocos2d/box2d. If I set b2BodyDef type as b2_staticBody, I can't set bodies on any position out of multipliers of PTM_RATIO. Let me explain: #define PTM_RATIO 32.0... myBodyDef_1.type = b2_staticBody; myB...
[ "cocos2d-iphone", "positioning", "box2d" ]
0
1
779
1
0
2011-06-01T21:38:57.653000
2011-06-02T16:57:56.857000
6,208,047
6,208,068
replaceFirst() fails when replacing with "$"
I don't understand why the "$" is special. String str = "bla aa"; String tag = "$"; str = str.replaceFirst("aa", tag); Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 If I change the tag = "\\$", then it works fine. But why does it need to be escaped? thanks in advanc...
Because it is a special regex symbol (in results it's about capturing groups), and replaceFirst takes regex arguments. The documentation explicitly warns you: Note that backslashes () and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacem...
replaceFirst() fails when replacing with "$" I don't understand why the "$" is special. String str = "bla aa"; String tag = "$"; str = str.replaceFirst("aa", tag); Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 If I change the tag = "\\$", then it works fine. But why...
TITLE: replaceFirst() fails when replacing with "$" QUESTION: I don't understand why the "$" is special. String str = "bla aa"; String tag = "$"; str = str.replaceFirst("aa", tag); Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 If I change the tag = "\\$", then it w...
[ "java", "regex", "string" ]
3
6
1,366
3
0
2011-06-01T21:39:14.950000
2011-06-01T21:40:54.310000
6,208,048
6,208,507
Multi-key lookup data structure
I need an efficient way to look up a user by any 1 of 3 different keys. For example, by id, username or alias. The basic concept would be a data structure in which you can use any of 3 different types of keys to look up the value: myDataStructure.lookupByName(name) -> User myDataStructure.lookupById(id) -> User myDataS...
If you know that the keysets (names, ids and aliases) are distinct, you could put them all into a single table. Otherwise, you'd need the three separate tables that you noted.
Multi-key lookup data structure I need an efficient way to look up a user by any 1 of 3 different keys. For example, by id, username or alias. The basic concept would be a data structure in which you can use any of 3 different types of keys to look up the value: myDataStructure.lookupByName(name) -> User myDataStructur...
TITLE: Multi-key lookup data structure QUESTION: I need an efficient way to look up a user by any 1 of 3 different keys. For example, by id, username or alias. The basic concept would be a data structure in which you can use any of 3 different types of keys to look up the value: myDataStructure.lookupByName(name) -> U...
[ "data-structures", "dictionary", "key", "lookup" ]
3
0
1,984
2
0
2011-06-01T21:39:16.137000
2011-06-01T22:32:11.020000
6,208,051
6,208,244
Redirect www.domain.com/uk to www.domain.co.uk/uk
I'm no.htaccess expert, but I've tried a few different things to redirect a domain to no avail. I've got a UK and US domain...some US pages have uk extension, and need to be pointed to the proper UK domain: www.domain.com/uk needs to be rewritten to www.domain.co.uk/uk Ex. If someone types in www.domain.com/uk/about it...
You can try something like this: RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC] RewriteRule (.*) http://www.domain.co.uk/$1 [L,R=301] The important point is to use a RewriteCond ition that works on the HTTP Host header. Simply speaking, if a RewriteCond is placed before a normal RewriteRule then t...
Redirect www.domain.com/uk to www.domain.co.uk/uk I'm no.htaccess expert, but I've tried a few different things to redirect a domain to no avail. I've got a UK and US domain...some US pages have uk extension, and need to be pointed to the proper UK domain: www.domain.com/uk needs to be rewritten to www.domain.co.uk/uk ...
TITLE: Redirect www.domain.com/uk to www.domain.co.uk/uk QUESTION: I'm no.htaccess expert, but I've tried a few different things to redirect a domain to no avail. I've got a UK and US domain...some US pages have uk extension, and need to be pointed to the proper UK domain: www.domain.com/uk needs to be rewritten to ww...
[ "apache", ".htaccess", "mod-rewrite", "internationalization", "dns" ]
2
2
728
1
0
2011-06-01T21:39:30.977000
2011-06-01T21:59:36.137000
6,208,052
6,208,079
jquery $.each() for objects
This code retrieves the first data. name:zonealarm and price:500. How can I retrieve all the data in the object? I tried $.each(data.programs, function(key,val) but it didn't work. Should I put it in a loop?
$.each() works for objects and arrays both: var data = { "programs": [ { "name":"zonealarm", "price":"500" }, { "name":"kaspersky", "price":"200" } ] }; $.each(data.programs, function (i) { $.each(data.programs[i], function (key, val) { alert(key + val); }); });...and since you will get the current array element as se...
jquery $.each() for objects This code retrieves the first data. name:zonealarm and price:500. How can I retrieve all the data in the object? I tried $.each(data.programs, function(key,val) but it didn't work. Should I put it in a loop?
TITLE: jquery $.each() for objects QUESTION: This code retrieves the first data. name:zonealarm and price:500. How can I retrieve all the data in the object? I tried $.each(data.programs, function(key,val) but it didn't work. Should I put it in a loop? ANSWER: $.each() works for objects and arrays both: var data = { ...
[ "jquery", "each" ]
69
147
400,774
5
0
2011-06-01T21:39:30.973000
2011-06-01T21:41:54.730000
6,208,065
6,208,082
Delay Javascript effect by 500 ms
I want to delay slideOutItem by 500 millisecond. Canno't get that working. if(current === idx) { slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true); current = -1; }
Something like this if(current === idx) { setTimeout(function () { slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true); }, 500); current = -1; }
Delay Javascript effect by 500 ms I want to delay slideOutItem by 500 millisecond. Canno't get that working. if(current === idx) { slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true); current = -1; }
TITLE: Delay Javascript effect by 500 ms QUESTION: I want to delay slideOutItem by 500 millisecond. Canno't get that working. if(current === idx) { slideOutItem($menuItems.eq(current), false, 250, 'easeOutQuint', true); current = -1; } ANSWER: Something like this if(current === idx) { setTimeout(function () { slideOu...
[ "javascript", "delay", "easing" ]
2
2
3,828
2
0
2011-06-01T21:40:32.243000
2011-06-01T21:42:18.547000
6,208,067
6,208,182
?: ?? Operators Instead Of IF|ELSE
public string Source { get { /* if ( Source == null ){ return string. Empty; } else { return Source; } */ return Source?? string.Empty; } set { /* if ( Source == null ) { Source = string. Empty; } else { if ( Source == value ) { Source = Source; } else { Source = value; } } */ Source == value? Source: value?? string.Em...
For [1], you can't: these operators are made to return a value, not perform operations. The expression a? b: c evaluates to b if a is true and evaluates to c if a is false. The expression b?? c evaluates to b if b is not null and evaluates to c if b is null. If you write return a? b: c; or return b?? c; they will alway...
?: ?? Operators Instead Of IF|ELSE public string Source { get { /* if ( Source == null ){ return string. Empty; } else { return Source; } */ return Source?? string.Empty; } set { /* if ( Source == null ) { Source = string. Empty; } else { if ( Source == value ) { Source = Source; } else { Source = value; } } */ Source ...
TITLE: ?: ?? Operators Instead Of IF|ELSE QUESTION: public string Source { get { /* if ( Source == null ){ return string. Empty; } else { return Source; } */ return Source?? string.Empty; } set { /* if ( Source == null ) { Source = string. Empty; } else { if ( Source == value ) { Source = Source; } else { Source = val...
[ "c#", "ternary-operator" ]
87
207
276,538
9
0
2011-06-01T21:40:42.337000
2011-06-01T21:53:34.467000
6,208,078
6,208,851
Lua alternative to optim()
I'm currently looking for a lua alternative to the R programming languages; optim() function, if anyone knows how to deal with this?
http://numlua.luaforge.net/ looks interesting but doesn't seem to have minimization. The most promising lead seems to be a Lua wrapper for GSL, which has a variety of multidimensional minimization algorithms included. With derivatives - BFGS ( method="BFGS" in optim ) and two conjugate gradient methods (Fletcher-Reeves...
Lua alternative to optim() I'm currently looking for a lua alternative to the R programming languages; optim() function, if anyone knows how to deal with this?
TITLE: Lua alternative to optim() QUESTION: I'm currently looking for a lua alternative to the R programming languages; optim() function, if anyone knows how to deal with this? ANSWER: http://numlua.luaforge.net/ looks interesting but doesn't seem to have minimization. The most promising lead seems to be a Lua wrappe...
[ "r", "optimization", "programming-languages", "lua" ]
2
5
1,403
2
0
2011-06-01T21:41:47.467000
2011-06-01T23:22:53.320000
6,208,085
6,208,139
Are there any ready-to-use map controls for wp7?
I know microsoft provides a bing map control. And ESRI has a map control for wp7. Are there any other map controls?
What other sort of Map control do you want? The Bing Maps control is highly extensible allowing you to create tile sources for all sorts of other mapping data. For example you can use it to render Google Sky tiles: http://www.scottlogic.co.uk/blog/colin/2011/02/google-sky-on-windows-phone-7/
Are there any ready-to-use map controls for wp7? I know microsoft provides a bing map control. And ESRI has a map control for wp7. Are there any other map controls?
TITLE: Are there any ready-to-use map controls for wp7? QUESTION: I know microsoft provides a bing map control. And ESRI has a map control for wp7. Are there any other map controls? ANSWER: What other sort of Map control do you want? The Bing Maps control is highly extensible allowing you to create tile sources for a...
[ "windows-phone-7", "dictionary" ]
5
6
276
2
0
2011-06-01T21:42:39.053000
2011-06-01T21:48:39.337000
6,208,097
6,208,270
Complex jquery selector that looks for a token in a string.split
I have an html table where one of the columns contains s with comma-delimited data. I want to come up with a jQuery selector that returns all of the rows ( s are preferable, but the s will work for now) where one of the comma-delimited tokens in a span tag matches a supplied string. I started with something like the fo...
This is where the beauty of jQuery expressions come in. You can add your own custom selector. I'm going to call it tag in this case jQuery.expr[":"].tag = function(elem, index, match, nodeList) { var tags = $(elem).text().replace(/(?:\ +)?,(?:\ +)?/g, ",").split(","); return tags.indexOf(match[3]) > -1; } This will che...
Complex jquery selector that looks for a token in a string.split I have an html table where one of the columns contains s with comma-delimited data. I want to come up with a jQuery selector that returns all of the rows ( s are preferable, but the s will work for now) where one of the comma-delimited tokens in a span ta...
TITLE: Complex jquery selector that looks for a token in a string.split QUESTION: I have an html table where one of the columns contains s with comma-delimited data. I want to come up with a jQuery selector that returns all of the rows ( s are preferable, but the s will work for now) where one of the comma-delimited t...
[ "javascript", "jquery", "jquery-selectors" ]
1
3
263
3
0
2011-06-01T21:43:57.430000
2011-06-01T22:01:59.580000
6,208,100
6,208,175
Problem with AJAX chat
The problem is this.I want to save every message in MySQL DB and I try to do this making this javascript function: function doWork(str) { var xmlhttp; if (window.XMLHttpRequest) {// Използваните браузъри xmlhttp=new XMLHttpRequest(); } else {// Кой ли ползва тези версии.. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");...
I believe the issue is in your reference to the input text field. Try this instead: Your message: Send When you use the following, 'this' refers to the button element, so don't do the following. Send
Problem with AJAX chat The problem is this.I want to save every message in MySQL DB and I try to do this making this javascript function: function doWork(str) { var xmlhttp; if (window.XMLHttpRequest) {// Използваните браузъри xmlhttp=new XMLHttpRequest(); } else {// Кой ли ползва тези версии.. xmlhttp=new ActiveXObjec...
TITLE: Problem with AJAX chat QUESTION: The problem is this.I want to save every message in MySQL DB and I try to do this making this javascript function: function doWork(str) { var xmlhttp; if (window.XMLHttpRequest) {// Използваните браузъри xmlhttp=new XMLHttpRequest(); } else {// Кой ли ползва тези версии.. xmlhtt...
[ "php", "mysql", "ajax" ]
1
2
156
4
0
2011-06-01T21:44:37.480000
2011-06-01T21:52:41.297000
6,208,118
6,208,337
UIDatePicker in UITextField in UITableView realtime update
This question has been bugging me a LOT lately. Any help would be appreciated. These were my objectives: Setup a UIDatePickerView for a UItextField in a UITableViewCell. I have done all this so far, and I can see the picker working fine. Whenever I change the picker Value, I use NSLog to display the current value and i...
You don't need to instantiate multiple instances of UIDatePicker. One should do. Assign it to all the text fields. Now to update the text field, you will have to identify which text field is being updated. For this you should adopt the UITextFieldDelegate protocol and implement the textFieldDidBeginEditing: method to s...
UIDatePicker in UITextField in UITableView realtime update This question has been bugging me a LOT lately. Any help would be appreciated. These were my objectives: Setup a UIDatePickerView for a UItextField in a UITableViewCell. I have done all this so far, and I can see the picker working fine. Whenever I change the p...
TITLE: UIDatePicker in UITextField in UITableView realtime update QUESTION: This question has been bugging me a LOT lately. Any help would be appreciated. These were my objectives: Setup a UIDatePickerView for a UItextField in a UITableViewCell. I have done all this so far, and I can see the picker working fine. Whene...
[ "iphone", "objective-c", "xcode", "uipickerview", "uidatepicker" ]
5
9
9,243
2
0
2011-06-01T21:46:23.390000
2011-06-01T22:09:41.313000
6,208,141
6,208,261
Random number within range with a seed
I've been trying to wrap my head around solving this issue but I can't seem to find a simple solution to it. I have a dynamic grid layout, articles are placed on the grid but have different width & height. This width & height of these different articles can change upon visiting the site but only when there is a new art...
mt_srand() is used to set your seed and mt_rand() takes in a min and max if you want to set the range. Basically something like: mt_srand($seed); mt_rand($min, $max); Note: As of PHP 4.2.0, there is no need to seed the random number generator with srand() or mt_srand() as this is now done automatically.
Random number within range with a seed I've been trying to wrap my head around solving this issue but I can't seem to find a simple solution to it. I have a dynamic grid layout, articles are placed on the grid but have different width & height. This width & height of these different articles can change upon visiting th...
TITLE: Random number within range with a seed QUESTION: I've been trying to wrap my head around solving this issue but I can't seem to find a simple solution to it. I have a dynamic grid layout, articles are placed on the grid but have different width & height. This width & height of these different articles can chang...
[ "php" ]
5
5
4,369
1
0
2011-06-01T21:48:40.853000
2011-06-01T22:00:49.600000
6,208,146
6,208,273
ScrollView moved AdMob ads
Well before my ads were working fine and were always at the bottom of the screen, but now I added a scrollview and the ads move up a little bit to be right under my scrollbar. main.xml Please help, thanks! EDIT: Picture UI pic http://img52.imageshack.us/img52/9397/unledyv.png
1) You will probably leave the ads outside the scollview so they are always visible (as opposed to scroll out of the screen) 2) What is the purpose of the relativelayout surrounding the adview? That is the only view inside it: just remove it and you will get the same layout, but better performance. Based on the update,...
ScrollView moved AdMob ads Well before my ads were working fine and were always at the bottom of the screen, but now I added a scrollview and the ads move up a little bit to be right under my scrollbar. main.xml Please help, thanks! EDIT: Picture UI pic http://img52.imageshack.us/img52/9397/unledyv.png
TITLE: ScrollView moved AdMob ads QUESTION: Well before my ads were working fine and were always at the bottom of the screen, but now I added a scrollview and the ads move up a little bit to be right under my scrollbar. main.xml Please help, thanks! EDIT: Picture UI pic http://img52.imageshack.us/img52/9397/unledyv.pn...
[ "android", "android-layout" ]
2
3
4,176
3
0
2011-06-01T21:49:18.523000
2011-06-01T22:02:28.833000
6,208,147
6,208,204
Ruby/Rails - Is there an easy way to make hard-coded HTML symbols html_safe?
In my view I want to display some right double angle quotes in my link. Before Rails 3, this worked: <%= link_to "» #{@category.name}", some_path %> Now what should I do if I want to specify the » as html_safe but not the rest of the link's text? In other words I do not want to do this: <%= link_to "» #{@category.name}...
In this situation I often explicitly escape the unsafe part: "» #{h @category.name}".html_safe
Ruby/Rails - Is there an easy way to make hard-coded HTML symbols html_safe? In my view I want to display some right double angle quotes in my link. Before Rails 3, this worked: <%= link_to "» #{@category.name}", some_path %> Now what should I do if I want to specify the » as html_safe but not the rest of the link's te...
TITLE: Ruby/Rails - Is there an easy way to make hard-coded HTML symbols html_safe? QUESTION: In my view I want to display some right double angle quotes in my link. Before Rails 3, this worked: <%= link_to "» #{@category.name}", some_path %> Now what should I do if I want to specify the » as html_safe but not the res...
[ "ruby-on-rails-3", "html-safe" ]
3
3
1,221
2
0
2011-06-01T21:49:18.853000
2011-06-01T21:56:05.670000
6,208,150
6,208,643
Why is the order of execution of attribute assignments failing?
I am passing these parameters to a controller: { "utf8" => "✓", "authenticity_token" => "ersjaJ4/ieZelVifP/YpBHTJtiQ53HgO5KYjEdW0BlQ=", "transaction" => { "use_balance" => "1", "traces_attributes" => { "trace_ids" => ["6"], "6" => { "amount" => "12.0", "charge_id" => "6" } }, "positive_balance" => "12", "property_id" =...
The order of the assignments should be the same as the order of the params in the form, but I don't think this is guaranteed. A safer solution would be to only store the data in the traces_attributes= method, and access the other attributes later, for example in a before_save callback.
Why is the order of execution of attribute assignments failing? I am passing these parameters to a controller: { "utf8" => "✓", "authenticity_token" => "ersjaJ4/ieZelVifP/YpBHTJtiQ53HgO5KYjEdW0BlQ=", "transaction" => { "use_balance" => "1", "traces_attributes" => { "trace_ids" => ["6"], "6" => { "amount" => "12.0", "ch...
TITLE: Why is the order of execution of attribute assignments failing? QUESTION: I am passing these parameters to a controller: { "utf8" => "✓", "authenticity_token" => "ersjaJ4/ieZelVifP/YpBHTJtiQ53HgO5KYjEdW0BlQ=", "transaction" => { "use_balance" => "1", "traces_attributes" => { "trace_ids" => ["6"], "6" => { "amou...
[ "ruby-on-rails", "ruby", "parameters" ]
0
0
97
2
0
2011-06-01T21:49:47.867000
2011-06-01T22:51:05.553000
6,208,156
6,208,493
Why does mysql_query() return TRUE with a SELECT statement?
According to the manual of mysql_query() and to everything I know about this function that I used so many times, it can either return a resource or FALSE if the query is a SELECT. Yet it returns TRUE from time to time. How can this be? It never ever happened before. Is this a bug in PHP 5.3.2? Does anyone know anything...
If webbiedave isn't on the right track, there's only one codepath that allows for this situation in the php source: #if MYSQL_VERSION_ID < 32224 #define PHP_MYSQL_VALID_RESULT(mysql) \ (mysql_num_fields(mysql)>0) #else #define PHP_MYSQL_VALID_RESULT(mysql) \ (mysql_field_count(mysql)>0) #endif... if (!mysql_result) { i...
Why does mysql_query() return TRUE with a SELECT statement? According to the manual of mysql_query() and to everything I know about this function that I used so many times, it can either return a resource or FALSE if the query is a SELECT. Yet it returns TRUE from time to time. How can this be? It never ever happened b...
TITLE: Why does mysql_query() return TRUE with a SELECT statement? QUESTION: According to the manual of mysql_query() and to everything I know about this function that I used so many times, it can either return a resource or FALSE if the query is a SELECT. Yet it returns TRUE from time to time. How can this be? It nev...
[ "php", "mysql" ]
9
6
8,845
7
0
2011-06-01T21:50:34.293000
2011-06-01T22:30:15.963000
6,208,165
6,209,241
Why does rails.bat work but rails does not?
When attempting to create a new Ruby on Rails app in Windows the command rails new test_app returns an error 'rails' is not recognized as an internal or external command, operable program or batch file but the command rails.bat new test_app works just fine. I have added the..\ruby\bin directory to my PATH variable but ...
From your updated question I can assume that PATHEXT, the environment variable responsible for knowing files to be executed without extensions is missing.BAT from it. To confirm, please do SET PATHEXT on a new command prompt and see the output, the result should be a semi-colon separated values that include.EXE,.BAT,.C...
Why does rails.bat work but rails does not? When attempting to create a new Ruby on Rails app in Windows the command rails new test_app returns an error 'rails' is not recognized as an internal or external command, operable program or batch file but the command rails.bat new test_app works just fine. I have added the.....
TITLE: Why does rails.bat work but rails does not? QUESTION: When attempting to create a new Ruby on Rails app in Windows the command rails new test_app returns an error 'rails' is not recognized as an internal or external command, operable program or batch file but the command rails.bat new test_app works just fine. ...
[ "ruby-on-rails", "ruby", "windows", "ruby-on-rails-3", "rake" ]
2
3
834
2
0
2011-06-01T21:51:24.433000
2011-06-02T00:32:51.303000
6,208,172
6,208,212
Use fake domain locally in Visual Studio without modifying the host file directly
I have an application that runs here http://localhost:10205/ but I need it run locally as http://somethingelse.com/. This needs to happen on other computers as well without the need to alter the host file. How do I do that?
If you are all within the same network, you can add an A Record to your domain controller. Beyond that, there's not much you can do when you're dealing with multiple endpoints. As far as actually performing that task, you may want to discuss on serverfault.
Use fake domain locally in Visual Studio without modifying the host file directly I have an application that runs here http://localhost:10205/ but I need it run locally as http://somethingelse.com/. This needs to happen on other computers as well without the need to alter the host file. How do I do that?
TITLE: Use fake domain locally in Visual Studio without modifying the host file directly QUESTION: I have an application that runs here http://localhost:10205/ but I need it run locally as http://somethingelse.com/. This needs to happen on other computers as well without the need to alter the host file. How do I do th...
[ "asp.net", "iis" ]
2
2
592
1
0
2011-06-01T21:52:20.523000
2011-06-01T21:56:36.307000
6,208,177
6,208,218
Is it protocol abuse to report server-side errors through the HTTP status?
I noticed that ColdFusion (version 8 at least) returns the HTTP status code 500 (internal server error) when an uncaught exception occurs in a CFML page. Is this kind of behavior abusing the HTTP status codes, or is it, on the opposite, a nice behavior I should try to reproduce for my other, non-ColdFusion app?
This is a nice behavior. Especially if you are creating services. Applications consuming your end points can simply check the HTTP status to know if there is an error. Typically, you may also include some text about the error in the body.
Is it protocol abuse to report server-side errors through the HTTP status? I noticed that ColdFusion (version 8 at least) returns the HTTP status code 500 (internal server error) when an uncaught exception occurs in a CFML page. Is this kind of behavior abusing the HTTP status codes, or is it, on the opposite, a nice b...
TITLE: Is it protocol abuse to report server-side errors through the HTTP status? QUESTION: I noticed that ColdFusion (version 8 at least) returns the HTTP status code 500 (internal server error) when an uncaught exception occurs in a CFML page. Is this kind of behavior abusing the HTTP status codes, or is it, on the ...
[ "http", "http-status-codes" ]
1
1
93
2
0
2011-06-01T21:53:03.363000
2011-06-01T21:57:16.870000
6,208,183
6,208,327
Python sleep function does not catch interrupt signal
I cannot catch the INT signal in the main thread, please advise me how to fix the problem. I wish that the sleep method could be interrupted by CTRL+C, but it waits till the timer is ended.. import pygtk pygtk.require('2.0') import gtk import time import urllib2 import re import signal import sys import __main__ fro...
Believe it or not, this will work. from Queue import Queue, Empty def signal_safe_sleep(delay): q = Queue() try: q.get(True, delay) except Empty: pass Alternatively, you can create some file descriptors using os.pipe() and then use select.select() on them within your signal_safe_sleep function. Both approaches will all...
Python sleep function does not catch interrupt signal I cannot catch the INT signal in the main thread, please advise me how to fix the problem. I wish that the sleep method could be interrupted by CTRL+C, but it waits till the timer is ended.. import pygtk pygtk.require('2.0') import gtk import time import urllib2 im...
TITLE: Python sleep function does not catch interrupt signal QUESTION: I cannot catch the INT signal in the main thread, please advise me how to fix the problem. I wish that the sleep method could be interrupted by CTRL+C, but it waits till the timer is ended.. import pygtk pygtk.require('2.0') import gtk import time...
[ "python" ]
4
3
2,663
2
0
2011-06-01T21:53:35.153000
2011-06-01T22:08:58.303000
6,208,187
6,220,257
Loading remote data into a ExtJS-Grid-Panel fails depending on the URL used
I have the following very simple Ext JS 4 script which is supposed to fetch two rows from an URL and display it in a Ext JS grid panel. Ext.define('Entry', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'int'}, {name: 'val' } ] }); var store = Ext.create('Ext.data.Store', { model: 'Entry', proxy: { type: 'aj...
By trial and error I was able to solve this problem. However my knowledge of Ext JS is to low to exactly know the reason. The difference between the two URLs was the response time. Whenever I added a delay to make server.php respond later it behaved the same way as the other URL. The way to fix it was to put the grid i...
Loading remote data into a ExtJS-Grid-Panel fails depending on the URL used I have the following very simple Ext JS 4 script which is supposed to fetch two rows from an URL and display it in a Ext JS grid panel. Ext.define('Entry', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'int'}, {name: 'val' } ] }); v...
TITLE: Loading remote data into a ExtJS-Grid-Panel fails depending on the URL used QUESTION: I have the following very simple Ext JS 4 script which is supposed to fetch two rows from an URL and display it in a Ext JS grid panel. Ext.define('Entry', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'int'}, {name...
[ "javascript", "extjs" ]
0
0
1,294
1
0
2011-06-01T21:54:14.170000
2011-06-02T20:52:25.217000
6,208,202
6,208,285
Can someone explain the parameter void(*pfn)(void*)?
I've come across this piece of code inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) I don't understand this part void(*pfn)(void*) Can someone tell me what it means/is? This is btw not listed in books for beginners so if you want to mention to read books, it's not there. Afaik, void...
This is a function pointer (or a pointer to a function). void(*pfn)(void*) This is broken down as such: *pfn (the name of the pointer i.e. pointer to a function) (void *) (these are the parameters to the function ie. a simple pointer to anything) void (this is return from the function) So if you have a function like th...
Can someone explain the parameter void(*pfn)(void*)? I've come across this piece of code inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) I don't understand this part void(*pfn)(void*) Can someone tell me what it means/is? This is btw not listed in books for beginners so if you want ...
TITLE: Can someone explain the parameter void(*pfn)(void*)? QUESTION: I've come across this piece of code inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) I don't understand this part void(*pfn)(void*) Can someone tell me what it means/is? This is btw not listed in books for beginne...
[ "c++", "pointers", "function-pointers" ]
5
7
3,899
8
0
2011-06-01T21:56:01.130000
2011-06-01T22:03:17.890000
6,208,214
6,208,292
Placing 3 div's Side by Side
I want to place 3 divs side by side using CSS. I have gone through many posts on SO, but not getting the thing working for my project. #quotescointainer{ width: 100%; font-size: 12px; } #quotesleft{ float:left; width: 33%; background-color: white; } #quotescenter{ background-color:white; width: 33%; } #quotesright{ flo...
You could float: left all the inner div s: http://jsfiddle.net/W8dyy/ You should fix the spelling of quotescointainer to quotescontainer. #quotescointainer{ width: 100%; font-size: 12px; overflow: hidden; /* contain floated elements */ background: #ccc } #quotesleft { float: left; width: 33%; background-color: #bbb; } ...
Placing 3 div's Side by Side I want to place 3 divs side by side using CSS. I have gone through many posts on SO, but not getting the thing working for my project. #quotescointainer{ width: 100%; font-size: 12px; } #quotesleft{ float:left; width: 33%; background-color: white; } #quotescenter{ background-color:white; wi...
TITLE: Placing 3 div's Side by Side QUESTION: I want to place 3 divs side by side using CSS. I have gone through many posts on SO, but not getting the thing working for my project. #quotescointainer{ width: 100%; font-size: 12px; } #quotesleft{ float:left; width: 33%; background-color: white; } #quotescenter{ backgrou...
[ "html", "css" ]
10
20
39,880
3
0
2011-06-01T21:57:04.027000
2011-06-01T22:04:03.030000
6,208,216
6,216,627
impossible to html parsing facebook public profile with php
i grabbed an html from this url: http://facebook.com/zuck there is no problem to echo it to the client browser but i found it impossible to parse it with php. i am trying to parse the text inside div tags for example: preg_match_all("/ (.*)<\/div>/",$html,$matches); print_r($matches); returns empty array i also tried w...
$html = str_replace(array('\u003c','\"','\/'), array('<','"','/'), $html); preg_match_all('/ (.*?)<\/div>/', $html, $matches); var_dump($matches); must be a way to do it with one single line of preg_match instead of the code above and also grab this tag text, but i don't know how to write it in a single line.
impossible to html parsing facebook public profile with php i grabbed an html from this url: http://facebook.com/zuck there is no problem to echo it to the client browser but i found it impossible to parse it with php. i am trying to parse the text inside div tags for example: preg_match_all("/ (.*)<\/div>/",$html,$mat...
TITLE: impossible to html parsing facebook public profile with php QUESTION: i grabbed an html from this url: http://facebook.com/zuck there is no problem to echo it to the client browser but i found it impossible to parse it with php. i am trying to parse the text inside div tags for example: preg_match_all("/ (.*)<\...
[ "php", "html", "facebook", "parsing" ]
1
1
2,161
3
0
2011-06-01T21:57:10.983000
2011-06-02T15:24:18.153000
6,208,217
6,208,259
How to identify touch on a specific imageView from multiple imageViews in a UIScrollView?
I have multiple ImageViews in a UIScrollView and I want to identify the specific imageView on which I touched. So that I could do some actions. (for example, showing Alert with the image name). I have seen some similar posts, but they did not have proper answer. And some answers were complex to me as I am pretty new to...
I recommend you look through the documentation and examples for UIGestureRecognizer. There is also a more explanatory Event Handling Guide. This will walk you through adding Gesture Recognizers to specific views (e.g. your imageView) that can handle swipes, taps and multitouch gestures however you like.
How to identify touch on a specific imageView from multiple imageViews in a UIScrollView? I have multiple ImageViews in a UIScrollView and I want to identify the specific imageView on which I touched. So that I could do some actions. (for example, showing Alert with the image name). I have seen some similar posts, but ...
TITLE: How to identify touch on a specific imageView from multiple imageViews in a UIScrollView? QUESTION: I have multiple ImageViews in a UIScrollView and I want to identify the specific imageView on which I touched. So that I could do some actions. (for example, showing Alert with the image name). I have seen some s...
[ "iphone", "objective-c", "uiimageview", "touch" ]
1
3
711
3
0
2011-06-01T21:57:12.500000
2011-06-01T22:00:45.963000