Search Results

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

Page 10/55 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Action method expected parameter named Id and nothing otherwise

    - by codingbiz
    The Error The parameters dictionary contains a null entry for parameter 'UserId' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult Predict(Int64)' in 'sportingbiz.Controllers.PredictionController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters This does not work. Throws the error mentioned above http://mysite/User/Profile/15 This works http://mysite/User/Profile/?UserID=15 The Controller Action public ActionResult Profile(long UserID) { } When I changed the parameter name to Id it works. I think it's because Id was specified in the route collection (Global.asax). Is it possible to tell MVC that UserId should map to Id without changing it in the Global.asax

    Read the article

  • my sql insert query not working

    - by Piyush
    I am inserting userId.It is displaying correct but inserting 0 in spite of actual userId. mycode- If(! empty($userIDToCheck) || $userIDToCheck != '' ) { echo $userIDToCheck; $sql = "INSERT INTOpnpdb.ruser(userid) VALUES ('$userIDToCheck');"; mysql_query($sql)or die(mysql_error()); echo "Done"; } Output : pi203713 Done But is database it is inserting "0"???

    Read the article

  • Stored procedure or function expects parameter which is not supplied

    - by user2920046
    I am trying to insert data into a SQL Server database by calling a stored procedure, but I am getting the error Procedure or function 'SHOWuser' expects parameter '@userID', which was not supplied. My stored procedure is called "SHOWuser". I have checked it thoroughly and no parameters is missing. My code is: public void SHOWuser(string userName, string password, string emailAddress, List preferences) { SqlConnection dbcon = new SqlConnection(conn); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = dbcon; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SHOWuser"; cmd.Parameters.AddWithValue("@userName", userName); cmd.Parameters.AddWithValue("@password", password); cmd.Parameters.AddWithValue("@emailAddress", emailAddress); dbcon.Open(); int i = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Parameters.Clear(); cmd.CommandText = "tbl_pref"; foreach (int preference in preferences) { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@userID", Convert.ToInt32(i)); cmd.Parameters.AddWithValue("@preferenceID", Convert.ToInt32(preference)); cmd.ExecuteNonQuery(); } } catch (Exception) { throw; } finally { dbcon.Close(); } and the stored procedure is: ALTER PROCEDURE [dbo].[SHOWuser] -- Add the parameters for the stored procedure here ( @userName varchar(50), @password nvarchar(50), @emailAddress nvarchar(50) ) AS BEGIN INSERT INTO tbl_user(userName,password,emailAddress) values(@userName,@password,@emailAddress) select tbl_user.userID,tbl_user.userName,tbl_user.password,tbl_user.emailAddress, stuff((select ',' + preferenceName from tbl_pref_master inner join tbl_preferences on tbl_pref_master.preferenceID = tbl_preferences.preferenceID where tbl_preferences.userID=tbl_user.userID FOR XML PATH ('')),1,1,' ' ) AS Preferences from tbl_user SELECT SCOPE_IDENTITY(); END Pls help, Thankx in advance...

    Read the article

  • Most efficient way to make an activity log

    - by Nathan
    I am making a "recent activity" tab to profiles on my site and I also am going to have a log for moderators to see everything that happens on the site. This would require making an activity log of some sort. I just don't know what would be better. I have 2 options: Make a table called "activity" and then every time someone does something, add a record to it with the type of action, user id, timestamp, etc. Problem: table could get very long. Join all 3 tables (questions, answers, answer_comments) and then somehow show all these on the page in the order in which the action was taken. Problem: this would be extremely hard because I have no clue how I could make it say "John commented on an answer on Question Title Here" by just joining 3 tables. Does anyone know of a better way of making an activity log in this situation? I am using PHP and MySQL. If this is either too inefficient or hard I will probably just forget the Recent Activity tab on profiles but I still need an activity log for moderators. Here's some SQL that I started making for option 2, but this would not work because there is no way of detecting whether the action is a comment, question, or answer when I echo the info in a while loop: SELECT q.*, a.*, ac.* FROM questions q JOIN answers a ON a.questionid = q.qid JOIN answer_comments ac ON c.answerid = a.ans_id WHERE q.user = $userid AND a.userid = $userid AND ac.userid = $userid ORDER BY q.created DESC, a.created DESC, ac.created DESC Thanks in advance for any help!

    Read the article

  • Linq to SQL - How to compare against a collection in the where clause?

    - by Sgraffite
    I'd like to compare against an IEnumerable collection in my where clause. Do I need to manually loop through the collection to pull out the column I want to compare against, or is there a generic way to handle this? I want something like this: public IEnumerable<Cookie> GetCookiesForUsers(IEnumerable<User> Users) { var cookies = from c in db.Cookies join uc in db.UserCookies on c.CookieID equals uc.CookieID join u in db.Users on uc.UserID equals u.UserID where u.UserID.Equals(Users.UserID) select c; return cookies.ToList(); } I'm used to using the lambda Linq to SQL syntax, but I decided to try the SQLesque syntax since I was using joins this time. What is a good way to do this?

    Read the article

  • Code producing System.NullReferenceException error for Membership.GetUser(). This is VB.Net (ASP.Net 4)

    - by Derrek
    I have a Default.aspx page that is not static. I have added functionality with datalist and sqldatasources. When a user logins he/she will see items like saved workouts, saved equipment, total replys, etc... This is based on getting the currently logged in user UserID. Quite simply this works great when the user is logged in. However, I do not want to force a user to login to view the Default page because it does have functionality on it that does not require login. When a user is not logged in of course I receive the [System.NullReferenceException] error. I understand the error well but I do not know how to code to fix it. That is where I need help. I will admit I am more designer than developer. However, I do know the exception error I am receivving is caused by me not setting a value in my code when a user is not logged in. I do not know how to do that and have for a week made unsuccessful attempts at writing the code. Both sets of code below compile for VB.Net/ASP.Net 4/Visual Studio 2010 without errors. However, I still get the System.NullReferenceException error if not logged in. I know it can be done but I do not know the right syntax. If you can help please insert you code in mine or write it out. JUST TELLING ME WHERE TO GO TO FIND AN ANSWER WON'T HELP. I HAVE DONE THAT FOR 7 STRAIGHT DAYS. I APPRECIATE OUR HELP. Partial Class _Default Inherits System.Web.UI.Page Protected Sub SqlDataSource4_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource4.Selecting Dim MemUser As MembershipUser MemUser = Membership.GetUser() If Not MemUser Is DBNull.Value Then UserID.Text = MemUser.ProviderUserKey.ToString() e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString() End If End Sub -------------------------------------ORIGINAL CODE------------------------------- Partial Class _Default Inherits System.Web.UI.Page Protected Sub SqlDataSource4_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource4.Selecting Dim MemUser As MembershipUser MemUser = Membership.GetUser() UserID.Text = MemUser.ProviderUserKey.ToString() e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString() End Sub

    Read the article

  • Facebook / Offline Permission - Trying to perform an action on a set of offline users.

    - by blueigloo
    Hi there, We're building an app which in part of its functionality tries to capture the number of likes associated to a particular video owned by a user. Users of the app are asked for extended off-line access and we capture the key for each user: The format is like this: 2.hg2QQuYeftuHx1R84J1oGg__.XXXX.1272394800-nnnnnn Each user has their offline / infinite key stored in a table in a DB. The object_id which we're interested in is also stored in the DB. At a later stage (offline) we try to run a batch job which reads the number of likes for each user's video. (See attached code) For some reason however, after the first iteration of the loop - which yields the likes correctly, we get a failure with the oh so familiar message: "Session key is invalid or no longer valid" Any insight would be most appreciated. Thanks, B List<DVideo> videoList = db.SelectVideos(); foreach (DVideo video in videoList) { long userId = 0; ConnectSession fbSession = new ConnectSession(APPLICATION_KEY, SECRET_KEY); //session key is attached to the video object for now. fbSession.SessionKey = video.UserSessionKey; fbSession.SessionExpires = false; string fbuid =video.FBUID; long.TryParse(fbuid, out userId); if (userId > 0) { fbSession.UserId = userId; fbSession.Login(); Api fbApi = new Facebook.Rest.Api(fbSession); string xmlQueryResult = fbApi.Fql.Query("SELECT user_id FROM like WHERE object_id = " + video.FBVID); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(new StringReader(xmlQueryResult)); int likesCount = xmlDoc.GetElementsByTagName("user_id").Count; //Write entry in VideoWallLikes if (likesCount > 0) { db.CountWallLikes(video.ID, likesCount); } fbSession.Logout(); } fbSession = null; }

    Read the article

  • add new records using signal in django admin

    - by ganesh
    I've a model called broadcastinfo, It has fields viz.. info,userid...userid is excluded. when i add an new info, my broadcastinfo table should get the records of all userid from user table and the given message. Im trying this via signal.Any idea is highly appreciated. Thanks

    Read the article

  • Inputs inside ListView doesn't change values from old to recently set on ItemUpdating event

    - by Tema
    Hi, I would appreciate if someone help me to understand this situation. I do not know why but when i edit selected ListView item (containing few TextBoxes) and then press Update button in the ItemUpdating event i always get old values instead of those which were typed recently. Why? I do not use Page_Load event so i do not need check on PostBack I try to get value before i bind data from DB to ListView, so it can't override recently typed values I tried to get TextBoxes values in different Event handlers - ItemCommand, ItemUpdating, ItemDataBound - result si always the same Collection NewValues and OldValues are always empty (i think this is because i don't use SqlDataSource control) The only one way i can get new values - is to check Request, but in this case i can't use control validators ... so probably it is bad idea to work with only request. This is the code of ItemUpdating method: ListViewItem editItem = AdminUsersListView.EditItem; Guid userId = new Guid((editItem.FindControl("UserId") as HiddenField).Value); Hashtable dataUpdate = new Hashtable { { "UserName", Request[ (editItem.FindControl("UserNameNew") as TextBox).UniqueID ] }, { "Email", Request[ (editItem.FindControl("Email") as TextBox).UniqueID ] }, { "IsApproved", Request[ (editItem.FindControl("IsApproved") as CheckBox).UniqueID ] == "on" }, { "IsLockedOut", Request[ (editItem.FindControl("IsLockedOut") as CheckBox).UniqueID ] == "on" } }; var x1 = dataUpdate["UserName"]; // this is corrent new value from Request var x2 = (editItem.FindControl("UserNameNew") as TextBox).Text; // this is WRONG! OLD! value from TextBox ... Why??? using (Entities entities = new Entities()) { aspnet_Membership membershipItem = entities.aspnet_Membership.Where(MBS => MBS.UserId == userId).FirstOrDefault(); membershipItem.Email = dataUpdate["Email"].ToString(); membershipItem.LoweredEmail = membershipItem.Email.ToLower(); membershipItem.IsApproved = Convert.ToBoolean(dataUpdate["IsApproved"]); membershipItem.IsLockedOut = Convert.ToBoolean(dataUpdate["IsLockedOut"]); entities.SaveChanges(); aspnet_Users userItem = entities.aspnet_Users.Where(USR => USR.UserId == userId).FirstOrDefault(); userItem.UserName = dataUpdate["UserName"].ToString(); userItem.LoweredUserName = userItem.UserName.ToLower(); entities.SaveChanges(); } AdminUsersListView.EditIndex = -1; AdminUsersListView.DataSource = _getDataList(); AdminUsersListView.DataBind(); Thanks, Art

    Read the article

  • I want search a item frome database

    - by vishal
    I want search a item frome database bye date and id but if I want to search only by date or id tahn data are display but if I want to search by both date and id than not both are display but combine both and than display. my code: SqlConnection con = new SqlConnection("Data Source=NODE5-PC;Initial Catalog=hans;Persist Security Info=True;User ID=sa;Password=123"); cmd = new SqlCommand("SELECT UserId, Date, Report FROM Daily_Report WHERE (Date='" + txtdate.Text + "' or UserId='" + txtempid.Text + "') OR (UserId='" + txtempid.Text + "' and UserId='" + txtempid.Text + "')", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); GridView2.DataSource = rdr; GridView2.DataBind(); con.Close();

    Read the article

  • PHP MySQL query help

    - by user547794
    Hello, I am trying to use this query to return every instance where the variable $d['userID'] is equal to the User ID in a separate table, and then echo the username tied to that user ID. Here's what I have so far: $uid = $d['userID']; $result = mysql_query("SELECT u.username FROM users u LEFT JOIN comments c ON c.userID = u.id WHERE u.id = $uid;")$row = mysql_fetch_assoc($result); echo $row['username'];

    Read the article

  • How to first get different related values from diferent SQL tables (PHP)

    - by Ole Jak
    I am triig to fill options list. I have 2 tables USERS and STREAMS I vant to get all streams and get names of users assigned to that streams. Users consists of username and id Streams consists of id, userID, streamID I try such code: <?php global $connection; $query = "SELECT * FROM streams "; $streams_set = mysql_query($query, $connection); confirm_query($streams_set); $streams_count = mysql_num_rows($streams_set); while ($row = mysql_fetch_array($streams_set)){ $userid = $row['userID']; global $connection; $query2 = "SELECT email, username "; $query2 .= "FROM users "; $query2 .= "WHERE id = '{$userid}' "; $qs = mysql_query($query2, $connection); confirm_query($qs); $found_user = mysql_fetch_array($qs); echo ' <option value="'.$row['streamID'].'">'.$row['userID'].$found_user.'</option> '; } ?> But it does not return USER names from DB=( So what shall I do to this code to see usernames as "options" text?

    Read the article

  • How to pass dynamic id text box value to another page without refreshing with jquery and php

    - by linlin
    $('.btncomment').click(function() { var id = $(this).attr('id'); $.post('SaveTopicInformation.php',{tid:commentform.(topic_+id).value, topicdetail:commentform.(topicdetail_+id).value,userid:commentform.(user_+id).value}); }); $userid=$rows['UserID']; $topicid=$rows['TopicID']; ? " " class="commentAlink"Comment " " value=""/ " value=""/ " cols="50" rows="5" "Cancel " value="Comment" / ?

    Read the article

  • How do I use 2 include statements in a single MVC EF query?

    - by alockrem
    I am trying to write a query that includes 2 joins. 1 StoryTemplate can have multiple Stories 1 Story can have multiple StoryDrafts I am starting the query on the StoryDrafts object because that is where it's linked to the UserId. I don't have a reference from the StoryDrafts object directly to the StoryTemplates object. How would I build this query properly? public JsonResult Index(int userId) { return Json( db.StoryDrafts .Include("Story") .Include("StoryTemplate") .Where(d => d.UserId == userId) ,JsonRequestBehavior.AllowGet); } Thank you for any help.

    Read the article

  • Framework 4 Features: Summary of Security enhancements

    - by Anthony Shorten
    In the last log entry I mentioned one of the new security features in Oracle Utilities Application Framework 4.0.1. Security is one of the major "tent poles" (to borrow a phrase from Steve Jobs) in this release of the framework. There are a number of security related enhancements requested by customers and as a result of internal reviews that we have introduced. Here is a summary of some of the security enchancements we have added in this release: Security Cache Changes - Security authorization information is automatically cached on the server for performance reasons (security is checked for every single call the product makes for all modes of access). Prior to this release the cache auto-refreshed every 30 minutes (or so). This has beem made more nimble by supporting a cache refresh every minute (or so). This means authorization changes are reflected quicker than before. Business Level security - Business Services are configurable services that are based upon Application Services. Typically, the business service inherited its security profile from its parent service. Whilst this is sufficient for most needs, it is now required to further specify security on the Business Service definition itself. This will allow granular security and allow the same application service to be exposed as different Business Services with their own security. This is particularly useful when you base a Business Service on a query zone. User Propogation - As with other client server applications, the database connections are pooled and shared as needed. This means that a common database user is used to access the database from the pool to allow sharing. Unfortunently, this means that tracability at the database level is that much harder. In Oracle Utilities Application Framework V4 the end userid is now propogated to the database using the CLIENT_IDENTIFIER as part of the Oracle JDBC connection API. This not only means that the common database userid is still used but the end user is indentifiable for the duration of the database call. This can be used for monitoring or to hook into Oracle's database security products. This enhancement is only available to Oracle Database customers. Enhanced Security Definitions - Security Administrators use the product browser front end to control access rights of defined users. While this is sufficient for most sites, a new security portal has been introduced to speed up the maintenance of security information. Oracle Identity Manager Integration - With the popularity of Oracle's Identity Management Suite, the Framework now provides an integration adapter and Identity Manager Generic Transport Connector (GTC) to allow users and group membership to be provisioned to any Oracle Utilities Application Framework based product from Oracle's Identity Manager. This is also available for Oracle Utilties Application Framework V2.2 customers. Refer to My Oracle Support KBid 970785.1 - Oracle Identity Manager Integration Overview. Audit On Inquiry - Typically the configurable audit facility in the Oracle Utilities Application Framework is used to audit changes to records. In Oracle Utilities Application Framework the Business Services and Service Scripts could be configured to audit inquiries as well. Now it is possible to attach auditing capabilities to zones on the product (including base package ones). Time Zone Support - In some of the Oracle Utilities Application Framework based products, the timezone of the end user is a factor in the processing. The user object has been extended to allow the recording of time zone information for use in product functionality. JAAS Suport - Internally the Oracle Utilities Application Framework uses a number of techniques to validate and transmit security information across the architecture. These various methods have been reconciled into using Java Authentication and Authorization Services for standardized security. This is strictly an internal change with no direct on how security operates externally. JMX Based Cache Management - In the last bullet point, I mentioned extra security applied to cache management from the browser. Alternatively a JMX based interface is now provided to allow IT operations to control the cache without the browser interface. This JMX capability can be initiated from a JSR120 compliant JMX console or JMX browser. I will be writing another more detailed blog entry on the JMX enhancements as it is quite a change and an exciting direction for the product line. Data Patch Permissions - The database installer provided with the product required lower levels of security for some operations. At some sites they wanted the ability for non-DBA's to execute the utilities in a controlled fashion. The framework now allows feature configuration to allow delegation for patch execution. User Enable Support - At some sites, the use of temporary staff such as contractors is commonplace. In this scenario, temporary security setups were required and used. A potential issue has arisen when the contractor left the company. Typically the IT group would remove the contractor from the security repository to prevent login using that contractors userid but the userid could NOT be removed from the authorization model becuase of audit requirements (if any user in the product updates financials or key data their userid is recorded for audit purposes). It is now possible to effectively diable the user from the security model to prevent any use of the useridwhilst retaining audit information. These are a subset of the security changes in Oracle Utilities Application Framework. More details about the security capabilities of the product is contained in My Oracle Support KB Id 773473.1 - Oracle Utilities Application Framework Security Overview.

    Read the article

  • change password code error

    - by ejah85
    I've created a code to change a password. Now it seem contain an error. When I fill in the form to change password, and click save the error message: Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103 Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103 I really don’t know what the error message means. Please guys. Help me fix it. Here's is the code: <?php session_start(); ?> <?php # change password.php //set the page title and include the html header. $page_title = 'Change Your Password'; //include('templates/header.inc'); if(isset($_POST['submit'])){//handle the form require_once('connectioncomplaint.php');//connect to the db. //include "connectioncomplaint.php"; //create a function for escaping the data. function escape_data($data){ global $dbc;//need the connection. if(ini_get('magic_quotes_gpc')){ $data=stripslashes($data); } return mysql_real_escape_string($data, $dbc); }//end function $message=NULL;//create the empty new variable. //check for a username if(empty($_POST['userid'])){ $u=FALSE; $message .='<p> You forgot enter your userid!</p>'; }else{ $u=escape_data($_POST['userid']); } //check for existing password if(empty($_POST['password'])){ $p=FALSE; $message .='<p>You forgot to enter your existing password!</p>'; }else{ $p=escape_data($_POST['password']); } //check for a password and match againts the comfirmed password. if(empty($_POST['password1'])) { $np=FALSE; $message .='<p> you forgot to enter your new password!</p>'; }else{ if($_POST['password1'] == $_POST['password2']){ $np=escape_data($_POST['password1']); }else{ $np=FALSE; $message .='<p> your new password did not match the confirmed new password!</p>'; } } if($u && $p && $np){//if everything's ok. $query="SELECT userid FROM access WHERE (userid='$u' AND password=PASSWORD('$p'))"; $result=@mysql_query($query); $num=mysql_num_rows($result); if($num == 1){ $row=mysql_fetch_array($result, MYSQL_NUM); //make the query $query="UPDATE access SET password=PASSWORD('$np') WHERE userid=$row[0]"; $result=@mysql_query($query);//run the query. if(mysql_affected_rows() == 1) {//if it run ok. //send an email,if desired. echo '<p><b>your password has been changed.</b></p>'; include('templates/footer.inc');//include the HTML footer. exit();//quit the script. }else{//if it did not run OK. $message= '<p>Your password could not be change due to a system error.We apolpgize for any inconvenience.</p><p>' .mysql_error() .'</p>'; } }else{ $message= '<p> Your username and password do not match our records.</p>'; } mysql_close();//close the database connection. }else{ $message .='<p>Please try again.</p>'; } }//end oh=f the submit conditional. //print the error message if there is one. if(isset($message)){ echo'<font color="red">' , $message, '</font>'; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <body> <script language="JavaScript1.2">mmLoadMenus();</script> <table width="604" height="599" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="130" colspan="7"><img src="images/banner(E-Complaint)-.jpg" width="759" height="130" /></td> </tr> <tr> <td width="100" height="30" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="160" bgcolor="#ABD519"> <?php include "header.php"; ?>&nbsp;</td> </tr> <tr> <td colspan="7" bgcolor="#FFFFFF"> <fieldset><legend> Enter your information in the form below:</legend> <p><b>User ID:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if(isset($_POST['userid'])) echo $_POST['userid']; ?>" /></p> <p><b>Current Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p> <p><b>New Password:</b> <input type="password" name="password1" size="20" maxlength="20" /></p> <p><b>Confirm New Password:</b> <input type="password" name="password2" size="20" maxlength="20" /></p> </fieldset> <div align="center"> <input type="submit" name="submit" value="Change My Password" /></div> </form><!--End Form--> </td> </tr> </table> </body> </html>

    Read the article

  • Passing values between Activities using MonoDroid

    - by Wallym
    Been doing some work in MonoDroid and found that I needed to pass a user entered value from on Activity to another Activity in MonoDroid.  Here's how I did it. In my sending Activity, I need to take some user user entered data and send it to my second activity.  Here is the code:             string UserId = Convert.ToString(et.Text);            if (!String.IsNullOrEmpty(UserId))            {                Intent i = new Intent();                i.SetClass(this, typeof(CustomList));                i.AddFlags(ActivityFlags.NewTask);                i.PutExtra("TwitterId", UserId);                StartActivity(i);            }  In this code, I have called .PutExtra and  passed it with a key.  In this case, I am passing a Twitter id.  In the code that is receiving the data, the code to retrieve the Twitter id is: string twitterId = Intent.GetStringExtra("TwitterId"); The call to GetStringExtra() returns the value passed on the key.

    Read the article

  • Should I modify an entity with many parameters or with the entity itself?

    - by Saeed Neamati
    We have a SOA-based system. The service methods are like: UpdateEntity(Entity entity) For small entities, it's all fine. However, when entities get bigger and bigger, to update one property we should follow this pattern in UI: Get parameters from UI (user) Create an instance of the Entity, using those parameters Get the entity from service Write code to fill the unchanged properties Give the result entity to the service Another option that I've experienced in previous experiences is to create semantic update methods for each update scenario. In other words instead of having one global all-encompasing update method, we had many ad-hoc parametric methods. For example, for the User entity, instead of having UpdateUser (User user) method, we had these methods: ChangeUserPassword(int userId, string newPassword) AddEmailToUserAccount(int userId, string email) ChangeProfilePicture(int userId, Image image) ... Now, I don't know which method is truly better, and for each approach, we encounter problems. I mean, I'm going to design the infrastructure for a new system, and I don't have enough reasons to pick any of these approaches. I couldn't find good resources on the Internet, because of the lack of keywords I could provide. What approach is better? What pitfalls each has? What benefits can we get from each one?

    Read the article

  • WCF REST Error Handler

    - by Elton Stoneman
    I’ve put up on GitHub a sample WCF error handler for REST services, which returns proper HTTP status codes in response to service errors.   The code is very simple – a ServiceBehavior implementation which can be specified in config to tag the RestErrorHandler to a service. Any uncaught exceptions will be routed to the error handler, which sets the HTTP status code and description in the response, based on the type of exception.   The sample defines a ClientException which can be thrown in code to indicate a problem with the client’s request, and the response will be a status 400 with a friendly error message:       throw new ClientException("Invalid userId. Must be provided as a positive integer");   - responds:   Request URL http://localhost/Sixeyed.WcfRestErrorHandler.Sample/ErrorProneService.svc/lastLogin?userId=xyz   Error Status Code: 400, Description: Invalid userId. Must be provided as a positive integer   Any other uncaught exceptions are hidden from the client. The full details are logged with a GUID to identify the error, and the response to the client is a status 500 with a generic message giving them the GUID to follow up on:       var iUserId = 0;     var dbz = 1 / iUserId;   - logs the divide-by-zero error and responds:   Request URL http://localhost/Sixeyed.WcfRestErrorHandler.Sample/ErrorProneService.svc/dbz     Error Status Code: 500, Description: Something has gone wrong. Please contact our support team with helpdesk ID: C9C5A968-4AEA-48C7-B90A-DEC986F80DA5   The sample demonstrates two techniques for building the response. For client exceptions, a friendly HTML response is sent in the body as well as the status code and description. Personally I prefer not to do that – it doesn’t make sense to get a 400 error and find text/html when you’re expecting application/json, but it’s easy to do if that’s the functionality you want. The other option is to send an empty response, which the sample does with server exceptions.   The obvious extension is to have multiple exceptions representing all the status codes you want to provide, then your code is as simple as throwing the relevant exception – UnauthorizedException, ForbiddenExeption, NotImplementedException etc – anywhere in the stack, and it will be handled nicely.

    Read the article

  • Run MySQL INSERT Query multiple times (insert values into multiple tables)

    - by Derek
    Hi, basically, I have 3 tables; users and projects (which is a many-to-many relationship), then I have 'usersprojects' to allow the one-to-many formation. When a user adds a project, I need the project information stored and then the 'userid' and 'projectid' stored in the usersprojects table. It sounds like its really straight forward but I'm having problems with the syntax I think!? As it stands, I have this as my INSERT queries (values going into 2 different tables): $project_id = $_POST['project_id']; $projectname = $_POST['projectname']; $projectdeadline = $_POST['projectdeadline']; $projectdetails = $_POST['projectdetails']; $user_id = $_POST['user_id']; $sql = "INSERT INTO projects (projectid, projectname, projectdeadline, projectdetails) VALUES ('{$projectid}','{$projectname}','{$projectdeadline}','{$projectdetails}')"; $sql = "INSERT INTO usersprojects (userid, projectid) VALUES ('{$userid}','{$projectid}')"; None of the information is being stored in the projects table, but the user ID is being stored in the usersprojects table (but not project ID!?)... I did have it working where the project information is stored correctly with a project ID, before I added this bit: $sql = "INSERT INTO usersprojects (userid, projectid) VALUES ('{$userid}','{$projectid}')"; But before the code above was put in, obviously no info is being stored in usersprojects table. The source code that links the script: <form id="addform" name="addform" method="POST" action="addproject-run.php"> <label>Project Name:</label> <input name="projectname" size="40" id="projectname" value="<?php if (isset($_POST['projectname'])); ?>"/><br /> <input name="user_id" input type="hidden" size="40" id="user_id" value="<?php echo $_SESSION['SESS_USERID']; ?>"/> <label>Project Deadline:</label> <input name="projectdeadline" size="40" id="projectdeadline" value="In the format of 'YYYY-MM-DD'<?php if (isset($_POST['projectdeadline'])); ?>"/><br /> <label>Project Details:</label> <textarea rows="5" cols="20" name="projectdetails" id="projectdetails"><?php if (isset($_POST['projectdetails'])); ?></textarea> <br /> <br /> <input value="Create Project" class="addbtn" type="submit" /> </form></div> So I think I'm right in saying I have the syntax for the SQL statement to be run an insert query of values into 2 tables? Any help is much appreciated! Thanks.

    Read the article

  • Adding delegate with calendar access using Exchange Web Services?

    - by BryanG
    I have a set up where I need to add a delegate to various user calendars programmatically. Using a sample from MDSN, I've gotten as far as trying to add the delegate, but after the call to the service binding, I get nothing back...no success or fail....nothing. How I create the service binidng: // Initialize the service binding serviceBinding = new ExchangeServiceBinding(); serviceBinding.Credentials = new NetworkCredential(Properties.Settings.Default.UserName, Properties.Settings.Default.Password, Properties.Settings.Default.Domain); // A production application should call the autodiscover service to locate the service binding url serviceBinding.Url = Properties.Settings.Default.EWSUrlEndPoint; serviceBinding.RequestServerVersionValue = new RequestServerVersion(); serviceBinding.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1; serviceBinding.AllowAutoRedirect = true; and the delegate addition: static void AddDelegate(string email) { // Create the request. AddDelegateType request = new AddDelegateType(); // Identify the agent's mailbox. request.Mailbox = new EmailAddressType(); request.Mailbox.EmailAddress = email; // add the exch_integration user as a delegate request.DelegateUsers = new DelegateUserType[1]; request.DelegateUsers[0] = new DelegateUserType(); request.DelegateUsers[0].UserId = new UserIdType(); request.DelegateUsers[0].UserId.PrimarySmtpAddress = "[email protected]"; // Specify the permissions that are granted to exch_integration request.DelegateUsers[0].DelegatePermissions = new DelegatePermissionsType(); request.DelegateUsers[0].DelegatePermissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevelType.Author; request.DelegateUsers[0].DelegatePermissions.CalendarFolderPermissionLevelSpecified = true; // Specify whether the agent recieves meeting requests. request.DeliverMeetingRequests = DeliverMeetingRequestsType.DelegatesAndSendInformationToMe; request.DeliverMeetingRequestsSpecified = true; try { // Send the request and get the response. AddDelegateResponseMessageType response = serviceBinding.AddDelegate(request); DelegateUserResponseMessageType[] responseMessages = response.ResponseMessages; // One DelegateUserResponseMessageType exists for each attempt to add a delegate user to an account. foreach (DelegateUserResponseMessageType user in responseMessages) { Console.WriteLine("Results of adding user: " + user.ResponseClass.ToString()); Console.WriteLine(user.DelegateUser.UserId.DisplayName); Console.WriteLine(user.DelegateUser.UserId.PrimarySmtpAddress); Console.WriteLine(user.DelegateUser.UserId.SID); } Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); } } The response nothing which must mean that the AddDelegate call isn't hitting the server properly, but I'm not sure. Thanks.

    Read the article

  • the data can't display in the form....

    - by shimaTun
    i wrote code to view data after user fill the form...but the data can't display.... this the code : <?php include "connectioncomplaint.php"; $userid = $_GET['userid']; $secname = $_GET['secname']; $subject = $_GET['subject']; $comment = $_GET['comment']; //Tarik data dari sini $queryDetail = " SELECT * FROM campuscomplaint " . " WHERE userid = '". $userid . "' AND secname = '". secname . "' "; $resultDetail = mysql_query($queryDetail); $detail = mysql_fetch_array($resultDetail); ?> and this code for form: <tr> <td height="400" colspan="7" bgcolor="#FFFFFF"> <table width="67%" align="center" border="1" bordercolor="#ABD519" cellpadding="2" cellspacing="2"> <tr bordercolor="#0000FF" bgcolor="#000033"> <td colspan="2" align="center" valign="top" bgcolor="#ABD519"> --- Complaint Detail --- &nbsp;</td> </tr> <tr bordercolor="#FFFFFF"> <td width="40%" class="register">User ID:</td> <td width="62%" class="register"><?php echo $detail['userid']; ?></td></tr> <tr bordercolor="#FFFFFF"> <td width="40%" class="register">Section Name:</td> <td width="62%" class="register"><?php echo $detail['secname']; ?></td></tr> <tr> <td width="40%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register">Subject:</td> <td width="62%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register"><?php echo $detail['subject']; ?></td></tr> <tr> <td width="40%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register">Comment:</td> <td width="62%" bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="register"><?php echo $detail['comment']; ?></td></tr> <tr bordercolor="#0000FF" bgcolor="#ABD519"> <td colspan="2" align="center" valign="top">&nbsp;</td> </tr> </table> how to view data from dbase?.... help me...

    Read the article

  • Mapping two tables 0..n in Hibernate

    - by simon
    I have a table Users CREATE TABLE "USERS" ( "ID" NUMBER NOT NULL , "LOGINNAME" VARCHAR2 (150) NOT NULL ) and I have a second table SpecialUsers. No UserId can occur twice in the SpecialUsers table, and only a small subset of the ids of users in the Users table are contained in the SpecialUsers table. CREATE TABLE "SPECIALUSERS" ( "USERID" NUMBER NOT NULL, CONSTRAINT "PK_SPECIALUSERS" PRIMARY KEY ("USERID") ) ALTER TABLE "SPECIALUSERS" ADD CONSTRAINT "FK_SPECIALUSERS_USERID" FOREIGN KEY ("USERID") REFERENCES "USERS" ("ID") / Mapping the Users table in Hibernate works ok <hibernate-mapping package="com.initech.domain"> <class name="com.initech.User" table="USERS"> <id name="id" column="ID" type="java.lang.Long"> <meta attribute="use-in-tostring">true</meta> <generator class="sequence"> <param name="sequence">SEQ_USERS_ID</param> </generator> </id> <property name="loginName" column="LOGINNAME" type="java.lang.String" not-null="true"> <meta attribute="use-in-tostring">true</meta> </property> </class> </hibernate-mapping> But I'm struggling in creating the mapping for the SpecialUsers table. All the examples (e.g. in Hibernate documentation) in Internet I found don't have this type of self-reference. I tried a mapping like this: <hibernate-mapping package="com.initech.domain"> <class name="com.initech.User" table="SPECIALUSERS"> <id name="id" column="USERID"> <meta attribute="use-in-tostring">true</meta> <generator class="foreign"> <param name="property">user</param> </generator> </id> <one-to-one name="user" class="User"/> </class> </hibernate-mapping> but got the error Invocation of init method failed; nested exception is org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.initech.User How should I map the SpecialUsers table? What I need on the application level is a list of the User objects contained in the SpecialUsers table.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >