Search Results

Search found 19688 results on 788 pages for 'con current'.

Page 77/788 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • Learning OOP in PHP, trying to refactor my code. Can't connect to database anymore.

    - by Cortopasta
    Thought I understood how classes work, then I tried this code: class user { var $dbcon; var $dbinfo; var $con; var $error; function dbConnect() { $this->dbinfo['server'] = "localhost"; $this->dbinfo['database'] = "foolish_faith"; $this->dbinfo['user'] = "user"; $this->dbinfo['password'] = "password"; $this->con = "mysql:host=".$dbinfo['server']."; dbname=".$dbinfo['database']; $this->dbcon = new PDO($con, $dbinfo['user'], $dbinfo['password']); $this->dbcon->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->error = $this->dbcon->errorInfo(); if ($error[0] != "") { print "Error!"; print_r($error); } } } Now it just spits out this error: Fatal error: Uncaught exception 'PDOException' with message 'invalid data source name' in E:\PortableApps\xampp\htdocs\dbcon.php:24 Stack trace: #0 E:\PortableApps\xampp\htdocs\dbcon.php(24): PDO-__construct('', NULL, NULL) #1 E:\PortableApps\xampp\htdocs\login.php(4): user-dbConnect() #2 {main} thrown in E:\PortableApps\xampp\htdocs\dbcon.php on line 24 Can anybody see what I'm doing wrong, as I'm sure it has to do with my lack of knowledge when it comes to classes?

    Read the article

  • How to load data on option box in php

    - by user225269
    I'm having trouble loading the mysql data on the html form option box using php. Here's my code: <?php $con = mysql_connect("localhost","myuname","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $idnum= mysql_real_escape_string($_POST['idnum']); $result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'"); ?> <?php while ( $row = mysql_fetch_array($result) ) { ?> <tr> <td width="30" height="35"><font size="2">*I D Number:</td> <td width="30"><input name="idnum" type="text" maxlength="5" value="<?php echo $row["IDNO"]; ?>" readonly="readonly"></td> </tr> My problem is loading it here: <td><font size="2">Gender</td> <td> <select name="gender" id="gender"> <font size="2"> <option value="<?php echo $line['IDNO']; ?> "><?php $line['GENDER'] ; ?></option> </select></td></td> The table looks like this: IDNO | GENDER 123 | M 321 | F What am I supposed to do?To load the exact gender corresponding to the IDNO?

    Read the article

  • How would i output a message that says "values inserted to table" ?

    - by ranlo
    <?php error_reporting(0); $con=mysql_connect("localhost","root",""); if (!$con) { die('could not connect:'.mysql_error()); } mysql_select_db("final?orgdocs",$con); $org_name = $_POST["org_name"]; $org_type = $_POST["org_type"]; $org_code = $_POST["org_code"]; $description = $_POST["description"]; $stmt = "INSERT INTO organization VALUES('".$org_name."','".$org_type."','".$org_code."','".$description."')"; $result = mysql_query("SELECT * FROM organization WHERE org_name = '$org_name' "); echo '<TABLE BORDER = "1">'; $result1 = $result; while ($row = mysql_fetch_array($result1)){ echo '<TR>'.'<TD>'.'Organization Name'.'</TD>'.'<TD>'.'Organization Type'.'</TD>'.'<TD>'.'Organization Code'.'</TD>'.'<TD>'.'Description'.'</TD>'.'<TD>'.'Constitution'.'</TD>'; echo '</TR>'; echo '<TR>'.'<TD>'.$row['org_name'].'</TD>'.'<TD>'.$row['org_type'].'</TD>'; echo '<TD>'.$row['org_code'].'</TD>'.'<TD>'.$row['description'].'</TD>'.'<TD>'; echo '</TR>'; } echo '</TABLE>'; ?>

    Read the article

  • PHP Dropdown menu [closed]

    - by rShetty
    <br><h2>Select a Tag</h2></br> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("portal", $con); $query = "SELECT tag_name FROM tags"; $result = mysql_query($query); ?> <select name="tag_name" id="abc"> <option size=30 selected>Select</option> <?php while($array = mysql_fetch_assoc($result)){ ?> <option value ="<?php echo $array['tag_name'];?>"><?php echo $array['tag_name'];?> </option> <?php } ?> </select> <br><br> This is a snippet of code for getting the dropdown menu in the page. I have a database named portal and table named tags with tag_name as the attribute. Do help me to find the error in the program. I am not getting the tag_names in the dropdown menu

    Read the article

  • PHP login, getting wrong count value from query / fetch array

    - by Chris
    Hello, *EDIT*Thanks to the comments below it has been figured out that the problem lies with the md5, without everything works as it should. But how do i implent the md5 then? I am having some troubles with the following code below to login. The database and register system are already working. The problem lies that it does not find any result at all in the query. IF the count is 0 it should redirect the user to a secured page. But this only works if i write count = 0, but this should be 0 , only if the user name and password is found he should be directed to the secure (startpage) of the site after login. For example root (username) root (password) already exists but i cannot seem to properly login with it. <?php session_start(); if (!empty($_POST["send"])) { $username = ($_POST["username"]); $password = (md5($_POST["password"])); $count = 0; $con = mysql_connect("localhost" , "root", ""); mysql_select_db("testdb", $con); $result = mysql_query("SELECT name, password FROM user WHERE name = '".$username."' AND password = '".$password."' ") or die("Error select statement"); $count = mysql_num_rows($result); if($count > 0) // always goes the to else, only works with >=0 but then the data is not found in the database, hence incorrect { $row = mysql_fetch_array($result); $_SESSION["username"] = $row["name"]; header("Location: StartPage.php"); } else { echo "Wrong login data, please try again"; } mysql_close($con); } ?>

    Read the article

  • How to create festival calendar in ASP.net

    - by Atul
    I want to make a festival calendar using asp.net from that I used two ajax calendar and one textbox it is a festival textbox where we enter festival which FromDate and ToDate respectively. I want to do this as following point If I enter in textbox Christmas and Choose Fromdate=25/12/2011 and ToDate=31/12/2011 then it will be valid If I choose fromDate=25/12/2011 and ToDate=24/12/2011 then it will invalid If I choose Fromdate=25/12/2011 and Todate=28/12/2011 then also it is invalid because it coming in between 25/12/2011 and 31/12/2011 If I Choose fromdate=1/1/2011 and ToDate=1/1/2011 then it is valid If I choose fromdate=21/12/2011 and 25/12/2011 then it is invalid because of already Christmas done in 1/1/2011 And all date should show in gridview like 25-dec-2011 format Here is my code: DateTime dt1 = Convert.ToDateTime(txt_fromdate.Text); DateTime dt2 = Convert.ToDateTime(txt_todate.Text); if (dt1 > dt2) { con.Open(); com = new SqlCommand("BTNN_MovieDB_Festival_Details_Insert", con); com.Parameters.Add("@fromdate", SqlDbType.VarChar).Value = dateformat_mmdd(txt_fromdate.Text.ToString().Trim()); com.Parameters.Add("@todate", SqlDbType.VarChar).Value = dateformat_mmdd(txt_todate.Text.ToString().Trim()); com.Parameters.Add("@return", SqlDbType.VarChar).Direction = ParameterDirection.ReturnValue; com.ExecuteNonQuery(); con.Close(); showdata(); } else if (dt1 < dt2) { lblerror.Text = "ToDate should be greater than FromDate"; }

    Read the article

  • jQuery: change a css value if a option is selected

    - by Ivan Castellanos
    I'm trying to make an option dropdown menu and I got stuck when I try to show a textbox if the option 'other' is selected. there's what I have: <span id="con-country"><label for="country">Country: </label> <select name="country" required="required"> <option value="usa">United States</option> <option value="uk">United Kingdom</option> <option id="other" value="other">Other</option> </select> </span> <span id="con-specify"> <label for="specify">Specify: </label> <input type="text" name="specify" id="c-specify" required="required"></input> </span> CSS: #con-specify{ margin-left: 50px; display: none; } Simple huh?, the problem is that I don't know how to do the code in jQuery So, if the user select other in the menu, then the textbox should appear, how can I do that?

    Read the article

  • How TiVo is messing up customer support.

    - by James Fleming
    Ok,  So I've gotten a TiVo and overall, I'm happy, but there have been issues and I suspect I've a defective unit. - Now the nice folks after many service calls were happy to swap it out, and to ensure continuity of service, they sent me a new unit (after a $109 deposit).  That was yesterday. Today, when we go to watch a little TV, and wait for our replacement unit to arrive we find our TiVo service has been suspended. WTF? They have an exchange program, but your unit your waiting to exchange is as dead as a doornail until the replacement arrives. How hard is it to keep the old unit active for an extra week? Here is the exchange w/Tivo below... You are currently number 1 in the queue. We apologize for the delay. We will assign you to an agent as soon as one is available.The average amount of time a customer has to wait is 00:13.  Kaylene (Listening)  Kaylene: Thank you for contacting TiVo! My name is Kaylene. So that I may better assist you, are you an existing customer?  james Fleming: yes I am, but I'm now having second thoughts about being one    Kaylene: Thank you for verifying your information. How may I assist you today James?  james Fleming: I've been having issues w/a tivo box & I'm getting a replacement sent out to me (after paying an additional deposit) and now my current unit is no longer activated  Kaylene: I can help you today!  Kaylene: When we process an exchange we do transfer over the service to the replacement box so it is active and ready to go when you receive it.  james Fleming: which is to say you also make my current box worthless until such time I receive a new box?!?!?  Kaylene: I apologize that your original box was deactivated so we could activate your replacement box.  james Fleming: Why on Earth would I bother to pay in advance for a new box if you were going to kill my existing box.  Kaylene: What features are you needing to use on your current box?  james Fleming: I need to be able to access my netflix subscription (if I'm lucky enough to have it work without rebooting)  Kaylene: Can I have you verify the TiVo Service Number of your TiVo box please?  james Fleming: 7460011906979b4  Kaylene: We have your current box temporary service but not all features are available with temporary service as it is not paid for service.  Kaylene: If you like I can transfer your service back to your current box for now. Then once you receive the new box you will have to call in and have the service transferred back to the new box.  james Fleming: Not paid for? Let's see> one tivo box + 3 year service plan + monthly service + $109 deposit on a second box = what?  Kaylene: Would you like me to transfer your service back to your current box?  james Fleming: Yes - that would be helpful  Kaylene: All you will need to do is contact us again once you receive the new box so we can transfer it back.  Kaylene: I have put your service back on TiVo box 7460011906979b4.  james Fleming: What would also be helpful is your firm informing me to how you'd be cutting service in the interim.  james Fleming: Again - I opted to pay to have a second box delivered BEFORE returning the box I have - thus trying to have a continuity of service..  Kaylene: This is not something we normally do so it is important when you contact us to transfer the service back to the new box when you receive it that you reference this case number: 110622-006089.  Kaylene: I apologize about the inconvenience. You may need  force a few connections for the box to recognize the service again.  james Fleming: If it's not something you normally do than WHY would you have a $109 fee and a term for the service.  james Fleming: I am not mad at you, but your company is not impressing me and I'm blogging about this experience  Kaylene: Again I apologize about the inconvenience but you should be good to go now. Is there anything else I can help you with today?  james Fleming: so I need to go through the re-actviate process or is that somethign you do  Kaylene: When you receive the new TiVo box you need to contact us so we can transfer the service to the new box for you.  james Fleming: sure  Kaylene: Is there anything else I can help you with today James?  james Fleming: Nope - please email this transcript to me  Kaylene: I apologize but we do not have the ability to e-mail you a copy of this transcript. You can view it online at  http://www.tivo.com when you sign into your account or you can copy and paste it now to save it.  Kaylene: Thank you for contacting TiVo today. Your reference number for our conversation is 110622-006089. You can save this for your records, and if necessary, provide this to a later agent to pull up what we discussed. There will be a brief satisfaction survey emailed to you. We would appreciate any feedback on your TiVo Chat Support experience today.  Kaylene: Thank you for using TiVo Chat and have a great day James! Good-bye.  Kaylene has disconnected.

    Read the article

  • Lubuntu 13.10 unable to connect to cups localhost:631

    - by user142139
    I am using Lubuntu 13.10 (recently upgraded) and am trying to print to a network printer (HP photosmart 7960) through my router (US Robotics 5461). My printer is connected to the router via USB cable. Normally, I would use the cups configuration interface to set up the wireless connection to the printer. I was able to use the printer through the router wirelessly, using Ubuntu 12.04. Now, with my recently upgraded Lubuntu 13.10, I am unable to get the Cups config webpage (http://localhost:631) to come up. In Chromium, I get: This web page is not available. In Firefox, I get: Unable to connect. Firefox can't establish a connection to the server at localhost:631. The CUPS config file details are below. I have this website to help with the router connections for Linux: http://www.usr.com/support/5461/5461-files/printer_installation_linux/index.html My printer's address through the router is: http://192.168.2.1:1631/printers/My_Printer Can you tell me how to fix this? Or, what to add to the cups configuration file to make this work? Please help. Thanks psychicnut CUPS CONFIG FILE DETAILS: # Show general information in error_log. LogLevel warn MaxLogSize 0 SystemGroup lpadmin Listen /var/run/cups/cups.sock Listen /var/run/cups/cups.sock Listen 192.168.2.1:1631 Browsing Off BrowseLocalProtocols dnssd DefaultAuthType Basic WebInterface Yes <Location /> Order allow,deny </Location> <Location /admin> Order allow,deny </Location> <Location /admin/conf> AuthType Default Require user @SYSTEM Order allow,deny </Location> <Policy default> JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default <Limit Create-Job Print-Job Print-URI Validate-Job> Order deny,allow </Limit> <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document> Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices> AuthType Default Require user @SYSTEM Order deny,allow </Limit> <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs> AuthType Default Require user @SYSTEM Order deny,allow </Limit> <Limit Cancel-Job CUPS-Authenticate-Job> Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy> <Policy authenticated> JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default <Limit Create-Job Print-Job Print-URI Validate-Job> AuthType Default Order deny,allow </Limit> <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document> AuthType Default Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default> AuthType Default Require user @SYSTEM Order deny,allow </Limit> <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs> AuthType Default Require user @SYSTEM Order deny,allow </Limit> <Limit Cancel-Job CUPS-Authenticate-Job> AuthType Default Require user @OWNER @SYSTEM Order deny,allow </Limit> <Limit All> Order deny,allow </Limit> </Policy> JobPrivateAccess default JobPrivateValues default SubscriptionPrivateAccess default SubscriptionPrivateValues default

    Read the article

  • Rendering ASP.NET MVC Razor Views outside of MVC revisited

    - by Rick Strahl
    Last year I posted a detailed article on how to render Razor Views to string both inside of ASP.NET MVC and outside of it. In that article I showed several different approaches to capture the rendering output. The first and easiest is to use an existing MVC Controller Context to render a view by simply passing the controller context which is fairly trivial and I demonstrated a simple ViewRenderer class that simplified the process down to a couple lines of code. However, if no Controller Context is available the process is not quite as straight forward and I referenced an old, much more complex example that uses my RazorHosting library, which is a custom self-contained implementation of the Razor templating engine that can be hosted completely outside of ASP.NET. While it works inside of ASP.NET, it’s an awkward solution when running inside of ASP.NET, because it requires a bit of setup to run efficiently.Well, it turns out that I missed something in the original article, namely that it is possible to create a ControllerContext, if you have a controller instance, even if MVC didn’t create that instance. Creating a Controller Instance outside of MVCThe trick to make this work is to create an MVC Controller instance – any Controller instance – and then configure a ControllerContext through that instance. As long as an HttpContext.Current is available it’s possible to create a fully functional controller context as Razor can get all the necessary context information from the HttpContextWrapper().The key to make this work is the following method:/// <summary> /// Creates an instance of an MVC controller from scratch /// when no existing ControllerContext is present /// </summary> /// <typeparam name="T">Type of the controller to create</typeparam> /// <returns>Controller Context for T</returns> /// <exception cref="InvalidOperationException">thrown if HttpContext not available</exception> public static T CreateController<T>(RouteData routeData = null) where T : Controller, new() { // create a disconnected controller instance T controller = new T(); // get context wrapper from HttpContext if available HttpContextBase wrapper = null; if (HttpContext.Current != null) wrapper = new HttpContextWrapper(System.Web.HttpContext.Current); else throw new InvalidOperationException( "Can't create Controller Context if no active HttpContext instance is available."); if (routeData == null) routeData = new RouteData(); // add the controller routing if not existing if (!routeData.Values.ContainsKey("controller") && !routeData.Values.ContainsKey("Controller")) routeData.Values.Add("controller", controller.GetType().Name .ToLower() .Replace("controller", "")); controller.ControllerContext = new ControllerContext(wrapper, routeData, controller); return controller; }This method creates an instance of a Controller class from an existing HttpContext which means this code should work from anywhere within ASP.NET to create a controller instance that’s ready to be rendered. This means you can use this from within an Application_Error handler as I needed to or even from within a WebAPI controller as long as it’s running inside of ASP.NET (ie. not self-hosted). Nice.So using the ViewRenderer class from the previous article I can now very easily render an MVC view outside of the context of MVC. Here’s what I ended up in my Application’s custom error HttpModule: protected override void OnDisplayError(WebErrorHandler errorHandler, ErrorViewModel model) { var Response = HttpContext.Current.Response; Response.ContentType = "text/html"; Response.StatusCode = errorHandler.OriginalHttpStatusCode; var context = ViewRenderer.CreateController<ErrorController>().ControllerContext; var renderer = new ViewRenderer(context); string html = renderer.RenderView("~/Views/Shared/GenericError.cshtml", model); Response.Write(html); }That’s pretty sweet, because it’s now possible to use ViewRenderer just about anywhere in any ASP.NET application, not only inside of controller code. This also allows the constructor for the ViewRenderer from the last article to work without a controller context parameter, using a generic view as a base for the controller context when not passed:public ViewRenderer(ControllerContext controllerContext = null) { // Create a known controller from HttpContext if no context is passed if (controllerContext == null) { if (HttpContext.Current != null) controllerContext = CreateController<ErrorController>().ControllerContext; else throw new InvalidOperationException( "ViewRenderer must run in the context of an ASP.NET " + "Application and requires HttpContext.Current to be present."); } Context = controllerContext; }In this case I use the ErrorController class which is a generic controller instance that exists in the same assembly as my ViewRenderer class and that works just fine since ‘generically’ rendered views tend to not rely on anything from the controller other than the model which is explicitly passed.While these days most of my apps use MVC I do still have a number of generic pieces in most of these applications where Razor comes in handy. This includes modules like the above, which when they error often need to display error output. In other cases I need to generate string template output for emailing or logging data to disk. Being able to render simply render an arbitrary View to and pass in a model makes this super nice and easy at least within the context of an ASP.NET application!You can check out the updated ViewRenderer class below to render your ‘generic views’ from anywhere within your ASP.NET applications. Hope some of you find this useful.ResourcesViewRenderer Class in Westwind.Web.Mvc Library (Github)Original ViewRenderer ArticleRazor Hosting Library (GitHub)Original Razor Hosting Article© Rick Strahl, West Wind Technologies, 2005-2013Posted in ASP.NET  MVC   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Posting from ASP.NET WebForms page to another URL

    - by hajan
    Few days ago I had a case when I needed to make FORM POST from my ASP.NET WebForms page to an external site URL. More specifically, I was working on implementing Simple Payment System (like Amazon, PayPal, MoneyBookers). The operator asks to make FORM POST request to a given URL in their website, sending parameters together with the post which are computed on my application level (access keys, secret keys, signature, return-URL… etc). So, since we are not allowed nesting another form inside the <form runat=”server”> … </form>, which is required because other controls in my ASPX code work on server-side, I thought to inject the HTML and create FORM with method=”POST”. After making some proof of concept and testing some scenarios, I’ve concluded that I can do this very fast in two ways: Using jQuery to create form on fly with the needed parameters and make submit() Using HttpContext.Current.Response.Write to write the form on server-side (code-behind) and embed JavaScript code that will do the post Both ways seemed fine. 1. Using jQuery to create FORM html code and Submit it. Let’s say we have ‘PAY NOW’ button in our ASPX code: <asp:Button ID="btnPayNow" runat="server" Text="Pay Now" /> Now, if we want to make this button submit a FORM using POST method to another website, the jQuery way should be as follows: <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.js" type="text/javascript"></script> <script type="text/javascript">     $(function () {         $("#btnPayNow").click(function (event) {             event.preventDefault();             //construct htmlForm string             var htmlForm = "<form id='myform' method='POST' action='http://www.microsoft.com'>" +                 "<input type='hidden' id='name' value='hajan' />" +             "</form>";             //Submit the form             $(htmlForm).appendTo("body").submit();         });     }); </script> Yes, as you see, the code fires on btnPayNow click. It removes the default button behavior, then creates htmlForm string. After that using jQuery we append the form to the body and submit it. Inside the form, you can see I have set the htttp://www.microsoft.com URL, so after clicking the button you should be automatically redirected to the Microsoft website (just for test, of course for Payment I’m using Operator's URL). 2. Using HttpContext.Current.Response.Write to write the form on server-side (code-behind) and embed JavaScript code that will do the post The C# code behind should be something like this: public void btnPayNow_Click(object sender, EventArgs e) {     string Url = "http://www.microsoft.com";     string formId = "myForm1";     StringBuilder htmlForm = new StringBuilder();     htmlForm.AppendLine("<html>");     htmlForm.AppendLine(String.Format("<body onload='document.forms[\"{0}\"].submit()'>",formId));     htmlForm.AppendLine(String.Format("<form id='{0}' method='POST' action='{1}'>", formId, Url));     htmlForm.AppendLine("<input type='hidden' id='name' value='hajan' />");     htmlForm.AppendLine("</form>");     htmlForm.AppendLine("</body>");     htmlForm.AppendLine("</html>");     HttpContext.Current.Response.Clear();     HttpContext.Current.Response.Write(htmlForm.ToString());     HttpContext.Current.Response.End();             } So, with this code we create htmlForm string using StringBuilder class and then just write the html to the page using HttpContext.Current.Response.Write. The interesting part here is that we submit the form using JavaScript code: document.forms["myForm1"].submit() This code runs on body load event, which means once the body is loaded the form is automatically submitted. Note: In order to test both solutions, create two applications on your web server and post the form from first to the second website, then get the values in the second website using Request.Form[“input-field-id”] I hope this was useful post for you. Regards, Hajan

    Read the article

  • Html.RenderAction Failed when Validation Failed

    - by Shaun
    RenderAction method had been introduced when ASP.NET MVC 1.0 released in its MvcFuture assembly and then final announced along with the ASP.NET MVC 2.0. Similar as RenderPartial, the RenderAction can display some HTML markups which defined in a partial view in any parent views. But the RenderAction gives us the ability to populate the data from an action which may different from the action which populating the main view. For example, in Home/Index.aspx we can invoke the Html.RenderPartial(“MyPartialView”) but the data of MyPartialView must be populated by the Index action of the Home controller. If we need the MyPartialView to be shown in Product/Create.aspx we have to copy (or invoke) the relevant code from the Index action in Home controller to the Create action in the Product controller which is painful. But if we are using Html.RenderAction we can tell the ASP.NET MVC from which action/controller the data should be populated. in that way in the Home/Index.aspx and Product/Create.aspx views we just need to call Html.RenderAction(“CreateMyPartialView”, “MyPartialView”) so it will invoke the CreateMyPartialView action in MyPartialView controller regardless from which main view. But in my current project we found a bug when I implement a RenderAction method in the master page to show something that need to connect to the backend data center when the validation logic was failed on some pages. I created a sample application below.   Demo application I created an ASP.NET MVC 2 application and here I need to display the current date and time on the master page. I created an action in the Home controller named TimeSlot and stored the current date into ViewDate. This method was marked as HttpGet as it just retrieves some data instead of changing anything. 1: [HttpGet] 2: public ActionResult TimeSlot() 3: { 4: ViewData["timeslot"] = DateTime.Now; 5: return View("TimeSlot"); 6: } Next, I created a partial view under the Shared folder to display the date and time string. 1: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %> 2:  3: <span>Now: <% 1: : ViewData["timeslot"].ToString() %></span> Then at the master page I used Html.RenderAction to display it in front of the logon link. 1: <div id="logindisplay"> 2: <% 1: Html.RenderAction("TimeSlot", "Home"); %> 3:  4: <% 1: Html.RenderPartial("LogOnUserControl"); %> 5: </div> It’s fairly simple and works well when I navigated to any pages. But when I moved to the logon page and click the LogOn button without input anything in username and password the validation failed and my website crashed with the beautiful yellow page. (I really like its color style and fonts…)   How ASP.NET MVC executes Html.RenderAction In this example all other pages were rendered successful which means the ASP.NET MVC found the TimeSolt action under the Home controller except this situation. The only different is that when I clicked the LogOn button the browser send an HttpPost request to the server. Is that the reason of this bug? I created another action in Home controller with the same action name but for HttpPost. 1: [HttpPost] 2: [ActionName("TimeSlot")] 3: public ActionResult TimeSlot(object dummy) 4: { 5: return TimeSlot(); 6: } Or, I can use the AcceptVerbsAttribute on the TimeSlot action to let it allow both HttpGet and HttpPost. 1: [AcceptVerbs("GET", "POST")] 2: public ActionResult TimeSlot() 3: { 4: ViewData["timeslot"] = DateTime.Now; 5: return View("TimeSlot"); 6: } And then repeat what I did before and this time it worked well. Why we need the action for HttpPost here as it’s just data retrieving? That is because of how ASP.NET MVC executes the RenderAction method. In the source code of ASP.NET MVC we can see when proforming the RenderAction ASP.NET MVC creates a RequestContext instance from the current RequestContext and created a ChildActionMvcHandler instance which inherits from MvcHandler class. Then the ASP.NET MVC processes the handler through the HttpContext.Server.Execute method. That means it performs the action as a stand-alone request asynchronously and flush the result into the  TextWriter which is being used to render the current page. Since when I clicked the LogOn the request was in HttpPost so when ASP.NET MVC processed the ChildActionMvcHandler it would find the action which allow the current request method, which is HttpPost. Then our TimeSlot method in HttpGet would not be matched.   Summary In this post I introduced a bug in my currently developing project regards the new Html.RenderAction method provided within ASP.NET MVC 2 when processing a HttpPost request. In ASP.NET MVC world the underlying Http information became more important than in ASP.NET WebForm world. We need to pay more attention on which kind of request it currently created and how ASP.NET MVC processes.   Hope this helps, Shaun   All documents and related graphics, codes are provided "AS IS" without warranty of any kind. Copyright © Shaun Ziyan Xu. This work is licensed under the Creative Commons License.

    Read the article

  • Font gets enlarged when rotating screen

    - by queueoverflow
    I have a new ThinkPad X220 Tablet with Kubuntu 12.04. When I rotate the screen 90° with a script, the fonts of all programs that I open after the rotation have ugly huge fonts. #!/bin/sh # Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation. rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')" # Using current screen orientation proceed to rotate screen and input tools. case "$rotation" in normal) # rotate to the left xrandr -o right xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate cw xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate cw xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate cw ;; right) # rotate to normal xrandr -o normal xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate none xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate none xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate none ;; esac

    Read the article

  • WCF Operations and Multidimensional Arrays

    - by JoshReuben
    You cant pass MultiD arrays accross the wire using WCF - you need to pass jagged arrays. heres 2 extension methods that will allow you to convert prior to serialzation and convert back after deserialization:         public static T[,] ToMultiD<T>(this T[][] jArray)         {             int i = jArray.Count();             int j = jArray.Select(x => x.Count()).Aggregate(0, (current, c) => (current > c) ? current : c);                         var mArray = new T[i, j];             for (int ii = 0; ii < i; ii++)             {                 for (int jj = 0; jj < j; jj++)                 {                     mArray[ii, jj] = jArray[ii][jj];                 }             }             return mArray;         }         public static T[][] ToJagged<T>(this T[,] mArray)         {             var cols = mArray.GetLength(0);             var rows = mArray.GetLength(1);             var jArray = new T[cols][];             for (int i = 0; i < cols; i++)             {                 jArray[i] = new T[rows];                 for (int j = 0; j < rows; j++)                 {                     jArray[i][j] = mArray[i, j];                 }             }             return jArray;         } enjoy!

    Read the article

  • Ubuntuone fails to sync with 'File Sync starting...' displayed

    - by a different ben
    I am on 12.04 using ubuntuone-client 3.0.1-0ubuntu1.0.1. I actually have two machines that I sync with, having the same Ubuntu version and ubuntuone-client version. One is fine, the other is not. File sync has frozen within a user-defined folder under my home folder. The graphical client reports in the top-right corner: 'File Sync starting...', but this doesn't change. I have two files with changes that show a syncing overlay in Nautilus. They are both very small text files. Here are some details: harb@joan:~$ u1sdtool --status State: READY connection: With User Not Network description: ready to connect is_connected: False is_error: False is_online: False queues: WORKING harb@joan:~$ u1sdtool --current-transfers Current uploads: 0 Current downloads: 0 The status seems to suggest that I am not connected to a network, however I am connected to a network - in fact I am accessing this machine via NX. Is it not working because I am connected via NX? Happy to provide other info, just not sure what would be useful.

    Read the article

  • How to make "xrandr" work with GMA500?

    - by Nwbie
    Is it error at driver of graphic chip or Xorg or kernel? I am Asus T91mt with GMA500, Ubuntu 12.04.1. I would like too see only a notice of connection at least. A log of xrandr: $ lspci | grep VGA 00:02.0 VGA compatible controller: Intel Corporation System Corporation System Controller Hub (SCH Poulcbo) Graphics Controller (rev 07) vp@vc:~$ xrandr --verbose xrandr: Failed to get size of gamma for output default Screen 0: minimum 1024 x 600, current 1024 x 600, maximum 1024 x 600 default connected 1024x600+0+0 (0x138) normal (normal) 0mm x 0mm Identifier: 0x137 Timestamp: 26863 Subpixel: unknown Clones: CRTC: 0 CRTCs: 0 Transform: 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 filter: 1024x600 (0x138) 0.0MHz *current h: width 1024 start 0 end 0 total 1024 skew 0 clock 0.0KHz v: height 600 start 0 end 0 total 600 clock 0.0Hz vp@vc:~$ xrandr --prop xrandr: Failed to get size of gamma for output default Screen 0: minimum 1024 x 600, current 1024 x 600, maximum 1024 x 600 default connected 1024x600+0+0 0mm x 0mm 1024x600 0.0* vp@vc:~$ Please help, i am linux newbie and i am tired ;/

    Read the article

  • effect and model vertex declaration compatibility

    - by Vodácek
    I have normal model drawing code. When I try to draw model without UV coordinates I got this exception: System.InvalidOperationException: The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing. at Microsoft.Xna.Framework.Graphics.GraphicsDevice.VerifyCanDraw( Boolean bUserPrimitives, Boolean bIndexedPrimitives) at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives( PrimitiveType primitiveType, Int32 baseVertex, Int32 minVertexIndex, Int32 numVertices, Int32 startIndex, Int32 primitiveCount) at Microsoft.Xna.Framework.Graphics.ModelMeshPart.Draw() at Microsoft.Xna.Framework.Graphics.ModelMesh.Draw() ... I know what cause the exception, but is possible to avoid it? Is possible to check model before drawing it with current shader for vertex declaration compatibility?

    Read the article

  • WordPress bot issues

    - by Paul
    I need to implement a blog into a clients site as he is unhappy with his current basic CMS driven solution. It needs to suit both seo and the current style and as I'm a front end dev/designer and they don't have budget to redevelop - the only solution I can think of is to setup a Wordpress blog and restyle to suit. My only worry about this is the current press reports on WordPress being affected by webbots. I understand the main worry Is if you use an id of admin, but I'm concerned that regardless of this the site could be bombarded with bot requests and cause timeouts! Is this valid? If so is there any way to avoid this issue!? If not can anyone recommend another good SEO friendly blog solution!?

    Read the article

  • How to handle compensation issue

    - by Ali
    I consider myself an expert Software Developer. Recently, I noticed my current company posted a new job through a recruting firm requiring half experience than I have and even lesser set of skills. However, they are offering the same salary as my current salary. When I joined my current company a year ago, they declined to pay my asking salary. My evaluations are good and there are critical projects in the pipeline where my involvement is crucial for their success. I'm little confused on how to handle this situation. I don't want to come across threatning or any thing like that.

    Read the article

  • which kernels can I safely purge?

    - by ecoologic
    I use the main answer of this question quite often to clear some space, but now I'm in extreme need and I'd like to better understand which kernels are safe to purge, my list is the following 10:50:58-673 - ~> dpkg -l | grep -Eo "^.i +linux-(image|headers)[^ ]+" | cut -c 5- | grep --color -E "$|"`uname -r` linux-headers-2.6.38-15 linux-headers-2.6.38-15-generic linux-headers-2.6.38-15-generic-pae linux-headers-2.6.38-16 linux-headers-2.6.38-16-generic linux-headers-2.6.38-16-generic-pae # current one linux-headers-generic linux-headers-generic-pae linux-headers-server linux-image-2.6.38-15-generic-pae linux-image-2.6.38-16-generic-pae linux-image-generic-pae linux-image-server Is it enough to keep linux-headers-2.6.38-15 linux-headers-2.6.38-15-generic linux-headers-2.6.38-15-generic-pae linux-headers-2.6.38-16 linux-headers-2.6.38-16-generic linux-headers-2.6.38-16-generic-pae # current one Or would this be enough linux-headers-2.6.38-15-generic-pae linux-headers-2.6.38-16-generic-pae # current one Or which other would be the shortest (keeping the previous one too)? And why?

    Read the article

  • Join Gretchen Alarcon In Person for an Oracle HCM Applications Strategy Updates

    - by jay.richey
    How can you benefit from staying current and moving to the latest release of your Oracle HCM applications? Where does Fusion HCM fit in and what do they mean to your existing investments? What does Oracle offer in terms of SaaS for HCM? What is Oracle doing to maintain excellence in your current applications portfolio while innovating in new and creative ways? Join us for an exclusive breakfast briefing where you will have the opportunity to hear about Oracle's current blockbuster releases for HCM: PeopleSoft 9.1 and E-Business Suite 12.1. Take this opportunity to hear about what the latest releases mean to you and learn how organizations like yours are successfully moving forward. Our featured speaker, Gretchen Alarcon, Oracle's Vice President of Fusion HCM Product Strategy will share how Oracle's latest HCM offerings - Fusion HCM and Fusion Talent Management On Demand - can work alongside your Oracle PeopleSoft, E-Business Suite, or JD Edwards HR foundation to show immediate business value. This event promises to provide you with an opportunity to share experiences, best practices, challenges, and successes with fellow business executives. Coming to: Chicago, Minneaoplis, St. Louis

    Read the article

  • horizontal line across screen at startup

    - by Debbie Poole
    I recently ran an upgrade from 12.04 to 12.10 and was using Nvidia current tested drivers and all seemed ok at first. Then suddenly every time I started the computer and shutdown, the graphical plymouth logo changed to text.The only changes I made to try to correct this issue were; sudo apt-get --purge remove nvidia-current nvidia-settings sudo apt-get --purge autoremove sudo apt-get clean sudo apt-get update sudo apt-get install nvidia-current and this made no change at all to the display. Then I read somewhere that Nouveau drivers may be the answer, so I installed them to use instead, and hey presto, the shutdown screen displays the Plymouth splash. However with startup, I get a stable purple screen, for a while, and than a thick black horizontal line appears, really ugly-looking, and then the loging screen appears to be ok. Can I correct the login screen same as the shutdown screen?

    Read the article

  • You do not appear to be using the NVIDIA X driver

    - by Vishal shekhar
    my laptop has nvidia GT540m yesterday i install nvidia-current after updating fromsudo apt-add-repository ppa:ubuntu-x-swat/x-updates then i write sudo nvidia-xconfig and then reboot my desktop visual effect changes and it look good like nvidia is working but still glx i not working and nvidia-setting tells me that You do not appear to be using the NVIDIA X driver my dkms status is nvidia-current, 304.43, 3.2.0-30-generic-pae, i686: installed lspci |grep VGA output : 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 01:00.0 VGA compatible controller: NVIDIA Corporation GF108 [GeForce GT 540M] (rev a1) also i can not login to my admin account but when i login to standard user or guest it works but still NVIDIA X driver is not working can any one suggest something so that NVIDIA X Driver start working as i seen many forum but none worked for me earlier i tried nvidia-173 ,nvidia-current(before x-swat/updates reprository) but none works for me

    Read the article

  • Mounting ddrescue image after recovery (in over my head)

    - by BorgDomination
    I'm having problems mounting the recovery image. I've tried to mount the image multiple ways. quark@DS9 ~ $ sudo mount -t ext4 /media/jump1/1recover/sdb1.img /mnt mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so quark@DS9 ~ $ sudo mount -r -o loop /media/jump1/1recover/sdb1.img recover mount: you must specify the filesystem type quark@DS9 ~ $ sudo mount /media/jump1/1recover/sdb1.img mnt mount: you must specify the filesystem type It doesn't even give me detailed information on the file I just made, nautilus says it's 160gb. quark@DS9 ~ $ file /media/jump1/1recover/sdb1.img /media/jump1/1recover/sdb1.img: data quark@DS9 ~ $ mmls /media/jump1/1recover/sdb1.img Cannot determine partition type I'm not sure what I'm doing wrong or if I started this process incorrectly from the beginning. I've outlined what I've done so far below. I'm clueless, I'd appreciate if someone had some input for me. What I have done from the beginning My laptop has two hard drives. One has the dual boot Win7 / Linux Mint system files. Secondary one contained my /home folder. The laptop was jarred and the /home disk was broken. I tried a LiveCD recovery, it failed. Wouldn't even load a Live session with the disk installed. So I turned to ddrescue. quark@DS9 ~ $ sudo fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0009fc18 Device Boot Start End Blocks Id System /dev/sda1 * 2048 112642047 56320000 7 HPFS/NTFS/exFAT /dev/sda2 138033152 312580095 87273472 83 Linux /dev/sda3 112644094 138033151 12694529 5 Extended /dev/sda5 112644096 132173823 9764864 83 Linux /dev/sda6 132175872 138033151 2928640 82 Linux swap / Solaris Partition table entries are not in disk order Disk /dev/sdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002a8ea Device Boot Start End Blocks Id System /dev/sdb1 * 63 312576704 156288321 83 Linux Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xed6d054b Device Boot Start End Blocks Id System /dev/sdc1 63 1953520064 976760001 7 HPFS/NTFS/exFAT sda - 160g internal, holds all system files and all computer functions. sdb - 160g internal, BROKEN, contains about 140g of data I'd like to recover. sdc - 1T external, contains recovery image. Only place that has space to do all this. From this site, https://apps.education.ucsb.edu/wiki/Ddrescue I used this script to create an image of the broken hard drive. I changed the destination to the external USB drive. #!/bin/sh prt=sdb1 src=/dev/$prt dst=/media/jump1/1recover/$prt.img log=$dst.log sudo time ddrescue --no-split $src $dst $log sudo time ddrescue --direct --max-retries=3 $src $dst $log sudo time ddrescue --direct --retrim --max-retries=3 $src $dst $log Everything looked like it came off without a hitch: quark@DS9 ~ $ sudo bash recover1 Press Ctrl-C to interrupt Initial status (read from logfile) rescued: 0 B, errsize: 0 B, errors: 0 Current status rescued: 160039 MB, errsize: 4096 B, current rate: 35588 B/s ipos: 3584 B, errors: 1, average rate: 22859 kB/s opos: 3584 B, time from last successful read: 0 s Finished 12.78user 1060.42system 1:56:41elapsed 15%CPU (0avgtext+0avgdata 4944maxresident)k 312580958inputs+0outputs (1major+601minor)pagefaults 0swaps Press Ctrl-C to interrupt Initial status (read from logfile) rescued: 160039 MB, errsize: 4096 B, errors: 1 Current status rescued: 160039 MB, errsize: 1024 B, current rate: 0 B/s ipos: 1536 B, errors: 1, average rate: 13 B/s opos: 1536 B, time from last successful read: 1.3 m Finished 0.00user 0.00system 3:43.95elapsed 0%CPU (0avgtext+0avgdata 4944maxresident)k 238inputs+0outputs (3major+374minor)pagefaults 0swaps Press Ctrl-C to interrupt Initial status (read from logfile) rescued: 160039 MB, errsize: 1024 B, errors: 1 Current status rescued: 160039 MB, errsize: 1024 B, current rate: 0 B/s ipos: 1536 B, errors: 1, average rate: 0 B/s opos: 1536 B, time from last successful read: 3.7 m Finished 0.00user 0.00system 3:43.56elapsed 0%CPU (0avgtext+0avgdata 4944maxresident)k 8inputs+0outputs (0major+376minor)pagefaults 0swaps It looks like, from where I'm standing it worked perfectly. Here's the log: # Rescue Logfile. Created by GNU ddrescue version 1.14 # Command line: ddrescue --direct --retrim --max-retries=3 /dev/sdb1 /media/jump1/1recover/sdb1.img /media/jump1/1recover/sdb1.img.log # current_pos current_status 0x00000600 + # pos size status 0x00000000 0x00000400 + 0x00000400 0x00000400 - 0x00000800 0x254314FC00 + I'm not sure how to proceed. Does this mean all of my data is lost???????? Appreciate ANY input!

    Read the article

  • A* how make natural look path?

    - by user11177
    I've been reading this: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html But there are some things I don't understand, for example the article says to use something like this for pathfinding with diagonal movement: function heuristic(node) = dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) I don't know how do set D to get a natural looking path like in the article, I set D to the lowest cost between adjacent squares like it said, and I don't know what they meant by the stuff about the heuristic should be 4*D, that does not seem to change any thing. This is my heuristic function and move function: def heuristic(self, node, goal): D = 10 dx = abs(node.x - goal.x) dy = abs(node.y - goal.y) return D * max(dx, dy) def move_cost(self, current, node): cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1 return 19 if cross else 10 Result: The smooth sailing path we want to happen: The rest of my code: http://pastebin.com/TL2cEkeX

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >