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,236,684
6,236,739
Optimizing subset sum implementation
I'm working on a solution to a variant of the subset sum problem, using the below code. The problem entails generating subsets of 11 ints from a larger set (superset) and check if it matches a specific value (endsum). #include #include #include int endsum = 0, supersetsize = 0, done = 0; int superset[] = {1,30,10,7,11,...
One way to only generate unique subsets is to add the elements from the superset in order, and use an additional argument to permute (eg. supersetPos ) to indicate where you are in the superset. This generates sorted permutations which will be unique. EDIT: Code that AFAIK runs correctly on your sample: #include int su...
Optimizing subset sum implementation I'm working on a solution to a variant of the subset sum problem, using the below code. The problem entails generating subsets of 11 ints from a larger set (superset) and check if it matches a specific value (endsum). #include #include #include int endsum = 0, supersetsize = 0, done...
TITLE: Optimizing subset sum implementation QUESTION: I'm working on a solution to a variant of the subset sum problem, using the below code. The problem entails generating subsets of 11 ints from a larger set (superset) and check if it matches a specific value (endsum). #include #include #include int endsum = 0, supe...
[ "c++", "c", "optimization" ]
0
2
2,144
3
0
2011-06-04T12:14:42.460000
2011-06-04T12:28:09.520000
6,236,687
6,236,867
How to calculate the running difference of the same column in a table with SQL query?
I have the following table structure with data as ReadingDate Unit 01-05-2011 10 01-06-2011 20 01-07-2011 40 01-08-2011 40 AND I want to the following result with T-Sql query. I am using sql server 2008 R2 ReadingDate Unit UnitConsumed 01-05-2011 10 10 01-06-2011 20 10 01-07-2011 40 20 01-08-2011 40 0
You could try the following: With tblDifference as ( Select Row_Number() OVER (Order by ReadingDate) as RowNumber,ReadingDate,Unit from TestTable ) Select Cur.ReadingDate, Cur.Unit, ISNULL((Cur.Unit-Prv.Unit),Cur.Unit) as UnitConsumed from tblDifference Cur Left Outer Join tblDifference Prv On Cur.RowNumber=Prv.RowNum...
How to calculate the running difference of the same column in a table with SQL query? I have the following table structure with data as ReadingDate Unit 01-05-2011 10 01-06-2011 20 01-07-2011 40 01-08-2011 40 AND I want to the following result with T-Sql query. I am using sql server 2008 R2 ReadingDate Unit UnitConsume...
TITLE: How to calculate the running difference of the same column in a table with SQL query? QUESTION: I have the following table structure with data as ReadingDate Unit 01-05-2011 10 01-06-2011 20 01-07-2011 40 01-08-2011 40 AND I want to the following result with T-Sql query. I am using sql server 2008 R2 ReadingDat...
[ "sql-server-2008" ]
3
1
5,311
2
0
2011-06-04T12:15:10.667000
2011-06-04T12:59:39.123000
6,236,723
6,236,747
c# application working on development machine, fails on non-development machine
this problem has me baffled. I'm writing an application which is supposed to take information from a form, pass it to a background worker which then a) writes the information to a local xml file and b) inserts the information into a remote MySQL database. On my development machine, it seems to work flawlessly. The remo...
If your code fails, it most likely means there is some uncaught exception. What you should do is to log all uncaught exceptions (and probably some of the caught too) to a file, possibly using something like log4net. I don't think we can help you beyond that.
c# application working on development machine, fails on non-development machine this problem has me baffled. I'm writing an application which is supposed to take information from a form, pass it to a background worker which then a) writes the information to a local xml file and b) inserts the information into a remote ...
TITLE: c# application working on development machine, fails on non-development machine QUESTION: this problem has me baffled. I'm writing an application which is supposed to take information from a form, pass it to a background worker which then a) writes the information to a local xml file and b) inserts the informat...
[ "c#", "winforms", "c#-4.0", "backgroundworker" ]
2
4
372
3
0
2011-06-04T12:23:59.813000
2011-06-04T12:31:23.057000
6,236,743
6,238,201
Wrapping parts of boost::asio in a C library - for use on embedded Linux
I'm looking for a good ( and simple ) sockets library that I can incorporate into an XMPP client I am building in C for embedded Linux. Lots of people have recommended boost::asio, and since I am already familiar with C++ and some aspects of boost - I thought I might wrap this up into a C library to be called from my c...
Using Boost ASIO to implement a C interface does sound a bit complicated and mismatched. How about starting with something more native to C, like libevent? I know it's not the same, but it's a start, and socket programming is well supported in C itself.
Wrapping parts of boost::asio in a C library - for use on embedded Linux I'm looking for a good ( and simple ) sockets library that I can incorporate into an XMPP client I am building in C for embedded Linux. Lots of people have recommended boost::asio, and since I am already familiar with C++ and some aspects of boost...
TITLE: Wrapping parts of boost::asio in a C library - for use on embedded Linux QUESTION: I'm looking for a good ( and simple ) sockets library that I can incorporate into an XMPP client I am building in C for embedded Linux. Lots of people have recommended boost::asio, and since I am already familiar with C++ and som...
[ "c++", "sockets", "boost-asio" ]
1
2
709
1
0
2011-06-04T12:29:44.023000
2011-06-04T17:13:29.323000
6,236,751
6,236,801
Android: what is the difference between Bundle Vs java.util collections like HashMap
What is the difference between Bundle Vs java.util collections like HashMap?
One difference I can see easily is that a Bundle allows you to put int, boolean, etc., into it while a HashMap seems to require you to convert them to/from objects. A more important difference is that with a Bundle, every object it contains is parcelable. This allows Bundles to be used as service parameters and to be a...
Android: what is the difference between Bundle Vs java.util collections like HashMap What is the difference between Bundle Vs java.util collections like HashMap?
TITLE: Android: what is the difference between Bundle Vs java.util collections like HashMap QUESTION: What is the difference between Bundle Vs java.util collections like HashMap? ANSWER: One difference I can see easily is that a Bundle allows you to put int, boolean, etc., into it while a HashMap seems to require you...
[ "java", "android" ]
15
27
6,660
2
0
2011-06-04T12:32:13.967000
2011-06-04T12:42:52.967000
6,236,760
6,236,788
String Comparision without Special Character
I have strings having special characters e.g. "ravi", "Ravi","!ravi","ravi...","RaVi)" etc.. I want all these to be treated as same. How to achieve this. Can be in shell script, C,C++,JAVA. Thanks, Ravi.
Java: str.toLowercase().replace("[^a-zA-Z]", "") will render them all in lowercase with special chars removed and therefore all equal() Edited to cover everything not alpha as "special"
String Comparision without Special Character I have strings having special characters e.g. "ravi", "Ravi","!ravi","ravi...","RaVi)" etc.. I want all these to be treated as same. How to achieve this. Can be in shell script, C,C++,JAVA. Thanks, Ravi.
TITLE: String Comparision without Special Character QUESTION: I have strings having special characters e.g. "ravi", "Ravi","!ravi","ravi...","RaVi)" etc.. I want all these to be treated as same. How to achieve this. Can be in shell script, C,C++,JAVA. Thanks, Ravi. ANSWER: Java: str.toLowercase().replace("[^a-zA-Z]",...
[ "java", "c++", "c", "scripting", "string-comparison" ]
1
3
3,565
3
0
2011-06-04T12:34:53.637000
2011-06-04T12:40:38.923000
6,236,761
6,236,884
removing body background color of iframe
I have a an iframe on my page that currentlyhas a background color of grey, I want to change the color to be white but cant seem to do it. I have tried using jquery but not sure if this is correct: $(document).ready(function(){ $('iframe').contents().find('body').css('backgroundColor', 'white'); }); basically at the mo...
My comment... Does the src attribute of the iframe have matching domain, protocol and port to its parent page? Your response... No the iframe is external. The reason you can not change it is because of Same Origin Policy.
removing body background color of iframe I have a an iframe on my page that currentlyhas a background color of grey, I want to change the color to be white but cant seem to do it. I have tried using jquery but not sure if this is correct: $(document).ready(function(){ $('iframe').contents().find('body').css('background...
TITLE: removing body background color of iframe QUESTION: I have a an iframe on my page that currentlyhas a background color of grey, I want to change the color to be white but cant seem to do it. I have tried using jquery but not sure if this is correct: $(document).ready(function(){ $('iframe').contents().find('body...
[ "javascript", "jquery", "html", "css" ]
4
2
6,810
3
0
2011-06-04T12:34:54.713000
2011-06-04T13:03:26.200000
6,236,762
6,237,094
In C, are const variables guaranteed to be distinct in memory?
Speaking of string literals, the C99 standard says (6.4.5.6): It is unspecified whether these arrays are distinct provided their elements have the appropriate values. If the program attempts to modify such an array, the behavior is undefined. I couldn't find either a similar warning or an explicit guarantee for const v...
In the standard, equality is discussed in §6.5.9 “Equality operators”, & is discussed in §6.5.3.2 “Address and indirection operators”, and const is discussed in §6.7.3 “Type qualifiers”. The relevant passage about pointer equality is §6.5.9.6: Two pointers compare equal if and only if both are null pointers, both are p...
In C, are const variables guaranteed to be distinct in memory? Speaking of string literals, the C99 standard says (6.4.5.6): It is unspecified whether these arrays are distinct provided their elements have the appropriate values. If the program attempts to modify such an array, the behavior is undefined. I couldn't fin...
TITLE: In C, are const variables guaranteed to be distinct in memory? QUESTION: Speaking of string literals, the C99 standard says (6.4.5.6): It is unspecified whether these arrays are distinct provided their elements have the appropriate values. If the program attempts to modify such an array, the behavior is undefin...
[ "c", "string", "constants", "c99" ]
11
5
598
4
0
2011-06-04T12:34:56.570000
2011-06-04T13:49:05.590000
6,236,772
6,236,893
using arraylist inside mysql select statement
I have a login arraylist where i have stored users loginid using following mysql query Code: query = "select LoginID from issuedeposit id where id.DueDate < CURDATE()"; result = statement.executeQuery(query); while(result.next()) { String loginid = result.getString(1); loginarray.add(loginid); } now I want to use the...
res = statement1.executeQuery("select EmailID form studentaccount sa where sa.LoginID = '"+ loginarray.get(i) +"' "); Should be res = statement1.executeQuery("select EmailID FROM studentaccount sa where sa.LoginID = '"+ loginarray.get(i) +"' ");
using arraylist inside mysql select statement I have a login arraylist where i have stored users loginid using following mysql query Code: query = "select LoginID from issuedeposit id where id.DueDate < CURDATE()"; result = statement.executeQuery(query); while(result.next()) { String loginid = result.getString(1); lo...
TITLE: using arraylist inside mysql select statement QUESTION: I have a login arraylist where i have stored users loginid using following mysql query Code: query = "select LoginID from issuedeposit id where id.DueDate < CURDATE()"; result = statement.executeQuery(query); while(result.next()) { String loginid = resul...
[ "java", "mysql", "jdbc" ]
1
2
2,476
1
0
2011-06-04T12:37:47.053000
2011-06-04T13:05:13.563000
6,236,775
6,237,055
Unit of Work Scope
I have a solution that uses webforms for front end & mvc for admin console. Both UIs consume a service layer via Ninject, and i am having trouble working out a subtle but rather important issue. Suppose i have a CourseService that returns a list of courses based upon a string search term - the service returns the searc...
That is all about "Boundary" of your unit of work. What is a boundary of your logical operation? Is it UI - code behind / controller or service layer? By boundary I mean who defines what is unit of work? Is it responsibility of an UI developer to choreograph multiple service calls to a single unit of work or is it resp...
Unit of Work Scope I have a solution that uses webforms for front end & mvc for admin console. Both UIs consume a service layer via Ninject, and i am having trouble working out a subtle but rather important issue. Suppose i have a CourseService that returns a list of courses based upon a string search term - the servic...
TITLE: Unit of Work Scope QUESTION: I have a solution that uses webforms for front end & mvc for admin console. Both UIs consume a service layer via Ninject, and i am having trouble working out a subtle but rather important issue. Suppose i have a CourseService that returns a list of courses based upon a string search...
[ "architecture", "repository-pattern", "ninject", "unit-of-work", "service-layer" ]
2
2
2,755
1
0
2011-06-04T12:38:19.330000
2011-06-04T13:39:38.623000
6,236,778
6,236,806
"lvalue required as unary '&' operand" in accept() socket system call
I am writing a network program where, in the server part, I want to accept connections from multiple clients using a listening socket. So I declare an array of address structs like this: struct sockaddr_in* client; which I create using malloc and later on, to accept connections I type: newsock = accept(fd_skt, (struct ...
Yes, you can't take the address of something that isn't an lvalue, that is an object with an address. The result of the sizeof operator is just a value, it isn't an object with an address. You need to create a local variable so that you can take its address. E.g. socklen_t addrlen = sizeof client[i]; newsock = accept(f...
"lvalue required as unary '&' operand" in accept() socket system call I am writing a network program where, in the server part, I want to accept connections from multiple clients using a listening socket. So I declare an array of address structs like this: struct sockaddr_in* client; which I create using malloc and lat...
TITLE: "lvalue required as unary '&' operand" in accept() socket system call QUESTION: I am writing a network program where, in the server part, I want to accept connections from multiple clients using a listening socket. So I declare an array of address structs like this: struct sockaddr_in* client; which I create us...
[ "c", "sockets", "compiler-errors" ]
4
11
13,112
2
0
2011-06-04T12:38:53.093000
2011-06-04T12:43:10.297000
6,236,779
6,241,027
Silverlight client port check
I'm facing a problem that gives me a quite hard time... People having trouble to execute a program that needs specific ports to be open, sadly they don't know if its a clientside problem caused by blocked ports, of it its simply a software problem. So I thought about making a program that checks if the user can access...
If you trying to do it from the in-browser application that its a no. Trusted silverlight application should be able to connect to any port without restrictions.
Silverlight client port check I'm facing a problem that gives me a quite hard time... People having trouble to execute a program that needs specific ports to be open, sadly they don't know if its a clientside problem caused by blocked ports, of it its simply a software problem. So I thought about making a program that...
TITLE: Silverlight client port check QUESTION: I'm facing a problem that gives me a quite hard time... People having trouble to execute a program that needs specific ports to be open, sadly they don't know if its a clientside problem caused by blocked ports, of it its simply a software problem. So I thought about mak...
[ "silverlight", "tcp", "connection", "port" ]
0
0
359
1
0
2011-06-04T12:38:53.853000
2011-06-05T04:36:04.477000
6,236,782
6,236,828
jQuery - Change css for all divs of a class except 'this'
I need it so when I click on a div of class 'mydiv', all divs of that class have a z-index of 1, except for the div I clicked on which as a z-index of 2. Clicking on the div again needs to change its z-index back to 1. So far ive come up with the following: $('.mydiv').toggle(function() { $('.mydiv').css('z-index','1')...
So now we changed everything again. Based on the OP edit, now the code would be: $(".mydiv").click(function () { var $t = $(this); $t.siblings().css("z-index", 1).animate({ "margin-top": 0 }, "fast"); if ($t.css("z-index") == 1) $t.css("z-index", 2).animate({ "margin-top": -10 }); else $t.css("z-index", 1).animate({ "m...
jQuery - Change css for all divs of a class except 'this' I need it so when I click on a div of class 'mydiv', all divs of that class have a z-index of 1, except for the div I clicked on which as a z-index of 2. Clicking on the div again needs to change its z-index back to 1. So far ive come up with the following: $('....
TITLE: jQuery - Change css for all divs of a class except 'this' QUESTION: I need it so when I click on a div of class 'mydiv', all divs of that class have a z-index of 1, except for the div I clicked on which as a z-index of 2. Clicking on the div again needs to change its z-index back to 1. So far ive come up with t...
[ "jquery", "css", "z-index" ]
5
2
4,591
3
0
2011-06-04T12:39:39.280000
2011-06-04T12:48:59.743000
6,236,789
6,236,863
is there user defined flags i can set/check in ZwCreateFile/InitializeObjectAttributes inside file system driver?
I am developing file system driver under Windows and i need to check file attributes of every accessed file. To do this i need to do additional ZwCreateFile for each file, but again it returns to my dispatch routine. What flags i can set with InitializeObjectAttributes() or ZwCreateFile() so i can check it later so my ...
Solved, try IoCreateFileSpecifyDeviceObjectHint, IoCreateFileEx or FtlCreateFile.
is there user defined flags i can set/check in ZwCreateFile/InitializeObjectAttributes inside file system driver? I am developing file system driver under Windows and i need to check file attributes of every accessed file. To do this i need to do additional ZwCreateFile for each file, but again it returns to my dispatc...
TITLE: is there user defined flags i can set/check in ZwCreateFile/InitializeObjectAttributes inside file system driver? QUESTION: I am developing file system driver under Windows and i need to check file attributes of every accessed file. To do this i need to do additional ZwCreateFile for each file, but again it ret...
[ "c", "windows", "winapi", "device-driver" ]
1
2
233
1
0
2011-06-04T12:40:42.247000
2011-06-04T12:57:45.163000
6,236,794
6,236,927
How much is the difference between html parsing and web crawling in python
I need to grab some data from websites in my django website. Now i am confused whether i should use python parsing libraries or web crawling libraries. Does search engine libraries also fall in same category I want to know how much is the difference between the two and if i want to use those functions inside my website...
If you can get away with background web crawling use scrapy. If need to immediately grab something use html5lib (more robust) or lxml (faster). If you are going to be doing the later, use the awesome requests library. I would avoid using BeautifulSoup, mechanize, urllib2, httplib.
How much is the difference between html parsing and web crawling in python I need to grab some data from websites in my django website. Now i am confused whether i should use python parsing libraries or web crawling libraries. Does search engine libraries also fall in same category I want to know how much is the differ...
TITLE: How much is the difference between html parsing and web crawling in python QUESTION: I need to grab some data from websites in my django website. Now i am confused whether i should use python parsing libraries or web crawling libraries. Does search engine libraries also fall in same category I want to know how ...
[ "python", "django", "web-crawler" ]
4
9
2,501
3
0
2011-06-04T12:41:22.787000
2011-06-04T13:11:50.510000
6,236,799
6,236,830
How to separate inner class of template class into other file
I want to do: typedef MyTemplateClass TClass; TClass t; TClass::InnerClass i; i.test(); i think the solution could be: template class MyTemplateClass { public: class InnerClass { //here I can do stuff with A and B A test() { return 0; } }; friend class InnerClass; }; but I want to have ma templates in separate *.inl f...
You can't. In a nutshell. Templates must be wholly defined before instantiation- that means that whatever you do, you'll have to define the inner class in the template class anyway.
How to separate inner class of template class into other file I want to do: typedef MyTemplateClass TClass; TClass t; TClass::InnerClass i; i.test(); i think the solution could be: template class MyTemplateClass { public: class InnerClass { //here I can do stuff with A and B A test() { return 0; } }; friend class Inne...
TITLE: How to separate inner class of template class into other file QUESTION: I want to do: typedef MyTemplateClass TClass; TClass t; TClass::InnerClass i; i.test(); i think the solution could be: template class MyTemplateClass { public: class InnerClass { //here I can do stuff with A and B A test() { return 0; } }; ...
[ "c++", "templates", "inner-classes" ]
3
4
1,732
2
0
2011-06-04T12:42:17.730000
2011-06-04T12:49:05.320000
6,236,815
6,236,848
Why can not make a declaration directly in a page class in case of session variable?
My question is one line yet this is very confusing me. Why i can not declare and initialize a session variable in partial class of a page it throws an error saying Error 1 Invalid token '[' in class, struct, or interface member declaration E:\ASP.NET\Trial\statemanagement.aspx.cs 17 12 E:\ASP.NET\Trial\ below is the co...
That is not a declaration. It is an assignment. You can not place an assignment statement directly inside a class. You have to place it inside a method or property. Refering to ASP.NET Session State Overview Session variables are stored in a SessionStateItemCollection object that is exposed through the HttpContext.Sess...
Why can not make a declaration directly in a page class in case of session variable? My question is one line yet this is very confusing me. Why i can not declare and initialize a session variable in partial class of a page it throws an error saying Error 1 Invalid token '[' in class, struct, or interface member declara...
TITLE: Why can not make a declaration directly in a page class in case of session variable? QUESTION: My question is one line yet this is very confusing me. Why i can not declare and initialize a session variable in partial class of a page it throws an error saying Error 1 Invalid token '[' in class, struct, or interf...
[ "c#", "asp.net", "session" ]
0
3
686
2
0
2011-06-04T12:45:57.143000
2011-06-04T12:53:35.447000
6,236,818
6,236,841
Primary Key Problem ASP.NET
I am developing a career website for one of my projects. I am using Visual Studio 2010 and ASP.NET Web Forms to code. My problem is I have got a table named Companies which consists of columns Company ID, Company Name, Company Address and Company Phone. CompanyID is my primary key. I am trying to insert new companies t...
If your CompanyID is a uniqueidentifier then you can pass in Guid.NewGuid(); For example: Company newCompany = new Company { coID = Guid.NewGuid(), coName = TextBox_coName.Text, coAddress = TextBox_coAddress.Text, coPhone = int.Parse(TextBox_coPhone.Text) };
Primary Key Problem ASP.NET I am developing a career website for one of my projects. I am using Visual Studio 2010 and ASP.NET Web Forms to code. My problem is I have got a table named Companies which consists of columns Company ID, Company Name, Company Address and Company Phone. CompanyID is my primary key. I am tryi...
TITLE: Primary Key Problem ASP.NET QUESTION: I am developing a career website for one of my projects. I am using Visual Studio 2010 and ASP.NET Web Forms to code. My problem is I have got a table named Companies which consists of columns Company ID, Company Name, Company Address and Company Phone. CompanyID is my prim...
[ "asp.net", "sql-server", "visual-studio", "linq-to-sql" ]
0
1
326
1
0
2011-06-04T12:46:49.437000
2011-06-04T12:51:01.157000
6,236,820
6,247,415
Show custom contact information
So I have an MKMapView and I have a pin on it with a disclosure button. I want the user to be able to tap the disclosure button and the navigation controller to push a new view controller. But I want that new view controller to look like the contacts viewController that comes standard in the contacts app. I need it to ...
Here is how it should be done: ABUnknownPersonViewController *newPersonViewController = [[ABUnknownPersonViewController alloc] init]; newPersonViewController.displayedPerson = [self personObject]; [self.navigationController pushViewController:newPersonViewController animated:YES]; and than to respond to the [self perso...
Show custom contact information So I have an MKMapView and I have a pin on it with a disclosure button. I want the user to be able to tap the disclosure button and the navigation controller to push a new view controller. But I want that new view controller to look like the contacts viewController that comes standard in...
TITLE: Show custom contact information QUESTION: So I have an MKMapView and I have a pin on it with a disclosure button. I want the user to be able to tap the disclosure button and the navigation controller to push a new view controller. But I want that new view controller to look like the contacts viewController that...
[ "iphone", "mkmapview", "contacts", "mapkit", "abpersonviewcontroller" ]
1
2
1,340
1
0
2011-06-04T12:47:05.633000
2011-06-06T02:54:30.350000
6,236,824
6,237,773
Using Boost.Spirit.Qi with custom lexer
I dug through the whole documentation and couldn't find an example. All the examples either parse character data or use Spirit.Lex. Forgive me if I missed something. Can someone give an example for, or point to a tutorial on, how to use Boost.Spirit.Qi with my custom lexer? E.g.: vector tokens = GetTokens(); // use boo...
You will have to do sevaral things: a) expose the token sequence as a range of iterators, which will have to be passed to parse/phrase_parse b) add a default conversion operator to your token type exposing the token id struct token { operator int() const { return id; } }; that allows to use qi::char_(ID) as a parser co...
Using Boost.Spirit.Qi with custom lexer I dug through the whole documentation and couldn't find an example. All the examples either parse character data or use Spirit.Lex. Forgive me if I missed something. Can someone give an example for, or point to a tutorial on, how to use Boost.Spirit.Qi with my custom lexer? E.g.:...
TITLE: Using Boost.Spirit.Qi with custom lexer QUESTION: I dug through the whole documentation and couldn't find an example. All the examples either parse character data or use Spirit.Lex. Forgive me if I missed something. Can someone give an example for, or point to a tutorial on, how to use Boost.Spirit.Qi with my c...
[ "c++", "boost", "boost-spirit" ]
3
4
430
1
0
2011-06-04T12:48:10.220000
2011-06-04T15:57:03.480000
6,236,829
6,236,889
WPF binding List<Dictionary<string,string>> to a ListBox
var list = new List >{ new Dictionary { {"id","1"}, {"name","foo"}, }, new Dictionary { {"id","2"}, {"name","bar"}, } }; I want to bind this list to a listbox. It's quite simple: listBox.ItemsSource=list; but the problem is: I can't control what is displayed in the listbox. What I want is to display is dict["name"]. I ...
Your code tries to display a property called name on the dictionary, which doesn't exist. To access an indexer use the following syntax: listBox.DisplayMemberPath = "[name]"; Also, you should be probably setting things like this directly in XAML, not in code-behind.
WPF binding List<Dictionary<string,string>> to a ListBox var list = new List >{ new Dictionary { {"id","1"}, {"name","foo"}, }, new Dictionary { {"id","2"}, {"name","bar"}, } }; I want to bind this list to a listbox. It's quite simple: listBox.ItemsSource=list; but the problem is: I can't control what is displayed in t...
TITLE: WPF binding List<Dictionary<string,string>> to a ListBox QUESTION: var list = new List >{ new Dictionary { {"id","1"}, {"name","foo"}, }, new Dictionary { {"id","2"}, {"name","bar"}, } }; I want to bind this list to a listbox. It's quite simple: listBox.ItemsSource=list; but the problem is: I can't control what...
[ "wpf", "data-binding", "listbox" ]
0
2
1,864
2
0
2011-06-04T12:49:04.833000
2011-06-04T13:04:24.113000
6,236,833
6,237,383
Exact real arithmetic and lazy list performance in C++/Haskell
I recently came across the subject of exact real arithmetic after reading this paper and this paper. I have found a number of papers that discuss realizations of exact arithmetic using signed digit streams. The use of infinite streams for arbitrary precision leads to nice practical implementations in functional languag...
is there something inherently slow about a signed digit/lazy stream representation that causes the bad performance, or is it Haskell? What is it that makes it slow? Would it be possible to implement a signed digit stream representation using lazy streams in C++ that achieves (significantly) better performance than its ...
Exact real arithmetic and lazy list performance in C++/Haskell I recently came across the subject of exact real arithmetic after reading this paper and this paper. I have found a number of papers that discuss realizations of exact arithmetic using signed digit streams. The use of infinite streams for arbitrary precisio...
TITLE: Exact real arithmetic and lazy list performance in C++/Haskell QUESTION: I recently came across the subject of exact real arithmetic after reading this paper and this paper. I have found a number of papers that discuss realizations of exact arithmetic using signed digit streams. The use of infinite streams for ...
[ "c++", "math", "haskell", "lazy-evaluation", "arbitrary-precision" ]
13
8
1,603
2
0
2011-06-04T12:49:45.333000
2011-06-04T14:45:48.460000
6,236,843
6,236,850
How to deny HTML form submission if previous submission is still in action?
So I have this form which executes a pretty long data posting using AJAX, now I am a bit paranoid that some smart bloke might open firebug and re-trigger posting process, while previous is still in action. How do I avoid this? Thanks!
You can: Disable submit buttons. Prevent Enter key presses. Remove action attribute from form tag. Redirect to another page upon first submission and expire the page with form on it. With that said, there's only so much you can do on the front-end to prevent resubmissions - there's always a way around. If you are so co...
How to deny HTML form submission if previous submission is still in action? So I have this form which executes a pretty long data posting using AJAX, now I am a bit paranoid that some smart bloke might open firebug and re-trigger posting process, while previous is still in action. How do I avoid this? Thanks!
TITLE: How to deny HTML form submission if previous submission is still in action? QUESTION: So I have this form which executes a pretty long data posting using AJAX, now I am a bit paranoid that some smart bloke might open firebug and re-trigger posting process, while previous is still in action. How do I avoid this?...
[ "javascript", "jquery", "html", "security", "form-submit" ]
0
2
761
3
0
2011-06-04T12:51:41.583000
2011-06-04T12:55:13.573000
6,236,844
6,243,919
Using a dynamic array inside a class -- Receiving error at compile time
QUESTION ANSWERED IN COMMENTS Because of my reputation, I can't answer it in the regular fashion. I'll add details in an answer later, already addressed in comments. Thanks. * * Hello all - As you'll no doubt see based on the question, I'm new to C++, but have experience with some higher level languages. (Which seems t...
@Bo helped me out in the comments. Turns out I had an old int list[] declaration in my header file that I never changed. So that compiler error it was throwing was due to the declaration there. After that everything was gravy.
Using a dynamic array inside a class -- Receiving error at compile time QUESTION ANSWERED IN COMMENTS Because of my reputation, I can't answer it in the regular fashion. I'll add details in an answer later, already addressed in comments. Thanks. * * Hello all - As you'll no doubt see based on the question, I'm new to C...
TITLE: Using a dynamic array inside a class -- Receiving error at compile time QUESTION: QUESTION ANSWERED IN COMMENTS Because of my reputation, I can't answer it in the regular fashion. I'll add details in an answer later, already addressed in comments. Thanks. * * Hello all - As you'll no doubt see based on the ques...
[ "c++", "dynamic-arrays" ]
1
0
3,846
2
0
2011-06-04T12:51:42.980000
2011-06-05T15:40:31.830000
6,236,856
6,236,904
How to correctly release a CGMutablePathRef in -dealloc?
Problem: Maybe the CGMutablePathRef has been created and set, but maybe not. What I do right now in -dealloc is: if (path!= NULL) { CGPathRelease(path); path = NULL; } Is this correct?
From the manual, void CGPathRelease ( CGPathRef path ); This function is equivalent to CFRelease, except that it does not cause an error if the path parameter is NULL. So there is no need to NULL check.
How to correctly release a CGMutablePathRef in -dealloc? Problem: Maybe the CGMutablePathRef has been created and set, but maybe not. What I do right now in -dealloc is: if (path!= NULL) { CGPathRelease(path); path = NULL; } Is this correct?
TITLE: How to correctly release a CGMutablePathRef in -dealloc? QUESTION: Problem: Maybe the CGMutablePathRef has been created and set, but maybe not. What I do right now in -dealloc is: if (path!= NULL) { CGPathRelease(path); path = NULL; } Is this correct? ANSWER: From the manual, void CGPathRelease ( CGPathRef pat...
[ "ios", "memory-management", "core-graphics", "core-foundation" ]
3
8
1,815
1
0
2011-06-04T12:56:48.997000
2011-06-04T13:08:08.407000
6,236,859
6,237,125
Move cursor to next contentEditable - JQuery
what I am looking to do specifically is when i press enter it creates a new paragraph the cursor then moves to or selects the new content editable paragraph to begin typing but i cant seem to find a way to do it. /*HTML Layout*/ || <----cursor posiiton //*New paragraph content editable when enter is pressed New Paragrp...
Disable the parent contenteditable, set focus on new contenteditable, enable parent contenteditable and focus back on parent contenteditable (won't allow you to move outside of the current one otherwise in some browsers.). $(window).keydown(function(event){ if(event.which == 13){ event.preventDefault(); var p = $(' ...
Move cursor to next contentEditable - JQuery what I am looking to do specifically is when i press enter it creates a new paragraph the cursor then moves to or selects the new content editable paragraph to begin typing but i cant seem to find a way to do it. /*HTML Layout*/ || <----cursor posiiton //*New paragraph conte...
TITLE: Move cursor to next contentEditable - JQuery QUESTION: what I am looking to do specifically is when i press enter it creates a new paragraph the cursor then moves to or selects the new content editable paragraph to begin typing but i cant seem to find a way to do it. /*HTML Layout*/ || <----cursor posiiton //*N...
[ "javascript", "jquery", "html", "text-editor", "contenteditable" ]
4
3
3,723
1
0
2011-06-04T12:57:04.900000
2011-06-04T13:57:13.987000
6,236,861
6,236,874
Speech recognition in C#
I'm doing a project that involves speech recognition. But here i don't just need to recognize simple commands, I need my application to identify a lengthy sentence. Such as "My name is jack, I live in UK". I'm currently using Microsoft SAPI5.1. But when i execute my application it doesn't take what I'm saying accuratel...
The best option for speech recognition would have to be Nuance's Dragon Naturally Speaking. Note that it is a commercial solution though.
Speech recognition in C# I'm doing a project that involves speech recognition. But here i don't just need to recognize simple commands, I need my application to identify a lengthy sentence. Such as "My name is jack, I live in UK". I'm currently using Microsoft SAPI5.1. But when i execute my application it doesn't take ...
TITLE: Speech recognition in C# QUESTION: I'm doing a project that involves speech recognition. But here i don't just need to recognize simple commands, I need my application to identify a lengthy sentence. Such as "My name is jack, I live in UK". I'm currently using Microsoft SAPI5.1. But when i execute my applicatio...
[ "c#", "speech-to-text" ]
2
2
1,085
1
0
2011-06-04T12:57:37.230000
2011-06-04T13:01:24.483000
6,236,866
6,236,987
Graphics arch not exact
I have to draw precise archs in java. I am currenlty using Graphics2D.fillArc(). The problem is that it only accepts ints and the archs are not precise and i cant make the archs degree increase smoothly. Does anyone know a workaround this?
Here's my SSCCE using Arc2D. import java.awt.*; import java.awt.event.*; import java.awt.geom.Arc2D; import javax.swing.*; @SuppressWarnings("serial") public class ChangingArcs extends JPanel { private static final Color ARC_FILL_COLOR = Color.RED; private static final int TIMER_DELAY = 20; private static final int AR...
Graphics arch not exact I have to draw precise archs in java. I am currenlty using Graphics2D.fillArc(). The problem is that it only accepts ints and the archs are not precise and i cant make the archs degree increase smoothly. Does anyone know a workaround this?
TITLE: Graphics arch not exact QUESTION: I have to draw precise archs in java. I am currenlty using Graphics2D.fillArc(). The problem is that it only accepts ints and the archs are not precise and i cant make the archs degree increase smoothly. Does anyone know a workaround this? ANSWER: Here's my SSCCE using Arc2D. ...
[ "java", "graphics2d" ]
1
3
148
1
0
2011-06-04T12:59:24.680000
2011-06-04T13:26:13.503000
6,236,868
6,242,427
Silverlight Upload file to MVC3 controller endpoint (Server Respose NotFound )
I'm developing a recorder in silverlight and I need to upload data from stream to the web server after recording process is completed. On server side I'm using ASP.NET MVC 3, and I have created a Controller with method FileUpload. public class FileUploaderController: Controller { [HttpPost] public ActionResult FileUplo...
With filddler I was able to get more detailed information regarding to the error. It was "upload file potentially dangerous Request.Form value was detected from the client...". To solve this I've specified content-type of the webRequest to "multipart/form-data"
Silverlight Upload file to MVC3 controller endpoint (Server Respose NotFound ) I'm developing a recorder in silverlight and I need to upload data from stream to the web server after recording process is completed. On server side I'm using ASP.NET MVC 3, and I have created a Controller with method FileUpload. public cla...
TITLE: Silverlight Upload file to MVC3 controller endpoint (Server Respose NotFound ) QUESTION: I'm developing a recorder in silverlight and I need to upload data from stream to the web server after recording process is completed. On server side I'm using ASP.NET MVC 3, and I have created a Controller with method File...
[ "silverlight", "upload" ]
1
0
423
1
0
2011-06-04T12:59:56.403000
2011-06-05T10:46:53.940000
6,236,880
6,236,896
Question about EXC_BAD_ACCESS error in std::vector::push_back on a pointer
std::vector sure is great, hey? I'm getting an EXC_BAD_ACCESS in using push_back to add an element, though. (I had a similar problem once, looked it up on SO, solved! Sadly, this appears to be a different issue.) class BackgroundGroupsHandler { public: void addBeat(Beat *b); vector groups; }; ( Beat is a simple struct-...
The problem is most likely that the BackgroundGroupsHandler that you are calling addBeat on is NULL or otherwise an invalid pointer. The problem shows up in the std::vector code because you are using groups, which will be invalid due to the BackgroundGroupsHandler being invalid.
Question about EXC_BAD_ACCESS error in std::vector::push_back on a pointer std::vector sure is great, hey? I'm getting an EXC_BAD_ACCESS in using push_back to add an element, though. (I had a similar problem once, looked it up on SO, solved! Sadly, this appears to be a different issue.) class BackgroundGroupsHandler { ...
TITLE: Question about EXC_BAD_ACCESS error in std::vector::push_back on a pointer QUESTION: std::vector sure is great, hey? I'm getting an EXC_BAD_ACCESS in using push_back to add an element, though. (I had a similar problem once, looked it up on SO, solved! Sadly, this appears to be a different issue.) class Backgrou...
[ "c++", "std", "stdvector" ]
5
4
3,539
1
0
2011-06-04T13:02:41.860000
2011-06-04T13:05:50.480000
6,236,881
6,236,988
Naming conflicts between different libraries
I'm trying to compile my program with two statically linked libraries: SFML and PhysFS. However, at the linking phase I get the following errors: eror LNK2005: _inflatePrime already defined in sfml-graphics-s.lib(inflate.obj) error LNK2005: _inflateGetHeader already defined in sfml-graphics-s.lib(inflate.obj) error LNK...
Both libraries seems to have preferred to include the zlib library instead of having a dependency on it. I'd try to build them without this inclusion and link the executable with zlib.
Naming conflicts between different libraries I'm trying to compile my program with two statically linked libraries: SFML and PhysFS. However, at the linking phase I get the following errors: eror LNK2005: _inflatePrime already defined in sfml-graphics-s.lib(inflate.obj) error LNK2005: _inflateGetHeader already defined ...
TITLE: Naming conflicts between different libraries QUESTION: I'm trying to compile my program with two statically linked libraries: SFML and PhysFS. However, at the linking phase I get the following errors: eror LNK2005: _inflatePrime already defined in sfml-graphics-s.lib(inflate.obj) error LNK2005: _inflateGetHeade...
[ "c++" ]
8
9
833
2
0
2011-06-04T13:02:45.367000
2011-06-04T13:26:18.650000
6,236,887
6,273,214
Getting a bind position from a bind name in OCI
When using OCIStmtPrepare() and OCIBindByName(), is there a way to do the bind by name, then get the position of that bind as an int? OCIStmtGetBindInfo() doesn't seem to do it. Thanks!
There doesn't appear to be an easy way to do it. I tried using the undocumented (as in I couldn't find it in the help docs but it is in the oci.h header) OCI_ATTR_HANDLE_POSITION using OCIAttrGet() on the bind handle: ub4 bpos = 0; OCIBind *bindp; OCIAttrGet(bindp, OCI_HTYPE_BIND, &bpos, 0, OCI_ATTR_HANDLE_POSITION, er...
Getting a bind position from a bind name in OCI When using OCIStmtPrepare() and OCIBindByName(), is there a way to do the bind by name, then get the position of that bind as an int? OCIStmtGetBindInfo() doesn't seem to do it. Thanks!
TITLE: Getting a bind position from a bind name in OCI QUESTION: When using OCIStmtPrepare() and OCIBindByName(), is there a way to do the bind by name, then get the position of that bind as an int? OCIStmtGetBindInfo() doesn't seem to do it. Thanks! ANSWER: There doesn't appear to be an easy way to do it. I tried us...
[ "c", "oracle", "oracle-call-interface" ]
3
2
615
1
0
2011-06-04T13:04:02.890000
2011-06-08T01:04:12.083000
6,236,890
6,236,933
High performance C# TCP server problem: No connection could be made because the target machine actively refused it
I have developed a TCP server according to your advises: High performance TCP server in C# It is based on asynchron pattern. I also developed a stress test application to test its performance. My server can get thousands of connections paralelly from my stress test app, can parse data and save it to my database. When I...
You are making connections faster than the software can listen for new connections, or in other words you are reaching the connections per second limit of that port. I think you can double the amount of connections per second by listening to a second port, client side you should just reconnect when you get the exceptio...
High performance C# TCP server problem: No connection could be made because the target machine actively refused it I have developed a TCP server according to your advises: High performance TCP server in C# It is based on asynchron pattern. I also developed a stress test application to test its performance. My server ca...
TITLE: High performance C# TCP server problem: No connection could be made because the target machine actively refused it QUESTION: I have developed a TCP server according to your advises: High performance TCP server in C# It is based on asynchron pattern. I also developed a stress test application to test its perform...
[ "c#", "exception", "tcp", "connection" ]
6
3
2,799
2
0
2011-06-04T13:04:31.693000
2011-06-04T13:13:02.170000
6,236,905
6,236,937
Alternation not matching as expected in sed
Learning sed, I want to change the drive letter of the following input lines from 'a' to 'd': http:/a/foo/bar.txt http:/a/bar/foo.txt file:/a/foobar.txt http:/b/foo/bar.txt http:/c/foobar.txt I'm using the following sed expression: sed 's_^\(http|file\):/a_\1:/d_' in.txt That is: if a line starts with either 'http' or ...
Escape the | or use extended regular expressions sed -r 's_^(http|file):/a_\1:/d_'
Alternation not matching as expected in sed Learning sed, I want to change the drive letter of the following input lines from 'a' to 'd': http:/a/foo/bar.txt http:/a/bar/foo.txt file:/a/foobar.txt http:/b/foo/bar.txt http:/c/foobar.txt I'm using the following sed expression: sed 's_^\(http|file\):/a_\1:/d_' in.txt That...
TITLE: Alternation not matching as expected in sed QUESTION: Learning sed, I want to change the drive letter of the following input lines from 'a' to 'd': http:/a/foo/bar.txt http:/a/bar/foo.txt file:/a/foobar.txt http:/b/foo/bar.txt http:/c/foobar.txt I'm using the following sed expression: sed 's_^\(http|file\):/a_\...
[ "regex", "sed" ]
3
2
1,295
2
0
2011-06-04T13:08:15.917000
2011-06-04T13:13:33.010000
6,236,909
6,237,106
Why can't we change access modifier while overriding methods in C#?
In C#, we can not change access modifier while overriding a method from base class. e.g. Class Base { **protected** string foo() { return "Base"; } } Class Derived: Base { **public** override string foo() { return "Derived"; } } This is not valid in C#, It will give compile time error. I want to know the reason, why i...
Changing the access modifier of a method in a derived type is pointless that's why it's not allowed: Case 1: Override with a more restrictive access This case is obviously not allowed due to the following situation: class Base { public virtual void A() {} } class Derived: Base { protected override void A() } Now we co...
Why can't we change access modifier while overriding methods in C#? In C#, we can not change access modifier while overriding a method from base class. e.g. Class Base { **protected** string foo() { return "Base"; } } Class Derived: Base { **public** override string foo() { return "Derived"; } } This is not valid in C...
TITLE: Why can't we change access modifier while overriding methods in C#? QUESTION: In C#, we can not change access modifier while overriding a method from base class. e.g. Class Base { **protected** string foo() { return "Base"; } } Class Derived: Base { **public** override string foo() { return "Derived"; } } This...
[ "c#", "oop", "access-modifiers" ]
51
33
31,638
8
0
2011-06-04T13:08:59.220000
2011-06-04T13:52:28.357000
6,236,924
6,237,176
After toggling class, anchor title doesn't change and anchor doesn't work
I have this html: Sign in Upon successful log in, I am able to change the anchor class to "btnsignout" and the title to "Sign out". So far so good. And now when I click on the anchor to sign out, the log out page loads into content div, but the anchor title doesn't change back to "Sign in". Clicking on it doesn't do an...
Here's an example of how I would do this. Using "live" makes it easier I think, and this way you can have more than one button in your doc and it would work (some changes would be needed to change all buttons from login to logout, and not only the clicked button). Declaring the events functions separately also makes it...
After toggling class, anchor title doesn't change and anchor doesn't work I have this html: Sign in Upon successful log in, I am able to change the anchor class to "btnsignout" and the title to "Sign out". So far so good. And now when I click on the anchor to sign out, the log out page loads into content div, but the a...
TITLE: After toggling class, anchor title doesn't change and anchor doesn't work QUESTION: I have this html: Sign in Upon successful log in, I am able to change the anchor class to "btnsignout" and the title to "Sign out". So far so good. And now when I click on the anchor to sign out, the log out page loads into cont...
[ "jquery" ]
0
1
1,198
3
0
2011-06-04T13:11:12.280000
2011-06-04T14:05:46.570000
6,236,929
6,236,935
How do we rotate a figure in 2d in openGL with respect to a point (other than the origin)?
Using the glrotatef() function rotates the figure by a specified angle with respect to the origin. How do I rotate the same figure with respect to another point without making use of transformation matrices manually? Thanks! void display(){ glClear(GL_COLOR_BUFFER_BIT); gluOrtho2D(0,499,0,499); glMatrixMode(GL_PROJECTI...
Basically: If you want to rotate around P, translate by -P (so that P moves to the origin), then perform your rotation, then translate by P (so that the origin moves back to P ). glTranslatef(P.x, P.y, P.z); glRotatef(angle, A.x, A.y, A.z); glTranslatef(-P.x, -P.y, -P.z); (Note: This is in "reverse order" because the l...
How do we rotate a figure in 2d in openGL with respect to a point (other than the origin)? Using the glrotatef() function rotates the figure by a specified angle with respect to the origin. How do I rotate the same figure with respect to another point without making use of transformation matrices manually? Thanks! void...
TITLE: How do we rotate a figure in 2d in openGL with respect to a point (other than the origin)? QUESTION: Using the glrotatef() function rotates the figure by a specified angle with respect to the origin. How do I rotate the same figure with respect to another point without making use of transformation matrices manu...
[ "c++", "opengl" ]
4
7
11,600
2
0
2011-06-04T13:12:06.707000
2011-06-04T13:13:28.753000
6,236,931
6,237,321
Scala support for string templates?
Is there default (in SDK) Scala support for string templating? Example: "$firstName $lastName"(named not numbered parameters) or even constructs like for/if. If there is no such default engine, what is the best scala library to accomplish this?
Complementing Kim's answer, note that Java's Formatter accepts positional parameters. For example: "%2$s %1$s".format(firstName, lastName) Also, there's the Enhanced Strings plugin, which allows one to embed arbitrary expressions on Strings. For example: @EnhanceStrings // enhance strings in this scope trait Example1 {...
Scala support for string templates? Is there default (in SDK) Scala support for string templating? Example: "$firstName $lastName"(named not numbered parameters) or even constructs like for/if. If there is no such default engine, what is the best scala library to accomplish this?
TITLE: Scala support for string templates? QUESTION: Is there default (in SDK) Scala support for string templating? Example: "$firstName $lastName"(named not numbered parameters) or even constructs like for/if. If there is no such default engine, what is the best scala library to accomplish this? ANSWER: Complementin...
[ "scala", "templates", "template-engine" ]
11
6
11,311
4
0
2011-06-04T13:12:31.127000
2011-06-04T14:32:52.447000
6,236,944
6,237,081
Obtain all functions in a file in Node.js
I have some functions inside a file. I'm trying to obtain all functions in that file, from within that file. Normally, all functions are in the window object, but I'm using Node.js, which does not seem to have a window object. Say I have something along the lines of the following in a file: function foo() {} function b...
The following is a common pattern var foo = exports.foo = function() { //... } This way its written to exports and you can access it locally as foo
Obtain all functions in a file in Node.js I have some functions inside a file. I'm trying to obtain all functions in that file, from within that file. Normally, all functions are in the window object, but I'm using Node.js, which does not seem to have a window object. Say I have something along the lines of the followi...
TITLE: Obtain all functions in a file in Node.js QUESTION: I have some functions inside a file. I'm trying to obtain all functions in that file, from within that file. Normally, all functions are in the window object, but I'm using Node.js, which does not seem to have a window object. Say I have something along the li...
[ "javascript", "function", "node.js" ]
0
1
848
3
0
2011-06-04T13:15:35.693000
2011-06-04T13:45:22.587000
6,236,954
6,237,095
Check servers for active Webserver fast (multithreaded)
I want to check an huge amount (thousands) of Websites, if they are still running. Because I want to get rid of unececarry entries in my HostFile Wikipage about Hostfiles. I want to do it in a 2 Stage process. Check if something is running on Port 80 Check the HTTP response code (if it's not 200 I have to check the sit...
I have 3 suggestions that may help you in your task. Maybe you can use the class HttpURLConnection Use a maximum of 10 threads because you are still limited by cpu, bandwidth, etc. The lists good and bad shouldn't be part of your thread class, maybe they can be static members of the class were you have your main method...
Check servers for active Webserver fast (multithreaded) I want to check an huge amount (thousands) of Websites, if they are still running. Because I want to get rid of unececarry entries in my HostFile Wikipage about Hostfiles. I want to do it in a 2 Stage process. Check if something is running on Port 80 Check the HTT...
TITLE: Check servers for active Webserver fast (multithreaded) QUESTION: I want to check an huge amount (thousands) of Websites, if they are still running. Because I want to get rid of unececarry entries in my HostFile Wikipage about Hostfiles. I want to do it in a 2 Stage process. Check if something is running on Por...
[ "java", "multithreading", "performance", "sockets", "httpurlconnection" ]
1
0
455
2
0
2011-06-04T13:17:40.370000
2011-06-04T13:49:13.753000
6,236,970
6,241,521
AppStore's screenshot gallery in html?
I'm trying to do the screenshot gallery of an app from the AppStore but in a web app in html. I've actually get it but the problem is that it scrolls REALLY slow. To do the touch/swipe functions I've used the code from here: http://quirksmode.org/m/tests/scrollayer.html In the example, the div's are scrolled smoothly b...
I finally solved using webkit transforms (translate3d) instead of using javascript. The problem was that javascript was taking care of moving the object. For example, I was using: testElement.style.marginLeft="newposition px"; That was painfully slow in iOS devices. Now I use: testElement.style.webkitTransform='transla...
AppStore's screenshot gallery in html? I'm trying to do the screenshot gallery of an app from the AppStore but in a web app in html. I've actually get it but the problem is that it scrolls REALLY slow. To do the touch/swipe functions I've used the code from here: http://quirksmode.org/m/tests/scrollayer.html In the exa...
TITLE: AppStore's screenshot gallery in html? QUESTION: I'm trying to do the screenshot gallery of an app from the AppStore but in a web app in html. I've actually get it but the problem is that it scrolls REALLY slow. To do the touch/swipe functions I've used the code from here: http://quirksmode.org/m/tests/scrollay...
[ "javascript", "iphone", "html", "touch", "iphone-web-app" ]
0
1
278
1
0
2011-06-04T13:22:33.300000
2011-06-05T07:21:56.690000
6,236,972
6,236,993
jsoup second element instead of first()
I have translated the PHP Simple HTML DOM query: $article->find('td[id$=tdDescription] div a', 1)->plaintext; to the jsoup query: resultRow.select("td[id$=tdDescription] > div > a").first().text()); as you can see I am acessing the second (1) result in PHP, currently in jsoup with the.first() I am accessing the first r...
Use Elements#get() instead. This allows accessing elements by index. resultRow.select("td[id$=tdDescription] > div > a").get(1).text();
jsoup second element instead of first() I have translated the PHP Simple HTML DOM query: $article->find('td[id$=tdDescription] div a', 1)->plaintext; to the jsoup query: resultRow.select("td[id$=tdDescription] > div > a").first().text()); as you can see I am acessing the second (1) result in PHP, currently in jsoup wit...
TITLE: jsoup second element instead of first() QUESTION: I have translated the PHP Simple HTML DOM query: $article->find('td[id$=tdDescription] div a', 1)->plaintext; to the jsoup query: resultRow.select("td[id$=tdDescription] > div > a").first().text()); as you can see I am acessing the second (1) result in PHP, curr...
[ "java", "php", "jsoup", "simple-html-dom" ]
12
21
14,377
2
0
2011-06-04T13:22:55.377000
2011-06-04T13:27:31.773000
6,236,976
6,237,001
ASP.NET MVC 3 and jQuery validation
What is the best way to do validation in MVC 3? Here are the requirements: Works client and server side. Shares as much code between client and server as possible (attribute on model property seems ideal) Works across async request Display errors, validation messages, and success messages coming from the server side Un...
I would check out Brad Wilson's blog on this. He covers using unobtrusive validation in MVC3, sounds like exactly what you're looking for. Adding more info per OP's comment Regarding server side validation (custom validation), check out @jfar's response to a similar question I posted regarding custom validation -- he s...
ASP.NET MVC 3 and jQuery validation What is the best way to do validation in MVC 3? Here are the requirements: Works client and server side. Shares as much code between client and server as possible (attribute on model property seems ideal) Works across async request Display errors, validation messages, and success mes...
TITLE: ASP.NET MVC 3 and jQuery validation QUESTION: What is the best way to do validation in MVC 3? Here are the requirements: Works client and server side. Shares as much code between client and server as possible (attribute on model property seems ideal) Works across async request Display errors, validation message...
[ "asp.net-mvc-3", "asynchronous", "jquery-validate" ]
4
1
1,056
1
0
2011-06-04T13:23:33.600000
2011-06-04T13:29:03.207000
6,236,995
6,237,045
Using LIKE with IN / OR in Stored Procedure
I am trying to create a stored procedure in SQL Server 2008 where I am trying to replicate a simple query of SELECT Col1, Col2 FROM Table WHERE Col1 LIKE 'A%' OR Col1 LIKE 'B%' OR Col1 LIKE 'C%' as CREATE PROCEDURE usp_MySP @ColValues varchar(100) = NULL AS SELECT Col1, Col2 FROM Table WHERE (@ColValues IS NULL OR Col1...
If the number of parameters is unknown, then you will need to do a table operation. Basically something like select col1, col2 from Table t inner join MyParameters p on (t.Col1 like p.Query) In order to generate table MyParameters, you can either construct it in your code, or use the new table-valued parameters in 2008...
Using LIKE with IN / OR in Stored Procedure I am trying to create a stored procedure in SQL Server 2008 where I am trying to replicate a simple query of SELECT Col1, Col2 FROM Table WHERE Col1 LIKE 'A%' OR Col1 LIKE 'B%' OR Col1 LIKE 'C%' as CREATE PROCEDURE usp_MySP @ColValues varchar(100) = NULL AS SELECT Col1, Col2 ...
TITLE: Using LIKE with IN / OR in Stored Procedure QUESTION: I am trying to create a stored procedure in SQL Server 2008 where I am trying to replicate a simple query of SELECT Col1, Col2 FROM Table WHERE Col1 LIKE 'A%' OR Col1 LIKE 'B%' OR Col1 LIKE 'C%' as CREATE PROCEDURE usp_MySP @ColValues varchar(100) = NULL AS ...
[ "sql", "t-sql", "sql-server-2008", "stored-procedures" ]
2
3
3,002
3
0
2011-06-04T13:27:51.970000
2011-06-04T13:37:41.313000
6,236,999
6,237,089
NullPointerException when parsing URL to ImageIcon
I am following few tutorials on JMonkey2.1 When I run those tutorials I get NullPointerExceptions where new ImageIcons are loaded using java.net.URL. // generate a terrain texture with 3 textures ProceduralTextureGenerator pt = new ProceduralTextureGenerator(heightMap); pt.addTexture(new ImageIcon(Lesson3.class.getClas...
In order to use ClassLoader#getResource(), the resource needs to be in the classpath. When it's located in the same package as Lesson3 class, then do so new ImageIcon(Lesson3.class.getResource("image.png")); When it's located in a different package, then use an absolute path from the classpath root on, i.e. start with ...
NullPointerException when parsing URL to ImageIcon I am following few tutorials on JMonkey2.1 When I run those tutorials I get NullPointerExceptions where new ImageIcons are loaded using java.net.URL. // generate a terrain texture with 3 textures ProceduralTextureGenerator pt = new ProceduralTextureGenerator(heightMap)...
TITLE: NullPointerException when parsing URL to ImageIcon QUESTION: I am following few tutorials on JMonkey2.1 When I run those tutorials I get NullPointerExceptions where new ImageIcons are loaded using java.net.URL. // generate a terrain texture with 3 textures ProceduralTextureGenerator pt = new ProceduralTextureGe...
[ "java", "file-io", "nullpointerexception" ]
2
5
1,821
2
0
2011-06-04T13:28:53.267000
2011-06-04T13:47:03.450000
6,237,005
6,237,019
Getting the container from the given structure using selector
consider the following html structure: 123 123 Now I want to pick the container on the basis of class="top" and id="id2" in such a way that i get the container with class top. How can I do that? I would like to have some selector for that. P.S: the id i am looking for is not necessarily to be an immediate parent of the...
Is this what you're looking for? $('#id2').closest('.top') It will start with the ID and travel up until it finds the class top.
Getting the container from the given structure using selector consider the following html structure: 123 123 Now I want to pick the container on the basis of class="top" and id="id2" in such a way that i get the container with class top. How can I do that? I would like to have some selector for that. P.S: the id i am l...
TITLE: Getting the container from the given structure using selector QUESTION: consider the following html structure: 123 123 Now I want to pick the container on the basis of class="top" and id="id2" in such a way that i get the container with class top. How can I do that? I would like to have some selector for that. ...
[ "jquery" ]
0
1
36
3
0
2011-06-04T13:29:47.510000
2011-06-04T13:32:58.120000
6,237,006
6,237,572
How to recreate a deleted target?
I have deleted my application target and now all my Build option are gone. I cannot run my project because I am missing a target. How can I regenerate it?
You have two options. The first is DarkDust's suggestion: restore from a backup or an SCM repository if you have them. If you have neither, you must admit you were begging for trouble. The second is unfortunate but comes with a message of hope. Recreate the target from scratch. Select File > New > New Target from the m...
How to recreate a deleted target? I have deleted my application target and now all my Build option are gone. I cannot run my project because I am missing a target. How can I regenerate it?
TITLE: How to recreate a deleted target? QUESTION: I have deleted my application target and now all my Build option are gone. I cannot run my project because I am missing a target. How can I regenerate it? ANSWER: You have two options. The first is DarkDust's suggestion: restore from a backup or an SCM repository if ...
[ "build", "xcode4", "target" ]
3
6
7,331
3
0
2011-06-04T13:29:52.880000
2011-06-04T15:22:47.190000
6,237,012
6,237,031
calling php function from string (with parameters)
i'd like to run a php-function dynamically by using this string: do_lightbox('image1.jpg', 'picture 1') i've parsed the string like this: $exe = "do_lightbox"; $pars = "'image1.jpg', 'picture 1'"; and tried using the following code: $rc = call_user_func($exe, $pars); unfortunately this gives me an error - i've also tri...
I think this is what you're after: $exe = "do_lightbox"; $pars = array('image1.jpg', 'picture 1'); $rc = call_user_func_array($exe, $pars);
calling php function from string (with parameters) i'd like to run a php-function dynamically by using this string: do_lightbox('image1.jpg', 'picture 1') i've parsed the string like this: $exe = "do_lightbox"; $pars = "'image1.jpg', 'picture 1'"; and tried using the following code: $rc = call_user_func($exe, $pars); u...
TITLE: calling php function from string (with parameters) QUESTION: i'd like to run a php-function dynamically by using this string: do_lightbox('image1.jpg', 'picture 1') i've parsed the string like this: $exe = "do_lightbox"; $pars = "'image1.jpg', 'picture 1'"; and tried using the following code: $rc = call_user_fu...
[ "php", "function", "dynamic" ]
6
7
10,205
6
0
2011-06-04T13:31:14.747000
2011-06-04T13:34:30.820000
6,237,013
6,237,043
How to calculate image rotation from touches?
I'm an iphone developer, but this question is about geometry. I have a simple rectangle (maybe a photo). The user touches this photo at a point and drags their finger to a new point: http://dl.dropbox.com/u/792862/Untitleddrawing.png How many radians I must rotate this rectangle to simulate a rotation given by the touc...
I'm assuming that you have a fixed origin for your rotation (the crosshair in your picture would suggest so) and the touch sets the other point. First you need a method to figure out the angle of a line. The atan2 function (available in any well-equipped math library) figures out the angle between any line and the X ax...
How to calculate image rotation from touches? I'm an iphone developer, but this question is about geometry. I have a simple rectangle (maybe a photo). The user touches this photo at a point and drags their finger to a new point: http://dl.dropbox.com/u/792862/Untitleddrawing.png How many radians I must rotate this rect...
TITLE: How to calculate image rotation from touches? QUESTION: I'm an iphone developer, but this question is about geometry. I have a simple rectangle (maybe a photo). The user touches this photo at a point and drags their finger to a new point: http://dl.dropbox.com/u/792862/Untitleddrawing.png How many radians I mus...
[ "iphone", "geometry", "rotation" ]
1
2
270
2
0
2011-06-04T13:31:17.363000
2011-06-04T13:37:03.653000
6,237,020
6,237,078
Help with a JQuery selector?
I have a HTML structure like follows What i wanna do is when user clicks on the link with a class of edit i will have to hide it's parent div and all subsequent divs having ID like answer-x and have to show the div with the id of editor. I need help with this. This is not not the exact html structure. And the anchor ta...
The option likely to respond fastest is to give your answer divs a unique class like "answer" and hide all div.answer following containers, but in the event you can't or don't wish to do that: $("a.edit").click(function() { $(this).closest('div[id^="answer-"]').nextAll('div[id^="answer-"]').andSelf().hide(); $("#edit")...
Help with a JQuery selector? I have a HTML structure like follows What i wanna do is when user clicks on the link with a class of edit i will have to hide it's parent div and all subsequent divs having ID like answer-x and have to show the div with the id of editor. I need help with this. This is not not the exact html...
TITLE: Help with a JQuery selector? QUESTION: I have a HTML structure like follows What i wanna do is when user clicks on the link with a class of edit i will have to hide it's parent div and all subsequent divs having ID like answer-x and have to show the div with the id of editor. I need help with this. This is not ...
[ "jquery", "jquery-selectors" ]
0
2
86
3
0
2011-06-04T13:32:59.670000
2011-06-04T13:45:12.437000
6,237,053
6,237,139
is FBML compliant with HTML standards?
this funny thing called FBML http://developers.facebook.com/docs/reference/fbml/ I'm just wondering is it true that any web page that uses FBML automatically disqualifies themselves as a 100% standard-compliant webpage?
FBML is a language developed by Facebook (which is now deprecated ). Even their JavaScript SDK, which does not introduce custom tags, is technically not an open standard either, though it may be too early to say whether social networking sites could join up to make one. XMPP's Pubsub specification might be the closest ...
is FBML compliant with HTML standards? this funny thing called FBML http://developers.facebook.com/docs/reference/fbml/ I'm just wondering is it true that any web page that uses FBML automatically disqualifies themselves as a 100% standard-compliant webpage?
TITLE: is FBML compliant with HTML standards? QUESTION: this funny thing called FBML http://developers.facebook.com/docs/reference/fbml/ I'm just wondering is it true that any web page that uses FBML automatically disqualifies themselves as a 100% standard-compliant webpage? ANSWER: FBML is a language developed by Fa...
[ "javascript", "html", "web-applications", "fbml" ]
3
1
276
2
0
2011-06-04T13:39:19.230000
2011-06-04T14:00:32.437000
6,237,065
6,237,103
How to correctly cancel an outstanding Ajax request that will never complete?
This question is like another, except that one is asked in the context of JQuery, which I don't use. Ajax code on my page issues a POST every ten seconds. Once in a while -- every ~600 requests -- my client code hangs waiting for a response that will never show up. The code will time out and re-issue the Ajax request, ...
Store a reference to your last AJAX request and abort it when you start the next one. For instance: var lastRequest; setInterval(function() { lastRequest.abort(); // abort the last request lastRequest = new XMLHTTPRequest(); // and the rest of your XHR code }, 10000);
How to correctly cancel an outstanding Ajax request that will never complete? This question is like another, except that one is asked in the context of JQuery, which I don't use. Ajax code on my page issues a POST every ten seconds. Once in a while -- every ~600 requests -- my client code hangs waiting for a response t...
TITLE: How to correctly cancel an outstanding Ajax request that will never complete? QUESTION: This question is like another, except that one is asked in the context of JQuery, which I don't use. Ajax code on my page issues a POST every ten seconds. Once in a while -- every ~600 requests -- my client code hangs waitin...
[ "ajax", "request-cancelling" ]
8
5
728
1
0
2011-06-04T13:42:43.303000
2011-06-04T13:50:33.903000
6,237,066
6,252,399
fixing ESPNConversations (add pause button)
Its their new discussion board. (http://espn.go.com/nba/conversation?id=310605006) The problem is, the real time updates keep adding new comments so it keeps scrolling away from whatever you're reading, for example right after a game when thousands of people are adding comments. Its really ridiculous. So just trying to...
There is no set way to pause AJAX. It all depends on the page details. In this case, that page pauses updates when you mouse over the conversation area. And that page uses jQuery and the Echo Stream library. So you could have your script create a button that sends mouseover 1 events (toggling to send mouseout to clear)...
fixing ESPNConversations (add pause button) Its their new discussion board. (http://espn.go.com/nba/conversation?id=310605006) The problem is, the real time updates keep adding new comments so it keeps scrolling away from whatever you're reading, for example right after a game when thousands of people are adding commen...
TITLE: fixing ESPNConversations (add pause button) QUESTION: Its their new discussion board. (http://espn.go.com/nba/conversation?id=310605006) The problem is, the real time updates keep adding new comments so it keeps scrolling away from whatever you're reading, for example right after a game when thousands of people...
[ "javascript", "jquery", "greasemonkey" ]
2
1
137
1
0
2011-06-04T13:42:54.360000
2011-06-06T13:01:17
6,237,071
6,242,187
How should I Install a Java desktop application into a Desktop without Netbeans/IDE and MySQL?
Hi I am planning to install a Java Desktop Application to a PC that doesn't have a Netbeans IDE and MySQL installed. Can you teach me what to do? I really don't have any clue. Please help... thanks in advance ^_^
I only use Java Web Start for my Swing applications. Follow these links to start getting your head around JWS. Lessons How is it launched
How should I Install a Java desktop application into a Desktop without Netbeans/IDE and MySQL? Hi I am planning to install a Java Desktop Application to a PC that doesn't have a Netbeans IDE and MySQL installed. Can you teach me what to do? I really don't have any clue. Please help... thanks in advance ^_^
TITLE: How should I Install a Java desktop application into a Desktop without Netbeans/IDE and MySQL? QUESTION: Hi I am planning to install a Java Desktop Application to a PC that doesn't have a Netbeans IDE and MySQL installed. Can you teach me what to do? I really don't have any clue. Please help... thanks in advanc...
[ "java", "desktop-application" ]
2
1
2,188
2
0
2011-06-04T13:43:53.480000
2011-06-05T09:59:49.453000
6,237,072
6,258,597
flash page flipping technology that support touch gesture or compatible with iPad
Does anyone know a "flash example" or "fla file" or tutorial that is related to a flipping page in using Flash technology. I've seen a lot of page flipping flash website that has a page that you can virtually flip using flash. I want to create a similar flash site/magazine that has 5-10 page that hopefully supports the...
I agree with scriptocalypse. That said: Something like this? http://www.flashloaded.com/flashcomponents/pageflipper/ You'll have to implement your own swipe gesture. But a regular finger down and drag ought to work.
flash page flipping technology that support touch gesture or compatible with iPad Does anyone know a "flash example" or "fla file" or tutorial that is related to a flipping page in using Flash technology. I've seen a lot of page flipping flash website that has a page that you can virtually flip using flash. I want to c...
TITLE: flash page flipping technology that support touch gesture or compatible with iPad QUESTION: Does anyone know a "flash example" or "fla file" or tutorial that is related to a flipping page in using Flash technology. I've seen a lot of page flipping flash website that has a page that you can virtually flip using ...
[ "flash", "actionscript-3" ]
0
1
740
1
0
2011-06-04T13:44:02.173000
2011-06-06T22:08:22.040000
6,237,088
6,269,046
AMD Open64: Optimized math functions
Does Open64 has something equivalent to Intel Short Vector Math Library Operations. Thank you.
OK, I more or less figured it out. AMD OpenMP ships with AMD's math library ACML. ACML has functions similar to those in Intel's library.
AMD Open64: Optimized math functions Does Open64 has something equivalent to Intel Short Vector Math Library Operations. Thank you.
TITLE: AMD Open64: Optimized math functions QUESTION: Does Open64 has something equivalent to Intel Short Vector Math Library Operations. Thank you. ANSWER: OK, I more or less figured it out. AMD OpenMP ships with AMD's math library ACML. ACML has functions similar to those in Intel's library.
[ "instruction-set", "vectormath", "amd-processor" ]
1
1
186
2
0
2011-06-04T13:46:48.867000
2011-06-07T17:14:56.280000
6,237,100
6,237,373
Jquery resizable shifts my DOM element
I have the following code Untitled Document Name here blanl Resizalbe element Player List OMG OMG OMG OMG Configs OMG OMG OMG OMG sdg SDF sDsag sdzh z zh zh Comming Soon Comming Soon Zong OMG OMG OMG OMG Server Disscussion Server Disscussion Server Disscussion comming Soon comming Soon comming Soon When i resizable th...
It's the percentage left property on the #top-name, #top-ip selector. I was surprised to find the jQuery UI #2421 enhancement request has been around for 3 years! Until that is fixed, if you make the left property a non-percentage value ( 30px seems about right), the resize works as expected. Edit: I've found a workaro...
Jquery resizable shifts my DOM element I have the following code Untitled Document Name here blanl Resizalbe element Player List OMG OMG OMG OMG Configs OMG OMG OMG OMG sdg SDF sDsag sdzh z zh zh Comming Soon Comming Soon Zong OMG OMG OMG OMG Server Disscussion Server Disscussion Server Disscussion comming Soon commin...
TITLE: Jquery resizable shifts my DOM element QUESTION: I have the following code Untitled Document Name here blanl Resizalbe element Player List OMG OMG OMG OMG Configs OMG OMG OMG OMG sdg SDF sDsag sdzh z zh zh Comming Soon Comming Soon Zong OMG OMG OMG OMG Server Disscussion Server Disscussion Server Disscussion c...
[ "jquery", "jquery-ui", "jquery-ui-resizable" ]
5
3
2,321
1
0
2011-06-04T13:49:52.790000
2011-06-04T14:44:42.573000
6,237,102
6,237,149
simple design problem : parent, child ; teacher,student
very simple problem, but i want to see how experts look at it. This is just imaginary software just to understand OOP. I have a school administration software. So I have classes Student ClassRoom Teacher Now I assign a teacher as class-teacher for a particular classroom. Thus ClassRoom contains Teacher classTeacher; St...
This should not be a big code change, this should be a validation change. Psuedo-Code: Class ClassRoom { List students Teacher teacher ClassRoom(Teacher _teacher, List students) { teacher = _teacher; SetStudents(students); } void SetStudents(List _students) { foreach (Student s in _students) { if (validate(s)) { stud...
simple design problem : parent, child ; teacher,student very simple problem, but i want to see how experts look at it. This is just imaginary software just to understand OOP. I have a school administration software. So I have classes Student ClassRoom Teacher Now I assign a teacher as class-teacher for a particular cla...
TITLE: simple design problem : parent, child ; teacher,student QUESTION: very simple problem, but i want to see how experts look at it. This is just imaginary software just to understand OOP. I have a school administration software. So I have classes Student ClassRoom Teacher Now I assign a teacher as class-teacher fo...
[ "oop", "class-design" ]
0
2
402
1
0
2011-06-04T13:50:24.583000
2011-06-04T14:01:34.817000
6,237,112
6,237,137
Could a shared memory be updated in some thread while its value is still not visible to the main thread?
I was reading this article about volatile fields in C#. using System; using System.Threading; class Test { public static int result; public static volatile bool finished; static void Thread2() { result = 143; finished = true; } static void Main() { finished = false; // Run Thread2() in a new thread new Thread(new Threa...
Volatile prevents (among other things) re-ordering, so without volatile it could as an edge condition conceivably (on some hardware) write them in a different order, allowing the flag to be true even though result is 0 - for a tiny fraction of time. A much more likely scenario, though, is that without volatile the hot ...
Could a shared memory be updated in some thread while its value is still not visible to the main thread? I was reading this article about volatile fields in C#. using System; using System.Threading; class Test { public static int result; public static volatile bool finished; static void Thread2() { result = 143; finish...
TITLE: Could a shared memory be updated in some thread while its value is still not visible to the main thread? QUESTION: I was reading this article about volatile fields in C#. using System; using System.Threading; class Test { public static int result; public static volatile bool finished; static void Thread2() { re...
[ "c#", "multithreading", "volatile" ]
3
3
167
1
0
2011-06-04T13:53:37.437000
2011-06-04T14:00:10.377000
6,237,113
6,238,650
Why can't Go method Receiving Types be interfaces?
From the Go documentation on method declarations: The receiver type must be of the form T or *T where T is a type name. T is called the receiver base type or just base type. The base type must not be a pointer or interface type and must be declared in the same package as the method. Can anyone give me some insight on w...
It's probably for the same reason you can't define methods on interfaces in Java. An interface is meant to be a description of a part of, or the whole of, the external interface for a set of objects and not how they implement the underlying behavior. In Java you would probably use an abstract class if you need parts of...
Why can't Go method Receiving Types be interfaces? From the Go documentation on method declarations: The receiver type must be of the form T or *T where T is a type name. T is called the receiver base type or just base type. The base type must not be a pointer or interface type and must be declared in the same package ...
TITLE: Why can't Go method Receiving Types be interfaces? QUESTION: From the Go documentation on method declarations: The receiver type must be of the form T or *T where T is a type name. T is called the receiver base type or just base type. The base type must not be a pointer or interface type and must be declared in...
[ "syntax", "interface", "methods", "go" ]
6
3
1,317
4
0
2011-06-04T13:54:18.340000
2011-06-04T18:39:03.300000
6,237,122
6,237,141
Mysql regex match names with a maximum of two words
i've being trying this without success: select * from table where name regexp '^[:alpha:]{2}$' pls help me?
There probably needs to be some white space in between the two words, right? Try select * from table where name regexp '^[[:alpha:]]+[[:space:]]*[[:alpha:]]*$' [[:alpha:]]+ matches one or more letter characters [[:space:]]* matches zero or more whitespace characters. (You may want to use [[:blank:]]* instead, to only m...
Mysql regex match names with a maximum of two words i've being trying this without success: select * from table where name regexp '^[:alpha:]{2}$' pls help me?
TITLE: Mysql regex match names with a maximum of two words QUESTION: i've being trying this without success: select * from table where name regexp '^[:alpha:]{2}$' pls help me? ANSWER: There probably needs to be some white space in between the two words, right? Try select * from table where name regexp '^[[:alpha:]]+...
[ "mysql", "regex" ]
0
1
760
2
0
2011-06-04T13:57:05.430000
2011-06-04T14:00:45.310000
6,237,123
6,238,896
Is it possible to convert a single C# file to IL assembly?
Given a single c# source file, I'd like to output IL (not assembled) of that single file such that later I can feed each '.il' file to ilasm to produce assemblies, is this possible?
So, you probably can't do this well and in most cases you won't want to. However it is possible to cut compilation and assembly linking into two stages by building all sources to modules and then linking modules and resources into the final assemblies. Short answer, getting textual IL out of a C# compiler is not feasib...
Is it possible to convert a single C# file to IL assembly? Given a single c# source file, I'd like to output IL (not assembled) of that single file such that later I can feed each '.il' file to ilasm to produce assemblies, is this possible?
TITLE: Is it possible to convert a single C# file to IL assembly? QUESTION: Given a single c# source file, I'd like to output IL (not assembled) of that single file such that later I can feed each '.il' file to ilasm to produce assemblies, is this possible? ANSWER: So, you probably can't do this well and in most case...
[ "c#", "il", "ilasm" ]
0
0
686
2
0
2011-06-04T13:57:05.293000
2011-06-04T19:26:22.343000
6,237,126
6,237,236
Mapping structs to memory in c#, is it worth it? Or is there a better way
I'm sending some packets of data across the network and they arrive in byte[]s, lets say the structure is [int, int, byte, int] If this was c++ I would declare a struct* and point to the byte[]. I'm doing this project in c# and I'm not sure whether it is worth it with marshalling overhead, or if there is a better way t...
I think marshaling is the best option. You could parse the byte array by yourself using BitConverter, but that would require more work on your part and is not as flexible.
Mapping structs to memory in c#, is it worth it? Or is there a better way I'm sending some packets of data across the network and they arrive in byte[]s, lets say the structure is [int, int, byte, int] If this was c++ I would declare a struct* and point to the byte[]. I'm doing this project in c# and I'm not sure wheth...
TITLE: Mapping structs to memory in c#, is it worth it? Or is there a better way QUESTION: I'm sending some packets of data across the network and they arrive in byte[]s, lets say the structure is [int, int, byte, int] If this was c++ I would declare a struct* and point to the byte[]. I'm doing this project in c# and ...
[ "c#", "pointers", "struct", "marshalling", "unsafe" ]
0
0
1,068
4
0
2011-06-04T13:57:24.380000
2011-06-04T14:18:39.393000
6,237,127
6,237,242
How to write dynamic Test Case
Suppose, I have a junit test class: class MyComponentTest { private void test(File file) {...} @Test public void test1() {test("test1.txt")} @Test public void test2() {test("test2.txt")} @Test public void test3() {test("test3.txt")} } The test method reads the input data from the file and test the component with the ...
Though you can use Junit's Parameterized tests for this it is bit involved and ugly. I suggest you looking at the spockframework which simplifies this a lot. And there is also another option in TestNG.
How to write dynamic Test Case Suppose, I have a junit test class: class MyComponentTest { private void test(File file) {...} @Test public void test1() {test("test1.txt")} @Test public void test2() {test("test2.txt")} @Test public void test3() {test("test3.txt")} } The test method reads the input data from the file a...
TITLE: How to write dynamic Test Case QUESTION: Suppose, I have a junit test class: class MyComponentTest { private void test(File file) {...} @Test public void test1() {test("test1.txt")} @Test public void test2() {test("test2.txt")} @Test public void test3() {test("test3.txt")} } The test method reads the input da...
[ "java", "unit-testing", "junit" ]
4
2
1,877
1
0
2011-06-04T13:57:28.840000
2011-06-04T14:19:29.803000
6,237,136
6,242,940
Search for words with a Dash in Twitter API
How can I get the results for the phrase "E-Contact" In a normal twitter search it returns results with E-Contact but also results without the dash anything but The same happens for a Williams-Sonoma search I tried using quotes and also replacing the dash with the URL encoded %2D but still no luck.
I don't think you can. You will have to manually filter the search results on your side.
Search for words with a Dash in Twitter API How can I get the results for the phrase "E-Contact" In a normal twitter search it returns results with E-Contact but also results without the dash anything but The same happens for a Williams-Sonoma search I tried using quotes and also replacing the dash with the URL encoded...
TITLE: Search for words with a Dash in Twitter API QUESTION: How can I get the results for the phrase "E-Contact" In a normal twitter search it returns results with E-Contact but also results without the dash anything but The same happens for a Williams-Sonoma search I tried using quotes and also replacing the dash wi...
[ "search", "twitter" ]
4
1
400
1
0
2011-06-04T13:59:59.990000
2011-06-05T12:37:38.270000
6,237,138
6,237,234
iphone - setting a property on another class
I have a property declared on a class:.h @interface myClass: UIView { BOOL doStuff; } @property BOOL doStuff;.m @synthesize doStuff; this class is a delegate of another one. On the other class, I am trying to set this property, doing something like [delegate setDoStuff:YES]; I receive an error telling me that "method ...
is your delegate declared as type "id"? either you declare its true type MyClass delegate in the other class (which points to your myclass) or declare a protocol that delegate has to implement id in declaration. Last (but not right approach) is to typecast it [(MyClass )delegate doStuff].
iphone - setting a property on another class I have a property declared on a class:.h @interface myClass: UIView { BOOL doStuff; } @property BOOL doStuff;.m @synthesize doStuff; this class is a delegate of another one. On the other class, I am trying to set this property, doing something like [delegate setDoStuff:YES]...
TITLE: iphone - setting a property on another class QUESTION: I have a property declared on a class:.h @interface myClass: UIView { BOOL doStuff; } @property BOOL doStuff;.m @synthesize doStuff; this class is a delegate of another one. On the other class, I am trying to set this property, doing something like [delega...
[ "iphone" ]
0
2
142
3
0
2011-06-04T14:00:15.657000
2011-06-04T14:18:03.217000
6,237,144
6,243,938
Average of rows where column = A within distinct rows on another column grouped by a third column
Using SQL Server, I'm trying to query a kind of averaged count from a table I didn't design, where basically I want a list, grouped by one column, with the number of distinct values of another column matching a given criterion, and of those, the number of rows matching another criterion (which I'll use to created the a...
The answer is: It depends. In my testing, my solution is the slowest of the bunch, regardless of what test data I use. With real life data, it's about half the speed of the fastest solution. Mikael's solution is faster for the test data quoted in my question, and faster for a larger-but-still-small data set (our testin...
Average of rows where column = A within distinct rows on another column grouped by a third column Using SQL Server, I'm trying to query a kind of averaged count from a table I didn't design, where basically I want a list, grouped by one column, with the number of distinct values of another column matching a given crite...
TITLE: Average of rows where column = A within distinct rows on another column grouped by a third column QUESTION: Using SQL Server, I'm trying to query a kind of averaged count from a table I didn't design, where basically I want a list, grouped by one column, with the number of distinct values of another column matc...
[ "sql", "sql-server" ]
6
1
1,611
5
0
2011-06-04T14:01:11.990000
2011-06-05T15:43:38.023000
6,237,147
6,237,762
SlidingDrawer get's behind Admob ad
I have a framelayout(my main layout), im drawing ads on it. AdView adView = new AdView(this, AdSize.BANNER, "id"); FrameLayout v = (FrameLayout)findViewById(R.id.framemain); v.addView(adView); AdRequest request = new AdRequest(); request.addTestDevice(AdRequest.TEST_EMULATOR); request.addTestDevice("41A48DB6B62384BDC3...
The most recently added view is at the top of the z-order. So if you add this ad view last, it will be drawn at the top.
SlidingDrawer get's behind Admob ad I have a framelayout(my main layout), im drawing ads on it. AdView adView = new AdView(this, AdSize.BANNER, "id"); FrameLayout v = (FrameLayout)findViewById(R.id.framemain); v.addView(adView); AdRequest request = new AdRequest(); request.addTestDevice(AdRequest.TEST_EMULATOR); reque...
TITLE: SlidingDrawer get's behind Admob ad QUESTION: I have a framelayout(my main layout), im drawing ads on it. AdView adView = new AdView(this, AdSize.BANNER, "id"); FrameLayout v = (FrameLayout)findViewById(R.id.framemain); v.addView(adView); AdRequest request = new AdRequest(); request.addTestDevice(AdRequest.TES...
[ "android", "admob", "slidingdrawer" ]
0
1
332
2
0
2011-06-04T14:01:27.103000
2011-06-04T15:53:44.370000
6,237,156
6,237,414
App Store Review Button
How can we make the " please leave us a review in the app store " functional PopUp in an iOS app?
I personally used this one. I think it works really well. http://arashpayan.com/blog/2009/09/07/presenting-appirater/
App Store Review Button How can we make the " please leave us a review in the app store " functional PopUp in an iOS app?
TITLE: App Store Review Button QUESTION: How can we make the " please leave us a review in the app store " functional PopUp in an iOS app? ANSWER: I personally used this one. I think it works really well. http://arashpayan.com/blog/2009/09/07/presenting-appirater/
[ "iphone", "ios", "app-store" ]
12
7
8,610
6
0
2011-06-04T14:02:54.720000
2011-06-04T14:50:00.653000
6,237,164
6,237,474
Stopping MP playback onTouch / Click in extended ListActivity
I'm displaying a ListView of files to be played, read from an array in Strings.xml. Everything works fine, however I can't figure out how to implement an Event which would stop the playback on Click or Touch anywhere on the screen, so the audio file can be interrupted and there's no need to wait until the whole file is...
Instead of playing the media in the onItemClick(), create an AsyncTask to start it in the background, then flag the background thread to stop when the user indicates they want to stop (clicking a button say). Alternatively control the player through a Service and make calls to stop/start the player through that, as you...
Stopping MP playback onTouch / Click in extended ListActivity I'm displaying a ListView of files to be played, read from an array in Strings.xml. Everything works fine, however I can't figure out how to implement an Event which would stop the playback on Click or Touch anywhere on the screen, so the audio file can be i...
TITLE: Stopping MP playback onTouch / Click in extended ListActivity QUESTION: I'm displaying a ListView of files to be played, read from an array in Strings.xml. Everything works fine, however I can't figure out how to implement an Event which would stop the playback on Click or Touch anywhere on the screen, so the a...
[ "android", "listview", "media-player", "playback" ]
0
0
310
1
0
2011-06-04T14:04:26.903000
2011-06-04T15:03:16.190000
6,237,166
6,237,348
Get rate of rise from mysql order table but tooooo slow
I have a product order table in mysql. It's like this: create table `order` (productcode int, quantity tinyint, order_date timestamp, blablabla) then, to get rate of rise, i wrote this query: SELECT thismonth.productcode, (thismonth.ordercount-lastmonth.ordercount)/lastmonth.ordercount as riserate FROM ( (SELECT produc...
Try adding an index on (ORDER_DATE, PRODUCTCODE) and change the query to eliminate the use of the DATE_FORMAT function, as in: SELECT thismonth.productcode, (thismonth.ordercount-lastmonth.ordercount)/lastmonth.ordercount as riserate FROM ( (SELECT productcode, sum(quantity) as ordercount FROM `order` WHERE ORDER_DATE ...
Get rate of rise from mysql order table but tooooo slow I have a product order table in mysql. It's like this: create table `order` (productcode int, quantity tinyint, order_date timestamp, blablabla) then, to get rate of rise, i wrote this query: SELECT thismonth.productcode, (thismonth.ordercount-lastmonth.ordercount...
TITLE: Get rate of rise from mysql order table but tooooo slow QUESTION: I have a product order table in mysql. It's like this: create table `order` (productcode int, quantity tinyint, order_date timestamp, blablabla) then, to get rate of rise, i wrote this query: SELECT thismonth.productcode, (thismonth.ordercount-la...
[ "mysql", "sql", "performance" ]
2
3
235
5
0
2011-06-04T14:04:34.580000
2011-06-04T14:37:26.590000
6,237,169
6,237,184
Alternative to SVN with native Windows support
I've been using TortoiseSVN on my development machine so far, and I find there are certain shortcomings. I use Total Commander as a file manager, and I found myself often removing or moving folders inside a workspace. Because I use standard file system operations invoked by Total Commander, and not those provided by To...
git automatically detects files that have been moved. However, there are many other reasons to preferring git to SVN - first and foremost, git is a distributed version control system, which brings many benefits over centralized systems such as SVN. For instance, you can commit locally without having to immediately uplo...
Alternative to SVN with native Windows support I've been using TortoiseSVN on my development machine so far, and I find there are certain shortcomings. I use Total Commander as a file manager, and I found myself often removing or moving folders inside a workspace. Because I use standard file system operations invoked b...
TITLE: Alternative to SVN with native Windows support QUESTION: I've been using TortoiseSVN on my development machine so far, and I find there are certain shortcomings. I use Total Commander as a file manager, and I found myself often removing or moving folders inside a workspace. Because I use standard file system op...
[ "svn", "version-control", "tortoisesvn", "repository", "revision" ]
1
1
1,567
2
0
2011-06-04T14:05:14.807000
2011-06-04T14:08:06.537000
6,237,171
6,237,800
parsekit gives unexpected calls to selectors
I have the following very simple (test) grammar file @start = expression+; expression = keyword | otherWord; otherWord = Word; keyword = a | the; a = 'a'; the = 'the'; Then I run the following code: // Grammar contains the contents of the above grammar file. PKParser *parser = [[PKParserFactory factory] parserFromGramm...
I'm the developer of ParseKit, and this is actually correct behavior. Here's a few items to help clear this up: The best way to learn about how ParseKit works is to buy "Building Parsers with Java" by Steven John Metsker. ParseKit is based almost entirely on the designs laid out there. ParseKit's parser component is ex...
parsekit gives unexpected calls to selectors I have the following very simple (test) grammar file @start = expression+; expression = keyword | otherWord; otherWord = Word; keyword = a | the; a = 'a'; the = 'the'; Then I run the following code: // Grammar contains the contents of the above grammar file. PKParser *parser...
TITLE: parsekit gives unexpected calls to selectors QUESTION: I have the following very simple (test) grammar file @start = expression+; expression = keyword | otherWord; otherWord = Word; keyword = a | the; a = 'a'; the = 'the'; Then I run the following code: // Grammar contains the contents of the above grammar file...
[ "objective-c", "parsekit" ]
3
2
397
1
0
2011-06-04T14:05:21.317000
2011-06-04T16:00:07.053000
6,237,174
6,237,194
FTP Ascii transfer - does client or server strip carriage returns?
I have a problem transferring ascii files from a Windows 7 machine to a Unix Solaris server using FileZilla 3. The problem is that the text files end up on the Unix machine with CR+LF characters, instead of just the LF character, resulting in weird characters at the end of each line. I understand the problem - the CR c...
From the RFC: End-of-Line The end-of-line sequence defines the separation of printing lines. The sequence is Carriage Return, followed by Line Feed. The protocol does not specify what should be stored at the end of an FTP session, on either the client or the server, only what the session should look like.
FTP Ascii transfer - does client or server strip carriage returns? I have a problem transferring ascii files from a Windows 7 machine to a Unix Solaris server using FileZilla 3. The problem is that the text files end up on the Unix machine with CR+LF characters, instead of just the LF character, resulting in weird char...
TITLE: FTP Ascii transfer - does client or server strip carriage returns? QUESTION: I have a problem transferring ascii files from a Windows 7 machine to a Unix Solaris server using FileZilla 3. The problem is that the text files end up on the Unix machine with CR+LF characters, instead of just the LF character, resul...
[ "ftp", "ascii", "filezilla" ]
2
1
4,647
1
0
2011-06-04T14:05:33.473000
2011-06-04T14:10:33.983000
6,237,181
6,237,188
Better way of writing this
if (isset($row['product_limit'])){ if ($row['product_limit']!= 0){ echo $row['product_limit']; } else { echo $text_infinite; } } else { echo $text_infinite; } Is there a better way of writing this??? EDIT: though I used the @Radu code but here is the version i used echo (isset($row['product_limit']) && $row['product_li...
How about this? echo empty($row['product_limit'])? $text_infinite: $row['product_limit']; Take a look at the documentation for empty() and the ternary conditional operator.
Better way of writing this if (isset($row['product_limit'])){ if ($row['product_limit']!= 0){ echo $row['product_limit']; } else { echo $text_infinite; } } else { echo $text_infinite; } Is there a better way of writing this??? EDIT: though I used the @Radu code but here is the version i used echo (isset($row['product_l...
TITLE: Better way of writing this QUESTION: if (isset($row['product_limit'])){ if ($row['product_limit']!= 0){ echo $row['product_limit']; } else { echo $text_infinite; } } else { echo $text_infinite; } Is there a better way of writing this??? EDIT: though I used the @Radu code but here is the version i used echo (iss...
[ "php", "coding-style" ]
2
13
232
4
0
2011-06-04T14:07:25.420000
2011-06-04T14:08:47.420000
6,237,198
6,237,235
jQuery show DIV and scroll to it without hashtag in url
I have the following simple jQuery: $('#features').hide(); $('#more').click(function(e) { e.preventDefault(); $('#more').hide(); $('#features').show(); }); This shows a DIV when a user clicks the more link and using the preventDefault method the #features hash isn't added to the url. However I still want to scroll dow...
You'll need to use $(window).scrollTop(): $('#more').click(function (e) { e.preventDefault(); $('#more').hide(); $('#features').show(); $(window).scrollTop($('#features').offset().top); });
jQuery show DIV and scroll to it without hashtag in url I have the following simple jQuery: $('#features').hide(); $('#more').click(function(e) { e.preventDefault(); $('#more').hide(); $('#features').show(); }); This shows a DIV when a user clicks the more link and using the preventDefault method the #features hash is...
TITLE: jQuery show DIV and scroll to it without hashtag in url QUESTION: I have the following simple jQuery: $('#features').hide(); $('#more').click(function(e) { e.preventDefault(); $('#more').hide(); $('#features').show(); }); This shows a DIV when a user clicks the more link and using the preventDefault method the...
[ "jquery", "hash" ]
7
5
6,319
2
0
2011-06-04T14:11:23.597000
2011-06-04T14:18:03.557000
6,237,200
6,237,573
MotionEvent GetY() and getX() return incorrect values
I have following situation: I have a custom ListView with ImageView and TextView in a row. The ImageView has an onTouchListener, wchich invokes my onTouch method. Here are some lines from it: if (event.getAction()==MotionEvent.ACTION_MOVE) { layout.leftMargin = (int) event.getX() - dragIcon.getWidth()/2; layout.topMarg...
Try using getRawX() and getRawY() instead of getX() and getY().
MotionEvent GetY() and getX() return incorrect values I have following situation: I have a custom ListView with ImageView and TextView in a row. The ImageView has an onTouchListener, wchich invokes my onTouch method. Here are some lines from it: if (event.getAction()==MotionEvent.ACTION_MOVE) { layout.leftMargin = (int...
TITLE: MotionEvent GetY() and getX() return incorrect values QUESTION: I have following situation: I have a custom ListView with ImageView and TextView in a row. The ImageView has an onTouchListener, wchich invokes my onTouch method. Here are some lines from it: if (event.getAction()==MotionEvent.ACTION_MOVE) { layout...
[ "android", "coordinates", "motion" ]
19
49
22,256
3
0
2011-06-04T14:11:41.893000
2011-06-04T15:23:13.743000
6,237,205
6,237,227
Delete Subkey error (C#)
I have created the following registry key (copied through regedit): HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test I would like to now delete this registry key, and so... I have been using the following code and am running into a small error. RegistryKey regKey; string regPath_Key = @"Software\Microso...
You should not include HKEY_CURRENT_USER in the string you pass to Registry.CurrentUser.OpenSubKey(). Instead use string regPath_Key = @"Software\Microsoft\Windows\CurrentVersion\test";
Delete Subkey error (C#) I have created the following registry key (copied through regedit): HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test I would like to now delete this registry key, and so... I have been using the following code and am running into a small error. RegistryKey regKey; string regPath...
TITLE: Delete Subkey error (C#) QUESTION: I have created the following registry key (copied through regedit): HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test I would like to now delete this registry key, and so... I have been using the following code and am running into a small error. RegistryKey regK...
[ "c#", "registry", "key" ]
3
1
1,641
2
0
2011-06-04T14:12:15.793000
2011-06-04T14:16:23.643000
6,237,210
6,238,996
Linq Query (data in data) Problem in .Net MVC
I have 2 tables: Categories (int Id, string Title) Works (int categoryId, string WorkTitle, int id) Table Works has a foreign key (many to single) to Categories table. I want to have such result: Title (id 1) WorkTitle (Works.id) | WorkTitle (Works.id) | WorkTitle (Works.id) (this is works in thsi category) Title (id...
This should get you started. I'm assuming Entity Framework 4.1 code first. Use the ADO.NET Poco Entity template from NuGet to fill in the database initialization stuff. Model public class Category { public virtual int Id { get; set; } public virtual string Title { get; set; } public virtual ICollection Works { get; set...
Linq Query (data in data) Problem in .Net MVC I have 2 tables: Categories (int Id, string Title) Works (int categoryId, string WorkTitle, int id) Table Works has a foreign key (many to single) to Categories table. I want to have such result: Title (id 1) WorkTitle (Works.id) | WorkTitle (Works.id) | WorkTitle (Works.i...
TITLE: Linq Query (data in data) Problem in .Net MVC QUESTION: I have 2 tables: Categories (int Id, string Title) Works (int categoryId, string WorkTitle, int id) Table Works has a foreign key (many to single) to Categories table. I want to have such result: Title (id 1) WorkTitle (Works.id) | WorkTitle (Works.id) | ...
[ ".net", "asp.net-mvc-3", "linq-to-entities" ]
0
1
204
1
0
2011-06-04T14:13:17
2011-06-04T19:46:45.427000
6,237,212
6,237,244
Why does PDO rowCount() return 0 after UPDATE a table without modifying the existing data?
I am reading a tutorial on how to insert and update data into a MySQL table using PHP, the code is listed below. My problem is when i click update but I have not modified any data, rowCount() returns 0 and breaks the code. My question is, If I am simply updating the database with the same values that are in the databas...
My question is, If I am simply updating the database with the same values that are in the database, why does rowCount() return zero? rowCount is counting the affected rows by a query. As you haven't changed anything, there are zero affected rows. PDOStatement->rowCount — Returns the number of rows affected by the last ...
Why does PDO rowCount() return 0 after UPDATE a table without modifying the existing data? I am reading a tutorial on how to insert and update data into a MySQL table using PHP, the code is listed below. My problem is when i click update but I have not modified any data, rowCount() returns 0 and breaks the code. My que...
TITLE: Why does PDO rowCount() return 0 after UPDATE a table without modifying the existing data? QUESTION: I am reading a tutorial on how to insert and update data into a MySQL table using PHP, the code is listed below. My problem is when i click update but I have not modified any data, rowCount() returns 0 and break...
[ "php" ]
23
24
27,204
4
0
2011-06-04T14:13:53.340000
2011-06-04T14:19:39.663000
6,237,214
6,237,728
Extract long from arbitrary bitset subsequence
Is there a way to extract a CPU word size long subsequence of bits from a bitset efficiently without iterating over each bit individually? Something like #include #include using namespace std; int main() { bitset<100> b; // Do something with b //... // Now i want sizeof(long) many bits starting at position 50 unsigne...
You could create a constant bitset mask that only has the bottom N bits set, eg like this: bitset<100> const mask((unsigned long) -1); Then you can do ((b >> 50) & mask).to_ulong() to extract the bits. If your definition of "word" isn't the same as unsigned long, a different mask will be needed. (I changed your left sh...
Extract long from arbitrary bitset subsequence Is there a way to extract a CPU word size long subsequence of bits from a bitset efficiently without iterating over each bit individually? Something like #include #include using namespace std; int main() { bitset<100> b; // Do something with b //... // Now i want sizeof(...
TITLE: Extract long from arbitrary bitset subsequence QUESTION: Is there a way to extract a CPU word size long subsequence of bits from a bitset efficiently without iterating over each bit individually? Something like #include #include using namespace std; int main() { bitset<100> b; // Do something with b //... // ...
[ "c++", "bitset" ]
1
4
852
2
0
2011-06-04T14:14:31.203000
2011-06-04T15:46:46.780000
6,237,217
6,237,365
How to remove div element with jQuery
when I want to remove div element, I have the following code: when i click remove-btn, its parent div text-field should be removed. i have this code but it doesnt work. $(".remove-btn").click(function(){ $(this).parent().remove(); }); thanks for any help.:)
After reading your comment here is what you should do: $("#add-file-field").click(function() { $("#text").append(" "); }); $(".remove-btn").live('click',function() { $(this).parent().remove(); });
How to remove div element with jQuery when I want to remove div element, I have the following code: when i click remove-btn, its parent div text-field should be removed. i have this code but it doesnt work. $(".remove-btn").click(function(){ $(this).parent().remove(); }); thanks for any help.:)
TITLE: How to remove div element with jQuery QUESTION: when I want to remove div element, I have the following code: when i click remove-btn, its parent div text-field should be removed. i have this code but it doesnt work. $(".remove-btn").click(function(){ $(this).parent().remove(); }); thanks for any help.:) ANSWE...
[ "javascript", "jquery" ]
0
1
6,760
3
0
2011-06-04T14:15:00.267000
2011-06-04T14:43:23.280000
6,237,229
6,241,231
Why is my graphic sometimes centering using a relative layout?
I've been having an issue which is extremely odd to me. The graphic I'm using is sometimes centered, for reasons I can't understand, but only on certain displays. The top graphic is the bad example, the bottom one is the one I'd like to have. It seems to not be Android version dependent, both the good and bad were repl...
I managed to solve the question by a bit of trickery that I had to put in for a different reason. It works, however, to solve two problems with one stone. Basically, my ImageView became this: The key bit was the line android:layout_toLeftOf="@id/number_select", forced the image to not overlap with the textView with the...
Why is my graphic sometimes centering using a relative layout? I've been having an issue which is extremely odd to me. The graphic I'm using is sometimes centered, for reasons I can't understand, but only on certain displays. The top graphic is the bad example, the bottom one is the one I'd like to have. It seems to no...
TITLE: Why is my graphic sometimes centering using a relative layout? QUESTION: I've been having an issue which is extremely odd to me. The graphic I'm using is sometimes centered, for reasons I can't understand, but only on certain displays. The top graphic is the bad example, the bottom one is the one I'd like to ha...
[ "android", "android-layout", "android-xml" ]
0
0
282
3
0
2011-06-04T14:17:07.233000
2011-06-05T05:45:02.800000
6,237,249
6,237,275
How to get list or enumerate all handles of unmanaged windows with same class and name
Using pinvoke I can find Handle of a window with particular class & name easily: [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); IntPtr hWnd = FindWindow("Foo Class", "Foo Window"); The above code works perfect if there is only 0 or 1 matching windows. However...
You probably need to call EnumWindows to enumerate ALL top-level windows. You'll have to use their window handles to get their titles and window class information. See http://www.pinvoke.net/default.aspx/user32/enumwindows.html for an example that does very close to what you're asking.
How to get list or enumerate all handles of unmanaged windows with same class and name Using pinvoke I can find Handle of a window with particular class & name easily: [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); IntPtr hWnd = FindWindow("Foo Class", "Foo W...
TITLE: How to get list or enumerate all handles of unmanaged windows with same class and name QUESTION: Using pinvoke I can find Handle of a window with particular class & name easily: [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); IntPtr hWnd = FindWindow("...
[ "c#", "pinvoke" ]
2
4
5,451
1
0
2011-06-04T14:20:12.150000
2011-06-04T14:24:50.070000
6,237,251
6,238,089
How do I check HTTP headers of an incoming request to Google Appengine in Python?
I have an app installed on Google Appengine running on Python code. It has a request handler and a built-in database, which I update via something like this: http://appname.appspot.com/?type=update&service=test_name&url=.......... I only want the database to update, if the client accessing the python app has a certain ...
See http://code.google.com/appengine/docs/python/tools/webapp/requestclass.html#Request_headers Basically self.request.headers is a dictionary-like object that holds the request headers.
How do I check HTTP headers of an incoming request to Google Appengine in Python? I have an app installed on Google Appengine running on Python code. It has a request handler and a built-in database, which I update via something like this: http://appname.appspot.com/?type=update&service=test_name&url=.......... I only ...
TITLE: How do I check HTTP headers of an incoming request to Google Appengine in Python? QUESTION: I have an app installed on Google Appengine running on Python code. It has a request handler and a built-in database, which I update via something like this: http://appname.appspot.com/?type=update&service=test_name&url=...
[ "python", "google-app-engine" ]
2
6
2,006
2
0
2011-06-04T14:20:38.440000
2011-06-04T16:54:50.257000
6,237,259
6,237,299
Function composition in Haskell with tuple arguments
Sometimes I have two functions of the form: f:: a -> (b1,b2) h:: b1 -> b2 -> c and I need the composition g. I solve this by changing h to h': h':: (b1,b2) -> c Can you please show me (if possible) a function m, so that: (h. m. f) == (h'. f) Or another way to deal with such situations. Thanks.
What you're looking to do is to take a function that operates on curried arguments, h, and apply it to the result of f, which is a tuple. This process, turning a function of two arguments into a function that takes one argument that is a tuple, is called uncurrying. We have, from Data.Tuple: curry:: ((a, b) -> c) -> a ...
Function composition in Haskell with tuple arguments Sometimes I have two functions of the form: f:: a -> (b1,b2) h:: b1 -> b2 -> c and I need the composition g. I solve this by changing h to h': h':: (b1,b2) -> c Can you please show me (if possible) a function m, so that: (h. m. f) == (h'. f) Or another way to deal wi...
TITLE: Function composition in Haskell with tuple arguments QUESTION: Sometimes I have two functions of the form: f:: a -> (b1,b2) h:: b1 -> b2 -> c and I need the composition g. I solve this by changing h to h': h':: (b1,b2) -> c Can you please show me (if possible) a function m, so that: (h. m. f) == (h'. f) Or anot...
[ "haskell", "tuples", "currying", "function-composition" ]
13
16
5,404
2
0
2011-06-04T14:22:15.437000
2011-06-04T14:29:02.757000
6,237,261
6,237,281
button with image that defined in the css
I would like to make a button (clickable element) without text but with an image. I want the image to be defined in the css. If I use Image element, the image cannot be defined in the css. Using div looks like irrelevant. something like: elem { backround-image:url(img.jpg); } How can I do this? What is elem?
You can use a button element by reseting it's defaults CSS, Or use DIV. Button is more semantic. Obviously you will still need to add an event handler to the onclick event for it to do something. Example:.........
button with image that defined in the css I would like to make a button (clickable element) without text but with an image. I want the image to be defined in the css. If I use Image element, the image cannot be defined in the css. Using div looks like irrelevant. something like: elem { backround-image:url(img.jpg); } H...
TITLE: button with image that defined in the css QUESTION: I would like to make a button (clickable element) without text but with an image. I want the image to be defined in the css. If I use Image element, the image cannot be defined in the css. Using div looks like irrelevant. something like: elem { backround-image...
[ "html", "css" ]
0
2
179
2
0
2011-06-04T14:22:21.763000
2011-06-04T14:25:26.590000
6,237,262
6,237,379
find using multiple name patterns
I have this working fine for me: find Sources/$1-$2 -name '*' |xargs perl -pi -e "s/domain.com/$2/g" But when I change it to the following it doesn't: find Sources/$1-$2 -name '*.php,*.rb' |xargs perl -pi -e "s/domain.com/$2/g" What wrong?
you have to write it as: find Sources/$1-$2 -name '*.php' -o -name '*.rb'....
find using multiple name patterns I have this working fine for me: find Sources/$1-$2 -name '*' |xargs perl -pi -e "s/domain.com/$2/g" But when I change it to the following it doesn't: find Sources/$1-$2 -name '*.php,*.rb' |xargs perl -pi -e "s/domain.com/$2/g" What wrong?
TITLE: find using multiple name patterns QUESTION: I have this working fine for me: find Sources/$1-$2 -name '*' |xargs perl -pi -e "s/domain.com/$2/g" But when I change it to the following it doesn't: find Sources/$1-$2 -name '*.php,*.rb' |xargs perl -pi -e "s/domain.com/$2/g" What wrong? ANSWER: you have to write i...
[ "perl", "bash", "shell" ]
1
2
721
5
0
2011-06-04T14:22:24.193000
2011-06-04T14:45:24.123000
6,237,271
6,237,650
Is there a way to increase width of a control in a animated way in silverlight
I am a beginner in Silverlight. I took a border control, on mouse over of which I want to increase its width, but slowly in an animated way, and on mouse out back to normal private void bHome_MouseEnter(object sender, MouseEventArgs e) { Border border = (Border)sender; border.Width = 160; border.Opacity = 100; } priva...
If you really want to do it with code (it's way way easier to do with visual states, even the mouse over / out is handled for you out of the box, just have to set starting and ending parameters in XAML, however if the values are dynamic, it's not possible, you can't do binding in the VisualStateManager markup as it's n...
Is there a way to increase width of a control in a animated way in silverlight I am a beginner in Silverlight. I took a border control, on mouse over of which I want to increase its width, but slowly in an animated way, and on mouse out back to normal private void bHome_MouseEnter(object sender, MouseEventArgs e) { Bor...
TITLE: Is there a way to increase width of a control in a animated way in silverlight QUESTION: I am a beginner in Silverlight. I took a border control, on mouse over of which I want to increase its width, but slowly in an animated way, and on mouse out back to normal private void bHome_MouseEnter(object sender, Mouse...
[ "c#", ".net", "silverlight", "animation" ]
0
1
795
2
0
2011-06-04T14:24:20.870000
2011-06-04T15:33:46.297000
6,237,274
6,244,361
how to check if the user has the connection to the internet
In my page,I have to read the weather information from a third part site,then show the weather in the div if the user has the connection to the internet. If not,I will show some local content instead. So I have to check if the user have the connection. Some people said that if the user can see my page,they must be have...
For your usecase, the best way would be to check the error/return code for the weather content you're loading. If it somehow errors or doesn't load, display your local content. If you still want to insist on checking connectivity by loading a JS library, you can do something akin to the following: Possibly replacing 1....
how to check if the user has the connection to the internet In my page,I have to read the weather information from a third part site,then show the weather in the div if the user has the connection to the internet. If not,I will show some local content instead. So I have to check if the user have the connection. Some pe...
TITLE: how to check if the user has the connection to the internet QUESTION: In my page,I have to read the weather information from a third part site,then show the weather in the div if the user has the connection to the internet. If not,I will show some local content instead. So I have to check if the user have the c...
[ "javascript" ]
0
1
2,163
4
0
2011-06-04T14:24:33.247000
2011-06-05T16:52:04.317000
6,237,280
6,237,882
New transaction is not allowed because there are other threads running in the session
Getting "new transaction is not allowed because there are other threads running in the session". It has nothing to do with foreach loops or anything people usually have problems with in conjunction with this message. I using a EF4 with a repositoy pattern and common context open throughout the request. Something happen...
I don't think that this is only problem of not disposed contexts (context doesn't keep opened transaction - you would see it because of uncommitted changes). If you have this problem you most probably don't use the new context instance per request or you have some multi threaded / asynchronous processing on the shared ...
New transaction is not allowed because there are other threads running in the session Getting "new transaction is not allowed because there are other threads running in the session". It has nothing to do with foreach loops or anything people usually have problems with in conjunction with this message. I using a EF4 wit...
TITLE: New transaction is not allowed because there are other threads running in the session QUESTION: Getting "new transaction is not allowed because there are other threads running in the session". It has nothing to do with foreach loops or anything people usually have problems with in conjunction with this message....
[ "ado.net", "entity-framework-4" ]
8
16
31,103
4
0
2011-06-04T14:25:23.407000
2011-06-04T16:15:32.773000
6,237,289
6,282,770
Usage of checkbox in datagridtemplatecolumn issues WPF
I am using a technique similar to http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/df77a277-91d4-41f1-a42a-0fa02a443ff4/ I have a DaataGridTemplateColumn built, in code, and I am attempting to address the "select row, THEN click" checkbox issue with data grids in WPF. In the general sense, this works, however i...
The answer here was to not handle any of the checkboxes (or attempt to) in RowEditEnding. Instead, make use of PropertyChange event listening on the checkbox's which you are bound, and act accordingly (i.e. save changes when the checkbox's binding is set)
Usage of checkbox in datagridtemplatecolumn issues WPF I am using a technique similar to http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/df77a277-91d4-41f1-a42a-0fa02a443ff4/ I have a DaataGridTemplateColumn built, in code, and I am attempting to address the "select row, THEN click" checkbox issue with data gr...
TITLE: Usage of checkbox in datagridtemplatecolumn issues WPF QUESTION: I am using a technique similar to http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/df77a277-91d4-41f1-a42a-0fa02a443ff4/ I have a DaataGridTemplateColumn built, in code, and I am attempting to address the "select row, THEN click" checkbox ...
[ "wpf", "datagrid", "checkbox" ]
1
0
1,935
2
0
2011-06-04T14:27:25.277000
2011-06-08T17:27:50.700000
6,237,292
6,237,343
Navigating a file structure with using php to dynamically create pages
I am creating quite a complex web application. I like to use php to help reduce the amount of repetitive code that I end up using, creating page plugins if you like. an example of of a section of code looks like this: Texation as you can see there is a reference in the above section. As this project is going to be so l...
If you're talking about the paths to resources, why not just use absolute paths? example: /root/images/ = http://domain.com/root/images root/images = [Current directory]/root/images the second one needs you to manage updating paths for every file in your site the first one is absolute and works every time. If you are h...
Navigating a file structure with using php to dynamically create pages I am creating quite a complex web application. I like to use php to help reduce the amount of repetitive code that I end up using, creating page plugins if you like. an example of of a section of code looks like this: Texation as you can see there i...
TITLE: Navigating a file structure with using php to dynamically create pages QUESTION: I am creating quite a complex web application. I like to use php to help reduce the amount of repetitive code that I end up using, creating page plugins if you like. an example of of a section of code looks like this: Texation as y...
[ "php", "html" ]
1
1
959
2
0
2011-06-04T14:28:23.250000
2011-06-04T14:36:56.247000
6,237,294
6,237,997
Java service on Linux - How to ensure constant uptime. Deamon, Shell script or Wrapper?
I have a Java worker that are polling a external queue system for jobs, through web service calls. What is the most solid way to ensure that the worker is operating at any given time?
JVM execution is not different from any other program. So what you want to do is to put together a shell script and place it in /etc/init.d and link it appropriatelly to to /etc/rc.d. On RedHat flavors it will ensure service startup with the system. Wring the script may be tricky, but I would copy one of existing ones ...
Java service on Linux - How to ensure constant uptime. Deamon, Shell script or Wrapper? I have a Java worker that are polling a external queue system for jobs, through web service calls. What is the most solid way to ensure that the worker is operating at any given time?
TITLE: Java service on Linux - How to ensure constant uptime. Deamon, Shell script or Wrapper? QUESTION: I have a Java worker that are polling a external queue system for jobs, through web service calls. What is the most solid way to ensure that the worker is operating at any given time? ANSWER: JVM execution is not ...
[ "java", "linux", "daemon", "apache-commons-daemon" ]
1
1
715
2
0
2011-06-04T14:28:28.197000
2011-06-04T16:38:28.320000
6,237,296
6,237,306
Question regarding Java volatile keyword for reference types
I understand the volatile keyword in Java can make the read/write operations of reference variables and all primitives except long and double, atomic in nature. I also know compound statements such as incrementing an integer, var++, are not atomic and should not be used in place of synchronized statements. But what abo...
Is a call to the method setNum atomic? No, it's not. It is only the reads / writes to s that would be volatile. This can be compared with letting a List be final. This is not sufficient to make the list immutable, only the list-reference itself.
Question regarding Java volatile keyword for reference types I understand the volatile keyword in Java can make the read/write operations of reference variables and all primitives except long and double, atomic in nature. I also know compound statements such as incrementing an integer, var++, are not atomic and should ...
TITLE: Question regarding Java volatile keyword for reference types QUESTION: I understand the volatile keyword in Java can make the read/write operations of reference variables and all primitives except long and double, atomic in nature. I also know compound statements such as incrementing an integer, var++, are not ...
[ "java", "class", "volatile" ]
4
3
1,144
3
0
2011-06-04T14:28:39.793000
2011-06-04T14:30:38.200000
6,237,297
6,237,752
Meaning of knots when drawing a NURBS curve?
I'm using gluNurbsCurve to draw some curves with some control points. I've got the basic setup as described in the red book working correctly and I'm trying to expand on it. This sample looks like this: float knots[8] = {0,0,0,0,1,1,1,1}; float pnts[4][3] = { {...},{...},{...},{...} }; GLUnurbsObj *m = gluNewNurbsRende...
Actually there are ample sites online that explain the knot vector. It's not a GL specific thing but an inherent property of NURBS. So entering "NURBS knot vector" in google is gonna get you detailed explanations. I'm just gonna say that usually the knot vector has a length of knot_vector_length = number_of_points + de...
Meaning of knots when drawing a NURBS curve? I'm using gluNurbsCurve to draw some curves with some control points. I've got the basic setup as described in the red book working correctly and I'm trying to expand on it. This sample looks like this: float knots[8] = {0,0,0,0,1,1,1,1}; float pnts[4][3] = { {...},{...},{.....
TITLE: Meaning of knots when drawing a NURBS curve? QUESTION: I'm using gluNurbsCurve to draw some curves with some control points. I've got the basic setup as described in the red book working correctly and I'm trying to expand on it. This sample looks like this: float knots[8] = {0,0,0,0,1,1,1,1}; float pnts[4][3] =...
[ "opengl", "graphics", "3d", "glu", "nurbs" ]
5
6
5,542
2
0
2011-06-04T14:28:49.820000
2011-06-04T15:51:35.043000
6,237,300
6,237,333
Search in array or switch? For a cipher by substitution
I'm coding a classical cipher by substitution in C++, using all the printable characters in ASCII, and I'm wondering which is faster? A search in an array ( edit: a non associative one, just something like letters[] = {'a', 'b',...); (linear or binary) or a switch statement? The compiler can optimize the switch, doesn'...
There's certainly a chance that a sufficiently smart compiler could optimize the switch to be a lookup, which would be faster than a binary search. But you could do that optimization yourself and get short code: char alphabet[] = { 'Z', 'E', 'B', 'R', 'A', 'S', 'C', 'D', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'...
Search in array or switch? For a cipher by substitution I'm coding a classical cipher by substitution in C++, using all the printable characters in ASCII, and I'm wondering which is faster? A search in an array ( edit: a non associative one, just something like letters[] = {'a', 'b',...); (linear or binary) or a switch...
TITLE: Search in array or switch? For a cipher by substitution QUESTION: I'm coding a classical cipher by substitution in C++, using all the printable characters in ASCII, and I'm wondering which is faster? A search in an array ( edit: a non associative one, just something like letters[] = {'a', 'b',...); (linear or b...
[ "c++", "arrays", "algorithm", "encryption", "switch-statement" ]
3
1
480
3
0
2011-06-04T14:29:19.057000
2011-06-04T14:34:42.940000
6,237,307
6,237,370
looking for a solution in client cache
We provide a map in the web page(just like the google map),when user zoom in/out,move the map,we need to make a request to the server to get some information, so the request event will be so frequent,it will slow down the speed of user's acton,for example,when user move the map, he/she will notice it is not smooth enou...
I guess it depends how your Map is implemented. Is this images you want to cache? If they are the result of http requests, then if your content can be cached and has a suitable expiry time the browser cache will prevent duplicate requests for the same content. Alternatively or as well as you could take advantage of HTM...
looking for a solution in client cache We provide a map in the web page(just like the google map),when user zoom in/out,move the map,we need to make a request to the server to get some information, so the request event will be so frequent,it will slow down the speed of user's acton,for example,when user move the map, h...
TITLE: looking for a solution in client cache QUESTION: We provide a map in the web page(just like the google map),when user zoom in/out,move the map,we need to make a request to the server to get some information, so the request event will be so frequent,it will slow down the speed of user's acton,for example,when us...
[ "javascript", "browser-cache" ]
0
2
320
3
0
2011-06-04T14:30:39.457000
2011-06-04T14:44:30.967000
6,237,308
6,237,411
Add a UIView as a subview to a UITableViewController's view
I am trying to add a subview to a UITableViewController 's view via the following code //In a UITableViewController Implementation file self.loadingPageView = [[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame] autorelease]; self.loadingPageView.frame = self.view.bounds; self.loadingPageView.backgrou...
I am not sure if you can add something to the view of a tableViewController. I would add both the tableViewController.tableView and the loadingPageView to one superview.
Add a UIView as a subview to a UITableViewController's view I am trying to add a subview to a UITableViewController 's view via the following code //In a UITableViewController Implementation file self.loadingPageView = [[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame] autorelease]; self.loadingPageV...
TITLE: Add a UIView as a subview to a UITableViewController's view QUESTION: I am trying to add a subview to a UITableViewController 's view via the following code //In a UITableViewController Implementation file self.loadingPageView = [[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame] autorelease];...
[ "objective-c", "cocoa-touch", "ios", "uitableview", "subview" ]
0
1
690
1
0
2011-06-04T14:30:52.490000
2011-06-04T14:49:14.183000
6,237,309
6,237,331
localhost wont connect to mailserver
public bool send() { try { string body = _omschrijving; var fromAddress = new MailAddress("info@mydomain.com", "userfrom"); var toAddress = new MailAddress("randomemail@gmail.com", "userto"); const string subject = "mailmessage"; var smtp = new SmtpClient { Host = an IP address provided by the webhosting company, Use...
yes your hoster configured his mail-server to only accept connections from his very own webservers which is also common practice for database-severs
localhost wont connect to mailserver public bool send() { try { string body = _omschrijving; var fromAddress = new MailAddress("info@mydomain.com", "userfrom"); var toAddress = new MailAddress("randomemail@gmail.com", "userto"); const string subject = "mailmessage"; var smtp = new SmtpClient { Host = an IP address pr...
TITLE: localhost wont connect to mailserver QUESTION: public bool send() { try { string body = _omschrijving; var fromAddress = new MailAddress("info@mydomain.com", "userfrom"); var toAddress = new MailAddress("randomemail@gmail.com", "userto"); const string subject = "mailmessage"; var smtp = new SmtpClient { Host ...
[ "c#", "email", "smtp", "localhost", "mail-server" ]
1
1
260
3
0
2011-06-04T14:30:59.317000
2011-06-04T14:34:39.697000