Daily Archives

Articles indexed Thursday June 28 2012

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

  • Add Controls to GroupBox which was created dynamically

    - by phil13131
    I add GroupBoxes to an ItemsControl dynamically using: string name_ = "TestName", header_ = "TestHeader" GroupBox MyGroupBox = new GroupBox { Name = name_, Header= header_, Width = 240, Height = 150, Foreground=new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)) }; MyItemsControl.Items.Add(MyGroupBox); Now I need to add content to this GroupBox, like a few TextBlocks created like: TextBlock MyTextBlock = new TextBlock {Text = "test"}; But I can't figure out how to do that. Normally to a Grid or something like that I would just use .Children.Add(MyTextBlock), but that doesn't work here. Also I have to be able to remove specific Items from the ItemsControl again (best would be by the name of the Item, name_ in this example).

    Read the article

  • Qthread - trouble shutting down threads

    - by Bryan Greenway
    For the last few days, I've been trying out the new preferred approach for using QThreads without subclassing QThread. The trouble I'm having is when I try to shutdown a set of threads that I created. I regularly get a "Destroyed while thread is still running" message (if I'm running in Debug mode, I also get a Segmentation Fault dialog). My code is very simple, and I've tried to follow the examples that I've been able to find on the internet. My basic setup is as follows: I've a simple class that I want to run in a separate thread; in fact, I want to run 5 instances of this class, each in a separate thread. I have a simple dialog with a button to start each thread, and a button to stop each thread (10 buttons). When I click one of the "start" buttons, a new instance of the test class is created, a new QThread is created, a movetothread is called to get the test class object to the thread...also, since I have a couple of other members in the test class that need to move to the thread, I call movetothread a few additional times with these other items. Note that one of these items is a QUdpSocket, and although this may not make sense, I wanted to make sure that sockets could be moved to a separate thread in this fashion...I haven't tested the use of the socket in the thread at this point. Starting of the threads all seem to work fine. When I use the linux top command to see if the threads are created and running, they show up as expected. The problem occurs when I begin stopping the threads. I randomly (or it appears to be random) get the error described above. Class that is to run in separate thread: // Declaration class TestClass : public QObject { Q_OBJECT public: explicit TestClass(QObject *parent = 0); QTimer m_workTimer; QUdpSocket m_socket; Q_SIGNALS: void finished(); public Q_SLOTS: void start(); void stop(); void doWork(); }; // Implementation TestClass::TestClass(QObject *parent) : QObject(parent) { } void TestClass::start() { connect(&m_workTimer, SIGNAL(timeout()),this,SLOT(doWork())); m_workTimer.start(50); } void TestClass::stop() { m_workTimer.stop(); emit finished(); } void TestClass::doWork() { int j; for(int i = 0; i<10000; i++) { j = i; } } Inside my main app, code called to start the first thread (similar code exists for each of the other threads): mp_thread1 = new QThread(); mp_testClass1 = new TestClass(); mp_testClass1->moveToThread(mp_thread1); mp_testClass1->m_socket.moveToThread(mp_thread1); mp_testClass1->m_workTimer.moveToThread(mp_thread1); connect(mp_thread1, SIGNAL(started()), mp_testClass1, SLOT(start())); connect(mp_testClass1, SIGNAL(finished()), mp_thread1, SLOT(quit())); connect(mp_testClass1, SIGNAL(finished()), mp_testClass1, SLOT(deleteLater())); connect(mp_testClass1, SIGNAL(finished()), mp_thread1, SLOT(deleteLater())); connect(this,SIGNAL(stop1()),mp_testClass1,SLOT(stop())); mp_thread1->start(); Also inside my main app, this code is called when a stop button is clicked for a specific thread (in this case thread 1): emit stop1(); Sometimes it appears that threads are stopped and destroyed without issue. Other times, I get the error described above. Any guidance would be greatly appreciated. Thanks, Bryan

    Read the article

  • Add/remove UILocalNotification based on changes in my settings bundle

    - by Daniel Chui
    I have an app that sends a notification at the same time everyday, reminding the user to enter data into it. However, I want to give the user teh option to disable this as this could get very annoying, so I have an "Enable alerts" in a custom settings bundle. My question is, when the user toggles the switch in the settings bundle, can I add/remove the notifications that are already scheduled without having to enter the app again? note: I'm building and supporting for iOS 4.2.1, and I don't konw why but under "notifications" in the settings app, my app does not appear. I see it on ios 5.x devices though

    Read the article

  • Constructor within a constructor

    - by Chiramisu
    Is this a bad idea? Does calling a generic private constructor within a public constructor create multiple instances, or is this a valid way of initializing class variables? Private Class MyClass Dim _msg As String Sub New(ByVal name As String) Me.New() 'Do stuff End Sub Sub New(ByVal name As String, ByVal age As Integer) Me.New() 'Do stuff End Sub Private Sub New() 'Initializer constructor Me._msg = "Hello StackOverflow" 'Initialize other variables End Sub End Class

    Read the article

  • Error building C program

    - by John
    Here are my 2 source files: main.c: #include <stdio.h> #include "part2.c" extern int var1; extern int array1[]; int main() { var1 = 4; array1[0] = 2; array1[1] = 4; array1[2] = 5; array1[3] = 7; display(); printf("---------------"); printf("Var1: %d", var1); printf("array elements:"); int x; for(x = 0;x < 4;++x) printf("%d: %d", x, array1[x]); return 0; } part2.c #include <stdio.h> int var1; int array1[4]; void display(void); void display(void) { printf("Var1: %d", var1); printf("array elements:"); int x; for(x = 0;x < 4;++x) printf("%d: %d", x, array1[x]); } When i try to compile the program this is what i get: Ld /Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Products/Debug/Test normal x86_64 cd /Users/John/Xcode/Test setenv MACOSX_DEPLOYMENT_TARGET 10.7 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -L/Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Products/Debug -F/Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Products/Debug -filelist /Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/Test.LinkFileList -mmacosx-version-min=10.7 -o /Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Products/Debug/Test ld: duplicate symbol _display in /Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/part2.o and /Users/John/Library/Developer/Xcode/DerivedData/Test-blxrdmnozbbrbwhcekmouessaprf/Build/Intermediates/Test.build/Debug/Test.build/Objects-normal/x86_64/main.o for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I am using Xcode and both files are inside of a C project called Test What is causing the error and how do i fix it?

    Read the article

  • Is a full html page needed when loading a page with jQuery mobile?

    - by Vincent Hiribarren
    I am currently looking at jQuery mobile and its system of loading web pages with XmlHttpRequest. Thanks to that it is possible to automatically perform transition animations between two pages, for instance. However, something is not clear to me. If I understand correctly, each new page of a jQuery mobile powered website is injected in the DOM of the initial web page. The documentation of jQuery mobile even tells that because of this mechanism, the <title> tag of new webpages are not taken into account. So, in a way, if my initial webpage A.html loads a page B.html, I would tend to think that the webpage B.html does not need to have a full HTML grammar with the <html>, <head> or <body> tags. My page B.html could directly begin with a <div> element. Am I right?Is a full html page needed when loading a HTML page with jQuery mobile?What are the pros and cons about having a webpage with a wrong/truncated HTML syntax (appart that this page should not be accessed directly but through the main page)?

    Read the article

  • Python Parse regex

    - by Nemo
    Let's say I have string in the form given below: myString={"name", "age", "address", "contacts", "Email"} I need to get all the items of myString into a List using python. Here's what I did r= re.search("myString=\{\"(.+)\", $\}", line) if r: items.append(r.group(1)) print(items) Here line is the variable that holds the content of my text file. What change do I have to make to my regex to get all the items in myString? Please kindly help me out. Thanks.

    Read the article

  • Error 100 When Attempting to post from app to Facebook wall?

    - by IMAPC
    I'm playing around with the Facebook API, and have gotten far enough to get the access token into my app, but when I go to actually send a post to my Facebook wall I get the error message, {"error":{"message":"(#100) You can't post this because it has a blocked link.","type":"OAuthException","code":100}}1 I'm not attempting to send any kind of link, just "Hello, World!" so this seems pretty weird to me :\ Here's my code so far: $content = urlencode("Hello, World!"); $accesstoken = urlencode($row['fbid']); $result = getPageWithPOST("https://graph.facebook.com/me/feed", "access_token=" . $accesstoken . "&message=" . $content); echo $result; where getPageWithPOST is, function getPageWithPOST($url, $posts) { $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $posts); $content = curl_exec ($c); curl_close ($c); return $content; } thanks!

    Read the article

  • Having to insert a record, then update the same record warrants 1:1 relationship design?

    - by dianovich
    Let's say an Order has many Line items and we're storing the total cost of an order (based on the sum of prices on order lines) in the orders table. -------------- orders -------------- id ref total_cost -------------- -------------- lines -------------- id order_id price -------------- In a simple application, the order and line are created during the same step of the checkout process. So this means INSERT INTO orders .... -- Get ID of inserted order record INSERT into lines VALUES(null, order_id, ...), ... where we get the order ID after creating the order record. The problem I'm having is trying to figure out the best way to store the total cost of an order. I don't want to have to create an order create lines on an order calculate cost on order based on lines then update record created in 1. in orders table This would mean a nullable total_cost field on orders for starters... My solution thus far is to have an order_totals table with a 1:1 relationship to the orders table. But I think it's redundant. Ideally, since everything required to calculate total costs (lines on an order) is in the database, I would work out the value every time I need it, but this is very expensive. What are your thoughts?

    Read the article

  • How to make a C program that can run x86 hex codes

    - by Iowa15
    I have an array of hex codes that translate into assembly instructions and I want to create program in C that can execute these. unsigned char rawData[5356] = { 0x4C, 0x01, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x0C, 0x00, 0x00, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x05, 0x00, 0x00, 0xA4, 0x01, 0x00, 0x00, 0x68, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x60, 0x2E, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x30, 0xC0, 0x2E, 0x62, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x30, 0xC0, 0x2F, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x58, 0x07, 0x00, 0x00, 0x32, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x10, 0x30, 0x60, 0x2F, 0x33, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x6C, 0x07, 0x00, 0x00,...and so on

    Read the article

  • MySQL Delete Records Older Than X Minutes?

    - by sajanNOPPIX
    I've searched quite a bit and found a few solutions that didn't end up working for me and can't understand why. I have a table with a timestamp column. The MySQL type for this column is 'datetime'. I insert into this table the following from PHP. date('Y-m-d H:i:s') This enters, what looks like the correct value for the MySQL date time. 2012-06-28 15:31:46 I want to use this column to delete rows that are older than say 10 minutes. I'm running the following query, but it's not working. It affects 0 rows. DELETE FROM adminLoginLog WHERE timestamp < (NOW() - INTERVAL 10 MINUTE); Can anyone shed some light as to what I'm doing wrong and why it's not working properly? Thanks. Update: It looks like my first issue is that I'm using DATETIME when I should be using the TIMESTAMP data type. I'm updating my code to do that now. Thanks.

    Read the article

  • My form php is not working and I can't figure out where I went wrong

    - by user1081524
    I'm fairly new to all this, but I've created a form, and this is what I've written to send it. I've used "[email protected]" here instead of the real address <?php /* Set e-mail recipient */ $myemail = "[email protected]"; /* Check all form inputs using check_input function */ $names = check_input($_POST['names'], "Please return to our Application Form and enter your and your future spouse's names."); $weddingtype = check_input($_POST['weddingtype'], "Please return to our Application Form and fill in what kind of wedding you will be having."); $religioussect = check_input($_POST['religioussect'], "Please return to our Application Form and tell us about your religion and wedding traditions."); $dateone = check_input($_POST['dateone'], "Please return to our Application Form and give us the date for at least one event."); $eventone = check_input($_POST['eventone'], "Please return to our Application Form and list at least one event."); $locationone = check_input($_POST['locationone'], "Please return to our Application Form and give us the location for at least one event."); $durationone = check_input($_POST['durationone'], "Please return to our Application Form and give us the duration of at least one event."); $typeone = check_input($_POST['typeone'], "Please return to our Application Form and tell us whether you would like video, photo or both for at least one event."); $datetwo = $_POST['datetwo']; $eventtwo = $_POST['eventtwo']; $locationtwo = $_POST['locationtwo']; $durationtwo = $_POST['durationtwo']; $typetwo = $_POST['typetwo']; $datethree = $_POST['datethree']; $eventthree = $_POST['eventthree']; $locationthree = $_POST['locationthree']; $durationthree = $_POST['durationthree']; $typethree = $_POST['typethree']; $datefour = $_POST['datefour']; $eventfour = $_POST['eventfour']; $locationfour = $_POST['locationfour']; $durationfour = $_POST['durationfour']; $typefour = $_POST['typefour']; $guests1 = check_input($_POST['guests1'], "Please return to our Application Form and tell us how many guests will attend at least one event."); $guests2 = $_POST['guests2']; $guests3 = $_POST['guests3']; $guests4 = $_POST['guests4']; $concerns = $_POST['concerns']; if(!isset($_POST['submit'])){ $subject = "Quote Application"; /*Message for the e-mail */ $message = "Hello! Another happy couple has filled out a Quote Application Form :D Hooray! Their names are $names. What sort of wedding are they having? '$weddingtype'. What religious sect and wedding traditions are they following? '$religioussect'. Now for their wedding events... Ooh boy! 1. $dateone $eventone $durationone $typeone Estimated guests: $guests1 $locationone 2. $datetwo $eventtwo $durationtwo $typetwo Estimated guests: $guests2 $locationtwo 3. $datethree $eventthree $durationthree $typethree Estimated guests: $guests3 $locationthree 4. $datefour $eventfour $durationfour $typefour Estimated guests: $guests4 $locationfour Any concerns the couple have follow here: '$concerns' You better be ready to get to work now! And also, have a really good day :) "; /* Functions used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <b>We apologize for the inconvenience, an error occurred.</b><br /> <?php echo $myError; ?> <?php exit(); } /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); exit(); ?> Please help me find what I'm doing wrong, I'm barely a beginner here. Thanks in advance!

    Read the article

  • Objective-C property getter

    - by Daniel
    What is technically wrong with the following: @property(nonatomic, assign) NSUInteger timestamp; @property(nonatomic, readonly, getter = timestamp) NSUInteger startTime; @property(nonatomic, assign) NSUInteger endTime; I am sure I can find a better way to organise this, but this is what I ended up with at one point in my project and I noticed that accessing the startTime property always returned 0, even when the timestamp property was set to a correct timestamp. It seems having set the getter of startTime to an existing property (timestamp), it is not forwarding the value of timestamp when I do: event.startTime => 0 event.timestamp => 1340920893 All these are timestamps by the way. Just a reminder, I know the above should have happened in my project but I don't understand why accessing startTime doesn't forward onto timestamp property. UPDATE In my implementation I am synthesising all of these properties: @synthesize timestamp, endTime, startTime; Please check an example object to use that demonstrates this at my gist on GitHub: https://gist.github.com/3013951

    Read the article

  • What is the best way to lay out elements in GWT?

    - by KutaBeach
    What is the best practice to specify the positions of elements in GWT widget? Imagine you have a task: place a set of widgets in page layout. What would you use to position all your buttons and inputs in some order? standart HTML markup with tables/divs + CSS styles for positioning GWT widgets: panels, grids, tables + CSS styles for positioning GWT widgets: panels, grids, tables + their native properties for positioning If 2 or 3 - what would you use to reproduce a standart HTML table with colspans, fixed width columns and paddings? ps UIBinder and XML markup. GWT 2.4 My opinion: one of the biggest advantages of GWT is the ability to prevent programmer from writing HTML markup and add cross-browser support for interfaces. We shouldn't drop these points so its better to choose p.3 and try to use CSS ONLY for decoration - i.e. colors, fonts etc. Another point of view: its a bad idea to place any styles inline. By specifying properties of the widgets in XML markup we are literally doing exactly this. Also, GWT doesn't have enough widgets to produce a normal layout. For example you need to create a simple table with collspans and fixed column width. How would you go about this? Looks like you have to embed several HorizontalPanels into VerticalPanels, specify width/height in everyone of them and produce a great paper of XML by this. So whats your opinion?

    Read the article

  • Gson Deserialize to Java Tree

    - by MountainX
    I need to deserialize some JSON to a Java tree structure that contains TreeNodes and NodeData. TreeNodes are thin wrappers around NodeData. I'll provide the JSON and the classes below. I have looked at the usual Gson help sources, including here, but I can't seem to come up with the solution. Serialization works fine with Gson. The JSON below was produced by Gson. But deserialization is the problem I need help with. Can someone show me how to write the deserializer (or suggest an alternative approach using Gson best practices)? Here is my JSON. The "data" element corresponds to class NodeData, and the "subList" JSON element corresponds to Java class TreeNode. { "data": { "version": "032", "name": "root", "path": "/", "id": "1", "parentId": "0", "toolTipText": "rootNode" }, "subList": [ { "data": { "version": "032", "name": "level1", "labelText": "Some Label Text at Level1", "path": "/root", "id": "2", "parentId": "1", "toolTipText": "a tool tip for level1" }, "subList": [ { "data": { "version": "032", "name": "level1_1", "labelText": "Label level1_1", "path": "/root/level1", "id": "3", "parentId": "2", "toolTipText": "ToolTipText for level1_1" } }, { "data": { "version": "032", "name": "level1_2", "labelText": "Label level1_2", "path": "/root/level1", "id": "4", "parentId": "2", "toolTipText": "ToolTipText for level1_2" } } ] }, { "data": { "version": "032", "name": "level2", "path": "/root", "id": "5", "parentId": "1", "toolTipText": "ToolTipText for level2" }, "subList": [ { "data": { "version": "032", "name": "level2_1", "labelText": "Label level2_1", "path": "/root/level2", "id": "6", "parentId": "5", "toolTipText": "ToolTipText for level2_1" }, "subList": [ { "data": { "version": "032", "name": "level2_1_1", "labelText": "Label level2_1_1", "path": "/root/level2/level2_1", "id": "7", "parentId": "6", "toolTipText": "ToolTipText for level2_1_1" } } ] } ] } ] } Here are the Java classes: public class Tree { private TreeNode rootElement; private HashMap<String, TreeNode> indexById; private HashMap<String, TreeNode> indexByKey; private long nextAvailableID = 0; public Tree() { indexById = new HashMap<String, TreeNode>(); indexByKey = new HashMap<String, TreeNode>(); } public long getNextAvailableID() { return this.nextAvailableID; } ... [snip] ... } public class TreeNode { private Tree tree; private NodeData data; public List<TreeNode> subList; private HashMap<String, TreeNode> indexById; private HashMap<String, TreeNode> indexByKey; //this default ctor is used only for Gson deserialization public TreeNode() { this.tree = new Tree(); indexById = tree.getIdIndex(); indexByKey = tree.getKeyIndex(); this.makeRoot(); tree.setRootElement(this); } //makes this node the root node. Calling this obviously has side effects. public NodeData makeRoot() { NodeData rootProp = new NodeData(TreeFactory.version, "example", "rootNode"); String nextAvailableID = getNextAvailableID(); if (!nextAvailableID.equals("1")) { throw new IllegalStateException(); } rootProp.setId(nextAvailableID); rootProp.setParentId("0"); rootProp.setKeyPathOnly("/"); rootProp.setSchema(tree); this.data = rootProp; rootProp.setNode(this); indexById.put(rootProp.getId(), this); indexByKey.put(rootProp.getKeyFullName(), this); return rootProp; } ... [snip] ... } public class NodeData { protected static Tree tree; private LinkedHashMap<String, String> keyValMap; protected String version; protected String name; protected String labelText; protected String path; protected String id; protected String parentId; protected TreeNode node; protected String toolTipText;//tool tip or help string protected String imagePath;//for things like images; not persisted to properties protected static final String delimiter = "/"; //this default ctor is used only for Gson deserialization public NodeData() { this("NOT_SET", "NOT_SET", "NOT_SET"); } ... [snip] ... } Side note: The tree data structure is a bit strange, as it includes indexes. Obviously, this isn't a typical search tree. In fact, the tree is used mainly to create a hierarchical path element (String) in each NodeData element. (Example: "path": "/root/level2/level2_1".) The indexes are actually used for NodeData retrieval.

    Read the article

  • REST WCF service locks thread when called using AJAX in an ASP.Net site

    - by Jupaol
    I have a WCF REST service consumed in an ASP.Net site, from a page, using AJAX. I want to be able to call methods from my service async, which means I will have callback handlers in my javascript code and when the methods finish, the output will be updated. The methods should run in different threads, because each method will take different time to complete their task I have the code semi-working, but something strange is happening because the first time I execute the code after compiling, it works, running each call in a different threads but subsequent calls blocs the service, in such a way that each method call has to wait until the last call ends in order to execute the next one. And they are running on the same thread. I have had the same problem before when I was using Page Methods, and I solved it by disabling the session in the page but I have not figured it out how to do the same when consuming WCF REST services Note: Methods complete time (running them async should take only 7 sec and the result should be: Execute1 - Execute3 - Execute2) Execute1 -- 2 sec Execute2 -- 7 sec Execute3 -- 4 sec Output After compiling Output subsequent calls (this is the problem) I will post the code...I'll try to simplify it as much as I can Service Contract [ServiceContract( SessionMode = SessionMode.NotAllowed )] public interface IMyService { // I have other 3 methods like these: Execute2 and Execute3 [OperationContract] [WebInvoke( RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/Execute1", Method = "POST")] string Execute1(string param); } [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior( InstanceContextMode = InstanceContextMode.PerCall )] public class MyService : IMyService { // I have other 3 methods like these: Execute2 (7 sec) and Execute3(4 sec) public string Execute1(string param) { var t = Observable.Start(() => Thread.Sleep(2000), Scheduler.NewThread); t.First(); return string.Format("Execute1 on: {0} count: {1} at: {2} thread: {3}", param, "0", DateTime.Now.ToString(), Thread.CurrentThread.ManagedThreadId.ToString()); } } ASPX page <%@ Page EnableSessionState="False" Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RestService._Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <script type="text/javascript"> function callMethodAsync(url, data) { $("#message").append("<br/>" + new Date()); $.ajax({ cache: false, type: "POST", async: true, url: url, data: '"de"', contentType: "application/json", dataType: "json", success: function (msg) { $("#message").append("<br/>&nbsp;&nbsp;&nbsp;" + msg); }, error: function (xhr) { alert(xhr.responseText); } }); } $(function () { $("#callMany").click(function () { $("#message").html(""); callMethodAsync("/Execute1", "hello"); callMethodAsync("/Execute2", "crazy"); callMethodAsync("/Execute3", "world"); }); }); </script> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <input type="button" id="callMany" value="Post Many" /> <div id="message"> </div> </asp:Content> Web.config (relevant) <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> <standardEndpoints> <webHttpEndpoint> <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" /> </webHttpEndpoint> </standardEndpoints> </system.serviceModel> Global.asax void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}"); RouteTable.Routes.Add(new ServiceRoute("", new WebServiceHostFactory(), typeof(MyService))); }

    Read the article

  • filling in the holes in the result of a query

    - by ????? ????????
    my query is returning: +------+------+------+------+------+------+------+-------+------+------+------+------+-----+ | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Bla | +------+------+------+------+------+------+------+-------+------+------+------+------+-----+ | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 13 | | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 14 | | 0 | 0 | 0 | 0 | 0 | 9 | 0 | 0 | 0 | 0 | 8 | 37 | 29 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 374 | 30 | | 0 | 0 | 1 | 0 | 78 | 2 | 4 | 8 | 57 | 169 | 116 | 602 | 31 | | 156 | 255 | 79 | 75 | 684 | 325 | 289 | 194 | 407 | 171 | 584 | 443 | 32 | | 1561 | 2852 | 2056 | 796 | 2004 | 1755 | 879 | 1052 | 1490 | 1683 | 2532 | 2381 | 33 | | 4167 | 3841 | 4798 | 3399 | 4132 | 5849 | 3157 | 4381 | 4424 | 4487 | 4178 | 5343 | 34 | | 5472 | 5939 | 5768 | 4150 | 7483 | 6836 | 6346 | 6288 | 6850 | 7155 | 5706 | 5231 | 35 | | 5749 | 4741 | 5264 | 4045 | 6544 | 7405 | 7524 | 6625 | 6344 | 5508 | 6513 | 3854 | 36 | | 5464 | 6323 | 7074 | 4861 | 7244 | 6768 | 6632 | 7389 | 8077 | 8745 | 6738 | 5039 | 37 | | 5731 | 7205 | 7476 | 5734 | 9103 | 9244 | 7339 | 8970 | 9726 | 9089 | 6328 | 5512 | 38 | | 7262 | 6149 | 8231 | 6654 | 9886 | 9834 | 9306 | 10065 | 9983 | 9984 | 6738 | 5806 | 39 | | 5886 | 6934 | 7137 | 6978 | 9034 | 9155 | 7389 | 9437 | 9711 | 8665 | 6593 | 5337 | 40 | +------+------+------+------+------+------+------+-------+------+------+------+------+-----+ as you can see the BLA column starts from 13. i want it to start from 1, then 2, then 3 etc......I do not want any gaps in the data. The reason there are gaps is because all of the months are 0 for that specific bla how do i get the result set to include ALL values for BLA, even ones that will yield 0 for the months? here are the desired results: +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | Bla | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 14 | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | | … | … | … | … | … | … | … | … | … | … | … | … | … | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ here's my query: WITH CTE AS ( select sum(case when datepart(month,[datetime entered]) = 1 then 1 end) as Jan, sum(case when datepart(month,[datetime entered]) = 2 then 1 end) as Feb, sum(case when datepart(month,[datetime entered]) = 3 then 1 end) as Mar, sum(case when datepart(month,[datetime entered]) = 4 then 1 end) as Apr, sum(case when datepart(month,[datetime entered]) = 5 then 1 end) as May, sum(case when datepart(month,[datetime entered]) = 6 then 1 end) as Jun, sum(case when datepart(month,[datetime entered]) = 7 then 1 end) as Jul, sum(case when datepart(month,[datetime entered]) = 8 then 1 end) as Aug, sum(case when datepart(month,[datetime entered]) = 9 then 1 end) as Sep, sum(case when datepart(month,[datetime entered]) = 10 then 1 end) as Oct, sum(case when datepart(month,[datetime entered]) = 11 then 1 end) as Nov, sum(case when datepart(month,[datetime entered]) = 12 then 1 end) as Dec, DATEPART(yyyy,[datetime entered]) as [Year], bla= CASE WHEN datediff(d, CAST([datetime entered] as DATE), CAST([datetime completed] as DATE))*24 + CONVERT(CHAR(2),[datetime completed],108) >191 THEN 192 ELSE datediff(d, CAST([datetime entered] as DATE), CAST([datetime completed] as DATE))*24 + CONVERT(CHAR(2),[datetime completed],108) END --,datediff(d, CAST([datetime entered] as DATE), CAST([datetime completed] as DATE)) AS Sort_Days, --DATEPART(hour, [datetime completed] ) AS Sort_Hours from [TurnAround] group by datediff(d, CAST([datetime entered] as DATE), CAST([datetime completed] as DATE))*24 + CONVERT(CHAR(2),[datetime completed],108), DATEPART(yyyy,[datetime entered]) , [datetime entered] --[DateTime Completed] ) SELECT ISNULL(SUM(Jan),0) Jan, ISNULL(SUM(Feb),0) Feb, ISNULL(SUM(Mar),0) Mar, ISNULL(SUM(Apr),0) Apr, ISNULL(SUM(May),0) May, ISNULL(SUM(Jun),0) Jun, ISNULL(SUM(Jul),0) Jul, ISNULL(SUM(Aug),0) Aug, ISNULL(SUM(Sep),0) Sep, ISNULL(SUM(Oct),0) Oct, ISNULL(SUM(Nov),0) Nov, ISNULL(SUM(Dec),0) Dec, [year], --,Sort_Hours, --Sort_Days, A.RN Bla FROM ( SELECT *, RN=ROW_NUMBER() OVER(ORDER BY object_id) FROM sys.all_objects) A LEFT JOIN CTE B ON A.RN = CASE WHEN B.Bla > 191 THEN 192 ELSE B.Bla END WHERE A.RN BETWEEN 1 AND 192 GROUP BY A.RN,[year]

    Read the article

  • Querying a 3rd party website's database from my website

    - by Mong134
    The Goal: To retrieve information from a 3rd party database based off of a user's query on my ASP.NET website The Details: I need to be able to search 3rd-party websites for information relating to pharmaceutical drugs. Basically, here's what I've been tasked with: a user starts entering the name of a drug they're using in their experiments, and while they're typing a 3rd party website (e.g., here or here) is queried and suggestions are made based based off of what they've typed. Once they've made a selection, certain properties (molecular weight, chemical structure, etc) are retrieved from the 3rd party database and stored in our database. PharmaGKB.org's search bar is pretty much what I need to implement, but I need to access a 3rd party db. The site that I'm working on is ASP.NET/C#. The Problem: I don't really know where to start with this. There's a downloadable Perl example at the bottom of the page here, but it didn't really help me all that much. I'm at a loss as to how to implement this, or even find information about how to do it. The AJAX toolkit was suggested, but I'm not sure if that will solve the issue. JavaScript is also being considered, but again, I'm not sure if that will be sufficient, either. Perl Example Connection As a mentioned, here is a snippet from the Perl example given on the Pharmgkb.org site: my $call = SOAP::Lite -> readable (1) -> uri('SearchService') -> proxy('http://www.pharmgkb.org/services/SearchService') -> search ($ARGV[0]); However, I'm not sure how to implement this is C#/ASP.NET/JavaScript. There's a question on Stack Overflow about embedding Perl in C#, but it require a C wrapper as well, and I don't think that three languages is necessary or wise to solve this issue.

    Read the article

  • Delegate Methods Not Firing on Search Results Table

    - by Slinky
    All, I have a UITableView w/detail, with a Search bar, created from code. Works fine on selected items except it doesn't work when an item is clicked from the search results; no delegate methods fire. Never seen this type of behavior before so I don't know where the issue lies. I get the same behavior with standard table cells as well as custom table cells. Appreciate any guidance on this and thanks. Just Hangs Here //ViewController.h @interface SongsViewController : UITableViewController <UISearchBarDelegate,UISearchDisplayDelegate> { NSMutableArray *searchData; UISearchBar *searchBar; UISearchDisplayController *searchDisplayController; UITableViewCell *customSongCell; } //ViewController.m -(void)viewDidLoad { [super viewDidLoad]; CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, screenWidth, 88)]; [searchBar setShowsScopeBar:YES]; [searchBar setScopeButtonTitles:[[NSArray alloc] initWithObjects:@"Title",@"Style", nil]]; searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]; searchDisplayController.delegate = self; searchDisplayController.searchResultsDataSource = self; self.tableView.tableHeaderView = searchBar; //Load custom table cell UINib *songCellNib = [UINib nibWithNibName:@"SongItem" bundle:nil]; //Register this nib, which contains the cell [[self tableView] registerNib:songCellNib forCellReuseIdentifier:@"SongItemCell"]; // create a filtered list that will contain products for the search results table. SongStore *ps = [SongStore defaultStore]; NSArray *songObjects = [ps allSongs]; self.filteredListContent = [NSMutableArray arrayWithCapacity: [songObjects count]]; self.masterSongArr = [[NSMutableArray alloc] initWithArray:[ps allSongs]]; [self refreshData]; [self.tableView reloadData]; self.tableView.scrollEnabled = YES; }

    Read the article

  • SSIS Custom Control Task Debugging UI in BIDS and VS

    - by zeencat
    I've created a SSIS Custom Task in C# and I'm currently developing the UI. I was wondering if there is a better way of debugging the UI instead of compiling the project, copying the DLL's into the appropriate DTS folder and then opening the test Package within BIDS and then attaching the process to Visual Studio. This part I'm not bothered about but once you've tested the UI and made changes to UI within Visual Studio. I've got to recomplile the DLL's and then repeat the entire process. I've got to close BIDS and VS because they don't release the DLL's before I have to start the entire process over again. Does anyone have any tips to speed up this process. It's just so frustrating having to do this everytime.

    Read the article

  • Unit testing code which uses Umbraco v4 API

    - by Jason Evans
    I'm trying to write a suite of integration tests, where I have custom code which uses the Umbraco API. The Umbraco database lives in a SQL Server CE 4.0 database (*.sdf file) and I've managed to get that association working fine. My problem looks to be dependancies in the Umbraco code. For example, I would like to create a new user for my tests, so I try: var user = User.MakeNew("developer", "developer", "mypassword", "[email protected]", adminUserType); Now as you can see, I have pass a user type which is an object. I've tried two separate ways to create the user type, both of which fail due to a null object exception: var adminUserType = UserType.GetUserType(1); var adminUserType2 = new UserType(1); The problem is that in each case the UserType code calls it's Cache method which uses the HttpRuntime class, which naturally is null. My question is this: Can someone suggest a way of writing integration tests against Umbraco code? Will I have to end up using a mocking framework such as TypeMock or JustMock?

    Read the article

  • How can I apply a PSSM efficiently?

    - by flies
    I am fitting for position specific scoring matrices (PSSM aka Position Specific Weight Matrices). The fit I'm using is like simulated annealing, where I the perturb the PSSM, compare the prediction to experiment and accept the change if it improves agreement. This means I apply the PSSM millions of times per fit; performance is critical. In my particular problem, I'm applying a PSSM for an object of length L (~8 bp) at every position of a DNA sequence of length M (~30 bp) (so there are M-L+1 valid positions). I need an efficient algorithm to apply a PSSM. Can anyone help improve performance? My best idea is to convert the DNA into some kind of a matrix so that applying the PSSM is matrix multiplication. There are efficient linear algebra libraries out there (e.g. BLAS), but I'm not sure how best to turn an M-length DNA sequence into a matrix M x 4 matrix and then apply the PSSM at each position. The solution needs to work for higher order/dinucleotide terms in the PSSM - presumably this means representing the sequence-matrix for mono-nucleotides and separately for dinucleotides. My current solution iterates over each position m, then over each letter in word from m to m+L-1, adding the corresponding term in the matrix. I'm storing the matrix as a multi-dimensional STL vector, and profiling has revealed that a lot of the computation time is just accessing the elements of the PSSM (with similar performance bottlenecks accessing the DNA sequence). If someone has an idea besides matrix multiplication, I'm all ears.

    Read the article

  • Want to open Shadowbox gallery directly through Wordpress Navigation Menu

    - by Kevin A.
    I want to be able to open my shadowbox gallery in wordpress by directly clicking the portfolio link in the navbar. Right now it either opens the portfolio page I made with the gallery in it or opens images separately (without shadowbox), this was because I tried adding html to the Nav Label in the wordpress dashboard. Basically want to be able to add this html to the link in the menu dashboard while having the one PORTFOLIO link: <a href="/portfolio_images/fashion/01.jpg" rel="shadowbox[fashion]"> <a href="/portfolio_images/fashion/02.jpg" rel="shadowbox[fashion]"> <a href="/portfolio_images/fashion/03.jpg" rel="shadowbox[fashion]"> Thanks Main page with nav links

    Read the article

  • Mercurial Workflow for small team

    - by Tarski
    I'm working in a team of 3 developers and we have recently switched from CVS to Mercurial. We are using Mercurial by having local repositories on each of our workstations and pulling/pushing to a development server. I'm not sure this is the best workflow, as it is easy to forget to Push after a Commit, and 3 way merge conflicts can cause a real headache. Is there a better workflow we could use, as I think the complexity of distributed VC is outweighing the benefits at the moment. Thanks

    Read the article

  • Google I/O 2012 - Monetizing Digital Goods with Google Wallet

    Google I/O 2012 - Monetizing Digital Goods with Google Wallet Joel Leitch, Dan Zink, Pali Bhat Whether you're a game developer selling virtual goods or currencies, or a media developer selling news content, videos, music or any other premium digital media, having an simple way to process payments from your customers is important. In this session, we will walk through an explanation of Google Wallet for digital goods, the new features, and the improved pricing model for developers. In addition, Kabam will share their experience with Google Wallet and best practices for integration. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 307 13 ratings Time: 44:31 More in Science & Technology

    Read the article

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