Search Results

Search found 1107 results on 45 pages for 'jonathan chan'.

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

  • MySQLi PHP: Check if SQL INSERT query was fully successful using MySQLi

    - by Jonathan
    Hi, I have this big function that gets a lot of different data and insert it into multiple tables.. Not all the data is always available so not all the SQL INSERT queries are successful. I need to check which SQL INSERT query was fully successful and which wasn't to the do something with this data (like inserting into a log table or similar). Just to give you an example of how I think it can be done: $sql = 'INSERT INTO data_table (ID, column1, column2) VALUES(?, ?, ?)'; if ($stmt->prepare($sql)) { $stmt->bind_param('iss', $varID, $var1, $var2); if ($stmt->execute()) { $success == TRUE; //or something like that } } I'm not completely sure this is the best way and if its always really show if the data was inserted into the table... Any suggestions??

    Read the article

  • How to customize a many-to-many inline model in django admin

    - by Jonathan
    I'm using the admin interface to view invoices and products. To make things easy, I've set the products as inline to invoices, so I will see the related products in the invoice's form. As you can see I'm using a many-to-many relationship. In models.py: class Product(models.Model): name = models.TextField() price = models.DecimalField(max_digits=10,decimal_places=2) class Invoice(models.Model): company = models.ForeignKey(Company) customer = models.ForeignKey(Customer) products = models.ManyToManyField(Product) In admin.py: class ProductInline(admin.StackedInline): model = Invoice.products.through class InvoiceAdmin(admin.ModelAdmin): inlines = [FilteredApartmentInline,] admin.site.register(Product, ProductAdmin) The problem is that django presents the products as a table of drop down menus (one per associated product). Each drop down contains all the products listed. So if I have 5000 products and 300 are associated with a certain invoice, django actually loads 300x5000 product names. Also the table is not aesthetic. How can I change it so that it'll just display the product's name in the inline table? Which form should I override, and how?

    Read the article

  • Switching between iScroll and standard WebView Scrolling functionality

    - by Jonathan
    I'm using iScroll 4 for my rather heavy iPhone web/Phonegap app and trying to find a way to switch between iScrolls scrolling functionality and standard "native" webview scrolling, basically on click. Why I want this is described below. My app has several different subpages all in one file. Some subpages have input fields, some don't. As we all know, iScroll + input fields = you're out of luck. I've wrapped iScrolls wrapper div (and all its functionality) around the one sub page where scrolling is crucial, and where there are no input fields. The other sections, I've simply placed outside this div, which gives these no scrolling functionality at all. I've of course tried wrapping all inside the wrapper and enabling/disabling scroll (shown below) but that didn't work me at all: myScroll.disable() myScroll.enable() By placing some sub pages outside the main scrolling area / iscroll div, I've disabled both iScrolls and the standard webview scrolling (the latter - which i guess iScroll does) which leaves me with only basic basic scrolling, hence basically no scrolling at all. One can move around vertically, but once you let go of the screen with, the "scrolling" stops. Quite naturally but alas so nasty. Therefore, I'm searching for a way to enable standard webview scrolling on the sub pages placed outside of iScroll's wrapper div. I've tried different approaches such as the one above and by using: document.removeEventListener('touchmove', preventDefault, false); document.removeEventListener('touchmove', preventDefault, true); But with no success. Sorry for not providing you guys with any hard code or demos to test out for yourselves, it's simply too much code and it would be presented so out of its context, nobody would be able to debug it. So, is there a way n javascript to do this, switching between iScroll scrolling functionality and standard "native" webview scrolling? I would rather not rebuild the entire DOM framework so a solution like the one described above would be preferable.

    Read the article

  • Many to Many with LINQ-To-Sql and ASP.NET MVC

    - by Jonathan Stowell
    Hi All, I will restrict this to the three tables I am trying to work with Problem, Communications, and ProbComms. The scenario is that a Student may have many Problems concurrently which may affect their studies. Lecturers may have future communications with a student after an initial problem is logged, however as a Student may have multiple Problems the Lecturer may decide that the discussion they had is related to more than one Problem. Here is a screenshot of the LINQ-To-Sql representation of my DB: LINQ-To-Sql Screenshot At the moment in my StudentController I have a StudentFormViewModel Class: // //ViewModel Class public class StudentFormViewModel { IProbCommRepository probCommRepository; // Properties public Student Student { get; private set; } public IEnumerable<ProbComm> ProbComm { get; private set; } // // Dependency Injection enabled constructors public StudentFormViewModel(Student student, IEnumerable<ProbComm> probComm) : this(new ProbCommRepository()) { this.Student = student; this.ProbComm = probComm; } public StudentFormViewModel(IProbCommRepository pRepository) { probCommRepository = pRepository; } } When I go to the Students Detail Page this runs: public ActionResult Details(string id) { StudentFormViewModel viewdata = new StudentFormViewModel(studentRepository.GetStudent(id), probCommRepository.FindAllProblemComms(id)); if (viewdata == null) return View("NotFound"); else return View(viewdata); } The GetStudent works fine and returns an instance of the student to output on the page, below the student I output all problems logged against them, but underneath these problems I want to show the communications related to the Problem. The LINQ I am using for ProbComms is This is located in the Model class ProbCommRepository, and accessed via a IProbCommRepository interface: public IQueryable<ProbComm> FindAllProblemComms(string studentEmail) { return (from p in db.ProbComms where p.Problem.StudentEmail.Equals(studentEmail) orderby p.Problem.ProblemDateTime select p); } However for example if I have this data in the ProbComms table: ProblemID CommunicationID 1 1 1 2 The query returns two rows so I assume I somehow have to groupby Problem or ProblemID but I am not too sure how to do this with the way I have built things as the return type has to be ProbComm for the query as thats what Model class its located in. When it comes to the view the Details.aspx calls two partial views each passing the relevant view data through, StudentDetails works fine page: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MitigatingCircumstances.Controllers.StudentFormViewModel>" %> <% Html.RenderPartial("StudentDetails", this.ViewData.Model.Student); %> <% Html.RenderPartial("StudentProblems", this.ViewData.Model.ProbComm); %> StudentProblems uses a foreach loop to loop through records in the Model and I am trying another foreach loop to output the communication details: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<MitigatingCircumstances.Models.ProbComm>>" %> <script type="text/javascript" language="javascript"> $(document).ready(function() { $("DIV.ContainerPanel > DIV.collapsePanelHeader > DIV.ArrowExpand").toggle( function() { $(this).parent().next("div.Content").show("slow"); $(this).attr("class", "ArrowClose"); }, function() { $(this).parent().next("div.Content").hide("slow"); $(this).attr("class", "ArrowExpand"); }); }); </script> <div class="studentProblems"> <% var i = 0; foreach (var item in Model) { %> <div id="ContainerPanel<%= i = i + 1 %>" class="ContainerPanel"> <div id="header<%= i = i + 1 %>" class="collapsePanelHeader"> <div id="dvHeaderText<%= i = i + 1 %>" class="HeaderContent"><%= Html.Encode(String.Format("{0:dd/MM/yyyy}", item.Problem.ProblemDateTime))%></div> <div id="dvArrow<%= i = i + 1 %>" class="ArrowExpand"></div> </div> <div id="dvContent<%= i = i + 1 %>" class="Content" style="display: none"> <p> Type: <%= Html.Encode(item.Problem.CommunicationType.TypeName) %> </p> <p> Problem Outline: <%= Html.Encode(item.Problem.ProblemOutline)%> </p> <p> Mitigating Circumstance Form: <%= Html.Encode(item.Problem.MCF)%> </p> <p> Mitigating Circumstance Level: <%= Html.Encode(item.Problem.MitigatingCircumstanceLevel.MCLevel)%> </p> <p> Absent From: <%= Html.Encode(String.Format("{0:g}", item.Problem.AbsentFrom))%> </p> <p> Absent Until: <%= Html.Encode(String.Format("{0:g}", item.Problem.AbsentUntil))%> </p> <p> Requested Follow Up: <%= Html.Encode(String.Format("{0:g}", item.Problem.RequestedFollowUp))%> </p> <p>Problem Communications</p> <% foreach (var comm in Model) { %> <p> <% if (item.Problem.ProblemID == comm.ProblemID) { %> <%= Html.Encode(comm.ProblemCommunication.CommunicationOutline)%> <% } %> </p> <% } %> </div> </div> <br /> <% } %> </div> The issue is that using the example data before the Model has two records for the same problem as there are two communications for that problem, therefore duplicating the output. Any help with this would be gratefully appreciated. Thanks, Jon

    Read the article

  • log4net with .NET 4.0

    - by Jonathan
    I've thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can't seem to find a build of my logging framework of choice (log4net) for 4.0, and I'm getting reference errors with the 2.0 version. Is there a 4.0 version available somewhere? I'm not asking for new features, just a version that's already been rebuilt against the new assemblies. Anyone know where I can find a build of 1.2.10 built for the 4.0 framework?

    Read the article

  • How to get stack trace information for logging in production when using the GAC

    - by Jonathan Parker
    I would like to get stack trace (file name and line number) information for logging exceptions etc. in a production environment. The DLLs are installed in the GAC. Is there any way to do this? This article says about putting PDB files in the GAC: You can spot these easily because they will say you need to copy the debug symbols (.pdb file) to the GAC. In and of itself, that will not work. I know this article refers to debugging with VS but I thought it might apply to logging the stacktrace also. I've followed the instructions for the answer to this question except for unchecking Optimize code which they said was optional. I copied the dlls and pdbs into the GAC but I'm still not getting the stack trace information. Here's what I get in the log file for the stack trace: OnAuthenticate at offset 161 in file:line:column <filename unknown>:0:0 ValidateUser at offset 427 in file:line:column <filename unknown>:0:0 LogException at offset 218 in file:line:column <filename unknown>:0:0 I'm using NLog. My NLog layout is: layout="${date:format=s}|${level}|${callsite}|${identity}|${message}|${stacktrace:format=Raw}" ${stacktrace:format=Raw} being the relevant part.

    Read the article

  • Catch enter key press in input text field in AS3

    - by Jonathan Barbero
    Hello, I want to catch the enter key press when the user is filling an input text field in AS3. I think I have to do something like this: inputText.addEventListener(Event. ? , func); function func(e:Event):void{ if(e. ? == "Enter"){ doSomething(); } } But I can't find the best way to do this. By the way, the input text has a restriction: inputText.restrict = "0-9"; Should I add the enter key to the restrictions? inputText.restrict = "0-9\n"; Thanks in advance.

    Read the article

  • Wrapping variable width text in emacs lisp

    - by Jonathan Arkell
    I am hacking up a tagging application for emacs. I have got a tag cloud/weighted list successfully displaying on a buffer, but i am running into a snag. I need to be able to properly word-wrap the buffer, but I haven't a clue where to start. The font I am using is a variable width font. On top of that, each tag is going to be in a different size, depending on how many times it shows up on the buffer. Finally, the window that displays the tagcloud could be in a window that is 200 pixels wide, or the full screen width. I really have no idea where to start. I tried longlines mode on the tagcloud buffer, but that didn't work. Source code is at: http://emacswiki.org/cgi-bin/emacs/free-tagging.el

    Read the article

  • Using IVMRWindowlessControl to display video in a Winforms Control and allow for full screen toggle

    - by Jonathan Websdale
    I've recently switched from using the IVideoWindow interface to IVMRWindowlessControl in my custom Winforms control to display video. The reason for this was to allow zoom capabilities on the video within the control. However in switching over, I've found that the FullScreen mode from IVideoWindow is not available and I am currently trying to replicate this using the SetVideoWindow() method. I'm finding that I size the video in my control to be at the same resolution as the screen however I can't get the control to position itself to the top/left of the screen and become the top most window. Any ideas on how to achieve this since the IVideoWindow::put_FullScreenMode just did it all for you?

    Read the article

  • Google collections GWT jar

    - by Sudhir Jonathan
    Has anyone had any luck rolling a custom GWT jar for Google Collections / Guava? I've tried uncommenting the relevant ant tasks and running them, but I just get empty folders in the JAR. Can't seem to get the include rules right :-/

    Read the article

  • PHP Session when using desktop app

    - by Jonathan
    In this question I asked how to POST to a php file form a vb.net app: http://stackoverflow.com/questions/2615335/post-to-webpage-in-vb-net-win-forms-desktop-not-asp-net So now I've logged in the user user by posting their username and password to the php file, the php file then does security/checks they exist/etc and if both username and password are correct is stores the user ID in a session variable. Now if the vb.net app tries to download data off a page which needs the user to logged in, it checks this by doing: if (!isset($_SESSION['uid'])) { header("Location: index.php"); } However after having logged correctly in the app the session variable is not set. How does session work with a vb.net app like this? When the user logs in successfully should I download the user id and keep it in the vb.net app and then post it to each page that requires authentication?

    Read the article

  • CMake add_custom_command not being run

    - by Jonathan Sternberg
    I'm trying to use add_custom_command to generate a file during the build. The command never seemed to be run, so I made this test file. cmake_minimum_required( VERSION 2.6 ) add_custom_command( OUTPUT hello.txt COMMAND touch hello.txt DEPENDS hello.txt ) I tried running: cmake . make And hello.txt was not generated. What have I done wrong?

    Read the article

  • HttpContext.Current.Request.Url.Host returns a string of numbers

    - by Jonathan Sewell
    I have a website that emails a link to the invoice when an order is complete. The link should be http://mysite.com/QuoteAndBook/Confirmation?orderId=123 But for some reason it is: http://204435-204435/QuoteAndBook/Confirmation?orderId=123 The host portion of the link is generated using HttpContext.Current.Request.Url.Host but I would expect that to return "mysite.com", not "204435-204435". Any idea what's going on?

    Read the article

  • Weak linking on iPhone refuses to work

    - by Jonathan Grynspan
    I've got an iPhone app that's mainly targetting 3.0, but which takes advantage of newer APIs when they're available. Code goes something like this: if (UIApplicationDidEnterBackgroundNotification != NULL) [nc addObserver: self selector: @selector(irrelelvantCallbackName:) name: UIApplicationDidEnterBackgroundNotification object: nil]; Now, according to everything Apple's ever said, if the relevant APIs are weakly linked, that will work fine because the dynamic linker will evaluate UIApplicationDidEnterBackgroundNotification to NULL. Except that it doesn't. The application compiles, but as soon as it hits "if (UIApplicationDidEnterBackgroundNotification != NULL)" it crashes with EXC_BAD_ACCESS. Is this simply a matter of a compiler flag I need to set? Or am I going about this the wrong way?

    Read the article

  • Can't send client certificate via SslStream

    - by Jonathan
    I am doing an SSL3 handshake using an SslStream, but, in spite of my best efforts, the SslStream never sends a client certificate on my behalf. Here is the code: SSLConnection = new System.Net.Security.SslStream(SSLInOutStream, false, new System.Net.Security.RemoteCertificateValidationCallback(AlwaysValidRemoteCertificate), new System.Net.Security.LocalCertificateSelectionCallback(ChooseLocalCertificate)); X509CertificateCollection CC = new X509CertificateCollection(); CC.Add(Org.BouncyCastle.Security.DotNetUtilities.ToX509Certificate(MyLocalCertificate)); SSLConnection.AuthenticateAsClient("test", CC, System.Security.Authentication.SslProtocols.Ssl3, false); and then I have AlwaysValidRemoteCertificate just returning true, and ChooseLocalCertificate returning the zeroth element of the array. The code probably looks a little weird because the project is a little weird, but I think that is beside the point here. The SSL handshake completes. The issue is that instead of sending a certificate message on my behalf (in the handshake process), with the ASN.1 encoded certificate (MyLocalCertificate), the SslStream sends an SSL alert number 41 (no certificate) and then carries on. I know this from packet sniffing. After the handshake is completed, the SslStream marks IsAuthenticated as true, IsMutuallyAuthenticated as false, and its LocalCertificate member is null. I feel like I'm probably missing something pretty obvious here, so any ideas would be appreciated. I am a novice with SSL, and this project is off the beaten path, so I am kind of at a loss. P.S. 1: My ChooseLocalCertificate routine is called twice during the handshake, and returns a valid (as far as I can tell), non-null certificate both times. P.S. 2: SSLInOutStream is my own class, not a NetworkStream. Like I said, though, the handshake proceeds mostly normally, so I doubt this is the culprit... but who knows?

    Read the article

  • Code Golf: Quickly Build List of Keywords from Text, Including # of Instances

    - by Jonathan Sampson
    I've already worked out this solution for myself with PHP, but I'm curious how it could be done differently - better even. The two languages I'm primarily interested in are PHP and Javascript, but I'd be interested in seeing how quickly this could be done in any other major language today as well (mostly C#, Java, etc). Return only words with an occurrence greater than X Return only words with a length greater than Y Ignore common terms like "and, is, the, etc" Feel free to strip punctuation prior to processing (ie. "John's" becomes "John") Return results in a collection/array Extra Credit Keep Quoted Statements together, (ie. "They were 'too good to be true' apparently")Where 'too good to be true' would be the actual statement Extra-Extra Credit Can your script determine words that should be kept together based upon their frequency of being found together? This being done without knowing the words beforehand. Example: "The fruit fly is a great thing when it comes to medical research. Much study has been done on the fruit fly in the past, and has lead to many breakthroughs. In the future, the fruit fly will continue to be studied, but our methods may change." Clearly the word here is "fruit fly," which is easy for us to find. Can your search'n'scrape script determine this too? Source text: http://sampsonresume.com/labs/c.txt Answer Format It would be great to see the results of your code, output, in addition to how long the operation lasted.

    Read the article

  • C++: Dependency injection, circular dependency and callbacks

    - by Jonathan
    Consider the (highly simplified) following case: class Dispatcher { public: receive() {/*implementation*/}; // callback } class CommInterface { public: send() = 0; // call } class CommA : public CommInterface { public: send() {/*implementation*/}; } Various classes in the system send messages via the dispatcher. The dispatcher uses a comm to send. Once an answer is returned, the comm relays it back to the dispatcher which dispatches it back to the appropriate original sender. Comm is polymorphic and which implementation to choose can be read from a settings file. Dispatcher has a dependency on the comm in order to send. Comm has a dependency on dispatcher in order to callback. Therefor there's a circular dependency here and I can't seem to implement the dependency injection principle (even after encountering this nice blog post).

    Read the article

  • Using SharePoint user profiles to build a company phone directory

    - by Jonathan
    I'm working on a Sharepoint 2007 (MOSS Std) intranet implementation right now, and one of the things we'd like to do is replace the manually-maintained phone directory with the profile information we're importing from AD. People search is great, but I want to have a big page with all the names and phone numbers of the 150 or so people that work at the company (which means using the People Search webpart with a query hard-coded to return everyone won't work). A few quick searches haven't turned up anything, but this seems like a really common request. Can anyone help me out? I'm not opposed to buying a reasonably-priced webpart to solve this or writing some custom code, but both seem like they shouldn't be required for such a simple request.

    Read the article

  • Xpath and innerHTML

    - by Jonathan
    What Xpath expression can I use to find all the anchor (just 'a') elements whose actual text (the innerHTML) is Logout. something like //a[@innerHTML='Logout'] Would that be correct?

    Read the article

  • Migrating from VisualSVN on windows to linux based svn

    - by Jonathan
    I'd like to migrate my svn repository from my local computer running windows and VisualSVN 2.1.2 to an svn app on webfaction (my Linux hosting solution). Initially I tried dumping the svn: svnadmin dump *path_to_repository* *dumpfile_name* and loading it on the Linux machine svnadmin load *dumpfile_name* I received the following error: svnadmin: Can't open file '*dumpfile_path_and_name*/format': Not a directory I found that on my Windows machine I do have a format folder under the repository. So I copied the entire repository to the Linux machine and tried: svnadmin load *path_to_repository_copy* I received the following error: svnadmin: Expected FS format between '1' and '3'; found format '4' what should I do?

    Read the article

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