Daily Archives

Articles indexed Thursday March 11 2010

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

  • Guessing Excel Data Types

    - by AjarnMark
    Note to Self HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel: TypeGuessRows = 0 means scan everything. Note to Others About 10 years ago I stumbled across this bit of information just when I needed it and it saved my project.  Then for some reason, a few years later when it would have been nice, but not critical, for some reason I could not find it again anywhere.  Well, now I have stumbled across it again, and to preserve my future self from nightmares and sudden baldness due to pulling my hair out, I have decided to blog it in the hopes that I can find it again this way. Here’s the story…  When you query data from an Excel spreadsheet, such as with old-fashioned DTS packages in SQL 2000 (my first reference) or simply with an OLEDB Data Adapter from ASP.NET (recent task) and if you are using the Microsoft Jet 4.0 driver (newer ones may deal with this differently) then you can get funny results where the query reports back that a cell value is null even when you know it contains data. What happens is that Excel doesn’t really have data types.  While you can format information in cells to appear like certain data types (e.g. Date, Time, Decimal, Text, etc.) that is not really defining the cell as being of a certain type like we think of when working with databases.  But, presumably, to make things more convenient for the user (programmer) when you issue a query against Excel, the query processor tries to guess what type of data is contained in each column and returns it in an appropriate manner.  This is all well and good IF your data is consistent in every row and matches what the processor guessed.  And, for efficiency’s sake, when the query processor is trying to figure out each column’s data type, it does so by analyzing only the first 8 rows of data (default setting). Now here’s the problem, suppose that your spreadsheet contains information about clothing, and one of the columns is Size.  Now suppose that in the first 8 rows, all of your sizes look like 32, 34, 18, 10, and so on, using numbers, but then, somewhere after the 8th row, you have some rows with sizes like S, M, L, XL.  What happens is that by examining only the first 8 rows, the query processor inferred that the column contained numerical data, and then when it hits the non-numerical data in later rows, it comes back blank.  Major bummer, and a real pain to track down if you don’t know that Excel is doing this, because you study the spreadsheet and say, “the data is RIGHT THERE!  WHY doesn’t the query see it?!?!”  And the hair-pulling begins. So, what’s a developer to do?  One option is to go to the registry setting noted above and change the DWORD value of TypeGuessRows from the default of 8 to 0 (zero).  Setting this value to zero will force Jet to scan every row in the spreadsheet before making its determination as to what type of data the column contains.  And that means that in the example above, it would have treated the column as a string rather than as numeric, and presto! your query now returns all of the values that you know are in there. Of course, there is a caveat… if you are querying large spreadsheets, making Jet scan every row can be quite a performance hit.  You could enter a different number (more than 8) that you believe is a better sampling of rows to make the guess, but you still have the possibility that every row scanned looks alike, but that later rows are different, and that you might get blanks when there really is data there.  That’s the type of gamble, I really don’t like to take with my data. Anyone with a better approach, or with experience with more recent drivers that have a better way of handling data types, please chime in!

    Read the article

  • Is it possible to have multiple sets of key columns in a table?

    - by Peter Larsson
    Filtered indexes is one of my new favorite things with SQL Server 2008. I am currently working on designing a new datawarehouse. There are two restrictions doing this It has to be fed from the old legacy system with both historical data and new data It has to be fed from the new business system with new data When we incorporate the new business system, we are going to do that for one market only. It means the old legacy business system still will produce new data for other markets (together with historical data for all markets) and the new business system produce new data to that one market only. Sounds interesting this far? To accomplish this I did a thorough research about the business requirements about the business intelligence needs. Then I went on to design the sucker. How does this relate to filtered indexes you ask? I'll give one example, the Stock transaction table. Well, the key columns for the old legacy system are different from the key columns from the new business system. The old legacy system has a key of 5 columns Movement date Movement time Product code Order number Sequence number within shipment And to all thing, I found out that the Movement Time column is not really a time. It starts out like a time HH:MM:SS but seconds are added for each delivery within the shipment, so a Movement Time can look like "12:11:68". The sequence number is ordered over the distributors for shipment. As I said, it is a legacy system. The new business system has one key column, the Movement DateTime (accuracy down to 100th of nanosecond). So how to deal with this? On thing would be to have two stock transaction tables, one for legacy system and one for the new business system. But that would lead to a maintenance overhead and using partitioned views for getting data out of the warehouse. Filtered index will be of a great use here. MovementDate DATETIME2(7) MovementTime CHAR(8) NULL ProductCode VARCHAR(15) NOT NULL OrderNumber VARCHAR(30) NULL SequenceNumber INT NULL The sequence number is not even used in the new system, so I created a clustered index for a new IDENTITY column to make a new identity column which can be shared by both systems. Then I created one unique filtered index for old system like this CREATE UNIQUE NONCLUSTERED INDEX IX_Legacy (MovementDate, MovementTime, ProductCode, SequenceNumber) INCLUDE (OrderNumber, Col5, Col6, ... ) WHERE SequenceNumber IS NOT NULL And then I created a new unique filtered index for the new business system like this CREATE UNIQUE NONCLUSTERED INDEX IX_Business (MovementDate) INCLUDE (ProductCode, OrderNumber, Col12, ... ) WHERE SequenceNumber IS NULL This way I can have multiple sets of key columns on same base table which is shared by both systems.

    Read the article

  • Uploading documents to WSS (Windows Sharepoint Services) using SSIS

    - by Randy Aldrich Paulo
    Recently I was tasked to create an SSIS application that will query a database, split the results with certain criteria and create CSV file for every result and upload the file to a Sharepoint Document Library site. I've search the web and compiled the steps I've taken to build the solution. Summary: A) Create a proxy class of WSS Copy.asmx. B) Create a wrapper class for the proxy class and add a mechanism to check if the file is existing and delete method. C) Create an SSIS and call the wrapper class to transfer the files.   A) Creating Proxy Class 1) Go to Visual Studio Command Prompt type wsdl http://[sharepoint site]/_vti_bin/Copy.asmx this will generate the proxy class (Copy.cs) that will be added to the solution. 2) Add Copy.cs to solution and create another constructor for Copy() that will accept additional parameters url, userName, password and domain.   public Copy(string url, string userName, string password, string domain) { this.Url = url; this.Credentials = new System.Net.NetworkCredential(userName, password, domain); } 3) Add a namespace.     B) Wrapper Class Create a C# new library that references the Proxy Class.         C) Create SSIS SSIS solution is composed of:   1) Execute SQL Task, returns a single column rows containing the criteria. 2) Foreach Loop Container - loops per result from query (SQL Task) and creates a CSV file on a certain folder. 3) Script Task - calls the wrapper class to upload CSV files located on a certain folder to targer WSS Document Library Note: I've created another overload of CopyFiles that accepts a Directory Info instead of file location that loops thru the contents of the folder. Designer View Variable View

    Read the article

  • COM+, DTC, and 80070422

    - by Chris Miller
    One of our  "packaged" software bits that accesses my servers is going through an upgrade right now.  Apparently this software requires DTC to be installed on my SQL Server, and able to accept remote connections.  So I look up how to do that in the knowledge base: http://support.microsoft.com/?kbid=555017 And immediately hit a roadblock.  The DTC components aren't showing up in my Component Services console.  The entire console's acting weird (well, weirder than usual) and when I go into the console and click "Options" it insists on having a timeout entered, and when I enter one, close the box, and go back, the setting's gone again and I'm required to re-enter it.  Lots of weirdness, and no DTC tab.  If you open the COM+ folders, you immediately get error 80070422. After a lot of searching I was looking through the Services listing on the box (after restarting DTC for the twelfth time) and saw that "Com+ System Application" was disabled.  I set it to manual, rebooted the box (test server) and everything started working. So, if you're trying to follow those instructions and discover that the Component Services tool is acting odder than usual, make sure that service isn't disabled.

    Read the article

  • WPF Radiobutton equivalent

    - by baron
    What is the WPF equivalent for WinForms radio button CheckedChanged? I have your basic 2 radio button set up, where when one is selected a textbox is enabled and when the other is selected it is disabled. For the time being I was using RadioButton_Checked, except, I set IsChecked true for one button in the xaml. When I reference the textbox in that Checked method it throws NullReferenceException... Let me know if you need code.

    Read the article

  • Profile:Object reference not set to an instance of an object

    - by sallalman83
    Hi, i just lunch my web site i used the asp.net routing technology on it, and its work fine in my localhost but when i moved the project to the hosting server(Godaddy.com) its just work fine when there is no virtual sub directories like this(havebreak.com) but when u click on this link (havebreak.com/Registration/) or any other links that contain a virtual sub-directories its give Object reference not set to an instance of an object error on the profile object if (!Profile.IsAnonymous) Line 18: mlvRegistratioin.ActiveViewIndex = 1; i check my IIS settings and found it using the "Integrated pipeline" as recommended (at least at my knowledge), i checked the httpModules and httpHandlers tags under the system.webServer (since my hosting plan use the IIS7) and under the normal tag and every thing is fine then i used the url-rewriting instead of URL-Routing and the same problem exist and i notice that the session also not working in the virtual sub-directories too and by the way the ASP.NET routing work fine with my site its just the profile and session objects that not workin any help will be appreciated

    Read the article

  • Copy .exe to Explorer.exe!

    - by Phillip
    What would happen if an ordinary .exe file is copied to explorer.exe? Will it be automatically running as long as explorer.exe is running? This seems like a major security whole...is it even possible? Does anti-virus protect against that sort of thing?

    Read the article

  • Can ASP.NET be configured to run as an administrator when UAC is enabled?

    - by Steve Eisner
    I can't seem to find any information that indicates whether ASP.NET can be configured (through web.config or maybe machine.config) to run as a real administrator on a machine with UAC enabled. By this I mean, even if you set it to impersonate an Administrator account, UAC will disable that account's ability to act as an Administrator by returning a token set that hides the administrator role. For any checks such as IsInRole, the running account is effectively not an administrator at all. So ... Let's say I want to ignore all good advice and just go ahead and run a web app on Vista with administrator permissions. Is it even possible? Alternatives welcome. (Core reason for needing administrator privileges: to stop or start services that are running on that machine.)

    Read the article

  • Error: Specified method is not supported?!!

    - by DanSogaard
    I keep getting this error when I try to call Find() public void findTxt(string text) { BindingSource src = new BindingSource(); src.DataSource = dataGridView1.DataSource; src.Position = src.Find("p_Name", text); // Specified method is not supported if (src.Position == 0 && dataGridView1.Rows[0].Cells[2].Value.ToString() == text) { MessageBox.Show("Item found!!"); dataGridView1.CurrentCell = dataGridView1.Rows[src.Position].Cells[2]; } else if (src.Position == 0 && dataGridView1.Rows[0].Cells[2].Value.ToString() != text) { MessageBox.Show("Item not found!!"); } else { MessageBox.Show("Item found!!"); dataGridView1.CurrentCell = dataGridView1.Rows[src.Position].Cells[2]; } }

    Read the article

  • Finding the Reachability Count for all vertices of a DAG

    - by ChrisH
    I am trying to find a fast algorithm with modest space requirements to solve the following problem. For each vertex of a DAG find the sum of its in-degree and out-degree in the DAG's transitive closure. Given this DAG: I expect the following result: Vertex # Reacability Count Reachable Vertices in closure 7 5 (11, 8, 2, 9, 10) 5 4 (11, 2, 9, 10) 3 3 (8, 9, 10) 11 5 (7, 5, 2, 9, 10) 8 3 (7, 3, 9) 2 3 (7, 5, 11) 9 5 (7, 5, 11, 8, 3) 10 4 (7, 5, 11, 3) It seems to me that this should be possible without actually constructing the transitive closure. I haven't been able to find anything on the net that exactly describes this problem. I've got some ideas about how to do this, but I wanted to see what the SO crowd could come up with.

    Read the article

  • facebook: can't send email from app to user

    - by flybywire
    I can't send email to my app users, even though I have the permissions. I am working with the java library, although I don't think it is related to that. long uid = ...; Collection<Long> uids = new ArrayList<Long>(); uids.add(uid); FacebookXmlRestClient client = new FacebookXmlRestClient(api, secret); boolean sendEmailPerm = client.users_hasAppPermission(Permission.EMAIL,uid); System.out.println("Can send email: "+ sendEmailPerm); Collection<String> sent = client.notifications_sendTextEmail(uids, "subject", "body"); System.out.println("Succesfully sent email to: "+sent); sent = client.notifications_sendFbmlEmail(uids, "subject", "body"); System.out.println("Succesfully sent email to: "+sent); I am trying both with fbml and text email. I can also obtain the user's proxied_email property but when I send email to that address with my regular mail client is doesn't arrive. The output is: Can send email: true Succesfully sent email to: [] Succesfully sent email to: []

    Read the article

  • Scanning string in perl

    - by Alphaneo
    What is the best way to achieve sscanf like functionality in perl? I am looking now looking at the sscanf module, Which is better, Option-1: Going sscanf way? Option-2: Regex way? [I am a beginner when it comes to Regex]

    Read the article

  • ASP.NET MVC not serving default document

    - by Jon Cahill
    I have an ASP.NET MVC application where the default page should be an index.html. I can browse to the file using www.mydomain.com/index.html but if I use www.mydomain.com I get a 404. I have check to see if the default document is correctly set in IIS7 and it is and I have even commented out all my routes to ensure it isn't that. Does anyone know how to get ASP.NET MVC to serve the default document?

    Read the article

  • Does importing of packages change visibility of classes?

    - by Roman
    I jsut learned that A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package. This is a clear statement. But this information interfere with my understanding of importing of packages (which easily can be wrong). I thought that importing a package I make classes from the imported package visible to the importing class. So, how does it work? Are public classes visible to all classes everywhere under condition that the package containing the public class is imported? Or there is not such a condition? What about the package-private classes? They are invisible no mater if the containing package was imported or not? ADDED: It seems to me that I got 2 answers which are marked as good (up-voted) and which contradict eachother.

    Read the article

  • Are there any platforms where using structure copy on an fd_set (for select() or pselect()) causes p

    - by Jonathan Leffler
    The select() and pselect() system calls modify their arguments (the 'struct fd_set *' arguments), so the input value tells the system which file descriptors to check and the return values tell the programmer which file descriptors are currently usable. If you are going to call them repeatedly for the same set of file descriptors, you need to ensure that you have a fresh copy of the descriptors for each call. The obvious way to do that is to use a structure copy: struct fd_set ref_set_rd; struct fd_set ref_set_wr; struct fd_set ref_set_er; ... ...code to set the reference fd_set_xx values... ... while (!done) { struct fd_set act_set_rd = ref_set_rd; struct fd_set act_set_wr = ref_set_wr; struct fd_set act_set_er = ref_set_er; int bits_set = select(max_fd, &act_set_rd, &act_set_wr, &act_set_er, &timeout); if (bits_set > 0) { ...process the output values of act_set_xx... } } My question: Are there any platforms where it is not safe to do a structure copy of the struct fd_set values as shown? I'm concerned lest there be hidden memory allocation or anything unexpected like that. (There are macros/functions FD_SET(), FD_CLR(), FD_ZERO() and FD_ISSET() to mask the internals from the application.) I can see that MacOS X (Darwin) is safe; other BSD-based systems are likely to be safe, therefore. You can help by documenting other systems that you know are safe in your answers. (I do have minor concerns about how well the struct fd_set would work with more than 8192 open file descriptors - the default maximum number of open files is only 256, but the maximum number is 'unlimited'. Also, since the structures are 1 KB, the copying code is not dreadfully efficient, but then running through a list of file descriptors to recreate the input mask on each cycle is not necessarily efficient either. Maybe you can't do select() when you have that many file descriptors open, though that is when you are most likely to need the functionality.) There's a related SO question - asking about 'poll() vs select()' which addresses a different set of issues from this question.

    Read the article

  • Are PyArg_ParseTuple() "s" format specifiers useful in Python 3.x C API?

    - by Craig McQueen
    I'm trying to write a Python C extension that processes byte strings, and I have something basically working for Python 2.x and Python 3.x. For the Python 2.x code, near the start of my function, I currently have a line: if (!PyArg_ParseTuple(args, "s#:in_bytes", &src_ptr, &src_len)) ... I notice that the s# format specifier accepts both Unicode strings and byte strings. I really just want it to accept byte strings and reject Unicode. For Python 2.x, this might be "good enough"--the standard hashlib seems to do the same, accepting Unicode as well as byte strings. However, Python 3.x is meant to clean up the Unicode/byte string mess and not let the two be interchangeable. So, I'm surprised to find that in Python 3.x, the s format specifiers for PyArg_ParseTuple() still seem to accept Unicode and provide a "default encoded string version" of the Unicode. This seems to go against the principles of Python 3.x, making the s format specifiers unusable in practice. Is my analysis correct, or am I missing something? Looking at the implementation for hashlib for Python 3.x (e.g. see md5module.c, function MD5_update() and its use of GET_BUFFER_VIEW_OR_ERROUT() macro) I see that it avoids the s format specifiers, and just takes a generic object (O specifier) and then does various explicit type checks using the GET_BUFFER_VIEW_OR_ERROUT() macro. Is this what we have to do?

    Read the article

  • Ideas for OpenSource CMS in ASP.NET MVC

    - by rajesh pillai
    I am in the process of collecting ideas for building an opensource CMS based on ASP.net framework. I have choosen ASP.NET MVC with Jquery as the tool to develop this. I have made this as community wiki. Background: Most of the good CMS that is available is built on PHP, though off late CMS built on ASP.net framework seems to be cropping up. I would like to collect ideas/suggestion/expectations from an opensource CMS system for ASP.net platform. I am looking for expectation from technology and features that you wish could find in a modern CMS and any other thoughts/ideas that comes to your mind. Your input would be of great help in this direction. Meanwhile I am also reviewing many opensource CMS system built on ASP.net as well as MS Office Sharepoint to get ideas and I would update my findings here for your reference. The following are some of the opensource CMS/BlogEngines that I am in the process of reviewing. -Oxite (ASP.net MVC) : This is the new kid on the block -Wordpress -BlogEngine.net -Umbraco Some of the features that I can think of is noted below Simplified content creation Support Multiple content author Metadata feature Workflow engine Simplified deployment List based contents (sharepoint like) Customizable URL's Support content Caching Roles (contenauthor, contentpublisher etc) Support different types of content (like html, txt, document, image, videos) Skinnable (support extensible themes) Localization & Globalization Unlimited nesting of categories Readymade template for blog, forums,survey. Good documentation You can add your points or add some depth to any of the above feature.

    Read the article

  • Method to capture a screenshot of user's browser to aid in bug reporting

    - by Buzz
    I'm looking for a way to make it easy for technically unsophisticated users to submit screenshots of their browser to me, to aid in debugging web application problems. There will be a button on all pages inside a web application they can use to report problems, which I would like to submit a screenshot (among other things). http://www.snapabug.com/ is very close to what I want, but I need to be able to customize a few things that service won't let me. Production environment is LAMP. I expect there must be something Flash-based that can do this, but I've not been able to find something. Thanks!

    Read the article

  • sending mail in rails from tutorial - outdated?

    - by Stacia
    I'm trying to use this tutorial (http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-send-emails.htm) to send mail on rails, but nothing seems to happen. I have ActionMailer::Base.delivery_method = :sendmail in my environment.rb. It's possible the tutorial may be out of date for the more recent version of rails? If so can someone tell me where it goes wrong or a link to another tutorial. I see this in the log. It's a little supsicious that the "to" has subject and stuff appended to it, but I don't know where it went wrong. Processing EmailerController#sendmail (for 127.0.0.1 at 2010-03-10 19:02:21) [POST] Parameters: {"commit"=>"Send", "authenticity_token"=>"251d315cc4dfc6c58c2c7f6f633d52b101d10c14", "email"=>{"recipient"=>"[email protected]", "subject"=>"booooooo", "message"=>"aabdsaf"}} SQL (0.1ms) SET NAMES 'utf8' SQL (0.1ms) SET SQL_AUTO_IS_NULL=0 Sent mail to subject, booooooo, recipient, [email protected], message, aabdsaf Date: Wed, 10 Mar 2010 19:02:21 -0800 From: [email protected] To: [email protected] Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Hi! You are having one email message from [email protected] with a title This is title and following is the message: Thanks edit: I manually changed "recipient" to my mail address and I still don't get mail, even though the problem in the log with all of the things stuck together is fixed.

    Read the article

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