Search Results

Search found 1372 results on 55 pages for 'userid'.

Page 27/55 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • php mysql parallel array checkboxes

    - by gramware
    I have an array of checkboxes that I edit at once to set up a 'tinyint' field. the problem comes in when i uncheck the checkbox and post the vales to mysql. since it posts an array of checkboxes and another parallel array of values to edit, unchecking a checkbox results in the 0 value been ignored by PHP_POST and hence the checkbox array will be less by the number of unchecked values in the form while the array to be edited will have all the records in the form. here is the submit code while($row=mysql_fetch_array($result)) { $checked = ($row[active]==1) ? 'checked="checked"' : ''; ... echo "<input type='hidden' name='TrID[]' value='$TrID'>"; echo "<input type='checkbox' name='active1[]' value='$row[active]''$checked' >"; ... and the processing php script $userid = ($_POST['TrID']); $checked= ($_POST['active']); $i=0; foreach ($userid as $usid) { if ($checked[$i]==1){ $check = 1; } else{ $check = 0; } $qry1 ="UPDATE `epapers`.`clientelle` SET `active` = '$check' WHERE `clientelle`.`user_id` = '$usid' "; $result = mysql_query($qry1); $i++; }

    Read the article

  • memory leak in php script

    - by Jasper De Bruijn
    Hi, I have a php script that runs a mysql query, then loops the result, and in that loop also runs several queries: $sqlstr = "SELECT * FROM user_pred WHERE uprType != 2 AND uprTurn=$turn ORDER BY uprUserTeamIdFK"; $utmres = mysql_query($sqlstr) or trigger_error($termerror = __FILE__." - ".__LINE__.": ".mysql_error()); while($utmrow = mysql_fetch_array($utmres, MYSQL_ASSOC)) { // some stuff happens here // echo memory_get_usage() . " - 1241<br/>\n"; $sqlstr = "UPDATE user_roundscores SET ursUpdDate=NOW(),ursScore=$score WHERE ursUserTeamIdFK=$userteamid"; if(!mysql_query($sqlstr)) { $err_crit++; $cLog->WriteLogFile("Failed to UPDATE user_roundscores record for user $userid - teamuserid: $userteamid\n"); echo "Failed to UPDATE user_roundscores record for user $userid - teamuserid: $userteamid<br>\n"; break; } unset($sqlstr); // echo memory_get_usage() . " - 1253<br/>\n"; // some stuff happens here too } The update query never fails. For some reason, between the two calls of memory_get_usage, there is some memory added. Because the big loop runs about 500.000 or more times, in the end it really adds up to alot of memory. Is there anything I'm missing here? could it herhaps be that the memory is not actually added between the two calls, but at another point in the script? Edit: some extra info: Before the loop it's at about 5mb, after the loop about 440mb, and every update query adds about 250 bytes. (the rest of the memory gets added at other places in the loop). The reason I didn't post more of the "other stuff" is because its about 300 lines of code. I posted this part because it looks to be where the most memory is added.

    Read the article

  • Maven build fails on an Ant FTP task failure

    - by fraido
    I'm using the FTP Ant task with maven-antrun-plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>ftp</id> <phase>generate-resources</phase> <configuration> <tasks> <ftp action="get" server="${ftp.server.ip}" userid="${ftp.server.userid}" password="${ftp.server.password}" remotedir="${ftp.server.remotedir}" depends="yes" verbose="yes" skipFailedTransfers="true" ignoreNoncriticalErrors="true"> <fileset dir="target/test-classes/testdata"> <include name="**/*.html" /> </fileset> </ftp> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> ... the problem is that my build fails when the folder ${ftp.server.remotedir} doesn't exist. I tried to specify skipFailedTransfers="true" ignoreNoncriticalErrors="true but these don't fix the problem and the build keeps failing. An Ant BuildException has occured: could not change remote directory: 550 /myBadDir: The system cannot find the file specified. Do you know how to instruct my maven build to don't care about this Ant task error

    Read the article

  • Why jquery ajax calls fails after session timeout in asp.net mvc?

    - by Pandiya Chendur
    when there is a value in my session variable my ajax calls work properly... But when a session is timedout it doesn't seem to work returning empty json result.... public JsonResult GetClients(int currentPage, int pageSize) { if (Session["userId"]!=null) { var clients = clirep.FindAllClients(Convert.ToInt32(Session["userId"])).AsQueryable(); var count = clients.Count(); var results = new PagedList<ClientBO>(clients, currentPage - 1, pageSize); var genericResult = new { Count = count, Results = results ,isRedirect=false}; return Json(genericResult); } else { var genericResult = new {redirectUrl = Url.Action("Create", "Registration"), isRedirect = true }; return Json(genericResult); } } However else part does'nt seem to work.... success: function(data) { alert(data.Results); if (data.isRedirect) { window.location.href = data.redirectUrl; } } EDIT: My global.asax has this, public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Clients", "Clients/{action}/{id}", new { controller = "Clients", action = "Index", id = "" } ); routes.MapRoute( "Registrations", "{controller}/{action}/{id}", new { controller = "Registration", action = "Create", id = "" } ); }

    Read the article

  • php when to use get method?

    - by user329394
    how all, when is the right time to use $_GET['data']? i want to pass value of userid from page A to page B by using popup javascript. $qry="SELECT * FROM dbase WHERE id='".$id."'"; $sql=mysql_query($qry); $rs=mysql_fetch_array($sql); <script language="JavaScript"> function myPopup() { window.open( "<?=$CFG->wwwroot.'/ptk/main.php?task=ptk_checkapp&id='.$rs['userid'];?>" ,"myWindow", "status = 1, height = 500, width = 500, scrollbars=yes,toolbar=no,directories=no,location=no,menubar=no, resizable='yes';" ) } </script> calling by hyperlink: <a href="#" onclick="myPopup()"> <?=ucwords(strtolower($rs->nama));?> </a> It seems that , the $rs['user'] dont hold any value on it. can tell me what problem or may be solution? thank you very much.

    Read the article

  • NHibernate mapping for subclasses and joined-subclasses

    - by Husain
    In a project that I am working on, I have the following entities: Analyst, Client and Contractor. Each inherit from a base class User. public abstract class User { public virtual int Id { get; set; } public virtual string Username { get; set; } public virtual string FullName { get; set; } } I then have the other classes inheriting from the base class as: public class Analyst : User { // Empty class. There are no additional properties for an analyst. } public class Client : User { // Empty class. There are no additional properties for a client. } public class Contractor : User { public int TotalJobs { get; set; } public int JobsInProgress { get; set; } } For the above classes, I have the following table structure: USER ---- UserId Username FullName UserType (1 = Analyst, 2 = Client, 3 = Contractor) CONTRACTOR ---------- UserId TotalJobs JobsInProgress There are no tables for Analyst and Client classes. I would like to know how I can write the NHibernate mapping file for the Contractor class. For the other classes, I have created a User mapping file and added Client and Analyst as sub-classes. How can I map the Contractor class?

    Read the article

  • Intermittent asp.net mvc exception: “A public action method ABC could not be found on controller XYZ

    - by Chris Schoon
    Hi, I'm getting an intermittent exception saying that asp.net mvc can’t find the action method. Here’s the exception: A public action method 'Fill' could not be found on controller 'Schoon.Form.Web.Controllers.ChrisController'. I think I have the routing set up correctly because this application works most of the time. Here is the controller’s action method. [ActionName("Fill")] [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post), UserIdFilter, DTOFilter] public ActionResult Fill(int userId, int subscriberId, DisplayMode? mode) { //… } The route: routes.MapRoute( "SchoonForm", "Form/Fill/{subscriberId}", new { controller = "ChrisController", action = "Fill" }, new { subscriberId = @"\d+" } ); And here is the stack: System.Web.HttpException: A public action method 'Fill' could not be found on controller 'Schoon.Form.Web.Controllers.ChrisController'. at System.Web.Mvc.Controller.HandleUnknownAction(String actionName) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\Controller.cs:line 197 at System.Web.Mvc.Controller.ExecuteCore() in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\Controller.cs:line 164 at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\ControllerBase.cs:line 76 at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\ControllerBase.cs:line 87 at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\MvcHandler.cs:line 80 at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\MvcHandler.cs:line 68 at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) in C:\dev\ThirdParty\MvcDev\src\SystemWebMvc\Mvc\MvcHandler.cs:line 104 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Here is an example of my filters they all work the same way: public class UserIdFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { const string Key = "userId"; if (filterContext.ActionParameters.ContainsKey(Key)) { filterContext.ActionParameters[Key] = // get the user id from session or cookie } base.OnActionExecuting(filterContext); } } Thanks, Chris

    Read the article

  • Extend the bootstrap-typeahead in order to take an object instead of a string

    - by Lorraine Bernard
    _.extend($.fn.typeahead.Constructor.prototype, { render: function (items) { var that = this; items = $(items).map(function (i, item) { i = $(that.options.item) .attr('data-value', item[that.options.display]) .attr('data-id', item.id); i.find('a').html(that.highlighter(item)); return i[0]; }); items.first().addClass('active'); this.$menu.html(items); return this; }, select: function () { var val = this.$menu.find('.active').attr('data-value'), id = this.$menu.find('.active').attr('data-id'); this.$element .val(this.updater(val, id)) .change(); return this.hide() } }); return function (element, options) { var getSource = function () { var users = app.userCollection.filter(function (model) { if (options && options.excludeCurrentUser) { return model.id !== app.currentUser.id; } }); return _.map(users, function (user) { return { id: user.get('id'), full_name: user.get('first_name') + ' ' + user.get('last_name') }; }); }; element.typeahead({ minLength: 3, source: getSource, display: 'full_name', sorter: function (items) { var beginswith = [], caseSensitive = [], caseInsensitive = [], item, itemDisplayed; while (item = items.shift()) { itemDisplayed = item[this.options.display]; if (!itemDisplayed.toLowerCase().indexOf(this.query.toLowerCase())) { beginswith.push(item); } else if (~itemDisplayed.indexOf(this.query)) { caseSensitive.push(item); } else { caseInsensitive.push(item); } } return beginswith.concat(caseSensitive, caseInsensitive); }, highlighter: function (item) { var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); return item[this.options.display].replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { return '<strong>' + match + '</strong>'; }); }, matcher: function (item) { var value = item[this.options.display]; return { value: ~value.toLowerCase().indexOf(this.query.toLowerCase()), id: item.id }; }, updater: function (item, userId) { options.hiddenInputElement.val(userId); return item; } }); };

    Read the article

  • Fetching Strategy example in repository pattern with pure POCO Entity framework

    - by Shawn Mclean
    I'm trying to roll out a strategy pattern with entity framework and the repository pattern using a simple example such as User and Post in which a user has many posts. From this answer here, I have the following domain: public interface IUser { public Guid UserId { get; set; } public string UserName { get; set; } public IEnumerable<Post> Posts { get; set; } } Add interfaces to support the roles in which you will use the user. public interface IAddPostsToUser : IUser { public void AddPost(Post post); } Now my repository looks like this: public interface IUserRepository { User Get<TRole>(Guid userId) where TRole : IUser; } Strategy (Where I'm stuck). What do I do with this code? Can I have an example of how to implement this, where do I put this? public interface IFetchingStrategy<TRole> { TRole Fetch(Guid id, IRepository<TRole> role) } My basic problem was what was asked in this question. I'd like to be able to get Users without posts and users with posts using the strategy pattern.

    Read the article

  • how can I know current viewcontroller name in iphone

    - by Shikhar
    I have BaseView which implement UIViewController. Every view in project must implement this BaseView. In BaseView, I have method: -(void) checkLoginStatus { defaults = [[NSUserDefaults alloc] init]; if(![[defaults objectForKey:@"USERID"] length] > 0 ) { Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil]; [self.navigationController pushViewController:login animated:TRUE]; [login release]; } [defaults release]; } The problem is my Login view also implement BaseView, checks for login, and again open LoginView i.e. stuck in to recursive calling. Can I check in checkLoginStatus method if request is from LoginView then take no action else check login. Ex: (void) checkLoginStatus { if(SubView is NOT Login){ defaults = [[NSUserDefaults alloc] init]; if(![[defaults objectForKey:@"USERID"] length] 0 ) { Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil]; [self.navigationController pushViewController:login animated:TRUE]; [login release]; } [defaults release]; } } Please help..

    Read the article

  • Rhino Mocks Sample How to Mock Property

    - by guazz
    How can I test that "TestProperty" was set a value when ForgotMyPassword(...) was called? > public interface IUserRepository { User GetUserById(int n); } public interface INotificationSender { void Send(string name); int TestProperty { get; set; } } public class User { public int Id { get; set; } public string Name { get; set; } } public class LoginController { private readonly IUserRepository repository; private readonly INotificationSender sender; public LoginController(IUserRepository repository, INotificationSender sender) { this.repository = repository; this.sender = sender; } public void ForgotMyPassword(int userId) { User user = repository.GetUserById(userId); sender.Send("Changed password for " + user.Name); sender.TestProperty = 1; } } // Sample test to verify that send was called [Test] public void WhenUserForgetPasswordWillSendNotification_WithConstraints() { var userRepository = MockRepository.GenerateStub<IUserRepository>(); var notificationSender = MockRepository.GenerateStub<INotificationSender>(); userRepository.Stub(x => x.GetUserById(5)).Return(new User { Id = 5, Name = "ayende" }); new LoginController(userRepository, notificationSender).ForgotMyPassword(5); notificationSender.AssertWasCalled(x => x.Send(null), options => options.Constraints(Rhino.Mocks.Constraints.Text.StartsWith("Changed"))); }

    Read the article

  • Parse error: syntax error, unexpected ';'

    - by sufoid
    Hallo I have this script: <? require("lib2/config.inc.php"); require("lib2/tpl.class.php"); require("lib2/db.class.php"); require("lib2/um.class.php"); $tpl = new template("templates", "tpl"); $db = new db($db['location'], $db['username'], $db['passwort'], $db['database']); $um = new usermanagment(); /** User login **/ $checklogin = $um->check_login(); $userdata = $um->getuserdata(); if(!$checklogin && !$guest) { header("LOCATION: ./index2.php"); } eval("\$header .= \" ".$tpl->get("header")."\";"); eval("\$footer .= \" ".$tpl->get("footer")."\";"); $time = time(); $db->Query("UPDATE userdaten SET lastaction = '$time' WHERE userid = '".$userdata['userid']."'"); ?> And get this error: Parse error: syntax error, unexpected ';' in /home/httpd/html/login/global.php(22) : eval()'d code on line 96 Any ideas?

    Read the article

  • treeview dynamically populated

    - by Laziale
    Hello everyone - I have this treeview control where I want to put uploaded files on the server. I want to be able to create the nodes and the child nodes dynamically from the database. I am using this query for getting the data from DB: SELECT c.Category, d.DocumentName FROM Categories c INNER JOIN DocumentUserFile d ON c.ID = d.CategoryId WHERE d.UserId = '9rge333a-91b5-4521-b3e6-dfb49b45237c' The result from that query is this one: Agendas transactions.pdf Minutes accounts.pdf I want to have the treeview sorted that way too. I am trying with this piece of code: TreeNode tn = new TreeNode(); TreeNode tnSub = new TreeNode(); foreach (DataRow dt in tblTreeView.Rows) { tn.Text = dt[0].ToString(); tn.Value = dt[0].ToString(); tnSub.Text = dt[1].ToString(); tnSub.NavigateUrl = "../downloading.aspx?file=" + dt[1].ToString() +"&user=" + userID; tn.ChildNodes.Add(tnSub); tvDocuments.Nodes.Add(tn); } I am getting the treeview populated nicely for the 1st category and the document under that category, but I can't get it to work when I want to show more documents under that category, or even more complicate to show new category beneath the 1st one with documents from that category. How can I solve this? I appreciate the answers a lot. Thanks, Laziale

    Read the article

  • Jquery and Prototype Conflict

    - by patrick
    I am having trouble running two javascript files on the same page. I used JQuery.noConflict() (http://api.jquery.com/jQuery.noConflict/) but no luck. <script src="http://www.google.com/jsapi"></script> <script> google.load("prototype", "1.6.0.3",{uncompressed:false}); google.load("scriptaculous", "1.8.1",{uncompressed:false}); </script> <script src="js/jquery.tools.min.js"></script> <script type="text/javascript"> $jQuery.noConflict(); jQuery(document).ready(function($) { $("#download_now").tooltip({ effect: 'slide'}); }); function show_text() { new Ajax.Request('./new.php', { method: 'post', parameters: { userid: $('userid').value }, onSuccess: function(r) { $('update').update(r.responseText) } }); } document.observe("dom:loaded", function() { $('loading').hide(); Ajax.Responders.register({ onCreate: function() { new Effect.Opacity('loading',{ from: 1.0, to: 0.3, duration: 0.7 }); new Effect.toggle('loading', 'appear'); }, onComplete: function() { new Effect.Opacity('loading', { from: 0.3, to: 1, duration: 0.7 }); new Effect.toggle('loading', 'appear'); } }); }); </script>

    Read the article

  • How to keep form items selected after post request?

    - by Ole Jak
    I have a simple html form. On php page. A simple list is placed on form. I submit this form (selected list items) to this page so it gives me page refresh. I want items which were POSTED to be selected after form was submited. How to do such thing? For my form I use such code: <form action="FormPage.php" method="post"> <select id="Streams" class="multiselect ui-widget-content ui-corner-all" multiple="multiple" name="Streams[]"> <?php $query = " SELECT s.streamId, s.userId, u.username FROM streams AS s JOIN user AS u ON s.userId = u.id LIMIT 0 , 30 "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); $streams_count = mysql_num_rows($streams_set); while ($row = mysql_fetch_array($streams_set)){ echo '<option value="' , $row['streamId'] , '"> ' , $row['username'] , ' (' , $row['streamId'] ,')' ,'</option> '; } ?> </select> <br/> <input type="submit" class="ui-state-default ui-corner-all" name="submitForm" id="submitForm" value="Play Stream from selected URL's!"/> </fieldset> </form>

    Read the article

  • apache solr : sum of data resulted from group by

    - by Terance Dias
    Hi, We have a requirement where we need to group our records by a particular field and take the sum of a corresponding numeric field e.x. select userid, sum(click_count) from user_action group by userid; We are trying to do this using apache solr and found that there were 2 ways of doing this: Using the field collapsing feature (http://blog.jteam.nl/2009/10/20/result-grouping-field-collapsing-with-solr/) but found 2 problems with this: 1.1. This is not part of release and is available as patch so we are not sure if we can use this in production. 1.2. We do not get the sum back but individual counts and we need to sum it at the client side. Using the Stats Component along with faceted search (http://wiki.apache.org/solr/StatsComponent). This meets our requirement but it is not fast enough for very large data sets. I just wanted to know if anybody knows of any other way to achieve this. Appreciate any help. Thanks, Terance.

    Read the article

  • Modify the server side functions using jquery

    - by ant
    Hi, I am developing one website using cakephp and jquery technologies. Server-side there are some functions which handles sql queris. As per requirement I want to modify server side functions on client side using jquery AJAX call. E.g. : Below is the function on server side to modify users information. function modifyUser(username,userid) { //update query statements } Then jquery AJAX call will be like this : $.ajax({ url: 'users/modiyUser', success: function() { alert("Updation done") or any statements. } }); and I want to modify above i.e. server side function depending upon client input criteria. $.ajax({ function users/modiyUser(username,userid) { // I will write here any other statements which gives me some other output. } }); Above AJAX call syntax may not present, but i think you all understood what I am trying to do I simply wants to modify/override server side functions on client side. Please let me know is there any way to resolve above mentioned requirement. Thanks in adavance

    Read the article

  • Axis2 SOAP Envelope Header Information

    - by BigZig
    I'm consuming a web service that places an authentication token in the SOAP envelope header. It appears (through looking at the samples that came with the WS WSDL) that if the stub is generated in .NET, this header information is exposed through a member variable in the stub class. However, when I generate my Axis2 java stub using WSDL2Java it doesn't appear to be exposed anywhere. What is the correct way to extract this information from the SOAP envelope header? WSDL: http://www.vbar.com/zangelo/SecurityService.wsdl C# Sample: using System; using SignInSample.Security; // web service using SignInSample.Document; // web service namespace SignInSample { class SignInSampleClass { [STAThread] static void Main(string[] args) { // login to the Vault and set up the document service SecurityService secSvc = new SecurityService(); secSvc.Url = "http://localhost/AutodeskDM/Services/SecurityService.asmx"; secSvc.SecurityHeaderValue = new SignInSample.Security.SecurityHeader(); secSvc.SignIn("Administrator", "", "Vault"); DocumentServiceWse docSvc = new DocumentServiceWse(); docSvc.Url = "http://localhost/AutodeskDM/Services/DocumentService.asmx"; docSvc.SecurityHeaderValue = new SignInSample.Document.SecurityHeader(); docSvc.SecurityHeaderValue.Ticket = secSvc.SecurityHeaderValue.Ticket; docSvc.SecurityHeaderValue.UserId = secSvc.SecurityHeaderValue.UserId; } } } The sample illustrates what I'd like to do. Notice how the secSvc instance has a SecurityHeaderValue member variable that is populated after a successful secSvc.SignIn() invocation. Here's some relevant API documentation regarding the SignIn method: Although there is no return value, a successful sign in will populate the SecurityHeaderValue of the security service. The SecurityHeaderValue information is then used for other web service calls.

    Read the article

  • is using private shared objects/variables on class level harmful ?

    - by haansi
    Hello, Thanks for your attention and time. I need your opinion on an basic architectural issue please. In page behind classes I am using a private and shared object and variables (list or just client or simplay int id) to temporary hold data coming from database or class library. This object is used temporarily to catch data and than to return, pass to some function or binding a control. 1st: Can this approach harm any way ? I couldn't analyze it but a thought was using such shared variables may replace data in it when multiple users may be sending request at a time? 2nd: Please comment also on using such variables in BLL (to hold data coming from DAL/database). In this example every time new object of BLL class will be made. Here is sample code: public class ClientManager { Client objclient = new Client(); //Used in 1st and 2nd method List<Client> clientlist = new List<Client>();// used in 3rd and 4th method ClientRepository objclientRep = new ClientRepository(); public List<Client> GetClients() { return clientlist = objclientRep.GetClients(); } public List<Client> SearchClients(string Keyword) { return clientlist = objclientRep.SearchClients(Keyword); } public Client GetaClient(int ClientId) { return objclient = objclientRep.GetaClient(ClientId); } public Client GetClientDetailForConfirmOrder(int UserId) { return objclientRep.GetClientDetailForConfirmOrder(UserId); } } I am really thankful to you for sparing time and paying kind attention.

    Read the article

  • Check for child duplicates

    - by ebb
    My console app will loop through each User to get their Websites, so that it can take new screenshots of them. However, to prevent taking screenshot of the same website twice I have to check whether there already has been taken screenshot of the website, while looping through another users websites. My current solution is: Database: User |--> ID: 1 |--> FirstName: Joe |--> ID: 2 |--> FirstName: Stranger Websites |--> ID: 1 |--> UserID: 1 |--> URL: http://site.com |--> ID: 2 |--> UserID: 2 |--> URL: http://site.com Console app: static void RenewWebsiteThumbNails() { Console.WriteLine("Starting renewal process..."); using (_repository) { var websitesUpdated = new List<string>(); foreach (var user in _repository.GetAll()) { foreach (var website in user.Websites.Where(website => !websitesUpdated.Contains(website.URL))) { _repository.TakeScreenDumpAndSave(website.URL); websitesUpdated.Add(website.URL); Console.WriteLine(new string('-', 50)); Console.WriteLine("{0} has successfully been renewed", website.URL); } } } } However, it seems wrong to declare a List for such a scenario, just to check whether a specific URL already has been added... any suggestions for an alternative way?

    Read the article

  • Appending an existing XML file with c#

    - by Farstucker
    I have an existing XML file that I would like to append without changing the format. Existing File looks like this: <Clients> <User username="farstucker"> <UserID>1</UserID> <DOB /> <FirstName>Steve</FirstName> <LastName>Lawrence</LastName> <Location>NYC</Location> </User> </Clients> How can I add another user using this format? My existing code is: string fileLocation = "clients.xml"; XmlTextWriter writer; if (!File.Exists(fileLocation)) { writer = new XmlTextWriter(fileLocation, null); writer.WriteStartDocument(); // Write the Root Element writer.WriteStartElement("Clients"); // End Element and Close writer.WriteEndElement(); writer.Close(); } // Append new data here Ive thought about using XmlDocument Fragment to append the data but Im not certain if I can maintain the existing format ( and empty tags ) without messing up the file. Any advice you could give is much appreciated. EDIT Ive changed the code to read the original XML but the file keeps getting overwritten.

    Read the article

  • how to read xml properties value?

    - by bala
    I have xml file in sdcard(xxx.file) how to read all the xml tag properties values starting point to end point and prints that value please help me I am not familiar in xml pullparser please help me... This is my xml file code: <?xml version="1.0"?> <layout schemaVersion="1" width="800" height="450" bgcolor="#000000"> <region id="47ff29524ce1b" width="800" height="450" top="0" left="0" userId="1"> <media id="9" type="image" duration="30" lkid="4" userId="1" schemaVersion="1"> <options><uri>9.png</uri></options> <raw/> </media></region></layout> java code: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try{ XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); File file = new File(Environment.getExternalStorageDirectory()+ "/xxx.xml"); FileInputStream fis = new FileInputStream(file); parser.setInput(new InputStreamReader(fis)); }catch(XmlPullParserException e){ e.printStackTrace(); }catch(FileNotFoundException e){ e.printStackTrace(); } } }

    Read the article

  • Return value mapping on Stored Procedures in Entity Framework

    - by Yucel
    Hi, I am calling a stored procedure with EntityFramework. But custom property that i set in partial entity class is null. I have Entities in my edmx (I called edmx i dont know what to call for this). For example I have a "User" table in my database and so i have a "User" class on my Entity. I have a stored procedure called GetUserById(@userId) and in this stored procedure i am writing a basic sql statement like below "SELECT * FROM Users WHERE Id=@userId" in my edmx i make a function import to call this stored procedure and set its return value to Entities (also select User from dropdownlist). It works perfectly when i call my stored procedure like below User user = Context.SP_GetUserById(123456); But i add a custom new column to stored procedure to return one more column like below SELECT *, dbo.ConcatRoles(U.Id) AS RolesAsString FROM membership.[User] U WHERE Id = @id Now when i execute it from SSMS new column called RolesAsString appear in result. To work this on entity framework i added a new property called RolesAsString to my User class like below. public partial class User { public string RolesAsString{ get; set; } } But this field isnt filled by stored procedure when i call it. I look to the Mapping Detail windows of my SP_GetUserById there isnt a mapping on this window. I want to add but window is read only i cant map it. I looked to the source of edmx cant find anything about mapping of SP. How can i map this custom field?

    Read the article

  • PHP: How do I rename a directory where the parent directory is variable?

    - by gsquare567
    i would like to move the files inside uploads/pension/#SOME_VARIABLE_NUMBER#/#SOME_CONSTANT_NUMBER#/ here is my code: // move pension statements // located at uploads/pension/%COMPANY_ID%/%USER_ID%/%HASH% // so just move the %USER_ID% folder to the new company $oldPensionDir = "uploads/pension/" . $demo_user[Users::companyID] . "/" . $demo_user[Users::userID] . "/"; $newPensionDir = "uploads/pension/" . $newCompanyID . "/" . $demo_user[Users::userID] . "/"; // see if the user had any files, and if so, move them if(file_exists($oldPensionDir)) { // if it doesnt exist, make it if(!file_exists($newPensionDir)) mkdir($newPensionDir); // move the folder rename($oldPensionDir, $newPensionDir); } however... when i need to make the directory with the "mkdir" function, i get: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such file or directory ok, maybe the mkdir won't work, but what about the rename? perhaps that will make the directory if it's not there... nope! rename(uploads/pension/1001/783/,uploads/pension/1000/783/) [<a href='function.rename'>function.rename</a>]: The system cannot find the path specified. (code: 3) so, there are two errors. i'm pretty sure if the renaming works, i won't even need the mkdir, but who knows... can anyone tell me why these are errors and how to fix them? thanks!

    Read the article

  • protect form hijacking hack

    - by Karem
    Yes hello today I discovered a hack for my site. When you write a msg on a users wall (in my communitysite) it runs a ajax call, to insert the msg to the db and will then on success slide down and show it. Works fine with no problem. So I was rethinking alittle, I am using POST methods for this and if it was GET method you could easily do ?msg=haxmsg&usr=12345679. But what could you do to come around the POST method? I made a new html document, made a form and on action i set "site.com/insertwall.php" (the file that normally are being used in ajax), i made some input fields with names exactly like i am doing with the ajaxcall (msg, uID (userid), BuID (by userid) ) and made a submit button. I know I have a page_protect() function on which requires you to login and if you arent you will be header to index.php. So i logged in (started session on my site.com) and then I pressed on this submit button. And then wops I saw on my site that it has made a new message. I was like wow, was it so easy to hijack POST method i thought maybe it was little more secure or something. I would like to know what could I do to prevent this hijacking? As i wouldnt even want to know what real hackers could do with this "hole". The page_protect secures that the sessions are from the same http user agent and so, and this works fine (tried to run the form without logging in, and it just headers me to startpage) but yea wouldnt take long time to figure out to log in first and then run it. Any advices are appreciated alot. I would like to keep my ajax calls most secure as possible and all of them are running on the POST method. What could I do to the insertwall.php, to check that it comes from the server or something.. Thank you

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >