Search Results

Search found 463 results on 19 pages for 'oliver lucas'.

Page 12/19 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Adding a ServiceReference programmatically during async postback

    - by Oliver
    Is it possible to add a new ServiceReference instance to the ScriptManager on the Page during an asynchronous postback so that subsequently I can use the referenced web service through client side script? I'm trying to do this inside a UserControl that sits inside a Repeater, that's why adding the ScriptReference programmatically during Page_Load does not work here. EDIT 2: This is the code I call from my UserControl which does not do what I expect (adding the ServiceReference to the ScriptManager during the async postback): private void RegisterWebservice(Type webserviceType) { var scm = ScriptManager.GetCurrent(Page); if (scm == null) throw new InvalidOperationException("ScriptManager needed on the Page!"); scm.Services.Add(new ServiceReference("~/" + webserviceType.Name + ".asmx")); } My goal is for my my UserControl to be as unobtrusive to the surrounding application as possible; otherwise I would have to statically define the ServiceReference in a ScriptManagerProxy on the containing Page, which is not what I want. EDIT: I must have been tired when I wrote this post... because I meant to write ServiceReference not ScriptReference. Updated the text above accordingly. Now I have: <asp:ScriptManagerProxy runat="server" ID="scmProxy"> <Services> <asp:ServiceReference Path="~/UsefulnessWebService.asmx" /> </Services> </asp:ScriptManagerProxy> but I want to register the webservice in the CodeBehind.

    Read the article

  • Objective-C : enum like Java (int values and many others for each enum)

    - by Oliver
    In Java, you can make an enum having multiples values. In objective-C, this cannot be done easily. I've read many pages about this but I didn't found anything satisfying that would allow me to use enums by a simple way and to keep the enum declaration and their different values in the same file. I would like to write something like this in a enums.h : // ======================================== typedef enum {eRED, eGREEN, eBLUE} ColorEnum; int colorValues[] = { 0xFF0000, 0x00FF00, 0x0000FF }; NSArray *colorNames = [NSArray arrayWithObjects:@"Red color", @"light green", @"Deep blue", nil]; // ======================================== and be able to use thoses global variables to manage my stuff anywhere like : int color = colorValues[eRED]; But I don't know how to write this. I have compile errors like "ColorValues" is defines many times. Or if I just use "static", I have many "ColorValues" not used in .m file... Could you help me ?

    Read the article

  • How to terminate a particular Azure worker role instance

    - by Oliver Bock
    Background I am trying to work out the best structure for an Azure application. Each of my worker roles will spin up multiple long-running jobs. Over time I can transfer jobs from one instance to another by switching them to a readonly mode on the source instance, spinning them up on the target instance, and then spinning the original down on the source instance. If I have too many jobs then I can tell Azure to spin up extra role instance, and use them for new jobs. Conversely if my load drops (e.g. during the night) then I can consolidate outstanding jobs to a few machines and tell Azure to give me fewer instances. The trouble is that (as I understand it) Azure provides no mechanism to allow me to decide which instance to stop. Thus I cannot know which servers to consolidate onto, and some of my jobs will die when their instance stops, causing delays for users while I restart those jobs on surviving instances. Idea 1: I decide which instance to stop, and return from its Run(). I then tell Azure to reduce my instance count by one, and hope it concludes that the broken instance is a good candidate. Has anyone tried anything like this? Idea 2: I predefine a whole bunch of different worker roles, with identical contents. I can individually stop and start them by switching their instance count from zero to one, and back again. I think this idea would work, but I don't like it because it seems to go against the natural Azure way of doing things, and because it involves me in a lot of extra bookkeeping to manage the extra worker roles. Idea 3: Live with it. Any better ideas?

    Read the article

  • What's the standard algorithm for syncing two lists of objects?

    - by Oliver Giesen
    I'm pretty sure this must be in some kind of text book (or more likely in all of them) but I seem to be using the wrong keywords to search for it... :( A common task I'm facing while programming is that I am dealing with lists of objects from different sources which I need to keep in sync somehow. Typically there's some sort of "master list" e.g. returned by some external API and then a list of objects I create myself each of which corresponds to an object in the master list. Sometimes the nature of the external API will not allow me to do a live sync: For instance the external list might not implement notifications about items being added or removed or it might notify me but not give me a reference to the actual item that was added or removed. Furthermore, refreshing the external list might return a completely new set of instances even though they still represent the same information so simply storing references to the external objects might also not always be feasible. Another characteristic of the problem is that both lists cannot be sorted in any meaningful way. You should also assume that initializing new objects in the "slave list" is expensive, i.e. simply clearing and rebuilding it from scratch is not an option. So how would I typically tackle this? What's the name of the algorithm I should google for? In the past I have implemented this in various ways (see below for an example) but it always felt like there should be a cleaner and more efficient way. Here's an example approach: Iterate over the master list Look up each item in the "slave list" Add items that do not yet exist Somehow keep track of items that already exist in both lists (e.g. by tagging them or keeping yet another list) When done iterate once more over the slave list Remove all objects that have not been tagged (see 4.) Update Thanks for all your responses so far! I will need some time to look at the links. Maybe one more thing worthy of note: In many of the situations where I needed this the implementation of the "master list" is completely hidden from me. In the most extreme cases the only access I might have to the master list might be a COM-interface that exposes nothing but GetFirst-, GetNext-style methods. I'm mentioning this because of the suggestions to either sort the list or to subclass it both of which is unfortunately not practical in these cases unless I copy the elements into a list of my own and I don't think that would be very efficient. I also might not have made it clear enough that the elements in the two lists are of different types, i.e. not assignment-compatible: Especially, the elements in the master list might be available as interface references only.

    Read the article

  • Using UNINSTALL_SHORTCUT Intent

    - by Lucas S.
    I am trying to use the following intent action, but i get an ActivityNotFoundException in the fisrt case. And nothing at all in the second case. "com.android.launcher.action.UNINSTALL_SHORTCUT" I try to use it with the following code: Intent i = new Intent ("com.android.launcher.action.UNINSTALL_SHORTCUT"); startActivity(i); Also with the following: Intent i = new Intent ("com.android.launcher.action.UNINSTALL_SHORTCUT"); sendBroadCast(i);

    Read the article

  • .htaccess mod_rewrite is preventing certain files from being served

    - by Lucas
    i have a successful use of mod_rewrite to make a site display as i wish... however, i have migrated the 'mock-up' folder to the root directory and in implementing these rules for the site, some files are not being served in the ^pdfs folder: RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] (old directory) RewriteRule ^redesign_03012010/mock-up/([^/]+)/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1&section=$2 [PT] RewriteRule ^redesign_03012010/mock-up/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1 [PT,L] (new directory) RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1&section=$2 [PT] RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [PT,L] ... ^pdfs (aka /pdfs/) is not serving the files... any suggestions?

    Read the article

  • How to find the first declaring method for a reference method

    - by Oliver Gierke
    Suppose you have a generic interface and an implementation: public interface MyInterface<T> { void foo(T param); } public class MyImplementation<T> implements MyInterface<T> { void foo(T param) { } } These two types are frework types. In the next step I want allow users to extend that interface as well as redeclare foo(T param) to maybe equip it with further annotations. public interface MyExtendedInterface extends MyInterface<Bar> { @Override void foo(Bar param); // Further declared methods } I create an AOP proxy for the extended interface and intercept especially the calls to furtherly declared methods. As foo(…) is no redeclared in MyExtendedInterface I cannot execute it by simply invoking MethodInvocation.proceed() as the instance of MyImplementation only implements MyInterface.foo(…) and not MyExtendedInterface.foo(…). So is there a way to get access to the method that declared a method initially? Regarding this example is there a way to find out that foo(Bar param) was declared in MyInterface originally and get access to the accoriding Method instance? I already tried to scan base class methods to match by name and parameter types but that doesn't work out as generics pop in and MyImplementation.getMethod("foo", Bar.class) obviously throws a NoSuchMethodException. I already know that MyExtendedInterface types MyInterface to Bar. So If I could create some kind of "typed view" on MyImplementation my math algorithm could work out actually.

    Read the article

  • What is difference between my atoi() calls?

    - by Lucas
    I have a big number stored in a string and try to extract a single digit. But what are the differences between those calls? #include <iostream> #include <string> int main(){ std::string bigNumber = "93485720394857230"; char tmp = bigNumber.at(5); int digit = atoi(&tmp); int digit2 = atoi(&bigNumber.at(5)) int digit3 = atoi(&bigNumber.at(12)); std::cout << "digit: " << digit << std::endl; std::cout << "digit2: " << digit2 << std::endl; std::cout << "digit3: " << digit3 << std::endl; } This will produce the following output. digit: 7 digit2: 2147483647 digit3: 57230 The first one is the desired result. The second one seems to me to be a random number, which I cannot find in the string. The third one is the end of the string, but not just a single digit as I expected, but up from the 12th index to the end of the string. Can somebody explain the different outputs to me? EDIT: Would this be an acceptable solution? char tmp[2] = {bigNumber.at(5), '\0'}; int digit = atoi(tmp); std::cout << "digit: " << digit << std::endl;

    Read the article

  • python-iptables: Cryptic error when allowing incoming TCP traffic on port 1234

    - by Lucas Kauffman
    I wanted to write an iptables script in Python. Rather than calling iptables itself I wanted to use the python-iptables package. However I'm having a hard time getting some basic rules setup. I wanted to use the filter chain to accept incoming TCP traffic on port 1234. So I wrote this: import iptc chain = iptc.Chain(iptc.TABLE_FILTER,"INPUT") rule = iptc.Rule() target = iptc.Target(rule,"ACCEPT") match = iptc.Match(rule,'tcp') match.dport='1234' rule.add_match(match) rule.target = target chain.insert_rule(rule) However when I run this I get this thrown back at me: Traceback (most recent call last): File "testing.py", line 9, in <module> chain.insert_rule(rule) File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1133, in insert_rule self.table.insert_entry(self.name, rbuf, position) File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1166, in new obj.refresh() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1230, in refresh self._free() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1224, in _free self.commit() File "/usr/local/lib/python2.6/dist-packages/iptc/__init__.py", line 1219, in commit raise IPTCError("can't commit: %s" % (self.strerror())) iptc.IPTCError: can't commit: Invalid argument Exception AttributeError: "'NoneType' object has no attribute 'get_errno'" in <bound method Table.__del__ of <iptc.Table object at 0x7fcad56cc550>> ignored Does anyone have experience with python-iptables that could enlighten on what I did wrong?

    Read the article

  • Mockito verify no more interactions but omit getters

    - by michael lucas
    Mockito api provides method: Mockito.verifyNoMoreInteractions(someMock); but is it possible in Mockito to declare that I don't want more interactions with a given mock with the exceptions of interactions with its getter methods? The simple scenario is the one in which I test that sut changes only certain properties of a given mock and lefts other properties untapped. In example I want to test that UserActivationService changes property Active on an instance of class User but does't do anything to properties like Role, Password, AccountBalance, etc. I'm open to criticism regarding my approach to the problem.

    Read the article

  • JBoss Clustered Service that sends emails from txt file

    - by michael lucas
    I need a little push in the right direction. Here's my problem: I have to create an ultra-reliable service that sends email messages to clients whose addresses are stored in txt file on FTP server. Single txt file may contain unlimited number of entries. Most often the file contains about 300,000 entries. Service exposes interface with just two simple methods: TaskHandle sendEmails(String ftpFilePath); ProcessStatus checkProcessStatus(TaskHandle taskHandle); Method sendEmails() returns TaskHandle by which we can ask for ProcessStatus. For such a service to be reliable clustering is necessary. Processing single txt file might take a long time. Restarting one node in a cluster should have no impact on sending emails. We use JBoss AS 4.2.0 which comes with a nice HASingletonController that ensure one instance of service is running at given time. But once a fail-over happens, the second service should continue work from where the first one stopped. How can I share state between nodes in a cluster in such a way that leaves no possibility of sending some emails twice?

    Read the article

  • Having a different action for each button dynamically created in a loop

    - by Oliver
    Hi, use this website a lot but first time posting. My program creates a number of buttons depending on the number of records in a file. E.g. 5 records, 5 buttons. The buttons are being created but i'm having a problem with the action listener. If add the action listener in the loop every button does the same thing; but if I add the action listener outside the loop it just adds the action listener to last button. Any ideas? Here is what I have code-wise (I've just added the for loop to save space): int j=0; for(int i=0; i<namesA.size(); i++) { b = new JButton(""+namesA.get(i)+""); conPanel.add(b); conFrame.add(conPanel); b.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae2){ System.out.println(namesA.get(j)); } }}); j++; } Much Appreciated

    Read the article

  • ASP.Net Problem with Event Handlers and Control Creation Timing

    - by Oliver Weichhold
    What I am trying to achieve here is to display a number of LinkButtons in a RadGrid Column. The buttons are generated from a collection property member of the bound grid row item. The CollectionLinkButton control is nothing more than a asp:Panel derived control that populates its Child Controls from "DataItem.SomeCollection" and this is working fine. The problem I am facing is with this part: Collection='<%# DataBinder.Eval(Container, "DataItem.SomeCollection") %' This is because databound Collection Property is populated so late in the lifecycle of the page that the LinkButton Controls that the CollectionLinkButton class creates from the collection are not available yet during Postback when the Click event Handler is supposed to fire and I have currently no idea how to solve this problem. <radG:RadGrid ID="grid" runat="server" DataSourceID="ds_AB"> <MasterTableView> <Columns> <radG:GridTemplateColumn> <ItemTemplate> <local:CollectionLinkButton ID="LinkButton1" runat="server" CssClass="EntityLinkButton" Collection='<%# DataBinder.Eval(Container, "DataItem.SomeCollection") %>' CollectionProperty="Id" CollectionDisplayProperty="Name" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>'</local:CollectionLinkButton> </ItemTemplate> </radG:GridTemplateColumn>

    Read the article

  • Starting and stopping firefox from c#

    - by Lucas Meijer
    When I start /Applications/Firefox.app/Contents/MacOS/firefox-bin on MacOSX using Process.Start() using Mono, the id of the process that gets returned does not match the process that firefox ends up running under. It looks like firefox quickly decides to start another process, and kill the current one. This makes it difficult to stop firefox, and to detect if it is still running. I've tried starting firefox using the -no-remote flag, to no avail. Is there a way to start firefox in such a way that it doesn't do this "I'll quickly make a new process for you" dance? The situation can somewhat be detected by making sure Firefox keeps on running for at least 3 seconds after its start, and when it does not, scan for other firefox processes. However, this technique is shaky at best, as on slow days it might take a bit more than 3 seconds, and then all tests depending on this behaviour fail. It turns out, that this behaviour only happens when asking firefox to start a specific profile using -P MyProfile. (Which I need to do, as I need to start firefox with specific proxyserver settings) If I start firefox "normally" it does stick to its process.

    Read the article

  • Recommendation on C# books

    - by Oliver Bayes-Shelton
    Hi, I am looking to buy my first c# book. At the moment amazon have a special offer on two titles: Sams Teach Yourself the C# Language Sams Teach Yourself Visual C# 2008 Is their a difference between visual C# and C#? Also which book would be better for an intro to C#?

    Read the article

  • NHibernate and hbm2dll update attribute

    - by michael lucas
    Hi, i'm using NHibernate with Sdf database. In my hibernate.cfg.xml file i've set: <property name="hbm2ddl.auto" value="update"/> But this does not seem to work at all. "Update" attribute should make NHibernate generate missing tables and columns during application launch, but it does not happen. If i want missing tables geenrated I have to set hbm2dll.auto property to "create" which is not an option for me since it drops existing db content beforehand. I experienced the same problem with PostgreSql problem. Am I missing something?

    Read the article

  • How can you tell if a person is a programmer?

    - by Lucas Jones
    I was wondering when I read the famous "Programmer Habits" thread, I was wondering: Is there any way to tell if somebody is a programmer without actually asking them? Clarification: I am asking for things that you can use to recognise a programmer from "afar" or without knowing them well. To identify habits, you need to be around a person for a certain amount of time.

    Read the article

  • How to make awkward pivot of sql table in SQL Server 2005?

    - by Oliver
    I have to rotate a given table from an SQL Server but a normal pivot just doesn't work (as far as i tried). So has anybody an idea how to rotate the table into the desired format? Just to make the problem more complicated, the list of given labels can vary and it is possible that a new label name can come into at any given time. Given Data ID | Label | Numerator | Denominator | Ratio ---+-----------------+-------------+---------------+-------- 1 | LabelNameOne | 41 | 10 | 4,1 1 | LabelNameTwo | 0 | 0 | 0 1 | LabelNameThree | 21 | 10 | 2,1 1 | LabelNameFour | 15 | 10 | 1,5 2 | LabelNameOne | 19 | 19 | 1 2 | LabelNameTwo | 0 | 0 | 0 2 | LabelNameThree | 15 | 16 | 0,9375 2 | LabelNameFive | 19 | 19 | 1 2 | LabelNameSix | 17 | 17 | 1 3 | LabelNameOne | 12 | 12 | 1 3 | LabelNameTwo | 0 | 0 | 0 3 | LabelNameThree | 11 | 12 | 0,9167 3 | LabelNameFour | 12 | 12 | 1 3 | LabelNameSix | 0 | 1 | 0 Wanted result ID | ValueType | LabelNameOne | LabelNameTwo | LabelNameThree | LabelNameFour | LabelNameFive | LabelNameSix ---+-------------+--------------+--------------+----------------+---------------+---------------+-------------- 1 | Numerator | 41 | 0 | 21 | 15 | | 1 | Denominator | 10 | 0 | 10 | 10 | | 1 | Ratio | 4,1 | 0 | 2,1 | 1,5 | | 2 | Numerator | 19 | 0 | 15 | | 19 | 17 2 | Denominator | 19 | 0 | 16 | | 19 | 17 2 | Ratio | 1 | 0 | 0,9375 | | 1 | 1 3 | Numerator | 12 | 0 | 11 | 12 | | 0 3 | Denominator | 12 | 0 | 12 | 12 | | 1 3 | Ratio | 1 | 0 | 0,9167 | 1 | | 0

    Read the article

  • Syncing with Address Book: Last modified property in ABPerson/ABRecord

    - by Oliver
    I'm syncing data from the Address Book into a Core Data database and I've nearly got it working perfectly. The only issue remaining is checking for changes and modifications on startup and reflecting the changes inside Core Data. Currently, I simply check the ID of each ABRecord and see if it is already in Core Data. Of course, this only works in the case of new contacts and not changed information inside an existing contact. One solution would be to go through each contact already in the database and check each property against the Address Book. The down side of this is that it's really slow. One method that would work is if the ABRecord had a last modified date. I could then store the date inside the Core Data database and check on startup to see if I need to update the contact. However, I can't find anything like this in the documentation. Any ideas?

    Read the article

  • How do I launch a subprocess in C# with an argv? (Or convert agrv to a legal arg string)

    - by lucas
    I have a C# command-line application that I need to run in windows and under mono in unix. At some point I want to launch a subprocess given a set of arbitrary paramaters passed in via the command line. For instance: Usage: mycommandline [-args] -- [arbitrary program] Unfortunately, System.Diagnostics.ProcessStartInfo only takes a string for args. This is a problem for commands such as: ./my_commandline myarg1 myarg2 -- grep "a b c" foo.txt In this case argv looks like : argv = {"my_commandline", "myarg1", "myarg2", "--", "grep", "a b c", "foo.txt"} Note that the quotes around "a b c" are stripped by the shell so if I simply concatenate the arguments in order to create the arg string for ProcessStartInfo I get: args = "my_commandline myarg1 myarg2 -- grep a b c foo.txt" Which is not what I want. Is there a simple way to either pass an argv to subprocess launch under C# OR to convert an arbitrary argv into a string which is legal for windows and linux shell? Any help would be greatly appreciated.

    Read the article

  • SharePoint Edit Tasklist Task

    - by Oliver S
    Hi, I have SharePoint setup, and for a test I added a Task List, added a few columns, and tested it out. I wanted to modify the task list task page, not the task list page. I can edit the task list page, but I cannot edit the task list task page. I am missing the Edit Page button from site actions on that page. How can I edit the page of the actual task? Thanks.

    Read the article

  • Mail "Can't continue" for a AppleScript function

    - by Paul J. Lucas
    I'm trying to write an AppleScript for use with Mail (on Snow Leopard) to save image attachments of messages to a folder. The main part of the AppleScript is: property ImageExtensionList : {"jpg", "jpeg"} property PicturesFolder : path to pictures folder as text property SaveFolderName : "Fetched" property SaveFolder : PicturesFolder & SaveFolderName tell application "Mail" set theMessages to the selection repeat with theMessage in theMessages repeat with theAttachment in every mail attachment of theMessage set attachmentFileName to theAttachment's name if isImageFileName(attachmentFileName) then set attachmentPathName to SaveFolder & attachmmentFileName save theAttachment in getNonexistantFile(attachmentPathName) end if end repeat end repeat end tell on isImageFileName(theFileName) set dot to offset of "." in theFileName if dot > 0 then set theExtension to text (dot + 1) thru -1 of theFileName return theExtension is in ImageExtensionList end if return false end isImageFileName When run, I get the error: error "Mail got an error: Can’t continue isImageFileName." number -1708 where error -1708 is: Event wasnt handled by an Apple event handler. However, if I copy/paste the isImageFileName() into another script like: property imageExtensionList : {"jpg", "jpeg"} on isImageFileName(theFileName) set dot to offset of "." in theFileName if dot > 0 then set theExtension to text (dot + 1) thru -1 of theFileName return theExtension is in ImageExtensionList end if return false end isImageFileName if isImageFileName("foo.jpg") then return true else return false end if it works fine. Why does Mail complain about this?

    Read the article

  • How to do "See Also" to a book using doxygen

    - by Paul J. Lucas
    The Javadoc @see allows a simple string as an argument to refer to something like a book, e.g.: @see "The Java Programming Language." As far as I can tell, the Doxygen \see offers no equivalent. Is there any way to have a book reference generated in the documentation, e.g.: See Also The C++ Programming Language, Bjarne Stroustrup, Addison-Wesley, 2000, section 19.4.1: The Standard Allocator ? Clarification This question is about how to do a "See Also" as part of a comment, e.g.: /** * Allocates memory in an amazing way. * \param size The number of bytes to allocate. * \return Returns a pointer to the start of the allocated memory. * \see MyOtherClass::alloc() * \see "The C++ Programming Language," Bjarne Stroustrup, Addison-Wesley, 2000, * section 19.4.1: The Standard Allocator. */ void* my_alloc( size_t size ); Of course the above does not work in Doxygen. Note that if there are multiple \see tags, they should be merged into a single "See Also" section (like the way \see normally works.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >