Search Results

Search found 1237 results on 50 pages for 'sam ingrassia'.

Page 22/50 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Ruby: Passing optional objects to method

    - by Sam
    Class TShirt def size(suggested_size) if suggested_size == nil size = "please choose a size" else size = suggested end end end tshirt = TShirt.new tshirt.size("M") == "M" tshirt = TShirt.new size = tshirt.size(nil) == "please choose a size" What is a better way to have optional objects in a method? Procs?

    Read the article

  • Algorithm to get through a maze

    - by Sam
    Hello, We are currently programming a game (its a pretty unknown language: modula 2), And the problem we encountered is the following: we have a maze (not a perfect maze) in a 17 x 12 grid. The computer has to generate a way from the starting point (9, 12) to the end point (9, 1). I found some algorithms but they dont work when the robot has to go back: xxxxx x => x x xxx or: xxxxx x xxxxxx x x x x x xxxxxx x => x xxxxxxxxx I found a solution for the first example type but then the second type couldn't be solved and the solution I made up for the second type would cause the robot to get stuck in the first type of situation. It's a lot of code so i'll give the idea: WHILE (end destination not reached) DO { try to go right, if nothing blocks you: go right if you encounter a block, try up until you can go right, if you cant go up anymore try going down until you can go right, (starting from the place you first were blocked), if you cant go down anymore, try one step left and fill the spaces you tested with blocks. } This works for the first type of problem ... not for the second one. Now it could be that i started wrong so i am open for better algorithms or solutions specificaly to how i could improve my algorithm. Thanks a lot!!

    Read the article

  • embedding pascal

    - by Sam P
    Is anyone aware of a Pascal interpreter/compiler which is embeddable in C++ (or anything else other than Pascal) applications? I am cloning (for lack of a better word) an application which uses an Object-Pascal compatible scripting language and needs to be script compatible. Am I going to end up writing an interpreter? (!)

    Read the article

  • UITabBar in iPad - Won't go into landscape mode with more than 2 items

    - by Sam Diaz
    I created a new project and selected the Tab Bar template for iPad. I opened it up in Interface Builder and added 4 more items, bringing the total items to 6. I did a build and run and it opened up fine in the iPad simulator, but it wouldn't go into landscape! I then backtracked in interface builder and found that it would go landscape if there were only 2 items in the tab bar, but not if there were any more. The simulator rotates but all the content (currently just the placeholders put in place by Apple) stays as if it was portrait. Any ideas why?

    Read the article

  • Images in the project NOT adding to array - don't know why.

    - by Sam Jarman
    Hi there, I have to sets of images. Each set has 16 images. One set is called 0.png through to 15.png the other is a0.png through to a15.png. In my app, it loads each one dependent on a variable (which by logging, I have proved it works) here is the code [MemoryManager sharedMemoryManager]; NSLog(@"THEME: %@", [MemoryManager sharedMemoryManager].themeName); imageArray = [[NSMutableArray alloc] init]; if([MemoryManager sharedMemoryManager].themeName == @"hand"){ NSLog(@"Here 2"); [imageArray addObject:[UIImage imageNamed:@"0.png"]]; // [imageArray addObject:[UIImage imageNamed:@"1.png"]];//1 [imageArray addObject:[UIImage imageNamed:@"2.png"]];//2 [imageArray addObject:[UIImage imageNamed:@"3.png"]];//3 [imageArray addObject:[UIImage imageNamed:@"4.png"]];//4 [imageArray addObject:[UIImage imageNamed:@"5.png"]];//5 [imageArray addObject:[UIImage imageNamed:@"6.png"]];//6 [imageArray addObject:[UIImage imageNamed:@"7.png"]];//7 [imageArray addObject:[UIImage imageNamed:@"8.png"]];//8 [imageArray addObject:[UIImage imageNamed:@"9.png"]];//9 [imageArray addObject:[UIImage imageNamed:@"10.png"]];//10 [imageArray addObject:[UIImage imageNamed:@"11.png"]];//11 [imageArray addObject:[UIImage imageNamed:@"12.png"]];//12 [imageArray addObject:[UIImage imageNamed:@"13.png"]];//13 [imageArray addObject:[UIImage imageNamed:@"14.png"]];//14 [imageArray addObject:[UIImage imageNamed:@"15.png"]];//15 } if([MemoryManager sharedMemoryManager].themeName == @"letters"){ NSLog(@"Here 3"); //[imageArray removeAllObjects]; [imageArray addObject:[UIImage imageNamed:@"a0.png"]]; // [imageArray addObject:[UIImage imageNamed:@"a1.png"]];//1 [imageArray addObject:[UIImage imageNamed:@"a2.png"]];//2 [imageArray addObject:[UIImage imageNamed:@"a3.png"]];//3 [imageArray addObject:[UIImage imageNamed:@"a4.png"]];//4 [imageArray addObject:[UIImage imageNamed:@"a5.png"]];//5 [imageArray addObject:[UIImage imageNamed:@"a6.png"]];//6 [imageArray addObject:[UIImage imageNamed:@"a7.png"]];//7 [imageArray addObject:[UIImage imageNamed:@"a8.png"]];//8 [imageArray addObject:[UIImage imageNamed:@"a9.png"]];//9 [imageArray addObject:[UIImage imageNamed:@"a10.png"]];//10 [imageArray addObject:[UIImage imageNamed:@"a11.png"]];//11 [imageArray addObject:[UIImage imageNamed:@"a12.png"]];//12 [imageArray addObject:[UIImage imageNamed:@"a13.png"]];//13 [imageArray addObject:[UIImage imageNamed:@"a14.png"]];//14 [imageArray addObject:[UIImage imageNamed:@"a15.png"]];//15 NSLog(@"Here 4"); } The log says 2010-05-26 21:30:57.092 Memory[22155:207] Here 1 2010-05-26 21:30:57.093 Memory[22155:207] THEME: letters 2010-05-26 21:30:57.095 Memory[22155:207] Here 3 2010-05-26 21:30:57.109 Memory[22155:207] Here 4 The images are in the same folder the .xproj file is. They simply is just not working. Any ideas? Cheers

    Read the article

  • XAML itemscontrol visibility

    - by Sam
    Hello, I have a ItemsControl in my XAML code. When some trigger occur i want to collapse the full itemsControl, so all the elements. <ItemsControl Name="VideoViewControl" ItemsSource="{Binding Videos}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel ItemHeight="120" ItemWidth="160" Name="wrapPanel1"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <views:VideoInMenuView /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> The trigger: <DataTrigger Value="videos" Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}, AncestorLevel=1}, Path=DataContext.VideosEnable}"> <Setter Property="ScrollViewer.Visibility" Value="Visible" TargetName="test1" /> <Setter Property="ScrollViewer.Visibility" Value="Collapsed" TargetName="test2" /> <Setter Property="WrapPanel.Visibility" Value="Collapsed" TargetName="wrapPanel1" /> </DataTrigger> When I add the last setter the program crashes. Without this last setter it works fine but no visibility change.... What is wrong with this code? What is the write method to collapse all the elements of a ItemsControl with a trigger?

    Read the article

  • Java error: Bad version number in .class file error when trying to run Cassandra on OS X

    - by Sam Lee
    I am trying to get Cassandra to work on OS X. When I run bin/cassandra, I get the following error: ~/apache-cassandra-incubating-0.4.1-src > bin/cassandra -f Listening for transport dt_socket at address: 8888 Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) From what I could determine by searching, this error is related to incompatible versions of Java. However, as far as I can tell, I have the latest version of Java: ~/apache-cassandra-incubating-0.4.1-src > java -version java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211) Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode) ~/apache-cassandra-incubating-0.4.1-src > javac -version javac 1.6.0_13 ~/Downloads/apache-cassandra-incubating-0.4.1-src > echo $JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home Any ideas on what I'm doing wrong?

    Read the article

  • Where/what is the specification for odata.service meta tag?

    - by Sam Saffron
    I would like to add some tags to our web app to enable auto-discovery of our odata feeds. So for example Nerd Dinner has the following tag: <link rel="odata.service" title="NerdDinner.com OData Service" href="/Services/OData.svc" /><link rel="odata.feed" title="NerdDinner.com OData Service - Dinners" href="/Services/OData.svc/Dinners" /> The trouble is that I have 4 different feeds and am unclear if I am allowed to add multiple link rel="odata.service" to the document. Where is the specification for this meta tag? (follow on question, are there any apps that take advantage of this tag that I can use to test out behavior)

    Read the article

  • PHP Object as XML Document

    - by Sam McAfee
    What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.

    Read the article

  • How to set up Mercurial with ssl/security

    - by Sam Lee
    I've been following the hginit.com tutorial on how to use mercurial. Everything is going fine except it uses push_ssl=False. This does not work for my situation because I want pushes (and pulls if possible) to be secure. All the tutorials I've been able to find also use push_ssl=False. Can anyone give me pointers on how to set up ssl/security for Mercurial? Thanks.

    Read the article

  • Visual Studio - How to disable autoformat/correct while running macro?

    - by Sam
    When running a macro that changes the selected text, tags are automatically closed and the text formatted. How can I prevent that from happening? For example, wrapping text in a tag: DTE.ActiveDocument.Selection.Text = String.Format("<tag>{0}</tag>", DTE.ActiveDocument.Selection.Text) Ends up with two closing tags: <tag>Text</tag></tag> Even stranger, multiple lines fails: <li>One</li> <li>Two</li> <li>Three</li> An ends up as <ul> <li>One</li> <li>Two</li> <li>Three</li></li></ul> How can I prevent that? As can be seen by the last example, the formatting is wrong and there is an extra </li>

    Read the article

  • Windows Service Webbrowser object invalid cast exception error

    - by Sam Youtsey
    Hi all, I'm having a bit of trouble with a Windows Service webbrowser object. It's attempting to load in values of username and password to a site but keeps failing and throwing the following error: System.InvalidCastException: Specified cast is not valid. at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation() at System.Windows.Forms.WebBrowser.get_Document() at MyWindowsService.MyDataProcessor.login() The code that I'm using to make this call is: MyWebBrowser.Document.All["Login"].SetAttribute("Value", username); MyWebBrowser.Document.All["Password"].SetAttribute("Value", password); MyWebBrowser.Document.All["submit"].InvokeMember("Click"); Any ideas as to why it keeps failing? Thanks in advance for the help.

    Read the article

  • Distributing APNS providers

    - by Sam
    I'm writing a business-focused iPhone app which includes a self-hosted server component. I'd like to include push notification functionality in the server; reading through the programming guide it looks as if this would involve either: Distributing the provider certificate with the server component - this doesn't sound like a terribly good idea (even if Apple permits it?) Hosting a shared notification provider and forwarding notifications to APNS from the servers. For an ongoing, high-availability service, this is likely to require including a subscription pricing component, which I would prefer to avoid. Require customers to apply for their own provider certificate. However, it's not clear whether multiple organisations are allowed to apply for provider certificates with a single bundle ID, and it would significantly increase the barrier to adoption. APNS looks to me as if it's specifically geared for centrally hosted services. Is anyone distributing self-hosted notification providers? Are there any other options?

    Read the article

  • How do I track down the source of a KVC exception: this class is not key value coding-compliant for

    - by sam
    I get this error when I try to run my app: 2010-04-29 13:49:01.355 MyApp[56123:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyViewController 0x5112b10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key toolbar.' MyViewController used to have an IBOutlet called 'toolbar' that connected to a UIToolbar object in a nib. I decided I no longer needed the toolbar or the nib so I removed them from the project. But Xcode seems to still want to refer to 'toolbar'. Where might the reference to toolbar be if I no longer use a nib? I can synthesize a dummy 'toolbar' property to appease Xcode, but I want to avoid this kind of ugly hack.

    Read the article

  • jQuery Validation rule inner HTML

    - by Sam Zhou
    As we know, jquery.validation.js is very powerful. In common, we should define the rule in js first, and then apply to input element or form. I'd like to declare the rule inner HTML code, then validator to find and apply the rule. just as below: <input MaxLength="10" id="StrField" class="required" name="StrField" type="text" value="Test" /> I have used to rules: required MaxLength My question is all the rules in jquery.validation could be wrote in HTML tag using attribute, and where I could get the document? can the jquery.metadata help for this?

    Read the article

  • Runtime Version of ILMerge'd assembly is v4.0.20926; expected version is v4.0.30319

    - by Sam
    This is what my .csproj AfterBuild looks like: <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'"> <Exec Command="&quot;..\Tools\ILMerge\ILMerge.exe&quot; /internalize /ndebug /out:@(MainAssembly) /targetplatform:v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319 &quot;@(IntermediateAssembly)&quot; @(ReferenceCopyLocalPaths->'&quot;%(FullPath)&quot;', ' ')" Condition=" '$(TargetFrameworkVersion)' == 'v4.0'" /> </Target> I'm running 64-bit Windows. I have tried changing the .NET Framework from ...\Microsoft.NET\Framework\... to ...\Microsoft.NET\Framework64\... but it didn't help. I also created ILMerge.exe.config in the ILMerge directory: <?xml version ="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/> </startup> </configuration> Why isn't ILMerge generating a 4.0.30319 assembly?

    Read the article

  • Getting XQuery [modify()]: Top-level attribute nodes are not supported error while modifying xml

    - by sam
    DECLARE @mycur CURSOR DECLARE @id int DECLARE @ParentNodeName varchar(max) DECLARE @NodeName varchar(max) DECLARE @NodeText varchar(max) SET @mycur = CURSOR FOR SELECT * FROM @temp OPEN @mycur FETCH NEXT FROM @mycur INTO @id,@ParentNodeName,@NodeName,@NodeText WHILE @@FETCH_STATUS = 0 BEGIN PRINT @id -- sample statements PRINT @ParentNodeName PRINT @NodeName SET @x.modify (' insert attribute status {sql:variable("@status")} as first into (/@ParentNodeName/@NodeName/child::*[position()=sql:variable("@status")])[1] ') FETCH NEXT FROM @mycur INTO @id,@ParentNodeName,@NodeName,@NodeText END DEALLOCATE @mycur Any idea why I am getting this error as query works fine if I manually insert path

    Read the article

  • iPhone - Native App GeoLocation VS Web App GeoLocation

    - by Sam
    Here's my situation; I've built a very simple web app that looks up a users location and plots it on a Google map. Here's my code: http://pastebin.com/d3a185efd When I test it, my location is detected as being = 500 meters from where I actually stand. BUT When I open up Google Maps or Gowalla my location is correct to within <20 meters? So my question is: Do native iPhone apps benefit from a higher accuracy rate than web apps? If so, why?

    Read the article

  • Passing events in JMS

    - by sam
    I'm new in JMS. In my program, My Problem is that , I want to pass 4 events(classes) (callEvent, agentEvent, featureEvent, eventListenerExit) from the JMSQueue Program , who i m mention below. How can I do this? // (JmsSender.java) package com.apac.control.helper; import java.util.Calendar; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.InitialContext; import com.apac.control.api.CallData; import com.apac.control.exception.CtiException; import library.cti.CtiEventDocument; import library.cti.impl.CtiEventDocumentImpl; public final class JmsSender { private QueueConnectionFactory factory; private Queue queue; private QueueConnection connection; private QueueSession session; private QueueSender sender; private String sessionId; private String deviceId; private String centerId; private String switchId; public JmsSender(String queueJndiName, String sessionId, String deviceId, String centerId, String switchId) throws CtiException { this.sessionId = sessionId; this.deviceId = deviceId; this.centerId = centerId; this.switchId = switchId; try { InitialContext ic = new InitialContext(); factory = (QueueConnectionFactory) ic.lookup("javax/jms/QueueConnectionFactory"); queue = (Queue) ic.lookup(queueJndiName); } catch (Exception e) { throw new CtiException("CTI. Error creating JmsSender.", e); } } public String getCenterId() { return centerId; } public String getDeviceId() { return deviceId; } public String getSwitchId() { return switchId; } public void connect() throws CtiException { try { connection = factory.createQueueConnection(); } catch (Exception e) { throw new CtiException("CTI000. Error connecting to cti queue."); } } public void close() throws CtiException { try { connection.close(); } catch (Exception e) { throw new CtiException("CTI000. Error closing queue."); } } public void send(String eventType, CallData call, long seqId) throws CtiException { // prepare the message CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setSequenceId(seqId); ce.setCallId("" + call.getCallId()); ce.setUcid(call.getUCID()); ce.setEventType(eventType); ce.setDnisNumber(call.getDnisNumber()); ce.setAniNumber(call.getAniNumber()); ce.setApplicationData(call.getApplicationData()); ce.setQueueNumber(call.getQueueNumber()); ce.setCallingNumber(call.getCallingNumber()); if (call instanceof ManualCall) { ce.setManual("yes"); } try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } public void send(String eventType, String agentId, String agentMode, long seqId) throws CtiException { CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setSequenceId(seqId); ce.setEventType(eventType); ce.setAgentId(agentId); ce.setAgentMode(agentMode); try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } public void sendError(String errCode, String errMsg) throws CtiException { CtiEventDocument ced = this.createBaseCtiDocument(); CtiEventDocument ce = ced.getCtiEvent(); ce.setEventType("Error"); ce.setErrorCode(errCode); ce.setErrorMessage(errMsg); try { sendMessage(ced.toString()); } catch (Exception e) { throw new CtiException("CTI051. Error sending message.", e); } } private CtiEventDocument createBaseCtiDocument() { CtiEventDocument ced = CtiEventDocument.Factory.newInstance(); CtiEventDocument ce = ced.addNewCtiEvent(); ce.setSessionId(sessionId); ce.setSwitchId(switchId); ce.setCenterId(centerId); ce.setDeviceId(deviceId); ce.setTime(Calendar.getInstance()); return ced; } // Synchronization protects session, which cannot be // accessed by more than one thread. We may more than // one thread here from Cti in some cases (for example // when customer is being transfered out and hangs the call // at the same time. synchronized void sendMessage(String msg) throws Exception { session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE); sender = session.createSender(queue); TextMessage txtMsg = session.createTextMessage(msg); sender.send(txtMsg); sender.close(); session.commit(); } }

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >