Search Results

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

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

  • JSP JPA Form: how to insert value in a path variable

    - by kajarigd
    I have the following code snippet in a jsp file: <hr> <form:form commandName="newTicketSale" id="reg" action="transactionResult.htm"> <h3>Buy Movie Tickets:</h3> <form:label path="movieName">Movie Name:</form:label> <form:input path="movieName" /> <form:errors class="invalid" path="movieName" /> <form:label path="ticketPrice">Ticket Price:</form:label> <form:input path="ticketPrice" /> <form:errors class="invalid" path="ticketPrice" /> <input type="submit"> <br><br> </form:form> I am using JPA tags in this jsp. Now, in the commandName "newTicketSale" there is another parameter called userId. In the jsp file itself I need to insert value ${name} in userId, so that in the Controller file when I am doing @Valid @ModelAttribute("newTicketSale") MovieTicket newTicket I can retrieve the value ${name} when I am doing newTicket.getUserId(). I don't know how to do this. Please help! Thanks in advance!

    Read the article

  • Facebook Android SDK. Error validating access token

    - by Mj1992
    I am trying to access user information from facebook sdk.But I keep getting this error. {"error":{"message":"Error validating access token: The session has been invalidated because the user has changed the password.","type":"OAuthException","code":190,"error_subcode":460}} Here is the call which returns me the error in the response parameter of the oncomplete function. mAsyncRunner.request("me", new RequestListener() { @Override public void onComplete(String response, Object state) { Log.d("Profile", response); String json = response; //<-- error in response try { JSONObject profile = new JSONObject(json); MainActivity.this.userid = profile.getString("id"); new GetUserProfilePic().execute(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "Name: " + MainActivity.this.userid, Toast.LENGTH_LONG).show(); } }); } catch (JSONException e) { e.printStackTrace(); Log.e("jsonexception",e.getMessage()); facebook.extendAccessTokenIfNeeded(MainActivity.this, null); GetUserInfo(); } } @Override public void onIOException(IOException e, Object state) { } @Override public void onFileNotFoundException(FileNotFoundException e, Object state) { } @Override public void onMalformedURLException(MalformedURLException e, Object state) { } @Override public void onFacebookError(FacebookError e, Object state) { } }); Sometimes I get the correct response also.I think this is due to the access token expiration if I am right. So can you guys tell me how to extend the access token although I've used this facebook.extendAccessTokenIfNeeded(this, null); in the onResume method of the activity. How to solve this?

    Read the article

  • Play! 1.2.5 with mongodb | Model Validation not happening

    - by TGV
    I have a simple User model whose fields are annotated with play validation annotations and morphia annotations like below. import play.data.validation.*; import play.modules.morphia.Model; import com.google.code.morphia.annotations.*; @Entity public class User extends Model{ @Id @Indexed(name="USERID", unique=true) public ObjectId userId; @Required public String userName; @Email @Indexed(name="USEREMAIL", unique=true) @Required public String userEmail; } Now I have a service which has a CreateNewUser method responsible for persisting the data. I have used Morphia plugin for the dao support. But the problem is that User Document gets persisted in mongo-db even if userName or userEmail is NULL. Also @Email validation does not happen // Below code is in app/controllers/Application.java User a = new User(); a.userName = "user1"; // calling bean to create user, userService is in app/service/UserService userService.createNewUser(a); It does not work even after adding @valid and validation.hasErrors() check.Below code is in app/service/UserService public void createNewUser(@Valid User user) { if (Validation.hasErrors()) { System.out.println("has errors"); } else { // TODO Auto-generated method stub userDao.save(user); } }

    Read the article

  • em.createQuery keeps returning null

    - by Developer106
    I have this application which i use JSF 2.0 and EclipseLink, i have entities created for a database made in MySQL, Created these entities using netbeans 7.1.2, it gets created automaticly. Then i use session beans to work with these entities, the thing is the em.createQuery always returns a null, though I checked NamedQueries in the entities and they perfectly match a sample from the entities named queries:- @NamedQueries({ @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"), @NamedQuery(name = "Users.findByUserId", query = "SELECT u FROM Users u WHERE u.userId = :userId"), @NamedQuery(name = "Users.findByUsername", query = "SELECT u FROM Users u WHERE u.username = :username"), @NamedQuery(name = "Users.findByEmail", query = "SELECT u FROM Users u WHERE u.email = :email"), notice how i use this findByEmail query in the session bean :- public Users findByEmail(String email){ em.getTransaction().begin(); String find = "Users.findByEmail"; Query query = em.createNamedQuery(find); query.setParameter("email", email); Users user = (Users) query.getSingleResult(); but it always returns null from this em.createNamedQuery, i tried using .createQuery first but it also was no good. the stacktrace of the exception Caused by: java.lang.NullPointerException at com.readme.entities.sessionBeans.UsersFacade.findByEmail(UsersFacade.java:48) at com.readme.user.signup.SignupBean.checkAvailability(SignupBean.java:137) at com.readme.user.signup.SignupBean.save(SignupBean.java:146) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) What Seems To Be The Problem Here ?

    Read the article

  • count of last item of the day

    - by frenchie
    I have a query in which one of the fields contains the count of status. The status can change several times a day and the count should be based on the final status of the day. For instance, this is what I have for Status1. CountStatus1 = (from status in MyDataContext.StatusHistories where status.UserID == TheUserID where status.StatusDateTime.Month == TheMonth.Month where status.StatusDateTime.Year == TheMonth.Year where status.NewStatus == 1 // where the LAST STATUS OF THE DAY == 1 select status.StatusID).Count() The problem is that I want to select the last status of the day to be equal to 1, and count those. The status for a day can change from 1 to 4 to 2 to 5 to 3 and then to finally to 1; if I write the query like this, the count will include 2 1's and then the 4,2,5 and 3 will also be counted in CountStatus4, CountStatus3, CountStatus"n". The return data is a monthly report grouped by day, where each day is a row. The structure of the query looks like this: var OutputStatusReport = from w in MyDataContext.WorkHistory where w.UserID == TheUserID where w.WorkDatetime.Month == TheMonth.Month where w.WorkDatetime.Year == TheMonth.Year group w by w.Datetime.Date into daygroups select new MyObjectModel { CountStatus1 = ...., CountStatus2 = ...., CountStatus3 =...... }; So I need the day of the count to match the day of daygroups. I'm struggling to figure this one out and any help is very welcome. Thanks.

    Read the article

  • ASP.NET MVC Inserting object and related object into 2 tables

    - by ile
    I have two tables: Users and UserOwners. Table UserOwners contains list of users that certain user created (list of child-users) - or to be more precise, it contains UserOwnerID and UserID fields. So, now I want to create a new user... in Controller I have something like this: var userOwner = accountRepository.GetUser(User.Identity.Name); var userOwnerID = userOwner.UserID; UserReference userReference = new UserReference(); userReference.UserOwnerID = userOwnerID; if (ModelState.IsValid) { try { //accountRepository.Add(user); //accountRepository.Save(); return View(); } catch { return View(); } } What is the easiest way to add new user to a table Users and matching UserOwner to UserOwners table. Is it suppose to be something like this? public void Add(User user) { db.Users.InsertOnSubmit(user); db.UserReferences.InsertOnSubmit(user.UserReference); } ...or I will have to pass two objects and after adding user I must read it's ID and than assign it to userReference object and add that object to DB? If so, how to read ID of the last object added? Thanks, Ile

    Read the article

  • Create table and call it from sql

    - by user1770816
    I have a PL/SQL function which creates a new temporary table. For creating the table I use execute immediate. When I run my function in oracle sql developer everything is ok; the function creates the temp table without errors. But when U use SQL: Select function_name from table_name I get an exceptions: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML ORA-06512: at "SYSTEM.GET_USERS", line 10 14552. 00000 - "cannot perform a DDL, commit or rollback inside a query or DML " *Cause: DDL operations like creation tables, views etc. and transaction control statements such as commit/rollback cannot be performed inside a query or a DML statement. Update Sorry, write from tablet PC and have problems with format text. My function: CREATE OR REPLACE FUNCTION GET_USERS ( USERID IN VARCHAR2 ) RETURN VARCHAR2 AS request VARCHAR2(520) := 'CREATE GLOBAL TEMPORARY TABLE '; BEGIN request := request || 'temp_table_' || userid || '(user_name varchar2(50), user_id varchar2(20), is_administrator varchar2(5)') || ' ON COMMIT PRESERVE ROWS'; EXECUTE IMMEDIATE (request); RETURN 'true'; END GET_USERS;

    Read the article

  • Javascript Conflict on PHP page

    - 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 Block The UserName After 3 Invalid Password Attempts IN ASP.NET

    - by shihab
    I used the following code for checking user name and password. and I want ti block the user name after 3 invalid password attempt. what should I add in my codeing MD5CryptoServiceProvider md5hasher = new MD5CryptoServiceProvider(); Byte[] hashedDataBytes; UTF8Encoding encoder = new UTF8Encoding(); hashedDataBytes = md5hasher.ComputeHash(encoder.GetBytes(TextBox3.Text)); StringBuilder hex = new StringBuilder(hashedDataBytes.Length * 2); foreach (Byte b in hashedDataBytes) { hex.AppendFormat("{0:x2}", b); } string hash = hex.ToString(); SqlConnection con = new SqlConnection("Data Source=Shihab-PC;Initial Catalog=test;User ID=SOMETHING;Password=SOMETHINGELSE"); SqlDataAdapter ad = new SqlDataAdapter("select password from Users where UserId='" + TextBox4.Text + "'", con); DataSet ds = new DataSet(); ad.Fill(ds, "Users"); SqlDataAdapter ad2 = new SqlDataAdapter("select UserId from Users ", con); DataSet ds2 = new DataSet(); ad2.Fill(ds2, "Users"); Session["id"] = TextBox4.Text.ToString(); if ((string.Compare((ds.Tables["Users"].Rows[0][0].ToString()), hash)) == 0) { if (string.Compare(TextBox4.Text, (ds2.Tables["Users"].Rows[0][0].ToString())) == 0) { Response.Redirect("actioncust.aspx"); } else { Response.Redirect("actioncust.aspx"); } } else { Label2.Text = "Invalid Login"; } con.Close(); }

    Read the article

  • List all foreign key constraints that refer to a particular column in a specific table

    - by Sid
    I would like to see a list of all the tables and columns that refer (either directly or indirectly) a specific column in the 'main' table via a foreign key constraint that has the ON DELETE=CASCADE setting missing. The tricky part is that there would be an indirect relationships buried across up to 5 levels deep. (example: ... great-grandchild- FK3 = grandchild = FK2 = child = FK1 = main table). We need to dig up the leaf tables-columns, not just the very 1st level. The 'good' part about this is that execution speed isn't of concern, it'll be run on a backup copy of the production db to fix any relational issues for the future. I did SELECT * FROM sys.foreign_keys but that gives me the name of the constraint - not the names of the child-parent tables and the columns in the relationship (the juicy bits). Plus the previous designer used short, non-descriptive/random names for the FK constraints, unlike our practice below The way we're adding constraints into SQL Server: ALTER TABLE [dbo].[UserEmailPrefs] WITH CHECK ADD CONSTRAINT [FK_UserEmailPrefs_UserMasterTable_UserId] FOREIGN KEY([UserId]) REFERENCES [dbo].[UserMasterTable] ([UserId]) ON DELETE CASCADE GO ALTER TABLE [dbo].[UserEmailPrefs] CHECK CONSTRAINT [FK_UserEmailPrefs_UserMasterTable_UserId] GO The comments in this SO question inpire this question.

    Read the article

  • passing xml to a webservice

    - by Neale
    I have a simple web service that will have one method: DoTransactions(xlm) Now the reason that i am using XML as a parameter is due to the fact that the parameters will often change. So for example it could be: <payload> <userId>1234</userid> <partnerId>ptn654</partnerId> </payload> OR <payload> <partnerId>ptn654</partnerId> <items> <item1> <cost>10</cost> <description>This is item 1</description> </item1> </items> </payload> As you can see the XML string will always change (this is due to a client request) Would it be better to rather pass in a string and parse the XML in the method or should is there a better way to do it. This web service will be used for varios different code languages.

    Read the article

  • MS SQL - High performance data inserting with stored procedures

    - by Marks
    Hi. Im searching for a very high performant possibility to insert data into a MS SQL database. The data is a (relatively big) construct of objects with relations. For security reasons i want to use stored procedures instead of direct table access. Lets say i have a structure like this: Document MetaData User Device Content ContentItem[0] SubItem[0] SubItem[1] SubItem[2] ContentItem[1] ... ContentItem[2] ... Right now I think of creating one big query, doing somehting like this (Just pseudo-code): EXEC @DeviceID = CreateDevice ...; EXEC @UserID = CreateUser ...; EXEC @DocID = CreateDocument @DeviceID, @UserID, ...; EXEC @ItemID = CreateItem @DocID, ... EXEC CreateSubItem @ItemID, ... EXEC CreateSubItem @ItemID, ... EXEC CreateSubItem @ItemID, ... ... But is this the best solution for performance? If not, what would be better? Split it into more querys? Give all Data to one big stored procedure to reduce size of query? Any other performance clue? I also thought of giving multiple items to one stored procedure, but i dont think its possible to give a non static amount of items to a stored procedure. Since 'INSERT INTO A VALUES (B,C),(C,D),(E,F) is more performant than 3 single inserts i thought i could get some performance here. Thanks for any hints, Marks

    Read the article

  • Replace field value(s) in a String

    - by xybrek
    Using Google Guava is there String utility to easily replace string field inside like this: String query = mydb..sp_mySP ${userId}, ${groupId}, ${someOtherField} Where I can do something like this: StringUtil.setString(query) .setField("userId", "123") .setField("groupId", "456") .setField("someOtherField", "12-12-12"); Then the resulting String would be: mydb..sp_mySP 123, 456, 12-12-12 Of course, setting the String field patter like ${<field>} before the operation... Anyway, this is my approach: public class StringUtil { public class FieldModifier { private String s; public FieldModifier(String s){ this.s = s; } public FieldModifier setField(String fieldName, Object fieldValue){ String value = String.valueOf(fieldValue); s = modifyField(s, fieldName, value); return new FieldModifier(s); } private String modifyField(String s, String fieldName, String fieldValue){ String modified = ""; return modified; } } public FieldModifier parse(String s){ FieldModifier fm = new FieldModifier(s); return fm; } } So in this case, I just need to put the actual code in the modifyField function that will modify the string in a straightforward way. Also if there's a way so the parse function be static so I can just do StringUtil.parse(...) without doing new StringUtil().parse(...) which really doesn't look good.

    Read the article

  • How important is it that models be consistent across project components?

    - by RonLugge
    I have a project with two components, a server-side component and a client-side component. For various reasons, the client-side device doesn't carry a fully copy of the database around. How important is it that my models have a 1:1 correlation between the two sides? And, to extend the question to my bigger concern, are there any time-bombs I'm going to run into down the line if they don't? I'm not talking about having different information on each side, but rather the way the information is encapsulated will vary. (Obviously, storage mechanisms will also vary) The server side will store each user, each review, each 'item' with seperate tables, and create links between them to gather data as necessary. The client side shouldn't have a complete user database, however, so rather than link against the user for gathering things like 'name', I'd store that on the review. In other words... --- Server Side --- Item: +id //Store stuff about the item User: +id +Name -Password Review: +id +itemId +rating +text +userId --- Device Side --- Item: +id +AverageRating Review: +id +rating +text +userId +name User: +id +Name //Stuff The basic idea is that certain 'critical' information gets moved one level 'up'. A user gets the list of 'items' relevant to their query, with certain review-orientation moved up (i. e. average rating). If they want more info, they query the detail view for the item, and the actual reviews get queried and added to the dataset (and displayed). If they query the actual review, the review gets queried and they pick up some additional user info along the way (maybe; I'm not sure if the user would have any use for any of the additional user information). My basic concern is that I don't wan't to glut the user's bandwidth or local storage with a huge variety of information that they just don't need, even if proper database normalizations suggests that information REALLY should be stored at a 'lower' level. I've phrased this as a fairly low-level conceptual issue because that's the level I'm trying to think / worry over, but if it matters I'm creating a PHP / MySQL server that provides data for a iOS / CoreData client.

    Read the article

  • JDBC with JSP fails to insert

    - by StrykeR
    I am having some issues right now with JDBC in JSP. I am trying to insert username/pass ext into my MySQL DB. I am not getting any error or exception, however nothing is being inserted into my DB either. Below is my code, any help would be greatly appreciated. <% String uname=request.getParameter("userName"); String pword=request.getParameter("passWord"); String fname=request.getParameter("firstName"); String lname=request.getParameter("lastName"); String email=request.getParameter("emailAddress"); %> <% try{ String dbURL = "jdbc:mysql:localhost:3306/assi1"; String user = "root"; String pwd = "password"; String driver = "com.mysql.jdbc.Driver"; String query = "USE Users"+"INSERT INTO User (UserName, UserPass, FirstName, LastName, EmailAddress) " + "VALUES ('"+uname+"','"+pword+"','"+fname+"','"+lname+"','"+email+"')"; Class.forName(driver); Connection conn = DriverManager.getConnection(dbURL, user, pwd); Statement statement = conn.createStatement(); statement.executeUpdate(query); out.println("Data is successfully inserted!"); } catch(SQLException e){ for (Throwable t : e) t.printStackTrace(); } %> DB script here: CREATE DATABASE Users; use Users; CREATE TABLE User ( UserID INT NOT NULL AUTO_INCREMENT, UserName VARCHAR(20), UserPass VARCHAR(20), FirstName VARCHAR(30), LastName VARCHAR(35), EmailAddress VARCHAR(50), PRIMARY KEY (UserID) );

    Read the article

  • Query syntax error selecting from 3 tables

    - by Toni Michel Caubet
    Given info about an object: id, user_id, group_id Given info about an user: id_user, id_loc I need to get i one query: The name of the user (in table users) The name of the location of the user (in table locs) The name of the group of the object (in table groups) I am trying like this: SELECT usuarios.first_name as username, usuarios.id as userid, usuarios.avatar as useravatar, usuarios.id_loc, locs.name as locname, groups.name as groupname FROM usuarios,groups,locs WHRE usuarios.id_loc = locs.id AND usuarios.id = 1 AND group.id = LIMIT 1 having an error saying You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND locs.id = 3 LIMIT 1' at line 3 What am i doing wrong? can i do this in one query? -EDIT- This is the query generator code (php+mysql): $query_loc_group_user = 'SELECT usuarios.first_name as username, usuarios.id as userid, usuarios.avatar as useravatar, usuarios.id_loc, locs.name as locname, groups.name as groupname FROM usuarios,groups,locs WHRE usuarios.id_loc = locs.id AND usuarios.id = '.$this->id_user.' AND group.id = '.$this->id_group.' LIMIT 1'; In case it helps, i am trying to do in one query this function get_info(){ $info; $result = cache_query('SELECT first_name,last_name,avatar FROM usuarios WHERE id = '.$this->id_user); foreach($result as $extra){ $info['username'] = $extra['first_name'].' '.$extra['last_name']; $info['avatar'] = $extra['avatar']; } $result1 = cache_query('SELECT name FROM locs WHERE id = '.$this->id_user); foreach($result1 as $extra){ $info['locname'] = $extra['name']; } $result2 = cache_query('SELECT name FROM locs WHERE id = '.$this->id_user); foreach($result2 as $extra){ $info['groupname'] = $extra['name']; } return $info; }

    Read the article

  • num_rows is 0 when it should be >0 for php mysqli code

    - by jpporterVA
    My num_rows is coming back as 0, and I've tried calling it several ways, but I'm stuck. Here is my code: $conn = new mysqli($dbserver, "dbuser", "dbpass", $dbname); // get the data $sql = 'SELECT AT.activityName, AT.createdOn FROM userActivity UA, users U, activityType AT WHERE U.userId = UA.userId and AT.activityType = UA.activityType and U.username = ? order by AT.createdOn'; $stmt = $conn->stmt_init(); $stmt->prepare($sql); $stmt->bind_param('s', $requestedUsername); $stmt->bind_result($activityName, $createdOn); $stmt->execute(); // display the data $numrows = $stmt->num_rows; $result=array("user activity report for: " . $requestedUsername . " with " . $numrows . " rows:"); $result[]="Created On --- Activity Name"; while ($stmt->fetch()) { $msg = " " . $createdOn . " --- " . $activityName . " "; $result[] = $msg; } $stmt->close(); There are multiple rows found, and the fetch loop process them just fine. Any suggestions on what will enable me to get the number of rows returned in the query? Suggestions are much appreciated. Thanks in advance.

    Read the article

  • EF Query with conditional include that uses Joins

    - by makerofthings7
    This is a follow up to another user's question. I have 5 tables CompanyDetail CompanyContacts FK to CompanyDetail CompanyContactsSecurity FK to CompanyContact UserDetail UserGroupMembership FK to UserDetail How do I return all companies and include the contacts in the same query? I would like to include companies that contain zero contacts. Companies have a 1 to many association to Contacts, however not every user is permitted to see every Contact. My goal is to get a list of every Company regardless of the count of Contacts, but include contact data. Right now I have this working query: var userGroupsQueryable = _entities.UserGroupMembership .Where(ug => ug.UserID == UserID) .Select(a => a.GroupMembership); var contactsGroupsQueryable = _entities.CompanyContactsSecurity;//.Where(c => c.CompanyID == companyID); /// OLD Query that shows permitted contacts /// ... I want to "use this query inside "listOfCompany" /// //var permittedContacts= from c in userGroupsQueryable //join p in contactsGroupsQueryable on c equals p.GroupID //select p; However this is inefficient when I need to get all contacts for all companies, since I use a For..Each loop and query each company individually and update my viewmodel. Question: How do I shoehorn the permittedContacts variable above and insert that into this query: var listOfCompany = from company in _entities.CompanyDetail.Include("CompanyContacts").Include("CompanyContactsSecurity") where company.CompanyContacts.Any( // Insert Query here.... // b => b.CompanyContactsSecurity.Join(/*inner*/,/*OuterKey*/,/*innerKey*/,/*ResultSelector*/) ) select company; My attempt at doing this resulted in: var listOfCompany = from company in _entities.CompanyDetail.Include("CompanyContacts").Include("CompanyContactsSecurity") where company.CompanyContacts.Any( // This is concept only... doesn't work... from grps in userGroupsQueryable join p in company.CompanyContactsSecurity on grps equals p.GroupID select p ) select company;

    Read the article

  • Inheritance issue

    - by VenkateshGudipati
    hi Friends i am facing a issue in Inheritance i have a interface called Irewhizz interface irewhzz { void object save(object obj); void object getdata(object obj); } i write definition in different class like public user:irewhzz { public object save(object obj); { ....... } public object getdata(object obj); { ....... } } this is antoher class public client:irewhzz { public object save(object obj); { ....... } public object getdata(object obj); { ....... } } now i have different classes like public partial class RwUser { #region variables IRewhizzDataHelper irewhizz; IRewhizzRelationDataHelper irewhizzrelation; private string _firstName; private string _lastName; private string _middleName; private string _email; private string _website; private int _addressId; private string _city; private string _zipcode; private string _phone; private string _fax; //private string _location; private string _aboutMe; private string _username; private string _password; private string _securityQuestion; private string _securityQAnswer; private Guid _user_Id; private long _rwuserid; private byte[] _image; private bool _changepassword; private string _mobilephone; private int _role; #endregion //IRewhizz is the interface and its functions are implimented by UserDataHelper class //RwUser Class is inheriting the UserDataHelper Properties and functions. //Here UserDataHelper functions are called with Irewhizz Interface Object but not with the //UserDataHelper class Object It will resolves the unit testing conflict. #region Constructors public RwUser() : this(new UserDataHelper(), new RewhizzRelationalDataHelper()) { } public RwUser(IRewhizzDataHelper repositary, IRewhizzRelationDataHelper relationrepositary) { irewhizz = repositary; irewhizzrelation = relationrepositary; } #endregion #region Properties public int Role { get { return _role; } set { _role = value; } } public string MobilePhone { get { return _mobilephone; } set { _mobilephone = value; } } public bool ChangePassword { get { return _changepassword; } set { _changepassword = value; } } public byte[] Image { get { return _image; } set { _image = value; } } public string FirstName { get { return _firstName; } set { _firstName = value; } } public string LastName { get { return _lastName; } set { _lastName = value; } } public string MiddleName { get { return _middleName; } set { _middleName = value; } } public string Email { get { return _email; } set { _email = value; } } public string Website { get { return _website; } set { _website = value; } } public int AddressId { get { return _addressId; } set { _addressId = value; } } public string City { get { return _city; } set { _city = value; } } public string Zipcode { get { return _zipcode; } set { _zipcode = value; } } public string Phone { get { return _phone; } set { _phone = value; } } public string Fax { get { return _fax; } set { _fax = value; } } //public string Location //{ // get // { // return _location; // } // set // { // _location = value; // } //} public string AboutMe { get { return _aboutMe; } set { _aboutMe = value; } } public string username { get { return _username; } set { _username = value; } } public string password { get { return _password; } set { _password = value; } } public string SecurityQuestion { get { return _securityQuestion; } set { _securityQuestion = value; } } public string SecurityQAnswer { get { return _securityQAnswer; } set { _securityQAnswer = value; } } public Guid UserID { get { return _user_Id; } set { _user_Id = value; } } public long RwUserID { get { return _rwuserid; } set { _rwuserid = value; } } #endregion #region MemberFunctions // DataHelperDataContext db = new DataHelperDataContext(); // RewhizzDataHelper rwdh=new RewhizzDataHelper(); //It saves user information entered by user and returns the id of that user public object saveUserInfo(RwUser userObj) { userObj.UserID = irewhizzrelation.GetUserId(username); var res = irewhizz.saveData(userObj); return res; } //It returns the security questions for user registration } public class Agent : RwUser { IRewhizzDataHelper irewhizz; IRewhizzRelationDataHelper irewhizzrelation; private int _roleid; private int _speclisationid; private int[] _language; private string _brokaragecompany; private int _loctionType_lk; private string _rolename; private int[] _specialization; private string _agentID; private string _expDate; private string _regstates; private string _selLangs; private string _selSpels; private string _locations; public string Locations { get { return _locations; } set { _locations = value; } } public string SelectedLanguages { get { return _selLangs; } set { _selLangs = value; } } public string SelectedSpecialization { get { return _selSpels; } set { _selSpels = value; } } public string RegisteredStates { get { return _regstates; } set { _regstates = value; } } //private string _registeredStates; public string AgentID { get { return _agentID; } set { _agentID = value; } } public string ExpDate { get { return _expDate; } set { _expDate = value; } } private int[] _registeredStates; public SelectList RegisterStates { set; get; } public SelectList Languages { set; get; } public SelectList Specializations { set; get; } public int[] RegisterdStates { get { return _registeredStates; } set { _registeredStates = value; } } //public string RegisterdStates //{ // get // { // return _registeredStates; // } // set // { // _registeredStates = value; // } //} public int RoleId { get { return _roleid; } set { _roleid = value; } } public int SpeclisationId { get { return _speclisationid; } set { _speclisationid = value; } } public int[] Language { get { return _language; } set { _language = value; } } public int LocationTypeId { get { return _loctionType_lk; } set { _loctionType_lk = value; } } public string BrokarageCompany { get { return _brokaragecompany; } set { _brokaragecompany = value; } } public string Rolename { get { return _rolename; } set { _rolename = value; } } public int[] Specialization { get { return _specialization; } set { _specialization = value; } } public Agent() : this(new AgentDataHelper(), new RewhizzRelationalDataHelper()) { } public Agent(IRewhizzDataHelper repositary, IRewhizzRelationDataHelper relationrepositary) { irewhizz = repositary; irewhizzrelation = relationrepositary; } public void inviteclient() { //Code related to mailing } //DataHelperDataContext dataObj = new DataHelperDataContext(); //#region IRewhizzFactory Members //public List<object> getAgentInfo(string username) //{ // var res=dataObj.GetCompleteUserDetails(username); // return res.ToList(); // throw new NotImplementedException(); //} //public List<object> GetRegisterAgentData(string username) //{ // var res= dataObj.RegisteredUserdetails(username); // return res.ToList(); //} //public void saveAgentInfo(string username, string password, string firstname, string lastname, string middlename, string securityquestion, string securityQanswer) //{ // User userobj=new User(); // var result = dataObj.rw_Users_InsertUserInfo(firstname, middlename, lastname, dataObj.GetUserId(username), securityquestion, securityquestionanswer); // throw new NotImplementedException(); //} //#endregion public Agent updateData(Agent objectId) { objectId.UserID = irewhizzrelation.GetUserId(objectId.username); objectId = (Agent)irewhizz.updateData(objectId); return objectId; } public Agent GetAgentData(Agent agentodj) { agentodj.UserID = irewhizzrelation.GetUserId(agentodj.username); agentodj = (Agent)irewhizz.getData(agentodj); if (agentodj.RoleId != 0) agentodj.Rolename = (string)(string)irewhizzrelation.getValue(agentodj.RoleId); if (agentodj.RegisterdStates.Count() != 0) { List<SelectListItem> list = new List<SelectListItem>(); string regstates = ""; foreach (int i in agentodj.RegisterdStates) { SelectListItem listitem = new SelectListItem(); listitem.Value = i.ToString(); listitem.Text = (string)irewhizzrelation.getValue(i); list.Add(listitem); regstates += (string)irewhizzrelation.getValue(i) + ","; } SelectList selectlist = new SelectList(list, "Value", "Text"); agentodj.RegisterStates = selectlist; if(regstates!=null) agentodj.RegisteredStates = regstates.Remove(regstates.Length - 1); } if (agentodj.Language.Count() != 0) { List<SelectListItem> list = new List<SelectListItem>(); string selectedlang = ""; foreach (int i in agentodj.Language) { SelectListItem listitem = new SelectListItem(); listitem.Value = i.ToString(); listitem.Text = (string)irewhizzrelation.getValue(i); list.Add(listitem); selectedlang += (string)irewhizzrelation.getValue(i) + ","; } SelectList selectlist = new SelectList(list, "Value", "Text"); agentodj.Languages = selectlist; // agentodj.SelectedLanguages = selectedlang; } if (agentodj.Specialization.Count() != 0) { List<SelectListItem> list = new List<SelectListItem>(); string selectedspel = ""; foreach (int i in agentodj.Specialization) { SelectListItem listitem = new SelectListItem(); listitem.Value = i.ToString(); listitem.Text = (string)irewhizzrelation.getValue(i); list.Add(listitem); selectedspel += (string)irewhizzrelation.getValue(i) + ","; } SelectList selectlist = new SelectList(list, "Value", "Text"); agentodj.Specializations = selectlist; //agentodj.SelectedSpecialization = selectedspel; } return agentodj; } public void SaveImage(byte[] pic, String username) { irewhizzrelation.SaveImage(pic, username); } } now the issue is when ever i am calling agent class it is given error like null reference exception for rwuser class can any body give the solution thanks in advance

    Read the article

  • Add new element in existing object

    - by user3094292
    I am using node.js. I have to add new elements in the object before to send a response to client. user.getMatch(req.user, function(err, match){ for( k=0; k<match.length; k++){ var userId = { id : match[k].match_id }; var user = new User(userId); console.log('k: ' + k); user.getUserInfo(function(err2, info){ console.log('k here: ' + k); if(info){ match[k].foo = info[0].foo; } }); } var response = { data : match }; res.json(response); }); I want to add an element "foo" from user.getUserInfo to the object "match" that was returned by user.getMatch. And then send all the data as response to the client. But it got an error because "k" inside of user.getUserInfo is not equal to the "k" outside. I do not know why the both "k" are not equal. And how will I send a response to the client after performing the loop. Thanks for your help!

    Read the article

  • Storing data from database [mysql_num_rows]

    - by user1717305
    So I have this code to pass items from database to my order table. When I'm echoing the session. The session variable contains something so there's no problem with that. But when I echo those variables under numrows, it only shows nothing. Is there something wrong? <?php error_reporting(E_ALL ^ E_NOTICE); session_start(); require("connect.php"); $UserID = $_SESSION['CustNum']; $UserN = $_SESSION['UserName']; $ProdGTotal = $_SESSION['ProdGTotal']; $queryord = mysql_query("SELECT * FROM customer WHERE UserName = '$UserN'"); $numrows = mysql_num_rows($queryord); if(numrows == 1){ $row = mysql_fetch_assoc($queryord)or die ('Unable to run query:'.mysql_error()); // fetch associated: get function from a query for a database $dbstreet = $row['Street']; $dhousenum = $row['HouseNum']; $dbcnum = $row['CelNum']; $dbarea = $row['Area']; $dbbuilding = $row['Building']; $dbcity = $row['City']; $dbpnum = $row['PhoneNum']; $dbfname = $row['FName']; $dblname = $row['LName']; } else die(mysql_error()); $query4=mysql_query("INSERT INTO orderdetails VALUES ('', '$UserID', Now(), '$dbhousenum', '$dbstreet', '$dbarea', '$dbbuilding', '$dbcity', '$dbfname', '$dblname', '$dbcnum', '$dbpnum', '$ProdGTotal')",$connect); if ($query4){ header("location:index.php"); } else die(mysql_error()); ?>

    Read the article

  • Linux HA cluster w/Xen, Heartbeat, Pacemaker. domU does not failover to secondary node

    - by Kendall
    I am having the followig problem with an OenSuSE + Heartbeat + Pacemaker + Xen HA cluster: when the node a Xen domU is running on is "dead" the Xen domU running on it is not restarted on the second node. The cluster is setup with two nodes, each running OpenSuSE-11.3, Heartbeat 3.0, and Pacemaker 1.0 in CRM mode. For storage I am using a LUN on an iSCSI SAN device; the LUN is formatted with OCFS2 and managed with LVM. The Xen domU has two logical volumes; one for root and the other for swap. I am using IPMI cards for STONITH devices, and a dedicated ethernet link for heartbeat communications. The ha.cf file is as follows: keepalive 1 deadtime 10 warntime 5 udpport 694 ucast eth1 auto_failback off node dhcp-166 node stage use_logd yes crm yes My resources look as follows: shocrm(live)configure# show node $id="5c1aa924-bba4-4f95-a367-6c9a58ac4a38" dhcp-166 node $id="cebc92eb-af24-4833-aaf0-672adf80b58e" stage primitive Xen-Util ocf:heartbeat:Xen \ meta target-role="Started" \ operations $id="Xen-Util-operations" \ op start interval="0" timeout="60" start-delay="0" \ op stop interval="0" timeout="120" \ params xmfile="/etc/xen/vm/xen-util" primitive my-stonith stonith:external/ipmi \ params hostname="dhcp-166" ipaddr="192.168.3.106" userid="ADMIN" passwd="xxx" \ op monitor interval="2m" timeout="60s" primitive my-stonith2 stonith:external/ipmi \ params hostname="stage" ipaddr="192.168.3.105" userid="ADMIN" passwd="xxx" \ op monitor interval="2m" timeout="60s" property $id="cib-bootstrap-options" \ dc-version="1.0.9-89bd754939df5150de7cd76835f98fe90851b677" \ cluster-infrastructure="Heartbeat" The Xen domU config file is as follows: name = "xen-util" bootloader = "/usr/lib/xen/boot/domUloader.py" #bootargs = "xvda1:/vmlinuz-xen,/initrd-xen" bootargs = "--entry=xvda1:/boot/vmlinuz-xen,/boot/initrd-xen" memory = 4096 disk = [ 'phy:vg_xen/xen-util-root,xvda1,w', 'phy:vg_xen/xen-util-swap,xvda2,w', ] root = "/dev/xvda1" vif = [ 'mac=00:16:3e:42:42:06' ] #vfb = [ 'type=vnc,vncunused=0,vnclisten=192.168.3.172' ] extra = "" Say domU "Xen-Util" is running on node "stage"; if "stage" goes down, "Xen-Util" does not restart on node "dhcp-166". It seems to want to try as an "xm list" will show it for a few seconds and if you "xm console xen-util" it will give a message like "copying /boot/kernel.gz from xvda1 to /var/lib/xen/tmp/kernel.a53gs for booting". However, it never gets past that, eventually gives up, and no longer appears in "xm list". Now, when node "stage" comes back online after being power cycled, it detects that "Xen-Util" isn't running, and starts it (on stage). I've tried starting "Xen-Util" on node "dhcp-166" without the cluster running, and it works fine. No problems. So, I know it works in that respect. Any ideas? Thanks!

    Read the article

  • UID/username lookup on IBM z/os USS

    - by jgrump2012
    How can I associate a UID to a specific username on IBM z/OS Unix System Services? Within USS, I see content created in my user space which I do not own. File ownership lists a three digit numerical value, rather than a userid, which I presume to be a UID. I've unsuccessfully attempted to make a username association using commands: tsocmd "search class(USER) uid(###)" tsocmd "rlist unixmap u### all"

    Read the article

  • Account sharing among Ubuntu machines

    - by muckabout
    I'd like a simple and secure system to have allow users in our network to have their account (e.g., 'myname') work on every machine in the network (e.g., such that they could ssh to any machine and have the same userid, mounted smb share). Any suggestions?

    Read the article

  • System Requirements of a write-heavy applications serving hundreds of requests per second

    - by Rolando Cruz
    NOTE: I am a self-taught PHP developer who has little to none experience managing web and database servers. I am about to write a web-based attendance system for a very large userbase. I expect around 1000 to 1500 users logged-in at the same time making at least 1 request every 10 seconds or so for a span of 30 minutes a day, 3 times a week. So it's more or less 100 requests per second, or at the very worst 1000 requests in a second (average of 16 concurrent requests? But it could be higher given the short timeframe that users will make these requests. crosses fingers to avoid 100 concurrent requests). I expect two types of transactions, a local (not referring to a local network) and a foreign transaction. local transactions basically download userdata in their locality and cache it for 1 - 2 weeks. Attendance equests will probably be two numeric strings only: userid and eventid. foreign transactions are for attendance of those do not belong in the current locality. This will pass in the following data instead: (numeric) locality_id, (string) full_name. Both requests are done in Ajax so no HTML data included, only JSON. Both type of requests expect at the very least a single numeric response from the server. I think there will be a 50-50 split on the frequency of local and foreign transactions, but there's only a few bytes of difference anyways in the sizes of these transactions. As of this moment the userid may only reach 6 digits and eventid are 4 to 5-digit integers too. I expect my users table to have at least 400k rows, and the event table to have as many as 10k rows, a locality table with at least 1500 rows, and my main attendance table to increase by 400k rows (based on the number of users in the users table) a day for 3 days a week (1.2M rows a week). For me, this sounds big. But is this really that big? Or can this be handled by a single server (not sure about the server specs yet since I'll probably avail of a VPS from ServInt or others)? I tried to read on multiple server setups Heatbeat, DRBD, master-slave setups. But I wonder if they're really necessary. the users table will add around 500 1k rows a week. If this can't be handled by a single server, then if I am to choose a MySQL replication topology, what would be the best setup for this case? Sorry, if I sound vague or the question is too wide. I just don't know what to ask or what do you want to know at this point.

    Read the article

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