Search Results

Search found 2033 results on 82 pages for 'andrew g johnson'.

Page 16/82 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • PHP's PDO Prepare Method Fails While in a Loop

    - by Andrew G. Johnson
    Given the following code: // Connect to MySQL up here $example_query = $database->prepare('SELECT * FROM table2'); if ($example_query === false) die('prepare failed'); $query = $database->prepare('SELECT * FROM table1'); $query->execute(); while ($results = $query->fetch()) { $example_query = $database->prepare('SELECT * FROM table2'); if ($example_query === false) die('prepare failed'); //it will die here } I obviously attempt to prepare statements to SELET everything from table2 twice. The second one (the one in the WHILE loop) always fails and causes an error. This is only on my production server, developing locally I have no issues so it must be some kind of setting somewhere. My immediate thought is that MySQL has some kind of max_connections setting that is set to 1 and a connection is kept open until the WHILE loop is completed so when I try to prepare a new query it says "nope too many connected already" and shits out. Any ideas? EDIT: Yes I know there's no need to do it twice, in my actual code it only gets prepared in the WHILE loop, but like I said that fails on my production server so after some testing I discovered that a simple SELECT * query fails in the WHILE loop but not out of it. The example code I gave is obviously very watered down to just illustrate the issue.

    Read the article

  • How to display Django SelectDateWidget on one line using crispy forms

    - by Scott Johnson
    I am trying to display the 3 select fields that are rendered out using Django SelectDateWidget on one line. When I use crispy forms, they are all on separate rows. Is there a way to use the Layout helper to achieve this? Thank you! class WineAddForm(forms.ModelForm): hold_until = forms.DateField(widget=SelectDateWidget(years=range(1950, datetime.date.today().year+50)), required=False) drink_before = forms.DateField(widget=SelectDateWidget(years=range(1950, datetime.date.today().year+50)), required=False) helper = FormHelper() helper.form_method = 'POST' helper.form_class = 'form-horizontal' helper.label_class = 'col-lg-2' helper.field_class = 'col-lg-8' helper.add_input(Submit('submit', 'Submit', css_class='btn-wine')) helper.layout = Layout( 'name', 'year', 'description', 'country', 'region', 'sub_region', 'appellation', 'wine_type', 'producer', 'varietal', 'label_pic', 'hold_until', 'drink_before', ) class Meta: model = wine exclude = ('user', 'slug', 'likes')

    Read the article

  • Custom array sorting based on instance properties

    - by St. John Johnson
    I'm trying to perform a usort on an array inside an instance of a class. But the sort is dependent on the properties of said instance. Code (which doesn't work): class foo { private $array; private $key; private $dir; function sort() { usort($this->array, array("foo", "orderArray")); } function orderArray($a, $b) { return strcmp($a[$this->key], $b[$this->key]) * $this->dir; } } From the orderArray class, you can't access $key or $dir. The question is, how can I write this so I can?

    Read the article

  • Call a protected method from outside a class in PHP

    - by Chad Johnson
    I have a very special case in which I need to call a protected method from outside a class. I am very conscious about what I do programmingwise, but I would not be entirely opposed to doing so in this one special case I have. In all other cases, I need to continue disallowing access to the internal method, and so I would like to keep the method protected. What are some elegant ways to access a protected method outside of a class? So far, I've found this. I suppose it may be possible create some kind of double-agent instance of the target class that would sneakily provide access to the internals...

    Read the article

  • Global Hotkey in Mono and Gtk#

    - by Zach Johnson
    I'm trying to get a global hotkey working in Linux using Mono. I found the signatures of XGrabKey and XUngrabKey, but I can't seem to get them working. Whenever I try to invoke XGrabKey, the application crashes with a SIGSEGV. This is what I have so far: using System; using Gtk; using System.Runtime.InteropServices; namespace GTKTest { class MainClass { const int GrabModeAsync = 1; public static void Main(string[] args) { Application.Init(); MainWindow win = new MainWindow(); win.Show(); // Crashes here XGrabKey( win.Display.Handle, (int)Gdk.Key.A, (uint)KeyMasks.ShiftMask, win.Handle, true, GrabModeAsync, GrabModeAsync); Application.Run(); XUngrabKey( win.Display.Handle, (int)Gdk.Key.A, (uint)KeyMasks.ShiftMask, win.Handle); } [DllImport("libX11")] internal static extern int XGrabKey( IntPtr display, int keycode, uint modifiers, IntPtr grab_window, bool owner_events, int pointer_mode, int keyboard_mode); [DllImport("libX11")] internal static extern int XUngrabKey( IntPtr display, int keycode, uint modifiers, IntPtr grab_window); } public enum KeyMasks { ShiftMask = (1 << 0), LockMask = (1 << 1), ControlMask = (1 << 2), Mod1Mask = (1 << 3), Mod2Mask = (1 << 4), Mod3Mask = (1 << 5), Mod4Mask = (1 << 6), Mod5Mask = (1 << 7) } } Does anyone have a working example of XGrabKey? Thanks!

    Read the article

  • How to calculate bandwidth consumption for a Hosting Account using C# in ASP.Net Application?

    - by Steve Johnson
    HI all, I am working on SaaS Hosting Software. a large number of sites are hosted on the server. I am trying to calculate bandwidth consumption, (bytes transferred in and out) using C#, described Here using the MS Log Parser. In the above case, if the log files are deleted by the user or any administrator even, the bandwidth calculation will not be possible. Q1: *What is the standard way to measure the Bandwidth for various Hosting accounts (of websites) on a single server?* Q2: *If Log parser mechanism (as described above) is used, then how to take care of the security issue? Is there some system directory or event viewer logs or something which cannot be deleted except by the System account and contains bandwidth data?* Please point me in the right direction. Thanks

    Read the article

  • Problems with Continuous Integration (CI) in TFS during Build Automation?

    - by Steve Johnson
    Hi all, I am using TFS 2008 and Visual Studio and my boss has instructed me to implement Build Automation for Development and Release builds for a web Project. I am a total newbie in Build Automation. There are multiple developers working on the project on different machines using Visual Studio 2008 team System. Source is already being maintained on TFS 2008. SQL Server in Use is SQL Server 2000 and hosted IIS is IIS 7.5 on Windows Server 2008 x64. I have searched over the net and found Continuous Integration and Nightly Builds as two important Build Automation techniques. I was just wondering of any disadvantages associated with both the methodologies (CI and Nightly Builds). If someone could guide me to a working tutorial that explains both techniques the it would be quite helpful. Please also tell the requirements of IIS, SQL Server and any other that might be pre-requisite to implement build automation. Also i would like to know whether there are other techniques that are better then CI? Replies and discussion much appreciated. Thanks

    Read the article

  • Automatically Sizing UIView after Adding to Window

    - by Kristopher Johnson
    I have an iPad app that switches between different views in its main window. The view-switching code looks like this: - (void)switchToViewController:(UIViewController*)viewController { if (currentViewController != viewController) { [currentViewController.view removeFromSuperview]; currentViewController = viewController; [window addSubview:viewController.view]; } } The problem is that when the new view (a UISplitView) appears in landscape orientation, it is not sized to fill the entire window. There is an empty black space on the right. If I rotate the device and then rotate back, the view sizes itself properly. If the device is in portrait orientation, everything works fine. The UISplitView also gets sized properly if it is the first view I show. The problem only occurs if I switch to it after another view has been shown, in landscape. So, is there some way to force iPhone OS to resize the view after it has been added to the window? I've tried calling sizeToFit, but it didn't work. I've also tried setting the view's bounds to the window's bounds, and I've tried setting the frame.

    Read the article

  • Convert From Custom List to List of String

    - by Paul Johnson
    Hi all I have the following code: Public Shared Function ConvertToString(ByVal list As IList) As String Dim strBuilder = New System.Text.StringBuilder() Dim item As Object For Each item In list strBuilder.Append(obj.ToString()) strBuilder.Append(",") Next Return strBuilder.ToString(strBuilder.Length - 1) End Function The intention is to convert an IList of custom objects to a string equivalent comprising each element in the Ilist. Unfortunately I can't seem to find a way to get the underlying data of the custom object, and of course as in the above example, using object simply gives me a string of types definitions, rather than access to the underlying data. Any assistance much appreciated. Paul.

    Read the article

  • MPI signal handling

    - by Seth Johnson
    When using mpirun, is it possible to catch signals (for example, the SIGINT generated by ^C) in the code being run? For example, I'm running a parallelized python code. I can except KeyboardInterrupt to catch those errors when running python blah.py by itself, but I can't when doing mpirun -np 1 python blah.py. Does anyone have a suggestion? Even finding how to catch signals in a C or C++ compiled program would be a helpful start. If I send a signal to the spawned Python processes, they can handle the signals properly; however, signals sent to the parent orterun process (i.e. from exceeding wall time on a cluster, or pressing control-C in a terminal) will kill everything immediately.

    Read the article

  • Restricting Android camera

    - by Johnson Tey
    Hello! Avoiding having to create a whole camera app myself, I am calling up: Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); this.startActivityForResult(camera, PICTURE_RESULT); However, the camera is very advanced and beautiful :) but not for my purposes. :( Is there a way to restrict the camera to control size, resolution, disable setup button, flash, face recognition, etc...?

    Read the article

  • Team build of Web Projects generates App_web_xxxx.dll files and TFSBuild.Proj Script

    - by Steve Johnson
    Hi all, I have a web application that has some non-web projects as well. When using Web Deployment, a single assembly is generated for all the aspx.vb files. When using Team Build (TS 2008), a lot number App_Web_xxx.dll file(s) are generated instead of a single assembly. How can i solve this problem and change the TFSBuild.proj file so that it can generate a single Web Assembly instead of a lot number of assemblies. Please help. Thanks Edit: I guess thats because the MERGE operation is not occurring like it used to happen for Web Deployment Project in my solution. How can i enable MERGE of App_web_*.dll files into a single Web.dll assembly file and delete the satellite assemblies? Here is my code from TFSBuild.proj file: (MY web project is in Release|.NET Config and all other projects within the solution are in Release|Any CPU) true .\Debug true true Web true false .\Release true true Web true Please tell me what are the corrections i need to do.,

    Read the article

  • Implementing a horizontal compass on the iPhone - algorithm?

    - by Andrew Johnson
    A horizontal compass looks something like this if you are facing due East (90 degrees). 85----90---95 If you were facing due 355 degrees northwest, it would look like this: 350----355---0 As you turn the compass, the number should cycle from 0 - 360 - 0 So, my question is, how would you implement a view like this on the iPhone? I had a couple of ideas: Make one long image with all numbers and tick marks, and shift it left/right when the compass heading changes Create pieces of the view as tiles and append them when the compass heading changes. Create a line of tick marks that shifts with the compass heading, and just write numbers on it as needed. How would you attack this problem? Im mainly looking for algorithmic advice, but if you ave code or pseudo-code to demonstrate, that would be helpful too.

    Read the article

  • Novel fitness measure for evolutionary image matching simulation

    - by Nick Johnson
    I'm sure many people have already seen demos of using genetic algorithms to generate an image that matches a sample image. You start off with noise, and gradually it comes to resemble the target image more and more closely, until you have a more-or-less exact duplicate. All of the examples I've seen, however, use a fairly straightforward pixel-by-pixel comparison, resulting in a fairly predictable 'fade in' of the final image. What I'm looking for is something more novel: A fitness measure that comes closer to what we see as 'similar' than the naive approach. I don't have a specific result in mind - I'm just looking for something more 'interesting' than the default. Suggestions?

    Read the article

  • Keep Window Inactive In Appearance Even When Activated

    - by Zach Johnson
    Is there a way to keep a window inactive looking, even if it contains focus? I have two forms (A and B). After the user interacts with A, I transfer focus back to B. The result of the focus transfers (the user clicking on the A, then focus being transferred back to B) is that form A blinks from active to inactive. This looks ugly (especially on Vista where A momentarily gets a bigger shadow). How can I make A stay inactive looking so this blinking will not happen?

    Read the article

  • JavaScript frameworks and CSS frameworks: JQuery, YUI, neither, or something else?

    - by Eric Johnson
    I haven't done web development for about 6 years. I'm trying to get back into it and there is a lot of new stuff out there. I've chosen to write my next project with Perl and Catalyst. I keep hearing about various JavaScript and CSS frameworks. I know very little about these frameworks so maybe this question is overly broad and open ended. What are the strengths, weaknesses, and popularity of the various frameworks? Should I be using YUI, JQuery, neither, or something else?

    Read the article

  • iPhone cocos2d CCTMXTiledMap tile transitions

    - by Jeff Johnson
    I am using cocos2d on the iPhone and am wondering if it is possible to use a texture mask in order to create tile transitions / fringe layer. For example, a grass tile and a dirt tile, I would want a tile that had both grass and dirt in it... Has anyone done this, or is the only way to create one tile for every possible transition?

    Read the article

  • Windows Service Conundrum

    - by Paul Johnson
    All, I have a Custom object which I have written using VB.NET (.net 2.0). The object instantiates its own threading.timer object and carries out a number of background process including periodic interrogation of an oracle database and delivery of emails via smtp according to data detected in the database. The following is the code implemented in the windows service class Public Class IncidentManagerService 'Fakes Private _fakeRepoFactory As IRepoFactory Private _incidentRepo As FakeIncidentRepo Private _incidentDefinitionRepo As FakeIncidentDefinitionRepo Private _incManager As IncidentManager.Session 'Real Private _started As Boolean = False Private _repoFactory As New NHibernateRepoFactory Private _psalertsEventRepo As IPsalertsEventRepo = _repoFactory.GetPsalertsEventRepo() Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. If Not _started Then Startup() _started = True End If End Sub Protected Overrides Sub OnStop() 'Tear down class variables in order to ensure the service stops cleanly _incManager.Dispose() _incidentDefinitionRepo = Nothing _incidentRepo = Nothing _fakeRepoFactory = Nothing _repoFactory = Nothing End Sub Private Sub Startup() Dim incidents As IList(Of Incident) = Nothing Dim incidentFactory As New IncidentFactory incidents = IncidentFactory.GetTwoFakeIncidents _repoFactory = New NHibernateRepoFactory _fakeRepoFactory = New FakeRepoFactory(incidents) _incidentRepo = _fakeRepoFactory.GetIncidentRepo _incidentDefinitionRepo = _fakeRepoFactory.GetIncidentDefinitionRepo 'Start an incident manager session _incManager = New IncidentManager.Session(_incidentRepo, _incidentDefinitionRepo, _psalertsEventRepo) _incManager.Start() End Sub End Class After a little bit of experimentation I arrived at the above code in the OnStart method. All functionality passed testing when deployed from VS2005 on my development PC, however when deployed on a true target machine, the service would not start and responds with the following message: "The service on local computer started and then stopped..." Am I going about this the correct way? If not how can I best implement my incident manager within the confines of the Windows Service class. It seems pointless to implement a timer for the incidentmanager because this already implements its own timer... Any assistance much appreciated. Kind Regards Paul J.

    Read the article

  • Why do I get "undefined method `destroy'" when including 'svn/repos'?

    - by Chad Johnson
    I get the following when running script/server require 'svn/repos' script/console Loading development environment (Rails 2.3.5) require 'svn/repos' /Library/Ruby/Site/1.8/svn/core.rb:88: warning: already initialized constant Stream /Library/Ruby/Site/1.8/svn/core.rb:138: warning: already initialized constant AuthBaton NoMethodError: undefined method destroy' for #<Svn::Ext::Core::Apr_pool_wrapper_t:0x10150ae68> from /Library/Ruby/Site/1.8/svn/util.rb:60:insvn_fs_initialize' from /Library/Ruby/Site/1.8/svn/util.rb:60:in call' from /Library/Ruby/Site/1.8/svn/util.rb:60:ininitialize' from /Library/Ruby/Site/1.8/svn/fs.rb:14 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Library/Ruby/Site/1.8/svn/repos.rb:5 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' from (irb):1 Any idea why?

    Read the article

  • Oracle SQL clause evaluation order

    - by jon.johnson
    In Oracle, which clause types get evaluated first? If I had the following ( pretend .... represent valid expressions and relation names ), what would the order of evaluation be? SELECT ... FROM ..... WHERE ........ GROUP BY ........... HAVING ............. ORDER BY ................ I am under the impression that the SELECT clause is evaluated last, but other than that I'm clueless.

    Read the article

  • SOAPUI: Document Type Webservices Testing.

    - by Neal Johnson
    Hi , I am new to SOAP UI usage. I would like to test one of the webservices generated using weblogic 8.1 SP 6. The webservice is a document type webservice. Is there any way to test this webservice using SOAP UI ?? Or is there any tool which helps to test document type webservices?? Thanks in advance.

    Read the article

  • Hide Mailto: link

    - by Bill Johnson
    Hi all, I have varying mailto: email address on my site which are now being hit with various harvesters and subsequently I'm being spammed. Can anyone assist me in creating some PHP code for the following: <a href="mailto:[email protected]">[email protected]</a> To prevent the address from being harvested and equally can I use this script on various email address displayed on the site? Thanks

    Read the article

  • Rails initializes extremely slow on ruby 1.9.1

    - by Ben Johnson
    I just got my rails 2.3.8 app running on ruby 1.9.1. To get into the console, start the webserver, anything that initializes rails, takes 3 - 4 times longer in ruby 1.9 than in ruby 1.8.7. I'm using ruby version managers so I can easily switch between ruby 1.9 and ruby 1.8.7. The speed difference happens in both production and development. I want to use 1.9 because its must faster once everything is running, but the startup time is so bad the app is timing out on Heroku on the first request. Any ideas why ruby 1.9 would be 3 - 4 times slower? I can't figure it out for the life of me.

    Read the article

  • Invalid iPhone Application Binary

    - by Kristopher Johnson
    I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect: The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate. My guess is that it is not properly signed. I have downloaded my App Store distribution certficate, but I can't figure out how to "sign" my application with it. The SDK's documentation about code signing is not very helpful. (FWIW, I can install the app on my iPhone just fine using the development provisioning profile.) However, it is possible that I screwed things up on a more basic level. Here's what I did to try to prepare it for upload: In Xcode, select the Device|Release target Select the target and click the Info button. Change "Code Signing Identity" to "iPhone Distribution", and change "Code Signing Provisioning Profile" to my App Store distribution profile. Build Go to the directory where the built MyApp.app bundle is, control-click and choose "Compress" to create MyApp.zip Upload MyApp.zip to the App Store via iTunes Connect (which resulted in the above error message). Can anybody give me any hints? Edit: Found someone with the same problem. Unfortunately, he won't tell us how he fixed it. http://www.rhonabwy.com/wp/2008/07/18/seattlebus-diary-ongoing-update-saga/#comments http://www.rhonabwy.com/wp/2008/07/22/seattlebus-diary-update-is-pending-review/ (Note: For general information on submitting iPhone applications to the App Store, see Steps to upload an iPhone application to the AppStore.)

    Read the article

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