Search Results

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

Page 18/55 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Uploadify - Passing Information Back to The Original Form

    - by CccTrash
    I have an Send.aspx page that has an uploadify control on it. Upload.ashx handles the file upload. I am adding a file record to a sql database in the Upload.ashx file and I need to get the ID of that record back from Upload.aspx when it is done. Can't get it working with Sessions. =( Something to do with an Adobe bug? What would the best way to handle this be? Here is the uploadify control: <script type="text/javascript"> // <![CDATA[ var contestID = $('[id$=HiddenFieldContestID]').val(); var maxEntries = $('[id$=HiddenFieldMaxEntries]').val(); var userID = $('[id$=HiddenFieldUserID]').val(); $(document).ready(function() { $('#fileInput').uploadify({ 'uploader': '../uploadify/uploadify.swf', 'script': '../uploadify/Upload.ashx', 'scriptData': { 'contestID': contestID, 'maxEntries': maxEntries, 'userID': userID }, 'cancelImg': '../uploadify/cancel.png', 'auto': true, 'multi': false, 'fileDesc': 'Image Files', 'fileExt': '*.jpg;*.png;*.jpeg', 'queueSizeLimit': 1, 'sizeLimit': 4000000, 'buttonText': 'Choose Image', 'folder': '/uploads', 'onAllComplete': function(event, queueID, fileObj, response, data) { document.getElementById('<%= ButtonCleanup.ClientID %>').click(); } }); }); // ]]></script> Edit: See Answer below... Video Tutorial from start to finish: http://casonclagg.com/articles/6/video-tutorial-uploadify-asp-net-c-sharp.aspx

    Read the article

  • Help with JPQL query

    - by Robert
    I have to query a Message that is in a provided list of Groups and has not been Deactivated by the current user. Here is some pseudo code to illustrate the properties and entities: class Message { private int messageId; private String messageText; } class Group { private String groupId; private int messageId; } class Deactivated { private String userId; private int messageId; } Here is an idea of what I need to query for, it's the last AND clause that I don't know how to do (I made up the compound NOT IN expression). Filtering the deactivated messages by userId can result in multiple messageIds, how can I check if that subset of rows does not contain the messageId? SELECT msg FROM Message msg, Group group, Deactivated unactive WHERE group.messageId = msg.messageId AND (group.groupId = 'groupA' OR group.groupId = 'groupB' OR ...) AND ('someUserId', msg.messageId) NOT IN (unactive.userId, unactive.messageId) I don't know the number of groupIds ahead of time -- I receive them as a Collection<String> so I'll need to traverse them and add them to the JPQL dynamically.

    Read the article

  • T-SQL Right Joins to ALL Entries inc Selected Column

    - by Pace
    Hi Experts, I have the following Query which produces the output below; SELECT TBLUSERS.USERID, TBLUSERS.ADusername, TBLACCESSLEVELS.ACCESSLEVELID, TBLACCESSLEVELS.AccessLevelName FROM TBLACCESSLEVELS INNER JOIN TBLACCESSRIGHTS ON TBLACCESSLEVELS.ACCESSLEVELID = TBLACCESSRIGHTS.ACCESSLEVELID INNER JOIN TBLUSERS ON TBLACCESSRIGHTS.USERID = TBLUSERS.USERID The output is this; 29 administrator 1 AllUsers 29 administrator 2 JobQueue 29 administrator 3 Telephone Directory Admin 29 administrator 4 Jobqueueadmin 29 administrator 5 UserAdmin 29 administrator 6 Product System 27 alan 1 AllUsers 97 andy 1 AllUsers 26 barry 1 AllUsers 26 barry 2 JobQueue 26 barry 3 Telephone Directory Admin 26 barry 4 Jobqueueadmin 26 barry 5 UserAdmin 26 barry 6 Product System 26 barry 7 Newseditor 26 barry 8 GreetingBoard What I would like to do is modify the query so I get all Access Levels regardless of weather there is an entry for that user. What I would also like to do is some sort of exist case so that I get output like the following; 29 administrator 1 AllUsers True 29 administrator 2 JobQueue True 29 administrator 3 Telephone Directory Admin True 29 administrator 4 Jobqueueadmin True 29 administrator 5 UserAdmin True 29 administrator 6 Product System True 29 administrator 7 Newseditor False 29 administrator 8 GreetingBoard False 27 alan 1 AllUsers True 27 alan 2 JobQueue False 27 alan 3 Telephone Directory Admin False 27 alan 4 Jobqueueadmin False 27 alan 5 UserAdmin False 27 alan 6 Product System False 27 alan 7 Newseditor False 27 alan 8 GreetingBoard False 97 andy 1 AllUsers True 97 andy 2 JobQueue False 97 andy 3 Telephone Directory Admin False 97 andy 4 Jobqueueadmin False 97 andy 5 UserAdmin False 97 andy 6 Product System False 97 andy 7 Newseditor False 97 andy 8 GreetingBoard False 26 Barry 1 AllUsers True 26 Barry 2 JobQueue True 26 Barry 3 Telephone Directory Admin True 26 Barry 4 Jobqueueadmin True 26 Barry 5 UserAdmin True 26 Barry 6 Product System True 26 Barry 7 Newseditor True 26 Barry 8 GreetingBoard True ......................................... So the rules are ALWAYS show ALL Entries for ACCESSLEVELS and where EXISTS in ACCESSRIGHTS produce a true / false to show this. I hope this makes sense and hopefully you dont need the table definitions as everything I need to work with is in the original Query. I just need a way of manipulating it slightly and getting the join in the right place. Thank you. Pace

    Read the article

  • Linq to SQL DynamicInvoke(System.Object[])' has no supported translation to SQL.

    - by ewwwyn
    I have a class, Users. Users has a UserId property. I have a method that looks something like this: static IQueryable<User> FilterById(this IQueryable<User> p, Func<int, bool> sel) { return p.Where(m => sel(m)); } Inevitably, when I call the function: var users = Users.FilterById(m => m > 10); I get the following exception: Method 'System.Object DynamicInvoke(System.Object[])' has no supported translation to SQL. Is there any solution to this problem? How far down the rabbit hole of Expression.KillMeAndMyFamily() might I have to go? To clarify why I'm doing this: I'm using T4 templates to autogenerate a simple repository and a system of pipes. Within the pipes, instead of writing: new UserPipe().Where(m => m.UserId > 10 && m.UserName.Contains("oo") && m.LastName == "Wee"); I'd like to generate something like: new UserPipe() .UserId(m => m > 10) .UserName(m => m.Contains("oo")) .LastName("Wee");

    Read the article

  • Flow control in a batch file

    - by dboarman-FissureStudios
    Reference Iterating arrays in a batch file I have the following: for /f "tokens=1" %%Q in ('query termserver') do ( if not ERRORLEVEL ( echo Checking %%Q for /f "tokens=1" %%U in ('query user %UserID% /server:%%Q') do (echo %%Q) ) ) When running query termserver from the command line, the first two lines are: Known ------------------------- ...followed by the list of terminal servers. However, I do not want to include these as part of the query user command. Also, there are about 4 servers I do not wish to include. When I supply UserID with this code, the program is promptly exiting. I know it has something to do with the if statement. Is this not possible to nest flow control inside the for-loop? I had tried setting a variable to exactly the names of the servers I wanted to check, but the iteration would end on the first server: set TermServers=Server1.Server2.Server3.Server7.Server8.Server10 for /f "tokens=2 delims=.=" %%Q in ('set TermServers') do ( echo Checking %%Q for /f "tokens=1" %%U in ('query user %UserID% /server:%%Q') do (echo %%Q) ) I would prefer this second example over the first if nothing else for cleanliness. Any help regarding either of these issues would be greatly appreciated.

    Read the article

  • Probably an easy one - PHP/CodeIgniter 'Undefined Variable'

    - by Jack W-H
    Morning y'all This is probably an easy one but I barely got any sleep last night and am struggling to comprehend anything. I've got a CodeIgniter library I've made called Points.php. Here's the contents of Points: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Points { function __construct() { $this->ci =& get_instance(); $this->ci->load->database(); } function getpoints($params) { echo $userid; } } /* End of file Points.php */ /* Location: ./application/libraries/Points.php */ ?> As you can see, I'm building it up slowly and it's being kept simple. In one of my views, I want it to display the number of 'points' (which for the time being is simply the third segment of the URI). I call it like this: <p>Points: <?php $params['user_id']=$this->uri->segment(3,1); echo $this->points->getpoints($params); ?></p> The warning I get back in the view is this: A PHP Error was encountered Severity: Notice Message: Undefined variable: userid Filename: libraries/Points.php Yes I know it's such a simple problem but I've tried lots of things. Some variations include echoing in Points.php $params['userid']; etc. But I don't see what I'm doing wrong? This is my first CodeIgniter class and I've fallen at the first step, haha...

    Read the article

  • ASP.Net MVC 3 Full Name In DropDownList

    - by tgriffiths
    I am getting a bit confused with this and need a little help please. I am developing a ASP.Net MVC 3 Web application using Entity Framework 4.1. I have a DropDownList on one of my Razor Views, and I wish to display a list of Full Names, for example Tom Jones Michael Jackson James Brown In my Controller I retrieve a List of User Objects, then select the FirstName and LastName of each User, and pass the data to a SelectList. List<User> Requesters = _userService.GetAllUsersByTypeIDOrgID(46, user.organisationID.Value).ToList(); var RequesterNames = from r in Requesters let person = new { UserID = r.userID, FullName = new { r.firstName, r.lastName } } orderby person.FullName ascending select person; viewModel.RequestersList = new SelectList(RequesterNames, "UserID", "FullName"); return View(viewModel); In my Razor View I have the following @Html.DropDownListFor(model => model.requesterID, Model.RequestersList, "Select", new { @class = "inpt_a"}) @Html.ValidationMessageFor(model => model.requesterID) However, when I run the code I get the following error At least one object must implement IComparable. I feel as if I am going about this the wrong way, so could someone please help with this? Thanks.

    Read the article

  • Does my API design violate RESTful principles?

    - by peta
    Hello everybody, I'm currently (I try to) designing a RESTful API for a social network. But I'm not sure if my current approach does still accord to the RESTful principles. I'd be glad if some brighter heads could give me some tips. Suppose the following URI represents the name field of a user account: people/{UserID}/profile/fields/name But there are almost hundred possible fields. So I want the client to create its own field views or use predefined ones. Let's suppose that the following URI represents a predefined field view that includes the fields "name", "age", "gender": utils/views/field-views/myFieldView And because field views are kind of higher logic I don't want to mix support for field views into the "people/{UserID}/profile/fields" resource. Instead I want to do the following: utils/views/field-views/myFieldView/{UserID} Though Leonard Richardson & Sam Ruby state in their book "RESTful Web Services" that a RESTful design is somehow like an "extreme object oriented" approach, I think that my approach is object oriented and therefore accords to RESTful principles. Or am I wrong? When not: Are such "object oriented" approaches generally encouraged when used with care and in order to avoid query-based REST-RPC hybrids? Thanks for your feedback in advance, peta

    Read the article

  • Objective-C: fetchManagedObjectsForEntity problem

    - by Meko
    Hi.I am trying to get value from CoreData entity name Person with predicate and then comparing with new data in dictionary.But it it returns every time 0 .And it creates about 5 person with same name. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"userName == %@",[flickr usernameForUserID:@"owner"]]; peopleList = (NSMutableArray *)[flickr fetchManagedObjectsForEntity:@"Person" withPredicate:predicate]; NSEnumerator *enumerator = [peopleList objectEnumerator]; Person *person; BOOL exists = FALSE; while (person = [enumerator nextObject]) { NSLog(@" Person is: %@ ", person.userName); NSLog(@"Person ID IS %@",person.userID); NSLog(@"Dict ID is %@",[dict objectForKey:@"owner"]); if([person.userID isEqualToString:[dict objectForKey:@"owner"]]) { exists = TRUE; NSLog(@"-- Person Exists : %@--", person.userName); [newPhoto setPerson:person]; } } Here peopleList returns 0 and the enumerator also 0 and it does not use if and not comparing.In my entity I have Person and Photo entities.In Person I have userName and userID attributes and also one-to many relationship with Photo entity. I think problem in predicate but i cant figure out it .

    Read the article

  • Crystal Reports Failed Database Login

    - by Marlon
    Hello, After spending a good 3 to 4 hours on google trying to find any solution to my problem I haven't had much luck. Basically, we use crystal reports for our .NET applications with a sql server back end, we have many clients each with their own server and so our reports need to have their connections dynamically set. Up until a week ago this worked fine. However a few days ago a client reported they were getting a database login prompt for a report (only one report, the rest worked fine). We were quite stumped but we managed to reproduce it on a netbook which didn't have visual studio or sql server installed. In the end the dev decided to reproduce the report in the hope it was just an oddity in that particular report. Unfortunately a new client today also experienced the same problem, but this time for every crystal report they had - and also they worked on the netbook, so we are really quite lost here. Below is a screenshot of what our clients get presented with - and here is the code that I use to set the connection information in the report cI.ServerName = (string)builder["Data Source"]; cI.DatabaseName = (string)builder["Initial Catalog"]; cI.UserID = (string)builder["User ID"]; cI.Password = (string)builder["Password"]; foreach (IConnectionInfo info in cryRpt.DataSourceConnections) { info.SetConnection(cI.ServerName, cI.DatabaseName, cI.UserID, cI.Password); } foreach (ReportDocument sub in cryRpt.Subreports) { foreach (IConnectionInfo info in sub.DataSourceConnections) { info.SetConnection(cI.ServerName, cI.DatabaseName, cI.UserID, cI.Password); } } As always, any help much appreciated.

    Read the article

  • ASP.NET MVC: How to validate an Ajax form with a specified UpdateTargetID?

    - by Bryan Roth
    I'm trying to figure out how to show validation errors after a user submits an Ajax form that has its UpdateTargetID property set. I'm stumped on how to update the Ajax form with the validation errors without returning the Create PartialView into the results div. If the form is valid, then it should return the Records PartialView. Create.ascx <% Using Ajax.BeginForm("Create", "Record", New Record With {.UserID = Model.UserID}, New AjaxOptions With { .UpdateTargetId = "results", .LoadingElementId = "loader" })%> Date Located <%= Html.TextBoxFor(Function(model) model.DateLocated)%> <%= Html.ValidationMessageFor(Function(model) model.DateLocated) %> Description <%= Html.TextBoxFor(Function(model) model.Description)%> <%= Html.ValidationMessageFor(Function(model) model.Description) %> <input id="btnSave" type="submit" value="Create" /> <span id="loader" class="loader">Saving...</span> <%End Using%> Records.ascx <div id="results"> ... </div> RecordController.vb Function Create(ByVal newRecord As Record) As ActionResult ValidateRecord(newRecord) If Not ModelState.IsValid Then Return PartialView("Create", newRecord) End If _repository.Add(newRecord) _repository.Save() Dim user = _repository.GetUser(newRecord.UserID) Return PartialView("Records", user) End Function

    Read the article

  • Excel VBA SQL Import

    - by user307655
    Hi All, I have the following code which imports data from a spreadsheet to SQL directly from Excel VBA. The code works great. However I am wondering if somebody can help me modify the code to: 1) Check if data from column A already exists in the SQL Table 2) If exists, then only update rather than import as a new role 3) if does not exist then import as a new role. Thanks again for your help Sub SQLIM() ' Send data to SQL Server ' This code loads data from an Excel Worksheet to an SQL Server Table ' Data should start in column A and should be in the same order as the server table ' Autonumber fields should NOT be included' ' FOR THIS CODE TO WORK ' In VBE you need to go Tools References and check Microsoft Active X Data Objects 2.x library Dim Cn As ADODB.Connection Dim ServerName As String Dim DatabaseName As String Dim TableName As String Dim UserID As String Dim Password As String Dim rs As ADODB.Recordset Dim RowCounter As Long Dim ColCounter As Integer Dim NoOfFields As Integer Dim StartRow As Long Dim EndRow As Long Dim shtSheetToWork As Worksheet Set shtSheetToWork = ActiveWorkbook.Worksheets("Sheet1") Set rs = New ADODB.Recordset ServerName = "WIN764X\sqlexpress" ' Enter your server name here DatabaseName = "two28it" ' Enter your database name here TableName = "COS" ' Enter your Table name here UserID = "" ' Enter your user ID here ' (Leave ID and Password blank if using windows Authentification") Password = "" ' Enter your password here NoOfFields = 7 ' Enter number of fields to update (eg. columns in your worksheet) StartRow = 2 ' Enter row in sheet to start reading records EndRow = shtSheetToWork.Cells(Rows.Count, 1).End(xlUp).Row ' Enter row of last record in sheet ' CHANGES ' Dim shtSheetToWork As Worksheet ' Set shtSheetToWork = ActiveWorkbook.Worksheets("Sheet1") '** Set Cn = New ADODB.Connection Cn.Open "Driver={SQL Server};Server=" & ServerName & ";Database=" & DatabaseName & _ ";Uid=" & UserID & ";Pwd=" & Password & ";" rs.Open TableName, Cn, adOpenKeyset, adLockOptimistic For RowCounter = StartRow To EndRow rs.AddNew For ColCounter = 1 To NoOfFields rs(ColCounter - 1) = shtSheetToWork.Cells(RowCounter, ColCounter) Next ColCounter Next RowCounter rs.UpdateBatch ' Tidy up rs.Close Set rs = Nothing Cn.Close Set Cn = Nothing End Sub

    Read the article

  • mySQL Efficiency Issue - How to find the right balance of normalization...?

    - by Foo
    I'm fairly new to working with relational databases, but have read a few books and know the basics of good design. I'm facing a design decision, and I'm not sure how to continue. Here's a very over simplified version of what I'm building: People can rate photos 1-5, and I need to display the average votes on the picture while keeping track of the individual votes. For example, 12 people voted 1, 7 people voted 2, etc. etc. The normalization freak of me initially designed the table structure like this: Table pictures id* | picture | userID | Table ratings id* | pictureID | userID | rating With all the foreign key constraints and everything set as they shoudl be. Every time someone rates a picture, I just insert a new record into ratings and be done with it. To find the average rating of a picture, I'd just run something like this: SELECT AVG(rating) FROM ratings WHERE pictureID = '5' GROUP by pictureID Having it setup this way lets me run my fancy statistics to. I can easily find who rated a certain picture a 3, and what not. Now I'm thinking if there's a crapload of ratings (which is very possible in what I'm really designing), finding the average will became very expensive and painful. Using a non-normalized version would seem to be more efficient. e.g.: Table picture id | picture | userID | ratingOne | ratingTwo | ratingThree | ratingFour | ratingFive To calculate the average, I'd just have to select a single row. It seems so much more efficient, but so much more uglier. Can someone point me in the right direction of what to do? My initial research shows that I have to "find the right balance", but how do I go about finding that balance? Any articles or additional reading information would be appreciated as well. Thanks.

    Read the article

  • After rich:extendedDataTable sortby, other actions are not getting executed

    - by kksachin
    I have several tabs and one of the tabs uses rich:extendedDataTable. If sortBy is clicked in the page where table is used and if I navigate to another page, it looks for the bean of the old page and throws an error saying that sortyBy of the column is undefined. E.g. If I use sortBy on userId in tab1 (where the column must have sortBy="#{data.userId}") and then I click on tab2, it looks for the data.userId and throws an error. I am using Richfaces version 3.2.2SR1. Can anyone help me on this? Here is the complete trace: javax.el.PropertyNotFoundException: /amendapplication/historyDetails.xhtml @33,174 sortBy="#{data.statusChangeTime}": Property 'statusChangeTime' not found on type uk.gov.wales.rpd.domain.applicationmanagement.ApplicationAttributeEntity com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73) org.richfaces.model.impl.expressive.ValueBindingExpression.evaluate(ValueBindingExpression.java:59) org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapObject(ObjectWrapperFactory.java:189) org.richfaces.model.ModifiableModel$RowKeyWrapperFactory.wrapObject(ModifiableModel.java:57) org.richfaces.model.impl.expressive.ObjectWrapperFactory$2.convert(ObjectWrapperFactory.java:177) org.richfaces.model.impl.expressive.ObjectWrapperFactory.convertList(ObjectWrapperFactory.java:138) org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapList(ObjectWrapperFactory.java:175) org.richfaces.model.ModifiableModel.sort(ModifiableModel.java:235) org.richfaces.model.ModifiableModel.modify(ModifiableModel.java:206) org.richfaces.component.UIExtendedDataTable.createDataModel(UIExtendedDataTable.java:310) org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621) org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:339) org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1034) org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1158) org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1168) javax.faces.component.UIForm.processDecodes(UIForm.java:209) org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:392) org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238) org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409) com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:341) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    Read the article

  • Login Page using ASP.Net & Ajax

    - by user1293474
    I'm trying to make a login page using html, ajax & ASP.NET.The data is truly passed to the ajax function, but when I debug the asp page the username and password are sent with NULL. The code is supposed to take username & password then returns the userid Html page: <div id="usernameid">Username:</div><input id="username" type="text"/> <span id="username_status"></span> <div id="passwordid">Password:</div><input id="password" type="password"/> <span id="password_status"></span> <div> <input id="loginbutton" onclick="UserLogin()" type="submit" value="Submit" /></div> Javascript: function UserLogin() { var postData = JSON.stringify({ "username": JSON.stringify($("#username").val()), "password": JSON.stringify($("#password").val()) }); alert(postData); $.ajax({ type: "GET", url: "http://localhost:49317/LoginPageForLearn.aspx", data: postData, contentType: "application/json; charset=utf-8", dataType: "jsonp", jsonp: 'jsoncallback', success: callbackfunction, error: function (msg) { alert(msg); } }); } Asp.net page: protected void Page_Load(object sender, EventArgs e) { string userName = ""; int userId = -1; string PassWord = ""; if (Request.QueryString.Count != 0 && Request.QueryString["username"] != string.Empty && Request.QueryString["password"] != string.Empty) { userName = Request.QueryString["username"]; PassWord = Request.QueryString["password"]; userId = GetUserID(userName, PassWord); } } Do you have any ideas why isn't the data passed correctly ? Or do you have any other ideas on how can I make a login page using html and access the data at SQL. Thanks a lot.

    Read the article

  • simple image upload in aspnet mvc

    - by FosterZ
    hi,i'm building a simple school portal, i have stucked at uploading an image into my application, i.e a user should upload school image to my server, i have directory for images as ./Content/Images -- all uploading images should be uploaded to this directory. i have following code input type="file" id="SchoolImageUrl" name="SchoolImageUrl" class="required" using this m'getting a browse button, i have no idea how to upload that image to server and how would be my action controller ? i have following controller for creating school public ActionResult SchoolCreate(_ASI_School schoolToCreate, FormCollection collection) { if (!ModelState.IsValid) return View(); try { // TODO: Add insert logic here schoolToCreate.SchoolId = Guid.NewGuid().ToString(); schoolToCreate.UserId = new Guid(Request.Form["currentUser"]); schoolToCreate.SchoolAddedBy = User.Identity.Name; HttpPostedFileBase file = Request.Files["SchoolImageUrl"]; file.SaveAs(file.FileName); //schoolToCreate.SchoolImageUrl = Reuseable.ImageUpload(Request.Files["SchoolImageUrl"], Server.MapPath("../Content")); //schoolToCreate.SchoolImageUrl = Path.GetFullPath(Request.Files[0].FileName); schoolToCreate.SchoolImageUrl = collection["SchoolImageUrl"]; UpdateModel(schoolToCreate); _schoolRepository.CreateSchool(schoolToCreate); //_schoolRepository.SaveToDb(); return RedirectToAction("DepartmentCreate", "Department", new { userId = schoolToCreate.UserId, schoolId = schoolToCreate.SchoolId }); } catch { return View("CreationFailed"); } } here im geting object referece error

    Read the article

  • how to hide ssh expect user/password

    - by raindrop18
    my perl cgi script I have the password/user on clear text and want to hide it or the user enter the credential interactively.is that possible? here is my code. please any help!! i am very new for perl. #!/usr/local/bin/expect ####################################################################################################### # Input: It will handle two arguments -> a device and a show command. ####################################################################################################### # ######### Start of Script ###################### # #### Set up Timeouts - Debugging Variables log_user 0 set timeout 10 set userid "USER" set password "PASS" # ############## Get two arguments - (1) Device (2) Command to be executed set device [lindex $argv 0] set command [lindex $argv 1] spawn /usr/local/bin/ssh -l $userid $device match_max [expr 32 * 1024] expect { -re "RSA key fingerprint" {send "yes\r"} timeout {puts "Host is known"} } expect { -re "username: " {send "$userid\r"} -re "(P|p)assword: " {send "$password\r"} -re "Warning:" {send "$password\r"} -re "Connection refused" {puts "Host error -> $expect_out(buffer)";exit} -re "Connection closed" {puts "Host error -> $expect_out(buffer)";exit} -re "no address.*" {puts "Host error -> $expect_out(buffer)";exit} timeout {puts "Timeout error. Is device down or unreachable?? ssh_expect";exit} } expect { -re "\[#>]$" {send "term len 0\r"} timeout {puts "Error reading prompt -> $expect_out(buffer)";exit} } expect { -re "\[#>]$" {send "$command\r"} timeout {puts "Error reading prompt -> $expect_out(buffer)";exit} } expect -re "\[#>]$" set output $expect_out(buffer) send "exit\r" puts "$output\r\n"

    Read the article

  • ORDER BY column_name help (via link in HTML table view) (PHP MySQL

    - by Derek
    My output for my table in HTML has several columns such as userid, name, age, dob. The table heading is simply the title of the column name, I want this to be a link, and when clicked, the selected column is sorted in order, ASC, and then DESC (on next click). I thought this was pretty straight forward but I'm having some difficulty. So far, I have produced this, and no output is taken, apart from the URL works by displaying 'users.php?orderby=userid' <?php if(isset($_GET['orderby'])){ $orderby = $_GET['orderby']; $query_sv = "SELECT * FROM users BY ".mysql_real_escape_string($orderby)." ASC"; } //default query else{ $query_sv = "SELECT * FROM users BY user_id DESC"; } ?> <tr> <th><a href="<?php echo $_SERVER['php_SELF']."?orderby=userid";?>">User ID</a></th> Hoefully if I get this working, I can sort the users by D.O.B. next also using the same principles. Does anyone have any ideas?

    Read the article

  • How to check if two records have a self-referencing relation?

    - by Machine
    Consider the following schema with users and their collegues (friends): Users User: columns: user_id: name: user_id as userId type: integer(8) unsigned: 1 primary: true autoincrement: true first_name: name: first_name as firstName type: string(45) notnull: true last_name: name: last_name as lastName type: string(45) notnull: true email: type: string(45) notnull: true unique: true relations: Collegues: class: User local: invitor foreign: invitee refClass: CollegueStatus equal: true onDelete: CASCADE onUpdate: CASCADE Join table: CollegueStatus: columns: invitor: type: integer(8) unsigned: 1 primary: true invitee: type: integer(8) unsigned: 1 primary: true status: type: enum(8) values: [pending, accepted, denied] default: pending notnull: true Now, let's say I two records, one for the user making a HTTP request (the logged in user), and one record for a user he wants to send a message to. I want to check if these users are collegues. Questions: Does Doctrine have any pre-build functionality to check if two records with with self-relations are related? If not, how would you write a method to check this? Where would you put said method? (In the User-class, UserTable-class etc) I could probably do something like this: public function (User $user1, User $user2) { // Ensure we load collegues if $user1 was fetched with DQL that // doesn't load this relation $collegues = $user1->get('Collegues'); $areCollegues = false; foreach($collegues as $collegue) { if($collegue['userId'] === $user2['userId']) { $areCollegues = true; break; } } return $areCollegues; } But this looks a neither efficient nor pretty. I just feel that it should be solved already for self-referencing relations to be nice to use.

    Read the article

  • Getting the ranking of a photo in SQL

    - by Jake Petroules
    I have the following tables: Photos [ PhotoID, CategoryID, ... ] PK [ PhotoID ] Categories [ CategoryID, ... ] PK [ CategoryID ] Votes [ PhotoID, UserID, ... ] PK [ PhotoID, UserID ] A photo belongs to one category. A category may contain many photos. A user may vote once on any photo. A photo can be voted for by many users. I want to select the ranks of a photo (by counting how many votes it has) both overall and within the scope of the category that photo belongs to. The count of SELECT * FROM Votes WHERE PhotoID = @PhotoID being the number of votes a photo has. I want the resulting table to have generated columns for overall rank, and rank within category, so that I may order the results by either. So for example, the resulting table from the query should look like: PhotoID VoteCount RankOverall RankInCategory 1 48 1 7 3 45 2 5 19 33 3 1 2 17 4 3 7 9 5 5 ... ...you get the idea. How can I achieve this? So far I've got the following query to retrieve the vote counts, but I need to generate the ranks as well: SELECT PhotoID, UserID, CategoryID, DateUploaded, (SELECT COUNT(CommentID) AS Expr1 FROM dbo.Comments WHERE (PhotoID = dbo.Photos.PhotoID)) AS CommentCount, (SELECT COUNT(PhotoID) AS Expr1 FROM dbo.PhotoVotes WHERE (PhotoID = dbo.Photos.PhotoID)) AS VoteCount, Comments FROM dbo.Photos

    Read the article

  • python global variable not working in apache

    - by Suhail
    I am facing issue with the global variable, when i run in the django development server it works fine, but in apache it doesn't work here is the code below: red= "/foodfolio3/test/" def showAddRecipe(request): #global objc if "userid" in request.session: objc["ErrorMsgURL"]= "" try: urlList= request.POST URL= str(urlList['url']) URL= URL.strip('http://') URL= "http://" + URL recipe= __addRecipeUrl__(URL) if (recipe == 'FailToOpenURL') or (recipe == 'Invalid-website-URL'): #request.session["ErrorMsgURL"]= "Kindly check URL, Please enter a valid URL" objc["ErrorMsgURL"]= "Kindly check URL, Please enter a valid URL" print "here global_context =", objc arurl= HttpResponseRedirect("/foodfolio3/add/import/") arurl['ErrorMsgURL']= objc["ErrorMsgURL"] #return HttpResponseRedirect("/foodfolio3/add/import/") #return render_to_response('addRecipeUrl.html', objc, context_instance = RequestContext(request)) return (arurl) else: objc["recipe"] = recipe return render_to_response('addRecipe.html', objc, context_instance = RequestContext(request)) except: objc["recipe"] = "" return render_to_response('addRecipe.html', objc, context_instance = RequestContext(request)) else: global red red= "/foodfolio3/add/" return HttpResponseRedirect("/foodfolio3/login") def showAddRecipeUrl(request): if "userid" in request.session: return render_to_response('addRecipeUrl.html', objc, context_instance = RequestContext(request)) else: global red red= "/foodfolio3/add/import/" return HttpResponseRedirect("/foodfolio3/login") def showLogin(request): obj = {} obj["error_message"] = "" obj["registered"] = "" if request.method == "POST": if (red == "/foodfolio3/test"): next= '/foodfolio3/recipes' else: next= red try: username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) except: user = authenticate(request=request) if user is not None: if user.is_active: login(request, user) request.session["userid"] = user.id # Redirect to a success page. return HttpResponseRedirect(next) this code works fine in django development server, but in apache, the url is getting redirected to '/foodfolio3/recipes'

    Read the article

  • PHP does not store all variables in session

    - by Flurin Juvalta
    Dear all I'm assigning session variables by filling the $_SESSION - Array throughout my script. My problem is, that for some reason not all variables are available in the session. here is a shortened version of my code for explaining this issue: session_start(); print_r($_SESSION); $_SESSION['lang'] = 'de'; $_SESSION['location_id'] = 11; $_SESSION['region_id'] = 1; $_SESSION['userid'] = 'eccbc87e4b5ce2fe28308fd9f2a7baf3'; $_SESSION['hash'] = 'dce57f1e3bc6fba32afab93b0c38b662'; print_r($_SESSION); first call prints something like this: Array ( ) Array ( [lang] => de [location_id] => 11 [region_id] => 1 [userid] => eccbc87e4b5ce2fe28308fd9f2a7baf3 [hash] => dce57f1e3bc6fba32afab93b0c38b662 ) the second call prints: Array ( [lang] => de [location_id] => 11 [region_id] => 1 ) Array ( [lang] => de [location_id] => 11 [region_id] => 1 [userid] => eccbc87e4b5ce2fe28308fd9f2a7baf3 [hash] => dce57f1e3bc6fba32afab93b0c38b662 ) As you can see, the important login information is not stored in the session. Does anybody has an idea what could be wrong with my session? Thanks for your answers!

    Read the article

  • Using ASP.NET SQL Membership Provider, how do I store my own per-user data?

    - by Gary McGill
    I'm using the ASP.NET SQL Membership Provider. So, there's an aspnet_Users table that has details of each of my users. (Actually, the aspnet_Membership table seems to contain most of the actual data). I now want to store some per-user information in my database, so I thought I'd just create a new table with a UserId (GUID) column and an FK relationship to aspnet_Users. However, I then discovered that I can't easily get access to the UserId since it's not exposed via the membership API. (I know I can access it via the ProviderUserKey, but it seems like the API is abstracting away the internal UserID in favor of the UserName, and I don't want to go too far against the grain). So, I thought I should instead put a LoweredUserName column in my table, and create an FK relationship to aspnet_Users using that. Bzzzt. Wrong again, because while there is a unique index in aspnet_Users that includes the LoweredUserName, it also includes the ApplicationId - so in order to create my FK relationship, I'd need to have an ApplicationId column in my table too. At first I thought: fine, I'm only dealing with a single application, so I'll just add such a column and give it a default value. Then I realised that the ApplicationId is a GUID, so it'd be a pain to do this. Not hard exactly, but until I roll out my DB I can't predict what the GUID is going to be. I feel like I'm missing something, or going about things the wrong way. What am I supposed to do?

    Read the article

  • Deserialize json with json.net c#

    - by 76mel
    Hi, am new to Json so a little green. I have a Rest Based Service that returns a json string; {"treeNode":[{"id":"U-2905","pid":"R","userId":"2905"}, {"id":"U-2905","pid":"R","userId":"2905"}]} I have been playing with the Json.net and trying to Deserialize the string into Objects etc. I wrote an extention method to help. public static T DeserializeFromJSON<T>(this Stream jsonStream, Type objectType) { T result; using (StreamReader reader = new StreamReader(jsonStream)) { JsonSerializer serializer = new JsonSerializer(); try { result = (T)serializer.Deserialize(reader, objectType); } catch (Exception e) { throw; } } return result; } I was expecting an array of treeNode[] objects. But its seems that I can only deserialize correctly if treeNode[] property of another object. public class treeNode { public string id { get; set; } public string pid { get; set; } public string userId { get; set; } } I there a way to to just get an straight array from the deserialization ? Cheers

    Read the article

  • is there a better way to write this frankenstein LINQ query that searches for values in a child tabl

    - by MRV
    I have a table of Users and a one to many UserSkills table. I need to be able to search for users based on skills. This query takes a list of desired skills and searches for users who have those skills. I want to sort the users based on the number of desired skills they posses. So if a users only has 1 of 3 desired skills he will be further down the list than the user who has 3 of 3 desired skills. I start with my comma separated list of skill IDs that are being searched for: List<short> searchedSkillsRaw = skills.Value.Split(',').Select(i => short.Parse(i)).ToList(); I then filter out only the types of users that are searchable: List<User> users = (from u in db.Users where u.Verified == true && u.Level > 0 && u.Type == 1 && (u.UserDetail.City == city.SelectedValue || u.UserDetail.City == null) select u).ToList(); and then comes the crazy part: var fUsers = from u in users select new { u.Id, u.FirstName, u.LastName, u.UserName, UserPhone = u.UserDetail.Phone, UserSkills = (from uskills in u.UserSkills join skillsJoin in configSkills on uskills.SkillId equals skillsJoin.ValueIdInt into tempSkills from skillsJoin in tempSkills.DefaultIfEmpty() where uskills.UserId == u.Id select new { SkillId = uskills.SkillId, SkillName = skillsJoin.Name, SkillNameFound = searchedSkillsRaw.Contains(uskills.SkillId) }), UserSkillsFound = (from uskills in u.UserSkills where uskills.UserId == u.Id && searchedSkillsRaw.Contains(uskills.SkillId) select uskills.UserId).Count() } into userResults where userResults.UserSkillsFound > 0 orderby userResults.UserSkillsFound descending select userResults; and this works! But it seems super bloated and inefficient to me. Especially the secondary part that counts the number of skills found. Thanks for any advice you can give. --r

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >