text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
type Foo to the list, the list of strings is no longer consistent. If you were to iterate the first reference, you would get a class cast exception because once you hit the Foo instance, the Foo could not be converted to string! As a side note, I think it would be more significant whether or not you can do the reverse cast: ``` List<object> ol = new List<object>(); List<string> sl; sl = (List<string>)ol; ``` I haven't used C# in a while, so I don't know if that is legal, but that sort of cast is actually (potentially) useful. In this case, you are going from a
[ 0.23420816659927368, -0.038081713020801544, 0.43237391114234924, -0.42694079875946045, -0.19100932776927948, -0.18852777779102325, 0.19297482073307037, -0.10076155513525009, -0.03038039803504944, -0.2939464747905731, 0.18002092838287354, 0.6386038661003113, -0.5560191869735718, 0.142519712...
more general class (object) to a more specific class (string) that extends from the general one. In this way, if you add to the list of strings, you are not violating the list of objects. Does anybody know or can test if such a cast is legal in C#?
[ 0.5817739963531494, -0.07499364018440247, -0.1278521567583084, 0.09805848449468613, -0.048564210534095764, -0.4910222291946411, 0.1927272230386734, -0.04354643076658249, -0.24360516667366028, -0.32458508014678955, -0.18998092412948608, 0.5509898662567139, -0.4061625003814697, 0.09952937811...
I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's `malloc` and `free` concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. How do `release`, `retain` and `autorelease` work and what are the conventions about their use? (Or failing that, what did you read which helped you get it?) Let's start with `retain` and `release`; `autorelease` is really just a special case once you understand the basic concepts. In Cocoa,
[ 0.2854914367198944, 0.16673439741134644, 0.19402527809143066, -0.09957358241081238, -0.1668364405632019, -0.2772899568080902, -0.1089487373828888, 0.06784772872924805, -0.30883970856666565, -0.3073144257068634, -0.0933152288198471, 0.9453653693199158, -0.1775294691324234, -0.24134792387485...
each object keeps track of how many times it is being referenced (specifically, the `NSObject` base class implements this). By calling `retain` on an object, you are telling it that you want to up its reference count by one. By calling `release`, you tell the object you are letting go of it, and its reference count is decremented. If, after calling `release`, the reference count is now zero, then that object's memory is freed by the system. The basic way this differs from `malloc` and `free` is that any given object doesn't need to worry about other parts of the system
[ 0.32320791482925415, -0.08075372874736786, 0.46949854493141174, 0.08925418555736542, 0.34480103850364685, -0.10326308012008667, 0.17357845604419708, -0.028614113107323647, -0.4892752766609192, -0.29455676674842834, -0.3125130236148834, 0.6689907312393188, -0.2567245364189148, 0.29049023985...
crashing because you've freed memory they were using. Assuming everyone is playing along and retaining/releasing according to the rules, when one piece of code retains and then releases the object, any other piece of code also referencing the object will be unaffected. What can sometimes be confusing is knowing the circumstances under which you should call `retain` and `release`. My general rule of thumb is that if I want to hang on to an object for some length of time (if it's a member variable in a class, for instance), then I need to make sure the object's reference count knows
[ 0.19088126718997955, -0.20777346193790436, 0.043429724872112274, 0.3195790946483612, 0.08597231656312943, -0.3057539165019989, 0.1472705900669098, 0.3184044659137726, -0.6162320971488953, -0.16430166363716125, -0.37258782982826233, 0.3518584370613098, -0.0019408130319789052, 0.353050351142...
about me. As described above, an object's reference count is incremented by calling `retain`. By convention, it is also incremented (set to 1, really) when the object is created with an "init" method. In either of these cases, it is my responsibility to call `release` on the object when I'm done with it. If I don't, there will be a memory leak. Example of object creation: ``` NSString* s = [[NSString alloc] init]; // Ref count is 1 [s retain];
[ 0.762000322341919, 0.37553930282592773, 0.4520103335380554, -0.16989850997924805, 0.0745759978890419, -0.2348383367061615, 0.48066920042037964, -0.1938910186290741, -0.18153956532478333, -0.25628000497817993, -0.4073388874530792, 0.5840574502944946, 0.006856990046799183, 0.3807182312011719...
// Ref count is 2 - silly // to do this after init [s release]; // Ref count is back to 1 [s release];
[ 0.09824659675359726, -0.055343735963106155, 0.5007484555244446, -0.28833186626434326, -0.28612402081489563, -0.1494206339120865, 0.3906605839729309, -0.1555616706609726, -0.07119257748126984, -0.40740495920181274, -0.27623817324638367, 0.6817828416824341, -0.22022010385990143, -0.232634767...
// Ref count is 0, object is freed ``` Now for `autorelease`. Autorelease is used as a convenient (and sometimes necessary) way to tell the system to free this object up after a little while. From a plumbing perspective, when `autorelease` is called, the current thread's `NSAutoreleasePool` is alerted of the call. The `NSAutoreleasePool` now knows that once it gets an opportunity (after the current iteration of the event loop), it can call `release` on the object. From our perspective
[ 0.3404548764228821, -0.3890632390975952, 0.40493834018707275, -0.09047780930995941, 0.2596920132637024, -0.28047189116477966, 0.4149256646633148, -0.02224862016737461, -0.31977027654647827, -0.5040708780288696, -0.47004708647727966, 0.613196849822998, -0.32811447978019714, 0.10469388216733...
as programmers, it takes care of calling `release` for us, so we don't have to (and in fact, we shouldn't). What's important to note is that (again, by convention) all object creation *class* methods return an autoreleased object. For example, in the following example, the variable "s" has a reference count of 1, but after the event loop completes, it will be destroyed. ``` NSString* s = [NSString stringWithString:@"Hello World"]; ``` If you want to hang onto that string, you'd need to call `retain` explicitly, and then explicitly `release` it when you're done. Consider the following (very contrived) bit of code, and you'll see a situation
[ 0.21601161360740662, -0.0015901982551440597, 0.19961842894554138, -0.15935152769088745, -0.10720078647136688, -0.41268011927604675, 0.36194533109664917, 0.036840103566646576, -0.5693676471710205, -0.2228558510541916, -0.5116591453552246, 0.689335823059082, -0.16179680824279785, 0.248868092...
where `autorelease` is required: ``` - (NSString*)createHelloWorldString { NSString* s = [[NSString alloc] initWithString:@"Hello World"]; // Now what? We want to return s, but we've upped its reference count. // The caller shouldn't be responsible for releasing it, since we're the // ones that created it. If we call release, however, the reference // count will hit zero and bad memory will be returned to the caller. // The answer is to call autorelease before returning the string. By
[ 0.16812051832675934, 0.14280708134174347, 0.6924391388893127, -0.17118705809116364, 0.12324466556310654, -0.03434855118393898, 0.5280312895774841, -0.025741348043084145, -0.2823176681995392, -0.34837988018989563, -0.39036908745765686, 0.5559914112091064, -0.3589538037776947, 0.392742425203...
// explicitly calling autorelease, we pass the responsibility for // releasing the string on to the thread's NSAutoreleasePool, which will // happen at some later time. The consequence is that the returned string // will still be valid for the caller of this function. return [s autorelease]; } ``` I realize all of this is a bit confusing - at some point, though, it will click. Here are a few references to get you going: * [Apple's introduction](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html "Apple's introduction to Cocoa's memory management") to memory
[ 0.18956255912780762, 0.28079867362976074, 0.3999135196208954, -0.1269088089466095, 0.027403775602579117, -0.26762962341308594, 0.29666730761528015, 0.00875784270465374, -0.40767234563827515, -0.3446349501609802, -0.22227849066257477, 0.6839378476142883, -0.4883206784725189, 0.0260776150971...
management. * [Cocoa Programming for Mac OS X (4th Edition)](https://rads.stackoverflow.com/amzn/click/com/0321774086), by Aaron Hillegas - a very well written book with lots of great examples. It reads like a tutorial. * If you're truly diving in, you could head to [Big Nerd Ranch](http://www.bignerdranch.com/ "Big Nerd Ranch"). This is a training facility run by Aaron Hillegas - the author of the book mentioned above. I attended the Intro to Cocoa course there several years ago, and it was a great way to learn.
[ 0.15779981017112732, 0.17356039583683014, -0.38908880949020386, 0.3888891637325287, 0.28309327363967896, -0.05589417368173599, 0.4804573059082031, -0.042322151362895966, -0.5046069025993347, -0.40531086921691895, -0.12259457260370255, 0.7502630949020386, 0.11297518759965897, -0.11491468548...
After changing the output directory of a visual studio project it started to fail to build with an error very much like: ``` C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManagement.dll /proxytypes /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EasDiscovery.Common\target\win_x32\release\results\EASDiscovery.Common.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EasDiscovery.Export\target\win_x32\release\results\EASDiscovery.Export.dll /reference:c:\p4root\Zantaz\trunk\EASDiscovery\ItemCache\target\win_x32\release\results\EasDiscovery.ItemCache.dll /reference:c:\p4root\Zantaz\trunk\EASDiscovery\RetrievalEngine\target\win_x32\release\results\EasDiscovery.RetrievalEngine.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryJobs\target\win_x32\release\results\EASDiscoveryJobs.dll /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Shared.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.Misc.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinChart.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinDataSource.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinDock.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinEditors.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol.
[ -0.39392340183258057, 0.24650409817695618, 0.3864152431488037, -0.04070857912302017, -0.21157798171043396, 0.21298713982105255, 0.21263359487056732, -0.3858243227005005, -0.17002558708190918, -0.6572434306144714, -0.2763320803642273, 0.6469384431838989, -0.39704573154449463, -0.01703647896...
1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinGrid.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinListView.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinMaskedEdit.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinStatusBar.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinTabControl.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinToolbars.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.UltraWinTree.v8.1.dll" /reference:"C:\Program Files\Infragistics\NetAdvantage for .NET 2008 Vol. 1 CLR 2.0\Windows Forms\Bin\Infragistics2.Win.v8.1.dll" /reference:"C:\Program Files\Microsoft Visual Studio 8\ReportViewer\Microsoft.ReportViewer.Common.dll" /reference:"C:\Program Files\Microsoft Visual Studio 8\ReportViewer\Microsoft.ReportViewer.WinForms.dll" /reference:C:\p4root\Zantaz\trunk\EASDiscovery\PreviewControl\target\win_x32\release\results\PreviewControl.dll /reference:C:\p4root\Zantaz\trunk\EASDiscovery\Quartz\src\Quartz\target\win_x32\release\results\Scheduler.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.configuration.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /compiler:/delaysign-
[ -0.48311224579811096, 0.2780064344406128, 0.9306438565254211, 0.010788111947476864, -0.042025238275527954, -0.071782685816288, -0.24432232975959778, -0.5147193074226379, -0.2805025279521942, -0.3432421088218689, -0.2404317855834961, 0.8414262533187866, -0.35748255252838135, -0.232093483209...
Error: The specified module could not be found. (Exception from HRESULT: 0x8007007E) C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1902,9): error MSB6006: "sgen.exe" exited with code 1. ``` I changed the output directory to target/win\_x32/release/results but the path in sgen doesn't seem to have been updated. There seems to be no reference in the project to what path is passed into sgen so I'm unsure how to fix it. As a workaround I have disabled the serialization generation but it would be nice to fix the underlying problem. Has anybody else seen this? see [msdn](http://msdn.microsoft.com/en-us/library/bk3w6240(VS.80).aspx) for the options to sgen.exe [you have the command line, you
[ 0.07635565102100372, -0.08092393726110458, 0.38913682103157043, 0.026228390634059906, 0.07345817983150482, -0.022578345611691475, 0.5057835578918457, 0.06058844178915024, -0.5772014260292053, -0.7152093052864075, -0.28982770442962646, 0.5518768429756165, -0.22549745440483093, 0.31251156330...
can play with it manually... delete your .XmlSerializers.dll or use /force though] Today I also ran across how to more [manually specify the sgen options](http://www.kiwidude.com/blog/2007/02/vs2005-when-sgen-doesnt-work.html). I wanted this to not use the /proxy switch, but it appears it can let you specify the output directory. I don't know enough about msbuild to make it awesome, but this should get you started [open your .csproj/.vbproj in your non-visual studio editor of choice, look at the bottom and you should be able to figure out how/where this goes] [the below code has had UseProxyTypes set to true for your convenience] ``` <Target Name="GenerateSerializationAssembliesForAllTypes" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource"
[ 0.2546212077140808, -0.640609622001648, 0.4427095651626587, 0.24966363608837128, 0.27789387106895447, -0.48112034797668457, -0.10624466836452484, -0.1261768937110901, -0.21608445048332214, -0.5110428333282471, 0.13099537789821625, 0.8471654653549194, -0.33108869194984436, 0.078438505530357...
Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$(OutputPath)$(_SGenDllName)"> <SGen BuildAssemblyName="$(TargetFileName)" BuildAssemblyPath="$(OutputPath)" References="@(ReferencePath)" ShouldGenerateSerializer="true" UseProxyTypes="true" KeyContainer="$(KeyContainerName)" KeyFile="$(KeyOriginatorFile)" DelaySign="$(DelaySign)" ToolPath="$(SGenToolPath)"> <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly" /> </SGen> </Target> <!-- <Target Name="BeforeBuild"> </Target> --> <Target Name="AfterBuild" DependsOnTargets="GenerateSerializationAssembliesForAllTypes"> </Target> ```
[ -0.1294734925031662, -0.31578516960144043, 0.5693631172180176, -0.22496719658374786, 0.17933644354343414, 0.3020264506340027, 0.13615889847278595, -0.49571654200553894, -0.1907559335231781, -0.6742828488349915, -0.08693517744541168, 0.7597784996032715, -0.09505631029605865, 0.0627761557698...
What is the difference, if any, between these methods of indexing into a PHP array: ``` $array[$index] $array["$index"] $array["{$index}"] ``` I'm interested in both the performance and functional differences. ### Update: (In response to @Jeremy) I'm not sure that's right. I ran this code: ``` $array = array(100, 200, 300); print_r($array); $idx = 0; $array[$idx] = 123; print_r($array); $array["$idx"] = 456; print_r($array); $array["{$idx}"] = 789; print_r($array); ``` And got this output: ``` Array ( [0] => 100 [1] => 200 [2] => 300 ) Array ( [0] => 123 [1] => 200
[ 0.01313037984073162, -0.15220524370670319, 0.4343075454235077, -0.02453337423503399, -0.11132962256669998, 0.26489943265914917, 0.33134913444519043, -0.4993988871574402, 0.08882168680429459, -0.39954885840415955, 0.31065112352371216, 0.6163648366928101, -0.17830947041511536, -0.08815713971...
[2] => 300 ) Array ( [0] => 456 [1] => 200 [2] => 300 ) Array ( [0] => 789 [1] => 200 [2] => 300 ) ``` see @svec and @jeremy above. All array indices are of type 'int' first, then type 'string', and will be cast to that as PHP sees fit. Performance wise, $index should be faster than "$index" and "{$index}" (which are the same). Once you start a double-quote string, PHP will go into interpolation mode and treat it as a string first, but looking
[ 0.14943653345108032, -0.07860726863145828, 0.6240580677986145, -0.15748010575771332, -0.33727672696113586, 0.011504446156322956, 0.28903472423553467, -0.4779015779495239, 0.045034751296043396, -0.4494711756706238, 0.07607156038284302, 0.5805639624595642, -0.2517508864402771, -0.21042396128...
for variable markers ($, {}, etc) to replace from the local scope. This is why in most discussions, true 'static' strings should always be single quotes unless you need the escape-shortcuts like "\n" or "\t", because PHP will not need to try to interpolate the string at runtime and the full string can be compiled statically. In this case, doublequoting will first copy the $index into that string, then return the string, where directly using $index will just return the string.
[ 0.2887144684791565, -0.13562500476837158, 0.17009054124355316, 0.018560823053121567, -0.2612343430519104, -0.09075500071048737, 0.3255578279495239, -0.00937599129974842, -0.17365600168704987, -0.11085115373134613, -0.15434907376766205, 0.5336429476737976, -0.5287095308303833, -0.0773231834...
I'm aware of things like `onchange`, `onmousedown` and `onmouseup` but is there a good reference somewhere that lists all of them complete with possibly a list of the elements that they cover? W3Schools seems to have a good Javascript events reference: [HTML DOM Events](http://www.w3schools.com/jsref/dom_obj_event.asp)
[ -0.08153211325407028, -0.36896416544914246, 0.05754322558641434, -0.03830663114786148, -0.25841090083122253, -0.20300333201885223, 0.42355260252952576, 0.24611635506153107, -0.5805317163467407, -0.39541828632354736, -0.16135597229003906, 0.39621853828430176, 0.008915252983570099, -0.142121...
I have a website that I've just uploaded onto the Internet. When I browse to the site using Firefox 3.0.1 on Ubuntu I don't see the favicon; Firefox 3.0.1 on WinXP does display it. **Why** isn't the favicon displaying under Ubuntu? It's a favicon.ico file in the root directory, not referenced in the meta tags; would it work better as a GIF? Previously, there was no favicon. The browser cached the lack of favicon. [Clear the Firefox cache](http://pcsupport.about.com/od/maintenance/ht/clearcacheff.htm), and all is well.
[ 0.10783101618289948, 0.1490117758512497, 1.0540671348571777, -0.011950562708079815, 0.14547565579414368, -0.19335365295410156, 0.16421091556549072, 0.17121754586696625, -0.2504088580608368, -0.6863484978675842, -0.23235361278057098, 0.5628905296325684, -0.15157762169837952, 0.0984878987073...
This page from Adobe says to add a "wmode" parameter and set its value to "transparent": [http://kb.adobe.com/selfservice/viewContent.do?externalId=tn\_1420](http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14201) This works flawlessly in IE. The background renders correctly in Firefox and Safari, however as soon as you use the browser's scroll bar then mouse over the Flash control you must click once to activate the control. You can see this behavior if you try to hit the play button in Adobe's example. Anyone know a way around this? You know you can set the background color when you're embedding? > The following attributes are optional when defining the object and/or embed tags. For object , all
[ 0.18984968960285187, -0.08699720352888107, 0.4537194073200226, -0.0473635271191597, -0.15614283084869385, -0.056803591549396515, 0.38413044810295105, -0.18775251507759094, -0.0555279403924942, -0.8461778163909912, -0.04261450096964836, 0.8344995379447937, -0.21919281780719757, -0.288572132...
attributes are defined in param tags unless otherwise specified: > > > **bgcolor** - [ hexadecimal RGB value] in the format #RRGGBB . Specifies the background color of the movie. Use this attribute to override the background color setting specified in the Flash file. This attribute does not affect the background color of the HTML page. Cut 'n paste from <http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701&sliceId=1>
[ 0.4105794429779053, -0.02235432155430317, 0.38230782747268677, 0.07354915887117386, 0.0782085508108139, 0.11782465875148773, -0.10762228071689606, -0.43483245372772217, -0.16926716268062592, -0.431730180978775, -0.027480576187372208, 0.656362771987915, -0.16189973056316376, -0.006729757413...
I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc. It would be nice to be able to bind these keys so they execute arbitrary programs. Does anybody know how to do this in Debian Etch? I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts) Instead of typing a shortcut such as `Ctrl`+`M`, hit the button on your keyboard. If you would prefer to do this via command line or with a different desktop environment, this may help:
[ 0.21009254455566406, 0.070509172976017, 0.174419566988945, 0.07176002115011215, 0.04602045938372612, -0.06936786323785782, 0.1348067820072174, 0.04558422416448593, -0.19153080880641937, -0.7079170346260071, 0.09345592558383942, 0.8173696398735046, -0.058102093636989594, 0.11588464677333832...
[Unusual keys and keyboards](http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-14.html)
[ -0.21789726614952087, 0.36690303683280945, 0.39567211270332336, 0.1722252517938614, 0.5556649565696716, -0.033417847007513046, -0.04138809069991112, -0.21441499888896942, -0.4704723656177521, -0.038818322122097015, -0.0397486612200737, 0.06445480138063431, 0.08142691105604172, 0.2007152140...
I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project. When using the java search on one particular project, I get an error message saying `Class file name must end with .class` (see stack trace below). This does not seem to be happening on all projects, just one particular one, so perhaps there's something I should try to get rebuilt? I have already tried `Project -> Clean`... and Closing Eclipse, deleting all the built class files and restarting Eclipse to no avail. The only reference I've been able to
[ 0.5021346807479858, 0.17692062258720398, -0.43623974919319153, 0.08295191079378128, -0.02804546430706978, -0.1452418565750122, 0.41758498549461365, 0.20854085683822632, -0.3358597457408905, -0.5903651714324951, 0.29956966638565063, 0.3908180594444275, -0.1397809237241745, 0.528734266757965...
find on Google for the problem is at <http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx>, but unfortunately his solution (closing, deleting class files, restarting) did not work for me. If anyone can suggest something to try, or there's any more info I can gather which might help track it's down, I'd greatly appreciate the pointers. ``` Version: 3.4.0 Build id: I20080617-2000 ``` Also just found this thread - <http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html> - which indicates the same problem may occur when the project name contains a period. Unfortunately, that's not the case in my setup, so I'm still stuck. ``` Caused by: java.lang.IllegalArgumentException: Class file name must end with .class at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182) at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:109) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1177) at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:223) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:506) at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:551) at
[ -0.4069896638393402, 0.05822990462183952, 0.3492085337638855, 0.0652836263179779, 0.06005850061774254, 0.05229866877198219, 0.3073193430900574, -0.1566370576620102, -0.4065684974193573, -0.4817265272140503, -0.1856996715068817, 0.28069040179252625, -0.2538284957408905, 0.1258045881986618, ...
org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:142) at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:129) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.initializeReferences(RenameTypeProcessor.java:594) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.doCheckFinalConditions(RenameTypeProcessor.java:522) at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225) at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) ``` Thanks McDowell, closing and opening the project seems to have fixed it (at least for now). Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies: * Close and open the project * Delete the project (but not from disk!) and reimport it as an existing project Failing that, [bugs.eclipse.org](https://bugs.eclipse.org/bugs/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__all__&product=JDT&content=Class+file+name+must+end+with+.class) might provide the answer. If the workspace is caching something broken, you may be able to delete it by poking around in **workspace/.metadata/.plugins**. Most of that stuff is fairly transient (though backup and watch for deleted preferences).
[ -0.19348572194576263, 0.13039495050907135, 0.28080326318740845, -0.31169435381889343, -0.3366510272026062, 0.47390180826187134, 0.38502398133277893, -0.4301086664199829, -0.2794696092605591, -0.811259388923645, -0.23790910840034485, 0.5880089998245239, -0.24848444759845734, -0.236884593963...
I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we need to rethink how we do things to scale to that many cores in a shared memory model. For example the standard memory allocator isn't good enough. What resources would people recommend? So far I've found Sutter's column Dr. Dobbs to be a good start. I just got The Art of Multiprocessor Programming and The
[ 0.4773228168487549, 0.3954179286956787, -0.10185018926858902, 0.292561411857605, 0.12553375959396362, 0.262784868478775, -0.06690507382154465, 0.27563226222991943, -0.4715758264064789, -0.8278123140335083, 0.3310227692127228, 0.2176569551229477, 0.09761937707662582, 0.20728549361228943, ...
O'Reilly book on Intel Threading Building Blocks A couple of other books that are going to be helpful are: * [Synchronization Algorithms and Concurrent Programming](https://rads.stackoverflow.com/amzn/click/com/0131972596 "Synchronization Algorithms and Concurrent Programming") * [Patterns for Parallel Programming](https://rads.stackoverflow.com/amzn/click/com/0321228111 "Patterns for Parallel Programming") * [Communicating Sequential Processes](http://www.usingcsp.com/ "Communicating Sequential Processes") by C. A. R. Hoare (a classic, free PDF at that link) Also, consider relying less on sharing state between concurrent processes. You'll scale much, much better if you can avoid it because you'll be able to parcel out independent units of work without having to do as much synchronization between them. Even if you need to share some state,
[ 0.1508520096540451, 0.034434400498867035, -0.15891587734222412, 0.1499464064836502, -0.06993850320577621, 0.11722173541784286, -0.04313468933105469, -0.07880468666553497, -0.3370440602302551, -0.617009162902832, 0.24631845951080322, 0.29044777154922485, -0.30208638310432434, 0.198445141315...
see if you can partition the shared state from the actual processing. That will let you do as much of the processing in parallel, independently from the integration of the completed units of work back into the shared state. Obviously this doesn't work if you have dependencies among units of work, but it's worth investigating instead of just assuming that the state is always going to be shared.
[ 0.37611687183380127, -0.23053690791130066, -0.08729999512434006, 0.42719924449920654, 0.29906630516052246, 0.3062734007835388, -0.10809910297393799, -0.01900169439613819, -0.33590802550315857, -0.5807223916053772, 0.26633790135383606, 0.19809383153915405, -0.01650155894458294, 0.3417587280...
When writing code do you consciously program defensively to ensure high program quality and to avoid the possibility of your code being exploited maliciously, e.g. through buffer overflow exploits or code injection ? What's the "minimum" level of quality you'll always apply to your code ? In my line of work, our code has to be top quality. So, we focus on two main things: 1. Testing 2. Code reviews Those bring home the money.
[ 0.685573935508728, 0.3563326895236969, -0.4705160856246948, 0.24159613251686096, -0.20631545782089233, -0.07302045077085495, 0.5660190582275391, -0.12934830784797668, 0.21202753484249115, -0.5368177890777588, 0.184356227517128, 0.8752194046974182, -0.0646444633603096, -0.24742412567138672,...
As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new. Does anyone have any advice on how to go about starting out? Is there an IDE one can use? How does one go about testing? Are there any ready made libraries available? Or would I get a better learning experience by ignoring the libraries and building from scratch? How do I oneshot Hogger? Would love to hear your
[ 0.5782374143600464, 0.2768605649471283, -0.15884456038475037, 0.30400511622428894, -0.046781327575445175, -0.1171201542019844, -0.3089498281478882, -0.08924739807844162, -0.3413764238357544, -0.41297978162765503, 0.4122074842453003, 0.5323591828346252, 0.10549280792474747, 0.19090142846107...
advice, experiences and views. [This article](http://www.wowwiki.com/Getting_started_with_writing_addons) explains how to start pretty well. Your first bookmark is possibly the US Interface Forum, especially the Stickies for that: <http://us.battle.net/wow/en/forum/1011693/> Then, grab some simple addons to learn how XML and LUA interacts. The [WoWWiki HOWTO List](http://www.wowwiki.com/Category:HOWTOs) is a good point here as well. One important thing to keep in mind: World of Warcraft is available in many languages. If you have a EU Account, you got an excellent testing bed by simply downloading the language Packs for Spanish, German and French. If you're an US Guy, check if you can get the Latin America version. That way, you
[ 0.30090609192848206, 0.1922300010919571, -0.03344278410077095, 0.3324400782585144, -0.2867274582386017, -0.14984950423240662, 0.0016273371875286102, 0.1804199367761612, -0.08736976981163025, -0.5166250467300415, -0.09926138073205948, 0.4315531551837921, 0.3755682706832886, -0.3326867520809...
can test it against another language version. Once you made 1 or 2 really small and simple addons just to learn how to use it, have a look at the various frameworks. [WowAce](http://www.wowace.com/) is a popular one, but there are others. Just keep one thing in mind: Making an Addon is work. Maintaining one is even more work. With each new Patch, there may be breaking changes, and the next Addon will surely cause a big Exodus of Addons, just like Patch 2.0.1 did.
[ 0.7381219863891602, -0.12933623790740967, -0.17366667091846466, 0.020767908543348312, -0.31800705194473267, 0.04062877967953682, 0.44971397519111633, 0.1422041803598404, -0.4077172577381134, -0.5461573004722595, -0.11181828379631042, 0.34158721566200256, -0.21648095548152924, -0.1721544265...
I have some code for starting a thread on the .NET CF 2.0: ``` ThreadStart tStart = new ThreadStart(MyMethod); Thread t = new Thread(tStart); t.Start(); ``` If I call this inside a loop the items completely out of order. How do introduce a wait after `t.Start()`, so that the work on the thread completes before the code continues? Will BeginInvoke/EndInvoke be a better option for this than manually creating threads? How much order do you need to impose on the threads? If you just need all of the work started in the loop to finish before the code continues, but you don't care about the order the
[ 0.5059563517570496, 0.049948710948228836, 0.30205199122428894, -0.1424974799156189, -0.0027131361421197653, -0.35012832283973694, 0.17473477125167847, -0.07110155373811722, -0.3094111680984497, -0.47510212659835815, 0.0043374327942729, 0.34389975666999817, -0.5168571472167969, 0.2153682112...
work within the loop finishes, then calling Join is the answer. To add more detail to [Kevin Kenny's answer,](https://stackoverflow.com/questions/6890/compact-framework-how-to-wait-for-thread-complete-before-continuing#6935) you should call Join *outside* the loop. This means you will need a collection to hold references to the threads you started: ``` // Start all of the threads. List<Thread> startedThreads = new List<Thread>(); foreach (...) { Thread thread = new Thread(new ThreadStart(MyMethod)); thread.Start(); startedThreads.Add(thread); } // Wait for all of the threads to finish. foreach (Thread thread in startedThreads) { thread.Join(); } ``` In contrast, if you called Join inside the loop, the result would basically be the same as not using threads at all. Each
[ 0.41281235218048096, 0.08495712280273438, 0.572896420955658, -0.3377150595188141, 0.11332312226295471, -0.18864409625530243, 0.3788926899433136, -0.35211774706840515, -0.6336406469345093, -0.4081951677799225, -0.18770352005958557, 0.12343426793813705, -0.47664016485214233, 0.33502185344696...
iteration of the loop body would create and start a thread but then immediately Join it and wait for it to finish. If the individual threads produce some result (write a message in a log, for example) then the messages may still appear out of order because there's no coordination between the threads. It is possible to get the threads to output their results in order by coordinating them with a Monitor.
[ 0.2707187831401825, -0.4324418902397156, 0.012024355120956898, 0.17871740460395813, -0.11485196650028229, 0.18772415816783905, 0.46569493412971497, -0.3709683418273926, -0.2580164968967438, -0.6447944641113281, 0.15553879737854004, 0.028057361021637917, -0.31996166706085205, 0.184235468506...
Is there a way to implement a singleton object in C++ that is: 1. Lazily constructed in a thread safe manner (two threads might simultaneously be the first user of the singleton - it should still only be constructed once). 2. Doesn't rely on static variables being constructed beforehand (so the singleton object is itself safe to use during the construction of static variables). (I don't know my C++ well enough, but is it the case that integral and constant static variables are initialized before any code is executed (ie, even before static constructors are executed - their values may already be "initialized"
[ -0.09640489518642426, -0.1473696082830429, -0.11220025271177292, 0.10409844666719437, 0.0019705549348145723, -0.2556600570678711, -0.02530115470290184, -0.24318714439868927, -0.18802107870578766, -0.4548042118549347, -0.008758245967328548, 0.46077361702919006, -0.32269033789634705, -0.3720...
in the program image)? If so - perhaps this can be exploited to implement a singleton mutex - which can in turn be used to guard the creation of the real singleton..) --- Excellent, it seems that I have a couple of good answers now (shame I can't mark 2 or 3 as being **the answer**). There appears to be two broad solutions: 1. Use static initialisation (as opposed to dynamic initialisation) of a POD static variable, and implementing my own mutex with that using the builtin atomic instructions. This was the type of solution I was hinting at in my question, and
[ 0.19660396873950958, -0.1924644261598587, 0.10263530910015106, -0.03364557400345802, -0.09306973218917847, 0.34987232089042664, 0.05495971813797951, -0.22750046849250793, -0.18565408885478973, -0.5151347517967224, -0.0721164420247078, 0.6823133826255798, -0.5054462552070618, 0.000236188716...
I believe I knew already. 2. Use some other library function like [pthread\_once](http://opengroup.org/onlinepubs/007908799/xsh/pthread_once.html) or [boost::call\_once](http://www.boost.org/doc/libs/1_33_1/doc/html/call_once.html). These I certainly didn't know about - and am very grateful for the answers posted. Basically, you're asking for synchronized creation of a singleton, without using any synchronization (previously-constructed variables). In general, no, this is not possible. You need something available for synchronization. As for your other question, yes, static variables which can be statically initialized (i.e. no runtime code necessary) are guaranteed to be initialized before other code is executed. This makes it possible to use a statically-initialized mutex to synchronize creation of the singleton. From the 2003
[ 0.013737554661929607, 0.10923879593610764, -0.050159111618995667, 0.20385146141052246, -0.19377128779888153, -0.18366099894046783, 0.23495778441429138, -0.1668049842119217, -0.3349932134151459, -0.295397013425827, 0.19450151920318604, 0.8312947750091553, -0.30734720826148987, 0.07149500399...
revision of the C++ standard: > Objects with static storage duration (3.7.1) shall be zero-initialized (8.5) before any other initialization takes place. Zero-initialization and initialization with a constant expression are collectively called static initialization; all other initialization is dynamic initialization. Objects of POD types (3.9) with static storage duration initialized with constant expressions (5.19) shall be initialized before any dynamic initialization takes place. Objects with static storage duration defined in namespace scope in the same translation unit and dynamically initialized shall be initialized in the order in which their definition appears in the translation unit. If you *know* that you will be
[ 0.004005545750260353, -0.2666168510913849, 0.6477714776992798, -0.09010671824216843, 0.3582594394683838, 0.102365642786026, -0.01916963793337345, -0.16556057333946228, -0.21669556200504303, -0.42243820428848267, -0.6731350421905518, 0.2868832051753998, -0.08729398995637894, 0.2467421144247...
using this singleton during the initialization of other static objects, I think you'll find that synchronization is a non-issue. To the best of my knowledge, all major compilers initialize static objects in a single thread, so thread-safety during static initialization. You can declare your singleton pointer to be NULL, and then check to see if it's been initialized before you use it. However, this assumes that you *know* that you'll use this singleton during static initialization. This is also not guaranteed by the standard, so if you want to be completely safe, use a statically-initialized mutex. Edit: Chris's suggestion to use an
[ 0.4475611746311188, 0.003975772298872471, -0.3799290060997009, 0.1756674200296402, -0.021748362109065056, -0.0856446623802185, 0.40403512120246887, 0.05302891880273819, -0.1912042647600174, -0.4550989270210266, 0.003924343269318342, 0.48436030745506287, -0.4811880886554718, 0.3228342235088...
atomic compare-and-swap would certainly work. If portability is not an issue (and creating additional temporary singletons is not a problem), then it is a slightly lower overhead solution.
[ -0.13216957449913025, -0.25769078731536865, -0.18035294115543365, 0.48369601368904114, 0.05207137390971184, -0.005461358465254307, -0.09523186087608337, -0.20189273357391357, -0.08654356747865677, -0.5384939312934875, -0.19661273062229156, 0.6062624454498291, -0.32498595118522644, -0.23839...
What are the differences between these two and which one should I use? ``` string s = "Hello world!"; String s = "Hello world!"; ``` [`string`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/string) is an alias in C# for [`System.String`](https://learn.microsoft.com/en-us/dotnet/api/system.string). So technically, there is no difference. It's like [`int` *vs.* `System.Int32`](https://stackoverflow.com/questions/62503/c-int-or-int32-should-i-care). As far as guidelines, it's generally recommended to use `string` any time you're referring to an object. e.g. ``` string place = "world"; ``` Likewise, I think it's generally recommended to use `String` if you need to refer specifically to the class. e.g. ``` string greet = String.Format("Hello {0}!", place); ``` ### This is the style that Microsoft tends to use in [their examples](https://learn.microsoft.com/en-us/dotnet/api/system.string.format#examples). It appears that the guidance in this area
[ 0.005736657418310642, 0.056245774030685425, 0.16527794301509857, -0.056607820093631744, 0.05904509127140045, -0.27326589822769165, 0.29490604996681213, 0.17205825448036194, -0.05703657492995262, -0.5394396781921387, -0.2675613462924957, 0.367542028427124, -0.05536530911922455, 0.3205058574...
may have changed, as [StyleCop](https://github.com/StyleCop) now enforces the use of the C# specific aliases.
[ 0.9045603275299072, 0.08292737603187561, 0.016264591366052628, -0.10378627479076385, 0.07453421503305435, -0.4802750051021576, 0.23103511333465576, 0.49082523584365845, -0.3578868508338928, 0.0011899701785296202, -0.437177449464798, 0.28204602003097534, -0.14623063802719116, 0.202629894018...
How can I create rounded corners using CSS? Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the `border-radius` property. You can [read the spec](http://www.w3.org/TR/css3-background/#the-border-radius) on the property, or get some [useful implementation information on MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius): If you are using a browser that [doesn't](http://fmbip.com/litmus/) [implement](http://css3test.com/) `border-radius` (Chrome pre-v4, Firefox pre-v4, IE8, Opera pre-v10.5, Safari pre-v5), then the links below detail a whole bunch of different approaches. Find one that suits your site and coding style, and go with it. 1. [CSS Design: Creating Custom Corners & Borders](http://www.alistapart.com/articles/customcorners/) 2. [CSS Rounded Corners 'Roundup'](http://www.smileycat.com/miaow/archives/000044.php) 3. [25 Rounded Corners Techniques with CSS](http://www.cssjuice.com/25-rounded-corners-techniques-with-css/)
[ 0.08312398940324783, 0.1395983099937439, 0.36496639251708984, 0.04543289542198181, -0.41645461320877075, 0.17776788771152496, 0.10304278135299683, -0.432160347700119, -0.11377142369747162, -0.8194717764854431, 0.09627708047628403, 0.3467513918876648, 0.14944590628147125, 0.0694799125194549...
In other words, is this Singleton implementation thread safe: ``` public class Singleton { private static Singleton instance; private Singleton() { } static Singleton() { instance = new Singleton(); } public static Singleton Instance { get { return instance; } } } ``` Static constructors are guaranteed to be run only once per application domain, before any instances of a class are created or any static members are
[ -0.16656571626663208, -0.13665907084941864, 0.32148292660713196, 0.03154599294066429, 0.11638856679201126, -0.19517360627651215, 0.23525403439998627, 0.21887223422527313, -0.32107996940612793, -0.44086742401123047, -0.4114382266998291, 0.5691903233528137, -0.5332444310188293, 0.35164326429...
accessed. <https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors> The implementation shown is thread safe for the initial construction, that is, no locking or null testing is required for constructing the Singleton object. However, this does not mean that any use of the instance will be synchronised. There are a variety of ways that this can be done; I've shown one below. ``` public class Singleton { private static Singleton instance; // Added a static mutex for synchronising use of instance. private static System.Threading.Mutex mutex; private Singleton() { } static Singleton() {
[ -0.08264610916376114, 0.0987715944647789, 0.2595181465148926, 0.17315232753753662, 0.09470006078481674, -0.0003819098346866667, 0.23407107591629028, -0.018380261957645416, -0.17063112556934357, -0.6733318567276001, -0.23825080692768097, 0.4992942810058594, -0.5059056282043457, 0.3722400665...
instance = new Singleton(); mutex = new System.Threading.Mutex(); } public static Singleton Acquire() { mutex.WaitOne(); return instance; } // Each call to Acquire() requires a call to Release() public static void Release() { mutex.ReleaseMutex(); } } ```
[ 0.1192869171500206, -0.16769415140151978, 0.1500287503004074, -0.2995719909667969, 0.006536693777889013, 0.2678065001964569, 0.15660080313682556, -0.48907670378685, -0.39265117049217224, -0.4830603301525116, -0.3755458891391754, 0.6143884062767029, -0.5386256575584412, 0.49202632904052734,...
What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinations would worth investigating? We have full control of our development environment so using some form of CI is certain here but I would also like to convince our production services team that they can reliably deploy to the system test, uat and even production environments using these tools. We use CruiseControl with NUnit, NCover, FxCop,
[ 0.27570605278015137, -0.13374391198158264, 0.6056516766548157, 0.5639338493347168, 0.12461835145950317, -0.0807713195681572, -0.38387346267700195, 0.021314159035682678, -0.23451614379882812, -0.6568286418914795, -0.02351868711411953, 0.6185094118118286, -0.005054804962128401, 0.03745484352...
SVN and some custom tools we wrote ourselves to produce the reports. In my opinion it has proven (over the last few years) to be an excellent combination. It's frustrating that MS restricts *all* of its integration tools to VSTS. Its test framework is as good as NUnit, but you can't use its code coverage tools or anything else. I'd check out XNuit - it's looking pretty promising (but currently lacking UI). We automate nightly builds, and you could automate UAT and manual test builds, but I'm not sure that we'd ever want to automate the release to our production servers. Even if
[ 0.4420243799686432, -0.28661274909973145, 0.3636293113231659, 0.13203348219394684, -0.15108183026313782, -0.2145891785621643, 0.343877911567688, 0.03384630009531975, -0.16738085448741913, -0.7842334508895874, -0.0671342983841896, 0.7344925403594971, -0.25499820709228516, 0.0518002919852733...
it were any change would be important enough that someone would have to watch over it anyway.
[ 0.4141557216644287, 0.0664936825633049, 0.10445476323366165, 0.008590918965637684, 0.07592949271202087, 0.24473638832569122, -0.06347858160734177, 0.07512499392032623, -0.34632113575935364, -0.1870349496603012, 0.1947602927684784, 0.3137272596359253, -0.010021326132118702, 0.22593554854393...
Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow. The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all windows on the terminal.
[ 0.05820798501372337, -0.2114253044128418, 0.7943444848060608, 0.01879577338695526, 0.13292807340621948, 0.13812434673309326, 0.1494915932416916, -0.052293576300144196, -0.16471515595912933, -0.8296908140182495, 0.41617095470428467, 0.576168417930603, -0.14796176552772522, -0.10867695510387...
Can anyone recommend software or a .NET library that will check for bounced emails and the reason for the bounce? I get bounced emails into a pop3 account that I can read then. I need it to keep my user database clean from invalid email addresses and want to automate this (mark user as invalid email). I have done a great deal of work handling bounce emails and there different types. If you want to be absolutely sure that the email your looking at is indeed a bounce of a specific kind I highly recommend getting a good filter. I have worked
[ 0.7356827259063721, 0.24027253687381744, 0.21081338822841644, 0.06791380047798157, -0.1561015397310257, -0.551546573638916, 0.24023593962192535, 0.2080402821302414, -0.446550190448761, -0.2837985157966614, 0.31513142585754395, 0.27741876244544983, -0.2263612449169159, -0.026040351018309593...
with [Boogie Tools](http://www.boogietools.com/) and it has worked very well. It lets you know what kind of bounce it is, Hard, Soft, Transient or if its even someone trying to unsubscribe. It has a muliple API's including .Net and I found it quite easy to get working.
[ 0.7634744644165039, -0.5202024579048157, 0.5922868847846985, 0.09033263474702835, -0.0737084448337555, -0.4805890917778015, -0.10576143860816956, 0.13890907168388367, -0.39987483620643616, -0.3763079345226288, 0.15273891389369965, 0.4296886622905731, -0.31684914231300354, 0.019469397142529...
Our software must be able to run on SQL Server 2000 and 2005. To simplify development, we're running our SQL Server 2005 databases in compatibility level 80. However, database performance seems slower on SQL 2005 than on SQL 2000 in some cases (we have not confirmed this using benchmarks yet). Would upgrading the compatibility level to 90 improve performance on the SQL 2005 servers? I think i read somewhere, that the SQL Server 2005 database engine should be about 30% faster than the SQL Server 2000 engine. It might be, that you have to run your database in compatibility mode 90
[ 0.2281198799610138, 0.3446279764175415, 0.6090666055679321, 0.1534399390220642, 0.17643088102340698, -0.3501388132572174, 0.22506168484687805, -0.3835601210594177, 0.14927750825881958, -0.34568291902542114, 0.05190061777830124, 0.8628653883934021, -0.15866443514823914, -0.23547211289405823...
to get these benefits. But i stumbled on two scenarios, where performance can drop dramatically when using mssql 2005 compared to mssql 2000: 1. Parameter Sniffing: When using a stored procedure, sql server will calculate exactly one execution plan at the time, you first call the procedure. The execution plan depends on the parameter values given for that call. In our case, procedures which normally took about 10 seconds are running for hours under mssql 2005. Take a look [here](http://furrukhbaig.wordpress.com/category/parameter-sniffing/) and [here](http://www.microsoft.com/technet/prodtechnol/sql/2005/qrystats.mspx). 2. When using distributed queries, mssql 2005 behaves different concerning assumptions about the sort order on the remote server. Default behavior
[ -0.18054628372192383, -0.4737025201320648, 0.09880570322275162, -0.16556590795516968, -0.44744208455085754, -0.009953716769814491, 0.36208415031433105, -0.45677533745765686, -0.28142422437667847, -0.23728813230991364, 0.0723334476351738, 0.34076544642448425, -0.5098406076431274, 0.01082204...
is, that the server copies the whole remote tables involved in a query to the local tempdb and then execute the joins locally. Workaround is to use OPENQUERY, where you can control exactly which resultset is transferred from the remote server.
[ 0.13659806549549103, -0.2773207426071167, 0.31835120916366577, 0.3705240786075592, -0.0398402139544487, -0.35207366943359375, -0.08241824060678482, 0.08908624947071075, -0.3211153745651245, -0.5202858448028564, -0.10077684372663498, 0.14511819183826447, -0.3960169851779938, 0.1646554619073...
The company I'm currently working for is using [Selenium](http://selenium.openqa.org/) for Uniting-Testing our User Interface. What do you use to Unit-Test your Web UI and how effective do you find it? We use Watin at my place of employment, we are a .net shop so this solution made a lot of sense. We actually started with Watir (the original ruby implementation) and switched after. It's been a pretty good solution for us so far
[ 0.9704776406288147, 0.08700347691774368, 0.06426914781332016, 0.06380464136600494, -0.1901412159204483, -0.058570001274347305, 0.3563899099826813, -0.4714238941669464, 0.0700099915266037, -0.603104293346405, 0.3502483367919922, 0.4910736382007599, -0.0048135872930288315, 0.0488198138773441...
I know almost nothing about linq. I'm doing this: ``` var apps = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero select app; ``` Which gets me all the running processes which match that criteria. But I don't know how to get the first one. The examples I can find on the net seem to imply I have to do this ``` var matchedApp = (from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero select app).First(); ``` which strikes me as somewhat ugly, and also throws an exception if there are
[ 0.14041027426719666, 0.5062329769134521, 0.8352372646331787, -0.228489488363266, 0.1852126121520996, 0.1242930218577385, 0.11136236786842346, -0.43203291296958923, -0.41071441769599915, -0.6844671368598938, -0.17873063683509827, 0.7740165591239929, -0.6283875703811646, -0.00793672632426023...
no matching processes. Is there a better way? **UPDATE** I'm actually trying to find the first matching item, and call `SetForegroundWindow` on it I've come up with this solution, which also strikes me as ugly and awful, but better than above. Any ideas? ``` var unused = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero select SetForegroundWindow( app.MainWindowHandle ); // side-effects in linq-query is technically bad I guess ``` @FryHard FirstOrDefault will work but remember that it returns null if none are found. This code isn't tested but should be close to what you want: ``` var app =
[ 0.1149606928229332, 0.27972421050071716, 0.5371106266975403, 0.008337329141795635, 0.12247608602046967, 0.4605232775211334, 0.4126366376876831, -0.3192286789417267, -0.35502028465270996, -0.986873984336853, -0.11400960385799408, 0.5429494380950928, -0.46750280261039734, 0.02121262811124324...
Process.GetProcesses().FirstOrDefault(p => p.ProcessName.Contains("MyAppName") && p.MainWindowHandle != IntPtr.Zero); if (app == null) return; SetForegroundWindow(app.MainWindowHandle); ```
[ -0.28315243124961853, 0.00040353593067266047, 0.7458378076553345, -0.385225772857666, 0.40395301580429077, 0.4120233356952667, 0.45105230808258057, -0.3521568179130554, -0.3193933963775635, -0.6615163087844849, -0.4060589075088501, 0.4186597764492035, -0.31150954961776733, 0.46326830983161...
So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based on the fact that I added an `std::string` to a class and assigning it a value from another `std::string`: ``` std::string hello = "Hello, world.\n"; /* exampleString = "Hello, world.\n" would work fine. */ exampleString = hello; ``` crashes on my system with a stack dump. So basically I need to **stop** and go through all my code and memory management stuff and find out where I've screwed up. The codebase is still small (about 1000 lines), so this
[ 0.005606874357908964, 0.3724743127822876, -0.11425596475601196, 0.16582058370113373, -0.01203965675085783, 0.0812331959605217, 0.6653284430503845, 0.24304965138435364, -0.1857532560825348, -0.7076194286346436, 0.3276403248310089, 0.30462783575057983, -0.10949582606554031, 0.278916448354721...
is easily do-able. Still, I'm over my head with this kind of stuff, so I thought I'd throw it out there. I'm on a Linux system and have poked around with `valgrind`, and while not knowing completely what I'm doing, it did report that the `std::string`'s destructor was an invalid free. I have to admit to getting the term 'Heap Corruption' from a Google search; any general purpose articles on this sort of stuff would be appreciated as well. (In before `rm -rf ProjectDir`, do again in C# :D) EDIT: I haven't made it clear, but what I'm asking for are ways an
[ 0.08683962374925613, 0.21765248477458954, -0.0357186421751976, 0.0925174430012703, -0.07895267754793167, -0.43298807740211487, 0.26947396993637085, -0.011649097315967083, -0.03847397491335869, -0.2728535830974579, -0.24464151263237, 0.5490145087242126, -0.16073952615261078, 0.1679040491580...
advice of diagnosing these sort of memory problems. I know the std::string stuff is right, so it's something I've done (or a bug, but there's Not A Problem With Select). I'm sure I could check the code I've written up and you very smart folks would see the problem in no time, but I want to add this kind of code analysis to my 'toolbox', as it were. These are relatively cheap mechanisms for possibly solving the problem: 1. Keep an eye on my [heap corruption question](https://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate) - I'm updating with the answers as they shake out. The first was balancing `new[]`
[ 0.21708057820796967, 0.20571185648441315, -0.10786091536283493, 0.16075080633163452, 0.05782950296998024, -0.08352945744991302, 0.19733381271362305, 0.15494424104690552, -0.06668710708618164, -0.4519440233707428, 0.16586677730083466, 0.7251519560813904, -0.06949617713689804, -0.27907928824...
and `delete[]`, but you're already doing that. 2. Give [valgrind](http://valgrind.org/) more of a go; it's an excellent tool, and I only wish it was available under Windows. I only slows your program down by about half, which is pretty good compared to the Windows equivalents. 3. Think about using the [Google Performance Tools](http://code.google.com/p/google-perftools/) as a replacement malloc/new. 4. Have you cleaned out all your object files and started over? Perhaps your make file is... "suboptimal" 5. You're not `assert()`ing enough in your code. How do I know that without having seen it? Like flossing, no-one `assert()`s enough in their code. Add in a validation
[ 0.31634819507598877, 0.020401477813720703, 0.42643168568611145, -0.12031041830778122, -0.2354956418275833, -0.2802414298057556, 0.676271378993988, -0.4126920998096466, -0.1820342242717743, -0.47344106435775757, -0.1961170732975006, 0.921670138835907, 0.029223915189504623, 0.046482294797897...
function for your objects and call that on method start and method end. 6. Are you [compiling -wall](http://gcc.gnu.org/onlinedocs/gcc-4.3.0/cpp/Invocation.html#Invocation)? If not, do so. 7. Find yourself a lint tool like [PC-Lint](http://www.gimpel.com/). A small app like yours might fit in the [PC-lint demo](http://gimpel-online.com/cgi-bin/genPage.py?srcFile=diy.cpp&cgiScript=analyseCode.py&title=Blank+Slate+(C%2B%2B)+&intro=An+empty+page+in+which+to+write+your+own+C%2B%2B+code.&compilerOption=co-gcc.lnt+co-gnu3.lnt&includeOption=%7B%7BquotedIncludeOption%7D%7D) page, meaning no purchase for you! 8. Check you're NULLing out pointers after deleteing them. Nobody likes a dangling pointer. Same gig with declared but unallocated pointers. 9. Stop using arrays. Use a [vector](http://en.wikipedia.org/wiki/Vector_(STL)) instead. 10. Don't use raw pointers. Use a [smart pointer](http://en.wikipedia.org/wiki/Smart_pointer). Don't use `auto_ptr`! That thing is... surprising; its semantics are very odd. Instead, choose one of the [Boost smart pointers](http://www.boost.org/doc/libs/1_35_0/libs/smart_ptr/smart_ptr.htm),
[ 0.18173785507678986, -0.22273477911949158, 0.5202794671058655, 0.05982593819499016, -0.10241953283548355, -0.04144471883773804, 0.26927614212036133, -0.12029223889112473, -0.3132338225841522, -0.44025230407714844, -0.20510901510715485, 0.9431465268135071, -0.46959832310676575, -0.413296908...
or something out of [the Loki library](http://en.wikipedia.org/wiki/Loki_(C%2B%2B)).
[ 0.5280764698982239, -0.07886479049921036, -0.251068651676178, 0.33625417947769165, -0.04287487640976906, -0.2658376097679138, 0.34139710664749146, 0.29588618874549866, -0.16711124777793884, 0.0018632345600053668, -0.2904927134513855, 0.10086561739444733, -0.03355397656559944, 0.15163767337...
Recently I tried understanding the use of **java.math.MathContext** but failed to understand properly. Is it used for rounding in `java.math.BigDecimal`. If yes why does not it round the decimal digits but even mantissa part. From API docs, I came to know that it follows the standard specified in `ANSI X3.274-1996` and `ANSI X3.274-1996/AM 1-2000` specifications but I did not get them to read online. Please let me know if you have any idea on this. @jatan > Thanks for you answer. It makes sense. Can you please explain me MathContext in the context of BigDecimal#round method. There's nothing special about `BigDecimal.round()` *vs.* any other `BigDecimal`
[ -0.08724328130483627, 0.11298388987779617, 0.20690995454788208, -0.019522177055478096, -0.376654714345932, 0.049866627901792526, 0.10845137387514114, -0.09311160445213318, -0.36121636629104614, -0.437483549118042, 0.3163837492465973, 0.4100014269351959, 0.13894087076187134, 0.0673709139227...
method. In all cases, the `MathContext` specifies the number of significant digits and the rounding technique. Basically, there are two parts of every [`MathContext`](http://java.sun.com/j2se/1.5.0/docs/api/java/math/MathContext.html). There's a precision, and there's also a [`RoundingMode`](http://java.sun.com/j2se/1.5.0/docs/api/java/math/RoundingMode.html). The precision again specifies the number of significant digits. So if you specify `123` as a number, and ask for 2 significant digits, you're going to get `120`. It might be clearer if you think in terms of scientific notation. `123` would be `1.23e2` in scientific notation. If you only keep 2 significant digits, then you get `1.2e2`, or `120`. By reducing the number of significant digits, we reduce the
[ 0.1777099370956421, -0.1173345074057579, 0.406584769487381, 0.05800898000597954, -0.2108512818813324, 0.09185957163572311, -0.11872301995754242, -0.5555358529090881, -0.1599644273519516, -0.4251043498516083, 0.06608149409294128, 0.6547454595565796, -0.10401251912117004, -0.298894464969635,...
precision with which we can specify a number. The `RoundingMode` part specifies how we should handle the loss of precision. To reuse the example, if you use `123` as the number, and ask for 2 significant digits, you've reduced your precision. With a `RoundingMode` of `HALF_UP` (the default mode), `123` will become `120`. With a `RoundingMode` of `CEILING`, you'll get `130`. For example: ``` System.out.println(new BigDecimal("123.4", new MathContext(4,RoundingMode.HALF_UP))); System.out.println(new BigDecimal("123.4",
[ 0.12341425567865372, 0.0059652868658304214, 0.6926576495170593, -0.14183616638183594, -0.022333497181534767, -0.03736477717757225, 0.0574352964758873, -0.5474265217781067, -0.3611193895339966, -0.3971293866634369, -0.09676972031593323, 0.6976431608200073, 0.12936639785766602, 0.08256869763...
new MathContext(2,RoundingMode.HALF_UP))); System.out.println(new BigDecimal("123.4", new MathContext(2,RoundingMode.CEILING))); System.out.println(new BigDecimal("123.4", new MathContext(1,RoundingMode.CEILING))); ``` Outputs: ``` 123.4 1.2E+2 1.3E+2 2E+2 ``` You can see that both the precision and the rounding mode affect the output.
[ -0.23491603136062622, -0.016134900972247124, 0.6332442164421082, -0.3176628649234772, 0.026781903579831123, 0.081941619515419, 0.31000977754592896, -0.30023646354675293, -0.26726672053337097, -0.6887164115905762, -0.49663498997688293, 0.6207975745201111, -0.2157478630542755, 0.007900815457...
Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron. I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit. So, my question is "is there a way to have some kind of process explorer, or task manager sort of thing for Firefox 3?" I would like to be able to see what tabs are using what percent of my processor via the JavaScript on that page
[ 0.33375856280326843, 0.08177263289690018, 0.12937934696674347, -0.06166451796889305, -0.4736626148223877, 0.06020481884479523, 0.30500200390815735, 0.18788503110408783, -0.47603070735931396, -0.7044064402580261, 0.3936251103878021, 0.565242350101471, -0.38151004910469055, 0.009774578735232...
(or anything in the page that is causing CPU/memory usage). Does anybody know of a plugin that does this, or something similar? Has anyone else done this kind of inspection another way? I know about FireBug, but I can't imagine how I would use it to finger which tab is using a lot of resources. Any suggestions or insights? It's probably the [awesome firefox3 fsync "bug"](http://shaver.off.net/diary/2008/05/25/fsyncers-and-curveballs/), which is a giant pile of fail. In summary * Firefox3 saves its bookmarks and history in an SQLite database * Every time you load a page it writes to this database several times * SQLite cares deeply that you don't
[ 0.3017738461494446, 0.46366024017333984, 0.03787018731236458, -0.07108715921640396, -0.15099357068538666, -0.20796558260917664, 0.4322708547115326, 0.32680514454841614, -0.26144444942474365, -0.5751577615737915, 0.21761554479599, 0.6947696208953857, -0.3715643286705017, -0.0549181215465068...
lose your bookmarks, so each time it writes, instructs the kernel to flush it's database file to disk and ensure that it's fully written * Many variants of linux, when told to flush like that, flush EVERY FILE. This may take up to a minute or more if you have background tasks doing any kind of disk intensive stuff. * The kernel makes firefox wait while this flush happens, which locks up the UI.
[ 0.24708212912082672, -0.08982973545789719, 0.5259916186332703, 0.17919981479644775, 0.23714584112167358, -0.3826550543308258, 0.4266926646232605, 0.06531103700399399, -0.2249370664358139, -0.6703587770462036, -0.2699994742870331, 0.6456964612007141, 0.006144452840089798, -0.169186890125274...
First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier. I myself have always had problems with * naming, * placing So, 1. Where do you put your domain specific constants (and what is the best name for such a class)? 2. Where do you put classes for stuff which is both infrastructural and domain specific (for instance I have a FileStorageStrategy class, which stores the files either in the database, or alternatively in database)? 3.
[ 0.5789252519607544, 0.047486886382102966, -0.4508191645145416, -0.0017528379103168845, -0.2046889215707779, -0.3089076578617096, 0.12300962954759598, -0.1567249596118927, -0.10548372566699982, -0.6456155776977539, 0.11980178952217102, 0.521145224571228, -0.24648934602737427, 0.193670719861...
Where to put Exceptions? 4. Are there any standards to which I can refer? I've really come to like Maven's [Standard Directory Layout](http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html "S"). One of the key ideas for me is to have two source roots - one for production code and one for test code like so: ``` MyProject/src/main/java/com/acme/Widget.java MyProject/src/test/java/com/acme/WidgetTest.java ``` (here, both src/main/java and src/test/java are source roots). Advantages: * Your tests have package (or "default") level access to your classes under test. * You can easily package only your production sources into a JAR by dropping src/test/java as a source root. One rule of thumb about class placement and packages: Generally speaking, well structured projects will be free of
[ 0.5029550194740295, 0.455708384513855, -0.34173065423965454, -0.014689718373119831, -0.27744340896606445, -0.25701481103897095, 0.31439557671546936, -0.35808804631233215, -0.2111373245716095, -0.6068035364151001, 0.09921569377183914, 0.4656662344932556, 0.023060860112309456, 0.192490220069...
[circular dependencies](http://en.wikipedia.org/wiki/Circular_dependency). Learn when they are bad (and when they are [not](http://beust.com/weblog/archives/000208.html)), and consider a tool like [JDepend](http://www.google.ca/search?q=JDepend&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a) or [SonarJ](http://www.hello2morrow.com/products/sonargraph) that will help you eliminate them.
[ 0.1631029099225998, -0.11004441231489182, 0.5602594614028931, -0.08853191137313843, -0.019786102697253227, -0.38622480630874634, 0.05436479300260544, -0.1989830583333969, -0.47277429699897766, -0.36195889115333557, -0.029426835477352142, 0.6440332531929016, -0.35913288593292236, 0.05327988...
I have a project that I'm currently working on but it currently only supports the .net framework 2.0. I love linq, but because of the framework version I can't use it. What I want isn't so much the ORM side of things, but the "queryability" (is that even a word?) of Linq. So far the closest is [llblgen](http://www.llblgen.com/defaultgeneric.aspx) but if there was something even lighter weight that could just do the querying for me that would be even better. I've also looked at [NHibernate](http://www.hibernate.org/343.html) which looks like it could go close to doing what I want, but it has a pretty
[ 0.4899694323539734, 0.059266120195388794, 0.09093810617923737, -0.08583458513021469, -0.5254276990890503, -0.31429237127304077, 0.22471261024475098, 0.05772764980792999, 0.06915640830993652, -0.6808874011039734, 0.290374755859375, 0.36191433668136597, -0.08359023928642273, 0.10734547674655...
steep learning curve and the mapping files don't get me overly excited. If anyone is aware of something that will give me a similar query interface to Linq (or even better, how to get Linq to work on the .net 2.0 framework) I'd really like to hear about it. Have a look at this: <http://www.albahari.com/nutshell/linqbridge.html> Linq is several different things, and I'm not 100% sure which bits you want, but the above might be useful in some way. If you don't already have a book on Linq (I guess you don't), then I found "Linq In Action" to be be good.
[ 0.2971135973930359, -0.14536035060882568, 0.00005415422856458463, 0.3273846507072449, -0.13507556915283203, -0.2892759144306183, -0.013706328347325325, 0.3068554401397705, 0.0016274499939754605, -0.4826456308364868, 0.18662574887275696, 0.37283629179000854, 0.15983858704566956, -0.20134574...
Searching for some sample code for converting a point in WGS84 coordinate system to a map position in Google Maps (pixel position), also supporting zoom levels. If the codes is well commented, then it can also be in some other language. You can also point me to a open source Java project :) Some resources found: [OpenLayer](http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer) implementation. [JOSM](http://josm.openstreetmap.de/browser/trunk/src/org/openstreetmap/josm/data/projection) project Excellent [Java Map Projection Library](https://github.com/OSUCartography/JMapProjLib) from JH LABS. This is a pure java PROJ.4 port. Does projection from WGS84 to meters. From there it's quite straightforward to convert meters to tile pixels. [Tile utility code in Java](http://web.archive.org/web/20110809084551/http://mapki.com/wiki/Tile_utility_code_in_Java) on mapki.com (great resource for google map
[ -0.045179951936006546, -0.06565026193857193, 0.615648627281189, 0.0902949795126915, -0.11291538178920746, -0.015850774943828583, 0.13329929113388062, -0.4148935079574585, -0.18839792907238007, -0.7670185565948486, 0.2598721385002136, 0.10565782338380814, 0.030658453702926636, -0.1955913901...
developers)
[ 0.1428089141845703, 0.03620770573616028, 0.01925634779036045, 0.1938060075044632, -0.12592023611068726, 0.3810478150844574, 0.07166152447462082, -0.502429187297821, -0.09084691852331161, -0.11013905704021454, -0.29092997312545776, 0.6840068101882935, -0.28655385971069336, 0.289766162633895...
We have a custom-built Flash-based video player that I maintain, and it needs to support preroll ads and ideally both progressive video playback and streaming depending on a server switch. I've been working with the flvPlayback component but am finding myself a little out of my depth. Are there any good tutorials or resources for understanding the difference between netstream and flvPlayback? Or is one part of the other? Have googled without success. For the preroll ads we'll probably use DART In-Stream, which is part of the reason I feel I'm losing a grip on the best way to structure this thing. Any
[ 0.5155193209648132, -0.1787620633840561, 0.6040986180305481, 0.10760929435491562, 0.03668845072388649, -0.3686359226703644, -0.1033988893032074, -0.16440646350383759, -0.18635615706443787, -0.4145035445690155, 0.2397831827402115, 0.8363330960273743, -0.055129773914813995, -0.14543980360031...
help with best practices or links most appreciated - ta! EDIT - Update: I wrote a player by hand and got it more or less working with everything it needed to do, but we did migrate to JW Player across all the web properties in the end, about six months later. It's very reliable and well-supported, it integrated with the DART system well, and the designers found it easy to skin. I would definitely have a look at the JW Flash Media Player: <http://www.jeroenwijering.com/?item=JW_FLV_Player> It's Open Source, and I found the Source quite clean and easy to understand, it also supports playlists. I don't
[ 0.32512104511260986, -0.14679914712905884, 0.4315856695175171, -0.16792425513267517, -0.22564920783042908, -0.39510810375213623, 0.14068815112113953, -0.16662126779556274, -0.3504498600959778, -0.5789088606834412, 0.30530017614364624, 0.8374859690666199, -0.006520586088299751, -0.106363803...
know the DART In-Stream stuff, but maybe you could "creatively use" the playlist feature to achieve that? Source Code is available here: <http://code.jeroenwijering.com/trac/>
[ 0.33899688720703125, -0.2528517544269562, -0.16252195835113525, -0.003341239644214511, 0.1958644837141037, -0.42728033661842346, 0.5314728021621704, -0.16698113083839417, -0.09013509750366211, -0.2833532392978668, 0.08101923763751984, 0.5033169984817505, -0.19945256412029266, -0.3795790672...
What is the best way to verify/test that a text string is serialized to a byte array with a certain encoding? In my case, I want to verify that an XML structure is serialized to a byte array with the UTF-8 encoding which is of variable character length. As an example, my current ugly procedure is to inject a character known to require two bytes into the structure before serializing, then replacing the two-byte character with an ASCII character and comparing the serialized array lengths. This should yield two serialized arrays where the array containing the two-byte characters should have length
[ 0.23918040096759796, 0.18505166471004486, 0.06559263914823532, 0.2539348304271698, -0.1853339821100235, -0.24338753521442413, 0.010999815538525581, -0.13200624287128448, -0.09469567239284515, -0.5585727095603943, -0.01116787176579237, 0.46102550625801086, -0.21796439588069916, -0.039716843...
+1. Plus if the solution is elegant for Java. I can't think of any elegant way to seek for a byte sequence in a byte array. (Could be used to seek for a known byte sequence representing the desired character representation in UTF-8.) Perhaps you could deserialise the byte array using a known encoding and ensure that (a) it doesn't throw any exceptions, and (b) deserialises to the original string. It seems that from your description of the scenario, you may not have the original string readily available. Might there be a way to create it?
[ 0.24104291200637817, -0.306115984916687, 0.14039595425128937, -0.039731111377477646, -0.043017320334911346, -0.15892674028873444, 0.3645361363887787, -0.29288995265960693, -0.09639838337898254, -0.48279377818107605, -0.14318251609802246, 0.42135170102119446, -0.7007100582122803, -0.2132194...
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox control? I know the inherited Control class has the event, but it's not exposed in TextBox. Is there a way to override the event handler? I also tried the OpenNETCF TextBox2 control which does have the MouseDown event exposed, but no matter what I do, it doesn't fire the handler. Any suggestions? --- > What kind of crazy mobile device do > you have that has a mouse? :) Yes, windows mobile does not have an actual mouse, but you are mistaken that Windows Mobile .NET do not support the Mouse events. A
[ 0.043241024017333984, -0.18693609535694122, 0.01825486309826374, 0.2658703327178955, 0.2558596134185791, -0.2582862675189972, 0.4130033850669861, 0.007253902964293957, -0.24155472218990326, -0.5712065100669861, 0.07623772323131561, 0.7297595143318176, -0.40907493233680725, -0.2203911989927...
click or move on the screen is still considered a "Mouse" event. It was done this way so that code could port over from full Windows easily. And this is not a Windows Mobile specific issue. The TextBox control on Windows does not have native mouse events either. I just happened to be using Windows Mobile in this case. Edit: And on a side note...as Windows Mobile is built of the WindowsCE core which is often used for embedded desktop systems and Slim Terminal Services clients or "WinTerms" it has support for a hardware mouse and has for a long time.
[ -0.12761355936527252, -0.303603857755661, 0.6777737140655518, 0.017601562663912773, 0.18951302766799927, -0.0859682559967041, 0.2773899734020233, 0.3139452040195465, -0.3403041362762451, -0.820881187915802, -0.06853429973125458, 0.3737104535102844, -0.1511916071176529, 0.09783431142568588,...
Most devices just don't have the ports to plug one in. --- > According to the .Net Framework, the > MouseDown Event Handler on a TextBox > is supported. What happens when you > try to run the code? Actually, that's only there because it inherits it from "Control", as does *every* other Form control. It is, however, overridden (and changed to private I believe) in the TextBox class. So it will not show up in IntelliSense in Visual Studio. However, you actually can write the code: ``` textBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textBox1_MouseDown); ``` and it will compile and run just fine, the only problem is that textBox1\_MouseDown() will
[ -0.1314009428024292, 0.003966317977756262, 0.5476647019386292, -0.02821224555373192, 0.43727678060531616, -0.5456818342208862, 0.5271400213241577, -0.12573812901973724, 0.08707287907600403, -0.9760191440582275, -0.15853199362754822, 0.7959330677986145, -0.4436681568622589, -0.0842998623847...
not be fired when you tap the TextBox control. I assume this is because of the Event being overridden internally. I don't even want to change what's happening on the event internally, I just want to add my own event handler to that event so I can fire some custom code as you could with any other event. Looks like you're right. Bummer. No MouseOver event. One of the fallbacks that always works with .NET, though, is P/Invoke. Someone already took the time to do this for the .NET CF TextBox. I found this on CodeProject: <http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx> Hope this helps
[ 0.414634108543396, -0.2689764201641083, 0.19740429520606995, -0.036295413970947266, 0.035203129053115845, -0.53856360912323, 0.6451734900474548, 0.01811762899160385, -0.46764466166496277, -0.584990382194519, -0.011351639404892921, 0.8317934274673462, -0.29552367329597473, -0.27657219767570...
Is there a good way for displaying unicode text in opengl under Windows? For example, when you have to deal with different languages. The most common approach like ``` #define FONTLISTRANGE 128 GLuint list; list = glGenLists(FONTLISTRANGE); wglUseFontBitmapsW(hDC, 0, FONTLISTRANGE, list); ``` just won't do because you can't create enough lists for all unicode characters. You could also group the characters by language. Load each language table as needed, and when you need to switch languages, unload the previous language table and load the new one.
[ -0.21323543787002563, 0.010294172912836075, 0.4858264923095703, 0.05916331335902214, -0.22776591777801514, 0.046840157359838486, 0.16388951241970062, 0.08831047266721725, -0.2183106243610382, -0.8540909290313721, -0.10699556022882462, 0.4983425736427307, -0.38847216963768005, -0.1122035235...
Perl has OOP features, but they are somewhat rarely used. How do you create and use Perl objects with methods and properties? You should definitely take a look at [`Moose`](http://search.cpan.org/perldoc?Moose). ``` package Point; use Moose; # automatically turns on strict and warnings has 'x' => (is => 'rw', isa => 'Int'); has 'y' => (is => 'rw', isa => 'Int'); sub clear { my $self = shift; $self->x(0); $self->y(0); } ``` Moose gives you (among other things) a constructor, accessor methods, and type checking for free! So in your code you can: ``` my $p = Point->new({x=>10 , y=>20}); # Free constructor $p->x(15);
[ 0.0707886591553688, -0.08498226851224899, 0.5742006897926331, 0.06714879721403122, -0.23721440136432648, 0.010755864903330803, 0.26939231157302856, -0.19106654822826385, -0.46123379468917847, -0.40917935967445374, -0.17233164608478546, 0.27841129899024963, -0.5364683270454407, -0.256928503...
# Free setter print $p->x(); # Free getter $p->clear(); $p->x(15.5); # FAILS! Free type check. ``` A good starting point is [`Moose::Manual`](http://search.cpan.org/perldoc?Moose::Manual) and [`Moose::Cookbook`](http://search.cpan.org/perldoc?Moose::Cookbook) If you just need the basic stuff you can also use [`Mouse`](http://search.cpan.org/perldoc?Mouse) which is not as complete, but without most of the compile time penalty.
[ 0.4260573089122772, 0.10054796934127808, 0.34702393412590027, 0.34853890538215637, -0.13692490756511688, -0.4095906615257263, 0.34489938616752625, -0.4537923038005829, -0.18287304043769836, -0.48691317439079285, -0.5335094332695007, 0.520512580871582, -0.5479792356491089, -0.20700812339782...
Is there some means of querying the system tables to establish which tables are using what locking schemes? I took a look at the columns in **sysobjects** but nothing jumped out. aargh, just being an idiot: ``` SELECT name, lockscheme(name) FROM sysobjects WHERE type="U" ORDER BY name ```
[ 0.25802740454673767, 0.27496111392974854, 0.21566368639469147, 0.135611429810524, 0.11826533824205399, -0.11528531461954117, 0.29967978596687317, -0.02615255117416382, -0.5701134204864502, -0.3478791415691376, -0.00022186627029441297, 0.373717725276947, -0.30978840589523315, 0.139621257781...
When using IE, you cannot put an absolutely positioned div over a select input element. That's because the select element is considered an ActiveX object and is on top of every HTML element in the page. I already saw people hiding selects when opening a popup div, that leads to pretty bad user experience having controls disappearing. FogBugz actually had a pretty smart solution (before v6) of turning every select into text boxes when a popup was displayed. This solved the bug and tricked the user eye but the behavior was not perfect. Another solution is in FogBugz 6 where they no more
[ 0.1639977991580963, -0.2986908555030823, 0.6703435182571411, -0.019805269315838814, -0.22267918288707733, -0.36011385917663574, 0.4572121202945709, 0.014031020924448967, 0.0310504212975502, -0.9522525072097778, -0.10271153599023819, 0.5008370280265808, -0.6570175290107727, -0.0622203424572...
use the select element and recoded it everywhere. Last solution I currently use is messing up the IE rendering engine and force it to render the absolutely positioned `<div>` as an ActiveX element too, ensuring it can live over a select element. This is achieved by placing an invisible `<iframe>` inside the `<div>` and styling it with: ```css #MyDiv iframe { position: absolute; z-index: -1; filter: mask(); border: 0; margin: 0; padding: 0; top: 0; left: 0;
[ -0.01076209545135498, -0.1723693162202835, 0.6888870596885681, -0.14779026806354523, 0.20375409722328186, -0.14721912145614624, 0.2850915789604187, -0.0035808219108730555, 0.2632347345352173, -0.9000355005264282, -0.40227776765823364, 0.2676953971385956, -0.3833256959915161, 0.179238319396...
width: 9999px; height: 9999px; overflow: hidden; } ``` Does anyone have an even better solution than this one? EDIT: The purpose of this question is as much informative as it is a real question. I find the `<iframe>` trick to be a good solution, but I am still looking for improvement like removing this *ugly useless tag* that degrades accessibility. I don't know anything better than an Iframe But it does occur to me that this could be added in JS by looking for a couple of variables 1. IE 6 2. A high Z-Index (you tend to have to set
[ 0.09988497197628021, 0.0866251215338707, 0.4327996075153351, 0.07132608443498611, -0.2517491281032562, -0.03847424313426018, 0.3976590037345886, 0.1318991631269455, -0.23847411572933197, -0.711502730846405, -0.13186661899089813, 0.3510202169418335, -0.079715795814991, -0.059037286788225174...