PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
11,349,572
07/05/2012 17:36:46
1,464,849
06/18/2012 21:10:51
40
0
Per Second statistics in R
I have a file which contains Timestamps like this: 0.000100 0.003890 0.567980 0.999000 0.999990 1.000010 1.236800 1.456098 1.989001 2.098710 2.309879 2.890879 I want to find the per-second statistics , like in 1st second: 5 values, 2nd second: 4, 3rd second 3 in the file above using R. I also want to find Avg per second, max value in all the seconds and minimum value in all seconds. How can these be extracted using R? I am a newbie to R and still learning. I know how to plot these in histograms, but don't know how to extract the values.
r
histogram
null
null
null
null
open
Per Second statistics in R === I have a file which contains Timestamps like this: 0.000100 0.003890 0.567980 0.999000 0.999990 1.000010 1.236800 1.456098 1.989001 2.098710 2.309879 2.890879 I want to find the per-second statistics , like in 1st second: 5 values, 2nd second: 4, 3rd second 3 in the file above using R. I also want to find Avg per second, max value in all the seconds and minimum value in all seconds. How can these be extracted using R? I am a newbie to R and still learning. I know how to plot these in histograms, but don't know how to extract the values.
0
11,349,597
07/05/2012 17:38:09
1,493,903
07/01/2012 05:50:18
1
0
Alternative between Kannel and paid SMS gateway
I am currently setting up Kannel to provide send sms facility to users on my website. I would like to know if Kannel can be used to provide even cheaper sms sending service compared to paid sms gateways by companies. And also i would like to know what is the maximum number of sms can be sent using Kannel in a min (or an hour). Is Kannel worth the effort or should i switch to a paid gateway as i am running short of time to experiment?
kannel
null
null
null
null
null
open
Alternative between Kannel and paid SMS gateway === I am currently setting up Kannel to provide send sms facility to users on my website. I would like to know if Kannel can be used to provide even cheaper sms sending service compared to paid sms gateways by companies. And also i would like to know what is the maximum number of sms can be sent using Kannel in a min (or an hour). Is Kannel worth the effort or should i switch to a paid gateway as i am running short of time to experiment?
0
11,344,561
07/05/2012 12:40:42
1,281,189
03/20/2012 14:43:07
2,558
91
Controlling line color and line type in ggplot legend
**Background** In Germany, there are 16 federal states, ten of which belonged to West Germany, six of which belonged to East Germany. In some respects, for example mortality rates of certain cancers, there are persistent differences between the ten former western states and the six former eastern ones. There are also differences among the states within the respective groups. To show the differences among the states, it can make a certain amount of sense to plot data, for example age-standardized breast cancer mortality by year, from each state. A plot with 16 lines is not always a good choice, and I don't want to open up a discussion about that. Sometimes the powers that be say that's how it has to be. **The problem** Differentiating among 16 lines on a plot can be difficult. To do so, I usually use a combination of colors from the `RColorBrewer` package (the first ten colors of `Set3` plus the first six colors of that palette again, corresponding to the ten former west and six former east states) and line types (one line type for east, one for west). Using the `lattice` package, a plot of age-standardized breast cancer mortality rates from 1998-2010 by state could look like this: ![xyplot that works][1] **The question** I would like to do a similar plot using `ggplot`, but I haven't figured out how to combine the colors and the line types in the legend. So far, I've gotten this far: ![unsatisfactory ggplot][2] If it is possible to combine colors and line types in `ggplot` legends, how does one go about doing it? Here's the code to create the data frame and the plots: mort3 <- structure(list(State = structure(c(8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L), class = "factor", .Label = c("SH", "HH", "NI", "HB", "NW", "HE", "RP", "BW", "BY", "SL", "BE", "BB", "MV", "SN", "ST", "TH")), BCmort = c(16.5, 16.6, 15, 14.4, 13.5, 17.1, 15.8, 16.3, 18.3, 16.8, 17, 18.1, 13.1, 15.1, 18.8, 13.1, 16.4, 16.1, 15.8, 12.8, 16.3, 19.2, 16.8, 13, 17.9, 17, 19.4, 19.4, 13.1, 13.8, 18.1, 13.8, 15.9, 17.3, 17.5, 13.7, 17.4, 17.5, 16.7, 15.5, 18.1, 18, 20.1, 19.1, 11.8, 14.6, 18.2, 13.4, 16.8, 17.5, 15.6, 14.1, 13.9, 18.2, 17.1, 15.2, 18.1, 16.6, 19.3, 18.6, 13.1, 14.6, 19.6, 12.4, 16.6, 17.8, 17.5, 14.3, 20.5, 19.2, 19, 12.6, 19.5, 17.8, 19.2, 21, 14.4, 13.4, 19.8, 14, 17.5, 18.9, 16.4, 14.7, 17.7, 20.1, 18.5, 14.5, 19.1, 19.2, 20.1, 19.7, 14.2, 16.2, 17.9, 12.6, 18, 18.7, 17.7, 16.5, 16.6, 20.3, 18.1, 15.2, 19, 20, 19.8, 21.3, 13.8, 14.8, 20.4, 14.8, 18.2, 18.7, 16.9, 16.2, 20.2, 20.4, 18.5, 14, 20.2, 18.7, 20.3, 17.7, 14.4, 14.5, 21.7, 13.7, 18.3, 19.7, 17.8, 16.5, 20.2, 21.7, 18.8, 16.7, 20.4, 20, 19.6, 22.9, 15.2, 14.9, 21.7, 14.6, 18.3, 19.7, 17, 16.7, 22.9, 16.2, 19.6, 15.9, 20.3, 19.9, 18.9, 21.8, 14.9, 18, 21.4, 16.1, 19.6, 19.2, 19.1, 16.7, 20, 18.2, 20.5, 15.5, 20.5, 21.1, 21.3, 23.8, 15.8, 15.3, 21.3, 15.7, 19.6, 20.3, 19.2, 17.4, 18.1, 23.1, 20.6, 16.2, 21.5, 20.3, 21.4, 20.8, 16.1, 15.8, 22.1, 14.5, 20, 20.2, 19, 18.7, 23.1, 21.8, 19.4, 17.4, 20.9, 20.5, 20.4, 23.2, 16.3, 17.6, 23.1, 16.5), year = c(2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998), eastWest = structure(c(1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L), .Label = c("west", "east"), class = "factor")), .Names = c("State", "BCmort", "year", "eastWest"), class = "data.frame", row.names = c(NA, -208L)) colVec<-c(brewer.pal(10,"Set3"),brewer.pal(6,"Set3")) ltyVec<-rep(c("solid","dashed"),c(10,6)) ggplot(mort3, aes(x = year, y = BCmort, col = State, lty = eastWest)) + geom_line(lwd = 1) + scale_linetype_manual(values = c(west = "solid", east = "dashed")) + scale_color_manual(values = c(brewer.pal(10, "Set3"), brewer.pal(6, "Set3"))) + opts(title = "BC mortality") xyplot(BCmort ~ year, data = mort3, groups = State, lty = ltyVec, type = "l", col = colVec, lwd = 2, key = list(lines = list(lty = ltyVec, col = colVec, lwd = 2), text = list(levels(mort3$State)), columns = 1, space = "right", title = "State"), grid = TRUE, main = "BC mortality") [1]: http://i.stack.imgur.com/KRXyD.png [2]: http://i.stack.imgur.com/EjCfb.png
r
ggplot2
null
null
null
null
open
Controlling line color and line type in ggplot legend === **Background** In Germany, there are 16 federal states, ten of which belonged to West Germany, six of which belonged to East Germany. In some respects, for example mortality rates of certain cancers, there are persistent differences between the ten former western states and the six former eastern ones. There are also differences among the states within the respective groups. To show the differences among the states, it can make a certain amount of sense to plot data, for example age-standardized breast cancer mortality by year, from each state. A plot with 16 lines is not always a good choice, and I don't want to open up a discussion about that. Sometimes the powers that be say that's how it has to be. **The problem** Differentiating among 16 lines on a plot can be difficult. To do so, I usually use a combination of colors from the `RColorBrewer` package (the first ten colors of `Set3` plus the first six colors of that palette again, corresponding to the ten former west and six former east states) and line types (one line type for east, one for west). Using the `lattice` package, a plot of age-standardized breast cancer mortality rates from 1998-2010 by state could look like this: ![xyplot that works][1] **The question** I would like to do a similar plot using `ggplot`, but I haven't figured out how to combine the colors and the line types in the legend. So far, I've gotten this far: ![unsatisfactory ggplot][2] If it is possible to combine colors and line types in `ggplot` legends, how does one go about doing it? Here's the code to create the data frame and the plots: mort3 <- structure(list(State = structure(c(8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L, 8L, 9L, 11L, 12L, 4L, 2L, 6L, 13L, 3L, 5L, 7L, 10L, 14L, 15L, 1L, 16L), class = "factor", .Label = c("SH", "HH", "NI", "HB", "NW", "HE", "RP", "BW", "BY", "SL", "BE", "BB", "MV", "SN", "ST", "TH")), BCmort = c(16.5, 16.6, 15, 14.4, 13.5, 17.1, 15.8, 16.3, 18.3, 16.8, 17, 18.1, 13.1, 15.1, 18.8, 13.1, 16.4, 16.1, 15.8, 12.8, 16.3, 19.2, 16.8, 13, 17.9, 17, 19.4, 19.4, 13.1, 13.8, 18.1, 13.8, 15.9, 17.3, 17.5, 13.7, 17.4, 17.5, 16.7, 15.5, 18.1, 18, 20.1, 19.1, 11.8, 14.6, 18.2, 13.4, 16.8, 17.5, 15.6, 14.1, 13.9, 18.2, 17.1, 15.2, 18.1, 16.6, 19.3, 18.6, 13.1, 14.6, 19.6, 12.4, 16.6, 17.8, 17.5, 14.3, 20.5, 19.2, 19, 12.6, 19.5, 17.8, 19.2, 21, 14.4, 13.4, 19.8, 14, 17.5, 18.9, 16.4, 14.7, 17.7, 20.1, 18.5, 14.5, 19.1, 19.2, 20.1, 19.7, 14.2, 16.2, 17.9, 12.6, 18, 18.7, 17.7, 16.5, 16.6, 20.3, 18.1, 15.2, 19, 20, 19.8, 21.3, 13.8, 14.8, 20.4, 14.8, 18.2, 18.7, 16.9, 16.2, 20.2, 20.4, 18.5, 14, 20.2, 18.7, 20.3, 17.7, 14.4, 14.5, 21.7, 13.7, 18.3, 19.7, 17.8, 16.5, 20.2, 21.7, 18.8, 16.7, 20.4, 20, 19.6, 22.9, 15.2, 14.9, 21.7, 14.6, 18.3, 19.7, 17, 16.7, 22.9, 16.2, 19.6, 15.9, 20.3, 19.9, 18.9, 21.8, 14.9, 18, 21.4, 16.1, 19.6, 19.2, 19.1, 16.7, 20, 18.2, 20.5, 15.5, 20.5, 21.1, 21.3, 23.8, 15.8, 15.3, 21.3, 15.7, 19.6, 20.3, 19.2, 17.4, 18.1, 23.1, 20.6, 16.2, 21.5, 20.3, 21.4, 20.8, 16.1, 15.8, 22.1, 14.5, 20, 20.2, 19, 18.7, 23.1, 21.8, 19.4, 17.4, 20.9, 20.5, 20.4, 23.2, 16.3, 17.6, 23.1, 16.5), year = c(2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2010, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1999, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998), eastWest = structure(c(1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L), .Label = c("west", "east"), class = "factor")), .Names = c("State", "BCmort", "year", "eastWest"), class = "data.frame", row.names = c(NA, -208L)) colVec<-c(brewer.pal(10,"Set3"),brewer.pal(6,"Set3")) ltyVec<-rep(c("solid","dashed"),c(10,6)) ggplot(mort3, aes(x = year, y = BCmort, col = State, lty = eastWest)) + geom_line(lwd = 1) + scale_linetype_manual(values = c(west = "solid", east = "dashed")) + scale_color_manual(values = c(brewer.pal(10, "Set3"), brewer.pal(6, "Set3"))) + opts(title = "BC mortality") xyplot(BCmort ~ year, data = mort3, groups = State, lty = ltyVec, type = "l", col = colVec, lwd = 2, key = list(lines = list(lty = ltyVec, col = colVec, lwd = 2), text = list(levels(mort3$State)), columns = 1, space = "right", title = "State"), grid = TRUE, main = "BC mortality") [1]: http://i.stack.imgur.com/KRXyD.png [2]: http://i.stack.imgur.com/EjCfb.png
0
11,344,562
07/05/2012 12:40:42
1,377,826
05/06/2012 08:45:24
89
1
Calling Store from App.JS
I am in the app.js file. there is a function that gets executed when user logs in to the stytem successfully; loginSuccess: function() { this.getViewport().getLayout().setActiveItem(1).store.load(); // Calls the Store of the i need to navigate this.getViewport().getLayout().setActiveItem(1); // The view i will be navigating } I am getting an error stating `this.getViewport().getLayout().setActiveItem(1).store is undefined`. i think i'm calling the Store the wrong way. how could i correct this ? How can i call the Store from the app.js ?
extjs4
extjs-mvc
extjs4.1
null
null
null
open
Calling Store from App.JS === I am in the app.js file. there is a function that gets executed when user logs in to the stytem successfully; loginSuccess: function() { this.getViewport().getLayout().setActiveItem(1).store.load(); // Calls the Store of the i need to navigate this.getViewport().getLayout().setActiveItem(1); // The view i will be navigating } I am getting an error stating `this.getViewport().getLayout().setActiveItem(1).store is undefined`. i think i'm calling the Store the wrong way. how could i correct this ? How can i call the Store from the app.js ?
0
11,344,564
07/05/2012 12:40:44
188,477
10/12/2009 14:29:12
578
9
Updating a part of the object works but it updates even before I update it
Im updating a part of an object and the update works fine.Its when I did a console.log on the object before the I called the update functio,n the object was already updated.I was expecting to see the old copy of the object,i know Im doing something really silly.I just want to understand why this is happening.Here is my code function updateObject(o){ o.a='oneHundred'; o.b='twoHundred' } var obj={ a : 'one', b : 'two', c : { a : '', b : '' } } console.log(obj);//outputs the updated object before I call updateObject() var upObject = obj.c ; updateObject(upObject); console.log(obj);
javascript
null
null
null
null
null
open
Updating a part of the object works but it updates even before I update it === Im updating a part of an object and the update works fine.Its when I did a console.log on the object before the I called the update functio,n the object was already updated.I was expecting to see the old copy of the object,i know Im doing something really silly.I just want to understand why this is happening.Here is my code function updateObject(o){ o.a='oneHundred'; o.b='twoHundred' } var obj={ a : 'one', b : 'two', c : { a : '', b : '' } } console.log(obj);//outputs the updated object before I call updateObject() var upObject = obj.c ; updateObject(upObject); console.log(obj);
0
11,226,769
06/27/2012 12:59:10
904,173
02/18/2011 15:39:07
437
11
CopyToDataTable is not a member of system.array
I have a function in a VB.Net script file, but it produces the error 'CopyToDataTable' is not a member of 'system.array'. Any ideas? Public Function CollectionFromTable(tableName As String, sql As String, sortOrder As String) As DataTable Dim foundRows() As DataRow foundRows = ds.Tables(tableName).Select(sql, sortOrder) Return foundRows.CopyToDataTable End Function Note: I have the following imports at the top but still get the error. Imports System Imports System.Data Imports System.Windows.Forms Imports System.Math Imports Microsoft.VisualBasic Imports System.Collections.Generic Imports System.Data.DataRow Imports System.Linq Imports System.Drawing Imports System.Xml Imports System.Collections
c#
vb.net
visual-studio-2010
null
null
null
open
CopyToDataTable is not a member of system.array === I have a function in a VB.Net script file, but it produces the error 'CopyToDataTable' is not a member of 'system.array'. Any ideas? Public Function CollectionFromTable(tableName As String, sql As String, sortOrder As String) As DataTable Dim foundRows() As DataRow foundRows = ds.Tables(tableName).Select(sql, sortOrder) Return foundRows.CopyToDataTable End Function Note: I have the following imports at the top but still get the error. Imports System Imports System.Data Imports System.Windows.Forms Imports System.Math Imports Microsoft.VisualBasic Imports System.Collections.Generic Imports System.Data.DataRow Imports System.Linq Imports System.Drawing Imports System.Xml Imports System.Collections
0
11,226,770
06/27/2012 12:59:11
1,485,692
06/27/2012 12:50:28
1
0
Getting data from listview in WPF
I have created listview in C# and filled it with data from SQL server. But when I assign mouse double click, I don't know how to get clicked data. Please help: My XAML: <ListView Name="ListViewEmployeeDetails" ItemsSource="{Binding Path=Table}" Margin="0,0,0,67" MouseDoubleClick="ListViewEmployeeDetails_MouseDoubleClick"> <ListView.Background> <LinearGradientBrush> <GradientStop Color="white" Offset="0"/> </LinearGradientBrush> </ListView.Background> <ListView.View> <GridView> <GridViewColumn Width="70" Header="Číslo bytu" DisplayMemberBinding="{Binding Path=cislo_Bytu}"/> <GridViewColumn Width="70" Header="Podlaží" DisplayMemberBinding="{Binding Path=podlazi}"/> <GridViewColumn Width="70" Header="Účel" DisplayMemberBinding="{Binding Path=ucel}"/> <GridViewColumn Width="70" Header="Plocha" DisplayMemberBinding="{Binding Path=plocha}"/> <GridViewColumn Width="70" Header="Stav" DisplayMemberBinding="{Binding Path=stav}"/> <GridViewColumn Width="70" Header="Country" DisplayMemberBinding="{Binding Path=Country}"/> </GridView> </ListView.View> </ListView> And my code: SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand(); String str = "SELECT cislo_Bytu, podlazi, ucel, plocha, stav, poznamky FROM prostory"; cmd.CommandText = str; ad.SelectCommand = cmd; cmd.Connection = datovéPřipojení; DataSet ds = new DataSet(); ad.Fill(ds); ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView; datovéPřipojení.Close(); So my question is, what I should write into the private void ListViewEmployeeDetails_MouseDoubleClick(object sender, MouseButtonEventArgs e) { } To get the data (cislo_Bytu) from the row which was clicked on? Thanks, Petr
c#
wpf
listview
null
null
null
open
Getting data from listview in WPF === I have created listview in C# and filled it with data from SQL server. But when I assign mouse double click, I don't know how to get clicked data. Please help: My XAML: <ListView Name="ListViewEmployeeDetails" ItemsSource="{Binding Path=Table}" Margin="0,0,0,67" MouseDoubleClick="ListViewEmployeeDetails_MouseDoubleClick"> <ListView.Background> <LinearGradientBrush> <GradientStop Color="white" Offset="0"/> </LinearGradientBrush> </ListView.Background> <ListView.View> <GridView> <GridViewColumn Width="70" Header="Číslo bytu" DisplayMemberBinding="{Binding Path=cislo_Bytu}"/> <GridViewColumn Width="70" Header="Podlaží" DisplayMemberBinding="{Binding Path=podlazi}"/> <GridViewColumn Width="70" Header="Účel" DisplayMemberBinding="{Binding Path=ucel}"/> <GridViewColumn Width="70" Header="Plocha" DisplayMemberBinding="{Binding Path=plocha}"/> <GridViewColumn Width="70" Header="Stav" DisplayMemberBinding="{Binding Path=stav}"/> <GridViewColumn Width="70" Header="Country" DisplayMemberBinding="{Binding Path=Country}"/> </GridView> </ListView.View> </ListView> And my code: SqlDataAdapter ad = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand(); String str = "SELECT cislo_Bytu, podlazi, ucel, plocha, stav, poznamky FROM prostory"; cmd.CommandText = str; ad.SelectCommand = cmd; cmd.Connection = datovéPřipojení; DataSet ds = new DataSet(); ad.Fill(ds); ListViewEmployeeDetails.DataContext = ds.Tables[0].DefaultView; datovéPřipojení.Close(); So my question is, what I should write into the private void ListViewEmployeeDetails_MouseDoubleClick(object sender, MouseButtonEventArgs e) { } To get the data (cislo_Bytu) from the row which was clicked on? Thanks, Petr
0
11,226,777
06/27/2012 12:59:39
1,287,523
03/23/2012 04:47:34
37
0
Update struts 2 autocompleter from another autocompleter
I'm using struts+spring+hibernate. On my .jsp page, I have two autocompleter drop down menus. Each one returns a list of VOs from their specific table in the database, which is then used to call a search action that searches from another table. Menu A links to table A, and menu B links to table B, and they are used to search in table C. However, table B has a foreign key that links it to table A Table C has a foreign key that links it to table B. I would like it to be that when the user picks an option from menu A, menu B is updated so it only includes options that contain the proper foreign key. The user then can pick something specific from menu B and have the action search table C only for rows containing the proper foreign key. If the user does not touch table B, then the action will search for all rows in table C containing all foreign keys from Table B that match the one chosen in table A. I hope this is understandable and let me know if I need to clarify. I've been googling for some time and it might be a simple solution but I can't find anything. Thanks.
hibernate
spring-mvc
struts2
foreign-keys
null
null
open
Update struts 2 autocompleter from another autocompleter === I'm using struts+spring+hibernate. On my .jsp page, I have two autocompleter drop down menus. Each one returns a list of VOs from their specific table in the database, which is then used to call a search action that searches from another table. Menu A links to table A, and menu B links to table B, and they are used to search in table C. However, table B has a foreign key that links it to table A Table C has a foreign key that links it to table B. I would like it to be that when the user picks an option from menu A, menu B is updated so it only includes options that contain the proper foreign key. The user then can pick something specific from menu B and have the action search table C only for rows containing the proper foreign key. If the user does not touch table B, then the action will search for all rows in table C containing all foreign keys from Table B that match the one chosen in table A. I hope this is understandable and let me know if I need to clarify. I've been googling for some time and it might be a simple solution but I can't find anything. Thanks.
0
11,226,773
06/27/2012 12:59:24
1,485,704
06/27/2012 12:54:25
1
0
getting error check ur mysql syntax near 'order(`pcode`)
i used `` for column name though im getting error... my code is $sql = "INSERT INTO order(`pcode`) VALUES ('$pcode')"; if(!mysql_query($sql,$con)) die('cant connect ' .mysql_error());
php
mysql
null
null
null
null
open
getting error check ur mysql syntax near 'order(`pcode`) === i used `` for column name though im getting error... my code is $sql = "INSERT INTO order(`pcode`) VALUES ('$pcode')"; if(!mysql_query($sql,$con)) die('cant connect ' .mysql_error());
0
11,226,780
06/27/2012 12:59:52
387,906
07/09/2010 15:51:50
176
3
Binding Data To DropDownList MVC Razor
I have just started with my project using MVC and Razor. Now I am encountering a problem when it comes to binding data coming from the database to a dropdownlist. Please refer on my codes below: Specialization Model: public class SpecializationModel { [Display(Name = "SpecializationID")] public string SpecializationID { get; set; } [Display(Name = "SpecializationDescription")] public string SpecializationDescription { get; set; } public IEnumerable<SelectListItem> Items { get; set; } public int SelectedSpecializationID { get; set; } } Controller: public ActionResult Physicians() { SpecializationManager spec = new SpecializationManager(); List<Specialization> SpecializationList = spec.GetAllSpecialization(); var obj = new SpecializationModel(); obj.Items = new[] { foreach(var x in SpecializationList) { new SelectListItem { Value = x.SpecializationID.ToString(), Text = x.SpecializationDescription }; } }; return View(obj); } I have this manager which contains my LINQ query to extract the data from the database. I encounter problems on the controller. Wherein the error points on the `foreach` syntax saying `Invalid expression term foreach` Can anyone please point me to the right direction? Thanks a lot!
database
mvc
razor
drop-down-menu
bind
null
open
Binding Data To DropDownList MVC Razor === I have just started with my project using MVC and Razor. Now I am encountering a problem when it comes to binding data coming from the database to a dropdownlist. Please refer on my codes below: Specialization Model: public class SpecializationModel { [Display(Name = "SpecializationID")] public string SpecializationID { get; set; } [Display(Name = "SpecializationDescription")] public string SpecializationDescription { get; set; } public IEnumerable<SelectListItem> Items { get; set; } public int SelectedSpecializationID { get; set; } } Controller: public ActionResult Physicians() { SpecializationManager spec = new SpecializationManager(); List<Specialization> SpecializationList = spec.GetAllSpecialization(); var obj = new SpecializationModel(); obj.Items = new[] { foreach(var x in SpecializationList) { new SelectListItem { Value = x.SpecializationID.ToString(), Text = x.SpecializationDescription }; } }; return View(obj); } I have this manager which contains my LINQ query to extract the data from the database. I encounter problems on the controller. Wherein the error points on the `foreach` syntax saying `Invalid expression term foreach` Can anyone please point me to the right direction? Thanks a lot!
0
11,226,781
06/27/2012 12:59:53
1,028,269
11/03/2011 17:47:24
22
0
android change layout dpi
can I change layout dpi that use my application on device? (on developed application that works fine but on small screen size devices everything looks big )
android
android-layout
null
null
null
null
open
android change layout dpi === can I change layout dpi that use my application on device? (on developed application that works fine but on small screen size devices everything looks big )
0
11,226,784
06/27/2012 13:00:05
449,692
09/16/2010 15:28:06
603
8
Rails routes work in console but not server
I'm having trouble with a route that seems to be right in the console but gives me a routing error when I use it in the server. The case is similar to the "edit" and "update" pair. Calling GET 'messages/25/followup' should route to messages#followup, while the same URL with POST should route to messages#followup_send. In my routes.rb file I have get "messages/:id/followup", :to => "messages#followup" match "messages/:id/followup", :to => "messages#followup_send", :via => :post Displaying the routes gives ruby-1.9.2-p0 :092 > puts fu GET /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup"} POST /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup_send"} Testing in the console gives ruby-1.9.2-p0 :088 > r.recognize_path "/messages/54/followup", :method=>'POST' => {:controller=>"messages", :action=>"followup_send", :id=>"54"} The code in the form is <form id="edit_message_42" class="edit_message" method="post" action="/messages/42/followup?method=post" accept-charset="UTF-8"> ... <input type="submit" value="Send" name="commit"> However, if I click on the button I get in the log Started POST "/messages/42/followup?method=post" for 127.0.0.1 at 2012-06-27 13:54:48 +0100 ActionController::RoutingError (No route matches "/messages/42/followup") The same thing happens if I enter the URL manually (including the "method=post'). I will just get around this for now by using a separate name (e.g. /messages/42/send_followup) rather than relying on the GET-POST distinction, but I would like to understand what is going on here. Thanks for any ideas.
ruby-on-rails-3
routes
rails-routing
http-method
null
null
open
Rails routes work in console but not server === I'm having trouble with a route that seems to be right in the console but gives me a routing error when I use it in the server. The case is similar to the "edit" and "update" pair. Calling GET 'messages/25/followup' should route to messages#followup, while the same URL with POST should route to messages#followup_send. In my routes.rb file I have get "messages/:id/followup", :to => "messages#followup" match "messages/:id/followup", :to => "messages#followup_send", :via => :post Displaying the routes gives ruby-1.9.2-p0 :092 > puts fu GET /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup"} POST /messages/:id/followup(.:format) {:controller=>"messages", :action=>"followup_send"} Testing in the console gives ruby-1.9.2-p0 :088 > r.recognize_path "/messages/54/followup", :method=>'POST' => {:controller=>"messages", :action=>"followup_send", :id=>"54"} The code in the form is <form id="edit_message_42" class="edit_message" method="post" action="/messages/42/followup?method=post" accept-charset="UTF-8"> ... <input type="submit" value="Send" name="commit"> However, if I click on the button I get in the log Started POST "/messages/42/followup?method=post" for 127.0.0.1 at 2012-06-27 13:54:48 +0100 ActionController::RoutingError (No route matches "/messages/42/followup") The same thing happens if I enter the URL manually (including the "method=post'). I will just get around this for now by using a separate name (e.g. /messages/42/send_followup) rather than relying on the GET-POST distinction, but I would like to understand what is going on here. Thanks for any ideas.
0
11,226,721
06/27/2012 12:56:38
1,219,163
02/19/2012 12:03:06
71
30
caching image avatars without using CacheKey from url
I have a list of messages with avatars next to them. I need to fetch the avatar from a link that never changes. every time a new message is received, it will download the image, place it as avatar and cache it. (note, the server always will serve One image, the last one that was uploaded.) next time the list activity is created, I need to take the bitmap from the cache,and if not found (or null) i should place instead some avatar from the static resources. How can this be done? now, I found [this][1] for caching mechanizem, and using it like this: private static class MyAdapter extends ArrayAdapter<Msgs> { /** Re-usable contact image drawable */ private Drawable pushImage = null; /** * Constructor * * @param context The context * @param push_msgs The list of pushed messages */ public MyAdapter(final Context context, final ArrayList<Msgs> push_msgs) { super(context, 0, push_msgs); try { URL url = new URL(Config.PUSH_IMAGE_LINK); URLConnection connection = url.openConnection(); connection.setUseCaches(true); pushImage = Drawable.createFromStream(connection.getInputStream(), "src"); } catch (MalformedURLException e) { Log.e("MalformedURLException: ", e.getMessage()); } catch (IOException e) { Log.e("IOException: ", e.getMessage()); } } @Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(getContext()).inflate(R.layout.list_item, null); } final TextView name = (TextView)view.findViewById(R.id.contact_name); name.setText(getItem(position)._text); final TextView time = (TextView)view.findViewById(R.id.contact_number); time.setText(getItem(position)._time); final ImageView photo = (ImageView)view.findViewById(R.id.contact_photo); photo.setImageDrawable(pushImage); return view; } } and in onCreate() : final File cacheDir = cntx.getCacheDir(); ResponseCache.setDefault(new ResponseCache() { @Override public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException { final File file = new File(cacheDir, escape(urlConnection.getURL().getPath())); return new CacheRequest() { @Override public OutputStream getBody() throws IOException { return new FileOutputStream(file); } @Override public void abort() { file.delete(); } }; } private String escape(String url) { return url.replace("/", "-").replace(".", "-"); } @Override public CacheResponse get(URI uri, String s, Map<String, List<String>> headers) throws IOException { final File file = new File(cacheDir, escape(uri.getPath())); if (file.exists()) { return new CacheResponse() { @Override public Map<String, List<String>> getHeaders() throws IOException { return null; } @Override public InputStream getBody() throws IOException { return new FileInputStream(file); } }; } else { return null; } } }); if only i could change the key of the cached image from : > escape(uri.getPath() to the position of the image in the list .. can this be done? Thank You for reading! [1]: http://pivotallabs.com/users/tyler/blog/articles/1754-android-image-caching
image
list
caching
key
null
null
open
caching image avatars without using CacheKey from url === I have a list of messages with avatars next to them. I need to fetch the avatar from a link that never changes. every time a new message is received, it will download the image, place it as avatar and cache it. (note, the server always will serve One image, the last one that was uploaded.) next time the list activity is created, I need to take the bitmap from the cache,and if not found (or null) i should place instead some avatar from the static resources. How can this be done? now, I found [this][1] for caching mechanizem, and using it like this: private static class MyAdapter extends ArrayAdapter<Msgs> { /** Re-usable contact image drawable */ private Drawable pushImage = null; /** * Constructor * * @param context The context * @param push_msgs The list of pushed messages */ public MyAdapter(final Context context, final ArrayList<Msgs> push_msgs) { super(context, 0, push_msgs); try { URL url = new URL(Config.PUSH_IMAGE_LINK); URLConnection connection = url.openConnection(); connection.setUseCaches(true); pushImage = Drawable.createFromStream(connection.getInputStream(), "src"); } catch (MalformedURLException e) { Log.e("MalformedURLException: ", e.getMessage()); } catch (IOException e) { Log.e("IOException: ", e.getMessage()); } } @Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(getContext()).inflate(R.layout.list_item, null); } final TextView name = (TextView)view.findViewById(R.id.contact_name); name.setText(getItem(position)._text); final TextView time = (TextView)view.findViewById(R.id.contact_number); time.setText(getItem(position)._time); final ImageView photo = (ImageView)view.findViewById(R.id.contact_photo); photo.setImageDrawable(pushImage); return view; } } and in onCreate() : final File cacheDir = cntx.getCacheDir(); ResponseCache.setDefault(new ResponseCache() { @Override public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException { final File file = new File(cacheDir, escape(urlConnection.getURL().getPath())); return new CacheRequest() { @Override public OutputStream getBody() throws IOException { return new FileOutputStream(file); } @Override public void abort() { file.delete(); } }; } private String escape(String url) { return url.replace("/", "-").replace(".", "-"); } @Override public CacheResponse get(URI uri, String s, Map<String, List<String>> headers) throws IOException { final File file = new File(cacheDir, escape(uri.getPath())); if (file.exists()) { return new CacheResponse() { @Override public Map<String, List<String>> getHeaders() throws IOException { return null; } @Override public InputStream getBody() throws IOException { return new FileInputStream(file); } }; } else { return null; } } }); if only i could change the key of the cached image from : > escape(uri.getPath() to the position of the image in the list .. can this be done? Thank You for reading! [1]: http://pivotallabs.com/users/tyler/blog/articles/1754-android-image-caching
0
11,226,722
06/27/2012 12:56:38
1,485,698
06/27/2012 12:52:45
1
0
Get domain from string? - Python
i needed help. How do i get domain from a string? For example: "*Hi im Natsume, check out my site http://www.mysite.com/*" How do i get just **mysite.com**?
python
string
url
domain
null
null
open
Get domain from string? - Python === i needed help. How do i get domain from a string? For example: "*Hi im Natsume, check out my site http://www.mysite.com/*" How do i get just **mysite.com**?
0
11,226,724
06/27/2012 12:56:43
657,801
03/13/2011 19:09:06
593
6
How to trigger an event on a parent but not on its child in jQuery
I have this piece of html: <div id="parent"> <div id="child></div> </div> and it looks graphically like this: --------------------------- - - - #parent - - - - ---------- - - - - - - - #Child - - - - - - - ---------- - - - --------------------------- How do I trigger an event in jQuery (roll over for example) that will work only when hovering on the `#parent` but **will not work** when hovering on the `#child`
javascript
jquery
html
null
null
null
open
How to trigger an event on a parent but not on its child in jQuery === I have this piece of html: <div id="parent"> <div id="child></div> </div> and it looks graphically like this: --------------------------- - - - #parent - - - - ---------- - - - - - - - #Child - - - - - - - ---------- - - - --------------------------- How do I trigger an event in jQuery (roll over for example) that will work only when hovering on the `#parent` but **will not work** when hovering on the `#child`
0
11,226,747
06/27/2012 12:58:02
281,121
02/25/2010 10:14:10
522
0
Parse a list of XML fragments with no root element from a stream input
Is it feasible in Java using the SAX api to parse a list of XML fragments with no root element from a stream input? I tried parsing such an XML but got a org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. before even the endDocument event was fired. I would like not to settle with obvious but clumsy solutions as "Pre-append a custom root element or Use buffered fragment parsing". I am using the standard SAX API of Java 1.6. The SAX factory had setValidating(false) in case anyone wondered.
java
xml
xml-parsing
sax
null
null
open
Parse a list of XML fragments with no root element from a stream input === Is it feasible in Java using the SAX api to parse a list of XML fragments with no root element from a stream input? I tried parsing such an XML but got a org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. before even the endDocument event was fired. I would like not to settle with obvious but clumsy solutions as "Pre-append a custom root element or Use buffered fragment parsing". I am using the standard SAX API of Java 1.6. The SAX factory had setValidating(false) in case anyone wondered.
0
11,226,751
06/27/2012 12:58:12
1,485,326
06/27/2012 10:30:38
1
0
Facebook,Graph API
From where I can start For interaction with Facebook like post Image on wall, get friend list, post image on friend wall etc. I already read basics from [here][1] (Facebook GuideLines). Any good resources for learn Graph API and latest API documentation or tutorial? thanks [1]: http://developers.facebook.com/docs/mobile/ios/build/
iphone
ios
facebook
facebook-graph-api
null
null
open
Facebook,Graph API === From where I can start For interaction with Facebook like post Image on wall, get friend list, post image on friend wall etc. I already read basics from [here][1] (Facebook GuideLines). Any good resources for learn Graph API and latest API documentation or tutorial? thanks [1]: http://developers.facebook.com/docs/mobile/ios/build/
0
11,387,038
07/08/2012 21:56:12
1,492,323
06/29/2012 23:20:51
1
0
Android filter and sort ListView with adapter set during Async task
I'm making a ListView with data I get from a database placed in a server. The ListView has TWO TextViews for each row, one for the cities, and the other one for the ID's each city has on the database, but this textview(the ID's one) is HIDDEN from the ListView, so the user can only see cities. Everything works fine, but now I want to add a search bar to the listview so I can filter the cities, but i'm getting the following problems: 1.-The adapter of the ListView is a Simple Adapter, as you can see on the code, and I have found no examples of how to filter a Listview using such an adapter. 2.-I'm getting the info for the ListView through an Async Task, and setting up the ListView inside the *onPostExecute* method of the Async Task, and again, I have found no examples of filtering it when its in such a place. Here is the "relevant" code. If somebody needs the complete code, just ask me for it. public class SQLWebVer extends ListActivity implements OnItemClickListener{ ProgressDialog barraProgreso; ArrayList<HashMap<String, String>> listaCiudades; . .//some more varibles for the class . protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.sqlwebver); // Hashmap de la ListView listaCiudades = new ArrayList<HashMap<String, String>>(); new cargaCiudades().execute();//this is the call to the async task } class cargaCiudades extends AsyncTask<String, String, String>{//the async task . .//here are the onPreExecute and doInBackground methods . protected void onPostExecute(String file_url) { barraProgreso.dismiss();//quita la barra de la pantalla runOnUiThread(new Runnable(){//actualiza la UI(la listView) public void run() { // TODO Auto-generated method stub ListAdapter adapter = new SimpleAdapter (SQLWebVer.this, listaCiudades, R.layout.sqlweblist_item, new String[]{"key_id", "key_ciudad"},new int[] {R.id.ID_CIUDAD, R.id.CIUDAD}); setListAdapter(adapter); } }); } } I have tried to add the filter feature both on the onCreate and onPostExecute method, but with no luck so, any suggestions? P.D:BONUS question, how could I sort my ListView alphabetically by cities but keeping each ID related to his city?(without changing the php files)
android
listview
search
asynchronous
filter
null
open
Android filter and sort ListView with adapter set during Async task === I'm making a ListView with data I get from a database placed in a server. The ListView has TWO TextViews for each row, one for the cities, and the other one for the ID's each city has on the database, but this textview(the ID's one) is HIDDEN from the ListView, so the user can only see cities. Everything works fine, but now I want to add a search bar to the listview so I can filter the cities, but i'm getting the following problems: 1.-The adapter of the ListView is a Simple Adapter, as you can see on the code, and I have found no examples of how to filter a Listview using such an adapter. 2.-I'm getting the info for the ListView through an Async Task, and setting up the ListView inside the *onPostExecute* method of the Async Task, and again, I have found no examples of filtering it when its in such a place. Here is the "relevant" code. If somebody needs the complete code, just ask me for it. public class SQLWebVer extends ListActivity implements OnItemClickListener{ ProgressDialog barraProgreso; ArrayList<HashMap<String, String>> listaCiudades; . .//some more varibles for the class . protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.sqlwebver); // Hashmap de la ListView listaCiudades = new ArrayList<HashMap<String, String>>(); new cargaCiudades().execute();//this is the call to the async task } class cargaCiudades extends AsyncTask<String, String, String>{//the async task . .//here are the onPreExecute and doInBackground methods . protected void onPostExecute(String file_url) { barraProgreso.dismiss();//quita la barra de la pantalla runOnUiThread(new Runnable(){//actualiza la UI(la listView) public void run() { // TODO Auto-generated method stub ListAdapter adapter = new SimpleAdapter (SQLWebVer.this, listaCiudades, R.layout.sqlweblist_item, new String[]{"key_id", "key_ciudad"},new int[] {R.id.ID_CIUDAD, R.id.CIUDAD}); setListAdapter(adapter); } }); } } I have tried to add the filter feature both on the onCreate and onPostExecute method, but with no luck so, any suggestions? P.D:BONUS question, how could I sort my ListView alphabetically by cities but keeping each ID related to his city?(without changing the php files)
0
11,387,039
07/08/2012 21:56:16
970,042
09/28/2011 22:05:44
14
0
WCF: Server responding with Bad Request (400)
My WCF client works OK with WCF server except when making a call to the server trying to pass array of custom objects. When the array is 100 items it works fine, but when number of items is 300 the server throws exception Bad Request (400). So I assume that the key to the solution is in configuration files. First of all here is the app.config for the client. The WCF client resides in a DLL which is Outlook Add-In. I copy this app.config to Outlook.exe.config to Outlook installation dir - something that is required for the Add-In to be loaded by Outlook: <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="MyProject.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> </sectionGroup> </configSections> <system.serviceModel> <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" /> <security mode="Message"> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsDualHttpBinding> </bindings> <client> <endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="JabberService.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"> </endpoint> </client> </system.serviceModel> <system.diagnostics> <trace autoflush="true" /> <sharedListeners> <add name="sharedListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="%AppData%\Mfg\ProjectName\Logs\SwitchvoxDialerTraceLog.svclog" /> </sharedListeners> <sources> <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" propagateActivity="true"> <listeners> <add name="sharedListener"/> </listeners> </source> <source name="System.ServiceModel.MessageLogging" switchValue="Verbose"> <listeners> <add name="sharedListener" /> </listeners> </source> </sources> </system.diagnostics> <userSettings> <SwitchvoxDialer.Properties.Settings> <setting name="InstallSubFolder" serializeAs="String"> <value>Mfg\\ProjectName</value> </setting> <setting name="DialerTitle" serializeAs="String"> <value>ProjectName</value> </setting> </SwitchvoxDialer.Properties.Settings> </userSettings> </configuration> The relevant part of the server config looks like this: <system.serviceModel> <services> <service name="WcfServiceLib.JabberSvc" behaviorConfiguration="JabberSvc"> <endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="WcfServiceLib.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"> <identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="http://localhost:9047/switchvox/alerter"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="JabberSvc"> <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483646" /> <serviceTimeouts transactionTimeout="00:10:00" /> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="True"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> <reliableSession ordered="true" inactivityTimeout="00:10:00"/> <security mode="Message"> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/> </security> </binding> </wsDualHttpBinding> </bindings> <!-- Enable message tracing by adding this section - Remove for production code --> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="100000" /> </diagnostics> </system.serviceModel> The app.config produces ServerName.exe.config that in bin/Debug (previously I had it as embedded resource but it did not help either... As you can see I increased all the numbers for buffers, messages, etc. to maximum and made sure that the time values are high enough... I am convinced that that the problem is that somehow either the server or the client do not know about these increased values, but cant figure out why...
arrays
wcf
exception
app-config
null
null
open
WCF: Server responding with Bad Request (400) === My WCF client works OK with WCF server except when making a call to the server trying to pass array of custom objects. When the array is 100 items it works fine, but when number of items is 300 the server throws exception Bad Request (400). So I assume that the key to the solution is in configuration files. First of all here is the app.config for the client. The WCF client resides in a DLL which is Outlook Add-In. I copy this app.config to Outlook.exe.config to Outlook installation dir - something that is required for the Add-In to be loaded by Outlook: <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="MyProject.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> </sectionGroup> </configSections> <system.serviceModel> <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" /> <security mode="Message"> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsDualHttpBinding> </bindings> <client> <endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="JabberService.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"> </endpoint> </client> </system.serviceModel> <system.diagnostics> <trace autoflush="true" /> <sharedListeners> <add name="sharedListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="%AppData%\Mfg\ProjectName\Logs\SwitchvoxDialerTraceLog.svclog" /> </sharedListeners> <sources> <source name="System.ServiceModel" switchValue="Verbose, ActivityTracing" propagateActivity="true"> <listeners> <add name="sharedListener"/> </listeners> </source> <source name="System.ServiceModel.MessageLogging" switchValue="Verbose"> <listeners> <add name="sharedListener" /> </listeners> </source> </sources> </system.diagnostics> <userSettings> <SwitchvoxDialer.Properties.Settings> <setting name="InstallSubFolder" serializeAs="String"> <value>Mfg\\ProjectName</value> </setting> <setting name="DialerTitle" serializeAs="String"> <value>ProjectName</value> </setting> </SwitchvoxDialer.Properties.Settings> </userSettings> </configuration> The relevant part of the server config looks like this: <system.serviceModel> <services> <service name="WcfServiceLib.JabberSvc" behaviorConfiguration="JabberSvc"> <endpoint address="http://localhost:9047/switchvox/alerter" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IJabberSvc" contract="WcfServiceLib.IJabberSvc" name="WSDualHttpBinding_IJabberSvc"> <identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> <host> <baseAddresses> <add baseAddress="http://localhost:9047/switchvox/alerter"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="JabberSvc"> <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483646" /> <serviceTimeouts transactionTimeout="00:10:00" /> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="True"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_IJabberSvc" closeTimeout="00:01:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> <reliableSession ordered="true" inactivityTimeout="00:10:00"/> <security mode="Message"> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/> </security> </binding> </wsDualHttpBinding> </bindings> <!-- Enable message tracing by adding this section - Remove for production code --> <diagnostics> <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="100000" /> </diagnostics> </system.serviceModel> The app.config produces ServerName.exe.config that in bin/Debug (previously I had it as embedded resource but it did not help either... As you can see I increased all the numbers for buffers, messages, etc. to maximum and made sure that the time values are high enough... I am convinced that that the problem is that somehow either the server or the client do not know about these increased values, but cant figure out why...
0
11,387,036
07/08/2012 21:55:55
796,997
06/14/2011 04:17:17
138
4
MVC3 Razor - Editing a variable length list
I followed Steven Sanderson's blog - http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/ When I try to add another row of items, rather than adding the row it sends me to the url with the returned partial view. How do I prevent this from happening and hence add an actual row? #My code below along with the path (as I am using Areas): ##MyWebUI ###Areas/Client/MyMoveItems/Index.cshtml @model IEnumerable<MovinMyStuff.Domain.Entities.MoveItem> @using MovinMyStuff.WebUI.HtmlHelpers @{ ViewBag.Title = "Index"; } <h1>My Move Items</h1> @using (Html.BeginForm()) { <table class="move-item"> <tr> <th> Item </th> <th class="dimension-header"> L </th> <th class="dimension-header"> W </th> <th class="dimension-header"> H </th> <th class="weight-header"> Wt </th> <th class="qty-header"> Qty </th> <th> Addt'l Work </th> </tr> <tr> <td colspan="7"> <div id="editorRows"> @foreach (var item in Model) { Html.RenderPartial("_MoveItemEditorRow", item); } </div> </td> </tr> </table> @Html.ActionLink("Add Item", "Add", new { area = "Client" }, new { id = "addItem" }) <input type="submit" value="Finished" /> } ###Areas/Client/MyMoveItems/_MoveItemEditorRow.cshtml @model MovinMyStuff.Domain.Entities.MoveItem @using MovinMyStuff.WebUI.HtmlHelpers @using (Html.BeginCollectionItem("moveitems")) { <div class="editorRow"> <tr> <td class="item-name"> @Html.TextBoxFor(model => model.MoveItemType) @Html.ValidationMessageFor(model => model.MoveItemType) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Length) @Html.ValidationMessageFor(model => model.Length) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Width) @Html.ValidationMessageFor(model => model.Width) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Height) @Html.ValidationMessageFor(model => model.Height) </td> <td class="item-weight"> @Html.EditorFor(model => model.Weight) @Html.ValidationMessageFor(model => model.Weight) </td> <td class="item-qty"> @Html.EditorFor(model => model.Quantity) @Html.ValidationMessageFor(model => model.Quantity) </td> <td class="work-items-group"> <table class="work-items"> <tr> <td>Assembly</td> <td> @Html.EditorFor(model => model.Assemble) @Html.ValidationMessageFor(model => model.Assemble) </td> </tr> </table> <table class="work-items"> <tr> <td>Glass</td> <td> @Html.EditorFor(model => model.HasGlass) @Html.ValidationMessageFor(model => model.HasGlass) </td> </tr> </table> </td> </tr> </div> } ###Areas/Client/Controllers/MyMoveItemsControllers.cs using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Mvc; using MovinMyStuff.Domain.Entities; using MovinMyStuff.Domain.Concrete; namespace MovinMyStuff.WebUI.Areas.Client.Controllers { public class MyMoveItemsController : Controller { private EFDbContext db = new EFDbContext(); // // GET: /Client/MyMoveItems/ public ActionResult Index() { var moveitems = db.MoveItems.Include(m => m.Move); return View(moveitems); } [HttpPost] public ActionResult Index(IEnumerable<MoveItem> moveitems) { return View("Completed", moveitems); } public PartialViewResult Add() { return PartialView("_MoveItemEditorRow", new MoveItem()); } } } ###HtmlHelpers/HtmlPrefixScopeExtension.cs using System; using System.Collections.Generic; using System.Web; using System.Web.Mvc; namespace MovinMyStuff.WebUI.HtmlHelpers { public static class HtmlPrefixScopeExtensions { private const string idsToReuseKey = "__htmlPrefixScopeExtensions_IdsToReuse_"; public static IDisposable BeginCollectionItem(this HtmlHelper html, string collectionName) { var idsToReuse = GetIdsToReuse(html.ViewContext.HttpContext, collectionName); string itemIndex = idsToReuse.Count > 0 ? idsToReuse.Dequeue() : Guid.NewGuid().ToString(); // autocomplete="off" is needed to work around a very annoying Chrome behaviour whereby it reuses old values after the user clicks "Back", which causes the xyz.index and xyz[...] values to get out of sync. html.ViewContext.Writer.WriteLine(string.Format("<input type=\"hidden\" name=\"{0}.index\" autocomplete=\"off\" value=\"{1}\" />", collectionName, html.Encode(itemIndex))); return BeginHtmlFieldPrefixScope(html, string.Format("{0}[{1}]", collectionName, itemIndex)); } public static IDisposable BeginHtmlFieldPrefixScope(this HtmlHelper html, string htmlFieldPrefix) { return new HtmlFieldPrefixScope(html.ViewData.TemplateInfo, htmlFieldPrefix); } private static Queue<string> GetIdsToReuse(HttpContextBase httpContext, string collectionName) { // We need to use the same sequence of IDs following a server-side validation failure, // otherwise the framework won't render the validation error messages next to each item. string key = idsToReuseKey + collectionName; var queue = (Queue<string>)httpContext.Items[key]; if (queue == null) { httpContext.Items[key] = queue = new Queue<string>(); var previouslyUsedIds = httpContext.Request[collectionName + ".index"]; if (!string.IsNullOrEmpty(previouslyUsedIds)) foreach (string previouslyUsedId in previouslyUsedIds.Split(',')) queue.Enqueue(previouslyUsedId); } return queue; } private class HtmlFieldPrefixScope : IDisposable { private readonly TemplateInfo templateInfo; private readonly string previousHtmlFieldPrefix; public HtmlFieldPrefixScope(TemplateInfo templateInfo, string htmlFieldPrefix) { this.templateInfo = templateInfo; previousHtmlFieldPrefix = templateInfo.HtmlFieldPrefix; templateInfo.HtmlFieldPrefix = htmlFieldPrefix; } public void Dispose() { templateInfo.HtmlFieldPrefix = previousHtmlFieldPrefix; } } } } ###Scripts/mms-custom.js $("#addItem").click(function () { $.ajax({ url: this.href, cache: false, success: function (html) { $("#editorRows").append(html); } }); return false; }); $("a.deleteRow").live("click", function () { $(this).parents("div.editorRow:first").remove(); return false; }); ###Views/Shared/_ClientLayout.cshtml <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-2.5.3.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/mms-custom.js")" type="text/javascript"></script> @(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group.Add("telerik.common.css") .Add("telerik.default.css")) ) </head> <body> <section> @RenderBody() </section> </body> </html>
c#
ajax
asp.net-mvc-3
asp.net-mvc-partialview
null
null
open
MVC3 Razor - Editing a variable length list === I followed Steven Sanderson's blog - http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/ When I try to add another row of items, rather than adding the row it sends me to the url with the returned partial view. How do I prevent this from happening and hence add an actual row? #My code below along with the path (as I am using Areas): ##MyWebUI ###Areas/Client/MyMoveItems/Index.cshtml @model IEnumerable<MovinMyStuff.Domain.Entities.MoveItem> @using MovinMyStuff.WebUI.HtmlHelpers @{ ViewBag.Title = "Index"; } <h1>My Move Items</h1> @using (Html.BeginForm()) { <table class="move-item"> <tr> <th> Item </th> <th class="dimension-header"> L </th> <th class="dimension-header"> W </th> <th class="dimension-header"> H </th> <th class="weight-header"> Wt </th> <th class="qty-header"> Qty </th> <th> Addt'l Work </th> </tr> <tr> <td colspan="7"> <div id="editorRows"> @foreach (var item in Model) { Html.RenderPartial("_MoveItemEditorRow", item); } </div> </td> </tr> </table> @Html.ActionLink("Add Item", "Add", new { area = "Client" }, new { id = "addItem" }) <input type="submit" value="Finished" /> } ###Areas/Client/MyMoveItems/_MoveItemEditorRow.cshtml @model MovinMyStuff.Domain.Entities.MoveItem @using MovinMyStuff.WebUI.HtmlHelpers @using (Html.BeginCollectionItem("moveitems")) { <div class="editorRow"> <tr> <td class="item-name"> @Html.TextBoxFor(model => model.MoveItemType) @Html.ValidationMessageFor(model => model.MoveItemType) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Length) @Html.ValidationMessageFor(model => model.Length) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Width) @Html.ValidationMessageFor(model => model.Width) </td> <td class="item-dimension"> @Html.EditorFor(model => model.Height) @Html.ValidationMessageFor(model => model.Height) </td> <td class="item-weight"> @Html.EditorFor(model => model.Weight) @Html.ValidationMessageFor(model => model.Weight) </td> <td class="item-qty"> @Html.EditorFor(model => model.Quantity) @Html.ValidationMessageFor(model => model.Quantity) </td> <td class="work-items-group"> <table class="work-items"> <tr> <td>Assembly</td> <td> @Html.EditorFor(model => model.Assemble) @Html.ValidationMessageFor(model => model.Assemble) </td> </tr> </table> <table class="work-items"> <tr> <td>Glass</td> <td> @Html.EditorFor(model => model.HasGlass) @Html.ValidationMessageFor(model => model.HasGlass) </td> </tr> </table> </td> </tr> </div> } ###Areas/Client/Controllers/MyMoveItemsControllers.cs using System; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Mvc; using MovinMyStuff.Domain.Entities; using MovinMyStuff.Domain.Concrete; namespace MovinMyStuff.WebUI.Areas.Client.Controllers { public class MyMoveItemsController : Controller { private EFDbContext db = new EFDbContext(); // // GET: /Client/MyMoveItems/ public ActionResult Index() { var moveitems = db.MoveItems.Include(m => m.Move); return View(moveitems); } [HttpPost] public ActionResult Index(IEnumerable<MoveItem> moveitems) { return View("Completed", moveitems); } public PartialViewResult Add() { return PartialView("_MoveItemEditorRow", new MoveItem()); } } } ###HtmlHelpers/HtmlPrefixScopeExtension.cs using System; using System.Collections.Generic; using System.Web; using System.Web.Mvc; namespace MovinMyStuff.WebUI.HtmlHelpers { public static class HtmlPrefixScopeExtensions { private const string idsToReuseKey = "__htmlPrefixScopeExtensions_IdsToReuse_"; public static IDisposable BeginCollectionItem(this HtmlHelper html, string collectionName) { var idsToReuse = GetIdsToReuse(html.ViewContext.HttpContext, collectionName); string itemIndex = idsToReuse.Count > 0 ? idsToReuse.Dequeue() : Guid.NewGuid().ToString(); // autocomplete="off" is needed to work around a very annoying Chrome behaviour whereby it reuses old values after the user clicks "Back", which causes the xyz.index and xyz[...] values to get out of sync. html.ViewContext.Writer.WriteLine(string.Format("<input type=\"hidden\" name=\"{0}.index\" autocomplete=\"off\" value=\"{1}\" />", collectionName, html.Encode(itemIndex))); return BeginHtmlFieldPrefixScope(html, string.Format("{0}[{1}]", collectionName, itemIndex)); } public static IDisposable BeginHtmlFieldPrefixScope(this HtmlHelper html, string htmlFieldPrefix) { return new HtmlFieldPrefixScope(html.ViewData.TemplateInfo, htmlFieldPrefix); } private static Queue<string> GetIdsToReuse(HttpContextBase httpContext, string collectionName) { // We need to use the same sequence of IDs following a server-side validation failure, // otherwise the framework won't render the validation error messages next to each item. string key = idsToReuseKey + collectionName; var queue = (Queue<string>)httpContext.Items[key]; if (queue == null) { httpContext.Items[key] = queue = new Queue<string>(); var previouslyUsedIds = httpContext.Request[collectionName + ".index"]; if (!string.IsNullOrEmpty(previouslyUsedIds)) foreach (string previouslyUsedId in previouslyUsedIds.Split(',')) queue.Enqueue(previouslyUsedId); } return queue; } private class HtmlFieldPrefixScope : IDisposable { private readonly TemplateInfo templateInfo; private readonly string previousHtmlFieldPrefix; public HtmlFieldPrefixScope(TemplateInfo templateInfo, string htmlFieldPrefix) { this.templateInfo = templateInfo; previousHtmlFieldPrefix = templateInfo.HtmlFieldPrefix; templateInfo.HtmlFieldPrefix = htmlFieldPrefix; } public void Dispose() { templateInfo.HtmlFieldPrefix = previousHtmlFieldPrefix; } } } } ###Scripts/mms-custom.js $("#addItem").click(function () { $.ajax({ url: this.href, cache: false, success: function (html) { $("#editorRows").append(html); } }); return false; }); $("a.deleteRow").live("click", function () { $(this).parents("div.editorRow:first").remove(); return false; }); ###Views/Shared/_ClientLayout.cshtml <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>@ViewBag.Title</title> <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/modernizr-2.5.3.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/mms-custom.js")" type="text/javascript"></script> @(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group.Add("telerik.common.css") .Add("telerik.default.css")) ) </head> <body> <section> @RenderBody() </section> </body> </html>
0
11,385,738
07/08/2012 18:50:33
1,236,302
02/27/2012 18:57:43
11
0
Sourceforge export XML or HTML
I have been trying to extract and scrape information about bugs filed for the joda-time software. However, I am finding no good way to export this information to a file using an automated script or something. I do find some python scripts online but they are mostly about converting sourceforge tickets to git or outdated. Any help in that matter would be greatly appreciated. Thanks, Shivani
python
sourceforge
screen-scraper
export-to-xml
null
null
open
Sourceforge export XML or HTML === I have been trying to extract and scrape information about bugs filed for the joda-time software. However, I am finding no good way to export this information to a file using an automated script or something. I do find some python scripts online but they are mostly about converting sourceforge tickets to git or outdated. Any help in that matter would be greatly appreciated. Thanks, Shivani
0
11,650,333
07/25/2012 13:02:04
1,320,351
04/08/2012 13:53:58
19
1
Use a random record in a file for a preparedstatement
i'm using swingbench for some load testing. I have just to create a case that run something like SELECT COL1 FROM TABLE WHERE COL2 = ? the value of COL2 is a number contained in a file, like a customer number, that is not a sequence. Looking and available classes in swingbench for demos I see that wherever swingbench read a file with (for example) productids then use a single product id calculating a random value between min and max value of the file. In my case this is not applicable. How can I tackle this problem in java? Thanks Ste
java
oracle
class
null
null
null
open
Use a random record in a file for a preparedstatement === i'm using swingbench for some load testing. I have just to create a case that run something like SELECT COL1 FROM TABLE WHERE COL2 = ? the value of COL2 is a number contained in a file, like a customer number, that is not a sequence. Looking and available classes in swingbench for demos I see that wherever swingbench read a file with (for example) productids then use a single product id calculating a random value between min and max value of the file. In my case this is not applicable. How can I tackle this problem in java? Thanks Ste
0
11,650,335
07/25/2012 13:02:09
1,252,275
03/06/2012 13:17:19
45
8
Dynamically changing the browser title in ActionScript
i have set a title of Browser via ` Application.pageTitle ` property. is there any way to change the title of web Browser dynamically or as3?
actionscript-3
actionscript
flex4.5
null
null
null
open
Dynamically changing the browser title in ActionScript === i have set a title of Browser via ` Application.pageTitle ` property. is there any way to change the title of web Browser dynamically or as3?
0
11,650,414
07/25/2012 13:06:59
237,882
12/23/2009 20:18:33
1,474
88
NCell redrawing issues
I'm creating a `NSCell` subclass that draws some objects directly onto the view (using `drawInRect:fromRect:operation:fraction:respectFlipped:hints:`) and also draws an `NSButton` instance simply using NSView's `addSubview:` selector. While objects drawn using the first method all draw correclty, I'm having problems with drawing the `NSButton` correctly. The issue is that my `NSButton` instances will draw in the right places, but multiple times over. I've researched this on the internet for a while and some people suggested using a cache, but I'm not sure if this is efficient. (going an array containing buttons using a for loop will definately cause slow scrolling since I display a lot of data...) How would you do this? Am I barking up the wrong tree? This is the relevant code: - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { NSRect _controlRect = cellFrame; float _Y = cellFrame.origin.y; NSRect _accessoryRect = NSMakeRect(_controlRect.size.width - 70.0f, _Y + 9.0f, 50.0f, 23.0f); _switch = [self _choiceSwitch]; [_switch setFrame:_accessoryRect]; [controlView addSubview:_switch]; }
objective-c
nstableview
nscell
nstableviewcell
null
null
open
NCell redrawing issues === I'm creating a `NSCell` subclass that draws some objects directly onto the view (using `drawInRect:fromRect:operation:fraction:respectFlipped:hints:`) and also draws an `NSButton` instance simply using NSView's `addSubview:` selector. While objects drawn using the first method all draw correclty, I'm having problems with drawing the `NSButton` correctly. The issue is that my `NSButton` instances will draw in the right places, but multiple times over. I've researched this on the internet for a while and some people suggested using a cache, but I'm not sure if this is efficient. (going an array containing buttons using a for loop will definately cause slow scrolling since I display a lot of data...) How would you do this? Am I barking up the wrong tree? This is the relevant code: - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { NSRect _controlRect = cellFrame; float _Y = cellFrame.origin.y; NSRect _accessoryRect = NSMakeRect(_controlRect.size.width - 70.0f, _Y + 9.0f, 50.0f, 23.0f); _switch = [self _choiceSwitch]; [_switch setFrame:_accessoryRect]; [controlView addSubview:_switch]; }
0
11,650,416
07/25/2012 13:07:00
1,269,291
03/14/2012 14:44:47
40
0
Passing a file path from XSL to JavaScript Function
I am trying to pass a folder path from XSL to JavaScript. Function is there in JavaScript and that function is getting called on onClick button of a HTML button in XSL. The path is like "C:\ABC\DEF\GH". While putting an alert I saw that path is getting sent like: "CABCDEFGH". All the slashes are removed. Even I removed the function call on OnClick event and just put an alert there with hard coded path, still same thing. It removed all the slashes. How to send the exact path with slashes to JavaScript. Thanks in advance.
javascript
xslt
null
null
null
null
open
Passing a file path from XSL to JavaScript Function === I am trying to pass a folder path from XSL to JavaScript. Function is there in JavaScript and that function is getting called on onClick button of a HTML button in XSL. The path is like "C:\ABC\DEF\GH". While putting an alert I saw that path is getting sent like: "CABCDEFGH". All the slashes are removed. Even I removed the function call on OnClick event and just put an alert there with hard coded path, still same thing. It removed all the slashes. How to send the exact path with slashes to JavaScript. Thanks in advance.
0
11,650,417
07/25/2012 13:07:09
1,551,643
07/25/2012 12:46:49
1
0
How to access functions from calling module from within a Jython class?
I'm working with some Jython code where it makes sense for me to create an external module with a number of classes to encapsulate some of the date that we need model. However, in the calling module, we also have a number of functions that we've developed for calling into a third party system which I will need access to, without having to create a brand new connection to this system. Where I'm struggling is trying to figure out the correct method in Jython to call the functions in my parent module from within my classes. Ignoring the connection to our external system for the moment, the simplest example would be: Main.py: import test-module.testing as thisTest def doPrint(myvar): print (myvar) return myTest=thisTest() myTest.testprint() test-module/__init__.py: class testing(): def testPrint(self): doPrint("Test message") Clearly, the call to `doPrint()` in the class is always going to fail as it has no way of referencing the calling module. Am I missing something really obvious here, or is this simply not the way to tackle the problem? Many thanks! :)
jython
null
null
null
null
null
open
How to access functions from calling module from within a Jython class? === I'm working with some Jython code where it makes sense for me to create an external module with a number of classes to encapsulate some of the date that we need model. However, in the calling module, we also have a number of functions that we've developed for calling into a third party system which I will need access to, without having to create a brand new connection to this system. Where I'm struggling is trying to figure out the correct method in Jython to call the functions in my parent module from within my classes. Ignoring the connection to our external system for the moment, the simplest example would be: Main.py: import test-module.testing as thisTest def doPrint(myvar): print (myvar) return myTest=thisTest() myTest.testprint() test-module/__init__.py: class testing(): def testPrint(self): doPrint("Test message") Clearly, the call to `doPrint()` in the class is always going to fail as it has no way of referencing the calling module. Am I missing something really obvious here, or is this simply not the way to tackle the problem? Many thanks! :)
0
11,584,244
07/20/2012 17:32:29
265,650
02/03/2010 21:05:20
636
18
CSS: div with cross label and horizontal label
I was looking at a post here - [http://speckyboy.com/2009/02/19/12-wordpress-plugins-to-display-and-highlight-code-within-your-blog/][1] and noticed that the snapshots are having a side label bar and a botton horizontal bar for labeling contents. How can this be achieved using CSS? Update: I am talking about the cross-bar in the first image that says "snapshot" and "WP Advanced Code Editor"! [1]: http://speckyboy.com/2009/02/19/12-wordpress-plugins-to-display-and-highlight-code-within-your-blog/
css
css3
null
null
null
null
open
CSS: div with cross label and horizontal label === I was looking at a post here - [http://speckyboy.com/2009/02/19/12-wordpress-plugins-to-display-and-highlight-code-within-your-blog/][1] and noticed that the snapshots are having a side label bar and a botton horizontal bar for labeling contents. How can this be achieved using CSS? Update: I am talking about the cross-bar in the first image that says "snapshot" and "WP Advanced Code Editor"! [1]: http://speckyboy.com/2009/02/19/12-wordpress-plugins-to-display-and-highlight-code-within-your-blog/
0
11,650,426
07/25/2012 13:07:30
754,131
05/15/2011 01:39:29
31
3
Working with a Hypermedia (REST) API in Backbone
In the process of building a Backbone.js SPA that talks to a RESTful (hopefully) API. I've tried to design the API around resources, using hypermedia to link the resources together. As I've begun implementing things in Backbone, I'm starting to realize that accomplishing true hypermedia with Backbone may not be a good fit. The main issue is backbone routers wanting to have their paths declared up-front. With a good Hypermedia API, resource URIs should not be hard-coded in the client, to allow for flexibility in adding new features and (*gasp*) changing resource locations. I'm playing with the idea of decoupling client-level **Page Resources** from API-level **Object Resources**. Somebody scream if this is nuts. Basically, this would mean defining routes to resources within my backbone app (think a discrete page), which would then retrieve one or more API-level resources. This leads to some interesting questions: 1. Is this even a good idea? Should I do my best to re-use the API-level resource URIs within my app such that the routes are 1-to-1. - I realize that a *page* and an *api object* are just different representations of the same resource, but in most cases, a page is a composite of multiple resources. Or I'm just crazy :) 2. What happens with page-refreshes in the middle of a series of navigations. How do I know the location of the API-level resources if they aren't the same? 3. It seems to me that RESTful design emphasizes *discovery* over knowing things up front. Am I right in assuming this? Is this what code download is all about? Can someone point me to further reading if I'm going the right direction. *Most* of the resources are read-only, and so only use the GET verb, but I do have a few scenarios that use POST/PUT (DELETE really isn't in the domain of this particular client, except for possibly aborting an order before it's placed fully). *Let me just say that I am by no means a REST guru. I'm still in the process of learning, so feel free to tell me I'm off base completely. No feelings will be hurt.
rest
backbone.js
hypermedia
null
null
null
open
Working with a Hypermedia (REST) API in Backbone === In the process of building a Backbone.js SPA that talks to a RESTful (hopefully) API. I've tried to design the API around resources, using hypermedia to link the resources together. As I've begun implementing things in Backbone, I'm starting to realize that accomplishing true hypermedia with Backbone may not be a good fit. The main issue is backbone routers wanting to have their paths declared up-front. With a good Hypermedia API, resource URIs should not be hard-coded in the client, to allow for flexibility in adding new features and (*gasp*) changing resource locations. I'm playing with the idea of decoupling client-level **Page Resources** from API-level **Object Resources**. Somebody scream if this is nuts. Basically, this would mean defining routes to resources within my backbone app (think a discrete page), which would then retrieve one or more API-level resources. This leads to some interesting questions: 1. Is this even a good idea? Should I do my best to re-use the API-level resource URIs within my app such that the routes are 1-to-1. - I realize that a *page* and an *api object* are just different representations of the same resource, but in most cases, a page is a composite of multiple resources. Or I'm just crazy :) 2. What happens with page-refreshes in the middle of a series of navigations. How do I know the location of the API-level resources if they aren't the same? 3. It seems to me that RESTful design emphasizes *discovery* over knowing things up front. Am I right in assuming this? Is this what code download is all about? Can someone point me to further reading if I'm going the right direction. *Most* of the resources are read-only, and so only use the GET verb, but I do have a few scenarios that use POST/PUT (DELETE really isn't in the domain of this particular client, except for possibly aborting an order before it's placed fully). *Let me just say that I am by no means a REST guru. I'm still in the process of learning, so feel free to tell me I'm off base completely. No feelings will be hurt.
0
11,650,429
07/25/2012 13:07:33
978,461
10/04/2011 12:53:14
207
0
How to apply a javascript to my webView's html content in Android?
Im working on an epub reader for android platform. Not me started the project i just continue it so i have tons of code to get in to it. My question is simple: Is there a way in android to apply javascript to my html content inside my webView ? I would like to make the html's font-size smaller or bigger by clicking a button for example... So users could modify font-size inside the webView. Is there a way to achiev this ? Any suggestions will be appreciated! Thanks,
javascript
android
android-webview
null
null
null
open
How to apply a javascript to my webView's html content in Android? === Im working on an epub reader for android platform. Not me started the project i just continue it so i have tons of code to get in to it. My question is simple: Is there a way in android to apply javascript to my html content inside my webView ? I would like to make the html's font-size smaller or bigger by clicking a button for example... So users could modify font-size inside the webView. Is there a way to achiev this ? Any suggestions will be appreciated! Thanks,
0
11,395,622
07/09/2012 13:04:36
1,510,692
07/08/2012 23:17:46
8
0
Chrome extension to reload and close tab after a time interval
i am working on a extension for google chrome that reloads the a tab once after 2 seconds that the page has loaded and after that waits for 30 minutes and closes the tab or google chrome window. ive tried these scripts in my .js file but none of them seem to worked chrome.tabs.reload(integer tabId, object reloadProperties, function callback) chrome.tabs.remove(integer or array of integer tabIds, function callback) ive already added this permission to my manifest file: {"name": "My First Extension", "version": "1.0", "manifest_version": 2, "description": "The first extension that I made.", "content_scripts": [ {"matches": ["http://*/*"], "js": ["1.js"],"permissions": [ "tabs", "http://*/*"], "permissions": ["tabs"]}]} but it doesnt work thank you all
javascript
google-chrome
script
google-chrome-extension
null
null
open
Chrome extension to reload and close tab after a time interval === i am working on a extension for google chrome that reloads the a tab once after 2 seconds that the page has loaded and after that waits for 30 minutes and closes the tab or google chrome window. ive tried these scripts in my .js file but none of them seem to worked chrome.tabs.reload(integer tabId, object reloadProperties, function callback) chrome.tabs.remove(integer or array of integer tabIds, function callback) ive already added this permission to my manifest file: {"name": "My First Extension", "version": "1.0", "manifest_version": 2, "description": "The first extension that I made.", "content_scripts": [ {"matches": ["http://*/*"], "js": ["1.js"],"permissions": [ "tabs", "http://*/*"], "permissions": ["tabs"]}]} but it doesnt work thank you all
0
11,395,623
07/09/2012 13:04:38
646,536
02/27/2011 21:02:22
143
2
onkeyup event slowness
I have a aspx page with about 200 textboxes with onkeyup events that some users have complained is really slow. Would having all of those onkeyup events cause this slowness?
javascript
asp.net
null
null
null
null
open
onkeyup event slowness === I have a aspx page with about 200 textboxes with onkeyup events that some users have complained is really slow. Would having all of those onkeyup events cause this slowness?
0
11,408,704
07/10/2012 07:41:25
1,425,543
05/30/2012 08:31:46
1
1
SharePoint Workflow doesn't appear in SP Designer. Deployment was successful
I develop a SP Workflow Activity for SP Designer. The deployment is successful. In the webconfig-file the authorizedType is correctly inserted. <authorizedType Assembly="WorkflowActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c8e215f3e395427" Namespace="AdventureWorksWFs" TypeName="*" Authorized="True" /> Can anyone help?
c#
sharepoint
workflow
sharepoint-designer
sharepointdesigner
null
open
SharePoint Workflow doesn't appear in SP Designer. Deployment was successful === I develop a SP Workflow Activity for SP Designer. The deployment is successful. In the webconfig-file the authorizedType is correctly inserted. <authorizedType Assembly="WorkflowActivity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5c8e215f3e395427" Namespace="AdventureWorksWFs" TypeName="*" Authorized="True" /> Can anyone help?
0
11,410,348
07/10/2012 09:28:16
1,105,561
12/19/2011 09:20:03
5
0
JXtable.setHighlighters, refresh UI after editing table
I have a JXtable with some highlighters add with setHighlighters. When i edit a cell of my jxtable my UI is not always update. I have a problem on one system where i have to move the mouse over the jxtable for the jxtable's highlighters was update. But on my system it's work well. Do you know the reason ? I have forget something that I have to do ? Thanks you for your help.
swing
refresh
highlighter
jxtable
null
null
open
JXtable.setHighlighters, refresh UI after editing table === I have a JXtable with some highlighters add with setHighlighters. When i edit a cell of my jxtable my UI is not always update. I have a problem on one system where i have to move the mouse over the jxtable for the jxtable's highlighters was update. But on my system it's work well. Do you know the reason ? I have forget something that I have to do ? Thanks you for your help.
0
11,410,350
07/10/2012 09:28:22
604,480
02/05/2011 15:32:06
71
2
C++ typedef with nested templates is not a class, struct, or union type
I'm not sure to understand why the following code is not compiled with g++: t.cpp: In instantiation of ‘Distrib<double>’: t.cpp:28:56: instantiated from ‘Sampler<Distrib<Solution<double> > >’ t.cpp:35:48: instantiated from here t.cpp:16:45: erreur: ‘double’ is not a class, struct, or union type t.cpp:18:43: erreur: ‘double’ is not a class, struct, or union type I was expecting to be able to propagate the `AtomType` type across the nested templates… <!-- language: c++ --> #include <iostream> #include <vector> template<typename T> class Solution { public: typedef T AtomType; }; template<typename SOLT> class Distrib { public: typedef typename SOLT::AtomType AtomType; typedef std::vector<AtomType> Matrix; Matrix matrix; }; template<typename DT> class Sampler { public: typedef typename DT::AtomType AtomType; typedef typename Distrib<AtomType>::Matrix Matrix; Matrix matrix; }; int main() { Sampler< Distrib< Solution<double> > > sampler; }
c++
templates
typedef
typename
null
null
open
C++ typedef with nested templates is not a class, struct, or union type === I'm not sure to understand why the following code is not compiled with g++: t.cpp: In instantiation of ‘Distrib<double>’: t.cpp:28:56: instantiated from ‘Sampler<Distrib<Solution<double> > >’ t.cpp:35:48: instantiated from here t.cpp:16:45: erreur: ‘double’ is not a class, struct, or union type t.cpp:18:43: erreur: ‘double’ is not a class, struct, or union type I was expecting to be able to propagate the `AtomType` type across the nested templates… <!-- language: c++ --> #include <iostream> #include <vector> template<typename T> class Solution { public: typedef T AtomType; }; template<typename SOLT> class Distrib { public: typedef typename SOLT::AtomType AtomType; typedef std::vector<AtomType> Matrix; Matrix matrix; }; template<typename DT> class Sampler { public: typedef typename DT::AtomType AtomType; typedef typename Distrib<AtomType>::Matrix Matrix; Matrix matrix; }; int main() { Sampler< Distrib< Solution<double> > > sampler; }
0
11,410,355
07/10/2012 09:28:47
797,685
06/14/2011 12:55:25
58
0
Android: changing tab must refresh my listview of the db
i have an application made with tab host. i need to refresh my listview (the second tab) when clicked. this view contain the db data, it's obvious that it need to be always up to date (because in the entire app i make update,insert,delete,... how can i? this is the onCreate in the class called by the tab super.onCreate(savedInstanceState); setContentView(R.layout.bookmarks); final Database info=new Database(this); final Timer t = new Timer(); info.open(); final Cursor data=info.getData(); final ListView listView1 = (ListView) findViewById(R.id.list_mia); String[] from = new String[] {"contenuto"}; int[] to = new int[] { android.R.id.text1 }; SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1, data, from, to); listView1.setAdapter(adapter); i've tried recalling the code in onResume but no success...
android
database
tabs
refresh
null
null
open
Android: changing tab must refresh my listview of the db === i have an application made with tab host. i need to refresh my listview (the second tab) when clicked. this view contain the db data, it's obvious that it need to be always up to date (because in the entire app i make update,insert,delete,... how can i? this is the onCreate in the class called by the tab super.onCreate(savedInstanceState); setContentView(R.layout.bookmarks); final Database info=new Database(this); final Timer t = new Timer(); info.open(); final Cursor data=info.getData(); final ListView listView1 = (ListView) findViewById(R.id.list_mia); String[] from = new String[] {"contenuto"}; int[] to = new int[] { android.R.id.text1 }; SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1, data, from, to); listView1.setAdapter(adapter); i've tried recalling the code in onResume but no success...
0
11,410,361
07/10/2012 09:29:07
551,586
10/12/2010 15:15:22
34
0
Image resize in CSS hover
I have to scale up the image when I hover over it, it should scale up to 300x225 pixels from 100x75 pixels. Layout seems to work fine, it's just width does not scale up when hovered. Thank you in advance. CSS: .hoverbox a .preview { display: none; } .hoverbox a .preview img { display: inline; } .hoverbox a:hover .preview { display: block; position: absolute; top: -1em; left: -2em; z-index: 10; border-width: 1px 1px 6px 1px; border-style: solid; border-color: #fff7ea; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -moz-box-shadow: 2px 2px 2px #161615; -webkit-box-shadow: 2px 2px 2px #161615; box-shadow: 2px 2px 2px #161615; } .hoverbox img{ background: #fff; border-width: 1px 1px 6px 1px; border-style: solid; border-color: #fff7ea; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -moz-box-shadow: 2px 2px 2px #161615; -webkit-box-shadow: 2px 2px 2px #161615; box-shadow: 2px 2px 2px #161615; padding: 2px; vertical-align: top; width: 100px; height: 75px; } .hoverbox li { background: transparent; display: inline; float: left; margin: 3px; padding: 5px; position: relative; } .hoverbox .preview { width: 300px; height: 225px; } HTML: <section> <h1 class="headline">Feast your eyes.</h1> <ul class="hoverbox"> <li> <a href="#"><img src="200opt.jpg" alt="descr"/><img src="200opt.jpg" alt="description" class="preview" /></a> </li> </section> Thank you
css
null
null
null
null
null
open
Image resize in CSS hover === I have to scale up the image when I hover over it, it should scale up to 300x225 pixels from 100x75 pixels. Layout seems to work fine, it's just width does not scale up when hovered. Thank you in advance. CSS: .hoverbox a .preview { display: none; } .hoverbox a .preview img { display: inline; } .hoverbox a:hover .preview { display: block; position: absolute; top: -1em; left: -2em; z-index: 10; border-width: 1px 1px 6px 1px; border-style: solid; border-color: #fff7ea; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -moz-box-shadow: 2px 2px 2px #161615; -webkit-box-shadow: 2px 2px 2px #161615; box-shadow: 2px 2px 2px #161615; } .hoverbox img{ background: #fff; border-width: 1px 1px 6px 1px; border-style: solid; border-color: #fff7ea; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -moz-box-shadow: 2px 2px 2px #161615; -webkit-box-shadow: 2px 2px 2px #161615; box-shadow: 2px 2px 2px #161615; padding: 2px; vertical-align: top; width: 100px; height: 75px; } .hoverbox li { background: transparent; display: inline; float: left; margin: 3px; padding: 5px; position: relative; } .hoverbox .preview { width: 300px; height: 225px; } HTML: <section> <h1 class="headline">Feast your eyes.</h1> <ul class="hoverbox"> <li> <a href="#"><img src="200opt.jpg" alt="descr"/><img src="200opt.jpg" alt="description" class="preview" /></a> </li> </section> Thank you
0
11,410,363
07/10/2012 09:29:12
1,355,300
04/25/2012 05:10:06
128
0
PHP calling a function in function_exists
If I use `function_exists` as following: if ( ! function_exists( 'get_value' ) ) : function get_value( $field ) { .. return $value; } endif; Now, when I call the function in the same file before the above function, it will give fatal error: Fatal error: Call to undefined function get_value() ... But, if i call it after the above function, it will return the value without any error. Now, if I remove the function_exists condition, ie: function get_value( $field ) { .. return $value; } Then it will work if i call this function before or after in the same document. Why is this so?
php
function
null
null
null
null
open
PHP calling a function in function_exists === If I use `function_exists` as following: if ( ! function_exists( 'get_value' ) ) : function get_value( $field ) { .. return $value; } endif; Now, when I call the function in the same file before the above function, it will give fatal error: Fatal error: Call to undefined function get_value() ... But, if i call it after the above function, it will return the value without any error. Now, if I remove the function_exists condition, ie: function get_value( $field ) { .. return $value; } Then it will work if i call this function before or after in the same document. Why is this so?
0
11,410,365
07/10/2012 09:29:22
1,488,756
06/28/2012 13:52:52
3
0
DB compression with MSSQL 2008R2 server
In MSSQL2008r2, at the time of backup there is 3 mode available under compression field 1.)Use the default server setting 2.)Compress Backup 3.)Do not Compress Backup here i have a doubt that when we take backup by choosing the option "Compress Backup", so it will affect any kind of data loss or performance issue with the DB or it is same as to choose "Do not Compress Backup" or "Use the default server setting"
sql-server-2008
null
null
null
null
null
open
DB compression with MSSQL 2008R2 server === In MSSQL2008r2, at the time of backup there is 3 mode available under compression field 1.)Use the default server setting 2.)Compress Backup 3.)Do not Compress Backup here i have a doubt that when we take backup by choosing the option "Compress Backup", so it will affect any kind of data loss or performance issue with the DB or it is same as to choose "Do not Compress Backup" or "Use the default server setting"
0
11,410,367
07/10/2012 09:29:36
433,570
08/28/2010 07:11:43
1,382
22
moving layer doesn't seem smooth in cocos2d
I have a code like below if(condition) sprite->setPosition(newPosition) else layer->moveBy(diff) it works ok, but movement is not smooth.. (the code tries to keep the sprite in center while the sprite is not near the bounds of layer) setPosition() and moveBy() is called in alternate and I think that's causing the non-smoothness. 1. move layer and sprite is also off the center. 2. move sprite to center 1. go back to 1. How can I fix this? I wonder if I can move layer with leaving the sprite in the center of screen alone.
cocos2d
layer
cocos2d-x
null
null
null
open
moving layer doesn't seem smooth in cocos2d === I have a code like below if(condition) sprite->setPosition(newPosition) else layer->moveBy(diff) it works ok, but movement is not smooth.. (the code tries to keep the sprite in center while the sprite is not near the bounds of layer) setPosition() and moveBy() is called in alternate and I think that's causing the non-smoothness. 1. move layer and sprite is also off the center. 2. move sprite to center 1. go back to 1. How can I fix this? I wonder if I can move layer with leaving the sprite in the center of screen alone.
0
11,280,362
07/01/2012 07:46:49
1,414,139
05/24/2012 05:01:08
44
2
Error in logging in facebook for wp7
I have facebook api and integrated facebook login for my wp7 app. I dont know, but when i try to login facebook, it is asking to install something. I have also added an image below about this problem. Can anybody help me with this? Thanks in advance for your help! ![enter image description here][1] [1]: http://i.stack.imgur.com/87dPb.png
c#
windows-phone-7
facebook-graph-api
null
null
07/01/2012 17:04:53
not a real question
Error in logging in facebook for wp7 === I have facebook api and integrated facebook login for my wp7 app. I dont know, but when i try to login facebook, it is asking to install something. I have also added an image below about this problem. Can anybody help me with this? Thanks in advance for your help! ![enter image description here][1] [1]: http://i.stack.imgur.com/87dPb.png
1
11,280,363
07/01/2012 07:46:54
1,480,614
06/25/2012 17:08:31
1
0
Collecting data from website without API
I am looking to build a webapp to improve user experience in booking railway tickets in India.The API is impossible to get due to hefty charge to procure it.I have seen many apps that provide details of the trains etc through their apps. *** My Question is how are they scraping data from the website.**In genral how can i legally get data shown to user(i don't want payment and stuff that are impossible without API) on any website***.*How do people scarp such data?** Any tools/methods? *** Bear with me if question is naive.I'm pretty new to this stuff.
web-services
api
web-applications
data
web-scraping
null
open
Collecting data from website without API === I am looking to build a webapp to improve user experience in booking railway tickets in India.The API is impossible to get due to hefty charge to procure it.I have seen many apps that provide details of the trains etc through their apps. *** My Question is how are they scraping data from the website.**In genral how can i legally get data shown to user(i don't want payment and stuff that are impossible without API) on any website***.*How do people scarp such data?** Any tools/methods? *** Bear with me if question is naive.I'm pretty new to this stuff.
0
11,280,411
07/01/2012 07:59:21
1,262,401
03/11/2012 14:47:34
1
0
No apparent reason for high load average
We have several web servers running on Amazon (ec2) c1.xlarge, over Amazon AMI. The servers are duplicates of each other, running the exact same hardware and software. Each server spec is: 7 GB of memory 20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each) 1690 GB of instance storage 64-bit platform I/O Performance: High API name: c1.xlarge A couple of weeks ago we have run a yum upgrade on one of the servers. Starting on this upgrade the upgraded server started showing a high load average. Needless to say, we did not update the other servers and we can not do so until we understand the reason for this behavior. The strange thing is that when we compare the servers using top or iostat, we can not find the reason for the high load. Note that we have moved traffic from the "problematic" server to the others, which have made the "problematic" server less crowded in terms of requests, and still his load is higher. Do you have any idea what could it be, or where else can we check? Many thanks for the help! Oz. # # proper server # w command # 00:42:26 up 2 days, 19:54, 2 users, load average: 0.41, 0.48, 0.49 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT pts/1 82.80.137.29 00:28 14:05 0.01s 0.01s -bash pts/2 82.80.137.29 00:38 0.00s 0.02s 0.00s w # # proper server # iostat command # Linux 3.2.12-3.2.4.amzn1.x86_64 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 9.03 0.02 4.26 0.17 0.13 86.39 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn xvdap1 1.63 1.50 55.00 367236 13444008 xvdfp1 4.41 45.93 70.48 11227226 17228552 xvdfp2 2.61 2.01 59.81 491890 14620104 xvdfp3 8.16 14.47 94.23 3536522 23034376 xvdfp4 0.98 0.79 45.86 192818 11209784 # # problematic server # w command # 00:43:26 up 2 days, 21:52, 2 users, load average: 1.35, 1.10, 1.17 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT pts/0 82.80.137.29 00:28 15:04 0.02s 0.02s -bash pts/1 82.80.137.29 00:38 0.00s 0.05s 0.00s w # # problematic server # iostat command # Linux 3.2.20-1.29.6.amzn1.x86_64 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 7.97 0.04 3.43 0.19 0.07 88.30 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn xvdap1 2.10 1.49 76.54 374660 19253592 xvdfp1 5.64 40.98 85.92 10308946 21612112 xvdfp2 3.97 4.32 93.18 1087090 23439488 xvdfp3 10.87 30.30 115.14 7622474 28961720 xvdfp4 1.12 0.28 65.54 71034 16487112
amazon-ec2
high-load
iostat
null
null
07/01/2012 12:57:00
off topic
No apparent reason for high load average === We have several web servers running on Amazon (ec2) c1.xlarge, over Amazon AMI. The servers are duplicates of each other, running the exact same hardware and software. Each server spec is: 7 GB of memory 20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each) 1690 GB of instance storage 64-bit platform I/O Performance: High API name: c1.xlarge A couple of weeks ago we have run a yum upgrade on one of the servers. Starting on this upgrade the upgraded server started showing a high load average. Needless to say, we did not update the other servers and we can not do so until we understand the reason for this behavior. The strange thing is that when we compare the servers using top or iostat, we can not find the reason for the high load. Note that we have moved traffic from the "problematic" server to the others, which have made the "problematic" server less crowded in terms of requests, and still his load is higher. Do you have any idea what could it be, or where else can we check? Many thanks for the help! Oz. # # proper server # w command # 00:42:26 up 2 days, 19:54, 2 users, load average: 0.41, 0.48, 0.49 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT pts/1 82.80.137.29 00:28 14:05 0.01s 0.01s -bash pts/2 82.80.137.29 00:38 0.00s 0.02s 0.00s w # # proper server # iostat command # Linux 3.2.12-3.2.4.amzn1.x86_64 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 9.03 0.02 4.26 0.17 0.13 86.39 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn xvdap1 1.63 1.50 55.00 367236 13444008 xvdfp1 4.41 45.93 70.48 11227226 17228552 xvdfp2 2.61 2.01 59.81 491890 14620104 xvdfp3 8.16 14.47 94.23 3536522 23034376 xvdfp4 0.98 0.79 45.86 192818 11209784 # # problematic server # w command # 00:43:26 up 2 days, 21:52, 2 users, load average: 1.35, 1.10, 1.17 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT pts/0 82.80.137.29 00:28 15:04 0.02s 0.02s -bash pts/1 82.80.137.29 00:38 0.00s 0.05s 0.00s w # # problematic server # iostat command # Linux 3.2.20-1.29.6.amzn1.x86_64 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 7.97 0.04 3.43 0.19 0.07 88.30 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn xvdap1 2.10 1.49 76.54 374660 19253592 xvdfp1 5.64 40.98 85.92 10308946 21612112 xvdfp2 3.97 4.32 93.18 1087090 23439488 xvdfp3 10.87 30.30 115.14 7622474 28961720 xvdfp4 1.12 0.28 65.54 71034 16487112
2
11,280,412
07/01/2012 07:59:34
1,056,166
11/20/2011 08:25:52
1
0
Getting Error while returning back using Server.Transfer()
I have page(Default1.aspx) in that i am redirecting to another page(Default2.aspx) using Server.Transfer() method. After the page processing completed in Default2.aspx the execution returns back to Default1.aspx, that time i am getting the error as "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack". why am i getting this and how to avoid this by using Server.Transfer() method.? regards, Santho$h
c#
asp.net
.net
null
null
null
open
Getting Error while returning back using Server.Transfer() === I have page(Default1.aspx) in that i am redirecting to another page(Default2.aspx) using Server.Transfer() method. After the page processing completed in Default2.aspx the execution returns back to Default1.aspx, that time i am getting the error as "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack". why am i getting this and how to avoid this by using Server.Transfer() method.? regards, Santho$h
0
11,280,414
07/01/2012 08:00:00
539,176
12/11/2010 21:31:48
36
1
How does appengine's data store query and index multi-value properties?
Lets say I have a Photo class containing a multi-valued property for tags and a date field. I would like to allow the user to perform a query based on tags (using only a AND operator for more then 1 tag). For example lets say a user searches for a rainy day. Select * from Photo where tag='clouds' AND tag='rainy' How does the zig-zag merge work? I know that two scans are performed, and based on if the keys from both searches point to the same Photo then it's returned. Does this happen in parallel however? Ex: While Search 1 finds a photo that contains tag 'clouds' , Search 2 is finding the first photo that contains tag "rainy". When both searches are done, it becomes synchronous. Search 1 then continues it's scan until it hits the same key as S2. Then while the keys for each search are the same, the photo is returned, and the "cursor" is moved along 1 step for each search? Secondly, does defining multiple indexes speed up these sort of queries? Ex, if I wanted to allow up to 4 tags then I would need to define the indexes such as: Index(Photo) Index(Photo, tag) Index(Photo, tag,tag) Index(Photo, tag,tag,tag) Index(Photo, tag,tag,tag,tag) Then, performing the same query above will be quicker? Also, using our original query, lets say we have Millions of photos tagged as cloudy, but only two are tagged as rainy. Does this mean zig-zag will perform relatively slow? Since one of the searches will try to find a matching key exist? Even worse, if we have one million photos tagged "rainy" and one million are tagged "cloudly" yet no single photo have both tags in them. Will defining the above index's fix this issue? Lastly, lets say a photo has 100 tags. Does that mean all the index's above have to include EVERY combination of the 100 tags? I know there are got-yas (such as a entity can only be indexed 5000 times, and a single multi-valued property can only be indexed a 1000 times).
query
google-app-engine
indexes
datastore
null
null
open
How does appengine's data store query and index multi-value properties? === Lets say I have a Photo class containing a multi-valued property for tags and a date field. I would like to allow the user to perform a query based on tags (using only a AND operator for more then 1 tag). For example lets say a user searches for a rainy day. Select * from Photo where tag='clouds' AND tag='rainy' How does the zig-zag merge work? I know that two scans are performed, and based on if the keys from both searches point to the same Photo then it's returned. Does this happen in parallel however? Ex: While Search 1 finds a photo that contains tag 'clouds' , Search 2 is finding the first photo that contains tag "rainy". When both searches are done, it becomes synchronous. Search 1 then continues it's scan until it hits the same key as S2. Then while the keys for each search are the same, the photo is returned, and the "cursor" is moved along 1 step for each search? Secondly, does defining multiple indexes speed up these sort of queries? Ex, if I wanted to allow up to 4 tags then I would need to define the indexes such as: Index(Photo) Index(Photo, tag) Index(Photo, tag,tag) Index(Photo, tag,tag,tag) Index(Photo, tag,tag,tag,tag) Then, performing the same query above will be quicker? Also, using our original query, lets say we have Millions of photos tagged as cloudy, but only two are tagged as rainy. Does this mean zig-zag will perform relatively slow? Since one of the searches will try to find a matching key exist? Even worse, if we have one million photos tagged "rainy" and one million are tagged "cloudly" yet no single photo have both tags in them. Will defining the above index's fix this issue? Lastly, lets say a photo has 100 tags. Does that mean all the index's above have to include EVERY combination of the 100 tags? I know there are got-yas (such as a entity can only be indexed 5000 times, and a single multi-valued property can only be indexed a 1000 times).
0
11,280,415
07/01/2012 08:00:06
1,310,515
04/03/2012 13:13:58
120
0
Hiding Top Level List Items
I am looking for a pure CSS solution to hide top level list items in an unordered list. For example: <ul> <li> Top level item 1 <li> Top level item 2 <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> <li> Top level item 3 </ul> Becomes... <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> Initially I figured I this would be quite simple. I created a simple little example like so... <ul> <li> Top level item 1 <li> Top level item 2 <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> <li> Top level item 3 </ul> Styling it using something like... .menu ul{ display:none; } .menu ul li ul{ display:inline-block; } ...but it seems that if the parent ul is hidden then I can't show the child ul. Any suggestions?
css
html-lists
null
null
null
null
open
Hiding Top Level List Items === I am looking for a pure CSS solution to hide top level list items in an unordered list. For example: <ul> <li> Top level item 1 <li> Top level item 2 <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> <li> Top level item 3 </ul> Becomes... <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> Initially I figured I this would be quite simple. I created a simple little example like so... <ul> <li> Top level item 1 <li> Top level item 2 <ul> <li> Sub item 1 <li> Sub item 2 <li> Sub item 3 </ul> <li> Top level item 3 </ul> Styling it using something like... .menu ul{ display:none; } .menu ul li ul{ display:inline-block; } ...but it seems that if the parent ul is hidden then I can't show the child ul. Any suggestions?
0
11,280,423
07/01/2012 08:01:07
1,259,261
03/09/2012 12:20:24
87
5
wrapping document.createElement() with custom type
I want to make a viewport type that basically wraps a `<div>` tag with some custom styling options, but I'm not sure how to add the elements methods to my viewport type, I am trying something like this: var viewport = function(){ document.createElement.call(this, 'div'); // additional custom properties... this.customStuff = ExtraProperty; } //would this work? viewport.prototype = Object.create(document.createElement.prototype); // additional custom methods... viewport.prototype.constructor = viewport; I want my viewport objects to be able to be used just like a Element object. So I could call like this: var myVP = new viewport(); myVP.appendChild(someotherElementType); I'm just not sure how to wrap document.createElement properly/effectively as I'm not sure where the .appendChild and other methods live etc. If it were used like a typical constructor I know I could use the pattern above but as you don't need to write `new document.createElement('type');` I'm not sure. Thanks.
javascript
wrapper
null
null
null
null
open
wrapping document.createElement() with custom type === I want to make a viewport type that basically wraps a `<div>` tag with some custom styling options, but I'm not sure how to add the elements methods to my viewport type, I am trying something like this: var viewport = function(){ document.createElement.call(this, 'div'); // additional custom properties... this.customStuff = ExtraProperty; } //would this work? viewport.prototype = Object.create(document.createElement.prototype); // additional custom methods... viewport.prototype.constructor = viewport; I want my viewport objects to be able to be used just like a Element object. So I could call like this: var myVP = new viewport(); myVP.appendChild(someotherElementType); I'm just not sure how to wrap document.createElement properly/effectively as I'm not sure where the .appendChild and other methods live etc. If it were used like a typical constructor I know I could use the pattern above but as you don't need to write `new document.createElement('type');` I'm not sure. Thanks.
0
11,280,427
07/01/2012 08:01:37
1,433,512
06/03/2012 12:30:15
3
0
How can I add index in hibernate
how can i add new index to entity in existing schema in hibernate without change mode in my hibernate.cgf file from update to create. I don't want to delete existing records from my tables.
java
hibernate
null
null
null
null
open
How can I add index in hibernate === how can i add new index to entity in existing schema in hibernate without change mode in my hibernate.cgf file from update to create. I don't want to delete existing records from my tables.
0
11,280,428
07/01/2012 08:01:44
1,493,470
06/30/2012 19:29:08
1
0
Need clarifications working with Views in iOS
Ok, I'm learning programming for iOS with Stanford's online course on iTunes U (CS193P) but I can't exactly get a hold on how all the stuff from UIView works. Could someone explain how the following things work cohesively and how I should use them? CGContextRef CGContext(if they're not the same thing) drawRect awakeFromNib Thanks in advance!
ios
uiview
drawrect
cs193p
cgcontextref
null
open
Need clarifications working with Views in iOS === Ok, I'm learning programming for iOS with Stanford's online course on iTunes U (CS193P) but I can't exactly get a hold on how all the stuff from UIView works. Could someone explain how the following things work cohesively and how I should use them? CGContextRef CGContext(if they're not the same thing) drawRect awakeFromNib Thanks in advance!
0
11,443,213
07/11/2012 23:48:11
1,181,827
02/01/2012 03:27:56
63
1
Observe touches on multiple views in one motion
I have a parent view with 3 separate child views. The child views are spread out within the parent with no overlap (and with some space in between). As a user moves her finger around the screen (without lifting it), I'd like to track touches as they enter and exit each of the child views. **Example**: If the user begins touching somewhere on the screen outside of the child views, then swipes her finger over child 1, off of child 1, over child 2, and then lets go, I would expect these events to be triggered: 1. Touch began 2. Touch entered child 1 3. Touch exited child 1 4. Touch entered child 2 5. Touch ended It seems as if touchesBegan:withEvent: and touchesEnded:withEvent: methods would be helpful in this case, but when I define them on the child view controllers, they don't do exactly what I want -- if the user begins touching outside the child view, then swipes over the child view, no touch events are triggered on the child itself. **Current Solution**: I'm currently using a solution that feels really hacky to accomplish this. I'm observing touchesBegan:withEvent:, touchesEnded:withEvent:, and touchesMoved:withEvent: on the parent, grabbing the coordinates of each event, and determining if they lie within the bounds of a child. If they do, I trigger the appropriate events as described above. This method mostly works, but feels very inefficient. It feels like the framework should handle this work for me. My state management code also sometimes misses an "enter" or "exit" trigger and I suspect it's because touch events were either dropped or came to me in an unexpected order. Am I missing a better method here?
objective-c
ios
cocoa-touch
events
touch
null
open
Observe touches on multiple views in one motion === I have a parent view with 3 separate child views. The child views are spread out within the parent with no overlap (and with some space in between). As a user moves her finger around the screen (without lifting it), I'd like to track touches as they enter and exit each of the child views. **Example**: If the user begins touching somewhere on the screen outside of the child views, then swipes her finger over child 1, off of child 1, over child 2, and then lets go, I would expect these events to be triggered: 1. Touch began 2. Touch entered child 1 3. Touch exited child 1 4. Touch entered child 2 5. Touch ended It seems as if touchesBegan:withEvent: and touchesEnded:withEvent: methods would be helpful in this case, but when I define them on the child view controllers, they don't do exactly what I want -- if the user begins touching outside the child view, then swipes over the child view, no touch events are triggered on the child itself. **Current Solution**: I'm currently using a solution that feels really hacky to accomplish this. I'm observing touchesBegan:withEvent:, touchesEnded:withEvent:, and touchesMoved:withEvent: on the parent, grabbing the coordinates of each event, and determining if they lie within the bounds of a child. If they do, I trigger the appropriate events as described above. This method mostly works, but feels very inefficient. It feels like the framework should handle this work for me. My state management code also sometimes misses an "enter" or "exit" trigger and I suspect it's because touch events were either dropped or came to me in an unexpected order. Am I missing a better method here?
0
11,443,277
07/11/2012 23:55:37
1,255,817
03/07/2012 22:16:42
122
0
Complex pattern matching with strings
I have a list of strings that looks like this: xs = ["xxbbaua", "bbbaacv", "ggfeehhaa", "uyyttaccaa", "bbbaab"] I would like to find only strings in the list which have two b's followed by any character followed by a vowel. How are simple matches like this done in Haskell. Is there a better solution that regular expressions? Can anyone help me with an example? Thanks.
haskell
null
null
null
null
null
open
Complex pattern matching with strings === I have a list of strings that looks like this: xs = ["xxbbaua", "bbbaacv", "ggfeehhaa", "uyyttaccaa", "bbbaab"] I would like to find only strings in the list which have two b's followed by any character followed by a vowel. How are simple matches like this done in Haskell. Is there a better solution that regular expressions? Can anyone help me with an example? Thanks.
0
11,443,282
07/11/2012 23:56:35
1,416,290
05/24/2012 23:55:13
13
0
Winapi shell extension overriding Windows command
I developed a very basic shell extension for a little application I'm working on. I've been using it for a while now without any problem, but I just noticed that in Windows xp, in start menu -> all programs, if I right click on a folder there and choose "open" or "explore", my little application shows up instead of an explorer window. You can imagine how happy and proud I was when I saw this. I find it weird since this is the only place where it happens (so far...). I registered the shell extension under the "directory" registry key so it shows up only when a folder is right clicked. I've found some good article on shell extensions and I made it so far with those, but I'm nowhere near my comfy zone in this winapi stuff. I did a lot of fiddling with the ids, but I can't figure out what the problem is. Here is my querycontextmenu implementation and I hope I made a dumb mistake in there that a c++ guru can spot right away. Any help will be appreciated. STDMETHODIMP ShellExtension::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags){ if (CMF_DEFAULTONLY & uFlags) { return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); } UINT uID = idCmdFirst; if (!InsertMenu(hMenu, indexMenu, MF_SEPARATOR | MF_BYPOSITION, 0, NULL)) { return HRESULT_FROM_WIN32(GetLastError()); } HMENU hSubmenu = CreatePopupMenu(); InsertMenu (hSubmenu, 0, MF_BYPOSITION, uID++, (this->isFrench ? SET_REF_TEXT : SET_REF_TEXT_EN)); InsertMenu (hSubmenu, 1, MF_BYPOSITION, uID++, (this->isFrench ? SET_COMP_TEXT : SET_COMP_TEXT_EN)); MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_BITMAP | MIIM_SUBMENU | MIIM_DATA | MIIM_STRING; mii.hSubMenu = hSubmenu; mii.fType = MFT_STRING; mii.dwTypeData = (this->isFrench ? MAIN_TEXT : MAIN_TEXT_EN); mii.hbmpItem = IsRequirePainting() ? HBMMENU_CALLBACK : m_hMenuBmp; mii.wID = uID++; if (!InsertMenuItem(hMenu, indexMenu, TRUE, &mii)) { return HRESULT_FROM_WIN32(GetLastError()); } if (!InsertMenu(hMenu, indexMenu, MF_SEPARATOR | MF_BYPOSITION, 0, NULL)) { return HRESULT_FROM_WIN32(GetLastError()); } return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, uID - idCmdFirst);} Thanks!
c++
c
windows
winapi
contextmenu
07/13/2012 09:19:07
not a real question
Winapi shell extension overriding Windows command === I developed a very basic shell extension for a little application I'm working on. I've been using it for a while now without any problem, but I just noticed that in Windows xp, in start menu -> all programs, if I right click on a folder there and choose "open" or "explore", my little application shows up instead of an explorer window. You can imagine how happy and proud I was when I saw this. I find it weird since this is the only place where it happens (so far...). I registered the shell extension under the "directory" registry key so it shows up only when a folder is right clicked. I've found some good article on shell extensions and I made it so far with those, but I'm nowhere near my comfy zone in this winapi stuff. I did a lot of fiddling with the ids, but I can't figure out what the problem is. Here is my querycontextmenu implementation and I hope I made a dumb mistake in there that a c++ guru can spot right away. Any help will be appreciated. STDMETHODIMP ShellExtension::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags){ if (CMF_DEFAULTONLY & uFlags) { return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); } UINT uID = idCmdFirst; if (!InsertMenu(hMenu, indexMenu, MF_SEPARATOR | MF_BYPOSITION, 0, NULL)) { return HRESULT_FROM_WIN32(GetLastError()); } HMENU hSubmenu = CreatePopupMenu(); InsertMenu (hSubmenu, 0, MF_BYPOSITION, uID++, (this->isFrench ? SET_REF_TEXT : SET_REF_TEXT_EN)); InsertMenu (hSubmenu, 1, MF_BYPOSITION, uID++, (this->isFrench ? SET_COMP_TEXT : SET_COMP_TEXT_EN)); MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_BITMAP | MIIM_SUBMENU | MIIM_DATA | MIIM_STRING; mii.hSubMenu = hSubmenu; mii.fType = MFT_STRING; mii.dwTypeData = (this->isFrench ? MAIN_TEXT : MAIN_TEXT_EN); mii.hbmpItem = IsRequirePainting() ? HBMMENU_CALLBACK : m_hMenuBmp; mii.wID = uID++; if (!InsertMenuItem(hMenu, indexMenu, TRUE, &mii)) { return HRESULT_FROM_WIN32(GetLastError()); } if (!InsertMenu(hMenu, indexMenu, MF_SEPARATOR | MF_BYPOSITION, 0, NULL)) { return HRESULT_FROM_WIN32(GetLastError()); } return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, uID - idCmdFirst);} Thanks!
1
11,443,206
07/11/2012 23:47:40
1,035,777
11/08/2011 14:24:15
59
0
mysql real escape string - is this normal?
When I use mysqli->real_escape_string and add a string value to the db such as "who's", it adds the string without modifying the quote in any way. When I check the db, the value within it is "who's". When I do not use mysqli->real_escape_string and add a string with a single quote like "who's", it just doesn't get added to the database. It is nowhere to be found. This isn't normal, is it?
php
mysql
mysqli
mysql-real-escape-string
null
null
open
mysql real escape string - is this normal? === When I use mysqli->real_escape_string and add a string value to the db such as "who's", it adds the string without modifying the quote in any way. When I check the db, the value within it is "who's". When I do not use mysqli->real_escape_string and add a string with a single quote like "who's", it just doesn't get added to the database. It is nowhere to be found. This isn't normal, is it?
0
11,443,207
07/11/2012 23:47:40
836,924
07/09/2011 17:41:59
58
1
Need to pull path info from file to create new file at same location
I am trying to traverse a directory with thousands of subdirectories. In each subdirectory there is a .nfo file. I am using Xdocument to parse some info from it, and I need to create a new file in the same location as the source .nfo file. I think I have all of the basic parts, but I can't figure out how to create the new file in the same location as the source file. Here is what I have so far: string strID = null; string[] filesNFO = Directory.GetFiles(@"D:\Test\", "*.nfo", SearchOption.AllDirectories); foreach(string file in filesNFO) { var doc = XDocument.Load(file); strID = doc.Root.Element("id") == null ? "" : doc.Root.Element("id").Value; FileStream fs = new FileStream("info.nfo", FileMode.Create); StreamWriter info = new StreamWriter(fs); info.Write("http://powerhostcrm.com/" + strID); info.Close(); }
c#
filesystems
null
null
null
null
open
Need to pull path info from file to create new file at same location === I am trying to traverse a directory with thousands of subdirectories. In each subdirectory there is a .nfo file. I am using Xdocument to parse some info from it, and I need to create a new file in the same location as the source .nfo file. I think I have all of the basic parts, but I can't figure out how to create the new file in the same location as the source file. Here is what I have so far: string strID = null; string[] filesNFO = Directory.GetFiles(@"D:\Test\", "*.nfo", SearchOption.AllDirectories); foreach(string file in filesNFO) { var doc = XDocument.Load(file); strID = doc.Root.Element("id") == null ? "" : doc.Root.Element("id").Value; FileStream fs = new FileStream("info.nfo", FileMode.Create); StreamWriter info = new StreamWriter(fs); info.Write("http://powerhostcrm.com/" + strID); info.Close(); }
0
11,298,319
07/02/2012 17:25:58
1,475,945
06/22/2012 21:09:06
1
0
Once I activate admin, Django under mod_wsgi can't find other URLs
I'm trying to do the Django tutorial. Part 1 went OK (i.stack.imgur.com/US5GN.jpg) However, once I activate the admin site the root I get i.stack.imgur.com/EXfE4.jpg. `dj1.net` is my test domain (editing `/etc/hosts`), and while `dj1.net/admin/` now works as expected, I don't know why `dj1.net/` throws this error once I uncomment (as instructed) the line url(r'^admin/', include(admin.site.urls)), under `mysite/urls.py` (in my case `dj1_net/urls.py`). It seems to me everything should work as before *unless* the GET request is against `/admin/`. My stack: a Debian 6.0 VPS with Apache and mod_wsgi. **I want to avoid Django's built-in server**: if I can't deploy it for real, I'd rather know earlier rather than later. In fact, for easy PHP support I'm very interested in an Apache-based solution. For further reference, here is my `/etc/apache2/sites-available/dj1.net`: <VirtualHost *:80> ServerName dj1.net DocumentRoot /var/www/dj1_net Alias /static/ /var/www/dj1_net/static/ Alias /media/ /var/www/dj1_net/media/ ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined WSGIScriptAlias / /var/www/dj1_net/django.wsgi WSGIProcessGroup dj1_net WSGIDaemonProcess dj1_net processes=2 threads=16 maximum-requests=1000 display-name=apache-dj1_net-wsgi </VirtualHost> Finally, here is `/var/www/dj1_net/django.wsgi`: import sys import os import os.path sys.path.append(os.path.dirname(__file__)) os.environ['DJANGO_SETTINGS_MODULE'] = 'dj1_net.settings' from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler() Just to be upfront, I know close to nil about Apache server configuration *and* WSGI. I do, however, want to make this set-up work before embarking in Django. I followed a mix of [the official instructions][4] and [this post][5], since I frankly couldn't make get Django to work applying either instructions verbatim. I'm afraid the bottom of the problem must lie there... Any tips will be greatly appreciated. Cheers! S.P. [1]: https://docs.djangoproject.com/en/dev/intro/tutorial01/ [2]: http://i.stack.imgur.com/US5GN.jpg [3]: http://i.stack.imgur.com/EXfE4.jpg [4]: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ [5]: http://mindref.blogspot.com.es/2011/08/debian-django-apache-modwsgi.html
django
mod-wsgi
null
null
null
null
open
Once I activate admin, Django under mod_wsgi can't find other URLs === I'm trying to do the Django tutorial. Part 1 went OK (i.stack.imgur.com/US5GN.jpg) However, once I activate the admin site the root I get i.stack.imgur.com/EXfE4.jpg. `dj1.net` is my test domain (editing `/etc/hosts`), and while `dj1.net/admin/` now works as expected, I don't know why `dj1.net/` throws this error once I uncomment (as instructed) the line url(r'^admin/', include(admin.site.urls)), under `mysite/urls.py` (in my case `dj1_net/urls.py`). It seems to me everything should work as before *unless* the GET request is against `/admin/`. My stack: a Debian 6.0 VPS with Apache and mod_wsgi. **I want to avoid Django's built-in server**: if I can't deploy it for real, I'd rather know earlier rather than later. In fact, for easy PHP support I'm very interested in an Apache-based solution. For further reference, here is my `/etc/apache2/sites-available/dj1.net`: <VirtualHost *:80> ServerName dj1.net DocumentRoot /var/www/dj1_net Alias /static/ /var/www/dj1_net/static/ Alias /media/ /var/www/dj1_net/media/ ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined WSGIScriptAlias / /var/www/dj1_net/django.wsgi WSGIProcessGroup dj1_net WSGIDaemonProcess dj1_net processes=2 threads=16 maximum-requests=1000 display-name=apache-dj1_net-wsgi </VirtualHost> Finally, here is `/var/www/dj1_net/django.wsgi`: import sys import os import os.path sys.path.append(os.path.dirname(__file__)) os.environ['DJANGO_SETTINGS_MODULE'] = 'dj1_net.settings' from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler() Just to be upfront, I know close to nil about Apache server configuration *and* WSGI. I do, however, want to make this set-up work before embarking in Django. I followed a mix of [the official instructions][4] and [this post][5], since I frankly couldn't make get Django to work applying either instructions verbatim. I'm afraid the bottom of the problem must lie there... Any tips will be greatly appreciated. Cheers! S.P. [1]: https://docs.djangoproject.com/en/dev/intro/tutorial01/ [2]: http://i.stack.imgur.com/US5GN.jpg [3]: http://i.stack.imgur.com/EXfE4.jpg [4]: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ [5]: http://mindref.blogspot.com.es/2011/08/debian-django-apache-modwsgi.html
0
11,298,322
07/02/2012 17:26:24
1,480,488
06/25/2012 16:06:46
1
0
Load Testing with TestNG
I want to preface this with 'I am a complete noob' when it comes to Java. I have figured out how to consume a webservice and get some tests against that webservice using TestNG. I would now like to be able to take those TestNG tests and use them in a load test. Is there a way that I can either use these TestNG tests in SoapUI or is there another tool which I can use to perform load testing of the webservice?
load
performance-testing
null
null
null
null
open
Load Testing with TestNG === I want to preface this with 'I am a complete noob' when it comes to Java. I have figured out how to consume a webservice and get some tests against that webservice using TestNG. I would now like to be able to take those TestNG tests and use them in a load test. Is there a way that I can either use these TestNG tests in SoapUI or is there another tool which I can use to perform load testing of the webservice?
0
11,298,323
07/02/2012 17:26:27
379,235
06/29/2010 16:45:28
1,747
32
Spring Bean: Doesn't seems to be wired up
My `wireup.xml` looks like <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <util:properties id="mongoProperties" location="file:///storage//local.properties" /> <bean id="mongoService" class="com.business.persist.MongoService" init-method="init"></bean> </beans> and `storage//local.properties` as ### === MongoDB interaction === ### host="127.0.0.1" port=27017 database=contract The Bean class `MongoService` as @Service public class MongoService { @Value("#{mongoProperties['host']}") private String host; @Value("#{mongoProperties['port']}") private int port; @Value("#{mongoProperties['database']}") private String database; private Mongo mongo; private static final Logger LOGGER = LoggerFactory.getLogger(MongoService.class); public MongoService() {} public void init() throws UnknownHostException { LOGGER.info("host=" + host + ", port=" + port + ", database=" + database); mongo = new Mongo(host, port); } public void putDocument(@Nonnull final DBObject document) { LOGGER.info("inserting document - " + document.toString()); mongo.getDB(database).getCollection(getCollectionName(document)).insert(document, WriteConcern.SAFE); } public void putDocuments(@Nonnull final List<DBObject> documents) { for (final DBObject document : documents) { putDocument(document); } } I test this class in `MongoServiceTest` as public class MongoServiceTest { @Autowired private MongoService mongoService; @Test public void testMongoService() { final DBObject document = DBContract.getUniqueQuery("001"); document.put(DBContract.R_VARIABLES, "values"); document.put(DBContract.P_VARIABLES, "values"); mongoService.putDocument(document); } When I run this I enncountered `NullpointerException` 10:24:23.956 [main] INFO c.s.sparrow.business.util.MongoRule - Setting up Mongo Database 10:24:23.963 [main] INFO c.s.sparrow.business.util.MongoRule - Shutting down the Mongo Database java.lang.NullPointerException at com.business.persist.MongoServiceTest.testMongoService(MongoServiceTest.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46) at org.junit.rules.RunRules.evaluate(RunRules.java:18) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) It doesn't seem like the wireup is actually creating a bean and calling the `init` method **Question** How can I fix this and make it work? Thank you
java
spring
null
null
null
null
open
Spring Bean: Doesn't seems to be wired up === My `wireup.xml` looks like <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <util:properties id="mongoProperties" location="file:///storage//local.properties" /> <bean id="mongoService" class="com.business.persist.MongoService" init-method="init"></bean> </beans> and `storage//local.properties` as ### === MongoDB interaction === ### host="127.0.0.1" port=27017 database=contract The Bean class `MongoService` as @Service public class MongoService { @Value("#{mongoProperties['host']}") private String host; @Value("#{mongoProperties['port']}") private int port; @Value("#{mongoProperties['database']}") private String database; private Mongo mongo; private static final Logger LOGGER = LoggerFactory.getLogger(MongoService.class); public MongoService() {} public void init() throws UnknownHostException { LOGGER.info("host=" + host + ", port=" + port + ", database=" + database); mongo = new Mongo(host, port); } public void putDocument(@Nonnull final DBObject document) { LOGGER.info("inserting document - " + document.toString()); mongo.getDB(database).getCollection(getCollectionName(document)).insert(document, WriteConcern.SAFE); } public void putDocuments(@Nonnull final List<DBObject> documents) { for (final DBObject document : documents) { putDocument(document); } } I test this class in `MongoServiceTest` as public class MongoServiceTest { @Autowired private MongoService mongoService; @Test public void testMongoService() { final DBObject document = DBContract.getUniqueQuery("001"); document.put(DBContract.R_VARIABLES, "values"); document.put(DBContract.P_VARIABLES, "values"); mongoService.putDocument(document); } When I run this I enncountered `NullpointerException` 10:24:23.956 [main] INFO c.s.sparrow.business.util.MongoRule - Setting up Mongo Database 10:24:23.963 [main] INFO c.s.sparrow.business.util.MongoRule - Shutting down the Mongo Database java.lang.NullPointerException at com.business.persist.MongoServiceTest.testMongoService(MongoServiceTest.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46) at org.junit.rules.RunRules.evaluate(RunRules.java:18) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) It doesn't seem like the wireup is actually creating a bean and calling the `init` method **Question** How can I fix this and make it work? Thank you
0
11,298,291
07/02/2012 17:23:25
209,794
11/12/2009 17:11:34
471
7
Utilize keytool programmtically in a Java servlet to create a certificate/keypair
We need to create an HTTP service that can create and return a certificate signed by a trusted parent certificate. Our initial plan was to use keytool in the bin directory of our jdk in a Servlet using Runtime.exec, but it seems the keytool commands require answers to prompts on the command line. For example: `keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048` asks a number of questions on the command line. Our next idea was to use java.security.KeyStore, but I don't see a way to export and persist the store, we will want to keep all our certificates in a jks file. If the web container goes down we definitely need to be able to keep all the PKI artifacts. Help!
servlets
cryptography
keystore
keytool
null
null
open
Utilize keytool programmtically in a Java servlet to create a certificate/keypair === We need to create an HTTP service that can create and return a certificate signed by a trusted parent certificate. Our initial plan was to use keytool in the bin directory of our jdk in a Servlet using Runtime.exec, but it seems the keytool commands require answers to prompts on the command line. For example: `keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048` asks a number of questions on the command line. Our next idea was to use java.security.KeyStore, but I don't see a way to export and persist the store, we will want to keep all our certificates in a jks file. If the web container goes down we definitely need to be able to keep all the PKI artifacts. Help!
0
11,349,602
07/05/2012 17:38:43
1,383,164
05/08/2012 21:35:54
13
2
URL Rewrite IIS 7.5 - 403 Forbidden error for aspx asp.net
Ok. I am setting up a website and hosting it for an organization (www.enfieldsdachurch.com). I have an asp.net page (www.enfieldsdachurch.com/sermons.aspx) and I'd like to remove the .aspx file extension so that the web-address is (www.enfieldsdachurch.com/sermons). For all the other pages (html/php) I am using URL rewrite rules to remove the extension, however whenever I try to do it for the asp-net page I keep on getting a 403:Forbidden Error. I have made sure that the sermons.aspx has full read/write control etc. Could someone please point me in the right direction? I am no expert and this, but I'm willing to learn and I appreciate any help that you can provide me. Thank you.
asp.net
url-rewriting
iis-7.5
http-status-code-403
null
null
open
URL Rewrite IIS 7.5 - 403 Forbidden error for aspx asp.net === Ok. I am setting up a website and hosting it for an organization (www.enfieldsdachurch.com). I have an asp.net page (www.enfieldsdachurch.com/sermons.aspx) and I'd like to remove the .aspx file extension so that the web-address is (www.enfieldsdachurch.com/sermons). For all the other pages (html/php) I am using URL rewrite rules to remove the extension, however whenever I try to do it for the asp-net page I keep on getting a 403:Forbidden Error. I have made sure that the sermons.aspx has full read/write control etc. Could someone please point me in the right direction? I am no expert and this, but I'm willing to learn and I appreciate any help that you can provide me. Thank you.
0
11,349,607
07/05/2012 17:38:58
1,108,948
12/21/2011 01:13:09
508
22
Merge two datatables
I have two datatables. Each has three columns, the two of them have the same name. However one column in table1 is "Desc", in table2 is named as "Descr". How to merge them together? Thanks.
c#
ado.net
datatable
null
null
null
open
Merge two datatables === I have two datatables. Each has three columns, the two of them have the same name. However one column in table1 is "Desc", in table2 is named as "Descr". How to merge them together? Thanks.
0
11,349,612
07/05/2012 17:39:10
1,274,998
03/16/2012 21:33:01
15
0
Can't get homemade CKEditor file uploader working in web2py
There's something arcane going on with my custom CKEditor uploader. The image or whatever file I try to upload to the server is correctly uploaded but no matter what I do it's link won't show up in the editor. It looks like the callback to CKEditor in my upload_file.html view doesn't work as it should. The documentation of CKEditor is really sparse about these things, so I could really use some guidance here. In my controller I have the following upload function: def upload_file(): upload = request.vars.upload if upload != None: if hasattr(upload, 'file'): old_filename = upload.filename new_filename = db.files.uploaded_data.store(upload.file, upload.filename) result = db.files.insert(filename = old_filename, uploaded_data = new_filename, created_on = datetime.today()) if not result: message = T('An error has occured during upload.') url = '' else: message = T('File uploaded succesfully.') url = URL(r = request, f = 'download', args = new_filename) return dict(form = None, cknum = request.vars.CKEditorFuncNum, url = url, message = message) else: raise HTTP(401, T('Upload is not proper type.')) else: form = SQLFORM(db.files, fields = ['uploaded_data']) upload = request.vars.uploaded_data if upload != None: form.vars.filename = upload.filename form.vars.created_on = datetime.today() if form.process().accepted: response.flash = T('File uploaded successfully!') elif form.errors: response.flash = T('form has errors') else: response.flash = T('please fill out the form') return dict(form = clean_form(form)) The view for this function looks like this: {{if form != None:}} {{extend 'layout.html'}} {{=form}} {{else:}} <html> <body> <script type="text/javascript"> window.opener.CKEDITOR.tools.callFunction({{=cknum}}, '{{=url}}', '{{=message}}'); </script> </body> </html> {{pass}} I have a test view with a form containing several textareas all of which are properly converted to editors: {{extend 'layout.html'}} <script type="text/javascript"> CKEDITOR.config.filebrowserBrowseUrl = "{{=URL(request.application, c='default', f='upload_file')}}"; CKEDITOR.config.filebrowserUploadUrl = "{{=URL(request.application, c='default', f='upload_file')}}"; CKEDITOR.config.filebrowserWindowHeight = '60%'; CKEDITOR.config.filebrowserWindowWidth = '70%'; </script> {{=form}}
ckeditor
web2py
null
null
null
null
open
Can't get homemade CKEditor file uploader working in web2py === There's something arcane going on with my custom CKEditor uploader. The image or whatever file I try to upload to the server is correctly uploaded but no matter what I do it's link won't show up in the editor. It looks like the callback to CKEditor in my upload_file.html view doesn't work as it should. The documentation of CKEditor is really sparse about these things, so I could really use some guidance here. In my controller I have the following upload function: def upload_file(): upload = request.vars.upload if upload != None: if hasattr(upload, 'file'): old_filename = upload.filename new_filename = db.files.uploaded_data.store(upload.file, upload.filename) result = db.files.insert(filename = old_filename, uploaded_data = new_filename, created_on = datetime.today()) if not result: message = T('An error has occured during upload.') url = '' else: message = T('File uploaded succesfully.') url = URL(r = request, f = 'download', args = new_filename) return dict(form = None, cknum = request.vars.CKEditorFuncNum, url = url, message = message) else: raise HTTP(401, T('Upload is not proper type.')) else: form = SQLFORM(db.files, fields = ['uploaded_data']) upload = request.vars.uploaded_data if upload != None: form.vars.filename = upload.filename form.vars.created_on = datetime.today() if form.process().accepted: response.flash = T('File uploaded successfully!') elif form.errors: response.flash = T('form has errors') else: response.flash = T('please fill out the form') return dict(form = clean_form(form)) The view for this function looks like this: {{if form != None:}} {{extend 'layout.html'}} {{=form}} {{else:}} <html> <body> <script type="text/javascript"> window.opener.CKEDITOR.tools.callFunction({{=cknum}}, '{{=url}}', '{{=message}}'); </script> </body> </html> {{pass}} I have a test view with a form containing several textareas all of which are properly converted to editors: {{extend 'layout.html'}} <script type="text/javascript"> CKEDITOR.config.filebrowserBrowseUrl = "{{=URL(request.application, c='default', f='upload_file')}}"; CKEDITOR.config.filebrowserUploadUrl = "{{=URL(request.application, c='default', f='upload_file')}}"; CKEDITOR.config.filebrowserWindowHeight = '60%'; CKEDITOR.config.filebrowserWindowWidth = '70%'; </script> {{=form}}
0
11,349,613
07/05/2012 17:39:14
1,171,609
01/26/2012 15:39:36
65
0
HTML5 Canvas not working in external JavaScript file
I have written this code in JavaScript and works perfectly fine when I include it on my index.html page: <canvas id="bannerCanvas" width="960" height="200"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var canvas = document.getElementById("bannerCanvas"); var context = canvas.getContext("2d"); context.beginPath(); context.moveTo(25,25); context.lineTo(355,55); context.lineTo(355,125); context.lineTo(25,125); context.moveTo(465,25); context.fill(); }; </script> ...however when I place it in an external JavaScript file, it won't work! In the head of the index page, I have declared this: <script type="text/javascript" src="JavaScript/functionality.js"> </script> And I save this functionality.js file in the JavaScript directory, I've tried doing other JS functions in this file to check the index page and the JS are connected and they are...The answer is probably staring me in the face but for some reason I cannot see it! Any help is much appreciated, thank you. EDIT: I've been using Firebug and it is giving me no errors, when I use the code on the index page, I am seeing the shape I want yet when using the external JS file I am just seeing a big black rectangle.
javascript
html
directory
null
null
null
open
HTML5 Canvas not working in external JavaScript file === I have written this code in JavaScript and works perfectly fine when I include it on my index.html page: <canvas id="bannerCanvas" width="960" height="200"> Your browser does not support the canvas element. </canvas> <script type="text/javascript"> var canvas = document.getElementById("bannerCanvas"); var context = canvas.getContext("2d"); context.beginPath(); context.moveTo(25,25); context.lineTo(355,55); context.lineTo(355,125); context.lineTo(25,125); context.moveTo(465,25); context.fill(); }; </script> ...however when I place it in an external JavaScript file, it won't work! In the head of the index page, I have declared this: <script type="text/javascript" src="JavaScript/functionality.js"> </script> And I save this functionality.js file in the JavaScript directory, I've tried doing other JS functions in this file to check the index page and the JS are connected and they are...The answer is probably staring me in the face but for some reason I cannot see it! Any help is much appreciated, thank you. EDIT: I've been using Firebug and it is giving me no errors, when I use the code on the index page, I am seeing the shape I want yet when using the external JS file I am just seeing a big black rectangle.
0
11,349,617
07/05/2012 17:39:30
1,494,209
07/01/2012 11:37:36
6
0
Getting a black screen after trying to resize an image
I am currently trying to resize a picture that I am downloading from the web and putting it into a JPanel. First, I am using the following code to download the image from the web: public static Image MSImageHigh(){ URL imageUrl = null; try { imageUrl = new URL("http://www.hmdb.ca/labm/metabolites/" + HMDB + "/ms/spectraH/" + HMDB + "H.png"); } catch (MalformedURLException e) { e.printStackTrace(); } Image image = Toolkit.getDefaultToolkit().createImage(imageUrl); return image; } Then I made a new method that resizes the image: public static BufferedImage resizeImage() { final BufferedImage bufferedImage = new BufferedImage(300, 500,BufferedImage.TYPE_INT_RGB); final Graphics2D graphics2D = bufferedImage.createGraphics(); graphics2D.setComposite(AlphaComposite.Src); graphics2D.drawImage(MSImageHigh(), 0, 0, 200, 200, null); graphics2D.dispose(); return bufferedImage; } This should produce s a new image that is resized to 200x200 px. What it in fact does is give me a black screen that is 200x200px in size. Btw, I also tried using TYPE_INT_ARGB instead of TYPE_INT_RGB, and this produces a totally transparent image, so that is not working either.
java
bufferedimage
null
null
null
null
open
Getting a black screen after trying to resize an image === I am currently trying to resize a picture that I am downloading from the web and putting it into a JPanel. First, I am using the following code to download the image from the web: public static Image MSImageHigh(){ URL imageUrl = null; try { imageUrl = new URL("http://www.hmdb.ca/labm/metabolites/" + HMDB + "/ms/spectraH/" + HMDB + "H.png"); } catch (MalformedURLException e) { e.printStackTrace(); } Image image = Toolkit.getDefaultToolkit().createImage(imageUrl); return image; } Then I made a new method that resizes the image: public static BufferedImage resizeImage() { final BufferedImage bufferedImage = new BufferedImage(300, 500,BufferedImage.TYPE_INT_RGB); final Graphics2D graphics2D = bufferedImage.createGraphics(); graphics2D.setComposite(AlphaComposite.Src); graphics2D.drawImage(MSImageHigh(), 0, 0, 200, 200, null); graphics2D.dispose(); return bufferedImage; } This should produce s a new image that is resized to 200x200 px. What it in fact does is give me a black screen that is 200x200px in size. Btw, I also tried using TYPE_INT_ARGB instead of TYPE_INT_RGB, and this produces a totally transparent image, so that is not working either.
0
11,327,524
07/04/2012 10:45:14
731,255
04/29/2011 14:32:31
1,198
6
Android - is there a way to make the keyboard not to pop up as a default in a particular screen?
I have an Activity screen with a form that has a text area, and text below the form. When the screen opens, for some reason, the keyboard pops up automatically and blocks the bottom part of the screen for the user, causing some confusion since they don't get to see the text that is below. Is there a way to not make the keyboard pop up by default and only have it pop up when the user clicks inside the text area? Thanks!
android
null
null
null
null
null
open
Android - is there a way to make the keyboard not to pop up as a default in a particular screen? === I have an Activity screen with a form that has a text area, and text below the form. When the screen opens, for some reason, the keyboard pops up automatically and blocks the bottom part of the screen for the user, causing some confusion since they don't get to see the text that is below. Is there a way to not make the keyboard pop up by default and only have it pop up when the user clicks inside the text area? Thanks!
0
11,327,535
07/04/2012 10:45:57
329,925
04/30/2010 16:37:36
561
8
Finding the date/time a file appeared in a git branch
How is possible to get the date in which a file appeared for the first time in a branch. Currently I'm using the following. The problem is that for merges it returns the creation date in the original branch instead of returning the date of the merge. ``` $ git log --first-parent --format=%ct FILE ```
git
null
null
null
null
null
open
Finding the date/time a file appeared in a git branch === How is possible to get the date in which a file appeared for the first time in a branch. Currently I'm using the following. The problem is that for merges it returns the creation date in the original branch instead of returning the date of the merge. ``` $ git log --first-parent --format=%ct FILE ```
0
11,327,553
07/04/2012 10:47:07
710,818
02/10/2010 09:50:08
2,096
16
Does it possible in Spring have reference to part of another bean?
Code: <bean id="bean1" ... <property name="Utils"> ... </bean> I would like to do: <bean id="bean2" ... <property name="Utils" ref="bean1.Utils"/> Does it possible in Spring? Or something similar? Thanks.
java
spring
properties
reference
javabeans
null
open
Does it possible in Spring have reference to part of another bean? === Code: <bean id="bean1" ... <property name="Utils"> ... </bean> I would like to do: <bean id="bean2" ... <property name="Utils" ref="bean1.Utils"/> Does it possible in Spring? Or something similar? Thanks.
0
11,327,458
07/04/2012 10:41:16
821,443
06/29/2011 15:35:12
856
13
Scala - erroneous mixing of packages and variables?
A very strange thing indeed. I have the following project structure: myproject/one/two Inside package `myproject` I have a class: abstract class A (two: Buffer[Int]) and then, inside package `one` I have: object B extends A (Buffer[Int](1, 2, 3)) { val с = two.map(_ + 1) // ERROR } However, the erros says: > object `map` is not a member of package > `org.vixa.games.ii.states.gamescreens.au.levels` which is obviously erroneous because it should be perfectly clear that I don't refer to the packages here, but to the local variable... Is this an intended behavior and I am doing something wrong or is it a bug?
scala
null
null
null
null
null
open
Scala - erroneous mixing of packages and variables? === A very strange thing indeed. I have the following project structure: myproject/one/two Inside package `myproject` I have a class: abstract class A (two: Buffer[Int]) and then, inside package `one` I have: object B extends A (Buffer[Int](1, 2, 3)) { val с = two.map(_ + 1) // ERROR } However, the erros says: > object `map` is not a member of package > `org.vixa.games.ii.states.gamescreens.au.levels` which is obviously erroneous because it should be perfectly clear that I don't refer to the packages here, but to the local variable... Is this an intended behavior and I am doing something wrong or is it a bug?
0
11,327,555
07/04/2012 10:47:19
628,918
02/22/2011 19:02:41
166
7
how to feed Hidden Markov Model (HMM) with several datastreams simultaneously?
I have built a body sensor network consisting of 8 accelerometers. At each sample (at about 30 Hz) each accelerometer gives me a X Y and Z value. I have used the jahmm java library for classification of a datastream consisting of one accelerometer. This works fine. But now i am confused about how to extend my code so that it can be fed with more than one accelerometer. a single datastream looks like this: [-4.976763 7.096352 1.3488603]; [-4.8699903 7.417777 1.3515397];... The library allows to define the dimensionality of the feature vector. In the above stream the dimensionality is 3. I thought of raising the dimensionality to 3 x 8 = 24, and then simply concatenate all accelerometers into a single 24D feature vector. is this the way to go or will this deteriorate my results?
classification
sensor
hidden-markov-models
null
null
null
open
how to feed Hidden Markov Model (HMM) with several datastreams simultaneously? === I have built a body sensor network consisting of 8 accelerometers. At each sample (at about 30 Hz) each accelerometer gives me a X Y and Z value. I have used the jahmm java library for classification of a datastream consisting of one accelerometer. This works fine. But now i am confused about how to extend my code so that it can be fed with more than one accelerometer. a single datastream looks like this: [-4.976763 7.096352 1.3488603]; [-4.8699903 7.417777 1.3515397];... The library allows to define the dimensionality of the feature vector. In the above stream the dimensionality is 3. I thought of raising the dimensionality to 3 x 8 = 24, and then simply concatenate all accelerometers into a single 24D feature vector. is this the way to go or will this deteriorate my results?
0
11,327,556
07/04/2012 10:47:22
827,992
07/04/2011 11:06:19
135
5
How I can write drivers for Android if the support for modules is not an option for the commercial-kernel-phones?
I see that many Android kernels comes without a loadable module support, how i can write and load a driver in this scenario? For example i have a codebase for a driver that works under a vanilla linux kernel, how i can port this to Android?
android
kernel
driver
null
null
null
open
How I can write drivers for Android if the support for modules is not an option for the commercial-kernel-phones? === I see that many Android kernels comes without a loadable module support, how i can write and load a driver in this scenario? For example i have a codebase for a driver that works under a vanilla linux kernel, how i can port this to Android?
0
11,327,510
07/04/2012 10:44:14
514,329
11/20/2010 08:44:54
166
20
Sql server : List table names and columns in relationship
I'm trying to get some query which returns following: TableName | ColumnName | IsColumnInRelation | RelatedTable | RelationKind | InsertUpdateSepecification | IsNull | Describtion ------------------------------------------------------------------------------------------------------------------------------------- TableName | ColumnName | IsColumnInRelation | RelatedTable | RelationKind | InsertUpdateSepecification | IsNull | Describtion Company | Personel | Yes | Employee | One | Cascade | True | 'company employees' Company | ID | No | -------- | --- | ------- | False | 'company pk' Company | Name | No | -------- | --- | ------- | False | 'name of company' Company | Country | Yes | Contries | Many | No Action | False | 'companys placement' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | ''
sql
query
null
null
null
null
open
Sql server : List table names and columns in relationship === I'm trying to get some query which returns following: TableName | ColumnName | IsColumnInRelation | RelatedTable | RelationKind | InsertUpdateSepecification | IsNull | Describtion ------------------------------------------------------------------------------------------------------------------------------------- TableName | ColumnName | IsColumnInRelation | RelatedTable | RelationKind | InsertUpdateSepecification | IsNull | Describtion Company | Personel | Yes | Employee | One | Cascade | True | 'company employees' Company | ID | No | -------- | --- | ------- | False | 'company pk' Company | Name | No | -------- | --- | ------- | False | 'name of company' Company | Country | Yes | Contries | Many | No Action | False | 'companys placement' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | '' Company | . | . | . | . | . | . | ''
0
11,226,788
06/27/2012 13:00:18
281,118
01/22/2010 12:22:05
169
5
jQuery, jCycle - Appending a tab item to 'the back of the line'
I'm building a big carousel for on my homepage. Kind of want it to look like this: http://themeforest.net/item/ventura-wordpress-corporate-business-theme/full_screen_preview/378380 I'm using jCycle (http://jquery.malsup.com/cycle/) I was wondering if anyone could explain how you can append the first slider tab item (like 1/7) and put it behind 7/7 in the chain of slider tabs? This'll have to happend when the the slider tab is leaving the carousel space and moving to the left. I want the carousel the be able to keep looping with the correct navigation forever. Thanks in advance.
jquery
tabs
append
carousel
jcycle
null
open
jQuery, jCycle - Appending a tab item to 'the back of the line' === I'm building a big carousel for on my homepage. Kind of want it to look like this: http://themeforest.net/item/ventura-wordpress-corporate-business-theme/full_screen_preview/378380 I'm using jCycle (http://jquery.malsup.com/cycle/) I was wondering if anyone could explain how you can append the first slider tab item (like 1/7) and put it behind 7/7 in the chain of slider tabs? This'll have to happend when the the slider tab is leaving the carousel space and moving to the left. I want the carousel the be able to keep looping with the correct navigation forever. Thanks in advance.
0
11,226,789
06/27/2012 13:00:19
959,837
09/22/2011 19:05:06
26
0
C# COM Add In failing while calling from thread
I am in process of writing UDF library for Excel in C#. I will have long running UDF so I want to make my UDF asynchronous so that Excel UI will stays usable while calling UDF. Below is my code; but it fails while calling Excel from spawned thread... [ClassInterface(ClassInterfaceType.AutoDual)] [ComVisible(true)] [ComDefaultInterface(typeof(IRAPDataAddIn))] public class RAPDataAddIn : IRAPDataAddIn { public string GetPositionData(Excel.Range Portfolios, Excel.Range Security) { Excel.Application excelApp = (Excel.Application)Marshal.GetActiveObject("Excel.Application"); Excel.Range target = (Excel.Range)excelApp.get_Caller(System.Type.Missing); Thread _workerThread = new Thread(new ParameterizedThreadStart(this.GetData)); _workerThread.CurrentCulture = System.Globalization.CultureInfo.CurrentCulture; _workerThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentUICulture; _workerThread.Start(target); return "Getting Data"; } public void GetData(object Range) { Excel.Range target = Range as Excel.Range; Thread.Sleep(1000); object[,] returnData = new object[2,2]; returnData[0, 0] = " FirstThread"; returnData[0, 1] = " SecondThread"; returnData[1, 0] = " ThirdThread"; returnData[1, 1] = " FourthThread"; var Start = (Excel.Range)target.Worksheet.Cells[1,1]; var End = (Excel.Range)target.Worksheet.Cells[2,2]; Excel.Range r = (Excel.Range)target.Worksheet.Range[Start, End]; try { r.Value2 = returnData; ***//It fails here*** } catch (Exception ex) { } }
c#
excel
com
udf
null
null
open
C# COM Add In failing while calling from thread === I am in process of writing UDF library for Excel in C#. I will have long running UDF so I want to make my UDF asynchronous so that Excel UI will stays usable while calling UDF. Below is my code; but it fails while calling Excel from spawned thread... [ClassInterface(ClassInterfaceType.AutoDual)] [ComVisible(true)] [ComDefaultInterface(typeof(IRAPDataAddIn))] public class RAPDataAddIn : IRAPDataAddIn { public string GetPositionData(Excel.Range Portfolios, Excel.Range Security) { Excel.Application excelApp = (Excel.Application)Marshal.GetActiveObject("Excel.Application"); Excel.Range target = (Excel.Range)excelApp.get_Caller(System.Type.Missing); Thread _workerThread = new Thread(new ParameterizedThreadStart(this.GetData)); _workerThread.CurrentCulture = System.Globalization.CultureInfo.CurrentCulture; _workerThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentUICulture; _workerThread.Start(target); return "Getting Data"; } public void GetData(object Range) { Excel.Range target = Range as Excel.Range; Thread.Sleep(1000); object[,] returnData = new object[2,2]; returnData[0, 0] = " FirstThread"; returnData[0, 1] = " SecondThread"; returnData[1, 0] = " ThirdThread"; returnData[1, 1] = " FourthThread"; var Start = (Excel.Range)target.Worksheet.Cells[1,1]; var End = (Excel.Range)target.Worksheet.Cells[2,2]; Excel.Range r = (Excel.Range)target.Worksheet.Range[Start, End]; try { r.Value2 = returnData; ***//It fails here*** } catch (Exception ex) { } }
0
11,226,790
06/27/2012 13:00:22
126,483
06/21/2009 13:47:02
1,856
10
Not using Messaging systems in CQRS
I have a domain (read) and reporting (write) database on the same machine. Currently, events are raised and put on an in memory queue and then the corresponding handlers are called to update the reporting database. What concerns if there is an issue with the reporting database and for some reason writing fails for an event. I suppose this is where NserviceBus etc would be useful but at this stage we do not have the time to invest to look into it. Now if new events are being raised, should I not process them until I get the problem event processed? Would this be manual intervention? Also other events will all get queued behind the problem event and nothing gets updated in the reporting database. Also I suppose I need to persist the events just in case the machine goes down.
domain-driven-design
cqrs
null
null
null
null
open
Not using Messaging systems in CQRS === I have a domain (read) and reporting (write) database on the same machine. Currently, events are raised and put on an in memory queue and then the corresponding handlers are called to update the reporting database. What concerns if there is an issue with the reporting database and for some reason writing fails for an event. I suppose this is where NserviceBus etc would be useful but at this stage we do not have the time to invest to look into it. Now if new events are being raised, should I not process them until I get the problem event processed? Would this be manual intervention? Also other events will all get queued behind the problem event and nothing gets updated in the reporting database. Also I suppose I need to persist the events just in case the machine goes down.
0
11,226,793
06/27/2012 13:00:30
816,328
06/26/2011 16:59:00
36
0
Does unreferenced objects get GC if lambdas are connected to their events?
imagine this simple snippet. { var o = new MyClass(); o.MyClassEvent += (args) => {}; } We create an object in a local context and doesn't save a reference. My question is if the lambda function added to the event `MyClassEvent` stops the GC from freeing the object `o` and the lambda function as well.
c#
events
lambda
garbage-collection
null
null
open
Does unreferenced objects get GC if lambdas are connected to their events? === imagine this simple snippet. { var o = new MyClass(); o.MyClassEvent += (args) => {}; } We create an object in a local context and doesn't save a reference. My question is if the lambda function added to the event `MyClassEvent` stops the GC from freeing the object `o` and the lambda function as well.
0
11,226,798
06/27/2012 13:00:36
137,483
07/13/2009 14:52:16
2,900
145
Remove method of iterator doesn't work after the first call
I'm trying to group some sets in disjoint sets. For example, if I have these 5 sets: > [[1, 3], [2], [1, 5], [6, 8], [1, 7]] I want to have this result: > [[2], [6, 8], [1, 3, 5, 7]] Here is the code: import java.util.*; public class SetTest { public static void main(String[] args) { // ---- Initialisation Set<Set<Integer>> groups = new LinkedHashSet<Set<Integer>>(); for (int[] set : new int[][] { {1, 3 }, {2 }, {1, 5 }, {6, 8 }, {1, 7} }) { Set<Integer> group = new TreeSet<Integer>(); for (int i : set) { group.add(i); } groups.add(group); } System.out.println(groups); // ---- Grouping values in disjoint sets for (Iterator<Set<Integer>> iterator = groups.iterator(); iterator.hasNext();) { Set<Integer> group = iterator.next(); System.out.println(String.format(" + Checking %20s in \t %s", group, groups)); for (Set<Integer> other : groups) { if (!group.equals(other) && !Collections.disjoint(group, other)) { other.addAll(group); iterator.remove(); System.out.println(String.format(" - Removed %20s -> \t %s", group, groups)); break; } } } System.out.println(groups); } } I am using an iterator over the set, and I want to group 2 sets in one, removing one of them. However, I am having a problem with the [`Iterator.remove()`][1] method. What this program prints is: [[1, 3], [2], [1, 5], [6, 8], [1, 7]] + Checking [1, 3] in [[1, 3], [2], [1, 5], [6, 8], [1, 7]] - Removed [1, 3] -> [[2], [1, 3, 5], [6, 8], [1, 7]] + Checking [2] in [[2], [1, 3, 5], [6, 8], [1, 7]] + Checking [1, 3, 5] in [[2], [1, 3, 5], [6, 8], [1, 7]] - Removed [1, 3, 5] -> [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] + Checking [6, 8] in [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] + Checking [1, 3, 5, 7] in [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] - Removed [1, 3, 5, 7] -> [[2], [1, 3, 5, 7], [6, 8], [1, 3, 5, 7]] [[2], [1, 3, 5, 7], [6, 8], [1, 3, 5, 7]] The first time, removing `[1, 3]` works as expected, but the rest of the times, it does not remove the item. I think it's because I use `addAll()`, but why is that? Because I don't make changes in `groups`; I only change an element inside it(`other`) - and the reference is the same, right? [1]: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Iterator.html#remove%28%29
java
iterator
null
null
null
null
open
Remove method of iterator doesn't work after the first call === I'm trying to group some sets in disjoint sets. For example, if I have these 5 sets: > [[1, 3], [2], [1, 5], [6, 8], [1, 7]] I want to have this result: > [[2], [6, 8], [1, 3, 5, 7]] Here is the code: import java.util.*; public class SetTest { public static void main(String[] args) { // ---- Initialisation Set<Set<Integer>> groups = new LinkedHashSet<Set<Integer>>(); for (int[] set : new int[][] { {1, 3 }, {2 }, {1, 5 }, {6, 8 }, {1, 7} }) { Set<Integer> group = new TreeSet<Integer>(); for (int i : set) { group.add(i); } groups.add(group); } System.out.println(groups); // ---- Grouping values in disjoint sets for (Iterator<Set<Integer>> iterator = groups.iterator(); iterator.hasNext();) { Set<Integer> group = iterator.next(); System.out.println(String.format(" + Checking %20s in \t %s", group, groups)); for (Set<Integer> other : groups) { if (!group.equals(other) && !Collections.disjoint(group, other)) { other.addAll(group); iterator.remove(); System.out.println(String.format(" - Removed %20s -> \t %s", group, groups)); break; } } } System.out.println(groups); } } I am using an iterator over the set, and I want to group 2 sets in one, removing one of them. However, I am having a problem with the [`Iterator.remove()`][1] method. What this program prints is: [[1, 3], [2], [1, 5], [6, 8], [1, 7]] + Checking [1, 3] in [[1, 3], [2], [1, 5], [6, 8], [1, 7]] - Removed [1, 3] -> [[2], [1, 3, 5], [6, 8], [1, 7]] + Checking [2] in [[2], [1, 3, 5], [6, 8], [1, 7]] + Checking [1, 3, 5] in [[2], [1, 3, 5], [6, 8], [1, 7]] - Removed [1, 3, 5] -> [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] + Checking [6, 8] in [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] + Checking [1, 3, 5, 7] in [[2], [1, 3, 5], [6, 8], [1, 3, 5, 7]] - Removed [1, 3, 5, 7] -> [[2], [1, 3, 5, 7], [6, 8], [1, 3, 5, 7]] [[2], [1, 3, 5, 7], [6, 8], [1, 3, 5, 7]] The first time, removing `[1, 3]` works as expected, but the rest of the times, it does not remove the item. I think it's because I use `addAll()`, but why is that? Because I don't make changes in `groups`; I only change an element inside it(`other`) - and the reference is the same, right? [1]: http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Iterator.html#remove%28%29
0
11,226,802
06/27/2012 13:00:41
1,058,543
11/21/2011 20:16:10
1
0
Starting a new activity but with different intents
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This is fine. I can also set an intent Intent i = new Intent(this, typeof(foo)); StartActivity(i); Problem is this. I have Activity A. This fires off Activity B. However, I need to fire off Activity B after using PutExtra on an intent. If I do Intent i = new Intent(this, typeof(ActivityB)); monodroid gets rightly annoyed as I'm defining a new Intent from within an Activity. Is there a way to do this (psuedocode) [Activity] public partial class A { protected override void OnCreate(Bundle savedInstance) { SetContentView(Resource.Layout.layout); Button btnClick = FindViewById<Button>(Resource.Id.btnClicky); btnClick.Click += new EventHandler(button_click); } private void button_Click(object s, EventArgs e) { Intent i = new Intent(this, typeof(B)); // <- gets annoyed i.PutExtra("foo", 1); i.PutExtra("bar", true); StartActivity(i); } } Any help here would be appreciated. PFJ
monodroid
null
null
null
null
null
open
Starting a new activity but with different intents === Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This is fine. I can also set an intent Intent i = new Intent(this, typeof(foo)); StartActivity(i); Problem is this. I have Activity A. This fires off Activity B. However, I need to fire off Activity B after using PutExtra on an intent. If I do Intent i = new Intent(this, typeof(ActivityB)); monodroid gets rightly annoyed as I'm defining a new Intent from within an Activity. Is there a way to do this (psuedocode) [Activity] public partial class A { protected override void OnCreate(Bundle savedInstance) { SetContentView(Resource.Layout.layout); Button btnClick = FindViewById<Button>(Resource.Id.btnClicky); btnClick.Click += new EventHandler(button_click); } private void button_Click(object s, EventArgs e) { Intent i = new Intent(this, typeof(B)); // <- gets annoyed i.PutExtra("foo", 1); i.PutExtra("bar", true); StartActivity(i); } } Any help here would be appreciated. PFJ
0
11,226,806
06/27/2012 13:00:50
1,252,575
03/06/2012 15:28:13
35
8
Thread cannot access the object
I declared a field: WriteableBitmap colorBitmap; Then I created a simple thread which does something: private void doSomething() { // ... bla bla bla colorBitmap = new WriteableBitmap(/* parameters */); myImage.Source = colorBitmap; // error here:S } In Windows_Loaded event I declared and started a new thread: private void window_Loaded(object sender, RoutedEventArgs e) { Thread th = new Thread(new ThreadStart(doSomething)); th.Start(); } The problem is that I couldn't change myImage's source. I've got an error like: > InvalidOperationException was unhandled > The calling thread cannot access this object because a different thread owns it. I tried to use Dispatcher.Invoke, but it didn't help... Application.Current.Dispatcher.Invoke((Action)delegate { myImage.Source = colorBitmap; }); I was searching for some answers, but never found the case exactly as mine. Could any1 help me to understand how to solve problems like this (I've had the same problem recently, but I couldn't call the method, because other thread owned it).
c#
multithreading
invalidoperationexception
null
null
null
open
Thread cannot access the object === I declared a field: WriteableBitmap colorBitmap; Then I created a simple thread which does something: private void doSomething() { // ... bla bla bla colorBitmap = new WriteableBitmap(/* parameters */); myImage.Source = colorBitmap; // error here:S } In Windows_Loaded event I declared and started a new thread: private void window_Loaded(object sender, RoutedEventArgs e) { Thread th = new Thread(new ThreadStart(doSomething)); th.Start(); } The problem is that I couldn't change myImage's source. I've got an error like: > InvalidOperationException was unhandled > The calling thread cannot access this object because a different thread owns it. I tried to use Dispatcher.Invoke, but it didn't help... Application.Current.Dispatcher.Invoke((Action)delegate { myImage.Source = colorBitmap; }); I was searching for some answers, but never found the case exactly as mine. Could any1 help me to understand how to solve problems like this (I've had the same problem recently, but I couldn't call the method, because other thread owned it).
0
11,226,811
06/27/2012 13:00:59
713,179
04/05/2011 10:09:17
1,008
1
printf in C dont occupy memory?
Is printf occupies a memory in the stack. **printf("Hello world");** as "Hello world" is a constant address? Please help me understand.
c
null
null
null
null
null
open
printf in C dont occupy memory? === Is printf occupies a memory in the stack. **printf("Hello world");** as "Hello world" is a constant address? Please help me understand.
0
11,226,812
06/27/2012 13:01:03
1,036,081
11/08/2011 17:04:52
64
1
How to saturate memory bus
I want to test a program with various memory bus usage levels. For example, I would like to find out if my program works as expected when other processes use 50% of the memory bus. How would I simulate this kind of disturbance? My attempt was to run a process with multiple threads, each thread doing random reads from a big block of memory. This didn't appear to have a big impact on my program. My program has a lot of memory operations, so I would expect that a significant disturbance will be noticeable. I want to saturate the bus but without using too many CPU cycles, so that any performance degradation will be caused only by bus contention.
c
optimization
memory
hardware
null
null
open
How to saturate memory bus === I want to test a program with various memory bus usage levels. For example, I would like to find out if my program works as expected when other processes use 50% of the memory bus. How would I simulate this kind of disturbance? My attempt was to run a process with multiple threads, each thread doing random reads from a big block of memory. This didn't appear to have a big impact on my program. My program has a lot of memory operations, so I would expect that a significant disturbance will be noticeable. I want to saturate the bus but without using too many CPU cycles, so that any performance degradation will be caused only by bus contention.
0
11,226,815
06/27/2012 13:01:21
1,485,258
06/27/2012 10:05:00
1
0
gzip support for Apache and Tomcat
I have tomcat configured to compress(Gzip) content requested from clients who Accept-Encoding:gzip, deflate. Also I send my request to apache2 to send the non-static content to tomcat: **client**(accept Gzip) <------> **Apache**(mod_deflate) <----(mod_jk)---->**Tomcat**(Gzip Enabled) How Apache handle such situation when it receives compressed content? When i call the tomcat directly the response is compressed (Content-Encoding:gzip) but when i call it through Apache the response is non compressed. I tried it with mod_rewrite but it not worked. Does Apache just shift the content to client? or maby, Apache does not send the correct request(accept gzip) to tomcat for compression ?
apache
tomcat
compression
gzip
null
null
open
gzip support for Apache and Tomcat === I have tomcat configured to compress(Gzip) content requested from clients who Accept-Encoding:gzip, deflate. Also I send my request to apache2 to send the non-static content to tomcat: **client**(accept Gzip) <------> **Apache**(mod_deflate) <----(mod_jk)---->**Tomcat**(Gzip Enabled) How Apache handle such situation when it receives compressed content? When i call the tomcat directly the response is compressed (Content-Encoding:gzip) but when i call it through Apache the response is non compressed. I tried it with mod_rewrite but it not worked. Does Apache just shift the content to client? or maby, Apache does not send the correct request(accept gzip) to tomcat for compression ?
0
11,541,559
07/18/2012 12:37:42
1,189,194
02/04/2012 10:21:28
55
3
what is 'create=true' , connection javadb ?
jdbc:derby:myDatabase;create=true what is this create=true means. Should all connetionurls hould have this create=true or just user and psw? Advanced thanks
java
database-connection
derby
javadb
null
null
open
what is 'create=true' , connection javadb ? === jdbc:derby:myDatabase;create=true what is this create=true means. Should all connetionurls hould have this create=true or just user and psw? Advanced thanks
0
11,541,560
07/18/2012 12:37:43
1,534,788
07/18/2012 12:30:22
1
0
Cross Compile apache server for arm-linux
now a days I am working with my arm-1808 board and want to cross compile Apache web server for it.I have already tried different instructions to do this but did not get the satisfied results please help me . Thanks
arm
embedded-linux
null
null
null
null
open
Cross Compile apache server for arm-linux === now a days I am working with my arm-1808 board and want to cross compile Apache web server for it.I have already tried different instructions to do this but did not get the satisfied results please help me . Thanks
0
11,541,563
07/18/2012 12:37:49
386,579
07/08/2010 11:32:56
933
42
Is there any API for fetching State and District values when the zipcode is entered?
I am looking for an API, that can prefill the State and District values in a form, when the Zipcode is entered. I came across this **[API][1]** but that is specifically for US only. It fetches the State and City values for a particular Zipcode, using Ajax and Json. I am looking for such an API for Indian states and districts. Is there such an API for India ? [1]: http://daspecster.github.com/ziptastic/demo.html
php
ajax
json
api
zipcode
null
open
Is there any API for fetching State and District values when the zipcode is entered? === I am looking for an API, that can prefill the State and District values in a form, when the Zipcode is entered. I came across this **[API][1]** but that is specifically for US only. It fetches the State and City values for a particular Zipcode, using Ajax and Json. I am looking for such an API for Indian states and districts. Is there such an API for India ? [1]: http://daspecster.github.com/ziptastic/demo.html
0
11,541,568
07/18/2012 12:37:56
244,333
01/05/2010 22:58:36
902
3
How to do float comparison in Bash?
lock_percent=$(echo "scale = 5; $value2*100/$value1" | bc) value=`echo "$lock_percent" | bc` if [[ "$value" > "$8" ]]; then echo "Lock Percentage:$value percentage State Critical" exit $STATE_CRITICAL fi I am not able to perform a float comparison with this. I am not able to understand where I am going wrong.
bash
shell
float
null
null
null
open
How to do float comparison in Bash? === lock_percent=$(echo "scale = 5; $value2*100/$value1" | bc) value=`echo "$lock_percent" | bc` if [[ "$value" > "$8" ]]; then echo "Lock Percentage:$value percentage State Critical" exit $STATE_CRITICAL fi I am not able to perform a float comparison with this. I am not able to understand where I am going wrong.
0
11,541,570
07/18/2012 12:37:59
1,503,117
07/05/2012 06:41:53
1
0
Cannot create proxy in jboss 5.0.1
I am using jboss 5.0.1 server and I have written a web service client using jax-rpc,I get the following exception when I run it. Since Jboss web service is not accepting user defined java beans to be passed in / out of jax-rpc so I have converted all the java beans object into String and String arrays and primitive data types. So I would be invoke the web service from my client.But when I try to call my web service it throws me the following exception. Please help me. 17:27:09,537 ERROR [ServiceProxy] Service error javax.xml.rpc.ServiceException: Cannot create proxy at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127) at $Proxy105.getCarrierWSSEIPort(Unknown Source) at org.apache.jsp.index_jsp._jspService(index_jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods: public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException OperationMetaData: qname={urn:CarrierWS/wsdl}checkPlanData2 javaName=checkPlanData style=document/literal/WRAPPED oneWay=false soapAction= ParameterMetaData: xmlName={urn:CarrierWS/types}checkPlanData2 partName=checkPlanData2 xmlType={urn:CarrierWS/types}checkPlanData2 javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct mode=IN inHeader=false index=0 wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]] ReturnMetaData: xmlName={urn:CarrierWS/types}checkPlanData2Response partName=checkPlanData2Response xmlType={urn:CarrierWS/types}checkPlanData2Response javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1 mode=OUT inHeader=false index=-1 wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]] at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491) at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557) at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541) at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220) at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345) ... 33 more 17:27:09,646 ERROR [STDERR] javax.xml.rpc.ServiceException: Cannot create proxy 17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359) 17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 17:27:09,646 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 17:27:09,646 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597) 17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127) 17:27:09,646 ERROR [STDERR] at $Proxy105.getCarrierWSSEIPort(Unknown Source) 17:27:09,646 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:88) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) 17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 17:27:09,677 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) 17:27:09,677 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 17:27:09,677 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662) 17:27:09,677 ERROR [STDERR] Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods: public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException OperationMetaData: qname={urn:CarrierWS/wsdl}checkPlanData2 javaName=checkPlanData style=document/literal/WRAPPED oneWay=false soapAction= ParameterMetaData: xmlName={urn:CarrierWS/types}checkPlanData2 partName=checkPlanData2 xmlType={urn:CarrierWS/types}checkPlanData2 javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct mode=IN inHeader=false index=0 wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]] ReturnMetaData: xmlName={urn:CarrierWS/types}checkPlanData2Response partName=checkPlanData2Response xmlType={urn:CarrierWS/types}checkPlanData2Response javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1 mode=OUT inHeader=false index=-1 wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]] 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345) 17:27:09,756 ERROR [STDERR] ... 33 more The JSP client code is as follows: <pre><code> <%@page import="java.util.Hashtable"%> <%@page import="javax.naming.*,javax.xml.rpc.Stub,stubs.CarrierWS,stubs.CarrierWSSEI,stubs.CarrierWSSEI_Impl"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% try { InitialContext ic = new InitialContext( ); CarrierWS carrierws = (CarrierWS)ic.lookup("java:comp/env/service/CarrierWS"); out.println("========================" + carrierws); CarrierWSSEI sei = carrierws.getCarrierWSSEIPort(); out.println("Invoking the service please wait ............." + carrierws.getCarrierWSSEIPort()); ((Stub)sei)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8080/TestWS3WAR/CarrierWS"); out.println("Invoking the service please wait ............." + sei.getActiveBenData().length); } catch(Exception e) { out.println("Exception occurred : " + e.getMessage()); e.printStackTrace(); } %> </body> </html> </pre></code> Thanks in advance Senthil
java
web-services
java-ee
null
null
null
open
Cannot create proxy in jboss 5.0.1 === I am using jboss 5.0.1 server and I have written a web service client using jax-rpc,I get the following exception when I run it. Since Jboss web service is not accepting user defined java beans to be passed in / out of jax-rpc so I have converted all the java beans object into String and String arrays and primitive data types. So I would be invoke the web service from my client.But when I try to call my web service it throws me the following exception. Please help me. 17:27:09,537 ERROR [ServiceProxy] Service error javax.xml.rpc.ServiceException: Cannot create proxy at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127) at $Proxy105.getCarrierWSSEIPort(Unknown Source) at org.apache.jsp.index_jsp._jspService(index_jsp.java:88) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods: public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException OperationMetaData: qname={urn:CarrierWS/wsdl}checkPlanData2 javaName=checkPlanData style=document/literal/WRAPPED oneWay=false soapAction= ParameterMetaData: xmlName={urn:CarrierWS/types}checkPlanData2 partName=checkPlanData2 xmlType={urn:CarrierWS/types}checkPlanData2 javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct mode=IN inHeader=false index=0 wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]] ReturnMetaData: xmlName={urn:CarrierWS/types}checkPlanData2Response partName=checkPlanData2Response xmlType={urn:CarrierWS/types}checkPlanData2Response javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1 mode=OUT inHeader=false index=-1 wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]] at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491) at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557) at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541) at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220) at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345) ... 33 more 17:27:09,646 ERROR [STDERR] javax.xml.rpc.ServiceException: Cannot create proxy 17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:359) 17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 17:27:09,646 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 17:27:09,646 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 17:27:09,646 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597) 17:27:09,646 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceProxy.invoke(ServiceProxy.java:127) 17:27:09,646 ERROR [STDERR] at $Proxy105.getCarrierWSSEIPort(Unknown Source) 17:27:09,646 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:88) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) 17:27:09,662 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) 17:27:09,662 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 17:27:09,662 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 17:27:09,662 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 17:27:09,677 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 17:27:09,677 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) 17:27:09,677 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 17:27:09,677 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662) 17:27:09,677 ERROR [STDERR] Caused by: java.lang.IllegalStateException: Cannot synchronize to any of these methods: public abstract java.lang.String[] client.CarrierWSSEI.getGroupID() throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.checkRateData(java.lang.String) throws java.rmi.RemoteException public abstract boolean client.CarrierWSSEI.commitZipImportData(java.lang.String) throws java.rmi.RemoteException OperationMetaData: qname={urn:CarrierWS/wsdl}checkPlanData2 javaName=checkPlanData style=document/literal/WRAPPED oneWay=false soapAction= ParameterMetaData: xmlName={urn:CarrierWS/types}checkPlanData2 partName=checkPlanData2 xmlType={urn:CarrierWS/types}checkPlanData2 javaType=test.CarrierWSSEI_checkPlanData2_RequestStruct mode=IN inHeader=false index=0 wrappedParameters=[[name = String_1, type = java.lang.String, typeArgs = null, variable = String_1, index = 0], [name = String_2, type = java.lang.String, typeArgs = null, variable = String_2, index = 1]] ReturnMetaData: xmlName={urn:CarrierWS/types}checkPlanData2Response partName=checkPlanData2Response xmlType={urn:CarrierWS/types}checkPlanData2Response javaType=test.CarrierWSSEI_checkPlanData_ResponseStruct1 mode=OUT inHeader=false index=-1 wrappedParameters=[[name = result, type = boolean, typeArgs = null, variable = result, index = -1]] 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.OperationMetaData.eagerInitialize(OperationMetaData.java:491) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeOperations(EndpointMetaData.java:557) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:541) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.metadata.umdm.EndpointMetaData.setServiceEndpointInterfaceName(EndpointMetaData.java:220) 17:27:09,756 ERROR [STDERR] at org.jboss.ws.core.jaxrpc.client.ServiceImpl.getPort(ServiceImpl.java:345) 17:27:09,756 ERROR [STDERR] ... 33 more The JSP client code is as follows: <pre><code> <%@page import="java.util.Hashtable"%> <%@page import="javax.naming.*,javax.xml.rpc.Stub,stubs.CarrierWS,stubs.CarrierWSSEI,stubs.CarrierWSSEI_Impl"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <% try { InitialContext ic = new InitialContext( ); CarrierWS carrierws = (CarrierWS)ic.lookup("java:comp/env/service/CarrierWS"); out.println("========================" + carrierws); CarrierWSSEI sei = carrierws.getCarrierWSSEIPort(); out.println("Invoking the service please wait ............." + carrierws.getCarrierWSSEIPort()); ((Stub)sei)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY,"http://localhost:8080/TestWS3WAR/CarrierWS"); out.println("Invoking the service please wait ............." + sei.getActiveBenData().length); } catch(Exception e) { out.println("Exception occurred : " + e.getMessage()); e.printStackTrace(); } %> </body> </html> </pre></code> Thanks in advance Senthil
0
11,541,571
07/18/2012 12:38:01
1,086,229
12/07/2011 17:53:59
18
0
iPhone generate X509 certificate from RSA public key
is there a way in iPhone development to generate a X509 Certificate from my RSA public key (seckeyref) or has anybody an idea how i can transmit my public key to a java server? thanks Patrick
iphone
certificate
rsa
exchange
x509
null
open
iPhone generate X509 certificate from RSA public key === is there a way in iPhone development to generate a X509 Certificate from my RSA public key (seckeyref) or has anybody an idea how i can transmit my public key to a java server? thanks Patrick
0
11,541,577
07/18/2012 12:38:06
369,520
06/17/2010 15:52:06
39
1
Supersized: playToggle
I am using the Supersized background slideshow: http://buildinternet.com/project/supersized/ with the following code to pause the Slideshow while loading a modal box. Jquery <script type="text/javascript"> $(function($) { $('#slideInfo').click(function() { api.playToggle(); }); }); </script> HTML <div id="btnContainer"> <a id="slideInfo" href="#">More Info</a> </div> I am able to pause the slideshow. However, when I close the modal box the Slideshow won't play back again (it stays paused). Is there a way to accomplish this? Thanks!
jquery
supersized
null
null
null
null
open
Supersized: playToggle === I am using the Supersized background slideshow: http://buildinternet.com/project/supersized/ with the following code to pause the Slideshow while loading a modal box. Jquery <script type="text/javascript"> $(function($) { $('#slideInfo').click(function() { api.playToggle(); }); }); </script> HTML <div id="btnContainer"> <a id="slideInfo" href="#">More Info</a> </div> I am able to pause the slideshow. However, when I close the modal box the Slideshow won't play back again (it stays paused). Is there a way to accomplish this? Thanks!
0
11,541,551
07/18/2012 12:37:26
1,027,669
11/03/2011 12:30:11
162
6
Android: cannot install app saved to the internal memory
I am downloading an Android app from a server and saving it to the internal space of my application using: URL url = new URL(Urls[0]); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); File outputFile = new File(getFilesDir(), "Apps"); outputFile.mkdirs(); File file = makeFilename(outputFile, _appName + ".apk"); file.createNewFile(); file.setExecutable(true); file.setReadable(true, false); file.setWritable(true, false); FileOutputStream fout = new FileOutputStream(zipFile); InputStream in = conn.getInputStream(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) > 0) { fout.write(buffer, 0, length); } fout.close(); in.close(); outputFile.setExecutable(true, false); outputFile.setReadable(true, false); outputFile.setWritable(true, false); private File makeFilename(File base, String name) { if (name.indexOf(File.separatorChar) < 0) { return new File(base, name); } throw new IllegalArgumentException("File " + name + " contains a path separator"); } when the download is completed, a notification appears. When I click this notification, the app should be installed. But in reality, when I click the notification, an "Error parsing the package" appears. What I am doing wrong? Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(new File(getFilesDir()+ "/Apps/_appName.apk")),"application/vnd.android.package-archive"); PendingIntent act = PendingIntent.getActivity(MainActivity._activity,0, i, 0); notification.setLatestEventInfo("TEXT", "TEXT, act);
android
parsing
package
null
null
null
open
Android: cannot install app saved to the internal memory === I am downloading an Android app from a server and saving it to the internal space of my application using: URL url = new URL(Urls[0]); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); File outputFile = new File(getFilesDir(), "Apps"); outputFile.mkdirs(); File file = makeFilename(outputFile, _appName + ".apk"); file.createNewFile(); file.setExecutable(true); file.setReadable(true, false); file.setWritable(true, false); FileOutputStream fout = new FileOutputStream(zipFile); InputStream in = conn.getInputStream(); byte[] buffer = new byte[1024]; int length = 0; while ((length = in.read(buffer)) > 0) { fout.write(buffer, 0, length); } fout.close(); in.close(); outputFile.setExecutable(true, false); outputFile.setReadable(true, false); outputFile.setWritable(true, false); private File makeFilename(File base, String name) { if (name.indexOf(File.separatorChar) < 0) { return new File(base, name); } throw new IllegalArgumentException("File " + name + " contains a path separator"); } when the download is completed, a notification appears. When I click this notification, the app should be installed. But in reality, when I click the notification, an "Error parsing the package" appears. What I am doing wrong? Intent i = new Intent(Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(new File(getFilesDir()+ "/Apps/_appName.apk")),"application/vnd.android.package-archive"); PendingIntent act = PendingIntent.getActivity(MainActivity._activity,0, i, 0); notification.setLatestEventInfo("TEXT", "TEXT, act);
0
11,541,554
07/18/2012 12:37:34
1,421,471
05/28/2012 10:16:48
104
1
Plist file to convert xml file in iphone?
Is it possible to convert xml file from plist, How to convert this, please any one help me Thanks
iphone
ios
xml
plist
null
null
open
Plist file to convert xml file in iphone? === Is it possible to convert xml file from plist, How to convert this, please any one help me Thanks
0
11,541,452
07/18/2012 12:32:59
1,534,771
07/18/2012 12:24:31
1
0
How to use SQLite with c++ on Ubuntu? (undefined reference error)
I want to use SQLite with c++ on Ubuntu. I chose to try the example from https://www.sqlite.org/quickstart.html. But when running `c++ test.cpp -o test` I get the error: /tmp/ccTwwjKw.o: In function `main': test.cpp:(.text+0xf1): undefined reference to `sqlite3_open' test.cpp:(.text+0x106): undefined reference to `sqlite3_errmsg' test.cpp:(.text+0x12e): undefined reference to `sqlite3_close' test.cpp:(.text+0x15d): undefined reference to `sqlite3_exec' test.cpp:(.text+0x18f): undefined reference to `sqlite3_free' test.cpp:(.text+0x19b): undefined reference to `sqlite3_close' collect2: ld gab 1 als Ende-Status zurück I think the Problem is the same as here: http://stackoverflow.com/questions/3463438. But I have no make file and I don't use netbeans.
c++
sqlite
ubuntu
sqlite3
null
null
open
How to use SQLite with c++ on Ubuntu? (undefined reference error) === I want to use SQLite with c++ on Ubuntu. I chose to try the example from https://www.sqlite.org/quickstart.html. But when running `c++ test.cpp -o test` I get the error: /tmp/ccTwwjKw.o: In function `main': test.cpp:(.text+0xf1): undefined reference to `sqlite3_open' test.cpp:(.text+0x106): undefined reference to `sqlite3_errmsg' test.cpp:(.text+0x12e): undefined reference to `sqlite3_close' test.cpp:(.text+0x15d): undefined reference to `sqlite3_exec' test.cpp:(.text+0x18f): undefined reference to `sqlite3_free' test.cpp:(.text+0x19b): undefined reference to `sqlite3_close' collect2: ld gab 1 als Ende-Status zurück I think the Problem is the same as here: http://stackoverflow.com/questions/3463438. But I have no make file and I don't use netbeans.
0
11,401,194
07/09/2012 18:49:11
809,933
06/22/2011 08:12:21
31
1
Images display issue in Dynamics AX 2009 reports saved as pdf
When i saved a native Dynamics AX 2009 report as pdf or pdf-embed it doesn't show the images in the report i.e. company logo in header section, properly. The image comes very distorted, grayish and repeated. On the other if i export the image in HTML format the image comes properly. Had anyone experience a similar issue. Please note that im saving the report as pdf using "file" option that comes when the report print dialog opens. Any help would be highly appreciated.
pdf
dynamics-ax-2009
null
null
null
null
open
Images display issue in Dynamics AX 2009 reports saved as pdf === When i saved a native Dynamics AX 2009 report as pdf or pdf-embed it doesn't show the images in the report i.e. company logo in header section, properly. The image comes very distorted, grayish and repeated. On the other if i export the image in HTML format the image comes properly. Had anyone experience a similar issue. Please note that im saving the report as pdf using "file" option that comes when the report print dialog opens. Any help would be highly appreciated.
0
11,401,197
07/09/2012 18:49:31
787,612
06/07/2011 14:13:11
10
0
Java ConcurrentHashMap corrupt values
I have a ConcurrentHashMap<String, String> that exhibits strange behavior on occasion. When my app first starts up, I read a directory from the file system and load contents of each file into the ConcurrentHashMap using the filename as the key. Some files may be empty, in which case I set the value to "empty". Once all files have been loaded, a pool of worker threads will wait for external requests. When a request comes in, I call the getData() function where I check if the ConcurrentHashMap contains the key. If the key exists I get the value and check if the value is "empty". If value.contains("empty"), I return "file not found". Otherwise, the contents of the file is returned. When the key does not exist, I try to load the file from the file system. private String getData(String name) { String reply = null; if (map.containsKey(name)) { reply = map.get(name); } else { reply = getDataFromFileSystem(name); } if (reply != null && !reply.contains("empty")) { return reply; } return "file not found"; } On occasion, the ConcurrentHashMap will return the contents of a non-empty file (i.e. value.contains("empty") == false), however the line: if (reply != null && !reply.contains("empty")) returns FALSE. I broke down the IF statement into two parts: if (reply != null) and if (!reply.contains("empty")). The first part of the IF statement returns TRUE. The second part returns FALSE. So I decided to print out the variable "reply" in order to determine if the contents of the string does in fact contain "empty". This was NOT the case i.e. the contents did not contain the string "empty". Furthermore, I added the line int indexOf = reply.indexOf("empty"); Since the variable reply did not contain the string "empty" when I printed it out, I was expecting indexOf to return -1. But the function returned the a value approx the length of the string i.e. if reply.length == 15100, then reply.indexOf("empty") was returning 15099. I experience this issue on a weekly basis, approx 2-3 times a week. This process is restarted on a daily basis therefore the ConcurrentHashMap is re-generated regularly. Has anyone seen such behavior when using Java's ConcurrentHashMap?
java
concurrency
thread-safety
hashmap
concurrenthashmap
null
open
Java ConcurrentHashMap corrupt values === I have a ConcurrentHashMap<String, String> that exhibits strange behavior on occasion. When my app first starts up, I read a directory from the file system and load contents of each file into the ConcurrentHashMap using the filename as the key. Some files may be empty, in which case I set the value to "empty". Once all files have been loaded, a pool of worker threads will wait for external requests. When a request comes in, I call the getData() function where I check if the ConcurrentHashMap contains the key. If the key exists I get the value and check if the value is "empty". If value.contains("empty"), I return "file not found". Otherwise, the contents of the file is returned. When the key does not exist, I try to load the file from the file system. private String getData(String name) { String reply = null; if (map.containsKey(name)) { reply = map.get(name); } else { reply = getDataFromFileSystem(name); } if (reply != null && !reply.contains("empty")) { return reply; } return "file not found"; } On occasion, the ConcurrentHashMap will return the contents of a non-empty file (i.e. value.contains("empty") == false), however the line: if (reply != null && !reply.contains("empty")) returns FALSE. I broke down the IF statement into two parts: if (reply != null) and if (!reply.contains("empty")). The first part of the IF statement returns TRUE. The second part returns FALSE. So I decided to print out the variable "reply" in order to determine if the contents of the string does in fact contain "empty". This was NOT the case i.e. the contents did not contain the string "empty". Furthermore, I added the line int indexOf = reply.indexOf("empty"); Since the variable reply did not contain the string "empty" when I printed it out, I was expecting indexOf to return -1. But the function returned the a value approx the length of the string i.e. if reply.length == 15100, then reply.indexOf("empty") was returning 15099. I experience this issue on a weekly basis, approx 2-3 times a week. This process is restarted on a daily basis therefore the ConcurrentHashMap is re-generated regularly. Has anyone seen such behavior when using Java's ConcurrentHashMap?
0
11,401,198
07/09/2012 18:49:32
963,737
09/25/2011 15:09:39
17
1
Multi-template application in iOS
I am new to iOS development and probably this is really simple question. So I want to build an application which has a signup screen and after successful login we go to a home screen which is a tabbed application. How do i achieve this ? I tried searching for this but found all other searches and none that had what i was looking for. Please do not down vote it and any help would be appreciated
ios
templates
user-interface
null
null
null
open
Multi-template application in iOS === I am new to iOS development and probably this is really simple question. So I want to build an application which has a signup screen and after successful login we go to a home screen which is a tabbed application. How do i achieve this ? I tried searching for this but found all other searches and none that had what i was looking for. Please do not down vote it and any help would be appreciated
0
11,401,199
07/09/2012 18:49:41
1,512,762
07/09/2012 18:02:09
1
0
populate ListView from my database
I have read so many posts about how to populate the listview from a database. but i simply cant do it on my app! i dont know what im doing wrong. I´m very new to programming so there are allot of things i dont understand but im trying to learn :) I add items to the database without any problems using this code in the activity: String selectedstone = (String) stonespinner.getSelectedItem(); String weight = etaddweight.getText().toString(); db.addStone(new MyStonesDatabase(selectedstone, weight)); in the DatabaseHandler.java i have this: // Adding new stone void addStone(MyStonesDatabase stone) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_STONE, stone.getStone()); values.put(KEY_WEIGHT, stone.getWeight()); // Inserting Row db.insert(TABLE_MYSTONES, null, values); db.close(); // Closing database connection } I can see that my database gets populated by running this: Log.d("Reading: ", "Reading all items.."); List<MyStonesDatabase> items = db.getAllstones(); for (MyStonesDatabase cn : items) { String log = "Id: " + cn.getID() + ", Stone: " + cn.getStone() + ", Weight: " + cn.getWeight(); // Writing Items to log Log.d("Name: ", log); } But when trying to have a listview to show the database my app either crashes or dont show anything. In my DatabaseHandler.java i have this: // Getting All items from database public List<MyStonesDatabase> getAllstones() { List<MyStonesDatabase> stoneList = new ArrayList<MyStonesDatabase>(); // Select All Query String selectQuery = "SELECT * FROM " + TABLE_MYSTONES; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { MyStonesDatabase stone = new MyStonesDatabase(); stone.setID(Integer.parseInt(cursor.getString(0))); stone.setStone(cursor.getString(1)); stone.setWeight(cursor.getString(2)); // Adding stone to list stoneList.add(stone); } while (cursor.moveToNext()); } // return stonelist return stone; } I dont know what to put in my activity that should show the listview. public class MyStones extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } Can someone please help me, im about to give up hehe :) thanks!
android
database
android-listview
null
null
null
open
populate ListView from my database === I have read so many posts about how to populate the listview from a database. but i simply cant do it on my app! i dont know what im doing wrong. I´m very new to programming so there are allot of things i dont understand but im trying to learn :) I add items to the database without any problems using this code in the activity: String selectedstone = (String) stonespinner.getSelectedItem(); String weight = etaddweight.getText().toString(); db.addStone(new MyStonesDatabase(selectedstone, weight)); in the DatabaseHandler.java i have this: // Adding new stone void addStone(MyStonesDatabase stone) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_STONE, stone.getStone()); values.put(KEY_WEIGHT, stone.getWeight()); // Inserting Row db.insert(TABLE_MYSTONES, null, values); db.close(); // Closing database connection } I can see that my database gets populated by running this: Log.d("Reading: ", "Reading all items.."); List<MyStonesDatabase> items = db.getAllstones(); for (MyStonesDatabase cn : items) { String log = "Id: " + cn.getID() + ", Stone: " + cn.getStone() + ", Weight: " + cn.getWeight(); // Writing Items to log Log.d("Name: ", log); } But when trying to have a listview to show the database my app either crashes or dont show anything. In my DatabaseHandler.java i have this: // Getting All items from database public List<MyStonesDatabase> getAllstones() { List<MyStonesDatabase> stoneList = new ArrayList<MyStonesDatabase>(); // Select All Query String selectQuery = "SELECT * FROM " + TABLE_MYSTONES; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); // looping through all rows and adding to list if (cursor.moveToFirst()) { do { MyStonesDatabase stone = new MyStonesDatabase(); stone.setID(Integer.parseInt(cursor.getString(0))); stone.setStone(cursor.getString(1)); stone.setWeight(cursor.getString(2)); // Adding stone to list stoneList.add(stone); } while (cursor.moveToNext()); } // return stonelist return stone; } I dont know what to put in my activity that should show the listview. public class MyStones extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } Can someone please help me, im about to give up hehe :) thanks!
0
11,401,170
07/09/2012 18:47:14
1,055,536
11/19/2011 17:22:53
130
9
Casting POD object with static_cast
this is what i mean, class V3 { public: float x,y,z; }; class V3_ { public: float x,y,z; }; V3_ vec1; V3 vec2 = static_cast<V3_>(vec1); what should i do to make this cast work in compile time? Thanks.
c++
casting
pod
null
null
null
open
Casting POD object with static_cast === this is what i mean, class V3 { public: float x,y,z; }; class V3_ { public: float x,y,z; }; V3_ vec1; V3 vec2 = static_cast<V3_>(vec1); what should i do to make this cast work in compile time? Thanks.
0
11,401,173
07/09/2012 18:47:22
1,329,572
04/12/2012 15:45:24
998
21
Java: Does copy constructor need to copy mutexes?
For instance, public Foo{ private Object mutex = new Object(); private int bar; public Foo(Foo f){ this.mutex = f.getMutex(); this.bar = f.getBar(); } public Object getMutex(){ return mutex; } public void setBar(int bar){ synchronized(mutex){ this.bar = bar; } } public int getBar(){ synchronized(mutex){ return bar; } } }
java
mutex
copy-constructor
null
null
null
open
Java: Does copy constructor need to copy mutexes? === For instance, public Foo{ private Object mutex = new Object(); private int bar; public Foo(Foo f){ this.mutex = f.getMutex(); this.bar = f.getBar(); } public Object getMutex(){ return mutex; } public void setBar(int bar){ synchronized(mutex){ this.bar = bar; } } public int getBar(){ synchronized(mutex){ return bar; } } }
0
11,401,203
07/09/2012 18:50:00
1,380,921
05/08/2012 00:39:14
14
4
removeClass from links in separated div container
I'm having a couple problems trying to add/remove a class from links and their siblings. I have 3 groups of links contained in `<div class="collapse_content"> ... </div>`. I was able to get the jQuery to add and remove the 'Selected" class from the links in the same container, but if I select a link that is in another container (group) then the previous selected link wont remove its class. Each link in the groups are loading a page into an iframe, so they are all static links. I also have a collapse toggle function in jQuery above each group of links. Basically, I'm wondering if someone could help me figure out why the jQuery wont remove the 'selected' class from the previous link that is in a different group from the newly selected link. Any help/suggestions are appreciated. Thank you in advance. Here's the code I have so far. --jQuery-- $(function() { //Add 'selected' class to A tag within class collapse_content $('.collapse_content a').on('click', function(e){ $(this).addClass('selected').siblings().removeClass('selected'); $(this).find('.collapse_content a').removeClass('selected'); }); //toggle the componenet with class collapse_tab $(".collapse_tab").click(function() { $(this).next(".collapse_content").slideToggle(500); }); });​ --HTML-- <div class="collapse_tab">Group 1</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 2</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 3</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 4</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> --CSS-- .collapse_tab { text-decoration:none; font-weight:bold; background-color:#0cf; color:#FFF; font-size:11px; padding: 2px; margin:0px; text-align:center; border:1px solid #09f; cursor: pointer; } .collapse_content { font:Verdana, Arial, Helvetica, sans-serif; margin: 0px; padding: 0px; font-size: 10px; background-color:#0cf; border:#fff 1px solid; }​
jquery
addclass
collapse
removeclass
siblings
null
open
removeClass from links in separated div container === I'm having a couple problems trying to add/remove a class from links and their siblings. I have 3 groups of links contained in `<div class="collapse_content"> ... </div>`. I was able to get the jQuery to add and remove the 'Selected" class from the links in the same container, but if I select a link that is in another container (group) then the previous selected link wont remove its class. Each link in the groups are loading a page into an iframe, so they are all static links. I also have a collapse toggle function in jQuery above each group of links. Basically, I'm wondering if someone could help me figure out why the jQuery wont remove the 'selected' class from the previous link that is in a different group from the newly selected link. Any help/suggestions are appreciated. Thank you in advance. Here's the code I have so far. --jQuery-- $(function() { //Add 'selected' class to A tag within class collapse_content $('.collapse_content a').on('click', function(e){ $(this).addClass('selected').siblings().removeClass('selected'); $(this).find('.collapse_content a').removeClass('selected'); }); //toggle the componenet with class collapse_tab $(".collapse_tab").click(function() { $(this).next(".collapse_content").slideToggle(500); }); });​ --HTML-- <div class="collapse_tab">Group 1</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 2</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 3</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> <div class="collapse_tab">Group 4</div> <div class="collapse_content"> <a href="Link 1.asp" onclick="return handlelink(this)">Link 1</a><br> <a href="Link 2.asp" onclick="return handlelink(this)">Link 2</a><br> <a href="Link 3.asp" onclick="return handlelink(this)">Link 3</a><br> <a href="Link 4.asp" onclick="return handlelink(this)">Link 4</a><br> </div> --CSS-- .collapse_tab { text-decoration:none; font-weight:bold; background-color:#0cf; color:#FFF; font-size:11px; padding: 2px; margin:0px; text-align:center; border:1px solid #09f; cursor: pointer; } .collapse_content { font:Verdana, Arial, Helvetica, sans-serif; margin: 0px; padding: 0px; font-size: 10px; background-color:#0cf; border:#fff 1px solid; }​
0
11,401,211
07/09/2012 18:50:17
543,677
12/14/2009 13:32:38
107
15
Data being lost between Android device and python server using TCP
I'm somewhat new to network programming and am having some trouble. I am creating a JSON object on an Android device, connecting to a python server via TCP, and sending the JSON string. The connection gets accepted, but I keep losing the end of the string, so json.loads(json_string) is failing. Here is the relevant Android code: private class Worker implements Runnable { @Override public void run() { //create the network socket try { socket = new Socket(address, 4242); Log.i(TAG, "timeout: " + socket.getSoTimeout()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } packets = new ArrayList<JSONObject>(); for (jobs.moveToFirst(); jobs.isAfterLast() == false; jobs.moveToNext()) { String jobName = jobs.getString(jobs.getColumnIndex(JobMetaData.JobTableMetaData.JOB)); Uri.Builder updated = new Uri.Builder(); updated.scheme("content"); updated.authority(JobMetaData.AUTHORITY); updated.appendPath(jobName); updated.appendPath("member"); updated.appendPath(JobMetaData.MemberTableMetaData.CHANGED); updated.appendPath("true"); Cursor changed = getContentResolver().query(updated.build(), null, null, null, null); Log.d(TAG, "number of members " + changed.getCount()); //create a JSON object out of the editable properties for (changed.moveToFirst(); changed.isAfterLast() == false; changed.moveToNext()) { JSONObject json = new JSONObject(); for (String att : changed.getColumnNames()) { if (ListMetaData.validAtts.contains(att)) { try { json.put(att, changed.getString(changed.getColumnIndex(att))); } catch (JSONException e) { // TODO Auto-generated catch block Log.d(TAG, "JSON exception in DatagramService"); e.printStackTrace(); } } } //include the GUID and job name //for identification try { json.put(JobMetaData.MemberTableMetaData.GUID, changed.getString(changed.getColumnIndex(JobMetaData.MemberTableMetaData.GUID))); json.put(JobMetaData.JobTableMetaData.JOB, jobName); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } packets.add(json); } changed.close(); } Log.d(TAG, "entering send loop"); for (JSONObject packet : packets) { try { Log.d(TAG, "supposedly sending"); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); out.flush(); //send the length of the data out.write(Integer.toString(packet.toString().getBytes().length)); out.flush(); //now write the data Log.d(TAG, "packet string: " + packet.toString()); out.write(packet.toString(), 0, packet.toString().getBytes().length); out.flush(); } catch (IOException e) { Log.d(TAG, "in IOException of send loop"); e.printStackTrace(); } } //commented out for development // Intent receive = new Intent(getApplication().getApplicationContext(), ReceptionService.class); // startService(receive); stopSelf(); } } And the test server that I am using (written in python): #!/usr/bin/env python import socket, sys import json import pickle s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = '' PORT = 4242 #s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind( (HOST, PORT) ) s.listen(5) while True: print "listening for shit" conn, address = s.accept() print "address:", address while 1: #get the size of the incoming data size = conn.recv(sys.getsizeof(int)) print "size:", int(size) #now receive the data itself data = conn.recv(int(size)) if data == None: break #data.encode("utf-8") decoded = json.loads(data) print "Weight:", decoded['Weight'] print "Piecemark:", decoded['Piecemark'] conn.close() Here is the string that is being sent (it is long): "DetailCheckedBy":"","SketchRight":"","DetailLength":"142.75","DetailedDate":"**NOT SET**","EngineerVerifiedBothConns":"False","HoldStatus":"Not held","RevisionLevel":"No Revision","MemberNumber":"28","RequestVerifySectionSize":"False","TieForcesRight":"False","InputBy":"","IFCFinishDate_4":"**NOT SET**","IFCFinishDate_5":"**NOT SET**","Weight":"438.408","IFCTaskUID_1":"","IFCFinishDate_1":"**NOT SET**","ErectorOrder":"","IFCFinishDate_2":"**NOT SET**","IFCFinishDate_3":"**NOT SET**","IFCTaskUID_4":"","IFCTaskUID_5":"","IFCTaskUID_2":"","SketchLeft":"","IFCTaskUID_3":"","ErectorSequences":"","ReasonRejected":"","MemberCategory":"","EngineerVerifiedLeftConn":"False","BarcodeId":"","ManufacturingGUID":"42bbf9cc-52da-4712-a5fc-e37c5a544c14","aess":"False","FabricationComplete":"**NOT SET**","UserComment2":"","UserComment3":"","LoadNumber":"","UserComment1":"","ErectionBolted":"**NOT SET**","RequestVerifyLength":"False","RequestVerifyGrade":"False","Painted":"False","HeatCertNumber":"","Route1Description":"","IsExisting":"No","ReceivedFromApproval":"**NOT SET**","BackCheckedBy":"","BatchNumber":"","CostCodeReference":"","PONumber":"","Piecemark":"B_25","ReleasedForFabrication":"**NOT SET**","MemberDescription":"BEAM","EngineerVerifiedMemberReady":"False","IFCTaskName_2":"","IFCTaskName_1":"","IFCTaskName_4":"","RequestVerifyMemberPosition":"False","IFCTaskName_3":"","Erected":"**NOT SET**","RevisionCheckedBy_3":"","IFCTaskName_5":"","RevisionCheckedBy_2":"","RevisionCheckedBy_1":"","EngineerVerifiedLeftComments":"","RequestVerifyLeftConnMaterial":"False","RequestEngineerVerify":"False","RevisionCheckedDate_3":"**NOT SET**","RevisionCheckedDate_2":"**NOT SET**","RevisionCheckedDate_1":"**NOT SET**","EngineerVerifiedLength":"False","BackCheckedDate":"**NOT SET**","SubmittedForApproval":"**NOT SET**","EngineerVerifiedSpecial":"False","CostCodeDescription":"","IFCStartDate_5":"**NOT SET**","TieForcesLeft":"False","Fireproofed":"False","ErectorAvailable":"False","RequestVerifyRightConnMaterial":"False","DetailCheckedDate":"**NOT SET**","ErectorNonSteelSupported":"False","BeamPent":"False","StockStatus":"","Sequence":"1","RequestVerifyLeftLoad":"False","DetailFinalCheckDate":"**NOT SET**","ErectorMemberPlaced":"**NOT SET**","InstanceStatus":"","EngineerVerifiedRightConn":"False","DateReceived":"**NOT SET**","MemberType":"Beam","ModelCheckDate":"**NOT SET**","ReasonForHold":"","EngineerVerifiedRightComments":"","ReceivedOnJobSite":"**NOT SET**","RequestVerifyRightLoad":"False","CostCodePrice":"0.0","NestStatus":"","DateDue":"**NOT SET**","ShopSequence":"","EngineerVerifiedSectionSize":"False","ActualLength":"144","InputDate":"**NOT SET**","ErectorCity":"Unknown","EngineerVerifiedSpecial_comments":"","Route4Description":"","EngineerVerifiedGrade":"False","RightLocation":"0.0xx144.0xx156.0xx","IFCFinishTime_2":"","IFCFinishTime_1":"","IFCFinishTime_4":"","Route3Description":"","IFCFinishTime_3":"","LoadStatus":"","ErectorLongitude":"","DateModelCompleted":"61299957600000","Grade":"##SEKRIT KODE!!##","IFCFinishTime_5":"","Route2Description":"","RequestVerifyCamber":"False","ProjectedFabricationComplete":"**NOT SET**","DetailedBy":"","DetailFinalCheckBy":"","Description":"W8x35","ProjectedShippedDate":"**NOT SET**","NestName":"","IFCStartDate_2":"**NOT SET**","IFCStartTime_1":"","IFCStartDate_1":"**NOT SET**","IFCStartDate_4":"**NOT SET**","IFCStartDate_3":"**NOT SET**","IFCStartTime_5":"","IFCStartTime_4":"","IFCStartTime_3":"","DateHeld":"**NOT SET**","IFCStartTime_2":"","LeftLocation":"0.0xx0.0xx156.0xx","Job":"Mobile_x_x_x_x_Demo_x_x_x_x_IN_x_x_x_x_2011","SpecialCutWeld":"False","RejectedBy":"","ErectionWelded":"**NOT SET**","RequestVerifyRightConnConfig":"False","Vendor":"","PackageNumber":"","RejectedByErector":"**NOT SET**","ModelCheckedBy":"","ApprovalStatus":"Not reviewed","RequestVerifyLeftConnConfig":"False","ErectorLatitude":"","LotName":"","ActualShipDate":"**NOT SET**","NestId":"" This is the error I get from the python server: ValueError: Unterminated string starting at: line 1 column 1435 (char 1435) which I assume means that the string has been truncated to: "DetailCheckedBy":"","SketchRight":"","DetailLength":"142.75","DetailedDate":"**NOT SET**","EngineerVerifiedBothConns":"False","HoldStatus":"Not held","RevisionLevel":"No Revision","MemberNumber":"28","RequestVerifySectionSize":"False","TieForcesRight":"False","InputBy":"","IFCFinishDate_4":"**NOT SET**","IFCFinishDate_5":"**NOT SET**","Weight":"438.408","IFCTaskUID_1":"","IFCFinishDate_1":"**NOT SET**","ErectorOrder":"","IFCFinishDate_2":"**NOT SET**","IFCFinishDate_3":"**NOT SET**","IFCTaskUID_4":"","IFCTaskUID_5":"","IFCTaskUID_2":"","SketchLeft":"","IFCTaskUID_3":"","ErectorSequences":"","ReasonRejected":"","MemberCategory":"","EngineerVerifiedLeftConn":"False","BarcodeId":"","ManufacturingGUID":"42bbf9cc-52da-4712-a5fc-e37c5a544c14","aess":"False","FabricationComplete":"**NOT SET**","UserComment2":"","UserComment3":"","LoadNumber":"","UserComment1":"","ErectionBolted":"**NOT SET**","RequestVerifyLength":"False","RequestVerifyGrade":"False","Painted":"False","HeatCertNumber":"","Route1Description":"","IsExisting":"No","ReceivedFromApproval":"**NOT SET**","BackCheckedBy":"","BatchNumber":"","CostCodeReference":"","PONumber":"","Piecemark":"B_25","ReleasedForFabrication":"**NOT SET**","MemberDescription":"BEAM","EngineerVerifiedMemberReady":"False","IFCTaskName_2":"","IFCTaskName_1":"","IFCTaskName_4":"","RequestVerifyMemberPosition":"False","IFCTaskName_3":"","Erected":"**NOT SET**","RevisionCheckedBy_3":"","IFCTaskName_ Any help would be greatly appreciated. Thanks in advance.
android
python
tcp
null
null
null
open
Data being lost between Android device and python server using TCP === I'm somewhat new to network programming and am having some trouble. I am creating a JSON object on an Android device, connecting to a python server via TCP, and sending the JSON string. The connection gets accepted, but I keep losing the end of the string, so json.loads(json_string) is failing. Here is the relevant Android code: private class Worker implements Runnable { @Override public void run() { //create the network socket try { socket = new Socket(address, 4242); Log.i(TAG, "timeout: " + socket.getSoTimeout()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } packets = new ArrayList<JSONObject>(); for (jobs.moveToFirst(); jobs.isAfterLast() == false; jobs.moveToNext()) { String jobName = jobs.getString(jobs.getColumnIndex(JobMetaData.JobTableMetaData.JOB)); Uri.Builder updated = new Uri.Builder(); updated.scheme("content"); updated.authority(JobMetaData.AUTHORITY); updated.appendPath(jobName); updated.appendPath("member"); updated.appendPath(JobMetaData.MemberTableMetaData.CHANGED); updated.appendPath("true"); Cursor changed = getContentResolver().query(updated.build(), null, null, null, null); Log.d(TAG, "number of members " + changed.getCount()); //create a JSON object out of the editable properties for (changed.moveToFirst(); changed.isAfterLast() == false; changed.moveToNext()) { JSONObject json = new JSONObject(); for (String att : changed.getColumnNames()) { if (ListMetaData.validAtts.contains(att)) { try { json.put(att, changed.getString(changed.getColumnIndex(att))); } catch (JSONException e) { // TODO Auto-generated catch block Log.d(TAG, "JSON exception in DatagramService"); e.printStackTrace(); } } } //include the GUID and job name //for identification try { json.put(JobMetaData.MemberTableMetaData.GUID, changed.getString(changed.getColumnIndex(JobMetaData.MemberTableMetaData.GUID))); json.put(JobMetaData.JobTableMetaData.JOB, jobName); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } packets.add(json); } changed.close(); } Log.d(TAG, "entering send loop"); for (JSONObject packet : packets) { try { Log.d(TAG, "supposedly sending"); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); out.flush(); //send the length of the data out.write(Integer.toString(packet.toString().getBytes().length)); out.flush(); //now write the data Log.d(TAG, "packet string: " + packet.toString()); out.write(packet.toString(), 0, packet.toString().getBytes().length); out.flush(); } catch (IOException e) { Log.d(TAG, "in IOException of send loop"); e.printStackTrace(); } } //commented out for development // Intent receive = new Intent(getApplication().getApplicationContext(), ReceptionService.class); // startService(receive); stopSelf(); } } And the test server that I am using (written in python): #!/usr/bin/env python import socket, sys import json import pickle s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = '' PORT = 4242 #s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind( (HOST, PORT) ) s.listen(5) while True: print "listening for shit" conn, address = s.accept() print "address:", address while 1: #get the size of the incoming data size = conn.recv(sys.getsizeof(int)) print "size:", int(size) #now receive the data itself data = conn.recv(int(size)) if data == None: break #data.encode("utf-8") decoded = json.loads(data) print "Weight:", decoded['Weight'] print "Piecemark:", decoded['Piecemark'] conn.close() Here is the string that is being sent (it is long): "DetailCheckedBy":"","SketchRight":"","DetailLength":"142.75","DetailedDate":"**NOT SET**","EngineerVerifiedBothConns":"False","HoldStatus":"Not held","RevisionLevel":"No Revision","MemberNumber":"28","RequestVerifySectionSize":"False","TieForcesRight":"False","InputBy":"","IFCFinishDate_4":"**NOT SET**","IFCFinishDate_5":"**NOT SET**","Weight":"438.408","IFCTaskUID_1":"","IFCFinishDate_1":"**NOT SET**","ErectorOrder":"","IFCFinishDate_2":"**NOT SET**","IFCFinishDate_3":"**NOT SET**","IFCTaskUID_4":"","IFCTaskUID_5":"","IFCTaskUID_2":"","SketchLeft":"","IFCTaskUID_3":"","ErectorSequences":"","ReasonRejected":"","MemberCategory":"","EngineerVerifiedLeftConn":"False","BarcodeId":"","ManufacturingGUID":"42bbf9cc-52da-4712-a5fc-e37c5a544c14","aess":"False","FabricationComplete":"**NOT SET**","UserComment2":"","UserComment3":"","LoadNumber":"","UserComment1":"","ErectionBolted":"**NOT SET**","RequestVerifyLength":"False","RequestVerifyGrade":"False","Painted":"False","HeatCertNumber":"","Route1Description":"","IsExisting":"No","ReceivedFromApproval":"**NOT SET**","BackCheckedBy":"","BatchNumber":"","CostCodeReference":"","PONumber":"","Piecemark":"B_25","ReleasedForFabrication":"**NOT SET**","MemberDescription":"BEAM","EngineerVerifiedMemberReady":"False","IFCTaskName_2":"","IFCTaskName_1":"","IFCTaskName_4":"","RequestVerifyMemberPosition":"False","IFCTaskName_3":"","Erected":"**NOT SET**","RevisionCheckedBy_3":"","IFCTaskName_5":"","RevisionCheckedBy_2":"","RevisionCheckedBy_1":"","EngineerVerifiedLeftComments":"","RequestVerifyLeftConnMaterial":"False","RequestEngineerVerify":"False","RevisionCheckedDate_3":"**NOT SET**","RevisionCheckedDate_2":"**NOT SET**","RevisionCheckedDate_1":"**NOT SET**","EngineerVerifiedLength":"False","BackCheckedDate":"**NOT SET**","SubmittedForApproval":"**NOT SET**","EngineerVerifiedSpecial":"False","CostCodeDescription":"","IFCStartDate_5":"**NOT SET**","TieForcesLeft":"False","Fireproofed":"False","ErectorAvailable":"False","RequestVerifyRightConnMaterial":"False","DetailCheckedDate":"**NOT SET**","ErectorNonSteelSupported":"False","BeamPent":"False","StockStatus":"","Sequence":"1","RequestVerifyLeftLoad":"False","DetailFinalCheckDate":"**NOT SET**","ErectorMemberPlaced":"**NOT SET**","InstanceStatus":"","EngineerVerifiedRightConn":"False","DateReceived":"**NOT SET**","MemberType":"Beam","ModelCheckDate":"**NOT SET**","ReasonForHold":"","EngineerVerifiedRightComments":"","ReceivedOnJobSite":"**NOT SET**","RequestVerifyRightLoad":"False","CostCodePrice":"0.0","NestStatus":"","DateDue":"**NOT SET**","ShopSequence":"","EngineerVerifiedSectionSize":"False","ActualLength":"144","InputDate":"**NOT SET**","ErectorCity":"Unknown","EngineerVerifiedSpecial_comments":"","Route4Description":"","EngineerVerifiedGrade":"False","RightLocation":"0.0xx144.0xx156.0xx","IFCFinishTime_2":"","IFCFinishTime_1":"","IFCFinishTime_4":"","Route3Description":"","IFCFinishTime_3":"","LoadStatus":"","ErectorLongitude":"","DateModelCompleted":"61299957600000","Grade":"##SEKRIT KODE!!##","IFCFinishTime_5":"","Route2Description":"","RequestVerifyCamber":"False","ProjectedFabricationComplete":"**NOT SET**","DetailedBy":"","DetailFinalCheckBy":"","Description":"W8x35","ProjectedShippedDate":"**NOT SET**","NestName":"","IFCStartDate_2":"**NOT SET**","IFCStartTime_1":"","IFCStartDate_1":"**NOT SET**","IFCStartDate_4":"**NOT SET**","IFCStartDate_3":"**NOT SET**","IFCStartTime_5":"","IFCStartTime_4":"","IFCStartTime_3":"","DateHeld":"**NOT SET**","IFCStartTime_2":"","LeftLocation":"0.0xx0.0xx156.0xx","Job":"Mobile_x_x_x_x_Demo_x_x_x_x_IN_x_x_x_x_2011","SpecialCutWeld":"False","RejectedBy":"","ErectionWelded":"**NOT SET**","RequestVerifyRightConnConfig":"False","Vendor":"","PackageNumber":"","RejectedByErector":"**NOT SET**","ModelCheckedBy":"","ApprovalStatus":"Not reviewed","RequestVerifyLeftConnConfig":"False","ErectorLatitude":"","LotName":"","ActualShipDate":"**NOT SET**","NestId":"" This is the error I get from the python server: ValueError: Unterminated string starting at: line 1 column 1435 (char 1435) which I assume means that the string has been truncated to: "DetailCheckedBy":"","SketchRight":"","DetailLength":"142.75","DetailedDate":"**NOT SET**","EngineerVerifiedBothConns":"False","HoldStatus":"Not held","RevisionLevel":"No Revision","MemberNumber":"28","RequestVerifySectionSize":"False","TieForcesRight":"False","InputBy":"","IFCFinishDate_4":"**NOT SET**","IFCFinishDate_5":"**NOT SET**","Weight":"438.408","IFCTaskUID_1":"","IFCFinishDate_1":"**NOT SET**","ErectorOrder":"","IFCFinishDate_2":"**NOT SET**","IFCFinishDate_3":"**NOT SET**","IFCTaskUID_4":"","IFCTaskUID_5":"","IFCTaskUID_2":"","SketchLeft":"","IFCTaskUID_3":"","ErectorSequences":"","ReasonRejected":"","MemberCategory":"","EngineerVerifiedLeftConn":"False","BarcodeId":"","ManufacturingGUID":"42bbf9cc-52da-4712-a5fc-e37c5a544c14","aess":"False","FabricationComplete":"**NOT SET**","UserComment2":"","UserComment3":"","LoadNumber":"","UserComment1":"","ErectionBolted":"**NOT SET**","RequestVerifyLength":"False","RequestVerifyGrade":"False","Painted":"False","HeatCertNumber":"","Route1Description":"","IsExisting":"No","ReceivedFromApproval":"**NOT SET**","BackCheckedBy":"","BatchNumber":"","CostCodeReference":"","PONumber":"","Piecemark":"B_25","ReleasedForFabrication":"**NOT SET**","MemberDescription":"BEAM","EngineerVerifiedMemberReady":"False","IFCTaskName_2":"","IFCTaskName_1":"","IFCTaskName_4":"","RequestVerifyMemberPosition":"False","IFCTaskName_3":"","Erected":"**NOT SET**","RevisionCheckedBy_3":"","IFCTaskName_ Any help would be greatly appreciated. Thanks in advance.
0
11,401,212
07/09/2012 18:50:20
1,426,508
05/30/2012 16:11:36
15
2
Amazon MWS Read Inventory Stock Php
I am trying to get the available stock of a product for an sku. I searched it a-lot found some pdfs non of them worked for me. I am stuck scratching my head what to do, can anyone help me I will be more then thankful. I also tried this code, $skus = new FBAInventoryServiceMWS_Model_SellerSkuList(); $skus->setmember( 'sku-111' ); invokeListInventorySupply($service, $request->withSellerSkus( $skus ) ); but what it returned is InStockSupplyQuantity is 0 you can see on this [link][1] [1]: http://ht.dnsuk.net/amazon/FBAInventoryServiceMWS/Samples/ListInventorySupplySample.php
php
amazon-mws
null
null
null
null
open
Amazon MWS Read Inventory Stock Php === I am trying to get the available stock of a product for an sku. I searched it a-lot found some pdfs non of them worked for me. I am stuck scratching my head what to do, can anyone help me I will be more then thankful. I also tried this code, $skus = new FBAInventoryServiceMWS_Model_SellerSkuList(); $skus->setmember( 'sku-111' ); invokeListInventorySupply($service, $request->withSellerSkus( $skus ) ); but what it returned is InStockSupplyQuantity is 0 you can see on this [link][1] [1]: http://ht.dnsuk.net/amazon/FBAInventoryServiceMWS/Samples/ListInventorySupplySample.php
0
11,400,308
07/09/2012 17:46:21
1,308,678
04/02/2012 17:53:26
8
0
Parsing huge, badly encoded XML files in Python
I have been working on code that parses external XML-files. Some of these files are huge, up to gigabytes of data. Needless to say, these files need to be parsed as a stream because loading them into memory is much too inefficient and often leads to OutOfMemory troubles. I have used the libraries miniDOM, ElementTree, cElementTree and I am currently using lxml. Right now I have a working, pretty memory-efficient script, using `lxml.etree.iterparse`. The problem is that some of the XML files I need to parse contain encoding errors (they advertise as UTF-8, but contain differently encoded characters). When using `lxml.etree.parse` this can be fixed by using the `recover=True` option of a custom parser, but `iterparse` does not accept a custom parser. (see also: [this question](http://stackoverflow.com/questions/2352840/parsing-broken-xml-with-lxml-etree-iterparse)) My current code looks like this: from lxml import etree events = ("start", "end") context = etree.iterparse(xmlfile, events=events) event, root_element = context.next() # <items> for action, element in context: if action == 'end' and element.tag == 'item': # <parse> root_element.clear() Error when `iterparse` encounters a bad character (in this case, it's a `^Y`): lxml.etree.XMLSyntaxError: Input is not proper UTF-8, indicate encoding ! Bytes: 0x19 0x73 0x20 0x65, line 949490, column 25 I don't even wish to decode this data, I can just drop it. However I don't know any way to skip the element - I tried `context.next` and `continue` in try/except statements. Any help would be appreciated!
python
xml
encoding
iterparse
null
null
open
Parsing huge, badly encoded XML files in Python === I have been working on code that parses external XML-files. Some of these files are huge, up to gigabytes of data. Needless to say, these files need to be parsed as a stream because loading them into memory is much too inefficient and often leads to OutOfMemory troubles. I have used the libraries miniDOM, ElementTree, cElementTree and I am currently using lxml. Right now I have a working, pretty memory-efficient script, using `lxml.etree.iterparse`. The problem is that some of the XML files I need to parse contain encoding errors (they advertise as UTF-8, but contain differently encoded characters). When using `lxml.etree.parse` this can be fixed by using the `recover=True` option of a custom parser, but `iterparse` does not accept a custom parser. (see also: [this question](http://stackoverflow.com/questions/2352840/parsing-broken-xml-with-lxml-etree-iterparse)) My current code looks like this: from lxml import etree events = ("start", "end") context = etree.iterparse(xmlfile, events=events) event, root_element = context.next() # <items> for action, element in context: if action == 'end' and element.tag == 'item': # <parse> root_element.clear() Error when `iterparse` encounters a bad character (in this case, it's a `^Y`): lxml.etree.XMLSyntaxError: Input is not proper UTF-8, indicate encoding ! Bytes: 0x19 0x73 0x20 0x65, line 949490, column 25 I don't even wish to decode this data, I can just drop it. However I don't know any way to skip the element - I tried `context.next` and `continue` in try/except statements. Any help would be appreciated!
0
11,401,215
07/09/2012 18:50:33
752,920
05/13/2011 19:21:59
643
20
How to find the vertices of an edge and if either of those is a leaf node a in JUNG Graph?
I am working with JUNG Graph. The problem I am working on can be defined as follows: > Given a JUNG Graph G={V,E} and an edge E1, find the nodes/vertices > that E1 connects and delete the vertex if it is a leaf node. So, there are two parts: 1. Finding the vertices that are connected by a given edge E1. 2. Find if a given vertex is a leaf node? Are these two operations directly possible in JUNG. If not, can someone suggest an alternate way to achieve the same.
java
jung
null
null
null
null
open
How to find the vertices of an edge and if either of those is a leaf node a in JUNG Graph? === I am working with JUNG Graph. The problem I am working on can be defined as follows: > Given a JUNG Graph G={V,E} and an edge E1, find the nodes/vertices > that E1 connects and delete the vertex if it is a leaf node. So, there are two parts: 1. Finding the vertices that are connected by a given edge E1. 2. Find if a given vertex is a leaf node? Are these two operations directly possible in JUNG. If not, can someone suggest an alternate way to achieve the same.
0