text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
After asking [organising my Python project](https://stackoverflow.com/questions/391879/organising-my-python-project) and then [calling from a parent file in Python](https://stackoverflow.com/questions/403822/calling-from-a-parent-file-in-python) it's occurring to me that it'll be so much easier to put all my code in on...
[ 0.507010281085968, 0.19099342823028564, -0.12428997457027435, -0.3057311773300171, -0.28181156516075134, -0.21528184413909912, 0.10122136771678925, 0.04213210940361023, -0.5854379534721375, -0.393186092376709, 0.000032748928788350895, 0.13663384318351746, -0.022008968517184258, 0.328788638...
then you are going to be screwed. Having one file is a guaranteed way to have lots of collisions and merges that will be painstaking to deal with over time. Stick to conventions and break apart your files. If nothing more than to save the guy who will one day have to maintain your code...
[ 0.5391102433204651, 0.23876026272773743, -0.03064068779349327, 0.5884114503860474, 0.3981788456439972, -0.17025737464427948, 0.17038673162460327, 0.17369510233402252, -0.3298514783382416, -0.5746243000030518, 0.10302379727363586, 0.4335813820362091, -0.2645556330680847, 0.28152281045913696...
I'm not certain where the error is resulting (from silverlight, from wcf, something else...) but, I have a WCF service being called from Silverlight. The method returns a class, with a property that does not have a setter. This throws an error. If I add a setter to the property then it does not give an error. The erro...
[ 0.3687106668949127, 0.03140944242477417, -0.0013426764635369182, 0.028849691152572632, -0.014084790833294392, -0.3394937217235565, 0.45335671305656433, -0.26917773485183716, 0.02567404881119728, -0.6427090167999268, -0.10044565796852112, 0.45472055673599243, -0.43622463941574097, 0.5376871...
{ get { return "Hi There"; } } } ``` Throws an error... But change it to: ``` [Serializable] [DataContract] public SomeClass { [DataMember] public string PropertyA { get; set; } public string PropertyB { get { return "Hi There"; } set {} } } ``` No error. Includes the usual ISome...
[ -0.06807777285575867, -0.009684237651526928, 0.5835086107254028, 0.020443396642804146, 0.16425400972366333, -0.4256911277770996, 0.27923133969306946, -0.4603148400783539, -0.08552854508161545, -0.5231707096099854, -0.49641916155815125, 0.50686115026474, -0.03621100261807442, 0.235629990696...
or a private-set property) to pass it over the wire? In your example PropertyB is not marked with a DataMember attribute meaning that it won't be exposed in the WSDL and ignored by the serializer. But if you mark PropertyB with a DataMember then you must have a setter (private, proptected or public) in order to seriali...
[ 0.5671892762184143, -0.31530553102493286, 0.11295519024133682, 0.12549039721488953, 0.03061019815504551, -0.46862468123435974, 0.32487985491752625, -0.2487548142671585, -0.1613137423992157, -0.3746359646320343, 0.024169551208615303, 0.6150109767913818, -0.3244817554950714, 0.33418387174606...
"Hi there"; } [DataMember(Name="PropertyB")] private readonly string _propertyB; public string PropertyB { get { return _propertyB; } } } ``` Or this: ``` [DataContract] public class SomeClass { public SomeClass() { PorpertyB = "Hi there"; } [DataMember] ...
[ -0.1214044839143753, -0.23805706202983856, 0.5708441138267517, -0.2881535589694977, 0.1931421011686325, -0.2217094898223877, 0.217767134308815, -0.3207570016384125, 0.17750284075737, -0.35717955231666565, -0.6087767481803894, 0.5862340331077576, -0.05730220675468445, 0.30113375186920166, ...
private set; } } ``` Please note that if you use [svcutil.exe](http://msdn.microsoft.com/en-us/library/aa347733.aspx), the generated proxy class will have both public getter and setter for the property which might not be what you are looking for. In this case you can use the service contract and data contract ass...
[ 0.2568954527378082, -0.2895375192165375, 0.2955373227596283, 0.08689460903406143, -0.014283370226621628, -0.2538241446018219, 0.08078835159540176, 0.1550888568162918, -0.04193082079291344, -0.6286187767982483, -0.38718748092651367, 0.6532943844795227, -0.3634992241859436, 0.293004304170608...
Whenever I include boost in my project I get a million of these warnings. Does anyone know how I can get rid of the warnings? > ../depends\boost/config/abi\_prefix.hpp(19) > : warning C4103: > 'depends\boost\config\abi\_prefix.hpp' > : alignment changed after including > header, may be due to missing #pragma > pa...
[ 0.30537644028663635, 0.29060378670692444, 0.3321017622947693, -0.10920339822769165, -0.2454277127981186, -0.02408435568213463, 0.4616140127182007, -0.3312761187553406, -0.23809856176376343, -0.23578877747058868, 0.03549974411725998, 0.6185781955718994, -0.49238231778144836, -0.229596033692...
which does the pop. That allows them to reuse the same #pragma pack code everywhere, which is handy as it may vary between compilers. It's perfectly safe though. The #pragma push is followed by a pop, it's just included from a different file. So you should probably just disable that error.
[ 0.19378499686717987, 0.09119240194559097, 0.25546038150787354, 0.1289944052696228, 0.024894122034311295, -0.4342440366744995, 0.29490309953689575, 0.07197930663824081, -0.30980631709098816, -0.10214734077453613, 0.13157539069652557, 0.822252631187439, -0.19313974678516388, -0.3082529008388...
I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on [this article](http://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/)). I've created several windows, and am now attempting to create a common style set for them. However, as it's a ...
[ 0.3575298488140106, 0.3602150082588196, 0.4031645953655243, -0.2245941162109375, -0.18102239072322845, 0.018107863143086433, 0.2544383108615875, -0.18959438800811768, -0.16278186440467834, -0.6370526552200317, 0.007519417442381382, 0.46844053268432617, -0.3426647484302521, -0.1578957140445...
*add* a working app.xaml to a class library? FYI, I did try creating a ResourceDictionary in a ResourceDictionary.xaml file, and include it in each window within a "Window.Resources" block. That turned out to solve the styling of Buttons, etc... but not for the enclosing Window. I can put `Style="{StaticResource MyWin...
[ 0.29446089267730713, -0.061965327709913254, 0.34443414211273193, 0.11672977358102798, -0.05029761418700218, 0.07589694112539291, 0.28603771328926086, -0.027468593791127205, -0.16711439192295074, -0.8218021988868713, 0.03840101137757301, 0.4371780455112457, -0.16952794790267944, -0.07801571...
and therefore hasn't loaded the ResourceDictionary yet). --- Thanks for the ideas, but still no go... apparently a class library does NOT support the generic.xaml usage implicitly. I added generic.xaml to my class library project and set its Build Action to "Resource". It contains: ``` <ResourceDictionary xmlns...
[ -0.3202483654022217, 0.14059697091579437, 0.6493444442749023, -0.11788389086723328, -0.2310815006494522, -0.18906114995479584, 0.25494182109832764, -0.07070008665323257, -0.277864545583725, -0.5163525938987732, -0.17033888399600983, 0.2849326729774475, -0.21285976469516754, 0.4569362401962...
Style="{StaticResource MyWindow}" Title="ConfigureGenericButtons"> ...Buttons, etc... </Window> ``` Although the VS Design window doesn't show the window using the MyWindow style (ie black background), it compiles fine and starts up. However, when the app containing this class library makes a call that causes thi...
[ 0.4279482364654541, -0.013934919610619545, 0.4496496915817261, -0.046669378876686096, -0.04781452938914299, -0.1062217652797699, 0.4350527822971344, 0.002257800893858075, -0.2115318775177002, -0.6441537737846375, 0.0035651109647005796, 0.7493783831596375, -0.12452832609415054, 0.2035706639...
something wrong here, or any other ideas on how one might allow for common custom styles to be used on a Window (ie, not have to define the styles in each Window's xaml) -- with the caveat that this is NOT an application? Try adding ``` Style={DynamicResource MyStyle} ``` You cannot use a StaticResource in this cas...
[ 0.514805018901825, -0.1718689352273941, 0.22452479600906372, 0.17400400340557098, -0.03550882264971733, -0.3983784019947052, 0.18505525588989258, 0.3876001536846161, -0.2610095143318176, -0.5488476157188416, -0.18095777928829193, 0.6180933117866516, -0.4466511309146881, 0.13780373334884644...
In my Flex interface, I've got a few List components that are data bound to ArrayCollections. I'm finding that when the ArrayCollections are updated (by Web services) and the data bindings for the Lists update, each List is reset and its selectedIndex is dropped. This is a problem if a user is in the middle of a task a...
[ 0.281634122133255, -0.5797555446624756, 0.28229770064353943, 0.17003118991851807, -0.0666557177901268, 0.023030228912830353, -0.13339368999004364, -0.3524169921875, -0.46247267723083496, -0.8502930402755737, 0.133274108171463, 0.6181655526161194, -0.3012775182723999, -0.25939303636550903, ...
data binding or general-purpose event utilities? As always, thanks! Try adding ``` Style={DynamicResource MyStyle} ``` You cannot use a StaticResource in this case.
[ 0.1595173180103302, -0.3421342968940735, 0.017005115747451782, 0.22115959227085114, -0.2858909070491791, -0.3863258957862854, 0.05239509418606758, 0.2323213517665863, -0.29414060711860657, -0.6143003702163696, -0.19351913034915924, 0.8615081310272217, -0.20500773191452026, -0.0268752034753...
I'm writing an ItemAdding handler for a SharePoint list, and the list contains multi-user fields. Since the SPItem is not actually available at this point, I think I'm relegated to using the string that comes back from the SPItemEventDataCollection. That string will look something like this when user1, user2, and user3...
[ -0.06515868008136749, 0.06532563269138336, 0.4697718620300293, -0.22984011471271515, -0.35257771611213684, 0.4031546413898468, 0.4170180559158325, 0.014980530366301537, -0.28717368841171265, -0.47069722414016724, 0.24910935759544373, 0.31137436628341675, -0.1106962040066719, 0.130020618438...
like the integer tokens here always correspond to the domain\username that follows. Are there any cases where this will not be true and either the integer or the domain\username are missing or otherwise incorrect? Would it be safe to just use the numbers and use SPWeb's SiteUsers.GetByID(id) method? In a handful of tes...
[ -0.029600657522678375, -0.06266619265079498, 0.5171149969100952, 0.16315019130706787, -0.021739790216088295, -0.22569751739501953, 0.1653454303741455, -0.19896866381168365, -0.4369784891605377, -0.7467542886734009, 0.1728481650352478, 0.5192499756813049, -0.21741577982902527, 0.01776534132...
User property that returns the corresponding SPUser objects for the web. ``` private void ProcessUsers(SPListItem item, string fieldName) { string fieldValue = item[fieldName] as string; SPFieldUserValueCollection users = new SPFieldUserValueCollection(item.Web, fieldValue); foreach(SPFieldUserValue uv in users...
[ -0.43221721053123474, 0.08157116174697876, 0.604357123374939, -0.24547025561332703, 0.025980595499277115, 0.018896035850048065, 0.3698183298110962, -0.570106565952301, -0.07584831118583679, -0.6381005644798279, -0.21962995827198029, 0.5808506011962891, -0.3066786825656891, 0.48308357596397...
In a fairly animated discussion in my team I was made to think what most people like as primary keys. We had the following groups- 1. Int/ BigInt which autoincrement are good enough primary keys. 2. There should be at least 3 columns that make up the primary key. 3. Id, GUID and human readable row identifiers all shou...
[ -0.06338860094547272, 0.0823272243142128, 0.3122042417526245, 0.15806108713150024, -0.34944114089012146, 0.4349682927131653, -0.10216782987117767, -0.2580196261405945, -0.21430492401123047, -0.5912429690361023, -0.009953316301107407, 0.46106773614883423, -0.27195489406585693, -0.1164391413...
to be doing any syncing between databases with occasionally connected apps, then you should be using GUIDs for your primary keys. It is kind of a pain for debugging, so apart from that case I tend to stick to ints that autoincrement. Autoincrement ints should be your default, and **not** using them should be justified...
[ 0.21961066126823425, 0.12341975420713425, 0.23808175325393677, 0.26940494775772095, -0.009584804996848106, 0.17715336382389069, 0.3082752525806427, 0.30325403809547424, -0.06399552524089813, -0.570508599281311, -0.06758920848369598, 0.9216689467430115, -0.42642495036125183, -0.175119847059...
My client asked me (a JavaScript client-side programmer) to change the order of the options so that their company's option appears at the top of a select box when the page loads. The following code works in Firefox but fails in Internet Explorer 7 when I try to swap two options: ``` function load{ var shi...
[ 0.12294697016477585, -0.13405662775039673, 0.6504698395729065, -0.3132829964160919, 0.6783304810523987, 0.007858720608055592, 0.09527076035737991, 0.03426602482795715, -0.2425767183303833, -0.7587939500808716, -0.24846960604190826, 0.6984931230545044, -0.45079854130744934, 0.12395584583282...
for(var i = 0; i < shippingLocation.length; i++) { if(shippingLocation.options[i].value == "XETEX") { swap = shippingLocation.options[i]; lastPos = i;
[ 0.012036306783556938, -0.5554305911064148, 0.4063381254673004, -0.3267887830734253, 0.6841216683387756, 0.38872915506362915, -0.20277641713619232, -0.3412214517593384, -0.27023759484291077, -0.3118835985660553, -0.34219884872436523, 0.8083041906356812, -0.18142257630825043, -0.076145090162...
break; } } console.debug("sl: " + shippingLocation.options[0]); console.debug("s: " + swap); shippingLocation.options[0] = swap; shippingLocation.options[lastPos] = initiallyFirstItem; shippingLocation.selectedIndex = 0; } ``` I get an error on the next ...
[ -0.27447688579559326, -0.19956126809120178, 0.38430255651474, -0.2816034257411957, 0.6646339893341064, -0.014371596276760101, 0.2762567102909088, -0.10312923043966293, -0.37200137972831726, -0.31811973452568054, -0.6353518962860107, 0.5813812613487244, -0.08828360587358475, 0.2522186040878...
or method". What's Internet Explorer's beef with switching option items? This is because inside an editable element IE makes everything, including elements hidden with display: none, editable. There's nothing you can do about it except remove the elements you wish to hide from the page's DOM. There's a reference to t...
[ 0.1506580263376236, -0.16391447186470032, 0.2938462495803833, 0.024625670164823532, 0.019119543954730034, -0.16720233857631683, 0.565246045589447, -0.14365746080875397, -0.19933955371379852, -0.4095988869667053, -0.3609846532344818, 0.26992344856262207, -0.4270160496234894, 0.0131481811404...
There are a variety of characters that are not legally encodeable in XML 1.0, e.g. `U+0007` ('bell') and `U+001B` ('escape'). Most of the interesting ones are non-whitespace 'control' characters. It's clear from (e.g.) [this question](https://stackoverflow.com/questions/209193/special-characters-in-xml) and others th...
[ 0.1387937217950821, 0.07725396752357483, 0.015087427571415901, 0.2953520715236664, 0.14920414984226227, 0.023138629272580147, 0.21390821039676666, -0.32562196254730225, -0.23203174769878387, -0.07949520647525787, -0.292921781539917, -0.024444492533802986, -0.2618495225906372, 0.21910351514...
there is some motivation towards avoiding transmission control characters, but Unicode includes many *other* control-like characters (consider `U+200C` "zero width non joiner"). I recognize there may be no good reason for this behavior, but I would still like to understand it better. It's particularly frustrating beca...
[ 0.22392739355564117, 0.19418586790561676, -0.07176319509744644, 0.02893255464732647, 0.026939459145069122, -0.19410650432109833, 0.27404579520225525, 0.08096756041049957, -0.08499038219451904, -0.4121779203414917, -0.40075525641441345, 0.17590543627738953, -0.3966653347015381, 0.1268032044...
for any editors and parsers in binary conversion. I'm struggling to find anything ex cathedra on this from Tim Bray et al though. edit: [some](http://lists.xml.org/archives/xml-dev/199804/msg00502.html) [discussion](http://lists.xml.org/archives/xml-dev/200006/msg00360.html) of control chars and a vague admission it ...
[ -0.19466637074947357, 0.37453484535217285, -0.05645303800702095, 0.08426573872566223, -0.10838498920202255, -0.2851945161819458, 0.2022499442100525, -0.004459147807210684, 0.01083703525364399, -0.4480512738227844, -0.2586900293827057, 0.07876405864953995, -0.21177224814891815, 0.1634457260...
we'd do it the same way if we were doing it again. I > don't see that they do any real harm. Clearly, if you're optimizing > for a highly interoperable *content* markup language (and XML is) it's > legitimate to be suspicious of things like vertical-tab and backspace > and so on... but then how can it be consistent...
[ 0.5951778292655945, 0.024276170879602432, 0.13578598201274872, 0.15582430362701416, -0.016390040516853333, -0.12032485008239746, 0.2159072309732437, 0.05374838411808014, -0.25301891565322876, -0.18294593691825867, -0.024605650454759598, 0.5242338180541992, -0.0055155628360807896, -0.063263...
While browsing the various option switches for my compiler (GNU C++ 3.2.3 is supported by my organization for my given hardware configuration), I ran across this: ``` -glevel : Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when y...
[ 0.20864740014076233, 0.046224866062402725, 0.14550302922725677, -0.10376258194446564, 0.12757433950901031, 0.0749509409070015, -0.10351871699094772, -0.07100512087345123, -0.40656229853630066, -0.5867422223091125, 0.18193794786930084, 0.8719263672828674, -0.42342156171798706, -0.1750695109...
here had the experience of getting extra debugging 'features' using -g3 on GNU compilers? Your question appears to imply that you don't understand what macros are. *Of course* you can't step into a macro. The -g3 is quite useful for "macro heavy" programs. Consider: ``` int main() { int i; for (i = 0; i < 20; ++i...
[ 0.1593114137649536, -0.09933621436357498, 0.24717587232589722, -0.4539397358894348, -0.04046579822897911, -0.07403247058391571, 0.29859593510627747, -0.34033647179603577, -0.309303343296051, -0.2910984754562378, -0.2758808732032776, 0.5747995376586914, -0.7037492990493774, -0.0333625264465...
} } return 0; } ``` Without -g3, when you are stopped on line 7 or 10, you may have to search quite a lot for definition of A(), and there could be many such definitions, so you would then have to figure out which one is "current". With -g3, GDB can to do the heavy lifting for you: ``` (gdb) b 7 Breakpoint 1 at...
[ 0.004945782944560051, -0.19800622761249542, 0.5574288368225098, -0.355743944644928, 0.2167699784040451, -0.06610208749771118, 0.3644908666610718, -0.1590873897075653, -0.384031742811203, -0.17877013981342316, -0.4392787516117096, 0.5051798224449158, -0.5851641297340393, 0.29853174090385437...
A(x) case x: printf(#x "\n"); break (gdb) c 1 2 3 4 Breakpoint 2, main () at m.c:10 10 A(1); A(2); (gdb) info macro A Defined at /tmp/m.c:9 #define A(x) case 10+x: printf("10+" #x "\n"); break (gdb) q ```
[ 0.02594718709588051, 0.040981680154800415, 0.18934641778469086, -0.36941665410995483, 0.1624535769224167, 0.08752822875976562, 0.20139074325561523, -0.1400044709444046, -0.18483929336071014, -0.23928208649158478, -0.5260062217712402, 0.4490543007850647, -0.8913366794586182, 0.0876531898975...
I am ftp'ing files from an external server, then deleting them on the external server, and one file failed because there was a space in the filename. I changed my ftp delete command to have quotes around the filename. ``` ftpStream.WriteLine("delete """ & FileToDelete & """") ``` But, are there other characters that...
[ 0.2529608905315399, 0.17033319175243378, 0.40882596373558044, -0.33180174231529236, 0.13876311480998993, 0.17146560549736023, 0.13147734105587006, -0.02121802605688572, -0.23337797820568085, -0.43410536646842957, 0.05635039880871773, 0.484256774187088, -0.4499943256378174, 0.22228898108005...
Win XP) Any characters that are reserved by the file system won't be allowed. This usually includes spaces, commas, slashes, colons, quetion marks, double quotes, etc. But as JaredPar mentioned, space is probably the only universal offender since each file system has its own set of reserved characters that don't always...
[ 0.10885303467512131, 0.1351785957813263, 0.5335671901702881, 0.19119317829608917, -0.18346449732780457, -0.158325657248497, 0.17331279814243317, 0.042849499732255936, -0.07279837131500244, -0.3953969180583954, -0.3487432599067688, 0.495436429977417, 0.11675359308719635, -0.0052150497213006...
I have this enum: ``` enum ButtonState { BUTTON_NORMAL = 0, BUTTON_PRESSED = 1, BUTTON_CLICKED = 2 }; const u8 NUM_BUTTON_STATES = 3; ``` In my Button class I have member variables `ButtonState state;` and `ButtonColors colors[NUM_BUTTON_STATES];`. When drawing the button, I use `colors[state]` to get t...
[ 0.0471462681889534, -0.054387740790843964, 0.4805690348148346, -0.31636080145835876, -0.020136773586273193, 0.3382824957370758, 0.15479858219623566, -0.39369750022888184, -0.10111420601606369, -0.8333954811096191, -0.04406369477510452, 0.28457820415496826, -0.17556816339492798, 0.155189424...
It seems to start from 0 by default and increment by 1 but is it guaranteed to work that way in all compilers? ***Is this good programming style?*** I think so. I do the same thing quite frequently. ***Is there a better way to do it?*** ``` class Button { public: // Used for array indexes! Don't change the numb...
[ -0.10805215686559677, -0.15809021890163422, 0.5057260394096375, -0.08798422664403915, 0.12097763270139694, -0.18006980419158936, 0.3131958842277527, 0.07728860527276993, -0.31325697898864746, -0.7081660032272339, -0.0727597326040268, 0.42246636748313904, -0.26854217052459717, 0.19342966377...
around as *ints*. But trouble if you are actually expecting a *Button::State*. ***Using an enum as an array index doesn't feel right.*** It's fine. Just **DOCUMENT** it, so the next guy knows what's going on! (That's what comments are for.) ***Do I have to specify the values of the enum?*** With no '=' assignment, ...
[ 0.25303345918655396, 0.1402912735939026, 0.40690815448760986, -0.013276818208396435, -0.3485623896121979, 0.041000738739967346, 0.20118853449821472, -0.0038265143521130085, -0.34187552332878113, -0.7261472940444946, -0.1692841649055481, 0.04978599399328232, -0.1199343353509903, 0.080541864...
For some reason the following code fails. You can't simply erase a reverse\_iterator by using its base() method. ``` #include <set> #include <iostream> int main() { std::set<int> setOfInts; setOfInts.insert(1); setOfInts.insert(2); setOfInts.insert(3); std::set<int>::reverse_iterator rev_iter = ...
[ -0.36049383878707886, 0.02397061511874199, 0.5445751547813416, -0.6149740219116211, 0.043339475989341736, 0.5219610929489136, 0.7009355425834656, -0.5733363628387451, -0.01468826923519373, -0.3676956593990326, -0.02554846927523613, 0.582287609577179, -0.5616782903671265, 0.0131939314305782...
{ // SEGFAULT HERE setOfInts.erase( rev_iter.base()); } rev_iter = nextRevIter; ++nextRevIter; } } ``` How does one go about correctly doing the above? Given a reverse\_iterator that corresponds to something you want to erase, how do you erase it? **Note, erase wo...
[ -0.027181856334209442, 0.06461180001497269, 0.29289039969444275, -0.28021037578582764, 0.1993957906961441, 0.04307771101593971, 0.4843330383300781, -0.10446149855852127, -0.09939063340425491, -0.4807106852531433, -0.19294656813144684, 0.6452277302742004, -0.30415573716163635, 0.09025296568...
1 off. The following identity holds for a reverse\_iterator: ``` &*(reverse_iterator(i)) == &*(i - 1) ``` Or in other words, the reverse\_iterator is always one pass the regular iterator it is the base of. Not sure why. In GCC ====== Simply change ``` // SEGFAULT HERE setOfInts.erase( rev_iter.ba...
[ -0.08630486577749252, -0.024035481736063957, 0.4711475968360901, -0.3731992244720459, -0.029213538393378258, -0.040799710899591446, 0.23957498371601105, -0.3816166818141937, -0.18559691309928894, -0.46738845109939575, -0.1967560201883316, 0.7207252383232117, -0.4481304883956909, -0.0630502...
doesn't quite work. The "nextIter" becomes invalid on the erase. Instead, you need to save away the temporary from the erase to get the next iterator instead of keeping around a nextIter like above. ``` set<int>::iterator tempIter = setOfInts.erase(--rev_iter.base()); rev_iter = setOfInts.erase(tempIter); ``` So...
[ -0.21661370992660522, -0.13802361488342285, 0.7588504552841187, -0.41940203309059143, 0.2904030978679657, 0.31116196513175964, 0.5261425971984863, -0.4619821012020111, -0.05717496573925018, -0.5406020283699036, -0.21885687112808228, 0.511042058467865, -0.3536674976348877, 0.103775076568126...
and try to erase if (*rev_iter == 3) { cout << "Erasing : " << *rev_iter; set<int>::iterator tempIter = setOfInts.erase( --rev_iter.base()); rev_iter = set<int>::reverse_iterator(tempIter); } else
[ 0.07432600855827332, 0.050976067781448364, 0.33843326568603516, -0.3136594295501709, 0.288142591714859, 0.3045957684516907, 0.5501006245613098, -0.39183372259140015, 0.00120684620924294, -0.6743400692939758, -0.3745379149913788, 0.7410378456115723, -0.42442774772644043, -0.0811232551932334...
{ ++rev_iter; } } } ``` Note, associative containers do not return an iterator from erase. So this solution wouldn't work for map, multimap, etc.
[ -0.3000609874725342, -0.02872304432094097, 0.13525468111038208, -0.14077121019363403, -0.17952577769756317, -0.24884575605392456, 0.23785929381847382, -0.11483543366193771, 0.0016242788406088948, -0.5899973511695862, -0.1241699755191803, 0.5495789051055908, -0.4435199499130249, 0.201186105...
I need to be able to programmatically transcode mpeg-2 files to .mp4, .mp3, .wmv, .rm (optional), and .flv (optional), and hopefully generate a thumbnail as well. I found the Java Media Framework, but it frankly looks pretty crappy. This will be running a Linux server, so I could shell out to ffmpeg using Commons Exec ...
[ 0.3188827931880951, 0.08554672449827194, 0.3225097060203552, 0.26411229372024536, -0.34861519932746887, -0.00028992429724894464, 0.0929030328989029, -0.24354024231433868, -0.1779222935438156, -0.8768140077590942, -0.058874525129795074, 0.6580277681350708, -0.4866864085197449, 0.08303675800...
{target_audio_rate} -b {target_bitrate} -s {width}x{height} {target}.ext ``` And your screenshot: ``` ffmpeg -i {input}.ext -r 1 -ss 00:00:04:005 -t 00:00:01 -an -s {width}x{height} {target_name}%d.jpg ``` 15 fps is standard for flv and audio sample rate should be 44100 for flv. Options to use: `-r` specifies a fr...
[ 0.07797311246395111, -0.11345768719911575, 0.8206464052200317, 0.017071891576051712, -0.10865110158920288, 0.11152572184801102, 0.1144142895936966, -0.6360068321228027, -0.23337861895561218, -0.37635859847068787, -0.28101417422294617, 0.8681079745292664, -0.009145503863692284, -0.140820652...
use. With the above, `%d` will always be the number 1 (one frame, one screenshot). Good luck.
[ 0.30049780011177063, 0.14145536720752716, 0.28890106081962585, 0.04623580351471901, 0.16437692940235138, -0.1928095668554306, 0.08886841684579849, 0.3329274356365204, 0.1083785817027092, -0.8250537514686584, -0.3066779673099518, 0.39685577154159546, -0.08797823637723923, -0.007251226343214...
How do I get the actual value (or text) of the item selected in an HTML select box? Here are the main methods I've tried... ``` document.getElementById('PlaceNames').value ``` ``` $("#PlaceNames option:selected").val() ``` ``` $("#PlaceNames option:selected").text() ``` And I've tried various variations on th...
[ 0.3272069990634918, -0.14028403162956238, 0.43980640172958374, 0.08931883424520493, -0.14181646704673767, 0.19993814826011658, 0.10565132647752762, -0.09201434254646301, -0.11811013519763947, -0.7168174982070923, -0.11392796784639359, 0.5103135108947754, -0.1168273538351059, 0.022645590826...
it must be due to some fundamental misunderstanding of Javascript and jQuery. EDIT: I should mention that I'm using IE7 `$('#placeNames').val()` returns the [value](http://docs.jquery.com/Attributes/val) of the selected option in the latest version of jQuery.
[ 0.19766181707382202, -0.1113097071647644, 0.3089013695716858, 0.04753435030579567, 0.13284195959568024, -0.149542436003685, 0.25458046793937683, 0.1549881100654602, -0.14956581592559814, -0.6508111357688904, -0.498215913772583, 0.6797890663146973, 0.06289032101631165, -0.03351240232586861,...
I am finishing off a C# ASP.NET program that allows the user to build their own computer by selecting hardware components such as memory, cpu, etc from a drop down lists. The SQL datatable has 3 columns; ComputerID, Attribute and Value. The computerID is an ID that corresponds to a certain computer in my main datatable...
[ 0.34977614879608154, 0.5116114616394043, 0.48210930824279785, -0.0865592285990715, -0.08905775099992752, 0.43353036046028137, -0.13093498349189758, -0.28473415970802307, 0.038221169263124466, -0.580809473991394, 0.2719048261642456, 0.2786233723163605, 0.20316000282764435, 0.488810330629348...
to do it narrow down the results by first selecting all computers that meet the first attribute requirements and then getting from that list, all computers that meet the next requirement.. and so on for about 10+ attributes. I thought it might be a good idea to show you an example of my LINQ to SQL query so that you h...
[ 0.011489084921777248, 0.13214103877544403, 0.3498801290988922, 0.21644265949726105, 0.22954800724983215, -0.0939202681183815, -0.16219186782836914, -0.44034910202026367, -0.10519898682832718, -0.7233927249908447, -0.0064550419338047504, 0.666797399520874, -0.11839800328016281, -0.086320146...
where computer.Value == "MEMORY" && computer.Value >= "1" select results.ComputerID; ``` Next I want to select from the resultsList where the CPU is say, faster than 2.8Ghz and so on. I hope I have given you enough information. If anyone could please give me some advice as to how I might go about ...
[ 0.12841419875621796, -0.08440807461738586, 0.3922995626926422, 0.21542993187904358, 0.370254248380661, -0.06121324002742767, -0.11123417317867279, -0.054726742208004, -0.1405106633901596, -0.8998305201530457, -0.18280786275863647, 0.586425244808197, -0.17963509261608124, 0.4210967421531677...
locally scoped variable to avoid using // the same reference in all of the where methods. ComputerRequirement cr = z; if (results == null) { results = db.ComputerAttributes .Where(c => c.Attribute == cr.Attribute && c.Value >= cr.Value); } else { results = results .Concat(db.ComputerA...
[ -0.1250254362821579, -0.15844479203224182, 0.6015619039535522, 0.09844829887151718, 0.18673591315746307, 0.14771205186843872, -0.0196559838950634, -0.1627941131591797, -0.14965517818927765, -0.6631085276603699, -0.39395076036453247, 0.6432462334632874, -0.15280041098594666, 0.0599313862621...
that matched all requirements. IQueryable<int> ids = results .GroupBy(x => x.ComputerId) .Where(g => g.Count == requirementsCount) .Select(g => g.Key); //Get all attributes for those id's List<ComputerAttributes> data = db .ComputerAttributes.Where(c => ids.Contains(c.ComputerId)) .ToList(); ```
[ 0.05448301136493683, -0.15767773985862732, 0.35935643315315247, 0.1985945850610733, -0.011981463059782982, 0.11061888933181763, 0.03734876215457916, -0.7139487862586975, -0.007443620823323727, -0.5871540307998657, -0.010226828046143055, 0.6209949851036072, -0.22571951150894165, -0.23627965...
I am writing a library in standard C++ which does the phonetic conversion. I have used std::string as of now. But in future I may have to change this to someother (std::wstring or something else). So I need to write my library in such a way that I can switch this easily. I have done the following so far to achieve this...
[ 0.5136279463768005, 0.31060460209846497, 0.3327270448207855, -0.26741454005241394, -0.17713263630867004, -0.02026279829442501, 0.06548699736595154, 0.031487900763750076, -0.09409394860267639, -0.6381924152374268, 0.12470925599336624, 0.4775845408439636, -0.2579684257507324, -0.102858781814...
the header file and it will be reflected everywhere. I'd appreciate if someone can see this is the correct approach or is there a better way to do this? Thanks You can write template functions that will work with either type of string, or for that matter anything that has the proper methods. If you do the typedef as ...
[ 0.784211277961731, -0.27399271726608276, 0.09663005918264389, 0.26194438338279724, -0.30192264914512634, -0.3502681255340576, 0.19819539785385132, 0.1379568725824356, -0.23801551759243011, -0.7194086313247681, 0.13970395922660828, 0.7093877196311951, -0.3786724805831909, -0.001956101739779...
line, but that's just the start - changing the typedef means you're changing the public API of your library. You'll have to change and test all of the code that interacts with your library, and this might represent the majority of the work involved. It's even possible that a simple search and replace is sufficient to u...
[ 0.33918488025665283, -0.2170105278491974, 0.360199511051178, 0.3320053219795227, 0.13949327170848846, -0.008901084773242474, 0.2666226625442505, 0.09706714004278183, -0.21148985624313354, -0.3194279372692108, -0.00010357697465224192, 0.4144095778465271, -0.3760754466056824, 0.2130016535520...
I am just starting with C++ and got some problems in understanding how the scope for private member variables in a class works. Please see the below code ``` class Foo{ private: std::vector<int> container; public: // other methods }; int main(int argc, char* argv[]) { Foo* foo = new Foo; ...
[ 0.05725817754864693, -0.013342561200261116, 0.4877769649028778, -0.3265575170516968, -0.048214301466941833, -0.05867387726902962, 0.06050989031791687, -0.13826483488082886, -0.23872274160385132, -0.37372443079948425, 0.09578247368335724, 0.41450223326683044, -0.44891107082366943, 0.4783791...
I am invoking "Foo" instance and passing it to several other methods and classes. Following are my doubts 1. What will be the scope of variable "container"? Will that variable exist until I delete the instance foo? 2. Do I need to make the "container" as a pointer to vector? Thanks for the help 1. Yes, the *lifetime*...
[ 0.3141977787017822, 0.03600045666098595, 0.43590250611305237, -0.30350467562675476, -0.05480700731277466, -0.17896375060081482, 0.3683406412601471, -0.1062786802649498, -0.29674872756004333, -0.5873335003852844, 0.37320271134376526, 0.6438291072845459, -0.4333915114402771, 0.38333755731582...
create a dynamic object of `vector<int>` which you would need to manage the lifetime of (including calling delete on the container pointer). That's unnecessary here. Assuming you want the container last as long as the Foo object, you are fine with having it directly contained, without doing it with a pointer. Passing ...
[ 0.045708660036325455, -0.3119522035121918, 0.1455952376127243, -0.019726896658539772, -0.15765653550624847, -0.2095324993133545, 0.32484862208366394, 0.08097884804010391, -0.3005211651325226, -0.7209553718566895, 0.023252815008163452, 0.5771062970161438, -0.4918474555015564, 0.068628519773...
to an object in Java, say: ``` Foo f = new Foo(); // just passes the reference (pointer in C++) to doIt. // the actual object is not copied doIt(f); ```
[ 0.19668443500995636, 0.21902796626091003, 0.6323937177658081, -0.347207635641098, 0.13344794511795044, -0.19779938459396362, 0.09677192568778992, -0.1582687795162201, -0.14149770140647888, -0.22188322246074677, -0.14674097299575806, 0.3978711664676666, -0.6940475106239319, -0.0469931960105...
Duplicate --------- [Modifying A Collection While Iterating Through It](https://stackoverflow.com/questions/308466/modifying-a-collection-while-iterating-through-it-c) --- Has anyone a nice pattern to allow me to get around the inability to remove objects while I loop through an enumerable collection (eg, an IList o...
[ -0.025462545454502106, 0.17065434157848358, 0.07758074253797531, 0.015226162038743496, 0.1265830546617508, 0.07029349356889725, 0.24284708499908447, -0.14148060977458954, -0.4695678651332855, -0.4385564923286438, -0.005532595328986645, 0.35144877433776855, -0.6749173998832703, 0.3042592406...
a new collection of objects to remove within to loop, then looping through that collection and removed the objects from the original collection. These work fine, but neither *feels* nice, and I was wondering if anyone has come up with a more *elegant* solution to the issue There's a useful `List<T>.RemoveAll(Predicate...
[ 0.21628648042678833, -0.2508189380168915, 0.13867171108722687, 0.12017867714166641, 0.029301047325134277, 0.018332401290535927, 0.31042245030403137, -0.24223122000694275, -0.4527141749858856, -0.41213375329971313, -0.09478036314249039, 0.03882360830903053, -0.37497231364250183, 0.305694341...
Do you use any free tool to generate query for oracle database. Tool that autocomplete and suggests the table names and column names. [Oracle SQL Developer](http://www.oracle.com/technology/products/database/sql_developer/index.html) has auto-complete and such. Written and maintained by Oracle themselves. It is writte...
[ 0.5479897260665894, 0.3256860673427582, -0.09861209243535995, -0.07821600139141083, 0.11705684661865234, -0.1448502540588379, 0.3277277648448944, 0.13449637591838837, 0.021249694749712944, -0.20706821978092194, -0.06233256682753563, 0.22553309798240662, -0.37221917510032654, -0.29497665166...
I am asking about that as I am going to develop a client side application using c# to display stock data and make some user-interaction, so give me links for best tutorials you read before [Jeremy Miller's guide](http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-content...
[ 0.19555962085723877, 0.3750668466091156, 0.6792593598365784, -0.15101005136966705, -0.3185521066188812, 0.15154094994068146, 0.4964542090892792, -0.648142397403717, 0.19924041628837585, -0.4855189919471741, 0.31214213371276855, 0.5802332758903503, -0.3347051739692688, -0.21043097972869873,...
this, here is a [tutorial](http://aspadvice.com/blogs/insane_world/archive/2007/06/25/Windsor-Container-Tutorials-_2D00_-BitterCoder_2700_s-Wiki.aspx) on just one implementation of an IoC tool. If you are still hungry for more, check out [Rich Newman's series](http://richnewman.wordpress.com/intro-to-cab-toc/) on Mic...
[ 0.1392216682434082, 0.1661609560251236, 0.022822266444563866, 0.29421335458755493, -0.090335413813591, -0.018431901931762695, 0.34588077664375305, 0.1395069807767868, 0.013749807141721249, -0.3854898512363434, -0.059455517679452896, 0.07571523636579514, -0.508129894733429, 0.23946890234947...
Is is that I'm a newbie learning Ruby, or does it really have more ways to write (the same) things than Java/C#? Also, if it is more flexible than Java, are there any linguistic features of Ruby that are generally **not** used to avoid confusion? Examples might be parallel assignment and all the different ways to writ...
[ 0.13430985808372498, -0.22325964272022247, -0.1382058709859848, 0.06075187399983406, -0.44635722041130066, -0.155147984623909, -0.00723988376557827, 0.11800064891576767, -0.21941235661506653, -0.37467145919799805, -0.14672648906707764, 0.5312446355819702, -0.3403300642967224, -0.2552035748...
answers say that dynamically-typed languages are more flexible. Is this necessarily true, and how does it affect syntax? **I am only asking about syntactic flexibility.** (PHP is also dynamically typed and it does **not** seem more flexible than Java/C#, as far as I've seen. Again, I mean in terms of syntax, not in t...
[ 0.0212460495531559, -0.17469458281993866, 0.1553705334663391, 0.19758561253547668, -0.36182311177253723, 0.04984235391020775, -0.19865073263645172, 0.22032658755779266, -0.5870568156242371, -0.5061999559402466, 0.12858162820339203, 0.6077914237976074, -0.09265465289354324, -0.3491110503673...
I have an application that resides in a single .py file. I've been able to get pyInstaller to bundle it successfully into an EXE for Windows. The problem is, the application requires a .cfg file that always sits directly beside the application in the same directory. Normally, I build the path using the following code:...
[ 0.2828235924243927, 0.2427278310060501, 0.5202174782752991, -0.06009087711572647, 0.07578913867473602, -0.012713685631752014, 0.17785543203353882, -0.3241977393627167, -0.21610337495803833, -0.8873522281646729, -0.15228277444839478, 0.40188223123550415, -0.5786482095718384, 0.1008819863200...
path of the currently running application so that I can find files that are relative to it? I found a solution. You need to check if the application is running as a script or as a frozen exe: ``` import os import sys config_name = 'myapp.cfg' # determine if application is a script file or frozen exe if getattr(sys, ...
[ -0.23643602430820465, -0.009561269544064999, 0.7380226850509644, -0.026159565895795822, 0.24624639749526978, 0.14112310111522675, 0.2821280360221863, -0.02575168013572693, -0.2072756141424179, -0.8668789267539978, -0.3040545880794525, 0.2843206226825714, -0.4427204430103302, 0.248160883784...
It is good practice to shift logic from the controller into the model. But in any complex system, this invariably leads to a very large file even if a majority of the methods are one liners as per the Rails Way. I've resorted to splitting up models into other modules and including them in the original model, for examp...
[ -0.16485784947872162, -0.19327718019485474, 0.21571330726146698, 0.1475050002336502, -0.2086707502603531, -0.2225673943758011, 0.2398325502872467, -0.252280592918396, -0.20656517148017883, -0.33736276626586914, -0.10280582308769226, 0.6195782423019409, -0.564854085445404, -0.22167047858238...
used to modularize behavior that's shared across models. Or, for that matter, to slim down models that have become too fat. DHH himself provides a nice, succinct example gist here: <https://gist.github.com/1014971>
[ 0.23512084782123566, -0.10071727633476257, 0.10021062940359116, -0.045679256319999695, 0.08375731855630875, 0.1280798316001892, -0.15492667257785797, -0.23425166308879852, -0.36399155855178833, -0.3369627892971039, -0.13188865780830383, 0.3874480426311493, -0.3010326027870178, -0.127566933...
``` public class CovariantTest { public A getObj() { return new A(); } public static void main(String[] args) { CovariantTest c = new SubCovariantTest(); System.out.println(c.getObj().x); } } class SubCovariantTest extends CovariantTest { public B getObj() { return ...
[ -0.013385644182562828, 0.03643261268734932, 0.280555784702301, -0.32867178320884705, 0.16917729377746582, 0.06454912573099136, 0.6104996800422668, -0.29464641213417053, -0.2759634256362915, -0.271433025598526, -0.6574438810348511, 0.5845193266868591, -0.7423710227012634, 0.3811414837837219...
x = 6; } ``` The above code prints 5 when compiled and run. It uses the covariant return for the over-ridden method. Why does it prints 5 instead of 6, as it executes the over ridden method getObj in class SubCovariantTest. Can some one throw some light on this. Thanks. This is because in Java member variables do...
[ -0.08793757855892181, 0.049605756998062134, 0.000027963280444964767, -0.2293097823858261, -0.10979252308607101, 0.018912093713879585, 0.45336630940437317, -0.26336443424224854, -0.23156049847602844, -0.27521979808807373, -0.13058747351169586, 0.3909571170806885, -0.5714768767356873, 0.1250...
It seems like I will be needing transaction with MySQL and I have no idea how should I manage transactions in Mysql with mixed InnoDB/MyISAM tables, It all seems like a huge mess. You might ask why would I ever want to mix the tables together... the anwer is PERFORMANCE. as many developers have noticed, InnoDB tables ...
[ -0.12856726348400116, 0.11802993714809418, 0.17989481985569, 0.1584242731332779, -0.29517436027526855, -0.20987552404403687, 0.12140481919050217, 0.15314683318138123, -0.3761261999607086, -0.7360683083534241, 0.1629141867160797, 0.4661392867565155, -0.20890992879867554, 0.0519612692296505,...
but InnoDB can actually be faster in many cases with normal OLTP queries. InnoDB is harder to tune since it has more knobs, but a properly tuned InnoDB system can often have higher throughput than MyISAM due to better locking and better I/O patterns.
[ -0.6203734874725342, 0.021139152348041534, 0.44786059856414795, 0.15317939221858978, -0.15208002924919128, 0.15842504799365997, 0.5036831498146057, -0.26993077993392944, 0.048779115080833435, -0.7291813492774963, -0.12557008862495422, 0.4575466513633728, -0.3121351897716522, 0.040407102555...
I've been programming in C-derived languages for a couple of decades now. Somewhere along the line, I decided that I no longer wanted to write: ``` if (var) // in C if ($var) # in Perl ``` when what I meant was: ``` if (var != 0) if (defined $var and $var ne '') ``` I think part of it is that I have a strong...
[ 0.20620828866958618, 0.40235841274261475, 0.02183634415268898, -0.31153956055641174, -0.2705787122249603, 0.03088698349893093, 0.43387702107429504, 0.258184552192688, -0.06183362007141113, -0.22443068027496338, 0.1802832931280136, 0.666767418384552, -0.27690258622169495, -0.059319309890270...
are your preferences and why? I like my `if`s to make sense when read aloud: ``` if (is_it_happening) ... if (number_of_sheep != 0) ... if (pointer_to_something != NULL) ... ```
[ 0.4210087060928345, 0.11291965842247009, 0.24435287714004517, -0.24855579435825348, 0.1671062558889389, -0.03621524199843407, 0.10336162149906158, 0.08245289325714111, -0.013139523565769196, -0.6536589860916138, 0.08859916776418686, 0.32318219542503357, -0.3081847131252289, 0.0606307424604...
I am starting, and loving, TDD, however wondering about the red green light concept. I do understand in theory the importance of ensuring you can fail a test before passing it. In practice, however, I am finding it somewhat a futile practice. I feel I can't properly write a failing or passing test without implementing...
[ 0.4327799081802368, 0.07561133801937103, 0.2928410470485687, -0.10633844137191772, -0.22198089957237244, -0.20844011008739471, 0.2841162383556366, 0.0361141636967659, 0.13931961357593536, -0.5223713517189026, -0.022481052204966545, 0.6277024149894714, 0.05460567772388458, -0.00113741506356...
from an empty method, something that seems meaningless, as I feel a red light should show that I can create a failed test from the actual logical that I am testing. In other words, if I just return null or false, from a function I am testing to get my fail what is really the value of the red light. However if I have...
[ -0.04480411484837532, -0.07209444791078568, 0.038772378116846085, 0.15274104475975037, -0.2834028899669647, 0.15707075595855713, 0.47082823514938354, -0.22262047231197357, 0.06354908645153046, -0.26996952295303345, -0.15560437738895416, 0.44360172748565674, -0.26904192566871643, 0.03830233...
getting a Red light instead of a Green, and then switching them to the opposite to get the Pass. I am not having a go at the concept, I am really posing this question as it is something I have noticed and am wondering if I am doing something wrong. **EDIT** I accepted Charlie Martin's answer, as it worked best for m...
[ 0.5734360814094543, 0.25199493765830994, 0.29500868916511536, -0.12029383331537247, -0.3569512665271759, 0.07749833911657333, 0.263459175825119, -0.10683255642652512, -0.18800798058509827, -0.24234236776828766, 0.1119021624326706, 0.4968230724334717, -0.04460868239402771, -0.26418495178222...
"what should the code I eventually want be able to do?" So, say you want to write a function that adds natural numbers. How would you know if that worked? Well, you know that 2+2=4, so you can write a test (this is basically python but leaves out a lot of details, see the [unittest module docs](http://docs.python.org/l...
[ 0.39465245604515076, -0.11928631365299225, -0.007031898479908705, 0.026349522173404694, -0.1529737412929535, 0.05542604997754097, 0.28471753001213074, -0.6028615236282349, 0.06536756455898285, -0.4250514507293701, -0.0650436207652092, 0.8311741352081299, -0.1609426736831665, -0.27503716945...
test. But then there are some other things you know; since it's for natural numbers only (for whatever reason), you need to add a guard against unnatural numbers: ``` def testUnnatural(self): failUnlessRaises(AssertionErrof, addNat(-1, 2)) ``` Now you've added a specification that says "and throw an AssertionErr...
[ 0.4496990740299225, 0.03967970982193947, 0.08060513436794281, -0.040230412036180496, -0.13606837391853333, -0.15902069211006165, 0.8033990859985352, -0.6084288954734802, 0.3264658451080322, -0.3999316096305847, -0.06177903339266777, 0.8248213529586792, -0.09989119321107864, -0.160366117954...
something like "addNat" they're not needed, but real code, especially in an agile world, you *don't* know the answer intuitively. TDD helps you sort that and fid the real requirements,
[ 0.41230252385139465, -0.25810080766677856, -0.19095826148986816, 0.38741153478622437, 0.05876469984650612, -0.21573321521282196, 0.38728806376457214, -0.1525401920080185, 0.07710103690624237, -0.5936038494110107, -0.39042314887046814, 0.6965193748474121, -0.05805951729416847, -0.6979740262...
How to create a java.awt.Image from image data? Image data is not pure RGB pixel data but encoded in jpeg/png format. JavaME has a simple api Image.createImage(...) for doing this. ``` public static Image createImage(byte[] imageData, int imageOffset, i...
[ 0.1763240545988083, -0.14583921432495117, 0.17953017354011536, 0.09069368988275528, -0.20504982769489288, 0.08288375288248062, 0.07624513655900955, -0.32367509603500366, 0.025758134201169014, -0.8824266791343689, -0.11450718343257904, 0.310855507850647, -0.5722830891609192, -0.139542922377...
- the array of image data in a supported image format. Is there anything similar to this available in JavaSE? ``` import java.awt.*; Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.createImage(imageData,imageOffset,imageLength); ```
[ 0.31986644864082336, -0.15265057981014252, 0.2902897894382477, 0.07808578759431839, -0.3090711832046509, 0.0996122807264328, 0.04319893568754196, -0.20883223414421082, -0.18554487824440002, -0.8764853477478027, -0.28049951791763306, 0.6164689660072327, -0.5619930028915405, -0.0697548612952...
I want to be able to pass an "array" of values to my stored procedure, instead of calling "Add value" procedure serially. Can anyone suggest a way to do it? am I missing something here? Edit: I will be using PostgreSQL / MySQL, I haven't decided yet. As Chris pointed, in PostgreSQL it's no problem - any base type (li...
[ 0.4748245179653168, 0.35071948170661926, -0.012038043700158596, -0.17273588478565216, -0.2656111717224121, 0.22447514533996582, 0.22060845792293549, -0.32912296056747437, -0.1930808573961258, -0.6077803373336792, 0.23847998678684235, 0.38616713881492615, -0.4168839156627655, -0.03285841271...
row(1,2)::test, row(3,4)::test, row(5,6)::test ]; ``` You can write a function that will multiply n\*m for each item in array, and return sum of products: ``` CREATE OR REPLACE FUNCTION test_test(IN work_array test[]) RETURNS INT4 as $$ DECLARE i INT4; result INT4 := 0; BEGIN FOR i IN SELECT...
[ 0.3352988064289093, 0.057736579328775406, 0.15449337661266327, -0.36644014716148376, 0.04199445992708206, 0.5213847160339355, 0.4112853407859802, -0.7555510401725769, 0.04755663499236107, -0.46593335270881653, -0.2281969040632248, 0.31108638644218445, -0.49663951992988586, 0.19228664040565...
ARRAY[ row(1, 2)::test, row(3,4)::test, row(5,6)::test ] ); test_test ----------- 44 (1 row) ```
[ 0.013616258278489113, 0.32873183488845825, 0.038975149393081665, -0.3016320466995239, 0.21939623355865479, 0.2727440893650055, 0.23879292607307434, -0.47317206859588623, -0.012844345532357693, -0.3096190392971039, 0.01741332747042179, 0.40322762727737427, -0.35176700353622437, 0.1119227707...
I'm getting a "FormatException: Input string was not in a correct format" error that I don't understand. I'm using the following lines to write a string to a text file: ``` using (StreamWriter sw = new StreamWriter(myfilename, false, System.Text.Encoding.GetEncoding(enc))) { sw.Write(mystring, Environment.NewLine...
[ 0.18295890092849731, 0.061710745096206665, 0.6000794768333435, -0.19616273045539856, 0.10113473981618881, -0.20890706777572632, 0.5892040133476257, 0.0007609350141137838, -0.017519712448120117, -0.8709495067596436, -0.05396795645356178, 0.5559540390968323, -0.2673204839229584, 0.2367790192...
characters there might be causing the problem but how do I know? The one thing I tried was to insert the following line just before the sw.Write statement above: ``` System.Console.WriteLine(mystring); ``` and it wrote out to the console just fine - no error. Help? Thanks! (and Happy New Year!) -Adeena The overl...
[ -0.032977718859910965, 0.13056005537509918, 0.5064356327056885, -0.15820157527923584, -0.1244787722826004, 0.3129086494445801, 0.33331695199012756, 0.18296298384666443, -0.09040027856826782, -0.42426997423171997, -0.1729750782251358, 0.5932088494300842, 0.06089426577091217, 0.1163076087832...
Something like `.//div[@id='foo\d+]` to capture div tags with `id='foo123'`. I'm using .NET, if that matters. As other answers have noted, **[XPath 1.0](http://www.w3.org/TR/xpath) does not support regular expressions**. **Nonetheless, you have the following options**: * **Use an XPath 1.0 expression** (note the [**...
[ 0.1934126317501068, 0.021278994157910347, 0.7431133389472961, -0.002973993541672826, -0.08032453060150146, -0.22378773987293243, 0.4113609790802002, -0.21178309619426727, -0.06964761018753052, -0.5936279892921448, -0.3461860120296478, 0.8025908470153809, -0.4261583089828491, -0.00922874640...
used are: [**`regexp:match()`**](http://exslt.org/regexp/functions/match/index.html), [**`regexp:replace()`**](http://exslt.org/regexp/functions/replace/index.html) and [**`regexp:test()`**](http://exslt.org/regexp/functions/test/index.html) * **Use** [**XPath 2.0**](http://www.w3.org/TR/xpath20/)/[XSLT 2.0](http://www...
[ -0.16995611786842346, -0.18338678777217865, 0.315583735704422, -0.0312839038670063, -0.33133628964424133, 0.05965801328420639, -0.0041940598748624325, -0.3827536404132843, -0.20062875747680664, -0.23770083487033844, -0.5891565084457397, 0.5834439396858215, -0.40836623311042786, -0.29706540...
I've got a custom site page in Windows SharePoint Services 3.0 that contains an SPGridView. When I use the search box on this page, I get the following error: ``` Unable to validate data. at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, In...
[ -0.034082457423210144, 0.19899296760559082, 0.4726789891719818, -0.2586490213871002, -0.07455139607191086, -0.15866482257843018, 0.6050750017166138, -0.0932733416557312, -0.25605708360671997, -0.8532084822654724, -0.038797177374362946, 0.5873631238937378, -0.2322230339050293, 0.35468420386...
I have one other custom site page in this feature (which doesn't include an SPGridView), but I can use the search box on that page without causing an error. OK, I finally figured out what the problem was (in my particular case, anyway): I was specifying the DataKeyNames attribute of the SPGridView. After removing that ...
[ -0.13960716128349304, -0.05172039195895195, 0.40636590123176575, -0.08815358579158783, -0.20501630008220673, -0.2259972095489502, 0.4886256456375122, -0.02530859410762787, -0.2735659182071686, -0.5631563663482666, 0.19560517370700836, 0.6587573289871216, -0.27585160732269287, 0.24512538313...
Inspired by this [question](https://stackoverflow.com/questions/404899/scope-of-variables-in-a-delegate) I began wondering why the following examples are all illegal in c#: ``` VoidFunction t = delegate { int i = 0; }; int i = 1; ``` and ``` { int i = 0; } int i = 1; ``` I'm just wondering if anyone knew th...
[ 0.7987909317016602, 0.19046418368816376, -0.20454512536525726, -0.11795295774936676, 0.086161769926548, -0.7123472690582275, 0.4324081242084503, -0.22293777763843536, -0.41891491413116455, -0.1045878678560257, 0.12040088325738907, 0.4445154666900635, -0.6554307341575623, 0.4148816764354706...
any expression that > occurs as the body of an anonymous > function in the form of a > lambda-expression creates a > declaration space which contains the > parameters of the anonymous function. > It is an error for two members of a > local variable declaration space to > have the same name. It is an error for >...
[ -0.03682701662182808, 0.05756417289376259, -0.10815822333097458, 0.036163125187158585, -0.08791382610797882, -0.159193217754364, 0.6373041868209839, -0.28719040751457214, 0.20455755293369293, -0.6148860454559326, -0.27777519822120667, 0.3263552486896515, -0.5839911699295044, 0.118209585547...
a local variable > or constant with the same name as a > local variable or constant in an > enclosing declaration space. I think the easier way to read this is that for the purpose of variable declaration (and many other block related functions) a lambda/anonymous delegate block are treated no different than a norm...
[ 0.3322448432445526, -0.03889600187540054, 0.1052124947309494, 0.3112923800945282, -0.20554451644420624, -0.26913726329803467, 0.13734818994998932, -0.07180327922105789, -0.2308957576751709, -0.22868472337722778, 0.037815552204847336, 0.5232322812080383, -0.43197759985923767, 0.327332109212...
to analyze the block for semantical errors and name resolution. This is particularly important when you consider variable lifting. Lambdas will eventually be a different function but they still have access to all in scope variables at the declaration point.
[ 0.33480700850486755, -0.15985193848609924, 0.057240139693021774, 0.16078801453113556, -0.2825292646884918, -0.2389211505651474, 0.28492286801338196, -0.21302011609077454, -0.30075526237487793, -0.3566000461578369, -0.2838567793369293, 0.5927918553352356, -0.2708737254142761, -0.03489065170...
On iPhone, I perform a HTTP request using NSURLRequest for a chunk of data. Object allocation spikes and I assign the data accordingly. When I finish with the data, I free it up accordingly - however instruments doesn't show any data to have been freed! My theory is that by default HTTP requests are cached, however - ...
[ -0.15483872592449188, 0.2686060965061188, 0.2980097234249115, -0.1191241592168808, 0.16794703900814056, 0.1290678232908249, 0.6400040984153748, -0.17914830148220062, -0.27861300110816956, -0.586876392364502, -0.17561662197113037, 0.44939592480659485, -0.3862769603729248, -0.266569584608078...