text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I am writing a few extensions to mimic the map and reduce functions in Lisp. ``` public delegate R ReduceFunction<T,R>(T t, R previous); public delegate void TransformFunction<T>(T t, params object[] args); public static R Reduce<T,R>(this List<T> list, ReduceFunction<T,R> r, R initial) { var aggregate = initial; foreach(var t in list) aggregate = r(t,aggregate); return aggregate; } public static void Transform<T>(this List<T> list, TransformFunction<T> f, params object [] args) { foreach(var t in list) f(t,args); } ``` The transform function will
[ -0.03963536396622658, -0.11158657819032669, 0.5368987917900085, -0.2651091516017914, -0.21643474698066711, 0.5128830075263977, 0.2775154709815979, -0.6720672249794006, -0.20470519363880157, -0.718281090259552, -0.15923120081424713, 0.5285687446594238, -0.4616495668888092, 0.245959013700485...
cut down on cruft like: ``` foreach(var t in list) if(conditions && moreconditions) //do work etc ``` Does this make sense? Could it be better? These look very similar to extensions in Linq already: ``` //takes a function that matches the Func<T,R> delegate listInstance.Aggregate( startingValue, (x, y) => /* aggregate two subsequent values */ ); //takes a function that matches the Action<T> delegate listInstance.ForEach( x => /* do something with x */); ``` Why is the 2nd example called Transform? Do you intend to change the values in the list
[ 0.2400585561990738, -0.23000316321849823, 0.225393146276474, -0.0047545465640723705, -0.21106818318367004, 0.07963329553604126, -0.12856270372867584, -0.5110147595405579, -0.09842710942029953, -0.6047443747520447, -0.07383934408426285, 0.8678780794143677, -0.531078040599823, -0.07516676187...
somehow? If that's the case you may be better off using `ConvertAll<T>` or `Select<T>`.
[ 0.5642684102058411, -0.13539642095565796, -0.03567543253302574, 0.05780152231454849, 0.038690485060214996, 0.09458588808774948, 0.09381706267595291, 0.12726739048957825, -0.1068345233798027, -0.5005937814712524, 0.012870256789028645, 0.4742952883243561, -0.09597720950841904, 0.105917997658...
I have been experimenting with [woopra.com](http://www.woopra.com/) A web analytics tool. Which requires a piece of javascript code to be added to each page to function. This is easy enough with more dynamic sites with universal headers or footers but not for totally static html pages. I attempted to work round it by using a combination of Apache rewrites and SSI's to "Wrap" the static html with the required code. For example... I made the following changes to my apache config ``` RewriteEngine On RewriteCond %{REQUEST_URI} !=test.shtml RewriteCond %{IS_SUBREQ} false
[ 0.46334782242774963, 0.20934626460075378, 0.5651665925979614, -0.192025825381279, -0.4040377140045166, -0.17789310216903687, 0.541341245174408, -0.577205240726471, 0.010055841878056526, -0.4681594967842102, -0.08163301646709442, 0.3520010709762573, -0.24669919908046722, 0.07689610868692398...
RewriteRule (.*)\.html test.shtml?$1.html ``` The test.shtml file contains... ``` <script type="text/javascript"> var XXXXid = 'xxxxxxx'; </script> <script src="http://xxxx.woopra.com/xx/xxx.js"></script> <!--#set var="page" value="$QUERY_STRING" --> <!--#include virtual= $page --> ``` The idea was that a request coming in for ``` /abc.html ``` would be redirected to ``` /test.shtml?abc.html ``` the shtml would then include the original file into the response page. Unfortunately it doesn't quite work as planed :) can anyone see what I am doing wrong or perhaps suggest an alternative approach. Is there any apache modules
[ 0.6063360571861267, 0.10714777559041977, 0.9484267234802246, -0.19754496216773987, 0.0341489352285862, 0.10396050661802292, 0.573085367679596, -0.9313482046127319, 0.1140383630990982, -0.3387581408023834, 0.13774749636650085, 0.5907077789306641, -0.20796024799346924, 0.050053343176841736, ...
that could do the same thing. Preferably that can be configured on a per site basis. Thanks Peter I think that [mod\_filter\_ext](http://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html) is the module you are looking for. You can write a short Perl script for example to insert the JS code in the pages and register it to process HTML pages: ``` while (<>) { s/<html>/\Q<script>....\E/; print $_; } ``` You could even use something like `sed` to perform the substitution.
[ 0.46132344007492065, -0.17240460216999054, 0.12501683831214905, 0.041372038424015045, -0.11961863934993744, -0.34940385818481445, 0.2940720319747925, -0.059905942529439926, -0.21475282311439514, -0.8045197129249573, -0.14680245518684387, 0.42861631512641907, -0.4908145070075989, -0.1754718...
A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked into soap4r, but it seems to have a slightly bad reputation. So what's the best way to integrate SOAP calls into a Rails app? We used the built in `soap/wsdlDriver` class, which is actually SOAP4R. It's dog slow, but really simple. The SOAP4R
[ 0.45292598009109497, 0.09259183704853058, 0.059858132153749466, 0.11904265731573105, -0.29013773798942566, 0.11467507481575012, 0.5121967792510986, -0.03389750421047211, 0.1431940793991089, -0.7012311220169067, 0.42541611194610596, 0.548830509185791, -0.42821991443634033, 0.118580795824527...
that you get from gems/etc is just an updated version of the same thing. Example code: ``` require 'soap/wsdlDriver' client = SOAP::WSDLDriverFactory.new( 'http://example.com/service.wsdl' ).create_rpc_driver result = client.doStuff(); ``` That's about it
[ 0.5105963349342346, 0.016488157212734222, 0.33884990215301514, -0.13611751794815063, 0.28767916560173035, -0.2554565668106079, 0.4838382601737976, -0.13336430490016937, -0.1599118709564209, -0.39070844650268555, -0.1432362198829651, 0.9041512608528137, -0.09802563488483429, 0.2507822215557...
Let's say I'm building a data access layer for an application. Typically I have a class definition for a each kind of object that is stored in the database. Of course, the actual data access retrieves data in the form of a datareader, typed or untyped dataset, or similar, usually with the data needed to create one object per row in the results. How would you go about creating your object instances in the data layer? Would have a constructor that accepts a datarow? If so, how would you make that type-safe? Or would you have your constructor list out one
[ 0.15374869108200073, 0.2341563105583191, 0.08642683923244476, 0.5008181929588318, -0.06554969400167465, 0.1557251214981079, -0.12625278532505035, -0.03802548348903656, -0.19407442212104797, -0.5870644450187683, 0.14615458250045776, 0.44426336884498596, -0.16011257469654083, 0.3559724390506...
parameter for each field you want to instantiate, even if there could be many fields? Would you mark this constructor 'internal'? I highly encourage you to use an ORM tool. Even simple projects can make use of ORM quickly and quietly... in particular, look at [Castle](http://www.castleproject.org/)'s [ActiveRecord](http://www.castleproject.org/activerecord/) tool (which sits on top of NHibernate to simplify model declaration).
[ -0.1311166137456894, -0.0953417718410492, 0.2710089087486267, 0.0026277503930032253, -0.2621029317378998, 0.05336427316069603, 0.142348051071167, -0.20349745452404022, -0.122464619576931, -0.3226702809333801, 0.2762865722179413, 0.6738845705986023, -0.21295687556266785, 0.21906322240829468...
I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work: ``` $ umount -f /mnt/data $ umount2: Device or resource busy $ umount: /mnt/data: device is busy ``` If I type "`mount`", it appears that the directory is no longer mounted, but it hangs if I do "`ls /mnt/data`", and if I try to remove the mountpoint, I get: ``` $ rmdir /mnt/data rmdir: /mnt/data: Device or resource busy ``` Is there anything I can do other than reboot the machine? You might try a lazy unmount: ``` umount -l ```
[ 0.23637209832668304, 0.09189660102128983, 0.5612807273864746, -0.09066397696733475, 0.0753990113735199, 0.11289536207914352, 0.08144286274909973, -0.07692863792181015, -0.4612177908420563, -0.4537430703639984, -0.05560997501015663, 0.7650882005691528, -0.4348528981208801, 0.407628327608108...
I am a member of all the roles (Browser, Content Manager, My Reports, Publisher, Report Builder). If I login with a Local Administrator account, I can see and use it fine. Any ideas? The first thing I would check is to make sure that your normal login is mapped to a role with the correct system-level permissions. The item-level role definitions don't make a difference for the "Report Builder" button. From the browser-based report manager interface: * Click "site settings" * In the Security section, click "Configure system-level role definitions" * Click the Role that you want to have this ability (e.g. "System Administrator" and
[ 0.452746719121933, -0.045223936438560486, 0.49123966693878174, 0.07036897540092468, -0.01675983890891075, -0.3603900969028473, 0.30183157324790955, 0.12653639912605286, -0.11517897993326187, -0.8708801865577698, -0.14983642101287842, 0.5997580289840698, 0.014268240891397, 0.063077531754970...
"System User" are the default roles, but I believe that you can create your own if you want to). * Make sure that the "Execute Report Definitions" task is checked/selected. This is the permission that controls whether or not the "Report Builder" button is displayed. * Click "OK" and then return to the "Site Settings" page. * In the Security section, click "Configure site-wide security" * Click "New Role Assignment" and then map your login (or an AD group to which your login belongs might be even better) to the system-level role you edited in the previous steps. The forms are pretty straightforward, and I'd
[ 0.048803381621837616, -0.23146255314350128, 0.3410617709159851, 0.04708593338727951, -0.0232671070843935, -0.21084773540496826, 0.2704121470451355, -0.0838252604007721, -0.20967185497283936, -0.8626395463943481, -0.21307837963104248, 0.6638504266738892, -0.14245079457759857, -0.05486996844...
guess that your login just isn't mapped to the proper system-level role since you can see the button with the local administrator login. If that doesn't work, you might check your IIS security settings for the report service to make sure that they're configured to use windows authentication (assuming that's what you're using in the first place).
[ 0.1654401570558548, -0.029194550588726997, 0.12322813272476196, 0.12694613635540009, 0.29109179973602295, -0.24139127135276794, 0.49346795678138733, 0.18577519059181213, -0.4634014964103699, -0.619771420955658, 0.023154621943831444, 0.5174851417541504, -0.004928745329380035, -0.10859873145...
We have a SQL server database. To manipulate the data non-programmatically, I can use SQL Server Management Studio by right-clicking a table and selecting "Open Table". However this is slow for very large tables and sorting and filtering is cumbersome. Typically what we have done until now is to create an Access database containing linked tables which point to the SQL Server tables and views. Opening a large table is much faster this way, and Access has easy-to-use right-click filtering and sorting. However, since Access 2007, sorting in particular has been quite slow when working with large tables. The Access database can
[ -0.09515693038702011, 0.3413390517234802, 0.372416615486145, 0.2881510555744171, 0.04764121025800705, -0.1870073825120926, -0.17724831402301788, 0.14656296372413635, -0.5288018584251404, -0.8092842698097229, 0.1409410685300827, 0.3831005394458771, -0.2231210321187973, 0.43274131417274475, ...
also inadvertently lock the database tables, blocking other processes that may need to access the data. Creating the Access database in the first place, and updating it when new tables are added to SQL Server, is also tedious. Is there a better way to work with the data that offers the usability of Access without its drawbacks? Joel Coehoorn's answer is of course correct, that if the data is critical or there are naive users using the data, then a application front end should be developed. That being said, I have cases where a wise user (ok, me) user needs to just
[ 0.026949699968099594, 0.41405513882637024, -0.253256618976593, 0.47371232509613037, 0.1994764804840088, -0.03149605169892311, 0.17916613817214966, -0.1466611623764038, -0.18690279126167297, -0.08162688463926315, 0.11477974057197571, 0.6765283346176147, 0.04340660572052002, -0.0514371320605...
get in there and poke around. Instead of directly looking at the tables, use MS Access but use queries to narrow down what you're looking at both column wise and row wise. That will improve the speed. Then edit the query properties and make sure that the query is No Locks. That should eliminate any blocking behavior. You may want to limit the number of rows returned which again will improve the speed. You can still edit the data in the query as you look at it. Depending on what you're looking at, it may also be useful to set up
[ 0.087845578789711, -0.062223173677921295, 0.1514216810464859, 0.2749774754047394, 0.22793279588222504, -0.1402473747730255, 0.3410691022872925, -0.10464433580636978, -0.4663788676261902, -0.8123629093170166, -0.08835054934024811, 0.5166339874267578, -0.19448786973953247, 0.1570235490798950...
database Views in the SQL Server to do some of the heavy lifting on the server rather than on the client.
[ 0.10016990453004837, 0.0895124301314354, 0.4208521842956543, 0.42169076204299927, -0.13000363111495972, -0.16237327456474304, -0.14630009233951569, 0.17415276169776917, -0.44637754559516907, -0.4999535381793976, 0.04262677580118179, 0.4780866503715515, -0.1595657467842102, 0.46756529808044...
So, we have [coding books](https://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read), [coding RSS feeds](https://stackoverflow.com/questions/5119/what-are-the-best-rss-feeds-for-programmersdevelopers), and [music to code by](https://stackoverflow.com/questions/3947/coding-music). Are there any coding magazines that anyone would recommend? The venerable [Dr. Dobbs Journal](http://www.ddj.com/) is still pretty good. It covers multiple platforms, and mixes some fairly hard-core technical articles with lighter fare (interviews with notables, a "Developer Diaries" column that profiles regular-Joe (and Jane) developers from a range of fields). If you are employed and have authority to spend some non-trivial amount of money on tools (or are willing to claim that you do), you can probably get them to send it to you for free. For the Microsoft
[ 0.7900799512863159, 0.1506846696138382, -0.11249995231628418, 0.44368866086006165, -0.08550027012825012, -0.3668517768383026, -0.08636637777090073, 0.0268199872225523, -0.356814444065094, -0.1877487748861313, -0.10799218714237213, 0.5537592768669128, 0.09139630198478699, -0.251546591520309...
world, [MSDN Magazine](http://msdn.microsoft.com/en-us/magazine/default.aspx) is very useful. Some of their columns are excellent, particularly Jeff Richter's [Concurrent Affairs](http://msdn.microsoft.com/en-us/magazine/cc501041.aspx).
[ 0.15059320628643036, -0.1357210874557495, 0.18245263397693634, 0.4233826994895935, 0.021465949714183807, -0.118009053170681, 0.07152123749256134, 0.27202215790748596, -0.40495994687080383, -0.27427932620048523, -0.17559270560741425, 0.39818307757377625, -0.1704549491405487, -0.161955282092...
I need to reformat my machine but I have so many user/passwords stored in FF2 that I just keep putting it off. Yes I know about backing up the entire profile and restoring it. But for some reason my profile has many issues and I want to start fresh with that as well. Are the username and passwords stored in a text file or is there some way to export them and import after I reformat? There is a Firefox add-on called [Password Exporter](https://addons.mozilla.org/en-US/firefox/addon/2848). It can export to XML or CSV files that can be imported in another browser or computer.
[ 0.21931974589824677, 0.2675836682319641, 0.38055673241615295, -0.016628798097372055, -0.21944783627986908, 0.022920988500118256, 0.2608588635921478, -0.13902169466018677, -0.536033034324646, -0.6816698312759399, -0.05727716162800789, 0.6748814582824707, -0.4608229696750641, 0.1196218430995...
I need to empty an LDF file before sending to a colleague. How do I force SQL Server to truncate the log? if I remember well... in query analyzer or equivalent: ``` BACKUP LOG databasename WITH TRUNCATE_ONLY DBCC SHRINKFILE ( databasename_Log, 1) ```
[ 0.20984305441379547, 0.07119840383529663, 0.523487389087677, -0.05583472549915314, -0.12636065483093262, -0.30524682998657227, 0.061299435794353485, -0.18960392475128174, 0.04161354899406433, -0.5951996445655823, -0.08185132592916489, 0.6633980870246887, -0.556550920009613, 0.1007367670536...
What are the differences between a [`HashMap`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html) and a [`Hashtable`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Hashtable.html) in Java? Which is more efficient for non-threaded applications? There are several differences between [`HashMap`](http://java.sun.com/javase/7/docs/api/java/util/HashMap.html) and [`Hashtable`](http://java.sun.com/javase/7/docs/api/java/util/Hashtable.html) in Java: 1. `Hashtable` is [synchronized](https://stackoverflow.com/questions/1085709/what-does-synchronized-mean), whereas `HashMap` is not. This makes `HashMap` better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones. 2. `Hashtable` does not allow `null` keys or values. `HashMap` allows one `null` key and any number of `null` values. 3. One of HashMap's subclasses is [`LinkedHashMap`](http://java.sun.com/javase/7/docs/api/java/util/LinkedHashMap.html), so in the event that you'd want predictable iteration order (which is insertion order by default), you could easily swap out the `HashMap` for a
[ -0.2263747602701187, -0.050951018929481506, -0.0032708332873880863, -0.07820193469524384, -0.23505641520023346, -0.07928884774446487, 0.12774737179279327, -0.3874594271183014, -0.49722373485565186, -0.1765040159225464, -0.23890632390975952, 0.14920814335346222, -0.632089376449585, -0.06990...
`LinkedHashMap`. This wouldn't be as easy if you were using `Hashtable`. Since synchronization is not an issue for you, I'd recommend `HashMap`. If synchronization becomes an issue, you may also look at [`ConcurrentHashMap`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html).
[ 0.18484565615653992, 0.012574750930070877, 0.15605774521827698, 0.2527540922164917, -0.25770220160484314, -0.2992630898952484, 0.3381999135017395, 0.1829438954591751, -0.48657891154289246, -0.4242829382419586, 0.04221250116825104, 0.2272525131702423, -0.5594162344932556, 0.3122304975986480...
I know I can do most of this by hacking Trac and using Git hooks, but I was wondering if someone has / knows of something ready. Commenting on (and closing) tickets from commit messages would be nice, specially if the diff appears inline with the comment/closing remark. sha1 hashes should be auto-linked to gitweb/cigt/custom git browser. I tried the GitPlugin for Trac, but the code browser was soo slow... any alternatives? [Redmine](http://www.redmine.org/) can do some of what you're asking for. Integration works in one direction, you must [reference issues in commit messages](http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages), and then this data will be available in redmine. The data
[ 0.24268028140068054, 0.024898769333958626, 0.06075367331504822, 0.10837422311306, -0.07055460661649704, -0.16432379186153412, 0.1934814751148224, -0.15122778713703156, -0.20817779004573822, -0.7811697721481323, 0.2106809765100479, 0.5135117173194885, -0.34585127234458923, 0.050696380436420...
is then available in two views. The bug display will include a list of matched commits. The repository display will link commits to bug display pages. Redmine keeps a local (bare) repository for each project. This can be the primary repo or a remote mirror. On updates, redmine parses the commit messages and updates an internal cross reference table of change\_set,issue. If the redmine repository is only used as a mirror, it will need to be updated. Updates can happen via cron or via external hook. We use a [redmine github plugin](http://mentalized.net/journal/2009/08/03/redmine_plugin_github_hook/) and a github post-receive hook to keep redmine in
[ 0.18158547580242157, 0.07433775067329407, 0.2603372037410736, -0.06508512794971466, -0.023852627724409103, 0.08045569807291031, 0.22474472224712372, -0.16112923622131348, -0.2351776510477066, -0.541408121585846, -0.22690214216709137, 0.592403769493103, -0.28844794631004333, 0.0121514471247...
sync with a primary github repository. It works, but it is still a bit clumsy.
[ 0.3304610848426819, -0.04408283904194832, 0.17591242492198944, 0.37413859367370605, 0.010926619172096252, -0.21740351617336273, 0.40799880027770996, 0.28835567831993103, 0.4572364091873169, -0.7823406457901001, -0.19697479903697968, 0.2120150625705719, -0.2641858458518982, -0.1069162264466...
What kind of programming problems are state machines most suited for? I have read about parsers being implemented using state machines, but would like to find out about problems that scream out to be implemented as a state machine. The easiest answer is probably that they are suited for practically any problem. Don't forget that a computer itself is also a state machine. Regardless of that, state machines are typically used for problems where there is some stream of input and the activity that needs to be done at a given moment depends the last elements seen in that stream at that point. Examples
[ 0.03610512241721153, -0.1329977810382843, -0.40111392736434937, 0.44458019733428955, 0.0025142179802060127, 0.22402344644069672, 0.1873294860124588, 0.2289668321609497, -0.4629439115524292, -0.7670671939849854, -0.14840734004974365, 0.39122849702835083, -0.3651123046875, 0.164861261844635,...
of this stream of input: some text file in the case of parsing, a string for regular expressions, events such as `player entered room` for game AI, etc. Examples of activities: be ready to read a number (after another number followed by a `+` have appear in the input in a parser for a calculator), turn around (after player approached and then sneezed), perform jumping kick (after player pressed left, left, right, up, up).
[ 0.1481492519378662, -0.25322383642196655, -0.03388804942369461, 0.16344451904296875, -0.299190491437912, -0.11240701377391815, 0.5449497103691101, -0.22037872672080994, -0.3154652714729309, -0.22944016754627228, -0.3871387839317322, 0.2570401430130005, -0.015619786456227303, -0.30782970786...
I'm trying to find a way to validate a large XML file against an XSD. I saw the question [...best way to validate an XML...](https://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file) but the answers all pointed to using the Xerces library for validation. The only problem is, when I use that library to validate a 180 MB file then I get an OutOfMemoryException. Are there any other tools,libraries, strategies for validating a larger than normal XML file? EDIT: The SAX solution worked for java validation, but the other two suggestions for the libxml tool were very helpful as well for validation outside of java. Instead of using a DOMParser,
[ 0.2183200716972351, 0.20384396612644196, 0.2743930518627167, 0.025254368782043457, -0.39557012915611267, 0.0095497015863657, 0.05436179041862488, -0.22508734464645386, -0.20420724153518677, -0.5007792115211487, 0.049575820565223694, 0.6359790563583374, -0.2011384516954422, 0.01611259393393...
use a SAXParser. This reads from an input stream or reader so you can keep the XML on disk instead of loading it all into memory. ``` SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setErrorHandler(new SimpleErrorHandler()); reader.parse(new InputSource(new FileReader ("document.xml"))); ```
[ 0.138759046792984, 0.12258497625589371, 0.6485450267791748, -0.12323661893606186, 0.15763168036937714, 0.23473100364208221, 0.449433833360672, -0.5470239520072937, -0.3404526114463806, -0.8754476308822632, -0.5912911295890808, 0.5200217366218567, -0.6724631190299988, 0.005944723263382912, ...
I need to be able to get at the full URL of the page I am on from a user control. Is it just a matter of concatenating a bunch of Request variables together? If so which ones? Or is there a more simpiler way? I usually use `Request.Url.ToString()` to get the full url (including querystring), no concatenation required.
[ 0.1870766282081604, 0.004735052119940519, 0.7052491307258606, 0.15343055129051208, -0.11237583309412003, -0.2700655162334442, 0.23093752562999725, 0.009401381947100163, -0.08051492273807526, -0.426787793636322, -0.22351819276809692, 0.5825191140174866, -0.004204539582133293, 0.115969240665...
Is it possible to create a REST web service using ASP.NET 2.0? The articles and blog entries I am finding all seem to indicate that ASP.NET 3.5 with WCF is required to create REST web services with ASP.NET. If it is possible to create REST web services in ASP.NET 2.0 can you provide an example. Thanks! I have actually created a REST web service with asp.net 2.0. Its really no different than creating a web page. When I did it, I really didn't have much time to research how to do it with an asmx file so I did it in a standard aspx
[ 0.3398934304714203, -0.20465168356895447, 0.17968495190143585, 0.18271049857139587, -0.15365587174892426, -0.18185444176197052, 0.17747879028320312, 0.04697045683860779, -0.2982286512851715, -0.6063978672027588, 0.04683893918991089, 0.7367124557495117, -0.23873423039913177, 0.0163167659193...
file. I know thier is extra overhead by doing it this way but as a first revision it was fine. ``` protected void PageLoad(object sender, EventArgs e) { using (XmlWriter xm = XmlWriter.Create(Response.OutputStream, GetXmlSettings())) { //do your stuff xm.Flush(); } } /// <summary> /// Create Xml Settings object to properly format the output of the xml doc. /// </summary> private static XmlWriterSettings GetXmlSettings() {
[ 0.23734316229820251, 0.0485563725233078, 0.8256028294563293, -0.09941220283508301, 0.2119322121143341, -0.23547904193401337, 0.2736717164516449, -0.2033138871192932, -0.10986418277025223, -0.708876371383667, -0.07847972959280014, 0.5590223670005798, -0.40623968839645386, 0.1225023791193962...
XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Indent = true; xmlSettings.IndentChars = " "; return xmlSettings; } ``` That should be enough to get you started, I will try and post more later. Also if you need basic authentication for your web service it can be done, but it needs to be done manually if you aren't using active directory.
[ 0.16323111951351166, 0.10488027334213257, 0.5958644151687622, -0.041052911430597305, -0.045053791254758835, -0.46912717819213867, 0.47898316383361816, -0.4741266369819641, 0.047274112701416016, -0.7824606895446777, 0.1023271232843399, 0.6054269075393677, -0.09249131381511688, -0.2341709434...
At the beginning of all my executable Python scripts I put the [shebang](http://en.wikipedia.org/wiki/Shebang_(Unix)) line: ``` #!/usr/bin/env python ``` I'm running these scripts on a system where `env python` yields a Python 2.2 environment. My scripts quickly fail because I have a manual check for a compatible Python version: ``` if sys.version_info < (2, 4): raise ImportError("Cannot run with Python version < 2.4") ``` I don't want to have to change the shebang line on every executable file, if it's possible; however, I don't have administrative access to the machine to change the result of `env python` and I don't want to force a particular version,
[ 0.11615454405546188, 0.2817324101924896, 0.11988651007413864, -0.3627842962741852, -0.11007198691368103, 0.04526897519826889, 0.3423732817173004, 0.15964265167713165, -0.2702675759792328, -0.2297798991203308, -0.1827363222837448, 0.4219178259372711, -0.3394836485385895, 0.2546137273311615,...
as in: ``` #!/usr/bin/env python2.4 ``` I'd like to avoid this because system may have a newer version than Python 2.4, or may have Python 2.5 but no Python 2.4. What's the elegant solution? [Edit:] I wasn't specific enough in posing the question -- I'd like to let users execute the scripts without manual configuration (e.g. path alteration or symlinking in `~/bin` and ensuring your PATH has `~/bin` before the Python 2.2 path). Maybe some distribution utility is required to prevent the manual tweaks? "env" simply executes the first thing it finds in the PATH env var. To switch to different python, prepend the directory for that
[ 0.360411673784256, -0.08677934110164642, 0.11593721061944962, -0.0015084149781614542, 0.0020846782717853785, -0.3563171327114105, 0.3519093096256256, -0.15022820234298706, -0.19793380796909332, -0.7534950375556946, -0.1525244563817978, 0.6253076791763306, -0.35622140765190125, -0.112186178...
python's executable to the path before invoking your script.
[ 0.046473462134599686, 0.1275356113910675, -0.12759393453598022, -0.13336969912052155, -0.31576603651046753, -0.24187587201595306, 0.5378159880638123, 0.34804055094718933, 0.04380673170089722, -0.40816783905029297, -0.025926297530531883, 0.6406039595603943, -0.287677526473999, -0.4223727285...
Do I need to register new extension types with Apple before I release an application that would create them on OS X? No, there's no need to register extensions.
[ 0.5831530690193176, 0.38918930292129517, 0.4426993131637573, -0.05690661072731018, 0.3817785680294037, 0.052824944257736206, 0.19908852875232697, -0.06207207962870598, -0.5008141398429871, -0.40966761112213135, -0.19939371943473816, 0.39608871936798096, -0.29133141040802, 0.105946227908134...
For a typical business application, should the focus be on client processing via AJAX i.e. pull the data from the server and process it on the client or would you suggest a more classic ASP.Net approach with the server being responsible for handling most of the UI events? I find it hard to come up with a good 'default architecture' from which to start. Maybe someone has an open source example application which they could recommend. It really depends on the application and the situation, but just keep in mind that every hit to the server is costly, both in adding
[ 0.21811477839946747, 0.10071776807308197, -0.011349461041390896, 0.10743644088506699, -0.19958272576332092, -0.11439599096775055, -0.011390991508960724, -0.08726023882627487, -0.3508071303367615, -0.5286016464233398, -0.2228996306657791, 0.581753134727478, -0.2955576777458191, -0.121792115...
load (perhaps minimally), but also in terms of UI responsiveness. I am of the mind that doing things in JavaScript when possible is a good idea, if it can make your UI feel snappier. Of course, it all depends on what you are trying to do, and whether it matters if the UI is snappy (an internal web app probably doesn't NEED extra development to make the UI more attractive and quicker/easier to use, whereas something that is used by the general public by a mass audience probably needs to be as polished and tuned as possible).
[ 0.7369856834411621, -0.04332316666841507, 0.3556888997554779, 0.16305938363075256, -0.32533442974090576, -0.07607468217611313, 0.13786618411540985, 0.09902869910001755, -0.22118203341960907, -0.6311201453208923, -0.14731839299201965, 0.7419326305389404, -0.02098694071173668, -0.56033718585...
[In this question](https://stackoverflow.com/questions/32230/tracking-down-where-disk-space-has-gone-on-linux) someone asked for ways to display disk usage in Linux. I'd like to take this one step further down the cli-path... how about a shell script that takes the output from something like a reasonable answer to the previous question and generates a graph/chart from it (output in a png file or something)? This may be a bit too much code to ask for in a regular question, but my guess is that someone already has a oneliner laying around somewhere... I would recommend [munin](http://munin.projects.linpro.no/). It is designed for exactly this sort of thing - graphing CPU usage,
[ 0.24371621012687683, -0.06929202377796173, 0.37614384293556213, 0.2210470288991928, -0.06042052060365677, -0.24665160477161407, -0.3039047420024872, 0.10869014263153076, -0.437151163816452, -0.6239391565322876, 0.2182006537914276, 0.6535677313804626, -0.2232854962348938, -0.167259410023689...
memory usage, disc-usage and such. sort of like MRTG (but MRTG is primarily aimed at graphing router's traffic, graphing anything but bandwidth with it is very hackish) Writing Munin plugins is very easy (it was one of the projects goals). They can be written in almost anything (shell script, perl/python/ruby/etc, C, anything that can be execute and produce an output). The plugin output format is basically `disc1usage.value 1234`. And debugging the plugins is very easy (compared to MRTG) I've set it up on my laptop to monitor disc-usage, bandwidth usage (by pulling data from my ISP's control panel, it graphs my two
[ 0.15281927585601807, -0.2154063582420349, 0.21373416483402252, 0.1873684972524643, -0.2630311846733093, -0.33691996335983276, 0.10582286864519119, 0.25100231170654297, -0.020477604120969772, -0.7473888993263245, -0.10445956140756607, 0.9681171178817749, -0.5597918033599854, -0.163803696632...
download "bins", uploads and newsgroup usage), load average and number of processes. Once I got it installed (currently slightly difficult on OS X, but it's trivial on Linux/FreeBSD), I had written a plugin in a few minutes, and it worked, first time! I would describe how it's setup, but the munin site will do that far better than I could! There's an example installation [here](http://munin.ping.uio.no/) Some alternatives are nagios and cacti. You could also write something similar using rrdtool. Munin, MRTG and Cacti are basically all far-nicer-to-use systems based around this graphing tool. If you want something really, really simple, you could do.. ``` import os import
[ 0.35550808906555176, -0.17865905165672302, 0.12446178495883942, 0.163497656583786, -0.26281818747520447, -0.24206027388572693, -0.01853964291512966, 0.20619945228099823, -0.38509291410446167, -0.8490166068077087, -0.0619499497115612, 0.8000912070274353, -0.4804849922657013, -0.067843846976...
time while True: disc_usage = os.system("df -h / | awk '{print $3}'") log = open("mylog.txt") log.write(disc_usage + "\n") log.close() time.sleep(60*5) ``` Then.. ``` f = open("mylog.txt") lines = f.readlines() # Convert each line to a float number lines = [float(cur_line) for cur_line in lines] # Get the biggest and smallest biggest = max(lines) smallest = min(lines) for cur_line in lines: base = (cur_line - smallest) + 1 # make lowest value 1 normalised = base / (biggest - smallest) # normalise value between 0 and 1 line_length =
[ 0.18687699735164642, -0.43738237023353577, 0.8302769064903259, -0.1283542513847351, 0.1783037930727005, 0.1965554654598236, 0.27172547578811646, -0.24143145978450775, -0.10905373096466064, -0.8195643424987793, -0.2658205032348633, 0.5634398460388184, 0.022620467469096184, 0.037974271923303...
int(round(normalised * 28)) # make a graph between 0 and 28 characters wide print "#" * line_length ``` That'll make a simple ascii graph of the disc usage. I *really really* don't recommend you use something like this. Why? The log file will get bigger, and bigger, and bigger. The graph will get progressively slower to graph. RRDTool uses a rolling-database system to store it's data, so the file will never get bigger than about 50-100KB, and it's consistently quick to graph as the file is a fixed length. In short. If you want something to easily graph almost anything,
[ 0.2655574381351471, -0.16691982746124268, 0.6800273060798645, -0.09215797483921051, -0.4431650638580322, 0.1937417834997177, 0.11452838778495789, -0.16075144708156586, -0.41117146611213684, -0.41322237253189087, 0.2320030927658081, 0.4749569892883301, -0.16820061206817627, 0.07637479156255...
use [munin](http://munin.projects.linpro.no/). If you want something smaller and self-contained, write something with RRDTool.
[ 0.31870439648628235, -0.5351925492286682, -0.1362687051296234, 0.11856173723936081, -0.19094909727573395, -0.28438422083854675, 0.10018179565668106, -0.18631525337696075, -0.34923887252807617, -0.5077512264251709, -0.13742448389530182, 0.5636026859283447, -0.4050185978412628, -0.2229854762...
Are all of these equal? Under what circumstances should I choose each over the others? * var.ToString() * CStr(var) * CType(var, String) * DirectCast(var, String) --- *EDIT: Suggestion from **[NotMyself](https://stackoverflow.com/users/303/notmyself)**…* * TryCast(var, String) Those are all slightly different, and generally have an acceptable usage. * `var.`[`ToString`](http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx)`()` is going to give you the string representation of an object, regardless of what type it is. Use this if `var` is not a string already. * [`CStr`](http://msdn.microsoft.com/en-us/library/0zk841e9.aspx)`(var)` is the VB string cast operator. I'm not a VB guy, so I would suggest avoiding it, but it's not really going to hurt anything. I think it is basically the same as `CType`. * [`CType`](http://msdn.microsoft.com/en-us/library/4x2877xb.aspx)`(var, String)`
[ 0.05871783569455147, 0.007606235332787037, 0.6300041079521179, -0.14618907868862152, -0.33826690912246704, -0.011347143910825253, 0.20187850296497345, -0.20550160109996796, -0.1935192197561264, -0.5480855703353882, 0.07183163613080978, 0.5860245227813721, -0.48619380593299866, 0.0641390979...
will convert the given type into a string, using any provided conversion operators. * [`DirectCast`](http://msdn.microsoft.com/en-us/library/7k6y2h6x.aspx)`(var, String)` is used to up-cast an object into a string. If you know that an object variable is, in fact, a string, use this. This is the same as `(string)var` in C#. * [`TryCast`](http://msdn.microsoft.com/en-us/library/zyy863x8.aspx) (as mentioned by @[NotMyself](https://stackoverflow.com/questions/40764/how-should-i-cast-in-vbnet#40771)) is like `DirectCast`, but it will return `Nothing` if the variable can't be converted into a string, rather than throwing an exception. This is the same as `var as string` in C#. The `TryCast` page on MSDN has a good comparison, too.
[ 0.25740233063697815, -0.12997813522815704, 0.24493373930454254, -0.11098676174879074, -0.36011040210723877, -0.3396465480327606, 0.25302252173423767, -0.010068516246974468, -0.05506313964724541, -0.6010028719902039, -0.10560160130262375, 0.4174969792366028, -0.5770986080169678, 0.031540315...
I've inherited a .NET application that automatically updates it's version number with each release. The problem, as I see it, is the length and number of digits in the version number. An example of the current version number format is `3.5.3167.26981` which is a mouthful for the users to say when they are reporting bugs. What I would like is something more like this: `3.5 (build 3198)`. I would prefer to manually update the major and minor versions, but have the build number update automatically. Even better, I don't want the build number to increment unless I am compiling in RELEASE mode. Anyone know
[ 0.23289422690868378, 0.4491729438304901, 0.3242543935775757, -0.18948523700237274, 0.08484867960214615, -0.27239957451820374, 0.3470333218574524, 0.19992494583129883, -0.4611937701702118, -0.5886209011077881, -0.10505475103855133, 0.6955111622810364, -0.13981182873249054, 0.364245414733886...
if there is a way to do this -- and how? In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to `[assembly: AssemblyVersion("3.5.*")]` or something similar. The \* basically means it lets Visual Studio automatically set the build and revision number. You can change this to a hard coded value in the format `<major version>.<minor version>.<build number>.<revision>` You are allowed to use any or all of the precision. For instance 3.5 or 3.5.3167 or 3.5.3167.10000. You can also use compiler conditions to change the versioning based on whether you're doing a debug build or release build.
[ 0.35889819264411926, 0.04642103239893913, 0.15709277987480164, -0.22958654165267944, -0.08258534967899323, -0.15656358003616333, 0.2771591544151306, -0.1291714310646057, -0.278678297996521, -0.5779567360877991, -0.20073269307613373, 0.5312538743019104, -0.19160686433315277, -0.025906873866...
If I have an HTML helper like so: ``` Name:<br /> <%=Html.TextBox("txtName",20) %><br /> ``` How do I apply a CSS class to it? Do I have to wrap it in a span? Or do I need to somehow utilize the HtmlAttributes property of the helper? You can pass it into the TextBox call as a parameter. ``` Name:<br/> <%= Html.TextBox("txtName", "20", new { @class = "hello" }) %> ``` This line will create a text box with the value 20 and assign the class attribute with the value hello. I put the @ character in front of the class, because class is a reserved keyword. If
[ -0.15959963202476501, -0.019405942410230637, 0.7399814128875732, -0.4235219657421112, -0.13794578611850739, 0.2787801921367645, 0.08981262147426605, -0.26868218183517456, 0.03587507829070091, -0.7583693861961365, -0.3029242157936096, 0.4244387745857239, -0.33609941601753235, 0.089818656444...
you want to add other attributes, just separate the key/value pairs with commas.
[ 0.25677111744880676, -0.013954581692814827, -0.15382404625415802, 0.1958608776330948, 0.08486034721136093, 0.024595357477664948, -0.23539158701896667, -0.19545108079910278, -0.14773687720298767, -0.4267213046550751, -0.10522203147411346, 0.7449324727058411, 0.04812144860625267, -0.17333358...
I have a custom installer action that updates the PATH environment, and creates an additional environment variable. Appending a directory to the existing path variable is working fine, but for some reason my attempts to create a new environment variable have been unsuccessful. The code I am using is: ``` using (RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", true)) { reg.SetValue("MYVAR", "SomeVal", RegistryValueKind.ExpandString); } ``` Edit: The OS is 32-bit XP, and as
[ 0.1410614550113678, 0.31723394989967346, 0.8016728758811951, -0.1270708590745926, 0.37051525712013245, -0.17416974902153015, 0.4833514094352722, 0.04001249372959137, 0.03849128633737564, -1.0805331468582153, -0.010824128985404968, 1.0859606266021729, -0.35461050271987915, 0.144913166761398...
far as I can tell it is failing silently. Is there any reason that you have to do it through the registry? If not, you can use Environment.SetEnvironmentVariable() since .NET 2.0. It allows you to set on a machine, process or user basis.
[ 0.8020214438438416, -0.35080859065055847, -0.006297039333730936, 0.008136671967804432, 0.2072644978761673, -0.32181718945503235, 0.1822170913219452, 0.013282647356390953, -0.28605392575263977, -0.8058086633682251, -0.011596680618822575, 0.47815436124801636, -0.5535579323768616, 0.051964212...
Has anyone had a chance to dig into how [F# Units of Measure](http://blogs.msdn.com/andrewkennedy/archive/2008/08/20/units-of-measure-in-f-part-one-introducing-units.aspx) work? Is it just type-based chicanery, or are there CLR types hiding underneath that could (potentially) be used from other .net languages? Will it work for any numerical unit, or is it limited to floating point values (which is what all the examples use)? According to a [response](http://blogs.msdn.com/andrewkennedy/archive/2008/08/22/units-of-measure-in-f-part-two-unit-conversions.aspx#8920660) on the next related blog post, they are a purely static mechanism in the F# compiler. So there is no CLR representation of the units data. Its not entirely clear whether it currently works with non-float types, but from the perspective
[ 0.06510278582572937, 0.25537538528442383, 0.5621734261512756, 0.08832091838121414, -0.034676697105169296, -0.022772671654820442, 0.010898537933826447, -0.1764151155948639, -0.3526780307292938, -0.1885865330696106, -0.11832635849714279, 0.20779360830783844, -0.12518401443958282, 0.193709656...
of the type system it is theoretically possible.
[ 0.35094383358955383, 0.007238867226988077, 0.04909774288535118, 0.0430397130548954, 0.09886649996042252, 0.09651312232017517, 0.22216074168682098, -0.2883537709712982, -0.0668051615357399, -0.5910239219665527, -0.2832399904727936, 0.4996269643306732, -0.2779035270214081, 0.3059097528457641...
How can I go about storing a vb.net user defined object in a sql database. I am not trying to replicate the properties with columns. I mean something along the lines of converting or encoding my object to a byte array and then storing that in a field in the db. Like when you store an instance of an object in session, but I need the info to persist past the current session. --- @Orion Edwards > It's not a matter of stances. It's because one day, you will change your code. Then you will try de-serialize the old object, and YOUR
[ 0.8393786549568176, 0.18042294681072235, -0.10104010999202728, 0.09108437597751617, -0.10607536137104034, -0.039963480085134506, 0.4206773042678833, -0.19423596560955048, -0.13344421982765198, -0.7425980567932129, 0.2848703861236572, 0.4356321692466736, -0.11023025959730148, 0.374917566776...
PROGRAM WILL CRASH. My Program will not "CRASH", it will throw an exception. Lucky for me .net has a whole set of classes dedicated for such an occasion. At which time I will refresh my stale data and put it back in the db. That is the point of this one field (or stance, as the case may be). You can use [serialization](http://msdn.microsoft.com/en-us/library/ms973893.aspx) - it allows you to store your object at least in 3 forms: binary (suitable for BLOBs), XML (take advantage of MSSQL's XML data type) or just plain text (store in varchar or text column)
[ 0.34256941080093384, -0.05956882983446121, 0.0007093017920851707, 0.23498035967350006, -0.09156109392642975, 0.015025494620203972, 0.3193669021129608, 0.13597120344638824, -0.2684009075164795, -0.5943574905395508, -0.31893080472946167, 0.4551745653152466, -0.2358819991350174, 0.10469062626...
I am having problems manually looping through xml data that is received via an HTTPService call, the xml looks something like this: ``` <DataTable> <Row> <text>foo</text> </Row> <Row> <text>bar</text> </Row> </DataTable> ``` When the webservice result event is fired I do something like this: ``` for(var i:int=0;i&lt;event.result.DataTable.Row.length;i++) { if(event.result.DataTable.Row[i].text == "foo") mx.controls.Alert.show('foo found!'); } ``` This code works then there is more than 1 "Row" nodes returned. However, it seems that if there is
[ 0.09896291047334671, 0.06654535233974457, 0.5032926201820374, -0.2843371331691742, 0.07596061378717422, -0.22198696434497833, 0.5396015048027039, -0.4142112135887146, -0.23799043893814087, -0.5115969777107239, -0.2549874782562256, 0.4604358673095703, -0.3677115738391876, 0.1886880248785019...
only one "Row" node then the *event.DataTable.Row* object is not an error and the code subsequently breaks. What is the proper way to loop through the *HTTPService* result object? Do I need to convert it to some type of *XMLList* collection or an *ArrayCollection*? I have tried setting the resultFormat to *e4x* and that has yet to fix the problem... Thanks. The problem lies in this statement ``` event.result.DataTable.Row.length ``` `length` is not a property of `XMLList`, but a method: ``` event.result.DataTable.Row.length() ``` it's confusing, but that's the way it is. *Addition:* actually, the safest thing to do is to always use a `for each` loop when iterating over `XMLList`s, that
[ 0.17815853655338287, -0.18575327098369598, 0.2612189054489136, -0.002400506054982543, -0.1253722757101059, -0.42547255754470825, 0.34846073389053345, -0.03460274264216423, -0.3261703550815582, -0.49853089451789856, -0.07543542981147766, 0.19641341269016266, -0.4573891758918762, 0.134758725...
way you never make the mistake, it's less code, and easier to read: ``` for each ( var node : XML in event.result.DataTable.Row ) ```
[ -0.10837344825267792, -0.09095799922943115, 0.2115078568458557, 0.11816900223493576, -0.05706779286265373, -0.23060236871242523, -0.03706110268831253, -0.10488547384738922, -0.13859966397285461, -0.5586279034614563, -0.26097768545150757, 0.4423528015613556, -0.05298745259642601, -0.1381885...
What code do you need to add in PHP to automatically have the browser download a file to the local machine when a link is visited? I am specifically thinking of functionality similar to that of download sites that prompt the user to save a file to disk once you click on the name of the software? Send the following headers before outputting the file: ``` header("Content-Disposition: attachment; filename=\"" . basename($File) . "\""); header("Content-Type: application/octet-stream"); header("Content-Length: " . filesize($File)); header("Connection: close"); ``` [@grom](https://stackoverflow.com/users/486/grom): Interesting about the 'application/octet-stream' MIME type. I wasn't aware of that, have always just used 'application/force-download' :)
[ 0.3423028290271759, 0.11539751291275024, 0.5852413773536682, 0.070923812687397, -0.038510944694280624, -0.11529313027858734, 0.105750672519207, -0.08802333474159241, -0.1097731962800026, -0.5901501178741455, -0.28751063346862793, 0.48902812600135803, -0.16602157056331635, 0.112297169864177...
I have a javascript function that manipulates the DOM when it is called (adds CSS classes, etc). This is invoked when the user changes some values in a form. When the document is first loading, I want to invoke this function to prepare the initial state (which is simpler in this case than setting up the DOM from the server side to the correct initial state). Is it better to use window.onload to do this functionality or have a script block after the DOM elements I need to modify? For either case, why is it better? For example: ``` function updateDOM(id) {
[ 0.3041548728942871, -0.017665835097432137, 0.4226868748664856, -0.25739651918411255, -0.043460581451654434, -0.15992175042629242, 0.058939434587955475, -0.37908411026000977, -0.01872776634991169, -0.7687791585922241, 0.11058717221021652, 0.7787635922431946, -0.24498076736927032, 0.18060135...
// updates the id element based on form state } ``` should I invoke it via: ``` window.onload = function() { updateDOM("myElement"); }; ``` or: ``` <div id="myElement">...</div> <script language="javascript"> updateDOM("myElement"); </script> ``` The former seems to be the standard way to do it, but the latter seems to be just as good, perhaps better since it will update the element as soon as the script is hit, and as long as it is placed after the element, I don't see a problem with it. Any thoughts? Is one version really better than the other? Definitely use `onload`. Keep your scripts separate from your page, or you'll go mad trying to
[ 0.24519537389278412, 0.09957986325025558, 0.5752169489860535, -0.12324190139770508, 0.12342924624681473, -0.24956047534942627, 0.5381704568862915, -0.04471166804432869, 0.013799604028463364, -0.9589760899543762, -0.2593911290168762, 0.8585164546966553, -0.3188375234603882, -0.2833700180053...
disentangle them later.
[ 0.0933019295334816, -0.29579588770866394, 0.49953892827033997, 0.4654514789581299, -0.10245440900325775, 0.2576275169849396, 0.40598711371421814, -0.4146076738834381, 0.07877667993307114, -0.6406224966049194, -0.3320995271205902, -0.11268085986375809, 0.03210162743926048, -0.46162295341491...
Here's a quick question I've been banging my head against today. I'm trying to convert a .Net dataset into an XML stream, transform it with an xsl file in memory, then output the result to a new XML file. Here's the current solution: ``` string transformXML = @"pathToXslDocument"; XmlDocument originalXml = new XmlDocument(); XmlDocument transformedXml = new XmlDocument(); XslCompiledTransform transformer = new XslCompiledTransform(); DataSet ds = new
[ 0.05234174057841301, -0.414315402507782, 0.6908249855041504, 0.2571648359298706, 0.057832203805446625, -0.17000547051429749, 0.00021650099370162934, -0.4767090678215027, -0.037882719188928604, -0.7348591685295105, -0.23524180054664612, 0.5754646062850952, -0.22741204500198364, 0.1725005209...
DataSet(); string filepath; originalXml.LoadXml(ds.GetXml()); //data loaded prior StringBuilder sb = new StringBuilder(); XmlWriter writer = XmlWriter.Create(sb); transformer.Load(transformXML); transformer.Transform(originalXml, writer); //no need to select the node transformedXml.LoadXml(sb.ToString()); transformedXml.Save(filepath); writer.Close(); ``` Here's the original code: ``` BufferedStream stream = new BufferedStream(new MemoryStream()); DataSet ds
[ -0.22283567488193512, -0.44873204827308655, 0.8019388914108276, -0.28182393312454224, 0.08490171283483505, 0.13337966799736023, 0.22491613030433655, -0.4925892949104309, -0.28788822889328003, -0.5367581844329834, -0.4418722987174988, 0.3077819049358368, -0.48469576239585876, 0.168108493089...
= new DataSet(); da.Fill(ds); ds.WriteXml(stream); StreamReader sr = new StreamReader(stream, true); stream.Position = 0; //I'm not certain if this is necessary, but for the StreamReader to read the text the position must be reset. XmlReader reader = XmlReader.Create(sr, null); //Problem is created here, the XmlReader is created with none of the data from the StreamReader XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(@"<path to xsl file>"); transformer.Transform(reader, null, writer); //Exception is thrown here, though the problem originates from the XmlReader.Create(sr, null) ``` For some reason in the transformer.Transform method, the reader has no root node, in fact the reader isn't reading anything from the StreamReader. My questions is what is wrong with
[ -0.41803064942359924, -0.20734944939613342, 0.624845027923584, 0.01019073836505413, -0.17550982534885406, 0.023507144302129745, 0.5405687689781189, -0.29372426867485046, -0.15833380818367004, -0.6434276103973389, -0.3468775451183319, 0.5913306474685669, -0.4586516320705414, 0.3060737848281...
this code? Secondarily, is there a better way to convert/transform/store a dataset into XML? Edit: Both answers were helpful and technically aku's was closer. However I am leaning towards a solution that more closely resembles Longhorn's after trying both solutions. I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it. **EDIT**: Just tried following code and it worked perfectly: ``` BufferedStream stream = new
[ 0.27377599477767944, -0.11391045153141022, 0.2046024650335312, 0.14177986979484558, -0.4827839434146881, -0.036340825259685516, 0.17421063780784607, -0.209900364279747, -0.011454380117356777, -0.6222556233406067, 0.07629385590553284, 0.5120928287506104, -0.323506623506546, -0.0795842409133...
BufferedStream(new MemoryStream()); stream.Write(Encoding.ASCII.GetBytes("<xml>foo</xml>"), 0, "<xml>foo</xml>".Length); stream.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(stream); XmlReader reader = XmlReader.Create(sr); while (reader.Read()) { Console.WriteLine(reader.Value); } stream.Close(); ```
[ -0.18613214790821075, -0.29099804162979126, 1.0539634227752686, -0.26961803436279297, 0.19048276543617249, 0.3013388216495514, 0.059679266065359116, -0.27888673543930054, 0.03485145792365074, -0.7510000467300415, -0.4104577302932739, 0.5017485022544861, -0.28729280829429626, 0.377825319766...
Grails makes it very easy to configure datasources for different environments (development, test, production) in its DataSources.groovy file, but there seems to be no facility for configuring multiple datasources in one environment. What to I do if I need to access several databases from the same Grails application? There is now Grails plugin that enables the use of multiple datasources directly with Grails' GORM layer: <http://burtbeckwith.com/blog/?p=70>
[ 0.23876959085464478, 0.2003045678138733, 0.20366154611110687, 0.1334308236837387, -0.09324689209461212, 0.14982321858406067, 0.21837987005710602, -0.14034126698970795, -0.36245256662368774, -0.21858803927898407, 0.09710417687892914, 0.564678966999054, -0.06909540295600891, 0.03027237206697...
I'm a long-time emacs user, and I'm now working about 1/2 time in Java. What are the best emacs libraries for 1. Debugging Java 2. Code Completion/Intellisense 3. Javadoc browsing ? I've used [JDEE](http://jdee.sourceforge.net/) on several projects. It handles Code Completion. I've never used it for debugging or browsing docs, but it's a big step up from a basic text editor.
[ -0.0909012034535408, 0.29633840918540955, 0.08492861688137054, -0.09159915894269943, -0.0857369601726532, -0.18993735313415527, 0.18564411997795105, 0.12095529586076736, 0.031620271503925323, -0.8961874842643738, 0.20510515570640564, 0.5033252239227295, -0.24671714007854462, -0.08386506885...
The question sort of says it all. Whether it's for code testing purposes, or you're modeling a real-world process, or you're trying to impress a loved one, what are some algorithms that folks use to generate interesting time series data? Are there any good resources out there with a consolidated list? No constraints on values (except plus or minus infinity) or dimensions, but I'm looking for examples that people have found useful or exciting in practice. Bonus points for parsimonious and readable code samples. I believe the following will work: ``` Dim b As CommandButton Set b = ocx.GetButton("btnPrint") b = True ``` `CommandButton`s actually have two functions.
[ 0.6113935708999634, -0.07629701495170593, 0.21313028037548065, -0.03222295269370079, 0.039475277066230774, 0.15216811001300812, -0.15991343557834625, 0.023407412692904472, 0.04339039325714111, -0.36710795760154724, -0.19027569890022278, 0.8500208258628845, -0.15457995235919952, 0.082761920...
One is the usual click button and the other is a toggle button that acts similar to a `CheckBox`. The default property of the `CommandButton` is actually the `Value` property that indicates whether a button is toggled. By setting the property, the `Click` event is generated. This is done even if the button is not styled as a `ToggleButton` and therefore doesn't change its state.
[ 0.009123243391513824, -0.24365033209323883, 0.5479956269264221, -0.04364374652504921, 0.29529181122779846, -0.2023390531539917, 0.016558771952986717, -0.1930035799741745, -0.019050898030400276, -0.1977737843990326, -0.22023992240428925, 0.8284598588943481, -0.3225177526473999, 0.0795105546...
I'd like to indicate to the user of a web app that a long-running task is being performed. Once upon a time, this concept would have been communicated to the user by displaying an hourglass. Nowadays, it seems to be an animated spinning circle. (e.g., when you are loading a new tab in Firefox, or booting in Mac OS X. Coincidentally, the overflowing stack in the stackoverflow logo looks like one quarter of the circle). Is there a simple way to create this effect using Javascript (in particular, JQuery)? Ideally, I'd like to have one of these little spinners as elements
[ 0.5896831750869751, -0.11972235143184662, 0.5463458895683289, 0.17602048814296722, -0.1701916754245758, -0.11040911823511124, -0.32094645500183105, 0.181727334856987, -0.6764119267463684, -0.3796194791793823, 0.3515283465385437, 0.17015619575977325, -0.1559944599866867, 0.23005682229995728...
in a table, to indicate to the user that the system is still active in processing a pending task (i.e., it hasn't forgotten or crashed). (Of course, I realize it's possible that the back-end has crashed and the front-end still show as an animating spinning thing, it's more for the psychological purpose of the user seeing activity). And what do you call that spinning thing, anyways? Google **Ajax activity indicator** to find lots of images and image generators (the "spinning" image itself is an animated GIF). Here is [one link](http://www.ajaxload.info/) to get you started. With the image in hand, use JQuery to toggle
[ 0.04051407426595688, -0.22077050805091858, 0.2920624017715454, 0.39367160201072693, -0.2676243484020233, -0.18724475800991058, -0.12937550246715546, 0.3630999028682709, -0.661697268486023, -0.7218003273010254, 0.1667487919330597, 0.27567151188850403, -0.015040233731269836, -0.1180963367223...
the visibility of the image (or perhaps its parent DIV tag). See [this link](http://skfox.com/2008/04/28/jquery-example-ajax-activity-indicator/) for some more info. rp
[ -0.07810037583112717, -0.23185096681118011, 0.4166783392429352, 0.08418624848127365, -0.351597398519516, -0.09932875633239746, 0.09416776150465012, -0.020047727972269058, -0.5322498679161072, -0.45885226130485535, -0.26414573192596436, 0.412240207195282, -0.08489856123924255, -0.5231273770...
The .NET `System.Security.Cryptography` namespace has a rather bewildering collection of algorithms that I could use for encryption of credit card details. Which is the best? It clearly needs to be secure for a relatively short string. EDIT: I'm in the UK, where I understand we're OK storing encrypted credit card details so long as the three-digit CVV number is never stored. And thanks all for the great responses. No offense, but the question is a little "misguided". There is no "silver bullet" solution. I would recommend to read up on cryptography in general and then do some threat modeling. Some questions (by
[ 0.6181276440620422, 0.2226397842168808, 0.16692402958869934, 0.3448348939418793, 0.3198266327381134, -0.5965749025344849, 0.3812040686607361, 0.15160676836967468, -0.2539147734642029, -0.2809660732746124, -0.20315736532211304, 0.17522747814655304, 0.1288727968931198, 0.06413568556308746, ...
no means a comprehensive list) you should ask yourself: * Is the module doing the encryption the one which needs to decrypt it (in this case use symmetric crypto) or will it send data to an other module (on an other machine) which will use it (in which case you should consider public-key crypto) * What do you want to protect against? Someone accessing the database but not having the sourcecode (in which case you can hardcode the encryption key directly into the source)? Someone sniffing your local network (you should consider transparent solutions like IPSec)? Someone stealing your server (it can
[ 0.634605348110199, -0.2044970691204071, 0.14463870227336884, 0.3325650095939636, 0.21634864807128906, -0.6378111839294434, 0.3643181025981903, -0.20996803045272827, -0.4306175708770752, -0.33882227540016174, -0.3542092442512512, 0.5928331017494202, -0.4134017825126648, 0.02093888260424137,...
happen even in data centers - in which case full disk encryption should be considered)? * Do you really need to keep the data? Can't you directly pass it to the credit card processor and erase it after you get the confirmation? Can't you store it locally at the client in a cookie or Flash LSO? If you store it at the client, make sure that you encrypt it at the server side before putting it in a cookie. Also, if you are using cookies, make sure that you make them http only. * Is it enough to compare the equality of
[ 0.4415088891983032, -0.025425709784030914, 0.26486095786094666, 0.26973989605903625, 0.4041202664375305, -0.43277862668037415, 0.31223875284194946, 0.1650470793247223, -0.5610120892524719, -0.6838294863700867, -0.32480642199516296, 0.26394122838974, -0.04696918651461601, 0.1506715267896652...
the data (ie the data that the client has given me is the same data that I have)? If so, consider storing a hash of it. Because credit card numbers are relatively short and use a reduced set of symbols, a unique salt should be generated for each before hashing. *Later edit*: note that standard encryption algorithms from the same category (for example 3DES and AES - both being symmetric block cyphers) are of comparable strength. Most (commercial) systems are not broken because somebody bruteforced their encryption, but because their threat modelling was not detailed enough (or flat out they didn't
[ 0.10534291714429855, 0.22169657051563263, 0.154938742518425, 0.21076427400112152, 0.05627523735165596, -0.20955921709537506, 0.23251256346702576, -0.21859723329544067, -0.23174788057804108, -0.42554160952568054, -0.1155206710100174, 0.5437225699424744, 0.08178147673606873, -0.0814627036452...
have any). For example you can encrypt all the data, but if you happen to have a public facing web interface which is vulnerable to SQL injection, it won't help you much.
[ 0.2924481928348541, 0.1726495325565338, 0.23564833402633667, 0.5501083731651306, -0.02072983607649803, -0.5643028616905212, 0.27182134985923767, 0.2829382121562958, -0.20927508175373077, -0.5164254903793335, -0.33955490589141846, 0.7242374420166016, -0.2286829650402069, 0.03761941939592361...
I've got bunches of auxiliary files that are generated by code and LaTeX documents that I dearly wish *would not* be suggested by SpotLight as potential search candidates. I'm not looking for `example.log`, I'm looking for `example.tex`! So can Spotlight be configured to ignore, say, all `.log` files? (I know, I know; I should just use QuickSilver instead…) --- @[diciu](https://stackoverflow.com/questions/41279/can-mac-os-xs-spotlight-be-configured-to-ignore-certain-file-types#41295) That's an interesting answer. The problem in my case is this: > Figure out which importer handles your type of file I'm not sure if my type of file is handled by any single importer? Since they've all got weird extensions (.aux, .glo, .out, whatever) I
[ 0.10656178742647171, 0.124168761074543, 0.3438141345977783, 0.027681926265358925, -0.28276434540748596, -0.2957684099674225, 0.19363895058631897, 0.25143322348594666, -0.5757195949554443, -0.4215070605278015, -0.03801929950714111, 0.569192111492157, -0.48835182189941406, -0.111746683716773...
think it's improbable that there's an importer that's *trying* to index them. But because they're plain text they're being picked up as generic files. (Admittedly, I don't know much about Spotlight's indexing, so I might be completely wrong on this.) --- @[diciu](https://stackoverflow.com/questions/41279/can-mac-os-xs-spotlight-be-configured-to-ignore-certain-file-types#41342) again: `TextImporterDontImportList` sounds very promising; I'll head off and see if anything comes of it. Like you say, it does seem like the whole UTI system doesn't really allow *not* searching for something. --- @[Raynet](https://stackoverflow.com/questions/41279/can-mac-os-xs-spotlight-be-configured-to-ignore-certain-file-types#41377) Making the files invisible is a good idea actually, albeit relatively tedious for me to set up in the general sense. If worst comes to worst, I might
[ 0.2062358409166336, 0.012787934392690659, 0.34517213702201843, -0.026068544015288353, -0.23265516757965088, -0.4502682387828827, 0.5006828904151917, 0.2855188846588135, -0.43371355533599854, -0.5655789375305176, -0.04352904111146927, 0.6100475192070007, -0.17765174806118011, -0.17010287940...
give that a shot (but probably after exhausting other options such as QuickSilver). (Oh, and SetFile requires the Developer Tools, but I'm guessing everyone here has them installed anyway `:)` ) @Will - these things that define types are called [uniform type identifiers](http://developer.apple.com/macosx/uniformtypeidentifiers.html). The problem is they are a combination of extensions (like .txt) and generic types (i.e. public.plain-text matches a txt file without the txt extension based purely on content) so it's not as simple as looking for an extension. RichText.mdimporter is *probably* the importer that imports your text file. This should be easily verified by running mdimport in debug mode on one
[ 0.3532705307006836, -0.17334170639514923, 0.3464037775993347, 0.07439570128917694, -0.08539670705795288, -0.26251038908958435, 0.16634374856948853, -0.24318121373653412, -0.1956169456243515, -0.6207733154296875, 0.00030746139236725867, 0.5993351340293884, -0.5068973898887634, 0.01913483999...
of the files you don't want indexed: ``` cristi:~ diciu$ echo "All work and no play makes Jack a dull boy" > ~/input.txt cristi:~ diciu$ mdimport -d 4 -n ~/input.txt 2>&1 | grep Imported kMD2008-09-03 12:05:06.342 mdimport[1230:10b] Imported '/Users/diciu/input.txt' of type 'public.plain-text' with plugIn /System/Library/Spotlight/RichText.mdimporter. ``` The type that matches in my example is public.plain-text. I've no idea how you actually write an extension-based exception for an UTI (like public.plain-text except anything ending in .log). Later edit: I've also looked though the RichText mdimporter binary and found a promising string but I can't figure out if it's actually being used (as a preference name
[ 0.12649212777614594, 0.20891989767551422, 0.2007642239332199, -0.016357751563191414, 0.0877101719379425, -0.05865911394357681, 0.1464475393295288, -0.05135311931371689, -0.17845849692821503, -0.5202691555023193, -0.4098644256591797, 0.47334545850753784, -0.601193904876709, 0.15430182218551...
or whatever): ``` cristi:FoodBrowser diciu$ strings /System/Library/Spotlight/RichText.mdimporter/Contents/MacOS/RichText |grep Text TextImporterDontImportList ```
[ 0.15873786807060242, 0.2374536097049713, 0.4807775914669037, -0.005191164556890726, 0.12254399061203003, 0.03573185205459595, -0.17138542234897614, 0.2973707318305969, -0.2534431517124176, -0.6301758289337158, -0.5038825273513794, 0.6058349013328552, -0.22100505232810974, 0.065931662917137...
I just wonder what the best approach is to have multiple users work on a Project in Visual Studio 2005 Professional. We got a Solution with multiple Class Libraries, but when everyone opens the solution, we keep getting the "X was modified, Reload/Discard?" prompt all the time. Just opening one project is an obvious alternative, but I find it harder to use as you can't just see some of the other classes in other projects that way. Are there any Guidelines for Team Development with VS2005 Pro? Edit: Thanks. The current environment is a bit limited in the sense there is only 1
[ 0.22300948202610016, -0.17732542753219604, -0.016621187329292297, 0.26624006032943726, -0.3687830865383148, -0.24980475008487701, 0.33992472290992737, -0.11508017033338547, -0.25611603260040283, -0.4458085298538208, 0.19071312248706818, 0.6996861696243286, -0.1630992591381073, -0.152955129...
PC with RDP Connection, but that will change in the future. Marking the first answer as Accepted, but they are all good :) Use source control to keep a central repository of all your code. Then each user checks out their own copy of the source code and works locally. Then submits only the code that changed. <https://en.wikipedia.org/wiki/Version_control>
[ 0.49269169569015503, -0.03526986762881279, 0.30827000737190247, 0.22153635323047638, 0.2308657467365265, -0.13107721507549286, -0.02962501160800457, 0.03651055693626404, -0.29325491189956665, -0.5112960934638977, -0.19311320781707764, 0.6520909070968628, -0.2596207559108734, 0.140264704823...
I'm currently working on a parser for our internal log files (generated by log4php, log4net and log4j). So far I have a nice regular expression to parse the logs, except for one annoying bit: Some log messages span multiple lines, which I can't get to match properly. The regex I have now is this: ``` (?<date>\d{2}/\d{2}/\d{2})\s(?<time>\d{2}):\d{2}:\d{2}),\d{3})\s(?<message>.+) ``` The log format (which I use for testing the parser) is this: ``` 07/23/08 14:17:31,321 log message spanning multiple lines 07/23/08 14:17:31,321 log message on one line ``` When I run the parser right now, I get only the line the log starts on. If I change it to span multiple lines, I get only
[ -0.14045771956443787, 0.06025461480021477, 0.6555493474006653, 0.02030029520392418, -0.21560020744800568, 0.1444896161556244, 0.5703049898147583, -0.1496930867433548, -0.32515057921409607, -0.920265257358551, 0.14444983005523682, 0.45013320446014404, -0.29479894042015076, -0.01060443837195...
one result (the whole log file). --- @samjudson: *You need to pass the RegexOptions.Singleline flag in to the regular expression, so that "." matches all characters, not just all characters except new lines (which is the default).* I tried that, but then it matches the whole file. I also tried to set the message-group to .+? (non-greedy), but then it matches a single character (which isn't what I'm looking for either). The problem is that the pattern for the message matches on the date-group as well, so when it doesn't break on a new-line it just goes on and on and on. --- I use this regex
[ 0.21207967400550842, -0.10405745357275009, 0.6515335440635681, -0.09315096586942673, -0.1965867131948471, 0.07362332195043564, 0.42520955204963684, 0.044710706919431686, -0.4025212228298187, -0.46925321221351624, -0.33678609132766724, 0.3545764088630676, -0.32304877042770386, -0.0455844290...
for the message group now. It works, unless there's a pattern IN the log message which is the same as the start of the log message. ``` (?<message>(.(?!\d{2}/\d{2}/\d{2}\s\d{2}:\d{2}:\d{2},\d{3}\s\[\d{4}\]))+) ``` This will only work if the log message doesn't contain a date at the beginning of the line, but you could try adding a negative look-ahead assertion for a date in the "message" group: ``` (?<date>\d{2}/\d{2}/\d{2})\s(?<time>\d{2}:\d{2}:\d{2},\d{3})\s(?<message>(.(?!^\d{2}/\d{2}/ \d{2}))+) ``` Note that this requires the use of the RegexOptions.MultiLine flag.
[ -0.1553879976272583, -0.2112436145544052, 0.5414075255393982, -0.16004104912281036, 0.14252163469791412, -0.15996861457824707, 0.37940871715545654, -0.3102419972419739, -0.21010927855968475, -0.4971727728843689, -0.3503654897212982, 0.37924569845199585, -0.3495241701602936, -0.020473286509...
In simple terms, what are the reasons for, and what are the differences between the GPL v2 and GPL v3 open source licenses? Explanations and references to legal terms and further descriptions would be appreciated. The page linked to in another answer is a good source, but a lot to read. Here is a short list of some the major differences: * internationalization: they used new terminology, rather than using language tied to US legal concepts * patents: they specifically address patents (including the Microsoft/Novell issue noted in another answer) * “Tivo-ization”: they address the restrictions (like Tivo’s) in consumer products that take away,
[ 0.5365058183670044, 0.3176245093345642, 0.08039502799510956, 0.29001444578170776, -0.10964293777942657, -0.5325167775154114, -0.10201212763786316, -0.13701467216014862, -0.1359122097492218, -0.17756296694278717, -0.14821039140224457, 0.53774094581604, -0.0954367145895958, 0.402263849973678...
though hardware, the ability to modify the software * DRM: they address digital rights management (which they call digital restrictions management) * compatibility: they addressed compatibility with some other open source licenses * termination: they addressed specifically what happens if the license is violated and the cure of violations I agree with the comment about consulting a lawyer (one who knows about software license issues, though). In doing these things (and more), they more than doubled the length of the GPL. GPL 3 is many things, and one of them is that it is a very complex, technical legal document.
[ 0.10341212153434753, 0.5087572336196899, 0.44327396154403687, -0.01794624514877796, -0.32141926884651184, -0.4133649468421936, 0.21821995079517365, -0.5599260330200195, -0.1738450676202774, -0.25869426131248474, -0.044050317257642746, 0.8434286713600159, -0.1000111922621727, 0.115208119153...
I am planning on creating a small website for my personal book collection. To automate the process a little bit, I would like to create the following functionality: The website will ask me for the ISBN number of the book and will then automatically fetch the title and add it to my database. Although I am mainly interested in doing this in php, I also have some Java implementation ideas for this. I believe it could also help if the answer was as much language-agnostic as possible. This is the LibraryThing founder. We have nothing to offer here, so I hope my comments
[ 0.7326180338859558, 0.3049849569797516, 0.06969130784273148, 0.19339171051979065, -0.020505543798208237, -0.43492430448532104, 0.1984170824289322, 0.33735182881355286, -0.41119909286499023, -0.15228496491909027, 0.31464189291000366, 0.14393608272075653, 0.21392107009887695, 0.2318011224269...
will not seem self-serving. First, the comment about Amazon, ASINs and ISBN numbers is wrong in a number of ways. In almost every circumstance where a book has an ISBN, the ASIN and the ISBN are the same. ISBNs are not now 13 digits. Rather, ISBNs can be either 10 or 13. Ten-digit ISBNs can be expressed as 13-digit ones starting with 978, which means every ISBN currently in existence has both a 10- and a 13-digit form. There are all sorts of libraries available for converting between ISBN10 and ISBN13. Basically, you add 978 to the front and recalculate the
[ 0.28028610348701477, -0.02558470517396927, 0.5250129699707031, 0.42006927728652954, -0.03440837562084198, 0.1871112585067749, -0.09986692667007446, 0.043080221861600876, -0.4037901759147644, -0.46689102053642273, -0.21465909481048584, 0.28995904326438904, 0.004299031104892492, 0.0228779632...
checksum digit at the end. ISBN13 was invented because publishers were running out of ISBNs. In the near future, when 979-based ISBN13s start being used, they will not have an ISBN10 equivalent. To my knowledge, there are no published books with 979-based ISBNs, but they are coming soon. Anyway, the long and short of it is that Amazon uses the ISBN10 form for all 978 ISBN10s. In any case, whether or not Amazon uses ten or thirteen-digit ASINs, you can search Amazon by either just fine. Personally, I wouldn't put ISBN DB at the top of your list. ISBN DB mines from
[ 0.06481936573982239, 0.2965937554836273, 0.2915874421596527, 0.46550455689430237, -0.5447579026222229, 0.10972429811954498, 0.20850543677806854, 0.1384877860546112, -0.31942814588546753, -0.4345094561576843, 0.1608210653066635, 0.18462693691253662, 0.008911773562431335, 0.06039528548717499...
a number of sources, but it's not as comprehensive as Amazon or Google. Rather, I'd look into Amazon—including the various international Amazons—and then the new Google Book Data API and, after that, the OpenLibrary API. For non-English books, there are other options, like Ozone for Russian books. If you care about the highest-quality data, or if you have any books published before about 1970, you will want to look into data from libraries, available by Z39.50 protocol and usually in MARC format, or, with a few libraries in Dublin Core, using the SRU/SRW protocol. MARC format is, to a modern
[ 0.30702945590019226, 0.1409873217344284, 0.20262086391448975, 0.33894047141075134, -0.16608619689941406, -0.3948715925216675, -0.11649535596370697, 0.2095295637845993, -0.3722100555896759, -0.4321940541267395, -0.3055746853351593, 0.14789249002933502, 0.08909013122320175, 0.051858097314834...
programmer, pretty strange stuff. But, once you get it, it's also better data and includes useful fields like the LCCN, DDC, LCC, and LCSH. LibraryThing runs off a homemade Python library that queries some 680 libraries and converts the many flavors of MARC into Amazon-compatible XML, with extras. We are currently reluctant to release the code, but maybe releasing a service soon.
[ 0.532296895980835, 0.08624426275491714, 0.12087922543287277, 0.24775360524654388, -0.1755102276802063, -0.2611624598503113, -0.03551628440618515, 0.23321950435638428, -0.24372199177742004, -0.43539297580718994, 0.17291498184204102, 0.5111470818519592, 0.15258729457855225, 0.070530563592910...