text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I have a VB6 picture box that gets an image from a video capture device. I'm trying to figure out how to then convert the picture box to a byte array. ``` Private Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBi...
[ 0.06749602407217026, 0.04468510299921036, 0.3140065670013428, 0.1653805375099182, -0.2159772366285324, -0.017105376347899437, 0.3578767776489258, -0.18875691294670105, -0.06185460835695267, -0.5079410076141357, -0.15242566168308258, 0.5386682748794556, -0.3393569588661194, 0.03592832013964...
(ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long Private Sub GetPictureBytes() Dim PicBits() As Byte, PicInfo As BITMAP GetObject Picture1.Picture, Len(PicInfo), PicInfo ReDim PicBits((PicInfo.bmWidth * PicInfo.bmHeight * 3) - 1) As Byte GetBitmapBits Picture1.Picture, UBound(PicBits), ...
[ 0.00773071963340044, -0.2515052855014801, 0.8617217540740967, 0.22099784016609192, 0.07124848663806915, 0.1709572970867157, 0.20659883320331573, -0.306656152009964, -0.3349977731704712, -0.20616182684898376, -0.4567108154296875, 0.4940755367279053, -0.09580207616090775, 0.07341127097606659...
Ok. I'm having an issue with the following bit of code: ``` StreamReader arrComputer = new StreamReader(FileDialog.FileName); ``` My first question had been answered already now my second question focuses on the tail end of this code. I'm reading a text file `StreamReader` that the user selects with a button event ...
[ 0.02358105219900608, -0.03713015466928482, 0.526037871837616, -0.07053975015878677, 0.19957903027534485, -0.15624701976776123, -0.0050116488710045815, 0.15403330326080322, -0.2740044891834259, -0.6333154439926147, -0.2881793677806854, 0.6938031911849976, -0.487517386674881, 0.1867850720882...
fileDialog.Filter = "Text|*.txt|All|*.*"; if (fileDialog.ShowDialog() == DialogResult.OK) ; textBox1.Text = fileDialog.FileName; buttonRun.Enabled = true; } ``` The later in the code the user will click a "Run" button to execute some code against each item in the list. I'm...
[ 0.04973170533776283, -0.313896119594574, 0.6093411445617676, -0.11875210702419281, 0.354884535074234, 0.06991013139486313, 0.2738193869590759, -0.09671799093484879, -0.4978969991207123, -0.7191547155380249, -0.0593990832567215, 0.5978727340698242, -0.7137465476989746, 0.07280687987804413, ...
{ StreamReader arrComputer = new StreamReader(FileDialog.FileName); } ``` This is the error I receive from my coding: ``` "An object reference is required for the non-static field, method, or property 'System.Windows.Forms.FileDialog.FileName.get' " ``` I think I understand the problem but I'm...
[ 0.02066972106695175, -0.22439560294151306, 0.37693077325820923, 0.056107569485902786, 0.21522656083106995, 0.11822293698787689, 0.3056497275829315, 0.20847484469413757, -0.1271751970052719, -0.7716396450996399, -0.046843260526657104, 0.6901768445968628, -0.6195768117904663, 0.3803785443305...
the file name from the dialog you created in the previous method. That's not what you're doing, though. The compiler interprets your code as an attempt to read the FileName property of the FileDialog class as though it were a static member. There are other problems in your code, but the problem that's causing the compi...
[ 0.17253562808036804, 0.042181629687547684, -0.053309328854084015, 0.23507723212242126, 0.015005513094365597, -0.05395841225981712, 0.03395390883088112, 0.12135111540555954, -0.4635598361492157, -0.5377007126808167, 0.015574323013424873, 0.6858647465705872, -0.4929921329021454, 0.4957278370...
But since you've also stored the file name in the text box, you can read the file name out of that text box, so you don't need access to the OpenFileDialog object.
[ 0.09004528820514679, -0.14371253550052643, 0.3185289800167084, 0.1379411369562149, 0.07705661654472351, -0.3141244649887085, 0.09573914110660553, 0.5668861269950867, -0.4466181695461273, -0.6897798776626587, -0.28304675221443176, 0.402261883020401, -0.052494872361421585, 0.3630326092243194...
Just wondering if anyone has any favourite SQL references they to use when creating new queries. Possibly something that shows syntax, or available functions? If you're looking for one with just very basic functions you can try this to see if it fits your need. <http://www.sql.su/> You might have to paste the parts t...
[ 0.5577417612075806, 0.0773942694067955, 0.38449421525001526, 0.31822726130485535, -0.028103681281208992, 0.030880503356456757, 0.24842652678489685, 0.39926791191101074, -0.2536798119544983, -0.44023457169532776, 0.12218895554542542, 0.1579969972372055, -0.2523502707481384, 0.03076951205730...
I have a large dataset (over 100,000 records) that I wish to load into a DataGridView. The stored procedure that does this can take 10 seconds or more to complete. So far I have a BackgroundWorker preventing the UI from locking up, and have implemented a rudimentary 'Please Wait' dialog. What I'd like to do is someho...
[ 0.4551333785057068, -0.016059035435318947, 0.6549807190895081, 0.011135922744870186, 0.26954078674316406, -0.14236566424369812, 0.15082457661628723, 0.07026863098144531, -0.10497220605611801, -0.6538276076316833, 0.11319919675588608, 0.41650882363319397, -0.08272313326597214, 0.18800976872...
also a button to stop the query and keep the rows that have been returned. How can I do this in my own code? The DataGridView is only used to display the rows of data, and then the user clicks one to do something else. Nothing gets written back to the database. 100,000 rows in a datagridview? just say "no"! 1. the u...
[ 0.19094379246234894, -0.00854541826993227, 0.6937301158905029, 0.21585126221179962, -0.11700662225484848, 0.2108953595161438, 0.4787813425064087, -0.08610716462135315, -0.3068602383136749, -0.7510258555412292, 0.17307204008102417, 0.5196983814239502, -0.3787994086742401, 0.2560736536979675...
is ever used by more than one user at once, the DBA will hunt you down follow austin's advice, and display only a page at a time
[ 0.39922812581062317, -0.01565217226743698, 0.2736921012401581, 0.2076963186264038, 0.1261991262435913, -0.3749028444290161, 0.3859441578388214, 0.20673754811286926, -0.02391466312110424, -0.4530413746833801, -0.34525877237319946, 0.11096455901861191, -0.5187229514122009, -0.047298375517129...
When I profile my application using SQL Server Profiler, I am seeing lots of *Audit Login* and *Audit Logout* messages for connections to the same database. I am wondering, does this indicate that something is wrong with my connection pooling? The reason I ask, is because I found this in the MSDN documentation in regar...
[ 0.23234392702579498, 0.18775972723960876, 0.13527695834636688, 0.06323215365409851, -0.12044096738100052, -0.2862040102481842, 0.11730241030454636, 0.19102579355239868, -0.5468842387199402, -0.6537092328071594, 0.18104343116283417, 0.35405397415161133, -0.2729167342185974, 0.13446095585823...
the connection pool. > For more information, see Audit Login > Event Class and Audit Logout Event > Class in SQL Server Books Online. <http://msdn.microsoft.com/en-us/library/8xx3tyca.aspx> Also, does anyone have any tips for determining how effective the connection pooling is for a given SQL server? I have lots o...
[ 0.34284427762031555, 0.06671546399593353, 0.18861444294452667, 0.5856271982192993, -0.019832683727145195, -0.310153603553772, -0.014002912677824497, 0.19389821588993073, -0.4662929177284241, -0.7621752619743347, 0.28825733065605164, 0.6194391250610352, 0.1464385688304901, 0.086049020290374...
app will create a new connection when none exist with the correct connectionstring. Then it will pool that connection and, if the pool is full, bump an existing connection. The default [Max Pool Size](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx) is 100 connections, ...
[ -0.12014903128147125, -0.03192225471138954, 0.5711430311203003, 0.27472639083862305, 0.010824400000274181, 0.10910441726446152, 0.2276884764432907, -0.258890300989151, -0.6274990439414978, -0.772792398929596, -0.22425737977027893, 0.235044464468956, -0.5078758597373962, -0.0714838877320289...
all databases). * Your SQL becomes more complex (especially if you're using an out-of-the-box ORM or stored procs). You could experiment with increasing the Max Pool Size if your database count isn't huge. Otherwise, if some databases are used frequently while others aren't, you could turn pooling off on the infrequen...
[ 0.24872350692749023, -0.17846664786338806, 0.4298607110977173, 0.40467506647109985, 0.15220028162002563, -0.12332257628440857, -0.06333567947149277, -0.13480240106582642, -0.5900722146034241, -0.7748740315437317, -0.05665658786892891, 0.4673650860786438, -0.17813286185264587, 0.14814195036...
I know that in the original C++0x standard there was a feature called `export`. But I can't find a description or explanation of this feature. What is it supposed to do? Also: which compiler is supporting it? Although Standard C++ has no such requirement, some compilers require that all function templates need to be m...
[ 0.4184711277484894, 0.17295274138450623, 0.02763100154697895, -0.14193834364414215, -0.2125905603170395, -0.40760675072669983, 0.08194747567176819, -0.07816728949546814, -0.2533312737941742, -0.2979252338409424, -0.36935433745384216, 0.5336638689041138, -0.4784979820251465, -0.053746651858...
To clarify, in C++ese this means that this: ``` // ORIGINAL version of xyz.h template <typename T> struct xyz { xyz(); ~xyz(); }; ``` would NOT be satisfied with these definitions of the ctor and dtors: ``` // ORIGINAL version of xyz.cpp #include "xyz.h" template <typename T> xyz<T>::xyz() {} template <...
[ -0.05098096653819084, 0.38095176219940186, 0.2905634343624115, 0.09397125244140625, 0.042319003492593765, -0.2478625625371933, 0.410611629486084, 0.08845416456460953, -0.3318448066711426, -0.10510403662919998, -0.42932865023612976, 0.42753568291664124, -0.5313923954963684, 0.34347343444824...
C++ > > C++'ing main.cpp... > Comeau C/C++ 4.3.4.1 (May 29 2004 23:08:11) for MS_WINDOWS_x86 > Copyright 1988-2004 Comeau Computing. All rights reserved. > MODE:non-strict warnings microsoft C++ > > main.obj : error LNK2001: unresolved external symbol xyz<T1>::~xyz<int>() [with T1=int] > main.obj : error LNK2019: un...
[ -0.460796058177948, 0.38109028339385986, 0.19380241632461548, -0.017158059403300285, -0.17983049154281616, -0.12426462024450302, 0.633895218372345, -0.04805056378245354, -0.41519278287887573, 0.04383976012468338, -0.33566170930862427, 0.24263858795166016, -0.6190509796142578, 0.12790633738...
of `xyz`, in this example of `xyz<int>`. In a brute force effort, this could be added to xyz.cpp by adding this line at the end of it: ``` template xyz<int>; ``` which requests that (all of) `xyz<int>` be instantiated. That's kind of in the wrong place though, since it means that everytime a new xyz type is brought ...
[ 0.4876309633255005, 0.05435777083039284, 0.3565158247947693, 0.017408721148967743, -0.20735159516334534, -0.15793728828430176, 0.1511894315481186, -0.04970325157046318, -0.34999364614486694, -0.5806686878204346, -0.2622782289981842, 0.2179688662290573, -0.7092669010162354, 0.32311820983886...
brought forth. In a non-trivial program this could be an unreasonable maintenance demand. So instead, another way to approach this is to `#include "xyz.cpp"` into the end of xyz.h: ``` // xyz.h // ... previous content of xyz.h ... #include "xyz.cpp" ``` You could of course literally bring (cut and paste it) the c...
[ 0.3867427706718445, 0.14095520973205566, 0.28044888377189636, 0.11338799446821213, -0.06997266411781311, -0.1358731985092163, -0.13040733337402344, -0.23619964718818665, -0.3683049976825714, -0.604915201663971, -0.4185018837451935, 0.3617500364780426, -0.4405272603034973, 0.340128332376480...
using the respective header. Either way, this has the side-effect that now every template is in your header file. It could slow compilation, and it could result in code bloat. One way to approach the latter is to declare the functions in question, in this case the ctor and dtor, as inline, so this would require you to ...
[ 0.6226904392242432, -0.17567160725593567, -0.09606756269931793, 0.1515587568283081, -0.1937163770198822, -0.3726843595504761, 0.17562325298786163, -0.0859861969947815, -0.18188424408435822, -0.503412663936615, -0.14217031002044678, 0.509319543838501, -0.5967875719070435, 0.1452013701200485...
Note that this is a compiler issue, not one of Standard C++, so not all compilers require this. For instance, Comeau C++ does not, nor should it. Check out <http://www.comeaucomputing.com/4.0/docs/userman/ati.html> for details on our current setup. In short, Comeau C++ supports many models, including one which comes cl...
[ 0.1614241749048233, -0.039447490125894547, 0.14009901881217957, -0.19314153492450714, -0.459881991147995, 0.046441700309515, -0.11847997456789017, 0.06147094443440437, -0.18845678865909576, -0.40311217308044434, -0.48672977089881897, 0.9011883735656738, -0.4571121633052826, -0.244705125689...
Hopefully as other compilers reach compliance with Standard C++, this situation will change. In the example above, using export means returning to the original code which produced the linker errors, and making a change: declare the template in xyz.h with the export keyword: ``` // xyz.h export // ... ORIGINAL content...
[ 0.19014129042625427, 0.018748754635453224, 0.3131316900253296, -0.024807360023260117, -0.059345245361328125, -0.43219703435897827, 0.1164761558175087, -0.05188754200935364, -0.3777080476284027, -0.5601441264152527, -0.5015899538993835, 0.4982892572879791, -0.5293521881103516, 0.12298859655...
line shown earlier, it's possible that the compiler will do it all for you automatically.
[ 0.30733180046081543, -0.02717961184680462, -0.03825857490301132, 0.19623754918575287, -0.07495075464248657, 0.10089059919118881, 0.2670125961303711, 0.028369037434458733, -0.3217867612838745, -0.23279735445976257, -0.21970832347869873, 0.4608769714832306, -0.16205869615077972, -0.142459511...
Given an object on a plain white background, does anybody know if OpenCV provides functionality to easily detect an object from a captured frame? I'm trying to locate the corner/center points of an object (rectangle). The way I'm currently doing it, is by brute force (scanning the image for the object) and not accura...
[ 0.4755956828594208, 0.05557745695114136, 0.37948670983314514, 0.18089474737644196, 0.04727727547287941, -0.146510511636734, -0.1354735791683197, 0.16034939885139465, -0.17601673305034637, -0.5573073625564575, -0.11026476323604584, 0.42321112751960754, -0.13448503613471985, -0.1049101501703...
is calculated from the corner points. It's just a white background, with the object on it (black). The quality of the shot is about what you'd expect to see from a Logitech webcam. Once I get the corner points, I calculate the center. The center point is then converted to centimeters. It's refining just 'how' I get ...
[ 0.28962618112564087, -0.1537884622812271, 0.5311496257781982, 0.05020818114280701, -0.14611703157424927, 0.11906589567661285, -0.13583782315254211, -0.37031546235084534, -0.46870940923690796, -0.5575477480888367, 0.31216681003570557, 0.15026435256004333, -0.034170351922512054, -0.257805377...
<- {} 1. image <- load image 2. for every channel: 2.1 image_canny <- apply canny edge detector to this channel 2.2 for threshold in bunch_of_increasing_thresholds: 2.2.1 image_thresholds[threshold] <- apply threshold to this channel 2.3 for each contour found in {image_canny} U image_thresholds: 2.3.1 Approxima...
[ -0.12667372822761536, -0.16416066884994507, 0.7678297162055969, 0.11780928820371628, -0.22449655830860138, 0.15059731900691986, 0.19504305720329285, -0.6141324639320374, 0.04440426081418991, -1.0901960134506226, 0.28973162174224854, 0.7572375535964966, 0.05929046869277954, -0.2583399116992...
I'd like to find a way to do a SQL query that will calculate the cidr (bit representation) of a subnet mask stored in the database. So for example, I've got either 255.255.255.0 or its decimal value (4294967040) stored in the database. I'd like to do a select and get back /24 representation via the query. I've done th...
[ 0.18900230526924133, -0.21022620797157288, 0.3292728364467621, 0.20729577541351318, -0.114908866584301, 0.08360324800014496, 0.09351594746112823, -0.10094344615936279, -0.22923655807971954, -0.8807867169380188, -0.025551429018378258, 0.48509007692337036, -0.20932753384113312, 0.31556987762...
statement that would work under mysql, postgres, oracle etc. I think I have found the solution to my issue. Here is what I have done: ``` select CONCAT(INET_NTOA(ip_addr),'/',32-log2((4294967296-ip_mask))) net from subnets order by ip_addr ``` Basically I take my decmial mask and subtract it from the maximum decim...
[ 0.032043106853961945, 0.006159704178571701, 0.22669732570648193, 0.14806479215621948, -0.19703494012355804, 0.06962031871080399, 0.4785647690296173, 0.032653387635946274, -0.12404963374137878, -0.3445947468280792, -0.1267450451850891, 0.6220347285270691, -0.38037386536598206, 0.10051182657...
what is the difference in using a standard ``` type sl: TStringList ``` compared to using a generic TList ``` type sl: TList<string> ``` ? As far as I can see, both behave exactly the same. Is it just another way of doing the same thing? Are there situations where one would be better than the other? T...
[ 0.17318592965602875, -0.25886407494544983, 0.2727797329425812, 0.08143742382526398, -0.44597986340522766, -0.28771284222602844, 0.1287723332643509, -0.2317235916852951, -0.3202314078807831, -0.7013909220695496, -0.03285509720444679, 0.09063495695590973, -0.4439174234867096, -0.122605025768...
I have a program that I need to run under \*nix and windows. because the program takes file paths from files the issue is what to do about the `\` vs `/` issue. My current thought is to put in a regex that converts the wrong one to the right one depending on what system I'm on. This will have the effect of letting ei...
[ 0.7330620288848877, 0.12495706975460052, 0.03396310657262802, -0.07423120737075806, 0.23576749861240387, -0.1042887344956398, 0.5501366853713989, 0.21624957025051117, -0.24526356160640717, -0.6622174382209778, 0.23656995594501495, 0.9287176132202148, -0.49111148715019226, 0.105579592287540...
work on unix rather than the other way around. The / is fully supported in win32 too. Also see this [related question](https://stackoverflow.com/questions/122455/handling-file-paths-cross-platform)
[ 0.06095175817608833, -0.10792537033557892, 0.11733703315258026, 0.07860742509365082, 0.14435622096061707, -0.4852099120616913, 0.12379739433526993, -0.051851287484169006, -0.44837120175361633, -0.507872462272644, -0.26956504583358765, 0.5555165410041809, -0.03495487570762634, -0.2933087348...
I have an auditing trigger that automatically places the time something was updated and the user that updated in fields in all my tables. I have another set of triggers that write event information from updates to an events table. The issue is when someone updates something, the event information is fired twice because...
[ 0.40788936614990234, 0.1483333259820938, 0.1738845556974411, -0.03902929648756981, 0.02110685408115387, -0.03703468292951584, 0.20599736273288727, -0.3996802270412445, -0.5304555892944336, -0.47464755177497864, 0.4904135763645172, 0.7496659755706787, -0.22875773906707764, 0.135993927717208...
I have a `vector` that I want to insert into a `set`. This is one of three different calls (the other two are more complex, involving `boost::lambda::if_()`), but solving this simple case will help me solve the others. ``` std::vector<std::string> s_vector; std::set<std::string> s_set; std::for_each(s_vector.begin(), ...
[ 0.12580543756484985, -0.1339881718158722, 0.69597327709198, -0.22655245661735535, -0.032506220042705536, -0.21822695434093475, 0.28459516167640686, -0.6013720631599426, 0.0019059928599745035, -0.827585756778717, -0.07487697154283524, 0.4774714410305023, -0.6483246684074402, -0.010491951368...
function you wish to use: ``` typedef std::set<std::string> s_type; typedef std::pair<s_type::iterator, bool>(s_type::*insert_fp)(const s_type::value_type&); std::for_each(s_vector.begin(), s_vector.end(), boost::bind(static_cast<insert_fp>(&s_type::insert), &s_set, _1)); ``` It's not pretty, but it should work.
[ -0.13698022067546844, -0.1545577347278595, 0.6353341341018677, -0.35781970620155334, 0.09799793362617493, 0.17143464088439941, 0.18806123733520508, -0.4485470950603485, 0.26689958572387695, -0.5481669902801514, -0.20444349944591522, 0.8046863079071045, -0.4526420831680298, -0.3955129683017...
I have this piece of Javascript and it just won't work. I allready checked JSlint but that said everything works. Still doesn't work. The javascript is located not in the HTML but is linked in the `<head>` note: I am working with a local server, so pageload in instant. ``` function changeVisibility() { var a = do...
[ 0.15295015275478363, 0.17839497327804565, 0.7973834276199341, -0.3049318790435791, 0.0950319692492485, -0.040290527045726776, 0.37061169743537903, -0.4780224859714508, -0.09034020453691483, -0.8155121803283691, -0.1507219821214676, 0.355429470539093, -0.6157534122467041, 0.0626738071441650...
then onchange event triggers and the style of my invisible div is set to block. Problem is, I keep getting this error: "changed is null: changed.onchange = changeVisibility;" i don't get it, I seriously don't get what I'm overlooking here. --- EDIT: question answered, thank you Mercutio for your help and everyone...
[ 0.09990864992141724, -0.20026721060276031, 0.7612357139587402, -0.16737443208694458, 0.04866190627217293, 0.14151298999786377, 0.35592904686927795, -0.17982538044452667, -0.23301267623901367, -0.6180869936943054, -0.08220753818750381, 0.6409755349159241, -0.5911943316459656, 0.116859987378...
here is the corresponding HTML: ``` <input type="file" name="click[]" size="35" id="click1" /> <div id="invisible" style="display: none;"> <a href="#">Attach another File</a> </div> ``` Also, thanks for the link to [JSbin](http://www.jsbin.com), didn't know about that, looks nifty. This sounds like the DOM object ...
[ 0.000793607672676444, -0.028767278417944908, 0.5690710544586182, -0.19178491830825806, -0.27973294258117676, -0.11087557673454285, 0.19958582520484924, -0.07577531039714813, -0.4042218029499054, -0.5439242124557495, -0.23060496151447296, 0.623193621635437, -0.15980271995067596, -0.06317028...
things happen before others :D > The onlything I'd like to do now is remove the Javascript link from the ... Place an id on there, and inside your function do this: ``` document.getElementById('addField').onclick = addFileInput; ``` Or, as you already have the div as the variable 'a': ``` a.firstChild.onclick = a...
[ 0.3011690080165863, 0.1124914288520813, 0.37296321988105774, -0.3524939715862274, 0.3569720983505249, -0.25880029797554016, 0.31118103861808777, -0.1980035901069641, 0.08212318271398544, -0.8517394065856934, -0.07886558771133423, 0.46025386452674866, -0.18646666407585144, 0.309573918581008...
I'm new to cryptography and modular arithmetic. So, I'm sure it's a silly question, but I can't help it. How do I calculate *a* from      pow(*a*,**q**) = 1 (mod **p**), where **p** and **q** are known? I don't get the "1 (mod **p**)" part, it equals to 1, doesn't it? If so, than what is "mod **p**" about? ...
[ -0.047857265919446945, 0.37566041946411133, 0.016085954383015633, -0.20025497674942017, -0.05772929638624191, 0.21014277637004852, 0.15856046974658966, -0.47453606128692627, -0.035843562334775925, -0.2372177541255951, -0.0970846638083458, 0.16735470294952393, 0.12051807343959808, -0.175578...
1 are equal*. For instance, "modulo 10, 246126 and 7868726 are equal" (and they are also both equal to 6 modulo 10): **two numbers x and y are equal modulo p if they have the same remainder on dividing by p, or equivalently, if p divides x-y.** Since you seem to be coming from a programming perspective, another way o...
[ 0.08127740025520325, -0.0725642740726471, -0.24341778457164764, -0.07543013244867325, 0.023319123312830925, 0.27139902114868164, 0.09347552806138992, -0.3513013422489166, -0.19566670060157776, -0.19577205181121826, -0.1676596999168396, 0.054351285099983215, 0.0317118875682354, -0.044095244...
is likely to introduce modular arithmetic). To answer your other question: there is no general formula for finding such an *a* (to the best of my knowledge) in general. Assuming that p is prime, and using [Fermat's little theorem](http://en.wikipedia.org/wiki/Fermat%27s_little_theorem) to reduce q modulo p-1, and assu...
[ -0.2888755202293396, -0.10442847013473511, -0.1489173173904419, -0.33117327094078064, -0.061531856656074524, 0.3108072280883789, 0.15189073979854584, -0.6655135750770569, -0.2615380585193634, -0.4929901957511902, -0.12697777152061462, 0.4254845082759857, -0.26944154500961304, 0.07918421924...
(say r) mod p, you can take r to the power of φ(p)/q, where φ is [the totient function](http://en.wikipedia.org/wiki/Euler%27s_totient_function) -- this comes from [Euler's theorem](http://en.wikipedia.org/wiki/Euler%27s_theorem).]
[ -0.37359538674354553, -0.30579203367233276, 0.4876604974269867, -0.5111744999885559, -0.11169735342264175, 0.4602559804916382, -0.004675555042922497, -1.1230679750442505, 0.057316768914461136, -0.22498321533203125, -0.32520896196365356, 0.7886248230934143, -0.39368122816085815, -0.03980715...
I have written code that automatically creates CSS sprites based on the IMG tags in a page and replaces them with DIV's with (what I thought was) appropriate CSS to position the sprite image as a background letting the appropriate part show through -- the problem is that I cannot get DIVs to behave as drop in replaceme...
[ 0.38725414872169495, 0.14303867518901825, 0.382646769285202, 0.04486360028386116, -0.18568868935108185, 0.09701921045780182, 0.060599133372306824, -0.040534570813179016, -0.18902571499347687, -0.2979460060596466, -0.11151305586099625, 0.20609156787395477, -0.4329337775707245, 0.13037279248...
I would expect something with display: block to do). If I change the 'display' to inline, then the DIV stays on the same line as the text but it ignores the 'width' and 'height' I have set and collapses. I've tried putting  's inside the DIV but it then only takes up enough width to contain the nbsp. I've tried exper...
[ 0.2480999380350113, 0.1291380673646927, 0.6554587483406067, -0.14946249127388, -0.5366326570510864, 0.11693845689296722, 0.15732967853546143, -0.132704496383667, -0.12801779806613922, -0.8658704161643982, -0.08783859014511108, 0.34139275550842285, -0.2014593780040741, 0.06903626024723053, ...
something more complicated than just a single DIV, however I've tried the obvious things there (one DIV inside another where the inner DIV is set to display: block with the outer set to display: inline) but I haven't found a combination there that works either. There are always specific things I can do outside of the ...
[ 0.43955206871032715, 0.15299485623836517, 0.4190521240234375, 0.049253374338150024, -0.3691723942756653, -0.04633678123354912, 0.28376489877700806, -0.20944221317768097, -0.2995593547821045, -0.5143376588821411, 0.08672340959310532, 0.7521700263023376, -0.6246783137321472, -0.2096482664346...
How can I send email using Perl through my Gmail account? The one CPAN library (Mail::Webmail::Gmail) that I tried didn't work and I don't see much activity with it. At the moment I really only need to send a message. However, the advanced functionality of getting my contacts, acting when a new email is received that ...
[ 0.4180009961128235, -0.02265090122818947, 0.5146346688270569, 0.06561189889907837, -0.2762410044670105, -0.19884875416755676, 0.4577852487564087, 0.17670351266860962, -0.5005736351013184, -0.42692363262176514, 0.36561208963394165, 0.3767251670360565, -0.23361900448799133, 0.104039989411830...
How do you convert between a DateTime and a Time object in Ruby? You'll need two slightly different conversions. To convert from `Time` to `DateTime` you can amend the Time class as follows: ``` require 'date' class Time def to_datetime # Convert seconds + microseconds into a fractional number of seconds ...
[ 0.2531038522720337, -0.4129600524902344, 0.16747142374515533, 0.1350218802690506, 0.21804480254650116, 0.1276879608631134, 0.117312952876091, -0.1648995578289032, -0.07390829175710678, -0.5468961000442505, 0.11589360237121582, 0.42444005608558655, -0.06391796469688416, 0.1392730176448822, ...
DateTime.new(year, month, day, hour, min, seconds, offset) end end ``` Similar adjustments to Date will let you convert `DateTime` to `Time` . ``` class Date def to_gm_time to_time(new_offset, :gm) end def to_local_time to_time(new_offset(DateTime.now.offset-offset), :local) end private de...
[ 0.24275387823581696, -0.40463143587112427, 0.5464640855789185, 0.06121594086289406, 0.4574096202850342, 0.23366206884384155, 0.019567091017961502, 0.009459035471081734, -0.31830456852912903, -0.976695716381073, -0.21960021555423737, 0.45953312516212463, 0.12107950448989868, 0.3139934241771...
dest.sec, usec) end end ``` Note that you have to choose between local time and GM/UTC time. Both the above code snippets are taken from O'Reilly's [Ruby Cookbook](http://safari.oreilly.com/0596523696). Their code reuse [policy](http://oreilly.com/pub/a/oreilly/ask_tim/2001/codepolicy.html) permits this.
[ 0.2867339849472046, -0.07837283611297607, 0.15544940531253815, 0.0843401551246643, 0.24606171250343323, -0.1690644770860672, 0.831437349319458, 0.00423298217356205, -0.3484624922275543, -0.6007719039916992, -0.23705893754959106, 0.45096322894096375, -0.0452008880674839, 0.18659164011478424...
I am not looking for links to information on hashing. I am not looking for the worlds greatest hash function. I am interested in mini-stories describing * The problem domain you were working in * The nature of the data you were working with * What your thought process was in designing a hash function for your data. ...
[ 0.22487607598304749, 0.09121294319629669, 0.30137553811073303, 0.33110669255256653, -0.11797147989273071, 0.29937586188316345, -0.07604258507490158, 0.2842521667480469, -0.40399470925331116, -0.670803964138031, 0.35234877467155457, 0.11026294529438019, 0.019764088094234467, 0.1793284565210...
rows. Dimension rows were clustered based on various combinations of columns. The clustering was a map from some key to a list of dimension rows that shared that key. The hash key, then, was a tuple of column values. The intermediate result, in Python, looked like this ``` { ( (col1, col2), (col3, col4) ) : [ aR...
[ -0.697660505771637, 0.15674643218517303, 0.7120776772499084, -0.2052280157804489, -0.22076700627803802, 0.347976952791214, -0.2691110670566559, -0.1187177523970604, -0.4011037051677704, -0.3181637227535248, -0.15175792574882507, 0.3261182904243469, -0.49586206674575806, 0.1624203324317932,...
won't use mutable collections (i.e., lists). More important, the tuples weren't simple flat lists of column values. They were usually two-tuples that attempted to partition the dimension rows into disjoint subsets based on key combinations The hash algorithm, down deep, is the built-in Python hash. Choosing the keys, ...
[ -0.10040106624364853, -0.16069893538951874, 0.21782872080802917, 0.208770290017128, -0.1078319400548935, -0.18621492385864258, 0.05984892323613167, 0.0911431759595871, -0.16974133253097534, -0.5181903839111328, -0.3865061104297638, 0.29592427611351013, -0.4615207314491272, 0.03130050748586...
It's kind of a C puzzle. You have to tell if the program finish its execution, if so, how much time it takes to run and what it returns to the OS. ``` static unsigned char buffer[256]; int main(void) { unsigned char *p, *q; q = (p = buffer) + sizeof(buffer); while (q - p) { p = buffer; while ...
[ 0.1308422088623047, 0.11041624844074249, 0.2895224094390869, 0.05714642256498337, 0.15978118777275085, -0.012276303954422474, 0.17954175174236298, -0.06555013358592987, -0.12567980587482452, -0.22619368135929108, -0.31178364157676697, 0.775399386882782, -0.3332023024559021, 0.2392787039279...
is a great little puzzle but as everyone has already pointed out, not a great interview question. Despite the fact that this is a horrible interview question, it is actually quite interesting: ``` static unsigned char buffer[256]; int main(void) { unsigned char *p, *q; q = (p = buffer) + sizeof(buffer); /* This...
[ -0.02080385386943817, 0.17009684443473816, 0.43836045265197754, -0.16324175894260406, 0.22599449753761292, 0.12333060055971146, 0.25619563460350037, -0.16840383410453796, -0.2999768555164337, -0.20863255858421326, -0.10668820887804031, 0.25588250160217285, -0.2611829340457916, 0.1810317933...
will decrease at an inversely exponential rate: */ { p = buffer; while (!++*p++); /* This is where the interesting part comes in; the prefix increment, dereference, and logical negation operators all have the same precedence and are evaluated **right-to-left**. The post...
[ -0.3662717044353485, -0.22669343650341034, 0.524505078792572, -0.24709464609622955, 0.07364971935749054, 0.43548858165740967, 0.014744999818503857, -0.30472928285598755, -0.01701197400689125, -0.5421229600906372, -0.18668924272060394, 0.19836241006851196, -0.23949894309043884, -0.079211860...
starts out at zero, is incremented to 1 by the prefix, and is negated by !. p is incremented by the postfix operator, the condition evaluates to false and the loop terminates with buffer[0] = 1. p is then set to point to buffer[0] again and the loop continues until buffer[...
[ -0.26347196102142334, 0.0063386340625584126, 0.4626498520374298, -0.4206709861755371, 0.1433437019586563, 0.3355686366558075, 0.5769159197807312, -0.39677172899246216, -0.058822084218263626, -0.0724417194724083, -0.37116628885269165, 0.1104249358177185, -0.2800758481025696, 0.0686155334115...
when *p is incremented, becomes 0 and is negated. This causes the loop to run again immediately after p is incremented to point to buffer[1], which is increased to 1. The value 1 is of course negated, p is incremented which doesn't matter because the loop terminates and p ...
[ -0.2355908304452896, -0.2968968152999878, 0.29418274760246277, -0.2361803650856018, 0.11372677236795425, 0.21132998168468475, 0.7149173617362976, 0.050199415534734726, -0.24558581411838531, -0.37258797883987427, -0.46068957448005676, 0.0342332199215889, -0.31834033131599426, 0.229057982563...
This process will continue to increment buffer[0] every time, increasing buffer[1] every 256 runs. After 256*255 runs, buffer[0] and buffer[1] will both be 255, the loop will succeed *twice* and buffer[2] will be incremented once, etc. The loop will terminate after about 256^256 ru...
[ 0.04911277815699577, 0.014100986532866955, 0.6787981986999512, -0.1934727430343628, -0.04461893439292908, 0.28157180547714233, 0.8514773845672607, -0.3379192054271698, -0.5302508473396301, -0.3340541422367096, -0.20068365335464478, 0.23157884180545807, -0.3012343943119049, 0.46267780661582...
255 allowing p to be incremented to the end of the array. This will happen sometime after the universe ends, maybe a little sooner on the new Intels ;) */ } return p - q; /* Returns 0 as p == q now */ } ``` Essentially this is a base-256 (assuming 8-bit bytes) counter with 256 digits, t...
[ 0.09344007819890976, 0.22120897471904755, 0.6657809019088745, -0.054516956210136414, -0.08896536380052567, 0.007325374521315098, 0.32661038637161255, -0.1749017834663391, -0.3357584476470947, -0.19513873755931854, 0.011919933371245861, 0.22279438376426697, -0.25413188338279724, 0.279141545...
completely legal C (no undefined or implementation defined behavior that you usually find in these types of questions) and there is actually a legitimate algorithm problem, albeit a little hidden, in the mix. The reason it is a horrible interview question is because I wouldn't expect anyone to remember the precedence a...
[ 0.3831093907356262, 0.015997925773262978, -0.05250769481062889, 0.4801871180534363, 0.1665349155664444, -0.526256799697876, 0.14717169106006622, 0.05157586932182312, 0.07020925730466843, 0.4013250470161438, -0.006952469237148762, 0.5830386877059937, 0.028367780148983, -0.09603531658649445,...
If I have a vector of pairs: ``` std::vector<std::pair<int, int> > vec; ``` Is there and easy way to sort the list in **increasing** order based on the second element of the pair? I know I can write a little function object that will do the work, but is there a way to use existing parts of the *STL* and `std::less`...
[ 0.14452533423900604, 0.06767236441373825, 0.2693033516407013, -0.042688000947237015, -0.28209275007247925, 0.12432733923196793, 0.11310023814439774, -0.33270958065986633, -0.14788547158241272, -0.8764684200286865, -0.07770996540784836, 0.397146612405777, -0.528478741645813, -0.018674446269...
vec.end(), std::something_magic<int, int, std::less>()); ``` **EDIT**: using c++14, the best solution is very easy to write thanks to lambdas that can now have parameters of type `auto`. **This is my current favorite solution** ``` std::sort(v.begin(), v.end(), [](auto &left, auto &right) { return left.second < r...
[ -0.24476836621761322, -0.022011851891875267, 0.7986365556716919, -0.09452220052480698, 0.17864158749580383, 0.3839500844478607, 0.5396527051925659, -0.37698128819465637, -0.04373325780034065, -0.9721289873123169, -0.11065670847892761, 0.8117476105690002, -0.20259886980056763, -0.0647263452...
std::pair<int,int> &left, const std::pair<int,int> &right) { return left.second < right.second; }); ``` **EDIT**: in response to your edits to your question, here's some thoughts ... if you **really** wanna be creative and be able to reuse this concept a lot, just make a template: ``` template <class T1, class T...
[ -0.08234726637601852, 0.004785561002790928, 0.39896488189697266, -0.11587359756231308, -0.08499979972839355, 0.17934343218803406, 0.2916533648967743, -0.5017579793930054, -0.10579440742731094, -0.784233570098877, -0.29662182927131653, 0.5115436315536499, -0.3893371522426605, -0.09008879959...
to be honest, this is all a bit overkill, just write the 3 line function and be done with it :-P
[ 0.09288028627634048, 0.15436282753944397, 0.3105812966823578, -0.016519030556082726, -0.22612552344799042, 0.045286744832992554, 0.6045421361923218, -0.05297836661338806, -0.012021780014038086, -0.3251425623893738, -0.0030159656889736652, 0.4798116683959961, -0.3328269422054291, -0.0319634...
Or better said: When to use array as a field data type in a table? Which solution provides better search results? I've considered this problem as well and the conclusion that I came to, is to use arrays when you want to eliminate table joins. The number of elements contained in each array isn't as important as the siz...
[ 0.2977241277694702, 0.039687905460596085, 0.08267302066087723, 0.06772422790527344, -0.15100713074207306, 0.1620568484067917, -0.01160968653857708, -0.23007918894290924, -0.5563035607337952, -0.6145932674407959, 0.1258307844400406, 0.15697260200977325, -0.25869590044021606, 0.1010260134935...
chewing through a lot of processor time and disk i/o though.
[ 0.09839476644992828, 0.2681698501110077, -0.24403350055217743, 0.19907674193382263, -0.2060662806034088, 0.11364574730396271, 0.07998012006282806, 0.13909046351909637, 0.023546449840068817, -0.35919007658958435, 0.46050533652305603, 0.5619786977767944, 0.16484194993972778, -0.1330069899559...
I'm using Forms Authentication (and the built in Login controls) and letting users click the "remember me" checkbox when logging in. When they return to the site, they are automatically logged in as expected. Is there an event I can catch when this happens? I've been studying the FormsAuthenticationModule.Authenticate ...
[ 0.5218071937561035, -0.03227287530899048, 0.5864443182945251, -0.0373605340719223, 0.16971950232982635, -0.5874399542808533, 0.4453025758266449, -0.0642889216542244, -0.27605944871902466, -0.7705882787704468, -0.014285648241639137, 0.2962503135204315, 0.1014259085059166, 0.0576734654605388...
the logged in user, <http://msdn.microsoft.com/en-us/library/system.web.ui.page.user.aspx>
[ 0.36721980571746826, -0.017463339492678642, 0.5686517357826233, 0.05868009477853775, 0.230043426156044, 0.030419882386922836, 0.15762114524841309, 0.34009599685668945, -0.49512264132499695, -0.4153798818588257, -0.3040989637374878, 0.11390529572963715, 0.040388379245996475, 0.0290166046470...
I have a script which logs on to a remote server and tries to rename files, using PHP. The code currently looks something like this example from the php.net website: ``` if (ftp_rename($conn_id, $old_file, $new_file)) { echo "successfully renamed $old_file to $new_file\n"; } else { echo "There was a problem while r...
[ 0.3497142195701599, 0.2481003850698471, 0.03294957056641579, -0.20644120872020721, -0.21662212908267975, -0.13691256940364838, 0.5184946656227112, -0.22909367084503174, -0.38725683093070984, -0.49649426341056824, 0.1881621927022934, 0.42140305042266846, -0.3767188787460327, 0.3985190987586...
anything but true or false. However, you could use ftp\_raw to send a raw RENAME command, and then parse the returned message.
[ 0.3438953757286072, -0.014654879458248615, -0.16595838963985443, 0.4182174503803253, -0.033002663403749466, -0.1649746149778366, 0.56279456615448, 0.20640575885772705, -0.12123695015907288, -0.3008764386177063, -0.21507641673088074, 0.6373780965805054, -0.15925922989845276, 0.0264728777110...
Basically I need to insert a bunch of data to an Excel file. Creating an OleDB connection appears to be the fastest way but I've seen to have run into memory issues. The memory used by the process seems to keep growing as I execute INSERT queries. I've narrowed them down to only happen when I output to the Excel file (...
[ 0.35680168867111206, 0.21171075105667114, 0.350790798664093, 0.02229110524058342, 0.17393237352371216, -0.05861504003405571, 0.07278544455766678, -0.01660173013806343, -0.03719990700483322, -0.7256445288658142, 0.07898210734128952, 0.5211171507835388, -0.23577019572257996, 0.01856168545782...
successfully as I can verify with relatively small data sets. If anyone has insight, it would be appreciated. *initializeADOConn()* is called in the constructor *initADOConnInsertComm()* creates the insert parameterized insert query *writeRecord()* is called whenever a new record is written. New worksheets are creat...
[ 0.1930580586194992, 0.056072626262903214, 0.5375053882598877, 0.0005203529144637287, 0.43741145730018616, -0.34046587347984314, 0.40969139337539673, -0.3442346155643463, -0.2458537071943283, -0.6523944139480591, -0.3605113923549652, 0.624712347984314, -0.14986011385917664, 0.05947737768292...
"Data Source=" + this.destination + ";Extended Properties=\"Excel 8.0;HDR=YES;\""; //DbProviderFactory factory = //DbProviderFactories.GetFactory("System.Data.OleDb"); conn = new OleDbConnection(connectionString); conn.ConnectionString = connectionString; ...
[ -0.13028797507286072, -0.153811976313591, 0.8887162804603577, -0.17407773435115814, 0.35777589678764343, 0.1762387603521347, 0.18711979687213898, -0.2904733121395111, -0.14067785441875458, -0.7206900119781494, -0.3725760579109192, 0.5364255309104919, -0.5436632633209229, 0.2652947008609772...
initADOConnInsertComm(); return true; } public override bool writeRecord(FileListerFileInfo file) { /* If all available sheets are full, make a new one. */ if (numWritten % EXCEL_MAX_ROWS == 0)
[ -0.020214008167386055, -0.11993285268545151, 0.4813810884952545, -0.21466289460659027, 0.257709801197052, 0.05137014389038086, 0.23294056951999664, -0.10548308491706848, -0.1360010802745819, -0.662469744682312, -0.1903824806213379, 0.3487445116043091, -0.1902942955493927, 0.274388998746871...
{ conn.Close(); conn.Open(); createNextSheet(); }
[ -0.3600909411907196, 0.03315269201993942, 0.4435429871082306, -0.4233850836753845, 0.31999102234840393, -0.09737131744623184, 0.13086478412151337, -0.03863593190908432, 0.22091926634311676, -0.596585750579834, -0.5994612574577332, 0.434146523475647, -0.22995184361934662, 0.2552598714828491...
/* Count this record as written. */ numWritten++; /* Get all of the properties of the FileListerFileInfo record and add * them to the parameters of the insert query. */ PropertyInfo[] properties
[ 0.3931237757205963, -0.0006345772999338806, 0.37843719124794006, -0.03377237915992737, 0.24785847961902618, -0.24812154471874237, -0.15737561881542206, -0.37657076120376587, -0.19935275614261627, -0.4992099702358246, -0.08941949903964996, 0.6914495229721069, -0.13170482218265533, 0.2398956...
= typeof(FileListerFileInfo).GetProperties(); for (int i = 0; i < insertComm.Parameters.Count; i++) insertComm.Parameters[i].Value = properties[i].GetValue(file, null); /* Add the record. */ insertComm.ExecuteNonQuery();
[ 0.248317152261734, -0.10393461585044861, 0.40994027256965637, -0.2640223503112793, 0.5498774647712708, 0.13736194372177124, 0.13898174464702606, -0.5269990563392639, -0.233502596616745, -0.3773643672466278, -0.16579470038414001, 0.6370664238929749, -0.4807789623737335, 0.37338942289352417,...
return true; } ``` EDIT: No, I do not use Excel at all. I'm intentionally avoiding Interop.Excel due to its poor performance (at least from my dabbles with it). The answer is **Yes**, the formula you describe *does* equal a bad time. If you have a database handy (SQL Server or Access are good for this),...
[ 0.2566410005092621, 0.5917372703552246, 0.07266939431428909, 0.013647348619997501, -0.015577529557049274, -0.10204082727432251, 0.13918854296207428, 0.05218604952096939, 0.11671976745128632, -0.6060608625411987, -0.07378187775611877, 0.6616442203521729, -0.27651911973953247, -0.05064067617...
I'm writing a C++ program that doesn't work (I get a segmentation fault) when I compile it with optimizations (options -O1, -O2, -O3, etc.), but it works just fine when I compile it without optimizations. Is there any chance that the error is in my code? or should I assume that this is a bug in GCC? My GCC version is...
[ -0.04669484496116638, 0.2674151062965393, 0.131346195936203, -0.006701901089400053, 0.11791372299194336, -0.0636732280254364, 0.05434521287679672, -0.04507742449641228, -0.19343477487564087, -0.6061738133430481, 0.10390215367078781, 0.6999636888504028, -0.4754122793674469, -0.2083371579647...
with no levels of optimizations and throws a segmentation fault with any level of optimization: ``` struct distanceToPointSort{ indexedDocument* point ; distanceToPointSort(indexedDocument* p): point(p) {} bool operator() (indexedDocument* p1,indexedDocument* p2){ return distance(point,p1) < distan...
[ -0.377061665058136, -0.04651637375354767, 0.36808887124061584, -0.08714484423398972, -0.023000072687864304, 0.12295212596654892, 0.034829866141080856, -0.4370390772819519, 0.006052387412637472, -0.532391369342804, -0.167517751455307, 0.4728650450706482, -0.2529699206352234, 0.0178433712571...
float d2=distance(point,p2) ; std::cout << "" ; //without this line, I get a segmentation fault anyways return d1 < d2 ; } } ; ``` Unfortunately, this problem is hard to reproduce because it happens with some specific values. I get the segmentation fault upon sorting just one out of more than a...
[ 0.1505632847547531, -0.1768069714307785, 0.21857009828090668, 0.026471400633454323, 0.03268766030669212, 0.050791382789611816, 0.18232911825180054, -0.24379755556583405, -0.19883880019187927, -0.5323230028152466, 0.14431624114513397, 0.19604261219501495, -0.203351229429245, 0.2650019526481...
I can say that perhaps what you are looking for is `-ffloat-store`. > -ffloat-store > > > Do not store floating point variables in registers, and inhibit other options that might change whether a floating point value is taken from a register or memory. > > > This option prevents undesirable excess precision on mac...
[ 0.27392858266830444, 0.15275706350803375, 0.13745132088661194, 0.04309944808483124, -0.213211327791214, -0.0023525136057287455, 0.22970126569271088, -0.1204206570982933, -0.32264769077301025, -0.29918399453163147, 0.07600473612546921, 0.5507477521896362, -0.3953678011894226, -0.11684975028...
Use -ffloat-store for such programs, after modifying them to store all pertinent intermediate computations into variables. Source: <http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Optimize-Options.html>
[ 0.2762993574142456, -0.25740525126457214, 0.3262960612773895, 0.03063507005572319, 0.3555375635623932, 0.15579316020011902, -0.25652015209198, -0.2966492772102356, -0.28271371126174927, -0.4323848485946655, -0.39399254322052, 0.6164124011993408, -0.5942329168319702, -0.5399496555328369, ...
What are the best ways (or at least most common ways) in ASP (VBScript) for input handling? My main concerns are HTML/JavaScript injections & SQL injections. Is there some equivalent to PHP's `htmlspecialchars` or `addslashes`, et cetera? Or do I have to do it manually with something like string replace functions? The ...
[ -0.024355851113796234, 0.0490657314658165, 0.4293505549430847, -0.11899116635322571, -0.4463159441947937, -0.07806061953306198, 0.37280017137527466, -0.20749451220035553, -0.2262554168701172, -0.7456510066986084, 0.044210705906152725, 0.5397770404815674, -0.36855459213256836, -0.3217426240...
IIS server that renders the page, unless they are version 6 and up, which do not require these tools anymore. If you stick to points 1 and 2 *slavishly*, I can't think of much that can go wrong. Most vulnerabilities come from not properly encoding user input or building SQL strings from it. If you for some reason co...
[ 0.04343756288290024, 0.1782367080450058, 0.30639922618865967, -0.1369948387145996, -0.21465426683425903, -0.2750077545642853, 0.61761075258255, 0.13047277927398682, 0.054191987961530685, -0.7724213004112244, 0.032156385481357574, 0.40666699409484863, -0.39014512300491333, 0.176385387778282...
I'm creating a data entry app for some in-house stuff. My team needs to enter info about "items" which can have many "categories" and vice versa. I need a quick way to let them enter an arbitrary amount of categories. Here's my idea: On the item entry page, I'll have it so that initially there's one text input for ...
[ 0.20349808037281036, -0.06439981609582901, 0.28452742099761963, 0.22556526958942413, -0.19536297023296356, 0.1433759480714798, -0.16117824614048004, -0.014815788716077805, -0.33529946208000183, -0.5046113729476929, -0.018589381128549576, 0.43641477823257446, -0.08215394616127014, 0.1541138...
array, then an additional "category" text input will be added and focused. This way people can enter an arbitrary amount of categories really quickly, without taking their hands off the keyboard, just by typing and hitting tab. Then hitting tab twice to denote the end of the list. First of all, what do you think of t...
[ 0.3510189354419708, -0.1998731940984726, 0.36750516295433044, 0.13761134445667267, -0.495559424161911, -0.0008492227643728256, 0.004800616297870874, 0.014734632335603237, -0.42308542132377625, -0.6979039907455444, 0.30814677476882935, 0.5303553342819214, -0.21718500554561615, 0.03244028985...
roll my own. Any and all advice appreciated Wikipedia points to the term [Canonicalization](http://en.wikipedia.org/wiki/Canonicalization). > A process for converting data that has more than one possible representation into a "standard" canonical representation. This can be done to compare different representations f...
[ 0.5693828463554382, 0.0813090056180954, 0.5339211821556091, 0.02393217757344246, -0.48013150691986084, -0.02184133790433407, -0.271257609128952, -0.22029349207878113, -0.21315978467464447, -0.4958037734031677, -0.051539916545152664, 0.3123186230659485, 0.10906525701284409, 0.00568111380562...
more complicated, since every possible encoding of each string character must be considered. A software implementation which does not consider all character encodings runs the risk of accepting strings considered invalid in the application design, which could cause bugs or allow attacks. The solution is to allow a sing...
[ 0.08643528074026108, -0.1485004872083664, 0.2870804965496063, 0.24847570061683655, -0.15912240743637085, -0.15688346326351166, 0.25045904517173767, -0.22441095113754272, -0.06734701991081238, -0.5327852368354797, -0.4524212181568146, 0.5009853839874268, -0.4749811291694641, 0.1478913128376...
responsibility of the client. In summary, a standard form of representation for data. From this form you can then convert to any representation you may need.
[ 0.18851031363010406, 0.048474136739969254, 0.22760158777236938, 0.20846672356128693, -0.12928041815757751, 0.02651873044669628, -0.18803229928016663, -0.3287852108478546, -0.5052511692047119, -0.34905046224594116, -0.20550844073295593, 0.8117497563362122, 0.05085540562868118, 0.12235409766...
I'm bored with surrounding code with try catch like this.. ``` try { //some boring stuff } catch(Exception ex) { //something even more boring stuff } ``` I would like something like ``` SurroundWithTryCatch(MyMethod) ``` I know I can accomplish this behaviour by creating a delegate with the exact signatur...
[ 0.7034207582473755, -0.214017853140831, -0.082502581179142, 0.14784179627895355, -0.2773018479347229, -0.4414616823196411, 0.35268425941467285, -0.22034801542758942, 0.02391870506107807, -0.6565814018249512, 0.13702760636806488, 0.4190981686115265, -0.5763614773750305, 0.018459085375070572...
particularly if you're catching `Exception`. try/catch blocks should be relatively rare; unless you can really "handle" the exception, you should just let it bubble up to the next layer of the stack. Now, assuming you really *do* want all of these try/catch blocks, why is it not an option to create a delegate? With an...
[ 0.4321177303791046, -0.3347915709018707, -0.04723726212978363, 0.02197624184191227, 0.034028708934783936, -0.144680455327034, 0.21128123998641968, -0.24285033345222473, -0.4665321409702301, -0.48549798130989075, -0.21022461354732513, 0.4732154309749603, -0.436642050743103, -0.1293271631002...
catch(Exception ex) { //something even more boring stuff } } ``` and then your `SurroundWithTryCatch(MyMethod)` will work fine, if it takes no paramaters. Alternatively, if you don't want to call a *different* method, just write: ``` public void MyMethod() { SurroundWithTryCatch(() => {...
[ 0.5420351028442383, -0.12930569052696228, 0.5063418745994568, -0.042224347591400146, 0.2835419774055481, -0.26516276597976685, 0.30861422419548035, -0.48492375016212463, -0.009621568955481052, -0.3147083520889282, -0.04637279361486435, 0.7573350667953491, -0.39529332518577576, 0.2222515791...
// Logic here return 5; }); } ``` with a generic overload of `SurroundWithTryCatch` like this: ``` public T SurroundWithTryCatch<T>(Func<T> func) { try { return func(); } catch(Exception ex) { //something even more boring stuff } } ``` Most of this would ...
[ 0.2165076732635498, -0.2509022355079651, 0.07198304682970047, 0.160836324095726, -0.030603481456637383, -0.6380725502967834, 0.2735458314418793, -0.307133287191391, 0.010864553973078728, -0.14474229514598846, -0.1287246197462082, 0.7606969475746155, -0.5398274660110474, 0.05382591858506203...
won't help you quite as much and you'll have to use anonymous methods instead of lambda expressions. To go back to the start though: try to use try/catch less often. (try/finally should be much more frequent, although usually written as a using statement.)
[ 0.3693634867668152, -0.4246359169483185, -0.08115913718938828, 0.13069353997707367, -0.28931838274002075, 0.00026300211902707815, 0.47138816118240356, 0.3789101243019104, -0.2913849949836731, -0.4028274118900299, -0.05370521917939186, 0.40528926253318787, -0.3782064616680145, -0.3076393008...
I have input consisting of a list of nested lists like this: ``` l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]] ``` I want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this: ``` [39, 6, 13, 50] ``` Then I ...
[ 0.1211061179637909, 0.3036089241504669, 0.11769569665193558, -0.2708977460861206, 0.07070367783308029, 0.5832281708717346, -0.14621901512145996, -0.13544782996177673, -0.2501484751701355, -0.4499710202217102, 0.14740192890167236, 0.21069031953811646, -0.529880166053772, -0.2931625843048095...
far, using a recent addition to python's syntax: ``` >>> l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]] >>> def asum(t): return sum(map(asum, t)) if hasattr(t, '__iter__') else t ... >>> sorted(l, key=asum) [[1, 2, 3], [4, [5, 3], 1], [[[[39]]]], [[[[8, 9], 10], 11], 12]] ```
[ -0.11901295185089111, -0.4853523075580597, 0.21686531603336334, -0.4170083701610565, -0.12808449566364288, 0.19863073527812958, 0.20396661758422852, -0.40106987953186035, -0.3852338492870331, -0.6213465929031372, -0.16176018118858337, 0.18668432533740997, -0.3830752372741699, -0.1680999845...
I'm thinking it would be smart to setup the Entity object context in Application\_BeginRequest, store it in Request.items, use it throughout the request and dispose it in Application\_EndRequest. That way the context is always available and I can navigate the Entity Framework object graph in my views, lazy loading what...
[ 0.16818809509277344, 0.4569509029388428, 0.36403802037239075, 0.08337036520242691, -0.292881578207016, -0.389716237783432, 0.49478358030319214, -0.19954083859920502, -0.08645918220281601, -0.27180877327919006, 0.03428049758076668, 0.789729118347168, -0.19772663712501526, 0.3026148080825805...
special trick I need to do? The 1.0 build of ASP.NET MVC let me hook up event handlers on both beginrequest and endrequest, newing up a SessionScope and storing it in HttpContext.Items in beginrequest (I switched to Castle ActiveRecord) and in endrequest I pick the sessionscope out from HttpContext.Items and dispose it...
[ 0.20759855210781097, -0.25404801964759827, 0.5190321207046509, -0.001934830448590219, -0.012267908081412315, -0.14475774765014648, 0.6610214710235596, -0.6214447617530823, -0.12641237676143646, -0.3672148883342743, -0.054660145193338394, 0.5561690330505371, -0.13334299623966217, -0.1829332...