text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I have an array being returned but as I'm new to programming I can't work out how to read each value. Can someone please point me in the right direction? My code is below. ``` private void testToolStripMenuItem_Click(object sender, EventArgs e) { foreach (int name in getNames()) //<----I'm wrong here I guess { ...
[ 0.13905970752239227, 0.021007221192121506, 0.18382351100444794, -0.06936946511268616, -0.11396661400794983, -0.08670417219400406, 0.4393582046031952, -0.16735000908374786, -0.16556614637374878, -0.5566973686218262, -0.02142411842942238, 0.5205946564674377, -0.27209240198135376, 0.298431992...
code. So, use `List<string>` rather than `ArrayList`. ``` private void testToolStripMenuItem_Click(object sender, EventArgs e) { foreach (string name in getNames()) { MessageBox.Show(name); } } private List<string> GetNames() { var names = new List<string>(); names.Add("Kent"); return ...
[ 0.44321125745773315, 0.1721659153699875, -0.12162981927394867, -0.13596871495246887, 0.09022081643342972, 0.060912176966667175, 0.5533599257469177, -0.41197264194488525, -0.1935243010520935, -0.5632042288780212, -0.32614678144454956, 0.3718830645084381, -0.16973403096199036, 0.109880730509...
I want to implement an Observer of a Model class which does not change the Model. Thus, it should be able to use a const-Reference to access the Model. But the Registering of the Observer prohibits this. Here is how the observer pattern is implemented in my Project: ``` //Attributes of type Observable are used by cl...
[ 0.12201178818941116, -0.18531133234500885, 0.3000214695930481, 0.11483690142631531, 0.026698388159275055, 0.02139400690793991, 0.2829195261001587, -0.38736602663993835, -0.17114652693271637, -0.761000394821167, -0.058621231466531754, 0.3957599699497223, -0.8192120790481567, 0.0384045690298...
a non-const { //reference to allow Observers to register themselves. return m_Notifier; } int QueryState() const; void ChangeModel(int newState) { m_Notifier.NotifyObservers(); } private: Notifier m_Notifier; }; //This View does not Modify the Mo...
[ 0.10322292149066925, -0.35955122113227844, 0.3857649266719818, 0.07225668430328369, 0.052750829607248306, 0.13653166592121124, 0.30958330631256104, -0.19595788419246674, -0.3276676535606384, -0.5281707048416138, -0.14817388355731964, 0.3187783360481262, -0.7669258713722229, 0.2288370728492...
//should be const Model* aModel... { m_Model = aModel; m_Model->GetNotifier().AddObserver(this); //...but can't because //SetModel needs to call GetNotifier and add itself, which requires //non-const AddObserver and GetNotifier methods. } void Update() //Part of Observer-In...
[ -0.1410159468650818, -0.2771646976470947, 0.6617904901504517, -0.13436681032180786, 0.38936206698417664, -0.03271998465061188, 0.19025224447250366, -0.4106527268886566, -0.134189173579216, -0.8471478819847107, -0.1854180097579956, 0.5502214431762695, -0.5794497728347778, 0.0323814414441585...
the Model is when it wants to register with it. I feel that I can not avoid a const\_cast here, but I wanted to know if there are better solutions. Sidenote: Put another way, I don't consider the "List of Observers" which a model object manages to be part of the state of the Model. C++ can not tell the difference and ...
[ 0.02676592953503132, 0.03043929673731327, 0.31000635027885437, 0.16128051280975342, -0.07901626080274582, -0.11008135974407196, 0.26952099800109863, -0.08451711386442184, -0.2239677459001541, -0.430473655462265, -0.12939414381980896, 0.4538860619068146, -0.28525078296661377, 0.312645524740...
then make getNotifier a const method returning a non-const reference: ``` Notifier& GetNotifier() const //Is const but returns a non-const { //reference to allow Observers to //register themselves. return m_Notifier; } ``` You will then have to eithe...
[ -0.200521782040596, -0.10514777898788452, 0.4073026776313782, 0.1545109897851944, 0.021129906177520752, 0.059962499886751175, 0.137547105550766, -0.22387242317199707, -0.2551512122154236, -0.6075792908668518, -0.3801114857196808, 0.600800633430481, -0.6449095606803894, 0.2211448699235916, ...
or else own it by pointer (or smart pointer) or reference rather than by inclusion. Either way, you avoid a const\_cast. It is usually preferable to embed objects rather than point/refer to them, but if this is a case where a Notifier isn't considered part of the Model which uses it, then embedding is not essential. Ow...
[ 0.338349312543869, 0.074247345328331, -0.060133736580610275, 0.36358001828193665, 0.07982196658849716, -0.45155856013298035, -0.03745534271001816, -0.15835514664649963, -0.2101903259754181, -0.35778623819351196, -0.11864951252937317, 0.5441084504127502, -0.20018216967582703, 0.441334664821...
ways to design things (such as Vinay's addition of another class), but your comment "Is non-const because it needs to return a non-const reference" suggests to me that you can do exactly what you originally wanted, you just don't realise you can.
[ 0.6239466071128845, -0.34451383352279663, -0.28464484214782715, 0.4313771426677704, 0.1818220019340515, -0.05109882727265358, 0.3994816839694977, -0.19300901889801025, -0.19525690376758575, -0.3452768921852112, -0.0666913092136383, 0.0628901943564415, 0.006910691503435373, 0.21313163638114...
I regularly send files in Gmail to exchange files between different computers. It is cumbersome. I want quickly to send my files, such as error logs. I found a promising article [1] about Mutt, but it apparently is not what I want: > Please note that mutt is a pure MUA > and cannot send e-mail without proper > email...
[ 0.2991347908973694, 0.29876402020454407, 0.24477039277553558, -0.1334143728017807, -0.20280714333057404, -0.09168422967195511, 0.8072619438171387, 0.33663058280944824, 0.02164016291499138, -0.7976455688476562, 0.0359131284058094, 0.6220368146896362, -0.582838237285614, 0.48980778455734253,...
error logs" -a > ./log1 -a ./log2 -a ./log3 mygmail@gmail.com I would really love to do the job in terminal. It is too time-consuming to bulk-send files in Gmail. **How can I quickly send a great amount of files?** [1] <http://www.cyberciti.biz/tips/sending-mail-with-attachment.html> Mutt can be configured to use a ...
[ 0.1314992904663086, -0.276779443025589, 0.5039246678352356, 0.28389596939086914, -0.07939747720956802, -0.0845349058508873, 0.5672609210014343, -0.051173627376556396, -0.21392419934272766, -0.9319444298744202, -0.06504930555820465, 0.8083197474479675, -0.48360663652420044, -0.1629976779222...
be able to install SSMTP or ESMTP to a local folder. If you prefer scripting, [mimesend](http://cpansearch.perl.org/src/DONEILL/MIME-tools-5.427/examples/mimesend), which is one of the example programs in Perl's [MIME-tools package](http://search.cpan.org/dist/MIME-tools/), does the same thing as your mutt command and...
[ 0.3599090576171875, -0.21662205457687378, 0.39438396692276, 0.15524445474147797, 0.10160350799560547, -0.24225136637687683, 0.5647441148757935, 0.2839951813220978, -0.32360145449638367, -0.7053365111351013, -0.20420098304748535, 0.7028492093086243, -0.31891733407974243, 0.08835001289844513...
I am parsing out some emails. Mobile Mail, iPhone and I assume iPod touch append a signature as a separate boundary, making it simple to remove. Not all mail clients do, and just use '--' as a signature delimiter. I need to chop off the '--' from a string, but only the last occurrence of it. Sample copy ``` hello, ...
[ 0.5373594760894775, 0.42328184843063354, 0.20376929640769958, 0.11629370599985123, 0.11279790848493576, -0.16319739818572998, 0.34161823987960815, 0.013854295015335083, -0.21926641464233398, -0.31104379892349243, -0.06398332118988037, 0.2676958739757538, -0.4378298223018646, 0.010594073683...
in the event there is not a match. I can not get `preg_replace()` to go across more than one line. I have standardized all line endings to `\n`. What is the best suggestion to end up with `hello, this is some email copy-- check this out`, taking not, there will be cases where there is no signature, and there are of c...
[ 0.1962376981973648, 0.2530973553657532, 0.32409483194351196, -0.19163325428962708, -0.07165990769863129, 0.048743173480033875, 0.5385848879814148, -0.16214844584465027, -0.018110329285264015, -0.48208415508270264, -0.29083314538002014, 0.4335426688194275, -0.5282757878303528, -0.0491820424...
I have an xls with a pivot table using a proc to populate it. I deleted the data connection in 'admin tools - odbc - file DSN' and it still works, how is that possible? Does that mean that the recipent doesn't have to have the file DSN present in order to see data in the pivot table? That is possible because when you...
[ 0.3131103217601776, 0.15097591280937195, 0.6313263773918152, 0.10350500047206879, 0.03515984117984772, 0.02055037021636963, -0.2681058645248413, -0.05168731510639191, -0.02177068032324314, -0.4767758548259735, 0.06875459104776382, 0.24529336392879486, -0.4256666898727417, 0.034894429147243...
QueryTable. So once you successfully refresh the QueryTable for the first time, you no longer need that file DSN. So it will work event after you delete it or in some else’s machine without that DSN. On a side note when you use file DSN in a QueryTable and later if you update the FileDSN (say to a new database or any ...
[ -0.2024306058883667, -0.2601233124732971, 0.5964770913124084, 0.2638748586177826, -0.12652587890625, -0.370444118976593, 0.05940505862236023, -0.15754760801792145, -0.583878219127655, -0.8864232301712036, -0.09615537524223328, 0.5951505899429321, -0.10790648311376572, 0.28569915890693665, ...
How can I link a shared library function statically in gcc? Refer to: <http://www.linuxquestions.org/questions/linux-newbie-8/forcing-static-linking-of-shared-libraries-696714/> You need the static version of the library to link it. A shared library is actually an executable in a special format with entry points spe...
[ 0.11261576414108276, -0.151772141456604, 0.31032899022102356, 0.341575026512146, -0.1029575988650322, -0.3517346680164337, 0.03312893584370613, 0.1180950477719307, -0.4124157130718231, -0.5588299036026001, -0.3035932779312134, 0.34063977003097534, -0.4276614785194397, 0.40432479977607727, ...
use [statifier](http://statifier.sf.net) or [Ermine](http://magicErmine.com). Both tools take as input a dynamically linked executable and as output create a self-contained executable with all shared libraries embedded.
[ 0.5632535815238953, -0.31710758805274963, -0.1378447413444519, 0.24913129210472107, -0.08108045160770416, -0.103737011551857, -0.021212270483374596, -0.3058766722679138, -0.12014881521463394, -0.5381961464881897, -0.23260153830051422, 0.4771037697792053, -0.307069331407547, -0.296661525964...
I have a custom control which is part of a list. The text that it should display is set by assigning a value to its Text property. At runtime, this text is loaded from a database. I want to prepend this text with the string "Toelichting: " (Dutch for "Explanation"). I can accomplish this by setting the FormatString pro...
[ 0.25903546810150146, 0.17479906976222992, 0.3838873505592346, -0.12739548087120056, 0.04913295805454254, -0.14303672313690186, 0.38766899704933167, -0.3109548091888428, 0.021687371656298637, -0.614829957485199, 0.011712180450558662, 0.5240341424942017, -0.23252639174461365, 0.0207217764109...
add some condition-checking code to the FormatString, such that I can check if the parameter is not empty? No, there's no way to do that.
[ 0.47127237915992737, 0.19325202703475952, 0.17158925533294678, 0.3172389566898346, 0.3392164707183838, -0.23247334361076355, 0.12061524391174316, -0.060049306601285934, -0.23016057908535004, -0.29940879344940186, 0.2477591633796692, 0.37819400429725647, -0.2822498679161072, 0.1840845197439...
I'm trying to create an application to craft packets to be able to debug some gateways here, and to experiment with TCP DoS situations. Nevertheless this should be very easy, I didn't find a way to implement this for a Windows application. I started using [Impacket](http://oss.coresecurity.com/projects/impacket.html)...
[ 0.35511791706085205, 0.13788965344429016, -0.09376724809408188, 0.2552611827850342, -0.13410703837871552, -0.08122497797012329, 0.1969103366136551, 0.25236350297927856, -0.1655385047197342, -0.5569602251052856, 0.12645085155963898, 0.4732300937175751, -0.3431394100189209, 0.224624574184417...
more. But is there something similar? Any C# library I can use... I didn't find anything jet. Thanks ;) I've been trying out a few other things and got it working ... I removed the existing DispatcherServlet servlet and servlet-mapping definitions in web.xml and replaced with the DynamicMappingFilter. As a bonus, t...
[ 0.10006612539291382, -0.5882218480110168, 0.3613027334213257, 0.14778637886047363, -0.4142199158668518, -0.2768150568008423, 0.025829801335930824, 0.06022827699780464, -0.5272627472877502, -0.4558817148208618, -0.24017512798309326, 0.4825890362262726, -0.5170735120773315, 0.050072826445102...
i'm having problems running my MVC project on my server. The main project on the server has it's own web.config file (1.0 versions referenced in configsections), while the 'virtual subproject' also has one (3.5 versions referenced). I receive the following error: *Configuration Error Description: An error occurred du...
[ 0.15927420556545258, 0.20127181708812714, 0.6704082489013672, -0.2867373824119568, 0.17553405463695526, 0.034500230103731155, 0.5179619789123535, 0.04961111769080162, -0.5508504509925842, -0.6072491407394409, -0.1580018401145935, 0.31150296330451965, -0.26367634534835815, 0.359723091125488...
name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" **Subproject web.config (location: `http://servername/subproject/web.config`) section:** sectionGroup name="system.web.extensions" ...
[ -0.21444833278656006, -0.05004614219069481, 0.4432404637336731, -0.11735384911298752, 0.06457173079252243, 0.03096083179116249, 0.22626641392707825, -0.18706972897052765, -0.5190993547439575, -0.5037958025932312, -0.39446955919265747, -0.09391879290342331, -0.389548659324646, 0.50866723060...
[revised] I'm creating a TreePanel in ExtJs that is loading its children from a JSON file. I'm having trouble adding a click action to the nodes. I'm not sure whether it's added in the script creating the tree, or if its added as a property in the JSON, and if so, what the syntax would be. Any help would be appreciated...
[ -0.07251254469156265, 0.05621979013085365, 0.4363444745540619, -0.05017751082777977, -0.11103331297636032, 0.10156206786632538, 0.3005125820636749, -0.07535009831190109, -0.1597028374671936, -0.6364812850952148, -0.3274407684803009, 0.5014892220497131, -0.11135664582252502, -0.240471795201...
I would like to do something like this in ASP.Net 2.0: ``` <asp:Repeater id="myRepeater" runat="server"> <ItemTemplate> <% if (DataBinder.Eval(Container.DataItem, "MyProperty").Equals("SomeValue")) { %> <%#DataBinder.Eval(Container.DataItem, "MyProperty")%> <% } %> </...
[ 0.002841751789674163, -0.08452106267213821, 0.41647714376449585, -0.042060695588588715, 0.13092459738254547, -0.26195013523101807, 0.32554975152015686, -0.17377731204032898, -0.1722860336303711, -0.817968487739563, 0.14469903707504272, 0.3223351240158081, -0.14467710256576538, 0.0774516388...
use this: ``` <%#DataBinder.Eval(Container.DataItem, "MyProperty").Equals("SomeValue")?"<!--":""%> ``` but I was looking for a cleaner way. Is there a way to test the Container.DataItem with inline code inside a Repeater? I would do this. You bind your "visibility" function to the visible property of an asp:liter...
[ -0.13823837041854858, -0.12775933742523193, 0.5202556848526001, 0.29328277707099915, -0.08807691186666489, -0.012470699846744537, 0.17383143305778503, -0.271572470664978, -0.10572174191474915, -0.7757888436317444, 0.12472023069858551, 0.29148757457733154, -0.35841256380081177, 0.0771868526...
I have the following data : ``` SectorKey Sector foo 1 A null 2 B null ... ... ... 1 null a 2 null b 2 null c 1
[ -0.020398013293743134, 0.3473427891731262, 0.40133893489837646, -0.3884621560573578, 0.10515245795249939, 0.028324980288743973, -0.04016207903623581, 0.15219147503376007, -0.0798807367682457, -0.1969035118818283, -0.1906844675540924, 0.37844088673591614, -0.38631707429885864, 0.42299601435...
null d 2 null e ... ... ... ``` I want to update column Sector when it's null based on the value of sectorKey, ie I want Sector to be 'A' when SectorKey is 1 and 'B' when SectorKey is 2 I've tried this query : ``` update tbFoo set Sector=A.sector from tbFoo A INNER JOIN tbFoo B ON A.SectorKe...
[ -0.16118982434272766, -0.19875741004943848, 0.2982686758041382, -0.5147064924240112, -0.19325591623783112, 0.17770862579345703, 0.12801237404346466, -0.21917931735515594, -0.17784029245376587, -0.6574791669845581, -0.1395215541124344, 0.4863657057285309, -0.7652483582496643, 0.260059595108...
but it doesn't seem to be a valid syntax. I don't understand why SQLServer complains about an ambiguous naming since I've got all my tables aliased. I've found [this thread](https://stackoverflow.com/questions/440702/how-can-i-update-a-field-in-one-table-with-a-field-from-another-table-sql), and I feel like I'm doing ...
[ 0.043196335434913635, 0.1166696548461914, 0.3489310145378113, -0.19997115433216095, -0.20239977538585663, -0.09449414163827896, 0.030529053881764412, 0.04962444677948952, -0.34889236092567444, -0.41540563106536865, -0.19431015849113464, 0.3381677567958832, -0.3873075842857361, 0.3210123777...
near 'A' Any ideas on what may be happening, and to fix this? I'm using SQLServer 2008. **EDIT** I've not shown the total data of my table. I don't have only two cases (A and B), but rather a few thousands of cases. So an explicit case is not an option Use the alias in the first part of your update query: ``` update...
[ -0.4422711730003357, 0.0022685681469738483, 0.5697470903396606, -0.2098669409751892, -0.02699548564851284, 0.21257609128952026, -0.018061215057969093, 0.008599506691098213, -0.02206219919025898, -0.5970501899719238, 0.18561671674251556, 0.36205101013183594, -0.34725284576416016, 0.22079740...
I have to insert some data periodically in my SQL Server database. But the feeds where I read the data repeats some data that was inserted before. When I use Linq-to-SQL to insert into the DB either some data is duplicated, or a primary key violation exception is raised, depending on the primary key. How to insert the...
[ 0.4488620162010193, 0.12896178662776947, 0.2466140240430832, 0.1966802179813385, -0.04556417465209961, -0.0386798158288002, 0.31253719329833984, -0.22019746899604797, -0.09065580368041992, -0.445928156375885, 0.15225645899772644, 0.4895130395889282, -0.3657096326351166, 0.38344553112983704...
which is run right after the InsertAllOnSubmit + SubmitChanges All you have to do is create a new instance of your class and then call InsertOnSumbit() on the table: ``` var foo = new MyFoo { Name = "foo1" }; var dc = new MyDataContext(); dc.Foos.InsertOnSubmit(foo); dc.SubmitChanges(); ``` The other thing you need ...
[ 0.1529536098241806, 0.12055984139442444, 0.55051589012146, -0.005935179069638252, 0.26831313967704773, -0.14061339199543, 0.09823537617921829, -0.40431374311447144, -0.1400618702173233, -0.45208314061164856, 0.042662717401981354, 0.6638849973678589, -0.35687097907066345, 0.1422809213399887...
really need is what we call in my shop an "append" functionality. IMHO, this is most easily accomplished with a stored procedure - we even have a template we use for it: ``` USE [<Database_Name, sysobject, Database_Name>] GO CREATE PROCEDURE [<Schema, sysobject, dbo>].[<Table_Name, sysobject, Table_Name>__append] ( ...
[ -0.12652570009231567, 0.2781379520893097, 0.36702558398246765, -0.20804637670516968, 0.0007392532425001264, 0.1522694081068039, 0.037899669259786606, -0.7349478602409363, -0.013566168025135994, -0.6752841472625732, -0.3831474483013153, 0.55824875831604, -0.3703872561454773, 0.0148083269596...
sysobject, dbo>].[<Table_Name, sysobject, Table_Name>s] ([<Key_Param, sysobject, Key_Param>]) OUTPUT INSERTED.[id] INTO @inserted_ids VALUES (@<Key_Param, sysobject, Key_Param>) SELECT TOP 1 @id = [id] FROM @inserted_ids; END ELSE BEGIN UPDATE [<Schema, sysobject, dbo>].[<Table_Name, sysobject, Table_...
[ -0.19762347638607025, 0.024606145918369293, 0.6506125330924988, -0.23616492748260498, 0.06419993191957474, 0.03817245364189148, 0.05584665760397911, -0.7103478312492371, -0.28897926211357117, -0.47562119364738464, -0.6930835843086243, 0.33973032236099243, -0.3166463077068329, -0.2049012631...
List<Foo>(); foreach(var bar in whateverYoureIterating) { // logic to add to newFoos } var foosToInsert = newFoos.Where(newFoo => !existingFoos.Any(existingFoo => newFoo.Id == existingFoo.Id)); dc.Foos.InsertAllOnSubmit(foosToInsert); dc.SubmitChanges(); // use the next line if you plan on re-using existingFoos. If t...
[ 0.33668163418769836, -0.03239892050623894, 0.6224512457847595, -0.4700504243373871, 0.304133802652359, 0.057445134967565536, 0.3549171984195709, -0.3686729669570923, -0.22634603083133698, -0.45550456643104553, -0.24018928408622742, 0.7577893733978271, -0.5575596690177917, 0.106052912771701...
**Original post: [How to access a timer from another class in C#](https://stackoverflow.com/questions/725413/how-to-access-a-timer-from-another-class-in-c)** I tried everything. -Event -Invoke can't be done,because Timers don't have InvokeRequired property. -Public/internal property Nothing worked,the code is bein...
[ 0.3371284306049347, 0.03953901305794716, 0.22346483170986176, 0.10388530790805817, 0.1587202250957489, -0.04875410720705986, 0.6681391596794128, -0.2624582052230835, -0.20380190014839172, -0.5465402603149414, -0.16323810815811157, 0.6603915691375732, -0.002292174380272627, 0.07662389427423...
use the Timer class from the System.Timers namespace, and not the WinForms Timer control, if you want multi-threading support. Check the MSDN documentation for the WinForms Timer control for more information: <http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx>
[ 0.2501288056373596, -0.2116905152797699, 0.21220123767852783, 0.039253003895282745, 0.13572044670581818, -0.12191478908061981, -0.023037752136588097, -0.021991237998008728, -0.3110044300556183, -0.8283438086509705, -0.047396183013916016, 0.3360763192176819, -0.17308777570724487, 0.05934025...
I have a relationship between two tables. The two tables PKs are int types. In one table (UserS), I need to supply the Username and get the corresponding ID (which is the PK). This is the standard ASP.NET user table when using forms authentication. However, in a related table, I want to supply the ID I find from the ...
[ 0.20347604155540466, -0.16427180171012878, 0.3605435788631439, 0.086922787129879, -0.2663709223270416, -0.16861675679683685, 0.029755910858511925, -0.27192816138267517, 0.06219055876135826, -0.4933617115020752, 0.04526137188076973, 0.2741779685020447, -0.1875828206539154, 0.129723474383354...
there might be a better suited and appropriate way of writing this query (on Sql Server 2k5). How can I go about doing this and what gotchas lurk? EDIT: I will try something along the lines of <http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-1> EDIT: Thanks for the tips everyone, I wrote this: SELEC...
[ 0.07479773461818695, -0.2692985534667969, 0.5060943961143494, 0.20875385403633118, -0.3691460192203522, -0.062495023012161255, 0.1724761575460434, 0.060915522277355194, -0.24415645003318787, -0.6596060395240784, 0.26512113213539124, 0.4631310999393463, 0.13756154477596283, -0.1310306340456...
Is it possible to determine - server-side - whether a page has been loaded within an `IFrame`? When certain errors happen in my application the user gets redirected to `Default.aspx` and an error message is shown. The text of that error message gets set in session by exception handling code. The error message gets cle...
[ 0.17204777896404266, 0.2792567014694214, 0.6011048555374146, -0.09461153298616409, 0.006340856198221445, -0.20633551478385925, 0.4092049300670624, 0.01836305484175682, -0.3469456136226654, -0.8470097184181213, -0.17740099132061005, 0.385151743888855, -0.040636833757162094, 0.10328005254268...
redirect takes effect within the `IFrame`. I am using JavaScript to detect this and reload `Default.aspx` correctly, but this means that I get two `Page_Loads` in rapid succession, and the error message only gets shown on the first one (and then cleared). You can do it in client side: [How to identify if a webpage is b...
[ -0.0284770205616951, -0.2287282794713974, 0.6362358927726746, -0.22947779297828674, -0.16184671223163605, -0.23865079879760742, 0.271390825510025, -0.22152327001094818, -0.43481433391571045, -0.6275911927223206, -0.2119501233100891, 0.58885657787323, -0.5373286008834839, -0.050468478351831...
I am trying to add a dynamic Meta attribute to all of my Django models using model inheritance, but I can't get it to work. I have a permission that I want to add to all my models like this: ``` class ModelA(models.Model): class Meta: permisssions =(('view_modela','Can view Model A'),) class ModelB(mod...
[ -0.07278506457805634, 0.0867219865322113, 0.185186967253685, -0.24898312985897064, -0.25522124767303467, 0.3608857989311218, 0.28528860211372375, -0.28619810938835144, -0.2614840269088745, -0.6295991539955139, 0.18263477087020874, 0.656524121761322, -0.5997376441955566, 0.25188589096069336...
self._meta.permissions.append(('view_'+self._meta.module_name, u'Can view %s' % self._meta.verbose_name)) super(CustomModel,self).__init__(*args, **kwargs) class ModelA(CustomModel): .... class ModelB(CustomModel): ... ``` but it's not working. Is this the right approach? Because Django uses introsp...
[ -0.10987858474254608, 0.11230245232582092, 0.2764805555343628, -0.13578104972839355, -0.09471015632152557, 0.05634070932865143, 0.4060455560684204, -0.33534830808639526, -0.20051482319831848, -0.5061761140823364, 0.14137239754199982, 0.7179335951805115, -0.33849090337753296, 0.192975819110...
at the class level when syncdb is run in order to populate the auth\_permission table (and your approach requires an instance, which won't be made during syncdb) * even if you did add it to `_meta.permissions` in `__init__`, the `User` object wouldn't pick it up in any permission check calls because those consult the p...
[ -0.034041088074445724, -0.20240670442581177, 0.1033763438463211, 0.1452188938856125, -0.07762020081281662, -0.2528023421764374, 0.29050445556640625, -0.18208500742912292, 0.009586924687027931, -0.6772913932800293, 0.040075670927762985, 0.4627518057823181, -0.5459420084953308, 0.16420489549...
instance, and is available to syncdb. Since Django's models also use metaclasses to build the `Meta` object in the first place, the only requirement is that your metaclass must inherit from the same metaclass as Django's models. Here's some sample code (Python 2): ```py from django.db.models.base import ModelBase cl...
[ -0.011987399309873581, 0.20144344866275787, 0.5423465371131897, -0.05901575833559036, -0.02389402873814106, 0.06544779241085052, 0.2339603304862976, -0.34192901849746704, -0.429730623960495, -0.31266820430755615, -0.1397521048784256, 0.5089842081069946, -0.4821532368659973, 0.2029636502265...
'view_{0.module_name}'.format(klas._meta), u'Can view {0.verbose_name}'.format(klas._meta)) ) return klas class ModelA(models.Model): __metaclass__ = CustomModelMetaClass test = models.CharField(max_length=5) ``` Python 3: ```py from django.db.models.base import ModelBase ...
[ -0.19967184960842133, -0.13884253799915314, 0.6827542185783386, -0.15431846678256989, 0.020445790141820908, 0.3663427531719208, 0.23072388768196106, -0.5747937560081482, -0.46616312861442566, -0.34357231855392456, -0.20846113562583923, 0.6723966598510742, -0.284469872713089, 0.133766382932...
'view_{0.module_name}'.format(klas._meta), 'Can view {0.verbose_name}'.format(klas._meta)) ) return klas class ModelA(models.Model, metaclass=CustomModelMetaClass): test = models.CharField(max_length=5) ``` Note that permissions in this case will be written only on `migrate`. If...
[ 0.03963359817862511, -0.1949603259563446, 0.5088558793067932, -0.10851701349020004, 0.1645255833864212, -0.10543092340230942, 0.39312607049942017, -0.5808407068252563, -0.31851616501808167, -0.43939244747161865, -0.2561371922492981, 0.44023120403289795, -0.3613540530204773, 0.0537830032408...
I want to test the security of a website of mine and I would love to have an application that is able to send POST data, **if** it's even possible.. Thanks Yes, there are two I know of: * [Tamper Data](https://addons.mozilla.org/en-US/firefox/addon/tamper-data-for-ff-quantum/) ([Github](https://github.com/Pamblam/Tam...
[ 0.5387481451034546, 0.15900589525699615, 0.3985089063644409, 0.1766032576560974, -0.22999659180641174, -0.24386468529701233, 0.22995281219482422, 0.08585015684366226, -0.5039029121398926, -0.4655897319316864, -0.028631752356886864, 0.3539297580718994, -0.39276060461997986, 0.11102130264043...
I am trying to implement a platform independent file/directory tree browser. Basically, I am trying to replicate windows explorer's tree control to browse the computer. However, I can't figure out how to find the "Desktop" or "My Computer" folder string (It changes in every pc and os type, version and language). If I c...
[ 0.42625999450683594, 0.22878076136112213, 0.5461763739585876, 0.061727795749902725, -0.2203863561153412, 0.06463122367858887, 0.36665451526641846, 0.3540430963039398, -0.14659512042999268, -0.9007807970046997, -0.09385747462511063, 0.5197270512580872, -0.09533064067363739, 0.49858224391937...
I use wxWidgets for my GUI but I am open to all suggestions for this specific problem. Oh, and I am using C++ in VS2008. Ignoring portability, what you need is the "PIDL" tree. PIDLs are generalizations of file paths. You can get the PIDLs for special folders with [SHGetFolderLocation](http://msdn.microsoft.com/en-us/l...
[ 0.025444982573390007, 0.019393611699342728, 0.6810712218284607, 0.20076647400856018, -0.12615124881267548, 0.006142015568912029, -0.07518482953310013, 0.2042369544506073, -0.47828200459480286, -1.0299699306488037, 0.1999898999929428, 0.27303341031074524, -0.5897475481033325, 0.378054052591...
Hopefully that title is clear enough. Anyways, it seems: ``` [NSKeyedArchiver archiveRootObject:rootObject toFile:path]; ``` is restricted to `NSPropertyListBinaryFormat_v1_0`. I need the format to be human readable [so xml]. If you're interested, this is part of project I'll eventually put up on github with a blo...
[ 0.18677470088005066, 0.08469435572624207, 0.5125137567520142, 0.21193741261959076, 0.139466792345047, -0.27432891726493835, 0.20909970998764038, -0.24593259394168854, 0.17797726392745972, -0.6570870280265808, -0.2176743596792221, 0.6434314250946045, -0.3221505284309387, 0.02196110226213932...
format:NSPropertyListXMLFormat_v1_0 errorDescription:&error]: if( xmlData ) { [xmlData writeToFile:myPath atomically:YES]; } else { NSLog(error); [error release]; } ```
[ -0.2946150004863739, -0.28366872668266296, 0.3416091799736023, -0.1264655590057373, 0.08870459347963333, -0.00011120801354991272, 0.21815435588359833, -0.18728069961071014, -0.302230566740036, -0.5904097557067871, -0.3709052801132202, 0.574449360370636, -0.20473480224609375, -0.15383923053...
I'm having some problems with DllImport and ASP.NET because when I use a imported method ASP.NET loads the Dll and locks the file even after it finished using it. Is there any way to force ASP.NET to release the lock on the file? The only way to force a DLL out of the process in .Net is to unload the AppDomain in which...
[ 0.2614850699901581, 0.05730349197983742, 0.40157175064086914, 0.034241683781147, -0.20416152477264404, -0.41343793272972107, 0.20457957684993744, -0.09096480906009674, -0.510230541229248, -0.595555305480957, -0.13578800857067108, 0.6438076496124268, -0.4806465208530426, 0.4198669493198395,...
DLL's loaded via PINvoke but I am fairly certain.
[ 0.18073345720767975, -0.1410103291273117, 0.5733360052108765, 0.3634510934352875, -0.14142164587974548, -0.10517474263906479, -0.00538551015779376, 0.20758120715618134, -0.12346261739730835, -0.24796569347381592, 0.024617278948426247, 0.5203549861907959, -0.11560899019241333, 0.29617339372...
Is there a way to share a project across multiple solutions in SVN? I already have a class library in a solution that I want to import in another one. Can I just import the project in the new solution or will there be a problem with paths (since the project is not in the same repository)? Is there a better way to do th...
[ 0.20586590468883514, 0.049457892775535583, 0.19173043966293335, 0.22147947549819946, -0.02158312499523163, -0.2007582038640976, 0.2825600802898407, -0.08867955952882767, -0.500957727432251, -0.43568500876426697, 0.10451190173625946, 0.404849112033844, 0.11505278199911118, 0.153721913695335...
I have a sharepoint site that has an excel spreadsheet that I need to download on a schedulad basis Is this possible? Why not just use `wget.exe <url>`. You can put that line in a batch file and run that through windows scheduler.
[ 0.5478809475898743, -0.06468815356492996, 0.09601922333240509, 0.20278580486774445, 0.020475471392273903, -0.1843777745962143, -0.15029753744602203, 0.33317381143569946, 0.12711504101753235, -0.7248727679252625, 0.1432676762342453, 0.40791818499565125, -0.1703927218914032, 0.31348034739494...
I have a URL like this: ``` http://192.168.0.1:8080/servlet/rece ``` I want to parse the URL to get the values: ``` IP: 192.168.0.1 Port: 8080 page: /servlet/rece ``` How do I do that? Write a custom parser or use one of the string replace functions to replace the separator ':' and then use `sscanf()`.
[ 0.40216103196144104, 0.1709953397512436, 0.5055105686187744, 0.07472057640552521, -0.09606736153364182, -0.27698031067848206, 0.13575559854507446, -0.13149215281009674, -0.11238701641559601, -0.5817905068397522, -0.014813536778092384, 0.3028366267681122, -0.27166175842285156, 0.36870515346...
I have a mock up of a sql query that will represent a real sql query. ``` Create table #tmp ( Atype varchar(10), Btype varchar(10) ) insert into #tmp values ('a','x') insert into #tmp values ('b','x') insert into #tmp values ('a','y') insert into #tmp values ('a','y') insert into #tmp values ('b','z') insert ...
[ 0.18500594794750214, 0.11006616055965424, 0.5026914477348328, -0.03094799816608429, -0.32765114307403564, 0.6418242454528809, 0.12952828407287598, -0.6132868528366089, -0.13427409529685974, -0.44550779461860657, -0.05378062650561333, 0.31665998697280884, -0.524031937122345, 0.0560002326965...
1 b y 1 b z 1 ``` What i am looking for after this is to be able to create a report that basically looks like: ``` atype|x| y| z ------------- a |1| 2| 0 b |1| 1| 1 ``` I am sure you can do this using come crazy t-sql code but i am struggeling to get it right. EDIT: I agree that you can use...
[ 0.7128369808197021, -0.1995762288570404, 0.3237563669681549, 0.10654497891664505, -0.25793543457984924, -0.28563210368156433, 0.15982860326766968, -0.2619616389274597, 0.20438824594020844, -0.37096068263053894, 0.12972573935985565, 0.5681402683258057, -0.6665056347846985, -0.04442400485277...
atype, SUM(CASE btype WHEN 'x' THEN 1 ELSE 0 END) AS x, SUM(CASE btype WHEN 'y' THEN 1 ELSE 0 END) AS y, SUM(CASE btype WHEN 'z' THEN 1 ELSE 0 END) AS z FROM #tmp group by atype order by atype ```
[ 0.16228918731212616, -0.02556970901787281, 0.2860293686389923, -0.09296470135450363, -0.16193225979804993, 0.5307974815368652, 0.3221187889575958, -0.6091463565826416, 0.0574176162481308, -0.20378027856349945, -0.4982416033744812, 0.4287121593952179, -0.6173155307769775, 0.1329901814460754...
In Java, an Enum can do the great things that Enums do, but can also have methods (behavior and logic). What advantage does that have over using a class using an enum? Simple examples to illustrate the point would also be welcome. Here's a simple example: ``` enum RoundingMode { UP { public double round(do...
[ -0.05162365734577179, -0.0862673819065094, -0.08727564662694931, -0.13601577281951904, -0.12598614394664764, 0.05639166012406349, -0.10356596112251282, -0.508208692073822, -0.3381807506084442, -0.5444911122322083, -0.21202678978443146, 0.3015991151332855, -0.19988246262073517, 0.0347075797...
public double round(double d) { return Math.floor(d); } }; public abstract double round(double d); } ```
[ -0.16399221122264862, 0.1049419641494751, -0.05179307609796524, -0.2600109279155731, 0.05953378602862358, 0.01120378915220499, 0.13712424039840698, -0.22566890716552734, -0.26117175817489624, -0.3224967420101166, -0.43816545605659485, 0.46389514207839966, -0.27639737725257874, -0.003751552...
I have a weird issue. I am opening a popup window in IE6 with SSL enabled on the server. When the following executes it seems to lock the browser up. I know this is vague. This is the JScript that appears to be the problem. Gotta love your IE6! ``` function PopoffWindow(url) { var features = "height=400,width=550...
[ 0.5803205966949463, 0.166705921292305, 0.6760533452033997, -0.1481834203004837, 0.16939504444599152, -0.1694614589214325, 0.7344209551811218, 0.3954068422317505, -0.2085210084915161, -0.8221009373664856, -0.4169694483280182, 0.5948649644851685, 0.03780234232544899, 0.4629451632499695, 0....
win.focus(); return win; } ``` This is not a problem in IE7 or Firefox. And the problem seems to be isolated to this server (with SSL). Anyone have any insight on this? Thanks, Nick The problem was with a JSON webservice call. Please see this link for details: <http://codeclimber.net.nz/archive/2006/12/22/How-...
[ 0.5419992804527283, 0.027036773040890694, 0.2560499906539917, -0.2249554991722107, -0.09421120584011078, -0.4717126786708832, 0.622153639793396, 0.1526317447423935, -0.26818910241127014, -0.6385646462440491, -0.48663967847824097, 1.117330551147461, -0.36600610613822937, -0.252973347902298,...
I'm using .NET's built-in Tracing mechanism to trace program execution. The problem is the trace file can grow to several MB very quickly. Is there an efficient way of truncating the file when it grows past a certain point? I thought of putting in a check whenever something gets written (I have a custom class that inhe...
[ 0.49733680486679077, -0.01937509886920452, 0.4254346489906311, 0.17585980892181396, 0.24363836646080017, -0.37369808554649353, 0.20277586579322815, -0.02616112120449543, -0.3739892542362213, -0.743054211139679, 0.4331113398075104, 0.4788464605808258, -0.2288186252117157, 0.1860431134700775...
not really suitable for service applications that are supposed to be always active. If application produces a lot of trace output, then sooner or later this information will use up all disk space. <http://www.codeproject.com/KB/dotnet/customnettracelisteners.aspx?display=Print> With this example, you are able to crea...
[ 0.0406513474881649, -0.2252090573310852, 0.20023447275161743, 0.18479560315608978, 0.014754071831703186, -0.49436014890670776, 0.179791659116745, -0.055694472044706345, -0.30364906787872314, -0.6081446409225464, 0.017199238762259483, 0.5223803520202637, -0.32052719593048096, 0.026838570833...
I've always use String.IsNullOrEmpty to check for a empty string. It recently come to my attention that a " " count as not a empty string. For example, ``` Dim test As String = " " If String.IsNullOrEmpty(test) Then MessageBox.Show("Empty String") Else MessageBox.Show("Not Emtpy String") E...
[ 0.392063170671463, -0.03279398754239082, 0.09270817041397095, -0.2509172558784485, 0.07274848967790604, 0.019185643643140793, 0.3965088129043579, -0.012162771075963974, -0.17589080333709717, -0.43504855036735535, 0.08423296362161636, 0.511703372001648, -0.18038032948970795, 0.0550903752446...
check for blank strings. It is different from the Trim() versions in that it does not allocate a new string. It also uses a more expanded notion of whitespace. ``` Public Function IsNullOrBlank(ByVal str as String) As Boolean if String.IsNullOrEmpty(str) Then Return True End IF For Each c In str IF Not C...
[ 0.021738015115261078, -0.1104106605052948, 0.29336461424827576, -0.21088922023773193, 0.21401289105415344, -0.15717458724975586, 0.11743640154600143, -0.210310697555542, 0.09945142269134521, -0.19634315371513367, -0.2811254560947418, 0.46420416235923767, -0.4708009362220764, -0.00061227846...
I want to develop an Java application that can detect the user logged on a Windows Domain. These credentials are going to be used to logging on the Java application running on Tomcat. How can I do this? I want to know the remote user accessing my web app. This user is logged on in Active Directory. This is my solution...
[ 0.3847012519836426, -0.026965593919157982, 0.5111542344093323, -0.08772636950016022, -0.22910834848880768, 0.08827554434537888, 0.18686512112617493, -0.4411593973636627, -0.4491140842437744, -0.714423656463623, 0.128182515501976, 0.2828218638896942, -0.4741300940513611, 0.0425550602376461,...
--> Domain Controller IP </init-param> <init-param> <param-name>jcifs.util.loglevel</param-name> <param-value>2</param-value> </init-param> </filter> <filter-mapping> <filter-name>NtlmHttpFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ``` And the y...
[ 0.07336054742336273, -0.4766341745853424, 0.6113017201423645, 0.33891430497169495, -0.28622767329216003, -0.06990313529968262, -0.0057185012847185135, -0.5846610069274902, -0.6049616932868958, -0.6165673136711121, -0.23179157078266144, 0.007560054771602154, -0.353494793176651, 0.2750468850...
I have a bunch of externals directories in a plugins folder. ``` ~> svn propedit svn:externals . akismet http://plugins.svn.wordpress.org/akismet/trunk/ stats http://plugins.svn.wordpress.org/stats/tags/1.3.7/ html-purified http://svn.wp-plugins.org/html-purified/trunk/ ``` Some times I will update a single externa...
[ -0.0014156209072098136, 0.26791542768478394, 0.5594248175621033, -0.16743339598178864, -0.2568424642086029, 0.21592135727405548, 0.44242799282073975, -0.22667618095874786, -0.4633238911628723, -0.39463308453559875, -0.15905851125717163, 0.4133293032646179, -0.47779011726379395, 0.246068567...
Console.WriteLine(potenzen[i-1]); if (i % 10 == 0) Console.ReadLine(); } ``` is more in line with what you want. An improvement would be to separate your data-manipulation logic from your data display logic. ``` long [] potenzen = new long[32]; potenzen[0] = 1; for (int i = 1; i < potenzen.Length; ++i) poten...
[ -0.404918909072876, -0.19658510386943817, 0.7668943405151367, -0.2517361342906952, 0.19473408162593842, 0.09853596985340118, 0.32842421531677246, -0.5671536922454834, 0.06169147789478302, -0.591921865940094, -0.47034844756126404, 0.5652812123298645, -0.25983452796936035, 0.110248863697052,...
if (i % 10 == 0) Console.ReadLine(); } ```
[ -0.15608353912830353, 0.17695316672325134, 0.2981081008911133, -0.3738434910774231, 0.5167699456214905, -0.17036131024360657, 0.2761513590812683, 0.03249195218086243, 0.37827110290527344, -0.6616389751434326, -0.23554646968841553, 0.7313751578330994, -0.2476648986339569, 0.3536156415939331...
I am trying to insert values from one table in to the other, with an additonal parameter that is required. For instance: ``` INSERT INTO table1(someInt, someOtherInt, name, someBit) SELECT someInt, someOtherInt, name FROM table2 ``` someBit is not allowed to be null, and I need to set it to False, but I am not q...
[ 0.003932909108698368, 0.2952027916908264, -0.15181590616703033, -0.24150311946868896, -0.23413784801959991, -0.006592043675482273, 0.18488319218158722, -0.010060329921543598, -0.13303950428962708, -0.31149983406066895, 0.13047003746032715, 0.5715943574905396, -0.28721851110458374, -0.15332...
I need to show the same object in OpenGL in two different viewports, for instance, one using ortographic projection and the other using perspective. In order to do this, do I need to draw again the object after each call to glViewport()? Nehe has [a good tutorial](http://nehe.gamedev.net/tutorial/multiple_viewports/200...
[ 0.22096167504787445, -0.029572248458862305, 0.4154144823551178, 0.06278213858604431, -0.15351299941539764, -0.17504817247390747, -0.02606894262135029, -0.04337280988693237, -0.24667172133922577, -0.7981632947921753, -0.03393708914518356, 0.6272401809692383, -0.01657254435122013, -0.1133697...
In the Photos app, there is a nice water drop effect used for transition. I had seen an app a while ago that used this same water effect transition for it's content views. Unfortunately, this transition type is not listed in the UIViewAnimationTransition documentation. But since this third party app used it (I don't ...
[ 0.34202638268470764, -0.05178193747997284, 0.23878681659698486, 0.3502347469329834, -0.06583715230226517, -0.19182707369327545, -0.056323494762182236, 0.1861611157655716, -0.44276490807533264, -0.6158699989318848, -0.03412044420838356, 0.409486323595047, -0.1568201631307602, -0.02342657931...
I'm trying to look at cucumber for Jruby on Rails. One of the pre-requesites is webrat which has as pre-requisite hpricot. I've installed the gem with hpricot using: gem install hpricot --source <http://code.whytheluckystiff.net> --version 0.6.1 --platform java This installs the java version of hpricot. I add the hp...
[ -0.16119389235973358, 0.1336509734392166, 0.535442590713501, -0.12659092247486115, -0.0051821134984493256, 0.0283203162252903, 0.2805284857749939, -0.31251341104507446, 0.040407612919807434, -0.7601683735847473, 0.004731229040771723, 1.0913987159729004, -0.0801650807261467, -0.215390667319...
`/^I should see "([^\"]*)"$/' features/manage_activity.feature:9:in `Then I should see "Run"' ``` If I try to install later versions of the hpricot, then I get: ``` ERROR: Failed to build gem native extension. C:/Program Files/Ruby/jruby-1.2.0/bin/../bin/jruby.bat extconf.rb install hpricot --platform java C:/Progra...
[ 0.30999165773391724, 0.15406282246112823, 0.454590767621994, -0.004864098504185677, 0.04121123254299164, -0.34829914569854736, 0.8045294284820557, -0.4427533447742462, -0.20916661620140076, -0.2509478032588959, -0.10021419078111649, 1.0766267776489258, -0.1317766010761261, -0.3246439099311...
I am using ipython on Mac OS 10.5 with python 2.5.1 (I would actually like to use ipython for 2.6.1, but it doesn't seem to be available?) I installed ipython via easy\_install. It works but is missing gnu readline (needed for nice searching of command line history with ctrl-R, etc.) I found a [blog post](http://www....
[ -0.04243934899568558, 0.0031193899922072887, 0.21769490838050842, 0.09446980059146881, 0.015424824319779873, -0.30466145277023315, 0.5595378875732422, 0.09255248308181763, -0.3993164002895355, -0.6382870078086853, -0.11087142676115036, 0.7876807451248169, -0.6027772426605225, -0.1650128513...
need with essentially one command using MacPorts. First download and install MacPorts from <http://www.macports.org/>. Then just do the following in the terminal: 1) sudo port -v selfupdate 2) sudo port -v install py26-ipython That will install python2.6, ipython for python 2.6 and readline for you. The command t...
[ -0.008885943330824375, -0.0828288272023201, 0.6147994995117188, 0.1195637509226799, 0.04895065352320671, -0.022311637178063393, 0.0889248251914978, -0.31147268414497375, 0.04747437685728073, -0.8954377770423889, -0.08776451647281647, 0.8164838552474976, -0.4157487750053406, -0.181272879242...
I am having trouble figuring out how to coalesce or pivot on a SQL recordset that looks like this: ``` ID VALUE GROUP 3 John 18 4 Smith 18 5 Microsoft 18 3 Randy 21 4 Davis 21 5
[ 0.45571714639663696, 0.6833316683769226, 0.21572455763816833, 0.21239511668682098, 0.10766330361366272, -0.012089409865438938, 0.17854824662208557, -0.4605494439601898, -0.068967804312706, -0.1980295181274414, 0.08648580312728882, 0.3154788911342621, -0.0892297700047493, 0.244593545794487,...
IBM 21 etc ``` and I want formatted like this ``` NEWVALUE GROUP Smith, John (Microsft) 18 Davis, Randy (IBM) 21 ``` thanks for any suggestions and help! This is what i done, i hope it fits for you ``` DECLARE @t table (id int, value VARCHAR(20), grupo int) INSERT @T VALUES (3, ...
[ 0.3170988857746124, 0.18044190108776093, 0.20292000472545624, -0.14846445620059967, 0.15917709469795227, 0.22044354677200317, 0.009790237993001938, -0.363761305809021, -0.09932499378919601, -0.6479294896125793, -0.3579760789871216, 0.42178380489349365, -0.36909055709838867, -0.195137217640...
'Davis', 21) INSERT @T VALUES (5, 'IBM', 21) SELECT grupo, (SELECT value FROM @t t2 WHERE t2.grupo = t.grupo AND id = 4) + ', ' + (SELECT value FROM @t t2 WHERE t2.grupo = t.grupo AND id = 3) + ' (' + (SELECT value FROM @t t2 WHERE t2.grupo = t.grupo AND id = 5) + ')' FROM @t t GROUP BY grupo ```
[ 0.003640018170699477, 0.19542862474918365, 0.4146125912666321, 0.0663975328207016, 0.3108716607093811, 0.5736878514289856, -0.4952492415904999, -0.4395821690559387, -0.08375119417905807, 0.1922527551651001, -0.35974884033203125, 0.1848217397928238, -0.25086620450019836, 0.1305677890777588,...
I am trying to create a simple ajax chat using JQuery and ASP.NET. My code works like this: 1. When the page loads it refreshes the 'chatbox' div with a request to the messages.aspx page, which handles getting new messages from the database and kicks off an auto-refresh with the setTimeout(). 2. Whenever the user cli...
[ 0.15465597808361053, 0.04711524397134781, 0.31596821546554565, -0.10546346008777618, -0.32071298360824585, -0.14096768200397491, 0.1887928992509842, 0.10181808471679688, -0.3002614378929138, -0.8678323030471802, 0.19142474234104156, 0.5126750469207764, -0.28910231590270996, -0.078700050711...
in messages.aspx can't complete running within those 5 seconds? Any help would be appreciated! Also, I didn't worry about sql injection attacks yet b/c I was just trying to get it working with simple code. Here's my code: > **Client side** ``` <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.c...
[ 0.04147880896925926, -0.10012540221214294, 0.6593000888824463, -0.16273659467697144, -0.19969907402992249, -0.027844568714499474, 0.3504296541213989, -0.3679984509944916, -0.21447931230068207, -0.7519288659095764, -0.24747392535209656, 0.41728538274765015, -0.14060217142105103, -0.17183242...
$("#btnSend").click(function () { addMessage(); }); return false; }); function refreshChat() { $.get("messages.aspx", function (data) { $("#chatbox").empty();
[ 0.07539196312427521, -0.18933574855327606, 0.5181900858879089, -0.4726089835166931, 0.17686109244823456, 0.09548858553171158, 0.7893018126487732, -0.03371107578277588, -0.030421199277043343, -0.659322202205658, -0.6991011500358582, 0.8584303259849548, -0.521358847618103, 0.1947619467973709...
$("#chatbox").prepend(data); }); setTimeout(refreshChat(), 5000); } function addMessage() { $.get("messages.aspx", { usr: $("#usr").val(), msg: $("#msg").val() }); } </script> </head> <body> <form id="form1" runat="server"> <div
[ 0.09279397130012512, -0.32497909665107727, 0.8970174789428711, -0.23968814313411713, 0.025524821132421494, 0.3139742612838745, 0.5102323293685913, -0.3536244034767151, -0.07913681864738464, -0.8067977428436279, -0.588868260383606, 0.5660039186477661, -0.3392486572265625, 0.0732356831431388...
id="input"> username: <input type="text" name="usr" id="usr" /><br /> message:<br /> <textarea id="msg" name="msg" rows="5" cols="30"></textarea><br /><br /> <input type="button" id="btnSend" name="btnSend" value="Send" /> </div> <div id="chatbox"></div> ...
[ -0.14615696668624878, -0.059213895350694656, 0.5442034006118774, 0.002872545039281249, -0.16214323043823242, 0.4466967284679413, 0.09628717601299286, -0.4211576282978058, -0.22994981706142426, -0.8357754945755005, -0.33271917700767517, 0.3342962861061096, -0.1409958153963089, 0.00894695427...
System.Web.UI.HtmlControls; public partial class messages : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=F:\\Chatter\\App_Data\\messages.mdf;Integrated Security=True;User ...
[ -0.33753684163093567, -0.0469224788248539, 0.6822154521942139, -0.13428427278995514, 0.050822723656892776, 0.13934609293937683, 0.4360004663467407, 0.0008923557470552623, -0.2837057113647461, -0.8148720264434814, -0.5279147028923035, 0.4643765985965729, -0.6669440865516663, 0.2400567978620...
string user = Request["usr"].ToString(); string message = Request["msg"].ToString(); sql = "insert into messages (usr, msg, [date]) values ('" + user + "', '" + message + "', '" + DateTime.Now + "')"; comm = new SqlCommand(sql, conn);
[ -0.30300307273864746, -0.34840258955955505, 0.5976476073265076, -0.32041165232658386, 0.20758585631847382, 0.14157313108444214, 0.13075041770935059, -0.1923835128545761, -0.10039644688367844, -0.25058844685554504, -0.3198224902153015, 0.4696349501609802, -0.3730733096599579, 0.289809316396...
comm.ExecuteNonQuery(); } sql = "select top 5 usr, msg from messages order by [date] desc"; comm = new SqlCommand(sql, conn); SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { Response.Write(dr["usr"].ToString() + ": <br/>" + dr["msg"] + "<br/><br...
[ -0.24153123795986176, -0.08405793458223343, 0.7775707840919495, -0.23756711184978485, 0.01916317455470562, 0.24800743162631989, 0.21224574744701385, -0.27065739035606384, -0.5304259061813354, -0.27243971824645996, -0.2784961760044098, 0.4210498332977295, -0.21997959911823273, 0.42915758490...
dr.Close(); conn.Close(); } } ``` Your javascript refreshChat function is recursively calling itself. Change the code to: ``` function refreshChat() { $.get("messages.aspx", function (data) { $("#chatbox").empty(); $("#chatbox").prepend(data); }); setTimeout(refreshChat, 5000)...
[ -0.12253492325544357, 0.25070324540138245, 0.8653849959373474, -0.4115760028362274, 0.06777951121330261, -0.026580743491649628, 0.37227997183799744, -0.3990328311920166, 0.029559887945652008, -0.7746975421905518, -0.5777438282966614, 0.8203135132789612, -0.5859328508377075, 0.2538904547691...
I'm trying to mock a data repository object but after setting an expectation on my MockRepository, it returns null every time. My code is as follows: ``` [Test] public void GetById_NotNull() { Person expectedPerson = new Person() { Id = 1, Name="Jon"}; MockRepository MockRepository = new M...
[ 0.08041268587112427, 0.00023872923338785768, 0.3052356243133545, -0.2481985092163086, -0.017200421541929245, 0.4901890456676483, 0.5889846086502075, -0.18283692002296448, 0.07770820707082748, -0.5252220630645752, -0.024001771584153175, 0.6437336802482605, -0.012979304417967796, -0.16158449...
new PersonService(FakePersonRepository); Person returnedPerson = PersonService.Get(1); Assert.IsNotNull(returnedPerson); } //and inside my person service public class PersonService { private IRepository<Person> _PersonRepository; public PersonService(IRepository<Perso...
[ -0.47473984956741333, -0.10478467494249344, 0.4614388942718506, -0.007712169084697962, 0.06403036415576935, 0.2770705223083496, 0.41765284538269043, -0.0017131619388237596, 0.01738503761589527, -0.702743411064148, -0.4616512656211853, 0.6785130500793457, 0.09161435812711716, 0.359249025583...
public Person Get(int Id) { Person p = _PersonRepository.Get(Id); return p; } } ``` The assertion at the bottom of the Test fails and returned person is always null. I know I must be doing something wrong with my mock....ideas? Chris is on the money here. The AAA synta...
[ 0.11058276891708374, 0.19531625509262085, -0.005553048569709063, 0.2413809448480606, -0.11618928611278534, 0.03696320578455925, 0.4776040017604828, -0.1635342687368393, -0.0857902243733406, -0.30339425802230835, 0.04549406096339226, 0.7007222771644592, -0.04369281977415085, 0.1449082195758...
is best. ``` var FakePersonRepository = MockRepository.GenerateStub<<IRepository<Person>>(); FakePersonRepository.Stub(x => x.Get(1)).Returns(expectedPerson); PersonService PersonService = new PersonService(FakePersonRepository); Person returnedPerson = PersonService.Get(1); ```
[ -0.6040452718734741, -0.03786589950323105, 0.49446094036102295, -0.1785183846950531, 0.015393901616334915, 0.05412151664495468, 0.506524920463562, -0.2094801664352417, 0.18059635162353516, -0.7529910802841187, -0.19049522280693054, 0.7182256579399109, 0.04897640272974968, -0.24820350110530...
Part of me thinks that this shouldn't be possible (even if it is), but I'll ask anyway. Given the following class hierarchy (`Grandparent` and `Parent` are from a 3rd party and thus, not under my control), how would I override `myMethod()` in `Child` such that it bypasses the overridden implementation in `Parent` and...
[ 0.36333391070365906, 0.05409999191761017, 0.19959358870983124, -0.03379495069384575, 0.6070340275764465, -0.09656824916601181, 0.4098533093929291, -0.3453334867954254, -0.018506579101085663, -0.5164133310317993, -0.2731230556964874, 0.37615296244621277, -0.13966478407382965, 0.570084095001...
do something else } } class Child extends Parent { @Override public void myMethod() { // ??? I want to *only* do what Grandparent did here } } ``` Pretend that the `Parent` class provides a lot of other helpful behavior and is a crucial element of `Child`'s hierarchy (in other words, I'm not looking f...
[ 0.3777029514312744, -0.06716824322938919, 0.03653646260499954, -0.02963315322995186, 0.27799922227859497, -0.13477778434753418, 0.2805289328098297, -0.14834487438201904, -0.021148288622498512, -0.6944552063941956, 0.0563649982213974, 0.41960400342941284, -0.2170950174331665, 0.400486320257...
that's not the idea of subclassing. Maybe you should have a helper member to do some of the tasks you need, instead of subclassing, and have both "Child" and "Parent" classes extend "Grandparent". The main question you need to ask yourself is: "Is Child really a descendant of Parent, Grandparent or neiter?" In other ...
[ 0.1281040459871292, -0.043395400047302246, -0.14212998747825623, 0.22555755078792572, 0.14341282844543457, 0.3264409899711609, 0.17576652765274048, -0.006733333691954613, -0.2624916136264801, -0.5192091464996338, -0.00289808283559978, -0.01233438029885292, 0.2499433159828186, 0.68326836824...