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,243,032
6,243,130
Hibernate: 1st level cache
Could someone tell me how could I peek into objects being managed by a session in Hibernate? I am trying to use eclipse debugger and drill into persistenceContext but I am not sure if that is where I would find the objects being managed by hibernate session. Could someone tell me how to find out the objects that are be...
Are you looking to use this information simply for your own benefit and learning? You won't be able to access the information as far as I know in any sort of standard JPA-approved method. However, if you're using Hibernate, you could put a breakpoint and dig into Hibernate's implementation of PersistenceContext.java wh...
Hibernate: 1st level cache Could someone tell me how could I peek into objects being managed by a session in Hibernate? I am trying to use eclipse debugger and drill into persistenceContext but I am not sure if that is where I would find the objects being managed by hibernate session. Could someone tell me how to find ...
TITLE: Hibernate: 1st level cache QUESTION: Could someone tell me how could I peek into objects being managed by a session in Hibernate? I am trying to use eclipse debugger and drill into persistenceContext but I am not sure if that is where I would find the objects being managed by hibernate session. Could someone te...
[ "hibernate", "session" ]
3
2
303
1
0
2011-06-05T12:59:58.380000
2011-06-05T13:15:54.230000
6,243,040
6,244,039
How to fetch random row via Doctrine2 querybuilder?
So far I have: $qb1 = $this->getEntityManager()->createQueryBuilder(); $qb1->select('s') ->from('\My\Entity\Song', 's') ->where('s.id <>?1') ->orderBy('RAND()', '') ->setMaxResults(1) ->setParameters(array(1=>$current->id)); But doctrine2 doesn't understand that: Error: Expected end of string, got '(' Not even their qu...
The orderBy method should accept a field of Song for sorting purposes (such as 's.author' or 's.title'), and not a random value. Even if you chose a random field for ordering, such as selecting one randomly in php, this will not be very random at all, because you are always going to get the first result for the current...
How to fetch random row via Doctrine2 querybuilder? So far I have: $qb1 = $this->getEntityManager()->createQueryBuilder(); $qb1->select('s') ->from('\My\Entity\Song', 's') ->where('s.id <>?1') ->orderBy('RAND()', '') ->setMaxResults(1) ->setParameters(array(1=>$current->id)); But doctrine2 doesn't understand that: Erro...
TITLE: How to fetch random row via Doctrine2 querybuilder? QUESTION: So far I have: $qb1 = $this->getEntityManager()->createQueryBuilder(); $qb1->select('s') ->from('\My\Entity\Song', 's') ->where('s.id <>?1') ->orderBy('RAND()', '') ->setMaxResults(1) ->setParameters(array(1=>$current->id)); But doctrine2 doesn't und...
[ "symfony", "doctrine-orm" ]
7
11
7,068
2
0
2011-06-05T13:01:03.180000
2011-06-05T16:00:04.707000
6,243,041
6,243,097
static member variable file scope
Static variable has the scope inside that file only where they are been declared, as shown in below code: file1- static int a; file2- extern int a; This will give linking error as static variable a has the scope in file1 only. But I am confused with below code: file2- #include "file1" extern int a; Here it would not gi...
file1: static int a; file2: extern int a; There are two variables referenced here. The first is a declaration and definition of a variable with internal linkage in file1; the second is a declaration only of a variable with external linkage in file2. This doesn't necessarily cause an error; it is completely legal to hav...
static member variable file scope Static variable has the scope inside that file only where they are been declared, as shown in below code: file1- static int a; file2- extern int a; This will give linking error as static variable a has the scope in file1 only. But I am confused with below code: file2- #include "file1" ...
TITLE: static member variable file scope QUESTION: Static variable has the scope inside that file only where they are been declared, as shown in below code: file1- static int a; file2- extern int a; This will give linking error as static variable a has the scope in file1 only. But I am confused with below code: file2-...
[ "c++" ]
3
3
1,854
2
0
2011-06-05T13:01:04.053000
2011-06-05T13:10:54.293000
6,243,044
6,245,151
Unit testing with remote authentication
I have a suite of tests that I wrote while my app was using Django's default authentication, but now I've added Atlassian Crowd as the authentication method and those tests now fail, mainly because the Crowd server isn't there when I want to run my tests from home. Each app has this in it's Setup() method def setUp(sel...
You could change the AUTHENTICATION_BACKENDS setting in the setUp method, then change it back in tearDown. This question's accepted answer has an example just that, but with a different setting.
Unit testing with remote authentication I have a suite of tests that I wrote while my app was using Django's default authentication, but now I've added Atlassian Crowd as the authentication method and those tests now fail, mainly because the Crowd server isn't there when I want to run my tests from home. Each app has t...
TITLE: Unit testing with remote authentication QUESTION: I have a suite of tests that I wrote while my app was using Django's default authentication, but now I've added Atlassian Crowd as the authentication method and those tests now fail, mainly because the Crowd server isn't there when I want to run my tests from ho...
[ "django", "unit-testing", "authentication" ]
3
4
1,146
1
0
2011-06-05T13:01:14.073000
2011-06-05T19:03:02.143000
6,243,046
6,243,980
Implementing OnSubmit with httpwebrequest
I am new to C# and just messing around with it myself, now, i have been trying to create a WinForm that can post some parameters in a webpage and do something something on the resultant webpage obtained. Now I have accomplished this on a page that uses POST method, But i am not able to do so with A webpage that has a h...
Try using Fiddler in order to understand what the page is sending and receiving from the server. Then make the request as it is shown in fiddler... You can also use WebClient to open some pages or sending and receiving data from server. There are some ways to click on buttons or links: Use a WebBrowser object in your a...
Implementing OnSubmit with httpwebrequest I am new to C# and just messing around with it myself, now, i have been trying to create a WinForm that can post some parameters in a webpage and do something something on the resultant webpage obtained. Now I have accomplished this on a page that uses POST method, But i am not...
TITLE: Implementing OnSubmit with httpwebrequest QUESTION: I am new to C# and just messing around with it myself, now, i have been trying to create a WinForm that can post some parameters in a webpage and do something something on the resultant webpage obtained. Now I have accomplished this on a page that uses POST me...
[ "c#", "httpwebrequest", "onsubmit" ]
0
0
479
1
0
2011-06-05T13:02:13.103000
2011-06-05T15:48:42.003000
6,243,047
6,243,727
Android NDK: No rule to make target
I'm trying to build a simple Android application using NDK. Here are the contents of my Android.mk LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_LDLIBS:= -llog LOCAL_MODULE:= myNDK LOCAL_SRC_FILES:= native.c include $(BUILD_SHARED_LIBRARY) And when I'm running ndk-build I get: make: * No rule to make targ...
OK, I've solved my issue, and the reason was very strange: the problem is in the first line 'LOCAL_PATH:= $(call my-dir)____' It had several spaces in the end (I've replaced them with '_'). If you remove them everything works just fine.
Android NDK: No rule to make target I'm trying to build a simple Android application using NDK. Here are the contents of my Android.mk LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_LDLIBS:= -llog LOCAL_MODULE:= myNDK LOCAL_SRC_FILES:= native.c include $(BUILD_SHARED_LIBRARY) And when I'm running ndk-build...
TITLE: Android NDK: No rule to make target QUESTION: I'm trying to build a simple Android application using NDK. Here are the contents of my Android.mk LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_LDLIBS:= -llog LOCAL_MODULE:= myNDK LOCAL_SRC_FILES:= native.c include $(BUILD_SHARED_LIBRARY) And when I'm...
[ "android", "android-ndk" ]
53
89
60,756
6
0
2011-06-05T13:02:33.683000
2011-06-05T15:07:55.713000
6,243,061
6,243,731
jQuery autocomplete and focus event
Mornin' all, I have troubles to play with jQuery UI autocomplete widget events. I want to a add a custom class to the parent of the selected item. The generated markup looks like: When an item is focus, jQuery add the class.ui-state-hover to the How can I add a class.selected to the parent? I'm trying to do it from a f...
How about: focus: function(event, ui) { $(".live_search_result_list li.result").removeClass("selected"); $("#ui-active-menuitem").closest("li").addClass("selected"); }, Then, to remove the selected class from any li s when the menu loses mouse focus: $(".live_search_result_list ul").mouseleave(function() { $(this).chil...
jQuery autocomplete and focus event Mornin' all, I have troubles to play with jQuery UI autocomplete widget events. I want to a add a custom class to the parent of the selected item. The generated markup looks like: When an item is focus, jQuery add the class.ui-state-hover to the How can I add a class.selected to the ...
TITLE: jQuery autocomplete and focus event QUESTION: Mornin' all, I have troubles to play with jQuery UI autocomplete widget events. I want to a add a custom class to the parent of the selected item. The generated markup looks like: When an item is focus, jQuery add the class.ui-state-hover to the How can I add a clas...
[ "jquery-ui", "autocomplete", "focus" ]
4
5
13,661
1
0
2011-06-05T13:04:49.157000
2011-06-05T15:09:00.463000
6,243,063
6,243,305
Get full error in Release mode in MVC3
My MVC3 application that works fine in Debug is failing in Release mode. But the biggest problem is that the error I'm getting is not detailed at all. This is all I'm getting: Sorry, an error occurred while processing your request. I have configured elmah and was expecting to see a full error report, including stacktra...
After @tvanfosson comment, I realized I hadn't configured MVC3 to pass exceptions to elmah. Found this tutorial on how to do it, and right on Part 1 it suggests to comment this line from Global.asax.cs: public static void RegisterGlobalFilters(GlobalFilterCollection filters) { //filters.Add(new HandleErrorAttribute());...
Get full error in Release mode in MVC3 My MVC3 application that works fine in Debug is failing in Release mode. But the biggest problem is that the error I'm getting is not detailed at all. This is all I'm getting: Sorry, an error occurred while processing your request. I have configured elmah and was expecting to see ...
TITLE: Get full error in Release mode in MVC3 QUESTION: My MVC3 application that works fine in Debug is failing in Release mode. But the biggest problem is that the error I'm getting is not detailed at all. This is all I'm getting: Sorry, an error occurred while processing your request. I have configured elmah and was...
[ "asp.net-mvc-3", "release", "elmah" ]
1
4
636
1
0
2011-06-05T13:04:57.447000
2011-06-05T13:44:56.213000
6,243,070
6,243,091
CSS text-align: center; is not centering things
I have the following html: Site Map Privacy Policy Terms & Conditions Contact Us With the following CSS: div#footer { font-size: 10px; margin: 0 auto; text-align: center; width: 700px; } I threw in the font-size bit just to see if the style was working (Firebug reports it is working but I wanted to see). It is working....
I assume you want all the items next to each other, and the whole thing to be centered horizontally. li elements are display: block by default, taking up all the horizontal space. Add div#footer ul li { display: inline } once you've done that, you probably want to get rid of the list's bullets: div#footer ul { list-sty...
CSS text-align: center; is not centering things I have the following html: Site Map Privacy Policy Terms & Conditions Contact Us With the following CSS: div#footer { font-size: 10px; margin: 0 auto; text-align: center; width: 700px; } I threw in the font-size bit just to see if the style was working (Firebug reports it...
TITLE: CSS text-align: center; is not centering things QUESTION: I have the following html: Site Map Privacy Policy Terms & Conditions Contact Us With the following CSS: div#footer { font-size: 10px; margin: 0 auto; text-align: center; width: 700px; } I threw in the font-size bit just to see if the style was working (...
[ "css", "text-align" ]
66
51
279,256
7
0
2011-06-05T13:05:42.063000
2011-06-05T13:09:56.973000
6,243,075
6,243,136
What's the best way to let the Ajax app know of the errors back at server?
Hi I'm working on an application with Java as it's server-side language and for the client-side I'm using Ajax. But I'm fairly new to ajax applications so I needed some opinions on the issue I've faced. I'm using Spring Security for my authentication and authorization services and by reading spring forums I've managed ...
If standard HTTP error codes (eg 401 Unauthorized) are rich enough, use them. Best not to make up your own HTTP error codes, they're meant to be fixed. If you need more info to be returned, you should return a richer object in the response body (serialized as eg JSON or XML) and parse the object on the client side.
What's the best way to let the Ajax app know of the errors back at server? Hi I'm working on an application with Java as it's server-side language and for the client-side I'm using Ajax. But I'm fairly new to ajax applications so I needed some opinions on the issue I've faced. I'm using Spring Security for my authentic...
TITLE: What's the best way to let the Ajax app know of the errors back at server? QUESTION: Hi I'm working on an application with Java as it's server-side language and for the client-side I'm using Ajax. But I'm fairly new to ajax applications so I needed some opinions on the issue I've faced. I'm using Spring Securit...
[ "java", "javascript", "jquery", "ajax", "spring-security" ]
0
4
391
3
0
2011-06-05T13:06:09.797000
2011-06-05T13:16:57.380000
6,243,081
6,243,087
How to reset a list
It might be a silly question but still i am facing problem with this. var eformDetailIds = []; eformDetailIds=$("[name=eform_id]").map(function(){ return $(this).val() }).get(); this is the code that i have written in js function and calling this function on button click. But the problem is the list eformDetailIds con...
Just set the length to zero: eformDetailIds.length = 0; Or allocate a new array: eformDetailIds = []; Now, that said, according to the code you posted the entire array will definitely be replaced each time that ".map()" call runs. In other words, the previous values will not remain in the array. Perhaps you should post...
How to reset a list It might be a silly question but still i am facing problem with this. var eformDetailIds = []; eformDetailIds=$("[name=eform_id]").map(function(){ return $(this).val() }).get(); this is the code that i have written in js function and calling this function on button click. But the problem is the lis...
TITLE: How to reset a list QUESTION: It might be a silly question but still i am facing problem with this. var eformDetailIds = []; eformDetailIds=$("[name=eform_id]").map(function(){ return $(this).val() }).get(); this is the code that i have written in js function and calling this function on button click. But the ...
[ "javascript", "jquery" ]
0
2
173
2
0
2011-06-05T13:07:04.133000
2011-06-05T13:08:54.520000
6,243,086
6,243,135
Java Swing - how to scroll down a JTextArea?
I have an application with basic chat. I use JTextArea for the buffer. After adding a message I want to scroll to the bottom. How can this be achieved? I found no member function that would allow me to do this.
You can do this by setting the caret position to the end of the text area, i.e., myTextArea.setCaretPosition(myTextArea.getDocument().getLength()); Edit: you can find out a lot more on this question by looking at the related questions listed on the lower right of this page. In particular, please check out camickr's ans...
Java Swing - how to scroll down a JTextArea? I have an application with basic chat. I use JTextArea for the buffer. After adding a message I want to scroll to the bottom. How can this be achieved? I found no member function that would allow me to do this.
TITLE: Java Swing - how to scroll down a JTextArea? QUESTION: I have an application with basic chat. I use JTextArea for the buffer. After adding a message I want to scroll to the bottom. How can this be achieved? I found no member function that would allow me to do this. ANSWER: You can do this by setting the caret ...
[ "java", "swing", "scroll", "jtextarea" ]
10
25
9,796
1
0
2011-06-05T13:08:40.347000
2011-06-05T13:16:50.217000
6,243,088
6,243,306
Find out the number of days of a month in R
I have a date in P date = as.Date("2011-02-23", "%Y-%m-%d") Is it possible to find out the number of days of the month of that particular date? (With respect to leapyears). In PHP it would look similar to this ( http://www.php.net/manual/en/function.date.php ): days = format(date, "%t") but "%t" seems to have a differe...
You can write simple function to do that: numberOfDays <- function(date) { m <- format(date, format="%m") while (format(date, format="%m") == m) { date <- date + 1 } return(as.integer(format(date - 1, format="%d"))) } Invoke as: > date = as.Date("2011-02-23", "%Y-%m-%d") > numberOfDays(date) [1] 28 > date # date is u...
Find out the number of days of a month in R I have a date in P date = as.Date("2011-02-23", "%Y-%m-%d") Is it possible to find out the number of days of the month of that particular date? (With respect to leapyears). In PHP it would look similar to this ( http://www.php.net/manual/en/function.date.php ): days = format(...
TITLE: Find out the number of days of a month in R QUESTION: I have a date in P date = as.Date("2011-02-23", "%Y-%m-%d") Is it possible to find out the number of days of the month of that particular date? (With respect to leapyears). In PHP it would look similar to this ( http://www.php.net/manual/en/function.date.php...
[ "r", "date" ]
40
23
50,322
15
0
2011-06-05T13:09:02.650000
2011-06-05T13:45:00.393000
6,243,092
6,243,139
C/C++. Advantages of libraries over combined object files
While it is commonplace to combine multiple object files in a library, it is possible (at least in Linux) to combine multiple object files into another object file. (See combine two GCC compiled.o object files into a third.o file ) As there are downsides to using libraries instead of just combined object files: 1: It's...
While it depends on the linker being used, object files are being included in the final binary in their entirety. So, if you combine several object files into one object file, then the resulting (combined) object file is included in the resultant binary. In contrast, a library is just that, a library of object files. T...
C/C++. Advantages of libraries over combined object files While it is commonplace to combine multiple object files in a library, it is possible (at least in Linux) to combine multiple object files into another object file. (See combine two GCC compiled.o object files into a third.o file ) As there are downsides to usin...
TITLE: C/C++. Advantages of libraries over combined object files QUESTION: While it is commonplace to combine multiple object files in a library, it is possible (at least in Linux) to combine multiple object files into another object file. (See combine two GCC compiled.o object files into a third.o file ) As there are...
[ "c++", "c", "linker", "object-files" ]
10
11
2,771
4
0
2011-06-05T13:10:01.590000
2011-06-05T13:17:36.690000
6,243,093
6,243,111
How to iterate over the series: 1, -2, 3, -4, 5, -6, 7, -8, ...?
How would you iterate over the following series in Javascript/jQuery: 1, -2, 3, -4, 5, -6, 7, -8,... Here is how I do this: n = 1 while (...) { n = ((n % 2 == 0)? 1: -1) * (Math.abs(n) + 1); } Is there a simpler method?
You could keep two variables: for (var n = 1, s = 1;...; ++n, s = -s) alert(n * s);
How to iterate over the series: 1, -2, 3, -4, 5, -6, 7, -8, ...? How would you iterate over the following series in Javascript/jQuery: 1, -2, 3, -4, 5, -6, 7, -8,... Here is how I do this: n = 1 while (...) { n = ((n % 2 == 0)? 1: -1) * (Math.abs(n) + 1); } Is there a simpler method?
TITLE: How to iterate over the series: 1, -2, 3, -4, 5, -6, 7, -8, ...? QUESTION: How would you iterate over the following series in Javascript/jQuery: 1, -2, 3, -4, 5, -6, 7, -8,... Here is how I do this: n = 1 while (...) { n = ((n % 2 == 0)? 1: -1) * (Math.abs(n) + 1); } Is there a simpler method? ANSWER: You coul...
[ "javascript", "jquery", "series" ]
3
11
326
8
0
2011-06-05T13:10:02.510000
2011-06-05T13:13:19.763000
6,243,096
6,243,131
problem in understanding java sockets
I have an app in java which is playing the rolle of a server.For limiting the number of incoming connections I'm using a ThreadPool server. But I have a few problems understanding a part of the code: Here is y code: protected ExecutorService threadPool = Executors.newFixedThreadPool(5); public ThreadPooledServer(Block...
You need to call it somewhere in your code to stop your server and close those connections. If you don't the system will eventually reclaim its resources as the server will be shutting down. You should be able to register a shutdown hook in the JVM (which can call stop() ) to help with reclaiming those yourself... Good...
problem in understanding java sockets I have an app in java which is playing the rolle of a server.For limiting the number of incoming connections I'm using a ThreadPool server. But I have a few problems understanding a part of the code: Here is y code: protected ExecutorService threadPool = Executors.newFixedThreadPoo...
TITLE: problem in understanding java sockets QUESTION: I have an app in java which is playing the rolle of a server.For limiting the number of incoming connections I'm using a ThreadPool server. But I have a few problems understanding a part of the code: Here is y code: protected ExecutorService threadPool = Executors...
[ "android", "multithreading" ]
0
0
79
1
0
2011-06-05T13:10:39.863000
2011-06-05T13:15:59.353000
6,243,114
6,243,279
Help with AVG in Query with Left Join
I need help to write sql query to know avg of position. SELECT p.date_add, p.pozycja, f.nazwa FROM fraza f LEFT JOIN pozycja p ON f.id = p.parent_id WHERE f.parent_id = 101 AND p.date_add BETWEEN '2010-12-01' AND '2011-01-01' ORDER BY f.nazwa DESC, p.date_add ASC LIMIT 1000 now i got something like this: date_add | poz...
SELECT p.date_add, avg(p.pozycja) as avg_pozycja, f.nazwa FROM fraza f LEFT JOIN pozycja p ON f.id = p.parent_id WHERE f.parent_id = 101 AND p.date_add BETWEEN '2010-12-01' AND '2011-01-01' GROUP BY f.nazwa ORDER BY f.nazwa DESC, p.date_add ASC
Help with AVG in Query with Left Join I need help to write sql query to know avg of position. SELECT p.date_add, p.pozycja, f.nazwa FROM fraza f LEFT JOIN pozycja p ON f.id = p.parent_id WHERE f.parent_id = 101 AND p.date_add BETWEEN '2010-12-01' AND '2011-01-01' ORDER BY f.nazwa DESC, p.date_add ASC LIMIT 1000 now i g...
TITLE: Help with AVG in Query with Left Join QUESTION: I need help to write sql query to know avg of position. SELECT p.date_add, p.pozycja, f.nazwa FROM fraza f LEFT JOIN pozycja p ON f.id = p.parent_id WHERE f.parent_id = 101 AND p.date_add BETWEEN '2010-12-01' AND '2011-01-01' ORDER BY f.nazwa DESC, p.date_add ASC ...
[ "mysql", "left-join", "average" ]
0
3
709
1
0
2011-06-05T13:13:52.093000
2011-06-05T13:38:54.017000
6,243,125
6,243,602
Simple solution for handling special characters in shell script input
I have a script which can overwrite values in a configuration file using options, for example, option --password can overwrite the setting in the configuration file (please note, this is not a discussion about security). However a password can contain contain characters, that are by bash, recognized as special characte...
Hm.. Double quotes are not enough. Must use single quotes, because the rare situation, for example mycommand --password "AAA$PWD" #is worng for any exported environment varname mycommand --password 'AAA$PWD' #ok Here is no way avoid this, because your users using a sort of shell, what have variable expansions and metac...
Simple solution for handling special characters in shell script input I have a script which can overwrite values in a configuration file using options, for example, option --password can overwrite the setting in the configuration file (please note, this is not a discussion about security). However a password can contai...
TITLE: Simple solution for handling special characters in shell script input QUESTION: I have a script which can overwrite values in a configuration file using options, for example, option --password can overwrite the setting in the configuration file (please note, this is not a discussion about security). However a p...
[ "bash", "shell" ]
2
5
10,295
2
0
2011-06-05T13:15:37.553000
2011-06-05T14:44:34.797000
6,243,127
6,243,191
Using jaxb classes as parameters or results of web-methods
I am making web service that generates and accepts xml information, and i am wondering, whether generated from xml schema jaxb classes could be transferred as-is.
The details depends on what technology you're using as the transport for your web service but the answer is yes. For example, if you're using JAX-WS (for soap) or JAX-RS (for rest) then both of those technologies have a way of using JAXB objects. If you're writing a pure servlet then you can marshal the JAXB objects an...
Using jaxb classes as parameters or results of web-methods I am making web service that generates and accepts xml information, and i am wondering, whether generated from xml schema jaxb classes could be transferred as-is.
TITLE: Using jaxb classes as parameters or results of web-methods QUESTION: I am making web service that generates and accepts xml information, and i am wondering, whether generated from xml schema jaxb classes could be transferred as-is. ANSWER: The details depends on what technology you're using as the transport fo...
[ "java", "jaxb" ]
2
3
112
1
0
2011-06-05T13:15:44.633000
2011-06-05T13:24:27.910000
6,243,128
6,243,168
WSDL/SOAP Test With soapui
I have tested my web services (wsdl/soap) with soapui. and i have the errors: http/log: error 400 BAD REQUEST. What can be the error please with my wsdl? error/log: un Jun 05 14:10:37 CEST 2011:ERROR:javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.or...
definitions is a root element of WSDL so it looks like you are not loading WSDL. Edit: I tested it and it looks like the whole problem is with your web server. Your web server returns WSDL to browser but it doesn't return it to any tool because these tools are using very minimalistic HTTP requests without many HTTP hea...
WSDL/SOAP Test With soapui I have tested my web services (wsdl/soap) with soapui. and i have the errors: http/log: error 400 BAD REQUEST. What can be the error please with my wsdl? error/log: un Jun 05 14:10:37 CEST 2011:ERROR:javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element ...
TITLE: WSDL/SOAP Test With soapui QUESTION: I have tested my web services (wsdl/soap) with soapui. and i have the errors: http/log: error 400 BAD REQUEST. What can be the error please with my wsdl? error/log: un Jun 05 14:10:37 CEST 2011:ERROR:javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL:...
[ "web-services", "wsdl", "soapui" ]
28
39
124,098
9
0
2011-06-05T13:15:47.967000
2011-06-05T13:20:50.453000
6,243,133
6,243,298
What do the Google Maps Terms of Service mean in practice for an iOS app developer?
I want to use the MapViewController in an iOS app (to allow the user to find the adress of where he is currently at) and came across the "Google Maps Terms of Service for iPhone SDK", but I am a bit lost what some of this means in practice, i.e. what do I need to be aware of and what do I need to do when using a MapVie...
Taken from Google Maps API Terms of Service: How does the Google Maps APIs key system work? Google Maps API keys are only required when using the JavaScript Maps API v2 and the Maps API for Flash [emphasis added]. In order to obtain a Google Maps API key, you must sign in to your Google Account and agree to our Terms o...
What do the Google Maps Terms of Service mean in practice for an iOS app developer? I want to use the MapViewController in an iOS app (to allow the user to find the adress of where he is currently at) and came across the "Google Maps Terms of Service for iPhone SDK", but I am a bit lost what some of this means in pract...
TITLE: What do the Google Maps Terms of Service mean in practice for an iOS app developer? QUESTION: I want to use the MapViewController in an iOS app (to allow the user to find the adress of where he is currently at) and came across the "Google Maps Terms of Service for iPhone SDK", but I am a bit lost what some of t...
[ "ios", "google-maps" ]
3
3
563
1
0
2011-06-05T13:16:16.800000
2011-06-05T13:43:41.777000
6,243,137
6,243,209
Problem with backreferences in C#'s regex
The goal is to extract time and date strings from this: Date - Thursday, June 2 2011 9:00PM Here's the code: Match m = Regex.Match(line, " Date - (.*) (.*) "); date = m.Captures[0].Value; time = m.Captures[1].Value; Thanks to the regex being greedy, it should match the first group all the way up to the last space. But ...
Use Groups, not Captures. Your results will be in Groups[1] and Groups[2]. And personally, I'd recommend naming the groups: Match m = Regex.Match(line, " Date - (?.*) (?.*) "); if( m.Success ) { date = m.Groups["date"].Value; time = m.Groups["time"].Value; }
Problem with backreferences in C#'s regex The goal is to extract time and date strings from this: Date - Thursday, June 2 2011 9:00PM Here's the code: Match m = Regex.Match(line, " Date - (.*) (.*) "); date = m.Captures[0].Value; time = m.Captures[1].Value; Thanks to the regex being greedy, it should match the first gr...
TITLE: Problem with backreferences in C#'s regex QUESTION: The goal is to extract time and date strings from this: Date - Thursday, June 2 2011 9:00PM Here's the code: Match m = Regex.Match(line, " Date - (.*) (.*) "); date = m.Captures[0].Value; time = m.Captures[1].Value; Thanks to the regex being greedy, it should ...
[ "c#", "regex", "backreference" ]
4
4
652
1
0
2011-06-05T13:17:01.763000
2011-06-05T13:26:56.420000
6,243,140
6,245,445
Programmatically put a Mac into sleep
I can't find any instructions how to put a Mac programmatically into sleep mode (in Objective-C). I'm sure it should be only one line, but could you give me a hint?
#include #include #include SendAppleEventToSystemProcess(kAESleep); OSStatus SendAppleEventToSystemProcess(AEEventID EventToSend) { AEAddressDesc targetDesc; static const ProcessSerialNumber kPSNOfSystemProcess = { 0, kSystemProcess }; AppleEvent eventReply = {typeNull, NULL}; AppleEvent appleEventToSend = {typeNull, ...
Programmatically put a Mac into sleep I can't find any instructions how to put a Mac programmatically into sleep mode (in Objective-C). I'm sure it should be only one line, but could you give me a hint?
TITLE: Programmatically put a Mac into sleep QUESTION: I can't find any instructions how to put a Mac programmatically into sleep mode (in Objective-C). I'm sure it should be only one line, but could you give me a hint? ANSWER: #include #include #include SendAppleEventToSystemProcess(kAESleep); OSStatus SendAppleEve...
[ "objective-c", "cocoa", "macos", "sleep" ]
8
9
4,474
6
0
2011-06-05T13:17:41.587000
2011-06-05T19:51:27.733000
6,243,141
6,243,221
Problem with JS, DOM and looping
I have a problem with JavaScript looping and DOM. so I have a few div's, each has a background image defined by CSS, however when i rollover a text link, i wish for these background images to change, which ones will change depends on their class name and the link mouseover'ed web so those are the divs with my link for ...
This may work (if the link to your images is right and presumed that by id="5" you mean id="im5". Play with it until it's right. Check your code thourougly, there were several errors (typos or worse 1 ) in your coding: function showweb() { for(var i=1; i < 6; i++){ var el = document.getElementById("im"+(i)); if(el && /...
Problem with JS, DOM and looping I have a problem with JavaScript looping and DOM. so I have a few div's, each has a background image defined by CSS, however when i rollover a text link, i wish for these background images to change, which ones will change depends on their class name and the link mouseover'ed web so tho...
TITLE: Problem with JS, DOM and looping QUESTION: I have a problem with JavaScript looping and DOM. so I have a few div's, each has a background image defined by CSS, however when i rollover a text link, i wish for these background images to change, which ones will change depends on their class name and the link mouse...
[ "javascript", "loops" ]
1
0
108
5
0
2011-06-05T13:17:49.777000
2011-06-05T13:29:00.237000
6,243,145
6,243,217
stl container for table
Is there any data structure for a table? like storing this: Width Height 1 5 10 2 3 20 3 10 2 What I need is to address a value by row number and title, e.g. (2, "Height") will give 20. I know I can do an array of maps or 2d array and a map as column name to number, but is there a ready data structure for this?
Have you looked at Boost::MultiIndex yet? It's almost like an in-memory representation of a database table. You can query on several rows, a single row, and such. Very powerful, very useful, and I think it would solve the issue you're asking. Taken from the boost website: Boost.MultiIndex features additional functional...
stl container for table Is there any data structure for a table? like storing this: Width Height 1 5 10 2 3 20 3 10 2 What I need is to address a value by row number and title, e.g. (2, "Height") will give 20. I know I can do an array of maps or 2d array and a map as column name to number, but is there a ready data str...
TITLE: stl container for table QUESTION: Is there any data structure for a table? like storing this: Width Height 1 5 10 2 3 20 3 10 2 What I need is to address a value by row number and title, e.g. (2, "Height") will give 20. I know I can do an array of maps or 2d array and a map as column name to number, but is ther...
[ "c++", "stl" ]
3
4
5,452
5
0
2011-06-05T13:18:26.937000
2011-06-05T13:27:48.860000
6,243,164
6,243,172
concurrent file read/write
What happens when many requests are received to read & write to a file in PHP? Do the requests get queued? Or is only one accepted and the rest are discarded? I'm planning to use a text based hit counter.
You can encounter the problem of race condition To avoid this if you only need simple append data you can use file_put_contents(,,FILE_APPEND|LOCK_EX); and don't worry about your data integrity. If you need more complex operation you can use flock (used for simple reader/writer problem) For your PHP script counter I su...
concurrent file read/write What happens when many requests are received to read & write to a file in PHP? Do the requests get queued? Or is only one accepted and the rest are discarded? I'm planning to use a text based hit counter.
TITLE: concurrent file read/write QUESTION: What happens when many requests are received to read & write to a file in PHP? Do the requests get queued? Or is only one accepted and the rest are discarded? I'm planning to use a text based hit counter. ANSWER: You can encounter the problem of race condition To avoid this...
[ "php", "file-io" ]
9
6
2,881
3
0
2011-06-05T13:20:28.017000
2011-06-05T13:21:26.170000
6,243,167
6,243,425
PHP Page - Add popup/hover to survey invitation
I would like to add an option to an existing PHP page that invites users to participate in a survey - I've seen similar invitations appear on sites that I've visited in the past but have never had to build one myself. The invitation will be a hovering popup that appears on top of the current page with an option to part...
The easiest way to do this would to be with JavaScript and I use jQuery to do my javascript. So you would create a div as you would want the survey to look like so: Style this and do what you normally would Then in your CSS put: #idOfDiv { display:none; } Finally for jQuery you can use the following snippet to get it t...
PHP Page - Add popup/hover to survey invitation I would like to add an option to an existing PHP page that invites users to participate in a survey - I've seen similar invitations appear on sites that I've visited in the past but have never had to build one myself. The invitation will be a hovering popup that appears o...
TITLE: PHP Page - Add popup/hover to survey invitation QUESTION: I would like to add an option to an existing PHP page that invites users to participate in a survey - I've seen similar invitations appear on sites that I've visited in the past but have never had to build one myself. The invitation will be a hovering po...
[ "php", "javascript", "popup", "survey" ]
1
1
1,313
1
0
2011-06-05T13:20:42.083000
2011-06-05T14:10:01.543000
6,243,170
6,243,202
add a reference to a visual studio project for amazon web services sdk
how can I add a reference to the amazon sdk (installed already) to my existing class library? I can make a new amazon aws project, but I just want to add a reference to an already existing class library which will use amazon aws API's. searched on line, but could not find it... so a link is as good as a direct answer.
Can't you just add a reference to the existing class library dll? I strongly engcourage you to download and install NuGet from Tools > Extension Manager and use that to install third party libraries. Check out the NuGet documentation for more details:) To install (and reference) the AWS SDK, run the following command f...
add a reference to a visual studio project for amazon web services sdk how can I add a reference to the amazon sdk (installed already) to my existing class library? I can make a new amazon aws project, but I just want to add a reference to an already existing class library which will use amazon aws API's. searched on l...
TITLE: add a reference to a visual studio project for amazon web services sdk QUESTION: how can I add a reference to the amazon sdk (installed already) to my existing class library? I can make a new amazon aws project, but I just want to add a reference to an already existing class library which will use amazon aws AP...
[ "c#", "visual-studio-2010", "reference", "amazon-web-services", "projects-and-solutions" ]
4
5
4,305
1
0
2011-06-05T13:21:16.657000
2011-06-05T13:26:23.927000
6,243,175
6,243,285
Difference in columns. Returning variable top duplicate results
I have a query that returns the biggest difference in two columns. Lets say it's something like: | result | 5 5 5 4 4 3 2 How can I make it return all of the top results every time? (5, 5, 5) I'm not looking for LIMIT 3, since the results vary and sometimes there's only one top number, etc. The query I have now looks l...
SELECT MAX(column1 - column2) as result FROM table WHERE othercolumn = somecondition GROUP by id HAVING result = (select max(column1 - column2) FROM table WHERE othercolumn = somecondition) ORDER BY id;
Difference in columns. Returning variable top duplicate results I have a query that returns the biggest difference in two columns. Lets say it's something like: | result | 5 5 5 4 4 3 2 How can I make it return all of the top results every time? (5, 5, 5) I'm not looking for LIMIT 3, since the results vary and sometime...
TITLE: Difference in columns. Returning variable top duplicate results QUESTION: I have a query that returns the biggest difference in two columns. Lets say it's something like: | result | 5 5 5 4 4 3 2 How can I make it return all of the top results every time? (5, 5, 5) I'm not looking for LIMIT 3, since the results...
[ "mysql", "duplicates", "max" ]
1
0
109
2
0
2011-06-05T13:21:46.670000
2011-06-05T13:40:37.103000
6,243,193
6,243,241
Scroll TTreeView while dragging over/near the edges
I have a TTreeView that can have lots of nodes, when a lot of nodes are expanded the tree uses a lot of screen space. Now suppose I want to drag a node that is near the bottom of the TreeView to the top, I can't physically see the top part of the TreeView because the node I am selecting is at the bottom. When dragging ...
This is the code I use. It will work for any TWinControl descendent: list box, tree view, list view etc. type TAutoScrollTimer = class(TTimer) private FControl: TWinControl; FScrollCount: Integer; procedure InitialiseTimer; procedure Timer(Sender: TObject); public constructor Create(Control: TWinControl); end; { TAuto...
Scroll TTreeView while dragging over/near the edges I have a TTreeView that can have lots of nodes, when a lot of nodes are expanded the tree uses a lot of screen space. Now suppose I want to drag a node that is near the bottom of the TreeView to the top, I can't physically see the top part of the TreeView because the ...
TITLE: Scroll TTreeView while dragging over/near the edges QUESTION: I have a TTreeView that can have lots of nodes, when a lot of nodes are expanded the tree uses a lot of screen space. Now suppose I want to drag a node that is near the bottom of the TreeView to the top, I can't physically see the top part of the Tre...
[ "delphi", "treeview", "scroll" ]
8
11
2,987
3
0
2011-06-05T13:24:44.817000
2011-06-05T13:32:21.717000
6,243,233
6,244,160
How to compare byte to byte of two bitmap screenshots in c++
IN THE END OF THE QUESTION MY LAST EDIT Hi all, I have to implement a function that compares two shots of a portion of the screen in order to know if there are differences/variations. I wrote something like the following code but I can't manage it to work. In the code COORDINATES_RECT is a struct typedef struct _COORDI...
Rather than comparing the two bitmaps entirely on your own, consider using BitBlt to combine them using the SRCINVERT operator, which XORs the two together, so the parts that are identical will show up as zeros, and all the non-zero areas will be differences.
How to compare byte to byte of two bitmap screenshots in c++ IN THE END OF THE QUESTION MY LAST EDIT Hi all, I have to implement a function that compares two shots of a portion of the screen in order to know if there are differences/variations. I wrote something like the following code but I can't manage it to work. In...
TITLE: How to compare byte to byte of two bitmap screenshots in c++ QUESTION: IN THE END OF THE QUESTION MY LAST EDIT Hi all, I have to implement a function that compares two shots of a portion of the screen in order to know if there are differences/variations. I wrote something like the following code but I can't man...
[ "c++", "visual-studio-2010", "comparison", "bitmap", "msdn" ]
4
5
2,684
2
0
2011-06-05T13:31:23.043000
2011-06-05T16:20:08.250000
6,243,234
6,243,288
Using a subclass method on a base class object
Let's say I have declared the following classes: class BaseClass{ /* properties, constructors, getters, setters etc. */ public static BaseClass Create(string url){ /*will return, depending on url, a BaseClass or a SubClass object*/ } public void Method(){ /* some code here */ } } class SubClass: BaseClass{ /* other ...
It looks like you might be looking for polymorphism, but I can't be sure from the description. What is the concrete use case for what you're trying to do? class BaseClass{ public virtual void Method(){ Console.WriteLine("BaseClass"); } } class SubClass: BaseClass{ /* other properties, constructors, getters, setters e...
Using a subclass method on a base class object Let's say I have declared the following classes: class BaseClass{ /* properties, constructors, getters, setters etc. */ public static BaseClass Create(string url){ /*will return, depending on url, a BaseClass or a SubClass object*/ } public void Method(){ /* some code he...
TITLE: Using a subclass method on a base class object QUESTION: Let's say I have declared the following classes: class BaseClass{ /* properties, constructors, getters, setters etc. */ public static BaseClass Create(string url){ /*will return, depending on url, a BaseClass or a SubClass object*/ } public void Method(...
[ "c#" ]
3
2
3,686
4
0
2011-06-05T13:31:42.490000
2011-06-05T13:41:17.890000
6,243,238
6,247,823
How to stop parent div from stretching in IE7
Child Content It works fine in firefox, but in IE7 the parent div is stretching with the child div. Is there anyway to stop IE7 from stretching the parent div? For some design constraints the divs cannot be positioned.
Just adding at the start of the HTML solved the issue. Internet Explorer apparently defaults to 'quirks' mode if no DOCTYPE is declared! For further information check, CSS quirks mode
How to stop parent div from stretching in IE7 Child Content It works fine in firefox, but in IE7 the parent div is stretching with the child div. Is there anyway to stop IE7 from stretching the parent div? For some design constraints the divs cannot be positioned.
TITLE: How to stop parent div from stretching in IE7 QUESTION: Child Content It works fine in firefox, but in IE7 the parent div is stretching with the child div. Is there anyway to stop IE7 from stretching the parent div? For some design constraints the divs cannot be positioned. ANSWER: Just adding at the start of ...
[ "css", "overflow", "parent-child", "visible", "stretch" ]
1
1
699
3
0
2011-06-05T13:32:09.223000
2011-06-06T04:39:55.407000
6,243,242
6,243,372
Testing API which returns multiple values with JUnit
I would like to test an API, which received one argument and returns a set. The test invokes the API with an argument and checks if the returned set contains expected values. Suppose, I have to test the API with arguments arg1, arg2, and arg3 and check if values a, b, c appear in the returned set. That is, my test case...
Fluent assertions First of all, use FEST-Assertions library to introduce pleasantly looking assertions with meaningful error messages: assertThat(method(arg1)).containsExactly(a, b, c); assertThat(method(arg2)).containsExactly(a, b, c); assertThat(method(arg3)).containsExactly(a, b, c); The BDD way But I understand you...
Testing API which returns multiple values with JUnit I would like to test an API, which received one argument and returns a set. The test invokes the API with an argument and checks if the returned set contains expected values. Suppose, I have to test the API with arguments arg1, arg2, and arg3 and check if values a, b...
TITLE: Testing API which returns multiple values with JUnit QUESTION: I would like to test an API, which received one argument and returns a set. The test invokes the API with an argument and checks if the returned set contains expected values. Suppose, I have to test the API with arguments arg1, arg2, and arg3 and ch...
[ "java", "unit-testing", "junit" ]
2
4
4,880
4
0
2011-06-05T13:32:54.823000
2011-06-05T13:58:01.550000
6,243,254
6,243,295
Naming of hierarchical structures in C++
I need advice for the following hierarchical structure, I want to represent in a C++ program. There is one abstract class uri and the classes url and urn which derive from it. I would like to have one directory containing the source code of the uri concept. And a namespace which should be called.. uri.:) So, I'm coming...
Namespaces are not based nor should they be based on the actual directories that hold the files. Their purpose is to group related classes/structs/constants together and reduce ambiguities. There is no problem with naming a class the same as its containing namespace (such as uri::uri). Names should be chosen with the p...
Naming of hierarchical structures in C++ I need advice for the following hierarchical structure, I want to represent in a C++ program. There is one abstract class uri and the classes url and urn which derive from it. I would like to have one directory containing the source code of the uri concept. And a namespace which...
TITLE: Naming of hierarchical structures in C++ QUESTION: I need advice for the following hierarchical structure, I want to represent in a C++ program. There is one abstract class uri and the classes url and urn which derive from it. I would like to have one directory containing the source code of the uri concept. And...
[ "c++", "namespaces", "naming-conventions", "class-hierarchy" ]
0
3
426
3
0
2011-06-05T13:35:33.987000
2011-06-05T13:42:20.527000
6,243,264
6,243,558
How can I add a new jquery deferred to an existing $.when?
I am refactoring a resource-loading function that used a traditional callback pattern to instead use jQuery Deferreds. This function takes and array of urls, creates a new Deferred object for each resource, creates a $.when Deferred object to watch them, and returns the promise of the $.when object. Here's a simplified...
I guess I needed to ask the question to find a solution for myself. Basically I added the following code the beginning of getResources: if (! theLib.currentDeferred.isResolved()) { return $.when(theLib.currentDeferred).always(function() { theLib.getResources(paths); }).promise(); } The above was failing. The correct so...
How can I add a new jquery deferred to an existing $.when? I am refactoring a resource-loading function that used a traditional callback pattern to instead use jQuery Deferreds. This function takes and array of urls, creates a new Deferred object for each resource, creates a $.when Deferred object to watch them, and re...
TITLE: How can I add a new jquery deferred to an existing $.when? QUESTION: I am refactoring a resource-loading function that used a traditional callback pattern to instead use jQuery Deferreds. This function takes and array of urls, creates a new Deferred object for each resource, creates a $.when Deferred object to ...
[ "javascript", "jquery", "jquery-deferred" ]
4
3
1,342
1
0
2011-06-05T13:37:26.053000
2011-06-05T14:36:56.920000
6,243,266
6,271,800
Internet connection in MC65
In MC65, SIM card is already inserted. Any web site can be browsed. In my application, there is sending email feature using Rebex. Sometimes, it cannot send email. So I tried to browse IE and I'm beware if 3G connection signal appears, sending works properly. Around connection signal on Screen, there is "H" symbol. Wha...
Does the Rebex Mail throw any exception when it's unable to send email? Error message might help to diagnose the problem. Is it possible to create a SMTP communication log file and include part of it with error message? Following code shows how to do it: Dim mailMessage As New MailMessage() 'todo: set mail message prop...
Internet connection in MC65 In MC65, SIM card is already inserted. Any web site can be browsed. In my application, there is sending email feature using Rebex. Sometimes, it cannot send email. So I tried to browse IE and I'm beware if 3G connection signal appears, sending works properly. Around connection signal on Scre...
TITLE: Internet connection in MC65 QUESTION: In MC65, SIM card is already inserted. Any web site can be browsed. In my application, there is sending email feature using Rebex. Sometimes, it cannot send email. So I tried to browse IE and I'm beware if 3G connection signal appears, sending works properly. Around connect...
[ "vb.net", "windows-mobile-6.5", "rebex" ]
0
1
902
1
0
2011-06-05T13:37:40.647000
2011-06-07T21:20:40.017000
6,243,268
6,243,330
XPath produces garbled output instead of Unicode characters
I am parsing this XML file: Main class is: import java.io.File; import java.io.FileInputStream; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; public class Tes...
Could be that the parsing is ok, but the output is wrong. If you you used a font that doesn't contain those characters, or if you output the values to HTML, but specify a wrong encoding, this can be the result. The font-issue being the more likely one.
XPath produces garbled output instead of Unicode characters I am parsing this XML file: Main class is: import java.io.File; import java.io.FileInputStream; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; import org.w3c.dom...
TITLE: XPath produces garbled output instead of Unicode characters QUESTION: I am parsing this XML file: Main class is: import java.io.File; import java.io.FileInputStream; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; ...
[ "java", "jvm" ]
0
0
563
2
0
2011-06-05T13:37:57.670000
2011-06-05T13:49:58.123000
6,243,273
6,243,301
Generating classes from Anonymous types in C#
Are there any tools that can generate classes from anonymous types? I have a complex data structure that I have created using anonymous types. I would like to use this data structure in other places where the anonymous type would be out of scope. That's why I'm looking for such a code generation tool.
That's one of the refactorings supported by Resharper. With nested anonymous types (where one anonymous type has properties of another anonymous type), you'll just have to convert the inner types before you get the option to convert the outer one.
Generating classes from Anonymous types in C# Are there any tools that can generate classes from anonymous types? I have a complex data structure that I have created using anonymous types. I would like to use this data structure in other places where the anonymous type would be out of scope. That's why I'm looking for ...
TITLE: Generating classes from Anonymous types in C# QUESTION: Are there any tools that can generate classes from anonymous types? I have a complex data structure that I have created using anonymous types. I would like to use this data structure in other places where the anonymous type would be out of scope. That's wh...
[ "c#", ".net", "visual-studio", "visual-studio-2010", "anonymous-types" ]
28
19
4,325
4
0
2011-06-05T13:38:31.153000
2011-06-05T13:44:16.763000
6,243,274
6,243,994
What kind of information does google gether about my computer when i sign an app?
Google have been suspended my android market account. I will get a new one but i don't want to google relate my new account with suspended one. So my question is what kind of information does google gather about my computer when i sign and upload an app to market? Is a new key for signing all i need?
I don't think Google gathers anything about your computer, at least nothing to identify that you used the same computer that a suspended user did. However, It is possible, I think, that using your key and, for sure, your Google checkout account they can identify who you are. That said, I would recommend resolving your ...
What kind of information does google gether about my computer when i sign an app? Google have been suspended my android market account. I will get a new one but i don't want to google relate my new account with suspended one. So my question is what kind of information does google gather about my computer when i sign an...
TITLE: What kind of information does google gether about my computer when i sign an app? QUESTION: Google have been suspended my android market account. I will get a new one but i don't want to google relate my new account with suspended one. So my question is what kind of information does google gather about my compu...
[ "android", "google-play" ]
3
1
189
1
0
2011-06-05T13:38:32.323000
2011-06-05T15:51:25.373000
6,243,276
6,250,688
How to get the physical interface IP address from an interface
What I have done so far, using PyQt classes: all_Addresses = QNetworkInterface.allAddresses() #list-of-QHostAddress for addr in all_Addresses: print(addr.toString()) Output: 172.16.0.186 - Virtual Interface IP address 192.168.10.2 - Physical interface IP address. I want this one. 127.0.0.1 Using socket: import socket ...
You should use netifaces. It is designed to be cross-platform and contains specialised code for Windows together with a variety of generic versions that work on different UNIX/UNIX-like platforms. As of netifaces version 0.10.0, Python3 is supported. Usage Summary >>> from netifaces import AF_INET, AF_INET6, AF_LINK, A...
How to get the physical interface IP address from an interface What I have done so far, using PyQt classes: all_Addresses = QNetworkInterface.allAddresses() #list-of-QHostAddress for addr in all_Addresses: print(addr.toString()) Output: 172.16.0.186 - Virtual Interface IP address 192.168.10.2 - Physical interface IP a...
TITLE: How to get the physical interface IP address from an interface QUESTION: What I have done so far, using PyQt classes: all_Addresses = QNetworkInterface.allAddresses() #list-of-QHostAddress for addr in all_Addresses: print(addr.toString()) Output: 172.16.0.186 - Virtual Interface IP address 192.168.10.2 - Physi...
[ "python", "python-3.x", "pyqt", "ip-address" ]
25
48
61,872
3
0
2011-06-05T13:38:38.190000
2011-06-06T10:27:48.233000
6,243,286
6,243,312
Wordpress: output post title in lowercase?
I'm mucking around in my wordpress theme's loop_single.php to output the post title in lowercase. My content has non-ascii chars so I thought the following would work: But it does not work. It just outputs the title in the way it's written.
How about just using CSS? h1.post-title { /* or whatever the selector is */ text-transform: lowercase; } https://developer.mozilla.org/en/CSS/text-transform#Values
Wordpress: output post title in lowercase? I'm mucking around in my wordpress theme's loop_single.php to output the post title in lowercase. My content has non-ascii chars so I thought the following would work: But it does not work. It just outputs the title in the way it's written.
TITLE: Wordpress: output post title in lowercase? QUESTION: I'm mucking around in my wordpress theme's loop_single.php to output the post title in lowercase. My content has non-ascii chars so I thought the following would work: But it does not work. It just outputs the title in the way it's written. ANSWER: How about...
[ "php", "css", "wordpress", "wordpress-theming", "custom-wordpress-pages" ]
0
1
1,738
3
0
2011-06-05T13:41:03.240000
2011-06-05T13:46:11.727000
6,243,299
6,243,317
Fancy URL for result page of instant jQuery search script
I have a Google Instant style search script written in jQuery. When the user queries, # SEARCHTERM is added onto my page URL. How can I make it so that my URL is something like #search/ SEARCHTERM /1/? My jQuery code is: $(document).ready(function(){ $("#search").keyup(function(){ var search=$(this).val(); var query=en...
You need to alter window.location.hash=query; so it is window.location.hash="search/" + query; You will also need to alter the function that reads it on page load to remove the "search/". Either use substring() or replace().
Fancy URL for result page of instant jQuery search script I have a Google Instant style search script written in jQuery. When the user queries, # SEARCHTERM is added onto my page URL. How can I make it so that my URL is something like #search/ SEARCHTERM /1/? My jQuery code is: $(document).ready(function(){ $("#search"...
TITLE: Fancy URL for result page of instant jQuery search script QUESTION: I have a Google Instant style search script written in jQuery. When the user queries, # SEARCHTERM is added onto my page URL. How can I make it so that my URL is something like #search/ SEARCHTERM /1/? My jQuery code is: $(document).ready(funct...
[ "javascript", "jquery", "html" ]
0
1
231
1
0
2011-06-05T13:43:58.110000
2011-06-05T13:47:29.463000
6,243,303
6,243,323
Set maximum number of item in Select List - html
How can i set the maximum number of items to be allowed inside a list box? That is if i set the maxsize to 4 and the select list has 4 items then no more value can be inserted! how to do that? [there will be 2 lists, user will be able to move options one to another, but one of them will have the limit]
HTML doesn't offer facilities for this. You've just to add an extra if check in your JS code which moves items from one to other list. E.g. if (list.options.length < list.size) { // Add item. } else { // Show a warning/error? }
Set maximum number of item in Select List - html How can i set the maximum number of items to be allowed inside a list box? That is if i set the maxsize to 4 and the select list has 4 items then no more value can be inserted! how to do that? [there will be 2 lists, user will be able to move options one to another, but ...
TITLE: Set maximum number of item in Select List - html QUESTION: How can i set the maximum number of items to be allowed inside a list box? That is if i set the maxsize to 4 and the select list has 4 items then no more value can be inserted! how to do that? [there will be 2 lists, user will be able to move options on...
[ "javascript", "html" ]
0
2
2,379
1
0
2011-06-05T13:44:30.307000
2011-06-05T13:48:34.010000
6,243,304
6,243,314
Use older version of Rake
I have Rake version 0.9.1 but I need to use 0.8.7 for a project, and I'm fairly certain I have both version installed but it always uses 0.9.1 by default. Is there a way to specify which version of Rake to use? I'm trying to run this: rake db:drop db:create db:migrate db:seed and I get this error: You have already acti...
You can specify the version of Rake to use, in your Gemfile: gem 'rake', '0.8.7' Though the "error" message you are getting says it all... you need to run: bundle exec rake...... in order to use the right rake to run your rake tasks. More info on bundle exec: http://gembundler.com/man/bundle-exec.1.html
Use older version of Rake I have Rake version 0.9.1 but I need to use 0.8.7 for a project, and I'm fairly certain I have both version installed but it always uses 0.9.1 by default. Is there a way to specify which version of Rake to use? I'm trying to run this: rake db:drop db:create db:migrate db:seed and I get this er...
TITLE: Use older version of Rake QUESTION: I have Rake version 0.9.1 but I need to use 0.8.7 for a project, and I'm fairly certain I have both version installed but it always uses 0.9.1 by default. Is there a way to specify which version of Rake to use? I'm trying to run this: rake db:drop db:create db:migrate db:seed...
[ "ruby-on-rails", "ruby", "rake", "version", "switch-statement" ]
14
19
20,621
4
0
2011-06-05T13:44:32.190000
2011-06-05T13:46:34.660000
6,243,327
6,243,515
How to run mplayer with audio speaker output from PHP web script on linux?
I am logged in to linux feora 15 distro with username: stackoverflow. My browser execute in the local system a PHP script to play a music using PHP system("mplayer /tmp/stackoverflow.wav"), passthru("mplayer /tmp/stackoverflow.wav") command. Such as linux command. As a user stackoverflow i dont hear any audio. But i ca...
The direct answer to your question would be to use sudo, as in system("sudo -u mplayer /tmp/itworks.wav") But, I'm not sure this will solve your problem. Firstly, where do you want the sound outputted? The server or the client/browser? The above technique will work on the server. For the browser, you'd need to get the ...
How to run mplayer with audio speaker output from PHP web script on linux? I am logged in to linux feora 15 distro with username: stackoverflow. My browser execute in the local system a PHP script to play a music using PHP system("mplayer /tmp/stackoverflow.wav"), passthru("mplayer /tmp/stackoverflow.wav") command. Suc...
TITLE: How to run mplayer with audio speaker output from PHP web script on linux? QUESTION: I am logged in to linux feora 15 distro with username: stackoverflow. My browser execute in the local system a PHP script to play a music using PHP system("mplayer /tmp/stackoverflow.wav"), passthru("mplayer /tmp/stackoverflow....
[ "php", "linux", "apache", "fedora" ]
1
0
3,889
2
0
2011-06-05T13:49:24.243000
2011-06-05T14:29:43.473000
6,243,338
6,243,592
ModelBinding a generic type in MVC3
In my views I'm using a generic type for the Model, ItemModel. This allows me to have a basetype on my model and it works fine. Within ItemModel I attach the actual entity of T to a property called 'Item'. Let's say I'm loading a User item: in my view I would like to do something like this: <%: Html.TextBoxFor(Model =>...
change method of your actionresult from public ActionResult Login(User user, string redirectUrl) To public ActionResult Login(User Item, string redirectUrl) this way modelbiner will be able to locate properties of User object prefixed with Item
ModelBinding a generic type in MVC3 In my views I'm using a generic type for the Model, ItemModel. This allows me to have a basetype on my model and it works fine. Within ItemModel I attach the actual entity of T to a property called 'Item'. Let's say I'm loading a User item: in my view I would like to do something lik...
TITLE: ModelBinding a generic type in MVC3 QUESTION: In my views I'm using a generic type for the Model, ItemModel. This allows me to have a basetype on my model and it works fine. Within ItemModel I attach the actual entity of T to a property called 'Item'. Let's say I'm loading a User item: in my view I would like t...
[ "asp.net-mvc", "asp.net-mvc-3", "binding" ]
0
0
313
2
0
2011-06-05T13:51:32.417000
2011-06-05T14:42:52.840000
6,243,345
6,243,366
Storing large, complex data structures
I have to store large amounts of complex data. I'm currently using an XML file, because the complexity of the structures doesn't allow me to use a (normal) database to store the data. My question is: Is there any system (similar to a database) able to process/store large amounts of complex data? If not, how can I optim...
You might want to look into document oriented databases, like CouchDB.
Storing large, complex data structures I have to store large amounts of complex data. I'm currently using an XML file, because the complexity of the structures doesn't allow me to use a (normal) database to store the data. My question is: Is there any system (similar to a database) able to process/store large amounts o...
TITLE: Storing large, complex data structures QUESTION: I have to store large amounts of complex data. I'm currently using an XML file, because the complexity of the structures doesn't allow me to use a (normal) database to store the data. My question is: Is there any system (similar to a database) able to process/sto...
[ "xml", "database", "performance", "complexity-theory" ]
2
5
893
3
0
2011-06-05T13:53:34.990000
2011-06-05T13:57:08.343000
6,243,347
6,252,325
Added to existing EmbeddedDocuments in MongoMapper
Take the following MongoMapper documents. class Schedule include MongoMapper::Document key:name, String key:description, String key:active, Boolean many:periods timestamps! userstamps! end class Period include MongoMapper::EmbeddedDocument key:number, Integer key:descriptor, String key:begin, Time key:end, Time en...
Alas, association methods haven't been documented yet on mongomapper.com. But... Use the concat operator, which is defined on associations: s.periods << {:number => 1,:descriptor => "This is a description.",:begin => Time.now,:end => Time.now } You can hand it either a Hash or a document.
Added to existing EmbeddedDocuments in MongoMapper Take the following MongoMapper documents. class Schedule include MongoMapper::Document key:name, String key:description, String key:active, Boolean many:periods timestamps! userstamps! end class Period include MongoMapper::EmbeddedDocument key:number, Integer key:...
TITLE: Added to existing EmbeddedDocuments in MongoMapper QUESTION: Take the following MongoMapper documents. class Schedule include MongoMapper::Document key:name, String key:description, String key:active, Boolean many:periods timestamps! userstamps! end class Period include MongoMapper::EmbeddedDocument key:nu...
[ "ruby", "mongomapper", "padrino" ]
0
1
118
1
0
2011-06-05T13:53:49.187000
2011-06-06T12:55:28.450000
6,243,350
6,243,422
How to 'align' text in RichTextBox C#?
How do I align the text in a RichTextBox? Basically, the RTB contains: "--testing" "--TESTING" "TESTING--" "testing--" Which all have the same number of characters, but have different alignments. How can I align them properly? Im fairly new to C# and confused since it aligned properly in Java's TextArea. Thank you!
You would have to change the font to a monospaced font, like Courier. This behavior you're showing is standard with most fonts, as not all characters are the same width.
How to 'align' text in RichTextBox C#? How do I align the text in a RichTextBox? Basically, the RTB contains: "--testing" "--TESTING" "TESTING--" "testing--" Which all have the same number of characters, but have different alignments. How can I align them properly? Im fairly new to C# and confused since it aligned prop...
TITLE: How to 'align' text in RichTextBox C#? QUESTION: How do I align the text in a RichTextBox? Basically, the RTB contains: "--testing" "--TESTING" "TESTING--" "testing--" Which all have the same number of characters, but have different alignments. How can I align them properly? Im fairly new to C# and confused sin...
[ "c#", "richtextbox", "alignment" ]
16
9
57,920
5
0
2011-06-05T13:54:23.040000
2011-06-05T14:09:43.737000
6,243,352
6,243,371
html anchor tag reference
i have an anchor tag as below. Inside the deleteAttachment, how can i get the anchor tag. Sending this to the method, sends the window element to the method. function deleteAttachment(ancElement){ //Jquery operation on acnElement } Please helop me out.
Use the onclick handler: or, the cleanest and most accepted method nowadays, have just the raw link in the HTML: and add the click event programmatically, in a separate script block, on DOM load: document.getElementByID("deleteAttachment").onclick = function() {... you can use "this" here.... }
html anchor tag reference i have an anchor tag as below. Inside the deleteAttachment, how can i get the anchor tag. Sending this to the method, sends the window element to the method. function deleteAttachment(ancElement){ //Jquery operation on acnElement } Please helop me out.
TITLE: html anchor tag reference QUESTION: i have an anchor tag as below. Inside the deleteAttachment, how can i get the anchor tag. Sending this to the method, sends the window element to the method. function deleteAttachment(ancElement){ //Jquery operation on acnElement } Please helop me out. ANSWER: Use the onclic...
[ "javascript", "html" ]
0
1
485
3
0
2011-06-05T13:54:46.690000
2011-06-05T13:57:41.960000
6,243,357
6,243,429
How to execute a set of commands when exiting a java program?
i want to execute a particular set of commands when the program exits by pressing the cross on the right hand top corner
Depending of what you really want to do, there are few ways to do it: 1) If you want to do it on UI level use WindowListener [link] 2) If you want to do it on JVM level, use ShutdownHooks [link]
How to execute a set of commands when exiting a java program? i want to execute a particular set of commands when the program exits by pressing the cross on the right hand top corner
TITLE: How to execute a set of commands when exiting a java program? QUESTION: i want to execute a particular set of commands when the program exits by pressing the cross on the right hand top corner ANSWER: Depending of what you really want to do, there are few ways to do it: 1) If you want to do it on UI level use ...
[ "java" ]
0
1
91
1
0
2011-06-05T13:55:26.987000
2011-06-05T14:10:35.093000
6,243,358
6,243,387
Filling a NSComboBox with data generated in foreign-class-array
after my last question, regarding accessing an array from a different class, I ran into an new problem, that's giving me a headache for three days now. Everytime I think I have the correct solution approach, I fail. Well... I don't have many experience yet regarding Cocoa Programming. But maybe you are able to give me ...
Are you sure you hooked the combobox correctly? make sure the delegate and the datasource are set to whatever class has the methods implemented.
Filling a NSComboBox with data generated in foreign-class-array after my last question, regarding accessing an array from a different class, I ran into an new problem, that's giving me a headache for three days now. Everytime I think I have the correct solution approach, I fail. Well... I don't have many experience yet...
TITLE: Filling a NSComboBox with data generated in foreign-class-array QUESTION: after my last question, regarding accessing an array from a different class, I ran into an new problem, that's giving me a headache for three days now. Everytime I think I have the correct solution approach, I fail. Well... I don't have m...
[ "arrays", "cocoa", "delegates", "objective-c-2.0", "nscombobox" ]
0
0
675
1
0
2011-06-05T13:55:27.983000
2011-06-05T14:02:21.860000
6,243,359
6,243,468
Java: Halting Program Without Input Prompt
As many of you may know, when you have a while loop (or any loop for that matter) when an input method is called, the program stops and waits for input. e.g. while { String input = in.readLine(); int x = 55; //This will not execute until input has been given a value System.out.println (x + x); } Now I am using buttons ...
I think the problem you're having is how to change what the button does depending on what has been entered into the GUI. Remember that with a GUI, the user can interact with any enabled GUI component at any time and in any order. The key is to check the state of the GUI in your button's ActionListener and then altering...
Java: Halting Program Without Input Prompt As many of you may know, when you have a while loop (or any loop for that matter) when an input method is called, the program stops and waits for input. e.g. while { String input = in.readLine(); int x = 55; //This will not execute until input has been given a value System.out...
TITLE: Java: Halting Program Without Input Prompt QUESTION: As many of you may know, when you have a while loop (or any loop for that matter) when an input method is called, the program stops and waits for input. e.g. while { String input = in.readLine(); int x = 55; //This will not execute until input has been given ...
[ "java", "input", "while-loop", "halt" ]
0
2
313
4
0
2011-06-05T13:55:43.050000
2011-06-05T14:19:24.670000
6,243,361
6,243,379
SQL: After joined table query, put rows with data a both tables first
With 1001 possibilities to use MySQL, I've come up with a requirement for myself that I want to figure out, but don't know how. I also ran a Google Search of course and checked Stack Overflow and MySQL Docs, but I didn't get the answer I was looking for. The situation: I have 2 tables. One called and containing custome...
You need to select a customer progress_field that you can order by so that you add something like order by custer_progress_field desc; at the end of your select statement. For example: SELECT c.filed1, p.field1 FROM customers AS c LEFT JOIN customer_progress AS p ON p.customer_id = c.id AND p.year = 2011 // Joining the...
SQL: After joined table query, put rows with data a both tables first With 1001 possibilities to use MySQL, I've come up with a requirement for myself that I want to figure out, but don't know how. I also ran a Google Search of course and checked Stack Overflow and MySQL Docs, but I didn't get the answer I was looking ...
TITLE: SQL: After joined table query, put rows with data a both tables first QUESTION: With 1001 possibilities to use MySQL, I've come up with a requirement for myself that I want to figure out, but don't know how. I also ran a Google Search of course and checked Stack Overflow and MySQL Docs, but I didn't get the ans...
[ "mysql", "join" ]
1
3
149
2
0
2011-06-05T13:56:35.373000
2011-06-05T14:00:50.963000
6,243,362
6,243,556
how to use extensions from protocol buffers to maintain 'general' message
My client-server communication looks like this: there are some so called annoucements which are seperate messages used to exchange information. The idea is that annoucement is the common part of every message. Actually I suppose it will be the type of the message. The type decide what is the content. In UML class diagr...
There are a number of ways you could do this. I'm not actually sure extensions is the one I would leap for, but: in your message type, you could have a set of fully defined fields for each sub-message, i.e. base-message {1-5} common fields {optional 20} sub-message 1 {optional 21} sub-message 2 {optional 22} sub-messag...
how to use extensions from protocol buffers to maintain 'general' message My client-server communication looks like this: there are some so called annoucements which are seperate messages used to exchange information. The idea is that annoucement is the common part of every message. Actually I suppose it will be the ty...
TITLE: how to use extensions from protocol buffers to maintain 'general' message QUESTION: My client-server communication looks like this: there are some so called annoucements which are seperate messages used to exchange information. The idea is that annoucement is the common part of every message. Actually I suppose...
[ "c#", "c++", "protocol-buffers", "protobuf-net" ]
2
0
1,005
1
0
2011-06-05T13:56:37.137000
2011-06-05T14:36:45.307000
6,243,363
6,243,945
How to Attach File in Android and show specific icon?
I have a application requirement in Android. In my application I want to add files as attachments. This is to have it for quick reference. In my layout I want to have a attach button. If the user clicks on the attach button he should get a file browser to browse the SD CARD. He must be able to select a file to attach. ...
You need an Intent to open up a file chooser. This is assuming the user has a file chooser. int reqCode = 1; Intent action = new Intent(Intent.ACTION_GET_CONTENT); action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(action, reqCode); Note reqCode is like a 'key' you use later. N...
How to Attach File in Android and show specific icon? I have a application requirement in Android. In my application I want to add files as attachments. This is to have it for quick reference. In my layout I want to have a attach button. If the user clicks on the attach button he should get a file browser to browse the...
TITLE: How to Attach File in Android and show specific icon? QUESTION: I have a application requirement in Android. In my application I want to add files as attachments. This is to have it for quick reference. In my layout I want to have a attach button. If the user clicks on the attach button he should get a file bro...
[ "android", "android-layout", "android-browser", "android-file" ]
0
0
2,113
1
0
2011-06-05T13:56:40.027000
2011-06-05T15:44:20.860000
6,243,368
6,243,624
NHibernate 2.1.2 connection open upon factory.OpenSession()?
When I open a session with var session = factory.OpenSession(); and check session.Connection.State it is Open. The "Connection" is of type SqlConnection. This means that by creating the session the connection is automatically opened, which I thought that with NH isn't the case. Shouldn't this be closed until NH determi...
No, what actually happens is that NHibernate creates and opens a connection when you first say session.Connection (if the session didn't already have a connection, of course)
NHibernate 2.1.2 connection open upon factory.OpenSession()? When I open a session with var session = factory.OpenSession(); and check session.Connection.State it is Open. The "Connection" is of type SqlConnection. This means that by creating the session the connection is automatically opened, which I thought that with...
TITLE: NHibernate 2.1.2 connection open upon factory.OpenSession()? QUESTION: When I open a session with var session = factory.OpenSession(); and check session.Connection.State it is Open. The "Connection" is of type SqlConnection. This means that by creating the session the connection is automatically opened, which I...
[ "nhibernate", "connection", "isession" ]
1
2
565
1
0
2011-06-05T13:57:25.360000
2011-06-05T14:49:34.513000
6,243,378
6,243,392
PHP script not echo'ing logs in real time - Was working on my other server
I wasn't sure how to title this thread, sorry. I have a script that processes some logs and I echo a lot of debug information as the process goes. Since moving to the new server, it seems that the script hangs for 30 odd seconds, then spits out all the logging, then hangs again for 30 odd seconds and the process contin...
You may have output_buffering On. Try to disable it first. You can do it either in the php.ini file, in a.htaccess file if your server allows it, or use the following code at the beginning of your PHP script: while (ob_get_level()) ob_end_clean(); Also, use flush() after each echo or print, and it should be all right! ...
PHP script not echo'ing logs in real time - Was working on my other server I wasn't sure how to title this thread, sorry. I have a script that processes some logs and I echo a lot of debug information as the process goes. Since moving to the new server, it seems that the script hangs for 30 odd seconds, then spits out ...
TITLE: PHP script not echo'ing logs in real time - Was working on my other server QUESTION: I wasn't sure how to title this thread, sorry. I have a script that processes some logs and I echo a lot of debug information as the process goes. Since moving to the new server, it seems that the script hangs for 30 odd second...
[ "php" ]
1
4
381
1
0
2011-06-05T14:00:44.847000
2011-06-05T14:04:58.293000
6,243,380
6,243,397
How to block PC to visit your mobile site?
I'm trying to block all the PC, laptops and send them to a blank page or any page that I set it up for a PCs site. I just have a mobile version website and I only want to allow iOS such as iPad, iPod and iPhone to visit my website and block the rest for my security purpose I'm trying to search in here and google I thin...
I would just scan the user-agent. Find the ones that you will accept and then redirect the rest to a non-blank sorry page. A blank page would not be very nice, so a simple sorry would do. I say this because maybe the user has a mobile device to use, but happens to be on a pc. A blank page would make them think that the...
How to block PC to visit your mobile site? I'm trying to block all the PC, laptops and send them to a blank page or any page that I set it up for a PCs site. I just have a mobile version website and I only want to allow iOS such as iPad, iPod and iPhone to visit my website and block the rest for my security purpose I'm...
TITLE: How to block PC to visit your mobile site? QUESTION: I'm trying to block all the PC, laptops and send them to a blank page or any page that I set it up for a PCs site. I just have a mobile version website and I only want to allow iOS such as iPad, iPod and iPhone to visit my website and block the rest for my se...
[ "iphone", "web-applications", "mobile", "web" ]
0
4
644
3
0
2011-06-05T14:00:53.423000
2011-06-05T14:05:55.570000
6,243,381
6,243,418
Is it advisable to declare pointer to heap memory as `const` ALWAYS?
T *p = new T(); For the pointer on heap, there can be disastrous operations such as, p++; // (1) scope missed p = new T(); // (2) re-assignment Which would result in memory leaks or crashes due to wrong delete. Apart from using smart pointers, is it advisable always to make heap pointer a const; T* const p = new T(); /...
I hesitate to say always, but what you propose seems reasonable for many/most cases. Const correctness is something most C++ folks pay a fair bit of attention to in function parameters, but not so much in local (or even member) variables. We might be better off to do so.
Is it advisable to declare pointer to heap memory as `const` ALWAYS? T *p = new T(); For the pointer on heap, there can be disastrous operations such as, p++; // (1) scope missed p = new T(); // (2) re-assignment Which would result in memory leaks or crashes due to wrong delete. Apart from using smart pointers, is it a...
TITLE: Is it advisable to declare pointer to heap memory as `const` ALWAYS? QUESTION: T *p = new T(); For the pointer on heap, there can be disastrous operations such as, p++; // (1) scope missed p = new T(); // (2) re-assignment Which would result in memory leaks or crashes due to wrong delete. Apart from using smart...
[ "c++", "coding-style" ]
10
2
499
4
0
2011-06-05T14:01:27.250000
2011-06-05T14:09:07.463000
6,243,385
6,243,880
C++ performance weirdness w/ OpenGL
I am rewriting some rendering C code in C++. The old C code basically computes everything it needs and renders it at each frame. The new C++ code instead pre-computes what it needs and stores that as a linked list. Now, actual rendering operations are translations, colour changes and calls to GL lists. While executing ...
By spending time in printf, you may be avoiding stalls in your next OpenGL call.
C++ performance weirdness w/ OpenGL I am rewriting some rendering C code in C++. The old C code basically computes everything it needs and renders it at each frame. The new C++ code instead pre-computes what it needs and stores that as a linked list. Now, actual rendering operations are translations, colour changes and...
TITLE: C++ performance weirdness w/ OpenGL QUESTION: I am rewriting some rendering C code in C++. The old C code basically computes everything it needs and renders it at each frame. The new C++ code instead pre-computes what it needs and stores that as a linked list. Now, actual rendering operations are translations, ...
[ "c++", "opengl", "g++", "gprof" ]
0
3
314
2
0
2011-06-05T14:01:46.510000
2011-06-05T15:35:55.737000
6,243,389
6,243,604
get some data of user's friends - Facebook / FQL
I'm creating an app where user will be able to select some of his friends then the app will do some job on the selected friends. My question is =-> Can I directly write this FQL? SELECT uid, name, pic_square FROM user WHERE uid = $friendUID Or Do I need to write something like this? SELECT uid, name, pic_square FROM us...
http://developers.facebook.com/docs/reference/rest/fql.query/ it showed that both are correct
get some data of user's friends - Facebook / FQL I'm creating an app where user will be able to select some of his friends then the app will do some job on the selected friends. My question is =-> Can I directly write this FQL? SELECT uid, name, pic_square FROM user WHERE uid = $friendUID Or Do I need to write somethin...
TITLE: get some data of user's friends - Facebook / FQL QUESTION: I'm creating an app where user will be able to select some of his friends then the app will do some job on the selected friends. My question is =-> Can I directly write this FQL? SELECT uid, name, pic_square FROM user WHERE uid = $friendUID Or Do I need...
[ "facebook", "facebook-graph-api", "facebook-fql", "facebook-friends" ]
0
1
1,546
2
0
2011-06-05T14:03:36.653000
2011-06-05T14:45:17.820000
6,243,394
6,243,476
How deserialize, if lack of some date?
We have two systems: external and internal, which are sharing information in JSON format (GSON library). Information from an external system comes in internal and processed here. Everything was very good, coming from an external system data in JSON format in the internal system data deserialize and processed. For examp...
You can write your own serialization and deserialization methods by overwriting: private void writeObject(java.io.ObjectOutputStream out) throws IOException private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; which enables you to handle those cases yourself. You can still u...
How deserialize, if lack of some date? We have two systems: external and internal, which are sharing information in JSON format (GSON library). Information from an external system comes in internal and processed here. Everything was very good, coming from an external system data in JSON format in the internal system da...
TITLE: How deserialize, if lack of some date? QUESTION: We have two systems: external and internal, which are sharing information in JSON format (GSON library). Information from an external system comes in internal and processed here. Everything was very good, coming from an external system data in JSON format in the ...
[ "java", "class", "object", "deserialization" ]
1
1
240
2
0
2011-06-05T14:05:30.590000
2011-06-05T14:20:37.967000
6,243,395
6,243,410
A question on CSS height
I have an CSS like DIV.header_links { float:right; font-family:"Trebuchet MS" arial; font-size:12px; margin-top:19px; margin-bottom:19px; width:100px; background-color:blue; text-align:center; } Now the tag has a wrapper DIV around it which has height of 50px Is it safe to assume that the inner DIV ie DIV.header_links ...
Is it safe to assume that the inner DIV ie DIV.header_links will not overflow. Yes, as long as it is display: block; (which it is by default) Should margin-top:19px, margin-bottom:19px and font-size:12px give a sum of 50 px? Not necessarily. You can use the value of the overflow property for the header_link div to dete...
A question on CSS height I have an CSS like DIV.header_links { float:right; font-family:"Trebuchet MS" arial; font-size:12px; margin-top:19px; margin-bottom:19px; width:100px; background-color:blue; text-align:center; } Now the tag has a wrapper DIV around it which has height of 50px Is it safe to assume that the inner...
TITLE: A question on CSS height QUESTION: I have an CSS like DIV.header_links { float:right; font-family:"Trebuchet MS" arial; font-size:12px; margin-top:19px; margin-bottom:19px; width:100px; background-color:blue; text-align:center; } Now the tag has a wrapper DIV around it which has height of 50px Is it safe to ass...
[ "html", "css", "height" ]
2
2
144
3
0
2011-06-05T14:05:41.620000
2011-06-05T14:07:48.967000
6,243,396
6,243,589
Expression: _BLOCK_TYPE_ISVAILD(pHead->nBlockUse)
void Connection::Receive(){ socket_.async_read_some(boost::asio::buffer(read_buffer_), boost::bind(&Connection::handle_Receive, shared_from_this(),boost::asio::placeholders::error)); } void Connection::handle_Receive(const boost::system::error_code& error) { if(!error) { if(read_buffer_.size() <=0){ read_buffer_.empty...
You are getting a double delete from casting a uint8_t* that is owned by a boost::array to a std::shared_ptr. ByteBuffer b((std::shared_ptr )read_buffer_.data(), read_buffer_.size()); ^^^^^ Don't do that, a shared_ptr is for pointers with dynamic storage duration.
Expression: _BLOCK_TYPE_ISVAILD(pHead->nBlockUse) void Connection::Receive(){ socket_.async_read_some(boost::asio::buffer(read_buffer_), boost::bind(&Connection::handle_Receive, shared_from_this(),boost::asio::placeholders::error)); } void Connection::handle_Receive(const boost::system::error_code& error) { if(!error)...
TITLE: Expression: _BLOCK_TYPE_ISVAILD(pHead->nBlockUse) QUESTION: void Connection::Receive(){ socket_.async_read_some(boost::asio::buffer(read_buffer_), boost::bind(&Connection::handle_Receive, shared_from_this(),boost::asio::placeholders::error)); } void Connection::handle_Receive(const boost::system::error_code& e...
[ "c++", "scope", "boost-asio" ]
0
0
224
1
0
2011-06-05T14:05:47.900000
2011-06-05T14:41:53.157000
6,243,398
6,245,551
union of complexTypes in XMLSchema
I'm writing a schema and found myself unable to specify an XML schema that allows both icecream and icecream and does not allow (mixed content) blabla icecream hehe I first thought I could achieve this with a choice between elements with same name and a different type, but that failed. I also tried union, but since thi...
In XSD 1.1 you can have a complex type that allows the mixed content, and then restrict it with an assertion, for example:
union of complexTypes in XMLSchema I'm writing a schema and found myself unable to specify an XML schema that allows both icecream and icecream and does not allow (mixed content) blabla icecream hehe I first thought I could achieve this with a choice between elements with same name and a different type, but that failed...
TITLE: union of complexTypes in XMLSchema QUESTION: I'm writing a schema and found myself unable to specify an XML schema that allows both icecream and icecream and does not allow (mixed content) blabla icecream hehe I first thought I could achieve this with a choice between elements with same name and a different typ...
[ "xml", "xsd" ]
2
2
660
2
0
2011-06-05T14:06:04.767000
2011-06-05T20:09:23.820000
6,243,406
6,243,433
JQuery Form Validator plugin not working
I am trying to make my jQuery form validator work. I spent already 5 hours making it work, researching and stuff, but until now I can't. My code is as follows: Insert title here The Book of Joy! Be a part of our team of IT experts. Apply now! Signup now! Applicant Registration Form First Name: Middle Name: Last Name: A...
You forgot to import the plugin's.js files. As per the plugin documentation you should be adding the following lines as well: (and make sure that those files are made available by your webapp as well, i.e. they don't return 404)
JQuery Form Validator plugin not working I am trying to make my jQuery form validator work. I spent already 5 hours making it work, researching and stuff, but until now I can't. My code is as follows: Insert title here The Book of Joy! Be a part of our team of IT experts. Apply now! Signup now! Applicant Registration F...
TITLE: JQuery Form Validator plugin not working QUESTION: I am trying to make my jQuery form validator work. I spent already 5 hours making it work, researching and stuff, but until now I can't. My code is as follows: Insert title here The Book of Joy! Be a part of our team of IT experts. Apply now! Signup now! Applic...
[ "jquery", "html" ]
0
2
6,113
3
0
2011-06-05T14:07:00.257000
2011-06-05T14:12:13.140000
6,243,407
6,243,735
Delete username from a Git repository
I am getting this warning when I try to set my user name in Tower: warning: user.name has multiple values I have checked in a terminal window and found that I have three usernames: macmini:HiBye shannoga$ git config --get-all user.name Shani shani shani How can I delete two of the user names?
Use git config -e and you should see something like: [user] name = Shani name = shani name = shani Delete the lines you don't want.
Delete username from a Git repository I am getting this warning when I try to set my user name in Tower: warning: user.name has multiple values I have checked in a terminal window and found that I have three usernames: macmini:HiBye shannoga$ git config --get-all user.name Shani shani shani How can I delete two of the ...
TITLE: Delete username from a Git repository QUESTION: I am getting this warning when I try to set my user name in Tower: warning: user.name has multiple values I have checked in a terminal window and found that I have three usernames: macmini:HiBye shannoga$ git config --get-all user.name Shani shani shani How can I ...
[ "git", "git-config" ]
33
39
88,072
8
0
2011-06-05T14:07:00.587000
2011-06-05T15:10:06.490000
6,243,411
6,243,542
clipping polygon against rectangle
today I have a (simple) rendering problem for you. My current project gets datas from a file to generate a SVG file. Drawing things as polygon is pretty easy thanks to the SVG format, but I have a single problem: some of my polygons are in AND out of the page (meaning that some parts of them are displayed while the res...
Clipping a polygon with a rectangle. We reduce this problem to clipping a polygon with a line. We reduce this to an even simpler problem: clipping one edge of a polygon with a line. Which is really just Finding the intersection of a line segment with a line (if it exists). The last problem is pretty easy, considering t...
clipping polygon against rectangle today I have a (simple) rendering problem for you. My current project gets datas from a file to generate a SVG file. Drawing things as polygon is pretty easy thanks to the SVG format, but I have a single problem: some of my polygons are in AND out of the page (meaning that some parts ...
TITLE: clipping polygon against rectangle QUESTION: today I have a (simple) rendering problem for you. My current project gets datas from a file to generate a SVG file. Drawing things as polygon is pretty easy thanks to the SVG format, but I have a single problem: some of my polygons are in AND out of the page (meanin...
[ "math", "svg", "polygon", "computational-geometry", "raster" ]
3
4
3,188
1
0
2011-06-05T14:07:56.780000
2011-06-05T14:34:47.990000
6,243,412
6,243,738
Can I insert data unsorted in Red-black tree?
While I'm still struggling to find a solution for this question, i have another one which maybe is easier. The following is the insert function of Okasaki red-black tree implementation. What I want to do is to keep the data unsorted as i insert into the tree. So the data always go to the leftmost/bottom-most leaf every...
you can use my RBTree implementation in haskellDB, http://hackage.haskell.org/package/RBTree using the insert function: insert:: (a -> a -> Ordering) -> RBTree a -> a -> RBTree a feed it a (\_ _ -> LT) function, then you can always put new element into left-most place.
Can I insert data unsorted in Red-black tree? While I'm still struggling to find a solution for this question, i have another one which maybe is easier. The following is the insert function of Okasaki red-black tree implementation. What I want to do is to keep the data unsorted as i insert into the tree. So the data al...
TITLE: Can I insert data unsorted in Red-black tree? QUESTION: While I'm still struggling to find a solution for this question, i have another one which maybe is easier. The following is the insert function of Okasaki red-black tree implementation. What I want to do is to keep the data unsorted as i insert into the tr...
[ "algorithm", "haskell", "red-black-tree" ]
1
1
339
1
0
2011-06-05T14:07:57.107000
2011-06-05T15:10:17.620000
6,243,414
6,243,447
Ways to check if an ArrayList contains only null values
I was looking through the code for an old Android application of mine, and I saw one thing I did to the effect of this: boolean emptyArray = true; for (int i = 0; i < array.size(); i++) { if (array.get(i)!= null) { emptyArray = false; break; } } if (emptyArray == true) { return true; } return false; There has to be a m...
There is no more efficient way. The only thing is you can do, is write it in more elegant way: List l; boolean nonNullElemExist= false; for (Something s: l) { if (s!= null) { nonNullElemExist = true; break; } } // use of nonNullElemExist; Actually, it is possible that this is more efficient, since it uses Iterator an...
Ways to check if an ArrayList contains only null values I was looking through the code for an old Android application of mine, and I saw one thing I did to the effect of this: boolean emptyArray = true; for (int i = 0; i < array.size(); i++) { if (array.get(i)!= null) { emptyArray = false; break; } } if (emptyArray == ...
TITLE: Ways to check if an ArrayList contains only null values QUESTION: I was looking through the code for an old Android application of mine, and I saw one thing I did to the effect of this: boolean emptyArray = true; for (int i = 0; i < array.size(); i++) { if (array.get(i)!= null) { emptyArray = false; break; } } ...
[ "java", "android" ]
13
6
38,125
5
0
2011-06-05T14:08:26.240000
2011-06-05T14:15:23.453000
6,243,416
6,243,615
Does onDraw() calls automatically except on loading and when calling a invalidate()?
I wanted to know whether the onDraw method get called without the programmers knowledge. I know that it is called at the first time View is loading and I know it calls when I call invaliade(). But does it calls in any other times?
Yes, whenever a parent view is redrawing itself like if the custom view is within a ScrollView whenever you scroll it...
Does onDraw() calls automatically except on loading and when calling a invalidate()? I wanted to know whether the onDraw method get called without the programmers knowledge. I know that it is called at the first time View is loading and I know it calls when I call invaliade(). But does it calls in any other times?
TITLE: Does onDraw() calls automatically except on loading and when calling a invalidate()? QUESTION: I wanted to know whether the onDraw method get called without the programmers knowledge. I know that it is called at the first time View is loading and I know it calls when I call invaliade(). But does it calls in any...
[ "android" ]
0
1
348
1
0
2011-06-05T14:08:45.003000
2011-06-05T14:47:25.920000
6,243,430
6,243,455
How can i make the php cos function return the correct value?
I've tried $x = cos(deg2rad($angle)); but it returns 6.12323399574E-17 when the angle is 90 degrees instead of 0. I read that this is a floating point problem, but is there a workaround?
6.1E-17 is almost zero anyway[*]. If you need to actually compare the result to zero, in floating point math you should check that it's within a certain tolerance of the desired value, since most numbers can't be represented correctly. $x = cos(deg2rad($angle)); $is_zero = (abs($x) < 1e-10); Strictly speaking, of cours...
How can i make the php cos function return the correct value? I've tried $x = cos(deg2rad($angle)); but it returns 6.12323399574E-17 when the angle is 90 degrees instead of 0. I read that this is a floating point problem, but is there a workaround?
TITLE: How can i make the php cos function return the correct value? QUESTION: I've tried $x = cos(deg2rad($angle)); but it returns 6.12323399574E-17 when the angle is 90 degrees instead of 0. I read that this is a floating point problem, but is there a workaround? ANSWER: 6.1E-17 is almost zero anyway[*]. If you nee...
[ "php", "floating-point", "trigonometry" ]
5
10
1,457
3
0
2011-06-05T14:10:36.077000
2011-06-05T14:17:18.247000
6,243,431
6,254,568
Is Spring Roo the right tool for me? (See list of requirements in post)
I watched some videos, demos of Roo and I kind of liked it. However before starting using it, I'd like to ask few things more experienced programmers with Roo. Roo uses lot of AOP. Is it okay to write custom Java code and let Roo generated files just "be alone"? Or does whole Roo structure require some AOP knowledge. I...
Here are the answers per my knowledge of Roo: 1.Roo uses lot of AOP. Is it okay to write custom Java code and let Roo generated files just "be alone"? Or does whole Roo structure require some AOP knowledge. In other words, if I want to customize Roo project (add non CRUD functions), do I need to mess with AOP? No, you ...
Is Spring Roo the right tool for me? (See list of requirements in post) I watched some videos, demos of Roo and I kind of liked it. However before starting using it, I'd like to ask few things more experienced programmers with Roo. Roo uses lot of AOP. Is it okay to write custom Java code and let Roo generated files ju...
TITLE: Is Spring Roo the right tool for me? (See list of requirements in post) QUESTION: I watched some videos, demos of Roo and I kind of liked it. However before starting using it, I'd like to ask few things more experienced programmers with Roo. Roo uses lot of AOP. Is it okay to write custom Java code and let Roo ...
[ "java", "jsf", "gwt", "spring-roo" ]
4
3
488
1
0
2011-06-05T14:11:09.513000
2011-06-06T15:47:01.833000
6,243,440
6,243,519
Regex Captures in Java like in C#
I have a to rewrite a part of an existing C#/.NET program using Java. I'm not that fluent in Java and am missing something handling regular expressions and just wanted to know if I'm missing something or if Java just doesn't provide such feature. I have data like 2011:06:05 15:50\t0.478\t0.209\t0.211\t0.211\t0.205\t-0....
As I mentioned in the comments, Java will only return the last value of a multiple valued group fit. So you should first use regex to isolate the last part of your string with the values: strg = "0.478\t0.209\t0.211\t0.211\t0.205\t-0.462\t0.203\t0.202\t0.212" and then just split around the tabs: String[] values = strg....
Regex Captures in Java like in C# I have a to rewrite a part of an existing C#/.NET program using Java. I'm not that fluent in Java and am missing something handling regular expressions and just wanted to know if I'm missing something or if Java just doesn't provide such feature. I have data like 2011:06:05 15:50\t0.47...
TITLE: Regex Captures in Java like in C# QUESTION: I have a to rewrite a part of an existing C#/.NET program using Java. I'm not that fluent in Java and am missing something handling regular expressions and just wanted to know if I'm missing something or if Java just doesn't provide such feature. I have data like 2011...
[ "java", "c#", "regex", "capture", "regex-group" ]
5
3
257
1
0
2011-06-05T14:14:36.853000
2011-06-05T14:30:04.077000
6,243,443
6,243,647
How to dismiss SearchManager after search
how I am trying to dismiss the SearchManager in an android application after I finish fetching data, how I can do that? for now I am touching the list view to hide the search bar and the keyboard. http://www.ideasandroid.com/android/sdk/docs/images/search/search-suggest-custom.png
Tried calling stopSearch() after you've loaded your results? http://developer.android.com/reference/android/app/SearchManager.html#stopSearch()
How to dismiss SearchManager after search how I am trying to dismiss the SearchManager in an android application after I finish fetching data, how I can do that? for now I am touching the list view to hide the search bar and the keyboard. http://www.ideasandroid.com/android/sdk/docs/images/search/search-suggest-custom....
TITLE: How to dismiss SearchManager after search QUESTION: how I am trying to dismiss the SearchManager in an android application after I finish fetching data, how I can do that? for now I am touching the list view to hide the search bar and the keyboard. http://www.ideasandroid.com/android/sdk/docs/images/search/sear...
[ "java", "android", "android-searchmanager" ]
0
1
644
1
0
2011-06-05T14:15:00.387000
2011-06-05T14:54:42.990000
6,243,446
6,243,755
How to store a simple key string inside Java KeyStore?
I have a file on my FS (a S3 AWS key) that contains a string that is a key I use for encryption process. I would like to move it a Java KeyStore. I know how to import a certificate into a KeyStore with keytool but I can't find the way to import a simple string key. Can you help?
I don't see a way to do it with keytool, but some poking about, I wonder if you could store and retrieve it in code as a PasswordBasedEncryption (PBE) SecretKey. (Disclaimer: I haven't tried this myself). The resources that drove this thought: PBEKeySpec javadoc and CryptoSpec - Using Password Based Encryption example
How to store a simple key string inside Java KeyStore? I have a file on my FS (a S3 AWS key) that contains a string that is a key I use for encryption process. I would like to move it a Java KeyStore. I know how to import a certificate into a KeyStore with keytool but I can't find the way to import a simple string key....
TITLE: How to store a simple key string inside Java KeyStore? QUESTION: I have a file on my FS (a S3 AWS key) that contains a string that is a key I use for encryption process. I would like to move it a Java KeyStore. I know how to import a certificate into a KeyStore with keytool but I can't find the way to import a ...
[ "java", "keystore" ]
15
5
29,016
5
0
2011-06-05T14:15:07.290000
2011-06-05T15:12:50.297000
6,243,451
6,243,640
how to avoid polling in pthreads
I've got some code that currently looks like this (simplified) /* instance in global var *mystruct, count initialized to 0 */ typedef struct { volatile unsigned int count; } mystruct_t; pthread_mutex_t mymutex; // is initialized /* one thread, goal: block while mystruct->count == 0 */ void x(void *n) { while(1) { pth...
A general solution is to use a POSIX semaphore. These are not part of the pthread library but work with pthreads just the same. Since semaphores are provided in most other multi-threading APIs, it is a general technique that may be applied perhaps more portably; however perhaps more appropriate in this instance is a co...
how to avoid polling in pthreads I've got some code that currently looks like this (simplified) /* instance in global var *mystruct, count initialized to 0 */ typedef struct { volatile unsigned int count; } mystruct_t; pthread_mutex_t mymutex; // is initialized /* one thread, goal: block while mystruct->count == 0 */...
TITLE: how to avoid polling in pthreads QUESTION: I've got some code that currently looks like this (simplified) /* instance in global var *mystruct, count initialized to 0 */ typedef struct { volatile unsigned int count; } mystruct_t; pthread_mutex_t mymutex; // is initialized /* one thread, goal: block while mystr...
[ "c", "multithreading", "pthreads", "posix" ]
4
3
2,377
5
0
2011-06-05T14:16:10.567000
2011-06-05T14:52:35.953000
6,243,454
6,243,537
query object in multidimensional array that does not exist
I have this array: ---!map:ActiveSupport::HashWithIndifferentAccess search:!map:ActiveSupport::HashWithIndifferentAccess address: test I apply the following to it: address = params['search']['address'] if address # do something end If there is no search object and no address object, this code raises an error: You have ...
Firstly... [...] for example i have this array: Just to clarify that it is actually a specialised Hash. Secondly... You can do something like this: if params[:search] and params[:search][:address] # do something with address else # no value given end
query object in multidimensional array that does not exist I have this array: ---!map:ActiveSupport::HashWithIndifferentAccess search:!map:ActiveSupport::HashWithIndifferentAccess address: test I apply the following to it: address = params['search']['address'] if address # do something end If there is no search object ...
TITLE: query object in multidimensional array that does not exist QUESTION: I have this array: ---!map:ActiveSupport::HashWithIndifferentAccess search:!map:ActiveSupport::HashWithIndifferentAccess address: test I apply the following to it: address = params['search']['address'] if address # do something end If there is...
[ "ruby", "hash" ]
0
2
182
1
0
2011-06-05T14:17:16.830000
2011-06-05T14:32:44.580000
6,243,460
6,243,470
Python lambda function
What is happening here? reduce(lambda x,y: x+y, [x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0]) I understand how x is iterating through all of the numbers from 1 to 999 and taking out those that are divisible by 3 or 5, but the 'lambda x,y: x+y' part is stumping me.
This is bad Python for sum(x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0) It simply sums all numbers in the range 1..999 divisible by 3 or 5. reduce() applies the given function to the first two items of the iterable, then to the result and the next item of the iterable, and so on. In this example, the function ...
Python lambda function What is happening here? reduce(lambda x,y: x+y, [x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0]) I understand how x is iterating through all of the numbers from 1 to 999 and taking out those that are divisible by 3 or 5, but the 'lambda x,y: x+y' part is stumping me.
TITLE: Python lambda function QUESTION: What is happening here? reduce(lambda x,y: x+y, [x for x in range(1,1000) if x % 3 == 0 or x % 5 == 0]) I understand how x is iterating through all of the numbers from 1 to 999 and taking out those that are divisible by 3 or 5, but the 'lambda x,y: x+y' part is stumping me. ANS...
[ "python", "lambda" ]
17
18
19,509
3
0
2011-06-05T14:17:59.247000
2011-06-05T14:19:31.040000
6,243,467
6,257,170
Scala and Mockito with traits
I had a simple class that naturally divided into two parts, so I refactored as class Refactored extends PartOne with PartTwo Then the unit tests started failing. Below is an attempt to recreate the problem. The functionality of all three examples is the same, but the third test fails with a NullPointerException as indi...
Seems Mockito has some kind of problem seeing the relationship between class and trait. Guess this is not that strange since traits are not native in Java. It works if you mock the trait itself directly, but this is maybe not what you want to do? With several different traits you would need one mock for each: @Test def...
Scala and Mockito with traits I had a simple class that naturally divided into two parts, so I refactored as class Refactored extends PartOne with PartTwo Then the unit tests started failing. Below is an attempt to recreate the problem. The functionality of all three examples is the same, but the third test fails with ...
TITLE: Scala and Mockito with traits QUESTION: I had a simple class that naturally divided into two parts, so I refactored as class Refactored extends PartOne with PartTwo Then the unit tests started failing. Below is an attempt to recreate the problem. The functionality of all three examples is the same, but the thir...
[ "unit-testing", "scala", "mockito", "scalatest" ]
7
7
13,497
1
0
2011-06-05T14:19:06.593000
2011-06-06T19:45:15.217000
6,243,472
6,243,694
Cancel AlarmManager which was set in Service
folks! I have Service, which checks in onStartCommand() whether auto update was set in user preferences and sets AlarmManager update time if needed. So, I want to acomplish following: consider that AlarmManager is alread set, and user turns auto update off, I want to cancel the alarm. The only idea I have is to broadca...
A broadcast is definitely the best way to communicate between an activity/widget and a service.
Cancel AlarmManager which was set in Service folks! I have Service, which checks in onStartCommand() whether auto update was set in user preferences and sets AlarmManager update time if needed. So, I want to acomplish following: consider that AlarmManager is alread set, and user turns auto update off, I want to cancel ...
TITLE: Cancel AlarmManager which was set in Service QUESTION: folks! I have Service, which checks in onStartCommand() whether auto update was set in user preferences and sets AlarmManager update time if needed. So, I want to acomplish following: consider that AlarmManager is alread set, and user turns auto update off,...
[ "android" ]
1
2
251
1
0
2011-06-05T14:20:02.297000
2011-06-05T15:03:34.233000
6,243,473
6,243,486
Rails 3 show text field unless it has just "@"
In my Rails 3 web app, I have a Twitter text field in one of the forms and on the user page it displays it. <%= f.label:twitter, "Twitter Username" %> <%= f.text_field:twitter,:value => "@" %> And on the user page: <% if @user.twitter? %> <%= @user.twitter %> <% end %> The problem is, when a user doesn't enter their Tw...
Looks like the @ value gets persisted into the database if the user doesn't specify a twitter name, right? Are you sure you want that? You could, in the controller, when saving the user, do something like: user.twitter = params[:user][:twitter] unless params[:user][:twitter] == "@" This will ensure that the User#twitte...
Rails 3 show text field unless it has just "@" In my Rails 3 web app, I have a Twitter text field in one of the forms and on the user page it displays it. <%= f.label:twitter, "Twitter Username" %> <%= f.text_field:twitter,:value => "@" %> And on the user page: <% if @user.twitter? %> <%= @user.twitter %> <% end %> The...
TITLE: Rails 3 show text field unless it has just "@" QUESTION: In my Rails 3 web app, I have a Twitter text field in one of the forms and on the user page it displays it. <%= f.label:twitter, "Twitter Username" %> <%= f.text_field:twitter,:value => "@" %> And on the user page: <% if @user.twitter? %> <%= @user.twitte...
[ "ruby-on-rails-3", "textfield" ]
1
2
524
1
0
2011-06-05T14:20:03.507000
2011-06-05T14:23:26.547000
6,243,478
6,244,033
Django model aggregation
I have a simple hierarchic model whit a Person and RunningScore as child. this model store data about running score of many user, simplified something like: class Person(models.Model): firstName = models.CharField(max_length=200) lastName = models.CharField(max_length=200) class RunningScore(models.Model): person = mo...
I am not 100% sure if I get what you mean, but maybe this will help: from django.db.models import Min Person.objects.annotate(min_running_time=Min('time')) The queryset will fetch Person objects with min_running_time additional attribute. You can also add a filter: Person.objects.annotate(min_running_time=Min('time'))....
Django model aggregation I have a simple hierarchic model whit a Person and RunningScore as child. this model store data about running score of many user, simplified something like: class Person(models.Model): firstName = models.CharField(max_length=200) lastName = models.CharField(max_length=200) class RunningScore(m...
TITLE: Django model aggregation QUESTION: I have a simple hierarchic model whit a Person and RunningScore as child. this model store data about running score of many user, simplified something like: class Person(models.Model): firstName = models.CharField(max_length=200) lastName = models.CharField(max_length=200) cl...
[ "django", "django-models", "django-aggregation" ]
1
0
620
2
0
2011-06-05T14:20:58.030000
2011-06-05T15:59:36.733000
6,243,481
6,243,648
Post html with dojo RadioButton
I have an html form with: male female My problem is that when I post this form, there is always gender=on in post url, regardless of whether male or female is selected. What can I do to get checked information? And what's the difference between "selected" and "checked" with dijit.form.RadioButton?
You can try It may affect post information. Hopefully, it helps you.
Post html with dojo RadioButton I have an html form with: male female My problem is that when I post this form, there is always gender=on in post url, regardless of whether male or female is selected. What can I do to get checked information? And what's the difference between "selected" and "checked" with dijit.form.Ra...
TITLE: Post html with dojo RadioButton QUESTION: I have an html form with: male female My problem is that when I post this form, there is always gender=on in post url, regardless of whether male or female is selected. What can I do to get checked information? And what's the difference between "selected" and "checked" ...
[ "html", "http-post", "dojo" ]
2
1
392
1
0
2011-06-05T14:21:35.330000
2011-06-05T14:54:51.670000
6,243,487
6,243,506
Initialisation lists in constructors trying to initialize a structure
g++ (GCC) 4.6.0 I have the following class and I am trying to initialize in my initialization list of my constructor. class Floor_plan { private: unsigned int width; unsigned int height; struct floor_size { unsigned int x; unsigned int y; } floor; public: Floor_plan(): width(0), height(0), floor.x(0), floor.y(0) {} {...
See default init value for struct member of a class Either you initialize it inside the constructor Floor_plan(): width(0), height(0), floor() { floor.x = 1; floor.y = 2; } Or you create a constructor for the struct, and use that in the initialization list. struct floor_size { unsigned int x; unsigned int y; floor_size...
Initialisation lists in constructors trying to initialize a structure g++ (GCC) 4.6.0 I have the following class and I am trying to initialize in my initialization list of my constructor. class Floor_plan { private: unsigned int width; unsigned int height; struct floor_size { unsigned int x; unsigned int y; } floor; ...
TITLE: Initialisation lists in constructors trying to initialize a structure QUESTION: g++ (GCC) 4.6.0 I have the following class and I am trying to initialize in my initialization list of my constructor. class Floor_plan { private: unsigned int width; unsigned int height; struct floor_size { unsigned int x; unsigne...
[ "c++" ]
7
4
3,394
6
0
2011-06-05T14:23:47.947000
2011-06-05T14:27:55.110000
6,243,489
6,243,527
I fear that arc4random has betrayed me
I have code that pics a random number from 0 to 1. I am seeing that the number 1 is coming up far more times then the number 0 then I would think to be statistically possible. This is my code: int shipNumber = arc4random() % 2; Should this code work? Am I just going crazy?
That code should work. What I suspect you're seeing is truly random (or, at least, sufficiently random) and your brain is trying to find patterns. (Everybody's brain tries to find patterns everywhere. That's how you're reading this. The issue is there are no patterns in randomness [that being pretty much the definition...
I fear that arc4random has betrayed me I have code that pics a random number from 0 to 1. I am seeing that the number 1 is coming up far more times then the number 0 then I would think to be statistically possible. This is my code: int shipNumber = arc4random() % 2; Should this code work? Am I just going crazy?
TITLE: I fear that arc4random has betrayed me QUESTION: I have code that pics a random number from 0 to 1. I am seeing that the number 1 is coming up far more times then the number 0 then I would think to be statistically possible. This is my code: int shipNumber = arc4random() % 2; Should this code work? Am I just go...
[ "iphone", "objective-c", "cocos2d-iphone", "arc4random" ]
6
5
962
2
0
2011-06-05T14:24:03.567000
2011-06-05T14:31:15.040000
6,243,490
6,247,278
How to create indeed.com like search?
If you have used indeed.com before, you may know that for the keywords you look for, it returns a traditional search results as long as multiple search refinement options on the left side of screen. For example, searching for keyword "designer", the refinement options are: Salary Estimate $40,000+ (45982) $60,000+ (297...
The technology used in Indeed.com and other search engines is known as inverted indexing which is at the core of how search engines work (e.g Google). The filtering you refer to ("refinement options") are known as facets. You can use Apache Solr, a full-fledged search server built using Lucene and easily integrable int...
How to create indeed.com like search? If you have used indeed.com before, you may know that for the keywords you look for, it returns a traditional search results as long as multiple search refinement options on the left side of screen. For example, searching for keyword "designer", the refinement options are: Salary E...
TITLE: How to create indeed.com like search? QUESTION: If you have used indeed.com before, you may know that for the keywords you look for, it returns a traditional search results as long as multiple search refinement options on the left side of screen. For example, searching for keyword "designer", the refinement opt...
[ "mysql", "sql", "search", "search-engine", "reverse" ]
4
5
3,509
3
0
2011-06-05T14:24:21.460000
2011-06-06T02:15:38.570000
6,243,497
6,257,780
Sort by most recent date and cluster (group) similar titles
Looking for LINQ needed to sort on a date field but also have similar titles grouped and sorted. Consider something like the following desired ordering: Title Date "Some Title 1/3" 2009/1/3 "note1: even this is old title 3/3 causes this group to be 1st" "Some Title 2/3" 2011/1/31 "note2: dates may not be in sequence wi...
Normal grouping in LINQ (and in SQL, but that's not relevant here) works by selecting some key for every element in the collection. You don't have such key, so I wouldn't use LINQ, but two nested foreach es: var groups = new List >(); foreach (var book in books) { bool found = false; foreach (var g in groups) { if (s...
Sort by most recent date and cluster (group) similar titles Looking for LINQ needed to sort on a date field but also have similar titles grouped and sorted. Consider something like the following desired ordering: Title Date "Some Title 1/3" 2009/1/3 "note1: even this is old title 3/3 causes this group to be 1st" "Some ...
TITLE: Sort by most recent date and cluster (group) similar titles QUESTION: Looking for LINQ needed to sort on a date field but also have similar titles grouped and sorted. Consider something like the following desired ordering: Title Date "Some Title 1/3" 2009/1/3 "note1: even this is old title 3/3 causes this group...
[ "c#", "linq", "sorting", "lambda", "group-by" ]
2
0
660
3
0
2011-06-05T14:26:22.677000
2011-06-06T20:40:36.307000
6,243,520
6,243,538
Extracting data from an XML document without using an XML parser
Here's some lines of the document: Technical Fouls Players DAL None MIA Mike Miller Mike Miller, Jr. I'm interested in extracting the None and Mike Miller and Mike Miller, Jr. from this. I tried using various XML parsers, but 1) the performance is abysmal and 2) the document is apparently not a properly formatted XML d...
Relevant HTML generally isn't properly formatted XML, I suggest you use something like the HTML Agility pack
Extracting data from an XML document without using an XML parser Here's some lines of the document: Technical Fouls Players DAL None MIA Mike Miller Mike Miller, Jr. I'm interested in extracting the None and Mike Miller and Mike Miller, Jr. from this. I tried using various XML parsers, but 1) the performance is abysmal...
TITLE: Extracting data from an XML document without using an XML parser QUESTION: Here's some lines of the document: Technical Fouls Players DAL None MIA Mike Miller Mike Miller, Jr. I'm interested in extracting the None and Mike Miller and Mike Miller, Jr. from this. I tried using various XML parsers, but 1) the perf...
[ "c#", "xml", "regex" ]
2
3
139
2
0
2011-06-05T14:30:10.587000
2011-06-05T14:33:02.210000
6,243,528
6,243,571
Order of data in SQLite database
If I was to insert lots of rows into an empty table without primary key, nor any indexes. Varying number of rows might be inserted per transaction. Could I then be sure that a SELECT * FROM the_table; would retrieve the data in the same order on both Linux and Windows?
No, you cannot and should never rely on the order of rows in a result set from a query that does not have ordering constraints. Even on the same platform, same database. Even if it works in your tests. Things like VACCUM ing your database (or some of the auto_vaccum modes I think) could change the relative block layout...
Order of data in SQLite database If I was to insert lots of rows into an empty table without primary key, nor any indexes. Varying number of rows might be inserted per transaction. Could I then be sure that a SELECT * FROM the_table; would retrieve the data in the same order on both Linux and Windows?
TITLE: Order of data in SQLite database QUESTION: If I was to insert lots of rows into an empty table without primary key, nor any indexes. Varying number of rows might be inserted per transaction. Could I then be sure that a SELECT * FROM the_table; would retrieve the data in the same order on both Linux and Windows?...
[ "sqlite" ]
1
3
1,491
1
0
2011-06-05T14:31:34.253000
2011-06-05T14:39:23.013000
6,243,529
6,243,578
ManagementScope and "root\cimv2"?
To create a ManagementScope object you have to pass a string to the constructor which is either an IP address or the name of a PC. What I don't get is what the last part is for: ManagementScope ms = new ManagementScope(@"FullComputerName\root\cimv2"); ^^^^^^^^^^ What is this? What does root\cimv2 stand for? Where does ...
I think you're looking at this MSDN page. That input parameter is the full path, meaning the folders leading to the file. That particular path is the default namespace for WMI classes.
ManagementScope and "root\cimv2"? To create a ManagementScope object you have to pass a string to the constructor which is either an IP address or the name of a PC. What I don't get is what the last part is for: ManagementScope ms = new ManagementScope(@"FullComputerName\root\cimv2"); ^^^^^^^^^^ What is this? What does...
TITLE: ManagementScope and "root\cimv2"? QUESTION: To create a ManagementScope object you have to pass a string to the constructor which is either an IP address or the name of a PC. What I don't get is what the last part is for: ManagementScope ms = new ManagementScope(@"FullComputerName\root\cimv2"); ^^^^^^^^^^ What ...
[ "c#" ]
17
7
23,563
2
0
2011-06-05T14:31:38.483000
2011-06-05T14:40:16.857000
6,243,536
6,243,577
using repaint() method in this code
I am having a problem using the repaint method in the following code.Please suggest how to use repaint method so that my screen is updated for a small animation. This is my code: import javax.swing.*; import java.awt.*; import java.awt.event.*; class movingObjects extends JPanel { Timer timer; int x = 2, y = 2, width ...
Don't try to delay the actual painting. The component needs to be painted when it is asked to be painted. Instead, use your timer to modify some state in MovingObjects. In your case the state you want to change is x, y, width and height. When your timer fires, increment those values and call repaint(). Then in your pai...
using repaint() method in this code I am having a problem using the repaint method in the following code.Please suggest how to use repaint method so that my screen is updated for a small animation. This is my code: import javax.swing.*; import java.awt.*; import java.awt.event.*; class movingObjects extends JPanel { T...
TITLE: using repaint() method in this code QUESTION: I am having a problem using the repaint method in the following code.Please suggest how to use repaint method so that my screen is updated for a small animation. This is my code: import javax.swing.*; import java.awt.*; import java.awt.event.*; class movingObjects ...
[ "java", "swing", "user-interface", "graphics" ]
1
2
2,057
1
0
2011-06-05T14:32:39.153000
2011-06-05T14:40:04.063000
6,243,539
6,243,608
Scrolling with mouse scroll wheel doesn't trigger jQuery hover or mouseover
I have an unordered list with each list item background changing color when the mouse hovers over it. If the mouse does not move and the scroll wheel is scrolled down the cursor floats above different list items but the hover class through jQuery is not triggered. Why is this? How do I solve the problem? Here is the co...
Check out the mousewheel plugin by Brandon Aaron: A jQuery plugin that adds cross-browser mouse wheel support. // using bind $('#my_elem').bind('mousewheel', function(event, delta) { console.log(delta); }); // using the event helper $('#my_elem').mousewheel(function(event, delta) { console.log(delta); });
Scrolling with mouse scroll wheel doesn't trigger jQuery hover or mouseover I have an unordered list with each list item background changing color when the mouse hovers over it. If the mouse does not move and the scroll wheel is scrolled down the cursor floats above different list items but the hover class through jQue...
TITLE: Scrolling with mouse scroll wheel doesn't trigger jQuery hover or mouseover QUESTION: I have an unordered list with each list item background changing color when the mouse hovers over it. If the mouse does not move and the scroll wheel is scrolled down the cursor floats above different list items but the hover ...
[ "jquery", "scroll", "hover" ]
3
0
2,915
2
0
2011-06-05T14:33:03.297000
2011-06-05T14:45:50.283000
6,243,546
6,243,626
adding conditional requiredFieldValidators to dynamically created form in c# asp.net
Ok, i have a fully rendered dynamic form ( i do not know the content of the form, it is provided to my via a webservice ) i used asp.net RequiredFieldValidator for validation, because i read in this article that we could dynamically switch validators on and off depending if the field is visible or not with the Validato...
Maybe a better approach would be to loop through the client-side array of validators ( Page_Validators ) and find the validator which you want to disable. See also this MSDN page and this codeproject article for more information.
adding conditional requiredFieldValidators to dynamically created form in c# asp.net Ok, i have a fully rendered dynamic form ( i do not know the content of the form, it is provided to my via a webservice ) i used asp.net RequiredFieldValidator for validation, because i read in this article that we could dynamically sw...
TITLE: adding conditional requiredFieldValidators to dynamically created form in c# asp.net QUESTION: Ok, i have a fully rendered dynamic form ( i do not know the content of the form, it is provided to my via a webservice ) i used asp.net RequiredFieldValidator for validation, because i read in this article that we co...
[ "c#", "jquery", "asp.net", "validation" ]
2
1
1,272
2
0
2011-06-05T14:35:12.973000
2011-06-05T14:49:36.037000
6,243,549
6,243,588
Problems with repaint in gui
The first time a choose a image, it works just fine. But it does not work when I try to change it, the first image remains on the screen. label = new JLabel(""); panel_1.add(label); btnAddImage = new JButton("Select Image"); btnAddImage.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEven...
If you want to replace the existing label, replace label = new JLabel(new ImageIcon(bi)); label.setBounds(0, 68, 98, 92); panel_1.add(label); panel_1.repaint(); with label.setIcon(new ImageIcon(bi)); label.setBounds(0, 68, 98, 92); panel_1.revalidate(); Or if you want to add a second label, just replace label = new JLa...
Problems with repaint in gui The first time a choose a image, it works just fine. But it does not work when I try to change it, the first image remains on the screen. label = new JLabel(""); panel_1.add(label); btnAddImage = new JButton("Select Image"); btnAddImage.addMouseListener(new MouseAdapter() { @Override publi...
TITLE: Problems with repaint in gui QUESTION: The first time a choose a image, it works just fine. But it does not work when I try to change it, the first image remains on the screen. label = new JLabel(""); panel_1.add(label); btnAddImage = new JButton("Select Image"); btnAddImage.addMouseListener(new MouseAdapter()...
[ "java", "image", "swing", "user-interface", "repaint" ]
0
2
435
1
0
2011-06-05T14:35:35.763000
2011-06-05T14:41:45.110000
6,243,551
6,243,627
iphone popup custom size in IB
In my application I need show some info popup. This is just a text message above an image. When I create UIView for my popup in IB, it's size is non-ediatable (and equals to 320x460). But my popup is not full-screen size. Of course, I can create this popup programmatically, but I'd prefer data-driven approach. So, the ...
If you set status bar of the view to none then you should be able to resize the view.
iphone popup custom size in IB In my application I need show some info popup. This is just a text message above an image. When I create UIView for my popup in IB, it's size is non-ediatable (and equals to 320x460). But my popup is not full-screen size. Of course, I can create this popup programmatically, but I'd prefer...
TITLE: iphone popup custom size in IB QUESTION: In my application I need show some info popup. This is just a text message above an image. When I create UIView for my popup in IB, it's size is non-ediatable (and equals to 320x460). But my popup is not full-screen size. Of course, I can create this popup programmatical...
[ "iphone", "uiview", "popup", "size" ]
0
2
592
2
0
2011-06-05T14:36:07.123000
2011-06-05T14:49:37.117000
6,243,554
6,243,568
JQuery - how do i detect how many divs of a given class exist within a given div?
I have a div like this: and contained within this div I have several divs like this: etc. QUESTION 1: How do I detect how many of these divs (class="y") are contained within the container div (class="x")? - (just an alert("") with the number, for example). QUESTION 2: How do I do something to each of these y-divs (clas...
You need to find the elements within the ancestor element. $('#x div.y').length; // number of class y elements under element x $('#x div.y').html('Y'); // run a jQuery method on the y elements See the API: descendant selector length property
JQuery - how do i detect how many divs of a given class exist within a given div? I have a div like this: and contained within this div I have several divs like this: etc. QUESTION 1: How do I detect how many of these divs (class="y") are contained within the container div (class="x")? - (just an alert("") with the num...
TITLE: JQuery - how do i detect how many divs of a given class exist within a given div? QUESTION: I have a div like this: and contained within this div I have several divs like this: etc. QUESTION 1: How do I detect how many of these divs (class="y") are contained within the container div (class="x")? - (just an aler...
[ "jquery", "html", "detect" ]
3
6
2,894
5
0
2011-06-05T14:36:16.640000
2011-06-05T14:38:43.393000
6,243,557
6,244,582
Convert NSTask "/bin/sh -c" command into proper pipeline code
Can someone help me convert the following code into code that instead has two NSTasks for "cat" and "grep", showing how the two can be connected together with pipes? I suppose I would prefer the latter approach, since then I no longer have to worry about quoting and stuff. NSTask *task; task = [[NSTask alloc] init]; [t...
Use a instance of NSTask for each program and connect their standard inputs/outputs with NSPipe: NSPipe *pipe = [[NSPipe alloc] init]; NSPipe *resultPipe = [[NSPipe alloc] init]; NSTask *task1 = [[NSTask alloc] init]; [task1 setLaunchPath: @"/bin/cat"]; [task1 setStandardOutput: pipe]; [task1 launch]; NSTask *task2 =...
Convert NSTask "/bin/sh -c" command into proper pipeline code Can someone help me convert the following code into code that instead has two NSTasks for "cat" and "grep", showing how the two can be connected together with pipes? I suppose I would prefer the latter approach, since then I no longer have to worry about quo...
TITLE: Convert NSTask "/bin/sh -c" command into proper pipeline code QUESTION: Can someone help me convert the following code into code that instead has two NSTasks for "cat" and "grep", showing how the two can be connected together with pipes? I suppose I would prefer the latter approach, since then I no longer have ...
[ "objective-c", "cocoa", "nstask" ]
2
3
1,157
1
0
2011-06-05T14:36:53.747000
2011-06-05T17:29:44.447000