Search Results

Search found 4637 results on 186 pages for 'john deerikio'.

Page 89/186 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • Use LINQ and lambdas to put string in proper case

    - by Tobias Funke
    I have this function called ProperCase that takes a string, then converts the first letter in each word to uppercase. So ProperCase("john smith") will return "John Smith". Here is the code: public string ProperCase(string input) { var retVal = string.Empty; var words = input.Split(' '); foreach (var word in words) { if (word.Length == 1) { retVal += word.ToUpper(); } else if (word.Length > 1) { retVal += word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower(); } retVal += ' '; } if (retVal.Length > 0) { retVal = retVal.Substring(0, retVal.Length - 1); } return retVal; } This code workds perfectly, but I'm pretty sure I can do it more elegantly with LINQ and lambdas. Can some please show me how?

    Read the article

  • How do I export and import application services with say MEF?

    - by John Leidegren
    I'm working with MEF right now, but the answer I'm looking for probably is irrelevant to MEF -- it's all dependency injection -- I'm just using MEF terminology as an example here. Short background story, I read this article over at MSDN with focus on Composite Applications In this figure there's three things, the shell, the application services and the modules. So that's a composite application. What I don't fully get is the application services part. What's the service, what does it look like? How do you expose a service through a module and how do you consume a service from a different module? I'd really like to see some neat small code examples, nothing fancy but something to illustrate how all this comes to life (the application services part).

    Read the article

  • Play sound in mobile browser?

    - by John
    I want to make myself a web based stop watch for training that I can use on my Blackberry mobile browser. The stopwatch should count 3 minutes, then ring a bell, wait 1 minute, then ring another bell and then repeat. My problem is I can't seem to get sound to work on my blackberry browser. I tried using <embed src="bell.wav"> which works fine in the browser of a normal computer, but it doesn't make a sound on my blackberry. Should I build this stopwatch with Javascript and HTML or should I build it with flash?

    Read the article

  • Changing styling of DataGridViewComboBoxCell from DropDownList to DropDown?

    - by John at CashCommons
    (This question is narrower in scope than this question I asked earlier.) Say I have a DataGridViewComboBoxColumn, and want to switch the style of the ComboBox control between DropDownList and DropDown (mainly for the text field editing capability). I'd like to do this on a row-by-row basis (at the DataGridViewComboBoxCell level). How would I do that programatically? Or maybe a different way of asking: How do I access the ComboBox control given an object of type DataGridViewComboBoxCell? (I'm in VB 2005.) Thanks as always.

    Read the article

  • jquery validator message styling error in IE08 only when customised using errorPlacement function

    - by John Slaytor
    Going back to the errorplacement solution by Nadia (http://stackoverflow.com/questions/860055/jquery-override-default-validation-error-message-display-css-popup-tooltip-like) I have tried it and it works like a charm in Safari and Firefox but causes IE08 to bypass the jqueryvalidator and go straight to the server side validator. My code is this - as soon as I insert 'error element.... it is unstable in IE08. All help much appreciated <script type="text/javascript"> $(document).ready(function() { $("#sampleform").validate({ rules: { dinername: "required", venue: "required", contact: "required", dinertelephone: "required", venuetime: "required", numberdiners: "required", dineremail: { required: true, email: true}, datepicker: { required: true,date: true} }, messages: { dinername: "Your name?", numberdiners: "How many guests?", dinertelephone: "Your mobile?", venue: "Which restaurant?", venuetime: "Your arrival time?", datepicker: "Your booking date?", dineremail: "Please enter a valid email address", }, errorElement: "div", errorPlacement: function(error, element) { element.before(error); offset = element.offset(); error.css('right', offset.right); error.css('right', offset.right - element.outerHeight()); } }); }); </script> <script type="text/javascript"> $(function() { $("#datepicker") .datepicker({minDate: 0, maxDate: '+6M +0D',dateFormat: 'DD, d M yy',onClose: function() {$(this).valid();} }); }); </script> The relevant webpage is http://www.johnslaytor.com.au/nilgiris/forms/bookingform/bookingform.html

    Read the article

  • How to register XHTML namespaces??

    - by John Tyler
    My page use to validate for XHTML but I added the addthis buttons to page and it gives a new namespace: E.G.: <a addthis:url="http://domain.tld/path/to/stuff" addthis:title="Teh Title here"> I tried: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:addthis="http://addthis.com/" lang="en"> Doesn't work. Can we register namespaces for the validator??? I AM EMOTIONALLY ATTACHED TO VALID XHTML. I like addthis, I think its the best button of its kind (yes, I need to use the namespace properties, I know you dont have to but I do for what im doing PHP project) :(

    Read the article

  • Rails routing to XML/JSON without views gone mad

    - by John Schulze
    I have a mystifying problem. In a very simple Ruby app i have three classes: Drivers, Jobs and Vehicles. All three classes only consist of Id and Name. All three classes have the same #index and #show methods and only render in JSON or XML (this is in fact true for all their CRUD methods, they are identical in everything but name). There are no views. For example: def index @drivers= Driver.all respond_to do |format| format.js { render :json => @drivers} format.xml { render :xml => @drivers} end end def show @driver = Driver.find(params[:id]) respond_to do |format| format.js { render :json => @driver} format.xml { render :xml => @driver} end end The models are similarly minimalistic and only contain: class Driver< ActiveRecord::Base validates_presence_of :name end In routes.rb I have: map.resources :drivers map.resources :jobs map.resources :vehicles map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' I can perform POST/create, GET/index and PUT/update on all three classes and GET/read used to work as well until I installed the "has many polymorphs" ActiveRecord plugin and added to environment.rb: require File.join(File.dirname(__FILE__), 'boot') require 'has_many_polymorphs' require 'active_support' Now for two of the three classes I cannot do a read any more. If i go to localhost:3000/drivers they all list nicely in XML but if i go to localhost:3000/drivers/3 I get an error: Processing DriversController#show (for 127.0.0.1 at 2009-06-11 20:34:03) [GET] Parameters: {"id"=>"3"} [4;36;1mDriver Load (0.0ms)[0m [0;1mSELECT * FROM "drivers" WHERE ("drivers"."id" = 3) [0m ActionView::MissingTemplate (Missing template drivers/show.erb in view path app/views): app/controllers/drivers_controller.rb:14:in `show' ...etc This is followed a by another unexpected error: Processing ApplicationController#show (for 127.0.0.1 at 2009-06-11 21:35:52)[GET] Parameters: {"id"=>"3"} NameError (uninitialized constant ApplicationController::AreaAccessDenied): ...etc What is going on here? Why does the same code work for one class but not the other two? Why is it trying to do a #view on the ApplicationController? I found that if I create a simple HTML view for each of the three classes these work fine. To each class I add: format.html # show.html.erb With this in place, going to localhost:3000/drivers/3 renders out the item in HTML and I get no errors in the log. But if attach .xml to the URL it again fails for two of the classes (with the same error message as before) while one will output XML as expected. Even stranger, on the two failing classes, when adding .js to the URL (to trigger JSON rendering) I get the HTML output instead! Is it possible this has something to do with the "has many polymorphs" plugin? I have heard of people having routing issues after installing it. Removing "has many polymorphs" and "active support" from environment.rb (and rebooting the sever) seems to make no difference whatsoever. Yet my problems started after it was installed. I've spent a number of hours on this problem now and am starting to get a little desperate, Google turns up virtually no information which makes me suspect I must have missed something elementary. Any enlightenment or hint gratefully received! JS

    Read the article

  • php preg_replace with php code

    - by john
    I have a function that finds a regex thingy, then replaces with php code. I want to have it replace the found regex with php code on the screen, like have it echo out ". except when it echos that in the source, it shows all the

    Read the article

  • Trying to setup android sdk on PC with windows XP

    - by John Donovan
    When I start setup I get this message: XML verification failed for http://dl-ssl.google.com/android/repository/repository.xml. Error: cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-repository'. Failed to fetch URL reason: Unknown Even when I force the download to use http nothing happens. I get no downloads etc for the SDK. Any help would be greatly appreciated.

    Read the article

  • Using Unix Process Controll Methods in Ruby

    - by John F. Miller
    Ryan Tomayko touched off quite a fire storm with this post about using Unix process control commands. We should be doing more of this. A lot more of this. I'm talking about fork(2), execve(2), pipe(2), socketpair(2), select(2), kill(2), sigaction(2), and so on and so forth. These are our friends. They want so badly just to help us. I have a bit of code (a delayed_job clone for DataMapper that I think would fit right in with this, but I'm not clear on how to take advantage of the listed commands. Any Ideas on how to improve this code? def start say "*** Starting job worker #{@name}" t = Thread.new do loop do delay = Update.work_off(self) break if $exit sleep delay break if $exit end clear_locks end trap('TERM') { terminate_with t } trap('INT') { terminate_with t } trap('USR1') do say "Wakeup Signal Caught" t.run end end

    Read the article

  • What do I need to do to make sure my app launches as Admin?

    - by John Gietzen
    I'm writing an app that allows you to script the buttons from a wiimote into actions on your PC. It currently supports all of the features of the main remote control, except for the speaker. Now, I'm running in to trouble when I run it on Vista with UAC turned on. Any time a UAC'd window has focus, my app fails to move the mouse successfully. For instance, when an installer is run, I have to navigate it with the keyboard. Will running the app as administrator solve my problem? (At one point in time, I was able to successfully move the mouse over a UAC-password-entry box) How do I build a manifest that will tell windows to "run as administrator"? How do I embed this manifest into my app, if I'm strongly naming my assembly? How do I sign my application with an Authenticode cert? EDIT: Ok, so after some more extensive research, I have found: http://msdn.microsoft.com/en-us/library/bb756929.aspx <requestedExecutionLevel level="asInvoker|highestAvailable|requireAdministrator" uiAccess="true|false"/> However, the article says: Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. \Program Files\ and \windows\system32\ are currently the two allowable protected locations. I have edited the question to reflect the new developments.

    Read the article

  • Sending mail from Python using SMTP

    - by Eli Bendersky
    I'm using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I'm missing ? from smtplib import SMTP import datetime debuglevel = 0 smtp = SMTP() smtp.set_debuglevel(debuglevel) smtp.connect('YOUR.MAIL.SERVER', 26) smtp.login('USERNAME@DOMAIN', 'PASSWORD') from_addr = "John Doe <[email protected]>" to_addr = "[email protected]" subj = "hello" date = datetime.datetime.now().strftime( "%d/%m/%Y %H:%M" ) message_text = "Hello\nThis is a mail from your server\n\nBye\n" msg = "From: %s\nTo: %s\nSubject: %s\nDate: %s\n\n%s" % ( from_addr, to_addr, subj, date, message_text ) smtp.sendmail(from_addr, to_addr, msg) smtp.quit()

    Read the article

  • How can you prevent an individual window being captured by Print-Screen?

    - by John
    I noticed a few times than when I print-screen while Media Player is running, the content is replaced with a grey rectangle. I've no idea if it's deliberate due to DRM, or some technical issue, but it struck me that being able to deliberately block screen-capture might be a useful feature in some scenarios. I am not looking to fix the problem, but replicate it! Is there some specific message each HWND gets for print-screen - does Windows do a special repaint or simply dump buffers to the clipboard? I guess I'd prefer to focus this on Win32 specifically, but as long as it's Windows-related then fine.

    Read the article

  • How would one use Cocos2d to create a game like this.

    - by John Stewart
    http://itunes.apple.com/us/app/angry-birds/id343200656?mt=8&ign-mpt=uo%3D6 So I am getting started with this all game dev thing on iphone and I decided that I will start playing with Cocos2d as my starting engine. Now just so i have a goal in mind, I picked angry birds as my initial target of what sort of game play would I like to learn to build. This is not going to be a market release game. This is totally going to be learning purposes only. So to start off my question is: Would something like this be achievable using Cocos2d? How would I go about building the physics for this? How can one do a screen scroll like the way they do in cocos2d? (any example code would be great) This is just to start off. If you have any particular questions please do add to this question.

    Read the article

  • Entity-attribute-value model using codeigniter / php

    - by John Stewart
    SO I am trying to create a way to structure my database to be able customize forms. I looked into EAV pattern and here is my db structure: Table form - form_id - form_name - form_added_on - form_modified_at Table: form_fields - field_id - form_id - field_type (TEXT, RADIO etc..) - field_default_value - field_required Table: form_data - data_id - field_id - form_id - field_value so now I can store any custom form into the database and if I want to get the values for an individual form I can simply join it by "form_id" .. the problem: I want to be able to search through all the forms for a specific field value. How can I do that with EAV model? Also, I thought about just storing the custom data as a serialized (JSON) object but then I am not sure how can I query that data. Please note that I am using Codeigniter with MYSQL. So if conversation can use Codeigniter libraries if needed.

    Read the article

  • MySQL Select problems

    - by John Nuñez
    Table #1: qa_returns_items Table #2: qa_returns_residues I have a long time trying to get this Result: item_code - item_quantity 2 - 1 3 - 2 IF qa_returns_items.item_code = qa_returns_residues.item_code AND status_code = 11 THEN item_quantity = qa_returns_items.item_quantity - qa_returns_residues.item_quantity ELSEIF qa_returns_items.item_code = qa_returns_residues.item_code AND status_code = 12 THEN item_quantity = qa_returns_items.item_quantity + qa_returns_residues.item_quantity ELSE show diferendes END IF I tried this Query: select SubQueryAlias.item_code, total_ecuation, SubQueryAlias.item_unitprice, SubQueryAlias.item_unitprice * total_ecuation as item_subtotal, item_discount, (SubQueryAlias.item_unitprice * total_ecuation) - item_discount as item_total from ( select ri.item_code , case status_code when 11 then ri.item_quantity - rr.item_quantity when 12 then ri.item_quantity + rr.item_quantity end as total_ecuation , rr.item_unitprice , rr.item_quantity , rr.item_discount * rr.item_quantity as item_discount from qa_returns_residues rr left join qa_returns_items ri on ri.item_code = rr.item_code WHERE ri.returnlog_code = 1 ) as SubQueryAlias where total_ecuation > 0 GROUP BY (item_code); The query returns this result: item_code - item_quantity 1 - 2 2 - 2

    Read the article

  • Merging datasets with 2 different time variables in SAS

    - by John
    Hye Guys, for those regularly browsing this site sorry for already another question (however I did solve my last question myself!) I have another problem with merging datasets, it seems that accounting for time in datasets is a real pain in the ass. I succesfully managed to merge on months in my previous datasets, however it seems I have a final dataset which only has quarter as a time count variable. So where all my normal databases have month 1- xxx as an indicator of time, this database had quarter as an indicator of time. I still want to add the variables of this last database, let's call it TVOL, into my WORK database. Quick summary QUARTER: Quarter 0 = JAN1996-MAR1996 Month: Month 0 = JAN1996 Example: TVOL TVOL _ Ticker ____ Quarter 1500 _ AA ________ -1 52546 _ BB ________ 15 Example: WORK BETA _ Ticker ____ Month 1.52 _ AA ________ 2 1.54__ BB _______ 3 Example: Merged: BETA ______ TVOL __ Ticker ____ Month 1.52 _______ 500 ___ AA _______ 2 I now want to merge this 2 tables using following relationship if the month is in quarter 1, the data of quarter 0 has to be used, so if i have an observation i nWORK with date 2FEB1996 the TVOL of quarter -1 has to be put behind this observation. Something like IF month = quarter i use data quarter i-1. Also, as TVOL is measured quarterly and I have to put in monthly I have to take the average, so (TVOL/3) should be added as a variable. Thanks!

    Read the article

  • Sorting a text file by date - Date looks like DD/MM/YYYY

    - by John N
    I am trying to sort the dates from the earliest to the latest. I was thinking about using the bufferedreader and do a try searching the first 2 characters of the string and then the 4th and 5th characters and finally the 7th and 8th characters, ignoring the slashes. The following is an example of the text file I have: 04/24/2010 - 2000.0 (Deposit) 09/05/2010 - 20.0 (Fees) 02/30/2007 - 600.0 (Deposit) 06/15/2009 - 200.0 (Fees) 08/23/2010 - 300.0 (Deposit) 06/05/2006 - 500.0 (Fees)

    Read the article

  • Nservicebus serization issue of derived types

    - by Tiju John
    Hi Guys, for the context setting, I am exchanging messages between my nServiceBus client and nSerivceBus server. its is the namespace xyz.Messages and and a class, Message : IMessage I have more messages that are in the other dlls, like xyz.Messages.Domain1, xyz.Messages.Domain2, xyz.Messages.Domain3. and messages that derive form that base message, Message. I have the endpoints defined as like : at client <UnicastBusConfig> <MessageEndpointMappings> <add Messages="xyz.Messages" Endpoint="xyzServerQueue" /> <add Messages="xyz.Messages.Domain1" Endpoint="xyzServerQueue" /> <add Messages="xyz.Messages.Domain2" Endpoint="xyzServerQueue" /> </MessageEndpointMappings> </UnicastBusConfig> at Server <UnicastBusConfig> <MessageEndpointMappings> <add Messages="xyz.Messages" Endpoint="xyzClientQueue" /> <add Messages="xyz.Messages.Domain1" Endpoint="xyzClientQueue" /> <add Messages="xyz.Messages.Domain2" Endpoint="xyzClientQueue" /> </MessageEndpointMappings> </UnicastBusConfig> and the bus initialized as IBus serviceBus = Configure.With() .SpringBuilder() .XmlSerializer() .MsmqTransport() .UnicastBus() .LoadMessageHandlers() .CreateBus() .Start(); now when i try sending instance of Message type or any type derived types of Message, it successfully sends the message over and at the server, i get the proper type. eg. Message message= new Message(); Bus.Send(message); // works fine, transfers Message type message = new MessageDerived1(); Bus.Send(message); // works fine, transfers MessageDerived1 type message = new MessageDerived2(); Bus.Send(message); // works fine, transfers MessageDerived2 type My problem arises when any type, say MessageDerived1, contains a member variable of type Message, and when i assign it to a derived type, the type is not properly transferred over the wire. It transfers only as Message type, not the derived type. public class MessageDerived2 : Message { public Message message; } MessageDerived2 messageDerived2= new MessageDerived2(); messageDerived2.message = new MessageDerived1(); message = messageDerived2; Bus.Send(message); // incorrect behaviour, transfers MessageDerived2 correctly, but looses type of MessageDerived2.Message (it deserializes as Message type, instead of MessageDerived1) any help is strongly appreciated. Thanks TJ

    Read the article

  • Child sProc cannot reference a Local temp table created in parent sProc

    - by John Galt
    On our production SQL2000 instance, we have a database with hundreds of stored procedures, many of which use a technique of creating a #TEMP table "early" on in the code and then various inner stored procedures get EXECUTEd by this parent sProc. In SQL2000, the inner or "child" sProc have no problem INSERTing into #TEMP or SELECTing data from #TEMP. In short, I assume they can all refer to this #TEMP because they use the same connection. In testing with SQL2008, I find 2 manifestations of different behavior. First, at design time, the new "intellisense" feature is complaining in Management Studio EDIT of the child sProc that #TEMP is an "invalid object name". But worse is that at execution time, the invoked parent sProc fails inside the nested child sProc. Someone suggested that the solution is to change to ##TEMP which is apparently a global temporary table which can be referenced from different connections. That seems too drastic a proposal both from the amount of work to chase down all the problem spots as well as possible/probable nasty effects when these sProcs are invoked from web applications (i.e. multiuser issues). Is this indeed a change in behavior in SQL2005 or SQL2008 regarding #TEMP (local temp tables)? We skipped 2005 but I'd like to learn more precisely why this is occuring before I go off and try to hack out the needed fixes. Thanks.

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >