text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
case DOUBLE: PrintType<DOUBLE>(); break; case BOOL:
[ 0.06550232321023941, -0.06446507573127747, -0.12108585238456726, -0.38086241483688354, 0.011987786740064621, 0.05277378112077713, 0.4093642830848694, -0.16154292225837708, -0.024660814553499222, -0.12808683514595032, -0.6047725081443787, 0.4326884150505066, -0.4783817529678345, -0.07830044...
PrintType<BOOL>(); break; } // now you can write this: TYPED_CALL(PrintType, type, ); return 0; } ``` typed\_call.cc ("library"): ``` // Requirements: // |function| return type must be
[ 0.3442750573158264, 0.020885465666651726, 0.5410028100013733, -0.2141481190919876, 0.24674585461616516, -0.25090888142585754, 0.01831790618598461, -0.40839052200317383, 0.020969662815332413, -0.4326370358467102, -0.2658316195011139, 0.6510003209114075, -0.4968012273311615, 0.01525918394327...
void // // Usage: // // having for instance such |type| variable: // ColumnType type = INT; // and such |foo| function definition: // template <ColumnType T> // void foo(t1 arg1, t2 arg2) { // … // } // // instead of writing (won't compile): // foo<type>(arg1, arg2); // write this: // ...
[ 0.21254071593284607, 0.0648941844701767, 0.3540870249271393, -0.46188053488731384, 0.06078918278217316, 0.19653208553791046, 0.3536433279514313, -0.4045915901660919, -0.061736032366752625, -0.30684012174606323, -0.09590021520853043, 0.6429168581962585, -0.6746597290039062, -0.2114956527948...
\ switch (type) { \ case INT:
[ -0.016354314982891083, -0.16566996276378632, 0.031138045713305473, -0.2406931072473526, 0.5695279836654663, -0.22973519563674927, 0.03672412782907486, 0.03503339737653732, 0.0307279285043478, -0.48071548342704773, -0.27043721079826355, 0.5312660336494446, -0.3342743515968323, 0.16070576012...
\ function<INT>(args); \ break;
[ -0.3235631585121155, -0.15683197975158691, 0.21209034323692322, -0.6001285910606384, 0.2618328332901001, -0.12709876894950867, 0.5164880156517029, -0.01189356204122305, -0.10998861491680145, -0.49196016788482666, -0.6175340414047241, 0.42454585433006287, -0.6372737288475037, -0.11399686336...
\ case DOUBLE:
[ -0.13159610331058502, 0.1379280537366867, -0.26991739869117737, -0.482682466506958, 0.2694815993309021, 0.042548760771751404, 0.14637605845928192, -0.05840582400560379, 0.028712190687656403, -0.5380073189735413, -0.3506622612476349, 0.640587568283081, -0.2031184732913971, -0.22400616109371...
\ function<DOUBLE>(args); \ break;
[ 0.041970670223236084, -0.201889768242836, 0.13484705984592438, -0.6805148124694824, 0.25785592198371887, -0.09432603418827057, 0.5154557228088379, -0.07300402969121933, -0.057363033294677734, -0.3873361349105835, -0.5409307479858398, 0.4152834117412567, -0.701836884021759, -0.0802042707800...
\ case BOOL: \ function<BOOL>(args);
[ -0.45277905464172363, 0.06200295314192772, 0.27689865231513977, -0.6995006203651428, 0.18360409140586853, 0.07390919327735901, 0.2148391753435135, -0.035401053726673126, 0.06480835378170013, -0.43124791979789734, -0.6258678436279297, 0.5783167481422424, -0.6326739192008972, -0.210151001811...
\ break; \ }
[ -0.28191691637039185, 0.05257251113653183, -0.05584138259291649, -0.42226579785346985, 0.6986695528030396, -0.1617618352174759, 0.20686893165111542, 0.36338314414024353, 0.17057818174362183, -0.558681309223175, -0.6150541305541992, 0.6790890097618103, -0.5749036073684692, 0.105055749416351...
\ } #define BASE_TYPED_CALL(function, type, args...) { \ switch (type) {
[ 0.014917244203388691, -0.15326522290706635, 0.24600791931152344, -0.2205672264099121, 0.28982916474342346, -0.05982525274157524, 0.08216411620378494, -0.19163239002227783, 0.3510403037071228, -0.23961730301380157, -0.23037080466747284, 0.5250660181045532, -0.5879338979721069, -0.0219636876...
\ case INT: \ function<int>(args);
[ -0.46524864435195923, -0.030552146956324577, 0.3121119439601898, -0.6382686495780945, 0.1840486079454422, 0.2818980813026428, 0.12792563438415527, -0.039960674941539764, 0.08086217939853668, -0.6115044355392456, -0.5573084950447083, 0.520321249961853, -0.6878394484519958, -0.27727866172790...
\ break;
[ -0.20456597208976746, 0.01806589961051941, -0.12254994362592697, -0.5768336057662964, 0.612971842288971, -0.2421730011701584, 0.2790857255458832, 0.2288590967655182, 0.07410485297441483, -0.5925653576850891, -0.7373149991035461, 0.6547301411628723, -0.4672958254814148, -0.03639371320605278...
\ case DOUBLE: \ function<double>(args);
[ -0.1391758769750595, -0.11148448288440704, 0.1713392287492752, -0.6831006407737732, 0.07855325192213058, 0.17354269325733185, 0.20829202234745026, -0.13829131424427032, 0.14170165359973907, -0.43173402547836304, -0.4207439422607422, 0.4080864191055298, -0.6869532465934753, -0.2791521251201...
\ break; \ case BOOL:
[ -0.17373880743980408, 0.12975437939167023, -0.1574990451335907, -0.4698309004306793, 0.3916725516319275, -0.28641605377197266, 0.38002702593803406, 0.10271082073450089, -0.16230562329292297, -0.20934924483299255, -0.7235867381095886, 0.4469324052333832, -0.3374188542366028, 0.0992976129055...
\ function<bool>(args); \ break;
[ -0.27334293723106384, -0.05325990542769432, 0.18827855587005615, -0.6541612148284912, 0.3169245719909668, -0.24567346274852753, 0.5926515460014343, 0.039605773985385895, -0.07650585472583771, -0.40193304419517517, -0.6649404168128967, 0.46428266167640686, -0.603560745716095, -0.04941922798...
\ }
[ -0.2443399578332901, 0.015621405094861984, 0.14533884823322296, -0.2866206169128418, 0.6470680236816406, 0.07951914519071579, -0.1845235973596573, 0.35776180028915405, 0.18203814327716827, -0.7189640998840332, -0.24900369346141815, 0.8821953535079956, -0.6574272513389587, 0.006501227151602...
\ } ``` To take this solution "level up" you can replace macro with a function (still containing similiar switch construct). But probably you would like to pass a functor (object with () operator) as a parameter of this function instead of an ordinary function like in this macro. Btw: this is exactly how they do it i...
[ 0.26462113857269287, 0.18730385601520538, 0.2980591356754303, 0.010205735452473164, -0.050036463886499405, -0.27366524934768677, 0.26644834876060486, 0.30254435539245605, 0.2593223750591278, -0.7323691248893738, 0.10230917483568192, 0.3414542078971863, -0.22520487010478973, -0.058741901069...
like: ``` template <ColumnType T> struct EnumToBuiltin { }; template <> struct EnumToBuiltin<INT> { typedef int type; }; template <> struct EnumToBuiltin<DOUBLE> { typedef double type; }; template <> struct EnumToBuiltin<BOOL> { typedef bool type; }; template <typename T> struct BuiltinToEnum { }; template <>...
[ 0.17756247520446777, -0.21942080557346344, 0.3075852394104004, -0.1953965574502945, 0.035908546298742294, 0.32151731848716736, 0.5011729598045349, -0.2203923612833023, 0.12852396070957184, -0.5298156142234802, -0.4159473478794098, 0.580849289894104, -0.6450190544128418, 0.10808548331260681...
I have a PHP function that I want to make available publically on the web - but it uses a lot of server resources each time it is called. What I'd like to happen is that a user who calls this function is forced to wait for some time, before the function is called (or, at the least, before they can call it a second tim...
[ 0.5937809348106384, 0.20586323738098145, 0.12228372693061829, 0.03673916310071945, 0.03982113301753998, -0.18605801463127136, 0.15631476044654846, 0.08696619421243668, -0.20511417090892792, -0.30617326498031616, 0.23281897604465485, 0.37102237343788147, -0.0020542109850794077, 0.1552646756...
make the user wait, without using server resources? Would 'sleep()' be an appropriate way to do this? Are there any suggested problems with using sleep()? Is there a better solution to this? Excuse my ignorance, and thanks! `sleep` would be fine if you were using PHP as a command line tool for example. For a website t...
[ 0.5400415062904358, -0.1390986293554306, 0.1948762685060501, 0.15020576119422913, -0.032774340361356735, -0.13915547728538513, 0.1959594190120697, 0.02774820849299431, -0.4545753300189972, -0.6345001459121704, 0.12715160846710205, 0.5018994212150574, -0.1517494171857834, 0.1382740437984466...
is processed by a scheduled script and update the web page using AJAX or a meta-refresh.
[ -0.02731681615114212, -0.06876032799482346, 0.3676803708076477, 0.22237049043178558, 0.33560842275619507, -0.31321659684181213, 0.043816860765218735, 0.11760213971138, 0.24874453246593475, -0.6274685263633728, -0.7034982442855835, 0.22468183934688568, 0.020356744527816772, -0.0915364772081...
I have a Java function called testForNull ``` public static void testForNull(Object obj) { if (obj == null) { System.out.println("Object is null"); } } ``` I use it to test multiple objects to ensure they are not null. But, I am unable to tell the name of the variable that way. ...
[ 0.06036210432648659, -0.017079390585422516, 0.3197626769542694, -0.4514552354812622, -0.22182710468769073, 0.09515195339918137, 0.36261653900146484, -0.26582756638526917, 0.058247774839401245, -0.34235405921936035, -0.1200466975569725, 0.5279056429862976, -0.5083183646202087, 0.19322110712...
lines caused the "Object is null" output. Of course, I can simply add another parameter to the function and have something like ``` testForNull(x, "x"); testForNull(y, "y"); testForNull(z, "z"); ``` But I want to know whether it is possible to deduce the name of the variable without passing it explicitly...
[ 0.025293368846178055, -0.10598671436309814, 0.39978888630867004, 0.1434902548789978, -0.2772327661514282, 0.02618402987718582, 0.3378881514072418, 0.03216705471277237, 0.07342556864023209, -0.055550895631313324, -0.1120879128575325, 0.29820120334625244, -0.2892020344734192, 0.2894211709499...
For homework, I'm working with the following three classes. ``` Class | Extends | Variables -------------------------------------------------------- Person | None | firstName, lastName, streetAddress, zipCode, phone CollegeEmployee | Person | ssn, salary,deptName Fac...
[ -0.0928620770573616, 0.2379024624824524, 0.3559960126876831, -0.03396186977624893, 0.3690744936466217, 0.1104295551776886, 0.23865672945976257, 0.0012892589438706636, -0.023526819422841072, -0.3998360335826874, -0.2846274673938751, 0.6430673003196716, 0.00235158484429121, 0.107030808925628...
the data in the superclasses. ``` import java.util.*; import javax.swing.*; public class Faculty extends CollegeEmployee { protected String booleanFlag; protected boolean tenured; public Faculty(String firstName, String lastName, String streetAddress, String zipCode, Strin...
[ 0.2882697284221649, -0.10902612656354904, 0.34999045729637146, 0.09908447414636612, 0.3763298988342285, 0.08429402112960815, 0.11016584932804108, -0.01746707782149315, 0.0409640334546566, -0.28272148966789246, -0.6494470238685608, 0.5671053528785706, -0.22836478054523468, 0.440019965171813...
{ super(firstName,lastName,streetAddress,zipCode,phoneNumber, department,ssn,salary); String booleanFlag = JOptionPane.showInputDialog(null, "Tenured (Y/N)?"); if(booleanFlag.equals("Y")) tenured = true; else tenured
[ 0.13898330926895142, -0.34391921758651733, 0.3283005952835083, -0.2089550793170929, 0.2690958082675934, 0.19500790536403656, 0.398860365152359, -0.1279412806034088, -0.23448263108730316, -0.40257298946380615, -0.3895103335380554, 0.5061867833137512, -0.349808931350708, 0.44501811265945435,...
= false; } public void setTenure(boolean tenured) { this.tenured = tenured; } public boolean getTenured() { return tenured; } public void display() { super.display(); JOptionPane.showMessageDialog(null, "Tenured: " + tenured); } } ``` The `Coll...
[ 0.2397318184375763, -0.14662139117717743, 0.3486607074737549, -0.03304692730307579, 0.4380381405353546, -0.1987648606300354, 0.23552221059799194, 0.19698858261108398, -0.2733648419380188, -0.3164938688278198, -0.8421692848205566, 0.8591282367706299, -0.053928375244140625, 0.758529007434845...
appears below. ``` import java.util.*; import javax.swing.*; public class CollegeEmployee extends Person { protected String ssn; protected String sal; protected double annSalary; protected String department; public CollegeEmployee(String firstName, String lastName, ...
[ 0.08654634654521942, 0.17451700568199158, 0.35567522048950195, -0.0716501846909523, 0.3955383002758026, 0.0385105162858963, 0.5457673668861389, 0.0928199514746666, -0.009684829041361809, -0.28402990102767944, -0.8284328579902649, 0.23922975361347198, -0.04832414910197258, 0.260737419128417...
String phoneNumber) { super(firstName,lastName,streetAddress,zipCode,phoneNumber); ssn = JOptionPane.showInputDialog(null, "Enter SSN "); department = JOptionPane.showInputDialog(null, "Enter department: "); sal = JOptionPane.showInputDialog(null, "Enter salary: "); ...
[ 0.1444888859987259, -0.4845086634159088, 0.5214083194732666, -0.3314664363861084, 0.20161090791225433, 0.4891960322856903, 0.17437933385372162, -0.32080185413360596, 0.03149477764964104, -0.4978462755680084, -0.37331491708755493, 0.7056101560592651, -0.4164498448371887, 0.14530879259109497...
this.firstName = firstName; } public String getFirstName() { return firstName; } ... ETC ... REMAINING GET/SET METHODS ELIMINATED FOR BREVITY. ``` The errors I'm getting point to a mismatch between parameters...`Faculty` calls eight parameters, but `CollegeEmployee` only has five. However, I'd think that b...
[ -0.025041744112968445, -0.06443426012992859, 0.22350670397281647, -0.0018027531914412975, 0.144732266664505, 0.4027673602104187, 0.031688567250967026, -0.0770605057477951, -0.2497250735759735, -0.5202025175094604, -0.21703138947486877, 0.7086007595062256, 0.12486527115106583, 0.40257591009...
`CollegeEmployee` to `Faculty`? That's the piece I'm missing. I've been poring over the Java Tutorials and experimenting for a couple hours, but still can't get what I need to do for the correction. Do I need to call the `People` variables, via `CollegeEmployee`, then instantiate the `CollegeEmployee` variables in `Fac...
[ 0.34641823172569275, 0.22555381059646606, 0.42003193497657776, 0.11465615779161453, -0.14711278676986694, 0.07594047486782074, 0.15351523458957672, 0.22925785183906555, -0.27508389949798584, -0.5391213297843933, -0.09861604124307632, 0.5121962428092957, 0.0850677490234375, 0.39562919735908...
error. A class may have variables that are not set in the constructor. You could have empty constructors and set the variables in another method. Since there is an inheritance structure, you may only set the parent's variables via super().
[ 0.2607010006904602, -0.17622976005077362, -0.3574026823043823, 0.27524009346961975, -0.19232960045337677, 0.020702235400676727, 0.6815600991249084, 0.01895538531243801, -0.30858877301216125, -0.43850070238113403, -0.08451677858829498, 0.44069236516952515, -0.45885995030403137, 0.3969082832...
I am trying to rename many files in my application and need to be able to do a rename in all subdirectories from the app root through git (i.e. git mv %filenamematch% %replacement%) that only replaces the matching text. I'm no good with bash scripting though. update: would be good it if also renamed directories that m...
[ 0.03863876312971115, 0.3071088194847107, 0.6701140403747559, -0.35423317551612854, -0.15306538343429565, 0.13421551883220673, 0.5774199366569519, -0.3256629705429077, -0.2177976369857788, -0.9796013236045837, -0.3014613687992096, 0.7817701101303101, -0.4346197247505188, 0.098094142973423, ...
substitution with "$(...)". These powerful shell constructs allow us to combine several commands to get the result we need. See [Pipelines](http://www.gnu.org/software/bash/manual/html_node/Pipelines.html) and [Command Substitution](http://wiki.bash-hackers.org/syntax/expansion/cmdsubst). Here's what's going on in thi...
[ 0.5003941059112549, -0.17664621770381927, 0.11050192266702652, -0.1850138157606125, -0.01762780174612999, 0.045581888407468796, 0.017350807785987854, -0.21531395614147186, -0.0843118205666542, -0.7860202789306641, -0.029694756492972374, 0.5263957977294922, -0.5054534673690796, -0.109779670...
we're looking for. 3. `| sed -e 's/\(%filenamematch%[^/]*\).*/\1/'`: We pipe these matches through [sed](http://ss64.com/bash/sed.html) (the stream editor), executing (-e) sed's s (substitute) command to chop off any / and subsequent characters after our matching directory (if it happens to be one). 4. `| uniq`: In cas...
[ 0.22408823668956757, -0.11057926714420319, 0.5751248598098755, -0.044692736119031906, 0.04274147003889084, 0.37907904386520386, -0.06437025219202042, -0.4142224192619324, 0.2014305144548416, -0.9370017647743225, -0.2270592451095581, 0.37938550114631653, -0.294474333524704, 0.08603034168481...
to the variable "$file" and then executes the command after the semicolon (;). 6. `sed -e 's/%filenamematch%/%replacement%/'`: We use [echo](http://ss64.com/bash/echo.html) to pipe each filename through sed, using it's substitute command again--this time to perform our pattern replacement on the filename. 7. `git mv`: ...
[ 0.5039964914321899, -0.20215407013893127, 0.6017423272132874, -0.4479994475841522, -0.03739461675286293, 0.006705868057906628, 0.48684385418891907, -0.5424622893333435, -0.17337994277477264, -0.48046842217445374, -0.30167242884635925, 0.8705025315284729, -0.5971797704696655, 0.200250059366...
observation: 1. `git ls-files` 2. `git ls-files | grep %filenamematch%` 3. `git ls-files | grep %filenamematch% | sed -e 's/\(%filenamematch%[^/]*\).*/\1/'` 4. `git ls-files | grep %filenamematch% | sed -e 's/\(%filenamematch%[^/]*\).*/\1/' | uniq` 5. `for file in $(git ls-files | grep %filenamematch% | sed -e 's/\(%f...
[ 0.06724494695663452, -0.017341211438179016, 0.17605160176753998, -0.13976086676120758, 0.24029763042926788, 0.5255646705627441, 0.26756760478019714, -0.3648206889629364, -0.36447325348854065, -0.5922454595565796, -0.31375792622566223, 0.3523428738117218, -0.26929253339767456, -0.1307211220...
Why doesn't this code work in IE6 or IE7? ``` $('a').click( function() { var urlIsExternal = true; var urlMedicareDir = '/medicare/'; var urlMedicareHost = 'health.healthcare.com'; var urlMedicare = 'https://' + urlMedicareHost + urlMedicareDir; var urlAppsHost = 'apps...
[ 0.32108640670776367, 0.023025691509246826, 1.3042799234390259, -0.052897531539201736, 0.09383588284254074, 0.32878562808036804, 0.4721536636352539, -0.09206493198871613, -0.43842947483062744, -0.8339037299156189, -0.11121490597724915, 0.6431624889373779, -0.13640064001083374, 0.36749929189...
0, urlMedicare.length ); var urlCurrentURL = $.url( urlCurrent ); var urlClicked = $(this).attr('href'); var urlClickedURL = $.url( $(this).attr('href') ); var urlHost = urlClickedURL.attr('host'); if( !urlHost.length ) { urlHost = urlCurrentURL.attr('host'...
[ -0.33737003803253174, -0.21591642498970032, 1.1411224603652954, -0.2132050096988678, -0.002728185383602977, 0.2853599190711975, 0.285105437040329, 0.06053680554032326, -0.21340109407901764, -0.22802187502384186, -0.3441409468650818, 0.5273251533508301, -0.08778523653745651, 1.0052235126495...
= 'You are now leaving the Medicare website.'; if( urlCurrentPrefix == urlMedicare ) { if( urlClicked.substring( 0, 1 ) == '/' ) // starts with slash { if( urlClicked.substring( 0, urlMedicareDir.length ) == urlMedicareDir )
[ 0.20956093072891235, -0.4555203914642334, 1.1102728843688965, -0.2532694339752197, 0.1792408674955368, 0.2073279321193695, 0.16445301473140717, 0.09824119508266449, -0.38473042845726013, -0.49311208724975586, -0.08866178244352341, 0.27928826212882996, 0.2414264678955078, 0.6612793803215027...
{ urlIsExternal = false; } } if( urlClicked.substring( 0, urlMedicare.length ) == urlMedicare ) { urlIsExternal =
[ -0.17185255885124207, -0.27168312668800354, 0.8122875690460205, -0.01618138514459133, -0.0050797429867088795, 0.012646367773413658, 0.27854713797569275, -0.09049941599369049, 0.0007350424421019852, -0.2256115823984146, -0.19703060388565063, 0.423732727766037, 0.19650498032569885, 0.7505173...
false; } if ( urlClicked.substring( 0, 1 ) != '/' && urlClicked.substring( 0, 4 ) != 'http' && urlClicked.substring( 0, 4 ) != 'file'
[ 0.17739319801330566, -0.18991531431674957, 0.37054741382598877, -0.17962050437927246, 0.1824043095111847, 0.005772937089204788, 0.6985101699829102, -0.15611712634563446, 0.06071260944008827, -0.346865177154541, -0.4927259385585785, 0.4881531596183777, -0.23468153178691864, 0.44202646613121...
) { urlIsExternal = false; } if( urlAppsHost == urlHost ) { urlIsExternal = false;
[ -0.2630671560764313, -0.018307676538825035, 1.004751205444336, -0.06130709499120712, 0.19578076899051666, -0.030700573697686195, 0.5115354657173157, -0.11942830681800842, 0.03601616993546486, -0.1835295855998993, -0.5415544509887695, 0.47193148732185364, -0.10021460801362991, 0.70527118444...
} if( urlClicked.substring(urlClicked.length-4) == '.pdf' ) { urlIsExternal = false; } } else { urlIsExternal = false;
[ -0.20280574262142181, -0.12590570747852325, 0.8183737993240356, -0.014212244190275669, 0.1649875044822693, -0.16400258243083954, 0.24660086631774902, -0.1898559033870697, 0.15144164860248566, -0.24595488607883453, -0.5759924650192261, 0.7074937224388123, -0.06908741593360901, 0.48299428820...
} if( urlIsExternal ) { if( confirm( urlConfirmMessage ) ) { window.open( urlClicked ); return false; }
[ 0.07126283645629883, -0.0743185505270958, 0.6336737871170044, -0.07784580439329147, 0.26236316561698914, -0.16620120406150818, 0.3445492386817932, 0.14829383790493011, 0.16144569218158722, -0.30974605679512024, -0.43073800206184387, 0.40541398525238037, -0.03924347087740898, 0.772019505500...
else { return false; } } else { return true; }
[ -0.19032235443592072, 0.1352386325597763, -0.19206944108009338, -0.4015383720397949, 0.12067348510026932, -0.17026887834072113, 0.36210986971855164, 0.23097828030586243, 0.23721754550933838, -0.03392559289932251, -0.3679843246936798, 1.0392141342163086, 0.040765732526779175, -0.10666867345...
} ); ``` For some reason when the links are clicked in IE6 or IE7, they do not direct the user to the link and it does not prompt a confirm dialog. It should prompt a confirm dialog, but for some reason, it is not. Your question is money! **Seriously**. Let's say a little bird told me what's the game you are interest...
[ 0.7031089663505554, -0.014631617814302444, 0.36993420124053955, 0.25365713238716125, 0.000047532765165669844, -0.1710611879825592, -0.06463892757892609, -0.10678605735301971, -0.20804522931575775, -0.2678874433040619, 0.3409084677696228, 0.5771095156669617, -0.05868741497397423, -0.3222770...
a window/class. This is great for debugging because it allows you to monitor the messages that are sent to the EDIT box when a key is pressed on your keyboard, so you can find out the exact calls and parameters that are send to the game to simulate this operation. Use spy++ to open the game process, and once you are i...
[ 0.15332292020320892, -0.39510029554367065, 0.07692272961139679, 0.2563539743423462, -0.1126050353050232, -0.23104830086231232, 0.13156019151210785, -0.023210614919662476, -0.13883090019226074, -0.7766669988632202, -0.13221970200538635, 0.42354336380958557, -0.2301725149154663, 0.1969350725...
the EDIT boxes have caption, so the following code will never work: ``` HWND edit = FindWindowEx(hWnd, NULL, "Edit", NULL); ``` and by the way, always make sure that `FindWindowEx()` returns something valid, else how would you know that it succeeded finding the edit box? What you should do instead is: ``` HWND edi...
[ -0.12441776692867279, 0.06978138536214828, 0.4048398435115814, -0.011111168190836906, 0.30118468403816223, -0.020681681111454964, 0.5475878715515137, -0.38593459129333496, 0.011237328872084618, -0.5266287326812744, -0.2086036503314972, 0.7017273306846619, -0.24537645280361176, -0.012105363...
parameters PostMessage(edit, WM_KEYDOWN, ...); PostMessage(edit, WM_CHAR, ...); PostMessage(edit, WM_KEYUP, ...); ``` Spy++ will reveal what the other parameters are, don't worry. You will probably spend some time figuring out how the last parameter of the call is built (because it's a mask). I haven't been able...
[ 0.00759256212040782, -0.31048232316970825, 0.4815636873245239, 0.005901674274355173, -0.06714452803134918, -0.004969846922904253, 0.499019980430603, -0.31935667991638184, -0.08222584426403046, -0.7235739231109619, -0.2654930651187897, 0.8631521463394165, -0.3675830066204071, -0.02447303198...
I have the following 'key' array: (Array 1) ``` Array ( [0] => first_name [1] => surname [2] => position [3] => age ) ``` This array should determine the keys and the order of keys/values which should exist in Array 2. So in a perfect world Array 2 would look like this: ``` Array ( [0] => Array ...
[ -0.028886502608656883, 0.2929268777370453, 0.3385784327983856, -0.3556518256664276, 0.2537730634212494, 0.21599505841732025, 0.2517489194869995, -0.3287965655326843, 0.14962288737297058, -0.57477867603302, -0.0686732679605484, 0.2886013090610504, -0.09820529818534851, 0.291328102350235, ...
Johnstone [position] => Striker [age] => 42 ) [1] => Array ( [first_name] => Al [surname] => MacLean [position] => Defender
[ -0.129161074757576, 0.03931098431348801, 0.5973817706108093, -0.6418686509132385, -0.2410748153924942, -0.09538872539997101, 0.6063913702964783, -0.8033477067947388, -0.30556297302246094, -0.42404770851135254, 0.03804532811045647, 0.3935215473175049, -0.630810022354126, 0.26208949089050293...
[age] => 22 ) ... ) ``` The problem I'm having is in the following example array. Sometimes: a) the order of keys in Array 2 is not the same as Array 1 b) and some of the keys defined in Array 1 don't exist in Array 2 - like so: ``` Array ( [0] => Array ( [position] => Defen...
[ -0.18384398519992828, 0.16500423848628998, 0.32820025086402893, -0.4676288068294525, 0.007807318586856127, 0.0441758930683136, 0.20966963469982147, -0.6743478178977966, -0.33782127499580383, -0.5032936334609985, 0.031722020357847214, 0.7863097190856934, 0.06972036510705948, 0.1857462674379...
[first_name] => James [surname] => McDonald ) [1] => Array ( [position] => Striker [first_name] => Ben [surname] => Lailey ) ... ) ``` I'd like some assistance creating a PHP
[ 0.1134825274348259, 0.3105539381504059, 0.3743709921836853, -0.18718315660953522, -0.12732058763504028, -0.18371479213237762, 0.4915195107460022, -0.46260425448417664, -0.2143714874982834, -0.038264814764261246, 0.036713093519210815, -0.13647307455539703, -0.4805373251438141, 0.05368738621...
function which will take a 'badly formed' Array 2 such as the one directly above, and convert it to how it should be: Order as defined by Array 1, and add any missing keys to become 'correct' like so: ``` Array ( [0] => Array ( [first_name] => James [surname] => McDonald ...
[ -0.37562325596809387, -0.08540423214435577, 0.3829588294029236, -0.39860427379608154, 0.21772511303424835, 0.057053882628679276, 0.48519495129585266, -0.7280725836753845, -0.01478184387087822, -0.2863912582397461, -0.6623464226722717, 0.4100489914417267, -0.441845178604126, -0.025510137900...
[age] => ) [1] => Array ( [first_name] => Ben [surname] => Lailey [position] => Striker [age] => ) ... ) ``` The keys used
[ 0.2758866250514984, 0.3154354691505432, 0.3581065237522125, -0.26869362592697144, 0.2956881523132324, 0.12806954979896545, 0.1667064130306244, -0.7300402522087097, -0.17638421058654785, 0.003678545355796814, -0.3326050937175751, 0.2510814964771271, -0.31285032629966736, 0.38087183237075806...
in this example are arbitrary, there could be a new key added, removed or re-ordered in Array 1 and I need Array 2 to respect Array 1. Thank you in advance. A simple implementation: ``` // Pass in an array of keys, and an array of arrays function cleanArray($keys, $arrays) { // Create an empty container for our f...
[ 0.08905262500047684, -0.1274908185005188, 0.40959489345550537, -0.032531533390283585, 0.09694717824459076, -0.015211055055260658, 0.35932278633117676, -0.4733787178993225, -0.15255174040794373, -0.6358873248100281, -0.07016687095165253, 0.4723179340362549, -0.15608036518096924, 0.119702756...
$next = array(); // Loop through keys, in order foreach($keys as $k) { // Assign next key and value if we have it, or a blank string if we don't $next[$k] = isset($a[k]) ? $a[k] : ''; } // Add
[ -0.2324221283197403, -0.05680800601840019, 0.340680330991745, -0.33077359199523926, 0.21362517774105072, 0.2923239767551422, 0.0882788747549057, -0.41323262453079224, -0.14938703179359436, -0.41452252864837646, -0.35318514704704285, 0.23139487206935883, -0.2621406316757202, 0.1555462479591...
current item to output $final[] = $next; } // Return final values, each item now having its keys ordered and normalized return $final; } ```
[ -0.35424843430519104, -0.3806281089782715, 0.8021224737167358, -0.2169715315103531, 0.34690621495246887, 0.3752000331878662, -0.01742885634303093, 0.053096260875463486, -0.4000231623649597, -0.4470953941345215, -0.4660283625125885, 0.5002321600914001, -0.15532469749450684, 0.56093215942382...
Beginner question: I have a dictionary where the values are lists of (a variable # of) strings. Ultimately, I would like to write each dictionary entry to a single tab-delimited line with the key as column 1 and the individual items from the value list as columns 2-n. I have used the following code to generate an outp...
[ -0.13418686389923096, 0.14229832589626312, 0.34470799565315247, -0.2142188996076584, -0.04798385873436928, 0.40990304946899414, 0.2792394459247589, -0.03969366475939751, -0.06062500551342964, -0.55332350730896, -0.23154714703559875, 0.005122373811900616, -0.05952493101358414, 0.03796502202...
'dog':['andy'], 'cat':['andy','colby','jeff']} f = open('outfile.txt', 'w') writer = csv.writer(f, delimiter = '\t') for key, value in orfdict.iteritems(): writer.writerow([orf] + [value]) ``` The python documentation suggests that you can use zip() to create a list form key:value pairs, but when I t...
[ 0.1468043327331543, 0.2643854022026062, 0.33210763335227966, -0.19921433925628662, 0.06073564291000366, 0.3240322470664978, 0.4123704731464386, -0.2914280593395233, -0.21133367717266083, -0.3532062768936157, -0.38996782898902893, 0.35060325264930725, -0.4870261549949646, 0.0974161028861999...
to do this going to be creating an empty list for each iteration over the dictionary, then appending to that list first the key, and then each of the values with an indented for loop? I feel like I must be missing something. Try this to add a single value to an existing list: ``` writer.writerow([key] + value) ``` (...
[ 0.3376764953136444, 0.14340387284755707, 0.22239501774311066, -0.17109562456607819, 0.04456183686852455, 0.07711326330900192, 0.4371485412120819, 0.012021916918456554, -0.161295086145401, -0.48189520835876465, 0.37701132893562317, 0.4763754904270172, -0.2782597243785858, 0.3723981678485870...
I am running PHP 5.3.2, Apache 2.2.14 and xdebug 2.2.0rc1 on my Ubuntu 10.04 laptop, and I am trying to set up debugging on localhost in Netbeans 6.8. My problem is that breakpoints I set in Netbeans are being ignored. Otherwise it it seems to work correctly. For example, I get pretty var\_dumps, xdebug traces, xdebug...
[ 0.2111784815788269, 0.3325386345386505, 0.1760062575340271, -0.08820073306560516, -0.04116254299879074, -0.3042476177215576, 0.6093173623085022, 0.21976572275161743, -0.13463623821735382, -0.5270174145698547, -0.13150142133235931, 0.4427395164966583, -0.21960406005382538, 0.189905241131782...
being used * That xdebug is loaded as zend\_extension=/full/path/to/xdebug.so (not extension=xdebug.so) * Thread safety is disabled in PHP and I am using the non-thread safe version of xdebug * That the path to the breakpoints is correct in the xdebug remote log (see code snippet below this list, the paths in that snip...
[ 0.1443149298429489, 0.18052886426448822, 0.4896586835384369, -0.18216979503631592, 0.12127594649791718, -0.37628254294395447, 0.4440082311630249, -0.2653239071369171, -0.16628716886043549, -0.5066437125205994, -0.33195462822914124, 0.5103710889816284, -0.3910168409347534, 0.110484294593334...
like that could be the problem, but it hasn't helped. Currently I have server path as `/var/www/mockup` and project path as `/common/rsync/Dropbox/active-archives/code/Locus/mockup` However, `/var/www/mockup` is a symlink to the longer path anyway so I don't even know if this is necessary? It does not work whether I s...
[ 0.014224762097001076, -0.08246057480573654, 0.2843640148639679, -0.062473490834236145, -0.34261706471443176, -0.18020980060100555, 0.39502230286598206, 0.09396890550851822, -0.31508100032806396, -0.9815360903739929, -0.0455453135073185, 0.3550835847854614, -0.4427715241909027, 0.2075534462...
After you've verified that the breakpoint\_set include the correct path, it should work.
[ 0.3325890600681305, 0.006214486435055733, -0.008372284471988678, 0.06759992986917496, 0.38441136479377747, -0.309400349855423, 0.30991050601005554, -0.06916118413209915, 0.06716122478246689, -0.45831629633903503, -0.3422296941280365, 0.8153011798858643, -0.01906600221991539, -0.21892946958...
I am trying to create my own plist file to be used in my application, I am using apple [documents](https://developer.apple.com/library/archive/#documentation/Cocoa/Conceptual/PropertyLists/QuickStartPlist/QuickStartPlist.html#//apple_ref/doc/uid/10000048i-CH4-SW5) as refrence for doing this. However, I have read that ...
[ 0.27855706214904785, 0.17042119801044464, 0.5211324095726013, 0.19405952095985413, 0.03581057861447334, 0.19726328551769257, -0.26962319016456604, -0.03982539847493172, -0.4694986641407013, -0.6359805464744568, 0.03666509687900543, 0.34599193930625916, -0.08575177192687988, -0.065013870596...
allowing the plist to be read and written too? You can put that plist file anywhere you want. The important thing will be copying it into the bundle. So to be sure for that check `project settings>build phases>copy bundle resources` You can open project settings by left-clicking on your project in the project naviga...
[ 0.645863950252533, -0.36295464634895325, 0.30226847529411316, 0.4046662747859955, 0.10325708240270615, -0.25139477849006653, -0.11795597523450851, -0.01226278580725193, -0.30562636256217957, -0.6533883810043335, 0.03190377727150917, 0.399906188249588, 0.011268015950918198, -0.1576619297266...
During a code review I presented a method quickly to the team that I had made static and one person agreed that there was no reason for it to not be static and a person disagreed saying that he would not make it static because it wasn't necessary and just to be on the safe side for future modifications and testing. S...
[ 0.416552871465683, -0.15774738788604736, -0.05438746139407158, 0.2535587251186371, -0.05429590865969658, -0.12812872231006622, 0.4412655532360077, -0.18401314318180084, -0.10080859065055847, -0.020999949425458908, 0.21959762275218964, 0.41648000478744507, -0.5027121901512146, 0.16172280907...
methods, a very low traffic page. More for my knowledge and learning on Static.) ``` private IEnumerable<Category> GetCategoryByID(int id, Context context) { var categoryQuery = from selectAllProc in context.SelectAll_sp() where selectAllProc.CategoryID == id select...
[ -0.20659883320331573, -0.24810601770877838, 0.38548603653907776, 0.24766941368579865, -0.2137509435415268, 0.055326689034700394, 0.25412508845329285, -0.2112766057252884, -0.4052119851112366, -0.10839905589818954, -0.24355372786521912, 0.4979637563228607, -0.5668705105781555, 0.13293957710...
faster. But the difference is almost too small to be meaningful. Generally speaking, you should mark a method static when it: 1. Doesn't interact in any way with instance members, and 2. You would like to have the ability to call it without instantiating the class, as in `Class.Method()` Ordinarily, methods like you...
[ -0.08090663701295853, -0.3025420606136322, -0.10978811234235764, 0.37424203753471375, -0.2782381772994995, -0.2623811960220337, 0.09863250702619553, -0.02223450504243374, -0.4176250994205475, -0.30746573209762573, -0.17646178603172302, 0.20389927923679352, -0.37550851702690125, 0.081011518...
``` { "80550560": {"name":" HAdailton Cesar", "name2": "T-Max"}, "5987810": {"name": "Adnax", "name2": "Adna Zaza"} } ``` I have this input and I need to output all the names that comes in the input, but the problem is that i don't have integer organized index, I would have to get the string number and also I...
[ 0.12072762101888657, 0.23598912358283997, 0.17275261878967285, -0.05246945843100548, 0.16801445186138153, -0.13513211905956268, 0.3404805064201355, -0.32172906398773193, -0.12974101305007935, -0.5461443066596985, -0.358646422624588, 0.722763180732727, -0.3431316316127777, 0.110354334115982...
have always opted to use `getMemberNames'
[ 0.5483358502388, -0.01988469623029232, 0.36290687322616577, -0.004358131904155016, -0.14010457694530487, -0.7227088809013367, 0.3622306287288666, 0.8477754592895508, 0.08213495463132858, -0.29741302132606506, -0.5050876140594482, 0.1882115751504898, 0.24475322663784027, 0.08768311142921448...
My table named **pictures** has a column named **pic** and I'm wanting to get the highest number in that column. Each row has a unique number in **pic** and it goes up by *1* each row. But one or two rows won't have a number in the column and will have some text instead. Like **grapes**. Here's an example of the table...
[ 0.2972259521484375, 0.5168668627738953, 0.4290873408317566, 0.0929194837808609, -0.18793508410453796, 0.20016109943389893, -0.3414316773414612, -0.24024292826652527, -0.6839621067047119, -0.5586538910865784, 0.206007719039917, 0.1609121561050415, -0.1992013156414032, 0.14816132187843323, ...
| 3 | | here |grapes | |___________________| ``` So, how would I get the highest number in the column **pic** which would be **3**? Column **pic** is a **varchar**. ``` SELECT MAX(CONVERT(pic, UNSIGNED INTEGER)) AS max_pic FROM pictures WHERE CONVERT(pic, UNSIGNED INTEGER) IS NOT NULL ``` The `WHERE pic ...
[ -0.09492084383964539, 0.20700137317180634, 0.5972371697425842, -0.13049021363258362, -0.3357948660850525, 0.49534687399864197, 0.21444378793239594, -0.7746012806892395, -0.49905574321746826, -0.4832056164741516, 0.13788056373596191, 0.5613137483596802, -0.11528482288122177, -0.146470874547...
Is there any other ways to make it another way than with closure and define\_method? Say i have this: ``` def test result=[1,2,3] metadata=['foo', 'bar'] # for simplicity, could be fetched from database result.define_singleton_method :headers, lambda { metadata } result end ``` I'm curious, are there other ...
[ 0.5331801176071167, 0.0679476410150528, 0.039024874567985535, 0.07804594933986664, -0.16026273369789124, -0.19047577679157257, 0.1449558585882187, -0.3611445426940918, -0.16267229616641998, -0.2533131539821625, 0.16015689074993134, 0.5766053199768066, -0.44830161333084106, 0.12458945810794...
result.instance_eval { @headers = ['foo', 'bar'] } result.define_singleton_method(:headers) { @headers } result end ``` You could also do something like this (it's a little different in that it creates a setter as well). ``` module HasHeaders attr_accessor :headers end def test result = [1,2,3].extend HasHe...
[ 0.2348298728466034, 0.14551295340061188, 0.30914145708084106, -0.21980075538158417, 0.03560049831867218, -0.23588252067565918, 0.30685678124427795, -0.7173415422439575, -0.11905931681394577, -0.3946372866630554, -0.16071970760822296, 0.5569624304771423, -0.3616863787174225, -0.097306266427...
I am trying to use [amcharts](http://www.amcharts.com/) and I want to use JSON to format the data for my chart. However, it seems that the syntax that amcharts accepts is not valid JSON. Here is the javascript code for the data for a hardcoded amchart chart: ``` var chartData = [{ country: "Czech Republ...
[ 0.4036290943622589, 0.2775402069091797, 0.7999274730682373, 0.322326123714447, 0.20790478587150574, 0.1755272001028061, -0.05729756876826286, -0.007611513137817383, -0.22429513931274414, -0.4479627013206482, -0.08124294877052307, 0.26897868514060974, -0.4399070143699646, 0.1123904883861541...
[{"country": "Czech Republic", "litres": 301.90}] ``` View ``` var chartData = <%= @chart_data.to_json %>; ``` The [valid JSON](http://jsonlint.com/) output: ``` [{"country": "Czech Republic", "litres": 301.90}] ``` However, what amcharts accepts is: ``` [{country: "Czech Republic", litres: 301.90}] ``` T...
[ 0.04276476800441742, 0.23926569521427155, 0.7064437866210938, 0.1547473520040512, -0.0535140261054039, 0.1885555386543274, 0.21789176762104034, -0.09883128106594086, -0.22444698214530945, -0.2835902273654938, -0.3651145398616791, 0.16999021172523499, -0.2730579376220703, -0.002610383322462...
var legend; var chartData = [{ country: "Czech Republic", litres: 301.90 }, { country: "Ireland", litres: 201.10 }, { country: "Germany",
[ 0.021291956305503845, 0.06300488114356995, 0.459637314081192, 0.1497945636510849, 0.22148558497428894, 0.5435575842857361, 0.5372146964073181, 0.09893214702606201, -0.6896864771842957, -0.0018651240970939398, -0.3306461572647095, -0.3744055926799774, 0.20290479063987732, 0.6670823097229004...
litres: 165.80 }, { country: "Australia", litres: 139.90 }, { country: "Austria", litres: 128.30 }, {
[ -0.2024381160736084, 0.09172428399324417, 0.38052868843078613, 0.15343329310417175, 0.08869820833206177, 0.956777036190033, 0.4039689600467682, 0.21186819672584534, -0.49923408031463623, -0.12554629147052765, -0.2924113869667053, -0.29233354330062866, -0.12352596968412399, 0.49116811156272...
country: "UK", litres: 99.00 }, { country: "Belgium", litres: 60.00 }]; AmCharts.ready(function () { // PIE CHART chart = new AmCharts.AmPieChart();
[ 0.1414337307214737, -0.0478677935898304, 0.8716728687286377, 0.005063337739557028, 0.5027908086776733, 0.6517630219459534, 0.16424094140529633, -0.20377524197101593, -0.6193475127220154, -0.08419659733772278, -0.2860671579837799, 0.3024182617664337, -0.1827525645494461, 0.21015815436840057...
chart.dataProvider = chartData; chart.titleField = "country"; chart.valueField = "litres"; chart.outlineColor = "#FFFFFF"; chart.outlineAlpha = 0.8; chart.outlineThickness = 2; // WRITE
[ -0.14690692722797394, 0.07346147298812866, 1.0360281467437744, -0.03278563544154167, 0.09252578765153885, 0.28976941108703613, 0.3393731713294983, -0.228546142578125, -0.4428490400314331, -0.3870941698551178, -0.03452153876423836, 0.034869663417339325, -0.018513914197683334, 0.296166241168...
chart.write("chartdiv"); }); </script> ``` I might be missing the point here, but if you are not using @chart\_data anywhere else you could just build the pseudo-json data string in the controller and remove the .to\_json call in your view: Controller: ``` @chart_data = "[{country: \"Czech Republic\", li...
[ -0.11538802832365036, -0.589616596698761, 0.8054189085960388, 0.2790677845478058, 0.2092161327600479, 0.10244327783584595, 0.12019125372171402, 0.061566948890686035, -0.6122921109199524, -0.7137712240219116, -0.15286366641521454, 0.28700050711631775, -0.6912925243377686, -0.024369319900870...
nothing but return your chart data and call it from your js: Controller: ``` def get_formatted_chart_data chart_data = "[{country: \"Czech Republic\", litres: 301.90}]" render :text => chart_data end ``` Or is it dynamically building the string that is the hard part?
[ -0.0618225559592247, -0.302812397480011, 0.4344329237937927, 0.20136339962482452, 0.1713850200176239, -0.09534791111946106, 0.30933085083961487, 0.21637488901615143, -0.4830322861671448, -0.3639594614505768, -0.3349648416042328, 0.6231876015663147, -0.49817541241645813, -0.1222533434629440...
Take a very simple example, `mfrow=c(1,3)`; each figure is a different histogram; how would I draw a horizontal line (akin to `abline(h=10)`) that went across *all* 3 figures? (That is, even the margins between them.) Obviously, I could add an abline to each figure, but that's not what I want. I can think of a very com...
[ 0.3913472592830658, 0.017091481015086174, 0.47940176725387573, 0.10131525248289108, -0.34214165806770325, 0.19901897013187408, 0.028485827147960663, -0.5205666422843933, -0.42287150025367737, -0.6453289985656738, -0.0650232806801796, 0.09558214247226715, -0.20050857961177826, -0.1156072393...
of multiple plots on a single device. Here, I first use `grconvertY()` to query the location of a height of 50 on the y-axis *in units of* "normalized device coordinates". (i.e. as a proportion of the total height of the plotting device, with 0=bottom, and 1=top). I then use **grid** functions to: (1) push a `viewport...
[ 0.03888138756155968, -0.11421239376068115, 1.2705801725387573, 0.13792560994625092, 0.17539265751838684, 0.22251254320144653, -0.1123371571302414, -0.655849277973175, -0.18452619016170502, -0.7691746354103088, -0.1897643804550171, 0.5712863206863403, 0.007372124586254358, 0.203746587038040...
a height of 50 on the y-axis. (Y <- grconvertY(50, "user", "ndc")) # [1] 0.314248 ## Add the horizontal line using grid library(grid) pushViewport(viewport()) grid.lines(x = c(0,1), y = Y, gp = gpar(col = "red")) popViewport() ``` ![enter image description here](https://i.stack.imgur.com/jOMq2.png) **EDIT**: @joran...
[ -0.09803853929042816, -0.37153568863868713, 1.063643455505371, 0.10098069906234741, -0.13523365557193756, 0.16511359810829163, -0.040727272629737854, -0.571765661239624, -0.2080603688955307, -0.6493808031082153, -0.08644556254148483, 0.6064742803573608, 0.17056186497211456, 0.0579273886978...
of bars = 1 Y <- grconvertY(50, "user", "ndc") ## Horizontal line pushViewport(viewport()) grid.lines(x = c(X1, X2), y = Y, gp = gpar(col = "red")) popViewport() ``` ![enter image description here](https://i.stack.imgur.com/7CSQB.png) Finally, here's an *almost* equivalent, and more generally useful approach. It em...
[ -0.03260878473520279, -0.23067080974578857, 0.8949907422065735, -0.212506964802742, -0.1395455002784729, 0.35329532623291016, 0.06928497552871704, -0.6051434874534607, -0.3695126473903656, -0.7677281498908997, -0.2671302556991577, 0.2573907673358917, -0.32495176792144775, 0.260346412658691...
I want to set the listview datacontext equal to an observable collection so that changes to the collection may reflect on my listview. I create the observable collection as: ``` public static ObservableCollection<T> ToObservableCollection<T>(IEnumerable<T> enumeration) { return new ObservableCollection<T>(enumera...
[ 0.03190699592232704, -0.09834020584821701, 0.8437319993972778, -0.18717987835407257, 0.11823378503322601, 0.0668625459074974, 0.198280468583107, -0.41431519389152527, -0.313304603099823, -0.6210125684738159, -0.13569703698158264, 0.6644836664199829, -0.5183775424957275, 0.3035154342651367,...
join emp in m.Employees on t.idEmployee equals emp.id where emp.id == CurrentEmploye.id select new {
[ 0.013951335102319717, -0.27851834893226624, 0.5701032876968384, -0.03291073814034462, 0.3486567437648773, 0.1585911512374878, 0.23809479176998138, -0.2315196692943573, -0.3484463691711426, -0.6542190909385681, -0.3112957775592804, 0.28224870562553406, -0.27057650685310364, 0.40903925895690...
firstName = emp.firstName, lastName = emp.lastName, position = emp.position, clockInDate = t.clockInDate,
[ -0.16426371037960052, -0.29787611961364746, 0.4677961468696594, -0.21184220910072327, 0.3158915936946869, 0.5938109755516052, 0.18546393513679504, -0.17827902734279633, -0.5004028081893921, -0.47497475147247314, -0.042322464287281036, 0.13653786480426788, -0.18072065711021423, 0.3329749703...
clockOutDate = t.clockOutDate, }; // here I create the observablecollection!!!!!!!!!!!!!! listView1.DataContext = ToObservableCollection(q); } ``` now my problem is that if I want to add items to the ObservableCollection how can I do that? If I do listView1.DataContext.Add( ...
[ -0.04701157659292221, 0.060695331543684006, 0.724776566028595, -0.3927847146987915, 0.100790835916996, 0.023078199476003647, 0.2093024104833603, -0.3790251910686493, -0.36391639709472656, -0.35891273617744446, -0.047670625150203705, 0.5413255095481873, -0.5289891958236694, 0.21078221499919...
result on an error. In other words I have the method ``` private void btnClockIn_Click(object sender, RoutedEventArgs e) { // I will like to add items to the observable collection in here ``` --- This is what I have tried and it does not work: ``` dynamic collection; private void UserContr...
[ -0.07250431180000305, -0.2571203410625458, 0.3778236210346222, -0.08263290673494339, 0.39294353127479553, 0.07074655592441559, 0.29784077405929565, -0.21736638247966766, -0.3560672104358673, -0.5230585336685181, -0.03351360186934471, 0.5102183818817139, -0.5400255918502808, 0.5322308540344...
join emp in m.Employees on t.idEmployee equals emp.id where emp.id == CurrentEmploye.id select new
[ 0.06215137988328934, -0.1835666000843048, 0.69676274061203, 0.07145573198795319, 0.28440821170806885, 0.11561233550310135, 0.18947915732860565, -0.14092165231704712, -0.3616939187049866, -0.6095502376556396, -0.374511182308197, 0.14571119844913483, -0.21015769243240356, 0.35705801844596863...
{ firstName = emp.firstName, lastName = emp.lastName, position = emp.position, clockInDate = t.clockInDate,
[ -0.14054128527641296, -0.4997884929180145, 0.3550125062465668, -0.022460632026195526, 0.5612967610359192, 0.5593120455741882, 0.26604321599006653, -0.23949874937534332, -0.37549087405204773, -0.5412918925285339, 0.06573058664798737, 0.4232701361179352, -0.3585432767868042, 0.36155924201011...
clockOutDate = t.clockOutDate, }; collection = ToObservableCollection(q); } private void btnClockIn_Click(object sender, RoutedEventArgs e) { collection.Add(new { firstName = "Antonio",
[ 0.3935557007789612, -0.4669376015663147, 0.424447238445282, -0.14538638293743134, 0.44459325075149536, 0.16705040633678436, 0.4943253993988037, -0.27080288529396057, -0.27808496356010437, -0.0895056426525116, -0.2768375873565674, 0.44201257824897766, -0.5468181371688843, 0.3165620565414428...
lastName = "Nam", position = "Amin", clockInDate = DateTime.Now, clockOutDate = DateTime.Now
[ 0.033807553350925446, -0.338379442691803, 0.4385213851928711, -0.48837244510650635, 0.599803626537323, 0.2912439703941345, 0.1610177904367447, 0.007038481533527374, -0.6385458707809448, -0.321157842874527, 0.09732351452112198, 0.07303805649280548, -0.13999933004379272, 0.3393928110599518, ...
}); ``` You can 'trick' it by using a similar 'template' anonymous variable... e.g. code method would be something like... ``` static ObservableCollection<T> CastToEnumerable<T>(this T template, object value) { return (ObservableCollection<T>)value; } ``` ...and use it something like this... ``` var list ...
[ 0.047841817140579224, -0.43112388253211975, 0.6815345287322998, -0.2514016032218933, 0.28436633944511414, -0.11689358949661255, 0.3196064829826355, -0.3191094994544983, -0.2970133423805237, -0.4896397590637207, -0.14529360830783844, 0.8004294037818909, -0.557020366191864, 0.211776211857795...
[Cast to Anonymous Type](https://stackoverflow.com/questions/1409734/cast-to-anonymous-type) (Basically you cannot return anonymous type - short of tricks like this - 'inferring' of the type is what's behind this).
[ 0.1127377524971962, -0.01714003086090088, 0.07908979803323746, 0.04782198369503021, -0.08496171981096268, -0.04345028102397919, 0.35321345925331116, -0.2978889048099518, -0.1882309913635254, 0.10669974982738495, 0.07113384455442429, 0.36461395025253296, -0.40074700117111206, 0.003811897709...