PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 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 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,099,775 | 02/01/2012 16:50:48 | 1,013,792 | 10/26/2011 01:06:25 | 1 | 0 | Why are some directories and .aspx files returning 404s when they exist? | **Summary of the Problem**
<br/ >
I have an ASP.NET 2.0 website that doesn't serve certain .aspx files. A directory called /servercontrol/ exists, and all of the .aspx files within that are served correctly & work as expected.
However, no other .aspx files work. IIS seems to think that they don't exist, and serves stopped.htm, which is IIS's default 404 page. Strangely, if I copy any .aspx file into /servercontrol/, it works as expected!
I've checked the security settings on the site & see no issues. The settings are the same for both /servercontrol/ and other folders, and all files.
**Further Details**
<br/ >
The website was recently converted from .NET 1.1 (running in Visual Studio (VS) 2003) to .NET 2.0 (running in VS 2005). This problem did not occur in .NET 1.1.
The project / solution contains 5 C# libraries, 2 J# libraries, and 1 website. (The deployment servers have J#® 2.0 Redistributable Package – SE(x86) installed on them to make them compatible with the J# libraries.)
I have tried deploying to Windows 2003 under IIS6 and Windows 2008 under IIS7. The same problem occurs on both. On my local machine, which is running Windows XP under IIS 5, the problem doesn't occur.
To deploy I am currently using the 'Publish' function in VS 2005, and then copying the contents of the 'precompiled' folder onto the web server.
| asp.net | .net | visual-studio | iis | null | 05/07/2012 18:18:32 | too localized | Why are some directories and .aspx files returning 404s when they exist?
===
**Summary of the Problem**
<br/ >
I have an ASP.NET 2.0 website that doesn't serve certain .aspx files. A directory called /servercontrol/ exists, and all of the .aspx files within that are served correctly & work as expected.
However, no other .aspx files work. IIS seems to think that they don't exist, and serves stopped.htm, which is IIS's default 404 page. Strangely, if I copy any .aspx file into /servercontrol/, it works as expected!
I've checked the security settings on the site & see no issues. The settings are the same for both /servercontrol/ and other folders, and all files.
**Further Details**
<br/ >
The website was recently converted from .NET 1.1 (running in Visual Studio (VS) 2003) to .NET 2.0 (running in VS 2005). This problem did not occur in .NET 1.1.
The project / solution contains 5 C# libraries, 2 J# libraries, and 1 website. (The deployment servers have J#® 2.0 Redistributable Package – SE(x86) installed on them to make them compatible with the J# libraries.)
I have tried deploying to Windows 2003 under IIS6 and Windows 2008 under IIS7. The same problem occurs on both. On my local machine, which is running Windows XP under IIS 5, the problem doesn't occur.
To deploy I am currently using the 'Publish' function in VS 2005, and then copying the contents of the 'precompiled' folder onto the web server.
| 3 |
9,469,620 | 02/27/2012 17:45:55 | 654,423 | 03/10/2011 22:44:28 | 3,044 | 373 | What is the best method for creating a mobile app | I have been creating RIA type apps now for many years and I am very comfortable working with the flex frame work. However I have never created an AIR app.<br/>
With that being said I have a killer mobile device game I want to create, but have no idea on what is best methods to publish or best SDKs or IDEs.<BR/>
So I guess I have a few questions.<BR/><BR/>
Whats the best IDE to use for open source like flash develop or just go with flex builder?<br/>
I will assume 4.5 flex SDK would be best?<BR/>
And where can I find a decent tutorial on setting up and publishing of the apps. For now just android based tutorials. I figure I can get into the IOS mess later.<BR/>My Google ninja skills seem to be failing me as all I can get via Google are game links. <BR/>
| actionscript-3 | flex | null | null | null | 02/27/2012 22:23:37 | not constructive | What is the best method for creating a mobile app
===
I have been creating RIA type apps now for many years and I am very comfortable working with the flex frame work. However I have never created an AIR app.<br/>
With that being said I have a killer mobile device game I want to create, but have no idea on what is best methods to publish or best SDKs or IDEs.<BR/>
So I guess I have a few questions.<BR/><BR/>
Whats the best IDE to use for open source like flash develop or just go with flex builder?<br/>
I will assume 4.5 flex SDK would be best?<BR/>
And where can I find a decent tutorial on setting up and publishing of the apps. For now just android based tutorials. I figure I can get into the IOS mess later.<BR/>My Google ninja skills seem to be failing me as all I can get via Google are game links. <BR/>
| 4 |
10,531,662 | 05/10/2012 09:58:34 | 295,852 | 03/17/2010 16:52:12 | 192 | 10 | iOS 4.3 transparent png in status bar isn't transparent | I'm having some difficulty getting the transparent bits of my png image that I'm using to replace the default status bar to be rendered as transparent in iOS 4.3. At the moment they are coming up black.
Here is the code I'm using to draw my image:
@implementation UINavigationBar (BackgroundImage)
- (void)drawRect:(CGRect)rect
{
UIImage *image = nil;
switch(self.tag)
{
case HeaderBG_Logo:
image = [UIImage imageNamed: @"top_bar_logo.png"];
break;
case HeaderBG_Plain:
image = [UIImage imageNamed: @"top_bar.png"];
break;
}
if(image != nil)
{
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
}
@end
Here is a side by side comparison of the same app running in the simulator in ios4.3 and ios5 (the image has a drop shadow as its bottom border):
![screenshot][1]
As an aside, the 4.3 background image doesn't seem to be rendered as tall as the 5.0 one either.
I've tried setting the `UINavigationBar` to opaque / setting its background color to `clearColor`. None of that worked. :(
Can anyone help?
[1]: http://i.stack.imgur.com/dB6BK.png | iphone | ios | ios4 | null | null | null | open | iOS 4.3 transparent png in status bar isn't transparent
===
I'm having some difficulty getting the transparent bits of my png image that I'm using to replace the default status bar to be rendered as transparent in iOS 4.3. At the moment they are coming up black.
Here is the code I'm using to draw my image:
@implementation UINavigationBar (BackgroundImage)
- (void)drawRect:(CGRect)rect
{
UIImage *image = nil;
switch(self.tag)
{
case HeaderBG_Logo:
image = [UIImage imageNamed: @"top_bar_logo.png"];
break;
case HeaderBG_Plain:
image = [UIImage imageNamed: @"top_bar.png"];
break;
}
if(image != nil)
{
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
}
@end
Here is a side by side comparison of the same app running in the simulator in ios4.3 and ios5 (the image has a drop shadow as its bottom border):
![screenshot][1]
As an aside, the 4.3 background image doesn't seem to be rendered as tall as the 5.0 one either.
I've tried setting the `UINavigationBar` to opaque / setting its background color to `clearColor`. None of that worked. :(
Can anyone help?
[1]: http://i.stack.imgur.com/dB6BK.png | 0 |
4,699,571 | 01/15/2011 12:29:07 | 576,704 | 01/15/2011 12:29:07 | 1 | 0 | Display workspace's number - Ubuntu 10.10 | is there a way to somehow display the number (or identifier) of the current workspace in ubuntu 10.10? | ubuntu | workspaces | null | null | null | 07/19/2012 13:09:58 | off topic | Display workspace's number - Ubuntu 10.10
===
is there a way to somehow display the number (or identifier) of the current workspace in ubuntu 10.10? | 2 |
1,927,071 | 12/18/2009 08:46:14 | 52,954 | 01/08/2009 15:16:14 | 919 | 39 | Improving JBoss 5 slow startup | We upgraded from JBoss 4 (and JDK 5) to JBoss 5 (and JDK 6). The problem is that the start time has gone from 1.5 minutes (on JBoss 4) to more than 4 minutes.
20:41:33,366 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 4m:58s:302ms
It seems like the component that is taking JBoss the longest time to initialize is the JMX
20:37:12,050 INFO [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@fcc070[ defaultDomain='jboss' ]
20:39:53,424 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://lharel2/jndi/rmi://lharel2:1090/jmxconnector
Do you have any idea how JBoss start time can be improved? | jboss | jboss5.x | performance | startup | null | null | open | Improving JBoss 5 slow startup
===
We upgraded from JBoss 4 (and JDK 5) to JBoss 5 (and JDK 6). The problem is that the start time has gone from 1.5 minutes (on JBoss 4) to more than 4 minutes.
20:41:33,366 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 4m:58s:302ms
It seems like the component that is taking JBoss the longest time to initialize is the JMX
20:37:12,050 INFO [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@fcc070[ defaultDomain='jboss' ]
20:39:53,424 INFO [JMXConnectorServerService] JMX Connector server: service:jmx:rmi://lharel2/jndi/rmi://lharel2:1090/jmxconnector
Do you have any idea how JBoss start time can be improved? | 0 |
7,129,789 | 08/20/2011 05:03:11 | 191,726 | 10/17/2009 15:49:00 | 307 | 3 | Should I build a physics engine for my game, or use an already made one | I am planning on making a game for Android with some 2d rope physics. The core mechanic involves dragging strings around an environment. This is basically the extent of the physics in the game, at least the physics that I want to look reasonably realistic.
I haven't taken a physics class and I only know math up to high school trigonometry. Is a mechanic like this too difficult to code myself after some research? Should I use a library like toxiclibs or Box2D?
I know it's irritating to ask a question that can't be directly answered, but I just want to weight the pros and cons of building something myself as opposed to using something that might be more refined.
Thanks | java | android | physics | game-physics | null | 08/29/2011 19:29:07 | off topic | Should I build a physics engine for my game, or use an already made one
===
I am planning on making a game for Android with some 2d rope physics. The core mechanic involves dragging strings around an environment. This is basically the extent of the physics in the game, at least the physics that I want to look reasonably realistic.
I haven't taken a physics class and I only know math up to high school trigonometry. Is a mechanic like this too difficult to code myself after some research? Should I use a library like toxiclibs or Box2D?
I know it's irritating to ask a question that can't be directly answered, but I just want to weight the pros and cons of building something myself as opposed to using something that might be more refined.
Thanks | 2 |
3,391,222 | 08/02/2010 19:49:16 | 301,860 | 03/25/2010 16:18:35 | 147 | 6 | Flash video record on website tutorial | I wanted to make a website that would let users record a small video message through their broswer and save it to my website.
As I have never used flash, i wanted to know what softwares would be required and what programming languages would I need? I mean, what should I go about learning to implement such a site. I would prefer open-source solutions wherever possible.
Can something like this be implemented using python and html5?
| python | flash | video-capture | html5-video | null | null | open | Flash video record on website tutorial
===
I wanted to make a website that would let users record a small video message through their broswer and save it to my website.
As I have never used flash, i wanted to know what softwares would be required and what programming languages would I need? I mean, what should I go about learning to implement such a site. I would prefer open-source solutions wherever possible.
Can something like this be implemented using python and html5?
| 0 |
10,108,619 | 04/11/2012 15:00:56 | 535,425 | 12/08/2010 18:41:15 | 323 | 5 | Run two commands during git bisect run | I would essentially like to do `git bisect run 'bundle && bundle exec cucumber'`.
I want to do this on the commandline - I don't want to write a shell script. | git | bisect | null | null | null | null | open | Run two commands during git bisect run
===
I would essentially like to do `git bisect run 'bundle && bundle exec cucumber'`.
I want to do this on the commandline - I don't want to write a shell script. | 0 |
8,289,700 | 11/27/2011 22:41:44 | 428,272 | 05/24/2010 22:25:46 | 126 | 1 | PHP File Upload fails in IE for large files | I have an html page which POSTS files to a PHP backend.
Using Chrome/Firefox I can upload files up to the limits set in my .htaccess (10M)
When I use IE - files above 2M are rejected with Error 1:The uploaded file exceeds the upload_max_filesize directive in php.ini.
Why would a request from IE behave differently?
Technical details:
- Server: Linux, Apache, PHP 5.2.17
- PHP ini settings (set in .htaccess, and checked using phpinfo):
- upload_max_filesize 10M
- post_max_size 10M
- memory_limit 24M
| php | internet-explorer | file-upload | null | null | 11/28/2011 11:40:03 | too localized | PHP File Upload fails in IE for large files
===
I have an html page which POSTS files to a PHP backend.
Using Chrome/Firefox I can upload files up to the limits set in my .htaccess (10M)
When I use IE - files above 2M are rejected with Error 1:The uploaded file exceeds the upload_max_filesize directive in php.ini.
Why would a request from IE behave differently?
Technical details:
- Server: Linux, Apache, PHP 5.2.17
- PHP ini settings (set in .htaccess, and checked using phpinfo):
- upload_max_filesize 10M
- post_max_size 10M
- memory_limit 24M
| 3 |
518,510 | 02/05/2009 23:44:12 | 60,117 | 01/29/2009 08:46:51 | 296 | 39 | What books do you recommend reading for QA/Test ? | I'm looking for a list of books which people think are essential for a developer in a test/QA role to read. I'm looking for books which are test/QA specific, so not things like data structures or algorithms. Rather I'm looking for books like testing methodology. | books | qa | testing | null | null | 09/17/2011 22:45:23 | not constructive | What books do you recommend reading for QA/Test ?
===
I'm looking for a list of books which people think are essential for a developer in a test/QA role to read. I'm looking for books which are test/QA specific, so not things like data structures or algorithms. Rather I'm looking for books like testing methodology. | 4 |
7,695,073 | 10/08/2011 05:54:13 | 571,507 | 01/11/2011 16:14:04 | 817 | 48 | What are steps to Profile a SQL Stored Procedure for execution counts and running time | ### Somewhat Related
http://stackoverflow.com/questions/303417/what-are-the-best-practices-in-writing-a-sql-stored-procedure
### Question
I have written a sql-xml stored procedure in Microsoft SQL server express 2005, now how does one find how many executions it can do in a second, time it takes for the same and how to do load testing on the same. Are there any open source tool for the same? Is there any pattern i can follow for improving the execution count? What performance bottlenecks do stored procedure generally face? | sql | sql-server | sql-server-2005 | testing | stored-procedures | 10/10/2011 11:14:23 | not a real question | What are steps to Profile a SQL Stored Procedure for execution counts and running time
===
### Somewhat Related
http://stackoverflow.com/questions/303417/what-are-the-best-practices-in-writing-a-sql-stored-procedure
### Question
I have written a sql-xml stored procedure in Microsoft SQL server express 2005, now how does one find how many executions it can do in a second, time it takes for the same and how to do load testing on the same. Are there any open source tool for the same? Is there any pattern i can follow for improving the execution count? What performance bottlenecks do stored procedure generally face? | 1 |
6,609,968 | 07/07/2011 11:36:47 | 962,474 | 08/04/2010 17:47:01 | 86 | 2 | Real life examples of xvalues, glvalues, and prvalues? | Hya , i was wondering if anyone could tell or explain some real life examples of xvalues, glvalues, and prvalues?. I have read a similar question :
[What are rvalues, lvalues, xvalues, glvalues, and prvalues?][1]
but Didn't understand what everyone meant . Can anyone explain in what cases these values are important and when one should use them .
Any help is appreciated:)
[1]: http://stackoverflow.com/questions/3601602/what-are-rvalues-lvalues-xvalues-glvalues-and-prvalues | c++ | c++0x | null | null | null | null | open | Real life examples of xvalues, glvalues, and prvalues?
===
Hya , i was wondering if anyone could tell or explain some real life examples of xvalues, glvalues, and prvalues?. I have read a similar question :
[What are rvalues, lvalues, xvalues, glvalues, and prvalues?][1]
but Didn't understand what everyone meant . Can anyone explain in what cases these values are important and when one should use them .
Any help is appreciated:)
[1]: http://stackoverflow.com/questions/3601602/what-are-rvalues-lvalues-xvalues-glvalues-and-prvalues | 0 |
10,751,834 | 05/25/2012 09:26:56 | 936,604 | 09/09/2011 10:50:55 | 1 | 0 | Custom Profile Provider : The settings property '' was not found - MVC3 | I've been having this issue when trying to edit/update a user profile. Essentially when a user registers, they have a bool call 'AuthorizedTeamMember' set to false. Their Team Manager can then set it to true to authorize the user.
However, when clicking the "Authorize" button to authorize the user I get the following error:
The settings property 'AuthorizedTeamMember' was not found.
I've had a good look around to find a solution, but nothing seems to work. It seem's to error before it hits the method 'AuthorizePlayer' on the HttpPost.
**Anyway here's my custom profile provider:**
namespace iConfirm.Models
{
public class TeamPlayer : ProfileBase
{
[Display(Name = "First Name")]
public virtual string FirstName
{
get
{
return (this.GetPropertyValue("FirstName").ToString());
}
set
{
this.SetPropertyValue("FirstName", value);
}
}
[Display(Name = "Last Name")]
public virtual string LastName
{
get
{
return (this.GetPropertyValue("LastName").ToString());
}
set
{
this.SetPropertyValue("LastName", value);
}
}
[Display(Name = "Date Of Birth")]
public virtual string DateOfBirth
{
get
{
return (this.GetPropertyValue("DateOfBirth").ToString());
}
set
{
this.SetPropertyValue("DateOfBirth", value);
}
}
[Display(Name = "Phone Number")]
public virtual string PhoneNumber
{
get
{
return (this.GetPropertyValue("PhoneNumber").ToString());
}
set
{
this.SetPropertyValue("PhoneNumber", value);
}
}
public virtual string TeamId
{
get
{
return (this.GetPropertyValue("TeamId").ToString());
}
set
{
this.SetPropertyValue("TeamId", value);
}
}
public virtual bool AuthorizedTeamMember
{
get
{
return (bool)base["AuthorizedTeamMember"]; //<-- Errors here on post
}
set
{
base["AuthorizedTeamMember"] = value;
}
}
public static TeamPlayer GetProfile(string username)
{
return Create(username) as TeamPlayer;
}
public static List<TeamPlayer> GetProfilesByTeam(int teamId)
{
//var profileList = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
var profilesInTeam = Membership.GetAllUsers().Cast<MembershipUser>()
.Select(user => TeamPlayer.Create(user.UserName, true) as TeamPlayer)
.Where(profile => profile.GetPropertyValue("TeamId").ToString().Equals(teamId.ToString()))
.ToList();
return profilesInTeam;
}
}
}
**Here's the code that will Authorize the user:**
[HttpPost]
public ActionResult AuthorizePlayer(TeamPlayer teamPlayer)
{
teamPlayer.AuthorizedTeamMember = true;
var user = TeamPlayer.GetProfile(teamPlayer.UserName);
user.FirstName = teamPlayer.FirstName;
user.LastName = teamPlayer.LastName;
user.AuthorizedTeamMember = teamPlayer.AuthorizedTeamMember;
user.DateOfBirth = teamPlayer.DateOfBirth;
user.PhoneNumber = teamPlayer.PhoneNumber;
user.Save();
/*TeamPlayer _teamPlayer = TeamPlayer.Create(teamPlayer.UserName) as TeamPlayer;
//var tempProfile = TeamPlayer.Create(teamPlayer.UserName) as TeamPlayer;
_teamPlayer.AuthorizedTeamMember = true;
_teamPlayer.Save();
//Email user that they have been authorized*/
return View("Index");
}
**And finally the view:**
@model iConfirm.Models.TeamPlayer
@{
ViewBag.Title = "AuthorizePlayer";
MembershipUser user = Membership.GetUser(Model.UserName);
}
<h2>AuthorizePlayer</h2>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Authorize the following user?</legend>
@Html.HiddenFor(model => model.AuthorizedTeamMember)
<div class="display-label">
Username
</div>
<div class="display-field">
@Html.DisplayFor(model => model.UserName)
</div>
<div class="display-label">
Full Name
</div>
<div class="display-field">
@Html.DisplayFor(model => model.FirstName) @Html.DisplayFor(model => model.LastName)
</div>
<div class="display-label">
Email
</div>
<div class="display-field">
@user.Email
</div>
<div class="display-label">
Telephone number
</div>
<div class="display-field">
@Html.DisplayFor(model => model.PhoneNumber)
</div>
<div class="display-label">
Date of Birth
</div>
<div class="display-field">
@Html.DisplayFor(model => model.DateOfBirth)
</div>
<p>
<input type="submit" value="Authorize" />
</p>
</fieldset>
}
Any help would be greatly appreciated.
Alex | c# | .net | mvc | null | null | null | open | Custom Profile Provider : The settings property '' was not found - MVC3
===
I've been having this issue when trying to edit/update a user profile. Essentially when a user registers, they have a bool call 'AuthorizedTeamMember' set to false. Their Team Manager can then set it to true to authorize the user.
However, when clicking the "Authorize" button to authorize the user I get the following error:
The settings property 'AuthorizedTeamMember' was not found.
I've had a good look around to find a solution, but nothing seems to work. It seem's to error before it hits the method 'AuthorizePlayer' on the HttpPost.
**Anyway here's my custom profile provider:**
namespace iConfirm.Models
{
public class TeamPlayer : ProfileBase
{
[Display(Name = "First Name")]
public virtual string FirstName
{
get
{
return (this.GetPropertyValue("FirstName").ToString());
}
set
{
this.SetPropertyValue("FirstName", value);
}
}
[Display(Name = "Last Name")]
public virtual string LastName
{
get
{
return (this.GetPropertyValue("LastName").ToString());
}
set
{
this.SetPropertyValue("LastName", value);
}
}
[Display(Name = "Date Of Birth")]
public virtual string DateOfBirth
{
get
{
return (this.GetPropertyValue("DateOfBirth").ToString());
}
set
{
this.SetPropertyValue("DateOfBirth", value);
}
}
[Display(Name = "Phone Number")]
public virtual string PhoneNumber
{
get
{
return (this.GetPropertyValue("PhoneNumber").ToString());
}
set
{
this.SetPropertyValue("PhoneNumber", value);
}
}
public virtual string TeamId
{
get
{
return (this.GetPropertyValue("TeamId").ToString());
}
set
{
this.SetPropertyValue("TeamId", value);
}
}
public virtual bool AuthorizedTeamMember
{
get
{
return (bool)base["AuthorizedTeamMember"]; //<-- Errors here on post
}
set
{
base["AuthorizedTeamMember"] = value;
}
}
public static TeamPlayer GetProfile(string username)
{
return Create(username) as TeamPlayer;
}
public static List<TeamPlayer> GetProfilesByTeam(int teamId)
{
//var profileList = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All);
var profilesInTeam = Membership.GetAllUsers().Cast<MembershipUser>()
.Select(user => TeamPlayer.Create(user.UserName, true) as TeamPlayer)
.Where(profile => profile.GetPropertyValue("TeamId").ToString().Equals(teamId.ToString()))
.ToList();
return profilesInTeam;
}
}
}
**Here's the code that will Authorize the user:**
[HttpPost]
public ActionResult AuthorizePlayer(TeamPlayer teamPlayer)
{
teamPlayer.AuthorizedTeamMember = true;
var user = TeamPlayer.GetProfile(teamPlayer.UserName);
user.FirstName = teamPlayer.FirstName;
user.LastName = teamPlayer.LastName;
user.AuthorizedTeamMember = teamPlayer.AuthorizedTeamMember;
user.DateOfBirth = teamPlayer.DateOfBirth;
user.PhoneNumber = teamPlayer.PhoneNumber;
user.Save();
/*TeamPlayer _teamPlayer = TeamPlayer.Create(teamPlayer.UserName) as TeamPlayer;
//var tempProfile = TeamPlayer.Create(teamPlayer.UserName) as TeamPlayer;
_teamPlayer.AuthorizedTeamMember = true;
_teamPlayer.Save();
//Email user that they have been authorized*/
return View("Index");
}
**And finally the view:**
@model iConfirm.Models.TeamPlayer
@{
ViewBag.Title = "AuthorizePlayer";
MembershipUser user = Membership.GetUser(Model.UserName);
}
<h2>AuthorizePlayer</h2>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Authorize the following user?</legend>
@Html.HiddenFor(model => model.AuthorizedTeamMember)
<div class="display-label">
Username
</div>
<div class="display-field">
@Html.DisplayFor(model => model.UserName)
</div>
<div class="display-label">
Full Name
</div>
<div class="display-field">
@Html.DisplayFor(model => model.FirstName) @Html.DisplayFor(model => model.LastName)
</div>
<div class="display-label">
Email
</div>
<div class="display-field">
@user.Email
</div>
<div class="display-label">
Telephone number
</div>
<div class="display-field">
@Html.DisplayFor(model => model.PhoneNumber)
</div>
<div class="display-label">
Date of Birth
</div>
<div class="display-field">
@Html.DisplayFor(model => model.DateOfBirth)
</div>
<p>
<input type="submit" value="Authorize" />
</p>
</fieldset>
}
Any help would be greatly appreciated.
Alex | 0 |
5,718,575 | 04/19/2011 15:09:55 | 708,832 | 04/14/2011 21:53:09 | 1 | 0 | How can I grab all query parameters in Jersey JaxRS ? | I am building a generic web service and need to grab all the query parameters into one string for latter parsing. How can I do this?
Thanks | java | jersey | jax-rs | null | null | null | open | How can I grab all query parameters in Jersey JaxRS ?
===
I am building a generic web service and need to grab all the query parameters into one string for latter parsing. How can I do this?
Thanks | 0 |
2,630 | 08/05/2008 18:01:32 | 17 | 08/01/2008 12:02:21 | 371 | 34 | What are your favorite Powershell Cmdlets? | I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it begs the question what are your favorite Cmdlets, and how do you use them? | powershell | cmdlets | null | null | null | 02/22/2012 01:58:23 | not constructive | What are your favorite Powershell Cmdlets?
===
I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it begs the question what are your favorite Cmdlets, and how do you use them? | 4 |
9,928,756 | 03/29/2012 15:38:55 | 1,058,663 | 11/21/2011 21:43:26 | 16 | 0 | Is there way to change font size in putty using the wheel in mouse or contrl +/- key? | I love using Putty as a ssh terminal in Window. But what I don't like about it is that it doesn't allow me to change font using shortcut or a mouse. Is there a way(or plugin) to change the font size in putty using the wheel in mouse or contrl +/- key just as in other applications such as Mac Terminal, Chrome,etc?
Thanks | fonts | size | shortcut | putty | superuser | 03/30/2012 18:59:53 | off topic | Is there way to change font size in putty using the wheel in mouse or contrl +/- key?
===
I love using Putty as a ssh terminal in Window. But what I don't like about it is that it doesn't allow me to change font using shortcut or a mouse. Is there a way(or plugin) to change the font size in putty using the wheel in mouse or contrl +/- key just as in other applications such as Mac Terminal, Chrome,etc?
Thanks | 2 |
8,103,193 | 11/12/2011 07:26:56 | 538,705 | 12/11/2010 06:44:15 | 326 | 11 | is PHP redirection seo friendly? | I'm using this to redirect to the home page if the post doesn't exist:
if($_GET['id'] > mysql_num_rows($total_rows)){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".site_url."/");
exit();
}
is this SEO friendly? | php | redirect | header | seo | null | 11/12/2011 21:47:06 | off topic | is PHP redirection seo friendly?
===
I'm using this to redirect to the home page if the post doesn't exist:
if($_GET['id'] > mysql_num_rows($total_rows)){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".site_url."/");
exit();
}
is this SEO friendly? | 2 |
11,478,330 | 07/13/2012 21:02:15 | 1,524,638 | 07/13/2012 20:59:39 | 1 | 0 | How to write a program in python for the Average Rainfall? | This is the problem that I have:
Write a program that uses nested for loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Any ideas guys? Thank you in advance! | python | null | null | null | null | 07/13/2012 21:10:31 | too localized | How to write a program in python for the Average Rainfall?
===
This is the problem that I have:
Write a program that uses nested for loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Any ideas guys? Thank you in advance! | 3 |
9,538,899 | 03/02/2012 19:02:51 | 1,245,787 | 03/02/2012 18:53:30 | 1 | 0 | Is there a way to modify all incoming webpages to include a particular javascript | I am currently working a school project to demonstrate easily fixable user vulnerabilities when surfing the internet and was having trouble finding some way to modify all incoming web pages to include a script that will find login forms on an unencrypted site and capture passwords before the form is passed to the secure server. Any method that does not involve installing software on the router (it would be preferable if my software could run client-side) would be appreciated. It is especially important for it to be able to modify the incoming pages rather than the browser rendering as it is important for the software to be browser-independent.
If anyone has discovered some solution for doing this, or has some idea as to how this might be able to be achieved, their input would be greatly appreciated.
Sincerely,
cosbykid | javascript | network-traffic | null | null | null | 03/03/2012 03:36:03 | not constructive | Is there a way to modify all incoming webpages to include a particular javascript
===
I am currently working a school project to demonstrate easily fixable user vulnerabilities when surfing the internet and was having trouble finding some way to modify all incoming web pages to include a script that will find login forms on an unencrypted site and capture passwords before the form is passed to the secure server. Any method that does not involve installing software on the router (it would be preferable if my software could run client-side) would be appreciated. It is especially important for it to be able to modify the incoming pages rather than the browser rendering as it is important for the software to be browser-independent.
If anyone has discovered some solution for doing this, or has some idea as to how this might be able to be achieved, their input would be greatly appreciated.
Sincerely,
cosbykid | 4 |
3,016,575 | 06/10/2010 16:52:51 | 129,565 | 06/26/2009 17:36:41 | 294 | 13 | Regex age verification | Anyone have a good regex for Age verification?
You'd think it would be simple, but I'm still learning regex and what I'm thinking would be heinous. you'd have to match a range of years, months and days.. | regex | age | null | null | null | null | open | Regex age verification
===
Anyone have a good regex for Age verification?
You'd think it would be simple, but I'm still learning regex and what I'm thinking would be heinous. you'd have to match a range of years, months and days.. | 0 |
7,415,667 | 09/14/2011 11:35:12 | 940,529 | 09/12/2011 12:25:38 | 1 | 0 | Need to preview InDesign, InCopy, Quark etc. documents without their application? | Can anyone please suggest a solution on how can i preview an InDesign, InCopy, Quark etc. documents on Mac (or windows) without having their associated applications.
Any suggestions/recommendations are welcome.
| viewer | indesign | documentviewer | qlpreviewcontroller | null | null | open | Need to preview InDesign, InCopy, Quark etc. documents without their application?
===
Can anyone please suggest a solution on how can i preview an InDesign, InCopy, Quark etc. documents on Mac (or windows) without having their associated applications.
Any suggestions/recommendations are welcome.
| 0 |
10,691,708 | 05/21/2012 19:54:40 | 665,518 | 03/18/2011 04:47:51 | 112 | 0 | Java using an array from another class | I'm new to Java so please be gentle...
Consider the following `ShoppingList Class`:
public class ShoppingList {
...
public ItemPrices[] getSortedPrices(){
//do sorting stuff here etc
return ret.toArray(new ItemPrices[0]);
}
}
(`ItemPrices[]` is a double).
And now I have another class called `Hello`:
public class Hello {
...
private Groceries createGroceries() {
...
double pricearray = ShoppingList.ItemPrices[] //????
...
}
}
I want to assign the array pricearray I've created to equal to ItemPrices array returned in the method.
However I'm not getting what I want, what's the correct way to doing this?
How do I assign the
| java | arrays | class | null | null | 05/21/2012 20:04:15 | too localized | Java using an array from another class
===
I'm new to Java so please be gentle...
Consider the following `ShoppingList Class`:
public class ShoppingList {
...
public ItemPrices[] getSortedPrices(){
//do sorting stuff here etc
return ret.toArray(new ItemPrices[0]);
}
}
(`ItemPrices[]` is a double).
And now I have another class called `Hello`:
public class Hello {
...
private Groceries createGroceries() {
...
double pricearray = ShoppingList.ItemPrices[] //????
...
}
}
I want to assign the array pricearray I've created to equal to ItemPrices array returned in the method.
However I'm not getting what I want, what's the correct way to doing this?
How do I assign the
| 3 |
3,240,557 | 07/13/2010 19:10:58 | 375,510 | 06/24/2010 17:16:53 | 38 | 15 | how to add map layer overlays in opelayer? | i have 3 shapefile ready in a map file, and rendering it on mapserver. what i need is to and these layer overlay one over the other.how can i do this | gis | mapserver | null | null | null | null | open | how to add map layer overlays in opelayer?
===
i have 3 shapefile ready in a map file, and rendering it on mapserver. what i need is to and these layer overlay one over the other.how can i do this | 0 |
1,732,185 | 11/13/2009 22:01:13 | 195,711 | 10/24/2009 01:30:24 | 245 | 40 | DOS Database - help needed to recognize what is it | today I got a copy of an old system from which I need to import data. The system is written in C and runs in DOS. It uses some kind of database. The file format seems to be rather simple(1 file = 1 table, header contains some description and then records, fields are delimited by 0 ASCII character, but it's not that simple as it seems).
The question is: how to recognize what database is used?
Is there any kind of software that maybe opens many formats?
Or is there any software that could help me?
Or any links to sites describing dos databases?
Or just anything that can help will be appreciated:)
PS> I can post some small files from the db if anyone wants to try guessing.
| database | dos | ms-dos | old | null | null | open | DOS Database - help needed to recognize what is it
===
today I got a copy of an old system from which I need to import data. The system is written in C and runs in DOS. It uses some kind of database. The file format seems to be rather simple(1 file = 1 table, header contains some description and then records, fields are delimited by 0 ASCII character, but it's not that simple as it seems).
The question is: how to recognize what database is used?
Is there any kind of software that maybe opens many formats?
Or is there any software that could help me?
Or any links to sites describing dos databases?
Or just anything that can help will be appreciated:)
PS> I can post some small files from the db if anyone wants to try guessing.
| 0 |
3,938,248 | 10/14/2010 22:59:03 | 147,915 | 07/30/2009 15:48:14 | 115 | 18 | Good resources for learning jQuery | Can anyone recommend some resources for learning jQuery (not just about using other people's jQuery code, but how to build say, a gallery from scratch or something)
I've been looking through a few books but the examples seem way more simple than anything that's online... | jquery | null | null | null | null | 05/20/2012 22:49:59 | not constructive | Good resources for learning jQuery
===
Can anyone recommend some resources for learning jQuery (not just about using other people's jQuery code, but how to build say, a gallery from scratch or something)
I've been looking through a few books but the examples seem way more simple than anything that's online... | 4 |
9,097,295 | 02/01/2012 14:16:00 | 1,162,234 | 01/21/2012 12:11:09 | 1 | 0 | Ubuntu: Binary file exists yet not found message thrown |
If I try to execute a binary file
----------------------------------
root@ubuntu:~$ ./Convert2rfm.exe
/root/san/Convert2rfm.exe: not found
----------------------------------
But when tried to locate the file it get located !
----------------------------------
root@ubuntu:~$ ls -l root/san/Convert2rfm.exe
-rwxr-xr-x 1 root root 33242 2012-02-01 18:01 root/san/Convert2rfm.exe
----------------------------------
What could be the possible reason and how to get rid of that.
Please help !
Regards,
San | linux | ubuntu | null | null | null | 02/02/2012 14:48:33 | off topic | Ubuntu: Binary file exists yet not found message thrown
===
If I try to execute a binary file
----------------------------------
root@ubuntu:~$ ./Convert2rfm.exe
/root/san/Convert2rfm.exe: not found
----------------------------------
But when tried to locate the file it get located !
----------------------------------
root@ubuntu:~$ ls -l root/san/Convert2rfm.exe
-rwxr-xr-x 1 root root 33242 2012-02-01 18:01 root/san/Convert2rfm.exe
----------------------------------
What could be the possible reason and how to get rid of that.
Please help !
Regards,
San | 2 |
10,773,655 | 05/27/2012 11:31:41 | 1,352,310 | 04/23/2012 20:52:51 | 35 | 3 | How to fill color in a shape drawn by pen | Hey i am new to C# graphics.
I have simple question that i am drawing a shape with drawcurve with pen ...
i need to fill the color in that graphics how can i do that
this is my code
Pen p1 = new Pen(Color.Red);
Graphics g1 = panel1.CreateGraphics();
g1.DrawCurve(p1, new Point[] { new Point(470, 470), new Point(430, 440), new Point(400, 480), new Point(470, 560), });
Graphics g2 = panel1.CreateGraphics();
g2.DrawCurve(p1, new Point[] { new Point(470, 470), new Point(510, 440), new Point(540, 480), new Point(470, 560), });
i found fill path but i don't know how to use that.
please help sorry if this question is asked before by someone but i can not find that... | c#-4.0 | null | null | null | null | null | open | How to fill color in a shape drawn by pen
===
Hey i am new to C# graphics.
I have simple question that i am drawing a shape with drawcurve with pen ...
i need to fill the color in that graphics how can i do that
this is my code
Pen p1 = new Pen(Color.Red);
Graphics g1 = panel1.CreateGraphics();
g1.DrawCurve(p1, new Point[] { new Point(470, 470), new Point(430, 440), new Point(400, 480), new Point(470, 560), });
Graphics g2 = panel1.CreateGraphics();
g2.DrawCurve(p1, new Point[] { new Point(470, 470), new Point(510, 440), new Point(540, 480), new Point(470, 560), });
i found fill path but i don't know how to use that.
please help sorry if this question is asked before by someone but i can not find that... | 0 |
4,245,814 | 11/22/2010 13:23:40 | 467,947 | 10/06/2010 12:34:55 | 16 | 1 | Is switching to a engineering manager role with 7 yrs exp. a good idea? | I have almost 7 years experience as software developer and am getting a chance to join a new company as engineering manager. The pay of course is better than my current pay but I am bit hesitant as I think I still need a lot to learn as a software developer. Also the company I am with is much larger and stable than the new one although they both have been in business almost the same amount of time. My question is that is it a good idea for me to switch my career as a engineering manager with just 7 years of experience? I know I will be able to fulfill the role but isn't this too early? I am planning to move to UK or Australia, will I be able to get a job as a manager with this much experience there easily or will I have to start from development role again? Please suggest. Thanks
| career-development | null | null | null | null | 11/23/2010 07:37:55 | off topic | Is switching to a engineering manager role with 7 yrs exp. a good idea?
===
I have almost 7 years experience as software developer and am getting a chance to join a new company as engineering manager. The pay of course is better than my current pay but I am bit hesitant as I think I still need a lot to learn as a software developer. Also the company I am with is much larger and stable than the new one although they both have been in business almost the same amount of time. My question is that is it a good idea for me to switch my career as a engineering manager with just 7 years of experience? I know I will be able to fulfill the role but isn't this too early? I am planning to move to UK or Australia, will I be able to get a job as a manager with this much experience there easily or will I have to start from development role again? Please suggest. Thanks
| 2 |
10,875,918 | 06/04/2012 03:08:17 | 1,364,726 | 04/29/2012 22:03:56 | 438 | 26 | Color scheme in Careers 2.0 ad | I've been wondering what color scheme is used in this ad for Careers 2.0: http://static.adzerk.net/Advertisers/bd294ce7ff4c43b6aad4aa4169fb819b.jpg
I emailed their support line, and they checked with their graphic designer, but he/she didn't remember what editor or color scheme was used. So can anyone else identify it? | text-editor | graphic-design | null | null | null | 06/04/2012 21:27:02 | off topic | Color scheme in Careers 2.0 ad
===
I've been wondering what color scheme is used in this ad for Careers 2.0: http://static.adzerk.net/Advertisers/bd294ce7ff4c43b6aad4aa4169fb819b.jpg
I emailed their support line, and they checked with their graphic designer, but he/she didn't remember what editor or color scheme was used. So can anyone else identify it? | 2 |
6,830,234 | 07/26/2011 12:46:34 | 750,724 | 05/12/2011 14:23:11 | 8 | 0 | The short and fast path to be a Java web developer | I am familiar with Java and a little bit with Servlet and JSP, also I read some documents about Spring , Strut2 , Ant and ... . But my question is that which of these technologies I should to learn and is there a diagram to show me how I should walk through these technologies!! | java | spring | servlets | null | null | 07/26/2011 12:49:24 | not a real question | The short and fast path to be a Java web developer
===
I am familiar with Java and a little bit with Servlet and JSP, also I read some documents about Spring , Strut2 , Ant and ... . But my question is that which of these technologies I should to learn and is there a diagram to show me how I should walk through these technologies!! | 1 |
7,852,926 | 10/21/2011 17:17:31 | 116,614 | 06/03/2009 14:01:12 | 10,342 | 553 | Microsoft Roslyn vs. CodeDom | From a [press release][1] yesterday on InfoWorld regarding the new [Microsoft Roslyn][2]:
> The most obvious advantage of this kind of "deconstructed" compiler is
> that it allows the entire compile-execute process to be invoked from
> within .Net applications. Hejlsberg demonstrated a C# program that
> passed a few code snippets to the C# compiler as strings; the compiler
> returned the resulting IL assembly code as an object, which was then
> passed to the Common Language Runtime (CLR) for execution. Voilà! With
> Roslyn, C# gains a dynamic language's ability to generate and invoke
> code at runtime.
I've been able to do this since the release of .NET 4 with [`CSharpCodeProvider.CompileAssemblyFromSource`][3] which I in fact use in an ASP.Net project written awhile ago that does exactly that - allows a user to type in code into a textbox, choose assemblies/namespaces to reference, and then execute and display the output from that code on-the-fly for live environment code testing on Windows Azure.
Is `CodeDom` part of / a precurser to Roslyn? What's the special benefit of Roslyn over `CodeDom`?
[1]: http://www.infoworld.com/d/application-development/microsofts-roslyn-reinventing-the-compiler-we-know-it-176671
[2]: http://www.microsoft.com/download/en/details.aspx?id=27746
[3]: http://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider.compileassemblyfromsource.aspx | .net | codedom | roslyn-ctp | null | null | null | open | Microsoft Roslyn vs. CodeDom
===
From a [press release][1] yesterday on InfoWorld regarding the new [Microsoft Roslyn][2]:
> The most obvious advantage of this kind of "deconstructed" compiler is
> that it allows the entire compile-execute process to be invoked from
> within .Net applications. Hejlsberg demonstrated a C# program that
> passed a few code snippets to the C# compiler as strings; the compiler
> returned the resulting IL assembly code as an object, which was then
> passed to the Common Language Runtime (CLR) for execution. Voilà! With
> Roslyn, C# gains a dynamic language's ability to generate and invoke
> code at runtime.
I've been able to do this since the release of .NET 4 with [`CSharpCodeProvider.CompileAssemblyFromSource`][3] which I in fact use in an ASP.Net project written awhile ago that does exactly that - allows a user to type in code into a textbox, choose assemblies/namespaces to reference, and then execute and display the output from that code on-the-fly for live environment code testing on Windows Azure.
Is `CodeDom` part of / a precurser to Roslyn? What's the special benefit of Roslyn over `CodeDom`?
[1]: http://www.infoworld.com/d/application-development/microsofts-roslyn-reinventing-the-compiler-we-know-it-176671
[2]: http://www.microsoft.com/download/en/details.aspx?id=27746
[3]: http://msdn.microsoft.com/en-us/library/system.codedom.compiler.codedomprovider.compileassemblyfromsource.aspx | 0 |
7,828,248 | 10/19/2011 21:14:23 | 815,408 | 06/25/2011 14:33:19 | 119 | 0 | Make y-axis logarithmic in histogram using R | Hi I'm making histogram using R, but the number of Y axis is so large that I need to turn it into logarithmic.See below my script:
hplot<-read.table("libl")
hplot
pdf("first_end")
hist(hplot$V1, breaks=24, xlim=c(0,250000000), ylim=c(0,2000000),main="first end mapping", xlab="Coordinates")
dev.off()
So how should I change my script?
thx | r | histogram | logarithm | null | null | null | open | Make y-axis logarithmic in histogram using R
===
Hi I'm making histogram using R, but the number of Y axis is so large that I need to turn it into logarithmic.See below my script:
hplot<-read.table("libl")
hplot
pdf("first_end")
hist(hplot$V1, breaks=24, xlim=c(0,250000000), ylim=c(0,2000000),main="first end mapping", xlab="Coordinates")
dev.off()
So how should I change my script?
thx | 0 |
10,493,978 | 05/08/2012 06:52:33 | 371,178 | 06/19/2010 18:46:01 | 164 | 2 | Python API wrapper design pattern | I'm trying to build a library that will build XML responses for an API, a sample response for a Menu would be:
<CiscoIPPhoneMenu>
<Title>Title text goes here</Title>
<Prompt>Prompt text goes here</Prompt>
<MenuItem>
<Name>The name of each menu item</Name>
<URL>The URL associated with the menu item</URL>
</MenuItem>
<SoftKeyItem>
<Name>Name of soft key</Name>
<URL>URL or URI of soft key</URL>
<Position>Position information of the soft key</Position>
</SoftKeyItem>
</CiscoIPPhoneMenu>
And one to display Text would be:
<CiscoIPPhoneText>
<Title>Title text goes here</Title>
<Prompt>The prompt text goes here</Prompt>
<Text>The text to be displayed as the message body goes here</Text>
<SoftKeyItem>
<Name>Name of soft key</Name>
<URL>URL or URI of soft key</URL>
<Position>Position information of the soft key</Position>
<SoftKeyItem>
</CiscoIPPhoneText>
As you can see, both of these share common attributes: title, prompt, and softkeys, so using abstract classes would make sense.
My module outline looks like this:
class CiscoIPPhone(object):
def __init__(self, title=None, prompt=None):
self.title = title
self.prompt = prompt
class MenuItem(object):
def __init__(self, name=name, url=url):
self.name = name
self.url = url
class CiscoIPPhoneMenu(CiscoIPPhone):
def __init__(self, *args, **kwargs):
super(CiscoIPPhoneMenu, self).__init__(*args, **kwargs)
self.items = []
def add_menu(self, name, url):
self.items.append(MenuItem(name, url))
Note: for readability I removed the validation and sanitization these classes handle.
So my questions are:
1. I'm *practically* outputting a serialized representation of these objects, is doing it this considered wrong or bad practice?
2. Is there an design pattern that describes this kind of API wrapper class?
3. Is there a Python package I can reference that does something similar? | python | api | class | design-patterns | null | null | open | Python API wrapper design pattern
===
I'm trying to build a library that will build XML responses for an API, a sample response for a Menu would be:
<CiscoIPPhoneMenu>
<Title>Title text goes here</Title>
<Prompt>Prompt text goes here</Prompt>
<MenuItem>
<Name>The name of each menu item</Name>
<URL>The URL associated with the menu item</URL>
</MenuItem>
<SoftKeyItem>
<Name>Name of soft key</Name>
<URL>URL or URI of soft key</URL>
<Position>Position information of the soft key</Position>
</SoftKeyItem>
</CiscoIPPhoneMenu>
And one to display Text would be:
<CiscoIPPhoneText>
<Title>Title text goes here</Title>
<Prompt>The prompt text goes here</Prompt>
<Text>The text to be displayed as the message body goes here</Text>
<SoftKeyItem>
<Name>Name of soft key</Name>
<URL>URL or URI of soft key</URL>
<Position>Position information of the soft key</Position>
<SoftKeyItem>
</CiscoIPPhoneText>
As you can see, both of these share common attributes: title, prompt, and softkeys, so using abstract classes would make sense.
My module outline looks like this:
class CiscoIPPhone(object):
def __init__(self, title=None, prompt=None):
self.title = title
self.prompt = prompt
class MenuItem(object):
def __init__(self, name=name, url=url):
self.name = name
self.url = url
class CiscoIPPhoneMenu(CiscoIPPhone):
def __init__(self, *args, **kwargs):
super(CiscoIPPhoneMenu, self).__init__(*args, **kwargs)
self.items = []
def add_menu(self, name, url):
self.items.append(MenuItem(name, url))
Note: for readability I removed the validation and sanitization these classes handle.
So my questions are:
1. I'm *practically* outputting a serialized representation of these objects, is doing it this considered wrong or bad practice?
2. Is there an design pattern that describes this kind of API wrapper class?
3. Is there a Python package I can reference that does something similar? | 0 |
2,408,316 | 03/09/2010 10:34:55 | 202,020 | 11/03/2009 19:32:01 | 375 | 25 | Find Users E-Mail via SID using VBScript and ADSI | I am parsing log messages about changes to user accounts on a windows system.
I want to notify the user about the changes so I need to retrieve their personal
information (First,Last, E-Mail) from Active Directory.
I already found a way to retrieve the username but that is only via WMI and not ADSI:
Function FindUser(Message)
Dim objWMIService
Dim strAccountRegex
Dim objRegex
Dim objMatch
Dim strComputer
Dim objUser
Dim objShell
strAccountRegex = "(\%\{[A-Z,0-9,\-]*\})"
strComputer = "."
Wscript.StdOut.writeLine "Querying WMI to retrieve user-data"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objShell = WScript.CreateObject("WScript.Shell")
Set objRegex = new RegExp
objRegex.Pattern= strAccountRegex
for each objMatch in objRegex.Execute(Message)
REM Wscript.StdOut.writeLine "Found an Account ID: " & objMatch.value
Dim strSID
strSID=NormalizeSID(objMatch.value)
REM Wscript.Echo "SID after escaping: " & strSID
Set objUser = objWMIService.Get _
("Win32_SID.SID='" & strSID & "'")
next
FindUser=objUser.ReferencedDomainName & "\" & objUser.AccountName
End Function
It works fine, but I would like to do it via Active Directory instead of going via WMI.
Can you help me? | vbscript | adsi | active-directory | windows | null | null | open | Find Users E-Mail via SID using VBScript and ADSI
===
I am parsing log messages about changes to user accounts on a windows system.
I want to notify the user about the changes so I need to retrieve their personal
information (First,Last, E-Mail) from Active Directory.
I already found a way to retrieve the username but that is only via WMI and not ADSI:
Function FindUser(Message)
Dim objWMIService
Dim strAccountRegex
Dim objRegex
Dim objMatch
Dim strComputer
Dim objUser
Dim objShell
strAccountRegex = "(\%\{[A-Z,0-9,\-]*\})"
strComputer = "."
Wscript.StdOut.writeLine "Querying WMI to retrieve user-data"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objShell = WScript.CreateObject("WScript.Shell")
Set objRegex = new RegExp
objRegex.Pattern= strAccountRegex
for each objMatch in objRegex.Execute(Message)
REM Wscript.StdOut.writeLine "Found an Account ID: " & objMatch.value
Dim strSID
strSID=NormalizeSID(objMatch.value)
REM Wscript.Echo "SID after escaping: " & strSID
Set objUser = objWMIService.Get _
("Win32_SID.SID='" & strSID & "'")
next
FindUser=objUser.ReferencedDomainName & "\" & objUser.AccountName
End Function
It works fine, but I would like to do it via Active Directory instead of going via WMI.
Can you help me? | 0 |
6,690,822 | 07/14/2011 09:03:00 | 705,729 | 04/13/2011 09:42:41 | 596 | 26 | How can I ensure that IsInRole checks are not using cached credentials | I have a WPF client that connects to a WCF service, and I want to lock down some of the functionality so that only certain users can perform certain actions. The WCF service impersonates the client user when executing service methods. The OS is Windows XP.
I was reading [this question][1] as part of my investigation into the best way to apply user roles to features in my application (I want to assign users to AD security groups, and then check IsInRole), and am worried that cached permissions will allow users who have had their permissions reduced to access functionality they no longer have permission to. Conversely, I am also worried that users who have had their permissions upgraded will need to log out of their windows account, or even that the WCF service might have to be restarted (worst case scenario) before they can access the new functionality.
What is the simplest way to ensure that both client and server can immediately see changes to the AD security groups?
[1]: http://stackoverflow.com/questions/5042847/check-isinrole-against-ad | wcf | active-directory | wcf-security | windows-principal | null | null | open | How can I ensure that IsInRole checks are not using cached credentials
===
I have a WPF client that connects to a WCF service, and I want to lock down some of the functionality so that only certain users can perform certain actions. The WCF service impersonates the client user when executing service methods. The OS is Windows XP.
I was reading [this question][1] as part of my investigation into the best way to apply user roles to features in my application (I want to assign users to AD security groups, and then check IsInRole), and am worried that cached permissions will allow users who have had their permissions reduced to access functionality they no longer have permission to. Conversely, I am also worried that users who have had their permissions upgraded will need to log out of their windows account, or even that the WCF service might have to be restarted (worst case scenario) before they can access the new functionality.
What is the simplest way to ensure that both client and server can immediately see changes to the AD security groups?
[1]: http://stackoverflow.com/questions/5042847/check-isinrole-against-ad | 0 |
5,311,052 | 03/15/2011 11:29:56 | 39,321 | 11/20/2008 13:51:35 | 9,582 | 191 | Getting started with integration testing | I learned nothing about testing during my 3 years of computer engineering. We were mostly just told that it was very important.
Anyways, I managed to get started with Unit Testing on my own thanks to a talk by Roy Osherove and his book [The Art of Unit Testing][1]. Very helpful, clear and to the point.
Problem now is that there of course are a lot of code that requires for example databases or web services. I can mock these take them out of the equation which is good for unit tests, but it does leave quite a bit of my code untested. Are there any good books or resources that are up to date, with very little fluff, which can help me get started with integration tests? Preferably with focus on C#.
[1]: http://www.manning.com/osherove/ | c# | testing | integration-testing | getting-started | null | null | open | Getting started with integration testing
===
I learned nothing about testing during my 3 years of computer engineering. We were mostly just told that it was very important.
Anyways, I managed to get started with Unit Testing on my own thanks to a talk by Roy Osherove and his book [The Art of Unit Testing][1]. Very helpful, clear and to the point.
Problem now is that there of course are a lot of code that requires for example databases or web services. I can mock these take them out of the equation which is good for unit tests, but it does leave quite a bit of my code untested. Are there any good books or resources that are up to date, with very little fluff, which can help me get started with integration tests? Preferably with focus on C#.
[1]: http://www.manning.com/osherove/ | 0 |
6,487,794 | 06/27/2011 01:10:07 | 645,402 | 03/04/2011 20:41:41 | 29 | 1 | view won't redraw... | when a user selects a menu option, I catch it in onMenuItemSelected and then call
findViewById(R.id.xyz).setVisibility(View.VISIBLE);
But the view doesn't become visible. I tried all kinds of things to force a redraw, but it just won't redraw.
ideas? | android | window | redraw | null | null | null | open | view won't redraw...
===
when a user selects a menu option, I catch it in onMenuItemSelected and then call
findViewById(R.id.xyz).setVisibility(View.VISIBLE);
But the view doesn't become visible. I tried all kinds of things to force a redraw, but it just won't redraw.
ideas? | 0 |
8,977,958 | 01/23/2012 20:14:39 | 976,746 | 10/03/2011 13:19:34 | 8 | 0 | Realtime PHP,Javascript,MySQL MMORPG Optimization Tips | Hi i want to create a realtime mmorpg where i can see other players moving and things like that, using javascript (AJAX/JSON), php and mysql. i already made an engine like that a while ago, but when too many players were moveing at same time (in a not so good shared hosting) i took like 10 seconds to move and thats a lot.
What i Did in that engine
- JSON for moving, so i only ask for the new players position on screen and updated it with JS, saving a lot of bandwidth
- MySQL PLayers Position table were a MEMORY table so it access time was fast
- Used the JQuery Framework for ajax
I'd like to know if anyone has any tips or methods that i can use to make a game like that possible in a not so powerful host and not many players online (like 50)
Thanks | php | mysql | optimization | mmorpg | null | 01/23/2012 20:25:01 | not a real question | Realtime PHP,Javascript,MySQL MMORPG Optimization Tips
===
Hi i want to create a realtime mmorpg where i can see other players moving and things like that, using javascript (AJAX/JSON), php and mysql. i already made an engine like that a while ago, but when too many players were moveing at same time (in a not so good shared hosting) i took like 10 seconds to move and thats a lot.
What i Did in that engine
- JSON for moving, so i only ask for the new players position on screen and updated it with JS, saving a lot of bandwidth
- MySQL PLayers Position table were a MEMORY table so it access time was fast
- Used the JQuery Framework for ajax
I'd like to know if anyone has any tips or methods that i can use to make a game like that possible in a not so powerful host and not many players online (like 50)
Thanks | 1 |
10,045,312 | 04/06/2012 15:03:09 | 348,072 | 05/23/2010 00:27:49 | 103 | 0 | Python: How to program an IDE Code collapsing? | I'm learning Python and want to make a small text editor that would allow the code collapsing like when def a Function, how you can collapse that to a single line.
I'm thinking of using Tkinter but would be open to other environments.
I mainly want to know what widget I should use, I'd like to think that I'd be able to figure out how to do it. (Although an example is always welcome.)
Thanks. | python | null | null | null | null | 04/06/2012 22:07:42 | not a real question | Python: How to program an IDE Code collapsing?
===
I'm learning Python and want to make a small text editor that would allow the code collapsing like when def a Function, how you can collapse that to a single line.
I'm thinking of using Tkinter but would be open to other environments.
I mainly want to know what widget I should use, I'd like to think that I'd be able to figure out how to do it. (Although an example is always welcome.)
Thanks. | 1 |
1,872,033 | 12/09/2009 06:41:36 | 110,251 | 05/20/2009 23:37:47 | 132 | 6 | C# .Net Concurrency Books? | I have many C# books that all have one small section on Threads and maybe another on Delegates and Lamdas, however, I can't seem to find a book where the primary focus is Concurrency. Can anyone recommend a book on using Concurrency when writing C#.net apps?
I have found several books on Concurrency principles, but I need actual code samples.
Thanks! | c# | .net | concurrency | books | null | 09/22/2011 00:51:53 | not constructive | C# .Net Concurrency Books?
===
I have many C# books that all have one small section on Threads and maybe another on Delegates and Lamdas, however, I can't seem to find a book where the primary focus is Concurrency. Can anyone recommend a book on using Concurrency when writing C#.net apps?
I have found several books on Concurrency principles, but I need actual code samples.
Thanks! | 4 |
7,885,056 | 10/25/2011 05:29:35 | 236,501 | 12/17/2009 07:05:31 | 542 | 0 | Prolog counting elements in list | I want to count how many g items appear in a list, below is the code I was trying now, but I got false when return.
g(E) :- memberchk(E, [apple, orange, pear, grape, lycee, pineapple,dragonfruit]).
countFruit([], No):- write(' >> No of Fruits : '), write(No), nl.
countFruit([H|T], No) :- not(g(H)), countFruit(T,No).
countFruit([H|T], No) :- No1 is No+1, countFruit(T,No1).
?countFruit(H,0). (H is a list). | list | prolog | null | null | null | null | open | Prolog counting elements in list
===
I want to count how many g items appear in a list, below is the code I was trying now, but I got false when return.
g(E) :- memberchk(E, [apple, orange, pear, grape, lycee, pineapple,dragonfruit]).
countFruit([], No):- write(' >> No of Fruits : '), write(No), nl.
countFruit([H|T], No) :- not(g(H)), countFruit(T,No).
countFruit([H|T], No) :- No1 is No+1, countFruit(T,No1).
?countFruit(H,0). (H is a list). | 0 |
9,110,829 | 02/02/2012 10:35:48 | 324,400 | 04/23/2010 16:42:36 | 37 | 1 | List<List<bool>> and Contains method | I have a `List<List<bool>>` collection. I fail to check if it contains some `List<bool>` element. I've tried `Contains` method and compared elements with `==` also. | c# | list | collections | null | null | 02/03/2012 22:14:15 | not a real question | List<List<bool>> and Contains method
===
I have a `List<List<bool>>` collection. I fail to check if it contains some `List<bool>` element. I've tried `Contains` method and compared elements with `==` also. | 1 |
7,080,708 | 08/16/2011 15:24:13 | 215,969 | 11/21/2009 05:45:14 | 1,454 | 119 | How to stop OpenLayers from loading firebug lite | When I started working with OpenLayers, console.log stopped working and I kept getting this error in the chrome terminal.
GET http://127.0.0.1/my/private/dir/undefined/firebug.html 404 (Not Found)
At first I didn't realize it was OL so I uninstalled the firebug lite plugin. Then I checked the OL source and found where it's trying to inject firebug.
y=document.createElement("iframe");y.setAttribute("src",o+"/firebug.html");
Is there a way to prevent OL from doing that other than modifying the source.
| javascript | google-chrome | firebug | openlayers | firebug-lite | null | open | How to stop OpenLayers from loading firebug lite
===
When I started working with OpenLayers, console.log stopped working and I kept getting this error in the chrome terminal.
GET http://127.0.0.1/my/private/dir/undefined/firebug.html 404 (Not Found)
At first I didn't realize it was OL so I uninstalled the firebug lite plugin. Then I checked the OL source and found where it's trying to inject firebug.
y=document.createElement("iframe");y.setAttribute("src",o+"/firebug.html");
Is there a way to prevent OL from doing that other than modifying the source.
| 0 |
5,579,779 | 04/07/2011 10:41:23 | 694,567 | 04/06/2011 09:43:08 | -1 | 0 | interger to its prime factors | hey i need to desing a program that inputs an integer and outputs the prime factors of the integer example
660 input n output is 2 2 3 5 11
| homework | null | null | null | null | null | open | interger to its prime factors
===
hey i need to desing a program that inputs an integer and outputs the prime factors of the integer example
660 input n output is 2 2 3 5 11
| 0 |
10,894,357 | 06/05/2012 08:58:36 | 1,436,911 | 06/05/2012 08:47:57 | 1 | 1 | How to simulate Plug/Unplug of a USB in C# | I am new in Programming and I think I must go deep in programming.
We have a device connected to a USB port and during reboot enters in Low Power Mode, and It is unable to wake up after that, except if it is unplugged and plugged again.
I have tried devcon, but the device was not recognized correctly by windows and thus it did not work.
So far I have managed to make it work using a relay in the Power Line and this is what I want to simulate programaticaly if possible.
I know it is drivers but I have already contacted the company and they say it is a problem with their drivers but do not have a date for the fix and our deadline is coming really fast.
I have searched in the Internet and the only way to achieve it is by IOCTL_USB_HUB_CYCLE_PORT but I have no idea how to start..
Any help would be really valuable. In some forums they have made an effort but I have not find any example that works so far so if you please give me some hints with code would be really good for me.
ripping the USB cable and altering the shielding is not the best option that is why I am asking for help.
If you could please provide me with some extra info.
Thank you very much | usb | null | null | null | null | null | open | How to simulate Plug/Unplug of a USB in C#
===
I am new in Programming and I think I must go deep in programming.
We have a device connected to a USB port and during reboot enters in Low Power Mode, and It is unable to wake up after that, except if it is unplugged and plugged again.
I have tried devcon, but the device was not recognized correctly by windows and thus it did not work.
So far I have managed to make it work using a relay in the Power Line and this is what I want to simulate programaticaly if possible.
I know it is drivers but I have already contacted the company and they say it is a problem with their drivers but do not have a date for the fix and our deadline is coming really fast.
I have searched in the Internet and the only way to achieve it is by IOCTL_USB_HUB_CYCLE_PORT but I have no idea how to start..
Any help would be really valuable. In some forums they have made an effort but I have not find any example that works so far so if you please give me some hints with code would be really good for me.
ripping the USB cable and altering the shielding is not the best option that is why I am asking for help.
If you could please provide me with some extra info.
Thank you very much | 0 |
7,892,277 | 10/25/2011 16:10:48 | 548,634 | 12/20/2010 12:55:45 | 130 | 6 | How to read file from outside web directory (webpages dir) | I have the following scriptlet inside a JSP page.
File f = new File("//WEB-INF//music//rock//Evanascence//Fallen//text.txt");
FileReader fr = new FileReader(f);
out.println(f.exists());
I'm getting a
`FileNotFoundException: \\WEB-INF\music\rock\Evanascence\Fallen\text.txt (The network path was not found)` | java | jsp | null | null | null | null | open | How to read file from outside web directory (webpages dir)
===
I have the following scriptlet inside a JSP page.
File f = new File("//WEB-INF//music//rock//Evanascence//Fallen//text.txt");
FileReader fr = new FileReader(f);
out.println(f.exists());
I'm getting a
`FileNotFoundException: \\WEB-INF\music\rock\Evanascence\Fallen\text.txt (The network path was not found)` | 0 |
11,347,253 | 07/05/2012 15:10:07 | 1,504,352 | 07/05/2012 14:41:09 | 1 | 0 | Is Google App Engine Cost Effective? | I'm making a small mobile game where the player can choose to connect to facebook and in that case, see his friend's score and statistics.
I'm trying to calculate in advance how much does GAE will cost per user and will the income from ads will cover these expenses.
* The player can update his profile statistics, happens whenever a higher stat was achieved (higher score, etc...). There are a total of 6 statistics the game keep track of.
* The player can request to view friends profiles
Assuming an average player that plays for 30 minutes per day as a basis for calculations, and has 5 friends playing the game:
* The total number of updates to his own profile doesn't exceed 300 life.
* The number of profile requests is about 100/month (I cache profiles using memcache for 2 hours)
* According to GAE, the datastore pricing are $0.10/100K write ops and $0.07/100K read ops.
* The data structure of a player profile, consists of 7 fields and requires 16 ops to store/retrieve it.
The monthly cost per player:
* Write - [ (300 * 16) / 100000 ] * $0.10 = $0.0048 life
* Read - [ (10 * 10 * 16) / 100000 ] * $0.07 = $0.0016 monthly // 10 profile views per day times 10 days per month
So the average monthly cost per user, assuming the retention is 3 months will be $0.0032 and that consists of the datastore api pricing alone.
Assuming the retention is 3 months, the total play time per day is 30 minutes and the player plays for 10 days per month.
Does the earning from advertisements will cover the $0.0036/month cost ?
I will appreciate any insights or tips.
Thanks! | google-app-engine | mobile | advertising | monetization | null | 07/05/2012 18:07:03 | off topic | Is Google App Engine Cost Effective?
===
I'm making a small mobile game where the player can choose to connect to facebook and in that case, see his friend's score and statistics.
I'm trying to calculate in advance how much does GAE will cost per user and will the income from ads will cover these expenses.
* The player can update his profile statistics, happens whenever a higher stat was achieved (higher score, etc...). There are a total of 6 statistics the game keep track of.
* The player can request to view friends profiles
Assuming an average player that plays for 30 minutes per day as a basis for calculations, and has 5 friends playing the game:
* The total number of updates to his own profile doesn't exceed 300 life.
* The number of profile requests is about 100/month (I cache profiles using memcache for 2 hours)
* According to GAE, the datastore pricing are $0.10/100K write ops and $0.07/100K read ops.
* The data structure of a player profile, consists of 7 fields and requires 16 ops to store/retrieve it.
The monthly cost per player:
* Write - [ (300 * 16) / 100000 ] * $0.10 = $0.0048 life
* Read - [ (10 * 10 * 16) / 100000 ] * $0.07 = $0.0016 monthly // 10 profile views per day times 10 days per month
So the average monthly cost per user, assuming the retention is 3 months will be $0.0032 and that consists of the datastore api pricing alone.
Assuming the retention is 3 months, the total play time per day is 30 minutes and the player plays for 10 days per month.
Does the earning from advertisements will cover the $0.0036/month cost ?
I will appreciate any insights or tips.
Thanks! | 2 |
8,658,327 | 12/28/2011 16:12:56 | 835,609 | 07/08/2011 15:07:35 | 26 | 3 | Does Windows 8 Compile JavaScript? | It is exciting that Windows 8 is supporting so many languages for Metro App development. One that especially interested me was the HTML5/CSS/JavaScript. What I don't understand, is this code going to get compiled in a sort of executable (like the C#, VB, and C++ option), or would my app basically be running in IE as an actual web page? | metro | windows-8 | winrt | null | null | null | open | Does Windows 8 Compile JavaScript?
===
It is exciting that Windows 8 is supporting so many languages for Metro App development. One that especially interested me was the HTML5/CSS/JavaScript. What I don't understand, is this code going to get compiled in a sort of executable (like the C#, VB, and C++ option), or would my app basically be running in IE as an actual web page? | 0 |
4,855,149 | 01/31/2011 19:31:58 | 107,455 | 05/15/2009 03:13:52 | 1,827 | 126 | NHibernate: System.Argument Exception : An item with the same key has already been added | I'm getting a sporadic error that is difficult to reproduce. My first guess is that somehow I have a leaking nhibernate session, however when I ran the [nhibernate profiler][1], I didn't see much out of the ordinary.
- MVC 2.0
- Fluent version 1.1.0.685
- NHibernate version 2.1.2.4000
> Exception: System.ArgumentException :
> An item with the same key has already
> been added.
>
> Stack Trace: at
> System.Collections.Generic.Dictionary`2.Insert(TKey
> key, TValue value, Boolean add) at
> NHibernate.Util.ThreadSafeDictionary`2.Add(TKey
> key, TValue value) at
> NHibernate.SqlTypes.SqlTypeFactory.GetTypeWithLen[T](Int32
> length, TypeWithLenCreateDelegate
> createDelegate) at
> NHibernate.Type.EnumStringType..ctor(Type
> enumClass, Int32 length)
I am using a repository model. Here's my repository class.
public sealed class Repository<T> : IRepository<T> where T : CoreObjectBase
{
#region IRepository<T> Members
private ISession Session
{
get
{
return new SessionHelper().GetSession();
}
}
public IQueryable<T> GetAll()
{
return (from entity in Session.Linq<T>() select entity);
}
public T GetById(int id)
{
return Session.Get<T>(id);
}
public void Save(params T[] entities)
{
using (ITransaction tx = Session.BeginTransaction())
{
for (int x = 0; x < entities.Count(); x++)
{
var entity = entities[x];
entity.Validate();
Session.SaveOrUpdate(entities[x]);
if (x == entities.Count() - 1 || (x != 0 && x % 20 == 0)) //20 is the batch size
{
Session.Flush();
Session.Clear();
}
}
tx.Commit();
}
}
public void SaveWithDependence<K>(T entity, K dependant) where K : CoreObjectBase
{
entity.Validate();
dependant.Validate();
using (ITransaction tx = Session.BeginTransaction())
{
Session.SaveOrUpdate(entity);
Session.SaveOrUpdate(dependant);
tx.Commit();
}
}
public void Save(T entity)
{
entity.Validate();
using (ITransaction tx = Session.BeginTransaction())
{
Session.SaveOrUpdate(entity);
tx.Commit();
}
}
public void Delete(T entity)
{
using (ITransaction tx = Session.BeginTransaction())
{
Session.Delete(entity);
tx.Commit();
}
}
public T GetOne(QueryBase<T> query)
{
var result = query.SatisfyingElementFrom(Session.Linq<T>());
return result;
//return query.SatisfyingElementFrom(Session.Linq<T>());
}
public IQueryable<T> GetList(QueryBase<T> query)
{
return query.SatisfyingElementsFrom(Session.Linq<T>());
}
/// <summary>
/// remove the sepcific object from level 1 cache so it can be refreshed from the database
/// </summary>
/// <param name="entity"></param>
public void Evict(T entity)
{
Session.Evict(entity);
}
#endregion
}
And here is my session helper, adapted from [this][2].
public sealed class SessionHelper
{
private static ISessionFactory _sessionFactory;
private static ISession _currentSession;
public ISession GetSession()
{
ISessionFactory factory = getSessionFactory();
ISession session = getExistingOrNewSession(factory);
return session;
}
private ISessionFactory getSessionFactory()
{
if (_sessionFactory == null)
{
_sessionFactory = BuildSessionFactory();
}
return _sessionFactory;
}
private ISessionFactory BuildSessionFactory()
{
return Fluently.Configure().Database(
FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2005
.ConnectionString(c => c
.FromConnectionStringWithKey("MyDatabase"))
.AdoNetBatchSize(20))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SessionHelper>())
.BuildSessionFactory();
}
private ISession getExistingOrNewSession(ISessionFactory factory)
{
if (HttpContext.Current != null)
{
ISession session = GetExistingWebSession();
if (session == null)
{
session = openSessionAndAddToContext(factory);
}
else if (!session.IsOpen)
{
session = openSessionAndAddToContext(factory);
}
return session;
}
if (_currentSession == null)
{
_currentSession = factory.OpenSession();
}
else if (!_currentSession.IsOpen)
{
_currentSession = factory.OpenSession();
}
return _currentSession;
}
public ISession GetExistingWebSession()
{
return HttpContext.Current.Items[GetType().FullName] as ISession;
}
private ISession openSessionAndAddToContext(ISessionFactory factory)
{
ISession session = factory.OpenSession();
HttpContext.Current.Items.Remove(GetType().FullName);
HttpContext.Current.Items.Add(GetType().FullName, session);
return session;
}
}
Any ideas or suggestions to avoid this issue?
[1]: http://nhprof.com/
[2]: http://code.google.com/p/dot-net-reference-app/source/browse/trunk/src/Infrastructure/Impl/HybridSessionBuilder.cs | nhibernate | session | fluent-nhibernate | null | null | null | open | NHibernate: System.Argument Exception : An item with the same key has already been added
===
I'm getting a sporadic error that is difficult to reproduce. My first guess is that somehow I have a leaking nhibernate session, however when I ran the [nhibernate profiler][1], I didn't see much out of the ordinary.
- MVC 2.0
- Fluent version 1.1.0.685
- NHibernate version 2.1.2.4000
> Exception: System.ArgumentException :
> An item with the same key has already
> been added.
>
> Stack Trace: at
> System.Collections.Generic.Dictionary`2.Insert(TKey
> key, TValue value, Boolean add) at
> NHibernate.Util.ThreadSafeDictionary`2.Add(TKey
> key, TValue value) at
> NHibernate.SqlTypes.SqlTypeFactory.GetTypeWithLen[T](Int32
> length, TypeWithLenCreateDelegate
> createDelegate) at
> NHibernate.Type.EnumStringType..ctor(Type
> enumClass, Int32 length)
I am using a repository model. Here's my repository class.
public sealed class Repository<T> : IRepository<T> where T : CoreObjectBase
{
#region IRepository<T> Members
private ISession Session
{
get
{
return new SessionHelper().GetSession();
}
}
public IQueryable<T> GetAll()
{
return (from entity in Session.Linq<T>() select entity);
}
public T GetById(int id)
{
return Session.Get<T>(id);
}
public void Save(params T[] entities)
{
using (ITransaction tx = Session.BeginTransaction())
{
for (int x = 0; x < entities.Count(); x++)
{
var entity = entities[x];
entity.Validate();
Session.SaveOrUpdate(entities[x]);
if (x == entities.Count() - 1 || (x != 0 && x % 20 == 0)) //20 is the batch size
{
Session.Flush();
Session.Clear();
}
}
tx.Commit();
}
}
public void SaveWithDependence<K>(T entity, K dependant) where K : CoreObjectBase
{
entity.Validate();
dependant.Validate();
using (ITransaction tx = Session.BeginTransaction())
{
Session.SaveOrUpdate(entity);
Session.SaveOrUpdate(dependant);
tx.Commit();
}
}
public void Save(T entity)
{
entity.Validate();
using (ITransaction tx = Session.BeginTransaction())
{
Session.SaveOrUpdate(entity);
tx.Commit();
}
}
public void Delete(T entity)
{
using (ITransaction tx = Session.BeginTransaction())
{
Session.Delete(entity);
tx.Commit();
}
}
public T GetOne(QueryBase<T> query)
{
var result = query.SatisfyingElementFrom(Session.Linq<T>());
return result;
//return query.SatisfyingElementFrom(Session.Linq<T>());
}
public IQueryable<T> GetList(QueryBase<T> query)
{
return query.SatisfyingElementsFrom(Session.Linq<T>());
}
/// <summary>
/// remove the sepcific object from level 1 cache so it can be refreshed from the database
/// </summary>
/// <param name="entity"></param>
public void Evict(T entity)
{
Session.Evict(entity);
}
#endregion
}
And here is my session helper, adapted from [this][2].
public sealed class SessionHelper
{
private static ISessionFactory _sessionFactory;
private static ISession _currentSession;
public ISession GetSession()
{
ISessionFactory factory = getSessionFactory();
ISession session = getExistingOrNewSession(factory);
return session;
}
private ISessionFactory getSessionFactory()
{
if (_sessionFactory == null)
{
_sessionFactory = BuildSessionFactory();
}
return _sessionFactory;
}
private ISessionFactory BuildSessionFactory()
{
return Fluently.Configure().Database(
FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2005
.ConnectionString(c => c
.FromConnectionStringWithKey("MyDatabase"))
.AdoNetBatchSize(20))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SessionHelper>())
.BuildSessionFactory();
}
private ISession getExistingOrNewSession(ISessionFactory factory)
{
if (HttpContext.Current != null)
{
ISession session = GetExistingWebSession();
if (session == null)
{
session = openSessionAndAddToContext(factory);
}
else if (!session.IsOpen)
{
session = openSessionAndAddToContext(factory);
}
return session;
}
if (_currentSession == null)
{
_currentSession = factory.OpenSession();
}
else if (!_currentSession.IsOpen)
{
_currentSession = factory.OpenSession();
}
return _currentSession;
}
public ISession GetExistingWebSession()
{
return HttpContext.Current.Items[GetType().FullName] as ISession;
}
private ISession openSessionAndAddToContext(ISessionFactory factory)
{
ISession session = factory.OpenSession();
HttpContext.Current.Items.Remove(GetType().FullName);
HttpContext.Current.Items.Add(GetType().FullName, session);
return session;
}
}
Any ideas or suggestions to avoid this issue?
[1]: http://nhprof.com/
[2]: http://code.google.com/p/dot-net-reference-app/source/browse/trunk/src/Infrastructure/Impl/HybridSessionBuilder.cs | 0 |
6,710,273 | 07/15/2011 16:34:26 | 194,076 | 10/21/2009 19:48:10 | 616 | 27 | What is the good way to access one object in different methods | I have an object person that I'm using in several methods on the front-end. How do I do that best? create new instance every time? or do public? or something else? seems pretty basic question to me. | c# | null | null | null | null | 07/17/2011 12:16:05 | not a real question | What is the good way to access one object in different methods
===
I have an object person that I'm using in several methods on the front-end. How do I do that best? create new instance every time? or do public? or something else? seems pretty basic question to me. | 1 |
1,703,298 | 11/09/2009 19:49:12 | 207,193 | 11/09/2009 18:52:46 | 1 | 0 | How to not be an IT programmer? | I'll make this short and sweet. I like working with technologies that I'm currently not working with at my full time job. I like working with technologies that you don't usually see in a typical IT department( objective c, RoR, objective j/cappucino ). How do I move to a job that uses these technologies?
I feel like I'm in quicksand and when my head goes under this will mean I'm stuck doing boring .NET/Java IT business web app programming for the rest of my life. Right now, I can only see two options:
1. Develop a portfolio of projects that I create using the technologies I'm interested in.
To me this seems like the obvious choice but it still seems to me, and I may be wrong, that it may not be enough.
2. Go back and get a MSCS. Now I know that I probably won't be using these technologies in any of my classes, but the masters may get me on interviews that I may not get on otherwise.
I don't know if you were hiring someone would you want someone with projects that they've built with the technology that your hiring for or someone with more education?
I could do both but then I will be spreading my self then and I won't be able to do either very well probably. | career-development | null | null | null | null | 02/06/2012 21:56:09 | off topic | How to not be an IT programmer?
===
I'll make this short and sweet. I like working with technologies that I'm currently not working with at my full time job. I like working with technologies that you don't usually see in a typical IT department( objective c, RoR, objective j/cappucino ). How do I move to a job that uses these technologies?
I feel like I'm in quicksand and when my head goes under this will mean I'm stuck doing boring .NET/Java IT business web app programming for the rest of my life. Right now, I can only see two options:
1. Develop a portfolio of projects that I create using the technologies I'm interested in.
To me this seems like the obvious choice but it still seems to me, and I may be wrong, that it may not be enough.
2. Go back and get a MSCS. Now I know that I probably won't be using these technologies in any of my classes, but the masters may get me on interviews that I may not get on otherwise.
I don't know if you were hiring someone would you want someone with projects that they've built with the technology that your hiring for or someone with more education?
I could do both but then I will be spreading my self then and I won't be able to do either very well probably. | 2 |
8,777,423 | 01/08/2012 12:19:31 | 996,783 | 10/15/2011 11:21:08 | 8 | 0 | Assigning values to richtextbox | I want to assign texts to richtextbox,
richTextEditor.Lines[1] = "sdfdsf"; // Not working
Thanks | c# | null | null | null | null | 01/09/2012 10:30:50 | not a real question | Assigning values to richtextbox
===
I want to assign texts to richtextbox,
richTextEditor.Lines[1] = "sdfdsf"; // Not working
Thanks | 1 |
6,579,382 | 07/05/2011 07:45:15 | 661,859 | 03/16/2011 05:00:30 | 29 | 4 | SocketException Connection Reset | I created a server which accept TCP connection . After connected to socket it looping for reading data from input stream.
Strps :
1. I started my server.
2. Start Client.
Now I am closing client.
Then Server gives me SocketException Connection Reset
How do I check that my client is alive or not before reading from input stream. | java | networking | null | null | null | null | open | SocketException Connection Reset
===
I created a server which accept TCP connection . After connected to socket it looping for reading data from input stream.
Strps :
1. I started my server.
2. Start Client.
Now I am closing client.
Then Server gives me SocketException Connection Reset
How do I check that my client is alive or not before reading from input stream. | 0 |
10,142,725 | 04/13/2012 14:28:56 | 1,326,394 | 04/11/2012 11:13:43 | 6 | 0 | Skype4COM get all recent chat's in recents | I've made a code to get all contacts, but Now I would like to get all chat groups. Please do not read anymore of this topic if you have never used the Skype4COM API.
Used to collect all contacs
try
{
for (int i = 0; i < skype.HardwiredGroups.Count; i++)
if (skype.HardwiredGroups[i + 1].Type == TGroupType.grpAllFriends)
{
for (int j = skype.HardwiredGroups[i + 1].Users.Count; j > 0; j--)
listBox1.Items.Add(skype.HardwiredGroups[i + 1].Users[j].Handle);
button17.Enabled = false;
break;
}
}
catch (Exception eoi){}
Any idea to build a list of groups? | c# | null | null | null | null | null | open | Skype4COM get all recent chat's in recents
===
I've made a code to get all contacts, but Now I would like to get all chat groups. Please do not read anymore of this topic if you have never used the Skype4COM API.
Used to collect all contacs
try
{
for (int i = 0; i < skype.HardwiredGroups.Count; i++)
if (skype.HardwiredGroups[i + 1].Type == TGroupType.grpAllFriends)
{
for (int j = skype.HardwiredGroups[i + 1].Users.Count; j > 0; j--)
listBox1.Items.Add(skype.HardwiredGroups[i + 1].Users[j].Handle);
button17.Enabled = false;
break;
}
}
catch (Exception eoi){}
Any idea to build a list of groups? | 0 |
7,672,340 | 10/06/2011 09:18:13 | 954,687 | 09/20/2011 11:56:50 | 13 | 0 | How can I reload a facebook page? | How can I reload a facebook page ?
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
$(document).ready(function(){
/*var host = '<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yahoo.com&send=false&layout=button_count&width=90&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>';
$(".like_frame").append(host);*/
$appdomain = 'http://www.facebook.com/apps/application.php?id=263130783727234&sk=app_263130783727234';
$(".likebtn").attr("href",$appdomain);
FB.Event.subscribe('edge.create',
function(response) {
window.location.reload();
}
);
});
</script>
<fb:like href="http://www.facebook.com/apps/application.php?id=appid&sk=app" width="450" height="80" class="likebtn"/>
As I click on the like button, I need to reload the facebook page.However, the above code redirects me to http://www.facebook.com/insights/?sk=po_263130783727234..
How do I reload my facebook page ?
| facebook | null | null | null | null | null | open | How can I reload a facebook page?
===
How can I reload a facebook page ?
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script type="text/javascript">
$(document).ready(function(){
/*var host = '<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yahoo.com&send=false&layout=button_count&width=90&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>';
$(".like_frame").append(host);*/
$appdomain = 'http://www.facebook.com/apps/application.php?id=263130783727234&sk=app_263130783727234';
$(".likebtn").attr("href",$appdomain);
FB.Event.subscribe('edge.create',
function(response) {
window.location.reload();
}
);
});
</script>
<fb:like href="http://www.facebook.com/apps/application.php?id=appid&sk=app" width="450" height="80" class="likebtn"/>
As I click on the like button, I need to reload the facebook page.However, the above code redirects me to http://www.facebook.com/insights/?sk=po_263130783727234..
How do I reload my facebook page ?
| 0 |
8,380,256 | 12/05/2011 01:59:20 | 1,079,555 | 12/03/2011 23:54:36 | 46 | 0 | Programming Challenge | You have a room-full of balances and weights. Each balance weighs ten pounds and is considered perfectly balanced when the sum of weights on its left and right sides are exactly the same. You have placed some weights on some of the balances, and you have placed some of the balances on other balances. Given a description of how the balances are arranged and how much additional weight is on each balance, determine how to add weight to the balances so that they are all perfectly balanced.
There may be more than one way to balance everything, but always choose the way that places additional weight on the lowest balances.
The input file will begin with a single integer, N, specifying how many balances there are.
Balance 0 is specified by lines 1 and 2, balance 1 is specified by lines 3 and 4, etc...
Each pair of lines is formatted as follows:
WL <balances>
WR <balances>
WL and WR indicate the weight added to the left and right sides, respectively. <balances> is a space-delimited list of the other balance that are on that side of this balance. <balances> may contain zero or more elements.
Consider the following input:
4
0 1
0 2
0
0 3
3
0
0
0
Balance 0 has balance 1 on its left side and balance 2 on its right side
Balance 1 has balance 3 on its right side
Balance 2 has three pounds on its left side
Balance 3 has nothing on it
Since balance 3 has nothing on it it is already perfectly balanced, and weighs a total of 10 pounds.
Balance 2 has no other balance on it, so all we need to do is balance it by putting three pounds on its right side. Now it weighs a total of 16 pounds.
Balance 1 has balance three on its right side, which weighs 10 pounds, so we just put 10 pounds on its left side. Balance 1 weighs a total of 30 pounds.
Balance 0 has balance 1 on its left side (30 pounds), and balance 2 on its right side (16 pounds), we can balance it by adding 14 pounds to the right side.
The output should be N lines long, with the nth line listing the weight added to the nth balance, formatted as follows:
<index>: <weight added to left side> <weight added to right side>
So the output for this problem would be:
0: 0 14
1: 10 0
2: 0 3
3: 0 0
i tried but i really bad at programming i guess, where should i start? please don't post the solution i want to learn thanks
| php | challenge | null | null | null | 12/05/2011 02:10:50 | not constructive | Programming Challenge
===
You have a room-full of balances and weights. Each balance weighs ten pounds and is considered perfectly balanced when the sum of weights on its left and right sides are exactly the same. You have placed some weights on some of the balances, and you have placed some of the balances on other balances. Given a description of how the balances are arranged and how much additional weight is on each balance, determine how to add weight to the balances so that they are all perfectly balanced.
There may be more than one way to balance everything, but always choose the way that places additional weight on the lowest balances.
The input file will begin with a single integer, N, specifying how many balances there are.
Balance 0 is specified by lines 1 and 2, balance 1 is specified by lines 3 and 4, etc...
Each pair of lines is formatted as follows:
WL <balances>
WR <balances>
WL and WR indicate the weight added to the left and right sides, respectively. <balances> is a space-delimited list of the other balance that are on that side of this balance. <balances> may contain zero or more elements.
Consider the following input:
4
0 1
0 2
0
0 3
3
0
0
0
Balance 0 has balance 1 on its left side and balance 2 on its right side
Balance 1 has balance 3 on its right side
Balance 2 has three pounds on its left side
Balance 3 has nothing on it
Since balance 3 has nothing on it it is already perfectly balanced, and weighs a total of 10 pounds.
Balance 2 has no other balance on it, so all we need to do is balance it by putting three pounds on its right side. Now it weighs a total of 16 pounds.
Balance 1 has balance three on its right side, which weighs 10 pounds, so we just put 10 pounds on its left side. Balance 1 weighs a total of 30 pounds.
Balance 0 has balance 1 on its left side (30 pounds), and balance 2 on its right side (16 pounds), we can balance it by adding 14 pounds to the right side.
The output should be N lines long, with the nth line listing the weight added to the nth balance, formatted as follows:
<index>: <weight added to left side> <weight added to right side>
So the output for this problem would be:
0: 0 14
1: 10 0
2: 0 3
3: 0 0
i tried but i really bad at programming i guess, where should i start? please don't post the solution i want to learn thanks
| 4 |
8,902,612 | 01/17/2012 22:28:27 | 1,146,910 | 01/13/2012 03:54:54 | 1 | 0 | How to customize an exponential? | I'm trying to come up with an equation that, with some parameters, produce a graph similar to an exponential function.
My problem is that a basic exponential grow too slow at first or too fast.
I want to be able to modify the curving of my graph so that I can tweak the growth rate. I want to use the values between 1 and 1 000 000 so if my equation break at infinity or in the negative, I don't mind.
I think I need to change some part of the equation a^x, but so far I've not been successfull. I tried many different equation on wolfram-alpha, but it's kinda hard to see the real impact of my changes.
Can anyone tell me in which way the basic exponential equation can be changed to give a specific "look" to my graph.
Hopefully, I'm not to vague, but if anyone could help me with some pointers I'd be gratefull.
Thanks | math | null | null | null | null | 01/17/2012 23:14:15 | off topic | How to customize an exponential?
===
I'm trying to come up with an equation that, with some parameters, produce a graph similar to an exponential function.
My problem is that a basic exponential grow too slow at first or too fast.
I want to be able to modify the curving of my graph so that I can tweak the growth rate. I want to use the values between 1 and 1 000 000 so if my equation break at infinity or in the negative, I don't mind.
I think I need to change some part of the equation a^x, but so far I've not been successfull. I tried many different equation on wolfram-alpha, but it's kinda hard to see the real impact of my changes.
Can anyone tell me in which way the basic exponential equation can be changed to give a specific "look" to my graph.
Hopefully, I'm not to vague, but if anyone could help me with some pointers I'd be gratefull.
Thanks | 2 |
8,377,375 | 12/04/2011 17:59:49 | 1,079,801 | 12/04/2011 06:27:32 | 1 | 0 | What does this number do in finding out the number of registry in RandomAcessFile (java) | I was wondering if anyone What does this number do, I have heard that it has to do something with bytes?, I really don't know.. could anyone please enlighten me:
public int total_reg()
{
try
{
int reg;
RandomAccessFile file = new RandomAccessFile(Ruta,"rw");
reg= (int) file.length();
file.close();
return (int) reg/684; //<---HERE WHAT IS THIS
}
catch(IOException e)
{
return 0;
}
} | java | file | random-access | null | null | 12/05/2011 02:10:25 | not a real question | What does this number do in finding out the number of registry in RandomAcessFile (java)
===
I was wondering if anyone What does this number do, I have heard that it has to do something with bytes?, I really don't know.. could anyone please enlighten me:
public int total_reg()
{
try
{
int reg;
RandomAccessFile file = new RandomAccessFile(Ruta,"rw");
reg= (int) file.length();
file.close();
return (int) reg/684; //<---HERE WHAT IS THIS
}
catch(IOException e)
{
return 0;
}
} | 1 |
5,470,028 | 03/29/2011 08:52:30 | 653,331 | 03/10/2011 10:26:00 | 32 | 0 | Building Blackberry Playbook App in Adobe AIR/FLEX | Ive been trying to write my first Blackberry Adobe Flex application but get the following errors:
`1172: Definition mx.controls:Label could not be found.`
Any idea why?
Thanks
Phil | flex | blackberry | adobe | null | null | null | open | Building Blackberry Playbook App in Adobe AIR/FLEX
===
Ive been trying to write my first Blackberry Adobe Flex application but get the following errors:
`1172: Definition mx.controls:Label could not be found.`
Any idea why?
Thanks
Phil | 0 |
4,519,895 | 12/23/2010 15:02:39 | 142,019 | 07/21/2009 13:42:41 | 3,526 | 156 | Using Ruby on Rails to fetch and parse JSON from another web service. | I'm using Ruby on Rails to connect to various external web services, including Flickr, to receive some JSON data. I'd like to request this data and ideally, get it parsed into a arrays and hashes.
How does one get JSON data over HTTP and turn it into arrays and hashes using Ruby on Rails? Thanks. | ruby-on-rails | arrays | json | http | hash | null | open | Using Ruby on Rails to fetch and parse JSON from another web service.
===
I'm using Ruby on Rails to connect to various external web services, including Flickr, to receive some JSON data. I'd like to request this data and ideally, get it parsed into a arrays and hashes.
How does one get JSON data over HTTP and turn it into arrays and hashes using Ruby on Rails? Thanks. | 0 |
207,223 | 10/16/2008 02:24:11 | 27,025 | 10/11/2008 07:11:54 | 8 | 1 | PHP Dynamic Pagination Without SQL | I've got a script that dynamically calls and displays images from a directory, what would be the best way to paginate this? I'd like to be able to control the number of images that are displayed per page through a variable within the script. I'm thinking of using URL varriables (ie - http://domain.com/page.php?page=1) but am unsure how to go about this.
Thanks for the help. | php | pagination | null | null | null | null | open | PHP Dynamic Pagination Without SQL
===
I've got a script that dynamically calls and displays images from a directory, what would be the best way to paginate this? I'd like to be able to control the number of images that are displayed per page through a variable within the script. I'm thinking of using URL varriables (ie - http://domain.com/page.php?page=1) but am unsure how to go about this.
Thanks for the help. | 0 |
11,294,832 | 07/02/2012 13:36:20 | 977,108 | 10/03/2011 17:06:20 | 20 | 1 | Consecutive number generator program on each execution | I would like to write a program that generates the consecutive number starting from 1 every time it is *executed*.
It will print 1 at the first execution, then it will print 2 at the next execution, and so on.
What is the shortest way to do this in Java? | java | null | null | null | null | 07/03/2012 07:11:23 | not a real question | Consecutive number generator program on each execution
===
I would like to write a program that generates the consecutive number starting from 1 every time it is *executed*.
It will print 1 at the first execution, then it will print 2 at the next execution, and so on.
What is the shortest way to do this in Java? | 1 |
4,740,706 | 01/19/2011 21:01:04 | 1,220,874 | 01/19/2011 20:36:43 | 1 | 0 | how to access remote camera from web | I want to develop web site which can access cameras for security purpose. I used php to develop my site.my requirement is when manager or security administrator logged in he can watch the live video from web site. How can i implement this? | php | security | video | streaming | null | 01/21/2011 10:51:24 | not a real question | how to access remote camera from web
===
I want to develop web site which can access cameras for security purpose. I used php to develop my site.my requirement is when manager or security administrator logged in he can watch the live video from web site. How can i implement this? | 1 |
2,121,617 | 01/23/2010 01:06:04 | 166,887 | 09/01/2009 21:47:52 | 64 | 1 | Can Someone Explain Threads to Me? | I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be considered nothing but a hindrance? Can someone point the way to some resources to help me learn more or explain here? | c++ | python | java | perl | multithreading | 11/03/2011 14:02:47 | not a real question | Can Someone Explain Threads to Me?
===
I have been considering adding threaded procedures to my application to speed up execution, but the problem is that I honestly have no idea how to use threads, or what is considered "thread safe". For example, how does a game engine utilize threads in its rendering processes, or in what contexts would threads only be considered nothing but a hindrance? Can someone point the way to some resources to help me learn more or explain here? | 1 |
4,423,033 | 12/12/2010 17:52:22 | 539,085 | 12/11/2010 19:04:35 | 5 | 1 | The Hashtable type in C# is implemented using chaining or open addressing? | If open addressing, how is the probe sequence generated. pls give links | algorithm | data-structures | null | null | null | null | open | The Hashtable type in C# is implemented using chaining or open addressing?
===
If open addressing, how is the probe sequence generated. pls give links | 0 |
6,785,256 | 07/22/2011 03:11:15 | 263,960 | 02/02/2010 00:19:07 | 427 | 1 | Button inside link doesn't work in IE | I have sitewiode styling of buttons using the <button> html element. For buttons that submit forms this works well. However some buttons are just links. Therefore I use this syntax:
<a href="#"><button>Link Text</button></a>
This works perfectly in all browsers except IE, where the button clicks but nothing happens. The link isn't followed.
How can I get this to work in IE? | html | css | null | null | null | null | open | Button inside link doesn't work in IE
===
I have sitewiode styling of buttons using the <button> html element. For buttons that submit forms this works well. However some buttons are just links. Therefore I use this syntax:
<a href="#"><button>Link Text</button></a>
This works perfectly in all browsers except IE, where the button clicks but nothing happens. The link isn't followed.
How can I get this to work in IE? | 0 |
5,976,090 | 05/12/2011 09:40:47 | 147,572 | 07/30/2009 03:47:25 | 67 | 1 | Can not make swipe gesture work. | I've tried to make swipe gesture for user swipe to left and right.
Fortunately, I found useful example in Professional iPhone Programming with MonoTouch and .NET/C# chapter page 292 Recognizing Gestures and this article.
However, when I run this code in simulator, nothing happen. What is I miss?
Please could you suggest me to make thing work.
I also attach this code you can download by the following link. http://www.7749tutor.com/code/iPad06.zip
Please, have a look at line 31 of MyViewController.cs file
Looking forward to hearing from you.
Best wishest
embarus
| monotouch | null | null | null | null | null | open | Can not make swipe gesture work.
===
I've tried to make swipe gesture for user swipe to left and right.
Fortunately, I found useful example in Professional iPhone Programming with MonoTouch and .NET/C# chapter page 292 Recognizing Gestures and this article.
However, when I run this code in simulator, nothing happen. What is I miss?
Please could you suggest me to make thing work.
I also attach this code you can download by the following link. http://www.7749tutor.com/code/iPad06.zip
Please, have a look at line 31 of MyViewController.cs file
Looking forward to hearing from you.
Best wishest
embarus
| 0 |
636,649 | 03/11/2009 22:35:55 | 48,705 | 12/23/2008 17:57:58 | 306 | 10 | What is the best Workflow tool | Preferable free, open source, vcl. For Delphi 2007 or above and win32. | workflow | delphi | winapi | null | null | 08/01/2012 02:24:25 | not constructive | What is the best Workflow tool
===
Preferable free, open source, vcl. For Delphi 2007 or above and win32. | 4 |
517,070 | 02/05/2009 18:01:20 | 43,399 | 12/04/2008 22:31:41 | 318 | 21 | Why volatile is not enough? | I'm confused. Answers to my [previous question][1] seems to confirm my assumptions. But as stated [here][2] volatile is not enough to assure atomicity in .Net. Either operations like incrementation and assignment in MSIL are not translated directly to single, native OPCODE or many CPUs can simultaneously read and write to the same RAM location.
[1]: http://stackoverflow.com/questions/516940/can-multiple-cpus-simultaneously-write-to-the-same-ram-location
[2]: http://stackoverflow.com/questions/154551/volatile-vs-interlocked-vs-lock | c# | synchronization | null | null | null | null | open | Why volatile is not enough?
===
I'm confused. Answers to my [previous question][1] seems to confirm my assumptions. But as stated [here][2] volatile is not enough to assure atomicity in .Net. Either operations like incrementation and assignment in MSIL are not translated directly to single, native OPCODE or many CPUs can simultaneously read and write to the same RAM location.
[1]: http://stackoverflow.com/questions/516940/can-multiple-cpus-simultaneously-write-to-the-same-ram-location
[2]: http://stackoverflow.com/questions/154551/volatile-vs-interlocked-vs-lock | 0 |
10,506,485 | 05/08/2012 21:03:45 | 1,033,938 | 11/07/2011 14:47:57 | 545 | 38 | Creating a cutsom page to manipulate data on elgg | I'm new to Elgg development. Until now I've just customized the appearance. But now I want new entities to interact, one of it is "Organization" and other is "Product". And for those entities I have to create a page to register new organization, update and delete it. The same for "Product" entity.
Is it possible to do?
Is there a way to create a page (accessing only if the user have permission to) and manipulate the entity data?
Does anybody has a sample? | php | crud | elgg | null | null | null | open | Creating a cutsom page to manipulate data on elgg
===
I'm new to Elgg development. Until now I've just customized the appearance. But now I want new entities to interact, one of it is "Organization" and other is "Product". And for those entities I have to create a page to register new organization, update and delete it. The same for "Product" entity.
Is it possible to do?
Is there a way to create a page (accessing only if the user have permission to) and manipulate the entity data?
Does anybody has a sample? | 0 |
4,699,997 | 01/15/2011 14:09:30 | 489,284 | 10/27/2010 19:53:35 | 86 | 0 | Best PHP login script? | Hey stackoverflow! I am building my first website with log in functionality and I was searching for a good log in script. However, googling just won't work because there are too many to choose from, so I thought I'd ask here.
What is in your experience a good login script that you often use? It will need registring options and e-mailing the new users etc. Also some different user levels might come in handy. Pasword encryption/salting and possibly good form handling as well.
What do you guys often use? thanks!
this any good?:
http://evolt.org/node/60384/ | php | login | script | null | null | 09/12/2011 11:53:25 | not constructive | Best PHP login script?
===
Hey stackoverflow! I am building my first website with log in functionality and I was searching for a good log in script. However, googling just won't work because there are too many to choose from, so I thought I'd ask here.
What is in your experience a good login script that you often use? It will need registring options and e-mailing the new users etc. Also some different user levels might come in handy. Pasword encryption/salting and possibly good form handling as well.
What do you guys often use? thanks!
this any good?:
http://evolt.org/node/60384/ | 4 |
6,909,211 | 08/02/2011 08:29:26 | 429,059 | 08/24/2010 02:51:26 | 934 | 51 | Windows server 2008 R2 and uncompressing | I need this for a paper, does Windows server 2008 R2 contain a UNZIP/UNRAR utility by default? | microsoft | zip | windows-server-2008-r2 | rar | null | 08/21/2011 08:49:18 | off topic | Windows server 2008 R2 and uncompressing
===
I need this for a paper, does Windows server 2008 R2 contain a UNZIP/UNRAR utility by default? | 2 |
8,214,029 | 11/21/2011 15:18:16 | 1,058,044 | 11/21/2011 15:14:34 | 1 | 0 | what is the exception when we overriding a method | I am new in Java ,i have a question ,what is the exception allows to use when i override a method ,what are checked exception and what are the unchecked exception, and can i use checked exceptions in overriding ?
| java | null | null | null | null | 11/21/2011 15:44:19 | not a real question | what is the exception when we overriding a method
===
I am new in Java ,i have a question ,what is the exception allows to use when i override a method ,what are checked exception and what are the unchecked exception, and can i use checked exceptions in overriding ?
| 1 |
357,579 | 12/10/2008 20:53:53 | 45,129 | 12/10/2008 20:44:08 | 1 | 0 | Timeouts not working using JavaMail 1.4 | I'm using JavaMail to send email requests to an SMTP server. I'm setting both "mail.smtp.connectiontimeout" and "mail.smtp.timeout" properties to 5 and 30 seconds respectively and passing both of these to Session.getDefaultInstance(). However, when I go to do the Transport.send(), the timeouts I set appear to be ignored and it's taking around 3:45 to timeout on a Solaris machine. The timeout takes around 1:30 on a Mac. Is this a bug in JavaMail or do I need to set some other properties? | java | javamail | null | null | null | null | open | Timeouts not working using JavaMail 1.4
===
I'm using JavaMail to send email requests to an SMTP server. I'm setting both "mail.smtp.connectiontimeout" and "mail.smtp.timeout" properties to 5 and 30 seconds respectively and passing both of these to Session.getDefaultInstance(). However, when I go to do the Transport.send(), the timeouts I set appear to be ignored and it's taking around 3:45 to timeout on a Solaris machine. The timeout takes around 1:30 on a Mac. Is this a bug in JavaMail or do I need to set some other properties? | 0 |
6,659,949 | 07/12/2011 05:46:00 | 569,389 | 01/10/2011 05:22:11 | 11 | 0 | To find which of the search results the user clicks | I need a java code that identifies the search results that user clicks during his web search environment | java | javascript | search-engine | null | null | 07/12/2011 05:52:30 | not a real question | To find which of the search results the user clicks
===
I need a java code that identifies the search results that user clicks during his web search environment | 1 |
10,600,429 | 05/15/2012 12:14:40 | 1,342,795 | 04/19/2012 01:15:42 | 1 | 0 | C: local variable is unexpectedly changed. Is it possible? | I have a problem. Suddenly local variable is changed in function. So I But the line number is changed when got a Segmentation fault on gdb.
features
- Embedded Environment (ARM)
- Compiler is arm-linux-gcc 4.3.1
- Compiled with other custom libraries.
for example:
void foo() {
int num = 0;
if(num < 0) {
abort();
}
}
Approximately after 4 hours later, suddenly `num` is changed to other number. And the program dies.
What happened? | stack | null | null | null | null | 05/16/2012 14:04:18 | too localized | C: local variable is unexpectedly changed. Is it possible?
===
I have a problem. Suddenly local variable is changed in function. So I But the line number is changed when got a Segmentation fault on gdb.
features
- Embedded Environment (ARM)
- Compiler is arm-linux-gcc 4.3.1
- Compiled with other custom libraries.
for example:
void foo() {
int num = 0;
if(num < 0) {
abort();
}
}
Approximately after 4 hours later, suddenly `num` is changed to other number. And the program dies.
What happened? | 3 |
11,114,412 | 06/20/2012 07:01:18 | 1,344,009 | 04/19/2012 12:45:57 | 15 | 0 | How can i copy one file from one directory to another directory in JMeter? | I am trying to copy one file from one directory to another directory using Telnet Server. Can we do this in Jmeter. I am using Beanshell Sampler for that. Please anyone guide me on this.
Thanks in advance,
Anto | jmeter | telnet | beanshell | null | null | null | open | How can i copy one file from one directory to another directory in JMeter?
===
I am trying to copy one file from one directory to another directory using Telnet Server. Can we do this in Jmeter. I am using Beanshell Sampler for that. Please anyone guide me on this.
Thanks in advance,
Anto | 0 |
6,642,020 | 07/10/2011 15:44:16 | 834,204 | 07/07/2011 19:10:55 | 1 | 0 | in which language google plus is written ? | I want to know that in which programming or scripting language this, new application Google Plus (Google+) is written in. Do you guys know about this? Please share. | google | programming-languages | google-plus | null | null | 07/10/2011 15:46:23 | off topic | in which language google plus is written ?
===
I want to know that in which programming or scripting language this, new application Google Plus (Google+) is written in. Do you guys know about this? Please share. | 2 |
7,556,121 | 09/26/2011 13:51:05 | 900,081 | 08/18/2011 07:17:48 | 126 | 2 | BeansBinding in JTable and JTable's TableColumn | One of my JTable is update with a bean property(util.List).It is ok. But I want a column in my JTable named "Action". This column should have `JComboBox` for each row to do some thing for that row's data. I read [this](http://download.oracle.com/javase/tutorial/uiswing/components/table.html) and it has some tutorials how to set a Jcombobox into a JTable row.
I use NetBeans IDE for coding. In the netbeans "Table Content" of the JTable display box under the Column tab, there are properties to set our JTable.
I added a column for my "action" then set `javax.swing.table.TableCellEditor` as `new DefaultCellEditor(comboBox)` in "Editor" Options. Here I added a JComboBox combobox for the cell editor. But when I ran the project, there is no any combo box but only a text "Object" .(I had use `Object` as the Exression type of the column)
Any one tell me how can I **insert a JCombobox into cell and add an action with beansbinding.** specially in NetBeans | java | swing | desktop-application | beansbinding | null | null | open | BeansBinding in JTable and JTable's TableColumn
===
One of my JTable is update with a bean property(util.List).It is ok. But I want a column in my JTable named "Action". This column should have `JComboBox` for each row to do some thing for that row's data. I read [this](http://download.oracle.com/javase/tutorial/uiswing/components/table.html) and it has some tutorials how to set a Jcombobox into a JTable row.
I use NetBeans IDE for coding. In the netbeans "Table Content" of the JTable display box under the Column tab, there are properties to set our JTable.
I added a column for my "action" then set `javax.swing.table.TableCellEditor` as `new DefaultCellEditor(comboBox)` in "Editor" Options. Here I added a JComboBox combobox for the cell editor. But when I ran the project, there is no any combo box but only a text "Object" .(I had use `Object` as the Exression type of the column)
Any one tell me how can I **insert a JCombobox into cell and add an action with beansbinding.** specially in NetBeans | 0 |
7,478,693 | 09/20/2011 00:00:26 | 328,397 | 04/28/2010 23:54:42 | 2,875 | 68 | Why did MSFT remove XML digital signature support in MSXML6.0? | MSXML5 is the only version of MSXML that supports XML digital signatures.
Does anyone have any background why this was dropped, and what replaces it? [Is this a good substitute][1]?
[1]: http://social.msdn.microsoft.com/Forums/en-GB/xmlandnetfx/thread/29e9f729-4971-4264-860d-477271196eeb | xml | digital-signature | msxml | msxml6 | msxml5 | 07/17/2012 19:41:12 | not constructive | Why did MSFT remove XML digital signature support in MSXML6.0?
===
MSXML5 is the only version of MSXML that supports XML digital signatures.
Does anyone have any background why this was dropped, and what replaces it? [Is this a good substitute][1]?
[1]: http://social.msdn.microsoft.com/Forums/en-GB/xmlandnetfx/thread/29e9f729-4971-4264-860d-477271196eeb | 4 |
8,638,546 | 12/26/2011 19:25:12 | 1,020,477 | 10/30/2011 07:58:02 | 18 | 1 | Commenting Engine in ASP.NET | I am using GridView to show a Random image from database on an aspx page.Now I have to include comments on that page,save & display comments for that particular image,that means there should be different comments on different images.
So what would be the best approach to do so.
Do I have to Save comments on separate table against that particular image id ? & What would be the suitable control to display them?
I also used Disquss but I think its appropriate for this situation.
Thanks | c# | asp.net | sql-server-2008 | comments | null | 12/26/2011 23:20:09 | not a real question | Commenting Engine in ASP.NET
===
I am using GridView to show a Random image from database on an aspx page.Now I have to include comments on that page,save & display comments for that particular image,that means there should be different comments on different images.
So what would be the best approach to do so.
Do I have to Save comments on separate table against that particular image id ? & What would be the suitable control to display them?
I also used Disquss but I think its appropriate for this situation.
Thanks | 1 |
11,336,853 | 07/05/2012 01:19:06 | 1,491,820 | 06/29/2012 17:37:57 | 6 | 1 | Adding Linux kernel command line parameters | I would like to increase the size of the vmalloc region from the default value, and pass vmalloc=<size> as a command line parameter while booting. I am booting a uImage. In which file do I need to add the new vmalloc command line parameter so that it is known to the kernel at boot time? | linux | linux-kernel | command | null | null | 07/06/2012 04:06:40 | off topic | Adding Linux kernel command line parameters
===
I would like to increase the size of the vmalloc region from the default value, and pass vmalloc=<size> as a command line parameter while booting. I am booting a uImage. In which file do I need to add the new vmalloc command line parameter so that it is known to the kernel at boot time? | 2 |
386,801 | 12/22/2008 17:24:45 | 36,860 | 11/12/2008 10:06:35 | 93 | 6 | WCF Book Recommendation | Touched on in other questions, but not directly...which WCF book(s) would you recommend?
| wcf | .net-3.5 | .net-3.0 | c# | null | 09/17/2011 21:59:02 | not constructive | WCF Book Recommendation
===
Touched on in other questions, but not directly...which WCF book(s) would you recommend?
| 4 |
2,369,290 | 03/03/2010 06:50:04 | 185,430 | 10/07/2009 07:05:43 | 114 | 4 | PHP accelerators and static fields. | I would like to know about static (class) field representation within PHP interpreter.
For example, when you load a class in Java, static fields will be associated with that Class object; that means two applications running same JVM (and same classloader) will have some kind of shared global variable ;)
I'm just wondering, if I use some kind of PHP accelerator/opcode caching, what is that really cached? Is it just compiled bytecode, or a piece of VM state (responsible for storing class objects)?
It's because I'm afraid of static fields/singleton objects sharing between requests, etc.
P.S.: I'm really a PHP newbie, so I'm very sorry if the question is way too dumb :) | class | php | static | accelerator | state | null | open | PHP accelerators and static fields.
===
I would like to know about static (class) field representation within PHP interpreter.
For example, when you load a class in Java, static fields will be associated with that Class object; that means two applications running same JVM (and same classloader) will have some kind of shared global variable ;)
I'm just wondering, if I use some kind of PHP accelerator/opcode caching, what is that really cached? Is it just compiled bytecode, or a piece of VM state (responsible for storing class objects)?
It's because I'm afraid of static fields/singleton objects sharing between requests, etc.
P.S.: I'm really a PHP newbie, so I'm very sorry if the question is way too dumb :) | 0 |
5,465,946 | 03/28/2011 22:49:20 | 681,075 | 03/28/2011 22:49:20 | 1 | 0 | hex numbers and chars print [mips assembly] | how to print an array with those bits:
'a','b','c','f','a',0xfff1B,'d',0xfff6,'b','b',0x1ffB,'c',0x04,'a',0x0CCCC,'f','a','b' | string | assembly | char | hex | mips | 03/29/2011 16:48:03 | not a real question | hex numbers and chars print [mips assembly]
===
how to print an array with those bits:
'a','b','c','f','a',0xfff1B,'d',0xfff6,'b','b',0x1ffB,'c',0x04,'a',0x0CCCC,'f','a','b' | 1 |
9,506,386 | 02/29/2012 20:48:12 | 1,241,200 | 02/29/2012 20:44:05 | 1 | 0 | Parse such a String into a object structure using Java (GWT) | I am trying to parse an string in GWT to an Object structure. Unfortunately I am not able to do it.
Example string - (node1(node2(node3) (node4)) (node5))
"node1" has 2 children "node2" and "node5"
"node2" has 2 children "node3" and "node4"
Object can be "node", with children.
Any help on this will be greatly appreciated. | java | gwt | null | null | null | null | open | Parse such a String into a object structure using Java (GWT)
===
I am trying to parse an string in GWT to an Object structure. Unfortunately I am not able to do it.
Example string - (node1(node2(node3) (node4)) (node5))
"node1" has 2 children "node2" and "node5"
"node2" has 2 children "node3" and "node4"
Object can be "node", with children.
Any help on this will be greatly appreciated. | 0 |
5,074,298 | 02/22/2011 05:15:23 | 620,735 | 02/14/2011 09:17:50 | 11 | 0 | how can we convert the information into csv | i want to convert all the information into a csv
can you tell me how can i do this
i know it will we diong by file function cant any buddy brief me
thanks | php | php5 | null | null | null | 02/22/2011 06:07:48 | not a real question | how can we convert the information into csv
===
i want to convert all the information into a csv
can you tell me how can i do this
i know it will we diong by file function cant any buddy brief me
thanks | 1 |
6,190,306 | 05/31/2011 15:59:53 | 484,558 | 03/18/2010 19:01:34 | 90 | 1 | Have you every used any sorting algorithms or string search algorithms in real projects? | I college we study a lot of algorithms but I never hear anyone actually using them and if you google around you mostly find universities' websites that have info on these algorithms.
I have never used a sorting or string search algorithm and I don't know any fellow programmer who has, I've asked a few of them.
Have you ever used any? Why did you do it, why did you chose to use that algorithm?
I feel like a bad programmer. | algorithm | null | null | null | null | 05/31/2011 16:03:55 | not a real question | Have you every used any sorting algorithms or string search algorithms in real projects?
===
I college we study a lot of algorithms but I never hear anyone actually using them and if you google around you mostly find universities' websites that have info on these algorithms.
I have never used a sorting or string search algorithm and I don't know any fellow programmer who has, I've asked a few of them.
Have you ever used any? Why did you do it, why did you chose to use that algorithm?
I feel like a bad programmer. | 1 |
11,410,594 | 07/10/2012 09:43:33 | 1,160,682 | 01/20/2012 13:10:24 | 1 | 0 | Simple program for yii? | Can any one suggest me a simple program for yii framework with following features?
1.User registration
2.login
3.The particular user who has logined should be able to update their profile using the session
4.Session management | php | yii | yii-mvc | yii-events | null | 07/10/2012 12:20:12 | not a real question | Simple program for yii?
===
Can any one suggest me a simple program for yii framework with following features?
1.User registration
2.login
3.The particular user who has logined should be able to update their profile using the session
4.Session management | 1 |
11,573,921 | 07/20/2012 06:26:26 | 1,107,129 | 12/20/2011 04:29:19 | 160 | 10 | File is copied on the FTP server not moved in java | Using below program i am able to upload zip file on ftp server.
But it makes the copy of the zip file and upload the file on ftp server.
I want it should delete the file from local system and copy it to server i.e. it should move the file not copy.Please guide
public class UploadFile {
public static void main(String args[])
{
FTPClient ftp=new FTPClient();
try {
int reply;
ftp.connect("ipadddress");
ftp.login("abc", "abc");
reply = ftp.getReplyCode();
System.out.println("reply1" + reply);
if(!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
}
System.out.println("FTP server connected.");
ftp.setFileType(FTP.BINARY_FILE_TYPE);
InputStream input= new FileInputStream("D:\\testencrypted.zip");
String dirTree="/Vel";
boolean dirExists = true;
String[] directories = dirTree.split("/");
for (String dir : directories )
{
if (!dir.isEmpty() )
{
if (dirExists)
{
dirExists = ftp.changeWorkingDirectory(dir);
}
else if (!dirExists)
{
System.out.println("dir tree" + ftp.printWorkingDirectory());
if (!ftp.makeDirectory(dir))
{
throw new IOException("Unable to create remote directory '" + dir + "'. error='" + ftp.getReplyString()+"'");
}
if (!ftp.changeWorkingDirectory(dir))
{
throw new IOException("Unable to change into newly created remote directory '" + dir + "'. error='" + ftp.getReplyString()+"'");
}
System.out.println("dir tree" + ftp.printWorkingDirectory());
}
}
}
ftp.storeFile(dirTree+"/t1.zip",input);
input.close();
ftp.logout();
}
catch(Exception e)
{
System.out.println("err"+ e);
}
finally
{
if(ftp.isConnected())
{
try
{
ftp.disconnect();
}
catch(Exception ioe)
{
}
}
}
}
}
| java | ftp | ftp-client | null | null | null | open | File is copied on the FTP server not moved in java
===
Using below program i am able to upload zip file on ftp server.
But it makes the copy of the zip file and upload the file on ftp server.
I want it should delete the file from local system and copy it to server i.e. it should move the file not copy.Please guide
public class UploadFile {
public static void main(String args[])
{
FTPClient ftp=new FTPClient();
try {
int reply;
ftp.connect("ipadddress");
ftp.login("abc", "abc");
reply = ftp.getReplyCode();
System.out.println("reply1" + reply);
if(!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
}
System.out.println("FTP server connected.");
ftp.setFileType(FTP.BINARY_FILE_TYPE);
InputStream input= new FileInputStream("D:\\testencrypted.zip");
String dirTree="/Vel";
boolean dirExists = true;
String[] directories = dirTree.split("/");
for (String dir : directories )
{
if (!dir.isEmpty() )
{
if (dirExists)
{
dirExists = ftp.changeWorkingDirectory(dir);
}
else if (!dirExists)
{
System.out.println("dir tree" + ftp.printWorkingDirectory());
if (!ftp.makeDirectory(dir))
{
throw new IOException("Unable to create remote directory '" + dir + "'. error='" + ftp.getReplyString()+"'");
}
if (!ftp.changeWorkingDirectory(dir))
{
throw new IOException("Unable to change into newly created remote directory '" + dir + "'. error='" + ftp.getReplyString()+"'");
}
System.out.println("dir tree" + ftp.printWorkingDirectory());
}
}
}
ftp.storeFile(dirTree+"/t1.zip",input);
input.close();
ftp.logout();
}
catch(Exception e)
{
System.out.println("err"+ e);
}
finally
{
if(ftp.isConnected())
{
try
{
ftp.disconnect();
}
catch(Exception ioe)
{
}
}
}
}
}
| 0 |
1,365,683 | 09/02/2009 03:19:53 | 166,985 | 09/02/2009 03:10:17 | 1 | 0 | How do I change the record separator in a text file? | I'm trying to read in a file with names and addreses. It may look like this:
John Doe
123 Main Street
My Town, US 12345
Ralph Kramden
c/o Joe
999 North Lane
YourTown, US 22839
Where there is always a line between records. But I don't know how to tell Perl that the next X lines are all one record. (And X can vary).
How can that be done? | perl | null | null | null | null | null | open | How do I change the record separator in a text file?
===
I'm trying to read in a file with names and addreses. It may look like this:
John Doe
123 Main Street
My Town, US 12345
Ralph Kramden
c/o Joe
999 North Lane
YourTown, US 22839
Where there is always a line between records. But I don't know how to tell Perl that the next X lines are all one record. (And X can vary).
How can that be done? | 0 |
7,724,367 | 10/11/2011 10:08:47 | 288,089 | 03/07/2010 06:17:34 | 45 | 0 | Can nginx protect uri (before rewrited) by basic auth? | I have a problem with nginx when migrating from apache.
all uris are rewrited to /index.php, and ^/admin uri should be protected by basic auth.
when with apache, I configured it as below:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]
<Location ~ "^/admin">
AuthType Basic
AuthName "Restricted"
AuthUserFile /etc/apache2/httpd.passwd
Require valid-user
</Location>
this is nginx configuration but it does not work:
if (!-f $request_filename) {
rewrite ^ /index.php last;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
location ~* /admin/ {
auth_basic "admin login";
auth_basic_user_file /etc/nginx/httpd.passwd;
}
how can i do it in nginx? | php | apache | nginx | authentication | null | 10/12/2011 02:22:42 | off topic | Can nginx protect uri (before rewrited) by basic auth?
===
I have a problem with nginx when migrating from apache.
all uris are rewrited to /index.php, and ^/admin uri should be protected by basic auth.
when with apache, I configured it as below:
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [L]
<Location ~ "^/admin">
AuthType Basic
AuthName "Restricted"
AuthUserFile /etc/apache2/httpd.passwd
Require valid-user
</Location>
this is nginx configuration but it does not work:
if (!-f $request_filename) {
rewrite ^ /index.php last;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
location ~* /admin/ {
auth_basic "admin login";
auth_basic_user_file /etc/nginx/httpd.passwd;
}
how can i do it in nginx? | 2 |
9,091,820 | 02/01/2012 06:37:03 | 239,625 | 12/28/2009 15:10:23 | 1 | 2 | bitwise operation or shift operation, which one is faster? | For example:
char a = 0xac;
char b = 0xff
char c = (a * b) & 0xff00;
char d = (a * b) >> 8;
which one is faster to calculate, **c** or **d**?
Thanks | c++ | c | performance | compiler | assembly | 02/01/2012 06:40:39 | not constructive | bitwise operation or shift operation, which one is faster?
===
For example:
char a = 0xac;
char b = 0xff
char c = (a * b) & 0xff00;
char d = (a * b) >> 8;
which one is faster to calculate, **c** or **d**?
Thanks | 4 |
2,512,782 | 03/25/2010 02:38:48 | 98,026 | 04/29/2009 21:57:01 | 23 | 0 | Google Spreadsheet multiple column filter using OR | I have a Google Spreadsheet with 3 columns which are either blank or have a value. I want to get the count of the number of rows that has A and either B or C populated. If I were writing a SQL query it would be
select count(*)
from Table
where A is not null and (B is not null or C is not null)
But I can't for the life of me figure out how to get this in a Google Spreadsheet | google-docs | google-spreadsheet | null | null | null | null | open | Google Spreadsheet multiple column filter using OR
===
I have a Google Spreadsheet with 3 columns which are either blank or have a value. I want to get the count of the number of rows that has A and either B or C populated. If I were writing a SQL query it would be
select count(*)
from Table
where A is not null and (B is not null or C is not null)
But I can't for the life of me figure out how to get this in a Google Spreadsheet | 0 |
8,377,846 | 12/04/2011 19:08:21 | 739,136 | 05/05/2011 03:56:06 | 6 | 0 | Using PHP to read and write to JSON | So currently I'm working on a project that requires the use of PHP and JSON. The way I have currently set up my code is so that I read the JSON file in using file_get_contents and then use the built in json_decode() function. Everything is reading perfectly, it's the writing part that is giving me trouble.
The way I have my JSON tree set up is:
{
"test":[
{
"testName":"Winter 2011",
"testDate":"12/04/2011",
"testTime":"2:00pm",
"testRoom":"room",
"cap": 10,
"spotsLeft": 0,
"student":[
{
"fname":"Bob",
"lname":"Roberts",
"usrnm":"bobr",
"email":"bob@gmail.com"
}
]
}
]
}
To get the right test (since there will be multiple tests) I'm using a `foreach loop` and then I make sure there isn't a duplicate. At this point I'm ready to add a new student to the JSON file so I call:
`
$file = file_get_contents('testDates.json');
$json = json_decode($file, true);
//Go through each test in the file
foreach ($json[test] as $t){
.....
//Works if I only do $t[student] but that only adds it to the $t[] and not the
//JSON file. Can't seem to get it to add to the whole JSON string.
array_push($json[$t][student], $newStudent);
echo json_encode($json);
.....
//Use a file_put_contents later to write the file out
Any thoughts would be extremely helpful. It's probably a pointer error to a certain point int he array but a second set of eyes never hurt. Thanks. | php | json | null | null | null | null | open | Using PHP to read and write to JSON
===
So currently I'm working on a project that requires the use of PHP and JSON. The way I have currently set up my code is so that I read the JSON file in using file_get_contents and then use the built in json_decode() function. Everything is reading perfectly, it's the writing part that is giving me trouble.
The way I have my JSON tree set up is:
{
"test":[
{
"testName":"Winter 2011",
"testDate":"12/04/2011",
"testTime":"2:00pm",
"testRoom":"room",
"cap": 10,
"spotsLeft": 0,
"student":[
{
"fname":"Bob",
"lname":"Roberts",
"usrnm":"bobr",
"email":"bob@gmail.com"
}
]
}
]
}
To get the right test (since there will be multiple tests) I'm using a `foreach loop` and then I make sure there isn't a duplicate. At this point I'm ready to add a new student to the JSON file so I call:
`
$file = file_get_contents('testDates.json');
$json = json_decode($file, true);
//Go through each test in the file
foreach ($json[test] as $t){
.....
//Works if I only do $t[student] but that only adds it to the $t[] and not the
//JSON file. Can't seem to get it to add to the whole JSON string.
array_push($json[$t][student], $newStudent);
echo json_encode($json);
.....
//Use a file_put_contents later to write the file out
Any thoughts would be extremely helpful. It's probably a pointer error to a certain point int he array but a second set of eyes never hurt. Thanks. | 0 |
10,807,783 | 05/29/2012 22:45:26 | 469,408 | 10/07/2010 17:39:14 | 2,254 | 1 | Are CSS-only drop-down menus really workable? | So, I decided to start really learning CSS more in-depth, and I began by attempting to implement a pure-CSS drop-down menu/select-box. I started by studying the code available in some [online tutorials][1].
Ultimately, [I came up with this][2], which I think is pretty decent. However, I've come to the conclusion that CSS menus might never be a suitable replacement for Javascript menus, because there are subtle problems that come up when you ditch Javascript.
If the items in your drop-down menu are simply `<a href` links, everything should be fine. BUT if you want each link to fire a Javascript event, you run into the following issues:
- When the user clicks an item in the drop-down box, you want the
drop-down box to *disappear*, obviously. This happens automatically
if the items in your drop-down box are `<a>` elements. If they're
NOT `<a>` elements, the drop-down box won't disappear on-click -
which leaves you with two options: (A) wire up some Javascript that
listens for `onclick` and then make the drop-down box disappear, or
(B) use the css `:active` selector to set the drop-down box's
`display` property to `none`. (A) is stupid, because you're
basically back to Javascript menus at that point, and (B) doesn't
work out because it prevents Javascript events from firing when you
click an item in the menu.
- So, you *have* to use `<a>` tags. That means if you want to
associate an event with a menu-item selection, you need to use an
inline `onclick` in your `<a>` tag. That's fine, except if you do
that, it prevents the drop-down menu from disappearing ([as
demonstrated in my jsfiddle link][3]). So, really, CSS-only
drop-down menus only seem to be workable if all you want to do when
the user selects a menu item is navigate to another page via an `<a>`
link. I can't find anyway to get a Javascript function to fire that
doesn't come with some gotcha.
**Question:** So, is what I've said accurate? Or is there a way to create a CSS-only drop-down menu that (A) *disappears* when the user clicks it, and (B) triggers a Javascript function?
[1]: http://csswizardry.com/demos/css-dropdown/
[2]: http://jsfiddle.net/FcmtY/
[3]: http://jsfiddle.net/FcmtY/ | javascript | html | css | events | null | null | open | Are CSS-only drop-down menus really workable?
===
So, I decided to start really learning CSS more in-depth, and I began by attempting to implement a pure-CSS drop-down menu/select-box. I started by studying the code available in some [online tutorials][1].
Ultimately, [I came up with this][2], which I think is pretty decent. However, I've come to the conclusion that CSS menus might never be a suitable replacement for Javascript menus, because there are subtle problems that come up when you ditch Javascript.
If the items in your drop-down menu are simply `<a href` links, everything should be fine. BUT if you want each link to fire a Javascript event, you run into the following issues:
- When the user clicks an item in the drop-down box, you want the
drop-down box to *disappear*, obviously. This happens automatically
if the items in your drop-down box are `<a>` elements. If they're
NOT `<a>` elements, the drop-down box won't disappear on-click -
which leaves you with two options: (A) wire up some Javascript that
listens for `onclick` and then make the drop-down box disappear, or
(B) use the css `:active` selector to set the drop-down box's
`display` property to `none`. (A) is stupid, because you're
basically back to Javascript menus at that point, and (B) doesn't
work out because it prevents Javascript events from firing when you
click an item in the menu.
- So, you *have* to use `<a>` tags. That means if you want to
associate an event with a menu-item selection, you need to use an
inline `onclick` in your `<a>` tag. That's fine, except if you do
that, it prevents the drop-down menu from disappearing ([as
demonstrated in my jsfiddle link][3]). So, really, CSS-only
drop-down menus only seem to be workable if all you want to do when
the user selects a menu item is navigate to another page via an `<a>`
link. I can't find anyway to get a Javascript function to fire that
doesn't come with some gotcha.
**Question:** So, is what I've said accurate? Or is there a way to create a CSS-only drop-down menu that (A) *disappears* when the user clicks it, and (B) triggers a Javascript function?
[1]: http://csswizardry.com/demos/css-dropdown/
[2]: http://jsfiddle.net/FcmtY/
[3]: http://jsfiddle.net/FcmtY/ | 0 |
5,718,293 | 04/19/2011 14:47:54 | 632,951 | 02/24/2011 19:10:47 | 47 | 0 | Linking acounts | I'm wondering let's say if i signup in a website and they have a "link your account to gmail / hotmail / yahoo mail / facebook" etc.. is it possible that these "links" (yes after I've linked them) could send automatic emails to my contacts without my knowledge? | html | null | null | null | null | 04/19/2011 14:52:19 | off topic | Linking acounts
===
I'm wondering let's say if i signup in a website and they have a "link your account to gmail / hotmail / yahoo mail / facebook" etc.. is it possible that these "links" (yes after I've linked them) could send automatic emails to my contacts without my knowledge? | 2 |
5,851,944 | 05/01/2011 22:40:34 | 646,754 | 03/06/2011 08:31:31 | 10 | 0 | String .equals opposite | I have this line of code:
if(command.equals("e") || command.equals("d"){
//statements
}
| java | null | null | null | null | 05/01/2011 22:47:34 | not a real question | String .equals opposite
===
I have this line of code:
if(command.equals("e") || command.equals("d"){
//statements
}
| 1 |
11,371,106 | 07/07/2012 00:00:21 | 1,452,327 | 06/12/2012 21:46:22 | 6 | 0 | PHP - Show week Working Hours 4 | Hello I'm trying to show working hours on a week, my mysql table has
-idtimesheet
-Monday_from
-Monday_to
-Tuesday_from
-Tuesday_to
-Wednesday_from
-Wednesday_to
-Thursday_from
-Thursday_to
-Friday_from
-Friday_to
I have no code to show, because try and finish removing all the anger, it is very urgent and not to do, if someone can give me a hand I really appreciate it, regards.
[the link is an example of what Y whant to show][1]
[1]: https://docs.google.com/open?id=0B_B8EqvJgaC4RW9ZVW1rU0xSTEk | php | mysql | html | null | null | 07/08/2012 00:57:05 | not a real question | PHP - Show week Working Hours 4
===
Hello I'm trying to show working hours on a week, my mysql table has
-idtimesheet
-Monday_from
-Monday_to
-Tuesday_from
-Tuesday_to
-Wednesday_from
-Wednesday_to
-Thursday_from
-Thursday_to
-Friday_from
-Friday_to
I have no code to show, because try and finish removing all the anger, it is very urgent and not to do, if someone can give me a hand I really appreciate it, regards.
[the link is an example of what Y whant to show][1]
[1]: https://docs.google.com/open?id=0B_B8EqvJgaC4RW9ZVW1rU0xSTEk | 1 |
9,226,668 | 02/10/2012 10:56:12 | 647,670 | 03/07/2011 05:46:47 | 602 | 8 | How can I install CA Root certificate on IE 9/ window 7? | When I visit some websites I get the error message
**"Internet Explorer blocked this website from displaying content with security certificate errors**".
IE9 gives the option to "**show content**", but when I click on "show content" nothing changes; some content is still not shown.
So I did check the Network to see the cause of the problem, and I discovered that the issue is due to **untrusted certificate**.
So if I copy the url of the image not displayed in another tab and I click on **Continue to this website (not recommended).** I get the image.
When I go back to the original page, after reloading, the content is not shown.
So I was thinking to fix the problen installing the untrusted certificate, but how can I do that on **IE9/windiow7** ? | windows-7 | ssl | internet-explorer-9 | ssl-certificate | null | 03/01/2012 04:32:53 | off topic | How can I install CA Root certificate on IE 9/ window 7?
===
When I visit some websites I get the error message
**"Internet Explorer blocked this website from displaying content with security certificate errors**".
IE9 gives the option to "**show content**", but when I click on "show content" nothing changes; some content is still not shown.
So I did check the Network to see the cause of the problem, and I discovered that the issue is due to **untrusted certificate**.
So if I copy the url of the image not displayed in another tab and I click on **Continue to this website (not recommended).** I get the image.
When I go back to the original page, after reloading, the content is not shown.
So I was thinking to fix the problen installing the untrusted certificate, but how can I do that on **IE9/windiow7** ? | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.