text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I use the following code to save Chinese characters into a .txt file, but when I opened it with Wordpad, I couldn't read it. ``` StringBuffer Shanghai_StrBuf = new StringBuffer("\u4E0A\u6D77"); boolean Append = true; FileOutputStream fos; fos = new FileOutputStream(FileName, Append); for (int i = 0;i < Shanghai_StrBu...
[ 0.04109349101781845, 0.35310590267181396, 0.2989627718925476, -0.38992294669151306, 0.11516252905130386, 0.11985281854867935, 0.299712598323822, -0.32582083344459534, -0.05997956916689873, -0.9116501212120056, -0.043736040592193604, 0.5083058476448059, -0.2893366515636444, -0.1715809404850...
angle-bracket taxes, there are reasons XML is popular) * The default encoding for Windows is still an 8bit (or doublebyte) "[ANSI](http://blogs.msdn.com/oldnewthing/archive/2004/05/31/144893.aspx)" character set with a limited range of values - text files written in this format are not portable * To tell a Unicode file...
[ 0.27439701557159424, 0.0822582095861435, 0.6659632921218872, -0.06495384871959686, 0.06431899219751358, 0.26206085085868835, -0.33594629168510437, -0.5227177143096924, -0.04804912954568863, -0.2829992473125458, -0.13192854821681976, 0.6388475894927979, -0.14967283606529236, -0.383338004350...
on the marker bytes to automatically figure out that it is Unicode (though you'll note that Notepad has an encoding option on its open/save dialogs). * It is wrong to say that Java is broken because it does not write a UTF-8 BOM automatically. On Unix systems, it would be an error to write a BOM to a script file, for e...
[ -0.004075522068887949, 0.21636471152305603, 0.30811625719070435, -0.055247627198696136, 0.10949905216693878, -0.21237094700336456, 0.3872227668762207, -0.014809319749474525, -0.38082441687583923, -0.7453447580337524, -0.39410892128944397, 0.2921103239059448, -0.24297155439853668, -0.130100...
appending UTF-8 data to a file: ``` private static void writeUtf8ToFile(File file, boolean append, String data) throws IOException { boolean skipBOM = append && file.isFile() && (file.length() > 0); Closer res = new Closer(); try { OutputStream out = res.using(new FileOutputStream(file, appen...
[ 0.0058210063725709915, -0.10328667610883713, 0.6536513566970825, -0.43671485781669617, 0.1372094452381134, 0.28677430748939514, 0.39640679955482483, -0.6905894875526428, -0.10143529623746872, -0.47550317645072937, -0.30414557456970215, 0.5440317988395691, -0.6593422889709473, 0.17246134579...
} writer.write(data); } finally { res.close(); } } ``` Usage: ``` public static void main(String[] args) throws IOException { String chinese = "\u4E0A\u6D77"; boolean append = true; writeUtf8ToFile(new File("chinese.txt"), append, chinese); } ``` Note: if the file already exis...
[ 0.026397503912448883, 0.34336531162261963, 0.407924622297287, -0.3952818512916565, 0.04456125944852829, -0.044295553117990494, 0.4423026144504547, -0.36153444647789, 0.0795678123831749, -0.6245766878128052, -0.302237868309021, 0.5314179062843323, -0.4035002887248993, 0.3675394058227539, ...
private Closeable closeable; public <T extends Closeable> T using(T t) { closeable = t; return t; } @Override public void close() throws IOException { if (closeable != null) { closeable.close(); } } } ``` This code makes a Windows-style best guess about how to read the file based on by...
[ -0.08989987522363663, 0.15604045987129211, 0.7655256390571594, -0.4047642946243286, 0.29465505480766296, 0.16026067733764648, 0.08524096757173538, -0.40438342094421387, 0.25516170263290405, -0.3730343282222748, -0.5750357508659363, 0.5676090717315674, -0.581933319568634, 0.0500795766711235...
for (Charset encodings : UTF_ENCODINGS) { byte[] bom = "\uFEFF".getBytes(encodings); in.mark(bom.length); for (byte b : bom) { if ((0xFF & b) != in.read()) { in.reset(); continue charsetLoop; } } return encodings; } return Charset.defaultCharset(...
[ -0.06752578169107437, -0.18349677324295044, 0.46624886989593506, -0.48038285970687866, 0.31268665194511414, 0.2641271650791168, 0.3701897859573364, -0.45136958360671997, -0.2510525584220886, -0.46782833337783813, -0.6319800615310669, 0.6433220505714417, -0.4422096610069275, -0.148229047656...
private static String readText(File file) throws IOException { Closer res = new Closer(); try { InputStream in = res.using(new FileInputStream(file)); InputStream bin = res.using(new BufferedInputStream(in)); Reader reader = res.using(new InputStreamReader(bin, getEncoding(bin))); String...
[ -0.27392274141311646, -0.2731776833534241, 0.868781328201294, -0.18037880957126617, -0.07001693546772003, 0.4601840674877167, 0.38320010900497437, -0.5842528343200684, 0.2240809202194214, -0.6286952495574951, -0.344601571559906, 0.6765105724334717, -0.38357359170913696, 0.2655363082885742,...
res.close(); } } ``` Usage: ``` public static void main(String[] args) throws IOException { System.out.println(readText(new File("chinese.txt"))); } ``` (System.out uses the default encoding, so whether it prints anything sensible depends on your platform and [configuration](http://illegalargumentexc...
[ -0.12009680271148682, 0.029103951528668404, 0.18724194169044495, -0.32543283700942993, 0.3045327961444855, 0.11281196773052216, 0.28847700357437134, -0.2274094521999359, -0.2949562966823578, -0.3258811831474304, -0.3692342936992645, 0.6978326439857483, -0.5478374361991882, 0.08755255490541...
Autoboxing seems to come down to the fact that I can write: ``` Integer i = 0; ``` instead of: ``` Integer i = new Integer(0); ``` So, the compiler can automatically convert a primitive to an Object. Is that the idea? Why is this important? You kind of simplified it a little too much. **Autoboxing also come...
[ 0.2651311755180359, -0.07048337906599045, -0.09986146539449692, -0.2543242275714874, -0.24019061028957367, 0.02269512601196766, 0.15016378462314606, -0.3031705319881439, -0.3939458727836609, -0.5040079355239868, -0.07830023765563965, 0.8449093699455261, -0.7883017063140869, -0.555216729640...
need an int, you must unbox the Integer using the intValue method. All of this boxing and unboxing is a pain, and clutters up your code. The autoboxing and unboxing feature automates the process, eliminating the pain and the clutter. > > > So when should you use autoboxing and unboxing? Use them only when there is a...
[ 0.19334791600704193, 0.05953828617930412, -0.08074747771024704, 0.06287860125303268, -0.3419201374053955, 0.2598930597305298, 0.3517245054244995, -0.49114298820495605, 0.017784686759114265, -0.6160275340080261, 0.0053441510535776615, 0.9704447984695435, -0.32175466418266296, -0.15874300897...
for an int; autoboxing and unboxing blur the distinction between primitive types and reference types, but they do not eliminate it. [Great overview of Autoboxing](http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html)
[ -0.022182224318385124, -0.020655158907175064, -0.235969677567482, -0.4851992428302765, -0.25118300318717957, 0.46304991841316223, 0.3028821051120758, -0.13745369017124176, -0.32304301857948303, -0.3781910538673401, -0.2655103802680969, 0.6715983748435974, -0.6157639622688293, -0.5583764314...
Given an alternation like `/(foo|foobar|foobaz)/` does Perl 5.8 or 5.10 make any promises about which of the three will be used first, and if it does where in the documentation does it make that promise? See the related question [Does Perl 6 make any promises about the order alternations will be used?](https://stackov...
[ 0.17680902779102325, 0.042229365557432175, 0.1240827813744545, -0.21587233245372772, -0.18001967668533325, 0.10614871233701706, 0.2976106107234955, -0.6571373343467712, -0.08707951009273529, -0.14192822575569153, -0.24894969165325165, 0.5332844257354736, -0.7123204469680786, -0.18317984044...
implementation. > > > Another description starts with notions of "better"/"worse" > > > Again, for elementary pieces there is no such question, since at most one match at a given position is possible. This section describes the notion of better/worse for combining operators. In the description below S and T are reg...
[ -0.21414633095264435, -0.14553436636924744, 0.021479306742548943, -0.14340506494045258, -0.39143696427345276, -0.059468064457178116, 0.3094564974308014, -0.6069682836532593, -0.05855034291744232, -0.7582715153694153, -0.36347121000289917, 0.2567194104194641, -0.29155033826828003, -0.270832...
Is it possible to declare anonymous implementations of things like Delegates in Objective-C. I think I have the terminology right, but here's a java example: ``` myClass.addListener(new FancyInterfaceListener({ void onListenerInterestingAction(Action a){ ....interesting stuff here } }); ``` So for ex...
[ 0.12666235864162445, 0.048485323786735535, -0.02319423481822014, -0.05718797817826271, 0.031191186979413033, -0.3030717670917511, 0.31400176882743835, -0.06547952443361282, -0.26865315437316895, -0.34081292152404785, 0.19893087446689606, 0.3559538424015045, -0.5488919019699097, -0.01139819...
sure: ``` -(void)deleteItem:(int)indexToDelete{ UIActionSheet *confirm = [[UIActionSheet alloc] initWithTitle:@"Delete Item?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil]; [confirm showInView:self.view]; [confirm release]; } ``` and the UIActionSheetDe...
[ 0.2850930988788605, -0.010628373362123966, 0.8266048431396484, -0.042669497430324554, 0.3043477237224579, -0.32939285039901733, 0.34482541680336, -0.2917599081993103, 0.05961998924612999, -0.33746621012687683, 0.008000270463526249, 0.8103253245353699, -0.4063888192176819, 0.096859380602836...
currently. Apple has published some work on their efforts to add blocks (really more like lambda closures than anonymous classes) to the language. You would likely be able to do something similar to the anonymous delegate with those. In the mean time, most Cocoa programmers add the delegate methods to a separate categ...
[ -0.005806456785649061, 0.10981590300798416, 0.3552764356136322, -0.11724113672971725, -0.11016252636909485, -0.0077343229204416275, 0.37238168716430664, -0.1743699610233307, -0.5047061443328857, -0.73491370677948, -0.4040243625640869, 0.27405813336372375, -0.4739825129508972, 0.04216014966...
[[Settings sharedSettings] removeItemAtIndex:/*need index variable here*/]; [drinksTable reloadData]; } } @end ``` Xcode's method popup in the editor window will separate the category's declaration and implementation from the main class'.
[ 0.009373919107019901, 0.16934815049171448, 0.6238935589790344, -0.2438584417104721, 0.10995571315288544, -0.10076488554477692, 0.3587842881679535, -0.1797967255115509, 0.022877374663949013, -0.3008993864059448, -0.5365287661552429, 0.38189220428466797, -0.5837000012397766, 0.27904593944549...
I am creating a web application using Netbeans and servlets. I have used some css into my pages. Is there a way how I can put the banner and menu which every servlet will have in one place so I do not need to rewrite this in every servlet? Thank you With facelets this would be cake. Since you are using servlets, try m...
[ 0.5538354516029358, 0.008912201039493084, 0.08518625795841217, -0.11703107506036758, 0.031828004866838455, -0.0020047195721417665, 0.1832132339477539, -0.3644730746746063, 0.08072102069854736, -0.9769241213798523, -0.22058996558189392, 0.2717520594596863, -0.5930593609809875, 0.16347137093...
write getHeader(); write getMenu(); write getBody(); } } class SamplePage extends Template { getBody() { //put body HTML here } } ``` Then each child will be templated by Template.
[ 0.4847525358200073, -0.1648140847682953, 0.40795961022377014, -0.1410313993692398, 0.0947670191526413, 0.027487313374876976, 0.2520454227924347, -0.4206492304801941, 0.22126664221286774, -0.6581714153289795, -0.21098028123378754, 0.33425506949424744, -0.37298762798309326, -0.17420248687267...
I am working on a library where we want to determine how much of our library is being used. I.E. we want to know how many methods in our library are public, but never being called. Goal: Static Analysis Determine how many lines of code call each public method in package A in the current project. If the number of calls...
[ 0.4943675100803375, -0.056202735751867294, -0.017374997958540916, 0.1390475630760193, -0.2380966693162918, -0.22866679728031158, 0.02687045931816101, -0.12348383665084839, -0.24203896522521973, -0.567934513092041, -0.03934280201792717, 0.6302028298377991, -0.160491481423378, -0.13240806758...
of fields, which can be final On Larger scale, if you want to do Object Level Static Analysis, look at this tool from IBM -->[Structural Analysis for Java](http://www.alphaworks.ibm.com/tech/sa4j). It is really helpful for object analysis of libraries, APIs, etc.
[ 0.3300057649612427, -0.024132881313562393, -0.08146612346172333, -0.11492332816123962, -0.12090826034545898, -0.15590599179267883, -0.03863281011581421, -0.054294977337121964, -0.4098373055458069, -0.23108923435211182, -0.0053764996118843555, 0.21818102896213531, -0.5781405568122864, 0.067...
I have a model object which did not have a counter cache on it before and I added it via a migration. The thing is, I tried and failed to set the starting value of the counter cache based on the number of child objects I already had in the migration. Any attempt to update the cache value did not get written to the data...
[ 0.23144176602363586, 0.07761801779270172, 0.3584233224391937, 0.2736963927745819, 0.09172934293746948, 0.42528069019317627, 0.3683340549468994, -0.05859167128801346, -0.32525134086608887, -0.5204652547836304, 0.4282084107398987, 0.2723962962627411, -0.16354112327098846, 0.6048725247383118,...
counter cache (as it should), and removing the ":counter\_cache => true" from the child would let me update the value on the parent. But that's cheating. I needed to be able to add the counter cache and then set its starting value to the number of children in the migration so I could then start with correct values for ...
[ 0.3744949698448181, 0.12976543605327606, 0.017527364194393158, 0.05944942310452461, -0.13002711534500122, 0.091141477227211, 0.4714563190937042, -0.2941139340400696, -0.1341271996498108, -0.6927134394645691, 0.29235807061195374, 0.27904078364372253, -0.04154898598790169, 0.4525804817676544...
is also a good resource: <http://railscasts.com/episodes/23-counter-cache-column>
[ -0.35772937536239624, -0.4978736639022827, 0.3246566951274872, 0.3096623420715332, -0.06725503504276276, 0.012808718718588352, 0.48912084102630615, 0.40390923619270325, -0.5304292440414429, -0.441344290971756, -0.1710478514432907, -0.06364133954048157, 0.20309212803840637, 0.22344011068344...
I have run into some code and was wondering what the original developer was up to. Below is a simplified program using this pattern: ``` #include <stdio.h> int main() { char title[80] = "mytitle"; char title2[80] = "mayataiatale"; char mystring[80]; /* hugh ? *...
[ 0.20190556347370148, 0.33800822496414185, 0.3098877966403961, -0.41434648633003235, 0.27560243010520935, 0.005700647830963135, 0.6292970776557922, -0.1579206883907318, -0.026400743052363396, -0.37638983130455017, -0.33851101994514465, 0.6654072999954224, 0.06985612958669662, 0.328734576702...
printf("%s\n",mystring); /* Output is "mytitle" */ /* hugh ? */ sscanf(title2,"%[^a]",mystring); /* Output is "m" */ printf("%s\n",mystring); return 0; } ``` The [man page for scanf](https://linux.die.net/man/3/scanf) has relevant information, but I'm having trouble reading it. What is t...
[ 0.157155379652977, 0.14455008506774902, 0.2724129855632782, -0.3304747939109802, -0.03963670879602432, -0.0010411519324406981, 0.27671730518341064, -0.24316507577896118, -0.19469529390335083, -0.6937874555587769, -0.41498783230781555, 0.5168578028678894, -0.23803777992725372, 0.21987362205...
and you quite often don't want it to. In that case, the character class notation can be extremely helpful. Consider this code to read a line of up to 10 characters, discarding any excess, but keeping spaces: ``` #include <ctype.h> #include <stdio.h> int main(void) { char buffer[10+1] = ""; int rc; while ...
[ 0.2517596483230591, -0.03448251634836197, 0.48477357625961304, -0.33068472146987915, 0.21954666078090668, 0.22081977128982544, 0.32799211144447327, -0.31873154640197754, -0.2095397412776947, -0.28180626034736633, -0.4163335859775543, 0.47819870710372925, -0.2568468749523163, -0.08920674771...
if (rc >= 0) printf("buffer = <<%s>>\n", buffer); buffer[0] = '\0'; } printf("rc = %d\n", rc); return(0); } ``` This was actually example code for a discussion on comp.lang.c.moderated (circa June 2004) related to `getline()` variants. --- At least some confusion reigns. ...
[ -0.3483230471611023, -0.1905788630247116, 0.4692414104938507, -0.180087149143219, -0.05632905662059784, 0.47551512718200684, -0.10550191253423691, -0.25612589716911316, -0.288882315158844, -0.38711023330688477, -0.27414268255233765, 0.3899734914302826, -0.32560303807258606, 0.0819043517112...
with a trailing null. The second format specifier, `%*[^\n]` contains the assignment suppression character (`*`) and reads zero or more remaining non-newline characters from the input. When the `scanf()` function completes, the input is pointing at the next newline character. The body of the loop reads and prints that ...
[ -0.020765630528330803, -0.2513813078403473, 0.6273584961891174, -0.2583962380886078, 0.24889618158340454, 0.24095770716667175, 0.09057209640741348, -0.06767446547746658, -0.11938740313053131, -0.3860747814178467, -0.49098730087280273, 0.21160264313220978, -0.3225817084312439, 0.14647786319...
Forgive me if this has been asked before; I did a search but couldn't find anything that specifically answered this question, but I'd be happy to be referred. I'm taking a peek at both the Entity Framework and LINQ to SQL, and while I like the systems (and of course the LINQ integration) I'm a little skeptical on the ...
[ 0.5560877919197083, 0.07133098691701889, 0.25071874260902405, 0.19616106152534485, -0.07524317502975464, -0.44357478618621826, -0.10991981625556946, -0.34176933765411377, -0.2790473401546478, -0.37473922967910767, 0.24120844900608063, 0.39827239513397217, -0.29197192192077637, 0.0773032829...
reflection to get/set my entity properties. This seems like a comparatively expensive operation, especially when all of the code is generated anyway and could implement the interfaces. Does anyone have any insight into this? Is reflection used to get/set the value of the properties? If yes, does this have a performanc...
[ 0.7429344058036804, -0.017957985401153564, 0.16087272763252258, 0.2714154124259949, -0.46586957573890686, -0.07414446026086807, 0.20195947587490082, 0.017155561596155167, -0.09478781372308731, -0.6110970377922058, 0.35027968883514404, 0.7915244698524475, 0.245603546500206, -0.0077536264434...
didn't have a LINQ to SQL project up, I did inspect a simple Entity Framework entity query result, and it did not appear to implement `ITypedList`. Does anyone know if I'm just looking at something incorrectly, or if not why this is the case? **Edit 2** After accepting Marc's answer, I thought it might be helpful for...
[ 0.12043051421642303, -0.04594719782471657, 0.31794440746307373, -0.013945544138550758, -0.009675895795226097, -0.08638972043991089, 0.2377883940935135, -0.06034905090928078, -0.20877911150455475, -0.522543728351593, 0.14522980153560638, 0.44852936267852783, -0.28620338439941406, 0.12474538...
{ if (type.GetCustomAttributes(typeof(System.Data.Linq.Mapping .TableAttribute), true) != null) { System.ComponentModel.TypeDescriptor.AddProvider( new Hyper.ComponentModel.HyperTypeDescriptionProvider( System.ComponentModel.TypeDescriptor.GetP...
[ -0.3126929700374603, -0.2442694902420044, 1.0179401636123657, 0.06762918084859848, 0.19342197477817535, 0.0953180193901062, 0.2671016752719879, -0.41191262006759644, -0.20228242874145508, -0.42726486921310425, -0.505148708820343, 0.5027018189430237, -0.5565145015716553, 0.2050255984067917,...
type)), type); } } } ``` While this is for LINQ to SQL, I'm sure an equivalent version could be written for the Entity Framework. This will scan the assembly for any types with the `Table` attribute and add a custom provider for each of them. The Expression API that underpins LINQ etc is ...
[ 0.21582558751106262, -0.043767113238573074, 0.5048625469207764, 0.1219446063041687, -0.12207241356372833, -0.3295484483242035, -0.2059437483549118, -0.4108547866344452, -0.08421256393194199, -0.06802093237638474, -0.012212294153869152, 0.6060839891433716, -0.45184245705604553, -0.059703316...
Instead, the contents are inferred from the `T` in `IQueryable<T>`, `IEnumerable<T>` and `IList<T>` etc. The closest you might get is `IListSource`, but that will still just be a shallow wrapper around a proper typed list. If performance of runtime binding (to `PropertyDescriptor`) is key, you might want to look at [...
[ 0.346397340297699, -0.10429852455854416, 0.2209666669368744, 0.2765624523162842, -0.09721234440803528, -0.2876153588294983, 0.12190843373537064, -0.6021642684936523, -0.05185700207948685, -0.5806111097335815, -0.2414279282093048, 0.45055264234542847, -0.3591226637363434, 0.0318230018019676...
huge reflection cost. And likewise, with LINQ-to-Objects everything is *already* compiled (by the C# compiler).
[ 0.2057352513074875, 0.2441043257713318, 0.08556831628084183, 0.21484613418579102, -0.18028958141803741, -0.11667417734861374, 0.2131028026342392, 0.030974363908171654, -0.32009604573249817, -0.5299164652824402, -0.2783757448196411, 0.5521954298019409, -0.027325820177793503, -0.351967990398...
I'm afraid of varargs. I don't know what to use them for. Plus, it feels dangerous to let people pass as many arguments as they want. What's an example of a context that would be a good place to use them? *Varargs* are *useful* for any method that needs to deal with an *indeterminate number of objects*. One good ex...
[ 0.12551425397396088, 0.26258498430252075, 0.2993294894695282, -0.18323862552642822, -0.43194183707237244, 0.17795225977897644, 0.6077243685722351, -0.5253856778144836, -0.24565505981445312, -0.4229501783847809, 0.21773667633533478, 0.5250722765922546, -0.4846349358558655, -0.05672885850071...
I am having a heck of a time calling a RESTful service from within silverlight. I am encountering this error: ``` {System.Security.SecurityException ---> System.Security.SecurityException: Security error. at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.BrowserHt...
[ -0.0417298823595047, 0.22109608352184296, 0.2603231370449066, -0.30930471420288086, -0.10994849354028702, -0.04205646365880966, 0.7737152576446533, -0.2745116055011749, -0.12312828004360199, -0.6742733716964722, -0.3593386113643646, 0.5409265756607056, -0.5008122324943542, 0.19244024157524...
<policy> <allow-from http-request-headers="*"> <domain uri="*" /> </allow-from> <grant-to> <resource path="/" include-subpaths="true" /> </grant-to> </policy> </cross-domain-access> </access-policy> ``` and I have watched the silverlight in fiddler and ...
[ 0.39902177453041077, 0.09510263800621033, 0.7840815782546997, 0.1576552540063858, 0.00862081442028284, -0.3355618119239807, 0.0630030557513237, -0.30981481075286865, -0.02440479025244713, -0.38625508546829224, -0.059220343828201294, 0.10208476334810257, 0.10655000060796738, 0.3754102885723...
back. ``` public void login(string userName, string password) { WebClient client = new WebClient(); Uri uri = new Uri(serverURI + "/clientaccesspolicy.xml"); client.OpenReadCompleted += new OpenReadCompletedEventHandler(login_Complete); client.OpenReadAsync(uri)...
[ -0.24247784912586212, -0.04971693456172943, 0.6356859803199768, -0.09264317899942398, 0.034718867391347885, 0.1534620076417923, 0.20911574363708496, 0.08449597656726837, -0.32027575373649597, -0.7637108564376831, -0.6165253520011902, 0.4736744463443756, -0.3256242871284485, 0.4734625816345...
{ byte[] buffer = new byte[e.Result.Length]; //crashes here with exception ... } ``` I am more or less out of ideas. Anybody know what I'm doing wrong? Is there some issue with running the silverlight directly from a file:// uri? **Update:** I deleted the clientaccesspolicy.xml file ...
[ 0.678686797618866, 0.4615222215652466, 0.58721923828125, -0.12930548191070557, -0.18370023369789124, -0.3112691640853882, 0.5883232951164246, -0.10626406222581863, -0.24944767355918884, -0.4575780928134918, 0.262323796749115, 0.38288524746894836, -0.3101242184638977, 0.2927578091621399, ...
file but I copied that directly from [microsoft](http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx). What gives? You can't request content from a website if your Silverlight application is running from a file:// URL. For more information, see [URL Access Restrictions in Silverlight](http://msdn.microsoft.co...
[ 0.5689871907234192, 0.12875834107398987, 0.47656095027923584, 0.2340400665998459, 0.07871175557374954, -0.4479580819606781, 0.17099878191947937, -0.04228285327553749, -0.481403112411499, -0.14671850204467773, -0.07187923789024353, 0.43890365958213806, -0.45591816306114197, 0.51321363449096...
This is a very newbie questions, but does the iPhone API provide any data structures to work with (i.e. linked list, hash map, etc.)? You can use **any** data structure implemented on C or C++ with iPhone SDK. For example, I use [standard library](http://en.cppreference.com/w/cpp) a lot. Besides that, you can also us...
[ 0.22695614397525787, 0.19223447144031525, 0.11651000380516052, 0.19897706806659698, 0.04904206842184067, -0.11616991460323334, 0.053921036422252655, -0.024745682254433632, -0.5216528177261353, -0.5700956583023071, -0.21473176777362823, 0.545158326625824, -0.1652027815580368, -0.22002275288...
Is there a way to have mod\_wsgi reload all modules (maybe in a particular directory) on each load? While working on the code, it's very annoying to restart apache every time something is changed. The only option I've found so far is to put `modname = reload(modname)` below every import.. but that's also really annoyi...
[ 0.3863844871520996, 0.007460683584213257, 0.32324469089508057, 0.14067497849464417, -0.01027041207998991, -0.458456426858902, 0.6201201677322388, -0.2085230052471161, -0.501756489276886, -0.47323283553123474, -0.08626293390989304, 0.5717310905456543, -0.2729814350605011, 0.0669353753328323...
I need a java data structure/solution that meets these requirements. What best fits these? 1) Object's insertion order must be kept 2) Object's must be unique (These are database objects that are uniquely identified by a UUID). 3) If a newer object with the same ID is added, the older version of the object should be...
[ 0.16566796600818634, 0.19745798408985138, 0.4308306574821472, 0.019027816131711006, 0.032691024243831635, -0.26231837272644043, 0.20957419276237488, -0.3446623682975769, -0.19893459975719452, -0.6784064769744873, -0.05039340257644653, 0.10665281116962433, -0.288131445646286, 0.506365478038...
the uniqueness and predictable ordering that you require. Then, you could wrap the resulting set to make it thread-safe: ``` Set<T> s = Collections.synchronizedSet(new LinkedHashSet<T>(...)); ``` Note: Since a Set doesn't really define a method for retrieving items from it, your code would have to manually invoke Se...
[ 0.07163411378860474, -0.21043512225151062, 0.33955395221710205, 0.004591246135532856, -0.04944082349538803, -0.24913175404071808, 0.35976049304008484, -0.5524508357048035, -0.405318021774292, -0.6248449683189392, -0.37305107712745667, 0.47027844190597534, -0.696640133857727, 0.065342269837...
// ... } // (other read methods here) // implement remaining Map methods by forwarding to inner Map public V put(K key, V value) { return m.put(key, value); } // (remaining Map methods here) } ``` Finally, wrap an instance of your custom Map to make it thread-safe: ``` Map<K, V> m = ...
[ -0.07324288040399551, -0.30721285939216614, 0.5889750123023987, 0.0644867792725563, 0.20700569450855255, 0.17334626615047455, 0.27361562848091125, -0.42466646432876587, -0.5039178729057312, -0.7965216040611267, -0.1101316511631012, 0.5389897227287292, -0.3499775230884552, 0.218281775712966...
I ask this for deployable reasons. As in, if I write a solution in python, I feel bound to write to 2.x due to the lack of adoption of python 3. This is a major daily concern of mine, and I want to figure out what's going on. For many of the python-based questions here, people are giving solutions that **simply do not...
[ 0.6660768985748291, 0.3351428210735321, -0.11849062144756317, -0.15530569851398468, -0.11711093038320541, -0.18208421766757965, 0.2903122901916504, -0.03953542560338974, -0.10693026334047318, -0.5961816906929016, 0.029805419966578484, 0.8100387454032898, -0.28837063908576965, 0.08856568485...
seem to refuse to upgrade. Why? **[Edit 03/10/2014: This answer is now out-of-date. Django has supported Python 3 for some time.]** **[However, it must also be noted that the django third-party packages and extensions used in many Django projects are in various stages of Python 3 compatibility implementation. More de...
[ 0.10277581214904785, 0.30624085664749146, 0.39674681425094604, -0.4213128983974457, -0.45117512345314026, -0.4211937189102173, 0.22949419915676117, -0.14990493655204773, -0.21021287143230438, -0.30528101325035095, 0.07792221009731293, 0.7428040504455566, -0.22008219361305237, -0.2242958694...
* [If I’m going to learn Python, should I learn 2.x or just jump into 3.0?](https://stackoverflow.com/questions/410609/if-im-going-to-learn-python-should-i-learn-2-x-or-just-jump-into-3-0) > * [Who’s Using Python 3.0?](https://stackoverflow.com/questions/533510/whos-using-python-3-0) > * [Python Version for a Newbie](h...
[ 0.4379042088985443, 0.005262027028948069, 0.17933428287506104, -0.15724743902683258, -0.25843870639801025, -0.3037068247795105, 0.180271178483963, -0.0517747700214386, -0.35228222608566284, -0.32453733682632446, 0.05090466886758804, 0.7012802958488464, 0.1903432160615921, -0.35509383678436...
What is the best way to use a successful WordPress sign-in attempt to authenticate to a CakePHP application? I don't want to use password synchronization, if at all possible. I'd prefer to keep all of the user details within the WordPress database tables. I've been rolling this over in my mind this weekend and can't th...
[ 0.4133177101612091, 0.013078082352876663, 0.21865956485271454, 0.14528311789035797, 0.10385432839393616, -0.08239052444696426, 0.5561831593513489, 0.017980609089136124, -0.015753349289298058, -0.7057097554206848, -0.10421191155910492, 0.3959845006465912, -0.08339651674032211, -0.0211695153...
the necessary login info to Cakephp. You'd also have to set your Auth mechanisms fields attribute, so that Cake::Auth would know to pull the user information from the Wordpress database. It could work.
[ 0.23959600925445557, -0.27891063690185547, 0.427527517080307, 0.2633736729621887, 0.10990487784147263, 0.067005455493927, 0.4044583737850189, 0.18859358131885529, -0.2603903114795685, -0.6506412625312805, -0.11710602790117264, 0.48250749707221985, 0.043900519609451294, 0.05769864469766617,...
Hi I am trying to redirect all links to any pdf file in my site to a page with a form in it that collects user info before they can proceed to download/view the pdf. Eg I want to redirect \*.pdf files in web site to request.php?file=name\_of\_pdf\_being\_redirected Where request.php is the page with the form on it a...
[ -0.027264272794127464, 0.02637115679681301, 0.9371946454048157, -0.16202957928180695, -0.4382060170173645, -0.21018783748149872, 0.4019069969654083, -0.25589391589164734, -0.09668781608343124, -0.629305362701416, 0.06418538838624954, 0.4258055090904236, -0.2645814120769501, 0.2435530424118...
when i want to let the person actually download the file my new rule is spitting the download link back to the form :-P haha so is there anyway to let it download the file once the form has been submitted and you're on download.php? You can try this: * Move your files to a folder "outside" your web root so that no one...
[ 0.8503406643867493, -0.05677793174982071, 0.2646159827709198, 0.01203581877052784, -0.14342375099658966, -0.42770466208457947, 0.1765729784965515, -0.028482487425208092, -0.299616277217865, -0.4714009165763855, 0.05079171434044838, 0.5035094022750854, 0.027175722643733025, -0.0630476176738...
if ( isset( $_SESSION[ 'OK_TO_DOWNLOAD' ] ) == false ) { header( "Location: must_fill_this_first.php" ); exit( 0 ); } header( "Content-type: application/pdf" ); // double check the above, google it as i am not sure echo file_get_contents( 'some_directory_inaccessible_thru_www/' . $...
[ -0.03697751834988594, -0.07535094767808914, 0.34018152952194214, -0.08317629247903824, 0.17599274218082428, -0.34145817160606384, 0.3563212454319, -0.10982358455657959, -0.06405474245548248, -0.4596081078052521, -0.36769983172416687, 0.3226945698261261, -0.22530294954776764, 0.017500901594...
a draft outline and needs refinement.
[ 0.12347947806119919, 0.09137576818466187, 0.16801178455352783, -0.16258583962917328, 0.2098575085401535, -0.09125564992427826, -0.03204505145549774, -0.5382139086723328, 0.2480742484331131, -0.7373665571212769, -0.14766450226306915, 0.08368437737226486, 0.14130227267742157, -0.261097729206...
I would love to use closures in Java. I have read that they may or may not make it into Java 7. But an open-source project called [functional-java](http://code.google.com/p/functionaljava/) has implemented functional features including closures. How safe would it be to use such a library in an enterprise production a...
[ 0.2521732449531555, -0.2958987355232239, 0.6022052764892578, -0.08538174629211426, 0.3535395562648773, -0.17824669182300568, 0.3525433838367462, 0.1009068414568901, -0.43114006519317627, -0.5254031419754028, 0.0836569145321846, 0.49341192841529846, -0.13861988484859467, -0.0141795799136161...
simple bog-standard Java, and there's not a lot that could go wrong. I know at least one mission-critical enterprise app that uses it in production. This application has more than a million users. Go for it.
[ 0.5157323479652405, 0.05449965223670006, 0.01813923381268978, 0.09317924082279205, 0.041758257895708084, 0.05471396818757057, 0.5522783994674683, 0.16376431286334991, -0.33620259165763855, -0.45361417531967163, 0.14187321066856384, 0.6780948042869568, -0.2865294814109802, -0.07647611945867...
I have a website in my solution, let's assume it is in a folder called /Solution/Website1. When I debug it in Visual Studio, it will come up as <http://localhost:someport/Website1>. I want it to start as <http://localhost:someport>. Is this possible? If you click on the Website1 Project then go to the Properties Window...
[ 0.04622829332947731, 0.008967037312686443, 0.6751943230628967, -0.1502479910850525, 0.011700517497956753, -0.22139602899551392, 0.27390387654304504, 0.031078405678272247, -0.3505774140357971, -1.0071073770523071, -0.20066247880458832, 0.30529651045799255, -0.09554842114448547, 0.0209909752...
There is a git command called [git-quiltimport](http://www.kernel.org/pub/software/scm/git/docs/git-quiltimport.html). Its man pages says it "Applies a quilt patchset onto the current git branch, preserving the patch boundaries, patch order, and patch descriptions present in the quilt patchset." However, it doesn't de...
[ 0.21893581748008728, -0.06362853199243546, 0.4089612066745758, -0.1177041232585907, 0.012945722788572311, 0.03734862431883812, 0.017754046246409416, -0.10779035091400146, -0.38933131098747253, -1.0519908666610718, -0.07808759063482285, 0.3969518542289734, -0.2468901127576828, 0.19767788052...
use quilt, you would probably just have to create another client to maintain the separate change sets, but you would have to patch back and forth changes that would benefit both client source trees.
[ 0.5597840547561646, -0.24332092702388763, -0.016924390569329262, -0.01452784426510334, -0.2096538096666336, 0.11992990225553513, -0.29385197162628174, -0.30556559562683105, -0.24458494782447815, -1.1642545461654663, 0.40509194135665894, 0.3564601540565491, -0.31293925642967224, 0.019440155...
I have a MS SQL DB with about 2,600 records (each one information on a computer.) I need to write a SELECT statement that selects about 400 of those records. What's the best way to do that when they don't have any common criteria? They're all just different random numbers so I can't use wildcards or anything like that...
[ 0.2753165066242218, 0.2459077090024948, 0.20714141428470612, 0.3706258535385132, -0.07225198298692703, 0.0664585754275322, 0.16202670335769653, -0.16759823262691498, -0.05327669531106949, -0.5278912782669067, 0.3532385230064392, 0.19641584157943726, -0.2540818154811859, 0.3308318257331848,...
the database to indicate this commonality. You could then select against this new column.
[ 0.19167396426200867, -0.021279124543070793, 0.24131889641284943, 0.21840541064739227, -0.04055021330714226, 0.24975544214248657, -0.25500985980033875, 0.03275669738650322, -0.0694560632109642, -0.6925168633460999, 0.2616814970970154, 0.32581406831741333, -0.27212631702423096, 0.19143560528...
How do you add a 'keyword' to the GEdit list of keywords? I basiclly want to make the printf function look like a keyword. ``` printf("Hello World\n"); ``` GEdit uses [GtkSourceView](http://projects.gnome.org/gtksourceview/) for its syntax highlighting. You should be able to find the `c.lang` file it uses to highligh...
[ -0.13717283308506012, 0.16630934178829193, 0.34861239790916443, -0.16928523778915405, -0.15336909890174866, -0.09240105748176575, 0.14596152305603027, 0.20305591821670532, -0.08377859741449356, -0.7294000387191772, -0.48603305220603943, 0.4990929067134857, -0.5784304738044739, -0.045676488...
I get the following errors when trying to compile the below code using g++. When I compile it using gcc it works fine (other than a few warnings). Any help appreciated. ``` g++ ush7.cpp ush7.cpp: In function ‘int signalsetup(sigaction*, sigset_t*, void (*)(int))’: ush7.cpp:93: error: expected unqualified-id before ‘ca...
[ -0.08528874069452286, 0.0675666481256485, 0.539520263671875, -0.38316547870635986, 0.07275084406137466, 0.334409236907959, 0.5817882418632507, -0.3762775659561157, -0.1235940083861351, -0.3054933547973633, -0.25430741906166077, 0.39179834723472595, -0.2671394348144531, -0.1438303291797638,...
‘char*’ ush7.cpp:145: error: invalid conversion from ‘void*’ to ‘char**’ ``` --- ``` int signalsetup(struct sigaction *def, sigset_t *mask, void (*handler)(int)) { struct sigaction catch; catch.sa_handler = handler; /* Set up signal structures */ def->sa_handler = SIG_DFL; catch.sa_flags = 0; def->...
[ -0.11924412101507187, -0.5332280397415161, 0.337432861328125, -0.33086761832237244, 0.0008375319303013384, 0.39304855465888977, 0.5797699689865112, -0.5249899625778198, -0.10321652889251709, -0.45631954073905945, -0.37955230474472046, 0.17552614212036133, -0.45563849806785583, -0.062360070...
(sigaction(SIGQUIT, &catch, NULL) == -1) || (sigemptyset(mask) == -1) || (sigaddset(mask, SIGINT) == -1) || (sigaddset(mask, SIGQUIT) == -1)) return -1; return 0; } ``` `catch` is a keyword in C++ but not in C. Please see my related answer C is not a proper subset of C++ [here](https:/...
[ -0.16991662979125977, -0.18213698267936707, 0.5119639039039612, 0.02248133346438408, -0.1873888075351715, -0.11642121523618698, 0.1741310954093933, -0.09360447525978088, -0.1775990128517151, -0.11740106344223022, -0.4519405663013458, 0.29572048783302307, -0.23619386553764343, -0.0849293917...
I have a jad file for a BB app which I want to run on the simulator. When I do a "Load Java Program" it looks for a cod file. How can I run a JAD file on a BB simulator? Open the BlackBerry browser, enter the web link to the JAD file in there and your application will be installed on your BlackBerry simulator.
[ 0.5396974682807922, 0.35159868001937866, -0.01758810505270958, -0.02036697417497635, 0.25467386841773987, 0.05547378584742546, 0.3386861979961395, 0.46248137950897217, -0.07652200013399124, -0.7798730731010437, 0.20712655782699585, 0.67409348487854, -0.21151363849639893, -0.040818791836500...
I have this string "1.79769313486232E+308" and am trying to convert it to a .NET numeric value (double?) but am getting the below exception. I am using `Convert.ToDouble()`. What is the proper way to do this conversion? > OverflowException: Value was either too large or too small for a Double The problem is likely due...
[ 0.13326552510261536, 0.06372867524623871, 0.3622666597366333, -0.23609809577465057, -0.15375028550624847, 0.2016339898109436, 0.450382798910141, -0.3430635631084442, -0.03818328306078911, -0.37864717841148376, 0.2386143058538437, 0.549363911151886, -0.38661321997642517, 0.01858869940042495...
should be a quick workaround, if you need to keep the string the way it is. EDIT: Of course, if you don't need to keep the string the way it is, use the [Round Trip format specifier](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#RFormatString) to produce the string in the...
[ 0.2035144567489624, -0.1794944405555725, 0.5025795698165894, -0.01586819253861904, 0.3111564517021179, -0.16488586366176605, 0.08728805184364319, -0.3135804533958435, -0.4106610417366028, -0.20270965993404388, -0.3468562960624695, 0.5454258322715759, -0.1932654231786728, -0.077856741845607...
I need to duplicate a table in MySQL, making the new table empty. That is, I need to copy only the structure of an existing table to a new one. Try the create table LIKE syntax. ``` create table users2 like users; ``` This should give you an empty table (users2) with the same structure as the original (users).
[ 0.33294153213500977, 0.32468941807746887, 0.07926320284605026, 0.047462690621614456, 0.022458814084529877, -0.16709022223949432, 0.05290396511554718, 0.21572883427143097, -0.27871260046958923, -1.0514748096466064, 0.02595006301999092, 0.4293776750564575, -0.48008379340171814, 0.06218487769...
I'm currently creating a right-click context menu by instantiating a new `JMenu` on right click and setting its location to that of the mouse's position... Is there a better way? You are probably manually calling `setVisible(true)` on the menu. That can cause some nasty buggy behavior in the menu. The `show(Component...
[ 0.34013786911964417, -0.021656028926372528, 0.6047271490097046, -0.021704521030187607, 0.1200462356209755, -0.12017594277858734, 0.14258894324302673, -0.23469038307666779, -0.2589939832687378, -0.701560914516449, -0.26417505741119385, 0.672305703163147, -0.6087805032730103, -0.060240771621...
JMenuItem anItem; public PopUpDemo() { anItem = new JMenuItem("Click Me!"); add(anItem); } } ``` Then, all you need to do is add a custom [`MouseListener`](http://java.sun.com/javase/6/docs/api/java/awt/event/MouseListener.html) to the components you would like the menu to popup for. ``` clas...
[ -0.10490809381008148, -0.1867072582244873, 0.6365627646446228, -0.2277473658323288, 0.40249499678611755, 0.11189845204353333, 0.2527623772621155, -0.18238042294979095, -0.16966049373149872, -0.6825936436653137, -0.3704219460487366, 0.8317156434059143, -0.6309269666671753, -0.07709316909313...
{ if (e.isPopupTrigger()) doPop(e); } private void doPop(MouseEvent e) { PopUpDemo menu = new PopUpDemo(); menu.show(e.getComponent(), e.getX(), e.getY()); } } // Then on your component(s) component.addMouseListener(new PopClickListener()); ``` Of course, the tutorial...
[ 0.17476990818977356, -0.15380842983722687, 0.6689117550849915, 0.2731088101863861, 0.28366175293922424, 0.12213492393493652, 0.2668386697769165, 0.044971778988838196, -0.1610047072172165, -0.4232059121131897, -0.5550684332847595, 0.6542390584945679, -0.4331931173801422, 0.03390127792954445...
and y coordinates.
[ 0.2947082221508026, 0.23132625222206116, 0.648722767829895, 0.17086097598075867, 0.023612776771187782, 0.023950453847646713, -0.16101908683776855, 0.01801867038011551, 0.03968760743737221, -0.5499716401100159, 0.16141603887081146, -0.0646524503827095, -0.09236957877874374, 0.34260088205337...
how do i highlight the selected item (in my case, a custom user control) in a flowlayoutpanel FlowLayoutPanel is purely for layout - it has no concept of a "selected item". You might be able to add some logic to your UserControl which changes its colour when it receives focus (and changes back when it loses focus) but ...
[ 0.3187921643257141, -0.2238183170557022, 0.4774697422981262, 0.023450402542948723, 0.07463322579860687, 0.007156690116971731, -0.29514023661613464, 0.16589917242527008, -0.2645133435726166, -0.6414166688919067, -0.013695118017494678, 0.15811572968959808, -0.16315025091171265, -0.2550861835...
I want to maintain last ten years of stock market data in a single table. Certain analysis need only data of the last one month data. When I do this short term analysis it takes a long time to complete the operation. To overcome this I created another table to hold current year data alone. When I perform the analysis...
[ 0.3304714858531952, 0.09427637606859207, 0.42549416422843933, -0.03373882919549942, 0.33555179834365845, 0.13307514786720276, -0.4529508650302887, -0.2019869089126587, -0.5312960147857666, -0.2808881998062134, 0.3523589074611664, 0.26312243938446045, 0.11038243770599365, 0.5018233060836792...
separate table Is there any way to update the secondary table automatically. 3. Or we can use anything like dematerialized view or something like that to gain performance. Note: I'm using Postgresql database. You want [table partitioning](http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html). This will...
[ 0.17816247045993805, -0.20064608752727509, 0.3456602394580841, 0.2923063337802887, -0.21085993945598602, -0.10707167536020279, -0.2516457438468933, 0.09995963424444199, -0.4207710921764374, -0.763403058052063, 0.07543819397687912, 0.40532228350639343, -0.24969267845153809, 0.08933681994676...
Has anyone successfully "wrapped up" a C++ API in Java or .NET? I have an application that provides a C++ API for writing plug-ins. What I'd like to do is access that API from .NET or Java. Would I need to use COM, or are there simpler/better alternatives? If you have a very straight forward method signatures (i.e. me...
[ 0.4770110249519348, -0.08920655399560928, -0.17030146718025208, 0.22065429389476776, 0.04790812358260155, -0.16624288260936737, 0.19028711318969727, -0.2690656781196594, -0.39340823888778687, -0.4362373650074005, 0.048020169138908386, 0.6479827165603638, 0.009324879385530949, -0.2275515943...
as boost shared pointers and STL containers then it is a very different story. You will need to be really careful with memory management in this case. EDIT: It is gonna be even more interesting if the method has C++ template arguments because C++ template system is very different from C# or Java generics in that it is...
[ 0.20327264070510864, -0.21574021875858307, 0.033443551510572433, 0.30409637093544006, -0.37111639976501465, -0.2748155891895294, 0.17564421892166138, 0.08706478774547577, -0.40142545104026794, -0.27256250381469727, 0.3028543293476105, 0.6805326342582703, -0.23108264803886414, -0.0681442618...
Does anyone know what's going on with Hibernate? For a few days hibernate.org was redirecting to "jboss.org," but for the past 2-3 days it's just showing a jboss.org maintenance screen. I realize Hibernate has always been associated with JBoss, so I'm not asking about that, but I use Hibernate in multiple projects, an...
[ 0.6226306557655334, -0.1973743587732315, 0.1661614626646042, -0.058720435947179794, -0.3231775760650635, -0.5636522173881531, 0.374769389629364, 0.48886537551879883, -0.4618682861328125, -0.35035082697868347, 0.03573998808860779, 0.11808295547962189, -0.11178861558437347, 0.210399612784385...
hibernate on jboss.org is "hibernate.org" which is useless). Just curious if anyone in this community knows anything. Here are related questons that didn't really get sufficient answers: * <https://stackoverflow.com/questions/761425/whats-happening-to-hibernate-org-closed> Presumably the JBoss.org team know (it says ...
[ 0.6305633783340454, -0.09598349034786224, 0.681858479976654, 0.060561489313840866, -0.18680772185325623, -0.4690507650375366, 0.45175066590309143, 0.3005485236644745, -0.32507631182670593, -0.3438854515552521, -0.028338629752397537, 0.20879924297332764, -0.0758858323097229, 0.0768298879265...
I've tried following the PHP.net instructions for doing `SELECT` queries but I am not sure the best way to go about doing this. I would like to use a parameterized `SELECT` query, if possible, to return the `ID` in a table where the `name` field matches the parameter. This should return one `ID` because it will be uni...
[ 0.2650362253189087, -0.019339188933372498, 0.031000228598713875, 0.25330227613449097, -0.04326236620545387, -0.012516461312770844, -0.09518566727638245, -0.022883806377649307, -0.13806715607643127, -0.6322305798530579, 0.2380722165107727, 0.2508966624736786, 0.0019938545301556587, 0.311414...
data like this: ``` $db = new PDO("..."); $statement = $db->prepare("select id from some_table where name = :name"); $statement->execute(array(':name' => "Jimbo")); $row = $statement->fetch(); // Use fetchAll() if you want all results, or just iterate over the statement, since it implements Iterator ``` You insert i...
[ -0.05223698914051056, -0.038002513349056244, 0.2681189179420471, -0.1542215198278427, -0.17617306113243103, -0.12832769751548767, 0.11672041565179825, -0.5626217126846313, -0.1247595027089119, -0.49330300092697144, -0.2607349753379822, 0.5981100797653198, -0.4176536798477173, -0.1078086793...
I need to implement cover flow functionality to our iPhone application. I tried to find sample code online to get started with it, but I didn't have any luck. Can anyone tell me how to implement cover flow functionality or give me a sample? Thanks In Advance! Try FlowCover at <http://www.chaosinmotion.com/flowcover.m...
[ 0.5806717872619629, -0.10482421517372131, 0.2698271870613098, 0.09620855748653412, 0.08061635494232178, -0.21391192078590393, 0.12058605998754501, -0.04962862655520439, -0.2321610450744629, -0.6965080499649048, 0.11126664280891418, 0.5495904684066772, -0.2409517765045166, -0.19747489690780...
I'm having trouble with getting icons from resource bundle in Flex. Here's the scenario: Directory structure looks like this: ``` -ResourceManagerTest -resources -icons -icon1.png -icon2.png -icons.properties -src -MyButton.as -ResourceManagerTest.mxml ``` In icons.properties I ...
[ -0.14160317182540894, -0.07564039528369904, 0.5584759712219238, -0.27936625480651855, -0.05477287247776985, 0.3196713626384735, 0.10609278082847595, -0.3728070855140686, -0.4809672236442566, -0.9282596111297607, 0.03864748030900955, 0.7079436779022217, -0.38703611493110657, 0.0454629883170...
icon:Class; public function MyButton() { super(); icon = ResourceManager.getInstance().getClass("icons", "CIRCLE_FILLED"); } } ``` } And here is ResourceManagerTest where I define the ToggleButtonBar: ``` <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolut...
[ -0.10324477404356003, -0.0930691733956337, 0.8169627785682678, -0.2300594449043274, -0.08187972754240036, 0.35460972785949707, 0.1290743350982666, -0.4590485394001007, -0.20208865404129028, -0.48410579562187195, -0.3892771303653717, 0.7478253841400146, -0.34272709488868713, -0.037721402943...
dataProvider.push(new MyButton()); dataProvider.push(new MyButton()); tgb.dataProvider = dataProvider; } ]]> </mx:Script> <mx:ToggleButtonBar id="tgb"/> ``` Buttons do appear, however without any icons. What am I doing wrong? 1 . It's fine to compare iterators which are from the ...
[ 0.2760452926158905, -0.10349521040916443, 0.5626000165939331, -0.22289450466632843, 0.03889932855963707, 0.300042986869812, 0.2547801434993744, -0.5336593389511108, -0.39942795038223267, -0.42987391352653503, 0.1908545047044754, 0.47380921244621277, -0.5353547930717468, 0.11765343695878983...
of the for loop itself. In this for loop you compare `iter` against `sarray.end()` but the for loop never changes `iter`. This means that either there will be no iterations or the for loop will never terminate. Also, you probably want to use `!=` and not `<` for the comparison. `==` and `!=` work for all iterators, `<`...
[ -0.142015278339386, -0.3176165521144867, 0.49619993567466736, -0.5766189098358154, 0.18782956898212433, 0.09817299991846085, 0.3853554129600525, -0.42465701699256897, -0.24959544837474823, -0.5614431500434875, -0.27383482456207275, 0.4726150929927826, -0.24508963525295258, 0.41009867191314...
} ``` As `iter` starts where you want the loop to begin, you may want something like this: ``` for (; iter != sarray.end(); ++iter) { final.push_back(*iter); } ``` As you're still learning (although aren't we all!), it's probably instructive to work through an algorithm like...
[ 0.05425303429365158, -0.20580816268920898, 0.21969462931156158, -0.3773290514945984, 0.2689915597438812, -0.2757696211338043, 0.26953691244125366, -0.23539213836193085, -0.10284943878650665, -0.6420648694038391, -0.321460485458374, 0.4256998300552368, -0.203757181763649, 0.0599156394600868...
farray.end(), sarray.begin(), sarray.end(), std::back_inserter( final ) ); ``` (You need to `#include <iterator>` and `<algorithm>`.) 2 . I don't see incrementing iter or it in the outer for loop invalidating the logic in the later for loops, the point in 1. aside. 3 . `end()` points to one past the end of a contai...
[ 0.012851309031248093, -0.23421216011047363, 0.362321138381958, -0.2847408056259155, 0.40294215083122253, -0.24670270085334778, 0.03462972864508629, -0.29327020049095154, 0.09968078136444092, -0.2291448563337326, 0.12605494260787964, 0.4560443162918091, -0.21424084901809692, 0.1747544258832...
I have a Read generic function that does its job very well. It reads from a buffer of bytes and returns the specific type ``` public static T Read<T>() { // An T[] would be a reference type, and a lot easier to work with. T[] t = new T[1]; // Marshal.SizeOf will fail with types of unknown size. Try and se...
[ 0.2505702078342438, -0.014816178940236568, 0.1769547313451767, -0.05995747819542885, -0.12850752472877502, -0.18240374326705933, 0.34204477071762085, -0.37184029817581177, -0.013998598791658878, -0.5608755350112915, -0.07914964854717255, 0.2971741259098053, -0.35024315118789673, 0.37214115...
throw new Exception("Error 101 Celebrity"); // Grab a handle of the array we just created, pin it to avoid the gc // from moving it, then copy bytes from our stream into the address // of our array. GCHandle handle = GCHandle.Alloc(t, GCHandleType.Pinned); Marshal.Copy(dataRead, index, handle.AddrO...
[ 0.34255343675613403, 0.05065827816724777, 0.4505673944950104, -0.09316959232091904, 0.07578714936971664, -0.06328871846199036, 0.3545227348804474, -0.5049821138381958, -0.1491466909646988, -0.4199083149433136, -0.17515796422958374, 0.5444343090057373, -0.5033105611801147, 0.061624582856893...
// An T[] would be a reference type, and a lot easier to work with. T[] t = new T[1]; // Marshal.SizeOf will fail with types of unknown size. Try and see... int s = Marshal.SizeOf(typeof(T)); if (index + s > size) // Should throw something more specific. throw new Exception("Error 101 C...
[ 0.47432103753089905, -0.1083100214600563, 0.3148018419742584, 0.09838756173849106, 0.043315354734659195, -0.23669026792049408, 0.38866299390792847, -0.571235716342926, -0.31720882654190063, -0.3230834901332855, -0.11620405316352844, 0.45222556591033936, -0.4329427182674408, 0.0329332686960...
// from moving it, then copy bytes from our stream into the address // of our array. GCHandle handle = GCHandle.Alloc(dataWrite, GCHandleType.Pinned); Marshal.Copy(t, index, handle.AddrOfPinnedObject(), s); // ?? Problem index += s; } ``` "t" should be byte[] array. How do I accomplish that? It's a l...
[ 0.3000262379646301, 0.17154350876808167, 0.30068162083625793, -0.00037287312443368137, 0.1549549251794815, 0.010678973980247974, 0.46366095542907715, -0.5067216753959656, -0.313050240278244, -0.6037094593048096, -0.10413098335266113, 0.3719739019870758, -0.3665200173854828, 0.2051481604576...
new TestStruct(); test.Bar = 100; test.Foo = 200; using (MemoryStream ms = new MemoryStream()) { using (ObjectStream os = new ObjectStream(ms, false)) { os.Write(test);
[ 0.31060031056404114, 0.006795702036470175, 0.5770955681800842, -0.32635465264320374, 0.2778306305408478, 0.3049560785293579, 0.6541944742202759, -0.3534161448478699, 0.26179683208465576, -0.6075317859649658, -0.27899518609046936, 0.4257645308971405, -0.2532258629798889, -0.0175709016621112...
} ms.Seek(0, SeekOrigin.Begin); Console.WriteLine(BitConverter.ToString(ms.ToArray())); using (ObjectStream os = new ObjectStream(ms, false)) { TestStruct result = os.Read<TestStruct>(); Console.WriteLine(result.Bar);
[ -0.10121852904558182, -0.1499992311000824, 0.8256794214248657, -0.4287042021751404, 0.5364333987236023, 0.32019609212875366, 0.5681844353675842, -0.36590683460235596, 0.24291867017745972, -0.6001123785972595, -0.45481449365615845, 0.5317801237106323, -0.42590805888175964, 0.158093407750129...
Console.WriteLine(result.Foo); } } Console.ReadLine(); } } struct TestStruct { public int Foo; public int Bar; } class ObjectStream : Stream { private Stream _backing; private bool _ownsStream = true; public ObjectStream(Stream source) :this(source, true) ...
[ 0.16827762126922607, -0.3060382604598999, 0.5944762229919434, -0.09943974018096924, 0.288499116897583, 0.022932138293981552, 0.08459299802780151, -0.07316217571496964, 0.1832411289215088, -0.4264354705810547, -0.25159752368927, 0.6711496710777283, -0.23345407843589783, 0.1612081676721573, ...
{ if (source == null) throw new ArgumentNullException("source"); _backing = source; _ownsStream = ownsStream; } public override bool CanRead { get { return _backing.CanRead;
[ 0.09428107738494873, -0.2687378525733948, 0.3889760971069336, -0.1590050756931305, 0.31960171461105347, -0.09728178381919861, 0.3472098708152771, -0.17002108693122864, 0.020595304667949677, -0.1936357617378235, -0.445325642824173, 0.6327729225158691, -0.13584139943122864, 0.166947275400161...