text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
own hosts file making it correspond to the internal IP. This will achieve (3) automatically when accessing the name from your own host. You will have to repeat this for every single host behind your router. 4. Run your own DNS server behind the router, make it claim authority over your DNS record and resolve it to the ...
[ 0.24651838839054108, -0.27964159846305847, 0.6466172337532043, 0.12653227150440216, -0.1260380893945694, -0.19293351471424103, 0.06679543107748032, -0.24635225534439087, -0.3911149799823761, -0.682798445224762, -0.12979021668434143, 0.37851041555404663, -0.2051580250263214, 0.3106906414031...
Say you've got some IEnumerable called S of length N. I would like to select all continuous subsequences of length n <= N from S. If S were, say, a string, this'd be pretty easy. There are (S.Length - n + 1) subsequences of length n. For example, "abcdefg" is length (7), so that means it has (5) substrings of length (...
[ 0.4524896442890167, -0.13553059101104736, 0.3814128637313843, -0.05201251804828644, -0.1257428675889969, 0.011699636466801167, 0.1460978239774704, -0.15261416137218475, -0.27972742915153503, -0.612898051738739, -0.23997566103935242, 0.34103715419769287, -0.35890039801597595, 0.154173970222...
windowed n (s: seq<_>) = if n <= 0 then Helpers.invalid_arg2 "n" "the window size must be positive" { let arr = Array.zero_create n let r = ref (n-1) let i = ref 0 use e = s.GetEnumerator() while e.MoveNext() do do arr.[!i] <- e.Current do i :=
[ -0.13915935158729553, -0.31323888897895813, 0.6407091021537781, -0.3537847697734833, -0.11107239872217178, 0.20751191675662994, 0.28787264227867126, -0.5906795263290405, -0.3152281939983368, -0.6878925561904907, -0.3406845033168793, 0.4993453919887543, -0.46287715435028076, 0.1014034822583...
(!i + 1) % n if !r = 0 then yield Array.init n (fun j -> arr.[(!i+j) % n]) else do r := (!r - 1) } ```
[ -0.28614526987075806, 0.15423157811164856, 0.3493843972682953, -0.44839316606521606, -0.004111692309379578, 0.12037838995456696, 0.5507658123970032, -0.6976329684257507, -0.06396032869815826, -0.17776690423488617, -0.3707210421562195, 0.912296712398529, -0.33325397968292236, 0.068168319761...
I want to generate a url from a tag name. In my view (asp.net mvc) I have the following: ``` <%= Html.ActionLink(Html.Encode(tagName), "tagged" //action, "posts" //controller, new {tagName=Html.UrlEncode(tagName)} //querystring argument, new {@class="tag"} //html attributes) %> ``` But this generates the foll...
[ 0.29499632120132446, -0.011125952005386353, 0.7294885516166687, -0.18033435940742493, -0.12199999392032623, 0.06921388953924179, 0.041855353862047195, -0.5106008052825928, -0.4193585515022278, -0.4595203399658203, -0.14539070427417755, 0.48661285638809204, -0.37032926082611084, 0.212521374...
c%2523 is the encoded value for c%23. (0x23 = ASCII 35 = #, 0x25 = ASCII 37 = %). As you have two encode calls (Html.Encode and Html.UrlEncode), perhaps removing one of them removes your problem.
[ -0.1387016624212265, 0.4085654318332672, 0.17678532004356384, -0.30413201451301575, -0.03345751017332077, 0.08054856210947037, 0.19018428027629852, -0.041516631841659546, -0.007124980445951223, -0.3507802486419678, -0.16201646625995636, 0.08577931672334671, -0.4625614881515503, 0.260364711...
I have the following task: Create one website which is accessible with 20 different domains names. Same files, same folder, same ip. **Question (shared hosting):** Can this be accomplish with a bare cname's pointing to the same common subdomain or do we need one static ip for all? The problem is sure shared hosting ...
[ 0.2959447503089905, 0.06524483114480972, 0.4276212751865387, 0.36958205699920654, -0.19307810068130493, -0.0637337863445282, 0.1623287945985794, 0.08299009501934052, -0.4871097207069397, -0.47679248452186584, 0.03576415404677391, 0.24142169952392578, -0.25824713706970215, 0.551389276981353...
which works on shared hosting. "\*.domain.com", "two.domain.com", "three.domain.com" => directory/ I think you have answered your own question, the options open to you are * Add ServerAlias entries to the vhost config, via whatever means available to you * Ensure the default virtual host on the target IP is the one wh...
[ 0.453817218542099, 0.09124299138784409, 0.758000373840332, 0.06067913770675659, 0.07700265198945999, -0.13603107631206512, 0.036930691450834274, -0.08585328608751297, -0.339852899312973, -0.5771815180778503, -0.035291217267513275, 0.568553626537323, -0.2596988379955292, 0.33862000703811646...
In ruby's test/unit, the software indicates how long it takes for the tests to run, and the series of passes, errors and fails act like a pseudo-progress bar. Apart from using code profiling tools or running tests individually, is there an easy way of telling which test methods are fast and which ones are slow? When I...
[ 0.47771725058555603, 0.043899256736040115, -0.099239781498909, 0.10865283012390137, 0.042620714753866196, -0.30812183022499084, 0.6687930226325989, -0.5401911735534668, -0.06602410972118378, -0.5954840183258057, -0.09575200825929642, 0.37932080030441284, -0.2405509054660797, -0.01316376402...
end def teardown puts "#{@method_name}: #{Time.now - @start_time}s" end end end ```
[ 0.030568188056349754, -0.06978578120470047, 0.5325774550437927, -0.2756844460964203, -0.07417526096105576, -0.34605732560157776, 0.46280571818351746, -0.2145996242761612, 0.14648224413394928, -0.5430462956428528, -0.24498224258422852, 0.5896570086479187, -0.09708567708730698, 0.16932623088...
Can somebody please recommend a good multi-column combobox control for use in a Web Form? I'm quite disappointed to not find any multi-column support on the DevExpress ASPxComboBox control, unless I'm missing something. I'm using the telerik [RadComboBox control](http://www.telerik.com/products/aspnet-ajax/combobox.asp...
[ 0.008246026933193207, 0.07977829873561859, 0.12546052038669586, 0.19536612927913666, -0.06019013002514839, -0.14845344424247742, 0.2752330005168915, 0.02441607229411602, -0.25365757942199707, -0.7305094003677368, 0.0025917883031070232, 0.7218189239501953, -0.1542440503835678, -0.1957068294...
I have a C-code which I have not managed to run <http://dl.getdropbox.com/u/175564/problem-sdl.png> The problem is in OpenGL or SDL. I do not have SDL.h at /usr/local/SDL/SDL.h, so gcc cannot find it. I have SDL.h installed by MacPorts at /opt/local/include/SDL/SDL.h. I tried to copy it to /Masi/local/SDL/SDL.h unsu...
[ -0.00711712334305048, 0.40841910243034363, 0.48842930793762207, -0.09748057276010513, -0.13927814364433289, -0.28770554065704346, 0.37190720438957214, -0.16245707869529724, -0.19196158647537231, -0.7618589401245117, -0.2590321898460388, 0.6250450015068054, -0.3790988028049469, 0.0555019937...
-o src/geom.o -c -Wall -ansi src/geom.c gcc -o src/main.o -c -Wall -ansi src/main.c gcc -o test src/main.o src/geom.o -lSDL -lGL ``` If you install the libraries in some non-standard location, you might have to specify your own include (-I) and library (-L) paths.
[ 0.14909785985946655, 0.27762702107429504, 0.38831424713134766, -0.04198402166366577, 0.2092498242855072, -0.2211860716342926, -0.047341082245111465, -0.15673606097698212, -0.2753308415412903, -0.537774384021759, -0.524969220161438, 0.2486295998096466, -0.163827046751976, 0.0578335896134376...
[The code](http://www.djangobook.com/en/2.0/chapter01/) ``` #!/usr/bin/env python import MySQLdb print "Content-Type: text/html" print print "<html><head><title>Books</title></head>" print "<body>" print "<h1>Books</h1>" print "<ul>" connection = MySQLdb.connect(user='me', passwd='letmein', db='my_db') cursor = c...
[ 0.07783619314432144, 0.6424736380577087, 0.4773090183734894, -0.0029663206078112125, -0.05955951288342476, 0.04168636351823807, 0.34035030007362366, -0.5545985698699951, -0.07335390150547028, -0.40826547145843506, -0.17177866399288177, 0.29224693775177, -0.4164164066314697, 0.1528952717781...
PATH=${PATH}:~/bin 4. Python module MySQLdb is installed. 5. The code does not have smart quotes. **[edit]** after the second answer > you're getting that error because you > haven't installed the MySQLdb module > that Python needs to talk to a MySQL > database I installed MySQLdb to my system. The module works, ...
[ 0.08236309885978699, 0.05083194002509117, 0.41708338260650635, -0.032991815358400345, 0.007153878919780254, -0.259199321269989, 0.6031547784805298, -0.2549827992916107, -0.13329723477363586, -0.9706688523292542, 0.06319130212068558, 0.7831740975379944, -0.34793514013290405, -0.046000991016...
here? > Is the SELECT statement correct? You mean whether I have my SQL statements such as SELECT statement correct? I have not used any SQL queries yet. Do I need them here? Any number of issues can cause the error you are seeing: 1. Is `test.cgi` executable (chmod 755) on the server? 2. Is the directory in which y...
[ 0.6967499852180481, 0.0693792775273323, 0.14193099737167358, 0.1912374198436737, 0.06089574843645096, -0.13800537586212158, 0.11609481275081635, -0.4076045751571655, -0.11006859689950943, -0.4070155918598175, 0.07956479489803314, 0.47269824147224426, -0.26457685232162476, 0.040745910257101...
Is MySQL running on localhost at the default port? 6. Is the `SELECT` statement correct? If you're sure that `python` is found (test using the simplest possible script or by logging into the Web server if you can and typing `which python`) then you can get much better debug output by adding the following to the top of...
[ 0.19203123450279236, -0.004861715715378523, 0.238749697804451, -0.038861703127622604, 0.11077914386987686, -0.09473863244056702, 0.392387330532074, 0.11890805512666702, -0.10776859521865845, -0.5822016596794128, -0.29637661576271057, 0.8538816571235657, -0.2388194501399994, -0.116404689848...
you will need to get MySQLdb installed into the Web server's Python installation. **EDIT:** Looking more closely at the top of your question, I see that the code was scraped from an illustrative example at the very beginning of the Django Book. As such, I might expand #5 above to include the caveat that, of course, th...
[ 0.5188750624656677, 0.31160101294517517, 0.157348170876503, -0.24138309061527252, 0.16637292504310608, -0.28660356998443604, 0.014733964577317238, 0.20587848126888275, -0.06726044416427612, -0.7588843703269958, -0.14634208381175995, 0.5335274934768677, -0.026322660967707634, -0.18127703666...
After spending many years of analysis, design and programming in different domains and architectures, you have maybe come across a "pattern" or good practice that haven't been published as a pattern (analysis, design or architecture). Although you have done it many times before, it has no name. Interested i...
[ 0.9907712340354919, 0.24923346936702728, 0.006272702012211084, 0.21634866297245026, -0.03822391480207443, -0.08748120814561844, 0.359811007976532, 0.237296000123024, -0.5148850083351135, -0.9522229433059692, 0.1244291216135025, 0.03593368083238602, -0.019712448120117188, 0.3897441625595093...
of many years of trying to resolve the same problems. I guess unless someone 'finds' a new problem domain you aren't likely to see a new pattern. Maybe in the future, new programming paradigms or technologies will help uncover new ways of resolving the same old problems.
[ 0.2302411049604416, 0.2635558843612671, 0.12194910645484924, 0.4533970355987549, 0.2252301573753357, 0.0904216393828392, 0.45045730471611023, 0.3679535388946533, -0.47745993733406067, -0.7652913928031921, 0.025022439658641815, 0.5341132283210754, -0.06426288187503815, 0.41514214873313904, ...
I am looking to use a natural language parsing library for a simple chat bot. I can get the Parts of Speech tags, but I always wonder. What do you do with the POS. If I know the parts of the speech, what then? I guess it would help with the responses. But what data structures and architecture could I use. A part-of-sp...
[ -0.018819166347384453, -0.16570231318473816, -0.03132399171590805, 0.42893528938293457, -0.3007037937641144, 0.1399502009153366, 0.3428770899772644, 0.0608486533164978, 0.23574629426002502, -0.3774668872356415, -0.2388671636581421, 0.3083460330963135, -0.05244705080986023, -0.0755282938480...
many English word forms can be either nouns or verbs, but in the context of other words, their part of speech is unambiguous. So, having annotated your text with POS tags you can answer questions like: how many nouns do I have?, how many sentences do not contain a verb?, etc. For a chatbot, you obviously need much mor...
[ 0.12055883556604385, 0.04698552191257477, 0.114406056702137, -0.03171221911907196, -0.47715723514556885, 0.2895715534687042, 0.62748122215271, 0.32420215010643005, 0.041480716317892075, -0.6376433372497559, -0.5683433413505554, 0.29898858070373535, -0.10651694983243942, -0.3605796992778778...
(e.g. *every*, *more than 3*), etc. Ideally, you need to map you input text into some logical representation (such as first-order logic), which would let you bring in reasoning to determine if two sentences are equivalent in meaning, or in an entailment relationship, etc. While a POS-tagger would map the sentence ``...
[ -0.1913815140724182, 0.029936419799923897, 0.10477156937122345, 0.012871496379375458, -0.1544691026210785, 0.30721160769462585, 0.48332348465919495, -0.23222434520721436, -0.33656904101371765, -0.7234850525856018, -0.356857568025589, 0.4516104459762573, -0.15641677379608154, 0.109274610877...
Class(:cat) ) ) ObjectComplementOf( ObjectSomeValuesFrom( ObjectInverseOf(ObjectProperty(:like)) ObjectOneOf( NamedIndividual(:Mary) ) ) ) ) ``` Of course, while POS-taggers get precision and recall values close to 100%, more complex automatic processi...
[ -0.4007435441017151, -0.2798898220062256, 0.383379727602005, 0.03280181437730789, -0.05335060879588127, -0.19406214356422424, 0.3861926198005676, -0.057089220732450485, -0.23744408786296844, -0.6007095575332642, -0.06503338366746902, 0.3383367955684662, -0.16534526646137238, -0.12822741270...
however, go much beyond POS-tagging, chunking, and named entity recognition.
[ 0.44783785939216614, 0.20358248054981232, 0.005664175841957331, 0.159335196018219, -0.006385381333529949, -0.30072519183158875, -0.09770741313695908, 0.3866472840309143, -0.19998152554035187, -0.4786697030067444, -0.20799389481544495, 0.3298858404159546, -0.1195993721485138, -0.13196921348...
Using dynamic linq (<http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx>) I run the query below which returns an IQueryable. On this result which is also an IEnumerable I am able to run a Count() however there is not ToList() to get the values. I can enumerat...
[ -0.2950041592121124, -0.20711594820022583, 0.8588483333587646, -0.06643582880496979, -0.38434427976608276, 0.20345832407474518, 0.05383436754345894, -0.4111860990524292, -0.18119509518146515, -0.2118474543094635, -0.19608567655086517, 0.3260537385940552, -0.780643880367279, -0.118992127478...
OrderBy("CompanyName"). Select("New(CompanyName as Name, Phone)"); foreach (var item in query) { foreach (var prop in item.GetType().GetProperties()) {
[ -0.25350454449653625, -0.20123234391212463, 0.5030259490013123, -0.22692139446735382, 0.39270836114883423, 0.39651694893836975, 0.1294713169336319, -0.29483312368392944, -0.08701389282941818, -0.2992856502532959, -0.6672024726867676, 0.520544171333313, -0.3933774530887604, 0.43681910634040...
Console.WriteLine(prop); } } ``` Tried casting but got an error Unable to cast object of type 'DynamicClass1' to type 'Test'. ``` foreach (var item in query) { Console.WriteLine("{0}: {1}", ((Test)item).CompanyName, ((Test)item).Phone);
[ -0.20543985068798065, -0.12200324237346649, 0.5723148584365845, -0.1714814305305481, 0.28682941198349, 0.26617974042892456, 0.26593127846717834, -0.05811769887804985, 0.2038934975862503, -0.41436728835105896, -0.36661043763160706, 0.5142085552215576, -0.48750659823417664, 0.363688141107559...
} public class Test { public string CompanyName { get; set; } public string Phone { get; set; } ``` } You can't expect the type of you dynamic object to be resolved at compile time when your query is resolved at runtime. That's what dynamic linq is all about : it allows you to execute dynamic...
[ 0.2037813514471054, -0.054122451692819595, 0.33019334077835083, 0.06515094637870789, 0.001937956316396594, -0.2649533450603485, 0.20717771351337433, 0.12559159100055695, -0.09777076542377472, -0.3078373372554779, -0.049388911575078964, 0.6341581344604492, -0.34538885951042175, 0.0878674387...
What are common database development mistakes made by application developers? **1. Not using appropriate indices** This is a relatively easy one but still it happens all the time. Foreign keys should have indexes on them. If you're using a field in a `WHERE` you should (probably) have an index on it. Such indexes shou...
[ 0.2280007153749466, 0.3385448753833771, 0.00787994172424078, 0.22169284522533417, -0.09274189919233322, -0.5551252365112305, 0.45995450019836426, 0.04217328876256943, -0.2734393775463104, -0.5708263516426086, 0.17283637821674347, 0.6993151307106018, -0.42924246191978455, 0.1548731774091720...
this failure on MySQL databases. I don't believe MyISAM supports it. InnoDB does. You'll find people who are using MyISAM or those that are using InnoDB but aren't using it anyway. More here: * [How important are constraints like NOT NULL and FOREIGN KEY if I’ll always control my database input with php?](https://sta...
[ -0.2014217972755432, 0.03212634101510048, 0.19521783292293549, 0.36628055572509766, 0.2889964282512665, -0.35548290610313416, 0.17889375984668732, 0.14993244409561157, -0.28682249784469604, -0.34472694993019104, -0.24524261057376862, 0.6160820722579956, -0.19514839351177216, 0.161754116415...
numbers and so on. Surrogate or technical primary keys are those that have absolutely no meaning outside the system. They are invented purely for identifying the entity and are typically auto-incrementing fields (SQL Server, MySQL, others) or sequences (most notably Oracle). In my opinion you should **always** use sur...
[ 0.18220706284046173, 0.19507594406604767, 0.45278891921043396, 0.3440408408641815, 0.06601103395223618, -0.15752342343330383, -0.07419446110725403, -0.01094942819327116, -0.29507365822792053, -0.1236303299665451, -0.5015862584114075, 0.6367233395576477, -0.06691528856754303, 0.128127470612...
topic on which you won't get universal agreement. While you may find some people, who think natural keys are in some situations OK, you won't find any criticism of surrogate keys other than being arguably unnecessary. That's quite a small downside if you ask me. Remember, even [countries can cease to exist](http://en....
[ 0.03987549990415573, 0.04528706148266792, -0.052194468677043915, 0.2621198892593384, -0.045825324952602386, -0.26046022772789, 0.3169005513191223, 0.3658472001552582, -0.577530562877655, -0.33609941601753235, -0.6892920136451721, -0.027494000270962715, -0.22191974520683289, 0.5174247026443...
duplicate objects. You'll sometimes see people doing this as well. If you see it too much it's a real red flag. Not that `DISTINCT` is bad or doesn't have valid applications. It does (on both counts) but it's not a surrogate or a stopgap for writing correct queries. From [Why I Hate DISTINCT](http://weblogs.sqlteam.co...
[ -0.2473740577697754, 0.3977324664592743, -0.2485884130001068, 0.20339421927928925, -0.23837794363498688, -0.06387326121330261, 0.38080793619155884, 0.34380167722702026, -0.643787682056427, -0.5246625542640686, 0.015243294648826122, 0.018371447920799255, -0.38885071873664856, 0.768226146697...
response...his > "solution" to this "problem" is to > throw on the DISTINCT keyword and **POOF** > all his troubles go away. **5. Favouring aggregation over joins** Another common mistake by database application developers is to not realize how much more expensive aggregation (ie the `GROUP BY` clause) can be comp...
[ -0.22238248586654663, 0.17156264185905457, 0.30124354362487793, -0.29445192217826843, -0.17782264947891235, -0.0921214148402214, 0.26161444187164307, -0.19079744815826416, -0.35673341155052185, -0.2969358265399933, -0.23891191184520721, 0.40860167145729065, -0.4165814518928528, 0.21484375,...
2, 3) > GROUP by userid > HAVING COUNT(1) = 3 > > ``` > > Query time: 0.312 s > > > Second query: > > > > ``` > SELECT t1.userid > FROM userrole t1 > JOIN userrole t2 ON t1.userid = t2.userid AND t2.roleid = 2 > JOIN userrole t3 ON t2.userid = t3.userid AND t3.roleid = 3 > AND t1.roleid = 1 > > ``` > > Query t...
[ -0.33132481575012207, -0.22473423182964325, 0.9067789912223816, -0.20686309039592743, -0.30311501026153564, 0.21300405263900757, 0.16087935864925385, -0.6841031312942505, -0.02800569124519825, -0.9381682276725769, 0.1511727124452591, 0.5452800989151001, -0.24794957041740417, -0.18214400112...
simplify queries if used judiciously. For example, on one project I used a [generic Party model](http://www.tdan.com/view-articles/5014/) for CRM. This is an extremely powerful and flexible modelling technique but can lead to many joins. In this model there were: * **Party**: people and organisations; * **Party Role**...
[ 0.053083255887031555, 0.08904632180929184, 0.1389068216085434, 0.3457326292991638, -0.20428457856178284, 0.3068329393863678, -0.09982606768608093, -0.03750462085008621, -0.33237406611442566, -0.3627238869667053, -0.017902681604027748, 0.1365063488483429, -0.16327714920043945, 0.18695195019...
Intel employs Ted, meaning there is a relationship between their respective roles. So there are five tables joined to link Ted to his employer. You assume all employees are Persons (not organisations) and provide this helper view: ``` CREATE VIEW vw_employee AS SELECT p.title, p.given_names, p.surname, p.date_of_birt...
[ 0.20308160781860352, -0.04700199514627457, 0.05303698778152466, 0.15090981125831604, -0.18134839832782745, 0.37156084179878235, -0.3328160047531128, -0.05144472047686577, -0.14685983955860138, -0.428152859210968, -0.14450763165950775, 0.3570592403411865, 0.02446729876101017, -0.07114560157...
data model. **7. Not sanitizing input** This is a huge one. Now I like PHP but if you don't know what you're doing it's really easy to create sites vulnerable to attack. Nothing sums it up better than the [story of little Bobby Tables](http://xkcd.com/327/). Data provided by the user by way of URLs, form data **and ...
[ 0.10996874421834946, 0.07085854560136795, 0.17242905497550964, 0.16278156638145447, -0.37822163105010986, -0.26981037855148315, 0.43406879901885986, -0.07554159313440323, -0.2704143822193146, -0.6613790392875671, -0.03920923173427582, 0.44081252813339233, -0.1634667068719864, -0.0550957769...
WHERE username = 'bob' ``` vs ``` SELECT * FROM users WHERE username = ? ``` or ``` SELECT * FROM users WHERE username = :username ``` depending on your platform. I've seen databases brought to their knees by doing this. Basically, each time any modern database encounters a new query it has to compile it. If i...
[ 0.2218218594789505, 0.26053857803344727, -0.1817140281200409, 0.05350733920931816, 0.023916173726320267, 0.11013533920049667, 0.23795343935489655, -0.20853747427463531, -0.3685312569141388, -0.6399636268615723, -0.08863384276628494, 0.4684097170829773, -0.1142204999923706, 0.03878950327634...
give you meaningful statistics about how often certain queries are used. Prepared statements will also better protect you against SQL injection attacks. **9. Not normalizing enough** [Database normalization](http://en.wikipedia.org/wiki/Database_normalization) is basically the process of optimizing database design o...
[ 0.2608642280101776, -0.2124459147453308, 0.3244968354701996, 0.0954124853014946, 0.039039626717567444, -0.1438598334789276, 0.1672031581401825, 0.078847736120224, -0.3665749132633209, -0.40182358026504517, 0.17002882063388824, 0.2096032351255417, -0.4773433208465576, 0.1869315505027771, ...
seen in other systems that the list is stored in a serialized PHP array. But lack of normalization comes in many forms. More: * [Normalization: How far is far enough?](http://www.techrepublic.com/article/normalization-how-far-is-far-enough/) * [SQL by Design: Why You Need Database Normalization](http://www.sqlmag.co...
[ 0.29821762442588806, -0.3490622937679291, 0.4785548150539398, 0.2783489227294922, 0.23661355674266815, -0.4272362291812897, 0.024877138435840607, 0.1122777909040451, -0.09646652638912201, -0.4502296447753906, 0.13243871927261353, 0.11474651098251343, -0.04290656000375748, 0.199146851897239...
huge hierarchy for clients that went something like: ``` Licensee -> Dealer Group -> Company -> Practice -> ... ``` such that you had to join about 11 tables together before you could get any meaningful data. It was a good example of normalization taken too far. More to the point, careful and considered denormaliz...
[ 0.027285870164632797, -0.10239969938993454, 0.216964453458786, 0.1434745490550995, -0.10154110193252563, -0.2891002595424652, 0.1586606651544571, 0.24679189920425415, -0.4381982684135437, -0.3003064692020416, 0.015008622780442238, 0.4517800509929657, -0.46351054310798645, 0.450141787528991...
Normalization Debates on Coding Horror](http://highscalability.com/mother-all-database-normalization-debates-coding-horror) **11. Using exclusive arcs** An exclusive arc is a common mistake where a table is created with two or more foreign keys where one and only one of them can be non-null. **Big mistake.** For one ...
[ 0.2071572095155716, 0.05707652121782303, 0.3403726816177368, 0.23760271072387695, -0.16843320429325104, -0.1650044471025467, 0.1838528960943222, -0.24309125542640686, -0.04968120530247688, -0.2994228005409241, -0.2728179097175598, 0.36893945932388306, -0.24244865775108337, 0.23315262794494...
write code > and pose more maintenance difficulties. **12. Not doing performance analysis on queries at all** Pragmatism reigns supreme, particularly in the database world. If you're sticking to principles to the point that they've become a dogma then you've quite probably made mistakes. Take the example of the aggr...
[ 0.7919014096260071, 0.5044925808906555, -0.02240125648677349, 0.12731993198394775, -0.3098069727420807, -0.34874898195266724, 0.7299483418464661, -0.09371645003557205, 0.11575200408697128, -0.5495770573616028, -0.03609631955623627, 0.5235707759857178, -0.18930155038833618, 0.02357511222362...
terms merely concatenates congruent data sets, meaning they have the same type and number of columns. The difference between them is that UNION ALL is a simple concatenation and should be preferred wherever possible whereas a UNION will implicitly do a DISTINCT to remove duplicate tuples. UNIONs, like DISTINCT, have t...
[ 0.222135990858078, 0.04553854465484619, 0.18443332612514496, 0.15305998921394348, -0.3820818364620209, -0.3078431487083435, 0.3371472954750061, 0.1374489814043045, -0.0007226930465549231, -0.4328850209712982, -0.46939679980278015, 0.1881805658340454, -0.37263885140419006, 0.374716669321060...
or dependent subqueries, can cripple a database. Try to avoid them whenever possible. **14. Using OR conditions in queries** This might seem harmless. After all, ANDs are OK. OR should be OK too right? Wrong. Basically an AND condition **restricts** the data set whereas an OR condition **grows** it but not in a way t...
[ 0.14922554790973663, 0.011349900625646114, 0.2848965525627136, 0.11651020497083664, -0.11441392451524734, -0.19238759577274323, 0.3377455770969391, 0.023108793422579765, -0.21628998219966888, -0.47067883610725403, -0.2588788866996765, 0.5672152042388916, -0.5063518285751343, 0.172213196754...
effectively turn the first query into the second. But it might not. Just don't do it. **15. Not designing their data model to lend itself to high-performing solutions** This is a hard point to quantify. It is typically observed by its effect. If you find yourself writing gnarly queries for relatively simple tasks or ...
[ 0.32876482605934143, 0.3275420069694519, -0.09217391908168793, 0.0012652146397158504, -0.3195730447769165, -0.18704378604888916, 0.7362051010131836, 0.10391037911176682, -0.2776769995689392, -0.6807365417480469, -0.045370083302259445, 0.42824479937553406, 0.04140778258442879, 0.05828900262...
be done second. First and foremost you should ensure you have a good data model before trying to optimize the performance. As Knuth said: > Premature optimization is the root of all evil **16. Incorrect use of Database Transactions** All data changes for a specific process should be atomic. I.e. If the operation suc...
[ 0.12076161801815033, 0.25876280665397644, -0.04783596843481064, 0.012157042510807514, -0.04761718958616257, -0.07593422383069992, 0.6605329513549805, -0.14991559088230133, -0.06853098422288895, -0.5176302790641785, -0.2749030590057373, 0.7477124929428101, -0.4775003492832184, 0.01747780106...
transaction handling is needed, as your database engine should do so automatically. However, if any processes do require multiple statements be performed as a unit to keep the data in a consistent state, then appropriate Transaction Control is necessary. * Begin a Transaction before the first statement. * Commit the ...
[ 0.16874097287654877, 0.15196065604686737, 0.13976618647575378, 0.14357933402061462, -0.14315016567707062, -0.2854863703250885, 0.18045906722545624, -0.09345822781324387, -0.3948458731174469, -0.4123050570487976, 0.007454438600689173, 0.812515139579773, -0.17794127762317657, 0.0027821017429...
language follows a specific paradigm suited to specific kinds of problems. Various vendor-specific extensions notwithstanding, the language struggles to deal with problems that are trivial in langues like Java, C#, Delphi etc. This lack of understanding manifests itself in a few ways. * Inappropriately imposing too m...
[ -0.304208368062973, -0.009630627930164337, 0.012882021255791187, 0.16305845975875854, -0.24586221575737, -0.033064600080251694, 0.6523122787475586, 0.024718301370739937, -0.12094169110059738, -0.3747437298297882, -0.13915251195430756, 0.3305719792842865, -0.5278818607330322, -0.26236298680...
I'm learning PHP and MySQL and I'm creating a movies website for learning purposes. I want to insert variables and arrays containing movie info into a database but in different tables. This is what I have right now: ``` include('inc/connection.php'); $conn = dbConnect(); // create SQL $sql = 'INSERT INTO movies (mo...
[ 0.5437955260276794, 0.07522888481616974, 0.5045906901359558, 0.21432864665985107, 0.3193601667881012, -0.23601379990577698, 0.034731946885585785, -0.48447832465171814, 0.12973596155643463, -0.5103442668914795, -0.04249940440058708, 0.6846470236778259, 0.03308811038732529, 0.245085582137107...
same time) the genres of the movie, the actors, languages, etc... they are in arrays and go into different tables (and maybe also in different rows). For example the array containing the genres (Action, Crime, Drama) genres in the genres table, and the actors in the actors table and so on... I then will use many-to-man...
[ 0.7050269842147827, -0.020615609362721443, 0.16698530316352844, 0.44526275992393494, 0.052579931914806366, -0.17981775104999542, -0.1725911647081375, 0.0008085177396424115, -0.14816008508205414, -0.6171655058860779, 0.24115942418575287, 0.7556026577949524, -0.11425182968378067, -0.15584713...
supports only one table at a time, so you'll certainly have to execute multiple `INSERT` statements if you have complex data that goes into multiple tables. If you've inserted a specific `$movieid` value to `movies` then you know what value you need to insert to the rows of the other tables, to satisfy referential int...
[ 0.2113455832004547, 0.04678667336702347, 0.30832499265670776, 0.1358850747346878, 0.3369638919830322, 0.15829546749591827, 0.09579538553953171, -0.2924594283103943, -0.036253251135349274, -0.08278745412826538, -0.08519642055034637, 0.8609565496444702, -0.4010353982448578, 0.041637767106294...
{ // execute ($movieid, $actorid) } $lang_sql = 'INSERT INTO movie_languages (movieid, language) VALUES (?, ?)'; foreach ($languagelist as $language) { // execute ($movieid, $language) } ``` If your `movies` table uses an `AUTO_INCREMENT` primary key, then you can get the value generated during the fir...
[ 0.14578589797019958, 0.06298477202653885, 0.5500794649124146, -0.1671493500471115, 0.38340118527412415, 0.2289496809244156, 0.005316049791872501, -0.5086609125137329, -0.18700464069843292, -0.009354498237371445, -0.5562913417816162, 1.1684205532073975, -0.18597878515720367, -0.198896199464...
during your current session, so if you insert to another table that uses an auto primary key, the value changes. But the value reported is stable during your sessions; it does *not* change if another client session is doing inserts concurrently.
[ 0.058383841067552567, -0.03479303419589996, 0.29921990633010864, 0.008458178490400314, 0.30379199981689453, -0.12197033315896988, 0.2570923864841461, -0.05711835250258446, -0.2860698699951172, -0.6453444957733154, -0.17410527169704437, 0.7415924072265625, -0.27933040261268616, 0.1005612090...
A question from [Math Battle](http://www.math.toronto.edu/oz/turgor/mathbattle/problems/mathbattleE1.pdf). This particular question was also asked to me in one of my job interviews. " A monkey has two coconuts. It is fooling around by throwing coconut down from the balconies of M-storey building. The monkey wants to k...
[ 0.19231005012989044, 0.058272432535886765, -0.18652185797691345, 0.5709943771362305, -0.1602908968925476, 0.18653330206871033, 0.19934730231761932, -0.1760081797838211, -0.5324230194091797, -0.17010170221328735, 0.012249830178916454, 0.38314688205718994, 0.15920500457286835, -0.26607435941...
use upcounting from the last found Binary break up lower index. * Window/Slices of smaller sets of floors & use binary break up within the Window/Slice (but on the down side this would require a Slicing algorithm of it's own.) Wondering if there are any other ways to do this. A binary search is not the answer, because...
[ 0.09543292969465256, -0.023628680035471916, -0.016398316249251366, 0.25145062804222107, 0.16191783547401428, 0.17393019795417786, 0.2140856385231018, -0.5048910975456238, -0.5594250559806824, -0.45464441180229187, -0.1826501190662384, 0.5482704043388367, 0.05778499320149422, -0.41040441393...
after the last safe floor. The big steps are roughly `sqrt(m)`, but they are bigger early, and smaller later because if the first coconut breaks early, you can afford more iterations in the second phase. ``` StepSize = (minimum s such that s * (s + 1) / 2 >= m) CurrentFloor = 0 While no coconuts broken { Current...
[ -0.013170051388442516, -0.292728453874588, 0.8325192332267761, 0.19822759926319122, 0.5330458283424377, -0.10132721066474915, 0.3464218080043793, -0.7995758056640625, -0.5494648218154907, -0.38842418789863586, -0.21300359070301056, 0.32307159900665283, 0.1810033619403839, 0.147602781653404...
to the lowest floor that will break the coconut, // using no more total drops than the original value of StepSize ```
[ -0.13087478280067444, -0.105191171169281, 0.27336156368255615, 0.15783251821994781, 0.2881016433238983, 0.2280055582523346, 0.6996883153915405, -0.5201647877693176, -0.346024751663208, -0.20334668457508087, -0.1813162863254547, 0.346261590719223, 0.015971723943948746, -0.4448796212673187, ...
I have a large amount of data to move using two PHP scripts: one on the client side using a command line PHP script and other behind Apache. I POST the data to the server side and use php://input stream to save it on the web-server end. To prevent from reaching any memory limits, data is separated into 500kB chunks for...
[ 0.1589307188987732, 0.23548783361911774, 0.3838667869567871, 0.02566671371459961, -0.230713352560997, 0.24989360570907593, 0.29316532611846924, -0.16580817103385925, -0.11517004668712616, -0.7731783390045166, 0.03384499251842499, 0.25519952178001404, 0.030228618532419205, 0.190561115741729...
can do the job, but I cannot decide which one to use: * [`gzencode`](http://php.net/manual/en/function.gzencode.php) / [`gzdecode`](http://php.net/manual/en/function.gzdecode.php) * [`gzdeflate`](http://php.net/manual/en/function.gzdeflate.php) / [`gzinflate`](http://php.net/manual/en/function.gzinflate.php) * [`gzcom...
[ 0.10168121010065079, 0.11747344583272934, 0.5299721360206604, 0.024653587490320206, 0.2628065347671509, -0.23316381871700287, 0.011860787868499756, -0.30735114216804504, -0.08005334436893463, -0.6277939081192017, -0.5278406143188477, 0.7127413749694824, -0.32256147265434265, -0.07210761308...
three: * [**gzencode()**](http://php.net/manual/en/function.gzencode.php) uses the GZIP file format, the same as the `gzip` command line tool. This file format has a header containing optional metadata, DEFLATE compressed data, and footer containing a CRC32 checksum and length check. * [**gzcompress()**](http://php.ne...
[ 0.08364270627498627, 0.03333577886223793, 0.4420944154262543, -0.14937368035316467, -0.4827779531478882, 0.02007223293185234, 0.0030493203084915876, -0.5544160008430481, -0.03739824518561363, -0.6076395511627197, -0.21870629489421844, 0.8002833724021912, -0.30712398886680603, -0.0996470972...
the ability to include the original file name and other environmental data (this is unused when you are just compressing a string). `gzencode()` and `gzcompress()` both add a checksum, so the integrity of the archive can be verified, which can be useful over unreliable transmission and storage methods. If everything is...
[ 0.23276859521865845, 0.028175054118037224, 0.02546875551342964, 0.12881627678871155, 0.0317133404314518, -0.3420335352420807, 0.05823172256350517, -0.061459727585315704, -0.3056574761867523, -0.8096129298210144, -0.3513043522834778, 0.45892542600631714, -0.3459967076778412, 0.0250329654663...
overhead can comprise a significant part of the output. The overhead for each method, measured by compressing an empty string, is: * `gzencode('')` = 20 bytes * `gzcompress('')` = 8 bytes * `gzdeflate('')` = 2 bytes
[ 0.02845575660467148, -0.07491297274827957, 0.22691278159618378, 0.205397367477417, 0.03624529018998146, 0.30820661783218384, -0.006208894774317741, -0.2912614941596985, -0.07912355661392212, -0.43524762988090515, -0.17805370688438416, 0.6954070329666138, -0.31068626046180725, -0.0093040112...
I've got an application that sits in the system tray, which when double clicked on opens a window, fairly standard; however, when you close the window I'd like the window that was focussed *before* mine was opened to be given back focus. If I pop my window up by a keyboard shortcut, I'm able to restore the previous fo...
[ 0.26389870047569275, 0.016771044582128525, 0.9169248342514038, -0.14799949526786804, 0.03587620332837105, -0.14692404866218567, 0.35090553760528564, 0.08020131289958954, -0.2461598962545395, -0.7571915984153748, -0.3496165871620178, 0.9223299026489258, -0.015104827471077442, 0.206555843353...
because the user has essentially made the system tray focus. I've tried using a combination of `GetForegroundWindow`, `GetWindow`, and `GetTopMostWindow` to try to navigate the z-order to find the second window after the system tray (going on the assumption that the system tray will have jumped to the top, so logicall...
[ 0.3747987449169159, -0.03097139671444893, 0.3759026527404785, 0.018935201689600945, 0.03892898187041283, 0.09980987012386322, -0.06787019968032837, 0.3612991273403168, -0.34293410181999207, -0.6653621196746826, -0.10884048044681549, 0.6238752007484436, -0.0774230808019638, 0.32444909214973...
watcher, which just sits and monitors which is the front window and stores a pointer to it, but that'll be flaky at best. This is on Windows (I'm personally on x64 Server 2008) and with .Net 3.5. Although this might be a nice usability feature, you probably know that with Windows 7 the tray will get a (much) less prom...
[ 0.4155726432800293, -0.14060570299625397, 0.5863274931907654, -0.2247704267501831, -0.1212289035320282, -0.2660672962665558, 0.10788358747959137, 0.12919171154499054, -0.43594545125961304, -0.3860160708427429, 0.4202656149864197, 0.5788264870643616, -0.3701931834220886, 0.08977087587118149...
I tried to find a place where I can find ready to copy list of all functions and classes available in each stl header file. Looking through /usr/include/c++ is not so convenient as I expected. Google very often shows <http://www.cplusplus.com/reference/> which is not so convenient to copy and paste. Does anyone kno...
[ 0.6026151180267334, 0.18395286798477173, 0.2865457832813263, 0.041293688118457794, -0.219608336687088, 0.26175346970558167, -0.01600835658609867, 0.3256976306438446, -0.3857734799385071, -0.5555183291435242, 0.05457662418484688, 0.39709728956222534, -0.2771447002887726, 0.21135200560092926...
I can't choose right one answer by now. But the method with which I can receive such kind of information more automatically is still considering by me. Thanks. I'm not sure if I understood correctly, but if you need a reference and a list of functions from the headers, then maybe [dinkumware](http://www.dinkumware.c...
[ 0.5105331540107727, 0.11582080274820328, 0.20496876537799835, 0.2467866837978363, -0.11001478880643845, -0.1810043305158615, 0.030560240149497986, -0.19087526202201843, -0.2718806862831116, -0.4797576367855072, -0.06689351797103882, 0.6804478764533997, -0.045226942747831345, 0.029922602698...
I need to profile a program to see whether any changes need to be made regarding performance. I suspect there is a need, but measuring first is the way to go. This is not that program, but it illustrates the problem I'm having: ``` #include <stdio.h> int main (int argc, char** argv) { FILE* fp = fopen ("trivial.c", ...
[ 0.009919601492583752, -0.14433754980564117, 0.5321918725967407, -0.29441550374031067, 0.2150219827890396, 0.029801951721310616, 0.30829671025276184, -0.2579460144042969, -0.1077054888010025, -0.34454455971717834, -0.06935788691043854, 0.8611347675323486, -0.365921288728714, 0.0081266537308...
trivial % ./trivial ... % gprof trivial gmon.out ``` Granted, this is a trivial program, but I would have thought it would make some kind of blip on the profiling radar. It didn't: ``` called/total parents index %time self descendents called+self name index
[ -0.04538512974977493, 0.1481229066848755, 0.24936862289905548, 0.2018754929304123, -0.01468778308480978, -0.13848614692687988, -0.018163494765758514, 0.303809255361557, -0.08857287466526031, -0.37255382537841797, 0.07747659832239151, 0.20649480819702148, -0.3039533495903015, 0.610124588012...
called/total children 0.00 0.00 1/1 __start [1704] [105] 0.0 0.00 0.00 1
[ 0.04117845371365547, 0.10726607590913773, 0.1887788027524948, 0.032670047134160995, 0.07591509819030762, 0.41792789101600647, 0.358812540769577, -0.1258423626422882, -0.18264786899089813, -0.47498053312301636, -0.3187965154647827, 0.0836910679936409, 0.024327903985977173, 0.122270092368125...
_main [105] ----------------------------------------------- % cumulative self self total time seconds seconds calls ms/call ms/call name 0.0 0.00 0.00 1 0.00 0.00 _main
[ -0.8684412837028503, 0.2118714600801468, 0.5239697694778442, -0.02337215468287468, 0.15571923553943634, 0.3080757260322571, 0.5346847176551819, 0.06453433632850647, -0.352858304977417, -0.38281941413879395, 0.021697111427783966, 0.322005033493042, 0.01084608118981123, 0.1798146516084671, ...
[105] Index by function name [105] _main ``` Can anyone guide me here? I would like the output to reflect that it called fgets and printf at least 14 times, and it did hit the disk after all - there should be some measured time, surely. When I run the same command on the real program, I get more fun...
[ -0.08753648400306702, 0.28190097212791443, 0.3057870864868164, -0.2646710276603699, -0.3137340545654297, -0.057401347905397415, 0.13579440116882324, -0.14023783802986145, -0.6667691469192505, -0.4094581604003906, 0.08098942041397095, 0.41889041662216187, -0.43873143196105957, -0.2358855605...
ran the real program and got this: ``` % time real_program real 4m24.107s user 2m34.630s sys 0m38.716s ``` There are certain commonly-accepted beliefs in this business, that I would suggest you examine closely. One is that the best (if not only) way to find performance problems is to measure the time...
[ 0.41229552030563354, -0.023288456723093987, -0.058825016021728516, 0.25417137145996094, 0.11556985229253769, 0.12227770686149597, 0.7262246012687683, 0.09944489598274231, -0.38706499338150024, -0.03507222607731819, 0.2842438817024231, 0.5862661600112915, -0.23869064450263977, -0.1855134814...
very scientific. A performance problem is more like a bug than a quantitative thing. What it is doing wrong is it is *wasting time*, and it needs to be fixed. It is based on a simple observation: **Slowness consists of time being spent for poor reasons.** To find it, sample the program state at random slivers of clo...
[ 0.37897026538848877, 0.23885788023471832, -0.32113397121429443, 0.4221142530441284, 0.07272917032241821, 0.14852721989154816, 0.31664416193962097, 0.16510829329490662, -0.16358567774295807, -0.47803178429603577, 0.03691554442048073, 0.3851495385169983, -0.09148053079843521, 0.3491871953010...
show it. A good way to tell if a sliver of time is being spent for a good reason is to look carefully at the call stack. Every function invocation on the stack has an implicit reason, and if any of those reasons are poor, then the reason for the entire sample is poor. Some profilers tell you, at the statement level, ...
[ 0.5705849528312683, 0.2300691306591034, -0.02878545969724655, 0.163483127951622, -0.15870928764343262, -0.17038705945014954, 0.45149871706962585, -0.12000202387571335, 0.07382181286811829, -0.3341038227081299, 0.04740361496806145, 0.4817308485507965, -0.18538028001785278, -0.13804829120635...
the instructions causing the problem. It doesn't give you 3 decimal places of timing accuracy. I.e. it is lousy for measurement, but superb for diagnosis. You may say "What about recursion?". Well, what about it? You may say "I think that could only work on toy programs." That would be just wishing. In fact large pro...
[ 0.6051977872848511, 0.3463217318058014, 0.0017686461796984076, 0.3246685266494751, -0.06936728954315186, -0.2840433120727539, 0.5169429183006287, 0.258249431848526, -0.4410828649997711, -0.04147235304117203, 0.02393971011042595, 0.39431920647621155, -0.09297643601894379, 0.2651982307434082...
I have a class with a static method that looks roughly like: ``` class X { static float getFloat(MyBase& obj) { return obj.value(); // MyBase::value() is virtual } }; ``` I'm calling it with an instance of MyDerived which subclasses MyBase: ``` MyDerived d; float f = X::getFloat(d); ``` If I link...
[ -0.10464008152484894, 0.03039351850748062, 0.540259838104248, -0.24473559856414795, 0.00483351806178689, -0.007920066826045513, 0.3556945025920868, 0.0539521649479866, -0.15650665760040283, -0.7904497385025024, -0.207268625497818, 0.4493253529071808, -0.37003788352012634, 0.352766156196594...
Is this some type of sentinel value that should tell me what's wrong here? Is anything different when you link in a lib rather than an obj directly? I don't get any compiler warnings or errors. **Edit:** I'm using Visual Studio 2005 on Windows XP Pro SP3. To make sure I wasn't linking old files, I cloned the val...
[ 0.1352071315050125, 0.1483863741159439, 0.3719629645347595, -0.20669002830982208, -0.35924574732780457, -0.0031702574342489243, 0.5150177478790283, -0.07516907155513763, -0.42247438430786133, -0.6409466862678528, 0.18475325405597687, 0.7376314401626587, -0.5689469575881958, -0.076711744070...
into a different (unrelated) method. This makes me think my vtable is corrupted. I think the behavior I'm seeing must be a side effect of some other problem. --- **Solved!** (thanks to Vlad) It turns out I was violating the one definition rule (ODR) although it wasn't evident from the code I posted. [This](http:/...
[ 0.21672402322292328, 0.21656717360019684, 0.3105108141899109, 0.018964815884828568, -0.10709123313426971, -0.36014145612716675, 0.5999748110771179, -0.04541747644543648, -0.5254086256027222, -0.5815678834915161, -0.03114250674843788, 0.3577888607978821, -0.2864898443222046, 0.3905100524425...
found differences between the calling code and the library code. It turns out I had some *#ifdef* blocks in my header files and the corresponding *#define* statement was in the precompiled header for the main project but not in the subproject (the library). Have I mentioned how evil I think preprocessor macros are? An...
[ 0.271561861038208, 0.13134737312793732, 0.012671055272221565, 0.0023577879182994366, -0.2729748487472534, -0.10595937818288803, 0.27145105600357056, 0.19127821922302246, -0.337013304233551, -0.6036027669906616, -0.04256369173526764, 0.7455213069915771, -0.277670681476593, 0.132371395826339...
file that declares `MyDerived`. Completely clean and rebuild your projects. Barring this, different compiler options *could* be responsible, though it is somewhat unlikely. If the problem persists after rebuilding everything from scratch, then nail it by instantiating a dummy `MyDerived` object inside `getFloat`, in t...
[ 0.3324837386608124, 0.011344981379806995, 0.1279129832983017, 0.1602342277765274, -0.09217546135187149, -0.187201127409935, 0.5102877020835876, 0.03308553248643875, -0.17694750428199768, -0.8551942110061646, -0.5231592655181885, 0.7337856292724609, -0.05062882974743843, 0.07890501618385315...
I am looking for a way to check on the life of a PHP session, and return the number of seconds a session has been "alive". Is there a PHP function that I am missing out on? I think there are two options neither are great but here they are. 1) If you have access to the file system you can check the creation timestamp...
[ 0.40494969487190247, 0.06600136309862137, 0.013808870688080788, 0.008343877270817757, -0.16096025705337524, -0.16272319853305817, 0.5713694095611572, 0.05455276370048523, -0.19688956439495087, -0.6089329719543457, 0.2844916880130768, 0.5732934474945068, -0.01860593631863594, 0.144044935703...
What does `where T : somevalue` mean? I just saw some code that said `where T : Attribute`. I think this has something to do with generics but I am not sure what this means or what it is doing. Does anyone know? It is a [**constraint on a type parameter**](http://msdn.microsoft.com/en-us/library/d5x73970.aspx), meanin...
[ 0.13882003724575043, -0.07774683088064194, 0.06156575307250023, -0.09634768962860107, -0.039663057774305344, -0.1941337287425995, 0.1791430413722992, -0.23563309013843536, -0.1348116248846054, -0.2828992009162903, -0.2991753816604614, 0.555153489112854, -0.4139012396335602, 0.4065870344638...
error, int does not inherit Attribute ``` This is useful, because it allows the generic class to do things with objects of type `T` with the knowledge that anything that is a `T` must also be an `Attribute`. In the example above, it's okay for `GetTypeId` to query the `TypeId` of `attr` because `TypeId` is a proper...
[ -0.1264192909002304, -0.37519216537475586, -0.09659944474697113, 0.035688869655132294, -0.14127767086029053, -0.14096739888191223, 0.20574818551540375, -0.06105871871113777, -0.1312238872051239, -0.4485316276550293, -0.17470914125442505, 0.8810615539550781, -0.49608415365219116, 0.09541439...
you can place on a type; from [MSDN](http://msdn.microsoft.com/en-us/library/d5x73970.aspx): > `where T: struct` > > > The type argument must be a value > type. Any value type except Nullable > can be specified. > > > `where T : class` > > > The type argument must be a reference > type; this applies also to ...
[ -0.030188074335455894, 0.07285276800394058, 0.19825677573680878, 0.005811318755149841, 0.08343993127346039, 0.04549357667565346, 0.15822269022464752, -0.13728322088718414, -0.0006549299578182399, -0.7026515603065491, -0.4755916893482208, 0.3421916663646698, -0.40415704250335693, 0.19941452...
<base class name>` > > > The type argument must be or derive > from the specified base class. > > > `where T : <interface name>` > > > The type argument must be or implement > the specified interface. Multiple > interface constraints can be > specified. The constraining interface > can also be generic. > > ...
[ 0.026864390820264816, -0.18583981692790985, 0.34526383876800537, 0.20441964268684387, -0.2298503816127777, 0.12777456641197205, 0.19643926620483398, -0.3320501148700714, 0.09115413576364517, -0.6394444704055786, -0.1559370458126068, 0.3978802263736725, -0.4773024618625641, 0.17169366776943...
does anyone know if it is possible to concatenate matches resulting from a search into a single register? E.g, I have a file with following contents: ``` aaa :xxx 123 bb :y 8 ccccc :zzzzz 1923 ``` Now what I want is to copy column starting with ':' somewhere else. Unfortunatelly I can't use visual block mode, becaus...
[ 0.4081539511680603, 0.6269317269325256, 0.27949008345603943, 0.08437244594097137, -0.12492570281028748, -0.16404521465301514, 0.21153181791305542, -0.07190711051225662, -0.16374345123767853, -0.6327947378158569, 0.3060094118118286, 0.38029515743255615, -0.2871537208557129, 0.21171185374259...
and check the contents of register `"a`, you'll see ``` :xxx:y:zzzzz ``` (Possibly with linebreaks, depending on how you have `cpoptions` set.)
[ 0.1839199662208557, 0.17235755920410156, 0.25519904494285583, 0.021120088174939156, 0.3984842300415039, -0.013047485612332821, 0.06611816585063934, -0.0691663846373558, -0.46699538826942444, -0.1260070502758026, -0.4255942106246948, 0.33031347393989563, -0.29983776807785034, -0.04840214177...
I'm looking for a fast way to determine the area of intersection between a rectangle and a circle (I need to do millions of these calculations). A specific property is that in all cases the circle and rectangle always have 2 points of intersection. Given 2 points of intersection: **0 vertices** is inside the circle: ...
[ 0.0444561168551445, 0.1311965435743332, 0.5110581517219543, 0.022592512890696526, -0.12132642418146133, 0.09258674830198288, 0.04314770922064781, -0.14626117050647736, -0.4214268922805786, -0.5883059501647949, 0.021892176941037178, -0.003799924859777093, -0.011385218240320683, 0.5141468644...
X Circular segment X X XX XX +-X-------X--+ XXXXXXXX | X X | | XXXXX | ``` **1 vertex** is inside the circle: The sum of the areas of a circular segment and a triangle. ``` XXXXX
[ -0.29722291231155396, 0.2869302034378052, 0.37646302580833435, 0.03603367507457733, -0.44544681906700134, 0.3175882399082184, 0.08482324331998825, -0.06875629723072052, -0.2926134765148163, -0.5011672377586365, -0.16163139045238495, -0.37780460715293884, -0.17369204759597778, 0.40181723237...
XXXXXXXXX X X Triangle ->X _-X X X X _- X X +--X--+ X _- X <- Circular segment
[ -0.002407228574156761, 0.38540270924568176, 0.48004239797592163, 0.255965918302536, -0.594200074672699, 0.5580283403396606, -0.2747340798377991, -0.061966150999069214, -0.38680705428123474, -0.19783812761306763, -0.052988871932029724, -0.2200339287519455, -0.11843787878751755, 0.5679913759...
X | X | X- XXX XXXXX | XXXX | | ``` **2 vertices** are inside the circle: The sum of the area of two triangles and a circular segment ``` XXXXX
[ -0.18595175445079803, 0.3060346841812134, 0.22058479487895966, -0.1018860936164856, -0.28226274251937866, 0.37354061007499695, 0.32462215423583984, -0.08702588826417923, -0.15866239368915558, -0.7964830994606018, -0.09142480045557022, -0.19200372695922852, -0.16882644593715668, 0.218253791...
+------------X X X | _--'/'X X +--X--- Triangle->| _-- / X X | X |_-- /XX <- Circular segment X +-X----
[ -0.12380168586969376, 0.3690565526485443, 0.4199067950248718, 0.1444447934627533, -0.500763475894928, 0.5417866706848145, -0.0892922654747963, -0.24114273488521576, -0.27364790439605713, -0.2879326045513153, -0.009941247291862965, -0.1753096878528595, -0.18945853412151337, 0.47593823075294...
+-------XX XXXXX Triangle^ ``` **3 vertices** are inside the circle: The area of the rectangle minus the area of a triangle plus the area of a circular segment ``` XXXXX X +--X+ XXX X | X -------XXX-----+ <- Triangle outside X | |X
[ -0.45813697576522827, 0.2656528353691101, 0.3473486304283142, -0.0646817609667778, -0.3539706766605377, 0.35646021366119385, 0.3102509677410126, -0.3166584074497223, -0.12436478585004807, -0.6571133136749268, -0.11771532148122787, -0.30755123496055603, -0.18731789290905, 0.1499212086200714...
Rect ''. XXX | X +---+X ''. XX| X X ''. X <- Circular segment inside X X
[ -0.11824630945920944, -0.14120930433273315, 0.6511763334274292, 0.07788528501987457, -0.4435323476791382, 0.438984215259552, -0.13559497892856598, -0.15873423218727112, -0.20405200123786926, -0.27287057042121887, -0.533197820186615, 0.1435585618019104, -0.2661147713661194, 0.35080149769783...
^|X X X | X XXXXX ``` To calculate these areas: * Most of the points you'll need to use can be found by finding the [intersection of a line and a circle](http://mathworld.wolfram.com/Circle-LineIntersection.html) * The areas you need to compute can be found by [computing the area...
[ -0.16115345060825348, 0.060236331075429916, 0.5797649025917053, 0.022033274173736572, -0.3131600618362427, 0.36125433444976807, 0.09995453804731369, -0.0813237652182579, -0.48749202489852905, -0.5143840909004211, -0.12102159857749939, -0.238164022564888, -0.17625828087329865, 0.17558658123...
circle by calculating if its distance from the center is less than the radius.
[ -0.11888346076011658, -0.0726344883441925, 0.3428545594215393, -0.15571287274360657, 0.06020164117217064, -0.24197573959827423, 0.17483378946781158, -0.3013514280319214, 0.008284922689199448, -0.44493791460990906, -0.00004317303319112398, 0.036021772772073746, 0.14623650908470154, 0.508538...