Daily Archives

Articles indexed Sunday October 20 2013

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

  • Extract inputs from a pointer to array of characters in C / C++

    - by user2066884
    I am writing a command line utility but I cannot find a way to store the commands and arguments. so far I have the following but I get a Segmentation fault: int main(void) { char *command; char *args[MAX_LINE/2 + 1]; int should_run = 1; do{ cout << "cmd> "; int counter = 0; while(cin >> command) { strcpy(args[counter],command); counter++; } cout << args[0] << "\n"; } }

    Read the article

  • VS2012 equivalent of Eclipse's default Ctrl-Shift-O?

    - by x3chaos
    I'm used to Java (in Eclipse), which has its import statements, but I'm writing a DLL in Visual C# (in Visual Studio 2012), which has its using statements. I'm used to Eclipse's default keyboard shortcut Ctrl-Shift-O, which updates the list of import statements in the Java perspective, deleting unused imports and adding necessary imports found on the build path. Is there an equivalent operation in VS2012 with VC#? I've just been selecting the word, opening the Office-style popup, and added the "using" statement that way, but it conflicts with my workflow (read: I'm lazy and I like having my shortcuts).

    Read the article

  • About calling an subclass' overriding method when casted to its superclass

    - by Omega
    #include <iostream> class Vehicle { public: void greet() { std::cout << "Hello, I'm a vehicle"; } }; class Car : public Vehicle { public: void greet() { std::cout << "Hello, I'm a car"; } }; class Bike : public Vehicle { public: void greet() { std::cout << "Hello, I'm a bike"; } }; void receiveVehicle(Vehicle vehicle) { vehicle.greet(); } int main() { receiveVehicle(Car()); return 0; } As you can see, I'm trying to send a parameter of type Vehicle to a function, which calls greet(). Car and Bike are subclasses of Vehicle. They overwrite greet(). However, I'm getting "Hello, I'm a vehicle". I suppose that this is because receiveVehicle receives a parameter of type Vehicle instead of a specific subclass like Car or Bike. But that's what I want: I want this function to work with any subclass of Vehicle. Why am I not getting the expected output?

    Read the article

  • RegEx: difference between "(?:...) and normal parentheses

    - by N0thing
    >>> re.findall(r"(?:do|re|mi)+", "mimi") ['mimi'] >>> re.findall(r"(do|re|mi)+", "mimi") ['mi'] According to my understanding of the definitions, it should produce the same answer. The only difference between (...) and (?:...) should be whether or not we can use back-references later. Am I missing something? (...) Matches whatever regular expression is inside the parentheses, and indicates the start and end of a group; the contents of a group can be retrieved after a match has been performed, and can be matched later in the string with the \number special sequence, described below. To match the literals '(' or ')', use ( or ), or enclose them inside a character class: [(] [)]. (?:...) A non-capturing version of regular parentheses. Matches whatever regular expression is inside the parentheses, but the substring matched by the group cannot be retrieved after performing a match or referenced later in the pattern.

    Read the article

  • Selecting an option with given value

    - by Maven
    I am trying to select a particular option from a select list depending on the value, I have following markup: <select name="class" id="class"> <option value="1">679460ED-0B15-4ED9-B3C8-A8C276DF1C82</option> <option value="2">B99BF873-7DF0-4E7F-95FF-3F1FD1A26139</option> <option value="3">1DCD5AD7-F57C-414</option> <option value="4">6B0170AA-F044-4F9C-8BB8-31A51E452CE4</option> <option value="5">C6A8B</option> <option value="6">1BBD6FA4-335A-4D8F-8681-DFED317B8052</option> <option value="7">727D71AB-F7D1-4B83-9D6D-6BEEAAB</option> <option value="8">BC4DE8A2-C864-4C7C-B83C-EE2450AF11B1</option> <option value="9">AIR CONDITIONING SYSTEM</option> <option value="10">POWER GENERATION SYSTEM</option> </select> <script> selectThisValue('#class',3); </script> in .js function selectThisValue(element,value) { console.log(value); var elem = $(element + ' option[value=' + value + ']'); console.log(elem); elem.attr("selected", "selected"); } Results for console.log are as follows: 3 [prevObject: i.fn.i.init[1], context: document, selector: "#class option[value=3]", jquery: "1.10.2", constructor: function…] But this is not working, no errors are given but nothing happens also. Please help identifying the where am I wrong.

    Read the article

  • Merge Sort issue when removing the array copy step

    - by Ime Prezime
    I've been having an issue that I couldn't debug for quite some time. I am trying to implement a MergeSort algorithm with no additional steps of array copying by following Robert Sedgewick's algorithm in "Algorithm's in C++" book. Short description of the algorithm: The recursive program is set up to sort b, leaving results in a. Thus, the recursive calls are written to leave their result in b, and we use the basic merge program to merge those files from b into a. In this way, all the data movement is done during the course of the merges. The problem is that I cannot find any logical errors but the sorting isn't done properly. Data gets overwritten somewhere and I cannot determine what logical error causes this. The data is sorted when the program is finished but it is not the same data any more. For example, Input array: { A, Z, W, B, G, C } produces the array: { A, G, W, W, Z, Z }. I can obviously see that it must be a logical error somewhere, but I have been trying to debug this for a pretty long time and I think a fresh set of eyes could maybe see what I'm missing cause I really can't find anything wrong. My code: static const int M = 5; void insertion(char** a, int l, int r) { int i,j; char * temp; for (i = 1; i < r + 1; i++) { temp = a[i]; j = i; while (j > 0 && strcmp(a[j-1], temp) > 0) { a[j] = a[j-1]; j = j - 1; } a[j] = temp; } } //merging a and b into c void merge(char ** c,char ** a, int N, char ** b, int M) { for (int i = 0, j = 0, k = 0; k < N+M; k++) { if (i == N) { c[k] = b[j++]; continue; } if (j == M) { c[k] = a[i++]; continue; } c[k] = strcmp(a[i], b[j]) < 0 ? a[i++] : b[j++]; } } void mergesortAux(char ** a, char ** b, int l, int r) { if(r - l <= M) { insertion(a, l, r); return; } int m = (l + r)/2; mergesortAux(b, a, l, m); //merge sort left mergesortAux(b, a, m+1, r); //merge sort right merge(a+l, b+l, m-l+1, b+m+1, r-m); //merge } void mergesort(char ** a,int l, int r, int size) { static char ** aux = (char**)malloc(size * sizeof(char*)); for(int i = l; i < size; i++) aux[i] = a[i]; mergesortAux(a, aux, l, r); free(aux); }

    Read the article

  • Unique elements of list within list in python

    - by user2901061
    We are given a list of animals in different zoos and need to find which zoos have animals that are not in any others. The animals of each zoo are separated by spaces, and each zoo is originally separated by a comma. I am currently enumerating over all of the zoos to split each animal and create lists within lists for different zoos as such: for i, zoo in enumerate(zoos): zoos[i] = zoo.split() However, I then do not know how to tell and count how many of the zoos have unique animals. I figure it is something else with enumerate and possibly sets, but cannot get it down exactly. Any help is greatly appreciated. Thanks

    Read the article

  • printing reverse in singly link list using pointers

    - by theoneabhinav
    i have been trying this code. i think the logic is ok but the program terminates abruptly when the display_rev function is called here is code of display_rev void display_rev(emp_node *head) { emp_node *p=head, *q; while(p->next != NULL) p=p->next; while(p!=head || p==head){ q=head; display_rec(p); while(q->next != p) q=q->next; p=q; } } here is my whole code #include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> //Declarations=============================================================== typedef struct //employee record { int emp_id; char name[150]; char mob_no[11]; float salary; int proj[5]; struct emp_node *next; } emp_node; emp_node* add_rec(emp_node*); emp_node* create_db(emp_node*); emp_node* search_db(emp_node*, int); emp_node* delete_rec(emp_node*, int); void read_name(emp_node*); void read_mob(emp_node*); void display_db(emp_node*); void display_rec(emp_node*); void display_rev(emp_node*); void modify_rec(emp_node*); void swtch(emp_node*); //=========================================================================== int main() { char ans; emp_node *head = NULL; head = create_db(head); display_db(head); do { swtch(head); printf("\n\n\tDo you want to continue (y/n) : "); getchar(); scanf("%c", &ans); } while (ans == 'y' || ans == 'Y'); return 0; } //Definitions================================================================ emp_node* create_db(emp_node *head) //database creation { int i = 1, no; emp_node *p; printf("Enter number of employees:"); scanf("%d", &no); printf("\n\n"); head = (emp_node *) malloc(sizeof(emp_node)); head = add_rec(head); head->next = NULL; p = head; while (i < no) { p->next = (emp_node *) malloc(sizeof(emp_node)); p = p->next; p = add_rec(p); p->next = NULL; i++; } return head; } emp_node* add_rec(emp_node *p) //new record { int j; printf("\n\tEmployee ID : "); scanf("%d", &(p->emp_id)); printf("\n\tFirst Name:"); read_name(p); printf("\n\tMobile No.:"); read_mob(p); printf("\n\tSalary :"); scanf("%f", &(p->salary)); printf( "\n\tEnter \"1\" for the projects employee is working on, otherwise enter \"0\": \n"); for (j = 0; j < 5; j++) { printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); while (p->proj[j] != 1 && p->proj[j] != 0) { printf("\n\nInvalid entry!! Please re-enter."); printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); } } printf("\n\n\n"); return p; } void read_name(emp_node *p) //validation for name { int j, len; scanf("%s", p->name); len = strlen(p->name); for (j = 0; j < len; j++) { if (!isalpha(p->name[j])) { printf( "\n\n\tInvalid name!!Can contain only characters. Please Re-enter.\n"); printf("\n\tName : "); read_name(p); } } } void read_mob(emp_node *p) //validation for mobile no. { int j; scanf("%s", p->mob_no); while (strlen(p->mob_no) != 10) { printf("\n\nInvalid Mobile No!!Please Re-enter"); printf("\n\n\tMobile No.:"); read_mob(p); } for (j = 0; j < 10; j++) { if (!(48 <= p->mob_no[j] && p->mob_no[j] <= 57)) { printf( "\n\nInvalid Mobile No!!Can contain only digits. Please Re-enter."); printf("\n\n\tMobile No.:"); read_mob(p); } } } void display_db(emp_node *head) //displaying whole database { emp_node *p; p = head; printf("\n\n\t\t****** EMPLOYEE DATABASE ******\n"); printf( "\n=============================================================================="); printf("\n Id.\t Name\t\t Mobile No\t Salary\t Projects\n"); while (p != NULL) { display_rec(p); p = p->next; printf("\n\n\n"); } printf( "\n=============================================================================="); } void swtch(emp_node *head) //function for menu and switch case { int cho, x; emp_node *p; printf("\n\n\t\t****** MENU ******"); printf( "\n\n\t1. insert Record\n\t2. Search Record\n\t3. Modify Record\n\t4. Delete Record\n\t5. Display Reverse\n\t6. Exit"); printf("\n\tWhich operation do you want to perform? "); scanf("%d", &cho); switch (cho) { case 1: p=head; while(p->next != NULL) p=p->next; p->next = (emp_node *) malloc(sizeof(emp_node)); p=p->next; p = add_rec(p); p->next = NULL; display_db(head); break; case 2: printf("\n\n\tEnter employee ID whose record is to be Searched :"); scanf("%d", &x); p = search_db(head, x); if (p == NULL) printf("\n\nRecord not found."); else display_rec(p); break; case 3: printf("\n\n\tEnter employee ID whose record is to be modified :"); scanf("%d", &x); p = search_db(head, x); if (p == NULL) printf("\n\nRecord not found."); else modify_rec(p); display_db(head); break; case 4: printf("\n\n\tEnter employee ID whose record is to be deleted :"); scanf("%d", &x); head = delete_rec(head, x); display_db(head); break; case 5: display_rev(head); case 6: exit(0); default: printf("Invalid Choice!! Please try again."); } } emp_node* search_db(emp_node *head, int id) //search database { emp_node *p = head; while (p != NULL) { if (p->emp_id == id) return p; p = p->next; } return NULL; } void display_rec(emp_node *p) //display a single record { int j; printf("\n %d", p->emp_id); printf("\t %10s", p->name); printf("\t %10s", p->mob_no); printf("\t %05.2f", p->salary); printf("\t "); for (j = 0; j < 5; j++) { if (p->proj[j] == 1) printf(" %d,", j + 1); } } void modify_rec(emp_node *p) //modifying a record { int j, cho; char ch1, edt; do { printf( "\n\t1. Name\n\t2. Email Address\n\t3. Mobile No.\n\t4. Salary\n\t5. Date of birth\n\t6. Projects\n"); printf("Enter your choice : "); scanf("%d", &cho); switch (cho) { case 1: printf("\n\tPrevious name:%s", p->name); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New Name:"); read_name(p); } break; case 2: printf("\n\tPrevious Mobile No. : %s", p->mob_no); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New Mobile No. :"); read_mob(p); } break; case 3: printf("\n\tPrevious salary is : %f", p->salary); printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf("\n\tEnter New salary:"); scanf("%f", &(p->salary)); } break; case 4: printf("the employee is currently working on project no. "); for (j = 0; j < 5; j++) { if (p->proj[j] == 1) printf(" %d,", j + 1); } printf("\n\tDo you want to edit ? (y/n)"); getchar(); scanf("%c", &ch1); if (ch1 == 'y' || ch1 == 'Y') { printf( "\n\tEnter \"1\" for the projects employee is working on : \n"); for (j = 0; j < 5; j++) { printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); while (p->proj[j] != 1) { printf("\n\nInvalid entry!! Please re-enter."); printf("\n\t\tProject No. %d : ", j + 1); scanf("%d", &(p->proj[j])); } } } break; default: printf("\n\nInvalid Choice!! Please Try again."); } printf("\n\nDo you want to edit any other fields ?(y/n)"); getchar(); scanf("%c", &edt); } while (edt == 'y' || edt == 'Y'); } emp_node* delete_rec(emp_node *head, int id) //physical deletion of record { emp_node *p = head, *q; if (head->emp_id == id) { head = head->next; free(p); return head; } else { q = p->next; while (q->emp_id != id) { p = p->next; q = q->next; } if (q->next == NULL) p->next = NULL; else p->next = q->next; free(q); return head; } } void display_rev(emp_node *head) { emp_node *p=head, *q; while(p->next != NULL) p=p->next; while(p!=head || p==head){ q=head; display_rec(p); while(q->next != p) q=q->next; p=q; } }

    Read the article

  • Trouble setting FIrst view controller which will appear on App Startup

    - by Matte.Car
    I'm setting setting FIrst view controller which will appear on my App Startup. It should appear an UIView first time as a tutorial and, from second time, another standard view. In AppDelegate I wrote this: #import "AppDelegate.h" #import "TabBarController.h" #import "TutorialController.h" @implementation AppDelegate TabBarController * viewControllerStandard; // standard view TutorialController * viewControllerFirst; // tutorial view @synthesize window; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([@"1" isEqualToString:[[NSUserDefaults standardUserDefaults] objectForKey:@"Startup"]]) { window.rootViewController = viewControllerStandard; } else { window.rootViewController = viewControllerFirst; } [window makeKeyAndVisible]; return YES; } It doesn't return any alert but, launching app, after splashscreen, it appear only a black screen. Without that codes everything works fine. What could be wrong? Thank you!

    Read the article

  • Find subset with K elements that are closest to eachother

    - by Nima
    Given an array of integers size N, how can you efficiently find a subset of size K with elements that are closest to each other? Let the closeness for a subset (x1,x2,x3,..xk) be defined as: 2 <= N <= 10^5 2 <= K <= N constraints: Array may contain duplicates and is not guaranteed to be sorted. My brute force solution is very slow for large N, and it doesn't check if there's more than 1 solution: N = input() K = input() assert 2 <= N <= 10**5 assert 2 <= K <= N a = [] for i in xrange(0, N): a.append(input()) a.sort() minimum = sys.maxint startindex = 0 for i in xrange(0,N-K+1): last = i + K tmp = 0 for j in xrange(i, last): for l in xrange(j+1, last): tmp += abs(a[j]-a[l]) if(tmp > minimum): break if(tmp < minimum): minimum = tmp startindex = i #end index = startindex + K? Examples: N = 7 K = 3 array = [10,100,300,200,1000,20,30] result = [10,20,30] N = 10 K = 4 array = [1,2,3,4,10,20,30,40,100,200] result = [1,2,3,4]

    Read the article

  • Batch faulting in a to-many relationship for a collection of objects

    - by indragie
    Scenario: Let's say I have an entity called Author that has a to-many relationship called books to the Book entity (inverse relationship author). If I have an existing collection of Author objects, I want to fault in the books relationship for all of them in a single fetch request. Code This is what I've tried so far: NSArray *authors = ... // array of `Author` objects NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Book"]; fetchRequest.returnsObjectsAsFaults = NO; fetchRequest.predicate = [NSPredicate predicateWithFormat:@"author IN %@", authors]; Executing this fetch request does not result in the books relationship of the objects in the authors array being faulted in (inspected via logging). I've also tried doing the fetch request the other way around: NSArray *authors = ... // array of `Author` objects NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Author"]; fetchRequest.returnsObjectsAsFaults = NO; fetchRequest.predicate = [NSPredicate predicateWithFormat:@"SELF IN %@", authors]; fetchRequest.relationshipKeypathsForPrefetching = @[@"books"]; This doesn't fire the faults either. What's the appropriate way of going about doing this?

    Read the article

  • how to close layer that showed in other layer in cocos2d-iphone

    - by yegomo
    I have one layer called alayer, and there is a button called abutton, when click the button, another layer called blayer will show in alayer, not replaceScene, please look at the following code, alayer.m -(void)abuttonclicked:(id)sender { blayer *blayer = [blayer node]; blayer.position = ccp(1,1); [self addChild:blayer]; } blayer.m has a button called bbutton and string value called bstring, I want to click the b button, it will close blayer (remove blayer from alayer), and pass the string value bstring to alayer, please look at following code, -(void)bbuttonclicked:(id)sender { // how can do here to close its self(remove its self from alayer), and pass the bstring to alayer? } thanks. ps. I can use NSUserDefault to pass the string value, but I think it's a bad way to do this, is there another way to pass value?

    Read the article

  • For loop in Javascript runs only once

    - by user592748
    Here is my code. I do not quite understand why the for loop runs only once, both inner and outer. nodeList.length and innerNodeList.length show appropriate values when I generate alert messages. I see that both i and j do not increment beyond 0. Kindly point out anything wrong with the code. function getCategoryElements() { var newCategoryDiv = document.getElementById("category"); var nodeList = newCategoryDiv.childNodes; for (var i = 0; i < nodeList.length; ++i) { var innerNodeList = nodeList[i].childNodes; alert("innerNodeList Length" + innerNodeList.length.toString()); for (var j = 0; j < innerNodeList.length; ++j) { if (innerNodeList[j].nodeName == "SELECT") { alert("inside select Node value " + innerNodeList[j].nodeValue.toString()); document.getElementById("newCategories").value = document.getElementById("newCategories").value + '<%=delimiter%>' + innerNodeList[j].nodeValue; } else if (innerNodeList[j].nodeName == "TEXTAREA") { document.getElementById("newCategoriesData").value = document.getElementById("newCategoriesData").value + '<%=delimiter%>' + innerNodeList[j].nodeValue; } } } }

    Read the article

  • Sharing variable within different javascript file at client side

    - by Aman
    I was actually going through this link. which explains how we can share global variable across multiple js. but the point is what need to be done if I am getting some variable into one js and need to pass to another one mentioned in same document after the 1st one. approach which followed was: Script 1 <script type="text/javascript" src="js/client.js"></script> body added some hidden input with id myHiddenId, where values are set using client.js Script 2 <script type="text/javascript" src="js/anotherJS.js"></script> inside script 2 I am simply using $("#myHiddenId").val(); and using for my purpose. I want to know whether I am following correct approach, because that hidden field may have some data which client should not get aware of. is there any other way through which I can pass the variable values across the js files ? Since I am at beginner level hence digging up some resources/books but still no luck.

    Read the article

  • Why doesn't my test run tearDownAfterTestClass when it fails

    - by Memor-X
    in a test i am writing the setUpBeforeTests creates a new customer in the database who is then used to perform the tests with so naturally when i finish the test i should get rid of this test customer in tearDownAfterTestClass so that i can create then anew when i rerun the test and not get any false positives how when the tests all run fine i have no problem but if a test fails and i go to rerun it my setUpBeforeTests fails because i check for mysql errors in it like this try { if(!mysqli_query($connection,$query)) { $this->assertTrue(false); } } catch (Exception $exc) { $msg = '[tearDownAfterTestClass] Exception Error' . PHP_EOL . PHP_EOL; $msg .= 'Could not run query - '.mysqli_error($connection). PHP_EOL;; $this->fail($msg); } the error i get is that there is a primary key violation which is expected cause i'm trying to create a new customer using the same data (primary key is on email which is also used to log in) however that means when the test failed it didn't run tearDownAfterTestClass now i could just move everything in tearDownAfterTestClass to the start of setUpBeforeTests however to me that seems like bad programming since it defeates the purpose of even have tearDownAfterTestClass so i am wondering, why isn't my tearDownAfterTestClass running when a test fails NOTE: the database is a fundamental part of the system i'm testing and the database and system are on a separate development environment not the live one, the backup files for the database are almost 2 GBs and takes almost 1/2 an hour to restore, the purpose of the tear down is to remove any data we have added because of the test so that we don't have to restore the database every time we run the tests

    Read the article

  • SignalR Server Error "The ConnectionId is in the incorrect format." with SignalR-ObjC Library

    - by ozzotto
    Before asking a separate question I've done lots of googling about it and added a comment in the already existing stackoverflow question. I have a SignalR Hub (tried both v. 1.1.3 and 2.0.0-rc) in my server with the below code: [HubName("TestHub")] public class TestHub : Hub { [Authorize] public void TestMethod(string test) { //some stuff here Clients.Caller.NotifyOnTestCompleted(); } } The problem persists if I remove the Authorize attribute. And in my iOS client I try to call it with the below code: SRHubConnection *hubConnection = [SRHubConnection connectionWithURL:_baseURL]; SRHubProxy *hubProxy = [hubConnection createHubProxy:@"TestHub"]; [hubProxy on:@"NotifyOnTestCompleted" perform:self selector:@selector(stopConnection)]; hubConnection.started = ^{ [hubProxy invoke:@"TestMethod" withArgs:@[@"test"]]; }; //received, error handling [hubConnection start]; When the app starts the user is not logged in and there is no open SignalR connection. The users logs in by calling a Login service in the server which makes use of WebSecurity.Login method. If the login service returns success I then make the above call to SignalR Hub and I get the server error 500 with description "The ConnectionId is in the incorrect format.". The full server stacktrace is the following: Exception information: Exception type: InvalidOperationException Exception message: The ConnectionId is in the incorrect format. at Microsoft.AspNet.SignalR.PersistentConnection.GetConnectionId(HostContext context, String connectionToken) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Request information: Request URL: http://myserverip/signalr/signalr/connect?transport=webSockets&connectionToken=axJs EQMZxpmUopL36owSUkdhNs85E0fyB2XvV5R5znZfXYI/CiPbTRQ3kASc3 mq60cLkZU7coYo1P fbC0U1LR2rI6WIvCNIMOmv/mHut/Unt9mX3XFkQb053DmWgCan5zHA==&connectionData=[{"Name":"testhub"}] Request path: /signalr/signalr/connect User host address: User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\DefaultAppPool Thread information: Thread ID: 14 Thread account name: IIS APPPOOL\DefaultAppPool Is impersonating: True Stack trace: at Microsoft.AspNet.SignalR.PersistentConnection.GetConnectionId(HostContext context, String connectionToken) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.ProcessRequest(HostContext context) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(IDictionary`2 environment) at Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) I understand this is some kind of authentication and user identity mismatching but up to now I have found no way of solving it. All other questions suggest stoping the opened connection when the user identity changes but as I mentioned above I have no open connection before the user logs in successfully. Any help would be much appreciated. Thank you.

    Read the article

  • Ruby on Rails / PostgreSQL - Library not Loaded error when starting server- libq.5.dylib

    - by Mike McCoy
    I have app that is running Ruby 1.9.2, Rails 3, and postgreSQL 8.3. It was originally setup and working with postgreSQL 9.1, but I uninstalled 9.1 and installed and changed to 8.3 insure compatibility on a Heroku shared database setup. It was running ok, but it's not now Now, when working on this app, when I run a database upgrade I get this error: dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib Referenced from: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle Reason: no suitable image found. Did find: /usr/lib/libpq.5.dylib: no matching architecture in universal wrapper - /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle And when I try to run the server I get this error message: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg.rb:4:in `require': dlopen(/Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: libpq.5.dylib (LoadError) Referenced from: /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle Reason: no suitable image found. Did find: /usr/lib/libpq.5.dylib: no matching architecture in universal wrapper - /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg_ext.bundle from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/pg-0.12.2/lib/pg.rb:4:in `<top (required)>' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' from /Users/michaeljmccoy/www/mikemccoy/config/application.rb:7:in `<top (required)>' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:53:in `require' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:53:in `block in <top (required)>' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:50:in `tap' from /Users/michaeljmccoy/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.0.rc2/lib/rails/commands.rb:50:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' I know they are very similar errors and probably has to do with a missing path. However, when I add the path to my .profile file and restart the terminal window, I get the same errors.

    Read the article

  • Outlook 2007 disconnecting after sending email to specific email

    - by Michael
    So when a user emails another tech in my domain they get the prompt for username/password as though they got disconnected. I have not seen any issues in the event logs, tried deleting the email address from his auto correct, ran Outlook in safe mode and searched online as well. I am kind of lost. Checked the event logs on the exchange server as well in the security and still nothing. Exchange 2010, Client OS: Vista x64, Outlook 2007. Thanks!

    Read the article

  • Nginx rewrite with Simple Machines Forum

    - by Kevin Worthington
    I am running Nginx 1.5.6 and I use the Simple Machines Forum software. Most rewrite rules seem to work properly, with the exception of the RSS feeds. In my Nginx configuration, I have the following line which is supposed to handle URLs which contain ".xml": rewrite ^/forum/(\.xml|xmlhttp)/?$ "/forum/index.php?pretty;action=$1" last; The above rule produces the following URL for the main forum, which returns a 403 Error: http://www.mydomain.com/forum/.xml/?type=rss I would like the rewrite rule to produce this type of URL, which returns code 200 (a real page): http://www.mydomain.com/forum/?type=rss;action=.xml Here is the entire block pertaining to the forum rewrites: http://pastebin.com/raw.php?i=tZkAibW3 I would really appreciate some help to create a rewrite rule to do that. Thanks.

    Read the article

  • Is there a limit setting a php_admin_value in php-fpm?

    - by PeeHaa
    I am trying to set a large value in the configuration of a pool in php-fpm, but at some point it just doesn't start anymore. php_admin_value[disable_functions] = dl,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,pcntl_exec,include,include_once,require,require_once,posix_mkfifo,posix_getlogin,posix_ttyname,getenv,get_current_use,proc_get_status,get_cfg_va,disk_free_space,disk_total_space,diskfreespace,getcwd,getlastmo,getmygid,getmyinode,getmypid,getmyuid,ini_set,mail,proc_nice,proc_terminate,proc_close,pfsockopen,fsockopen,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,fopen,tmpfile,bzopen,gzopen,chgrp,chmod,chown,copy,file_put_contents,lchgrp,lchown,link,mkdi,move_uploaded_file,rename,rmdi,symlink,tempnam,touch,unlink,iptcembed,ftp_get,ftp_nb_get,file_exists,file_get_contents,file,fileatime,filectime,filegroup,fileinode,filemtime,fileowne,fileperms,filesize,filetype,glob,is_di,is_executable,is_file,is_link,is_readable,is_uploaded_file,is_writable,is_writeable,linkinfo,lstat,parse_ini_file,pathinfo,readfile,readlink,realpath,stat,gzfile,create_function When trying to restart php-fpm it fails with the following message: Stopping php-fpm: [ OK ] Starting php-fpm: [20-Oct-2013 22:31:52] ERROR: [/etc/php-fpm.d/codepad.conf:235] value is NULL for a ZEND_INI_PARSER_ENTRY [20-Oct-2013 22:31:52] ERROR: Unable to include /etc/php-fpm.d/codepad.conf from /etc/php-fpm.conf at line 235 [20-Oct-2013 22:31:52] ERROR: failed to load configuration file '/etc/php-fpm.conf' [20-Oct-2013 22:31:52] ERROR: FPM initialization failed [FAILED] When I remove the last disabled function (create_function) it start again. I also tried with other functions, but this gives the same error so it's not related to the create_function function. The string currently is just over 1KB in size so it looks like I have hit a limit here? Is my assumption correct? Is there a way to overcome this limit? I also tried to add another php_admin_value[disable_functions] underneath it (hoping it would be appended), but that didn't work (it just used the first one).

    Read the article

  • nginx + php fpm -> 404 php pages - file not found

    - by Mahesh
    *2037 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 server_name .site.com; root /var/www/site; error_page 404 /404.php; access_log /var/log/nginx/site.access.log; index index.html index.php; if ($http_host != "www.site.com") { rewrite ^ http://www.site.com$request_uri permanent; } location ~* \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_read_timeout 240; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } location ~ /\. { access_log off; log_not_found off; deny all; } location ~ /(libraries|setup/frames|setup/libs) { deny all; return 404; } location ~ ^/uploads/(\d+)/(\d+)/(\d+)/(\d+)/(.*)$ { alias /var/www/site/images/missing.gif; #i need to modify this to show only missing files. right now it is showing missing for all the files. } location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { access_log off; expires 20d; } location /user_uploads/ { location ~ .*\.(php)?$ { deny all; } } location ~ /\.ht { deny all; } } php-fpm config is default and is not touched. The problem is little strange for me. Error pages are showing File not found only if they are .php files. Other error files are clearly calling the 404.php file site.com/test = calls 404.php site.com/test.php = File not found. I am searching and making changes. but it hasn't solved the problem.

    Read the article

  • Is it possible to restrict the connection duration per client on the router (say with OpenWRT)?

    - by static
    How to limit the connection duration per client per period (say, one MAC-address can connect only for 3 hours per week to the network). Where could be defined such a rule? In the firewall? So the rule should define not statically times (this is simple), when the client is allowed to access the network, but the duration of the connection per day/week/month, etc. How/where to implement such rules? Is it possible to do so with OpenWRT/DD-WRT?

    Read the article

  • many unknow process name as "sudo"

    - by joaner
    my server free memoney is less and less, And many process COMMAND are"sudo" when use top and enter M. I don't understand root user need to use "sudo". I want to know the way these processes are generated ? Can I kill ? Tasks: 185 total, 1 running, 184 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 3967848k total, 3484196k used, 483652k free, 218532k buffers Swap: 4112376k total, 0k used, 4112376k free, 2932864k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 22219 mysql 20 0 582m 67m 5492 S 0.0 1.7 0:01.75 mysqld 22337 daemon 20 0 327m 31m 3440 S 0.0 0.8 0:01.58 httpd 22252 daemon 20 0 321m 26m 3416 S 0.0 0.7 0:01.25 httpd 22263 daemon 20 0 319m 23m 3396 S 0.0 0.6 0:00.71 httpd 22253 daemon 20 0 310m 18m 3444 S 0.0 0.5 0:00.69 httpd 22251 root 20 0 28392 12m 3640 S 0.0 0.3 0:00.09 httpd 2422 root 20 0 9192 3608 2184 S 0.0 0.1 0:00.32 ssh 13613 root 20 0 38220 3572 1044 S 0.0 0.1 0:22.31 rsyslogd 2423 root 20 0 11556 3420 2692 S 0.0 0.1 0:00.11 sshd 22570 root 20 0 11716 3408 2676 S 0.0 0.1 0:00.08 sshd 3351 root 20 0 10384 2540 2000 S 0.0 0.1 0:00.06 sudo 30870 root 20 0 10384 2528 2000 S 0.0 0.1 0:00.06 sudo 14356 dkim-mil 20 0 49664 2444 1468 S 0.0 0.1 0:03.91 dkim-filter 2085 root 20 0 10376 2344 1824 S 0.0 0.1 0:00.00 sudo 7741 root 20 0 10376 2344 1824 S 0.0 0.1 0:00.00 sudo 29838 root 20 0 10376 2344 1824 S 0.0 0.1 0:00.00 sudo 2006 root 20 0 10376 2340 1824 S 0.0 0.1 0:00.00 sudo 29747 root 20 0 10376 2340 1824 S 0.0 0.1 0:00.00 sudo 30602 root 20 0 10376 2340 1824 S 0.0 0.1 0:00.00 sudo 30935 root 20 0 10376 2340 1824 S 0.0 0.1 0:00.00 sudo 2259 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 2503 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 2515 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 7718 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 7745 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 29845 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30172 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30352 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30548 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30598 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30897 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo 30899 root 20 0 10376 2336 1824 S 0.0 0.1 0:00.00 sudo

    Read the article

  • windows cache not working as it should?

    - by piotrektt
    I run windows 2012 server with data center. The setup is with 60GB of RAM. I have one file shared on VHD and when I copy this file locally the RAM cache is all used up but when multiple computers connect to the share it the cache is not used. The network is 8Gb. The whole network is around 200 computers that need to read that one file but on this setup only 10 connection kills the server. Is there any way to check what is going on? What other solution can I use to manage cache in windows?

    Read the article

  • Howto detect fake RAM

    - by Michael
    I just bought a virtual server which should have 2GB of RAM. Now i got a server with 4gb which looks very strange to me. I think it is just a virtual RAM. dmidecode only ouputs /dev/mem: Operation not permitted How can i check if it's a real RAM or just a virtual one? free -m outputs: total used free shared buffers cached Mem: 4093 364 3728 0 0 346 -/+ buffers/cache: 18 4074 Swap: 0 0 0 Output from cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt 137: kmemsize 8922287 10194944 2145910784 2145910784 0 lockedpages 0 0 523904 523904 0 privvmpages 13387 59112 9223372036854775807 9223372036854775807 0 shmpages 769 785 9223372036854775807 9223372036854775807 0 dummy 0 0 9223372036854775807 9223372036854775807 0 numproc 22 54 9223372036854775807 9223372036854775807 0 physpages 93377 106010 0 1047808 0 vmguarpages 0 0 9223372036854775807 9223372036854775807 0 oomguarpages 2471 2473 9223372036854775807 9223372036854775807 0 numtcpsock 5 21 9223372036854775807 9223372036854775807 0 numflock 4 13 9223372036854775807 9223372036854775807 0 numpty 1 1 9223372036854775807 9223372036854775807 0 numsiginfo 0 39 9223372036854775807 9223372036854775807 0 tcpsndbuf 102592 381632 9223372036854775807 9223372036854775807 0 tcprcvbuf 81920 4820184 9223372036854775807 9223372036854775807 0 othersockbuf 4624 61632 9223372036854775807 9223372036854775807 0 dgramrcvbuf 0 9248 9223372036854775807 9223372036854775807 0 numothersock 39 56 9223372036854775807 9223372036854775807 0 dcachesize 4178917 4232732 1072955392 1072955392 0 numfile 378 535 9223372036854775807 9223372036854775807 0 dummy 0 0 9223372036854775807 9223372036854775807 0 dummy 0 0 9223372036854775807 9223372036854775807 0 dummy 0 0 9223372036854775807 9223372036854775807 0 numiptent 24 24 9223372036854775807 9223372036854775807 0

    Read the article

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