text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
on the same machine or same local network) The problem comes when the client is on a different network. My server is listening on a Win2003 server and has a public IP. When the client tries to connect to this server using the public IP + Port, the connection is made but it is soon dropped and a SocketException (10053 ...
[ -0.09847833216190338, 0.19252704083919525, 0.2941637635231018, 0.03606424108147621, 0.04561624303460121, -0.1512351781129837, 0.7215669751167297, -0.005997760687023401, -0.3541480302810669, -0.7393072247505188, 0.05297554284334183, 0.6667571067810059, -0.41254284977912903, 0.46828207373619...
service runs fine on my Win2003 server with clients on my network but gives problems on a different server with clients on a different network. The problem was with Windows XP SP2 itself. I tried connecting the clients from Windows Server 2003 or Vista and it worked fine. The following link explains the problem: <http:...
[ -0.020533669739961624, -0.11591910570859909, 0.336563378572464, -0.16713610291481018, -0.24758467078208923, 0.0697261318564415, 0.8998172283172607, 0.15824933350086212, -0.24409496784210205, -0.6518832445144653, -0.01291675865650177, 0.7025277614593506, -0.20058932900428772, 0.132944896817...
How do I point Blender to the version of python I have installed Mark, your version of Blender should be compiled with a specific version of Python interfaced to it -- and THAT is the version of Python you need to install on your machine. The same issue surfaced back when Python 2.5 was reasonably new and Blender was s...
[ 0.7273971438407898, -0.014909643679857254, 0.2642486095428467, -0.23602253198623657, -0.14099320769309998, -0.2640455663204193, -0.00430090120062232, 0.13922487199306488, 0.21291698515415192, -0.4327023923397064, 0.26149287819862366, 0.4688778221607208, -0.555230438709259, -0.1919682472944...
for what Python to install (unless you want to recompile Blender from source to support your favorite version of Python, of course!)
[ 0.58863365650177, -0.1285857856273651, -0.009127828292548656, 0.011122970841825008, 0.09190800040960312, -0.5167171359062195, 0.28790366649627686, 0.23287011682987213, 0.051287174224853516, -0.3862498700618744, -0.15957209467887878, 0.8629208207130432, -0.37348484992980957, -0.260434865951...
I have an asp.net mvc application and now I need to add a web service to go along with it. What is the best solution for this? Just create a new web service project and add it to my solution then deploy it to the same web server using a different url? I would like it to be a part of the mvc application only because I h...
[ 0.7015032768249512, 0.19994813203811646, 0.252385675907135, 0.12194611132144928, -0.06508444994688034, -0.17977547645568848, 0.12170860171318054, 0.08103518933057785, -0.4302341043949127, -0.6087642312049866, 0.2545476257801056, 0.2970145046710968, -0.34026917815208435, 0.45886996388435364...
strongly recommend you remove it from there into a separate class library project. This third project would be used both by the web service and by the MVC application. I also strongly recommend that you not use ASMX web services for any new development. Use WCF only, unless you have no choice at all. There's a misco...
[ 0.7345985174179077, 0.029150526970624924, 0.09054578095674515, 0.13670596480369568, -0.41439875960350037, -0.4741557538509369, 0.2460060864686966, -0.04602678492665291, -0.19734090566635132, -0.537931501865387, 0.029659604653716087, 0.6007358431816101, -0.3577783405780792, 0.08726254850625...
I have JRuby and Ruby (MRI) installed. It seems that I need to install gems twice - once for each of these platforms. Is this necessary or am I doing it wrong? After I installed the rails gem for MRI, should I have pointed JRuby to it, or was it necessary for me to also call: "jruby -S gem install rails" If you set GEM...
[ 0.5836739540100098, 0.08068195730447769, 0.07374829053878784, -0.041172370314598083, -0.1756148338317871, -0.05101119354367256, 0.3047679662704468, -0.3853279948234558, -0.10341464728116989, -0.6484698057174683, 0.3903864324092865, 0.9893119931221008, 0.013518296182155609, 0.06012358516454...
I'm having some issues when calling getItemIndex on an ArrayCollection with a filterFunction set. I do something like `myAC.removeItemAt(myAC.getItemIndex(myObject))`, which works fine when the filtering hasn't been applied. As soon as filtering is applied, getItemIndex seems to return -1 in every case. Has anyone c...
[ 0.11280252039432526, -0.10657481849193573, 0.4080354571342468, 0.13357877731323242, -0.48173248767852783, -0.21178826689720154, 0.26265034079551697, 0.1156773641705513, -0.44160783290863037, -0.6953933238983154, -0.12557080388069153, 0.4627837836742401, -0.5523719191551208, 0.3218890726566...
that's filtered out, you could temporarily disable the filter: ``` var filter:Function = ac.filterFunction; ac.fiterFunction = null; ac.refresh(); // remove item ac.filterFunction = filter; ac.refresh(); ```
[ -0.11511270701885223, -0.40109914541244507, 0.3291124403476715, -0.2262485921382904, 0.0527990460395813, 0.05936053395271301, 0.22910818457603455, -0.315857857465744, -0.1996290534734726, -0.6729757785797119, -0.5837575197219849, 0.5829665660858154, -0.6397136449813843, 0.2676745355129242,...
I'm trying to build a simple Magento Module that needs to connect to the database at the start of each page request. All tables need to be accessible to it. I've been pulling my hair out trying to understand how to do it. The best I could figure out was that I need to set this in the `config.xml` file of my module, but...
[ 0.6150192022323608, 0.13941824436187744, 0.4077937602996826, 0.2352505773305893, 0.0881815031170845, -0.316447377204895, 0.009038139134645462, 0.10105732828378677, -0.27969855070114136, -0.5895504951477051, 0.023451460525393486, 0.36793139576911926, -0.05318816751241684, 0.1112220287322998...
to include a custom `config.php` file which connects to the database manually? Are you trying to use a resource model or entity ? here is how you can query a table using raw SQL but you need to know the tablename. ``` $w = Mage::getSingleton('core/resource')->getConnection('core_write'); $result = $w->query('select en...
[ 0.17851382493972778, -0.04079390689730644, 0.5985488891601562, 0.08356614410877228, -0.05322589352726936, 0.10938864201307297, 0.11420446634292603, -0.7843592762947083, -0.445400208234787, -0.41006597876548767, -0.2863995432853699, 0.5110940337181091, -0.2500099241733551, 0.034348271787166...
hope this answer helps :)
[ 0.4411858022212982, 0.4145703911781311, 0.2061643749475479, 0.17499057948589325, 0.39304855465888977, -0.015727801248431206, 0.4630137085914612, 0.3740989565849304, 0.0009420456481166184, -0.6014729738235474, 0.039858389645814896, 0.1984398365020752, 0.24429316818714142, -0.082834251224994...
I have designed a dataset using VS2008 dataset designer. In one of the datatables, I have set "AllowDBNull" property of most of the columns to be False. However, still if I create a DataRow containing null values for these columns, this datatable accepts this row, without any error. Am I not understanding something he...
[ 0.20190557837486267, 0.24917875230312347, 0.25509727001190186, 0.1292649805545807, -0.32450684905052185, -0.1258629709482193, 0.4815441071987152, -0.23649996519088745, -0.18563063442707062, -0.6160290241241455, -0.11142212152481079, 0.4965595304965973, -0.3998253345489502, 0.31451943516731...
have found the problem and reason. I am initializing a new row of the DataTable, before filling in the values to that row. While initializing the row, default value for string, ie, "" might be being filled in that column. I think that's it? Any ideas about this? **The short answer is:** `System.DBNull.Value != null` ...
[ 0.14498111605644226, 0.20403480529785156, 0.25764086842536926, -0.16619516909122467, -0.17022550106048584, -0.27681636810302734, 0.0708225890994072, 0.035439129918813705, -0.1493171751499176, -0.37883543968200684, -0.24288097023963928, 0.28420424461364746, -0.46317458152770996, 0.214196473...
the column to whatever the default value is for that column (for example, an `int` column would be initialized to 0). That is, using `null` can actually cause a non-null value to end up in the database, and therefore you won't get an error. If you instead set a database column to `System.DBNull.Value`, the column will...
[ 0.038818906992673874, -0.2335169017314911, 0.5454021692276001, 0.05368233844637871, 0.057242121547460556, -0.07581155002117157, 0.48465096950531006, -0.07665962725877762, -0.09261267632246017, -0.5201700329780579, -0.24824713170528412, 0.5879324674606323, -0.5526151657104492, 0.38209438323...
I have seen a few examples where the architecture is that there is java on the server side and c# on the client - what makes this combination so good? why would .net on both sides not be a better choice (or in fact, java on both sides?) added later: in lots of cases, the java is hosted on a windows server itself, i th...
[ 0.2600303292274475, 0.15335775911808014, -0.14813227951526642, 0.05000606179237366, -0.24965660274028778, -0.3792893886566162, 0.20986522734165192, 0.3333284854888916, -0.4396267235279083, -0.5176227688789368, -0.0844598039984703, 0.563186526298523, -0.2883198857307434, 0.0515543632209301,...
Windows development workstations to dedicated unix servers. * Java enforces a modular, object-oriented approach to coding, which allows for large-scale systems to be written (hopefully) without becoming unmanageable. (this is also true of C#/.NET, but not true of other back-end languages such as Perl or Python) * Java ...
[ 0.16587917506694794, 0.09104854613542557, 0.008126757107675076, 0.028197292238473892, -0.24604058265686035, -0.11224772781133652, 0.029891692101955414, 0.24180543422698975, -0.40416547656059265, -0.8833858370780945, -0.2608829438686371, 0.4140124022960663, -0.3404806852340698, -0.226597189...
particular quirks of an OS's UI, whereas C# is designed and maintained by Microsoft, for the purpose of writing Windows applications.
[ 0.22843323647975922, 0.2996492087841034, 0.10020500421524048, 0.2450200915336609, 0.03980519250035286, 0.1450391709804535, 0.3499929904937744, 0.2645954191684723, 0.06641954183578491, -0.32601311802864075, -0.2525848150253296, 0.36516693234443665, -0.1062227264046669, 0.17835858464241028, ...
I am doing a lot of image processing in GDI+ in .NET in an ASP.NET application. I frequently find that Image.FromFile() is keeping a file handle open. Why is this? What is the best way to open an image without the file handle being retained. * NB: I'm not doing anything stupid like keeping the Image object lying aro...
[ 0.7884013056755066, -0.14714935421943665, 0.5442008376121521, 0.02687055617570877, -0.3893837630748749, -0.34993141889572144, 0.24919600784778595, -0.038162220269441605, -0.43601852655410767, -0.6514927744865417, 0.29465559124946594, 0.34974205493927, -0.09160462021827698, 0.25099524855613...
**Calling the Image.Dispose() did not release the file handle in all cases.** 2. Using a FileStream and the Image.FromStream method works, and releases the handle on the file if you call Dispose() on the FileStream or wrap the whole thing in a Using {} statement as recommended by Kris. However if you then attempt to sa...
[ 0.3597008287906647, -0.2811402678489685, 0.5496230125427246, 0.01751348376274109, -0.10923648625612259, -0.30975911021232605, 0.39051178097724915, -0.37391096353530884, -0.12846554815769196, -0.5752654671669006, -0.03293304890394211, 0.6322755217552185, -0.2842038869857788, 0.0936076715588...
the Image object in memory. I was also able to save the Image to both a stream and a file (I needed to do both of these things). I was also able to save to a file with the same name as the originating file, something that is documented as not possible if you use the Image.FromFile method (I find this weird since surely...
[ 0.24290113151073456, -0.13253264129161835, 0.658976674079895, 0.10821263492107391, -0.0270770862698555, -0.13485212624073029, 0.08641857653856277, 0.025604061782360077, -0.24188077449798584, -0.8799618482589722, -0.0554765984416008, 0.884308934211731, -0.22788311541080475, 0.21721239387989...
For a webapp written in Grails I would like to keep track of the current users account. In addition the account-name should be displayed as part of the url. 1) Keep the variable in the session 2) Pass the variable via account parameters Currently I am experimenting with option 2 which allows me to create URL's like...
[ 0.32040131092071533, 0.07001276314258575, 0.4961259365081787, 0.1349819004535675, -0.38015493750572205, -0.11568766087293625, 0.5690876245498657, 0.03612500801682472, -0.36855974793434143, -0.5517271757125854, 0.026258675381541252, 0.4778501093387604, -0.15921159088611603, 0.10544231534004...
using a session variable to keep track of the user's account. Ie: `session.user = userAccount;`. You could set this in your login controller.
[ 0.045389916747808456, -0.18334849178791046, 0.18227308988571167, 0.061435047537088394, 0.11662209779024124, -0.30065056681632996, 0.49274563789367676, 0.2512967884540558, -0.302517294883728, -0.6466968655586243, -0.05608066916465759, 0.501936137676239, -0.24134279787540436, 0.1687749475240...
I have a `UIPickerView` on my `UIView` along with a `UITextField`. I am letting the user select a value from the picker or enter a custom value in the text field. When the user selects any option from the picker, the variable values are changed fine (in the `pickerView:didSelectRow:inComponent:`) method. But if the us...
[ 0.18264377117156982, -0.33676794171333313, 0.4731224775314331, -0.0026991029735654593, -0.06196843087673187, 0.043005090206861496, -0.058438047766685486, 0.14943096041679382, -0.13502034544944763, -0.74088454246521, -0.0013706064783036709, 0.6251344680786133, -0.22381822764873505, 0.195687...
the picker. But in that case, when the user edits the text field, the variable will have the text field's text. Now if the user decides to pick the first value again, the new value is not reflected in the variable. How can I overcome this? Thanks. Here's the relevant code In my `viewDidLoad` I have this statement to...
[ -0.3511699438095093, -0.313220351934433, 0.5368574261665344, -0.10247089713811874, -0.09379085153341293, 0.17919495701789856, -0.21828238666057587, -0.3601248264312744, -0.0875241756439209, -0.2828270196914673, -0.03680284321308136, 0.7102700471878052, -0.18286974728107452, 0.0374410487711...
UI label [self setSelectText:[myArray objectAtIndex:[pickerView selectedRowInComponent:0]]]; } ``` The problem arises when the user edits the text and then decides he after all wants to use the first value of the picker. In that case they will dismiss the keyboard and click on the 1st option of the picker (which ...
[ -0.42571505904197693, -0.16416297852993011, 0.6941470503807068, -0.11807822436094284, -0.19731996953487396, -0.1386745423078537, 0.08809755742549896, -0.1979086548089981, 0.04635361582040787, -0.6747369766235352, -0.25413158535957336, 0.47355982661247253, -0.1778712421655655, 0.18604610860...
the value of the picker each time you make a selection with this code: ``` - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component ``` you should "pull it" when the user clicks the button (or other event you are using) using something similar to: ``` - (void)myAct...
[ -0.3164398968219757, -0.4031882584095001, 0.5536987781524658, -0.16407431662082672, 0.07324377447366714, 0.2216118425130844, -0.31173861026763916, -0.12489914894104004, -0.2256816178560257, -0.3993370532989502, -0.009046658873558044, 0.4624970555305481, -0.16329963505268097, 0.061203856021...
have a value u use the TextField, if it doesn't have a value, you pull the information from the `Picker`.
[ 0.24994438886642456, -0.22849009931087494, 0.1321188062429428, 0.05958389863371849, 0.004611588548868895, -0.056899216026067734, -0.06136953830718994, 0.22170375287532806, 0.009916218928992748, -0.22587305307388306, -0.17945577204227448, 0.41224685311317444, -0.056792087852954865, 0.175724...
Currently I am working on small application in asp.net mvc. It is a some kind of localization tool. Our clients login on our application and they can translate terms that shows up in our applications that they use. It is happens like this: 1. login to localization site 2. find and translate certain terms for example t...
[ 0.44530925154685974, 0.06791328638792038, 0.28395435214042664, 0.02265939861536026, -0.04125949740409851, -0.1311989277601242, 0.17024067044258118, 0.17294669151306152, 0.004527944605797529, -0.933894157409668, 0.02414744906127453, 0.4461912512779236, 0.03973739594221115, 0.335729897022247...
application in asp.net mvc and I think, why we have separate logic(doubled) in mvc and in web services? Why we can't use only mvc as a web service...this way I have only one logic(fetching elements and updating) and we don't need to create wcf web service or something. And most important, I don't have mesh desktop appl...
[ 0.0371248796582222, -0.10576949268579483, 0.5118366479873657, 0.19363026320934296, -0.23234383761882782, -0.1533145308494568, 0.09607228636741638, -0.3656942546367645, -0.6262138485908508, -0.7823935151100159, 0.041490934789180756, 0.6279096603393555, -0.4420924484729767, 0.233387410640716...
as a web services. What is your experience? cheers Marko It really depends on your needs. You can most certainly use an ASP.NET MVC application as a data service, but it sounds like you should tease out your shared code into a common library and reference that library in both applications. There are some things that w...
[ 0.1714569479227066, -0.09162541478872299, 0.24420450627803802, 0.24133145809173584, -0.09327923506498337, -0.1050923615694046, 0.05960235372185707, -0.2359088808298111, -0.6412920355796814, -0.46727433800697327, -0.1382744312286377, 0.30656811594963074, -0.04366668686270714, 0.004062178544...
What is required to create a PDF file through an ASP.NET application other than Crystal Reports? You can use iText#, it's based on a similar Java project. <http://itextsharp.sourceforge.net/> You don't need Crystal Reports in conjunction with this. If you need something more robust (but pricey), I have used this to g...
[ 0.1789880394935608, -0.08339010924100876, 0.20353052020072937, 0.25847503542900085, -0.364088773727417, -0.4283980429172516, 0.020848765969276428, -0.061507321894168854, -0.16238263249397278, -0.5857855677604675, 0.012682783417403698, 0.6599166393280029, -0.05343588441610336, -0.017578125,...
I am creating an action script library.I am calling some APIs which parses some xml and gets me the result. It dispatches an Event.COMPLETE when the parsing is done. I want to monitor whether this event is dispatched in some while loop like "while(eventnotdispatched)" is it possible? I know the other way would be to ad...
[ 0.32491275668144226, -0.4975909888744354, 0.3411363363265991, 0.31960177421569824, -0.23350535333156586, -0.033884886652231216, 0.2183491289615631, -0.06800667196512222, -0.35696449875831604, -0.560437023639679, 0.08146388828754425, 0.5652410387992859, -0.28926223516464233, -0.130313441157...
an event listener. It will work something like this: ``` private var loadCompleted = false; private var timer:Timer= new Timer(1); private function onInitCompleted(event:Event):void { timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); } private function loadCompleteEventHandler(event:Eve...
[ 0.1489802747964859, -0.11366459727287292, 0.23345071077346802, -0.3258792757987976, 0.05893487110733986, -0.23290321230888367, 0.33712175488471985, -0.27971211075782776, -0.03583986684679985, -0.43035760521888733, -0.22172564268112183, 1.0540080070495605, -0.515345573425293, 0.071856625378...
NO REASON for you to need to do this. Whatever you are trying to do could be accomplished using another method much simpler. Tell me what you are trying to accomplish with this and I will present a better solution. Sorry for yelling, it's late and I am sleepy.
[ 0.6007993817329407, 0.0847729966044426, -0.09227196127176285, 0.1393696516752243, 0.16439849138259888, -0.4018004536628723, 0.6019033789634705, 0.01994231529533863, 0.3010495603084564, -0.6811791062355042, 0.27655062079429626, 0.3783363103866577, 0.07213521003723145, 0.27619871497154236, ...
How to get currently running application without using a system process? It depends on what you look for. If you are interested in the assembly that is calling you,then you can use [GetCallingAssembly](http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getcallingassembly.aspx). You could also use [GetEx...
[ 0.4268447756767273, -0.11369945108890533, 0.5035580396652222, 0.21123391389846802, 0.26849091053009033, -0.14540325105190277, 0.1415235549211502, -0.19505415856838226, -0.38580888509750366, -0.5725857615470886, -0.20779135823249817, 0.4600943624973297, -0.20935115218162537, 0.0333917811512...
I'm trying to find all data items that have long/lats that are contained by a polygon made up of an array of long lats could be many points. I know you can do this kind of stuff with the new geospacial datatypes in SQL 2008 but i'm using SQL 2005 and C#. Would this be best done on at the DB end or in C#. Thanks. You n...
[ 0.08278633654117584, 0.20902030169963837, 0.17283959686756134, -0.016753489151597023, -0.16692711412906647, -0.292499303817749, 0.30814725160598755, 0.16141723096370697, -0.18054015934467316, -0.7081515789031982, 0.0049870871007442474, 0.599263072013855, -0.21846388280391693, 0.11478766798...
How do I use LINQ across Queryable and non-Queryable data? With the following code I want to end up with a list of unselected users, i.e. everyone in allUsers that is not in selected. ``` public IQueryable<CompanyUser> FindAllUsersNotAssignedTothisCompany(int companyID) { var allUsers = Membership.GetAllUsers(); ...
[ -0.2120240181684494, 0.2334747165441513, 0.7447502613067627, 0.020371001213788986, 0.11755877733230591, -0.137231707572937, -0.043993864208459854, -0.27590298652648926, -0.09841829538345337, -0.508283257484436, -0.0471046082675457, 0.35850760340690613, -0.2236354798078537, 0.00064883520826...
Membership.GetAllUsers(); var selected = db.CompanyUsers.Where(c => c.CompanyID == companyID); return allUsers.Except(selected); } ``` However if db.CompanyUsers already has all the users and all you need is to retrieve the users that do not have the companyID in question just: ``` return db.CompanyUsers.Whe...
[ -0.015080919489264488, 0.06671679764986038, 0.43702030181884766, -0.17472997307777405, 0.19692504405975342, -0.20616649091243744, 0.277373731136322, -0.19841796159744263, -0.2693881690502167, -0.442453533411026, -0.3766162693500519, 0.332542359828949, -0.42034709453582764, 0.26230233907699...
I have a modeling question related to profiles. Firstly, I have looked into using the SQLTableProvider and using the in built profiling system but didn't feel they were suitable. So, with that said, I have a membership scheme where every person has a profile, then that person can upgrade their profile to either an indi...
[ 0.6177192330360413, 0.08986552804708481, 0.2995043396949768, -0.10415009409189224, -0.05181054770946503, -0.20318058133125305, 0.08997486531734467, -0.0912148579955101, -0.25938481092453003, -0.4678545594215393, 0.26804569363594055, 0.7084835171699524, -0.18580012023448944, 0.1708709895610...
company or individual edit pages are effectively updating both the base Profile table and also the individual/company tables from the same page. How would I go about implementing this within the model (which is currently generated via LinqToSQL) and also at the view level? Apologies if that wasn't very clear, tricky o...
[ 0.4392978250980377, 0.07452566921710968, 0.6878992319107056, 0.13611648976802826, 0.04347897320985794, -0.22185328602790833, -0.199260413646698, -0.12073737382888794, -0.3888314366340637, -0.4500139355659485, 0.07958030700683594, 0.4536110758781433, -0.19461381435394287, 0.0453399010002613...
classes allowing you to enhance entities or the context itself for additional functionality. The controller can work directly against the generated model and pass entities or collections of entities to the view as needed. I would suggest that, for what you appear to be trying to do, you might consider not using the...
[ 0.22292928397655487, -0.5132018327713013, -0.014379016123712063, 0.6372185349464417, -0.3279067873954773, -0.23285432159900665, 0.04608497396111488, 0.3003522753715515, -0.11575760692358017, -0.7846218347549438, 0.07493153214454651, 0.43261846899986267, -0.12931790947914124, 0.245888292789...
in the database... this makes getting at profile data very difficult from admin tools and such. Performance starts to become a problem VERY fast in any case where you are needing multiple user's profile information (such as with an admin user editor). For a when you are storing important personal details like the stu...
[ 0.6850894689559937, 0.27012333273887634, 0.06507132947444916, 0.3488929867744446, 0.17074808478355408, -0.46521255373954773, 0.2715512812137604, -0.08115625381469727, -0.37483569979667664, -0.5996827483177185, 0.20233668386936188, 0.5683661103248596, 0.12181015312671661, 0.0607867427170276...
account information. My rule of thumb is this: if the information is ONLY needed during a request made by the user to whome the data belongs, then it goes in profiles. If I would need the data for one user to be read during another user's request, or if I would need a "list" of that data for different users, then it ...
[ 0.3318691849708557, 0.24427303671836853, 0.6053463220596313, 0.015845749527215958, 0.3092651069164276, -0.15021862089633942, 0.05402618274092674, 0.008067772723734379, -0.2240067720413208, -0.5018149614334106, 0.1629619151353836, 0.517503023147583, -0.014195581898093224, -0.165282055735588...
I wanted to bring this challenge to the attention of the stackoverflow community. The original problem and answers are [here](http://blogs.msdn.com/ericlippert/archive/2009/04/15/comma-quibbling.aspx). BTW, if you did not follow it before, you should try to read Eric's blog, it is pure wisdom. **Summary:** Write a fu...
[ 0.12813393771648407, 0.24704347550868988, 0.39358019828796387, 0.025888996198773384, -0.027740992605686188, -0.2587161958217621, 0.46829137206077576, -0.29252317547798157, -0.3096039891242981, -0.20311789214611053, -0.041068919003009796, 0.48096373677253723, -0.45866021513938904, 0.1270633...
more than two items, say, "ABC", "DEF", "G", "H" then the resulting string is "{ABC, DEF, G and H}". (Note: no Oxford comma!) As you can see even our very own Jon Skeet (yes, it is well known that [he can be in two places at the same time](https://stackoverflow.com/questions/305223/jon-skeet-facts)) has posted a solut...
[ -0.0359642319381237, 0.14304320514202118, 0.09238835424184799, 0.3358723819255829, -0.024179423227906227, -0.033447399735450745, -0.11846361309289932, -0.22050026059150696, -0.45354434847831726, -0.4512312412261963, -0.1687518060207367, 0.22277727723121643, -0.2640659213066101, -0.29181128...
some time to challenges like this make you learn a lot. I twisted it a bit so it is a bit more performant and clear (by using Count and avoiding Reverse): ``` public static string CommaQuibbling(IEnumerable<string> items) { int last = items.Count() - 1; Func<int, string> getSeparator = (i) => i == 0 ? string.E...
[ -0.21370656788349152, -0.2651436924934387, 0.5355348587036133, 0.09492052346467972, -0.0074153379537165165, -0.060608915984630585, 0.29771512746810913, -0.37344157695770264, -0.16671951115131378, -0.6223496794700623, -0.32109004259109497, 0.6441073417663574, 0.03070785664021969, 0.03173502...
.Aggregate(answer, (s, a) => s + getSeparator(a.Index) + a.Value) + "}"; } ``` How about this approach? Purely cumulative - no back-tracking, and only iterates once. For raw performance, I'm not sure you'll do better with LINQ etc, regardless of how "pretty" a LINQ answer might be. ``` using System; using System.Coll...
[ 0.04601875692605972, -0.01800387352705002, 0.3924069106578827, -0.056086763739585876, -0.17749644815921783, 0.27987051010131836, 0.26995959877967834, -0.598564863204956, -0.33242398500442505, -0.6121969819068909, -0.04682561755180359, 0.4997110366821289, -0.3338499665260315, 0.144496574997...
{ if (iter.MoveNext()) { // first item can be appended directly sb.Append(iter.Current); if (iter.MoveNext()) { // more than one; only add each
[ 0.10599774122238159, -0.38018468022346497, 0.7207829356193542, -0.29002514481544495, -0.02557290717959404, 0.3988180160522461, -0.023548871278762817, -0.6345776915550232, -0.4227535128593445, -0.48285168409347534, -0.39316675066947937, -0.06334910541772842, -0.546240508556366, 0.1622892916...
// term when we know there is another string lastItem = iter.Current; while (iter.MoveNext()) { // middle term; use ", "
[ -0.19033069908618927, -0.6532739400863647, 0.6414428353309631, -0.48022884130477905, 0.17912843823432922, -0.007084032986313105, -0.0118617694824934, -0.2744266986846924, -0.10866855829954147, -0.46849673986434937, -0.42284587025642395, 0.33678674697875977, 0.014614892192184925, 0.43415060...
sb.Append(", ").Append(lastItem); lastItem = iter.Current; } // add the final term; since we are on at least the
[ 0.007957215420901775, -0.26676255464553833, 0.7939023375511169, -0.49935612082481384, 0.22182141244411469, 0.13236989080905914, 0.4683080017566681, -0.6739312410354614, -0.3357183635234833, -0.5211676955223083, -0.3534601330757141, 0.13305838406085968, -0.25323379039764404, 0.1504086554050...
// second term, always use " and " sb.Append(" and ").Append(lastItem); } } } return sb.Append('}').ToString(); } static void Main()
[ -0.024104775860905647, -0.2794945538043976, 0.3295981287956238, -0.5781041979789734, 0.1322791874408722, 0.1537020206451416, 0.5768183469772339, -0.4725531339645386, -0.07377254217863083, -0.44907277822494507, -0.5258890986442566, 0.4375637173652649, -0.47620147466659546, 0.250167906284332...
{ Console.WriteLine(CommaQuibbling(new string[] { })); Console.WriteLine(CommaQuibbling(new string[] { "ABC" })); Console.WriteLine(CommaQuibbling(new string[] { "ABC", "DEF" })); Console.WriteLine(CommaQuibbling(new string[] { "ABC", "DEF", "G", "H" })); } } ```
[ -0.4102190136909485, 0.08711996674537659, 0.7560732364654541, -0.29508596658706665, 0.30383145809173584, 0.17793729901313782, 0.22630523145198822, -0.245961993932724, -0.023036951199173927, -0.7358552813529968, -0.6012944579124451, 0.8050289154052734, -0.45003193616867065, 0.18149727582931...
I have a relationship table : ``` create_table "animal_friends", :force => true do |t| t.integer "animal_id" t.integer "animal_friend_id" t.datetime "created_at" t.datetime "updated_at" t.integer "status_id", :default => 1 end ``` linking animals to others. Best way to retreive associ...
[ 0.02303740195930004, 0.30260276794433594, 0.27879637479782104, -0.0790511965751648, -0.10715220868587494, 0.08971928060054779, 0.07496737688779831, -0.47772520780563354, 0.02484484203159809, -0.3689882159233093, 0.38401341438293457, 0.4099171757698059, -0.2439659982919693, 0.06909529864788...
to create a proper has\_many relation in rails with this. Apparently, there's no way to provide joining conditions for has\_many. I'm currently using a finder\_sql : ``` has_many :friends, :class_name => "Animal", :finder_sql => 'SELECT animals.* from animals join animal_friends as af on animals.id = case when af.ani...
[ -0.004785899538546801, 0.010035870596766472, 0.43635281920433044, -0.04953690990805626, -0.05795321241021156, -0.12540709972381592, 0.28234750032424927, -0.5830163955688477, 0.018800823017954826, -0.70290207862854, 0.24903959035873413, 0.6380508542060852, -0.2583713233470917, 0.08402819186...
/ req). I guess it's a missing feature from AR, but I'd like to be sure first :) Thanks You could solve this on the database level with a view, which would be the correct method anyway. ``` CREATE VIEW with_inverse_animal_friends ( SELECT id, animal_id, animal_friend_id, created_at, ...
[ 0.3286159932613373, 0.0327129028737545, 0.30907803773880005, -0.22301629185676575, -0.17544792592525482, 0.3183498978614807, 0.02350909821689129, -0.21339154243469238, -0.04614153876900673, -0.7458664774894714, 0.22734397649765015, 0.5842236876487732, -0.3733648955821991, 0.038555759936571...
animal_friend_id AS animal_id, animal_id AS animal_friend_id, created_at, updated_at, status_id FROM animal_friends ) ``` If you dont want to have double entries for friends with relations both ways you could do this: ``` CREATE VIEW unique_animal_friends ( SELECT MIN(id), a...
[ 0.14842264354228973, 0.018185531720519066, -0.006164229940623045, 0.006477230694144964, 0.08171338587999344, 0.3100791871547699, 0.002336731180548668, -0.009800266474485397, -0.20861150324344635, -0.6869414448738098, 0.19005540013313293, 0.4924764633178711, -0.10712599754333496, -0.0146299...
animal_friend_id, created_at, updated_at, status_id FROM animal_friends UNION SELECT id, animal_friend_id AS animal_id, animal_id AS animal_friend_id, created_at,
[ 0.3269389271736145, -0.16963088512420654, -0.06318777799606323, -0.2521592080593109, -0.07633739709854126, 0.4504714608192444, 0.06477301567792892, -0.015148064121603966, -0.11956551671028137, -0.625592052936554, -0.13577143847942352, 0.375274658203125, -0.3332567512989044, 0.1433075815439...
updated_at, status_id FROM animal_friends) AS all_animal_friends GROUP BY animal_id, animal_friend_id ) ``` You would need a way to decide which status\_id to use in case there are two conflicting ones. I chose MIN(status\_id) but that is probably not what you want. In Rails you can do this now: ...
[ 0.00120510661508888, -0.16042925417423248, 0.1780933439731598, 0.01325074303895235, 0.01633722335100174, 0.07813640683889389, 0.14198271930217743, -0.07899649441242218, -0.27977001667022705, -0.97393798828125, 0.21105600893497467, 0.7354137897491455, -0.1321568638086319, 0.0246897581964731...
need some plugin for view handling in rails (like "redhillonrails-core").
[ 0.05222277343273163, -0.3383733034133911, 0.30217549204826355, 0.6153373718261719, 0.026201359927654266, -0.07042697817087173, 0.27998560667037964, 0.16565775871276855, -0.19914649426937103, -0.6996986269950867, 0.16682609915733337, 0.40870457887649536, 0.01807880960404873, -0.242710113525...
Is it possible to define a DynamicMethod with generic type parameters? The MethodBuilder class has the DefineGenericParameters method. Does the DynamicMethod have a counterpart? For example is it possible to create method with a signature like the one given blow using DynamicMethod? ``` void T Foo<T>(T a1, int a2) ``...
[ 0.12282726913690567, -0.5483907461166382, 0.36491960287094116, 0.1398238092660904, -0.2581915557384491, 0.06654626131057739, 0.09431488066911697, -0.29991352558135986, -0.26839229464530945, -0.2864200174808502, 0.16860224306583405, 0.5406564474105835, -0.5699282288551331, 0.060065101832151...
typeof(V), typeof(int)}; DynamicMethod method = new DynamicMethod("FooDynamic", typeof(V), args); // emit it return (Foo<V>)method.CreateDelegate(typeof(Foo<V>)); } } ``` You can call it like this: ``` Dynamic<double>.Foo(1.0, 3); ```
[ 0.580710768699646, -0.4201210141181946, 0.3610745370388031, -0.3587689995765686, 0.10402444005012512, 0.12643474340438843, 0.10265111923217773, -0.16859370470046997, -0.25633108615875244, -0.35401028394699097, -0.020729446783661842, 0.4527265131473541, -0.6263158917427063, 0.45057234168052...
I have just started to learn Ruby and got a good take on the basics. I keep hearing that one of the cool things that Ruby does very well is metaprogramming, but none of the tutorials I've read cover this. Searching Google I can only seem to find paid for ruby metaprogramming screen casts. So, where can I find a good R...
[ 0.704663097858429, 0.2087661325931549, 0.02937019243836403, 0.012172440066933632, -0.18531140685081482, -0.03339910879731178, 0.7531511187553406, 0.42539918422698975, -0.29183629155158997, -0.5528841018676758, 0.2311091125011444, 0.6722960472106934, 0.05471023917198181, 0.04238682985305786...
I want to be able to initialize a vector of a size 'SIZE' before main. Normally I would do ``` static vector<int> myVector(4,100); int main() { // Here I have a vector of size 4 with all the entries equal to 100 } ``` But the problem is that I would like to initialize the first item of the vector to be of a ...
[ -0.13399489223957062, -0.17116814851760864, 0.28824111819267273, -0.17097388207912445, -0.28488701581954956, 0.24221642315387726, -0.0002802293747663498, -0.3081718981266022, -0.3393293023109436, -0.4964139461517334, -0.2095312774181366, 0.3736981153488159, -0.4837167263031006, 0.014473137...
init() { myVector[0] = 42; return true; } bool initresult = init(); int main() { ; } ```
[ -0.26180168986320496, 0.03565428778529167, 0.23680102825164795, -0.3890306353569031, 0.09527266770601273, 0.11926164478063583, 0.6759830713272095, 0.00715413736179471, 0.27650490403175354, -0.28221091628074646, -0.38169753551483154, 0.31622955203056335, -0.3815111219882965, 0.2952739596366...
I get very confused when it comes up to byte conversation. I need to do two convertions: 1.We have a byte[] array { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 }; How do I convert it to string so I get "30 31 32 33 34 35". 2.We have the same byte[] array Now I need to convert it to ASCII(0x30 = 0, 0x31 = 1, 0x32 = 2 and so...
[ 0.0656936839222908, 0.2611522078514099, 0.3943144381046295, -0.3351772427558899, -0.17266051471233368, 0.39079394936561584, 0.21906255185604095, -0.6412846446037292, -0.15549582242965698, -0.6113969087600708, -0.08760864287614822, 0.5817647576332092, -0.16188566386699677, 0.154068917036056...
the output as a single `string` (as opposed to `IEnumerable`s), you could do: ``` var str = String.Join(" ", bytearr.Select(x => x.ToString("x2")).ToArray()); var ascii = new string(bytearr.Select(x => (char)x).ToArray()); ```
[ -0.042153604328632355, -0.04255475476384163, 0.4252369999885559, -0.13877125084400177, -0.22506120800971985, 0.29934409260749817, 0.12369578331708908, -0.41480982303619385, -0.09810697287321091, -0.2469247430562973, -0.2183561772108078, 0.3387613892555237, -0.3520849049091339, 0.3055312633...
Is there a good debugging tutorial for VS 2008 (C#, more precisely)? I have found a good deal of resources on the web, but they are still lacking a comprehensive, step by step, approach. Would you have any suggestions? These aren't specific to Visual Studio 2008, but their information is certainly still valid when deve...
[ 0.04353262111544609, -0.18344078958034515, -0.20448634028434753, 0.2992608845233917, -0.02078312449157238, -0.17279258370399475, 0.13713575899600983, 0.053618378937244415, -0.17234733700752258, -0.3799020051956177, 0.3065212070941925, 0.5447726845741272, 0.08386428654193878, -0.54557192325...
Microsoft .NET 2.0 Applications"](https://rads.stackoverflow.com/amzn/click/com/0735622027). John covers quite a bit of Visual Studio IDE kung fu which may be precisely what your looking for. If thats not quite enough, and you don't mind your brain melting, you can pick up a copy of ["Microsoft Windows Internals (4th ...
[ 0.05038955807685852, 0.42692652344703674, 0.1478194296360016, -0.042283181101083755, 0.04810640588402748, -0.019783319905400276, 0.30633077025413513, -0.21350222826004028, -0.072532519698143, -0.48301610350608826, -0.2287709265947342, 0.3378542363643646, -0.30541837215423584, -0.2921659052...
In a non-sharded DB, I could just use auto-increment to generate a unique ID to reference a specific row. I want to shard my DB, say into 12 shards. Now when I insert into a specific shard, the auto-increment ID is no longer unique. Would like to hear anyone's experience in dealing with this problem. A few approaches...
[ 0.0537976436316967, 0.3669966161251068, 0.058756422251462936, 0.06476368755102158, -0.7439700365066528, 0.4531523883342743, 0.12319235503673553, -0.6374411582946777, 0.22946536540985107, -0.5472614765167236, 0.026142437011003494, 0.38310202956199646, -0.2888846695423126, 0.2110776752233505...
How can I know what date format user prefers? Is there a way to read it from phone's local settings? Does the user prefer to read date in format "dd/mm/yyyy" or "mm/dd/yyyy"? Thank you in advance. Use NSDateFormatter, but set the style (not the format) so it uses the user's locale formats. e.g. create an NSDateForma...
[ 0.5205594301223755, 0.014441585168242455, 0.8405141234397888, 0.17051444947719574, 0.14734819531440735, -0.2580896317958832, 0.17118945717811584, -0.16915784776210785, 0.10482869297266006, -0.6732478141784668, -0.14613667130470276, 0.273335725069046, 0.2763644754886627, 0.06123785302042961...
Say I have some C++ project which builds an exe or dll file. The project is checked into a SVN repository. I want to automatically synchronize the revision from SVN with the version resource embedded in my exe/dll file, i.e. the version should be something like **$major.$minor.$svn\_revision**. Any ideas on how to a...
[ 0.2973138391971588, -0.05353375896811485, 0.6609004139900208, -0.05957787111401558, 0.13355979323387146, -0.05113135650753975, 0.3018825948238373, 0.05601365491747856, -0.6408251523971558, -0.6058555245399475, -0.171558678150177, 0.8174447417259216, -0.06525969505310059, 0.5005159378051758...
copy from `yourfile.txt.template`, do the substitutions, and write to `yourfile.txt`. Note that there's a lot of other macros you can use as well, if you execute `SubWCRev` without any arguments, it'll list them all on the console.
[ 0.2678384482860565, -0.25136885046958923, 0.3668209910392761, 0.10482696443796158, 0.1290765255689621, -0.053966473788022995, 0.07251103222370148, 0.3520529270172119, -0.11539530009031296, -0.708581805229187, -0.19434869289398193, 0.8258523344993591, -0.28765952587127686, -0.04575173556804...
Is it possible to get the actual URL (as opposed to the `src` attribute value) of an image within the current DOM using jQuery or JavaScript? i.e. retrieve "example.com/foo.jpg" as opposed to "foo.jpg" (taking `<base>` elements into account) What about any other interesting properties such as the mime type, file siz...
[ 0.10227525979280472, -0.1203162670135498, 0.8552157878875732, -0.039159007370471954, -0.006216384004801512, -0.1415962278842926, 0.16863606870174408, -0.12753012776374817, -0.23949505388736725, -0.35422059893608093, -0.4960533082485199, 0.6636466979980469, -0.07205283641815186, -0.05390971...
the rest of the information, could you use an AJAX request and look at the header & data sent?
[ 0.5331729650497437, -0.038217365741729736, -0.013692005537450314, 0.6694397926330566, 0.0047453828155994415, -0.46110042929649353, -0.03787930682301521, 0.5109952688217163, -0.06074553355574608, -0.2968493402004242, 0.2292761355638504, 0.22172386944293976, 0.08431376516819, 0.1361886262893...
### Duplicate: > [Why Must I Initialize All Fields in my C# struct with a Non-Default Constructor?](https://stackoverflow.com/questions/721246/c-struct-ctor-issues) --- If in the constructor of an struct like ``` internal struct BimonthlyPair { internal int year; internal int month; internal int count;...
[ -0.015284275636076927, 0.39156973361968994, 0.391480416059494, -0.03705938532948494, 0.08730360865592957, 0.21630440652370453, 0.26378050446510315, 0.0446116141974926, -0.4501422643661499, -0.2027358114719391, -0.20015591382980347, 0.22002631425857544, -0.2476346343755722, 0.39111474156379...
fully assigned > before control is returned to the > caller But if I assign all fields, including count in this case, with something like ``` this.year = year; this.month = month; this.count = 0; ``` the error disappeared. I think this happens because C# doesn't initialize struct fields when somebody creates a n...
[ 0.18342888355255127, -0.1593182533979416, 0.47634822130203247, 0.06626621633768082, -0.24396340548992157, -0.15750150382518768, 0.34835872054100037, -0.05757329240441322, -0.11049674451351166, -0.3487740755081177, -0.29209136962890625, 0.218938946723938, -0.14091409742832184, 0.24198667705...
no code that enforces it, so it's up to you to make sure that the entire struct has a value.
[ 0.6841400861740112, 0.22128283977508545, 0.024638582020998, 0.27779605984687805, -0.12245066463947296, -0.06670384854078293, 0.23564529418945312, -0.08184880018234253, 0.009863966144621372, -0.21461555361747742, -0.008283215574920177, 0.5835965275764465, -0.08908309042453766, -0.0367012247...
What do you suggest for JS development IDE. Is there something similar to VisualStudio IDE, so I can run/debug my application in it? A few options: * Visual Studio 2008 (including VWD Express, <http://blog.berniesumption.com/software/how-to-debug-javascript-in-internet-explorer/>) * Adobe Dreamweaver CS4 * Notepad++ (...
[ 0.44545143842697144, -0.052494410425424576, -0.07979462295770645, 0.09289395809173584, -0.25311583280563354, 0.01562626287341118, -0.053406573832035065, -0.0404578298330307, -0.30537155270576477, -0.454479843378067, 0.12876377999782562, 0.6307295560836792, -0.3100922703742981, -0.213324368...
I would like to be able to do one or more of the following from the shell: - call any function from the program not only the main - pass parameters that are not only strings (not only argv) - have a program return not only int (the return code from main) - assign returned values to shell-level variables to be able ...
[ 0.35595983266830444, -0.09168193489313126, 0.0034281278494745493, 0.02288133278489113, -0.1467619240283966, -0.32730457186698914, -0.06776701658964157, -0.037374019622802734, -0.11917486041784286, -0.23918794095516205, -0.03999480605125427, 0.7987383008003235, -0.28314125537872314, -0.1856...
this - the vxWorks shell/C interpreter does this. But, it's vxWorks - a realtime operating system (no GUI).
[ 0.040854740887880325, 0.15003468096256256, 0.316203236579895, 0.20131394267082214, 0.04815295711159706, -0.34099671244621277, 0.07420287281274796, 0.29237374663352966, 0.006111040711402893, -0.43333011865615845, -0.18480955064296722, 0.9137008190155029, -0.5573498010635376, -0.143410652875...
I want to achieve the effect of a 2D image I have but a little inclined, for example a plane, I want the image can be rotated about its axis Y. .. anyone can help me with some idea of how to do ..\*\* Basically you need a little linear geometry/algebra, and/or a package to do them for you. From the geometry point of v...
[ 0.583079993724823, 0.199677973985672, 0.3291591703891754, 0.3333806097507477, 0.015244575217366219, 0.16180361807346344, -0.20434287190437317, 0.08752691745758057, -0.17765173316001892, -0.683506965637207, 0.16998393833637238, 0.5991381406784058, 0.12545455992221832, 0.09185108542442322, ...
size, each point is mapped to a pixel on the screen. Otherwise you have to go through a computation that makes that mapping, which involves a trig function for the angles in the *x,y,z* directions between that plane and the plane of the screen. The linear algebra comes in because the easy way to handle this computation...
[ 0.040707338601350784, 0.2077074497938156, 0.4054366946220398, -0.039483603090047836, -0.09572848677635193, 0.3845585882663727, -0.2702413499355316, -0.5286471843719482, -0.6258857846260071, -0.5707111954689026, 0.05619729310274124, 0.2997691035270691, -0.01989009790122509, -0.0020013218745...
a package, there's good 3D graphics in Java. Even better, there are good tutorials: * [The Java3D tutorial at Sun](http://java.sun.com/developer/onlineTraining/java3d/). * the stuff at [j3d.org](http://www.j3d.org/) * a whole list of them at [java3d.org](http://www.java3d.org/)
[ 0.33903560042381287, 0.11521194130182266, 0.058437976986169815, 0.06285989284515381, -0.3372131288051605, -0.24115854501724243, 0.12196806073188782, 0.052724577486515045, -0.18779848515987396, -0.7072358131408691, -0.06587372720241547, 0.6106913685798645, -0.09462611377239227, -0.185688123...
***Scroll down to see latest edit, I left all this text here just so that I don't invalidate the replies this question has received so far!*** --- I have the following brain teaser I'd like to get a solution for, I have tried to solve this but since I'm not mathematically that much above average (*that is, I think I'...
[ 0.36890000104904175, 0.2759040892124176, 0.4001276195049286, 0.2524986267089844, -0.20071817934513092, 0.2385813593864441, 0.19345811009407043, 0.22277595102787018, -0.4214738607406616, -0.5533109903335571, 0.09033496677875519, 0.3244266211986542, -0.1491205394268036, 0.37063509225845337, ...
(technically an `array of integers`) the last number should be added instead of multiplied to be able to convert the multipliers back to original number. As an example, lets assume `x=29` and `y=10`. In this case the expected array would be `{10,2,9}` meaning `10*2+9`. However if `y=5`, it'd be `{5,5,4}` meaning `5*5+...
[ 0.045525893568992615, -0.05594830587506294, 0.32021474838256836, -0.3125661313533783, -0.12508726119995117, 0.24211394786834717, 0.03601761907339096, -0.5127379298210144, -0.32790130376815796, -0.4754893481731415, -0.09658336639404297, 0.5576585531234741, -0.3560638427734375, -0.0051124473...
store the "leftover" part separately and add that after everything else but that didn't work either. I believe my main problem is that I try to think this in a way too complex manner while the solution is blatantly obvious and simple. To reiterate, these are the limits this algorithm should have: * has to work with 6...
[ 0.2976127564907074, -0.040420569479465485, -0.09208378195762634, 0.22757671773433685, -0.03151246905326843, 0.0017932795453816652, 0.3327963948249817, 0.0313517190515995, -0.3395240306854248, -0.5724437236785889, 0.0825139731168747, 0.46580812335014343, -0.1670108139514923, -0.171234473586...
rather take any possible code examples as pseudocode, I specifically do NOT want readily made answers, I just need a nudge (well, more of a strong kick) so that I can solve this at least partly myself. Thanks in advance. Edit: Further clarification --------------------------- To avoid some confusion, I think I should...
[ 0.19504912197589874, 0.08246450126171112, 0.2777596712112427, 0.14426061511039734, -0.3825117349624634, 0.08515733480453491, 0.19779157638549805, 0.09283989667892456, -0.4155837297439575, -0.4868178963661194, -0.09125538170337677, 0.5807369947433472, 0.11189846694469452, 0.0620885714888572...
multiple answers to most of the numbers available, however I'm looking for the one with least amount of math ops. As far as my logic goes, that means finding the maximum amount of as big multipliers as possible, for example `x=1 000 000,y=100` is `100*100*100` even though `10*10*10*10*10*10` is equally correct answer m...
[ 0.22204336524009705, -0.028382834047079086, 0.19629345834255219, 0.6591875553131104, -0.22789861261844635, 0.2634093761444092, 0.2596018612384796, 0.10761456936597824, -0.41808977723121643, -0.4771856665611267, 0.3034174144268036, 0.625199019908905, -0.09715956449508667, -0.083681710064411...
for in here just can't be done the way I thought it could be. I was too ambiguous with my goal and after giving it a bit of a thought I decided to just tell you in its entirety what I'd want to do and see what you can come up with. My goal originally was to come up with a specific method to pack 1..n large integers (a...
[ 0.17249824106693268, 0.04098273441195488, 0.16654707491397858, -0.20566441118717194, -0.00987323373556137, 0.3880053460597992, -0.08761810511350632, -0.49758705496788025, -0.19736377894878387, -0.1857510805130005, 0.3314044773578644, -0.11779040843248367, -0.2636115849018097, 0.11257621645...
characters isn't. For this I wanted to somehow combine the numbers since it is expected that the numbers are somewhat close to each other. I firsth thought that representing `100, 121, 282` as `100+21+161` could be the way to go but the saving in string length is neglible at best and really doesn't work that well if t...
[ -0.1592767983675003, 0.12218120694160461, 0.34724125266075134, -0.0028360977303236723, -0.3109414279460907, 0.6204925179481506, -0.042362384498119354, -0.4485619068145752, 0.003742991480976343, -0.6248632073402405, 0.2014782577753067, -0.033264439553022385, 0.16855038702487946, 0.087752982...
which I can then represent as a string. This is where this problem steps in, I thought that for example 1 000 000 and 100 000 can be expressed as 10^(5|6) but due to the context of my aimed usage this was a bit too flaky: **The context is Web.** RESTful URL:s to be specific. That's why I mentioned of thinking of using...
[ 0.19691415131092072, 0.11620713770389557, 0.49643459916114807, -0.00844645407050848, -0.12930385768413544, 0.22795896232128143, 0.20052388310432434, -0.07521764934062958, -0.26821285486221313, -0.5442266464233398, -0.016135474666953087, 0.1420830637216568, -0.10603827238082886, 0.181795969...
creating a base 64-like number system for expressing base 10/2 numbers but since I'm not a math genius I have no idea beyond this point how to do it. The bounty ---------- Now that I have written the whole story (sorry that it's a long one), I'm opening a bounty to this question. Everything regarding requirements for...
[ 0.24674400687217712, 0.23761238157749176, 0.4135752022266388, 0.33624204993247986, -0.018546177074313164, 0.17115114629268646, -0.07314091920852661, 0.16860784590244293, -0.40156859159469604, -0.49532365798950195, 0.3704451024532318, 0.33568769693374634, 0.18385596573352814, 0.043103665113...
given. I spread a few comments to responses mostly for future reference and myself, you can also check out my [SO Uservoice](http://stackoverflow.uservoice.com/pages/1722-general/suggestions/178706-add-a-way-to-spread-bounty-to-multiple-answers) suggestion about spreading bounty which is related to this question if you...
[ 0.4057648181915283, -0.08359519392251968, 0.20772674679756165, 0.31895580887794495, -0.3085102140903473, 0.1472766399383545, -0.09989497065544128, -0.44330480694770813, -0.3586985468864441, -0.4703664481639862, 0.09303493797779083, 0.0019414876587688923, -0.1696375608444214, 0.068426154553...
hours or maybe even weeks/years for reasonable values of y. For x = 2^32-1 and y = 256, it took 1.68 seconds on my core duo 1.2 ghz. ``` >>> import time >>> def test(): ... before = time.time() ... print factor(2**32-1, 256) ... print time.time()-before ... >>> test() [254, 232, 215, 113, 3, 15] 1.68499994...
[ 0.32495394349098206, 0.1088121309876442, 0.40483909845352173, 0.1296069473028183, 0.06674271821975708, 0.2921246588230133, 0.48629483580589294, -0.5202906131744385, 0.05997925624251366, -0.5449880957603455, -0.12148711085319519, 0.5127401947975159, 0.2438141256570816, -0.011954138055443764...
# try all possible remainders from 0 to y for remainder in xrange(y+1): output = [] composite = x - remainder factors = getFactors(composite) # check if any factor is larger than y bad_remainder = False for n in factors.iterkeys(): if n >
[ -0.06241637095808983, -0.1412547081708908, 0.05315371975302696, -0.1575297713279724, -0.08914154767990112, 0.3812982141971588, 0.4764004349708557, -0.5679459571838379, -0.3162446916103363, -0.1747821867465973, -0.022160544991493225, 0.35050925612449646, -0.36557692289352417, -0.09338422119...
y: bad_remainder = True break if bad_remainder: continue # make the best factors while True: results = largestFactors(factors, y) if results == None: break
[ -0.17140060663223267, 0.03854140266776085, 0.40585967898368835, -0.09619373083114624, 0.2644941806793213, -0.08949767053127289, 0.29036858677864075, -0.41121578216552734, -0.4013543128967285, -0.18360482156276703, -0.3243211507797241, 0.5265743136405945, -0.2353673279285431, 0.135177522897...
output += [results[0]] factors = results[1] # store the best output output = output + [remainder] if len(best_output) == 0 or len(output) < len(best_output): best_output = output return best_output # Heuristic # The bigger the number the better. 8 is more compact t...
[ -0.6083144545555115, -0.16561372578144073, 0.3603849411010742, -0.05739907920360565, -0.1283695548772812, 0.23612678050994873, 0.0396600142121315, -0.5321564674377441, -0.5005811452865601, -0.6223245859146118, -0.1770801544189453, 0.6600953340530396, -0.08322080969810486, -0.24428114295005...
most factors you can have below or equal to y # output the number and unused factors that can be reinserted in this function def largestFactors(factors, y): assert(y > 1) # iterate from y to 2 and see if the factors are present. for i in xrange(y, 1, -1): try_another_number = False factors_b...
[ -0.20630811154842377, -0.24743390083312988, 0.44496986269950867, -0.08613600581884384, -0.25399941205978394, 0.09380172938108444, 0.0698261559009552, -0.7110022306442261, -0.2218031883239746, -0.6091670393943787, -0.014407890848815441, 0.8260437250137329, -0.46529877185821533, -0.042577881...
number in factors: if factors[number] < copies: try_another_number = True continue # not enough factors else: try_another_number = True
[ 0.2579074203968048, -0.2450714111328125, 0.40575671195983887, -0.0373346321284771, 0.13870510458946228, 0.22132515907287598, 0.3239542245864868, -0.5741130709648132, -0.5134294033050537, -0.5347983241081238, 0.039900656789541245, 0.46770983934402466, -0.402912974357605, 0.15108226239681244...