Search Results

Search found 7850 results on 314 pages for 'except'.

Page 14/314 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • SQL SERVER – Finding Different ColumnName From Almost Identitical Tables

    - by pinaldave
    I have mentioned earlier on this blog that I love social media – Facebook and Twitter. I receive so many interesting questions that sometimes I wonder how come I never faced them in my real life scenario. Well, let us see one of the similar situation. Here is one of the questions which I received on my social media handle. “Pinal, I have a large database. I did not develop this database but I have inherited this database. In our database we have many tables but all the tables are in pairs. We have one archive table and one current table. Now here is interesting situation. For a while due to some reason our organization has stopped paying attention to archive data. We did not archive anything for a while. If this was not enough we  even changed the schema of current table but did not change the corresponding archive table. This is now becoming a huge huge problem. We know for sure that in current table we have added few column but we do not know which ones. Is there any way we can figure out what are the new column added in the current table and does not exist in the archive tables? We cannot use any third party tool. Would you please guide us?” Well here is the interesting example of how we can use sys.column catalogue views and get the details of the newly added column. I have previously written about EXCEPT over here which is very similar to MINUS of Oracle. In following example we are going to create two tables. One of the tables has extra column. In our resultset we will get the name of the extra column as we are comparing the catalogue view of the column name. USE AdventureWorks2012 GO CREATE TABLE ArchiveTable (ID INT, Col1 VARCHAR(10), Col2 VARCHAR(100), Col3 VARCHAR(100)); CREATE TABLE CurrentTable (ID INT, Col1 VARCHAR(10), Col2 VARCHAR(100), Col3 VARCHAR(100), ExtraCol INT); GO -- Columns in ArchiveTable but not in CurrentTable SELECT name ColumnName FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID) = 'ArchiveTable' EXCEPT SELECT name ColumnName FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID) = 'CurrentTable' GO -- Columns in CurrentTable but not in ArchiveTable SELECT name ColumnName FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID) = 'CurrentTable' EXCEPT SELECT name ColumnName FROM sys.columns WHERE OBJECT_NAME(OBJECT_ID) = 'ArchiveTable' GO DROP TABLE ArchiveTable; DROP TABLE CurrentTable; GO The above query will return us following result. I hope this solves the problems. It is not the most elegant solution ever possible but it works. Here is the puzzle back to you – what native T-SQL solution would you have provided in this situation? Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL System Table, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • How to Determine The Module a Particular Exception Class is Defined In

    - by doug
    Note: i edited my Q (in the title) so that it better reflects what i actually want to know. In the original title and in the text of my Q, i referred to the source of the thrown exception; what i meant, and what i should have referred to, as pointed out in one of the high-strung but otherwise helpful response below, is the module that the exception class is defined in. This is evidenced by the fact that, again, as pointed out in one of the answers below the answer to the original Q is that the exceptions were thrown from calls to cursor.execute and cursor.next, respectively--which of course, isn't the information you need to write the try/except block. For instance (the Q has nothing specifically to do with SQLite or the PySQLite module): from pysqlite2 import dbapi2 as SQ try: cursor.execute('CREATE TABLE pname (id INTEGER PRIMARY KEY, name VARCHARS(50)') except SQ.OperationalError: print("{0}, {1}".format("table already exists", "... 'CREATE' ignored")) # cursor.execute('SELECT * FROM pname') while 1: try: print(cursor.next()) except StopIteration: break # i let both snippets error out to see the exception thrown, then coded the try/finally blocks--but that didn't tell me anything about which module the exception class is defined. In my example, there's only a single imported module, but where there are many more, i am interested to know how an experienced pythonista identifies the exception source (search-the-docs-till-i-happen-to-find-it is my current method). [And yes i am aware there's a nearly identical question on SO--but for C# rather than python, plus if you read the author's edited version, you'll see he's got a different problem in mind.]

    Read the article

  • Selector and Iterating Through a Table Within a Div

    - by GregH
    I have been working on this and cannot get this iterator to work. I have the following HTML and am trying to iterate through all rows (except the first row) and extract the values in cells (td) 2 and 3 : <div id="statsId"> <table width="220" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td width="65"/> <td width="90"/> <td width="65"/> </tr> <tr style="font-weight: bold;"> <td align="left">$1.00</td> <td> <a href="#">UserID1</a> </td> <td>Single</td> </tr> <tr> <td align="left">$6.99</td> <td> <a href="#">UserID2</a> </td> <td>Multiple</td> </tr> <tr>... .....(snip) I tried the following iterator to iterate through all except the first row of the table that is a child of "div#statsID" and get the values of the 2nd and 3rd cells (in the example, the first extracted cells would have values of "UserID1" and "Single"), but it doesn't work. $('div#statsId > table tr:not(:nth-child(1))').each(function(i, ele) { var secondCol = $('td:nth-child(2)', ele).innerHTML var thirdCol= $('td:nth-child(3)', ele).text() ..... }); Any suggestions on how to specify and iterate through the rows (except the first) of a table that is a child of a div would be appreciated.

    Read the article

  • LINQ - is SkipWhile broken?

    - by Judah Himango
    I'm a bit surprised to find the results of the following code, where I simply want to remove all 3s from a sequence of ints: var sequence = new [] { 1, 1, 2, 3 }; var result = sequence.SkipWhile(i => i == 3); // Oh noes! Returns { 1, 1, 2, 3 } Why isn't 3 skipped? My next thought was, OK, the Except operator will do the trick: var sequence = new [] { 1, 1, 2, 3 }; var result = sequence.Except(i => i == 3); // Oh noes! Returns { 1, 2 } In summary, Except removes the 3, but also removes non-distinct elements. Grr. SkipWhile doesn't skip the last element, even if it matches the condition. Grr. Can someone explain why SkipWhile doesn't skip the last element? And can anyone suggest what LINQ operator I can use to remove the '3' from the sequence above?

    Read the article

  • Problem with RVM and gem that has an executable

    - by djhworld
    Hi there, I've recently made the plunge to use RVM on Ubuntu. Everything seems to have gone swimmingly...except for one thing. I'm in the process of developing a gem of mine that has a script placed within its own bin/ directory, all of the gemspec and things were generated by Jeweler. The bin/mygem file contains the following code: - #!/usr/bin/env ruby begin require 'mygem' rescue LoadError require 'rubygems' require 'mygem' end app = MyGem::Application.new app.run That was working fine on the system version of Ruby. Now...recently I've moved to RVM to manage my ruby versions a bit better, except now my gem doesn't appear to be working. Firstly I do this: - rvm 1.9.2 Then I do this: - rvm 1.9.2 gem install mygem Which installs fine, except...when I try to run the command for mygem mygem I just get the following exception: - daniel@daniel-VirtualBox:~$ mygem <internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- mygem (LoadError) from <internal:lib/rubygems/custom_require>:29:in `require' from /home/daniel/.rvm/gems/ruby-1.9.2-p136/gems/mygem-0.1.4/bin/mygem:2:in `<top (required)>' from /home/daniel/.rvm/gems/ruby-1.9.2-p136/bin/mygem:19:in `load' from /home/daniel/.rvm/gems/ruby-1.9.2-p136/bin/mygem:19:in `<main>'mygem NOTE: I have a similar RVM setup on MAC OSX and my gem works fine there so I think this might be something to do with Ubuntu?

    Read the article

  • How to access a superclass's class attributes in Python?

    - by Brecht Machiels
    Have a look at the following code: class A(object): defaults = {'a': 1} def __getattr__(self, name): print('A.__getattr__') return self.get_default(name) @classmethod def get_default(cls, name): # some debug output print('A.get_default({}) - {}'.format(name, cls)) try: print(super(cls, cls).defaults) # as expected except AttributeError: #except for the base object class, of course pass # the actual function body try: return cls.defaults[name] except KeyError: return super(cls, cls).get_default(name) # infinite recursion #return cls.__mro__[1].get_default(name) # this works, though class B(A): defaults = {'b': 2} class C(B): defaults = {'c': 3} c = C() print('c.a =', c.a) I have a hierarchy of classes each with its own dictionary containing some default values. If an instance of a class doesn't have a particular attribute, a default value for it should be returned instead. If no default value for the attribute is contained in the current class's defaults dictionary, the superclass's defaults dictionary should be searched. I'm trying to implement this using the recursive class method get_default. The program gets stuck in an infinite recursion, unfortunately. My understanding of super() is obviously lacking. By accessing __mro__, I can get it to work properly though, but I'm not sure this is a proper solution. I have the feeling the answer is somewhere in this article, but I haven't been able to find it yet. Perhaps I need to resort to using a metaclass?

    Read the article

  • Calling Python app/script from C#

    - by Maxim Z.
    I'm building an ASP.NET MVC (C#) site where I want to implement STV (Single Transferable Vote) voting. I've used OpenSTV for voting scenarios before, with great success, but I've never used it programmatically. The OpenSTV Google Code project offers a Python script that allows usage of OpenSTV from other applications: import sys sys.path.append("path to openstv package") from openstv.ballots import Ballots from openstv.ReportPlugins.TextReport import TextReport from openstv.plugins import getMethodPlugins (ballotFname, method, reportFname) = sys.argv[1:] methods = getMethodPlugins("byName") f = open(reportFname, "w") try: b = Ballots() b.loadUnknown(ballotFname) except Exception, msg: print >> f, ("Unable to read ballots from %s" % ballotFname) print >> f, msg sys.exit(-1) try: e = methods[method](b) e.runElection() except Exception, msg: print >> f, ("Unable to count votes using %s" % method) print >> f, msg sys.exit(-1) try: r = TextReport(e, outputFile=f) r.generateReport(); except Exception, msg: print >> f, "Unable to write report" print >> f, msg sys.exit(-1) f.close() Is there a way for me to make such a Python call from my C# ASP.NET MVC site? If so, how? Thanks in advance!

    Read the article

  • LDAP query using Python: always no result

    - by Grey
    I am trying to use python to query LDAP server, and it always returns me no result. and anyone help me find what wrong with my python code? it runs fine without excpetions, and it always has no result. i played around with the filter like "cn=partofmyname" but just no luck. thanks for help import ldap try: l = ldap.open("server") l.protocol_version = ldap.VERSION3 l.set_option(ldap.OPT_REFERRALS, 0) output =l.simple_bind("cn=username,cn=Users,dc=domian, dc=net",'password$R') print output except ldap.LDAPError, e: print e baseDN = "DC=rim,DC=net" searchScope = ldap.SCOPE_SUBTREE ## retrieve all attributes - again adjust to your needs - see documentation for more options retrieveAttributes = None Filter = "(&(objectClass=user)(sAMAccountName=myaccount))" try: ldap_result_id = l.search(baseDN, searchScope, Filter, retrieveAttributes) print ldap_result_id result_set = [] while 1: result_type, result_data = l.result(ldap_result_id, 0) if len(result_data) == 0: print 'no reslut' break else: for i in range(len(result_set)): for entry in result_set[i]: try: name = entry[1]['cn'][0] email = entry[1]['mail'][0] phone = entry[1]['telephonenumber'][0] desc = entry[1]['description'][0] count = count + 1 print "%d.\nName: %s\nDescription: %s\nE-mail: %s\nPhone: %s\n" %\ (count, name, desc, email, phone) except: pass ## here you don't have to append to a list ## you could do whatever you want with the individual entry #if result_type == ldap.RES_SEARCH_ENTRY: # result_set.append(result_data) # print result_set except ldap.LDAPError, e: print e l.unbind()

    Read the article

  • Pass in a value into Python Class through command line

    - by chrissygormley
    Hello, I have got some code to pass in a variable into a script from the command line. The script is: import sys, os def function(var): print var class function_call(object): def __init__(self, sysArgs): try: self.function = None self.args = [] self.modulePath = sysArgs[0] self.moduleDir, tail = os.path.split(self.modulePath) self.moduleName, ext = os.path.splitext(tail) __import__(self.moduleName) self.module = sys.modules[self.moduleName] if len(sysArgs) > 1: self.functionName = sysArgs[1] self.function = self.module.__dict__[self.functionName] self.args = sysArgs[2:] except Exception, e: sys.stderr.write("%s %s\n" % ("PythonCall#__init__", e)) def execute(self): try: if self.function: self.function(*self.args) except Exception, e: sys.stderr.write("%s %s\n" % ("PythonCall#execute", e)) if __name__=="__main__": test = test() function_call(sys.argv).execute() This works by entering ./function <function> <arg1 arg2 ....>. The problem is that I want to to select the function I want that is in a class rather than just a function by itself. The code I have tried is the same except that function(var): is in a class. I was hoping for some ideas on how to modify my function_call class to accept this. Thanks for any help.

    Read the article

  • Can't get screen pixel from a specific full screen game with any language?

    - by user1007059
    Okay, I know this might seem like I'm posting a duplicate question since I've asked something similar like a day ago HOWEVER, if anyone sees any problem with this, please read my question first before judging: Yesterday I tried getting a specific pixel from a fullscreen game in C#. I thought my C# code was faulty but when I tried with multiple full screen games today they all worked except for that specific game. I literally tried with 10 different full screen games, a couple being mmofps, mmorpg, mmotps, regular rpg games, regular shooters, regular action adventure games, etc. I tried with multiple programming languages, and with every game except that specific game I'm dealing with, it returns the pixel color to me like I wanted. So let me explain what I tried: first I tried returning an IntPtr with C# using GetDC(IntPtr.Zero) before invoking GetPixel(int x, int y) and then getting the color out of it. Then I tried using the Robot class in Java and using the getPixelColor(int x, int y) method. I also tried using GetDC(0) to return an HDC object in C++ and then invoking GetPixel(int x, int y) before again extracting the color. These three methods worked EXACTLY the same in every single game except that specific game I was talking about. They returned the pixel perfectly, and extracted the exact same color perfectly. I don't feel it's necessary to tell you the game name or anything, since you probably don't even know it, but what could possibly be causing this malfunction in 1 specific game? PS: The game ALWAYS returns an RGB color of: A = 255, R = 0, G = 0, B = 0. Also, I tried taking a snapshot of the game with the 3 programming languages, and then getting the pixel which actually works in all 3 languages, but since I need to get this pixel every 30 ms, it kind of makes my game lag a bit (+ I think it takes up a lot of memory)

    Read the article

  • Removing specific tags in a KML file

    - by Legion
    I have a KML file which is a list of places around the world with coordinates and some other attributes. It looks like this for one place: <Placemark> <name>Albania - Durrës</name> <open>0</open> <visibility>1</visibility> <description>(Spot ID: 275801) show <![CDATA[<a href="http://www.windguru.cz/int/index.php?go=1&vs=1&sc=275801">forecast</a>]]></description> <styleUrl>#wgStyle001</styleUrl><Point> <coordinates>19.489747,41.277806,0</coordinates> </Point> <LookAt><range>200000</range><longitude>19.489747</longitude><latitude>41.277806</latitude></LookAt> </Placemark> I would like to remove everything except the name of the place. So in this case that would mean I would like to remove everything except <name>Albania - Durrës</name> The problem is, this KML file includes more than 1000 of these places. Doing this manually obviously isn't an option, so then how can I remove all tags except for the name tags for all of the items in the list? Can I use some kind of program for that?

    Read the article

  • How to change the BIOS splash screen on HP Pavilion G4 1303AU?

    - by avirk
    My cousin got (legally) a laptop model HP Pavilion G4 1303AU from the government of my state. The laptop dual-boots Ubuntu and Windows 7. Everything is great except the BIOS logo at boot which I would like to change but don't know how to. I tried to flash a new BIOS firmware, but this didn't change the logo. I found this link for the same model and the same problem, but no success there either. Also I saw this blog post which wasn't helpful, except for this comment that mentioned an image in .ROM format. Not wishing to decompile and recompile the BIOS, can someone help me out with a step by step guide ?

    Read the article

  • Why does my ReadyNas 4200 have a constant beep post disk failure

    - by swagner88
    Went to check on a high pitched constant beep coming from the server room and discovered that all the LED lights on the disks were black except one which had a constant green. Post a Re-boot nothing changed. Console indicated that that particular drive has failed. Pulled the drive out and BAM everything is fine. Except, the high pitched beep remains. Plan is currently to replace the drive with a new same size drive we happen to have purchased for expansion. My question is, what will this do? Will the NAS accept the new drive as a replacement for the failed one and decide to shut-up? The Manual for the device is almost to straight forward and says that I can just swap drives out as I need but I find that difficult to believe: http://www.readynas.com/download/documentation/HM/RN4200_HW_24May10.pdf

    Read the article

  • Windows 2008 Group Policy Setting? - Migration Headache

    - by DevNULL
    I have a small domain of users that I just migrated from a linux domain running open-ldap. Our new servers are running Windows 2008 Standard. I've installed Active Directory and everything is working perfectly... except that the initial user privileges is pretty restrictive and I need to loosen it up a bit. For example once they login to their workstations, they can create new files and folders but can not modify existing files or start. I basically want to open it all up except for software installations. Can someone please help with with this migration headache?

    Read the article

  • GPO Startup script did not execute on some computers

    - by Aaron Ooi
    The GPO Startup scripts works fine on other machine but not for another half of the machine. gpresult show that GPO was there. I ran RSOP and it show that the Startup script was there but it was never executed. There nothing on application error or anything related to the failed execution in the event viewer. I have set to Allow slow network connection too but it did not help for the startup script to execute. Permission read/execute granted to Domain Computers & Authenticated Users Other GPO settings works except Startup Script did not execute. The scripts works fine as other machine which success without any issue except some machine. I need help to sort this out as it troubles me where another half of the machine did not execute the script at all. It was all WIndows 7.

    Read the article

  • Wikipedia Images don't show up in browsers

    - by mantra
    It's a weird issue with wikipedia which had left me frustrated. When I go to wikipedia, with different browsers ( IE8, Chrome3, Opera10 ) no image in the site will show up. Even right-clicking the image to ( show, save, open in new tab/window ) will return nothing except when open in new tab/window I'll get a black horizontal line across the page. All my browsing across the web goes flawlessly, and every image in every site show up normally except in the wikipedia site. I have win7 ultimate with all updates.

    Read the article

  • excel 2010 format and input issue

    - by Craig Gunn
    I have completed a very complex Excel spreadsheet with a lot of equations, except ... I forgot to include September I have Jan through Dec, all the months, except the calculations for September. Of course all the equations are currently perfect for the data that's here. How do I add a whole new column without ruining the previous equations? PS: tomorrow is my holidays and I have to go to work to finish this table, so bad. would really appreciate some kind expertise :) cheers craig.

    Read the article

  • IIS displaying page differently when localhost is used in URL vs. hostname

    - by maik
    I'm having (yet another) strange problem with IIS. When viewing an ASPX page I've designed on my local machine by browsing to http://localhost/page.aspx the page looks as expected (and looks the same in IE, Firefox and Chrome. If I change localhost to my_hostname the page is rendered with a disabled vertical scroll bar. The behavior was first noticed when I published my site to our live server and saw the same discrepancy. After beating my head against the wall I tried what I described above and was able to duplicate my "problem". So with that, I turn to you guys. This wouldn't really be an issue (save for the cross-browser inconsistency) except that this screws up an "absolute"ly positioned <div> moving it partway off the screen instead of being centered like it should be (and is when viewed any other way except in IE when the address is anything but localhost).

    Read the article

  • Drupal + Zen - not proper layout/no graphics

    - by Luma
    Hello, I installed Drupal (both using Fantastico, then started over from scratch) and Drupal works great except when I setup the Zen theme (following the instructions on the website and in the readme-first.txt) the theme does not show up properly. it has no graphics except for the tiny drupal logo way at the bottom. the rest is text. I have uploaded the theme to the /public_html/sites/all/themes folder and it does show up in themes in the administer section so I select enable and default. permissions on this folder are 755. any ideas? I checked the Drupal forums and someone is having the same problem but no one replied (this was in April) so I figured I would have a better shot on this awesome website. thanks. Luma

    Read the article

  • Set 802.1Q tagged port on VLAN1 on Dell PowerConnect switch

    - by Javier
    I'm having big troubles when adding this Dell switch to my network. Here we use several VLANs to segment traffic. All switches (3com and DLink mostly) have configured the same VLANs, most ports are 'untagged' and belong to a single VLAN, except for the ports used to join together the switches (in a star topology), these ports belong to all VLANs and use 802.1Q tags. So far, it works really well. But on this new switch (a Dell PowerConnect 5448), the settings are very different (and confusing). I have configured the same VLANs, an the uplink ports are set in 'general' mode (supposed to be fully 802.1Q compliant), I can set the VLAN membership as 'T' on these ports for all VLANs except VLAN 1. It always stay as 'U' on VLAN 1. Any ideas?

    Read the article

  • How to make cygwin shortcut stick to Windows 7 dock

    - by Frank Krueger
    I have recently installed cygwin on a Windows 7 beta machine. Everything works great, except one little annoyance: The cygwin shortcut (Start-All Programs-cygwin-cygwin Bash Shell) cannot be pinned to the Start menu. My guess as to why is that I already have a "Console" window pinned to the start menu. My guess is that Windows sees that the two EXEs are the same and won't let me pin it. This would be fine except I cannot pin the window to the Dock either. While cygwin is running, WIndows interprets it as just a Command Window and won't let me pin it either. How do you pin the cygwin shortcut to the dock?

    Read the article

  • Postfix sends email to spam (gmail, hotmail)

    - by razorxan
    I recently installed a postfix + dovecot + dkim multi domain, multi user, multi alias mail server on my debian squeeze system. Everything works except for one big issue that basically makes the whole thing useless: Every single email sent by my server goes straight into spam. (gmail, hotmail) First thing i did is doing the well known allaboutspam test and all is checked (green) except for the BATV thing (yellow): Reverse dns: green HELO Greeting: green RBL: green BATV: yellow SPF: green DKIM: green URIBL: green SPAMAssassin: green Greylist: green I'm really confused and i can't see a way to solve this issue. Ask me any detail if you need.

    Read the article

  • Security measures for CentOS

    - by cappuccinodrinker
    I have been tightening up my web server security and wanted to know what else I can do. I am running CentOS 5 with these measures: - All passwords to FTP, MySQL etc are generated from grc.com/passwords.htm and microsoft.com/protect/fraud/passwords/create.aspx (for the ones which cannot be too long). - Running iptables with all ports shut off except for http mail and smtp, the important ports like FTP SSH are blocked to all except my static office IP. There is also no response to pings. - Rootkit Hunter running daily - The server is PCI compliant according to Comodo - Not running any crappy made php apps, we use Zend Framework for our stuff and do have kayako installed and keep them up to date. Can't really think of anything else I can do... I could implement a brute force measure, but I think I already have by simply changing my SSH port to a number above 10000 and blocking it off with iptables.

    Read the article

  • Subdomain only accessible from one computer

    - by Edan Maor
    I recently added a wildcard A record to my domain (*.root.com), mapping it to a certain elastic ip on AWS. I've configured apache to redirect all references to something.root.com to root.com, except for one specific "dev" subdomain, which is hosting its own site (a Django app, specifically). The Problem: This setup works perfectly for me on my computer. But on other computers around the office, it doesn't seem to work. Specifically, trying to visit dev.root.com gives an "unable to find server" error. Pinging dev.root.com gives a "cannot resolve hostname" error. The weird thing: pinging any other subdomain of root.com does work, from all machines. I would think this was all due to DNS propagation, except all the computers are behind the same office router, so how could that be the case? Any ideas?

    Read the article

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