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,471,490
07/13/2012 13:29:21
875,640
08/02/2011 23:48:53
541
26
Stretch Drawn Shape to fit Frame?
I have an app where I'm drawing a special ellipse I made a via series of Bezier Paths as follows: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGMutablePathRef pPath_0 = CGPathCreateMutable(); CGPathMoveToPoint(pPath_0, NULL, 515.98,258.24); CGPathAddCurveToPoint(pPath_0, NULL, 515.98,435.61,415.54,515.98,258.24,515.98); CGPathAddCurveToPoint(pPath_0, NULL, 100.94,515.98,0.50,435.61,0.50,258.24); CGPathAddCurveToPoint(pPath_0, NULL, 0.50,80.86,100.94,0.50,258.24,0.50); CGPathAddCurveToPoint(pPath_0, NULL, 415.54,0.50,515.98,80.86,515.98,258.24); CGPathCloseSubpath(pPath_0); CGContextSetRGBFillColor(context, 1.0000, 1.0000, 1.0000, 1.0000); CGContextSetRGBStrokeColor(context,0.0000,0.0000,0.0000,1.0000); CGContextSetLineWidth(context, 1); CGContextSetMiterLimit(context, 10.0000); CGContextAddPath(context, pPath_0); CGContextDrawPath(context, kCGPathFillStroke); CGPathRelease(pPath_0); CGContextRestoreGState(context); I am wondering, is there any way in core graphics where I can take the shape I just created and stretch it both horizontally and vertically so that it fits perfectly in its views frame? IE so I don't have to manually go into all my points and values and write them in terms of the view bounds? I know for this shape it wouldn't be that difficult, but I have some more complex shapes that are more time consuming that I'd rather avoid doing that...
iphone
ios
cocoa-touch
core-graphics
null
null
open
Stretch Drawn Shape to fit Frame? === I have an app where I'm drawing a special ellipse I made a via series of Bezier Paths as follows: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGMutablePathRef pPath_0 = CGPathCreateMutable(); CGPathMoveToPoint(pPath_0, NULL, 515.98,258.24); CGPathAddCurveToPoint(pPath_0, NULL, 515.98,435.61,415.54,515.98,258.24,515.98); CGPathAddCurveToPoint(pPath_0, NULL, 100.94,515.98,0.50,435.61,0.50,258.24); CGPathAddCurveToPoint(pPath_0, NULL, 0.50,80.86,100.94,0.50,258.24,0.50); CGPathAddCurveToPoint(pPath_0, NULL, 415.54,0.50,515.98,80.86,515.98,258.24); CGPathCloseSubpath(pPath_0); CGContextSetRGBFillColor(context, 1.0000, 1.0000, 1.0000, 1.0000); CGContextSetRGBStrokeColor(context,0.0000,0.0000,0.0000,1.0000); CGContextSetLineWidth(context, 1); CGContextSetMiterLimit(context, 10.0000); CGContextAddPath(context, pPath_0); CGContextDrawPath(context, kCGPathFillStroke); CGPathRelease(pPath_0); CGContextRestoreGState(context); I am wondering, is there any way in core graphics where I can take the shape I just created and stretch it both horizontally and vertically so that it fits perfectly in its views frame? IE so I don't have to manually go into all my points and values and write them in terms of the view bounds? I know for this shape it wouldn't be that difficult, but I have some more complex shapes that are more time consuming that I'd rather avoid doing that...
0
11,471,756
07/13/2012 13:46:08
959,780
09/22/2011 18:26:49
59
1
Google share button, is it possible to share content from one URL and link back to another?
Example an online learning application that you want to share your results which are behind a logged in part of your site. So you add a public URL to your site for google to fetch the content (img, description, title): data-href="http://www.example.com?result_id=24". But then when someone views the post and sees the shared content and clicks the link to the site it goes to: http://www.example.com?result_id=24 The only way I can think of is redirecting the user to http://www.example.com once they land on the shared URL. Is there an official way or better way to do this? Thanks
google
google-plus
null
null
null
null
open
Google share button, is it possible to share content from one URL and link back to another? === Example an online learning application that you want to share your results which are behind a logged in part of your site. So you add a public URL to your site for google to fetch the content (img, description, title): data-href="http://www.example.com?result_id=24". But then when someone views the post and sees the shared content and clicks the link to the site it goes to: http://www.example.com?result_id=24 The only way I can think of is redirecting the user to http://www.example.com once they land on the shared URL. Is there an official way or better way to do this? Thanks
0
11,471,758
07/13/2012 13:46:12
337,306
05/10/2010 14:04:17
663
91
getUrl doesn't work as it puts the numbered array key in the url
`<?php $daurl = Mage::getUrl('showdown/index/vote',array('c', 'd')) ?>` Produces this result > http://desbest.uk.to/clients/magentofull/index.php/showdown/index/**vote/0/c/1/d** But I don't want it to be `vote/0/c/1/d` Instead I want `vote/c/d` Please help!
magento
null
null
null
null
null
open
getUrl doesn't work as it puts the numbered array key in the url === `<?php $daurl = Mage::getUrl('showdown/index/vote',array('c', 'd')) ?>` Produces this result > http://desbest.uk.to/clients/magentofull/index.php/showdown/index/**vote/0/c/1/d** But I don't want it to be `vote/0/c/1/d` Instead I want `vote/c/d` Please help!
0
11,471,760
07/13/2012 13:46:20
1,472,364
06/21/2012 14:07:31
29
0
Removing outlier pixels from a small binary image
I am currently implementing an algorithm for identifying the axis of minimum inertia of a colored mass (provided by the second moments). In order to do so, I need to acquire the centre of mass, as given by the first moments. The weighted averaging function works well, but due to outlier pixels, I am receiving undesired results. ![Incorrect Center of Mass][1] [1]: http://i.stack.imgur.com/ihbtI.png Given an image such as this, which is represented by exclusively two colors (background and foreground), how can I remove outlying pixels? Note: Outlying pixels refers to anything not part of the big color-mass. Much appreciated.
algorithm
computer-vision
noise
outliers
null
null
open
Removing outlier pixels from a small binary image === I am currently implementing an algorithm for identifying the axis of minimum inertia of a colored mass (provided by the second moments). In order to do so, I need to acquire the centre of mass, as given by the first moments. The weighted averaging function works well, but due to outlier pixels, I am receiving undesired results. ![Incorrect Center of Mass][1] [1]: http://i.stack.imgur.com/ihbtI.png Given an image such as this, which is represented by exclusively two colors (background and foreground), how can I remove outlying pixels? Note: Outlying pixels refers to anything not part of the big color-mass. Much appreciated.
0
6,075,667
05/20/2011 17:39:54
763,174
05/20/2011 17:39:54
1
0
PHP function parameters from a string
How do I make a truely dynamic function with dynamic parameters call? The documentation and examples I've found all assume you have only 1 parameter. I would like to have multiple parameters, example: class Object { function A($p1) {} function B($p1,$p2) {} } $obj = new Object(); $function = "B"; $params = "'foo', 'me'"; $obj->$function($params); calling $function = "A" will be fine as $params is treated as a string. I've tried `$obj->$function(explode(',',$params));` for $function="B" but it does not work as explode simply returns an array and thus function B has a missing parameter. Any idea?
php
function
parameters
eval
null
null
open
PHP function parameters from a string === How do I make a truely dynamic function with dynamic parameters call? The documentation and examples I've found all assume you have only 1 parameter. I would like to have multiple parameters, example: class Object { function A($p1) {} function B($p1,$p2) {} } $obj = new Object(); $function = "B"; $params = "'foo', 'me'"; $obj->$function($params); calling $function = "A" will be fine as $params is treated as a string. I've tried `$obj->$function(explode(',',$params));` for $function="B" but it does not work as explode simply returns an array and thus function B has a missing parameter. Any idea?
0
11,471,767
07/13/2012 13:46:43
1,160,608
01/20/2012 12:25:30
776
43
Is it possible to communicate with WCF TCP service with app in java or python?
I receive a WCF service to communicate, so, i need to create a client in java or python to get informations provided by this service that is a WCF TCP service. Is it possible?
java
.net
python
wcf
tcp
null
open
Is it possible to communicate with WCF TCP service with app in java or python? === I receive a WCF service to communicate, so, i need to create a client in java or python to get informations provided by this service that is a WCF TCP service. Is it possible?
0
11,471,768
07/13/2012 13:46:44
1,143,694
01/11/2012 16:56:58
17
1
Dropdown autopost inside updatepabel never enters code behind SelectedIndexChanged event
This is a difficult scenerio to explain, so I coded up a simple example. <asp:UpdatePanel runat="server" ID="upTest" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlTest" runat="server" AutoPostBack="true"></asp:DropDownList> <br /><br /> In page: <asp:TextBox runat="server" ID="txtTest" Columns="50" Text="OnLoad</asp:TextBox> <br /> <br /> <asp:Button runat="server" ID="btnTest" Text="Click it" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlTest" /> </Triggers> </UpdatePanel> Code-Behind Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.IsPostBack Then BindDropDown(Request.Form(ddlTest.UniqueID)) Else BindDropDown(0) End If End Sub Public Sub BindDropDown(val As Integer) ddlTest.Items.Add(New ListItem("", 0)) ddlTest.Items.Add(New ListItem("One", 1)) ddlTest.Items.Add(New ListItem("Two", 2)) ddlTest.Items.Add(New ListItem("Three", 3)) ddlTest.Items.Add(New ListItem("Four", 4)) ddlTest.SelectedValue = val End Sub Private Sub ddlTest_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlTest.SelectedIndexChanged txtTest.Text = "Dropdown changed" End Sub Private Sub btnTest_Click(sender As Object, e As System.EventArgs) Handles btnTest.Click txtTest.Text = "Button clicked" End Sub Also to note, I have EnableViewState="false" and ClientIdMode="Static" for the page. When I click the button the partial postback occurs and the textbox has the expected value of 'Button Clicked' When I change the dropdown the partial postback occurs, however the textbox does not have the expected value of 'Dropdown changed' because the code in ddlTest_SelectedIndexChanged is never hit (breakpoint placement on that line of code also never hits) In the larger scope of my project this is the crux of the problem and I can't determine why this event is never hit (the core problem is when I load a dynamic user control, the data in the control is bound correctly, but then is overridden with the pre-post data after the user control is loaded - the override is occurring somewhere in the post back events). It appears to me it has something to do with the binding of the dropdown and where it happens in the page cycle, but I haven't been able to nail anything down, nor come up with google solutions. One odd thing I did notice when looking at the post in Firebug - the EVENTTARGET value for the dropdown was the UniqueId of the dropdown, but the EVENTTARGET value is empty for the button click. My brain is thinking there is some connection here. FYI - I have come up with a work around that seems to do the trick. I set autopostback on dropdown to false, and using jQuery I assign the change event on the dropdown to fire the button click - which causes the postback and fires btn_click event in code.
drop-down-menu
updatepanel
partial-postback
null
null
null
open
Dropdown autopost inside updatepabel never enters code behind SelectedIndexChanged event === This is a difficult scenerio to explain, so I coded up a simple example. <asp:UpdatePanel runat="server" ID="upTest" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlTest" runat="server" AutoPostBack="true"></asp:DropDownList> <br /><br /> In page: <asp:TextBox runat="server" ID="txtTest" Columns="50" Text="OnLoad</asp:TextBox> <br /> <br /> <asp:Button runat="server" ID="btnTest" Text="Click it" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlTest" /> </Triggers> </UpdatePanel> Code-Behind Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.IsPostBack Then BindDropDown(Request.Form(ddlTest.UniqueID)) Else BindDropDown(0) End If End Sub Public Sub BindDropDown(val As Integer) ddlTest.Items.Add(New ListItem("", 0)) ddlTest.Items.Add(New ListItem("One", 1)) ddlTest.Items.Add(New ListItem("Two", 2)) ddlTest.Items.Add(New ListItem("Three", 3)) ddlTest.Items.Add(New ListItem("Four", 4)) ddlTest.SelectedValue = val End Sub Private Sub ddlTest_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlTest.SelectedIndexChanged txtTest.Text = "Dropdown changed" End Sub Private Sub btnTest_Click(sender As Object, e As System.EventArgs) Handles btnTest.Click txtTest.Text = "Button clicked" End Sub Also to note, I have EnableViewState="false" and ClientIdMode="Static" for the page. When I click the button the partial postback occurs and the textbox has the expected value of 'Button Clicked' When I change the dropdown the partial postback occurs, however the textbox does not have the expected value of 'Dropdown changed' because the code in ddlTest_SelectedIndexChanged is never hit (breakpoint placement on that line of code also never hits) In the larger scope of my project this is the crux of the problem and I can't determine why this event is never hit (the core problem is when I load a dynamic user control, the data in the control is bound correctly, but then is overridden with the pre-post data after the user control is loaded - the override is occurring somewhere in the post back events). It appears to me it has something to do with the binding of the dropdown and where it happens in the page cycle, but I haven't been able to nail anything down, nor come up with google solutions. One odd thing I did notice when looking at the post in Firebug - the EVENTTARGET value for the dropdown was the UniqueId of the dropdown, but the EVENTTARGET value is empty for the button click. My brain is thinking there is some connection here. FYI - I have come up with a work around that seems to do the trick. I set autopostback on dropdown to false, and using jQuery I assign the change event on the dropdown to fire the button click - which causes the postback and fires btn_click event in code.
0
11,471,772
07/13/2012 13:47:07
1,365,834
04/30/2012 12:42:18
1
0
Cocos2d - Make Train in Box2d
I try to make a game Like Roller Coaster and i have no idea how to make Train so please Help Me to make Physics and Joint Of the Train, i also want to jump the train and i use Box2d.
cocos2d-iphone
cocos2d
null
null
null
07/13/2012 14:37:36
not a real question
Cocos2d - Make Train in Box2d === I try to make a game Like Roller Coaster and i have no idea how to make Train so please Help Me to make Physics and Joint Of the Train, i also want to jump the train and i use Box2d.
1
11,262,391
06/29/2012 13:08:19
181,351
09/29/2009 19:03:45
2,056
35
From barycentric to cartesian
I have the following function to convert a point on the same plane as a triangle into a barycentric point. // p0, p1 and p2 and the points that make up this triangle Vector3d Tri::barycentric(Vector3d p) { double triArea = (p1 - p0).cross(p2 - p0).norm() * 0.5; double u = ((p1 - p).cross(p2 - p).norm() * 0.5) / triArea; double v = ((p0 - p).cross(p2 - p).norm() * 0.5) / triArea; double w = ((p0 - p).cross(p1 - p).norm() * 0.5) / triArea; return Vector3d(u,v,w); } How can I write the inverse of this operation? I would like to write a function that takes a barycentric coord and returns the cartesian point.
c++
math
3d
coordinate-systems
null
null
open
From barycentric to cartesian === I have the following function to convert a point on the same plane as a triangle into a barycentric point. // p0, p1 and p2 and the points that make up this triangle Vector3d Tri::barycentric(Vector3d p) { double triArea = (p1 - p0).cross(p2 - p0).norm() * 0.5; double u = ((p1 - p).cross(p2 - p).norm() * 0.5) / triArea; double v = ((p0 - p).cross(p2 - p).norm() * 0.5) / triArea; double w = ((p0 - p).cross(p1 - p).norm() * 0.5) / triArea; return Vector3d(u,v,w); } How can I write the inverse of this operation? I would like to write a function that takes a barycentric coord and returns the cartesian point.
0
11,262,392
06/29/2012 13:08:20
643,469
03/03/2011 18:19:27
11
2
Matlab Optimisation with multiple combinations of inequality constraints that must be run simultaneously
Hi I am trying to code a linear optimisation using linprog to determine the optimum number of PV (x1) and WT (x2) units under a given objective function shown below f = [((CRF.*Panel_capacity./PV_energy)+OM_PV)((CRF.*WT_capacity/WT_energy)+OM_WT)]; Apart from CRF which is a constant, I have 27 selections for "Panel capacity" and "PVenergy" and "OM_PV" and 3 selections of "WT_capacity", "WTenergy" and "OM_WT". I am trying to run linprog to examine the optimum x1 and x2 values for all the 27 and 3 combinations (which in total are 27*3 = 81 possible combinations). Therefore I am hoping for an output in some form similar to say: 5*x1,2 and 10*x2,3 which would mean the optimum combination is 5 units of the second PV panel (from the 27 in total) and 10 units of the third WT . My inequality constraint is the following b = Demand_vector; Where "Demand_vector" is a 8760x1 vector -same for all cases. A = [PV WT]; Where PV is currently a 8760x1 and WT is an 8760x1 to have a total 8760x2 matrix of A (this should give me a 2x1 vector of x's which is what I'm looking for). However, as I mentioned above, I have 27 different PV's and 3 WT's (of the same type i.e 8760x1 which I want to examine all simultaneously and really need help in how to format the code for : objective function - f (at the moment it doesn't account for all combs) inequality constraint A = (at the moment it doesn't account for all combs) Any help in how to format this linprog optimisation would be extremely appreciated, please let me know if more info is required. Thank you
matlab
for-loop
multidimensional-array
linear-programming
null
null
open
Matlab Optimisation with multiple combinations of inequality constraints that must be run simultaneously === Hi I am trying to code a linear optimisation using linprog to determine the optimum number of PV (x1) and WT (x2) units under a given objective function shown below f = [((CRF.*Panel_capacity./PV_energy)+OM_PV)((CRF.*WT_capacity/WT_energy)+OM_WT)]; Apart from CRF which is a constant, I have 27 selections for "Panel capacity" and "PVenergy" and "OM_PV" and 3 selections of "WT_capacity", "WTenergy" and "OM_WT". I am trying to run linprog to examine the optimum x1 and x2 values for all the 27 and 3 combinations (which in total are 27*3 = 81 possible combinations). Therefore I am hoping for an output in some form similar to say: 5*x1,2 and 10*x2,3 which would mean the optimum combination is 5 units of the second PV panel (from the 27 in total) and 10 units of the third WT . My inequality constraint is the following b = Demand_vector; Where "Demand_vector" is a 8760x1 vector -same for all cases. A = [PV WT]; Where PV is currently a 8760x1 and WT is an 8760x1 to have a total 8760x2 matrix of A (this should give me a 2x1 vector of x's which is what I'm looking for). However, as I mentioned above, I have 27 different PV's and 3 WT's (of the same type i.e 8760x1 which I want to examine all simultaneously and really need help in how to format the code for : objective function - f (at the moment it doesn't account for all combs) inequality constraint A = (at the moment it doesn't account for all combs) Any help in how to format this linprog optimisation would be extremely appreciated, please let me know if more info is required. Thank you
0
11,262,394
06/29/2012 13:08:26
462,416
09/30/2010 02:57:52
181
4
Generalize and optimize speech bubble logic in Objective-C
I am working on a children's book app and would like to dynamically populate speech bubble(s) for character dialogues on every scene. I got the animation and dialogue working and below is the code for that. I would have multiple pages in my book, every page would have multiple characters and every character would have multiple dialogues. What is the best way to make this a generic approach so I can use it repeatedly. Can I store the dialogues in TEXT/XML file and read and display them dynamically based on following parameters: Page number, Character number, dialogue number? UIImage *bubble = [[UIImage imageNamed:@"BubbleLefthand.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(15, 21, 15, 21)]; UIImageView *imgView = [[[UIImageView alloc] initWithImage:bubble] autorelease]; imgView.frame = CGRectMake(250, 350, 0, 0); UILabel *xlabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; xlabel.text = @"This is a dialogue text!!!"; [imgView addSubview:xlabel]; [self.view addSubview:imgView]; [UIView animateWithDuration:0.5 animations:^(void) { imgView.frame = CGRectMake(250, 350, 300, -40); xlabel.frame = CGRectMake(30, 10, 200, 20); } completion:^(BOOL finished) { STLog(@"ChildrenBookViewController ==> SPPECH BUBBLE ANIMATION COMPLETE. Switch Case: %d", pageNum); }]; Currently my dialogue shows like attach screenshot. ![enter image description here][1] [1]: http://i.stack.imgur.com/w7KOU.png
objective-c
ios
ios5
null
null
null
open
Generalize and optimize speech bubble logic in Objective-C === I am working on a children's book app and would like to dynamically populate speech bubble(s) for character dialogues on every scene. I got the animation and dialogue working and below is the code for that. I would have multiple pages in my book, every page would have multiple characters and every character would have multiple dialogues. What is the best way to make this a generic approach so I can use it repeatedly. Can I store the dialogues in TEXT/XML file and read and display them dynamically based on following parameters: Page number, Character number, dialogue number? UIImage *bubble = [[UIImage imageNamed:@"BubbleLefthand.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(15, 21, 15, 21)]; UIImageView *imgView = [[[UIImageView alloc] initWithImage:bubble] autorelease]; imgView.frame = CGRectMake(250, 350, 0, 0); UILabel *xlabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; xlabel.text = @"This is a dialogue text!!!"; [imgView addSubview:xlabel]; [self.view addSubview:imgView]; [UIView animateWithDuration:0.5 animations:^(void) { imgView.frame = CGRectMake(250, 350, 300, -40); xlabel.frame = CGRectMake(30, 10, 200, 20); } completion:^(BOOL finished) { STLog(@"ChildrenBookViewController ==> SPPECH BUBBLE ANIMATION COMPLETE. Switch Case: %d", pageNum); }]; Currently my dialogue shows like attach screenshot. ![enter image description here][1] [1]: http://i.stack.imgur.com/w7KOU.png
0
11,262,397
06/29/2012 13:08:29
1,186,218
02/02/2012 21:42:51
8
0
Is it possible to have more than one Content_URI inside a provider?
I have a content provider that exposes two different URIs. My app keeps force closing if I try to run a query based on my 2nd of the two URIs and logcat gives me the error "failed to find provider for..." My two URIs are defined as follows in the ContentProvider class: public static final Uri CONTENT_ACCOUNT_URI = Uri.parse("content://com.vanhlebarsoftware.kmmdroid.kmmdprovider/account"); public static final Uri CONTENT_SCHEDULE_URI = Uri.parse("content://com.vanhlebarsoftware.kmmdroid.kmmprovider/schedule"); My provider is declared as follows in the manifest: `<provider android:name=".KMMDProvider"android:authorities="com.vanhlebarsoftware.kmmdroid.kmmdprovider"></provider>` Finally in my home screen widget I am calling the provider like this, which works just fine if I call it with CONTENT_ACCOUNT_URI but fails when I used the CONTENT_SCHEDULE_URI: c = context.getContentResolver().query(KMMDProvider.CONTENT_SCHEDULE_URI, null, null, null, null); Right now I need these two distinct URIs but in the future I might need more, if having them all defined in a single ContentProvider class is not the best way to go then how else should I do it? Have a separate ContentProvider for each URI that I need? That just doesn't seem to make much sense to me and seems like it would be a lot of extra code.
android
android-widget
null
null
null
null
open
Is it possible to have more than one Content_URI inside a provider? === I have a content provider that exposes two different URIs. My app keeps force closing if I try to run a query based on my 2nd of the two URIs and logcat gives me the error "failed to find provider for..." My two URIs are defined as follows in the ContentProvider class: public static final Uri CONTENT_ACCOUNT_URI = Uri.parse("content://com.vanhlebarsoftware.kmmdroid.kmmdprovider/account"); public static final Uri CONTENT_SCHEDULE_URI = Uri.parse("content://com.vanhlebarsoftware.kmmdroid.kmmprovider/schedule"); My provider is declared as follows in the manifest: `<provider android:name=".KMMDProvider"android:authorities="com.vanhlebarsoftware.kmmdroid.kmmdprovider"></provider>` Finally in my home screen widget I am calling the provider like this, which works just fine if I call it with CONTENT_ACCOUNT_URI but fails when I used the CONTENT_SCHEDULE_URI: c = context.getContentResolver().query(KMMDProvider.CONTENT_SCHEDULE_URI, null, null, null, null); Right now I need these two distinct URIs but in the future I might need more, if having them all defined in a single ContentProvider class is not the best way to go then how else should I do it? Have a separate ContentProvider for each URI that I need? That just doesn't seem to make much sense to me and seems like it would be a lot of extra code.
0
11,262,398
06/29/2012 13:08:29
603,661
02/04/2011 19:08:07
93
6
Recommended standards for unit test failure messages?
This is a rather minor aspect of unit testing, but I'm curious about the (often optional) failure message that you can define to display in the event that a test assertion fails during test execution. **Are there recommended practices for when to use such messages and what information to include in them?** For example, I'd guess that not every assertion needs to have a failure message defined, namely, when it's quite clear what the expected outcome of the test is supposed to be. But there are those instances when you might want to test a few aspects of an object after doing a single action, meaning that you may have a couple assertions listed in one test method. Should each assertion in that scenario have a descriptive failure message, so that it's easy to see why the test method might have failed at a given point?
unit-testing
null
null
null
null
null
open
Recommended standards for unit test failure messages? === This is a rather minor aspect of unit testing, but I'm curious about the (often optional) failure message that you can define to display in the event that a test assertion fails during test execution. **Are there recommended practices for when to use such messages and what information to include in them?** For example, I'd guess that not every assertion needs to have a failure message defined, namely, when it's quite clear what the expected outcome of the test is supposed to be. But there are those instances when you might want to test a few aspects of an object after doing a single action, meaning that you may have a couple assertions listed in one test method. Should each assertion in that scenario have a descriptive failure message, so that it's easy to see why the test method might have failed at a given point?
0
11,262,402
06/29/2012 13:08:41
876,922
08/03/2011 15:20:35
31
3
Random WindowsError/IOError with large amount of data
I'm currently experiencing a weird bug with a piece of software created with Python (and some Cython modules). I am running it in Windows 64-bit, but using 32-bit Python. Part of the program involves downloading a lot of data (up to several gigabytes), and then proceeding to process the data. The software has been relatively stable for a while, but we just introduced a new data source that substantially adds to the quantity of data downloaded. I believe this is when the bug has started occurring. Running the exact same test case over and over again, I get errors at what seems to be random places. Here are two of the error messages I've seen so far: IOError: [Errno 13] Permission denied: "[filename]" and WindowsError: [Error 32] The process cannot access the file because it is being used by another process: "[filename]" I will give out more information if it is needed. Again, I have only seen this error recently with the introduction of a new data source, so I think it has something to do with the volume of data. Does anybody have an idea what would be causing this? Thanks!
python
windows
null
null
null
null
open
Random WindowsError/IOError with large amount of data === I'm currently experiencing a weird bug with a piece of software created with Python (and some Cython modules). I am running it in Windows 64-bit, but using 32-bit Python. Part of the program involves downloading a lot of data (up to several gigabytes), and then proceeding to process the data. The software has been relatively stable for a while, but we just introduced a new data source that substantially adds to the quantity of data downloaded. I believe this is when the bug has started occurring. Running the exact same test case over and over again, I get errors at what seems to be random places. Here are two of the error messages I've seen so far: IOError: [Errno 13] Permission denied: "[filename]" and WindowsError: [Error 32] The process cannot access the file because it is being used by another process: "[filename]" I will give out more information if it is needed. Again, I have only seen this error recently with the introduction of a new data source, so I think it has something to do with the volume of data. Does anybody have an idea what would be causing this? Thanks!
0
11,262,403
06/29/2012 13:08:41
787,793
06/07/2011 15:42:46
436
21
ASP.NET MVC file uploads using Valums Ajax Uploader no view created
I followed this [tutorial][1], put js, css and gif in the respective folder. The problem is the view doesn't show a thing. <link href="@Url.Content("~/css/fileuploader.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/js/fileuploader.js")" type="text/javascript"></script> <div id="file-uploader"> <noscript> <p> Please enable JavaScript to use file uploader.</p> </noscript> </div> <script type="text/javascript"> var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader'), action: '@Url.Action("upload")' // put here a path to your page to handle uploading //,allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'] // user this if you want to upload only pictures sizeLimit: 4000000, // max size, about 4MB minSizeLimit: 0, // min size }); </script> What is wrong with this script? [1]: http://maxivak.com/asp-net-mvc-file-uploads-using-valums-plugin/
javascript
ajax
asp.net-mvc-3
null
null
null
open
ASP.NET MVC file uploads using Valums Ajax Uploader no view created === I followed this [tutorial][1], put js, css and gif in the respective folder. The problem is the view doesn't show a thing. <link href="@Url.Content("~/css/fileuploader.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/js/fileuploader.js")" type="text/javascript"></script> <div id="file-uploader"> <noscript> <p> Please enable JavaScript to use file uploader.</p> </noscript> </div> <script type="text/javascript"> var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader'), action: '@Url.Action("upload")' // put here a path to your page to handle uploading //,allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'] // user this if you want to upload only pictures sizeLimit: 4000000, // max size, about 4MB minSizeLimit: 0, // min size }); </script> What is wrong with this script? [1]: http://maxivak.com/asp-net-mvc-file-uploads-using-valums-plugin/
0
11,728,265
07/30/2012 19:30:02
1,473,914
06/22/2012 05:22:17
11
0
Image doesn't load in crystal report using its file path stored in sql ASP.NET C#
I am currently having a problem in loading the image which is stored in database with a datatype of text and using its file path located in the server like `Images/Students/Me.png`. I made a DataSet in my server and set the columns. The datatype of the image in the DataSet should be System.Byte[]. But when I do that, I am receiving an error.. But when I set it to System.String, no error but the image doesn't load. Here's the guide that I followed. http://csharpdotnetfreak.blogspot.com/2012/06/crystal-reports-display-images-database.html SqlConnection con = new SqlConnection(SeiboLMS.Helper.GetConnectionString()); protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["StudentID"] == null) Response.Redirect("Students.aspx"); else { if (!IsPostBack) ViewStudents(Request.QueryString["StudentID"].ToString()); } } private void ViewStudents(string StudentID) { DataSet1 imageDataSet = new DataSet1(); con.Open(); SqlCommand com = new SqlCommand(); com.Connection = con; string SQL = "SELECT Students.StudentID, Students.UserID, Students.YearID, Students.StudentNo, YearLevels.YearLevel, " + "Students.FirstName, " + "Students.LastName, " + "Students.MiddleName, " + "Students.Status, " + "Students.StudentType, " + "Students.Address, " + "Students.TelephoneNo, " + "Students.CellNo, " + "Students.Birthdate, " + "Students.Religion, " + "Students.Citizenship, " + "Students.EmailAddress, " + "Students.Image, " + "Students.Requirements, " + "Users.UserName, " + "Users.Password, " + "Users.UserTypeID " + "FROM Students, Users, YearLevels " + "WHERE Students.UserID = Users.UserID " + "AND Students.YearID = YearLevels.YearID " + "AND Students.StudentID = " + StudentID; com.CommandText = SQL; SqlDataAdapter da = new SqlDataAdapter(com); da.Fill(imageDataSet.Tables["reportTable"]); for (int rowNumber = 0; rowNumber < imageDataSet.Tables["reportTable"].Rows.Count; rowNumber++) { string imgName = Server.MapPath("../../" + imageDataSet.Tables["reportTable"].Rows[rowNumber]["Image"].ToString()); DisplayImages(imageDataSet.Tables["reportTable"].Rows[rowNumber], "Image", imgName); } ReportDocument rpt = new ReportDocument(); string reportPath = Server.MapPath("rptStudentInfo1.rpt"); rpt.Load(reportPath); rpt.SetDataSource(imageDataSet); rpt.Refresh(); crvStudentInfo.ReportSource = rpt; con.Close(); con.Dispose(); } private void DisplayImages(DataRow row, string img, string ImagePath) { FileStream stream = new FileStream(ImagePath, FileMode.Open, FileAccess.Read); byte[] ImgData = new byte[stream.Length]; stream.Read(ImgData, 0, Convert.ToInt32(stream.Length)); stream.Close(); row[img] = ImgData; }
c#
asp.net
image
crystal-reports
file-path
null
open
Image doesn't load in crystal report using its file path stored in sql ASP.NET C# === I am currently having a problem in loading the image which is stored in database with a datatype of text and using its file path located in the server like `Images/Students/Me.png`. I made a DataSet in my server and set the columns. The datatype of the image in the DataSet should be System.Byte[]. But when I do that, I am receiving an error.. But when I set it to System.String, no error but the image doesn't load. Here's the guide that I followed. http://csharpdotnetfreak.blogspot.com/2012/06/crystal-reports-display-images-database.html SqlConnection con = new SqlConnection(SeiboLMS.Helper.GetConnectionString()); protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["StudentID"] == null) Response.Redirect("Students.aspx"); else { if (!IsPostBack) ViewStudents(Request.QueryString["StudentID"].ToString()); } } private void ViewStudents(string StudentID) { DataSet1 imageDataSet = new DataSet1(); con.Open(); SqlCommand com = new SqlCommand(); com.Connection = con; string SQL = "SELECT Students.StudentID, Students.UserID, Students.YearID, Students.StudentNo, YearLevels.YearLevel, " + "Students.FirstName, " + "Students.LastName, " + "Students.MiddleName, " + "Students.Status, " + "Students.StudentType, " + "Students.Address, " + "Students.TelephoneNo, " + "Students.CellNo, " + "Students.Birthdate, " + "Students.Religion, " + "Students.Citizenship, " + "Students.EmailAddress, " + "Students.Image, " + "Students.Requirements, " + "Users.UserName, " + "Users.Password, " + "Users.UserTypeID " + "FROM Students, Users, YearLevels " + "WHERE Students.UserID = Users.UserID " + "AND Students.YearID = YearLevels.YearID " + "AND Students.StudentID = " + StudentID; com.CommandText = SQL; SqlDataAdapter da = new SqlDataAdapter(com); da.Fill(imageDataSet.Tables["reportTable"]); for (int rowNumber = 0; rowNumber < imageDataSet.Tables["reportTable"].Rows.Count; rowNumber++) { string imgName = Server.MapPath("../../" + imageDataSet.Tables["reportTable"].Rows[rowNumber]["Image"].ToString()); DisplayImages(imageDataSet.Tables["reportTable"].Rows[rowNumber], "Image", imgName); } ReportDocument rpt = new ReportDocument(); string reportPath = Server.MapPath("rptStudentInfo1.rpt"); rpt.Load(reportPath); rpt.SetDataSource(imageDataSet); rpt.Refresh(); crvStudentInfo.ReportSource = rpt; con.Close(); con.Dispose(); } private void DisplayImages(DataRow row, string img, string ImagePath) { FileStream stream = new FileStream(ImagePath, FileMode.Open, FileAccess.Read); byte[] ImgData = new byte[stream.Length]; stream.Read(ImgData, 0, Convert.ToInt32(stream.Length)); stream.Close(); row[img] = ImgData; }
0
11,728,202
07/30/2012 19:24:27
1,226,578
02/22/2012 18:22:37
1
0
How can I find out what MVC3 is doing under the hood?
OK, I'm an old dog (slowly) learning new tricks and I need to see the cogs turning in order to understand what's going on. I've generated an MVC3 app using EF4.1 from an existing database and the list in the MVC3 view (based on a SQL View) shows different results to the SQL View viewed in SQL manager. Specifically, fields from a joined table seem to not get updated between multiple hits on the main table. The funny thing is: If I capture the sql that intellisense shows for the db.myViewClass.ToList() call and paste that into SQL manager, it gives the right results! I've also created a mini test app and that works fine. So far I can't see how the test app differs from my main app which fails. I'm frustrated that I can't step in to the code to see what's happening in db.myViewClass. Any bright ideas anyone? Dave.
sql
asp.net-mvc-3
null
null
null
null
open
How can I find out what MVC3 is doing under the hood? === OK, I'm an old dog (slowly) learning new tricks and I need to see the cogs turning in order to understand what's going on. I've generated an MVC3 app using EF4.1 from an existing database and the list in the MVC3 view (based on a SQL View) shows different results to the SQL View viewed in SQL manager. Specifically, fields from a joined table seem to not get updated between multiple hits on the main table. The funny thing is: If I capture the sql that intellisense shows for the db.myViewClass.ToList() call and paste that into SQL manager, it gives the right results! I've also created a mini test app and that works fine. So far I can't see how the test app differs from my main app which fails. I'm frustrated that I can't step in to the code to see what's happening in db.myViewClass. Any bright ideas anyone? Dave.
0
11,728,203
07/30/2012 19:24:28
1,563,010
07/30/2012 12:58:26
1
0
Replacing Fragments correctly within ViewPager
by now i'am totally desperated. Whole day i'am trying to replace a fragment within a view, but don't succeed yet. i have the following classes. First my PagerAdapter: package com.example.tab1; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class SectionsPagerAdapter extends FragmentPagerAdapter { static final int NUM_ITEMS = 3; private final FragmentManager mFragmentManager; private Fragment mFragmentAtPos0; public SectionsPagerAdapter(FragmentManager fm) { super(fm); mFragmentManager = fm; } @Override public Fragment getItem(int position) { Bundle args = new Bundle(); mFragmentAtPos0= new testFragment(); args.putInt(testFragment.ARG_SECTION_NUMBER, position + 1); mFragmentAtPos0.setArguments(args); return mFragmentAtPos0; } @Override public int getItemPosition(Object object) { return 0; } @Override // liefert die Anzahl der Tabs public int getCount() { return NUM_ITEMS; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: // return getString(R.string.title_section1).toUpperCase(); // return // Resources.getSystem().getString(R.string.title_section1).toUpperCase(); return "Suche".toUpperCase(); case 1: // return getString(R.string.title_section2).toUpperCase(); // return // Resources.getSystem().getString(R.string.title_section2).toUpperCase(); return "Ergebnis".toUpperCase(); case 2: // return // Resources.getSystem().getString(R.string.title_section3).toUpperCase(); return "Optionen".toUpperCase(); } return null; } } Secondly my My DatePickerFragment: package com.example.tab1; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class DatePickerFragment extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public static DatePickerFragment newInstance() { DatePickerFragment f = new DatePickerFragment(); return f; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Log.d("DEBUG", "onCreateView"); return inflater.inflate(R.layout.datepickerfrag, container, false); } } And Finally my MainActivity, where i activate the change in the method onClickSearch, which is a method from an interface in my first Fragment, which is shown when the app is started. package com.example.tab1; import android.app.ActionBar; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.Menu; public class MainActivity extends FragmentActivity implements ActionBar.TabListener,testFragment.ButtonListenerS{ /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which * will keep every loaded fragment in memory. If this becomes too memory * intensive, it may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three // primary sections // of the app. mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. // We can also use ActionBar.Tab#select() to do this if we have a // reference to the // Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. // Also specify this Activity object, which implements the // TabListener interface, as the // listener for when this tab is selected. actionBar.addTab(actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } actionBar.selectTab(actionBar.getTabAt(0)); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } /* * Implementierung des "Suchbuttons" (non-Javadoc) * Interaktion zwischen testFragment und MainActivity */ public void OnclickSearchS() { android.support.v4.app.FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.pager,DatePickerFragment.newInstance()); ft.commit(); //mViewPager.setCurrentItem(1); } public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { // When the given tab is selected, switch to the corresponding page in // the ViewPager. mViewPager.setCurrentItem(tab.getPosition()); } public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } /** * A {@link FragmentPagerAdapter} that returns a fragment corresponding to * one of the primary sections of the app. */ } When the application is running, i push the button the first time and nothing happens, when i do this again secondly, i see an empty fragment and get an error afterwards: 07-30 21:20:17.800: W/dalvikvm(32553): threadid=1: thread exiting with uncaught exception (group=0x40c671f8) 07-30 21:20:17.805: E/AndroidRuntime(32553): FATAL EXCEPTION: main 07-30 21:20:17.805: E/AndroidRuntime(32553): java.lang.NullPointerException 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:750) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.app.FragmentPagerAdapter.setPrimaryItem(FragmentPagerAdapter.java:130) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.populate(ViewPager.java:893) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.populate(ViewPager.java:772) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.completeScroll(ViewPager.java:1539) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1663) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1631) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2063) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1399) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.app.Activity.dispatchTouchEvent(Activity.java:2364) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2011) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.View.dispatchPointerEvent(View.java:5861) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3094) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2614) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:978) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:992) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2585) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.os.Handler.dispatchMessage(Handler.java:99) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.os.Looper.loop(Looper.java:137) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.app.ActivityThread.main(ActivityThread.java:4507) 07-30 21:20:17.805: E/AndroidRuntime(32553): at java.lang.reflect.Method.invokeNative(Native Method) 07-30 21:20:17.805: E/AndroidRuntime(32553): at java.lang.reflect.Method.invoke(Method.java:511) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 07-30 21:20:17.805: E/AndroidRuntime(32553): at dalvik.system.NativeStart.main(Native Method) I have no idea, what is going on wrong. I hope somebody can help me. Thx
replace
android-fragments
android-viewpager
null
null
null
open
Replacing Fragments correctly within ViewPager === by now i'am totally desperated. Whole day i'am trying to replace a fragment within a view, but don't succeed yet. i have the following classes. First my PagerAdapter: package com.example.tab1; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class SectionsPagerAdapter extends FragmentPagerAdapter { static final int NUM_ITEMS = 3; private final FragmentManager mFragmentManager; private Fragment mFragmentAtPos0; public SectionsPagerAdapter(FragmentManager fm) { super(fm); mFragmentManager = fm; } @Override public Fragment getItem(int position) { Bundle args = new Bundle(); mFragmentAtPos0= new testFragment(); args.putInt(testFragment.ARG_SECTION_NUMBER, position + 1); mFragmentAtPos0.setArguments(args); return mFragmentAtPos0; } @Override public int getItemPosition(Object object) { return 0; } @Override // liefert die Anzahl der Tabs public int getCount() { return NUM_ITEMS; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: // return getString(R.string.title_section1).toUpperCase(); // return // Resources.getSystem().getString(R.string.title_section1).toUpperCase(); return "Suche".toUpperCase(); case 1: // return getString(R.string.title_section2).toUpperCase(); // return // Resources.getSystem().getString(R.string.title_section2).toUpperCase(); return "Ergebnis".toUpperCase(); case 2: // return // Resources.getSystem().getString(R.string.title_section3).toUpperCase(); return "Optionen".toUpperCase(); } return null; } } Secondly my My DatePickerFragment: package com.example.tab1; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class DatePickerFragment extends DialogFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public static DatePickerFragment newInstance() { DatePickerFragment f = new DatePickerFragment(); return f; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Log.d("DEBUG", "onCreateView"); return inflater.inflate(R.layout.datepickerfrag, container, false); } } And Finally my MainActivity, where i activate the change in the method onClickSearch, which is a method from an interface in my first Fragment, which is shown when the app is started. package com.example.tab1; import android.app.ActionBar; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.Menu; public class MainActivity extends FragmentActivity implements ActionBar.TabListener,testFragment.ButtonListenerS{ /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which * will keep every loaded fragment in memory. If this becomes too memory * intensive, it may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three // primary sections // of the app. mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. // We can also use ActionBar.Tab#select() to do this if we have a // reference to the // Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. // Also specify this Activity object, which implements the // TabListener interface, as the // listener for when this tab is selected. actionBar.addTab(actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } actionBar.selectTab(actionBar.getTabAt(0)); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } /* * Implementierung des "Suchbuttons" (non-Javadoc) * Interaktion zwischen testFragment und MainActivity */ public void OnclickSearchS() { android.support.v4.app.FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.pager,DatePickerFragment.newInstance()); ft.commit(); //mViewPager.setCurrentItem(1); } public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { // When the given tab is selected, switch to the corresponding page in // the ViewPager. mViewPager.setCurrentItem(tab.getPosition()); } public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } /** * A {@link FragmentPagerAdapter} that returns a fragment corresponding to * one of the primary sections of the app. */ } When the application is running, i push the button the first time and nothing happens, when i do this again secondly, i see an empty fragment and get an error afterwards: 07-30 21:20:17.800: W/dalvikvm(32553): threadid=1: thread exiting with uncaught exception (group=0x40c671f8) 07-30 21:20:17.805: E/AndroidRuntime(32553): FATAL EXCEPTION: main 07-30 21:20:17.805: E/AndroidRuntime(32553): java.lang.NullPointerException 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:750) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.app.FragmentPagerAdapter.setPrimaryItem(FragmentPagerAdapter.java:130) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.populate(ViewPager.java:893) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.populate(ViewPager.java:772) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.completeScroll(ViewPager.java:1539) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1663) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1631) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1963) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1690) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2063) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1399) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.app.Activity.dispatchTouchEvent(Activity.java:2364) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2011) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.View.dispatchPointerEvent(View.java:5861) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3094) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2614) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:978) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:992) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2585) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.os.Handler.dispatchMessage(Handler.java:99) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.os.Looper.loop(Looper.java:137) 07-30 21:20:17.805: E/AndroidRuntime(32553): at android.app.ActivityThread.main(ActivityThread.java:4507) 07-30 21:20:17.805: E/AndroidRuntime(32553): at java.lang.reflect.Method.invokeNative(Native Method) 07-30 21:20:17.805: E/AndroidRuntime(32553): at java.lang.reflect.Method.invoke(Method.java:511) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 07-30 21:20:17.805: E/AndroidRuntime(32553): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 07-30 21:20:17.805: E/AndroidRuntime(32553): at dalvik.system.NativeStart.main(Native Method) I have no idea, what is going on wrong. I hope somebody can help me. Thx
0
11,728,272
07/30/2012 19:30:44
682,763
03/29/2011 19:41:24
416
1
Extjs4, What is the lazyRender?
What is the lazyRender in Exjs? I couldn't find about that in Extjs document, also I couldn't find any web pages that describe about lazyRender. May I ask a good example please? Thanks!
extjs
extjs4
null
null
null
null
open
Extjs4, What is the lazyRender? === What is the lazyRender in Exjs? I couldn't find about that in Extjs document, also I couldn't find any web pages that describe about lazyRender. May I ask a good example please? Thanks!
0
11,728,277
07/30/2012 19:31:03
562,769
01/04/2011 15:39:58
1,327
38
A simple Java Race Condition
I just wanted to write an example for an race condition: **MyParallelClass.java**: <!-- language: lang-java --> public class MyParallelClass implements java.lang.Runnable { public int counter = 0; @Override public void run() { if (test.globalVar > 0) { for (int i = 0; i < 1000000; i++) { counter++; } test.globalVar--; } } } **test.java**: <!-- language: lang-java --> public class test { public static int globalVar; public static void main(String[] args) { globalVar = 1; MyParallelClass a = new MyParallelClass(); MyParallelClass b = new MyParallelClass(); new Thread(a).start(); // Thread A new Thread(b).start(); // Thread B System.out.println(globalVar); } } **What I thought would happen:** I thought this could output either `0` if thread A was executed completely before Thread B starts. The variable `test.globalVar` could also get manipulated like this: Thread A - Thread B checks if (globalVar > 0) looping ... checks if (globalVar > 0) looping ... execute all four bytecode commands of "test.globalVar--;" execute test.globalVar--; so the value of `test.globalVar` would be `-1`. So either one of the if-statements get executed or both. **What actually happened:** I got `0` and `1`. Why do I get `0` and `1` and not `0` and `-1`?
java
race-condition
null
null
null
null
open
A simple Java Race Condition === I just wanted to write an example for an race condition: **MyParallelClass.java**: <!-- language: lang-java --> public class MyParallelClass implements java.lang.Runnable { public int counter = 0; @Override public void run() { if (test.globalVar > 0) { for (int i = 0; i < 1000000; i++) { counter++; } test.globalVar--; } } } **test.java**: <!-- language: lang-java --> public class test { public static int globalVar; public static void main(String[] args) { globalVar = 1; MyParallelClass a = new MyParallelClass(); MyParallelClass b = new MyParallelClass(); new Thread(a).start(); // Thread A new Thread(b).start(); // Thread B System.out.println(globalVar); } } **What I thought would happen:** I thought this could output either `0` if thread A was executed completely before Thread B starts. The variable `test.globalVar` could also get manipulated like this: Thread A - Thread B checks if (globalVar > 0) looping ... checks if (globalVar > 0) looping ... execute all four bytecode commands of "test.globalVar--;" execute test.globalVar--; so the value of `test.globalVar` would be `-1`. So either one of the if-statements get executed or both. **What actually happened:** I got `0` and `1`. Why do I get `0` and `1` and not `0` and `-1`?
0
11,728,279
07/30/2012 19:31:06
1,411,247
05/22/2012 21:24:21
20
0
Highcharts legend item hover event?
I have a chart where I want some series not to be clickable in the legend, but others to be clickable. That was easy, because there was a legendItemClick event that I could make do nothing depending on the series. An example is here: http://jsfiddle.net/9PqyG/3/ My problem is that the mouse pointer still changes from the arrow to the clickable-link-hand-pointer, and I don't want anyone thinking that this is clickable. I know that I can change the itemHoverStyle parameter to make the arrow appear for all the legend items, but that will change it for every series. Can I make this happen only for a particular series?
highcharts
null
null
null
null
null
open
Highcharts legend item hover event? === I have a chart where I want some series not to be clickable in the legend, but others to be clickable. That was easy, because there was a legendItemClick event that I could make do nothing depending on the series. An example is here: http://jsfiddle.net/9PqyG/3/ My problem is that the mouse pointer still changes from the arrow to the clickable-link-hand-pointer, and I don't want anyone thinking that this is clickable. I know that I can change the itemHoverStyle parameter to make the arrow appear for all the legend items, but that will change it for every series. Can I make this happen only for a particular series?
0
11,728,256
07/30/2012 19:29:22
673,487
03/23/2011 16:39:38
145
3
urllib2.HTTPError: HTTP Error 401 while querying using the new Bing API ( in azure marketplace )
So, I ve made corrections based on most of the answers under the same roof in stack overflow, I'm still unable to resolve this problem. queryBingFor = "Google Fibre" quoted_query = urllib.quote(queryBingFor) account_key = "dslfkslkdfhsehwekhrwkj2187iwekjfkwej3" rootURL = "https://api.datamarket.azure.com/Bing/Search/v1/" searchURL = rootURL + "Image?format=json&Query=" + quoted_query cred = base64.encodestring(accountKey) reqBing = urllib2.Request(url=searchURL) author = "Basic %s" % cred reqBing.add_header('Authorization',author) readURL = urllib2.urlopen(reqBing) I know I'm missing out something in the above code, that gives me a: urllib2.HTTPError: HTTP Error 401: The authorization type you provided is not supported. Only Basic and OAuth are supported Any clue on what the problem could be? Thanks!
python
authentication
urllib2
http-status-code-401
bing-api
null
open
urllib2.HTTPError: HTTP Error 401 while querying using the new Bing API ( in azure marketplace ) === So, I ve made corrections based on most of the answers under the same roof in stack overflow, I'm still unable to resolve this problem. queryBingFor = "Google Fibre" quoted_query = urllib.quote(queryBingFor) account_key = "dslfkslkdfhsehwekhrwkj2187iwekjfkwej3" rootURL = "https://api.datamarket.azure.com/Bing/Search/v1/" searchURL = rootURL + "Image?format=json&Query=" + quoted_query cred = base64.encodestring(accountKey) reqBing = urllib2.Request(url=searchURL) author = "Basic %s" % cred reqBing.add_header('Authorization',author) readURL = urllib2.urlopen(reqBing) I know I'm missing out something in the above code, that gives me a: urllib2.HTTPError: HTTP Error 401: The authorization type you provided is not supported. Only Basic and OAuth are supported Any clue on what the problem could be? Thanks!
0
11,349,714
07/05/2012 17:46:39
1,034,229
11/07/2011 17:43:51
218
11
setShowsUserLocation to YES do not show blue dot in ios 4
I am new to iOS development but still manage to build some apps. To start with I am using tab bar as my base navigator. I am using location manager to get the users location. I set setShowsUserLocation = YES to show the current location of the user. and have added the following in -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: method if ([annotation isKindOfClass:MKUserLocation.class]) { //user location view is being requested, //return nil so it uses the default which is a blue dot... return nil; } I disable the location manager on -(void)viewWillDisappear:(BOOL)animated { [self disableLocation]; } where disableLocation is as follows if( [self showsUserLocation] ) { [self setShowsUserLocation:NO]; [locationManager stopMonitoringSignificantLocationChanges]; [locationManager stopUpdatingLocation]; [[NSNotificationCenter defaultCenter] removeObserver:self]; } I have another function which enables the location manager when clicked on a button. following is the function -(void) enableLocation { [self setShowsUserLocation:YES]; if (![CLLocationManager significantLocationChangeMonitoringAvailable]) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Your device won't support the significant location change." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; return; } if (locationManager == nil) { locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; } [locationManager startUpdatingLocation]; [locationManager startMonitoringSignificantLocationChanges]; [self setShowsUserLocation:YES]; } I go form on tab to another and and play with the user location functionality. everything seems to work fine for first few times say for first 3 times.. and later it only takes me to the correct spot but blue dot seen. Please help... I am not understanding what wrong in this code... I am stuck Raj
iphone
ios4
cllocationmanager
showuserlocation
null
null
open
setShowsUserLocation to YES do not show blue dot in ios 4 === I am new to iOS development but still manage to build some apps. To start with I am using tab bar as my base navigator. I am using location manager to get the users location. I set setShowsUserLocation = YES to show the current location of the user. and have added the following in -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: method if ([annotation isKindOfClass:MKUserLocation.class]) { //user location view is being requested, //return nil so it uses the default which is a blue dot... return nil; } I disable the location manager on -(void)viewWillDisappear:(BOOL)animated { [self disableLocation]; } where disableLocation is as follows if( [self showsUserLocation] ) { [self setShowsUserLocation:NO]; [locationManager stopMonitoringSignificantLocationChanges]; [locationManager stopUpdatingLocation]; [[NSNotificationCenter defaultCenter] removeObserver:self]; } I have another function which enables the location manager when clicked on a button. following is the function -(void) enableLocation { [self setShowsUserLocation:YES]; if (![CLLocationManager significantLocationChangeMonitoringAvailable]) {UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Your device won't support the significant location change." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; return; } if (locationManager == nil) { locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; } [locationManager startUpdatingLocation]; [locationManager startMonitoringSignificantLocationChanges]; [self setShowsUserLocation:YES]; } I go form on tab to another and and play with the user location functionality. everything seems to work fine for first few times say for first 3 times.. and later it only takes me to the correct spot but blue dot seen. Please help... I am not understanding what wrong in this code... I am stuck Raj
0
11,349,717
07/05/2012 17:46:50
1,489,811
06/28/2012 21:38:48
15
0
Can't get Django calendar app to display days in month
I'm trying to program a calendar app using Django and I can't seem to get it to show the days of the month. For monthly views in `views.py` I have: from datetime import date, datetime, timedelta import calendar @login_required def month(request, year, month, change=None): """Listing of days in `month`.""" year, month = int(year), int(month) # apply next / previous change if change in ("next", "prev"): now, mdelta = date(year, month, 15), timedelta(days=31) if change == "next": mod = mdelta elif change == "prev": mod = -mdelta year, month = (now+mod).timetuple()[:2] # init variables cal = calendar.Calendar() month_days = cal.itermonthdays(year, month) nyear, nmonth, nday = time.localtime()[:3] lst = [[]] week = 0 # make month lists containing list of days for each week # each day tuple will contain list of entries and 'current' indicator for day in month_days: entries = current = False # are there entries for this day; current day? if day: entries = Entry.objects.filter(date__year=year, date__month=month, date__day=day) if day == nday and year == nyear and month == nmonth: current = True lst[week].append((day, entries, current)) if len(lst[week]) == 7: lst.append([]) week += 1 return render_to_response("cal/month.html", dict(year=year, month=month, user=request.user, month_days=lst, mname=mnames[month-1])) For the yearly template, I have: {% extends "cal/base.html" %} {% block content %} <a href="{% url cal.views.main year|add:'-3' %}">&lt;&lt; Prev</a> <a href="{% url cal.views.main year|add:'3' %}">Next &gt;&gt;</a> {% for year, months in years %} <div class="clear"></div> <h4>{{ year }}</h4> {% for month in months %} <div class= {% if month.current %}"current"{% endif %} {% if not month.current %}"month"{% endif %} > {% if month.entry %}<b>{% endif %} <a href="{% url cal.views.month year month.n %}">{{ month.name }}</a> {% if month.entry %}</b>{% endif %} </div> {% if month.n == 6 %}<br />{% endif %} {% endfor %} {% endfor %} {% endblock %} That displays the months in a year. But when I click on the month, it doesn't display the days. For the monthly template, I have: {% extends "cal/base.html" %} {% block content %} <a href= "{% url cal.views.month year month "prev" %}">&lt;&lt; Prev</a> <a href= "{% url cal.views.month year month "next" %}">Next &gt;&gt;</a> <h4>{{ mname }} {{ year }}</h4> <div class="month"> <table> <tr> <td class="empty">Mon</td> <td class="empty">Tue</td> <td class="empty">Wed</td> <td class="empty">Thu</td> <td class="empty">Fri</td> <td class="empty">Sat</td> <td class="empty">Sun</td> </tr> {% for week in month_days %} <tr> {% for day, entries, current in week %} <!-- TD style: empty | day | current; onClick handler and highlight --> <td class= {% if day == 0 %}"empty"{% endif %} {% if day != 0 and not current %}"day"{% endif %} {% if day != 0 and current %}"current"{% endif %} {% if day != 0 %} onClick="parent.location='{% url cal.views.day year month day %}'" onMouseOver="this.bgColor='#eeeeee';" onMouseOut="this.bgColor='white';" {% endif %} > <!-- Day number and entry snippets --> {% if day != 0 %} {{ day }} {% for entry in entries %} <br /> <b>{{ entry.creator }}</b>: {{ entry.short|safe }} {% endfor %} {% endif %} </td> {% endfor %} </tr> {% endfor %} </table> <div class="clear"></div> </div> {% endblock %} I think it's a problem with the way I've linked my yearly template to my monthly template, but I'm not sure. I'm new to Django and programming in general, so if anyone can point me in the right direction, I'd greatly appreciate it.
html
django
null
null
null
null
open
Can't get Django calendar app to display days in month === I'm trying to program a calendar app using Django and I can't seem to get it to show the days of the month. For monthly views in `views.py` I have: from datetime import date, datetime, timedelta import calendar @login_required def month(request, year, month, change=None): """Listing of days in `month`.""" year, month = int(year), int(month) # apply next / previous change if change in ("next", "prev"): now, mdelta = date(year, month, 15), timedelta(days=31) if change == "next": mod = mdelta elif change == "prev": mod = -mdelta year, month = (now+mod).timetuple()[:2] # init variables cal = calendar.Calendar() month_days = cal.itermonthdays(year, month) nyear, nmonth, nday = time.localtime()[:3] lst = [[]] week = 0 # make month lists containing list of days for each week # each day tuple will contain list of entries and 'current' indicator for day in month_days: entries = current = False # are there entries for this day; current day? if day: entries = Entry.objects.filter(date__year=year, date__month=month, date__day=day) if day == nday and year == nyear and month == nmonth: current = True lst[week].append((day, entries, current)) if len(lst[week]) == 7: lst.append([]) week += 1 return render_to_response("cal/month.html", dict(year=year, month=month, user=request.user, month_days=lst, mname=mnames[month-1])) For the yearly template, I have: {% extends "cal/base.html" %} {% block content %} <a href="{% url cal.views.main year|add:'-3' %}">&lt;&lt; Prev</a> <a href="{% url cal.views.main year|add:'3' %}">Next &gt;&gt;</a> {% for year, months in years %} <div class="clear"></div> <h4>{{ year }}</h4> {% for month in months %} <div class= {% if month.current %}"current"{% endif %} {% if not month.current %}"month"{% endif %} > {% if month.entry %}<b>{% endif %} <a href="{% url cal.views.month year month.n %}">{{ month.name }}</a> {% if month.entry %}</b>{% endif %} </div> {% if month.n == 6 %}<br />{% endif %} {% endfor %} {% endfor %} {% endblock %} That displays the months in a year. But when I click on the month, it doesn't display the days. For the monthly template, I have: {% extends "cal/base.html" %} {% block content %} <a href= "{% url cal.views.month year month "prev" %}">&lt;&lt; Prev</a> <a href= "{% url cal.views.month year month "next" %}">Next &gt;&gt;</a> <h4>{{ mname }} {{ year }}</h4> <div class="month"> <table> <tr> <td class="empty">Mon</td> <td class="empty">Tue</td> <td class="empty">Wed</td> <td class="empty">Thu</td> <td class="empty">Fri</td> <td class="empty">Sat</td> <td class="empty">Sun</td> </tr> {% for week in month_days %} <tr> {% for day, entries, current in week %} <!-- TD style: empty | day | current; onClick handler and highlight --> <td class= {% if day == 0 %}"empty"{% endif %} {% if day != 0 and not current %}"day"{% endif %} {% if day != 0 and current %}"current"{% endif %} {% if day != 0 %} onClick="parent.location='{% url cal.views.day year month day %}'" onMouseOver="this.bgColor='#eeeeee';" onMouseOut="this.bgColor='white';" {% endif %} > <!-- Day number and entry snippets --> {% if day != 0 %} {{ day }} {% for entry in entries %} <br /> <b>{{ entry.creator }}</b>: {{ entry.short|safe }} {% endfor %} {% endif %} </td> {% endfor %} </tr> {% endfor %} </table> <div class="clear"></div> </div> {% endblock %} I think it's a problem with the way I've linked my yearly template to my monthly template, but I'm not sure. I'm new to Django and programming in general, so if anyone can point me in the right direction, I'd greatly appreciate it.
0
11,349,401
07/05/2012 17:25:26
1,295,369
03/27/2012 11:25:01
36
0
IE6 inline-block f**k up
Hi I have tried for 2 hours everything that I could find on the net with this to no avail. The problem is with the dreaded display: inline-block now working with IE6 and IE7.So my last hope resides here. html: <div class="contentNav clearfix"> <ul class="clearfix"> <li><a class="show1 navButton" class="left" id="activeLink">Overview</a></li> <li><a class="show2 navButton" class="right">Services</a></li> </ul> </div> css: .clearfix {clear: both;} .contentNav { color: #ddd !important; font-size: 1.5em; padding: 0; margin: 0; display: block; text-align: center; } .contentNav a { color: #fff !important; } .navButton { font-size: 18px !important;; padding: 5px 15px; background: rgb(122,188,255); /* Old browsers */ } .contentNav li { display: inline-block; } /*IE specific css*/ .navButton { zoom: 1; *display: inline; } .navButton a { zoom: 1; *display:inline; } .height { height: 45px; clear: both; }
css
internet-explorer-6
null
null
null
null
open
IE6 inline-block f**k up === Hi I have tried for 2 hours everything that I could find on the net with this to no avail. The problem is with the dreaded display: inline-block now working with IE6 and IE7.So my last hope resides here. html: <div class="contentNav clearfix"> <ul class="clearfix"> <li><a class="show1 navButton" class="left" id="activeLink">Overview</a></li> <li><a class="show2 navButton" class="right">Services</a></li> </ul> </div> css: .clearfix {clear: both;} .contentNav { color: #ddd !important; font-size: 1.5em; padding: 0; margin: 0; display: block; text-align: center; } .contentNav a { color: #fff !important; } .navButton { font-size: 18px !important;; padding: 5px 15px; background: rgb(122,188,255); /* Old browsers */ } .contentNav li { display: inline-block; } /*IE specific css*/ .navButton { zoom: 1; *display: inline; } .navButton a { zoom: 1; *display:inline; } .height { height: 45px; clear: both; }
0
11,349,403
07/05/2012 17:25:32
1,504,732
07/05/2012 17:11:11
1
0
HTML 4 Website - User submits email address to access/download a file
We have an archaic website done completely in HTML 4, and I've been tasked with coming up with a way to have the user input their email address to access/download files. After submitting their email address, it can either take them directly to the pdf file or be redirected to a "Thank You" page that has a link to the file. We would then be able to see a list of the email addresses & who downloaded what. I was told server side scripting language is required. To be honest, I have basic skills in coding, and I am completely stumped by this task. Any help (explained in simple terms please) would be greatly appreciated. Thank you! Jen
php
email
scripting
html4
null
null
open
HTML 4 Website - User submits email address to access/download a file === We have an archaic website done completely in HTML 4, and I've been tasked with coming up with a way to have the user input their email address to access/download files. After submitting their email address, it can either take them directly to the pdf file or be redirected to a "Thank You" page that has a link to the file. We would then be able to see a list of the email addresses & who downloaded what. I was told server side scripting language is required. To be honest, I have basic skills in coding, and I am completely stumped by this task. Any help (explained in simple terms please) would be greatly appreciated. Thank you! Jen
0
11,349,728
07/05/2012 17:47:44
1,111,581
12/22/2011 11:03:05
3
0
joomla 2.5 how to show frontend to registered users exclusively
My goal is to show the frontend of a joomla site to registered and logged-in users only.Currently, when I set the whole content to access level 'registered', users still are able to view the basic layout. Besides, it's a lot of work to modify the access level of the whole content, even using Joomla's 'batch-processing' feature. Not-logged-in users should be presented a 'neutral' login form whenever they try to access any part of the site. Thanks
joomla
access-control
null
null
null
null
open
joomla 2.5 how to show frontend to registered users exclusively === My goal is to show the frontend of a joomla site to registered and logged-in users only.Currently, when I set the whole content to access level 'registered', users still are able to view the basic layout. Besides, it's a lot of work to modify the access level of the whole content, even using Joomla's 'batch-processing' feature. Not-logged-in users should be presented a 'neutral' login form whenever they try to access any part of the site. Thanks
0
11,349,730
07/05/2012 17:47:51
1,472,591
06/21/2012 15:23:43
1
0
How to require multiple permissions on a single broadcast?
I'm working on an android Service that allows other applications to collect data received from a company's proprietary devices. The connection can be made over Bluetooth or USB. I allow other applications to access this data through broadcasted intents sent out by the service. I would like to force applications to have the bluetooth permission as well as another permission for accessing our data before they can receive the intent. I know I can force BroadcastReceivers to have one permission to receive my Broadcasted intent using [sendBroadcast(Intent intent, String receiverPermission)][1] but how do I require the receiver to have more than one permission to see my Broadcast? Thanks in advance. [1]: http://developer.android.com/reference/android/content/Context.html#sendBroadcast%28android.content.Intent,%20java.lang.String%29 "sendBroadcast&#40;Intent intent, String permission&#41;"
android
null
null
null
null
null
open
How to require multiple permissions on a single broadcast? === I'm working on an android Service that allows other applications to collect data received from a company's proprietary devices. The connection can be made over Bluetooth or USB. I allow other applications to access this data through broadcasted intents sent out by the service. I would like to force applications to have the bluetooth permission as well as another permission for accessing our data before they can receive the intent. I know I can force BroadcastReceivers to have one permission to receive my Broadcasted intent using [sendBroadcast(Intent intent, String receiverPermission)][1] but how do I require the receiver to have more than one permission to see my Broadcast? Thanks in advance. [1]: http://developer.android.com/reference/android/content/Context.html#sendBroadcast%28android.content.Intent,%20java.lang.String%29 "sendBroadcast&#40;Intent intent, String permission&#41;"
0
11,349,731
07/05/2012 17:47:59
601,005
02/03/2011 04:54:51
11
0
How to enable radiobutton1 and textbox4 if values are present in textbox1, textbox2, textbox3
I have a formview in asp page which contains 4 textboxes and a radio button. On clicking the edit button it should display radiobutton1 and textbox4 if values are present in textbox1, textbox2, textbox3(i.e if any one of the textboxes(1,2,3) is empty it should not display textbox1 and radiobutton)
c#
javascript
asp.net
asp.net-mvc
asp.net-mvc-2
null
open
How to enable radiobutton1 and textbox4 if values are present in textbox1, textbox2, textbox3 === I have a formview in asp page which contains 4 textboxes and a radio button. On clicking the edit button it should display radiobutton1 and textbox4 if values are present in textbox1, textbox2, textbox3(i.e if any one of the textboxes(1,2,3) is empty it should not display textbox1 and radiobutton)
0
11,400,996
07/09/2012 18:34:10
644,686
03/04/2011 12:20:53
60
1
how to change the general JAVA COFFEE CUP icon in JAR file
I can change the JAVA COFFEE CUP icon in my Frame (up,left), but how could I change the RUNNABLE JAR file's general JAVA COFFEE CUP picture? Is it possible at all, to change only one JAR file's file icon? Thx
java
jar
icons
null
null
null
open
how to change the general JAVA COFFEE CUP icon in JAR file === I can change the JAVA COFFEE CUP icon in my Frame (up,left), but how could I change the RUNNABLE JAR file's general JAVA COFFEE CUP picture? Is it possible at all, to change only one JAR file's file icon? Thx
0
11,401,294
07/09/2012 18:55:46
277,480
02/20/2010 02:21:24
825
19
Using HtmlAgilityPack to find movie link
Hey all i am using this code here: Dim doc As New HtmlDocument() Dim theVidURL As String = doc.DocumentNode.SelectSingleNode("//OBJECT/PARAM[@NAME='Movie']").Attributes("VALUE").Value in order to find the URL of the movie in this HTML source: <DIV id=player-wrapper> <DIV id=lcm_video> <OBJECT id=player codeBase="http://0000.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=480 align=middle height=320 VIEWASTEXT><PARAM NAME="_cx" VALUE="12700"><PARAM NAME="_cy" VALUE="8466"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&amp;hidecontrols=1&amp;&amp;noresize=1&amp;file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&amp;rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&amp;rtmpfile=fvc/3157/070712b&amp;sec=447"><PARAM NAME="Src" VALUE="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&amp;hidecontrols=1&amp;&amp;noresize=1&amp;file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&amp;rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&amp;rtmpfile=fvc/3157/070712b&amp;sec=447"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="sameDomain"><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE="000000"><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="true"><PARAM NAME="AllowFullScreenInteractive" VALUE="false"> <embed src="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&rtmpfile=fvc/3157/070712b&sec=447" quality="best" FlashVars="" bgcolor="#000000" width="480" height="320" name="player" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </OBJECT></DIV> But for some reason i get a **Nothing** returned back from **theVidURL**? Any help would be great!
vb.net
html-agility-pack
null
null
null
null
open
Using HtmlAgilityPack to find movie link === Hey all i am using this code here: Dim doc As New HtmlDocument() Dim theVidURL As String = doc.DocumentNode.SelectSingleNode("//OBJECT/PARAM[@NAME='Movie']").Attributes("VALUE").Value in order to find the URL of the movie in this HTML source: <DIV id=player-wrapper> <DIV id=lcm_video> <OBJECT id=player codeBase="http://0000.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=480 align=middle height=320 VIEWASTEXT><PARAM NAME="_cx" VALUE="12700"><PARAM NAME="_cy" VALUE="8466"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&amp;hidecontrols=1&amp;&amp;noresize=1&amp;file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&amp;rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&amp;rtmpfile=fvc/3157/070712b&amp;sec=447"><PARAM NAME="Src" VALUE="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&amp;hidecontrols=1&amp;&amp;noresize=1&amp;file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&amp;rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&amp;rtmpfile=fvc/3157/070712b&amp;sec=447"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="sameDomain"><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE="000000"><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="true"><PARAM NAME="AllowFullScreenInteractive" VALUE="false"> <embed src="http://0000.lightcastmedia.com/lcplayer_flash112fix.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2F%2Fedge2%2F3157%2F070712b&rtmppath=rtmp%3A//chi02.live.lightcastmedia.com%3A1935/mc/_definst_&rtmpfile=fvc/3157/070712b&sec=447" quality="best" FlashVars="" bgcolor="#000000" width="480" height="320" name="player" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </OBJECT></DIV> But for some reason i get a **Nothing** returned back from **theVidURL**? Any help would be great!
0
11,401,299
07/09/2012 18:56:02
1,504,163
07/05/2012 13:35:06
3
0
GMaps API v3 - jQuery - Problems with array
I am building an google map on my web page. This map has some markers. These markers are created with information of a json file. This all works fine. But when I want to use a list of all markers, this list.length is always 0 in an other function. Only in the function where i put the markers into the list, the list isn't empty. I made a fidler of my code, so it's more viewable for you guys. The problem is with the array "positions" and the function buttons. The alert in the buttons function, shows 0. And I have no idea why.. Thanks in advance! Here my [Fiddle][1] [1]: http://jsfiddle.net/cJxcV/
jquery
json
google-maps-api-3
null
null
null
open
GMaps API v3 - jQuery - Problems with array === I am building an google map on my web page. This map has some markers. These markers are created with information of a json file. This all works fine. But when I want to use a list of all markers, this list.length is always 0 in an other function. Only in the function where i put the markers into the list, the list isn't empty. I made a fidler of my code, so it's more viewable for you guys. The problem is with the array "positions" and the function buttons. The alert in the buttons function, shows 0. And I have no idea why.. Thanks in advance! Here my [Fiddle][1] [1]: http://jsfiddle.net/cJxcV/
0
11,401,276
07/09/2012 18:54:15
722,224
04/23/2011 23:45:39
6
0
If else statement comparing to 0 or NA
I have an element in a data frame tmp that may contain either a number, 0, or NA. If that element is neither 0 or NA, I would like something to happen. Otherwise, nothing happens. I imagine it'd look like this: if ( tmp[2, 19] != (0 || NA) ){ do something } I get this error: Error in if (tmp[2, 19] == (0 || NA)) { : missing value where TRUE/FALSE needed. I don't know if it's not possible in R to compare something to both an int and a string or if I'm just using the OR operator wrong. I've tried different variations in different cases but haven't been able to determine the problem. Please help!
if-statement
null
null
null
null
null
open
If else statement comparing to 0 or NA === I have an element in a data frame tmp that may contain either a number, 0, or NA. If that element is neither 0 or NA, I would like something to happen. Otherwise, nothing happens. I imagine it'd look like this: if ( tmp[2, 19] != (0 || NA) ){ do something } I get this error: Error in if (tmp[2, 19] == (0 || NA)) { : missing value where TRUE/FALSE needed. I don't know if it's not possible in R to compare something to both an int and a string or if I'm just using the OR operator wrong. I've tried different variations in different cases but haven't been able to determine the problem. Please help!
0
11,401,278
07/09/2012 18:54:17
1,203,177
02/11/2012 00:00:28
217
6
Debugging asynchronous iOS code in a run loop?
I have a program that does a lot of asynchronous web interaction using an NSRunLoop. I've got a " message sent to deallocated instance" error right now, but because the program is asynchronous, I don't know anything about where the error happened because I don't get a stack trace. Are there any tips or tools that would be helpful in fixing this problem? I could throw in lots of debugging statements, but that doesn't seem like the right answer.
objective-c
ios
debugging
asynchronous
null
null
open
Debugging asynchronous iOS code in a run loop? === I have a program that does a lot of asynchronous web interaction using an NSRunLoop. I've got a " message sent to deallocated instance" error right now, but because the program is asynchronous, I don't know anything about where the error happened because I don't get a stack trace. Are there any tips or tools that would be helpful in fixing this problem? I could throw in lots of debugging statements, but that doesn't seem like the right answer.
0
11,401,302
07/09/2012 18:56:21
1,512,862
07/09/2012 18:46:41
1
0
Replicate SQL Server 2012 publisher to 2008 subscriber?
Microsoft isn't letting you own a Web Edition of SQL 2012 like they did with 2008. But 2012 Standard edition is way overkill for my needs. Can I have a database server running 2012 Enterprise (or Standard) and use transactional replication to populate data on a 2008 Web Edition box? This would, of course, be 1-way replication only. Thanks... trying to save a bunch of money on licensing here.
database
sql-server-2008
replication
sql-server-2012
null
null
open
Replicate SQL Server 2012 publisher to 2008 subscriber? === Microsoft isn't letting you own a Web Edition of SQL 2012 like they did with 2008. But 2012 Standard edition is way overkill for my needs. Can I have a database server running 2012 Enterprise (or Standard) and use transactional replication to populate data on a 2008 Web Edition box? This would, of course, be 1-way replication only. Thanks... trying to save a bunch of money on licensing here.
0
11,499,762
07/16/2012 07:22:15
982,295
10/06/2011 13:51:44
91
0
Use text link as button in jquery/ajax
I've downloaded an ajax/jquery conatct form with a normal button. But I want to replace the button with a text link. I have been trying a bunch of suggestions from the web, but none of them seem to work. Any help would be much appreciated. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $('#contact_form').submit(function(e){ e.preventDefault(); var form = $(this); var post_url = form.attr('action'); var post_data = form.serialize(); $('#loader', form).html('<img src="loader.gif" /> Please Wait...'); $.ajax({ type: 'POST', url: post_url, data: post_data, success: function(msg) { $(form).fadeOut(500, function(){ form.html(msg).fadeIn(); }); } }); }); }); </script> </head> <body> <form action="process.php" method="post" id="contact_form"> <div> <label for="name">Your Name:</label> <input type="text" name="name" id="name" value="" tabindex="1" /> </div> <div> <label for="email">Your Email:</label> <input type="text" name="email" id="email" value="" tabindex="2" /> </div> <div> <label for="message">Message:</label> <textarea cols="40" rows="8" name="message" id="message"></textarea> </div> <div id="loader"> <input type="submit" value="Submit" /> </div> </form> </body> </html>
jquery
ajax
null
null
null
null
open
Use text link as button in jquery/ajax === I've downloaded an ajax/jquery conatct form with a normal button. But I want to replace the button with a text link. I have been trying a bunch of suggestions from the web, but none of them seem to work. Any help would be much appreciated. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $('#contact_form').submit(function(e){ e.preventDefault(); var form = $(this); var post_url = form.attr('action'); var post_data = form.serialize(); $('#loader', form).html('<img src="loader.gif" /> Please Wait...'); $.ajax({ type: 'POST', url: post_url, data: post_data, success: function(msg) { $(form).fadeOut(500, function(){ form.html(msg).fadeIn(); }); } }); }); }); </script> </head> <body> <form action="process.php" method="post" id="contact_form"> <div> <label for="name">Your Name:</label> <input type="text" name="name" id="name" value="" tabindex="1" /> </div> <div> <label for="email">Your Email:</label> <input type="text" name="email" id="email" value="" tabindex="2" /> </div> <div> <label for="message">Message:</label> <textarea cols="40" rows="8" name="message" id="message"></textarea> </div> <div id="loader"> <input type="submit" value="Submit" /> </div> </form> </body> </html>
0
11,499,763
07/16/2012 07:22:16
257,288
01/23/2010 05:13:00
178
17
Debugging multiple hadoop jvms with Eclipse
I have a problem that appears in pseudo-distributed mode, but not in standalone mode, and I'm hoping to scratch up some ideas on how to debug this. Some of my mapper tasks are returning code 143. I'd love to drop a breakpoint on System.exit() and see who's calling this why, but I have to get the debugger running on that mapper. I can get the task tracker up in the debugger by modifying my bin/hadoop script and remotely connecting to localhost:5000: ... elif [ "$COMMAND" = "tasktracker" ] ; then CLASS=org.apache.hadoop.mapred.TaskTracker HADOOP_OPTS="$HADOOP_OPTS $HADOOP_TASKTRACKER_OPTS" # TBMark! HADOOP_OPTS="$HADOOP_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n" ...and I can get the first mapper (or by a minor tweak, reducer) into Eclipse by adding this into my conf/mapred-site.xml and remotely connecting to localhost:5001: <property> <name>mapred.map.child.java.opts</name> <value>-Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y</value> </property> My problem is that the failure happens at random and not on the first mapper. Unsatisfactory ideas that come to mind include: 1. Somehow replace System.exit() with my own method that does a stack trace. (How does one hook a system call?) 2. Just keep trying to debug the mappers one by one and run each one to completion before debugging the next. (It *might* work...) 3. Track down every last place in hadoop that calls System.exit() and write a distinct signature to a log. (*Yuck*) 4. Make the debugger port number variable such that, if I can guess which one is going to fail and the delay doesn't make the bug go away, I can attach to that jvm and debug it. (Many if's, and I don't know any way to make this variable in the .xml file.) Any suggestions or ideas for how to make my bad ideas above work?
java
eclipse
hadoop
multiprocessing
null
null
open
Debugging multiple hadoop jvms with Eclipse === I have a problem that appears in pseudo-distributed mode, but not in standalone mode, and I'm hoping to scratch up some ideas on how to debug this. Some of my mapper tasks are returning code 143. I'd love to drop a breakpoint on System.exit() and see who's calling this why, but I have to get the debugger running on that mapper. I can get the task tracker up in the debugger by modifying my bin/hadoop script and remotely connecting to localhost:5000: ... elif [ "$COMMAND" = "tasktracker" ] ; then CLASS=org.apache.hadoop.mapred.TaskTracker HADOOP_OPTS="$HADOOP_OPTS $HADOOP_TASKTRACKER_OPTS" # TBMark! HADOOP_OPTS="$HADOOP_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n" ...and I can get the first mapper (or by a minor tweak, reducer) into Eclipse by adding this into my conf/mapred-site.xml and remotely connecting to localhost:5001: <property> <name>mapred.map.child.java.opts</name> <value>-Xdebug -Xrunjdwp:transport=dt_socket,address=5001,server=y,suspend=y</value> </property> My problem is that the failure happens at random and not on the first mapper. Unsatisfactory ideas that come to mind include: 1. Somehow replace System.exit() with my own method that does a stack trace. (How does one hook a system call?) 2. Just keep trying to debug the mappers one by one and run each one to completion before debugging the next. (It *might* work...) 3. Track down every last place in hadoop that calls System.exit() and write a distinct signature to a log. (*Yuck*) 4. Make the debugger port number variable such that, if I can guess which one is going to fail and the delay doesn't make the bug go away, I can attach to that jvm and debug it. (Many if's, and I don't know any way to make this variable in the .xml file.) Any suggestions or ideas for how to make my bad ideas above work?
0
11,499,771
07/16/2012 07:22:58
739,268
05/05/2011 05:53:12
108
9
Buckminster is throwing org.eclipse.core.runtime.CoreException for imported project
I have followed tutorial http://www.ralfebert.de/blog/eclipsercp/rcp_builds/#manual_install for build with Buckminster.Everything is working fine with this tutorial,But as soon as i import any project it shows me "org.eclipse.core.runtime.CoreException" when i invoke action "create.product" .Same exception is coming when i import any fragmented project.How can i solve it? Please help.
build
eclipse-plugin
buckminster
null
null
null
open
Buckminster is throwing org.eclipse.core.runtime.CoreException for imported project === I have followed tutorial http://www.ralfebert.de/blog/eclipsercp/rcp_builds/#manual_install for build with Buckminster.Everything is working fine with this tutorial,But as soon as i import any project it shows me "org.eclipse.core.runtime.CoreException" when i invoke action "create.product" .Same exception is coming when i import any fragmented project.How can i solve it? Please help.
0
11,499,774
07/16/2012 07:23:04
1,377,814
05/06/2012 08:36:37
34
2
Extjs or Deveexpress?
I want to develop mvc net application for finance and bank solution . i used Kendo UI in several application but Kendo UI have not stable. I want to know extjs is good solution or Devexpress for use in finance and bank solutions.
c#
extjs
curl
sencha
null
07/16/2012 14:20:13
not constructive
Extjs or Deveexpress? === I want to develop mvc net application for finance and bank solution . i used Kendo UI in several application but Kendo UI have not stable. I want to know extjs is good solution or Devexpress for use in finance and bank solutions.
4
11,499,775
07/16/2012 07:23:06
754,730
05/15/2011 18:34:00
74
5
Android Dynamic Layout and Code from Web
I am working on a project which will have lots and lots of Layout and Code changes. My Question is pretty simple but I don't know anything about it. Would it be possible to dynamically load content such as Source Code (Java) and XML Layout Files on a Backgroundthread and then startup another Activity with the downloaded Content (Of either/and Java File + XML Layout)? So that you change your Code and Layout online and download it on every start of the App? Thanks alot in advance.
android
android-layout
dynamic
null
null
null
open
Android Dynamic Layout and Code from Web === I am working on a project which will have lots and lots of Layout and Code changes. My Question is pretty simple but I don't know anything about it. Would it be possible to dynamically load content such as Source Code (Java) and XML Layout Files on a Backgroundthread and then startup another Activity with the downloaded Content (Of either/and Java File + XML Layout)? So that you change your Code and Layout online and download it on every start of the App? Thanks alot in advance.
0
11,499,781
07/16/2012 07:23:32
874,440
08/02/2011 10:51:29
328
6
Android. ldpi device won't choose images from mdpi folder
I've only placed mdpi and hdpi images inside each folder, but when I run my app on an ldpi device, it won't pick the images from the mdpi folder, but from the hdpi folder. Why is that? Any ideas on what i'm doing wrong? P.S. If I place images specifically for the ldpi device inside the ldpi folder, it uses those, but if i delete them, it uses the hdpi ones. Help.
android
null
null
null
null
null
open
Android. ldpi device won't choose images from mdpi folder === I've only placed mdpi and hdpi images inside each folder, but when I run my app on an ldpi device, it won't pick the images from the mdpi folder, but from the hdpi folder. Why is that? Any ideas on what i'm doing wrong? P.S. If I place images specifically for the ldpi device inside the ldpi folder, it uses those, but if i delete them, it uses the hdpi ones. Help.
0
11,541,678
07/18/2012 12:43:13
1,157,264
01/18/2012 21:59:21
6
0
PHP compare triggered from JQuery AJAX not returning value
I am using JQuery to invoke a PHP script to update a MYSQL db, but first do a logical test based on the value. This issue I am finding it if I build my query this way, i get the error "Query was empty." Logically I tried to resolve the test to no avail. Any help would be very appreciated. $type= trim($_POST['type']); if( $type == "wanted" ) { $qUpdate = "UPDATE Post... }
php
null
null
null
null
null
open
PHP compare triggered from JQuery AJAX not returning value === I am using JQuery to invoke a PHP script to update a MYSQL db, but first do a logical test based on the value. This issue I am finding it if I build my query this way, i get the error "Query was empty." Logically I tried to resolve the test to no avail. Any help would be very appreciated. $type= trim($_POST['type']); if( $type == "wanted" ) { $qUpdate = "UPDATE Post... }
0
11,541,681
07/18/2012 12:43:28
1,094,338
12/12/2011 18:34:54
87
0
c# how to code for a numeric field
// public Decimal IS_GENERIC { get; private set; This column is defined as numeric Icode as decimal public StockDetail(Facility facility, DateTime createdOn, String Dispense_For, Decimal Is_Generic, String ln) // reader.To("IS_GENERIC", ""), but when compiling there is an error message: Error 1 The best overloaded method match for 'Dashboard.Common.Modules.StockList.DataModels.StockDetail.StockDetail(Dashboard.Common.DataModels.Facility, System.DateTime, string, decimal, string)' has some invalid arguments C:\L\Dashboard\Common\Modules\StockList\DataAccess\StockListRepository.cs 71 39 Dashboard.Common
c#
null
null
null
null
07/18/2012 12:45:59
not a real question
c# how to code for a numeric field === // public Decimal IS_GENERIC { get; private set; This column is defined as numeric Icode as decimal public StockDetail(Facility facility, DateTime createdOn, String Dispense_For, Decimal Is_Generic, String ln) // reader.To("IS_GENERIC", ""), but when compiling there is an error message: Error 1 The best overloaded method match for 'Dashboard.Common.Modules.StockList.DataModels.StockDetail.StockDetail(Dashboard.Common.DataModels.Facility, System.DateTime, string, decimal, string)' has some invalid arguments C:\L\Dashboard\Common\Modules\StockList\DataAccess\StockListRepository.cs 71 39 Dashboard.Common
1
11,541,682
07/18/2012 12:43:27
1,465,597
06/19/2012 06:51:57
6
0
How can i adress only one of the articels in Javascript (AJAX)?
At my website i have clickable hidden meta tags like page views or Google requests under every article. This is the code i use: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".slidingDiv").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ $(".slidingDiv").slideToggle(); }); }); </script> And this code for PHP: <p class="postmetadata"><a href="javascript:;" class="show_hide">[Show/hide meta data]</a></p> <div class="slidingDiv"> <p class="postmetadata">Aufrufe: <?php if(function_exists('the_views')) { the_views(); } ?> </p> <p class="postmetadata"><?php if(function_exists('stt_terms_list')) echo stt_terms_list() ;?></p> <p class="postmetadata"><?php if (function_exists('backlinks')) backlinks(); ?></p> <br> </div> I use Wordpress. The problem is, if i click on "Show/hide meta data" every article shows the meta data. I only want the meta data of the article i clicked. This is my website: http://www.abitur-lernhilfen.de/ You have to click on the german "[Zeige/Verstecke Meta-Daten]", which is equal to "[Show/hide meta data]". Any help is appreciated.
php
javascript
ajax
null
null
null
open
How can i adress only one of the articels in Javascript (AJAX)? === At my website i have clickable hidden meta tags like page views or Google requests under every article. This is the code i use: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $(".slidingDiv").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ $(".slidingDiv").slideToggle(); }); }); </script> And this code for PHP: <p class="postmetadata"><a href="javascript:;" class="show_hide">[Show/hide meta data]</a></p> <div class="slidingDiv"> <p class="postmetadata">Aufrufe: <?php if(function_exists('the_views')) { the_views(); } ?> </p> <p class="postmetadata"><?php if(function_exists('stt_terms_list')) echo stt_terms_list() ;?></p> <p class="postmetadata"><?php if (function_exists('backlinks')) backlinks(); ?></p> <br> </div> I use Wordpress. The problem is, if i click on "Show/hide meta data" every article shows the meta data. I only want the meta data of the article i clicked. This is my website: http://www.abitur-lernhilfen.de/ You have to click on the german "[Zeige/Verstecke Meta-Daten]", which is equal to "[Show/hide meta data]". Any help is appreciated.
0
11,541,448
07/18/2012 12:32:47
819,111
06/28/2011 12:06:27
1
0
Property won't refresh although I raised propertychanged
at the moment I have a problem I'm not sure how to solve this or how to find an idea how to fix. I have a viewmodel that contains a child object. If I raise a command I reinitialize the ChildObject with new and add new data. After that my view updates and the new data is displayed. Sometimes (its not reproducable when) only one property is not updated anymore. There is no difference if I do this in the parent for the whole object or I do this with String.Empty. One property is not updated and will stay as its old value (the get method won't called). Once I was able to got this behaviour I'm not able to update it by raising this command again. Can somebody help me and know where such behaviours can occure? thanks,
c#
wpf
inotifypropertychanged
null
null
null
open
Property won't refresh although I raised propertychanged === at the moment I have a problem I'm not sure how to solve this or how to find an idea how to fix. I have a viewmodel that contains a child object. If I raise a command I reinitialize the ChildObject with new and add new data. After that my view updates and the new data is displayed. Sometimes (its not reproducable when) only one property is not updated anymore. There is no difference if I do this in the parent for the whole object or I do this with String.Empty. One property is not updated and will stay as its old value (the get method won't called). Once I was able to got this behaviour I'm not able to update it by raising this command again. Can somebody help me and know where such behaviours can occure? thanks,
0
11,541,683
07/18/2012 12:43:38
1,230,731
02/24/2012 12:13:33
11
2
Groovy XMLParser
I have some elements that have the same tag name, but equal different values. The example below displays my parsing. <Report> <ReportHost name= 2.3.3.3><HostProperties> <tag name="x"> Monday...</tag> <tag name="z"> Linux.....</tag> My issue is how do I capture the text after the string "x".. and "z" Currently I have langs.Report.ReportHost.each{ReportHost-> ${ReportHost.HostProperties.tag['@name']}" But this is only grabbing x and z. What syntax do I need to grab the text after that which including Monday and Linux.
groovy
xml-parsing
null
null
null
null
open
Groovy XMLParser === I have some elements that have the same tag name, but equal different values. The example below displays my parsing. <Report> <ReportHost name= 2.3.3.3><HostProperties> <tag name="x"> Monday...</tag> <tag name="z"> Linux.....</tag> My issue is how do I capture the text after the string "x".. and "z" Currently I have langs.Report.ReportHost.each{ReportHost-> ${ReportHost.HostProperties.tag['@name']}" But this is only grabbing x and z. What syntax do I need to grab the text after that which including Monday and Linux.
0
11,541,684
07/18/2012 12:43:42
978,769
10/04/2011 15:25:07
324
48
how to upload file using DWR
i'm trying to upload a file using DWR , but i can't get a hang of the technique to use , since i see no logic in passing the file path to the server , the server isn't supposed to access a local client file , moreover the file is crypted "fakePath". any idea how i can proceed ?
java
ajax
file-upload
dwr
null
null
open
how to upload file using DWR === i'm trying to upload a file using DWR , but i can't get a hang of the technique to use , since i see no logic in passing the file path to the server , the server isn't supposed to access a local client file , moreover the file is crypted "fakePath". any idea how i can proceed ?
0
11,541,647
07/18/2012 12:41:32
1,077,657
12/02/2011 15:14:09
50
0
Drawing pdf slows application
I am trying to draw a pdf image onto the background of my application using: [NSImage drawInRect: fromRect: operation: fraction:]; It does work but it substantially slows down the application as i am calling; [self setNeedsDisplay]; Quite frequently. Would using core graphics improve the performance of the app? If so how should i go about drawing the image to get the best results? Thanks in advance, Ben
pdf
core-graphics
draw
null
null
null
open
Drawing pdf slows application === I am trying to draw a pdf image onto the background of my application using: [NSImage drawInRect: fromRect: operation: fraction:]; It does work but it substantially slows down the application as i am calling; [self setNeedsDisplay]; Quite frequently. Would using core graphics improve the performance of the app? If so how should i go about drawing the image to get the best results? Thanks in advance, Ben
0
11,713,662
07/29/2012 22:50:55
1,309,245
04/02/2012 23:39:29
1
1
Resize iframe fancybox with easing
I have a link that displays a fancybox as an iframe. The fancybox contains a form so the user can sign up to the page. There are mandatory fields and optional fields to complete on the registration. I want the optional fields to be hidden and show them when the user clicks on a + button. When the user does that, the fancybox will ease down and the optional fields will appear. How can i achieve this?
jquery
asp.net
iframe
fancybox
easing
null
open
Resize iframe fancybox with easing === I have a link that displays a fancybox as an iframe. The fancybox contains a form so the user can sign up to the page. There are mandatory fields and optional fields to complete on the registration. I want the optional fields to be hidden and show them when the user clicks on a + button. When the user does that, the fancybox will ease down and the optional fields will appear. How can i achieve this?
0
11,713,650
07/29/2012 22:48:27
838,060
07/11/2011 00:11:01
166
8
Is starting up a WebGL project a bad idea?
I am trying to develop a game, and I was just wondering if it would be a bad idea to start the project in WebGL. I love the technology and I think it has potential to be great, but I'm afraid of its experimental nature. Since it's not really a "standard" yet, is it likely that it will change to the point of completely rendering the code I write useless? I want to write a 3D game one way or another, but I prefer WebGL because I am used to Javascript, and working with OpenGL or D3D directly from the OS libraries is a pain.
javascript
html5
opengl
html5-canvas
webgl
07/29/2012 22:53:03
not constructive
Is starting up a WebGL project a bad idea? === I am trying to develop a game, and I was just wondering if it would be a bad idea to start the project in WebGL. I love the technology and I think it has potential to be great, but I'm afraid of its experimental nature. Since it's not really a "standard" yet, is it likely that it will change to the point of completely rendering the code I write useless? I want to write a 3D game one way or another, but I prefer WebGL because I am used to Javascript, and working with OpenGL or D3D directly from the OS libraries is a pain.
4
11,713,651
07/29/2012 22:48:29
1,561,622
07/29/2012 22:39:55
1
0
Fl cs5 (song repeats even with perfect scripting)
The same song repeats when i move the actionscript frame in Fl cs5. How do i solve this problem? How do I make my player skip. My scripting is pefect. I get no errors or warnings. Everything works fine except when I move the actionscipt frame containg my code for the player. And even then, no errors or warnings. Please help
css3
actionscript
null
null
null
null
open
Fl cs5 (song repeats even with perfect scripting) === The same song repeats when i move the actionscript frame in Fl cs5. How do i solve this problem? How do I make my player skip. My scripting is pefect. I get no errors or warnings. Everything works fine except when I move the actionscipt frame containg my code for the player. And even then, no errors or warnings. Please help
0
11,713,652
07/29/2012 22:48:31
1,424,399
05/29/2012 18:15:31
16
5
Jquery page transitions and SEO
for a few of the brochure sites I'm currently working on I've found it quite pleasing to have a very short fade in and out as the page loads. I do this by using display none on the body and then triggering the fade on document ready with jQuery. My Question is this, will this negatively affect the page from an SEO perspective ? Please note the following : - I will serve non javascript users a notice and essentially a single column 'print' stylesheet, with all of the sites functionality hidden, so thats not a concern. - I'm fully aware that some may deem creating this delay "bad practice" and I'm not interested in having that discussion, please answer the question directly, thanks.
jquery
css
null
null
null
null
open
Jquery page transitions and SEO === for a few of the brochure sites I'm currently working on I've found it quite pleasing to have a very short fade in and out as the page loads. I do this by using display none on the body and then triggering the fade on document ready with jQuery. My Question is this, will this negatively affect the page from an SEO perspective ? Please note the following : - I will serve non javascript users a notice and essentially a single column 'print' stylesheet, with all of the sites functionality hidden, so thats not a concern. - I'm fully aware that some may deem creating this delay "bad practice" and I'm not interested in having that discussion, please answer the question directly, thanks.
0
11,713,665
07/29/2012 22:51:19
971,741
09/29/2011 18:18:58
321
2
Using fade in/fade out with jquery
I am working over on of my student projects and I am new jquery, for the project I have to use jquery to enhance few function and I have learned much to carry out basic tasks, but I am stuck over something very confusing. One my scripts actually changes the image of a div container at mouse over function, function is currently fine but make it feel a little beautiful I want to add transition affects to it either through fade in fade out functions or through animate but am unable to work it out with both. I searched over internet but here i am unable to relate those examples to mind here. I just want to know where can I insert fade in fade out or animate function in this code, to give it a transitioning effect: $(document).ready(function () { $(".thumb").hover(function () { var dummyImg = $(this).attr("alt"); $(this).attr("alt", $(this).attr("src")); $(this).attr("src", dummyImg); }, function () { var dummyImg = $(this).attr("src"); $(this).attr("src", $(this).attr("alt")); $(this).attr("alt", dummyImg); }); }); Thank-you!
javascript
jquery
jquery-ui
null
null
null
open
Using fade in/fade out with jquery === I am working over on of my student projects and I am new jquery, for the project I have to use jquery to enhance few function and I have learned much to carry out basic tasks, but I am stuck over something very confusing. One my scripts actually changes the image of a div container at mouse over function, function is currently fine but make it feel a little beautiful I want to add transition affects to it either through fade in fade out functions or through animate but am unable to work it out with both. I searched over internet but here i am unable to relate those examples to mind here. I just want to know where can I insert fade in fade out or animate function in this code, to give it a transitioning effect: $(document).ready(function () { $(".thumb").hover(function () { var dummyImg = $(this).attr("alt"); $(this).attr("alt", $(this).attr("src")); $(this).attr("src", dummyImg); }, function () { var dummyImg = $(this).attr("src"); $(this).attr("src", $(this).attr("alt")); $(this).attr("alt", dummyImg); }); }); Thank-you!
0
11,713,667
07/29/2012 22:51:35
1,513,458
07/10/2012 01:42:37
90
21
Can you spot this PHP error? I'm stumped
Here's the scenerio of what is happening in the script: - Session is start. - $id is set to a number (tournament ID number). Result: - User SESSION vars are reset with the ID number and the ID number's respective user data. Essentially logging the user in under a different account. Troubleshooting: - Renaming $id to $tid stops the glitch. - Not starting the session ("session_start()") stops the glitch. Thought Process: - $id must overwrite similar variable which is inside a block which contains: `if(isset( $_SESSION['someVar'] )) { $id = "some Value"; }` Since $id is only overwritten when session is started. The Problem: - There is no block of code that uses that syntax. Here's the call stack. jointourney.php <? session_start(); $id = (isset($_POST['id'])) ? $_POST['id'] : false; include("html.php"); ?> html.php <? if(session_id() == '') session_start(); if(!function_exists('isLogged')) include("includes/islogged.inc.php"); include("includes/autologin.inc.php"); $query = mysql_query("SELECT value FROM config WHERE name='shutdown'"); $query = mysql_fetch_array($query); $shutdown = end($query); if(!class_exists('ban')) include("class/ban.class.php"); $ban = new ban(); if(isLogged()){ $ban->setUsername($_SESSION['username']); } $user_level = (isset($_SESSION['user_level'])) ? $_SESSION['user_level'] : "0"; $ban->setIP($_SERVER['REMOTE_ADDR']); if((strlen($shutdown) > 0 || $ban->isBanned()) && $user_level == 0 && strtolower($_SERVER['REQUEST_URI']) != "/login.php"){ if(strtolower($_SERVER['REQUEST_URI']) != "/error.php"){ header("Location: ./error.php"); } } ?> islogged.inc.php File not needed, no variables set: only returns true/false. autologin.inc.php <? if(!class_exists('login')) include("./class/login.class.php"); $login = new Login(); if(isset($_COOKIE['username'],$_COOKIE['password']) && !$login->isLoggedIn()){ $login->setUsername($_COOKIE['username']); $login->setPasswordDirect($_COOKIE['password']); if(!$login->_error){ $login->processLogin(); } } ?> As you see, there is absolutely no place where jointourney.$id can overwrite - since there is no other variable called $id being used. Note: There are no variables that are being set globally (ie global $id) I do not understand why this is happening, are you guys able to figure this out? Everything you see here is exactly how it looks (minus HTML).
php
trouble-shooting
null
null
null
null
open
Can you spot this PHP error? I'm stumped === Here's the scenerio of what is happening in the script: - Session is start. - $id is set to a number (tournament ID number). Result: - User SESSION vars are reset with the ID number and the ID number's respective user data. Essentially logging the user in under a different account. Troubleshooting: - Renaming $id to $tid stops the glitch. - Not starting the session ("session_start()") stops the glitch. Thought Process: - $id must overwrite similar variable which is inside a block which contains: `if(isset( $_SESSION['someVar'] )) { $id = "some Value"; }` Since $id is only overwritten when session is started. The Problem: - There is no block of code that uses that syntax. Here's the call stack. jointourney.php <? session_start(); $id = (isset($_POST['id'])) ? $_POST['id'] : false; include("html.php"); ?> html.php <? if(session_id() == '') session_start(); if(!function_exists('isLogged')) include("includes/islogged.inc.php"); include("includes/autologin.inc.php"); $query = mysql_query("SELECT value FROM config WHERE name='shutdown'"); $query = mysql_fetch_array($query); $shutdown = end($query); if(!class_exists('ban')) include("class/ban.class.php"); $ban = new ban(); if(isLogged()){ $ban->setUsername($_SESSION['username']); } $user_level = (isset($_SESSION['user_level'])) ? $_SESSION['user_level'] : "0"; $ban->setIP($_SERVER['REMOTE_ADDR']); if((strlen($shutdown) > 0 || $ban->isBanned()) && $user_level == 0 && strtolower($_SERVER['REQUEST_URI']) != "/login.php"){ if(strtolower($_SERVER['REQUEST_URI']) != "/error.php"){ header("Location: ./error.php"); } } ?> islogged.inc.php File not needed, no variables set: only returns true/false. autologin.inc.php <? if(!class_exists('login')) include("./class/login.class.php"); $login = new Login(); if(isset($_COOKIE['username'],$_COOKIE['password']) && !$login->isLoggedIn()){ $login->setUsername($_COOKIE['username']); $login->setPasswordDirect($_COOKIE['password']); if(!$login->_error){ $login->processLogin(); } } ?> As you see, there is absolutely no place where jointourney.$id can overwrite - since there is no other variable called $id being used. Note: There are no variables that are being set globally (ie global $id) I do not understand why this is happening, are you guys able to figure this out? Everything you see here is exactly how it looks (minus HTML).
0
11,713,459
07/29/2012 22:16:18
1,549,496
07/24/2012 17:49:46
1
0
If IE not working properly
I have 1 div and i want to apply a gradient and a background image to it (yes, on the same element). I know that it's only possible if the browser you`re targeting is NOT IE. With that in mind, i thought of applying a solid color in stead of the gradient with an image on top of it for IE only. Here is my code: background: url(../images/newsletter.png), -moz-linear-gradient(top, rgb(10,10,01) , rgb(5,5,5)); background: url(../images/newsletter.png), -webkit-gradient(linear, left top, left bottom, from(#0a0a0a), to(#05050f)); background-repeat: no-repeat, repeat; <!--[if IE]> background: #000 url(../images/newsletter.png) center left no-repeat; <![endif]--> The problem is the condition is ignored, before or after the declaration for FF/Chrome. (i`ve tested the <![if !IE]><![endif]> and also the [if false] etc.) Any ideas?
css3
null
null
null
null
null
open
If IE not working properly === I have 1 div and i want to apply a gradient and a background image to it (yes, on the same element). I know that it's only possible if the browser you`re targeting is NOT IE. With that in mind, i thought of applying a solid color in stead of the gradient with an image on top of it for IE only. Here is my code: background: url(../images/newsletter.png), -moz-linear-gradient(top, rgb(10,10,01) , rgb(5,5,5)); background: url(../images/newsletter.png), -webkit-gradient(linear, left top, left bottom, from(#0a0a0a), to(#05050f)); background-repeat: no-repeat, repeat; <!--[if IE]> background: #000 url(../images/newsletter.png) center left no-repeat; <![endif]--> The problem is the condition is ignored, before or after the declaration for FF/Chrome. (i`ve tested the <![if !IE]><![endif]> and also the [if false] etc.) Any ideas?
0
11,713,460
07/29/2012 22:16:28
1,561,598
07/29/2012 22:08:21
1
0
If a member is not logged in, in Umbraco Contour prevalues works not correctly
I have upgraded Contour to 1.1.9 for the use of {member.property} in the forms on the site (umbraco 4.0.3). Works fine when your member are logged in (shows content in the input field), but if the member is not logged in, the form input will just show a plain text "{member.property}". Why is it not just showing an empty space or no info when no one is logged in? What I do, was just to place the {member.property} in the PreValues input field in Contour. Hope someone can help me out here? Kind regards, Niels Kristiansen
umbraco
contour
members
null
null
null
open
If a member is not logged in, in Umbraco Contour prevalues works not correctly === I have upgraded Contour to 1.1.9 for the use of {member.property} in the forms on the site (umbraco 4.0.3). Works fine when your member are logged in (shows content in the input field), but if the member is not logged in, the form input will just show a plain text "{member.property}". Why is it not just showing an empty space or no info when no one is logged in? What I do, was just to place the {member.property} in the PreValues input field in Contour. Hope someone can help me out here? Kind regards, Niels Kristiansen
0
11,713,673
07/29/2012 22:53:11
1,343,118
04/19/2012 05:51:23
9
1
Why isn't the "rectangle" that I want to draw on my Qt widget showing up?
I basically want to display a rectangle on a dialog window widget. Using another question as reference, I tried to adapt the framework of using a QLabel and painting to it (the process overall seems overly complicated). I started by making a member in the dialog box's class: QLabel* label; In the constructor of the dialog box: label = new QLabel(this); label->setGeometry(20, 50, 50, 100); Just to try and make it work, I gave the dialog box a button to make the "rectangle" created with the label appear on the widget. I connected the "pressed" signal of this button to a slot which does the following: QPixmap pixmap(50, 100); pixmap.fill(QColor("transparent")); QPainter painter(&pixmap); painter.setBrush(QBrush(Qt::black)); painter.drawRect(20, 50, 50, 100); label->setPixmap(pixmap); update(); Unfortunately, nothing appears in the widget when I press the button. What am I missing here?
qt
draw
drawrect
qwidget
qpainter
null
open
Why isn't the "rectangle" that I want to draw on my Qt widget showing up? === I basically want to display a rectangle on a dialog window widget. Using another question as reference, I tried to adapt the framework of using a QLabel and painting to it (the process overall seems overly complicated). I started by making a member in the dialog box's class: QLabel* label; In the constructor of the dialog box: label = new QLabel(this); label->setGeometry(20, 50, 50, 100); Just to try and make it work, I gave the dialog box a button to make the "rectangle" created with the label appear on the widget. I connected the "pressed" signal of this button to a slot which does the following: QPixmap pixmap(50, 100); pixmap.fill(QColor("transparent")); QPainter painter(&pixmap); painter.setBrush(QBrush(Qt::black)); painter.drawRect(20, 50, 50, 100); label->setPixmap(pixmap); update(); Unfortunately, nothing appears in the widget when I press the button. What am I missing here?
0
11,347,120
07/05/2012 15:03:43
185,840
10/07/2009 18:22:05
2,520
111
Wordpress: delete plugin references in database
How does one completely remove a plugin from Wordpress? I have deleted the plugin via Wordpress admin and then reinstalled, problem persists. I see 8 records in cmsoptions table referencing the offending plugin. Since WP Admin drags to a grinding crawl with the plugin active, and for weeks the plugin was working just fine, I have to conclude that the problem exists due to the plugin references in the DB Man, Wordpress COMPLETELY BLOWS CHUNKS&trade; when things go awry, impressive otherwise... If anyone has the inside word on completely obliterating a plugin from WP, please do share
wordpress
plugins
complete
obliterate
null
null
open
Wordpress: delete plugin references in database === How does one completely remove a plugin from Wordpress? I have deleted the plugin via Wordpress admin and then reinstalled, problem persists. I see 8 records in cmsoptions table referencing the offending plugin. Since WP Admin drags to a grinding crawl with the plugin active, and for weeks the plugin was working just fine, I have to conclude that the problem exists due to the plugin references in the DB Man, Wordpress COMPLETELY BLOWS CHUNKS&trade; when things go awry, impressive otherwise... If anyone has the inside word on completely obliterating a plugin from WP, please do share
0
11,347,121
07/05/2012 15:03:43
1,503,471
07/05/2012 09:11:04
1
0
Identity and Credential in different tables. How to login user?
I'm using Zend Framework. I save users information in two tables. I have one table for his basic information and password, and in the other table I save his e-mails. He can login with any e-mail. My question is how should I extend Zend_Auth_Adapter_DbTable so that I can allow this? I prefer not to use table views.
zend-framework
authentication
null
null
null
null
open
Identity and Credential in different tables. How to login user? === I'm using Zend Framework. I save users information in two tables. I have one table for his basic information and password, and in the other table I save his e-mails. He can login with any e-mail. My question is how should I extend Zend_Auth_Adapter_DbTable so that I can allow this? I prefer not to use table views.
0
11,349,739
07/05/2012 17:48:44
1,502,250
07/04/2012 18:12:46
1
0
Adding objects (String, String, int, int) to ArrayList
I got these two classes. The one below should get an ArrayList with movies... import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; public class UIDActivity extends Activity { private static ArrayList<Movie> movieList; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public static void main(String String, int int args[]) { movieList = new ArrayList<Movie>(); movie1 = new Movie("Fight Club", "David Fincher", "1999", "3"); movieList.add(movie1); } public String getTitle() { return title; } public String getDirector() { return director; } public int getYear() { return year; } public int getRating() { return rating; } } ------------------------ this is the Movie class, in which I tell what the attributes are of a Movie import java.io.Serializable; @SuppressWarnings("serial") public class Movie implements Serializable{ public String title; public String director; public int year; public int rating; public Movie(String deTitle, String deDirector, int hetYear, int deRating){ title = deTitle; director = deDirector; year = hetYear; rating = deRating; } public void setTitle(String title) { this.title = title; } public void setDirector(String director) { this.director = director; } public void setYear(int year) { this.year = year; } public void setRating(int rating) { this.rating = rating; } } For some reason I can't figure out what simple thing I keep forgetting?!?! Eclipse wants to change my public Movie to four times String... No errors there, but rest won't work neither. I would appreciate the help :)
string
arraylist
int
null
null
null
open
Adding objects (String, String, int, int) to ArrayList === I got these two classes. The one below should get an ArrayList with movies... import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; public class UIDActivity extends Activity { private static ArrayList<Movie> movieList; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public static void main(String String, int int args[]) { movieList = new ArrayList<Movie>(); movie1 = new Movie("Fight Club", "David Fincher", "1999", "3"); movieList.add(movie1); } public String getTitle() { return title; } public String getDirector() { return director; } public int getYear() { return year; } public int getRating() { return rating; } } ------------------------ this is the Movie class, in which I tell what the attributes are of a Movie import java.io.Serializable; @SuppressWarnings("serial") public class Movie implements Serializable{ public String title; public String director; public int year; public int rating; public Movie(String deTitle, String deDirector, int hetYear, int deRating){ title = deTitle; director = deDirector; year = hetYear; rating = deRating; } public void setTitle(String title) { this.title = title; } public void setDirector(String director) { this.director = director; } public void setYear(int year) { this.year = year; } public void setRating(int rating) { this.rating = rating; } } For some reason I can't figure out what simple thing I keep forgetting?!?! Eclipse wants to change my public Movie to four times String... No errors there, but rest won't work neither. I would appreciate the help :)
0
11,349,744
07/05/2012 17:49:02
1,504,736
07/05/2012 17:13:37
1
0
Adding JavaScript to document with PHP
Ok, so this should be easy right? test.php: function some_javascript() { echo "Hello"; echo "<script type='text/javascript'>alert('Hello')<script>"; } and you'll get an alert window when you try to load your test.php. I must be missing something because I can't get this to work using a modal window as target and an AJAX request via post. Here's a basic structure of what I'm trying to do: index.html: <html> <head> <style> #modal { visibility:hidden; } </style> </head> <body> <div id="modal"> </div> <button onclick="call_ajax();">Call Ajax</button> </body> </html> call_ajax() sets modal visibility to "visible" and its innerHTML to response text from test.php(I don't write code because I don't seem to have problems here; text is sent just fine (I get "hello") and post data sent is processed as needed). But no alert window! Instead I get "alert('Hello')". Other than that the code works fine but I can't get javascript to work. There must be some detail I'm missing. Any ideas????
php
javascript
html
ajax
null
null
open
Adding JavaScript to document with PHP === Ok, so this should be easy right? test.php: function some_javascript() { echo "Hello"; echo "<script type='text/javascript'>alert('Hello')<script>"; } and you'll get an alert window when you try to load your test.php. I must be missing something because I can't get this to work using a modal window as target and an AJAX request via post. Here's a basic structure of what I'm trying to do: index.html: <html> <head> <style> #modal { visibility:hidden; } </style> </head> <body> <div id="modal"> </div> <button onclick="call_ajax();">Call Ajax</button> </body> </html> call_ajax() sets modal visibility to "visible" and its innerHTML to response text from test.php(I don't write code because I don't seem to have problems here; text is sent just fine (I get "hello") and post data sent is processed as needed). But no alert window! Instead I get "alert('Hello')". Other than that the code works fine but I can't get javascript to work. There must be some detail I'm missing. Any ideas????
0
11,349,748
07/05/2012 17:49:14
597,389
01/31/2011 19:46:37
482
36
Entity not persisted. How to debug?
I'm using the [fosfacebookbundle][1] and the [fosuserbundle][2] to manage my users. I got everything working fine locally. However when I pushed everything to my staging environment, I noticed that the user's weren't persisted (using the doctrine entity manager) upon registration. First thing I checked was if I could persist other stuff using the entity manager, which went fine. Next I went on and checked the logs and saw that the insert statement is there: INSERT INTO user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at, firstname, lastname, facebookID, date_of_birth, locale, gender, has_profile_pic, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ({"1":"678770963","2":"678770963","3":"[email protected]","4":"[email protected]","5":true,"6":"","7":"","8":null,"9":0,"10":false,"11":null,"12":null,"13":null,"14":["ROLE_FACEBOOK"],"15":0,"16":null,"17":"Thomas","18":"Kleij","19":"678770963","20":{"date":"1986-12-09 00:00:00","timezone_type":3,"timezone":"PRC"},"21":"nl_NL","22":"male","23":1,"24":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"},"25":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"}}) When I replace the question marks, with the values of the prepared statement and issue the query manually, everything works fine. Has anyone got any clue as to what this could be? I would also be very happy with hints on how to further debug this, because I don't know where to look next.. Thanks in advance! [1]: https://github.com/FriendsOfSymfony/FOSFacebookBundle [2]: https://github.com/FriendsOfSymfony/FOSUserBundle
php
mysql
symfony
symfony-2.0
doctrine2
null
open
Entity not persisted. How to debug? === I'm using the [fosfacebookbundle][1] and the [fosuserbundle][2] to manage my users. I got everything working fine locally. However when I pushed everything to my staging environment, I noticed that the user's weren't persisted (using the doctrine entity manager) upon registration. First thing I checked was if I could persist other stuff using the entity manager, which went fine. Next I went on and checked the logs and saw that the insert statement is there: INSERT INTO user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at, firstname, lastname, facebookID, date_of_birth, locale, gender, has_profile_pic, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ({"1":"678770963","2":"678770963","3":"[email protected]","4":"[email protected]","5":true,"6":"","7":"","8":null,"9":0,"10":false,"11":null,"12":null,"13":null,"14":["ROLE_FACEBOOK"],"15":0,"16":null,"17":"Thomas","18":"Kleij","19":"678770963","20":{"date":"1986-12-09 00:00:00","timezone_type":3,"timezone":"PRC"},"21":"nl_NL","22":"male","23":1,"24":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"},"25":{"date":"2012-07-06 01:34:47","timezone_type":3,"timezone":"PRC"}}) When I replace the question marks, with the values of the prepared statement and issue the query manually, everything works fine. Has anyone got any clue as to what this could be? I would also be very happy with hints on how to further debug this, because I don't know where to look next.. Thanks in advance! [1]: https://github.com/FriendsOfSymfony/FOSFacebookBundle [2]: https://github.com/FriendsOfSymfony/FOSUserBundle
0
11,349,749
07/05/2012 17:49:16
1,504,769
07/05/2012 17:33:32
1
0
Using Awk to create a csv line
I am new to awk and can't quite figure out the best way to do this. I have thousands of xml files which I have already removed duplicates and divided fields into a single column in a single file using sed and awk. Now I want to assemble the list into a csv file containing multiple fields on one line. After a fixed number of fields I want to start a new line. Example 1234 2345 345678 4.23456E3 54321 654321 789 87654.100 9876 10.0 1234 2345 345678 4.23456E3 54321 654321 789 87654.100 9876 11.0 Output 1234, 2345, , 345678, 4.23456E3, 54321, 654321, 789, , 87654.100, 9876, , 10.0 1234, 2345, , 345678, 4.23456E3, 54321, 654321, 789, , 87654.100, 9876, , 11.0 Thanks
sed
awk
null
null
null
null
open
Using Awk to create a csv line === I am new to awk and can't quite figure out the best way to do this. I have thousands of xml files which I have already removed duplicates and divided fields into a single column in a single file using sed and awk. Now I want to assemble the list into a csv file containing multiple fields on one line. After a fixed number of fields I want to start a new line. Example 1234 2345 345678 4.23456E3 54321 654321 789 87654.100 9876 10.0 1234 2345 345678 4.23456E3 54321 654321 789 87654.100 9876 11.0 Output 1234, 2345, , 345678, 4.23456E3, 54321, 654321, 789, , 87654.100, 9876, , 10.0 1234, 2345, , 345678, 4.23456E3, 54321, 654321, 789, , 87654.100, 9876, , 11.0 Thanks
0
11,349,750
07/05/2012 17:49:18
428,757
08/23/2010 19:36:03
806
26
Why doesn't this model binding work?
I know that the way the names are in the HtmlHelper is what is breaking the model binding. But I haven't figured out how to fix it. Or if there is even a fix. A little explanation. I'm using one model to populate the: text, controls, default values (select lists), and values saved. I'm using the other ViewModel to only return the: value, dataid, and ctrltypeid. What has been commented out is the code (ex: Html.TextBoxFor) that is causing the postback ViewModel to be unpopulated. The working code (ex: Html.TextBox) does as expected. So I'm wondering what do I have to do to the commented code to make it work like the uncommented code. Is there actually anything I *can* do? @model InspectionWebFormsMVC.ViewModels.FormRowModel @using (Html.BeginForm("Index", "Section", FormMethod.Post)) { <div style="clear:both; padding:1%;"> <div class="section"> @Model.Section </div> <div class="number"> @Model.SectionNumber </div> <div class="desc"> @Model.Description </div> <div class="ctrl"> @{ int i = 0; //for (int i = 0; i < formRow.RowInput.Count; ++i) foreach (var RowInput in Model.RowInput) { var ddv = new SelectList(RowInput.RowCtrl.DefaultValues, "Value", "Label"); switch (RowInput.RowCtrl.Type) { case "dropdown": //@Html.DropDownListFor(blah => RowInput.InputtedData, ddv) //@Html.HiddenFor(blah => RowInput.InputtedDataID) //@Html.HiddenFor(blah => RowInput.RowCtrl.CtrlTypeID) @Html.DropDownList("InputtedData", ddv) @Html.Hidden("InputtedDataID", RowInput.InputtedDataID) @Html.Hidden("CtrlTypeID", RowInput.RowCtrl.CtrlTypeID) <br /> break; case "text": //@Html.TextBoxFor(blah => RowInput.InputtedData) //@Html.HiddenFor(blah => RowInput.InputtedDataID) //@Html.HiddenFor(blah => RowInput.RowCtrl.CtrlTypeID) @Html.TextBox("InputtedData", RowInput.InputtedData) @Html.Hidden("InputtedDataID", RowInput.InputtedDataID) @Html.Hidden("CtrlTypeID", RowInput.RowCtrl.CtrlTypeID) <br /> break; } } ++i; } Obviously Viewmodel for the Postback. namespace InspectionWebFormsMVC.ViewModels { public class SaveKeyValueInput { public long InputtedDataID { get; set; } public long CtrlTypeID { get; set; } public string InputtedData { get; set; } } } From Controller. Used for testing. [HttpPost] public ActionResult Index(SaveKeyValueInput placeholder) { var ha = placeholder; var la = "Hello"; FormRowProcessing placeholder2 = new FormRowProcessing(); var stub = placeholder2.stub()[2]; return View(stub); }
c#
asp.net-mvc
asp.net-mvc-3
razor
model
null
open
Why doesn't this model binding work? === I know that the way the names are in the HtmlHelper is what is breaking the model binding. But I haven't figured out how to fix it. Or if there is even a fix. A little explanation. I'm using one model to populate the: text, controls, default values (select lists), and values saved. I'm using the other ViewModel to only return the: value, dataid, and ctrltypeid. What has been commented out is the code (ex: Html.TextBoxFor) that is causing the postback ViewModel to be unpopulated. The working code (ex: Html.TextBox) does as expected. So I'm wondering what do I have to do to the commented code to make it work like the uncommented code. Is there actually anything I *can* do? @model InspectionWebFormsMVC.ViewModels.FormRowModel @using (Html.BeginForm("Index", "Section", FormMethod.Post)) { <div style="clear:both; padding:1%;"> <div class="section"> @Model.Section </div> <div class="number"> @Model.SectionNumber </div> <div class="desc"> @Model.Description </div> <div class="ctrl"> @{ int i = 0; //for (int i = 0; i < formRow.RowInput.Count; ++i) foreach (var RowInput in Model.RowInput) { var ddv = new SelectList(RowInput.RowCtrl.DefaultValues, "Value", "Label"); switch (RowInput.RowCtrl.Type) { case "dropdown": //@Html.DropDownListFor(blah => RowInput.InputtedData, ddv) //@Html.HiddenFor(blah => RowInput.InputtedDataID) //@Html.HiddenFor(blah => RowInput.RowCtrl.CtrlTypeID) @Html.DropDownList("InputtedData", ddv) @Html.Hidden("InputtedDataID", RowInput.InputtedDataID) @Html.Hidden("CtrlTypeID", RowInput.RowCtrl.CtrlTypeID) <br /> break; case "text": //@Html.TextBoxFor(blah => RowInput.InputtedData) //@Html.HiddenFor(blah => RowInput.InputtedDataID) //@Html.HiddenFor(blah => RowInput.RowCtrl.CtrlTypeID) @Html.TextBox("InputtedData", RowInput.InputtedData) @Html.Hidden("InputtedDataID", RowInput.InputtedDataID) @Html.Hidden("CtrlTypeID", RowInput.RowCtrl.CtrlTypeID) <br /> break; } } ++i; } Obviously Viewmodel for the Postback. namespace InspectionWebFormsMVC.ViewModels { public class SaveKeyValueInput { public long InputtedDataID { get; set; } public long CtrlTypeID { get; set; } public string InputtedData { get; set; } } } From Controller. Used for testing. [HttpPost] public ActionResult Index(SaveKeyValueInput placeholder) { var ha = placeholder; var la = "Hello"; FormRowProcessing placeholder2 = new FormRowProcessing(); var stub = placeholder2.stub()[2]; return View(stub); }
0
11,349,751
07/05/2012 17:49:30
1,504,779
07/05/2012 17:37:59
1
0
Error Powershell SCCM 2012 Package Deployment Script
Currently I'm trying to automate the package distribution process. My script looks like this: I found most of the information on how to create this from http://www.sepago.de/e/david/2012/03/17/microsoft-configuration-manager-2012-and-powershell-ae-create-deployments $sitename = "SKG" Function create-PKGDeployment { $targetcoll = gwmi -ns "root\SMS\Site_$sitename" -class SMS_Collection | WHERE {$_.Name -eq 'Lab'} $collID = $targetcoll.CollectionID $collName = $targetcoll.Name $PKG = gwmi -ns "root\SMS\Site_$sitename" -class SMS_Package | WHERE {$_.name -eq 'Lab'} $PKGID = $PKG.PackageID $PKGName = $PKG.Name $AdvName = $PKGName+"_"+$PKGID+"_"+$collName [ARRAY]$PackageID = $PKGID; Invoke-WmiMethod -Namespace "Root\SMS\Site_SC1" -Name AddPackages -Path "SMS_DistributionPointGroup.GroupID='{489CGFD8-1125-7B38-6WHV-2DD54E8TB91S}'" ` -ArgumentList ( ,$PackageID) $Format = get-date -format yyyyMMddHHmmss $Date = $Format + ".000000+***" $AdvArgs = @{ AdvertisementName = "$AdvName"; CollectionID = $collID; PackageID = $PKGID; SourceSite = $sitename; ActionInProgress = 2 PresentTime = $Date ProgramName = "*"; AdvertFlags = 33751072; RemoteClientFlags = 2128; TimeFLags = 8913 } Set-WmiInstance -Class SMS_Advertisement -arguments $AdvArgs -namespace "root\SMS\Site_$sitename" | Out-Null } create-PKGDeployment When I deploy the script under Deployment Status I get Message ID 10035 and under the CAS file it's coming up with: ![LOG[Error: DeleteDirectory:- Failed to delete Directory with Error 0x00000003.]LOG]!><time="13:16:11.382+240" date="07-05-2012" component="ContentAccess" context="" type="3" thread="2996" file="delpath.cpp:22" Just curious if anyone had any thoughts why the script is faulty. Thanks!
powershell
sccm
null
null
null
null
open
Error Powershell SCCM 2012 Package Deployment Script === Currently I'm trying to automate the package distribution process. My script looks like this: I found most of the information on how to create this from http://www.sepago.de/e/david/2012/03/17/microsoft-configuration-manager-2012-and-powershell-ae-create-deployments $sitename = "SKG" Function create-PKGDeployment { $targetcoll = gwmi -ns "root\SMS\Site_$sitename" -class SMS_Collection | WHERE {$_.Name -eq 'Lab'} $collID = $targetcoll.CollectionID $collName = $targetcoll.Name $PKG = gwmi -ns "root\SMS\Site_$sitename" -class SMS_Package | WHERE {$_.name -eq 'Lab'} $PKGID = $PKG.PackageID $PKGName = $PKG.Name $AdvName = $PKGName+"_"+$PKGID+"_"+$collName [ARRAY]$PackageID = $PKGID; Invoke-WmiMethod -Namespace "Root\SMS\Site_SC1" -Name AddPackages -Path "SMS_DistributionPointGroup.GroupID='{489CGFD8-1125-7B38-6WHV-2DD54E8TB91S}'" ` -ArgumentList ( ,$PackageID) $Format = get-date -format yyyyMMddHHmmss $Date = $Format + ".000000+***" $AdvArgs = @{ AdvertisementName = "$AdvName"; CollectionID = $collID; PackageID = $PKGID; SourceSite = $sitename; ActionInProgress = 2 PresentTime = $Date ProgramName = "*"; AdvertFlags = 33751072; RemoteClientFlags = 2128; TimeFLags = 8913 } Set-WmiInstance -Class SMS_Advertisement -arguments $AdvArgs -namespace "root\SMS\Site_$sitename" | Out-Null } create-PKGDeployment When I deploy the script under Deployment Status I get Message ID 10035 and under the CAS file it's coming up with: ![LOG[Error: DeleteDirectory:- Failed to delete Directory with Error 0x00000003.]LOG]!><time="13:16:11.382+240" date="07-05-2012" component="ContentAccess" context="" type="3" thread="2996" file="delpath.cpp:22" Just curious if anyone had any thoughts why the script is faulty. Thanks!
0
11,410,431
07/10/2012 09:34:14
874,927
08/02/2011 15:19:48
494
18
JQuery AJAX Post fails on Android Tablets Running Honeycomb 3.2
I have a simple enough AJAX `'POST'`. It works on IOS phones and tablets (4.0 and 5) and appears to work on Android phones (2.1 and 4.0) but when it is run on two different android tablets both using Honeycomb 3.2 the `errorcallback` is executed everytime - even though the webservice recieves the post successfully. $.ajax({ type: 'POST', url: url, cache: false, data: data, success: callback, error: errorCallback, crossDomain:true, // This option has no effect on the outcome dataType: 'JSON' }); I am successfully using JQuery's ajax `'GET'` across all platforms its just the `'POST'` i'm having problem with. CORS is enabled on the server. Anyone come across this problem before?
android
jquery
ajax
jquery-ajax
honeycomb
null
open
JQuery AJAX Post fails on Android Tablets Running Honeycomb 3.2 === I have a simple enough AJAX `'POST'`. It works on IOS phones and tablets (4.0 and 5) and appears to work on Android phones (2.1 and 4.0) but when it is run on two different android tablets both using Honeycomb 3.2 the `errorcallback` is executed everytime - even though the webservice recieves the post successfully. $.ajax({ type: 'POST', url: url, cache: false, data: data, success: callback, error: errorCallback, crossDomain:true, // This option has no effect on the outcome dataType: 'JSON' }); I am successfully using JQuery's ajax `'GET'` across all platforms its just the `'POST'` i'm having problem with. CORS is enabled on the server. Anyone come across this problem before?
0
11,410,438
07/10/2012 09:34:35
1,513,300
07/09/2012 23:13:58
1
0
Aligning list elements Sagemath
I have a huge list with hundreds of thousands of numbers. The list is badly formatted when produced by sagemath, but i must have it in the kind of formatting shown below to "feed" it to another function. Here is sample of the well formatted list: C=[ ( 7.850629, 25.421135, 22.162571), ( 37.706629, 28.421472, 0.229876), ( 37.560629, 21.421809, 18.320977), ( 39.238629, 26.422147, 18.442572), ( 35.087169, 0.419785, 15.055789), ] As you can see, all elements are aligned to the right as well as based on the precision and decimal place. So my question is this: **How can i convert the badly formatted list (example shown below) to the well formatted above** B=[(37.074945, 22.414327, 9.56234476116072e-9317194), (37.074945, 22.414665, 1.66921473562522e-8933558), (37.074945, 22.415002, 8.57137697295091e-8558000), (37.074945, 22.41534, 1.29473102283896e-8190517), (37.074945, 22.415677, 5.75306239964646e-7831112), (37.074945, 22.416014, 7.51985016236571e-7479783)] (If i could describe it even a bit more, i would say that if my list is thought of as a matrix, then it would have hundreds of thousands of rows and three columns)
list
formatting
alignment
decimal
sage
null
open
Aligning list elements Sagemath === I have a huge list with hundreds of thousands of numbers. The list is badly formatted when produced by sagemath, but i must have it in the kind of formatting shown below to "feed" it to another function. Here is sample of the well formatted list: C=[ ( 7.850629, 25.421135, 22.162571), ( 37.706629, 28.421472, 0.229876), ( 37.560629, 21.421809, 18.320977), ( 39.238629, 26.422147, 18.442572), ( 35.087169, 0.419785, 15.055789), ] As you can see, all elements are aligned to the right as well as based on the precision and decimal place. So my question is this: **How can i convert the badly formatted list (example shown below) to the well formatted above** B=[(37.074945, 22.414327, 9.56234476116072e-9317194), (37.074945, 22.414665, 1.66921473562522e-8933558), (37.074945, 22.415002, 8.57137697295091e-8558000), (37.074945, 22.41534, 1.29473102283896e-8190517), (37.074945, 22.415677, 5.75306239964646e-7831112), (37.074945, 22.416014, 7.51985016236571e-7479783)] (If i could describe it even a bit more, i would say that if my list is thought of as a matrix, then it would have hundreds of thousands of rows and three columns)
0
11,410,443
07/10/2012 09:34:54
413,174
08/06/2010 14:50:58
1,421
17
comparing two images using pixel by pixel
I need to find a scientific method of how to compare the difference between two float images. At the moment, my approach is to compare the values of every pixel of the two images: > pixelA ?= pixelB However, I need to have a scientific method to define a threshold such that: > Math.Abs(pixelA-pixelB) <= threshold How and which method should I define the threshold value? Thanks in advance.
image-processing
comparison
null
null
null
null
open
comparing two images using pixel by pixel === I need to find a scientific method of how to compare the difference between two float images. At the moment, my approach is to compare the values of every pixel of the two images: > pixelA ?= pixelB However, I need to have a scientific method to define a threshold such that: > Math.Abs(pixelA-pixelB) <= threshold How and which method should I define the threshold value? Thanks in advance.
0
11,410,445
07/10/2012 09:35:04
131,120
06/30/2009 14:32:56
982
30
Draw and write imagefile without Window
I found that using `matplotlib` just to draw a diagram into a file is not as easy as it seems from reading the tutorials. In the tutorials it is explained, that you just accumulate the data and then: import matplotlib.pyplot as plt # ... fill variables with meaningful stuff plt.plot(data.x,data.y,format_string) plt.savefig(filename) And done. That also works fine if you just execute it as a shell. But if you give this code to a process that doesn't have any window (like jenkins), then you just get the following error: Traceback (most recent call last): File "./to_graph.py", line 89, in <module> main() File "./to_graph.py", line 78, in main plt.plot(warnings[0],warnings[1],args.format_warnings,label="Warnings") File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2460, in plot ax = gca() File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 701, in gca ax = gcf().gca(**kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 369, in gcf return figure() File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 343, in figure **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 80, in new_figure_manager window = Tk.Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1688, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable The reason for this error, as I understand the sourcecode around the stack-trace lines, is that backend_tkagg.py expects to use an existing window (see the Tk.Tk() line in the stacktrace). So I wonder if there is a way to draw diagrams with matplotlib (or python at all) without relying on a window(-manager) to do the work.
python
linux
matplotlib
null
null
null
open
Draw and write imagefile without Window === I found that using `matplotlib` just to draw a diagram into a file is not as easy as it seems from reading the tutorials. In the tutorials it is explained, that you just accumulate the data and then: import matplotlib.pyplot as plt # ... fill variables with meaningful stuff plt.plot(data.x,data.y,format_string) plt.savefig(filename) And done. That also works fine if you just execute it as a shell. But if you give this code to a process that doesn't have any window (like jenkins), then you just get the following error: Traceback (most recent call last): File "./to_graph.py", line 89, in <module> main() File "./to_graph.py", line 78, in main plt.plot(warnings[0],warnings[1],args.format_warnings,label="Warnings") File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2460, in plot ax = gca() File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 701, in gca ax = gcf().gca(**kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 369, in gcf return figure() File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 343, in figure **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 80, in new_figure_manager window = Tk.Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1688, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable The reason for this error, as I understand the sourcecode around the stack-trace lines, is that backend_tkagg.py expects to use an existing window (see the Tk.Tk() line in the stacktrace). So I wonder if there is a way to draw diagrams with matplotlib (or python at all) without relying on a window(-manager) to do the work.
0
11,410,448
07/10/2012 09:35:12
246,051
01/08/2010 00:44:05
399
11
Create an Android ImageButton with a Shape
I have an ImageButton and want to scale the button in different sizes which means an image is not the right choice. So I was thinking of an ImageButton with a custom Shape as source. I want the button to look like this: ![enter image description here][1] I started with this, but got stuck with the rotate stuff: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >     <stroke android:width="2dp" android:color="@color/red" /> <rotate android:fromDegrees="90" android:toDegrees="135" > <shape android:shape="line" > <stroke android:width="2dp" android:color="@color/red" > </stroke> </shape> </rotate> <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" /> </shape> This however does not rotate as I expect it to. Maybe I am completely wrong and need a push in the right direction. :-) Thanks. [1]: http://i.stack.imgur.com/JCcwC.png
android
android-layout
null
null
null
null
open
Create an Android ImageButton with a Shape === I have an ImageButton and want to scale the button in different sizes which means an image is not the right choice. So I was thinking of an ImageButton with a custom Shape as source. I want the button to look like this: ![enter image description here][1] I started with this, but got stuck with the rotate stuff: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >     <stroke android:width="2dp" android:color="@color/red" /> <rotate android:fromDegrees="90" android:toDegrees="135" > <shape android:shape="line" > <stroke android:width="2dp" android:color="@color/red" > </stroke> </shape> </rotate> <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" /> </shape> This however does not rotate as I expect it to. Maybe I am completely wrong and need a push in the right direction. :-) Thanks. [1]: http://i.stack.imgur.com/JCcwC.png
0
11,410,450
07/10/2012 09:35:19
1,140,170
01/10/2012 05:51:01
78
0
Pthread program taking longer time than expected
Hello, I have created a multithreaded application for multiplying two matrices using pthreads,but to my surprise the multithreaded program is taking much time than my expectation. I dnt know where is the problem in my code,the code snippet is given below:: #include "pthreads.h" #include "cv.h" #include "cxcore.h" CvMat * matA; /* first matrix */ CvMat * matB; /* second matrix */ CvMat * matRes; /* result matrix */ int size_x_a; /* this variable will be used for the first dimension */ int size_y_a; /* this variable will be used for the second dimension */ int size_x_b,size_y_b; int size_x_res; int size_y_res; struct v { int i; /* row */ int j; /* column */ }; void *printThreadID(void *threadid) { /*long id = (long) threadid; //printf("Thread ID: %ld\n", id); arrZ[id] = arrX[id] + arrY[id]; pthread_exit(NULL);*/ return 0; } int main() { /* assigining the values of sizes */ size_x_a = 200; size_y_a = 200; size_x_b = 200; size_y_b = 200; /* resultant matrix dimensions */ size_x_res = size_x_a; size_y_res = size_y_b; matA = cvCreateMat(size_x_a,size_y_a,CV_64FC1); matB = cvCreateMat(size_x_b,size_y_b,CV_64FC1); matRes = cvCreateMat(size_x_res,size_y_res,CV_64FC1); pthread_t thread1; pthread_t thread2; pthread_t multThread[200][200]; int res1; int res2; int mulRes; /*******************************************************************************/ /*Creating a thread*/ res1 = pthread_create(&thread1,NULL,initializeA,(void*)matA); if(res1!=0) { perror("thread creation of thread1 failed"); exit(EXIT_FAILURE); } /*Creating a thread*/ res2 = pthread_create(&thread2,NULL,initializeB,(void*)matB); if(res2!=0) { perror("thread creation of thread2 failed"); exit(EXIT_FAILURE); } pthread_join(thread1,NULL); pthread_join(thread2,NULL); /*Multiplication of matrices*/ for(int i=0;i<size_x_a;i++) { for(int j=0;j<size_y_b;j++) { struct v * data = (struct v*)malloc(sizeof(struct v)); data->i = i; data->j = j; mulRes = pthread_create(&multThread[i][j],NULL,multiplication, (void*)data); } } for(int i=0;i<size_x_a;i++) { for(int j=0;j<size_y_b;j++) { pthread_join(multThread[i][j],NULL); } } for(int i =0;i<size_x_a;i++) { for(int j = 0;j<size_y_a;j++) { printf("%f ",cvmGet(matA,i,j)); } } return 0; } void * multiplication(void * param) { struct v * data = (struct v *)param; double sum =0; for(int k=0;k<size_x_a;k++) sum += cvmGet(matA,data->i,k) * cvmGet(matB,k,data->j); cvmSet(matRes,data->i,data->j,sum); pthread_exit(0); return 0; } void * initializeA(void * arg) { CvMat * matA = (CvMat*)arg; //matA = (CvMat*)malloc(size_x_a * sizeof(CvMat *)); /*initialiazing random values*/ for (int i = 0; i < size_x_a; i++) { for (int j = 0; j < size_y_a; j++) { cvmSet(matA,i,j,size_y_a + j); /* just some unique number for each element */ } } return 0; } void * initializeB(void * arg) { CvMat* matB = (CvMat*)arg; //matB = (CvMat*)malloc(size_x_b * sizeof(CvMat *)); /*initialiazing random values*/ for (int i = 0; i < size_x_b; i++) { for (int j = 0; j < size_y_b; j++) { cvmSet(matB,i,j,size_y_b + j); /* just some unique number for each element */ } } return 0; } void * initializeRes(void * arg) { CvMat * res = (CvMat*)arg; //res = (CvMat*)malloc(size_x_res * sizeof(CvMat *)); /* for matrix matRes, allocate storage for an array of ints */ for (int i = 0; i < size_x_res; i++) { for (int j = 0; j < size_y_res; j++) { cvmSet(matRes,i,j,0); } } return 0; } I am doing this multithreading for the first time. Kindly help me with this,any suggestion or correction will be very helpful. Thanks in advance.
c
multithreading
opencv
pthreads
matrix-multiplication
null
open
Pthread program taking longer time than expected === Hello, I have created a multithreaded application for multiplying two matrices using pthreads,but to my surprise the multithreaded program is taking much time than my expectation. I dnt know where is the problem in my code,the code snippet is given below:: #include "pthreads.h" #include "cv.h" #include "cxcore.h" CvMat * matA; /* first matrix */ CvMat * matB; /* second matrix */ CvMat * matRes; /* result matrix */ int size_x_a; /* this variable will be used for the first dimension */ int size_y_a; /* this variable will be used for the second dimension */ int size_x_b,size_y_b; int size_x_res; int size_y_res; struct v { int i; /* row */ int j; /* column */ }; void *printThreadID(void *threadid) { /*long id = (long) threadid; //printf("Thread ID: %ld\n", id); arrZ[id] = arrX[id] + arrY[id]; pthread_exit(NULL);*/ return 0; } int main() { /* assigining the values of sizes */ size_x_a = 200; size_y_a = 200; size_x_b = 200; size_y_b = 200; /* resultant matrix dimensions */ size_x_res = size_x_a; size_y_res = size_y_b; matA = cvCreateMat(size_x_a,size_y_a,CV_64FC1); matB = cvCreateMat(size_x_b,size_y_b,CV_64FC1); matRes = cvCreateMat(size_x_res,size_y_res,CV_64FC1); pthread_t thread1; pthread_t thread2; pthread_t multThread[200][200]; int res1; int res2; int mulRes; /*******************************************************************************/ /*Creating a thread*/ res1 = pthread_create(&thread1,NULL,initializeA,(void*)matA); if(res1!=0) { perror("thread creation of thread1 failed"); exit(EXIT_FAILURE); } /*Creating a thread*/ res2 = pthread_create(&thread2,NULL,initializeB,(void*)matB); if(res2!=0) { perror("thread creation of thread2 failed"); exit(EXIT_FAILURE); } pthread_join(thread1,NULL); pthread_join(thread2,NULL); /*Multiplication of matrices*/ for(int i=0;i<size_x_a;i++) { for(int j=0;j<size_y_b;j++) { struct v * data = (struct v*)malloc(sizeof(struct v)); data->i = i; data->j = j; mulRes = pthread_create(&multThread[i][j],NULL,multiplication, (void*)data); } } for(int i=0;i<size_x_a;i++) { for(int j=0;j<size_y_b;j++) { pthread_join(multThread[i][j],NULL); } } for(int i =0;i<size_x_a;i++) { for(int j = 0;j<size_y_a;j++) { printf("%f ",cvmGet(matA,i,j)); } } return 0; } void * multiplication(void * param) { struct v * data = (struct v *)param; double sum =0; for(int k=0;k<size_x_a;k++) sum += cvmGet(matA,data->i,k) * cvmGet(matB,k,data->j); cvmSet(matRes,data->i,data->j,sum); pthread_exit(0); return 0; } void * initializeA(void * arg) { CvMat * matA = (CvMat*)arg; //matA = (CvMat*)malloc(size_x_a * sizeof(CvMat *)); /*initialiazing random values*/ for (int i = 0; i < size_x_a; i++) { for (int j = 0; j < size_y_a; j++) { cvmSet(matA,i,j,size_y_a + j); /* just some unique number for each element */ } } return 0; } void * initializeB(void * arg) { CvMat* matB = (CvMat*)arg; //matB = (CvMat*)malloc(size_x_b * sizeof(CvMat *)); /*initialiazing random values*/ for (int i = 0; i < size_x_b; i++) { for (int j = 0; j < size_y_b; j++) { cvmSet(matB,i,j,size_y_b + j); /* just some unique number for each element */ } } return 0; } void * initializeRes(void * arg) { CvMat * res = (CvMat*)arg; //res = (CvMat*)malloc(size_x_res * sizeof(CvMat *)); /* for matrix matRes, allocate storage for an array of ints */ for (int i = 0; i < size_x_res; i++) { for (int j = 0; j < size_y_res; j++) { cvmSet(matRes,i,j,0); } } return 0; } I am doing this multithreading for the first time. Kindly help me with this,any suggestion or correction will be very helpful. Thanks in advance.
0
11,410,456
07/10/2012 09:35:34
1,341,839
04/18/2012 15:37:27
26
0
javascript dropdown not loading in time
My problem is that I am trying to create a javascript menu but the script seems to be loading really slow and late so it's not working on the first seconds. Correct me if I am wrong. Second, I don't manage to make each column to work well and sometimes it's just linking to the same page, no matter which option I choose as well to another problem that there is no reaction to my choice, like I didn't do anything even if I really chose something from the menu. Do you know what can be the problem? Is it a bad idea to do it with JavaScript? Would you make it with PHP? I also thing that the code is maybe too long. This is the example for my problem - [link][1] [1]: http://www.101greatgoals.com/drop-test-2/ <div class="quick_width"> <div class="quick_links"><img src="http://www.101greatgoals.com/wp-content/themes/tutorial/images/quick_links.jpg" width="102" height="37" alt=" "></div> <div class="green_bg"> <div class="option_width"> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('show_option_none=Country'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/category/goals/"+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=teams&show_option_none=Teams&name=teamsmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("teamsmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?teams="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=players&show_option_none=Players&name=playersmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("playersmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?players="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=managers&show_option_none=Managers&name=managersmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("managersmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?managers="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=clean_feeds&show_option_none=Other&name=othermenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("othermenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?clean_feeds="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> </div> </div> <div class="right_align"></div> </div>
php
javascript
wordpress
wordpress-theming
null
null
open
javascript dropdown not loading in time === My problem is that I am trying to create a javascript menu but the script seems to be loading really slow and late so it's not working on the first seconds. Correct me if I am wrong. Second, I don't manage to make each column to work well and sometimes it's just linking to the same page, no matter which option I choose as well to another problem that there is no reaction to my choice, like I didn't do anything even if I really chose something from the menu. Do you know what can be the problem? Is it a bad idea to do it with JavaScript? Would you make it with PHP? I also thing that the code is maybe too long. This is the example for my problem - [link][1] [1]: http://www.101greatgoals.com/drop-test-2/ <div class="quick_width"> <div class="quick_links"><img src="http://www.101greatgoals.com/wp-content/themes/tutorial/images/quick_links.jpg" width="102" height="37" alt=" "></div> <div class="green_bg"> <div class="option_width"> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('show_option_none=Country'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/category/goals/"+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=teams&show_option_none=Teams&name=teamsmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("teamsmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?teams="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=players&show_option_none=Players&name=playersmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("playersmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?players="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=managers&show_option_none=Managers&name=managersmenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("managersmenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?managers="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> <div class="form_row_name_input1"> <ul class="dropdownul"> <li id="categories"> <?php wp_dropdown_categories('taxonomy=clean_feeds&show_option_none=Other&name=othermenu'); ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("othermenu"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?clean_feeds="+dropdown.options[dropdown.selectedIndex].text.split(' ').join('-'); } } dropdown.onchange = onCatChange; --></script> </li> </ul> </div> </div> </div> <div class="right_align"></div> </div>
0
11,628,002
07/24/2012 09:32:47
1,281,132
03/20/2012 14:19:08
1
0
php read data from serial port on linux
I try to read serial port on Linux platform using PHP. But I cant read any data. When I try to read using .net, this time I can read. I use "php_serial.class.php" class for serial port operations. You can read this class from this link : [here][1] [1]: http://www.phpclasses.org/browse/file/17926.html My code is like this : <?php include "php_serial.class.php"; // Let's start the class $serial = new phpSerial; // First we must specify the device. This works on both linux and windows (if // your linux serial device is /dev/ttyS0 for COM1, etc) $serial->deviceSet("/dev/ttyS1"); // We can change the baud rate, parity, length, stop bits, flow control $serial->confBaudRate(19200); $serial->confParity("none"); $serial->confCharacterLength(8); $serial->confStopBits(1); $serial->confFlowControl("none"); // Then we need to open it $serial->deviceOpen(); // read from serial port $read = $serial->readPort(); //Determine if a variable is set and is not NULL if(isset($read)){ while(1){ $read = $serial->readPort(); print_r(" (size ".strlen($read). " ) "); for($i = 0; $i < strlen($read); $i++) { echo ord($read[$i])." "; } print_r("\n"); sleep(1); }// end while }// end if // If you want to change the configuration, the device must be closed $serial->deviceClose(); // We can change the baud rate $serial->confBaudRate(19200); ?> the line "print_r(" (size ".strlen($read). " ) ");" always return zero. What is the reason why I cant read data from serial port?
php
linux
serial-port
null
null
null
open
php read data from serial port on linux === I try to read serial port on Linux platform using PHP. But I cant read any data. When I try to read using .net, this time I can read. I use "php_serial.class.php" class for serial port operations. You can read this class from this link : [here][1] [1]: http://www.phpclasses.org/browse/file/17926.html My code is like this : <?php include "php_serial.class.php"; // Let's start the class $serial = new phpSerial; // First we must specify the device. This works on both linux and windows (if // your linux serial device is /dev/ttyS0 for COM1, etc) $serial->deviceSet("/dev/ttyS1"); // We can change the baud rate, parity, length, stop bits, flow control $serial->confBaudRate(19200); $serial->confParity("none"); $serial->confCharacterLength(8); $serial->confStopBits(1); $serial->confFlowControl("none"); // Then we need to open it $serial->deviceOpen(); // read from serial port $read = $serial->readPort(); //Determine if a variable is set and is not NULL if(isset($read)){ while(1){ $read = $serial->readPort(); print_r(" (size ".strlen($read). " ) "); for($i = 0; $i < strlen($read); $i++) { echo ord($read[$i])." "; } print_r("\n"); sleep(1); }// end while }// end if // If you want to change the configuration, the device must be closed $serial->deviceClose(); // We can change the baud rate $serial->confBaudRate(19200); ?> the line "print_r(" (size ".strlen($read). " ) ");" always return zero. What is the reason why I cant read data from serial port?
0
11,628,003
07/24/2012 09:32:50
1,480,595
06/25/2012 17:01:01
1
0
wrong/crazy number display in xpages dynamic view
I have a crazy effect when displaying in view with a number column in a dynamic view panel of an xPage: Some (not all!) entries are displayed like: 123.40000000000005 the value in the notes doc is 123.4 . I cannot found any difference between that wrong displayed value and others, which are displayed correctly. I tried a few number formatting things in the column properties of the notes view: does not improve. the notes view displayed everything well (for the notes client). Is it a bug? Or did a forget some format settings for the dyn view control? Thanks in advance, Uwe
xpages-extlib
null
null
null
null
null
open
wrong/crazy number display in xpages dynamic view === I have a crazy effect when displaying in view with a number column in a dynamic view panel of an xPage: Some (not all!) entries are displayed like: 123.40000000000005 the value in the notes doc is 123.4 . I cannot found any difference between that wrong displayed value and others, which are displayed correctly. I tried a few number formatting things in the column properties of the notes view: does not improve. the notes view displayed everything well (for the notes client). Is it a bug? Or did a forget some format settings for the dyn view control? Thanks in advance, Uwe
0
11,628,004
07/24/2012 09:32:51
1,548,112
07/24/2012 09:00:58
1
0
values of textbox in a repeater disappears on clicking next button of asp:wizard
I am having problem with asp:wizard. I have a textbox within a repeater in step1 of asp:wizard. The user enters values in the textbox. Based on this value data has to be populated in another repeater in step2 of wizard. But on clicking the next button, I dont get the next repeater populated depending on the textbox value of the first repeater. This is the code of my wizard: <asp:Wizard ID="PurchaseCardWizard" runat="server" DisplaySideBar="False"> <WizardSteps> <asp:WizardStep ID="PurchaseCardWizardStep1" runat="server" Title=""> <div id="FlashBanner"> <iframe src="banner.html" scrolling="no" frameborder="0" width="987" height="270" allowtransparency="true"></iframe> </div> <div class="clear"></div> <div id="MainContent"> <div class="leftmain"> <h1><span>visa</span> prepaid cards</h1> <asp:Repeater ID="rptrCardTypes" runat="server"> <ItemTemplate> <div class="visa_box"> <div class="visabox-1"> <asp:Image ID="cardImage" runat="server" Width="179" Height="114" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "cardPicture") %>' /> <%--<img src="images/visa-1.jpg" width="179" height="114" />--%> <%--<img src='images/<%# DataBinder.Eval(Container.DataItem, "cardPicture") %>' width="179" height="114" />--%> </div> <div class="visabox-2"> <asp:Label ID="testId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cardName") %>'></asp:Label> <%--<h2><%# DataBinder.Eval(Container.DataItem, "cardName") %></h2>--%> <p>You can use this card to pay anytime any place worldwide where Visa is accepted. You can buy online tickets, make online hotel reservations, shop and pay your bills online and also withdraw cash from any visa ATM</p> <div class="visabox-input"> <asp:TextBox ID="txtRequiredQuantity1" runat="server" class="num_visa" Text="" ></asp:TextBox> <p>Please enter the required quantity</p> </div> </div> </div> </ItemTemplate> </asp:Repeater> <div class="button_visa"> <div class="butt"> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/button.jpg" Height="22" Width="63" OnClick="ImageButton1_Click" /> </div> </div> </div> <div class="right_cont"> <div class="right_hedd"><img src="images/right_hedd.jpg" width="292" height="25" /></div> <div class="right_forum"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="right_form"> <tr> <td colspan="2">Please enter the required information</td> </tr> <tr> <td width="27%">Name:</td> <td width="73%"> <asp:TextBox ID="txtName" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvalidatorName" runat="server" ErrorMessage="Please enter your name" Display="Dynamic" ControlToValidate="txtName" style="font:normal 12px/16px arial;" ValidationGroup="vglogin"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td>Civil Id:</td> <td> <asp:TextBox ID="txtCivilID" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvalidatorCivilID" runat="server" ErrorMessage="Please enter your Civil ID" Display="Dynamic" ControlToValidate="txtCivilID" ValidationGroup="vglogin"></asp:RequiredFieldValidator> <%--<input name="Please enter the required quantity2" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Email:</td> <td> <asp:TextBox ID="txtEmail" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter your email" Display="Dynamic" ControlToValidate="txtEmail" ValidationGroup="vglogin"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revalidatorEmail" runat="server" ErrorMessage="Please enter a valid email" ControlToValidate="txtEmail" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="vglogin"></asp:RegularExpressionValidator> <%--<input name="Please enter the required quantity3" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Amount:</td> <td> <asp:TextBox ID="txtAmount" runat="server" class="forum_visa"></asp:TextBox> <%--<input name="Please enter the required quantity4" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Card No.:</td> <td> <asp:TextBox ID="txtCardNo" runat="server" class="forum_visa"></asp:TextBox> <%--<input name="Please enter the required quantity5" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>&nbsp;</td> <td width="150"> <cc1:CaptchaControl ID="Captcha1" runat="server" CaptchaBackgroundNoise="High" CaptchaLength="5" CaptchaHeight="38" CaptchaWidth="150" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" FontColor = "#B8B8B8" Font-Size="Smaller" NoiseColor="#999999" BorderWidth="20px" BackColor="#F9F9F9" Width="150" CaptchaChars="012346789" /> <%--<img src="images/sample_captcha.jpg" width="150" height="38" />--%></td> </tr> <tr> <td>Captcha:</td> <td> <asp:TextBox ID="txtCaptcha" runat="server" CssClass="forum_visa"></asp:TextBox> <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label> <%--<input name="Please enter the required quantity6" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>&nbsp;</td> <td align="center"><a href="#"> <asp:ImageButton ID="imgbtnSubmit" runat="server" src="images/submit.jpg" OnClick="imgbtnSubmit_Click" ValidationGroup="vglogin"/> <%--<img src="images/submit.jpg" width="63" height="22" />--%></a></td> </tr> </table> </div> </div> </asp:WizardStep> <asp:WizardStep ID="PurchaseCardWizardStep2" runat="server" Title=""> <div id="MainContent01"> <div class="checkout"> <h1><span>Cards</span> Details Entry</h1> <h3>Kuwait International Bank [KIB], a bank that operates according to the Islamic Shari’ah from 1st of July 2007, is a public quoted company. It was incorporated in 1973 and was originally known as the Kuwait Real Estate Bank.</h3> <asp:Label ID="testing" runat="server" Text="Hai"></asp:Label> <asp:Repeater ID="rptrCards" runat="server"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <asp:Label runat="server" ID="test" Text=""></asp:Label> <%-- <div class='<%= (counter++) % 2 ? "card_hedd" : "card_hedd00"%>'>--%> <div class="card_hedd"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="card_hedd_1"> <tr> <td width="4%">&nbsp;</td> <td width="60%"> <asp:Label ID="lblcardName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cardName") %>'></asp:Label> </td> <td width="25%"><p>Required Quantity: <asp:Label ID="lblQuantity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity")%>'></asp:Label></p></td> </tr> </table> </div> <div class="req_hedd1"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="subheadd_1"> <tr> <td width="4%">&nbsp;</td> <td width="29%">Select your amount per card:</td> <td width="31%">Enter Name:</td> <td width="36%">Fees:</td> </tr> </table> </div> <asp:Repeater ID="rptrNoCards" runat="server"> <HeaderTemplate> <div class="req_details1"> </HeaderTemplate> <ItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="req_table"> <tr> <td width="2%">&nbsp;</td> <td width="30%"><select class="forum_req_drop" > <option>Select One</option> <option>Select One</option> <option>Select One</option> </select></td> <td width="33%"><input name="Please enter the required quantity" type="text" class="forum_req" /></td> <td width="13%"><%# DataBinder.Eval(Container.Parent.Parent, "cardFees")%></td> <td width="20%"><img src="images/dupli_1.jpg" width="70" height="22" /></td> <td width="2%"><img src="images/del_1.jpg" width="17" height="15" /></td> </tr> </table> </ItemTemplate> <FooterTemplate> </div> </FooterTemplate> </asp:Repeater> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater> </div> </div> </asp:WizardStep> </WizardSteps> <StartNavigationTemplate> <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Next" Visible="false"/> </StartNavigationTemplate> <StepNavigationTemplate> <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" Visible="false"/> <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" Visible="false"/> </StepNavigationTemplate> </asp:Wizard> Code behind file: using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class PurchaseCard : System.Web.UI.Page { DataTable dt = new DataTable(); DataTable dt1=new DataTable(); PurchaseCardClass pcObj = new PurchaseCardClass(); protected System.Web.UI.WebControls.TextBox m_MyTextBox; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Request["ImageButton1"] != null) { testing.Text = "Nothing working"; rptrCards_bind(); } } else rptrCardTypes_bind(); } public void rptrCardTypes_bind() { dt = pcObj.getCardsDetails(); rptrCardTypes.DataSource = dt; rptrCardTypes.DataBind(); } public void rptrCards_bind() { string cardname = ""; dt = new DataTable(); testing.Text = "Nothing working"; foreach (RepeaterItem item in rptrCardTypes.Items) { DataTable dttemp = new DataTable(); testing.Text = "Nothing working"; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { TextBox txttemp = (TextBox)item.FindControl("txtRequiredQuantity1"); testing.Text = "Nothing working"; if (txttemp.Text != "0" && txttemp != null) { //int num = Convert.ToInt16(txttemp.Text); Label lbltemp = (Label)item.FindControl("testId"); cardname = lbltemp.Text; dttemp = pcObj.fillGvCardDetails(cardname); dttemp.Columns.Add("Quantity"); //gvCardsDetails.DataBind(); foreach (DataRow dr in dttemp.Rows) { dr["Quantity"] = txttemp.Text; } dt.Merge(dttemp); testing.Text = "Successfull"; } else { testing.Text = "Not Successfull"; } } } rptrCards.DataSource = dt; rptrCards.DataBind(); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { PurchaseCardWizard.MoveTo(PurchaseCardWizardStep2); } }
asp-classic
wizard
null
null
null
null
open
values of textbox in a repeater disappears on clicking next button of asp:wizard === I am having problem with asp:wizard. I have a textbox within a repeater in step1 of asp:wizard. The user enters values in the textbox. Based on this value data has to be populated in another repeater in step2 of wizard. But on clicking the next button, I dont get the next repeater populated depending on the textbox value of the first repeater. This is the code of my wizard: <asp:Wizard ID="PurchaseCardWizard" runat="server" DisplaySideBar="False"> <WizardSteps> <asp:WizardStep ID="PurchaseCardWizardStep1" runat="server" Title=""> <div id="FlashBanner"> <iframe src="banner.html" scrolling="no" frameborder="0" width="987" height="270" allowtransparency="true"></iframe> </div> <div class="clear"></div> <div id="MainContent"> <div class="leftmain"> <h1><span>visa</span> prepaid cards</h1> <asp:Repeater ID="rptrCardTypes" runat="server"> <ItemTemplate> <div class="visa_box"> <div class="visabox-1"> <asp:Image ID="cardImage" runat="server" Width="179" Height="114" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "cardPicture") %>' /> <%--<img src="images/visa-1.jpg" width="179" height="114" />--%> <%--<img src='images/<%# DataBinder.Eval(Container.DataItem, "cardPicture") %>' width="179" height="114" />--%> </div> <div class="visabox-2"> <asp:Label ID="testId" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cardName") %>'></asp:Label> <%--<h2><%# DataBinder.Eval(Container.DataItem, "cardName") %></h2>--%> <p>You can use this card to pay anytime any place worldwide where Visa is accepted. You can buy online tickets, make online hotel reservations, shop and pay your bills online and also withdraw cash from any visa ATM</p> <div class="visabox-input"> <asp:TextBox ID="txtRequiredQuantity1" runat="server" class="num_visa" Text="" ></asp:TextBox> <p>Please enter the required quantity</p> </div> </div> </div> </ItemTemplate> </asp:Repeater> <div class="button_visa"> <div class="butt"> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/button.jpg" Height="22" Width="63" OnClick="ImageButton1_Click" /> </div> </div> </div> <div class="right_cont"> <div class="right_hedd"><img src="images/right_hedd.jpg" width="292" height="25" /></div> <div class="right_forum"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="right_form"> <tr> <td colspan="2">Please enter the required information</td> </tr> <tr> <td width="27%">Name:</td> <td width="73%"> <asp:TextBox ID="txtName" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvalidatorName" runat="server" ErrorMessage="Please enter your name" Display="Dynamic" ControlToValidate="txtName" style="font:normal 12px/16px arial;" ValidationGroup="vglogin"> </asp:RequiredFieldValidator> </td> </tr> <tr> <td>Civil Id:</td> <td> <asp:TextBox ID="txtCivilID" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvalidatorCivilID" runat="server" ErrorMessage="Please enter your Civil ID" Display="Dynamic" ControlToValidate="txtCivilID" ValidationGroup="vglogin"></asp:RequiredFieldValidator> <%--<input name="Please enter the required quantity2" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Email:</td> <td> <asp:TextBox ID="txtEmail" runat="server" class="forum_visa"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please enter your email" Display="Dynamic" ControlToValidate="txtEmail" ValidationGroup="vglogin"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="revalidatorEmail" runat="server" ErrorMessage="Please enter a valid email" ControlToValidate="txtEmail" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="vglogin"></asp:RegularExpressionValidator> <%--<input name="Please enter the required quantity3" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Amount:</td> <td> <asp:TextBox ID="txtAmount" runat="server" class="forum_visa"></asp:TextBox> <%--<input name="Please enter the required quantity4" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>Card No.:</td> <td> <asp:TextBox ID="txtCardNo" runat="server" class="forum_visa"></asp:TextBox> <%--<input name="Please enter the required quantity5" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>&nbsp;</td> <td width="150"> <cc1:CaptchaControl ID="Captcha1" runat="server" CaptchaBackgroundNoise="High" CaptchaLength="5" CaptchaHeight="38" CaptchaWidth="150" CaptchaMinTimeout="5" CaptchaMaxTimeout="240" FontColor = "#B8B8B8" Font-Size="Smaller" NoiseColor="#999999" BorderWidth="20px" BackColor="#F9F9F9" Width="150" CaptchaChars="012346789" /> <%--<img src="images/sample_captcha.jpg" width="150" height="38" />--%></td> </tr> <tr> <td>Captcha:</td> <td> <asp:TextBox ID="txtCaptcha" runat="server" CssClass="forum_visa"></asp:TextBox> <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label> <%--<input name="Please enter the required quantity6" type="text" class="forum_visa" />--%></td> </tr> <tr> <td>&nbsp;</td> <td align="center"><a href="#"> <asp:ImageButton ID="imgbtnSubmit" runat="server" src="images/submit.jpg" OnClick="imgbtnSubmit_Click" ValidationGroup="vglogin"/> <%--<img src="images/submit.jpg" width="63" height="22" />--%></a></td> </tr> </table> </div> </div> </asp:WizardStep> <asp:WizardStep ID="PurchaseCardWizardStep2" runat="server" Title=""> <div id="MainContent01"> <div class="checkout"> <h1><span>Cards</span> Details Entry</h1> <h3>Kuwait International Bank [KIB], a bank that operates according to the Islamic Shari’ah from 1st of July 2007, is a public quoted company. It was incorporated in 1973 and was originally known as the Kuwait Real Estate Bank.</h3> <asp:Label ID="testing" runat="server" Text="Hai"></asp:Label> <asp:Repeater ID="rptrCards" runat="server"> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <asp:Label runat="server" ID="test" Text=""></asp:Label> <%-- <div class='<%= (counter++) % 2 ? "card_hedd" : "card_hedd00"%>'>--%> <div class="card_hedd"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="card_hedd_1"> <tr> <td width="4%">&nbsp;</td> <td width="60%"> <asp:Label ID="lblcardName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "cardName") %>'></asp:Label> </td> <td width="25%"><p>Required Quantity: <asp:Label ID="lblQuantity" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Quantity")%>'></asp:Label></p></td> </tr> </table> </div> <div class="req_hedd1"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="subheadd_1"> <tr> <td width="4%">&nbsp;</td> <td width="29%">Select your amount per card:</td> <td width="31%">Enter Name:</td> <td width="36%">Fees:</td> </tr> </table> </div> <asp:Repeater ID="rptrNoCards" runat="server"> <HeaderTemplate> <div class="req_details1"> </HeaderTemplate> <ItemTemplate> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="req_table"> <tr> <td width="2%">&nbsp;</td> <td width="30%"><select class="forum_req_drop" > <option>Select One</option> <option>Select One</option> <option>Select One</option> </select></td> <td width="33%"><input name="Please enter the required quantity" type="text" class="forum_req" /></td> <td width="13%"><%# DataBinder.Eval(Container.Parent.Parent, "cardFees")%></td> <td width="20%"><img src="images/dupli_1.jpg" width="70" height="22" /></td> <td width="2%"><img src="images/del_1.jpg" width="17" height="15" /></td> </tr> </table> </ItemTemplate> <FooterTemplate> </div> </FooterTemplate> </asp:Repeater> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater> </div> </div> </asp:WizardStep> </WizardSteps> <StartNavigationTemplate> <asp:Button ID="StartNextButton" runat="server" CommandName="MoveNext" Text="Next" Visible="false"/> </StartNavigationTemplate> <StepNavigationTemplate> <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" Visible="false"/> <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="Next" Visible="false"/> </StepNavigationTemplate> </asp:Wizard> Code behind file: using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; public partial class PurchaseCard : System.Web.UI.Page { DataTable dt = new DataTable(); DataTable dt1=new DataTable(); PurchaseCardClass pcObj = new PurchaseCardClass(); protected System.Web.UI.WebControls.TextBox m_MyTextBox; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Request["ImageButton1"] != null) { testing.Text = "Nothing working"; rptrCards_bind(); } } else rptrCardTypes_bind(); } public void rptrCardTypes_bind() { dt = pcObj.getCardsDetails(); rptrCardTypes.DataSource = dt; rptrCardTypes.DataBind(); } public void rptrCards_bind() { string cardname = ""; dt = new DataTable(); testing.Text = "Nothing working"; foreach (RepeaterItem item in rptrCardTypes.Items) { DataTable dttemp = new DataTable(); testing.Text = "Nothing working"; if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { TextBox txttemp = (TextBox)item.FindControl("txtRequiredQuantity1"); testing.Text = "Nothing working"; if (txttemp.Text != "0" && txttemp != null) { //int num = Convert.ToInt16(txttemp.Text); Label lbltemp = (Label)item.FindControl("testId"); cardname = lbltemp.Text; dttemp = pcObj.fillGvCardDetails(cardname); dttemp.Columns.Add("Quantity"); //gvCardsDetails.DataBind(); foreach (DataRow dr in dttemp.Rows) { dr["Quantity"] = txttemp.Text; } dt.Merge(dttemp); testing.Text = "Successfull"; } else { testing.Text = "Not Successfull"; } } } rptrCards.DataSource = dt; rptrCards.DataBind(); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { PurchaseCardWizard.MoveTo(PurchaseCardWizardStep2); } }
0
11,628,007
07/24/2012 09:33:06
1,463,384
06/18/2012 10:23:53
165
11
Split String[] to make different JSON
I would like to know how i can split this using jquery... "{"answer":["q1001-a2","q1002-a2","q1003-a2","q1004-a2","q1005-a2","q1006-a2"]}" So i can then make the following JSON... { "d": [ { "question": 1001, "answer": "a2" }, { "question": 1002, "answer": "a2" } ] } Thanks.
jquery
json
null
null
null
null
open
Split String[] to make different JSON === I would like to know how i can split this using jquery... "{"answer":["q1001-a2","q1002-a2","q1003-a2","q1004-a2","q1005-a2","q1006-a2"]}" So i can then make the following JSON... { "d": [ { "question": 1001, "answer": "a2" }, { "question": 1002, "answer": "a2" } ] } Thanks.
0
11,628,023
07/24/2012 09:33:59
1,017,882
10/28/2011 07:13:21
1,223
36
Do I have access to a counter variable inside .Aggregate?
I'm using `.Aggregate` on a `List<String>` to concatenate each item. I need to find out when the iteration has hit the last item. I was considering testing `listOfStrings.Last() == currentString` but the last item in the list *could* equal any other if the value is the same.
c#
string
list
aggregate
null
null
open
Do I have access to a counter variable inside .Aggregate? === I'm using `.Aggregate` on a `List<String>` to concatenate each item. I need to find out when the iteration has hit the last item. I was considering testing `listOfStrings.Last() == currentString` but the last item in the list *could* equal any other if the value is the same.
0
11,628,025
07/24/2012 09:34:07
792,700
06/10/2011 11:54:38
139
20
mysql_fetch_array or mysql_fetch_object for python?
I'm using MySQLdb in python to connect to a mysql database (duh) and am really missing the functionality that's built into PHP, namely: `mysql_fetch_array` and `mysql_fetch_object` What is the equivalent in Python so that I can start getting my scripts ported?
php
python
mysql
null
null
07/25/2012 12:08:19
not a real question
mysql_fetch_array or mysql_fetch_object for python? === I'm using MySQLdb in python to connect to a mysql database (duh) and am really missing the functionality that's built into PHP, namely: `mysql_fetch_array` and `mysql_fetch_object` What is the equivalent in Python so that I can start getting my scripts ported?
1
11,628,027
07/24/2012 09:34:23
1,096,710
12/13/2011 22:24:25
39
4
Function-based index when not using index access
I'm using a function-based index with a user-defined function for the first time, and have stumbled across a performance problem when the index can't be used. Internally, a function-based index seems to generate a hidden table column (of type varchar2(4000), since my function returns a varchar2), and indexes that. That works fine when the index is used, but sometimes we have to do a full table scan using the function as a filter, and in that case I see a performance degradation by a factor of 6. Seems in that case, Oracle does not use the hidden column, but recomputes the function for each row, make the query CPU-bound instead of IO-bound. Is there a way to make Oracle use that hidden column also for filtering? I wonder if I'm missing some rewrite options or something along those lines. If not, I'll have to define the column myself and using a trigger to keep it up to date. I'd prefer using the function-based index for transparency and easier maintanance.
oracle
index
user-defined-functions
null
null
null
open
Function-based index when not using index access === I'm using a function-based index with a user-defined function for the first time, and have stumbled across a performance problem when the index can't be used. Internally, a function-based index seems to generate a hidden table column (of type varchar2(4000), since my function returns a varchar2), and indexes that. That works fine when the index is used, but sometimes we have to do a full table scan using the function as a filter, and in that case I see a performance degradation by a factor of 6. Seems in that case, Oracle does not use the hidden column, but recomputes the function for each row, make the query CPU-bound instead of IO-bound. Is there a way to make Oracle use that hidden column also for filtering? I wonder if I'm missing some rewrite options or something along those lines. If not, I'll have to define the column myself and using a trigger to keep it up to date. I'd prefer using the function-based index for transparency and easier maintanance.
0
11,628,028
07/24/2012 09:34:24
306,709
04/01/2010 08:46:13
121
7
Thin::Server#daemonize exits immediately
I trying to make an executable, which starts a Sinatra application via Thin as a daemon. I am using this code to invoke Thin with the Sinatra app: #!/usr/bin/env ruby require 'thin' require 'app.rb' server = ::Thin::Server.new('127.0.0.1', 9999, App) server.log_file = 'tmp/thin.log' server.pid_file = 'tmp/thin.pid' server.daemonize Here is the log output I get when I execute the script: >> Writing PID to tmp/thin.pid >> Exiting! The server starts fine when I do server.start Any suggestions how I track down why it exits immediately?
ruby
sinatra
thin
null
null
null
open
Thin::Server#daemonize exits immediately === I trying to make an executable, which starts a Sinatra application via Thin as a daemon. I am using this code to invoke Thin with the Sinatra app: #!/usr/bin/env ruby require 'thin' require 'app.rb' server = ::Thin::Server.new('127.0.0.1', 9999, App) server.log_file = 'tmp/thin.log' server.pid_file = 'tmp/thin.pid' server.daemonize Here is the log output I get when I execute the script: >> Writing PID to tmp/thin.pid >> Exiting! The server starts fine when I do server.start Any suggestions how I track down why it exits immediately?
0
11,628,029
07/24/2012 09:34:34
1,548,192
07/24/2012 09:27:40
1
0
android device use qcom demo code to decode h264 in GB crashed
I use the qcom demo [here][1] to decode h264 on android device .but when I was in the GB system does not decode output..I use the apk app,named Qcom iOMX cam Test. Encoding is normal in Gingerbread,only decoding crashed. who know what should i do? [1]: https://developer.qualcomm.com/download/qcomvideocodecsample131.zip
android
video
android-ndk
codec
null
null
open
android device use qcom demo code to decode h264 in GB crashed === I use the qcom demo [here][1] to decode h264 on android device .but when I was in the GB system does not decode output..I use the apk app,named Qcom iOMX cam Test. Encoding is normal in Gingerbread,only decoding crashed. who know what should i do? [1]: https://developer.qualcomm.com/download/qcomvideocodecsample131.zip
0
11,471,711
07/13/2012 13:44:16
716,999
04/20/2011 11:06:47
333
5
ADO.NET Entity Framework In A COM Visible C# Class Library
I have a C# class library which I have made COM visible so I can also call it from legacy applications written in Visual Studio 6. This library has an Entity Framework in it for adding records to a database. Calling the library via COM works but the records do not get added to the database. I decided that the easiest way to debug this would be to add a C# WinForms test app to the library solution. This is where I noticed that the Entity Framework was failing here too. It turns out this is due to the app.config connection string in the library needing to be part of the test application too. That's fine and doing that means that the WinForms app works correctly and the records are added to the database. However, how can I also fix this for calls via COM from legacy apps? Obviously they don't have an app.config.
c#
com
ado.net
null
null
null
open
ADO.NET Entity Framework In A COM Visible C# Class Library === I have a C# class library which I have made COM visible so I can also call it from legacy applications written in Visual Studio 6. This library has an Entity Framework in it for adding records to a database. Calling the library via COM works but the records do not get added to the database. I decided that the easiest way to debug this would be to add a C# WinForms test app to the library solution. This is where I noticed that the Entity Framework was failing here too. It turns out this is due to the app.config connection string in the library needing to be part of the test application too. That's fine and doing that means that the WinForms app works correctly and the records are added to the database. However, how can I also fix this for calls via COM from legacy apps? Obviously they don't have an app.config.
0
11,471,752
07/13/2012 13:45:49
1,511,098
07/09/2012 05:48:24
11
0
Image mapping in html. When i hover , want to display link name?
I am working on image mapping . I used above code in image i got link in different parts of images , but when i hover i want to get alt name . how can i do this ? thank you in advance .`<map id="rade_img_map_1342182469821" name="rade_img_map_1342182469821"><area shape="CIRCLE" coords="121,198,15" href="http://Portfolio.com" target="_blank" alt="Portfolio" /></map>.`
html
null
null
null
null
null
open
Image mapping in html. When i hover , want to display link name? === I am working on image mapping . I used above code in image i got link in different parts of images , but when i hover i want to get alt name . how can i do this ? thank you in advance .`<map id="rade_img_map_1342182469821" name="rade_img_map_1342182469821"><area shape="CIRCLE" coords="121,198,15" href="http://Portfolio.com" target="_blank" alt="Portfolio" /></map>.`
0
11,471,753
07/13/2012 13:45:55
429,751
08/24/2010 15:54:56
309
17
Pass JavaScript function in ajax response
I'm trying to return a callback from an AJAX submitted form. The user submits a form, the server processes and returns the valid response, i.e. an error message and also a JavaScript function that could perform an action. I'm using Zepto.js faling back to jQuery depending on browser. My ajax request is: $.ajax({ success: function(data, status, xhr) { data.callback(); }, url: form.attr('action'), data: form.serialize(), dataType: 'json' }); On the server I want to return something like: // PHP code ?> { return: false, error: 'Sorry, we couldn’t find an account with that username or password.', callback: function() { console.log('this is the callback'); } } <?php // more PHP code When returned to the browser callback function should fire. I want the server to return the callback so I can use the same JavaScript code and have it respond accordingly to the server response. Would I need to change the dataType to script? However I thought this was just for loading .js files, not blocks of code. Any help appreciated. Thanks Ric
javascript
ajax
json
callback
null
null
open
Pass JavaScript function in ajax response === I'm trying to return a callback from an AJAX submitted form. The user submits a form, the server processes and returns the valid response, i.e. an error message and also a JavaScript function that could perform an action. I'm using Zepto.js faling back to jQuery depending on browser. My ajax request is: $.ajax({ success: function(data, status, xhr) { data.callback(); }, url: form.attr('action'), data: form.serialize(), dataType: 'json' }); On the server I want to return something like: // PHP code ?> { return: false, error: 'Sorry, we couldn’t find an account with that username or password.', callback: function() { console.log('this is the callback'); } } <?php // more PHP code When returned to the browser callback function should fire. I want the server to return the callback so I can use the same JavaScript code and have it respond accordingly to the server response. Would I need to change the dataType to script? However I thought this was just for loading .js files, not blocks of code. Any help appreciated. Thanks Ric
0
11,471,781
07/13/2012 13:47:26
1,220,627
02/20/2012 09:17:32
89
5
Basic Waypoint usage
I'm trying to use the [Waypoints][1] plugin for jQuery to lazy load elements on a webpage. However I can't get it to work. :( I made a very basic example: http://jsfiddle.net/P3XnN/2/ According to the Waypoints documentation all I need to do is the following. **JS:** $('#waypoint').waypoint(function() { alert('You have scrolled to my waypoint.'); }); **HTML:** <div style="height: 500px">Scroll down</div> <div id="waypoint">Waypoint</div> But it isn't as simple as that apparently. Please help. [1]: http://imakewebthings.com/jquery-waypoints/
jquery
jquery-plugins
lazy-loading
null
null
null
open
Basic Waypoint usage === I'm trying to use the [Waypoints][1] plugin for jQuery to lazy load elements on a webpage. However I can't get it to work. :( I made a very basic example: http://jsfiddle.net/P3XnN/2/ According to the Waypoints documentation all I need to do is the following. **JS:** $('#waypoint').waypoint(function() { alert('You have scrolled to my waypoint.'); }); **HTML:** <div style="height: 500px">Scroll down</div> <div id="waypoint">Waypoint</div> But it isn't as simple as that apparently. Please help. [1]: http://imakewebthings.com/jquery-waypoints/
0
11,468,060
07/13/2012 09:48:39
1,491,210
06/29/2012 12:56:28
30
0
Ignore arborescence in a zip and extract in root with DotNetZip
I have a password protected zipped file which contains another pw zipped file and I want to retrieve a xml file under a folder 0 inside the second zip. But I would like to have this xml in the root folder (args[0]), Do you have an idea ? It is always extracting in root/0/project.xml and I want root/project.xml actually I want the xml in the same folder than the first zip. using (ZipFile zip = ZipFile.Read(args[0])) { zip.Password = "pass1"; zip.ExtractAll(".",ExtractExistingFileAction.OverwriteSilently); using (ZipFile zip2 = ZipFile.Read("0.xtz")) { ZipEntry e = zip2["0/project.xml"]; e.ExtractWithPassword(".", ExtractExistingFileAction.OverwriteSilently, "pass2"); } }
c#
dotnetzip
null
null
null
null
open
Ignore arborescence in a zip and extract in root with DotNetZip === I have a password protected zipped file which contains another pw zipped file and I want to retrieve a xml file under a folder 0 inside the second zip. But I would like to have this xml in the root folder (args[0]), Do you have an idea ? It is always extracting in root/0/project.xml and I want root/project.xml actually I want the xml in the same folder than the first zip. using (ZipFile zip = ZipFile.Read(args[0])) { zip.Password = "pass1"; zip.ExtractAll(".",ExtractExistingFileAction.OverwriteSilently); using (ZipFile zip2 = ZipFile.Read("0.xtz")) { ZipEntry e = zip2["0/project.xml"]; e.ExtractWithPassword(".", ExtractExistingFileAction.OverwriteSilently, "pass2"); } }
0
11,468,061
07/13/2012 09:48:42
1,506,541
07/06/2012 11:09:32
1
0
user specific properties liferay api
Goodmorning everyone. I am looking for class which enable me manage a user specific properties. In my portal different users have different properties so how i can make it using liferay api. For example i can show u how it works in jboss Portal. `Map<String, Object> properties = this.userProfileModule.getProperties(portalUser);` and from other side we can add some new properties like that : `this.userProfileModule.setProperty(user, name, value);` i need such mechanism so i will be glad for any help. thanks in advance
properties
user
liferay
null
null
null
open
user specific properties liferay api === Goodmorning everyone. I am looking for class which enable me manage a user specific properties. In my portal different users have different properties so how i can make it using liferay api. For example i can show u how it works in jboss Portal. `Map<String, Object> properties = this.userProfileModule.getProperties(portalUser);` and from other side we can add some new properties like that : `this.userProfileModule.setProperty(user, name, value);` i need such mechanism so i will be glad for any help. thanks in advance
0
11,471,782
07/13/2012 13:47:33
1,431,288
06/01/2012 17:44:40
66
3
VBA Excel-Addressing a Dynamic Named Range inside of Select Case
I am building a page where Col H should be a drop down box which is dependent on Col A. Col A is already set up to use Validation List using a Dynamic Named Range which is specified on a hidden sheet named Data. Also, on the Data sheet, I have specified the 3 lists which are dependent on Col A and have already made them a Dynamic Named Range as well. So far, in VB code, I have 1) Taken the first word, before a comma, from the selection made in Col A and used that as my "Group" identifier. 2) Capitalized all text inputted to Col B (not relevant). Now, I need to specify what to make as possible selections in Col H. You can see in the case "Desktop" my attempt to do this, however, it does not work and gives me an "Object Required" error. > The Code Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo Whoa Application.EnableEvents = False If Not Intersect(Target, Columns(1)) Is Nothing Then If Target.Value <> "" And InStr(1, Target.Value, ",") Then Select Case Split(Target.Value, ",")(0) Case "Desktop": Range("H" & Target.row).Value = Data.Range("List_Desktops").Address Case "Laptop": Range("H" & Target.row).Value = "Laptop" Case "Server": Range("H" & Target.row).Value = "Server" Case Else: Range("H" & Target.row).Value = "N/A" End Select End If ElseIf Not Intersect(Target, Columns(2)) Is Nothing Then If Not Target.HasFormula Then Target.Value = UCase(Target.Value) End If LetsContinue: Application.EnableEvents = True Exit Sub Whoa: MsgBox Err.Description Resume LetsContinue End Sub
excel-vba
excel-2010
null
null
null
null
open
VBA Excel-Addressing a Dynamic Named Range inside of Select Case === I am building a page where Col H should be a drop down box which is dependent on Col A. Col A is already set up to use Validation List using a Dynamic Named Range which is specified on a hidden sheet named Data. Also, on the Data sheet, I have specified the 3 lists which are dependent on Col A and have already made them a Dynamic Named Range as well. So far, in VB code, I have 1) Taken the first word, before a comma, from the selection made in Col A and used that as my "Group" identifier. 2) Capitalized all text inputted to Col B (not relevant). Now, I need to specify what to make as possible selections in Col H. You can see in the case "Desktop" my attempt to do this, however, it does not work and gives me an "Object Required" error. > The Code Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo Whoa Application.EnableEvents = False If Not Intersect(Target, Columns(1)) Is Nothing Then If Target.Value <> "" And InStr(1, Target.Value, ",") Then Select Case Split(Target.Value, ",")(0) Case "Desktop": Range("H" & Target.row).Value = Data.Range("List_Desktops").Address Case "Laptop": Range("H" & Target.row).Value = "Laptop" Case "Server": Range("H" & Target.row).Value = "Server" Case Else: Range("H" & Target.row).Value = "N/A" End Select End If ElseIf Not Intersect(Target, Columns(2)) Is Nothing Then If Not Target.HasFormula Then Target.Value = UCase(Target.Value) End If LetsContinue: Application.EnableEvents = True Exit Sub Whoa: MsgBox Err.Description Resume LetsContinue End Sub
0
11,471,797
07/13/2012 13:48:05
1,523,696
07/13/2012 13:36:26
1
0
C programming. Using execl and pthread
I'm having a problem in the combined use of execl() and pthread. My idea is quite simple: write a daemon that in certain situation starts an external process (a separate executable with respect to the daemon itself) and wait for the return value of that process. Moreover I want to have the possibility to start multiple instances of the same process at the same time. The part of my code to handle multiple threads: ... for (c_thread=0,i=0;i<N;i++) { /* Start actions before start threads */ for (j=c_thread;j<c_thread+config.max_threads;j++) Before_Process(act[act_index[j]].measID); /* Now create threads */ for (c=0,j=c_thread;j<c_thread+config.max_threads;j++) { Print_Log(LOG_DEBUG,"Create tread n. %d, measurementID=%s",c,act[act_index[j]].measID); if ((ret=pthread_create(&pth[c],NULL,Start_Process_Thread,(void *) &act[act_index[j]].measID))) { Print_Log(LOG_ERR,"Error in creating thread (errorcode: %d)",ret); exit(EXIT_FAILURE); } c++; } /* Joint threads */ for (j=0;j<config.max_threads;j++) { if ((ret=pthread_join(pth[j], (void**) &r_value[j]))) { Print_Log(LOG_ERR,"Error in joint thread (errorcode: %d)",ret); exit(EXIT_FAILURE); } } /* Perform actions after the thread */ for (j=0;j<config.max_threads;j++) { status=*(int*) r_value[j]; Print_Log(LOG_DEBUG,"Joint tread n. %d. Return value=%d",j,status); After_Process(act[act_index[c_thread+j]].measID,status); } c_thread += config.max_threads; } ... And the function Start_Process_Thread: void *Start_Process_Thread(void *arg) { int *ret; char *measID; measID=(char*)arg; if (!(ret=malloc(sizeof(int)))) { Print_Log(LOG_ERR, "allocation memory failed, code=%d (%s)", errno, strerror(errno) ); exit(EXIT_FAILURE); } *ret=Start_Process(measID); pthread_exit(ret); } int Start_Process(char *measID) { ... pipe(pfd); pid=fork(); if (!pid) { signal(SIGALRM,Timeout); alarm(config.timeout_process); flag=0; /* Start the Process. */ ret=execl(config.pre_processor,buff_list[TokCount-1],config.db_name,measID,(char *) 0); if (ret==-1) { alarm(0); flag=1; Print_Log(LOG_ERR,"Cannot run script %s, code=%d (%s)",config.process, errno, strerror(errno)); } alarm(0); close(1); close(pfd[0]); dup2(pfd[1],1); write(1,&flag,sizeof(int)); } else { wait(&status); close(pfd[1]); read(pfd[0],&flag,sizeof(int)); close(pfd[0]); if (!flag) { if (WIFEXITED(status)) { if (!(return_value=WEXITSTATUS(status))) { /* Process gives no errors. */ Print_Log(LOG_INFO, "Processing of measurementID=%s ended succesfully!",measID); } else { /* Process gives errors. */ Print_Log(LOG_WARNING,"Processor failed for measurementID=%s, code=%d",measID, return_value); } } else { /* Timeout for Process */ Print_Log( LOG_WARNING,"Timeout occurred in processing measurementID=%s",measID); return_value=255; } } } } The above code works fine from technical point of view but I have a problem somewhere in handling the return values of the different instances of the called external process. In particular it happens that the return value associated to a certain instance is attributed to a different one randomly. For example suppose 4 different instances of the external process are called with the arguments meas1, meas2, meas3 and meas4 respectively and suppose that meas1, meas2 and meas3 are successfully processed and that for meas4 the process fails. In situation like that my code mix up the return vales giving success for meas1, meas3, and meas4 and failure for meas2 or success for meas1, meas2, meas4 and failure for meas3. Any idea on why this can happens? Any help is really welcome. Thank you in advance for your attention.
c
pthreads
null
null
null
null
open
C programming. Using execl and pthread === I'm having a problem in the combined use of execl() and pthread. My idea is quite simple: write a daemon that in certain situation starts an external process (a separate executable with respect to the daemon itself) and wait for the return value of that process. Moreover I want to have the possibility to start multiple instances of the same process at the same time. The part of my code to handle multiple threads: ... for (c_thread=0,i=0;i<N;i++) { /* Start actions before start threads */ for (j=c_thread;j<c_thread+config.max_threads;j++) Before_Process(act[act_index[j]].measID); /* Now create threads */ for (c=0,j=c_thread;j<c_thread+config.max_threads;j++) { Print_Log(LOG_DEBUG,"Create tread n. %d, measurementID=%s",c,act[act_index[j]].measID); if ((ret=pthread_create(&pth[c],NULL,Start_Process_Thread,(void *) &act[act_index[j]].measID))) { Print_Log(LOG_ERR,"Error in creating thread (errorcode: %d)",ret); exit(EXIT_FAILURE); } c++; } /* Joint threads */ for (j=0;j<config.max_threads;j++) { if ((ret=pthread_join(pth[j], (void**) &r_value[j]))) { Print_Log(LOG_ERR,"Error in joint thread (errorcode: %d)",ret); exit(EXIT_FAILURE); } } /* Perform actions after the thread */ for (j=0;j<config.max_threads;j++) { status=*(int*) r_value[j]; Print_Log(LOG_DEBUG,"Joint tread n. %d. Return value=%d",j,status); After_Process(act[act_index[c_thread+j]].measID,status); } c_thread += config.max_threads; } ... And the function Start_Process_Thread: void *Start_Process_Thread(void *arg) { int *ret; char *measID; measID=(char*)arg; if (!(ret=malloc(sizeof(int)))) { Print_Log(LOG_ERR, "allocation memory failed, code=%d (%s)", errno, strerror(errno) ); exit(EXIT_FAILURE); } *ret=Start_Process(measID); pthread_exit(ret); } int Start_Process(char *measID) { ... pipe(pfd); pid=fork(); if (!pid) { signal(SIGALRM,Timeout); alarm(config.timeout_process); flag=0; /* Start the Process. */ ret=execl(config.pre_processor,buff_list[TokCount-1],config.db_name,measID,(char *) 0); if (ret==-1) { alarm(0); flag=1; Print_Log(LOG_ERR,"Cannot run script %s, code=%d (%s)",config.process, errno, strerror(errno)); } alarm(0); close(1); close(pfd[0]); dup2(pfd[1],1); write(1,&flag,sizeof(int)); } else { wait(&status); close(pfd[1]); read(pfd[0],&flag,sizeof(int)); close(pfd[0]); if (!flag) { if (WIFEXITED(status)) { if (!(return_value=WEXITSTATUS(status))) { /* Process gives no errors. */ Print_Log(LOG_INFO, "Processing of measurementID=%s ended succesfully!",measID); } else { /* Process gives errors. */ Print_Log(LOG_WARNING,"Processor failed for measurementID=%s, code=%d",measID, return_value); } } else { /* Timeout for Process */ Print_Log( LOG_WARNING,"Timeout occurred in processing measurementID=%s",measID); return_value=255; } } } } The above code works fine from technical point of view but I have a problem somewhere in handling the return values of the different instances of the called external process. In particular it happens that the return value associated to a certain instance is attributed to a different one randomly. For example suppose 4 different instances of the external process are called with the arguments meas1, meas2, meas3 and meas4 respectively and suppose that meas1, meas2 and meas3 are successfully processed and that for meas4 the process fails. In situation like that my code mix up the return vales giving success for meas1, meas3, and meas4 and failure for meas2 or success for meas1, meas2, meas4 and failure for meas3. Any idea on why this can happens? Any help is really welcome. Thank you in advance for your attention.
0
11,650,482
07/25/2012 13:11:09
492,336
10/30/2010 18:57:47
2,136
110
How to disable the register DLL build step of my DLL project in VS2008?
I'm getting this error error PRJ0050: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. I don't really need to register the DLL as part of the build, where can I disable that step from the project configuration?
visual-studio-2008
null
null
null
null
null
open
How to disable the register DLL build step of my DLL project in VS2008? === I'm getting this error error PRJ0050: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. I don't really need to register the DLL as part of the build, where can I disable that step from the project configuration?
0
11,650,486
07/25/2012 13:11:22
1,360,930
04/27/2012 10:42:43
39
2
Android AlarmManager and DST/Timezone/Time change?
I'm coding an alarm clock application, and i would like to know what happens, when I set some alarm with AlarmManager for example at time 2:59am (this is not time of my alarm, this is only time WHEN i set some alarm), and at 3:00am there will be automatic time change from summer time to winter (DST). What happens with my scheduled alarm? I found nothing in docs, and it's not so easy to test, at least I must change dates and wait few hours...I'm not so patient ;) Next problem - I was also curious, what happens with my alarms set with AlarmManager when user changes timezone. This was luckily pretty easy to test, and I found, that android is pretty "intelligent" and reschedule alarm automatically. So when in my timezone is for example 9:00 and i set alarm on 10:00, and switch timezone (+1 hours) where actual time is 10:00, android reschedule my alarm to 11:00, as expected. This is very fine, however, i didn't found also anything in docs... Anybody has more official information? Thx
android
timezone
alarmmanager
dst
null
null
open
Android AlarmManager and DST/Timezone/Time change? === I'm coding an alarm clock application, and i would like to know what happens, when I set some alarm with AlarmManager for example at time 2:59am (this is not time of my alarm, this is only time WHEN i set some alarm), and at 3:00am there will be automatic time change from summer time to winter (DST). What happens with my scheduled alarm? I found nothing in docs, and it's not so easy to test, at least I must change dates and wait few hours...I'm not so patient ;) Next problem - I was also curious, what happens with my alarms set with AlarmManager when user changes timezone. This was luckily pretty easy to test, and I found, that android is pretty "intelligent" and reschedule alarm automatically. So when in my timezone is for example 9:00 and i set alarm on 10:00, and switch timezone (+1 hours) where actual time is 10:00, android reschedule my alarm to 11:00, as expected. This is very fine, however, i didn't found also anything in docs... Anybody has more official information? Thx
0
11,650,369
07/25/2012 13:04:27
1,551,649
07/25/2012 12:50:21
1
0
no match for operator+ error with operator overloading
I'm going through the gameinsitute's c++ programming course and there is an example for operator overloading and i'm constantly getting a > main.cpp|20|error: no match for ‘operator+’ in ‘v + w’ and i have no idea where the problem is. main.cpp // main.cpp #include "Vector3.h" #include <iostream> using namespace std; int main() { float coords[3] = {1.0f, 2.0f, 3.0f}; Vector3 u; Vector3 v(coords); Vector3 w(-5.0f, 2.0f, 0.0f); cout << "u = "; u.print(); cout << "v = "; v.print(); cout << "w = "; w.print(); cout << endl; u = v + w; // this gives the error cout << "v + w = "; u.print(); cout << endl; v.normalize(); cout << "unit v = "; v.print(); cout << "v.length() = "<< v.length() << endl; cout << endl; float dotP = u * w; // this also gives error cout << "u * w = " << dotP << endl; float* vArray = v.toFloatArray(); cout << "[0] = " << vArray[0] << ", " "[1] = " << vArray[1] << ", " "[2] = " << vArray[2] << endl <<endl; cout << "Input vector..." << endl; Vector3 m; m.input(); cout << "m = "; m.print(); return 0; } Vector3.h #ifndef VECTOR3_H #define VECTOR3_H #include <iostream> class Vector3 { public: // constructors Vector3(); Vector3(float coords[3]); Vector3(float x, float y, float z); Vector3(const Vector3& vec); // methods float length(); void normalize(); float* toFloatArray(); void print(); void input(); // operators Vector3 operator=(const Vector3& rhs); Vector3 operator+(const Vector3& rhs) const; Vector3 operator-(const Vector3& rhs) const; float operator*(const Vector3& rhs) const; Vector3 operator*(float scalar) const; // fields float mX; float mY; float mZ; }; #endif // VECTOR3_H Vector3.cpp #include "Vector3.h" #include <cmath> #include <iostream> using std::cout; using std::cin; Vector3::Vector3() { mX = 0.0f; mY = 0.0f; mZ = 0.0f; } Vector3::Vector3(float coords[3]) { mX = coords[0]; mY = coords[1]; mZ = coords[2]; } Vector3::Vector3(float x, float y, float z) { mX = x; mY = y; mZ = z; } Vector3::Vector3(const Vector3& vec) { mX = vec.mX; mY = vec.mY; mZ = vec.mZ; } float Vector3::length() { return sqrt(mX*mX + mY*mY + mZ*mZ); } void Vector3::normalize() { float len = length(); mX /= len; mY /= len; mZ /= len; } float* Vector3::toFloatArray() { return &mX; } void Vector3::print() { cout << "<" << mX << ", " << mY << ", " << mZ << "> \n"; } void Vector3::input() { cout << "Enter x: "; cin >> mX; cout << "Enter y: "; cin >> mY; cout << "Enter z: "; cin >> mZ; } //operators Vector3 Vector3::operator=(const Vector3& rhs) { Vector3 vTemp; vTemp.mX = rhs.mX; vTemp.mY = rhs.mY; vTemp.mZ = rhs.mZ; return vTemp; } Vector3 Vector3::operator+(const Vector3& rhs) const { Vector3 sum; sum.mX = mX + rhs.mX; sum.mY = mY + rhs.mY; sum.mZ = mZ + rhs.mZ; return sum; } Vector3 Vector3::operator-(const Vector3& rhs) const { Vector3 dif; dif.mX = mX - rhs.mX; dif.mY = mY - rhs.mY; dif.mZ = mZ - rhs.mZ; return dif; } float Vector3::operator*(const Vector3& rhs) const { float dotP = mX*rhs.mX + mY*rhs.mY + mZ*rhs.mZ; return dotP; } Vector3 Vector3::operator*(float scalar) const { Vector3 p; p.mX = mX * scalar; p.mY = mY * scalar; p.mZ = mZ * scalar; return p; } Thank you for your help in advance!
c++
overloading
operator-keyword
null
null
null
open
no match for operator+ error with operator overloading === I'm going through the gameinsitute's c++ programming course and there is an example for operator overloading and i'm constantly getting a > main.cpp|20|error: no match for ‘operator+’ in ‘v + w’ and i have no idea where the problem is. main.cpp // main.cpp #include "Vector3.h" #include <iostream> using namespace std; int main() { float coords[3] = {1.0f, 2.0f, 3.0f}; Vector3 u; Vector3 v(coords); Vector3 w(-5.0f, 2.0f, 0.0f); cout << "u = "; u.print(); cout << "v = "; v.print(); cout << "w = "; w.print(); cout << endl; u = v + w; // this gives the error cout << "v + w = "; u.print(); cout << endl; v.normalize(); cout << "unit v = "; v.print(); cout << "v.length() = "<< v.length() << endl; cout << endl; float dotP = u * w; // this also gives error cout << "u * w = " << dotP << endl; float* vArray = v.toFloatArray(); cout << "[0] = " << vArray[0] << ", " "[1] = " << vArray[1] << ", " "[2] = " << vArray[2] << endl <<endl; cout << "Input vector..." << endl; Vector3 m; m.input(); cout << "m = "; m.print(); return 0; } Vector3.h #ifndef VECTOR3_H #define VECTOR3_H #include <iostream> class Vector3 { public: // constructors Vector3(); Vector3(float coords[3]); Vector3(float x, float y, float z); Vector3(const Vector3& vec); // methods float length(); void normalize(); float* toFloatArray(); void print(); void input(); // operators Vector3 operator=(const Vector3& rhs); Vector3 operator+(const Vector3& rhs) const; Vector3 operator-(const Vector3& rhs) const; float operator*(const Vector3& rhs) const; Vector3 operator*(float scalar) const; // fields float mX; float mY; float mZ; }; #endif // VECTOR3_H Vector3.cpp #include "Vector3.h" #include <cmath> #include <iostream> using std::cout; using std::cin; Vector3::Vector3() { mX = 0.0f; mY = 0.0f; mZ = 0.0f; } Vector3::Vector3(float coords[3]) { mX = coords[0]; mY = coords[1]; mZ = coords[2]; } Vector3::Vector3(float x, float y, float z) { mX = x; mY = y; mZ = z; } Vector3::Vector3(const Vector3& vec) { mX = vec.mX; mY = vec.mY; mZ = vec.mZ; } float Vector3::length() { return sqrt(mX*mX + mY*mY + mZ*mZ); } void Vector3::normalize() { float len = length(); mX /= len; mY /= len; mZ /= len; } float* Vector3::toFloatArray() { return &mX; } void Vector3::print() { cout << "<" << mX << ", " << mY << ", " << mZ << "> \n"; } void Vector3::input() { cout << "Enter x: "; cin >> mX; cout << "Enter y: "; cin >> mY; cout << "Enter z: "; cin >> mZ; } //operators Vector3 Vector3::operator=(const Vector3& rhs) { Vector3 vTemp; vTemp.mX = rhs.mX; vTemp.mY = rhs.mY; vTemp.mZ = rhs.mZ; return vTemp; } Vector3 Vector3::operator+(const Vector3& rhs) const { Vector3 sum; sum.mX = mX + rhs.mX; sum.mY = mY + rhs.mY; sum.mZ = mZ + rhs.mZ; return sum; } Vector3 Vector3::operator-(const Vector3& rhs) const { Vector3 dif; dif.mX = mX - rhs.mX; dif.mY = mY - rhs.mY; dif.mZ = mZ - rhs.mZ; return dif; } float Vector3::operator*(const Vector3& rhs) const { float dotP = mX*rhs.mX + mY*rhs.mY + mZ*rhs.mZ; return dotP; } Vector3 Vector3::operator*(float scalar) const { Vector3 p; p.mX = mX * scalar; p.mY = mY * scalar; p.mZ = mZ * scalar; return p; } Thank you for your help in advance!
0
11,650,370
07/25/2012 13:04:27
1,261,507
03/10/2012 20:27:11
191
13
Displaying an array in xcode
I am trying to display the an array with different factors of a number ("prime"). But instead of giving me the int numbers I always get 0,1,2,3,4,5,... . factors.text = @""; int factorsNumber; NSMutableArray *array; array = [NSMutableArray arrayWithCapacity:5]; for (factorsNumber=1; factorsNumber<=prime; factorsNumber++) { if (prime%factorsNumber == 0) { [array addObject:[NSString stringWithFormat:@"%d", factorsNumber]]; } } for (int i = 0; i < [array count]; i++) { [array replaceObjectAtIndex:1 withObject:@"4"]; NSString *temp = [NSString stringWithFormat:@"%d, ", i, [[array objectAtIndex:i] intValue]]; factors.text = [factors.text stringByAppendingString:temp]; }
objective-c
xcode
arrays
null
null
null
open
Displaying an array in xcode === I am trying to display the an array with different factors of a number ("prime"). But instead of giving me the int numbers I always get 0,1,2,3,4,5,... . factors.text = @""; int factorsNumber; NSMutableArray *array; array = [NSMutableArray arrayWithCapacity:5]; for (factorsNumber=1; factorsNumber<=prime; factorsNumber++) { if (prime%factorsNumber == 0) { [array addObject:[NSString stringWithFormat:@"%d", factorsNumber]]; } } for (int i = 0; i < [array count]; i++) { [array replaceObjectAtIndex:1 withObject:@"4"]; NSString *temp = [NSString stringWithFormat:@"%d, ", i, [[array objectAtIndex:i] intValue]]; factors.text = [factors.text stringByAppendingString:temp]; }
0
11,650,487
07/25/2012 13:11:27
520,957
11/26/2010 05:44:11
6,780
328
Maven JavaEE 6 dependency for both Tomcat and JBoss
Which JavaEE 6 maven dependency should be included in a web app to be deployed on Tomcat and JBoss? Both? **Tomcat:** <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> **JBoss:** <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>1.0.0.Final</version> <type>pom</type> <scope>provided</scope> </dependency>
java
java-ee
maven
null
null
null
open
Maven JavaEE 6 dependency for both Tomcat and JBoss === Which JavaEE 6 maven dependency should be included in a web app to be deployed on Tomcat and JBoss? Both? **Tomcat:** <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> **JBoss:** <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>1.0.0.Final</version> <type>pom</type> <scope>provided</scope> </dependency>
0
11,650,489
07/25/2012 13:11:43
1,551,526
07/25/2012 12:07:07
1
0
Express.js sessions activated on a subset of routes
I'm working with expressjs and want to authenticate users for a login using sessions. The site/app should on one hand allow the user to browse and investigate different products and information in a stateless webpage allowing caching of these pages, but should on the other hand have the functionality to let the user login and access different content acquired using sessions. Thus for a subset of my routes I want session state activated, while for the complementary subset (the rest of my routes) express sessions should be deactivated, allowing caching of these pages. How can I do this in a clean way? Say the routes for which I want to activate sessions are '/kj%C3%B8p', '/bibliotek' and '/register'. I tried something like app.configure(function(){ app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); var pageName = 'somepage'; var oneYear = 1000*60*60*24*365; app.use(express.bodyParser()); app.use('/kj%C3%B8p', express.cookieParser()); app.use('/kj%C3%B8p', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path:'/', maxAge: (5*oneYear), httpOnly: true}})); app.use('/bibliotek', express.cookieParser()); app.use('/bibliotek', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path: '/', maxAge: (5*oneYear), httpOnly: true}})); app.use('/registrer', express.cookieParser()); app.use('/registrer', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path:'/', maxAge: (5*oneYear), httpOnly: true}})); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); but this regenerates the session object for each of the three routes, and seems quite messy. Any tips?
session
routes
express
connect
null
null
open
Express.js sessions activated on a subset of routes === I'm working with expressjs and want to authenticate users for a login using sessions. The site/app should on one hand allow the user to browse and investigate different products and information in a stateless webpage allowing caching of these pages, but should on the other hand have the functionality to let the user login and access different content acquired using sessions. Thus for a subset of my routes I want session state activated, while for the complementary subset (the rest of my routes) express sessions should be deactivated, allowing caching of these pages. How can I do this in a clean way? Say the routes for which I want to activate sessions are '/kj%C3%B8p', '/bibliotek' and '/register'. I tried something like app.configure(function(){ app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); var pageName = 'somepage'; var oneYear = 1000*60*60*24*365; app.use(express.bodyParser()); app.use('/kj%C3%B8p', express.cookieParser()); app.use('/kj%C3%B8p', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path:'/', maxAge: (5*oneYear), httpOnly: true}})); app.use('/bibliotek', express.cookieParser()); app.use('/bibliotek', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path: '/', maxAge: (5*oneYear), httpOnly: true}})); app.use('/registrer', express.cookieParser()); app.use('/registrer', express.session({key: pageName, secret: 'someCode', store: new RedisStore, cookie: {path:'/', maxAge: (5*oneYear), httpOnly: true}})); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); but this regenerates the session object for each of the three routes, and seems quite messy. Any tips?
0
11,650,494
07/25/2012 13:12:01
1,551,618
07/25/2012 12:37:59
1
0
GWT RequestFactory Error when firing request : org.springframework.beans.factory.NoSuchBeanDefinitionException
I have a maven+spring+gwt project in which i want to use request factory. I just can't figure out why I get this exception. Request factory: public interface StarRequestFactory extends RequestFactory { @Service(value = RaduService.class, locator = GWTServiceLocator.class) public interface RaduRequestContext extends RequestContext { Request<Void> save( ); } RaduRequestContext raduRequestcontext(); } Service : public class RaduService { public void save(){ System.out.println("You have saved."); } } Locator : public class GWTServiceLocator implements ServiceLocator, ApplicationContextAware { private ApplicationContext context; @Override public Object getInstance(Class<?> clazz) { return context.getBean(clazz); } @Override public void setApplicationContext(ApplicationContext context) throws BeansException { this.context = context; } } In my entrypoint class i make the request : requestFactory.raduRequestcontext().save().fire(new Receiver<Void>() { @Override public void onSuccess(Void response) { System.out.println("Success"); } }); On this request i get the following error : [ERROR] Iul 25, 2012 3:35:36 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost [ERROR] SEVERE: Unexpected error [ERROR] org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.aievas.star.shared.services.StarRequestFactory$RaduRequestContext] is defined: expected single bean but found 0: [ERROR] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269) [ERROR] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) [ERROR] at com.aievas.star.server.integration.GWTServiceLocator.getInstance(GWTServiceLocator.java:25) [ERROR] at com.aievas.star.server.integration.GWTServiceLayerDecorator.createServiceInstance(GWTServiceLayerDecorator.java:43) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.lang.reflect.Method.invoke(Method.java:601) [ERROR] at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) [ERROR] at com.google.web.bindery.requestfactory.server.ServiceLayerCache.createServiceInstance(ServiceLayerCache.java:117) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:451) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) .......................................................... Does anyone know what is this about ? I can post the pom if needed.
spring
gwt
maven
requestfactory
null
null
open
GWT RequestFactory Error when firing request : org.springframework.beans.factory.NoSuchBeanDefinitionException === I have a maven+spring+gwt project in which i want to use request factory. I just can't figure out why I get this exception. Request factory: public interface StarRequestFactory extends RequestFactory { @Service(value = RaduService.class, locator = GWTServiceLocator.class) public interface RaduRequestContext extends RequestContext { Request<Void> save( ); } RaduRequestContext raduRequestcontext(); } Service : public class RaduService { public void save(){ System.out.println("You have saved."); } } Locator : public class GWTServiceLocator implements ServiceLocator, ApplicationContextAware { private ApplicationContext context; @Override public Object getInstance(Class<?> clazz) { return context.getBean(clazz); } @Override public void setApplicationContext(ApplicationContext context) throws BeansException { this.context = context; } } In my entrypoint class i make the request : requestFactory.raduRequestcontext().save().fire(new Receiver<Void>() { @Override public void onSuccess(Void response) { System.out.println("Success"); } }); On this request i get the following error : [ERROR] Iul 25, 2012 3:35:36 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost [ERROR] SEVERE: Unexpected error [ERROR] org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.aievas.star.shared.services.StarRequestFactory$RaduRequestContext] is defined: expected single bean but found 0: [ERROR] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269) [ERROR] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) [ERROR] at com.aievas.star.server.integration.GWTServiceLocator.getInstance(GWTServiceLocator.java:25) [ERROR] at com.aievas.star.server.integration.GWTServiceLayerDecorator.createServiceInstance(GWTServiceLayerDecorator.java:43) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.lang.reflect.Method.invoke(Method.java:601) [ERROR] at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) [ERROR] at com.google.web.bindery.requestfactory.server.ServiceLayerCache.createServiceInstance(ServiceLayerCache.java:117) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:451) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225) [ERROR] at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) .......................................................... Does anyone know what is this about ? I can post the pom if needed.
0
11,541,692
07/18/2012 12:44:09
1,060,010
11/22/2011 14:48:08
41
0
Passing string instead of node while creating a XML file in java
Dear Stack over flow members, I would like to create a XML file which would have all the information about the system. To get the information, i would use `getProperty(os.name)` and would save it in a string like this String nameOS = "os.name"; nameOS=System.getProperty(nameOS); And now i would like to create an XML and would like the value of this string to be one of the element of XML file created, for which i would be doing something like this Element Osname = doc.createElement("Osname"); Osname.appendChild(doc.createTextNode("nameOS")); staff.appendChild(Osname); But Output xml file looks likes this <?xml version="1.0" encoding="UTF-8" standalone="no" ?> - <HardwareInfo> <OsName>nameOS</OsName> </HardwareInfo> I get the name of the string in the output instead of Value of the string. Any help would be very much appreciated. Cheers! Kishore
java
xml
string
xmlnode
null
null
open
Passing string instead of node while creating a XML file in java === Dear Stack over flow members, I would like to create a XML file which would have all the information about the system. To get the information, i would use `getProperty(os.name)` and would save it in a string like this String nameOS = "os.name"; nameOS=System.getProperty(nameOS); And now i would like to create an XML and would like the value of this string to be one of the element of XML file created, for which i would be doing something like this Element Osname = doc.createElement("Osname"); Osname.appendChild(doc.createTextNode("nameOS")); staff.appendChild(Osname); But Output xml file looks likes this <?xml version="1.0" encoding="UTF-8" standalone="no" ?> - <HardwareInfo> <OsName>nameOS</OsName> </HardwareInfo> I get the name of the string in the output instead of Value of the string. Any help would be very much appreciated. Cheers! Kishore
0
11,541,695
07/18/2012 12:44:22
455,368
09/22/2010 17:46:40
319
8
angular.js: Redirecting to a certain route based on condition
I'm writing a small Angular.js app that has a login view and a main view, configured like so: $routeProvider .when('/main' , {templateUrl: 'partials/main.html', controller: MainController}) .when('/login', {templateUrl: 'partials/login.html', controller: LoginController}) .otherwise({redirectTo: '/login'}); My LoginController checks the user/pass combination and sets a property on the $rootScope reflecting this: function LoginController($scope, $location, $rootScope) { $scope.attemptLogin = function() { if ( $scope.username == $scope.password ) { // test $rootScope.loggedUser = $scope.username; $location.path( "/main" ); } else { $scope.loginError = "Invalid user/pass."; } } Everything works, but if I access `http://localhost/#/main` I end up bypassing the login screen. I wanted to write something like "whenever the route changes, if $rootScope.loggedUser is null then redirect to /login" ... ... wait. Can I listen to route changes somehow? I'll post this question anyway and keep looking.
angularjs
null
null
null
null
null
open
angular.js: Redirecting to a certain route based on condition === I'm writing a small Angular.js app that has a login view and a main view, configured like so: $routeProvider .when('/main' , {templateUrl: 'partials/main.html', controller: MainController}) .when('/login', {templateUrl: 'partials/login.html', controller: LoginController}) .otherwise({redirectTo: '/login'}); My LoginController checks the user/pass combination and sets a property on the $rootScope reflecting this: function LoginController($scope, $location, $rootScope) { $scope.attemptLogin = function() { if ( $scope.username == $scope.password ) { // test $rootScope.loggedUser = $scope.username; $location.path( "/main" ); } else { $scope.loginError = "Invalid user/pass."; } } Everything works, but if I access `http://localhost/#/main` I end up bypassing the login screen. I wanted to write something like "whenever the route changes, if $rootScope.loggedUser is null then redirect to /login" ... ... wait. Can I listen to route changes somehow? I'll post this question anyway and keep looking.
0
11,541,348
07/18/2012 12:27:29
1,155,171
01/18/2012 00:59:08
60
0
R filter() dealing with NAs
I am trying too implement chebyshev filter to smooth a time series, but unfortunately, there are NAs in the data series. For example, t <- seq(0, 1, len = 100) x <- c(sin(2*pi*t*2.3) + 0.25*rnorm(length(t)),NA, cos(2*pi*t*2.3) + 0.25*rnorm(length(t))) I am using chebyshev filter: `cf1 = cheby1(5, 3, 1/44, type = "low")` then z <- filter(cf1, x) # apply filter This one doesn't work and i already tried na.rm=T, it seems there's no such argument. Thank you guys.
r
filter
signals
time-series
na
null
open
R filter() dealing with NAs === I am trying too implement chebyshev filter to smooth a time series, but unfortunately, there are NAs in the data series. For example, t <- seq(0, 1, len = 100) x <- c(sin(2*pi*t*2.3) + 0.25*rnorm(length(t)),NA, cos(2*pi*t*2.3) + 0.25*rnorm(length(t))) I am using chebyshev filter: `cf1 = cheby1(5, 3, 1/44, type = "low")` then z <- filter(cf1, x) # apply filter This one doesn't work and i already tried na.rm=T, it seems there's no such argument. Thank you guys.
0
11,541,711
07/18/2012 12:45:10
1,390,747
05/12/2012 07:20:37
1
0
Guessing list of google kind of functionality
I wanted to add a functionality in a text-box that if someone is typing a name and I already have a list of names than just like `Google Search` gives us some guess list at the bottom of the text box related to the letters we entered in the text-box I can also give the same list populated with all the names that are in the name list.<br> Is this possible ? <br>and if yes then where should I start from ?<br> Thank You
javascript
ajax
google
null
null
null
open
Guessing list of google kind of functionality === I wanted to add a functionality in a text-box that if someone is typing a name and I already have a list of names than just like `Google Search` gives us some guess list at the bottom of the text box related to the letters we entered in the text-box I can also give the same list populated with all the names that are in the name list.<br> Is this possible ? <br>and if yes then where should I start from ?<br> Thank You
0