Search Results

Search found 20383 results on 816 pages for 'hello'.

Page 38/816 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • CSS - Which method is better?

    - by Joe
    Which is better in regards to processing time but also taking into account ease of use for a developer? .font_small{ font-size:10px; } .font_blue{ color:blue; } .font_red{ color:red; } <span class="font_small font_blue">Hello World!</span><br /> <span class="font_small font_red">Today's the day!</span> OR .font_blue_small{ color:blue; } .font_red_small{ color:red; } .font_blue_small .font_red_small { font-size:10px; } <span class="font_blue_small">Hello World!</span><br /> <span class="font_red_small">Today's the day!</span> OR .font_blue_small{ color:blue; font-size:10px; } .font_red_small{ color:red; font-size:10px; } <span class="font_blue_small">Hello World!</span><br /> <span class="font_red_small">Today's the day!</span> OR Another option I haven't though of yet...?

    Read the article

  • XmlSerialize a custom collection with an Attribute

    - by roomaroo
    I've got a simple class that inherits from Collection and adds a couple of properties. I need to serialize this class to XML, but the XMLSerializer ignores my additional properties. I assume this is because of the special treatment that XMLSerializer gives ICollection and IEnumerable objects. What's the best way around this? Here's some sample code: using System.Collections.ObjectModel; using System.IO; using System.Xml.Serialization; namespace SerialiseCollection { class Program { static void Main(string[] args) { var c = new MyCollection(); c.Add("Hello"); c.Add("Goodbye"); var serializer = new XmlSerializer(typeof(MyCollection)); using (var writer = new StreamWriter("test.xml")) serializer.Serialize(writer, c); } } [XmlRoot("MyCollection")] public class MyCollection : Collection<string> { [XmlAttribute()] public string MyAttribute { get; set; } public MyCollection() { this.MyAttribute = "SerializeThis"; } } } This outputs the following XML (note MyAttribute is missing in the MyCollection element): <?xml version="1.0" encoding="utf-8"?> <MyCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>Hello</string> <string>Goodbye</string> </MyCollection> What I want is <MyCollection MyAttribute="SerializeThis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>Hello</string> <string>Goodbye</string> </MyCollection> Any ideas? The simpler the better. Thanks.

    Read the article

  • Orphan IBM JVM process

    - by Nicholas Key
    Hi people, I have this issue about orphan IBM JVM process being created in the process tree: For example: C:\Program Files\IBM\WebSphere\AppServer\bin>wsadmin -lang jython -f "C:\Hello.py" Hello.py has the simple implementation: import time i = 0 while (1): i = i + 1 print "Hello World " + str(i) time.sleep(3.0) My machine has such JVM information: C:\Program Files\WebSphere\java\bin>java -verbose:sizes -version -Xmca32K RAM class segment increment -Xmco128K ROM class segment increment -Xmns0K initial new space size -Xmnx0K maximum new space size -Xms4M initial memory size -Xmos4M initial old space size -Xmox1624995K maximum old space size -Xmx1624995K memory maximum -Xmr16K remembered set size -Xlp4K large page size available large page sizes: 4K 4M -Xmso256K operating system thread stack size -Xiss2K java thread stack initial size -Xssi16K java thread stack increment -Xss256K java thread stack maximum size java version "1.6.0" Java(TM) SE Runtime Environment (build pwi3260sr6ifix-20091015_01(SR6+152211+155930+156106)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows Server 2003 x86-32 jvmwi3260sr6-20091001_43491 (JIT enabled, AOT enabled) J9VM - 20091001_043491 JIT - r9_20090902_1330ifx1 GC - 20090817_AA) JCL - 20091006_01 While the program is running, I tried to kill it and subsequently I found an orphan IBM JVM process in the process tree. Is there a way to fix this issue? Why is there an orphan process in the first place? Is there something wrong with my code? I really don't believe that my simplistic code is wrongly implemented. Any suggestions?

    Read the article

  • How to represent and insert into an ordered list in SQL?

    - by Travis
    I want to represent the list "hi", "hello", "goodbye", "good day", "howdy" (with that order), in a SQL table: pk | i | val ------------ 1 | 0 | hi 0 | 2 | hello 2 | 3 | goodbye 3 | 4 | good day 5 | 6 | howdy 'pk' is the primary key column. Disregard its values. 'i' is the "index" that defines that order of the values in the 'val' column. It is only used to establish the order and the values are otherwise unimportant. The problem I'm having is with inserting values into the list while maintaining the order. For example, if I want to insert "hey" and I want it to appear between "hello" and "goodbye", then I have to shift the 'i' values of "goodbye" and "good day" (but preferably not "howdy") to make room for the new entry. So, is there a standard SQL pattern to do the shift operation, but only shift the elements that are necessary? (Note that a simple "UPDATE table SET i=i+1 WHERE i=3" doesn't work, because it violates the uniqueness constraint on 'i', and also it updates the "howdy" row unnecessarily.) Or, is there a better way to represent the ordered list? I suppose you could make 'i' a floating point value and choose values between, but then you have to have a separate rebalancing operation when no such value exists. Or, is there some standard algorithm for generating string values between arbitrary other strings, if I were to make 'i' a varchar? Or should I just represent it as a linked list? I was avoiding that because I'd like to also be able to do a SELECT .. ORDER BY to get all the elements in order.

    Read the article

  • How to call a service operation at a REST style WCF endpoint uri?

    - by Dieter Domanski
    Hi, is it possible to call a service operation at a wcf endpoint uri with a self hosted service? I want to call some default service operation when the client enters the endpoint uri of the service. In the following sample these uris correctly call the declared operations (SayHello, SayHi): - http://localhost:4711/clerk/hello - http://localhost:4711/clerk/hi But the uri - http://localhost:4711/clerk does not call the declared SayWelcome operation. Instead it leads to the well known 'Metadata publishing disabled' page. Enabling mex does not help, in this case the mex page is shown at the endpoint uri. private void StartSampleServiceHost() { ServiceHost serviceHost = new ServiceHost(typeof(Clerk), new Uri( "http://localhost:4711/clerk/")); ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(typeof(IClerk), new WebHttpBinding(), ""); endpoint.Behaviors.Add(new WebHttpBehavior()); serviceHost.Open(); } [ServiceContract] public interface IClerk { [OperationContract, WebGet(UriTemplate = "")] Stream SayWelcome(); [OperationContract, WebGet(UriTemplate = "/hello/")] Stream SayHello(); [OperationContract, WebGet(UriTemplate = "/hi/")] Stream SayHi(); } public class Clerk : IClerk { public Stream SayWelcome() { return Say("welcome"); } public Stream SayHello() { return Say("hello"); } public Stream SayHi() { return Say("hi"); } private Stream Say(string what) { string page = @"<html><body>" + what + "</body></html>"; return new MemoryStream(Encoding.UTF8.GetBytes(page)); } } Is there any way to disable the mex handling and to enable a declared operation instead? Thanks in advance, Dieter

    Read the article

  • emacs: Inferior-mode python-shell appears "lagged"

    - by Begbie00
    Hi all - I'm a Python(3.1.2)/emacs(23.2) newbie teaching myself tkinter using the pythonware tutorial found here. Relevant code is pasted below the question. Question: when I click the Hello button (which should call the say_hi function) why does the inferior python shell (i.e. the one I kicked off with C-c C-c) wait to execute the say_hi print function until I either a) click the Quit button or b) close the root widget down? When I try the same in IDLE, each click of the Hello button produces an immediate print in the IDLE python shell, even before I click Quit or close the root widget. Is there some quirk in the way emacs runs the Python shell (vs. IDLE) that causes this "lagged" behavior? I've noticed similar emacs lags vs. IDLE as I've worked through Project Euler problems, but this is the clearest example I've seen yet. FYI: I use python.el and have a relatively clean init.el... (setq python-python-command "d:/bin/python31/python") is the only line in my init.el. Thanks, Mike === Begin Code=== from tkinter import * class App: def __init__(self,master): frame = Frame(master) frame.pack() self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) self.button.pack(side=LEFT) self.hi_there = Button(frame, text="Hello", command=self.say_hi) self.hi_there.pack(side=LEFT) def say_hi(self): print("hi there, everyone!") root = Tk() app = App(root) root.mainloop()

    Read the article

  • How can get dtrace to run the traced command with non-root priviledges ?

    - by Gyom
    OS X lacks linux's strace, but it has dtrace which is supposed to be so much better. However, I miss the ability to do simple tracing on individual commands. For example, on linux I can write strace -f gcc hello.c to caputre all system calls, which gives me the list of all the filenames needed by the compiler to compile my program (the excellent memoize script is built upon this trick) I want to port memoize on the mac, so I need some kind of strace. What I actually need is the list of files gcc reads and writes into, so what I need is more of a truss. Sure enough can I say dtruss -f gcc hello.c and get somewhat the same functionality, but then the compiler is run with root priviledges, which is obviously undesirable (apart from the massive security risk, one issue is that the a.out file is now owned by root :-) I then tried dtruss -f sudo -u myusername gcc hello.c, but this feels a bit wrong, and does not work anyway (I get no a.out file at all this time, not sure why) All that long story tries to motivate my original question: how do I get dtrace to run my command with normal user priviledges, just like strace does in linux ? Edit: is seems that I'm not the only one wondering how to do this: question #1204256 is pretty much the same as mine (and has the same suboptimal sudo answer :-)

    Read the article

  • seg fault at the end of program after executing everything?

    - by Fantastic Fourier
    Hello all, I wrote a quick program which executes every statement before giving a seg fault error. struct foo { int cat; int * dog; }; void bar (void * arg) { printf("o hello bar\n"); struct foo * food = (struct foo *) arg; printf("cat meows %i\n", food->cat); printf("dog barks %i\n", *(food->dog)); } void main() { int cat = 4; int * dog; dog = &cat; printf("cat meows %i\n", cat); printf("dog barks %i\n", *dog); struct foo * food; food->cat = cat; food->dog = dog; printf("cat meows %i\n", food->cat); printf("dog barks %i\n", *(food->dog)); printf("time for foo!\n"); bar(food); printf("begone!\n"); cat = 5; printf("cat meows %i\n", cat); printf("dog barks %i\n", *dog); // return 0; } which gives a result of cat meows 4 dog barks 4 cat meows 4 dog barks 4 time for foo! o hello bar cat meows 4 dog barks 4 begone! cat meows 5 dog barks 5 Segmentation fault (core dumped) I'm not really sure why it seg faults at the end? Any comments/insights are deeply appreciated.

    Read the article

  • problems with Console.SetOut in Release Mode?

    - by Matt Jacobsen
    i have a bunch of Console.WriteLines in my code that I can observe at runtime. I communicate with a native library that I also wrote. I'd like to stick some printf's in the native library and observe them too. I don't see them at runtime however. I've created a convoluted hello world app to demonstrate my problem. When the app runs, I can debug into the native library and see that the hello world is called. The output never lands in the textwriter though. Note that if the same code is run as a console app then everything works fine. C#: [DllImport("native.dll")] static extern void Test(); StreamWriter writer; public Form1() { InitializeComponent(); writer = new StreamWriter(@"c:\output.txt"); writer.AutoFlush = true; System.Console.SetOut(writer); } private void button1_Click(object sender, EventArgs e) { Test(); } and the native part: __declspec(dllexport) void Test() { printf("Hello World"); } Update: hamishmcn below started talking about debug/release builds. I removed the native call in the above button1_click method and just replaced it with a standard Console.WriteLine .net call. When I compiled and ran this in debug mode the messages were redirected to the output file. When I switched to release mode however the calls weren't redirected. Console redirection only seems to work in debug mode. How do I get around this?

    Read the article

  • HTML entity encoding (convert '<' to '&lt;') on iPhone in objective-c

    - by Markus
    I'm developing an application for the iPhone that has inApp-mail sending capabilities. So far so good, but now I want to avoid html-injections as some parts of the mail are user-generated texts. Basically I search for something like this: // inits NSString *sourceString = [NSString stringWithString:@"Hello world! Grüße dich Welt <-- This is in German."]; // ----- THAT'S WHAT I'M LOOKING FOR // pseudo-code | // V NSString *htmlEncodedString = [sourceString htmlEncode]; // log NSLog(@"source string: %@", sourceString); NSLog(@"encoded string: %@", htmlEncodedString); Expected output source string: Hello world! Grüße dich Welt <-- This is in German. encoded string: Hello world! Gr&#252;&#223;e dich Welt &lt;-- This is in German. I already googled and looked through several of SO's questions and answers, but all of them seem to be related to URL-encoding and that's not what I really need (I tried stringByAddingPercentEscapesUsingEncoding with no luck - it creates %C3%BC out of an 'ü' that should be an ü). A code sample would be really great (correcting mine?)... -- Thanks in advance, Markus

    Read the article

  • Indentation control while developing a small python like language

    - by sap
    Hello, I'm developing a small python like language using flex, byacc (for lexical and parsing) and C++, but i have a few questions regarding scope control. just as python it uses white spaces (or tabs) for indentation, not only that but i want to implement index breaking like for instance if you type "break 2" inside a while loop that's inside another while loop it would not only break from the last one but from the first loop as well (hence the number 2 after break) and so on. example: while 1 while 1 break 2 'hello world'!! #will never reach this. "!!" outputs with a newline end 'hello world again'!! #also will never reach this. again "!!" used for cout end #after break 2 it would jump right here but since I don't have an "anti" tab character to check when a scope ends (like C for example i would just use the '}' char) i was wondering if this method would the the best: I would define a global variable, like "int tabIndex" on my yacc file that i would access in my lex file using extern. then every time i find a tab character on my lex file i would increment that variable by 1. when parsing on my yacc file if i find a "break" keyword i would decrement by the amount typed after it from the tabIndex variable, and when i reach and EOF after compiling and i get a tabIndex != 0 i would output compilation error. now the problem is, whats the best way to see if the indentation got reduced, should i read \b (backspace) chars from lex and then reduce the tabIndex variable (when the user doesn't use break)? another method to achieve this? also just another small question, i want every executable to have its starting point on the function called start() should i hardcode this onto my yacc file? sorry for the long question any help is greatly appreciated. also if someone can provide an yacc file for python would be nice as a guideline (tried looking on Google and had no luck). thanks in advance.

    Read the article

  • Delayed_job not executing the perform method but emptying the job queue

    - by James
    I have a fresh rails 3 app, here's my Gemfile: source 'http://rubygems.org' gem 'rails', '3.0.0' gem 'delayed_job' gem 'sqlite3-ruby', :require = 'sqlite3' Here's the class that represents the job that I want to queue: class Me < Struct.new(:something) def perform puts "Hello from me" logger.info "Hello from me" logger.debug "Hello from me" raise Exception.new end end From the console with no workers running: irb(main):002:0> Delayed::Job.enqueue Me.new(1) => #<Delayed::Backend::ActiveRecord::Job id: 7, priority: 0, attempts: 0, handler: "--- !ruby/struct:Me \nsomething: 1\n", last_error: nil, run_at: "2010-12-29 07:24:11", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2010-12-29 07:24:11", updated_at: "2010-12-29 07:24:11"> Like I mentioned: there are no workers running: irb(main):003:0> Delayed::Job.all => [#<Delayed::Backend::ActiveRecord::Job id: 7, priority: 0, attempts: 0, handler: "--- !ruby/struct:Me \nsomething: 1\n", last_error: nil, run_at: "2010-12-29 07:24:11", locked_at: nil, failed_at: nil, locked_by: nil, created_at: "2010-12-29 07:24:11", updated_at: "2010-12-29 07:24:11">] I start a worker with script/delayed_job run The queue gets emptied: irb(main):006:0> Delayed::Job.all => [] However, nothing happens as a result of the puts, nothing is logged from the logger calls, and no exception is raised. I'd appreciate any help / insight or anything to try.

    Read the article

  • How to send an array of complex type in PHP using Soap_Client?

    - by xaguilars
    Hello I want to know how to send this array of complex data to a SOAP server (that uses .NET / IIS). <xs:complexType name="SampleStruct"> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="description" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="SampleStruct_Array"> <xs:complexContent> <xs:restriction base="soapenc:Array"> <xs:sequence/> <xs:attribute ref="soapenc:arrayType" n1:arrayType="ns1:SampleStruct[]"/> </xs:restriction> </xs:complexContent> </xs:complexType> Would this code be ok? : $data1 = new SampleStruct(); $data1->title="Hello world"; $data1->description="This is a sample description."; $data2 = new SampleStruct(); $data2->title="Hello world 2"; $data2->description="This is a sample description 2."; $client->__soapCall("sampleFunction", array( new SoapParam(new SoapVar(array($data1, $data2) , SOAP_ENC_ARRAY, "SampleStruct_Array", "http://www.w3.org/2001/XMLSchema"), "theSampleFunctionParamName") )); Am I doing it ok? I'm not very familiar with Web services... Thank you

    Read the article

  • iPhone Localization: simple project not working

    - by gonso
    Hello Im doing my first localized project and I've been fighting with it for several hours with no luck. I have to create an app that, based on the user selection, shows texts and images in different languages. I've read most of Apple's documents on the matter but I cant make a simple example work. This are my steps so far: 1) Create a new project. 2) Manually create a "en.lproj" directory in the projects folder. 3) Using TexEdit create file called "Localizable.strings" and store it in Unicode UTF-16. The file looks like this: /* Localizable.strings Multilanguage02 Created by Gonzalo Floria on 5/6/10. Copyright 2010 __MyCompanyName__. All rights reserved. */ "Hello" = "Hi"; "Goodbye" = "Bye"; 4) I drag this file to the Resources Folder on XCode and it appear with the "subdir" "en" underneath it (with the dropdown triangle to the left). If I try to see it on XCode it looks all wrong, whit lots of ? symbols, but Im guessing thats because its a UTF-16 file. Right? 5) Now on my view did load I can access this strings like this: NSString *translated; translated = NSLocalizedString(@"Hello", @"User greetings"); NSLog(@"Translated text is %@",translated); My problem is allowing the user to switch language. I have create an es.lproj with the Localizable.strings file (in Spanish), but I CANT access it. I've tried this line: [[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:@"es", nil] forKey:@"AppleLanguages"]; But that only works the NEXT time you load the application. Is there no way to allow the user to switch languages while running the application?? Do I have to implement my own Dictionary files and forget all about NSLocalizableString family? Thanks for ANY advice or pointers. Gonso

    Read the article

  • Doubts in executable and relocatable object file

    - by bala1486
    Hello, I have written a simple Hello World program. #include <stdio.h> int main() { printf("Hello World"); return 0; } I wanted to understand how the relocatable object file and executable file look like. The object file corresponding to the main function is 0000000000000000 <main>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: bf 00 00 00 00 mov $0x0,%edi 9: b8 00 00 00 00 mov $0x0,%eax e: e8 00 00 00 00 callq 13 <main+0x13> 13: b8 00 00 00 00 mov $0x0,%eax 18: c9 leaveq 19: c3 retq Here the function call for printf is callq 13. One thing i don't understand is why is it 13. That means call the function at adresss 13, right??. 13 has the next instruction, right?? Please explain me what does this mean?? The executable code corresponding to main is 00000000004004cc <main>: 4004cc: 55 push %rbp 4004cd: 48 89 e5 mov %rsp,%rbp 4004d0: bf dc 05 40 00 mov $0x4005dc,%edi 4004d5: b8 00 00 00 00 mov $0x0,%eax 4004da: e8 e1 fe ff ff callq 4003c0 <printf@plt> 4004df: b8 00 00 00 00 mov $0x0,%eax 4004e4: c9 leaveq 4004e5: c3 retq Here it is callq 4003c0. But the binary instruction is e8 e1 fe ff ff. There is nothing that corresponds to 4003c0. What is that i am getting wrong? Thanks. Bala

    Read the article

  • Test if string is URL encoded in PHP

    - by Psytronic
    Hey guys, I've looked through the PHP Docs and can't see anything to do with this, so how can I test if a string is URL encoded? Is it better to search the string for characters which would be encoded, which aren't, and if any exist then its not encoded, or use something like this which I've made function is_urlEncoded($string){ $test_string = $string; while(urldecode($test_string) != $test_string){ $test_string = urldecode($test_string); } return (urlencode($test_string) == $string)?True:False; } $t = "Hello World how are you?"; if(is_urlEncoded($sreq)){ print "Was Encoded.\n"; }else{ print "Not Encoded.\n"; print "Should be ".urlencode($sreq)."\n"; } Which works, however not in instances where this might occur $t = "Hello%2BWorld%2B%253E%2Bhow%2Bare%2Byou%253F"; I.e. where the string has been doubly encoded, or maybe this string $t = "Hello+World%2B%253E%2Bhow%2Bare%2Byou%253F"; I.e. where most has been doubly encoded, except for one space. (Yes I don't know when this string would ever occur, but you never know)

    Read the article

  • String Concatenation Issue

    - by Nano HE
    Hi, Could you please have a look at my code below. #!C:\Perl\bin\perl.exe use strict; use warnings; use Data::Dumper; my $fh = \*DATA; my $str1 = "listBox1.Items.Add(\""; my $str2 = "\")\;"; while(my $line = <$fh>) { $line=~s/^\s+//g; print $str1.$line.$str2; chomp($line); } __DATA__ Hello World Output: D:\learning\perl>test.pl listBox1.Items.Add("Hello ");listBox1.Items.Add("World "); D:\learning\perl> Style error. I want the style below. Is ther anything wrong about my code? thanks. D:\learning\perl>test.pl listBox1.Items.Add("Hello"); listBox1.Items.Add("World"); D:\learning\perl>

    Read the article

  • Regex to check if exact string exists

    - by Jayrox
    I am looking for a way to check if an exact string match exists in another string using Regex or any better method suggested. I understand that you tell regex to match a space or any other non-word character at the beginning or end of a string. However, I don't know exactly how to set it up. Search String: t String 1: Hello World, Nice to see you! t String 2: Hello World, Nice to see you! String 3: T Hello World, Nice to see you! I would like to use the search string and compare it to String 1, String 2 and String 3 and only get a positive match from String 1 and String 3 but not from String 2. Requirements: Search String may be at any character position in the Subject. There may or may not be a white-space character before or after it. I do not want it to match if it is part of another string; such as part of a word. For the sake of this question: I think I would do this using this pattern: /\bt\b/gi /\b{$search_string}\b/gi Does this look right? Can it be made better? Any situations where this pattern wouldn't work? Additional info: this will be used in PHP 5

    Read the article

  • Life Scope of Temporary Variable

    - by Yan Cheng CHEOK
    #include <cstdio> #include <string> void fun(const char* c) { printf("--> %s\n", c); } std::string get() { std::string str = "Hello World"; return str; } int main() { const char *cc = get().c_str(); // cc is not valid at this point. As it is pointing to // temporary string internal buffer, and the temporary string // has already been destroyed at this point. fun(cc); // But I am surprise this call will yield valid result. // It seems that the returned temporary string is valid within // scope (...) // What my understanding is, scope means {...} // Is this valid behavior guarantee by C++ standard? Or it depends // on your compiler vendor implementations? fun(get().c_str()); getchar(); } The output is : --> --> Hello World Hello, may I know the correct behavior is guarantee by C++ standard, or it depends on your compiler vendor implementations? I have tested this under VC2008 and VC6. Works fine for both.

    Read the article

  • iPhone --- 3DES Encryption returns "wrong" results?

    - by Jan Gressmann
    Hello fellow developers, I have some serious trouble with a CommonCrypto function. There are two existing applications for BlackBerry and Windows Mobile, both use Triple-DES encryption with ECB mode for data exchange. On either the encrypted results are the same. Now I want to implent the 3DES encryption into our iPhone application, so I went straight for CommonCrypto: http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-32207/CommonCrypto/CommonCryptor.h I get some results if I use CBC mode, but they do not correspond with the results of Java or C#. Anyway, I want to use ECB mode, but I don't get this working at all - there is a parameter error showing up... This is my call for the ECB mode... I stripped it a little bit: const void *vplainText; plainTextBufferSize = [@"Hello World!" length]; bufferPtrSize = (plainTextBufferSize + kCCBlockSize3DES) & ~(kCCBlockSize3DES - 1); plainText = (const void *) [@"Hello World!" UTF8String]; NSString *key = @"abcdeabcdeabcdeabcdeabcd"; ccStatus = CCCrypt(kCCEncrypt, kCCAlgorithm3DES, kCCOptionECBMode, key, kCCKeySize3DES, nil, // iv, not used with ECB plainText, plainTextBufferSize, (void *)bufferPtr, // output bufferPtrSize, &movedBytes); t is more or less the code from here: http://discussions.apple.com/thread.jspa?messageID=9017515 But as already mentioned, I get a parameter error each time... When I use kCCOptionPKCS7Padding instead of kCCOptionECBMode and set the same initialization vector in C# and my iPhone code, the iPhone gives me different results. Is there a mistake by getting my output from the bufferPtr? Currently I get the encrypted stuff this way: NSData *myData = [NSData dataWithBytes:(const void *)bufferPtr length:(NSUInteger)movedBytes]; result = [[NSString alloc] initWithData:myData encoding:NSISOLatin1StringEncoding]; It seems I almost tried every setting twice, different encodings and so on... where is my error?

    Read the article

  • VB.NET Two different approaches to generic cross-threaded operations; which is better?

    - by BASnappl
    VB.NET 2010, .NET 4 Hello, I recently read about using SynchronizationContext objects to control the execution thread for some code. I have been using a generic subroutine to handle (possibly) cross-thread calls for things like updating UI controls that utilizes Invoke. I'm an amateur and have a hard time understanding the pros and cons of any particular approach. I am looking for some insight on which approach might be preferable and why. Update: This question is motivated, in part, by statements such as the following from the MSDN page on Control.InvokeRequired. An even better solution is to use the SynchronizationContext returned by SynchronizationContext rather than a control for cross-thread marshaling. Method 1: Public Sub InvokeControl(Of T As Control)(ByVal Control As T, ByVal Action As Action(Of T)) If Control.InvokeRequired Then Control.Invoke(New Action(Of T, Action(Of T))(AddressOf InvokeControl), New Object() {Control, Action}) Else Action(Control) End If End Sub Method 2: Public Sub UIAction(Of T As Control)(ByVal Control As T, ByVal Action As Action(Of Control)) SyncContext.Send(New Threading.SendOrPostCallback(Sub() Action(Control)), Nothing) End Sub Where SyncContext is a Threading.SynchronizationContext object defined in the constructor of my UI form: Public Sub New() InitializeComponent() SyncContext = WindowsFormsSynchronizationContext.Current End Sub Then, if I wanted to update a control (e.g., Label1) on the UI form, I would do: InvokeControl(Label1, Sub(x) x.Text = "hello") or UIAction(Label1, Sub(x) x.Text = "hello") So, what do y'all think? Is one way preferred or does it depend on the context? If you have the time, verbosity would be appreciated! Thanks in advance, Brian

    Read the article

  • C++ MACRO that will execute a block of code and a certain command after that block.

    - by Poni
    void main() { int xyz = 123; // original value { // code block starts xyz++; if(xyz < 1000) xyz = 1; } // code block ends int original_value = xyz; // should be 123 } void main() { int xyz = 123; // original value MACRO_NAME(xyz = 123) // the macro takes the code code that should be executed at the end of the block. { // code block starts xyz++; if(xyz < 1000) xyz = 1; } // code block ends << how to make the macro execute the "xyz = 123" statement? int original_value = xyz; // should be 123 } Only the first main() works. I think the comments explain the issue. It doesn't need to be a macro but to me it just sounds like a classical "macro-needed" case. By the way, there's the BOOST_FOREACH macro/library and I think it does the exact same thing I'm trying to achieve but it's too complex for me to find the essence of what I need. From its introductory manual page, an example: #include <string> #include <iostream> #include <boost/foreach.hpp> int main() { std::string hello( "Hello, world!" ); BOOST_FOREACH( char ch, hello ) { std::cout << ch; } return 0; }

    Read the article

  • How to create view in RoR if skipped during controller generation

    - by swapnesh
    When I run this: rails generate controller hello index it no doubt generates hello controller, but accidentally when I run another command like this: rails generate controller world it creates the world controller successfully, but missed the Route "world/index" like as "hello/index". For this mistake I need to use destroy controller and then generate it once more, is thr some kind of mid way command that I can generate if forgotten something rather than destroying and creating every time. This command rails generate controller contact-us index creates a route as contact_us/index or contact_us after changing routes.rb under config folder. How could I create a more SEO friendly URL in RoR? Like localhost:3000/contact-us? I am working on some very basic rules to follow RoR..like 3 static pages (Home, About us, Contact Us) Just simple html content to understand more, will certainly add more features to it as well. localhost:3000/home localhost:3000/About_us localhost:3000/contact_us I created this via creating home, About_us, contact_us controller command and then changed html in views. Since I am on an initial phase, I read somewhere for static pages we can create this in our public like what we have error pages there in the folder or the approach im using is correct?

    Read the article

  • Simple problem with mod_rewrite in the Fat Free Framework

    - by ian
    I am trying to setup and learn the Fat Free Framework for PHP. http://fatfree.sourceforge.net/ It's is fairly simple to setup and I am running it on my machine using MAMP. I was able to get the 'hello world' example running just fin: require_once 'path/to/F3.php'; F3::route('GET /','home'); function home() { echo 'Hello, world!'; } F3::run(); But when I try to add in the second part, which has two routes: require_once 'F3/F3.php'; F3::route('GET /','home'); function home() { echo 'Hello, world!'; } F3::route('GET /about','about'); function about() { echo 'About Us.'; } F3::run(); I get a 404 error if I try the second URL: /about Not sure why one of the mod_rewrite commands would be working and not the other. Below is my .htaccess file: # Enable rewrite engine and route requests to framework RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [L,QSA] # Disable ETags Header Unset ETag FileETag none # Default expires header if none specified (stay in browser cache for 7 days) <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A604800 </IfModule>

    Read the article

  • VB.net avoiding cross thread exception with extension method

    - by user574632
    Hello I am trying to implement a solution for updating form controls without using a delegate. I am attempting to use the 1st solution on this page: http://www.dreamincode.net/forums/blog/143/entry-2337-handling-the-dreaded-cross-thread-exception/ Imports System.ComponentModel Imports System.Runtime.CompilerServices Public Module MyInvoke <Extension()> _ Public Sub CustomInvoke(Of T As ISynchronizeInvoke)(ByVal control As T, ByVal toPerform As Action(Of T)) If control.InvokeRequired Then control.Invoke(toPerform, New Object() {control}) toPerform(control) End If End Sub End Module The site gives this as example of how to use: Label1.CustomInvoke(l => l.Text = "Hello World!") But i get 'l' is not declared error. As you can see im very new to VB or any OOP. I can get the second solution on that page to work (using delegates) but i have quite a few things to do in this thread and it seems like i would need to write a new delegate sub for each thing, which seems wasteful. What i need to do is select the 1st item from a combobox, update a textbox.text with the selected item, and pass the selected item to a function. Then wait for x seconds and start again, selecting the second item. I can get it to work in a single threaded application, but i need the interface to remain responsive. Any help greatly appreciated. EDIT: OK so changing the syntax worked for the example. However if i change it from Label1.CustomInvoke(Sub(l) l.text = "hello world!") (which worked just fine) to: Dim indexnumber As Integer = 0 ComboBox1.CustomInvoke(Sub(l) l.SelectedIndex = indexnumber) I get a cross threading error as though i didnt even use this method: Cross-thread operation not valid: Control 'ComboBox1' accessed from a thread other than the thread it was created on. So now im back to where i started? Any further help very much appreciated.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >