text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
// Open and set the key that points to the file RegistryKey key = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Current", true); key.SetValue(null, keyValue, RegistryValueKind.ExpandString); isEnabled = value; } } } } ``` Then in the main form we use the
[ -0.19966576993465424, 0.037025246769189835, 0.7579509019851685, -0.22838178277015686, 0.48229408264160156, -0.07237887382507324, 0.07504282891750336, -0.11688415706157684, -0.25705212354660034, -0.7900750637054443, -0.5229962468147278, 0.5420401096343994, -0.3785279095172882, 0.28634357452...
above code in these 3 events: * Activated * Deactivated * FormClosing ``` private void Form1_Activated(object sender, EventArgs e) { // Disable the sound when the program has focus WebClickSound.Enabled = false; } private void Form1_Deactivate(object sender, EventArgs e) { // Enable the sound when the program is out of focus WebClickSound.Enabled = true; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // Enable the sound on app exit WebClickSound.Enabled = true; } ``` The one problem I see currently is if the program crashes they won't have the click sound until they re-launch my application,
[ 0.05133612081408501, 0.15587325394153595, 0.7419524788856506, -0.2134670466184616, 0.36655664443969727, 0.027755646035075188, 0.7538904547691345, -0.27411946654319763, -0.21534346044063568, -0.6822699904441833, -0.6973872780799866, 0.9036979675292969, -0.5310308933258057, 0.032586954534053...
but they wouldn't know to do that. What do you guys think? Is this a good solution? What improvements can be made? I've noticed that if you use WebBrowser.Document.Write rather than WebBrowser.DocumentText then the click sound doesn't happen. So instead of this: ``` webBrowser1.DocumentText = "<h1>Hello, world!</h1>"; ``` try this: ``` webBrowser1.Document.OpenNew(true); webBrowser1.Document.Write("<h1>Hello, world!</h1>"); ```
[ 0.19325582683086395, -0.06300045549869537, 0.567855179309845, 0.050344739109277725, 0.2675560414791107, -0.43141278624534607, 0.4535068869590759, -0.18215778470039368, -0.14019031822681427, -0.7045271992683411, 0.03706229478120804, 0.7921566963195801, -0.27744582295417786, 0.21422640979290...
Since the keyboard is **the** interface we use to the computer, I've always thought touch typing should be something I should learn, but I've always been, well, lazy is the word. So, anyone recommend any good touch typing software? It's easy enough to google, but I'ld like to hear recommendations. [Typing of the Dead!](http://en.wikipedia.org/wiki/Typing_of_the_Dead) It's a good few years old so you may have to hunt around, but it's a lot of fun and as well as the main game there are numerous minigames to practice specific areas you may be weak on. ![alt text](https://i.stack.imgur.com/wM9Cv.jpg)
[ 0.061007626354694366, 0.020985115319490433, 0.2924852967262268, 0.017727119848132133, 0.2897329330444336, 0.02227473072707653, 0.04268850013613701, 0.3540648818016052, -0.2861833870410919, -0.595540463924408, 0.6490976214408875, 0.5068029761314392, 0.18962842226028442, -0.2096496969461441,...
One of the things I'd like to do in my browser-based application is allow the user to select some text (not in a <textarea>, just plain ol' text!), and have my application pop up a small toolbar that then can interact with the next (in my case, add annotations). I've found a lot of stuff on google that seems to be focused on writing WYSIWYG editors, **but that isn't what I want**, and most of it worked in IE but not in FF2 or 3. Ideally, I'd like some function that can return the currently selected text in the browser window
[ 0.24893201887607574, 0.07841546833515167, 0.24190235137939453, 0.14764738082885742, -0.24668516218662262, -0.01225245837122202, 0.1873512715101242, 0.3342937231063843, -0.07887933403253555, -0.8081269264221191, -0.0675329715013504, 0.573435366153717, -0.000948208209592849, -0.0279460158199...
that works in **IE7 (and 6 if possible), FireFox 2 & 3 and Safari 2**. If it works in Opera, that'd be a bonus, but it's not a requirement. Anyone have a function that does this? Or an idea of where to start? Have a look at [jQuery](http://jquery.com) and the [wrapSelection plugin](http://plugins.jquery.com/project/wrapSelection). It may be what you are looking for.
[ 0.44034913182258606, -0.3960858881473541, 0.07598940283060074, -0.009025928564369678, 0.18736962974071503, -0.2935977876186371, 0.08731533586978912, 0.10437599569559097, -0.3123474419116974, -0.6472272872924805, -0.1293082982301712, 0.4704327881336212, 0.061715591698884964, -0.239018067717...
Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using. What's the best way to figure this out? ++happy for various platform solutions. Oracle provides a utility called `tnsping`: ``` R:\>tnsping someconnection TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20 08 10:38:07 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: C:\Oracle92\network\ADMIN\sqlnet.ora C:\Oracle92\network\ADMIN\tnsnames.ora TNS-03505: Failed to resolve name R:\> R:\>tnsping entpr01 TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20 08 10:39:22 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: C:\Oracle92\network\ADMIN\sqlnet.ora C:\Oracle92\network\ADMIN\tnsnames.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
[ -0.17135831713676453, 0.29130491614341736, 0.5317214727401733, 0.055806055665016174, 0.009232128039002419, 0.015320469625294209, 0.11669524013996124, -0.1252087503671646, -0.3156692683696747, -0.03450894355773926, -0.0267093013972044, 0.8094658255577087, -0.5258994102478027, -0.03243212029...
(COMMUNITY = **) (PROTOCOL = TCP) (Host = ****) (Port = 1521))) (CONNECT_DATA = (SID = ENTPR0 1))) OK (40 msec) R:\> ``` This should show what file you're using. The utility sits in the Oracle `bin` directory.
[ 0.1488983929157257, -0.2478388100862503, 0.15976831316947937, -0.22506025433540344, 0.11867440491914749, -0.1511954963207245, 0.34208911657333374, -0.3731815218925476, 0.028895260766148567, -0.44400259852409363, -0.23742637038230896, 0.36917969584465027, -0.3104133605957031, 0.341630309820...
I am having a strange DB2 issue when I run DBUnit tests. My DBUnit tests are highly customized, but I don't think it is the issue. When I run the tests, I get a failure: > SQLCODE: -1084, SQLSTATE: 57019 [which translates to](https://www1.columbia.edu/sec/acis/db2/db2m0/sql1000.htm) > SQL1084C Shared memory segments cannot be allocated. It sounds like a weird memory issue, though here's the big strange thing. If I ssh to the test database server, then go in to db2 and do "connect to MY\_DB", the tests start succeeding! This seems to have no relation to the supposed memory error that is being reported. I have
[ 0.3403972387313843, 0.4480504095554352, -0.07114113122224808, -0.04316182807087898, -0.038915928453207016, -0.16482943296432495, 0.5113099813461304, 0.2164386361837387, -0.19337883591651917, -0.5897520184516907, 0.12355740368366241, 0.15881302952766418, -0.10699792951345444, 0.652285575866...
2 tests, and the first one actually succeeds, the second one is the one that fails. However, it fails in the DBUnit setup code, when it is obtaining the connection to the DB server to load my xml dataset. Any ideas what might be going on? Oracle provides a utility called `tnsping`: ``` R:\>tnsping someconnection TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20 08 10:38:07 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: C:\Oracle92\network\ADMIN\sqlnet.ora C:\Oracle92\network\ADMIN\tnsnames.ora TNS-03505: Failed to resolve name R:\> R:\>tnsping entpr01 TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20 08 10:39:22 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: C:\Oracle92\network\ADMIN\sqlnet.ora C:\Oracle92\network\ADMIN\tnsnames.ora Used
[ 0.12599027156829834, 0.4232601523399353, 0.2750329375267029, -0.0485830120742321, 0.04050113633275032, 0.010389991104602814, 0.10240857303142548, -0.2472260594367981, -0.1483946591615677, -0.06153489276766777, -0.01319468580186367, 0.6195029616355896, -0.5731050372123718, 0.093491740524768...
TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = **) (PROTOCOL = TCP) (Host = ****) (Port = 1521))) (CONNECT_DATA = (SID = ENTPR0 1))) OK (40 msec) R:\> ``` This should show what file you're using. The utility sits in the Oracle `bin` directory.
[ -0.11958968639373779, -0.4055706262588501, 0.4234982430934906, -0.07745910435914993, 0.14613139629364014, -0.1438068151473999, 0.270467072725296, -0.47617214918136597, 0.09640509635210037, -0.6528837084770203, -0.1604222059249878, 0.7962006330490112, -0.30955278873443604, 0.169428303837776...
The Entity Framework does not support the `Expression.Invoke` operator. You receive the following exception when trying to use it: > "The LINQ expression node type 'Invoke' is not supported in LINQ to Entities. Has anyone got a workaround for this missing functionality? I would like to use the PredicateBuilder detailed [here](http://www.albahari.com/nutshell/predicatebuilder.html) in an Entity Framework context. **Edit 1** @marxidad - I like your suggestion, however it does baffle me somewhat. Can you give some further advice on your proposed solution? **Edit 2** @marxidad - Thanks for the clarification. [PredicateBuilder](http://www.albahari.com/nutshell/predicatebuilder.aspx) and [LINQKit](http://www.albahari.com/nutshell/linqkit.aspx) now support Entity Framework. Sorry, guys, for not doing this earlier!
[ 0.10113487392663956, 0.13260813057422638, 0.35229572653770447, 0.14297889173030853, -0.001526044332422316, -0.1964513659477234, 0.11001028120517731, 0.03800304979085922, -0.16901876032352448, -0.40830883383750916, 0.06681479513645172, 0.5921169519424438, -0.06778950244188309, 0.08622134476...
Here's a problem I ran into recently. I have attributes strings of the form ``` "x=1 and y=abc and z=c4g and ..." ``` Some attributes have numeric values, some have alpha values, some have mixed, some have dates, etc. Every string is *supposed* to have "`x=someval and y=anotherval`" at the beginning, but some don't. I have three things I need to do. 1. Validate the strings to be certain that they have `x` and `y`. 2. Actually parse the values for `x` and `y`. 3. Get the rest of the string. Given the example at the top, this would result in the following variables: ``` $x = 1; $y = "abc"; $remainder
[ 0.2503570318222046, 0.5303103923797607, 0.06531159579753876, -0.02741874009370804, -0.18424063920974731, 0.11128979921340942, 0.1910877525806427, -0.46172258257865906, 0.016927525401115417, -0.5587375164031982, 0.15370869636535645, 0.5471782684326172, -0.1353265941143036, 0.385020405054092...
= "z=c4g and ..." ``` My question is: Is there a (reasonably) simple way to parse these *and* validate with a single regular expression? i.e.: ``` if ($str =~ /someexpression/) { $x = $1; $y = $2; $remainder = $3; } ``` Note that the string may consist of *only* `x` and `y` attributes. This is a valid string. I'll post my solution as an answer, but it doesn't meet my single-regex preference. I'm not the best at regular expressions, but this seems pretty close to what you're looking for: ``` /x=(.+) and y=([^ ]+)( and (.*))?/ ``` Except you use $1, $2, and $4.
[ 0.167981818318367, 0.47084763646125793, 0.370079904794693, -0.07365109026432037, 0.12959203124046326, 0.012084451504051685, 0.2935018539428711, -0.2162214070558548, -0.02895723283290863, -0.34360185265541077, -0.39243239164352417, 0.6158586740493774, -0.13180017471313477, 0.038278318941593...
In use: ``` my @strs = ("x=1 and y=abc and z=c4g and w=v4l", "x=yes and y=no", "z=nox and w=noy"); foreach (@strs) { if ($_ =~ /x=(.+) and y=([^ ]+)( and (.*))?/) { $x = $1; $y = $2; $remainder = $4; print "x: $x; y: $y; remainder: $remainder\n";
[ -0.16562023758888245, 0.2367154061794281, 0.36334627866744995, -0.36111822724342346, 0.10780549794435501, 0.19471986591815948, 0.16890060901641846, -0.2616594135761261, -0.058112695813179016, -0.16332361102104187, -0.6176574230194092, 0.44668328762054443, -0.12910732626914978, 0.2824608981...
} else { print "Failed.\n"; } } ``` Output: ``` x: 1; y: abc; remainder: z=c4g and w=v4l x: yes; y: no; remainder: Failed. ``` This of course leaves out plenty of error checking, and I don't know everything about your inputs, but this seems to work.
[ -0.016535451635718346, 0.4190237820148468, 0.04430351033806801, -0.3118916153907776, 0.20984064042568207, 0.057464126497507095, 0.2959475815296173, -0.2923218011856079, -0.046639129519462585, -0.39195454120635986, -0.33570247888565063, 0.7970585823059082, -0.3936387300491333, 0.15400974452...
I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again. I have intended to use a StAX parser (`javax.xml.stream.XMLStreamReader`) to read in each event, see if it was one I wanted to change, and then pass it straight on to the StAX writer (`javax.xml.stream.XMLStreamReader`) if no changes were required. Unfortunately, that doesn't look to be so simple - The writer has no way to take an event type and a parser object, only methods like `writeAttribute` and `writeStartElement`. Obviously I could write a big switch statement with
[ 0.19975392520427704, -0.061046089977025986, 0.28261879086494446, -0.0729072317481041, 0.023322125896811485, -0.031378503888845444, -0.01364009827375412, -0.02984062023460865, -0.01857111044228077, -0.6899703741073608, 0.10796794295310974, 0.4911711513996124, -0.16151519119739532, -0.092311...
a case for every possible type of element which can occur in an XML document, and just write it back out again, but it seems like a lot of trouble for something which seems like it should be simple. Is there something I'm missing that makes it easy to write out a very similar XML document to the one you read in with StAX? StAX works pretty well and is very fast. I used it in a project to parse XML files which are up to 20MB. I don't have a thorough analysis, but it was definitely faster than SAX. As for
[ 0.10475648194551468, 0.19505035877227783, -0.07792718708515167, 0.08012907207012177, -0.06897284090518951, -0.26496216654777527, -0.11186780035495758, -0.23705603182315826, -0.32541611790657043, -0.5037818551063538, 0.20161063969135284, 0.713378369808197, -0.10904105752706528, -0.419477164...
your question: The difference between streaming and event-handling, AFAIK is control. With the streaming API you can walk through your document step by step and get the contents you want. Whereas the event-based API you can only handle what you are interested in.
[ 0.2289925515651703, -0.22328543663024902, -0.015544035471975803, 0.40613245964050293, 0.11783449351787567, -0.2303033173084259, -0.1777656227350235, -0.054832328110933304, -0.03098633512854576, -0.4608890414237976, -0.1105283796787262, 0.5733914375305176, -0.33163735270500183, -0.001214553...
I wrote a simple batch file as a PowerShell script, and I am getting errors when they run. It's in a scripts directory in my path. This is the error I get: > Cannot be loaded because the execution of scripts is disabled on this system. > Please see "get-help about-signing". I looked in the help, but it's less than helpful. It could be PowerShell's default security level, which (IIRC) will only run signed scripts. Try typing this: ```none set-executionpolicy remotesigned ``` That will tell PowerShell to allow local (that is, on a local drive) unsigned scripts to run. Then try executing your script again.
[ 0.375949889421463, 0.26767417788505554, 0.01142378244549036, -0.027909616008400917, 0.131546750664711, -0.40442007780075073, 0.6369723081588745, -0.06583230197429657, -0.24625979363918304, -0.7643108367919922, 0.004971853923052549, 0.7568944692611694, -0.4056853950023651, 0.155236348509788...
I need a C# profiler. Although I'm not averse to paying for one, something which is free or at least with a trial version would be ideal since it takes time to raise a purchase order. Any recommendations? You can try the following: * [nprof](http://nprof.sourceforge.net/Site/Description.html) (free but kinda old) * [ProfileSharp](http://sourceforge.net/projects/profilesharp/) (open source) * [.Net Memory Profiler](http://memprofiler.com/) (really good for memory leaks, there's a trial version) --- Edit: Nprof has been replaced with [SlimTune](https://code.google.com/p/slimtune/) and works with .Net 4.0 applications
[ 0.5673233866691589, 0.04634736478328705, 0.2716423571109772, -0.0064896875992417336, -0.1685197502374649, -0.24031415581703186, 0.09951633960008621, -0.06512003391981125, -0.11184638738632202, -0.7440183162689209, 0.1963154524564743, 0.6214845776557922, 0.006649241782724857, -0.03847944363...
We deployed a live, fresh, swanky site using preview 3 including rigorous stress testing. Page Output caching was our saviour and afforded us the ability to meet our performance contractual requirements. My question is, is there a difference between action `OutputCacheFilter` and page output caching? Is the action output caching faster than page output caching? Internally, the OutputCacheAttribute (aka output cache filter) uses the same internal mechanism as [page output caching](http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx) (aka the @OutputCache directive). Therefore, it's not any faster than page output caching. However, with MVC, you really can't use page output caching via the @OutputCache directive in MVC because we render the
[ 0.08174511045217514, -0.2447289526462555, 0.194881871342659, -0.2209692746400833, -0.47062215209007263, 0.010328666307032108, 0.04614756256341934, -0.35569703578948975, -0.010584723204374313, -0.5866943001747131, -0.028005335479974747, 0.6389558911323547, -0.3511398732662201, -0.1372633576...
view (aka page) **after** the action runs. So you would gain very little benefit. With the output cache filter, it does the correct thing and does not execute the action code if the result is in the output cache. Hope that helps. :)
[ 0.09679452329874039, -0.2703307271003723, 0.583946168422699, -0.04359522461891174, -0.3245142102241516, 0.1254383623600006, 0.2782498896121979, -0.11316933482885361, -0.27011868357658386, -0.7025609016418457, -0.014236402697861195, 0.5568972229957581, -0.2025408297777176, -0.22496661543846...
Is there any difference between ``` int on_exit(void (*function)(int , void *), void *arg); ``` and ``` int atexit(void (*function)(void)); ``` other than the fact that the function used by on\_exit gets the exit status? That is, if I don't care about the exit status, is there any reason to use one or the other? **Edit:** Many of the answers warned against `on_exit` because it's non-standard. If I'm developing an app that is for internal corporate use and guaranteed to run on specific configurations, should I worry about this? According to [this link](http://www.delorie.com/gnu/docs/glibc/libc_560.html) I found, it seems there are a few differences. `on_exit` will let
[ 0.3593531548976898, 0.20740987360477448, 0.30289191007614136, 0.060751333832740784, 0.4721410870552063, 0.0763188824057579, -0.03733058646321297, 0.20427937805652618, -0.09655460715293884, -0.6720736622810364, -0.3082242012023926, 0.6849226355552673, -0.36722421646118164, 0.112419009208679...
you pass in an argument that is passed in to the `on_exit` function when it is called... which might let you set up some pointers to do some cleanup work on when it is time to exit. Furthermore, it appears that `on_exit` was a SunOS specific function that may not be compatible on all platforms... so you may want to stick with atexit, despite it being more restrictive.
[ -0.18947039544582367, -0.12861348688602448, 0.13383260369300842, 0.13286587595939636, 0.16297085583209991, -0.1046609953045845, 0.1738647222518921, 0.0633208304643631, 0.07992148399353027, -0.8010575175285339, -0.08639438450336456, 0.41318997740745544, -0.4345124065876007, 0.20541834831237...
So our web server apps need to connect to the database, and some other apps have startup scripts that execute at boot time. What's the best way to store the name/password for these applications, in terms of * security, e.g. perhaps we don't want sysadmins to know the database password * maintainability, e.g. making the configuration easy to change when the password changes, etc. both windows and linux solutions appreciated! The best way to secure your password is to stop using one. Use a trusted connection: [How To: Connect to SQL Server Using Windows Authentication in ASP.NET 2.0](http://msdn.microsoft.com/en-us/library/ms998292.aspx). Then you have nothing to hide - publish
[ 0.22560164332389832, 0.14329874515533447, 0.35809460282325745, 0.3952249586582184, 0.19863516092300415, -0.5485432744026184, 0.283292680978775, -0.05478024110198021, -0.31853291392326355, -0.665421187877655, -0.09393861144781113, 0.5108184218406677, -0.1312454640865326, -0.0932420790195465...
your web.config and source to the world, they still can't hit your database. If that won't work for you, use the built in [configuration encryption system in ASP.NET](http://msdn.microsoft.com/en-us/magazine/cc163614.aspx).
[ 0.34915316104888916, -0.03853951022028923, 0.22981004416942596, 0.3828369081020355, 0.25305530428886414, -0.3870387673377991, 0.4967661499977112, 0.386434406042099, -0.3474904000759125, -0.858963668346405, -0.2039736807346344, 0.6945791244506836, -0.08660300076007843, -0.07993075996637344,...
Ok, so I've been refactoring my code in my little Rails app in an effort to remove duplication, and in general make my life easier (as I like an easy life). Part of this refactoring, has been to move code that's common to two of my models to a module that I can include where I need it. So far, so good. Looks like it's going to work out, but I've just hit a problem that I'm not sure how to get around. The module (which I've called sendable), is just going to be the code that handles faxing, e-mailing, or
[ 0.34290048480033875, -0.005666189827024937, 0.04056666046380997, 0.14233998954296112, 0.12374267727136612, 0.10160093009471893, 0.2934079170227051, 0.2786204516887665, -0.34048929810523987, -0.7055110335350037, 0.10687251389026642, 0.32783302664756775, -0.1978471279144287, -0.1955459862947...
printing a PDF of the document. So, for example, I have a purchase order, and I have Internal Sales Orders (imaginatively abbreviated to ISO). The problem I've struck, is that I want some variables initialised (initialized for people who don't spell correctly :P ) after the object is loaded, so I've been using the **after\_initialize** hook. No problem... until I start adding some more mixins. The problem I have, is that I can have an **`after_initialize`** in any one of my mixins, so I need to include a **super** call at the start to make sure the other mixin **`after_initialize`** calls get
[ 0.3209967017173767, 0.011996378190815449, 0.42974698543548584, -0.03756384551525116, -0.03627830743789673, 0.013993043452501297, -0.17605505883693695, -0.0018918282585218549, -0.23554877936840057, -0.6185323596000671, -0.22761301696300507, 0.3702273964881897, -0.4009512960910797, 0.0769434...
called. Which is great, until I end up calling super and I get an error because there is no super to call. Here's a little example, in case I haven't been confusing enough: ``` class Iso < ActiveRecord::Base include Shared::TracksSerialNumberExtension include Shared::OrderLines extend Shared::Filtered include Sendable::Model validates_presence_of :customer validates_associated :lines owned_by :customer order_lines :despatched # Mixin tracks_serial_numbers :items
[ 0.15318384766578674, -0.4083471894264221, 0.3648010194301605, 0.1734052151441574, 0.10108470171689987, 0.027086587622761726, 0.32910704612731934, -0.19501350820064545, -0.4413304626941681, -0.3070150315761566, -0.2866791784763336, 0.29446104168891907, -0.6241839528083801, 0.299802064895629...
# Mixin sendable :customer # Mixin attr_accessor :address def initialize( params = nil ) super self.created_at ||= Time.now.to_date end end ``` So, if each one of the mixins have an after\_initialize call, with a **super** call, how can I stop that last **super** call from raising the error? How can I test that the super method exists before I call it? You can use this: ``` super if defined?(super) ``` Here is an example: ``` class A end class B <
[ 0.426104336977005, -0.163367360830307, 0.33731818199157715, -0.1726619154214859, -0.020342053845524788, -0.035922821611166, 0.348065048456192, -0.3466094434261322, -0.13833235204219818, -0.2308601289987564, -0.31727805733680725, 0.49379879236221313, -0.5917500853538513, 0.28260889649391174...
A def t super if defined?(super) puts "Hi from B" end end B.new.t ```
[ 0.3018069863319397, -0.3959397077560425, 0.2678864300251007, -0.39480870962142944, -0.3260766267776489, -0.2673804461956024, 0.6342061161994934, -0.38070711493492126, 0.1303563117980957, -0.33411934971809387, -0.5876542329788208, 0.42558690905570984, -0.3017970323562622, 0.2782318890094757...
For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query. What is the optimal way to create such a function? Heh... sorry I'm so late responding to an old post. And, yeah, I had to respond because the most popular answer (at the time, the Recursive CTE answer with the link to 14 different methods) on this thread is, ummm... performance challenged at
[ 0.12172339111566544, -0.04931965097784996, 0.18527498841285706, 0.3098940849304199, -0.13158996403217316, -0.09117066115140915, 0.18658585846424103, 0.12048175930976868, -0.3330373167991638, -0.4953679144382477, 0.1375139206647873, 0.31153786182403564, -0.0664154514670372, 0.22364242374897...
best. First, the article with the 14 different solutions is fine for seeing the different methods of creating a Numbers/Tally table on the fly but as pointed out in the article and in the cited thread, there's a *very* important quote... > "suggestions regarding efficiency and > performance are often subjective. > Regardless of how a query is being > used, the physical implementation > determines the efficiency of a query. > Therefore, rather than relying on > biased guidelines, it is imperative > that you test the query and determine > which one performs better." Ironically, the article itself contains many subjective
[ 0.10075031220912933, 0.1856997311115265, 0.16664454340934753, 0.472088485956192, -0.255741149187088, -0.071722611784935, 0.41175204515457153, -0.3587794005870819, -0.04479512944817543, -0.6929374933242798, 0.31215035915374756, 0.7035832405090332, -0.14718972146511078, -0.24522040784358978,...
statements and "biased guidelines" such as *"a recursive CTE can generate a number listing **pretty efficiently**"* and *"This is **an efficient method** of using WHILE loop from a newsgroup posting by Itzik Ben-Gen"* (which I'm sure he posted just for comparison purposes). C'mon folks... Just mentioning Itzik's good name may lead some poor slob into actually using that horrible method. The author should practice what (s)he preaches and should do a little performance testing before making such ridiculously incorrect statements especially in the face of any scalablility. With the thought of actually doing some testing before making any subjective claims about
[ 0.7281336188316345, 0.5660748481750488, -0.20967134833335876, 0.19747905433177948, -0.5567131638526917, -0.3408924639225006, 0.5946211218833923, 0.11943796277046204, 0.020464975386857986, -0.05389667674899101, -0.06965875625610352, 0.2358773946762085, -0.42545440793037415, 0.19935767352581...
what any code does or what someone "likes", here's some code you can do your own testing with. Setup profiler for the SPID you're running the test from and check it out for yourself... just do a "Search'n'Replace" of the number 1000000 for your "favorite" number and see... ``` --===== Test for 1000000 rows ================================== GO --===== Traditional RECURSIVE CTE method WITH Tally (N) AS ( SELECT 1 UNION ALL SELECT 1 + N FROM Tally
[ 0.5602969527244568, -0.014786051586270332, 0.15568435192108154, 0.20081137120723724, -0.133310467004776, 0.04314201697707176, 0.1991853415966034, -0.45459651947021484, 0.17498591542243958, -0.36907732486724854, 0.02826211228966713, 0.22320564091205597, -0.2529992461204529, -0.0059961457736...
WHERE N < 1000000 ) SELECT N INTO #Tally1 FROM Tally OPTION (MAXRECURSION 0); GO --===== Traditional WHILE LOOP method CREATE TABLE #Tally2 (N INT); SET NOCOUNT ON; DECLARE @Index INT; SET @Index = 1; WHILE @Index <= 1000000 BEGIN INSERT #Tally2 (N) VALUES (@Index); SET @Index = @Index
[ -0.03201673924922943, -0.24459810554981232, 0.4411032497882843, -0.19006969034671783, 0.06497316062450409, 0.3633745312690735, 0.15158675611019135, -0.5449225902557373, -0.186898335814476, -0.18819007277488708, -0.17505010962486267, 0.2660858929157257, -0.4129398763179779, -0.1186510324478...
+ 1; END; GO --===== Traditional CROSS JOIN table method SELECT TOP (1000000) ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS N INTO #Tally3 FROM Master.sys.All_Columns ac1 CROSS JOIN Master.sys.ALL_Columns ac2; GO --===== Itzik's CROSS JOINED CTE method WITH E00(N) AS (SELECT 1 UNION ALL SELECT 1), E02(N) AS (SELECT 1 FROM E00 a, E00 b), E04(N) AS (SELECT 1 FROM E02 a, E02 b), E08(N) AS
[ -0.2584748864173889, -0.1300126016139984, 0.5184475779533386, -0.07809124141931534, -0.025184210389852524, 0.3017626404762268, 0.2464670091867447, -0.6908775568008423, -0.20190294086933136, -0.5361030697822571, -0.25371408462524414, 0.20140387117862701, -0.5689154267311096, 0.2637882828712...
(SELECT 1 FROM E04 a, E04 b), E16(N) AS (SELECT 1 FROM E08 a, E08 b), E32(N) AS (SELECT 1 FROM E16 a, E16 b), cteTally(N) AS (SELECT ROW_NUMBER() OVER (ORDER BY N) FROM E32) SELECT N INTO #Tally4 FROM cteTally WHERE N <= 1000000; GO --===== Housekeeping DROP TABLE #Tally1, #Tally2, #Tally3, #Tally4; GO ``` While we're at it, here's the numbers I get from SQL Profiler for the values of 100, 1000, 10000, 100000, and 1000000... ``` SPID TextData
[ 0.0006929994560778141, 0.25912153720855713, 0.47918206453323364, -0.13109081983566284, 0.08067945390939713, 0.278520792722702, 0.06062527000904083, -0.5948085188865662, -0.34318429231643677, -0.34068727493286133, -0.22341600060462952, 0.26692894101142883, -0.1854552924633026, -0.1587930768...
Dur(ms) CPU Reads Writes ---- ---------------------------------------- ------- ----- ------- ------ 51 --===== Test for 100 rows ============== 8 0 0 0 51 --===== Traditional RECURSIVE CTE method 16 0 868
[ -0.49765780568122864, -0.1378629356622696, 0.356968492269516, -0.32152485847473145, 0.024904511868953705, 0.597766637802124, 0.22098615765571594, -0.3742147386074066, -0.04278722405433655, -0.5338804721832275, -0.20873601734638214, 0.43208569288253784, -0.14164845645427704, -0.002573358127...
0 51 --===== Traditional WHILE LOOP method CR 73 16 175 2 51 --===== Traditional CROSS JOIN table met 11 0 80 0 51 --===== Itzik's CROSS JOINED CTE method 6 0 63 0 51 --=====
[ 0.16574250161647797, 0.2274753600358963, 0.45878270268440247, -0.18417343497276306, -0.15525905787944794, 0.30192530155181885, 0.4484572410583496, -0.4442196786403656, -0.06756402552127838, -0.546563982963562, 0.1506488174200058, -0.017136098816990852, -0.044939685612916946, 0.129961207509...
Housekeeping DROP TABLE #Tally 35 31 401 0 51 --===== Test for 1000 rows ============= 0 0 0 0 51 --===== Traditional RECURSIVE CTE method 47 47 8074 0 51 --===== Traditional WHILE LOOP method CR
[ 0.11734497547149658, 0.5149779319763184, 0.28744760155677795, -0.04151878505945206, 0.20216640830039978, 0.1410687267780304, 0.416842520236969, -0.9636922478675842, -0.466696172952652, -0.07926328480243683, -0.2879844605922699, 0.023465801030397415, -0.244104266166687, -0.2686275839805603,...
80 78 1085 0 51 --===== Traditional CROSS JOIN table met 5 0 98 0 51 --===== Itzik's CROSS JOINED CTE method 2 0 83 0 51 --===== Housekeeping DROP TABLE #Tally 6 15
[ 0.20684631168842316, 0.39438381791114807, 0.5127578973770142, -0.316477507352829, -0.19524621963500977, 0.15228770673274994, 0.4633374512195587, -0.8635169863700867, -0.33782491087913513, -0.18901272118091583, 0.05601847916841507, 0.09249626845121384, -0.15244929492473602, -0.0377851128578...
426 0 51 --===== Test for 10000 rows ============ 0 0 0 0 51 --===== Traditional RECURSIVE CTE method 434 344 80230 10 51 --===== Traditional WHILE LOOP method CR 671 563 10240 9 51 --===== Traditional CROSS JOIN table met
[ -0.3279041647911072, 0.3732864260673523, 0.14766305685043335, 0.07456953078508377, 0.1772664189338684, 0.5000503063201904, 0.6282357573509216, -0.5414770245552063, -0.246770977973938, -0.5190593004226685, -0.05304252728819847, 0.07215434312820435, -0.036780424416065216, 0.01710897497832775...
25 31 302 15 51 --===== Itzik's CROSS JOINED CTE method 24 0 192 15 51 --===== Housekeeping DROP TABLE #Tally 7 15 531 0 51 --===== Test for 100000 rows =========== 0
[ 0.1750313639640808, 0.43299803137779236, 0.3731206953525543, -0.059921134263277054, -0.24115967750549316, 0.46073952317237854, 0.5603984594345093, -0.6687213182449341, -0.2270573377609253, -0.31447359919548035, 0.0038974422495812178, 0.023313194513320923, -0.154565691947937, -0.09159675985...
0 0 0 51 --===== Traditional RECURSIVE CTE method 4143 3813 800260 154 51 --===== Traditional WHILE LOOP method CR 5820 5547 101380 161 51 --===== Traditional CROSS JOIN table met 160 140 479 211 51 --===== Itzik's CROSS JOINED CTE method 153 141 276
[ -0.12939704954624176, 0.20330403745174408, 0.3432237207889557, -0.11569087207317352, -0.09261806309223175, 0.3167668282985687, 0.3705061376094818, -0.47914206981658936, -0.2781374454498291, -0.4802084267139435, -0.17453870177268982, -0.06868196278810501, -0.019227871671319008, 0.2153209447...
204 51 --===== Housekeeping DROP TABLE #Tally 10 15 761 0 51 --===== Test for 1000000 rows ========== 0 0 0 0 51 --===== Traditional RECURSIVE CTE method 41349 37437 8001048 1601 51 --===== Traditional WHILE LOOP method CR 59138 56141 1012785 1682 51
[ -0.15387485921382904, 0.2689880132675171, -0.09129868447780609, 0.07597712427377701, 0.23983553051948547, -0.03843693062663078, 0.5255153775215149, -0.9194214344024658, -0.7467837333679199, 0.001757158781401813, -0.3456338047981262, -0.15051355957984924, -0.17938333749771118, -0.4206034839...
--===== Traditional CROSS JOIN table met 1224 1219 2429 2101 51 --===== Itzik's CROSS JOINED CTE method 1448 1328 1217 2095 51 --===== Housekeeping DROP TABLE #Tally 8 0 415 0 ``` As you can see, **the Recursive CTE method is the second worst only to the While Loop for Duration and CPU and has 8 times the memory pressure
[ 0.07341274619102478, 0.20348937809467316, 0.16454678773880005, -0.015490376390516758, 0.17364326119422913, 0.13329286873340607, 0.6879910230636597, -0.5353178381919861, -0.25399771332740784, -0.43215805292129517, -0.3160773813724518, 0.09280358999967575, -0.2509201467037201, 0.061334684491...
in the form of logical reads than the While Loop**. It's RBAR on steroids and should be avoided, at all cost, for any single row calculations just as a While Loop should be avoided. **There are places where recursion is quite valuable but this ISN'T one of them**. As a side bar, Mr. Denny is absolutely spot on... a correctly sized permanent Numbers or Tally table is the way to go for most things. What does correctly sized mean? Well, most people use a Tally table to generate dates or to do splits on VARCHAR(8000). If you create an 11,000 row
[ 0.4147249758243561, 0.36133939027786255, 0.03581567853689194, 0.30066540837287903, 0.12414222955703735, -0.2511891722679138, -0.032133933156728745, 0.25516191124916077, -0.598584771156311, -0.1036955863237381, -0.0011916282819584012, -0.06883663684129715, 0.11756259202957153, 0.19234688580...
Tally table with the correct clustered index on "N", you'll have enough rows to create more than 30 years worth of dates (I work with mortgages a fair bit so 30 years is a key number for me) and certainly enough to handle a VARCHAR(8000) split. Why is "right sizing" so important? If the Tally table is used a lot, it easily fits in cache which makes it blazingly fast without much pressure on memory at all. Last but not least, every one knows that if you create a permanent Tally table, it doesn't much matter which method you use to
[ 0.30818212032318115, 0.3438287079334259, 0.6505193114280701, 0.17941465973854065, 0.23730412125587463, -0.03222418949007988, -0.1779700666666031, -0.039440255612134933, -0.3986448049545288, -0.6379120945930481, 0.1491549164056778, 0.08643916994333267, 0.49362531304359436, 0.178442090749740...
build it because 1) it's only going to be made once and 2) if it's something like an 11,000 row table, all of the methods are going to run "good enough". **So why all the indigination on my part about which method to use???** The answer is that some poor guy/gal who doesn't know any better and just needs to get his or her job done might see something like the Recursive CTE method and decide to use it for something much larger and much more frequently used than building a permanent Tally table and I'm trying to **protect those people,
[ 0.8155227899551392, 0.4143878221511841, 0.1783355325460434, 0.11385713517665863, 0.33204805850982666, 0.13096190989017487, 0.30114006996154785, 0.09599655866622925, -0.281136691570282, -0.599494457244873, 0.08297743648290634, 0.1935407966375351, 0.1116553246974945, 0.017444122582674026, ...
the servers their code runs on, and the company that owns the data on those servers**. Yeah... it's that big a deal. It should be for everyone else, as well. Teach the right way to do things instead of "good enough". Do some testing before posting or using something from a post or book... the life you save may, in fact, be your own especially if you think a recursive CTE is the way to go for something like this. ;-) Thanks for listening...
[ 0.77154541015625, 0.07162849605083466, -0.08733539283275604, 0.5616655349731445, 0.18380963802337646, -0.17882797122001648, 0.3178229033946991, 0.3843885660171509, 0.025239817798137665, -0.38257336616516113, -0.123536616563797, 0.4609902799129486, 0.003653241554275155, -0.44742968678474426...
In SQL Server I have a `DATETIME` column which includes a time element. Example: ``` '14 AUG 2008 14:23:019' ``` What is the **best** method to only select the records for a particular day, ignoring the time part? Example: (Not safe, as it does not match the time part and returns no rows) ``` DECLARE @p_date DATETIME SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 ) SELECT * FROM table1 WHERE column_datetime = @p_date ``` *Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question
[ -0.18336355686187744, 0.23641331493854523, 0.5185559988021851, -0.07330622524023056, -0.03766335919499397, -0.28231626749038696, 0.01782512292265892, -0.13324061036109924, -0.08668335527181625, -0.47868919372558594, 0.1142619326710701, 0.1844700127840042, -0.31337156891822815, 0.0022868332...
as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.* --- **Update** Clarified example to be more specific. --- **Edit** Sorry, But I've had to down-mod WRONG answers (answers that return wrong results). @Jorrit: `WHERE (date>'20080813' AND date<'20080815')` will return the 13th and the 14th. @wearejimbo: *Close, but no cigar!* badge awarded to you. You missed out records written at 14/08/2008 23:59:001 to 23:59:999 (i.e. Less than 1 second before midnight.) Technique 1: ``` DECLARE @p_date DATETIME SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 ) SELECT * FROM table1 WHERE column_datetime >=
[ -0.0898095890879631, 0.11489458382129669, 0.7573239803314209, -0.23211030662059784, 0.052248790860176086, -0.07718349248170853, 0.27668866515159607, -0.17503862082958221, -0.3682103157043457, -0.39208418130874634, 0.06667204201221466, 0.5414322018623352, 0.010354557074606419, -0.0250435564...
@p_date AND column_datetime < DATEADD(d, 1, @p_date) ``` The advantage of this is that it will use any index on 'column\_datetime' if it exists.
[ -0.1981811374425888, -0.2100677639245987, 0.5220267176628113, -0.26116836071014404, 0.08124402910470963, -0.025990881025791168, -0.3487580120563507, 0.11708919703960419, -0.17278392612934113, -0.6853000521659851, -0.12660960853099823, 0.44225287437438965, -0.21227659285068512, 0.0379652604...
I'm looking for a good article on using emacs as C/C++ IDE. Something like Steve Yegge's ["Effective emacs"](http://steve.yegge.googlepages.com/effective-emacs). No specific article, really, but I've found [EmacsWiki](http://www.emacswiki.org/cgi-bin/wiki) to be full of useful information. Consider checking out these entries: * [CPlusPlus](http://www.emacswiki.org/cgi-bin/wiki/CPlusPlus) as a starting point for many C++-related articles, and * [CppTemplate](http://www.emacswiki.org/cgi-bin/wiki/CppTemplate) to define a template that can give you a good skeleton when you start new files
[ 0.3646920919418335, 0.448647141456604, 0.1045803427696228, 0.2961617410182953, -0.15182222425937653, -0.0402454249560833, -0.03739197924733162, 0.18254397809505463, -0.5688176155090332, -0.2657015025615692, -0.11504801362752914, 0.16917061805725098, -0.28594791889190674, 0.1618761569261551...
I have a **DLL** with some **COM objects**. Sometimes, this objects **crashes** and register an error event in the Windows Event Log with lots of hexadecimal informations. I have no clue why this crashes happens. So, How can I trace those COM objects exceptions? The first step is to lookup the Fail code's hex value (E.G. E\_FAIL 0x80004005). I've had really good luck with posting that value in Google to get a sense of what the error code means. Then, I just use trial and error to try to isolate the location in code that's failing, and the root cause of
[ 0.23968662321567535, 0.42277681827545166, -0.03949166461825371, 0.23999552428722382, 0.09469255805015564, -0.028769029304385185, 0.665104329586029, 0.2766548991203308, -0.12030767649412155, -0.7389537692070007, -0.09141355752944946, 0.5163744688034058, -0.12219120562076569, 0.2856010496616...
the failure.
[ -0.16649867594242096, 0.20110735297203064, -0.032005757093429565, 0.15002620220184326, -0.2309536635875702, 0.22338220477104187, 0.016116676852107048, 0.03975299745798111, 0.06027333810925484, -0.32764965295791626, -0.03170360252261162, 0.31821346282958984, -0.12763501703739166, 0.30020630...
I have been looking into IKVMing Apache's FOP project to use with our .NET app. It's a commercial product, and looking into licensing, IKVM runs into some sticky areas because of its use of GNU Classpath. From what I've seen, no one can say for sure if this stuff can be used in a commercial product. Has anyone used IKVM, or an IKVM'd product, in a commercial product? Here's what I've found so far: [IKVM license page](https://web.archive.org/web/20040202014857/http://weblog.ikvm.net:80/story.aspx/license), which notes that one dll contains code from other projects, their license [GPLv2 + Classpath Exception](https://openjdk.java.net/legal/gplv2+ce.html) [Saxon for .NET](http://saxon.sourceforge.net/) is generated with IKVM, but released
[ 0.4331386387348175, -0.12310154736042023, -0.0015669659478589892, 0.2490532398223877, -0.293592631816864, -0.4648645520210266, 0.0791378766298294, -0.22263246774673462, 0.05308413878083229, -0.03815454989671707, -0.02583192102611065, 0.12928935885429382, -0.3158501982688904, 0.093933269381...
under the Apache license... Anyone have experience with this? There are multiple issues here as ikvm is currently being transitioned away from the GNU classpath system to Sun's OpenJDK. Both are licensed as GPL+Exceptions to state explicitly that applications which merely use the OpenJDK libraries will not be considered derived works. Generally speaking, applications which rely upon components with defined specs such as this do not fall under the GPL anyway. For example, linking against public POSIX APIs does not trigger GPL reliance in a Linux application, despite the kernel being GPL. A similar principal will usually (the details can be tricky) apply
[ 0.3152593672275543, 0.18545208871364594, 0.2068663388490677, 0.08547430485486984, -0.30696824193000793, -0.8828508257865906, 0.21617715060710907, -0.29722917079925537, -0.1809941828250885, -0.29737985134124756, 0.012914679944515228, 0.29424843192100525, -0.3990582823753357, 0.3020456433296...
to replacing Sun's Java with a FOSS/GPL implementation.
[ -0.17044228315353394, -0.04167091101408005, 0.0901753306388855, -0.13047532737255096, -0.20465892553329468, -0.14820313453674316, -0.04229256510734558, -0.10401876270771027, -0.1706007719039917, -0.46469417214393616, -0.21784467995166779, 0.3219932019710541, -0.41190391778945923, -0.144611...
Does anyone know how I can, in platform-independent C++ code prevent an object from being created on the heap? That is, for a class "Foo", I want to prevent users from doing this: ``` Foo *ptr = new Foo; ``` and only allow them to do this: ``` Foo myfooObject; ``` Does anyone have any ideas? Cheers, [Nick's answer](https://stackoverflow.com/questions/10985/how-to-prevent-an-object-being-created-on-the-heap#11003) is a good starting point, but incomplete, as you actually need to overload: ``` private: void* operator new(size_t); // standard new void* operator new(size_t, void*); // placement new void* operator new[](size_t);
[ 0.45270559191703796, 0.34200435876846313, 0.15971040725708008, 0.06959928572177887, 0.20035883784294128, -0.24169699847698212, 0.4528336226940155, -0.02859799563884735, -0.28051134943962097, -0.40640774369239807, -0.27779027819633484, 0.6131674647331238, -0.014476754702627659, 0.1902234107...
// array new void* operator new[](size_t, void*); // placement array new ``` (Good coding practice would suggest you should also overload the delete and delete[] operators -- I would, but since they're not going to get called it isn't *really* necessary.) [Pauldoo](https://stackoverflow.com/questions/10985/how-to-prevent-an-object-being-created-on-the-heap#11018) is also correct that this doesn't survive aggregating on Foo, although it does survive inheriting from Foo. You could do some template meta-programming magic to HELP prevent this, but it would not be immune to "evil users" and thus is probably not worth the complication. Documentation of how it should be used,
[ 0.3358203172683716, 0.22287090122699738, -0.016760755330324173, -0.20018792152404785, 0.05237496271729469, -0.29860439896583557, 0.6546990275382996, -0.3710116446018219, -0.43325260281562805, -0.4247649312019348, -0.12336210906505585, 0.4947776794433594, -0.2735367715358734, 0.145657911896...
and code review to ensure it is used properly, are the only ~100% way.
[ 0.2838657796382904, 0.35416674613952637, 0.3671327829360962, 0.1099151000380516, 0.247450590133667, -0.16747277975082397, 0.3579825758934021, -0.10128429532051086, 0.262703001499176, -0.5922108292579651, -0.5409871339797974, 0.6986764669418335, 0.24795813858509064, -0.5697579383850098, -...
In Perl, an object is just a reference to any of the basic Perl data types that has been blessed into a particular class. When you use the ref() function on an unblessed reference, you are told what data type the reference points to. However, when you call ref() on a blessed reference, you are returned the name of the package that reference has been blessed into. I want to know the actual underlying type of the blessed reference. How can I determine this? `Scalar::Util::reftype()` is the cleanest solution. The [`Scalar::Util`](http://search.cpan.org/dist/Scalar-List-Utils/lib/Scalar/Util.pm) module was added to the Perl core in version 5.7
[ 0.10031778365373611, 0.022617928683757782, 0.6986898183822632, -0.05059808865189552, -0.4921797811985016, 0.06868943572044373, 0.3565801680088043, -0.04328783601522446, -0.2513800859451294, -0.20150704681873322, -0.3405589461326599, 0.47262006998062134, -0.3560203015804291, 0.1330960988998...
but is available for older versions (5.004 or later) from CPAN. You can also probe with `UNIVERSAL::isa()`: ``` $x->isa('HASH') # if $x is known to be an object UNIVERSAL::isa($x, 'HASH') # if $x might not be an object or reference ``` Obviously, you'd also have to check for `ARRAY` and `SCALAR` types. The UNIVERSAL module (which serves as the base class for all objects) has been part of the core since Perl 5.003. Another way -- easy but a little dirty -- is to stringify the reference. Assuming that the class hasn't overloaded stringification
[ 0.25266316533088684, -0.06456790119409561, 0.714895486831665, -0.16834382712841034, 0.16095221042633057, -0.276539146900177, 0.12257690727710724, -0.041417915374040604, -0.1772235929965973, -0.22282785177230835, -0.174440398812294, 0.7642734050750732, -0.5201811790466309, 0.240149825811386...
you'll get back something resembling `Class=HASH(0x1234ABCD)`, which you can parse to extract the underlying data type: ``` my $type = ($object =~ /=(.+)\(0x[0-9a-f]+\)$/i); ```
[ -0.015178336761891842, 0.14519064128398895, 0.552075207233429, 0.03580067679286003, 0.30094173550605774, -0.0207002405077219, 0.2147659957408905, 0.12822937965393066, -0.05273984372615814, -0.7040155529975891, -0.37257853150367737, 0.5735030770301819, 0.09135526418685913, 0.178916573524475...
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my own "Cache", because I didn't know any better, it looked a bit like this: ``` public class DataManager { private static DataManager s_instance; public static DataManager GetInstance() { } private Data[] m_myData; private DataTime m_cacheTime; public Data[] GetData() {
[ 0.052558355033397675, -0.103255994617939, 0.12541761994361877, 0.04737197607755661, -0.06660391390323639, -0.03624619171023369, 0.24814550578594208, -0.03158973529934883, -0.36988574266433716, -0.7762886881828308, -0.20547842979431152, 0.3674388527870178, -0.5249469876289368, 0.47481846809...
TimeSpan span = DateTime.Now.Substract(m_cacheTime); if(span.TotalSeconds > 10) { // Do SQL to get data m_myData = data; m_cacheTime = DateTime.Now;
[ 0.15518328547477722, -0.3827379643917084, 0.5604819059371948, -0.27139079570770264, 0.3615269064903259, 0.02572270855307579, 0.08738292008638382, -0.2037927508354187, -0.5795888900756836, -0.4504627585411072, -0.1712825745344162, 0.16472257673740387, -0.06522759050130844, -0.05279417335987...
return m_myData; } else { return m_myData; } } } ``` So the values are stored for a while in a singleton,
[ -0.268671452999115, 0.023085661232471466, 0.14500603079795837, -0.21306920051574707, 0.35029137134552, -0.11139604449272156, 0.16911402344703674, 0.20773321390151978, -0.07182353734970093, -0.3569367229938507, -0.2991003394126892, 0.5725930333137512, -0.1578422486782074, 0.3072068393230438...
and when the time expires, the values are renewed. If time has not expired, and a request for the data is done, the stored values in the field are returned. What are the benefits over using the real method (<http://msdn.microsoft.com/en-us/library/aa478965.aspx>) instead of this? I think the maxim "let the computer do it; it's smarter than you" applies here. Just like memory management and other complicated things, the computer is a lot more informed about what it's doing than your are; consequently, able to get more performance than you are. Microsoft has had a team of engineers working on it and they've probably managed
[ 0.2901783287525177, -0.01397691946476698, 0.07286138832569122, 0.5062176585197449, 0.43902310729026794, -0.339973509311676, -0.030167747288942337, 0.061691004782915115, -0.3528260886669159, -0.5104885101318359, -0.04880795627832413, 0.8546756505966187, 0.22866931557655334, -0.1610331088304...
to squeeze much more performance out of the system than would be possible for you to. It's also likely that ASP.NET's built-in caching operates at a different level (which is inaccessible to your application), making it much faster.
[ 0.23522372543811798, -0.19306814670562744, 0.06967221945524216, 0.10651795566082001, 0.07665427774190903, -0.19636858999729156, 0.23910890519618988, -0.1056031733751297, -0.3030341565608978, -0.7389221787452698, -0.21105292439460754, 0.3041622042655945, -0.220882847905159, -0.1616305559873...
I'd like to start moving our application business layers into a collection of REST web services. However, most of our Intranet has been built using Classic ASP and most of the developers where I work keep programming in Classic ASP. Ideally, then, for them to benefit from the advantages of a unique set of web APIs, it would have to be called from Classic ASP pages. I haven't the slightest idea how to do that. You could use a combination of JQuery with JSON calls to consume REST services from the client or if you need to interact with the REST services from the
[ 0.40373608469963074, 0.003997269552201033, -0.006692171562463045, 0.015198932029306889, 0.003949833568185568, 0.030074894428253174, 0.013817034661769867, 0.10887861996889114, -0.1875990778207779, -0.5942210555076599, -0.18687628209590912, 0.8145766854286194, -0.09122670441865921, -0.013089...
ASP layer you can use MSXML2.ServerXMLHTTP like: ``` Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP") HttpReq.open "GET", "Rest_URI", False HttpReq.send ```
[ 0.06444758921861649, -0.4048730432987213, 0.6100826859474182, 0.11783316731452942, -0.3866839110851288, -0.2244265228509903, 0.20116887986660004, -0.0836525484919548, -0.3454853594303131, -0.7514491081237793, -0.3125167489051819, 0.31953713297843933, -0.30454301834106445, -0.10365705937147...
Anyone know how to do this without using a third party program? If there no way to do it with a add-on someone can recommend one? EDIT: I need to add this in the server so all users have the same signature. Thanks You need to create your own exchange message sink to do this. Here's a classic VB example from MS KB: <http://support.microsoft.com/kb/317327> and a VB Script one: <http://support.microsoft.com/kb/317680> And lots of goodness from MSDN about Exchange 2003 Transport Event Sinks: <http://msdn.microsoft.com/en-us/library/ms526223(EXCHG.10).aspx> If you're running Exchange 2007 then you can use Transport Rules: <http://msexchangeteam.com/archive/2006/12/12/431879.aspx> <http://www.msexchange.org/tutorials/Using-Transport-Rules-Creating-Disclaimers-Exchange-Server-2007.html>
[ 0.21096131205558777, 0.17468880116939545, 0.28289926052093506, 0.18616324663162231, -0.36998122930526733, -0.21638570725917816, 0.13254962861537933, -0.19517892599105835, -0.36267194151878357, -0.7388442158699036, 0.4995840787887573, 0.35840970277786255, -0.27941370010375977, 0.02950754575...
I have a small VB.NET application that I'm working on using the full version of Visual Studio 2005. In the **Publish** properties of the project, I have it set to *Automatically increment revision with each publish*. The issue is that it's only incrementing the revision in the Setup files. It doesn't seem to be updating the version number in the About Box (which is the generic, built-in, About Box template). That version number seems to be coming from *My.Application.Info.Version*. What should I be using instead so that my automatically incrementing revision number shows up in the about box? Change the code for the
[ 0.45990559458732605, 0.11341191828250885, 0.5633953213691711, -0.1633671373128891, -0.1330212503671646, -0.3426222503185272, 0.23731769621372223, -0.09627028554677963, -0.20329482853412628, -0.6837269067764282, 0.16869470477104187, 0.6567739248275757, -0.1822870671749115, 0.103123813867568...
About box to ``` Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Deployment.CurrentVersion.ToString) ``` Please note that all the other answers are correct for "how do I get my assembly version", not the stated question "how do I show my publish version".
[ 0.2985076308250427, 0.15369991958141327, 0.43108534812927246, -0.07500309497117996, 0.1622854620218277, -0.37484118342399597, 0.012836710549890995, -0.12266282737255096, -0.13376975059509277, -0.28548526763916016, -0.35095253586769104, 0.3298502564430237, -0.4094250798225403, 0.07114412635...
I work in VBA, and want to parse a string eg ``` <PointN xsi:type='typens:PointN' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <X>24.365</X> <Y>78.63</Y> </PointN> ``` and get the X & Y values into two separate integer variables. I'm a newbie when it comes to XML, since I'm stuck in VB6 and VBA, because of the field I work in. How do I do this? This is a bit of a complicated question, but it seems like the most direct route would be to load the XML document or XML string via MSXML2.DOMDocument which will then allow you to access the XML nodes. You can find more on MSXML2.DOMDocument
[ 0.3496319353580475, 0.4146159589290619, 0.3672735393047333, -0.20870113372802734, -0.3272094130516052, -0.09309396147727966, 0.2325640320777893, -0.27780166268348694, -0.24184873700141907, -0.4564502239227295, 0.22270067036151886, 0.35530757904052734, -0.15377521514892578, 0.30183437466621...
at the following sites: * [Manipulating XML files with Excel VBA & Xpath](https://web.archive.org/web/20161217090033/http://en.allexperts.com/q/XML-1469/Manipulating-XML-files-Excel.htm) * MSXML - <http://msdn.microsoft.com/en-us/library/ms763742(VS.85).aspx> * [An Overview of MSXML 4.0](https://web.archive.org/web/20161030020427/http://www.xml.com:80/lpt/a/979)
[ -0.06913155317306519, 0.06924435496330261, 0.3972392678260803, -0.014510609209537506, -0.15162675082683563, 0.2560666799545288, 0.025711411610245705, -0.14062482118606567, -0.5020145773887634, -0.36028963327407837, -0.4238034188747406, 0.4011390805244446, -0.18929974734783173, -0.026693025...
Does SQL Server 2008 ship with the .NET 3.5 CLR, so that stored procedures written in CLR can use 3.5 features? Actually it ships with .NET 3.5 SP1. So yes, the stored procs can use 3.5 features and libraries.
[ -0.29772767424583435, 0.23609362542629242, 0.6577544212341309, 0.1712084859609604, -0.25301480293273926, -0.2892850637435913, 0.13818129897117615, 0.10843665897846222, -0.13541661202907562, 0.1370038390159607, 0.24335670471191406, 0.469478964805603, -0.18825243413448334, -0.027740322053432...
I have created a custom dialog for Visual Studio Setup Project using the steps described [here](http://www.codeproject.com/KB/install/vsSetupCustomDialogs.aspx?fid=419622&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2640482&fr=26) Now I have a combobox in one of my dialogs. I want to populate the combobox with a list of all SQL Server instances running on the local network. It's trivial to get the server list ... but I'm completely lost on how to make them display in the combobox. I would appreciate your help and some code might also be nice as I'm beginner :). I've always found the custom dialogs in visual studio setup projects to be woefully limited and barely functional. By contrast, I normally
[ 0.4869561195373535, 0.1411992907524109, 0.23121057450771332, -0.03707107901573181, -0.011480257846415043, 0.19976477324962616, 0.23789454996585846, -0.154750794172287, -0.2061176896095276, -0.8779301047325134, 0.01650824584066868, 0.5443599224090576, -0.19556815922260284, -0.06537783145904...
create custom actions that display winforms gui's for any remotely difficult tasks during setup. Works really well and you can do just about anything you want by creating a custom action and passing a few parameters across. In the dayjob we built a collection of common custom actions for tasks like application config and database creation / script execution to get around custom dialog limitations.
[ 0.646390974521637, -0.5620763897895813, 0.03395402431488037, 0.2563113272190094, -0.18417395651340485, 0.022256845608353615, 0.12023090571165085, -0.16670003533363342, -0.16002772748470306, -0.6434392929077148, 0.30371707677841187, 0.751666247844696, -0.309297114610672, -0.3121525049209595...
Ok, I've seen a few posts that *mention* a few other posts about not using SP wikis because they suck. Since we are looking at doing our wiki *in* SP, I need to know why we shouldn't do it for a group of 6 automation-developers to document the steps in various automated processes and the changes that have to be made from time to time. Before the rant, here is my overall experience with SharePoint as a wiki. It is a poorly implemented feature that failed becouse there was a fundemental lack of investigation into what current wiki environments provide. That is
[ 0.6023817658424377, -0.0024709233548492193, 0.06911677122116089, 0.18565864861011505, -0.09484801441431046, -0.22676420211791992, 0.2866227328777313, -0.04682710021734238, -0.19525225460529327, -0.48211827874183655, 0.46488505601882935, 0.4690651595592499, -0.05438472330570221, 0.085265479...
why it failed in it's editor and why it misses on points like: tagging, history comparison, and poorly generated html code. You need to skip it and get something else that does the job better and link to it from SharePoint. Having **production** experience with both products, I'd recommend ScrewTurn over SharePoint. *see edit history for rant*
[ 0.4198991358280182, 0.08135774731636047, 0.1079317256808281, 0.23755384981632233, -0.2129490226507187, -0.06567121297121048, 0.42338764667510986, 0.2632632851600647, 0.027177808806300163, -0.4259377121925354, -0.006409627851098776, 0.4168981909751892, -0.21530260145664215, 0.14040613174438...
I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages. What I would like to do is make my application as compact and speedy as possible when I deliver it. One idea is to set expiration dates for all of the site's static resources so they aren't recalled on page loads. By resources I mean images, linked style
[ 0.40545541048049927, 0.21711689233779907, 0.38873690366744995, -0.11452701687812805, -0.11761558055877686, -0.35040944814682007, 0.2526577413082123, 0.28743383288383484, -0.2725341022014618, -0.9366016387939453, -0.043141499161720276, 0.3716048300266266, -0.023543894290924072, 0.1804893761...
sheets and JavaScript source files. Is there an easy way to do this? What other ways are there to optimize a .Net web site? UPDATE: I've run YSlow on the site and the areas where I am getting hit the hardest are in the number of JavaScript and Style Sheets being loaded (23 JS files and 5 style sheets). All but one (the main style sheet) has been inserted by Ajax.net and Asp. Why so many? 1. [Script Combining in .net 3.5 SP1](http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx) 2. [Best Practices for fast websites](http://developer.yahoo.com/performance/rules.html) 3. HTTP Compression (gzip) 4. Compress JS / CSS (different than http compression, minify javascript) 1. [YUI Compressor](http://developer.yahoo.com/yui/compressor/) 2.
[ 0.4367586672306061, 0.03708311915397644, 0.5116612315177917, 0.0856112390756607, -0.5875561833381653, -0.05485482141375542, 0.0937381237745285, -0.4077203571796417, 0.00827103853225708, -0.7562114596366882, -0.1539938747882843, 0.4248461425304413, -0.15730105340480804, -0.42454496026039124...
[.NET YUI Compressor](http://www.codeplex.com/YUICompressor) My best advice is to check out the [YUI content](http://developer.yahoo.com/YUI). They have some great articles that talk about things like [CSS sprites](http://www.alistapart.com/articles/sprites/) and have some [nice javascript libraries to help reduce the number of requests](http://developer.yahoo.com/yui/imageloader/) the browser is making.
[ 0.6239196062088013, 0.12121628224849701, 0.16192574799060822, 0.16213490068912506, -0.7418081164360046, -0.1275142878293991, 0.24224741756916046, 0.2823391556739807, -0.1063273698091507, -0.7453147172927856, -0.1448957771062851, 0.3480593264102936, -0.035961586982011795, 0.1071911528706550...
How can I find any unused functions in a PHP project? Are there features or APIs built into PHP that will allow me to analyse my codebase - for example [Reflection](http://ie.php.net/manual/en/language.oop5.reflection.php), [`token_get_all()`](http://php.net/manual/en/function.token-get-all.php)? Are these APIs feature rich enough for me not to have to rely on a third party tool to perform this type of analysis? Thanks Greg and Dave for the feedback. Wasn't quite what I was looking for, but I decided to put a bit of time into researching it and came up with this quick and dirty solution: ``` <?php $functions = array(); $path = "/path/to/my/php/project";
[ 0.3403377830982208, 0.10912071913480759, 0.007100145798176527, 0.11372100561857224, -0.148437961935997, -0.03525032103061676, 0.3847036361694336, -0.12075426429510117, -0.2575714886188507, -0.5653297901153564, 0.11829791218042374, 0.47442397475242615, -0.03386281430721283, -0.1713373512029...
define_dir($path, $functions); reference_dir($path, $functions); echo "<table>" . "<tr>" . "<th>Name</th>" . "<th>Defined</th>" . "<th>Referenced</th>" . "</tr>";
[ -0.02727205492556095, -0.19110755622386932, 0.24799828231334686, -0.3576003313064575, 0.12235932797193527, 0.18586166203022003, 0.021851899102330208, -0.5205819606781006, 0.1396419107913971, -0.45228782296180725, -0.2354278266429901, 0.715124785900116, -0.5800250172615051, 0.07447136938571...
foreach ($functions as $name => $value) { echo "<tr>" . "<td>" . htmlentities($name) . "</td>" . "<td>" . (isset($value[0]) ? count($value[0]) : "-") . "</td>" . "<td>" . (isset($value[1]) ? count($value[1]) : "-") .
[ -0.08518996834754944, 0.38457629084587097, 0.37541669607162476, -0.5696312189102173, 0.048028841614723206, 0.5749720931053162, 0.2974244952201843, -0.739014208316803, 0.19788213074207306, -0.3684208393096924, -0.5596556663513184, 0.367851585149765, -0.40432852506637573, -0.0045744753442704...
"</td>" . "</tr>"; } echo "</table>"; function define_dir($path, &$functions) { if ($dir = opendir($path)) { while (($file = readdir($dir)) !== false) { if (substr($file, 0, 1) == ".") continue; if (is_dir($path .
[ 0.06877367943525314, -0.3247770071029663, 0.4219685196876526, -0.6124391555786133, 0.28589704632759094, -0.036123983561992645, 0.5604932308197021, -0.8047086000442505, 0.0814213678240776, -0.22584812343120575, -0.28626883029937744, 0.7298896312713623, -0.3073660433292389, 0.221684232354164...
"/" . $file)) { define_dir($path . "/" . $file, $functions); } else { if (substr($file, - 4, 4) != ".php") continue; define_file($path . "/" . $file, $functions);
[ -0.14922116696834564, -0.33213669061660767, 0.6030604243278503, -0.5803400278091431, 0.2054050862789154, 0.023005416616797447, 0.43928688764572144, -0.5514572262763977, 0.3293302655220032, -0.4145548939704895, -0.2056206464767456, 0.94489985704422, -0.27854689955711365, 0.1312098205089569,...
} } } } function define_file($path, &$functions) { $tokens = token_get_all(file_get_contents($path)); for ($i = 0; $i < count($tokens); $i++) { $token = $tokens[$i];
[ -0.14458145201206207, -0.386429101228714, 0.04288544878363609, -0.23751704394817352, 0.14497344195842743, 0.04937203973531723, 0.2963455021381378, -0.44258302450180054, -0.15869036316871643, -0.5722574591636658, -0.45457831025123596, 0.27438199520111084, -0.4745570421218872, 0.172775462269...
if (is_array($token)) { if ($token[0] != T_FUNCTION) continue; $i++; $token = $tokens[$i]; if ($token[0] != T_WHITESPACE) die("T_WHITESPACE"); $i++;
[ 0.020860174670815468, -0.37275344133377075, 0.19325095415115356, -0.5174978375434875, 0.32998573780059814, 0.16294166445732117, 0.3942639231681824, -0.4099859297275543, -0.2700662910938263, -0.4013400971889496, -0.7288012504577637, 0.1457948237657547, -0.3009735643863678, 0.381160825490951...
$token = $tokens[$i]; if ($token[0] != T_STRING) die("T_STRING"); $functions[$token[1]][0][] = array($path, $token[2]); } } } function reference_dir($path, &$functions) { if ($dir = opendir($path)) {
[ -0.17136408388614655, -0.15188097953796387, 0.14560921490192413, -0.29900896549224854, -0.0923537090420723, 0.26643937826156616, 0.2002258151769638, -0.6203696727752686, -0.10628945380449295, -0.3851068913936615, -0.1370445042848587, 0.42604702711105347, -0.39861249923706055, 0.40120765566...
while (($file = readdir($dir)) !== false) { if (substr($file, 0, 1) == ".") continue; if (is_dir($path . "/" . $file)) { reference_dir($path . "/" . $file, $functions); }
[ -0.09773377329111099, -0.2036404311656952, 0.6343037486076355, -0.33523839712142944, 0.515626847743988, 0.029365630820393562, 0.3845093548297882, -0.376750648021698, 0.007638478651642799, -0.2620367407798767, -0.2858397364616394, 0.8623567223548889, -0.31495869159698486, 0.3497650027275085...
else { if (substr($file, - 4, 4) != ".php") continue; reference_file($path . "/" . $file, $functions); } } }
[ 0.05704857409000397, -0.12081313133239746, 0.6861934661865234, -0.11758590489625931, 0.44953519105911255, 0.018556876108050346, 0.40696170926094055, -0.273876428604126, -0.07026546448469162, -0.33696386218070984, -0.21968267858028412, 0.7424209117889404, -0.11128179728984833, 0.21976105868...
} function reference_file($path, &$functions) { $tokens = token_get_all(file_get_contents($path)); for ($i = 0; $i < count($tokens); $i++) { $token = $tokens[$i]; if (is_array($token)) { if ($token[0] != T_STRING) continue; if ($tokens[$i +
[ -0.032892417162656784, -0.3437039852142334, 0.37952321767807007, -0.14993785321712494, 0.2516535520553589, 0.08555284142494202, 0.3604939579963684, -0.4637854993343353, -0.36203697323799133, -0.47584468126296997, -0.5060997009277344, 0.39294174313545227, -0.4684772491455078, 0.268066227436...
1] != "(") continue; $functions[$token[1]][1][] = array($path, $token[2]); } } } ?> ``` I'll probably spend some more time on it so I can quickly find the files and line numbers of the function definitions and references; this information is being gathered, just not displayed.
[ 0.12798739969730377, -0.09904923290014267, 0.25835031270980835, -0.20307894051074982, 0.04261612147092819, -0.30503135919570923, 0.37212926149368286, -0.4320019781589508, -0.18797145783901215, -0.5773504376411438, -0.2654331922531128, 0.5686358213424683, -0.3903183341026306, -0.00389217655...
I've used Apache CXF to expose about ten java classes as web services. I've generated clients using CXF, Axis, and .NET. In Axis and CXF a "Service" or "Locator" is generated. From this service you can get a "Port". The "Port" is used to make individual calls to the methods exposed by the web service. In .NET the "Service" directly exposes the calls to the web service. Can someone explain the difference between a port, a service, a locator, and an endpoint when it comes to web services? Axis: ``` PatientServiceImplServiceLocator locator = new PatientServiceImplServiceLocator(); PatientService service = locator.getPatientServiceImplPort(); ``` CXF: ``` PatientServiceImplService locator = new PatientServiceImplService(); PatientService service =
[ 0.25694793462753296, 0.23144938051700592, 0.6607590913772583, -0.17487384378910065, -0.02643946371972561, 0.3633502423763275, 0.2249794900417328, -0.28311124444007874, -0.1061679944396019, -0.8730881810188293, 0.07351238280534744, 0.44195666909217834, -0.3044149577617645, 0.399899214506149...