Search Results

Search found 2455 results on 99 pages for 'matt tm'.

Page 1/99 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • PPPD Is Locking the Modem and Not Releasing It

    - by Skid
    Got an issue with PPPD on one of our system, we have a PC that is used to talk to remote sites via a dial up connection, the modem can both connect out to the sites and the sites also dial back in. Currently I'm having an issue where some times a site ether dials in or we dial out, and it connects, but then blocks the modem and throws and error to kern.log. Aug 26 14:23:57 TM-SCADA kernel: [191233.503745] INFO: task pppd:8142 blocked for more than 120 seconds. Aug 26 14:23:57 TM-SCADA kernel: [191233.503750] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. Aug 26 14:23:57 TM-SCADA kernel: [191233.503753] pppd D ffffffff8180cb40 0 8142 1 0x00000000 Aug 26 14:23:57 TM-SCADA kernel: [191233.503759] ffff8800ac1f5dc8 0000000000000086 ffff8800ac1f5fd8 00000000000137c0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503765] ffff8800ac1f4010 00000000000137c0 00000000000137c0 00000000000137c0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503770] ffff8800ac1f5fd8 00000000000137c0 ffffffff81c13020 ffff880135df5b80 Aug 26 14:23:57 TM-SCADA kernel: [191233.503775] Call Trace: Aug 26 14:23:57 TM-SCADA kernel: [191233.503784] [<ffffffff8166ba29>] schedule+0x29/0x70 Aug 26 14:23:57 TM-SCADA kernel: [191233.503790] [<ffffffff813db005>] tty_ldisc_ref_wait+0x65/0xb0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503796] [<ffffffff813f3061>] ? uart_ioctl+0xd1/0x1c0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503801] [<ffffffff81076960>] ? wake_up_bit+0x40/0x40 Aug 26 14:23:57 TM-SCADA kernel: [191233.503806] [<ffffffff813d3fa0>] tty_ioctl+0x2c0/0x9a0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503810] [<ffffffff811d0549>] ? fcntl_setlk+0x69/0x200 Aug 26 14:23:57 TM-SCADA kernel: [191233.503815] [<ffffffff81195f79>] do_vfs_ioctl+0x99/0x330 Aug 26 14:23:57 TM-SCADA kernel: [191233.503820] [<ffffffff81195212>] ? do_fcntl+0x232/0x410 Aug 26 14:23:57 TM-SCADA kernel: [191233.503823] [<ffffffff811962b1>] sys_ioctl+0xa1/0xb0 Aug 26 14:23:57 TM-SCADA kernel: [191233.503829] [<ffffffff81674e69>] system_call_fastpath+0x16/0x1b The syslog trace stops at "Serial connection established". Aug 28 06:00:03 TM-SCADA pppd[10358]: pppd 2.4.5 started by root, uid 0 Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (NO CARRIER) Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (NO DIALTONE) Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (ERROR) Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (NO ANSWER) Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (BUSY) Aug 28 06:00:04 TM-SCADA chat[10360]: abort on (Username/Password Incorrect) Aug 28 06:00:04 TM-SCADA chat[10360]: send (atz^M) Aug 28 06:00:04 TM-SCADA chat[10360]: expect (OK) Aug 28 06:00:04 TM-SCADA chat[10360]: atz^M^M Aug 28 06:00:04 TM-SCADA chat[10360]: OK Aug 28 06:00:04 TM-SCADA chat[10360]: -- got it Aug 28 06:00:04 TM-SCADA chat[10360]: send (atx0^M) Aug 28 06:00:04 TM-SCADA chat[10360]: expect (OK) Aug 28 06:00:04 TM-SCADA chat[10360]: ^M Aug 28 06:00:04 TM-SCADA chat[10360]: atx0^M^M Aug 28 06:00:04 TM-SCADA chat[10360]: OK Aug 28 06:00:04 TM-SCADA chat[10360]: -- got it Aug 28 06:00:04 TM-SCADA chat[10360]: send (atdt0123456789^M) Aug 28 06:00:04 TM-SCADA chat[10360]: expect (CONNECT/ARQ) Aug 28 06:00:04 TM-SCADA chat[10360]: ^M Aug 28 06:00:30 TM-SCADA chat[10360]: atdt0123456789^M^M Aug 28 06:00:30 TM-SCADA chat[10360]: CONNECT/ARQ Aug 28 06:00:30 TM-SCADA chat[10360]: -- got it Aug 28 06:00:30 TM-SCADA pppd[10358]: Serial connection established. I've only found two ways to release the modem in this condition, the first is to turn the modem off and on again, the second is to delete the serial lock file, and then SIGKILL pppd. Now I could write into our software to do the latter if the modem is locked, but I would rather stop it from locking in the first place if at all possible. The reason I put this issue in the askubuntu is because we used to use OpenSuse and never had an issue with it, admittedly that was version 11.2 or earlier so its still and old kernel, but I figured I would ask here first anyway. Any suggestions of places to look would be appreciated.

    Read the article

  • WRTU54G-TM T-Mobile@Home router with 3rd party firmware

    - by dlamblin
    I've been doing a lot of reading online about the Linksys WRTU54G-TM router model that I now own. It seems getting a custom firmware onto it is not a problem. But no one is talking about retaining the Voip features (yet). So far they're all disappointed that it's not a SIP machine and used GSM over IPSec. Personally I don't care about using it with non-t-mobile. If I take the original firmware, shouldn't I be able to extract it, and it's SquashFS image, and then move all of the t-mobile specific binaries for enabling the calling features over to a custom firmware installation (maybe OpenWRT)? You might ask why, and the reason is, that if I do this I could retain my calling features, which I do want, and ssh to the router and use it to run additional software, as any OpenWRT router could do. Does anyone know if this can be done, and how the firmware's binaries could be gotten at and installed correctly?

    Read the article

  • AJI Report Talks With Matt Watson About Stackify

    - by Jeff Julian
    Matt Watson of Stackify sits down with us at HDC to talk about what Stackify offers for developers who need the ability to get access to their production systems for diagnostics. Matt discusses why it is important to have good tools to gain visibility into their applications and some great examples of why he started Stackify after selling his first software company. Matt has been a blogger on Geekswithblogs.net since day one and we were excited to sit down with him to talk about what his new company will be offering developers who interact with production systems.   Listen to the Show   Site: http://stackify.com Twitter: @MattWatson81 Blog: http://geekswithblogs.net/mwatson/

    Read the article

  • SQLPeople Interviews Wrap Up January 2011 with Matt Velic

    - by andyleonard
    Introduction Late last year I announced an exciting new endeavor called SQLPeople . At the end of 2010 I announced the 2010 SQLPeople Person of the Year . Check out this interview with Matt Velic! SQLPeople is off to a great start. Thanks to all who have our first month awesome - those willing to share and respond to interview requests and those who are enjoying the interviews! Here's a wrap up of January 2011: January 2011 Interviews Matt Velic Cindy Gross Steve Fibich Tim Mitchell Jeremiah Peschka...(read more)

    Read the article

  • SQLPeople Interviews Wrap Up January 2011 with Matt Velic

    - by andyleonard
    Introduction Late last year I announced an exciting new endeavor called SQLPeople . At the end of 2010 I announced the 2010 SQLPeople Person of the Year . Check out this interview with Matt Velic! SQLPeople is off to a great start. Thanks to all who have our first month awesome - those willing to share and respond to interview requests and those who are enjoying the interviews! Here's a wrap up of January 2011: January 2011 Interviews Matt Velic Cindy Gross Steve Fibich Tim Mitchell Jeremiah Peschka...(read more)

    Read the article

  • QotD: Matt Stephens on OpenJDK in 2012 at the Register

    - by $utils.escapeXML($entry.author)
    While Java SE churns and gets pushed back, the new initiatives do at least show OpenJDK is reinvigorating the Java space. The project has picked up speed just a little too late for the fifth anniversary of the open-sourcing of Java, but if these promised developments really do come together then that means next year should see a series of “one last things” missing from 2011.Matt Stephens in an article in the Register.

    Read the article

  • Marvell TOPDOG (TM) PCI-Express 802.11n Wireless (EC85)

    - by Jareb
    I was running Windows Vista, but hard drive got wipe out and couldn't reinstall it, so I install Ubuntu. My problem is that I cannot get wireless internet. I have search and search, but nothing help or it was too old and the forms got removed. I'm new at Linux. My computer is Gateway M-6752, running a (I believe) Marvell TOPDOG (TM) PCI-Express 802.11n Wireless (EC85), driver. How do I get my wireless working?

    Read the article

  • Matt Asay on Partisanship

    <b>The-Source.com:</b> "If Microsoft warms up to open source, why not share some plaudits? And even when it gets things wrong, surely it&#8217;s better to politely critique rather than spew invectives?"

    Read the article

  • Overload assignment operator for assigning sql::ResultSet to struct tm

    - by Luke Mcneice
    Are there exceptions for types which can't have thier assignment operator overloaded? Specifically, I'm wanting to overload the assignment operator of a struct tm (from time.h) so I can assign a sql::ResultSet to it. I already have the conversion logic: sscanf(sqlresult->getString("StoredAt").c_str(), "%d-%d-%d %d:%d:%d", &TempTimeStruct->tm_year, &TempTimeStruct->tm_mon, &TempTimeStruct->tm_mday, &TempTimeStruct->tm_hour, &TempTimeStruct->tm_min, &TempTimeStruct->tm_sec); I tried the overload with this: tm& tm::operator=(sql::ResultSet & results) { /*CODE*/ return *this; } However VS08 reports: error C2511: 'tm &tm::operator =(sql::ResultSet &)' : overloaded member function not found in 'tm'

    Read the article

  • Two seperate tm structs mirroring each other

    - by BSchlinker
    Here is my current situation: I have two tm structs, both set to the current time I make a change to the hour in one of the structs The change is occurring in the other struct magically.... How do I prevent this from occurring? I need to be able to compare and know the number of seconds between two different times -- the current time and a time in the future. I've been using difftime and mktime to determine this. I recognize that I don't technically need two tm structs (the other struct could just be a time_t loaded with raw time) but I'm still interested in understanding why this occurs. void Tracker::monitor(char* buffer){ // time handling time_t systemtime, scheduletime, currenttime; struct tm * dispatchtime; struct tm * uiuctime; double remainingtime; // let's get two structs operating with current time dispatchtime = dispatchtime_tm(); uiuctime = uiuctime_tm(); // set the scheduled parameters dispatchtime->tm_hour = 5; dispatchtime->tm_min = 05; dispatchtime->tm_sec = 14; uiuctime->tm_hour = 0; // both of these will now print the same time! (0:05:14) // what's linking them?? // print the scheduled time printf ("Current Time : %2d:%02d:%02d\n", uiuctime->tm_hour, uiuctime->tm_min, uiuctime->tm_sec); printf ("Scheduled Time : %2d:%02d:%02d\n", dispatchtime->tm_hour, dispatchtime->tm_min, dispatchtime->tm_sec); } struct tm* Tracker::uiuctime_tm(){ time_t uiucTime; struct tm *ts_uiuc; // give currentTime the current time time(&uiucTime); // change the time zone to UIUC putenv("TZ=CST6CDT"); tzset(); // get the localtime for the tz selected ts_uiuc = localtime(&uiucTime); // set back the current timezone unsetenv("TZ"); tzset(); // set back our results return ts_uiuc; } struct tm* Tracker::dispatchtime_tm(){ time_t currentTime; struct tm *ts_dispatch; // give currentTime the current time time(&currentTime); // get the localtime for the tz selected ts_dispatch = localtime(&currentTime); // set back our results return ts_dispatch; }

    Read the article

  • Returning an array of tm* structs from a function

    - by paultop6
    Hi Guys, Im trying to create an array of tm* structs, and then return them at the end of the function. This is what i have at the moment: struct tm* BusinessLogicLayer::GetNoResponceTime() { struct tm* time_v[3]; struct tm* time_save; int s = 3; time_save = LastSavedTime(); time_v[0] = time_save; sleep(5); time_save = LastSavedTime(); time_v[1] = time_save; sleep(5); time_save = LastSavedTime(); time_v[2] = time_save; return time_v; } I understand that given the code i have now it will not be possible to return the array, because it will be destroyed when the function ends. Can anyone help me with regards to how i would go about being able to access the array from the returned value after the function has ended? Regards Paul

    Read the article

  • Strange casting problem with tm structure

    - by egiakoum1984
    I have the following casting problem when my data structure sSpecificData contains a field of type tm: typedef struct { unsigned char data[10000]; } sDataBuffer; typedef struct { int m_Id; sDataBuffer m_Data; } sData; typedef struct { int m_value1; int m_value2; tm m_Date; } sSpecificData; const int SPECIFIC_SVC_DATA_SIZE = sizeof(sSpecificData); typedef struct { int m_Id; sSpecificData m_Data; } sMyData; int main(void) { sData svc; sMyData* ptr1 = (sMyData*) &svc; sSpecificData* ptr2; ptr2 = (sSpecificData*) &svc.m_Data; ptr1->m_Data.m_value1 = 90; ptr1->m_Data.m_value2 = 80; cout << ptr1->m_Data.m_value1 << endl; cout << ptr1->m_Data.m_value2 << endl; cout << ptr2->m_value1 << endl; cout << ptr2->m_value2 << endl; return 0; } Without the field "tm m_Date;" as part of the sSpecificData, the output is correct: 90 80 90 80 With the field "tm m_Date;" as part of the sSpecificData, the output is wrong: 90 80 0 <-- ! 90 <-- ! Is there any idea why my example doesn't work when there is field of type tm as part of the sSpecificData? Thanks!

    Read the article

  • recommended format to save time with MJD + BCD format in database

    - by pierr
    Hi, There is a time represented in MJD and BCD format with 5 bytes .I am wondering what is the recommended format to save this date-time in the sqlite database so that user can search against it ? My first attempt is to save it just as it is, that is a 5 bytes string. The user will use the same format to search and the result will be converted to unix time by the user with following code. However, later, I was suggested to save the time in the integer - the UTC time, for example. But I can not find a standard way to do the conversion. I feel this is a common issue and would like to hear your comments. time_t sidate_to_unixtime(unsigned char sidate[]) { int k = 0; struct tm tm; double mjd; /* check for the undefined value */ if ((sidate[0] == 0xff) && (sidate[1] == 0xff) && (sidate[2] == 0xff) && (sidate[3] == 0xff) && (sidate[4] == 0xff)) { return -1; } memset(&tm, 0, sizeof(tm)); mjd = (sidate[0] << 8) | sidate[1]; tm.tm_year = (int) ((mjd - 15078.2) / 365.25); tm.tm_mon = (int) (((mjd - 14956.1) - (int) (tm.tm_year * 365.25)) / 30.6001); tm.tm_mday = (int) mjd - 14956 - (int) (tm.tm_year * 365.25) - (int) (tm.tm_mon * 30.6001); if ((tm.tm_mon == 14) || (tm.tm_mon == 15)) k = 1; tm.tm_year += k; tm.tm_mon = tm.tm_mon - 2 - k * 12; tm.tm_sec = bcd_to_integer(sidate[4]); tm.tm_min = bcd_to_integer(sidate[3]); tm.tm_hour = bcd_to_integer(sidate[2]); return mktime(&tm); }

    Read the article

  • Progressive download using Matt Gallagher's audio streamer

    - by Fernando Valente
    I'm a completely n00b when talking about audio. I'm using Matt Gallagher's audio streamer on my radio app. How may I use progressive download? Also, ExtAudioFile is a good idea too :) Edit: Used this: length = CFReadStreamRead(stream, bytes, kAQDefaultBufSize); if(!data) data =[[NSMutableData alloc] initWithLength:0]; [data appendData:[NSData dataWithBytes:bytes length:kAQDefaultBufSize]]; Now I can save the audio data using writeToFile:atomically: NSData method, but the audio won't play. Also, if I try to load it on a AVAudioPlayer, I get an error.

    Read the article

  • Mac OS X kernel panic after TM restore

    - by Sev
    I changed my HD in my MacBook Pro, and restored from Time Machine backup. Now I keep getting kernel panic error everytime I restart. I booted from the DVD and ran a few tests, noticed that HD and RAM are being detected, also did a repair on the disk through disk utility, still getting same error. Any suggestions?

    Read the article

  • how to solve unhandled exception error when using visual C++ 2008?

    - by make
    Hi, Could someone please help me to solve unhandled exception error when using visual C++ 2008? the error is displayed as follow: Unhandled exception at 0x00411690 in time.exe: 0xC0000005: Access violation reading location 0x00000008 Actually when I used visual c++ 6 in the past, there weren't any error and the program was running fine. But now ehen I use visual 2008, I am getting this Unhandled exception error. Here is the program: #include <stdio.h> #include <stdlib.h> #include <time.h> #ifdef _WIN32 // #include <winsock.h> #include <windows.h> #include "stdint.h" // typedef __int64 int64_t // Define it from MSVC's internal type // typedef unsigned __int32 uint32_t #else #include <stdint.h> // Use the C99 official header #include <sys/time.h> #include <unistd.h> #endif #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif struct timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ }; #define TEST #ifdef TEST uint32_t stampstart(); uint32_t stampstop(uint32_t start); int main() { uint32_t start, stop; start = stampstart(); /* Your code goes here */ stop = stampstop(start); return 0; } #endif int gettimeofday(struct timeval *tv, struct timezone *tz) { FILETIME ft; unsigned __int64 tmpres = 0; static int tzflag = 0; if (NULL != tv) { GetSystemTimeAsFileTime(&ft); tmpres |= ft.dwHighDateTime; tmpres <<= 32; tmpres |= ft.dwLowDateTime; tmpres /= 10; /*convert into microseconds*/ /*converting file time to unix epoch*/ tmpres -= DELTA_EPOCH_IN_MICROSECS; tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL); } if (NULL != tz) { if (!tzflag) { _tzset(); tzflag++; } tz->tz_minuteswest = _timezone / 60; tz->tz_dsttime = _daylight; } return 0; } uint32_t stampstart() { struct timeval tv; struct timezone tz; struct tm *tm; uint32_t start; gettimeofday(&tv, &tz); tm = localtime(&tv.tv_sec); printf("TIMESTAMP-START\t %d:%02d:%02d:%d (~%d ms)\n", tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec, tm->tm_hour * 3600 * 1000 + tm->tm_min * 60 * 1000 + tm->tm_sec * 1000 + tv.tv_usec / 1000); start = tm->tm_hour * 3600 * 1000 + tm->tm_min * 60 * 1000 + tm->tm_sec * 1000 + tv.tv_usec / 1000; return (start); } uint32_t stampstop(uint32_t start) { struct timeval tv; struct timezone tz; struct tm *tm; uint32_t stop; gettimeofday(&tv, &tz); tm = localtime(&tv.tv_sec); stop = tm->tm_hour * 3600 * 1000 + tm->tm_min * 60 * 1000 + tm->tm_sec * 1000 + tv.tv_usec / 1000; printf("TIMESTAMP-END\t %d:%02d:%02d:%d (~%d ms) \n", tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec, tm->tm_hour * 3600 * 1000 + tm->tm_min * 60 * 1000 + tm->tm_sec * 1000 + tv.tv_usec / 1000); printf("ELAPSED\t %d ms\n", stop - start); return (stop); } thanks for your replies:

    Read the article

  • MS cash drawer with epson TM-IV88 Status API

    - by Xience
    Does anyone know how to monitor cash drawer's open/close state using Advanced Printer Driver's Status API for Epson TM-88IV thermal printer. I wish i could use OPOS for ADK .Net, but haven't had luck setting it up on windows 7. Does anyone know how to be a part of epson developer network. I have gone through the information available at www.epson-pos.com but there is no information available on POS/ESC codes. Please help...........

    Read the article

  • Will IntelliTrace(tm) (historical debugging) be available for unmanaged c++ in future versions of Vi

    - by Tim
    I love the idea of historical debugging in VS 2010. However, I am really disappointed that unmanaged C++ is left out. IntelliTrace supports debugging Visual Basic and C# applications that use .NET version 2.0, 3.0, 3.5, or 4. You can debug most applications, including applications that were created by using ASP.NET, Windows Forms, WPF, Windows Workflow, and WCF. IntelliTrace does not support debugging C++, script, or other languages. Debugging of F# applications is supported on an experimental basis. (editorial) [This is really poor support in my opinion. .NET is less in need of this assistance than unmanaged c++. I an getting a little tired of the status of plain old C++ and its second-class status in the MS tools world. Yes, I realize it is probably WAAY easier to implement this with .NET and MS are pushing .NET as the future, and yes, I know that C++ is an "old" language, but that does not diminish the fact that there are lots of C++ apps out there and there will continue to be more apps built with C++. I sincerely hope MS has not dropped C++ as a supported developer tool/language- that would be a shame.] Does anyone know if there are plans for it to support C++?

    Read the article

  • [C++] Can all/any struct assignment operator be Overloaded? (and specifically struct tm = sql::Resu

    - by Luke Mcneice
    Hi all, Generally, i was wondering if there was any exceptions of types that cant have thier assignment operator overloaded. Specifically, I'm wanting to overload the assignment operator of a tm struct, (time.h) so i can assign a sql::ResultSet to it. I have already have the conversion logic: sscanf(sqlresult->getString("StoredAt").c_str(),"%d-%d-%d %d:%d:%d",&TempTimeStruct->tm_year,&TempTimeStruct->tm_mon,&TempTimeStruct->tm_mday,&TempTimeStruct->tm_hour,&TempTimeStruct->tm_min,&TempTimeStruct->tm_sec); //populating the struct I tried the overload with this: tm& tm::operator=(sql::ResultSet & results) { //CODE return *this; } however VS08 reports: error C2511: 'tm &tm::operator =(sql::ResultSet &)' : overloaded member function not found in 'tm'

    Read the article

  • use printf("text %d", number) type format to assign value to variable

    - by rksprst
    I would like to use the syntax that printf uses, using the %d, %s and adding values after to assign a value to a char[]. Is this possible? e.g. Given an output of: printf("now: %d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); I'd like to assign that to char[] output; How can this be done? I tried: sprintf(output, "now: %d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); but that didn't seem to work. Is sprintf used differently... or is that not what I should be using? Thanks!

    Read the article

  • Amazon Web Services promet de baisser ses prix en 2012, entretien avec Matt Wood, Technology Evangelist EMEA chez Amazon

    Amazon Web Services promet de baisser encore ses prix en 2012 Entretien avec Matt Wood, Technology Evangelist EMEA chez Amazon Les Cloud dédiés aux développeurs se multiplient. Ils mettent tous en avant les mêmes avantages : flexibilité, facturation à la demande, gestion externalisée de l'infrastructure, et aujourd'hui simplification des outils d'administration. Après avoir interviewé Laurent Lesaicherre, le responsable chez Microsoft France de la plateforme Windows Azure, il nous est apparu intéressant de continuer ce tour d'horizon du marché avec un de ses précurseurs : Amazon. Il y a maintenant cinq ans, ...

    Read the article

  • T-SQL Tuesday #53-Matt's Making Me Do This!

    - by Most Valuable Yak (Rob Volk)
    Hello everyone! It's that time again, time for T-SQL Tuesday, the wonderful blog series started by Adam Machanic (b|t). This month we are hosted by Matt Velic (b|t) who asks the question, "Why So Serious?", in celebration of April Fool's Day. He asks the contributors for their dirty tricks. And for some reason that escapes me, he and Jeff Verheul (b|t) seem to think I might be able to write about those. Shocked, I am! Nah, not really. They're absolutely right, this one is gonna be fun! I took some inspiration from Matt's suggestions, namely Resource Governor and Login Triggers.  I've done some interesting login trigger stuff for a presentation, but nothing yet with Resource Governor. Best way to learn it! One of my oldest pet peeves is abuse of the sa login. Don't get me wrong, I use it too, but typically only as SQL Agent job owner. It's been a while since I've been stuck with it, but back when I started using SQL Server, EVERY application needed sa to function. It was hard-coded and couldn't be changed. (welllllll, that is if you didn't use a hex editor on the EXE file, but who would do such a thing?) My standard warning applies: don't run anything on this page in production. In fact, back up whatever server you're testing this on, including the master database. Snapshotting a VM is a good idea. Also make sure you have other sysadmin level logins on that server. So here's a standard template for a logon trigger to address those pesky sa users: CREATE TRIGGER SA_LOGIN_PRIORITY ON ALL SERVER WITH ENCRYPTION, EXECUTE AS N'sa' AFTER LOGON AS IF ORIGINAL_LOGIN()<>N'sa' OR APP_NAME() LIKE N'SQL Agent%' RETURN; -- interesting stuff goes here GO   What can you do for "interesting stuff"? Books Online limits itself to merely rolling back the logon, which will throw an error (and alert the person that the logon trigger fired).  That's a good use for logon triggers, but really not tricky enough for this blog.  Some of my suggestions are below: WAITFOR DELAY '23:59:59';   Or: EXEC sp_MSforeach_db 'EXEC sp_detach_db ''?'';'   Or: EXEC msdb.dbo.sp_add_job @job_name=N'`', @enabled=1, @start_step_id=1, @notify_level_eventlog=0, @delete_level=3; EXEC msdb.dbo.sp_add_jobserver @job_name=N'`', @server_name=@@SERVERNAME; EXEC msdb.dbo.sp_add_jobstep @job_name=N'`', @step_id=1, @step_name=N'`', @command=N'SHUTDOWN;'; EXEC msdb.dbo.sp_start_job @job_name=N'`';   Really, I don't want to spoil your own exploration, try it yourself!  The thing I really like about these is it lets me promote the idea that "sa is SLOW, sa is BUGGY, don't use sa!".  Before we get into Resource Governor, make sure to drop or disable that logon trigger. They don't work well in combination. (Had to redo all the following code when SSMS locked up) Resource Governor is a feature that lets you control how many resources a single session can consume. The main goal is to limit the damage from a runaway query. But we're not here to read about its main goal or normal usage! I'm trying to make people stop using sa BECAUSE IT'S SLOW! Here's how RG can do that: USE master; GO CREATE FUNCTION dbo.SA_LOGIN_PRIORITY() RETURNS sysname WITH SCHEMABINDING, ENCRYPTION AS BEGIN RETURN CASE WHEN ORIGINAL_LOGIN()=N'sa' AND APP_NAME() NOT LIKE N'SQL Agent%' THEN N'SA_LOGIN_PRIORITY' ELSE N'default' END END GO CREATE RESOURCE POOL SA_LOGIN_PRIORITY WITH ( MIN_CPU_PERCENT = 0 ,MAX_CPU_PERCENT = 1 ,CAP_CPU_PERCENT = 1 ,AFFINITY SCHEDULER = (0) ,MIN_MEMORY_PERCENT = 0 ,MAX_MEMORY_PERCENT = 1 -- ,MIN_IOPS_PER_VOLUME = 1 ,MAX_IOPS_PER_VOLUME = 1 -- uncomment for SQL Server 2014 ); CREATE WORKLOAD GROUP SA_LOGIN_PRIORITY WITH ( IMPORTANCE = LOW ,REQUEST_MAX_MEMORY_GRANT_PERCENT = 1 ,REQUEST_MAX_CPU_TIME_SEC = 1 ,REQUEST_MEMORY_GRANT_TIMEOUT_SEC = 1 ,MAX_DOP = 1 ,GROUP_MAX_REQUESTS = 1 ) USING SA_LOGIN_PRIORITY; ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION=dbo.SA_LOGIN_PRIORITY); ALTER RESOURCE GOVERNOR RECONFIGURE;   From top to bottom: Create a classifier function to determine which pool the session should go to. More info on classifier functions. Create the pool and provide a generous helping of resources for the sa login. Create the workload group and further prioritize those resources for the sa login. Apply the classifier function and reconfigure RG to use it. I have to say this one is a bit sneakier than the logon trigger, least of all you don't get any error messages.  I heartily recommend testing it in Management Studio, and click around the UI a lot, there's some fun behavior there. And DEFINITELY try it on SQL 2014 with the IO settings included!  You'll notice I made allowances for SQL Agent jobs owned by sa, they'll go into the default workload group.  You can add your own overrides to the classifier function if needed. Some interesting ideas I didn't have time for but expect you to get to before me: Set up different pools/workgroups with different settings and randomize which one the classifier chooses Do the same but base it on time of day (Books Online example covers this)... Or, which workstation it connects from. This can be modified for certain special people in your office who either don't listen, or are attracted (and attractive) to you. And if things go wrong you can always use the following from another sysadmin or Dedicated Admin connection: ALTER RESOURCE GOVERNOR DISABLE;   That will let you go in and either fix (or drop) the pools, workgroups and classifier function. So now that you know these types of things are possible, and if you are tired of your team using sa when they shouldn't, I expect you'll enjoy playing with these quite a bit! Unfortunately, the aforementioned Dedicated Admin Connection kinda poops on the party here.  Books Online for both topics will tell you that the DAC will not fire either feature. So if you have a crafty user who does their research, they can still sneak in with sa and do their bidding without being hampered. Of course, you can still detect their login via various methods, like a server trace, SQL Server Audit, extended events, and enabling "Audit Successful Logins" on the server.  These all have their downsides: traces take resources, extended events and SQL Audit can't fire off actions, and enabling successful logins will bloat your error log very quickly.  SQL Audit is also limited unless you have Enterprise Edition, and Resource Governor is Enterprise-only.  And WORST OF ALL, these features are all available and visible through the SSMS UI, so even a doofus developer or manager could find them. Fortunately there are Event Notifications! Event notifications are becoming one of my favorite features of SQL Server (keep an eye out for more blogs from me about them). They are practically unknown and heinously underutilized.  They are also a great gateway drug to using Service Broker, another great but underutilized feature. Hopefully this will get you to start using them, or at least your enemies in the office will once they read this, and then you'll have to learn them in order to fix things. So here's the setup: USE msdb; GO CREATE PROCEDURE dbo.SA_LOGIN_PRIORITY_act WITH ENCRYPTION AS DECLARE @x XML, @message nvarchar(max); RECEIVE @x=CAST(message_body AS XML) FROM SA_LOGIN_PRIORITY_q; IF @x.value('(//LoginName)[1]','sysname')=N'sa' AND @x.value('(//ApplicationName)[1]','sysname') NOT LIKE N'SQL Agent%' BEGIN -- interesting activation procedure stuff goes here END GO CREATE QUEUE SA_LOGIN_PRIORITY_q WITH STATUS=ON, RETENTION=OFF, ACTIVATION (PROCEDURE_NAME=dbo.SA_LOGIN_PRIORITY_act, MAX_QUEUE_READERS=1, EXECUTE AS OWNER); CREATE SERVICE SA_LOGIN_PRIORITY_s ON QUEUE SA_LOGIN_PRIORITY_q([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]); CREATE EVENT NOTIFICATION SA_LOGIN_PRIORITY_en ON SERVER WITH FAN_IN FOR AUDIT_LOGIN TO SERVICE N'SA_LOGIN_PRIORITY_s', N'current database' GO   From top to bottom: Create activation procedure for event notification queue. Create queue to accept messages from event notification, and activate the procedure to process those messages when received. Create service to send messages to that queue. Create event notification on AUDIT_LOGIN events that fire the service. I placed this in msdb as it is an available system database and already has Service Broker enabled by default. You should change this to another database if you can guarantee it won't get dropped. So what to put in place for "interesting activation procedure code"?  Hmmm, so far I haven't addressed Matt's suggestion of writing a lengthy script to send an annoying message: SET @[email protected]('(//HostName)[1]','sysname') + N' tried to log in to server ' + @x.value('(//ServerName)[1]','sysname') + N' as SA at ' + @x.value('(//StartTime)[1]','sysname') + N' using the ' + @x.value('(//ApplicationName)[1]','sysname') + N' program. That''s why you''re getting this message and the attached pornography which' + N' is bloating your inbox and violating company policy, among other things. If you know' + N' this person you can go to their desk and hit them, or use the following SQL to end their session: KILL ' + @x.value('(//SPID)[1]','sysname') + N'; Hopefully they''re in the middle of a huge query that they need to finish right away.' EXEC msdb.dbo.sp_send_dbmail @recipients=N'[email protected]', @subject=N'SA Login Alert', @query_result_width=32767, @body=@message, @query=N'EXEC sp_readerrorlog;', @attach_query_result_as_file=1, @query_attachment_filename=N'UtterlyGrossPorn_SeriouslyDontOpenIt.jpg' I'm not sure I'd call that a lengthy script, but the attachment should get pretty big, and I'm sure the email admins will love storing multiple copies of it.  The nice thing is that this also fires on Dedicated Admin connections! You can even identify DAC connections from the event data returned, I leave that as an exercise for you. You can use that info to change the action taken by the activation procedure, and since it's a stored procedure, it can pretty much do anything! Except KILL the SPID, or SHUTDOWN the server directly.  I'm still working on those.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >