text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I'm learning MVC and am having trouble deciding when I should create a new controller versus just adding an action and view associated with an existing controller. On the one hand, Single Responsibility would seem to say a controller should be limited to a few actions. When I try this, though, the number of classes gro...
[ -0.053309544920921326, -0.21972531080245972, 0.3488384783267975, 0.26841309666633606, 0.04404475912451744, -0.015106098726391792, 0.20009900629520416, -0.20256127417087555, -0.35166308283805847, -0.6960315108299255, 0.02108020707964897, 0.5843357443809509, -0.2137000858783722, 0.0022286372...
there was 1 class, there would be 3-6. Is there any good rule of thumb on this? I think you need to be pragmatic about it. I'm working on a project that consists of a StatsController. The number of actions is continuously growing (RandomStat, MostPopular, MostViewed, MostVoted, etc...) the list goes on and on. These ...
[ 0.32303017377853394, -0.39673200249671936, -0.05357303470373154, 0.5334998369216919, -0.30227795243263245, 0.17228835821151733, 0.05112680047750473, -0.03868044540286064, -0.4814679026603699, -0.6828324198722839, 0.2586557865142822, -0.1263221949338913, -0.08513353019952774, 0.149755120277...
LoginController, PasswordController, and ProfileController all rely on the same objects, why break them apart?
[ 0.20260979235172272, 0.17486751079559326, -0.10264372080564499, 0.6302626132965088, 0.18416434526443481, -0.22076432406902313, 0.2531755566596985, 0.09636247158050537, -0.29071444272994995, -0.6725448369979858, 0.0019737074617296457, 0.39004576206207275, -0.2728201448917389, 0.176006823778...
I'm interested in speed, not good looking code, that is why I'm using array and not list(of integer). I have an array looking like: 0,1,0,1,1,0,1,0,1,1,1,0,0,1 I'm interesting in the position of each number so I can later pick one randomly. so what I do is looping through the array to take position number of each 1 ...
[ 0.4270227253437042, 0.03791392594575882, 0.3376672565937042, -0.02817578800022602, -0.40929892659187317, 0.4201752841472626, 0.08134571462869644, -0.7193722724914551, -0.2395055741071701, -0.32172900438308716, 0.28841716051101685, 0.4502828121185303, -0.3949670195579529, 0.2689366340637207...
{0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1} Dim ar() As Integer = Nothing Dim arCount As Integer = -1 For x = 1 To arIn.GetUpperBound(0) If arIn(x) = 1 Then arCount += 1 End If Next If arCount > -1 Then 'using redim preseve is slower
[ 0.2004929780960083, -0.25070416927337646, 0.7993478775024414, -0.23375113308429718, -0.38002654910087585, 0.03964942321181297, 0.4313000440597534, -0.42486095428466797, -0.03661687672138214, -0.2999124228954315, -0.20446881651878357, 0.8149989247322083, -0.32868096232414246, 0.144768655300...
than the loop above ReDim ar(arCount) arCount = 0 For x = 1 To arIn.GetUpperBound(0) If arIn(x) = 1 Then ar(arCount) = x arCount += 1 End
[ 0.08850263059139252, -0.14390957355499268, 0.5624408721923828, 0.02452249452471733, -0.2492215782403946, -0.1392974853515625, 0.3921900689601898, -0.6976785659790039, 0.009858776815235615, -0.2123904526233673, -0.13386653363704681, 0.7462214827537537, -0.4150846302509308, 0.090348102152347...
If Next End If Return ar End Function ``` **\* EDIT \*** current solution(10% to 15% faster) is now ``` Private Function theThing() As Integer Dim ar() As Integer = {0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1} Dim arLenght As Integer = ar.GetUpperBound(0) Dim arCount As Integer = 0 D...
[ -0.11802370101213455, -0.0820956751704216, 1.2086200714111328, -0.3539874255657196, -0.002176831942051649, 0.3527551293373108, 0.3654431104660034, -0.7426958680152893, -0.12528766691684723, -0.44808441400527954, -0.22100482881069183, 0.7256063222885132, -0.2649938762187958, 0.1628852337598...
Then ar(arCount) = x arCount += 1 End If Next dim r As New Random() Return ar(r.Next(arCount)) End Function ``` I don't think it can be optimized more than that, unless someone find a way to do exactly what the solution does but way faster Before this question, my whole ...
[ -0.04774513095617294, -0.11210876703262329, 0.6673611402511597, -0.20472103357315063, 0.011854314245283604, -0.046308066695928574, 0.3426509499549866, -0.5978389978408813, -0.13173724710941315, -0.6966763138771057, 0.10418369621038437, 0.5891557931900024, -0.22694532573223114, 0.0942008420...
all the time, a 21% increase, thanks! Few tips on the original algorithm: 1. Try storing the results of arIn.GetUpperBound(0) in a variable. I don't know how VB makes it's loops, but there is a chance that the function gets called once every iteration. You should check that though. 2. That `If arCount > -1` is always ...
[ 0.39915502071380615, -0.19484557211399078, 0.10670929402112961, 0.27388012409210205, -0.17681756615638733, 0.04404153302311897, 0.34750786423683167, -0.2885109782218933, -0.16765524446964264, -0.4269311726093292, 0.31836649775505066, 0.8169663548469543, -0.29997149109840393, 0.019746869802...
C# since I know it better. You should be able to understand: ``` public static int GetRandomSetBit(int[] AllBits) { // Perhaps check here if AllBits is null/empty. I'll skip that for now. int L = AllBits.Length; int SetBitCount = 0; // No point to save a few bytes here. Also - you can make a global a...
[ -0.04080689698457718, -0.18700428307056427, 0.29505226016044617, -0.09004975110292435, 0.0913592055439949, -0.11763112992048264, 0.24221311509609222, 0.08987227082252502, -0.46876877546310425, -0.3595350384712219, -0.24668893218040466, 0.616881251335144, -0.3616168797016144, -0.19016902148...
issues (if you use several threads). int[] GoodPositions = new int[L]; for ( int i = 0; i < L; i++ ) if ( AllBits[i] != 0 ) { GoodPositions[SetBitCount] = i; SetBitCount++; } Random r = new Random(); // Should use one global instance
[ -0.3377918303012848, -0.21797065436840057, 0.23178744316101074, 0.06360755860805511, 0.11783400177955627, 0.12448172271251678, 0.0838954895734787, -0.2218852937221527, -0.5832231044769287, -0.5965079665184021, 0.08525824546813965, 0.6855553984642029, -0.5827645659446716, 0.0176867116242647...
return GoodPositions[r.Next(SetBitCount)]; } ``` I'm afraid it won't get any better than that. Not unless you can somehow change the inputs/outputs or requirements.
[ 0.18932579457759857, 0.26461467146873474, 0.250112920999527, -0.24025565385818481, 0.0818239226937294, -0.19885766506195068, 0.2353954315185547, -0.009073375724256039, 0.05612686276435852, -0.7548835873603821, -0.2728058397769928, 0.6976329684257507, -0.4344766139984131, 0.0100536830723285...
Hi I'm using ms2005 for a simple calendaring system. We have three 'legacy' tables: Groups, Units and Staff. I need to give each record in the tables a unique identifier (carrying across all 3 tables). What would be best way to approach this? I am using NHibernate and was was wondering whether that could do it for me...
[ 0.01614728383719921, 0.048156607896089554, 0.7168632745742798, 0.057195838540792465, -0.38045215606689453, 0.13006968796253204, -0.08975208550691605, -0.16341568529605865, -0.24499349296092987, -0.528649091720581, 0.0798390731215477, 0.052899185568094254, 0.00594445550814271, 0.43772795796...
When writing plugins for media center your plugin is hosted in `ehexthost.exe` this exe gets launched from `ehshell.exe` and you have no way of launching it directly, instead you pass a special param to `ehshell.exe` which will launch the plugin in a separate process. When we are debugging [media browser](http://code....
[ 0.5489284992218018, 0.04189349710941315, 0.6758447289466858, 0.14397874474525452, -0.20399339497089386, -0.20346979796886444, -0.2402261197566986, -0.08264261484146118, -0.23644408583641052, -0.6048134565353394, -0.29429519176483154, 0.6733920574188232, -0.212187260389328, 0.16733670234680...
the child process automatically. Can this be done? If there is a plugin for VS that allows me to achieve this functionality I would be happy with it. **EDIT** I ended up going with the following macro: ``` Public Sub CompileRunAndAttachToEhExtHost() DTE.Solution.SolutionBuild.Build(True) DTE.Solution.So...
[ 0.10681388527154922, 0.08474624902009964, 0.4686856269836426, -0.0911129042506218, 0.31800174713134766, 0.25984451174736023, 0.37859925627708435, -0.2805311679840088, 0.09975748509168625, -0.7199593782424927, -0.12596385180950165, 0.44412997364997864, -0.24226346611976624, 0.32576552033424...
Try For Each proc As EnvDTE.Process In DTE.Debugger.LocalProcesses If (proc.Name.IndexOf("ehexthost.exe") <> -1) Then proc.Attach() Exit Sub End If
[ -0.46465620398521423, -0.22549855709075928, 0.4777962565422058, -0.291705846786499, 0.41694581508636475, 0.060590144246816635, 0.05672040581703186, -0.40776029229164124, -0.02415337786078453, -0.5101953148841858, -0.5449098944664001, 0.255953311920166, -0.32409924268722534, 0.1146751716732...
Next Catch e As Exception ' dont care - stuff may be busy End Try Threading.Thread.Sleep(100) Loop End Sub ``` Also, I outlined the process on how to [get this going](http://www.samsaffron.com/archive/2009/01/28/Simpler+debugging+of+Vista+Media+Center+plugins) on my blog. I wo...
[ 0.2469421774148941, -0.16955609619617462, 0.45147639513015747, -0.09662667661905289, 0.04849710687994957, -0.48238876461982727, 0.45992186665534973, -0.06862204521894455, -0.4366452693939209, -0.5171011090278625, -0.27073103189468384, 0.4028805196285248, -0.38256314396858215, 0.02489268966...
works pretty well for me and it's really easy. ``` For Each process In DTE.Debugger.LocalProcesses If (process.Name.IndexOf("aspnet_wp.exe") <> -1) Then process.Attach() Exit Sub End If Next ```
[ -0.2624070644378662, -0.1565159559249878, 0.5410301089286804, -0.3212587237358093, 0.18804553151130676, 0.0213156808167696, 0.09360994398593903, -0.24458105862140656, -0.3918013572692871, -0.8228545784950256, -0.26267772912979126, 0.525398850440979, -0.17617332935333252, 0.3321810066699981...
As probably many people around here I read a few webcomics. [Drowtales](http://www.drowtales.com) is my favorite, but that's besides the point. For a long time a thought has been nagging me at the back of my head: webcomics are drawn pictures. They are not photographs. There should be a lot of redundancy (less colors,...
[ 0.47926366329193115, 0.03249761834740639, 0.23453354835510254, 0.5528416037559509, -0.39266037940979004, -0.13347533345222473, -0.14622509479522705, 0.5625718832015991, -0.5670977234840393, -0.8385038375854492, -0.22127306461334229, 0.24784506857395172, -0.025108041241765022, 0.28479611873...
in data compression, so my own meager attempts at finding some better algorithm have been fruitless. Best I could find was [Pngcrush](http://pmt.sourceforge.net/pngcrush/), but it still is way behind JPEG in terms of compression. I would like to hear an expert opinion on this. Is this idea of mine foolish and doomed t...
[ 0.28254541754722595, 0.25393226742744446, 0.05238380283117294, 0.22348366677761078, -0.2769557237625122, -0.10158584266901016, -0.014591841958463192, 0.31586748361587524, -0.26830512285232544, -0.6805736422538757, -0.21055154502391815, 0.3894670903682709, 0.010968274436891079, 0.1234889551...
they should be easily compressible. **Is it not possible to somehow compress them so that they would be both lossless AND smaller than JPEG?** Or at the very least compress them better than JPEG while still retaining the quality. Since they would be for **web** the specialized compressor should still probably emit PNG...
[ 0.1281985491514206, -0.14459188282489777, 0.376474529504776, 0.21675363183021545, -0.0861382931470871, -0.0801476240158081, -0.13959194719791412, -0.0062434859573841095, -0.46764644980430603, -0.8219944834709167, -0.2641928493976593, 0.5667510628700256, -0.0923890545964241, 0.0187563356012...
you mentioned. However, these solid areas are then refined using various techniques, from hand touching using airbrush tools to overlaying graduated fills, dodging and burning tools, etc. The result is an image which is more like a natural image - which is what comic artists are striving for of course - and thus it co...
[ 0.010738203302025795, -0.11485177278518677, 0.44685715436935425, 0.5741064548492432, -0.07177084684371948, 0.03179005905985832, -0.3078155815601349, -0.10983143001794815, -0.2287723273038864, -0.7107389569282532, 0.0002488143800292164, 0.5327319502830505, 0.11354387551546097, -0.1963755339...
I need to access the crypto functions of OpenSSL to encode Blowfish data in a CBC streams. I've googled and found some Blowfish libraries (hand written) and some OpenSSL wrappers (none of the seem complete.) In the end, I need to access the certain OpenSSL functions, such as the full blowfish.h library of [commands](h...
[ 0.47551238536834717, 0.22891360521316528, 0.17483898997306824, 0.12388536334037781, -0.14699940383434296, -0.3371735215187073, 0.04234881326556206, 0.021773183718323708, 0.028182554990053177, -0.410597562789917, -0.0218167994171381, 0.6812210083007812, -0.24248665571212769, -0.018711797893...
would be compile time errors into runtime segfaults. If you're looking to write your own extension, SIP is very nice. SWIG is very general, but has a larger following. Of course, the first thing you should be doing is seeing if you really need to interface. Have you looked at PyCrypto?
[ 0.16548992693424225, -0.18444804847240448, 0.22427774965763092, -0.0015997346490621567, -0.09759577363729477, -0.1626841276884079, 0.06268265098333359, 0.4648387134075165, -0.38681837916374207, -0.5050491094589233, 0.053305577486753464, 0.6120938062667847, -0.2995368242263794, -0.267364829...
When I retrieve any Scalar value from the database, I usually write code like this for nullable fields. ``` cmd.ExecuteScalar() == DBNull.Value ? 0 : (int)cmd.ExecuteScalar() ``` But I don't like it because it executes the Executescalar statement twice. It's an extra trip to the server for my website and in favor of...
[ 0.09355586767196655, -0.19228291511535645, 0.45555007457733154, -0.28096702694892883, -0.009060850366950035, -0.10835421085357666, 0.35246121883392334, -0.17357175052165985, -0.26951542496681213, -0.3106507658958435, 0.0920971930027008, 0.6253429055213928, -0.5060775876045227, 0.2692848443...
DBNull.Value) return default(T); return (T)result; } ``` Usage becomes: ``` int value = cmd.ExecuteNullableScalar<int>(); ```
[ 0.07308726012706757, -0.3880375921726227, 0.6538169384002686, -0.4904046058654785, -0.0034834928810596466, 0.07591438293457031, 0.25930386781692505, -0.4735843241214752, -0.10159841924905777, -0.4857238233089447, -0.4025123715400696, 0.747879147529602, -0.2250249832868576, 0.50817918777465...
I'm using the following command to remove every ".dummy" directories in a folder named "Test Folder": ``` rm -rf `find "Test Folder" -type d -name .dummy` ``` However, this doesn't work since it expands to, say: ``` rm -rf Test Folder/.dummy ``` Since the whitespace is not escaped, this fails. I also tried somet...
[ 0.161069855093956, 0.21863970160484314, 0.15880446135997772, 0.031822215765714645, 0.07408632338047028, -0.06197016313672066, 0.3232755661010742, -0.2421267032623291, -0.1538727730512619, -0.4823642373085022, -0.16142965853214264, 0.651711106300354, -0.3328898549079895, 0.19921308755874634...
-0 rm -rf ``` Another choice is ``` $ find 'Test Folder' -type d -exec \'{}\' \; ```
[ -0.1539963185787201, 0.048162609338760376, 0.2388276904821396, -0.059498388320207596, 0.13330771028995514, 0.028460441157221794, 0.033020105212926865, -0.41161754727363586, 0.20042426884174347, -0.1456659734249115, -0.4643964171409607, 0.644641637802124, -0.29830247163772583, 0.11612786352...
I have inherited a project that uses the following pattern for passing parameters from the code behind to the aspx page. I know this is wrong, but I am on the fence on the best way to refactor it. Code Behind: ``` using System; using System.Web; namespace BadPassing { public partial class _Default : System.Web.U...
[ 0.34467700123786926, -0.13007275760173798, 0.18235741555690765, -0.21101878583431244, 0.05337351933121681, -0.09806028008460999, 0.4095042943954468, -0.1340777575969696, -0.2831476330757141, -0.8994474411010742, 0.15499843657016754, 0.37760886549949646, -0.15622542798519135, 0.481034129858...
protected void Page_Load(object sender, EventArgs e) { numberOne = rnd.Next(100); numberTwo = rnd.Next(100); } } } ``` ASPX Page: ``` <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BadPassing._Default" %> <!DOCTYPE html PUBLIC "-//W3C...
[ -0.09800916910171509, -0.2089560329914093, 0.370830774307251, -0.12541377544403076, 0.1716568022966385, 0.026495760306715965, 0.171418696641922, -0.32577094435691833, -0.3396064043045044, -0.41818150877952576, -0.389822393655777, 0.638332724571228, -0.24635553359985352, -0.0149532686918973...
%>%2B<%=this.numberTwo %>"> Add <%=this.numberOne %> and <%=this.numberTwo %> using google. </a> </div> </form> </body> </html> ``` My understanding is that the numberOne and numberTwo are not thread-safe, and could cause incorrect behavior if two people loaded the page at the same time. F...
[ 0.09259695559740067, 0.1125926747918129, 0.27877140045166016, -0.04705924913287163, -0.08233215659856796, -0.05271148309111595, 0.5821377635002136, 0.02860378287732601, -0.2070358693599701, -0.7173049449920654, -0.11773855984210968, 0.2483072131872177, -0.4238206446170807, 0.07741579413414...
you best refactor this code? On a side note, is it incorrect to store stateless page-level services (like Random) as member variables of the page class? This code is ok. The member variables are instantiated every time the page loads, as a new instance of a class is created on every page load. If the variables were st...
[ 0.04346272349357605, -0.10733511298894882, 0.1785314530134201, 0.42446693778038025, -0.26545432209968567, -0.20612278580665588, 0.37076982855796814, -0.11133867502212524, -0.5005530118942261, -0.5668573975563049, 0.19847308099269867, 0.5257205963134766, -0.3583012521266937, 0.2775931954383...
different requests.
[ 0.46425172686576843, -0.10119666159152985, 0.14743772149085999, 0.25528591871261597, -0.3385164141654968, 0.34572023153305054, -0.08689837157726288, -0.22864234447479248, -0.27703505754470825, -0.5023856163024902, 0.14097747206687927, 0.37030673027038574, -0.18054406344890594, 0.1532485485...
When I create an application on my laptop it compiles and renders just fine. If I compile the page and put it on a server to host it, it still renders just fine on multiple computers. However, if I transfer the code to my desktop and run it on my desktop the size of all the fonts is all messed up. Everything is MUCH b...
[ 0.4535427689552307, 0.21294735372066498, 0.5280526876449585, -0.02327706292271614, -0.1756521314382553, 0.24697041511535645, 0.3645404875278473, 0.18860013782978058, -0.460271954536438, -1.1612285375595093, 0.17584702372550964, 0.5544182658195496, -0.3626372516155243, 0.1922750473022461, ...
code on the desktop and put it on a server it looks like the laptop version (small). Essentially I have this: ``` Laptop Hosted: small Server: small Desktop Hosted: large Server: small ``` I have checked this against IE, firefox and safari. Why does hosted mode look different? Thanks! Because you ha...
[ 0.3810406029224396, 0.0018859350821003318, 0.3098624050617218, -0.05496279522776604, -0.18824784457683563, 0.06929080188274384, 0.28487059473991394, 0.07239273190498352, -0.15949326753616333, -0.9979310035705566, -0.03633194789290428, 0.5885287523269653, -0.29758208990097046, -0.0307770743...
more liquid layout that can cope with a range of font sizes.
[ -0.5626047253608704, -0.39328470826148987, 0.4843713939189911, 0.25427931547164917, 0.08650918304920197, 0.27648696303367615, -0.20583339035511017, -0.1556052267551422, -0.14412356913089752, -1.1862534284591675, -0.437757283449173, 0.505585253238678, -0.13578511774539948, -0.22425349056720...
I have a ridiculously long xml row, it has > 800000 characters. The 'client' is also the 'server'. The OS is windows 2k8 x64. The database has plenty of memory as does the client. The problem is that once i hit some magic number of characters - exactly 43679 xml chars - the row returns what APPEARS to be ''. i call th...
[ 0.01923578605055809, 0.4737529158592224, 0.5240708589553833, -0.007459403481334448, -0.050076160579919815, 0.1818530559539795, 0.16323812305927277, 0.055679962038993835, -0.20841802656650543, -0.6250978708267212, 0.07671162486076355, 0.3483649790287018, 0.16825208067893982, 0.4540369212627...
this problem? I've actually attached to the same server with windows 2k3 and another windows 2k8 server and no issues on any other machine than this one (the actual server itself). I've also found the query results -> sql server -> results to grid and set the limit for xml to 'unlimited' but it seems to still not be '...
[ 0.12204711884260178, -0.0148788345977664, 0.4759399890899658, 0.4164547622203827, -0.04885891452431679, -0.15823757648468018, 0.45459917187690735, 0.20566426217556, -0.43999341130256653, -0.5413430333137512, -0.06608524918556213, 0.6275262832641602, -0.33624112606048584, -0.030617866665124...
the problem isn't with the conversion - i dont' actually want to convert it. the only reason i'm using convert in this example is to use len (len doesn't work on xml datatypes) so I can find how 'long' the xml is. The problem is this... ``` INSERT INTO someTableForXml(theXml) VALUES ('<this><is><some><really>long xml...
[ 0.1318424493074417, -0.0932333767414093, 0.5622273087501526, 0.012856990098953247, -0.2533968389034271, 0.11109629273414612, -0.014828309416770935, -0.09280350804328918, -0.11282692849636078, -0.8734380006790161, -0.08939889818429947, 0.3458450138568878, -0.1996498852968216, 0.219065472483...
xml" in a new tab. However for ME... Once I pass this oddly magic number it stops doing that and simply looks blank. Because you have different default font sizes and/or monitor dpi settings on the two machines? AIUI the GWT standard styles just sets font size to "small", which will be relative to the default font siz...
[ 0.07194605469703674, -0.08015048503875732, 0.6936662197113037, 0.20098745822906494, -0.280821830034256, -0.3584936261177063, -0.057181745767593384, -0.10005331039428711, -0.14183248579502106, -0.7451245784759521, -0.10922161489725113, 0.4074331223964691, -0.24334590137004852, -0.0191740505...
I have an application for Windows XP. This application is deployed with the hardware. The application is the only application that ever runs on these machines. These machines are never connected to the internet. I'm interested in instant-on (or quick-on) options that bypass the Windows XP startup for these machines. T...
[ 0.42191392183303833, 0.22190044820308685, 0.4567888379096985, 0.08654166013002396, 0.3590834438800812, -0.14901010692119598, 0.23013699054718018, 0.2541793882846832, -0.2251543253660202, -0.47076815366744995, -0.13690990209579468, 0.4672043025493622, -0.02218695729970932, 0.221540957689285...
regardless of how it was shut down. How can I achieve this? Sounds like you're looking for the [Hibernate Once, Resume Many](http://msdn.microsoft.com/en-us/library/bb499376.aspx) feature of Windows Embedded.
[ 0.5902003645896912, -0.1492489129304886, 0.35295653343200684, -0.05004342272877693, 0.0020803879015147686, -0.34295839071273804, 0.48104920983314514, 0.22104951739311218, -0.05596013367176056, -0.6450953483581543, -0.1383819431066513, 0.6947424411773682, 0.37202024459838867, 0.130662500858...
It's probably the tenth time I'm implementing something like this, and I've never been 100% happy about solutions I came up with. The reason using mysql table instead of a "proper" messaging system is attractive is primarily because most application already use some relational database for other stuff (which tends to ...
[ -0.05257003381848335, 0.251081258058548, 0.20299528539180756, 0.11070256680250168, 0.020600108429789543, -0.09629178792238235, -0.02786044031381607, 0.03292568027973175, -0.3998841941356659, -0.8766410946846008, 0.15910308063030243, 0.3894616961479187, -0.48945027589797974, -0.183383628726...
null, process_id varbinary(255) null default null, key jobs_key(process_id) ); ``` And then enqueue looks like this: ``` insert into jobs(message) values('blah blah'); ``` And dequeue looks like this: ``` begin; select * from jobs where process_id is null order by id asc limit 1; update jobs set process_id...
[ 0.06395327299833298, 0.030935663729906082, 0.36172398924827576, -0.22326132655143738, 0.24542273581027985, 0.4234330356121063, 0.24207712709903717, -0.2085491567850113, -0.33064085245132446, -0.7972997426986694, -0.21309980750083923, 0.7515553832054138, -0.342932790517807, 0.28023916482925...
queuing systems and I'm not certain what type of message you're referring to, but in the case of the dequeuing (is that a word?) I've done the same thing you've done. Your method looks simple, clean and solid. Not that my work is the best, but it's proven very effective for large-monitoring for many sites. (error loggi...
[ 0.2721375823020935, -0.09198257327079773, 0.30498844385147095, 0.42676475644111633, -0.06052528694272041, 0.013411731459200382, 0.14468926191329956, 0.21718767285346985, -0.3807884454727173, -0.5594372153282166, 0.09352825582027435, 0.421941876411438, 0.06288094818592072, -0.05530805885791...
Simple question: do I have to `delete` or `delete []` `c`? Does the language matter? ``` char c[] = "hello" ``` In c++ that is not dynamic memory allocation. No `delete[]` will be needed. Your example is basically a short-cut for this: ``` char c[6]={'h','e','l','l','o','\0'}; ```
[ -0.005206254776567221, 0.24487857520580292, 0.11604031920433044, -0.21167975664138794, 0.14701390266418457, 0.008573302067816257, 0.15989428758621216, 0.014518911950290203, -0.01799311488866806, -0.1750916689634323, -0.5002025365829468, 0.688474178314209, -0.1758357584476471, 0.01236869674...
Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them? ``` public IUserFactory { User CreateNewUser(); } public UserFactory : IUserFactory { public User CreateNewUser() { return new User();...
[ 0.011078223586082458, 0.25852498412132263, 0.2826891839504242, -0.38471725583076477, -0.07468448579311371, 0.3916361331939697, 0.5193153023719788, -0.3482579290866852, -0.011049913242459297, -1.0663535594940186, -0.04754208028316498, 0.5043340921401978, -0.8534787893295288, 0.1694333851337...
// whatever special logic it takes to make a User // below is simplification return new User(); } } ``` I don't see any special benefit to defining an interface for the factory, since you're defining a single interface for a centralized producer. Typically I find that I need to produce many dif...
[ 0.4764224588871002, 0.23145292699337006, 0.1394808143377304, 0.02693098597228527, -0.11550889909267426, 0.28765881061553955, -0.03878837078809738, -0.13654014468193054, -0.19872735440731049, -0.8577467799186707, 0.10511825233697891, 0.6172770261764526, -0.3876722753047943, 0.23938170075416...
public String getName(); public long getId(); public long getUUID(); // more biz methods on the User } ``` The factory would look like this: ``` public class UserFactory { public static User createUserFrom(Person person) { // ... return new UserImpl( ... ); } public static u...
[ -0.021555475890636444, -0.23569926619529724, 0.4300811290740967, -0.16593201458454132, 0.04559376835823059, 0.3473018705844879, 0.36939987540245056, -0.15072393417358398, -0.2265596091747284, -0.6196509003639221, -0.24141624569892883, 0.4986571967601776, -0.47879454493522644, 0.35492569208...
return new UserImpl( ... ); } private static class UserImpl implements User { // encapsulated impl with validation semantics to // insure no one else in the production code can impl // this naively with side effects } } ``` Hope this gets the point across.
[ -0.09686128795146942, 0.15793786942958832, 0.43439552187919617, -0.31778544187545776, 0.05649148300290108, 0.007295251823961735, 0.1753430962562561, -0.19454669952392578, 0.06618057936429977, -0.42725932598114014, -0.2722025513648987, 0.6272855997085571, -0.48497554659843445, 0.03581398725...
Is it possible to have two background images? For instance, I'd like to have one image repeat across the top (repeat-x), and another repeat across the entire page (repeat), where the one across the entire page is behind the one which repeats across the top. I've found that I can achieve the desired effect for two back...
[ 0.4254220128059387, -0.10106562823057175, 0.38747304677963257, -0.1937653124332428, -0.25977104902267456, 0.12152184545993805, 0.4228477478027344, -0.045652180910110474, -0.4243091344833374, -0.6729361414909363, 0.09589817374944687, 0.4897196292877197, -0.31691837310791016, -0.111790344119...
thing and it looks like this: ```css body { background-image: url(images/bgtop.png), url(images/bg.png); background-repeat: repeat-x, repeat; } ``` [The current versions of all the major browsers now support it](http://caniuse.com/#search=multiple%20backgrounds), however if you need to support IE8 or below, ...
[ 0.4359394907951355, -0.5121690630912781, 0.5709771513938904, 0.06254184246063232, 0.018878880888223648, -0.21035055816173553, -0.018907319754362106, -0.10887391120195389, -0.2645988166332245, -0.43464675545692444, -0.19828180968761444, 0.3497892916202545, 0.043240148574113846, 0.0954001992...
It is obvious what I am trying to do below, but I get the following exception: > Unable to return a TimeSpan property value for a Duration value of 'Automatic'. I was discouraged to read that > NaturalDuration cannot be determined until after MediaOpened has occurred. ([link](http://msdn.microsoft.com/en-us/library/...
[ 0.05861740931868553, -0.20605726540088654, 0.40213119983673096, -0.26754504442214966, 0.07275864481925964, -0.4564775824546814, 0.33085668087005615, -0.14885078370571136, -0.288272887468338, -0.39643552899360657, -0.11616591364145279, 0.8327762484550476, -0.2974661588668823, 0.327956825494...
{ myMediaPlayer.Stop(); myMediaPlayer.Close(); myMediaPlayer.Open(new Uri(filename)); myMediaPlayer.Play(); return myMediaPlayer.NaturalDuration.TimeSpan.Milliseconds; } catch (Exception e) {
[ -0.030999112874269485, -0.3949306309223175, 0.6276944279670715, -0.21111291646957397, 0.4053896963596344, -0.1264972984790802, 0.1327177882194519, 0.14230364561080933, -0.06329192966222763, -0.6202791333198547, -0.3623785674571991, 0.5672385692596436, -0.2148657739162445, 0.434230238199234...
MessageBox.Show(e.Message); return -1; } } ``` > I have to come up with a contrived method to open the file, wait for the media opened event in a separate thread, then return the duration only after the event has fired That's exactly what it means, unfortunately. The below is what I just came ...
[ 0.09106185287237167, -0.1453315019607544, 0.5581501722335815, -0.3543940484523773, 0.03075013868510723, -0.07737381756305695, 0.28706952929496765, 0.03516870364546776, -0.47683706879615784, -0.47256746888160706, -0.22366324067115784, 0.658862829208374, -0.6133015751838684, 0.47618940472602...
var mediaFile = @"c:\path\to\mediafile.mp3"; var duration = GetMediaDuration(mediaFile, TimeSpan.FromMilliseconds(500)); Console.WriteLine(duration.ToString()); Console.ReadKey(); } static TimeSpan GetMediaDuration(string mediaFile) { return GetMediaDuration(mediaFile, TimeS...
[ -0.13962070643901825, -0.34723442792892456, 0.9352921843528748, -0.17070478200912476, 0.21421392261981964, 0.10463693737983704, 0.16944240033626556, -0.43736112117767334, -0.0668649971485138, -0.7008940577507019, -0.44858604669570923, 0.9618908762931824, -0.24761787056922913, 0.59745925664...
var thread = new Thread(GetMediaDurationThreadStart); DateTime deadline = DateTime.Now.Add(maxTimeToWait); thread.Start(mediaData); while (!mediaData.Done && ((TimeSpan.Zero == maxTimeToWait) || (DateTime.Now < deadline))) Thread.Sleep(100); Dispatcher.FromThread(thread).In...
[ -0.08133959025144577, -0.3625337481498718, 0.7036225199699402, -0.34591400623321533, 0.4915139079093933, 0.039446402341127396, 0.5029125213623047, -0.4054723381996155, -0.30137333273887634, -0.6146612763404846, -0.37874454259872437, 0.6850733757019043, -0.16075997054576874, 0.5824097394943...
throw new Exception(string.Format("MediaFailed {0}", mediaFile)); return mediaData.Duration; } static void GetMediaDurationThreadStart(object context) { var mediaData = (MediaData) context; var mediaPlayer = new MediaPlayer(); mediaPlayer.MediaOpened += delega...
[ 0.0929284393787384, -0.2937638461589813, 0.46158018708229065, 0.03475036472082138, -0.04701058566570282, -0.1576048880815506, 0.4239356219768524, -0.5050992965698242, -0.2665638327598572, -0.5509156584739685, -0.40572917461395264, 0.6307125687599182, -0.3476008474826813, 0.4966094493865967...
{ if (mediaPlayer.NaturalDuration.HasTimeSpan) mediaData.Duration = mediaPlayer.NaturalDuration.TimeSpan; mediaData.Success = true; mediaPlayer.Close();
[ -0.16128286719322205, -0.30204975605010986, 0.7745687365531921, -0.31660202145576477, 0.36330512166023254, -0.2797684073448181, 0.3032648265361786, -0.10922467708587646, 0.040691543370485306, -0.38393634557724, -0.6035715341567993, 0.8171508312225342, -0.058993417769670486, 0.2772815525531...
}; mediaPlayer.MediaFailed += delegate { mediaData.Failure = true; mediaPlayer.Close();
[ -0.1761166900396347, -0.23695014417171478, 0.4577066898345947, 0.006009981967508793, 0.36034446954727173, -0.09263288229703903, 0.496967613697052, -0.2107928842306137, 0.11434929072856903, -0.5976672172546387, -0.40609273314476013, 0.7070654034614563, -0.42866435647010803, 0.49235284328460...
}; mediaPlayer.Open(mediaData.MediaUri); Dispatcher.Run(); } } class MediaData { public Uri MediaUri; public TimeSpan Duration = TimeSpan.Zero; public bool Success; public bool Failure; public bool Done { get { return (Success || Failure); } } } ```
[ -0.04925774037837982, -0.31002452969551086, 0.4248519837856293, -0.1085907593369484, 0.3252326548099518, -0.0639265924692154, 0.36887291073799133, 0.02537325955927372, -0.25232401490211487, -0.5582268834114075, -0.6555044651031494, 0.8060189485549927, -0.28250548243522644, 0.53892451524734...
How do I create or use a global variable inside a function? How do I use a global variable that was defined in one function inside other functions? --- Failing to use the `global` keyword where appropriate often causes `UnboundLocalError`. The precise rules for this are explained at [UnboundLocalError on local varia...
[ -0.02241414412856102, 0.17539870738983154, 0.22711171209812164, 0.24540668725967407, 0.09439294040203094, -0.12906606495380402, 0.21276706457138062, -0.12610264122486115, -0.1270374208688736, -0.32861199975013733, -0.16893240809440613, 0.5376328229904175, -0.1451064497232437, 0.23876245319...
a value to it: ``` globvar = 0 def set_globvar_to_one(): global globvar # Needed to modify global copy of globvar globvar = 1 def print_globvar(): print(globvar) # No need for global declaration to read value of globvar set_globvar_to_one() print_globvar() # Prints 1 ``` Since it's unclea...
[ -0.39116498827934265, -0.1147870421409607, 0.30809256434440613, -0.21665240824222565, -0.1917906105518341, 0.026002081111073494, 0.06778335571289062, 0.06893496960401535, -0.39114660024642944, -0.35679006576538086, -0.22875896096229553, 0.5586464405059814, -0.8631387948989868, 0.1244041770...
a global variable across modules.
[ -0.0607006661593914, -0.24064293503761292, 0.26326969265937805, 0.19409015774726868, -0.11131853610277176, 0.09391219168901443, -0.28157830238342285, 0.06903353333473206, -0.197776198387146, -0.48462897539138794, -0.1757771223783493, 0.23996910452842712, -0.24413101375102997, 0.46777158975...
i have a c function which returns a `long double`. i'd like to call this function from python using ctypes, and it mostly works. setting `so.func.restype = c_longdouble` does the trick -- except that python's float type is a `c_double` so if the returned value is larger than a double, but well within the bounds of a lo...
[ 0.5282633304595947, 0.2977066934108734, -0.0118895024061203, -0.25990456342697144, -0.07973673939704895, 0.04550815001130104, 0.18139463663101196, -0.12219676375389099, -0.3274063467979431, -0.1442035436630249, 0.1878252476453781, 0.4483840763568878, -0.24878107011318207, 0.045486744493246...
it without modifying the C code. ctypes seems to have really bad support for `long double`s - you can't manipulate them like numbers at all, all you can do is convert them back and forth between the native `float` Python type. You can't even use a byte array as the return value instead of a `c_longdouble`, because of ...
[ 0.22367072105407715, 0.04610278457403183, 0.3393772542476654, -0.007550098933279514, -0.0947309285402298, 0.0178476981818676, -0.052953947335481644, 0.008746522478759289, -0.05827658250927925, -0.09770737588405609, 0.26590001583099365, 0.5173854827880859, -0.3426622748374939, 0.22237369418...
I'm in the process of refactoring an application and I've decided to use a mobile/embedded database. I've been reading about SQL Server Compact Edition, but I was wondering if any of you knew of any other databases that could be used and don't have huge download sizes, as my current application is about ~2MB (installe...
[ -0.14826741814613342, 0.24387666583061218, 0.7434410452842712, 0.21580325067043304, -0.028125829994678497, -0.3650384545326233, 0.013156804256141186, -0.08742404729127884, -0.34858807921409607, -0.6083774566650391, -0.05992506444454193, 0.6365528702735901, 0.029599757865071297, -0.04425634...
Framework. I believe VistaDB can be used with the Entity Framework. Also, if you do not require a relational database, you may want to consider [db4o](http://www.db4o.com/). Rob Conery writes about this [here](http://blog.wekeroad.com/blog/crazy-talk-reducing-orm-friction/). Hope this helps!
[ 0.5905764102935791, 0.2582007050514221, 0.07035130262374878, 0.23491710424423218, 0.006879215594381094, -0.5704697966575623, 0.4512612819671631, -0.2204098254442215, -0.11359921097755432, -0.24599240720272064, 0.13599029183387756, 0.5481216311454773, -0.34432658553123474, -0.05495381355285...
While working with ASP.Net Forms Authentication I came across the .ASPXAUTH cookie. I have a couple questions: * What is the purpose of this cookie? * What is the location of this cookie? The ASPXAUTH cookie is used to determine if a user is authenticated. As far as the location of the cookie, that depends on your b...
[ 0.24409547448158264, 0.19220630824565887, 0.48182836174964905, 0.17422522604465485, 0.026627423241734505, -0.19976279139518738, 0.36261117458343506, -0.010935366153717041, -0.18700465559959412, -0.6242685914039612, 0.0621093288064003, 0.37082695960998535, -0.14165683090686798, -0.027949394...
server's machine.config or web.config file) so looking at the cookie on the client won't really provide you any information. You can decrypt/view the value on the server side using: ``` HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];//.ASPXAUTH FormsAuthenticationTicket authTicket = Forms...
[ -0.13674454391002655, -0.03628075495362282, 0.5865073800086975, 0.12382786720991135, -0.1386018693447113, -0.17634271085262299, 0.6584950685501099, 0.1043449193239212, -0.4077832102775574, -0.7689331769943237, -0.07513809949159622, 0.4684840142726898, -0.18038499355316162, 0.29076558351516...
I have encountered odd behavior when using document.getElementById tonight. Duplicated in Firefox 3 and Safari. Basically, it finds the div with id "divid" in Example1. However, in Example2 it always returns null. What's going on here? ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR...
[ 0.24330958724021912, 0.161453977227211, 0.5602284669876099, -0.23248042166233063, -0.07167558372020721, -0.14336399734020233, 0.3085445463657379, -0.4064542353153229, -0.028698762878775597, -0.8362067341804504, -0.06699095666408539, 0.30341124534606934, -0.4841232895851135, 0.2542791366577...
to window.onload. Change the line to this: ``` window.onload = addelement; ```
[ 0.13646936416625977, 0.07183320075273514, 0.4160511791706085, -0.34604591131210327, 0.07254064828157425, 0.20039227604866028, 0.050120897591114044, 0.18616297841072083, -0.21865558624267578, -0.7071254849433899, -0.33713847398757935, 0.5555675029754639, -0.5601020455360413, 0.4384994208812...
I'm sure I've done this before, but can't find any example of it! Grrr... For example, I want to convert an `IList<T>` into a `BindingList<T>`: ``` public class ListHelper { public static BindingList<T> ToBindingList(IList<T> data) { BindingList<T> output = new BindingList<T>(); foreach (T it...
[ 0.20051723718643188, -0.1825273036956787, 0.14825594425201416, -0.19664481282234192, -0.30373185873031616, 0.05609471723437309, -0.10994766652584076, -0.4041265845298767, -0.23904666304588318, -0.6440341472625732, -0.12053284049034119, 0.6732653975486755, -0.8946831822395325, 0.15670745074...
{ BindingList<T> output = new BindingList<T>(); foreach (T item in data) { output.Add(item); } return output; } } ```
[ 0.21651554107666016, -0.23418833315372467, 0.4784053564071655, -0.21097113192081451, -0.13116736710071564, 0.03863002732396126, 0.1729152649641037, -0.5900943279266357, -0.17691181600093842, -0.573757529258728, -0.41822344064712524, 0.4692850708961487, -0.6804551482200623, 0.32156294584274...
I am developing a flvplayer with cocoa. I want to drag a flv file from the finder and drop it to the webview window (I use it to view the flv). But I didn't have the path of this file from finder. This is my code: ``` _ (void)showflv(nsstring*)aa { .......... //Register to accept flv drag/d...
[ 0.18742281198501587, -0.08729767799377441, 0.4951309561729431, -0.32898008823394775, -0.03824574500322342, 0.0543949194252491, 0.053304579108953476, -0.24349826574325562, -0.2614712715148926, -0.5076544880867004, -0.038179587572813034, 0.7643530964851379, -0.5704271197319031, 0.05714814364...
[self registerForDraggedTypes:dragTypes]; } _ (BOOL)performDragOperation:(id <NSDraggingInfo>)sender { NSPasteboard *pboard = [sender draggingPasteboard]; if ( [[pboard types] containsObject:NSFileContentsPboardType] ) { } return YES; } ``` I read the document about this.I find that the fun...
[ -0.13841645419597626, -0.14479419589042664, 0.38046011328697205, -0.601275622844696, -0.2920510768890381, 0.18223334848880768, 0.38061094284057617, -0.8317440748214722, -0.18135741353034973, -0.26038873195648193, -0.01622217334806919, 0.9812576770782471, -0.4727762043476105, -0.26662540435...
using the file’s contents } return YES; } ``` I can get the filecontents of this dragging file.but how to get the path? ``` NSString *fileName = [fileContents filename]; ``` I did a test, it wasn't correct. --- I did a test ,but The draggedFilePaths didn't work.I found that the code: ``` NSPasteboard ...
[ -0.00532259326428175, 0.04796291142702103, 0.4491545557975769, -0.1382865160703659, -0.054462917149066925, 0.14126771688461304, 0.4502899646759033, -0.46848049759864807, -0.2771972119808197, -0.48074769973754883, -0.024721043184399605, 0.826561450958252, -0.595746636390686, -0.205018967390...
I'm using JUnit 4.4 and Maven and I have a large number of long-running integration tests. When it comes to parallelizing test suites there are a few solutions that allow me to run each test method in a single test-class in parallel. But all of these require that I change the tests in one way or another. I really thi...
[ 0.3407711982727051, -0.0975097194314003, 0.42740270495414734, 0.021439382806420326, -0.1240796223282814, -0.12505167722702026, 0.2897126078605652, 0.235097274184227, -0.07112453132867813, -0.9235277771949768, 0.24987229704856873, 0.48372703790664673, -0.23345790803432465, 0.376192897558212...
possible to run tests in parallel without using TestNG. Actually it has been possible since 4.6, but there are a number of fixes being made in 4.7 that will make it a viable option. You may also run parallel tests with spring, which you can read about [here](http://incodewetrustinc.blogspot.com/2009/07/run-your-junit-t...
[ 0.45728549361228943, -0.38953107595443726, 0.10058136284351349, 0.27262330055236816, -0.026775280013680458, -0.09043069928884506, 0.4339973032474518, 0.295292466878891, -0.18655137717723846, -0.2731449604034424, 0.25993144512176514, 0.37313464283943176, -0.23280417919158936, 0.088973402976...
I need to create a data transfer object, which I will use for storing the records retrieved from database. In this data transfer object, I need to declare a numeric field. For that which one is better - **int** or **Integer** If I am defining the field as Integer, will there be any performance impact because of 'Integ...
[ 0.18359678983688354, 0.08323642611503601, -0.07612035423517227, 0.17566721141338348, -0.16437086462974548, -0.011639459058642387, 0.09450870752334595, -0.3601972460746765, -0.1361190527677536, -0.5441969037055969, 0.15973268449306488, 0.38154006004333496, -0.1380009949207306, 0.22659985721...
"Unable to set `null` to a primitive property". Performance is of little concern here. * if you choose `int`, you will end-up adding extra handling code; and that wouldn't benefit you much. Your code will not be clean and straight-forward, lot of boiler-plate code, and you wouldn't even gain performance. * let me mak...
[ 0.12992320954799652, 0.1698954999446869, -0.1259603500366211, 0.1969359666109085, -0.04917401075363159, -0.1450432986021042, 0.5150862336158752, -0.021666714921593666, -0.3155788779258728, -0.7342005372047424, -0.10178903490304947, 0.46263745427131653, -0.1282263547182083, 0.15120199322700...
when that field is `not null` in the database.
[ -0.1937023252248764, -0.09557104110717773, -0.043945908546447754, -0.05126839131116867, 0.24970953166484833, -0.4192708432674408, 0.10154943913221359, 0.1446913182735443, -0.07053086161613464, -0.29820218682289124, -0.6531470417976379, 0.22634056210517883, -0.1720893830060959, 0.0746754184...
How can I get the RSS feed URL for the iTunes podcasts available? I want a feed which would list down all the podcasts present on iTunes. Is that possible? Thanks. As with many things Apple creates, a very limited set of functionality is exposed to third party developers. Currently, generating RSS feeds of podcasts in...
[ 0.8223887085914612, 0.05784215033054352, -0.009077833034098148, 0.31528717279434204, 0.010200993157923222, -0.25647640228271484, 0.20838402211666107, 0.1760193109512329, -0.5796217918395996, -0.35042497515678406, 0.014774669893085957, 0.7929956912994385, -0.3118886649608612, 0.011560969986...
of thing RSS is designed to do. The list of podcasts in iTunes is enormous, and wrapping each podcast in XML tags would create an even more enormous file. RSS is best used when you need to present a list of the most recent updates to something. Encoding the entire iTumes podcast catalog in RSS doesn't fit that catagory...
[ 0.26842057704925537, -0.02549801766872406, 0.27787286043167114, 0.21783040463924408, 0.10116808116436005, -0.4190864562988281, 0.23140853643417358, 0.1070285513997078, -0.3387559950351715, -0.318869024515152, -0.11547009646892548, 0.5987573266029358, -0.23247723281383514, 0.172152012586593...
I would like to pass a COM method as a function argument but I get this error (Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86): error C3867: 'IDispatch::GetTypeInfoCount': function call missing argument list; use '&IDispatch::GetTypeInfoCount' to create a pointer to member What am I m...
[ -0.005798820871859789, 0.18546545505523682, 0.3332875072956085, -0.15837594866752625, 0.016176465898752213, 0.2351485788822174, 0.5574370622634888, -0.37442439794540405, -0.054063573479652405, -0.7096872925758362, -0.07416354864835739, 0.6327337026596069, -0.6287504434585571, 0.17764502763...
the sake of exemplification CComPtr< IDispatch > ptr; UINT u; update( ptr->GetTypeInfoCount, u ); return 0; } ``` As [morechilli](https://stackoverflow.com/users/5427/morechilli) pointed out this is a C++ issue. Here it is the solution, thanks to my colleague Daniele: ``` #include <atlbase.h> template <...
[ 0.10562250763177872, -0.06875814497470856, 0.7774125933647156, -0.08451725542545319, 0.13716129958629608, 0.02198242023587227, 0.2821826636791229, -0.5515159964561462, -0.18656308948993683, -0.801281750202179, -0.13461531698703766, 0.6253557205200195, -0.5352898836135864, 0.200651332736015...
just for the sake of exemplification CComPtr< IDispatch > ptr; UINT u; update( ptr.p, &IDispatch::GetTypeInfoCount, u ); return 0; } ```
[ 0.18273602426052094, -0.09471316635608673, 0.42155203223228455, 0.08592497557401657, 0.30398914217948914, -0.22238680720329285, 0.22124682366847992, -0.2554823160171509, -0.1877255141735077, -0.3775870203971863, -0.4297952353954315, 0.5210202932357788, -0.4664765000343323, 0.22664991021156...
RIM has released a new Blackberry JDE4.7 after releasing the Blackberry Storm. Does the Blackberry storm support programs created using the previous versions? I've heard there have been a lot of changes in this version compared to the old ones. And there have been complaints about Storm having many bugs. Should I use ...
[ 0.012039903551340103, 0.01963656209409237, 0.8854159116744995, -0.024409186094999313, 0.06391766667366028, 0.2134653478860855, 0.13254103064537048, 0.014233702793717384, -0.713434636592865, -0.3227923810482025, 0.16161490976810455, 0.6486838459968567, -0.055201832205057144, -0.016140233725...
built-in fields and managers, it's all automatic). The big things you'll need the 4.7 JDE to do include: * Responding to specific touch events (events which result in e.g. focus going to a Field, or scrolling, are automatically mapped to the older APIs) * Detecting device orientation (though again, layout is already ...
[ -0.11168438196182251, -0.045015208423137665, 0.7099741697311401, 0.2570582926273346, -0.0036437392700463533, -0.3689410090446472, 0.3085349500179291, -0.06586165726184845, -0.1776246577501297, -0.6243889331817627, -0.17136339843273163, 1.0104862451553345, -0.04162969812750816, -0.504658758...
(most people believe that the Bold and Curve are still better devices), stick with an older SDK unless you're doing a very Storm-specific application.
[ 0.4161580204963684, -0.1772899031639099, 0.10269051790237427, 0.13246561586856842, 0.10361136496067047, -0.38048624992370605, 0.553446888923645, 0.09374342113733292, -0.19452130794525146, -0.38662493228912354, -0.018785545602440834, 0.443394273519516, -0.032064154744148254, -0.242988854646...
I'm working with some code (not mine I hasten to add, I don't trust this much at all) for a class which opens a socket, makes requests and listens for responses, which is throwing an exception in a way I can't comprehend when tested in xunit. I *assume* the same exception happens "live" but the class is referenced by a...
[ 0.3801092803478241, 0.1139732077717781, 0.003441145410761237, -0.19730357825756073, -0.06671410799026489, -0.05400591716170311, 0.43817266821861267, 0.12213722616434097, -0.05395229160785675, -0.7172017693519592, -0.053369585424661636, 0.46352002024650574, 0.008202329277992249, 0.347671240...
which call close and dispose is protected on the Socket class so I'm not clear how else the object could be disposed. Further, if I merely catch and absorb the ObjectDisposedException xunit terminates when it hits the line to close the listener thread. **I just don't get how the Socket can be disposed before it's ask...
[ 0.4542292356491089, 0.3218221068382263, 0.4416548013687134, -0.3320924639701843, -0.15857534110546112, -0.1867835819721222, 0.2680323123931885, -0.17814303934574127, -0.1273801475763321, -0.532846987247467, -0.03992617875337601, 0.7194665670394897, -0.33317896723747253, 0.5869606733322144,...
private bool bInitialised; private Object InitLock = null; private Object DeInitLock = null; public Foo() { bInitialised = false; InitLock = new Object(); DeInitLock = new Object(); } public bool initialise() { if (null == InitLock) return
[ -0.13324807584285736, -0.30799978971481323, -0.06911898404359818, -0.22467480599880219, 0.03804709389805794, 0.06328033655881882, 0.6289731860160828, -0.42401304841041565, 0.21581782400608063, -0.07396937161684036, -0.48080265522003174, 0.6096881628036499, -0.6101415157318115, 0.2789774537...
false; lock (InitLock) { if (bInitialised) return false; sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 8); sock.Bind( /*...
[ -0.15749172866344452, -0.40569067001342773, 0.1819831132888794, -0.16108447313308716, 0.23350416123867035, 0.06243680417537689, 0.5772259831428528, -0.20694276690483093, -0.1757277548313141, -0.7367847561836243, -0.08618684858083725, 0.23390816152095795, -0.3265279531478882, 0.548769772052...
sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(mcIP)); tListenerThread = new Thread(new ThreadStart(listener)); tListenerThread.Start(); bInitialised = true; return true; } } ~Foo() { if (bInit...
[ 0.23022399842739105, -0.45553743839263916, 0.2294292449951172, -0.2639446556568146, 0.23198451101779938, 0.1354256570339203, 0.6096567511558533, -0.26559072732925415, -0.4463631212711334, -0.7326419949531555, -0.11953794211149216, 0.38784778118133545, -0.36460140347480774, 0.49970072507858...
deInitialise(); } private void deInitialise() { if (null == DeInitLock) return; lock (DeInitLock) { if (bInitialised) { sock.Shutdown(SocketShutdown.Both); //throws System.ObjectDisposedException
[ 0.4095195531845093, -0.5655142068862915, -0.0716291293501854, 0.0975380465388298, 0.3307064473628998, 0.20883721113204956, 0.559888482093811, -0.14910128712654114, 0.08101598918437958, -0.5879836082458496, -0.2136789709329605, 0.7991788387298584, -0.32089272141456604, 0.32092714309692383, ...
sock.Close(); tListenerThread.Abort(); //terminates xunit test! tListenerThread = null; sock = null; bInitialised = false;
[ 0.19536809623241425, -0.17070545256137848, 0.2848389446735382, -0.22069311141967773, 0.20345568656921387, -0.011376980692148209, 0.7568134665489197, -0.1799306869506836, 0.08900188654661179, -0.379523903131485, -0.26003605127334595, 0.47320669889450073, -0.45771414041519165, 0.402845650911...
} } } } ``` If this object is eligible for garbage collection and there are no other references to the Socket, then the *socket's* finalizer may well run before your object's finalizer. I suspect that's what's happened here. It's generally a bad idea (IMO) to do this much work in a finalizer. I can't reme...
[ 0.1285708099603653, 0.2924922704696655, 0.2153094857931137, -0.07856990396976471, 0.06823987513780594, -0.2954406142234802, 0.3165337145328522, 0.04436975717544556, -0.25531384348869324, -0.5848532915115356, -0.2893698215484619, 0.5662631988525391, -0.07087329775094986, 0.40373140573501587...
be the norm - a finalizer should only usually run if either the program is shutting down, or someone has forgotten to dispose of the instance to start with. (I know you clarified at the start that this isn't your code - I just thought I'd explain why it's problematic. Apologies if you already knew some/all of this.)
[ 0.40768343210220337, -0.17836205661296844, 0.06906234472990036, -0.03260499984025955, 0.025381896644830704, -0.37842005491256714, 0.44762852787971497, 0.063377246260643, -0.030802348628640175, -0.11930813640356064, -0.2595278322696686, 0.5654461979866028, -0.1988166719675064, -0.0628224983...
I am getting to grips with Windows Azure. I usually use NInject as my IoC container in web apps. However, when trying to use it within an Azure web role I get a security exception (something to do with reflection permission). Has anyone used other IoC with Azure and had succcess? I just have been prototyping with Azur...
[ 0.31558239459991455, -0.062160179018974304, -0.0777696892619133, 0.40380626916885376, -0.21505385637283325, -0.5717727541923523, -0.04455912113189697, 0.22716845571994781, -0.027217138558626175, -0.7897627949714661, 0.08429796248674393, 0.1608036309480667, -0.0039782836101949215, 0.0886489...