text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
figured out, is to send 1 query that returns something akin to the results of an in(), but returns a duplicate entry id for each token matches for each entry id checked. Is there a better way to do this than what I'm doing, of using multiple, individual queries running one query per token? If so, what's the easiest way to implement those? **edit** I've already tokenized the entries, so, for example, "see spot run" has an entry id of 1, and three tokens, 'see', 'spot', 'run', and those are in a separate token table, with entry ids relevant to them
[ 0.3877151310443878, -0.1983928382396698, 0.335582435131073, 0.19505178928375244, -0.15984737873077393, 0.1702372431755066, 0.13221584260463715, -0.3071669042110443, -0.17095321416854858, -0.7894783020019531, 0.14071685075759888, 0.07722384482622147, -0.3524150252342224, -0.1231855675578117...
so the table might look like this: ``` 'see', 1 'spot', 1 'run', 1 'run', 2 'spot', 3 ``` you could achive this in one query using 'UNION ALL' in MySQL. Just loop through the tokens in PHP creating a UNION ALL for each token: e.g if the tokens are 'x', 'y' and 'z' your query may look something like this ``` SELECT * FROM `entries` WHERE token like "%x%" union all SELECT * FROM `entries` WHERE token like "%y%" union all SELECT * FROM `entries`
[ 0.14627249538898468, -0.09985747933387756, 0.22145643830299377, 0.11191241443157196, -0.14863485097885132, 0.18097123503684998, -0.3294980227947235, -0.18095290660858154, -0.20864368975162506, -0.7681962847709656, 0.1430070698261261, -0.14237092435359955, -0.419217973947525, 0.104956097900...
WHERE token like "%z%" ORDER BY score ect... ``` The order clause should operate on the entire result set as one, which is what you need. In terms of performance it won't be all that fast (I'm guessing), however with databases the main overhead in terms of speed is often sending the query to the database engine from PHP and receiving the results. With this technique this only happens once instead of once per token, so performance will increase, I just don't know if it'll be enough.
[ 0.016718482598662376, 0.09529979526996613, 0.010585751384496689, 0.19097842276096344, -0.055957067757844925, -0.014603488147258759, 0.09793224930763245, -0.16179496049880981, -0.21026627719402313, -0.6075440645217896, 0.10554243624210358, 0.4486112892627716, -0.1674986332654953, -0.0265931...
Simple one really. In SQL, if I want to search a text field for a couple of characters, I can do: ``` SELECT blah FROM blah WHERE blah LIKE '%text%' ``` The documentation for App Engine makes no mention of how to achieve this, but surely it's a common enough problem? BigTable, which is the database back end for App Engine, will scale to millions of records. Due to this, App Engine will not allow you to do any query that will result in a table scan, as performance would be dreadful for a well populated table. In other words, every query must use an index.
[ -0.11169560998678207, 0.12560738623142242, 0.2727692723274231, 0.1756778210401535, -0.036265596747398376, 0.09835926443338394, 0.07354860752820969, -0.10233909636735916, -0.517912745475769, -0.6039045453071594, -0.008745508268475533, 0.3895477056503296, -0.4584019184112549, -0.122492969036...
This is why you can only do `=`, `>` and `<` queries. (In fact you can also do `!=` but the API does this using a a combination of `>` and `<` queries.) This is also why the development environment monitors all the queries you do and automatically adds any missing indexes to your `index.yaml` file. There is no way to index for a `LIKE` query so it's simply not available. Have a watch of [this Google IO session](http://sites.google.com/site/io/under-the-covers-of-the-google-app-engine-datastore) for a much better and more detailed explanation of this.
[ 0.21664123237133026, 0.2869511544704437, 0.22914057970046997, 0.15981312096118927, -0.004929014947265387, -0.27890533208847046, 0.40792667865753174, 0.20242813229560852, -0.2718450725078583, -0.7486655116081238, -0.17504669725894928, 0.6989461183547974, -0.3274008631706238, 0.1275616586208...
I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty? I would suggest something like:- ``` bool nonEmptyDataSet = dataSet != null && (from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any(); ``` **Edits:** I have significantly cleaned up the code after due consideration, I think this is much cleaner. Many thanks to Keith for the inspiration regarding the use of .Any(). In line with Keith's suggestion, here is an extension method version of this approach:- ``` public static class ExtensionMethods { public static bool IsEmpty(this DataSet
[ 0.24539320170879364, 0.06058449670672417, 0.26862379908561707, -0.07527807354927063, 0.024990685284137726, -0.2754691243171692, 0.38777557015419006, -0.05742573365569115, -0.2342279553413391, -0.6573781967163086, -0.10929378867149353, 0.5354481339454651, -0.46776869893074036, 0.36524090170...
dataSet) { return dataSet == null || !(from DataTable t in dataSet.Tables where t.Rows.Count > 0 select t).Any(); } } ``` Note, as Keith rightly corrected me on in the comments of his post, this method will work even when the data set is null.
[ -0.05089924857020378, -0.1679265797138214, 0.31109899282455444, -0.13384635746479034, 0.017127176746726036, -0.34876787662506104, 0.4285958707332611, -0.12940818071365356, -0.12916018068790436, -0.45365557074546814, -0.2284826934337616, 0.5452185869216919, -0.4655747711658478, -0.069358430...
What is the most efficient way to determine how many comments a particular blog post has? We want to store the data for a new web app. We have a list of permalink URl's as well as the RSS feeds. If I understand correctly, you want a heuristic to estimate the number of comments in an HTML page which is known to be a blog post, yes? Very often, a specific blog will have some features which make it easy to work out. If you look at mine over at <http://kstruct.com/> you'll see that all the pages with comments say 'X Responses',
[ 0.7675598859786987, 0.03919728100299835, 0.4365997314453125, 0.3369458317756653, -0.29455724358558655, -0.09887012094259262, 0.1777593046426773, 0.36558690667152405, -0.2621178925037384, -0.48717406392097473, 0.2447017878293991, 0.31414493918418884, -0.14077098667621613, 0.1727733463048935...
so if you were able to do some work on a per blog basis, it's probably not really difficult. If you needed something generic, I guess there are a few common features that comments have that you might be able to detect. For one, any links in them are quite likely to have rel="nofollow" attributes, so seeing that within a block might imply that it's a comment. The main interesting thing to look for would be changes in the structure of posts for m the same site. For example, there's also a very good chance that each comment will have its
[ 0.797554612159729, 0.016533056274056435, 0.2901386022567749, 0.20912469923496246, -0.3026407063007355, -0.2572694420814514, 0.2633116841316223, 0.42957448959350586, -0.5936774611473083, -0.4090404510498047, 0.02892315946519375, -0.03946803882718086, -0.20103581249713898, 0.4080793857574463...
own anchor so people can link directly to it, so you could look at the differing numbers of <a name="XXX"> tags in a given page on the same site to get an idea of the relative numbers of comments. As Michael Stum pointed out, if the pages have a Comment-RSS feed, your life is made a lot easier because you can get the comment data in a structured format. All in all, though, I think it's going to be quite a challenging problem to solve in general.
[ 0.6659011840820312, 0.04242141544818878, 0.3692266345024109, 0.17175203561782837, -0.2796303927898407, -0.15936098992824554, -0.12374629080295563, 0.2727939188480377, -0.49059879779815674, -0.2622131407260895, 0.017237264662981033, 0.18652866780757904, -0.1634853184223175, -0.2443780899047...
I'm trying to install 'quadrupel', a library that relies on ffmpeg on Solaris x86. I managed to build ffmpeg and its libraries live in /opt/gnu/lib and the includes are in /opt/gnu/include but when I try to build quadrupel, it can't find the ffmpeg headers. What flags/configuration is required to include those two directories in the proper search paths for libraries and includes? I'm not much of a Makefile hacker. You can override the path by setting the environmental variable LD\_LIBRARY\_PATH. However I would suggest changing the system paths as well so you don't have to change the library path for all users. This
[ 0.5578171610832214, -0.05973110347986221, 0.0908065214753151, 0.23563848435878754, -0.2362900674343109, -0.3193417191505432, 0.3113262951374054, -0.140807643532753, -0.14640358090400696, -0.7102643847465515, -0.020953986793756485, 0.6791041493415833, -0.7526710629463196, 0.1195061802864074...
can be done using crel. ``` crle -l -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/opt/gnu/lib ``` For the includes just add -I/opt/gnu/include to your CFLAGS variable.
[ 0.43559497594833374, 0.22220538556575775, 0.560041606426239, -0.03255022317171097, 0.02120036818087101, -0.3784216642379761, -0.16287322342395782, -0.25363993644714355, -0.14254212379455566, -0.6011109948158264, -0.07781139761209488, 0.8483597636222839, -0.43980905413627625, -0.11497807502...
For general protocol message exchange, which can tolerate some packet loss. How much more efficient is UDP over TCP? UDP is faster than TCP, and the simple reason is because its non-existent acknowledge packet (ACK) that permits a continuous packet stream, instead of TCP that acknowledges a set of packets, calculated by using the TCP window size and round-trip time (RTT). For more information, I recommend the simple, but very comprehensible [Skullbox explanation (TCP vs. UDP)](http://www.skullbox.net/tcpudp.php)
[ -0.08747449517250061, -0.24687793850898743, 0.43194183707237244, 0.07365725189447403, -0.259917676448822, -0.47427406907081604, 0.15227992832660675, -0.18608403205871582, -0.4859437048435211, -0.6691310405731201, 0.01902422122657299, 0.38724517822265625, -0.4050014317035675, 0.171253874897...
I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why having 2 files is better than 1). What strategies should I use for organizing my code? Is it possible to separate "public" functions from "private" ones for a particular file? [This](https://stackoverflow.com/questions/47878/codereview-tiny-encryption-algorithm-for-arbitrary-sized-data) question precipitated my inquiry. The tea.h file makes no reference to the
[ 0.27907660603523254, 0.06696240603923798, 0.04135917127132416, 0.21061000227928162, 0.1705716848373413, -0.10316696017980576, -0.013653556816279888, -0.25755494832992554, -0.4361642599105835, -0.46965938806533813, -0.10680297762155533, 0.08628735691308975, -0.33458536863327026, 0.090626724...
tea.c file. Does the compiler "know" that every .h file has a corresponding .c file? You should regard .h files as **interface files** of your .c file. Every .c file represents a module with a certain amount of functionality. If functions in a .c file are used by other modules (i.e. other .c files) put the function prototype in the .h interface file. By including the interface file in your original modules .c file and every other .c file you need the function in, you make this function available to other modules. If you only need a function in a certain
[ 0.35744184255599976, 0.0009216833859682083, 0.686488687992096, 0.024472950026392937, 0.009313387796282768, -0.2779039144515991, -0.12975546717643738, -0.485635906457901, -0.4488351047039032, -0.5515831112861633, -0.12460163980722427, 0.12831471860408783, -0.3297143578529358, 0.322788566350...
.c file (not in any other module), declare its scope static. This means it can only be called from within the c file it is defined in. Same goes for variables that are used across multiple modules. They should go in the header file and there they have to marked with the keyword 'extern'. Note: For functions the keyword 'extern' is optional. Functions are always considered 'extern'. The inclusion guards in header files help to not include the same header file multiple times. For example: Module1.c: ``` #include "Module1.h" static void MyLocalFunction(void); static unsigned int
[ 0.4021306335926056, -0.25006166100502014, 0.4794853627681732, -0.18215496838092804, 0.010326803661882877, -0.33530759811401367, 0.1412716507911682, -0.20793893933296204, -0.241454616189003, -0.33261072635650635, -0.39719289541244507, 0.5643337368965149, -0.6188584566116333, 0.2807046771049...
MyLocalVariable; unsigned int MyExternVariable; void MyExternFunction(void) { MyLocalVariable = 1u; /* Do something */ MyLocalFunction(); } static void MyLocalFunction(void) { /* Do something */ MyExternVariable = 2u; } ``` Module1.h: ``` #ifndef __MODULE1.H #define
[ -0.05258343741297722, -0.1952400654554367, 0.7599160075187683, -0.07142836600542068, 0.5526590347290039, 0.031741540879011154, 0.036223236471414566, 0.0621868260204792, 0.05250534415245056, -0.5592069625854492, -0.38409608602523804, 0.728999674320221, -0.183461993932724, 0.1255331337451934...
__MODULE1.H extern unsigned int MyExternVariable; void MyExternFunction(void); #endif ``` Module2.c ``` #include "Module.1.h" static void MyLocalFunction(void); static void MyLocalFunction(void) { MyExternVariable = 1u; MyExternFunction(); } ```
[ -0.07377283275127411, -0.01948361285030842, 0.81465083360672, -0.2423122376203537, 0.48197779059410095, -0.08238733559846878, 0.3564307391643524, -0.3294811248779297, 0.007394459098577499, -0.44456884264945984, -0.555790364742279, 0.8682672381401062, -0.45599332451820374, 0.167126178741455...
I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect: > The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate. --- Note: The details of original question have been removed, as this page has turned into a repository for all information about possible causes of that particular error message. For general information on submitting iPhone applications to the App Store, see [Steps to upload an iPhone application to the AppStore](https://stackoverflow.com/questions/796482/steps-to-upload-an-iphone-application-to-the-appstore). It's been my experience that Xcode occasionally gets confused about which signing certificate to
[ 0.4619233012199402, 0.519291877746582, 0.35610032081604004, -0.0193735770881176, 0.11798331886529922, -0.08167073130607605, 0.4714554250240326, -0.2640222907066345, -0.33101633191108704, -0.5752197504043579, -0.10035012662410736, 0.524745762348175, -0.3627417981624603, -0.0738460123538971,...
use. I got into the habit of quitting and restarting Xcode after any change to the code signing settings (and doing a clean build) to work around this problem.
[ 0.8373870253562927, 0.49008023738861084, -0.08798548579216003, -0.10302439332008362, -0.04755057767033577, -0.2079618275165558, 0.28213682770729065, 0.035013262182474136, 0.4222080409526825, -0.7657958269119263, 0.015610456466674805, 0.3542516529560089, -0.5195388793945312, 0.1324514746665...
I'm researching and experimenting more with Groovy and I'm trying to wrap my mind around the pros and cons of implementing things in Groovy that I can't/don't do in Java. Dynamic programming is still just a concept to me since I've been deeply steeped static and strongly typed languages. Groovy gives me the ability to [duck-type](http://en.wikipedia.org/wiki/Duck_typing), but I can't really see the value. How is duck-typing more productive than static typing? What kind of things can I do in my code practice to help me grasp the benefits of it? I ask this question with Groovy in mind but I understand
[ 0.2618308365345001, 0.07892167568206787, 0.014301416464149952, -0.010851793922483921, -0.02575484663248062, 0.10076221823692322, 0.01615961641073227, 0.32105928659439087, -0.19367153942584991, -0.44713491201400757, 0.3331940472126007, 0.42946961522102356, -0.3189810514450073, -0.2036809921...
it isn't necessarily a Groovy question so I welcome answers from every code camp. Next, which is better: EMACS or vi? This is one of the running religious wars. Think of it this way: any program that is *correct*, will be correct if the language is statically typed. What static typing does is let the compiler have enough information to detect type mismatches at compile time instead of run time. This can be an annoyance if your doing incremental sorts of programming, although (I maintain) if you're thinking clearly about your program it doesn't much matter; on the other hand, if you're
[ 0.5362338423728943, 0.46340927481651306, 0.07386012375354767, 0.1732376217842102, -0.3905506432056427, -0.000695890630595386, 0.4746842384338379, 0.3691706955432892, -0.16386695206165314, -0.5599706172943115, -0.11191388219594955, 0.7265235781669617, 0.0027907334733754396, 0.11744485795497...
building a really big program, like an operating system or a telephone switch, with dozens or hundreds or thousands of people working on it, or with really high reliability requirements, then having he compiler be able to detect a large class of problems for you without needing a test case to exercise just the right code path. It's not as if dynamic typing is a new and different thing: C, for example, is effectively dynamically typed, since I can always cast a `foo*` to a `bar*`. It just means it's then my responsibility as a C programmer never to use code
[ 0.4742090106010437, 0.20488621294498444, -0.23258070647716522, 0.19733141362667084, 0.061097484081983566, -0.22125104069709778, 0.37678906321525574, 0.24772155284881592, -0.5191318392753601, -0.30532804131507874, -0.128694549202919, 0.5917818546295166, -0.25621896982192993, -0.137653753161...
that is appropriate on a `bar*` when the address is really pointing to a `foo*`. But as a result of the issues with large programs, C grew tools like lint(1), strengthened its type system with `typedef` and eventually developed a strongly typed variant in C++. (And, of course, C++ in turn developed ways around the strong typing, with all the varieties of casts and generics/templates and with RTTI. One other thing, though --- don't confuse "agile programming" with "dynamic languages". [Agile programming](http://agilemanifesto.org/) is about the way people work together in a project: can the project adapt to changing requirements to
[ 0.14877302944660187, 0.008837861940264702, -0.1489795297384262, -0.05926630273461342, -0.2107612043619156, -0.12370812892913818, 0.0474347248673439, -0.12607699632644653, -0.25696510076522827, -0.34898364543914795, -0.07445194572210312, 0.534980833530426, -0.5531144738197327, -0.2248285561...
meet the customers' needs while maintaining a humane environment for the programmers? It can be done with dynamically typed languages, and often is, because they can be more productive (eg, Ruby, Smalltalk), but it can be done, has been done successfully, in C and even assembler. In fact, [Rally Development](http://www.rallydev.com/) even uses agile methods (SCRUM in particular) to do marketing and documentation.
[ 0.598616898059845, 0.2581571340560913, -0.02077169343829155, 0.12786489725112915, -0.047133561223745346, -0.09807430952787399, -0.0032545600552111864, -0.0385424941778183, 0.06217411532998085, -0.07446522265672684, -0.21890629827976227, 0.7030460834503174, -0.0049472083337605, -0.526874184...
More out of interest than anything else, but can you compile a DirectX app under linux? Obviously there's no official SDK, but I was thinking it might be possible with wine. Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that? (edit: This is called winelib) Failing that, maybe a mingw cross compiler with the app running under wine. Half answered my own question here, but wondered if anyone had heard of anything like this being done? I've had some luck with this. I've managed to compile [this simple Direct3D example](http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B5.aspx). I used winelib for
[ 0.324762761592865, 0.05999959632754326, 0.2341599315404892, 0.03683698549866676, -0.3488033711910248, -0.1504615992307663, -0.004580565262585878, 0.1724158525466919, 0.0330146849155426, -0.6316156983375549, 0.2604629695415497, 0.820050060749054, -0.2821527123451233, -0.029694993048906326, ...
this (wine-dev package on Ubuntu). Thanks to [alastair](https://stackoverflow.com/users/9554/alastair) for pointing me to winelib. I modified the source slightly to convert the wchars to chars (1 on line 52, 2 on line 55, by removing the L before the string literals). There may be a way around this, but this got it up and running. I then compiled the source with the following: ``` wineg++ -ld3d9 -ld3dx9 triangle.cpp ``` This generates an a.out.exe.so binary, as well as an a.out script to run it under wine.
[ 0.10508843511343002, 0.33970025181770325, 0.39477550983428955, -0.37747642397880554, -0.32185351848602295, 0.164645254611969, 0.17192120850086212, -0.212832972407341, -0.029236018657684326, -0.5493391752243042, -0.012796834111213684, 0.3845239281654358, -0.37712883949279785, 0.048347257077...
Is there a risk of legal trouble if you include GPL or LGPL licensed icons in a closed source software? Would it force it to become open source just to include the icon? Does it matter if the icon is compiled as a resource? Are the creative common licensed icons safe to use if you follow the attribution rules specified by the license? For GPL, yes. Any GPL Code/Content that's compiled into your Application or the Package will make it GPL. (Edit: What could be safe is if the Icon is a separate file and is used. That could be a grey area,
[ 0.4264800548553467, 0.2693914771080017, 0.03863593563437462, 0.2442288100719452, 0.11194481700658798, -0.40368402004241943, 0.19570492208003998, -0.047723181545734406, -0.38087961077690125, -0.37356531620025635, -0.12484442442655563, 0.7101870775222778, -0.24735116958618164, 0.069243513047...
as you are not using GPL Code to access it. But any attempt to embed it will force your program to GPL, it's one of the most restrictive licenses out there) LGPL is fine: Any modification to LGPL Content has to be released under LGPL, but using the Code/Content is safe. Addition: Like LGPL, CreativeCommons usually only affects the Content you're using. So if you're using a CC Icon and modify it, you will have to give out the modified item under CreativeCommons, but your Application is not affected. Just mind the "Non-Commercial" Clause if it exists.
[ 0.7256618738174438, 0.1724645495414734, 0.318036824464798, 0.30938926339149475, -0.016096346080303192, -0.8794543743133545, -0.13503646850585938, 0.2483079582452774, -0.5408034324645996, -0.21394892036914825, -0.11312447488307953, 0.6726142168045044, -0.3393811881542206, 0.1873237490653991...
What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP ``` <?php $class_name = 'SomeClassName'; $object = new $class_name; ?> ``` This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement. Problems that come immediately to mind are 1. ~~You lose the ability to pass arguments into a constructor~~ (LIES. Thanks Jeremy) 2. Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?) What other implications are there, or what search engine terms other than
[ 0.4308141767978668, 0.35481274127960205, 0.06913090497255325, -0.3003566563129425, -0.14631524682044983, -0.14873996376991272, 0.412482887506485, -0.137352854013443, 0.025653664022684097, -0.40522220730781555, -0.0036948148626834154, 0.31765660643577576, -0.36413562297821045, 0.24567732214...
"Rank PHP Hackery" can someone use to research this? One of the issues with the resolving at run time is that you make it really hard for the opcode caches (like APC). Still, for now, doing something like you describe in your question is a valid way if you need a certain amount of indirection when instanciating stuff. As long as you don't do something like ``` $classname = 'SomeClassName'; for ($x = 0; $x < 100000; $x++){ $object = new $classname; } ``` you are probably fine :-) (my point being: Dynamically looking up a class here and then doesn't hurt. If you do it often, it
[ 0.1911875605583191, -0.037476375699043274, 0.170924112200737, 0.22098615765571594, -0.18090549111366272, -0.5486870408058167, 0.5722554922103882, -0.2219340056180954, -0.28400158882141113, -0.37829163670539856, 0.12233923375606537, 0.49681705236434937, -0.21851247549057007, 0.1252052038908...
will). Also, be sure that $classname can never be set from the outside - you'd want to have some control over what exact class you will be instantiating.
[ 0.20994654297828674, -0.3253268599510193, 0.1930326223373413, 0.12241218239068985, 0.3100300133228302, -0.20503179728984833, 0.20702911913394928, 0.13817085325717926, -0.02088443748652935, -0.8912838101387024, -0.2832373082637787, 0.7169024348258972, -0.1534549444913864, 0.1100395396351814...
I'm working on a project with a friend that will utilize Hbase to store it's data. Are there any good query examples? I seem to be writing a ton of Java code to iterate through lists of RowResult's when, in SQL land, I could write a simple query. Am I missing something? Or is Hbase missing something? I think you, like many of us, are making the mistake of treating bigtable and HBase like just another RDBMS when it's actually a column-oriented storage model meant for efficiently storing and retrieving large sets of sparse data. This means storing, ideally, many-to-one relationships
[ 0.19839143753051758, 0.155856192111969, -0.09028054028749466, 0.11328095197677612, -0.11579333990812302, -0.4210137128829956, -0.08964002877473831, 0.14857983589172363, -0.4057099521160126, -0.5017775297164917, 0.2876795828342438, 0.2538837194442749, -0.2280954271554947, 0.3053953349590301...
within a single row, for example. Your queries should return very few rows but contain (potentially) many datapoints. Perhaps if you told us more about what you were trying to store, we could help you design your schema to match the bigtable/HBase way of doing things. For a good rundown of what HBase does differently than a "traditional" RDBMS, check out this awesome article: [Matching Impedance: When to use HBase](http://blog.csdn.net/arthurbryant/article/details/6643933) by Bryan Duxbury.
[ 0.5311682820320129, 0.16644272208213806, -0.4020506739616394, 0.0987306535243988, -0.15037941932678223, -0.04167560860514641, 0.1649826318025589, -0.30917608737945557, -0.012521655298769474, -0.4277799725532532, -0.19800224900245667, 0.341024786233902, -0.26187995076179504, -0.236587211489...
Simply, are there any Java Developer specific Linux distros? A real Sun geek would chime in here about the virtues of using Solaris as a Java development platform, but I am much more ambivalent. Developing with Java is about the same on any linux distro; you are going to wind up having to install the JDK and tools of your choosing (Eclipse, Sun Studio, Tomcat, etc) so you may as well choose a distro on other criteria... perhaps how comfortable you are with it, how easy package management is, and if the look & feel suit your development habits are all
[ 0.34908735752105713, 0.21170569956302643, -0.19242025911808014, 0.15555688738822937, -0.18719421327114105, -0.23478811979293823, -0.03074922040104866, 0.2024013102054596, -0.16600486636161804, -0.5328253507614136, -0.22842469811439514, 0.7946426272392273, -0.24853633344173431, -0.191571503...
big factors. So, to answer your question more directly, a Java developer would do well with any major linux distro that they are comfortable with using in general. If you want some Java goodness out of the box, Fedora 9 and Ubuntu 8.04 have OpenJDK (and NetBeans) according to [a recent announcement](http://www.vnunet.com/vnunet/news/2215568/open-source-java-added-linux).
[ 0.20041890442371368, -0.06648486852645874, 0.04009665921330452, -0.11172273755073547, -0.21141664683818817, -0.2342349886894226, -0.04064464569091797, 0.21198613941669464, -0.4559423327445984, -0.5052968263626099, -0.05486192926764488, 0.6148894429206848, -0.2368451952934265, 0.02242783643...
Is there any way to get the ID of the element that fires an event? I'm thinking something like: ```js $(document).ready(function() { $("a").click(function() { var test = caller.id; alert(test.val()); }); }); ``` ```html <script type="text/javascript" src="starterkit/jquery.js"></script> <form class="item" id="aaa"> <input class="title"></input> </form> <form class="item" id="bbb"> <input class="title"></input> </form> ``` Except of course that the var `test` should contain the id `"aaa"`, if the event is fired from the first form, and `"bbb"`, if the event is fired from the second form. In jQuery `event.target` always refers to the element that triggered the event, where `event` is the parameter passed to the function. <http://api.jquery.com/category/events/event-object/> ``` $(document).ready(function() {
[ 0.30448827147483826, -0.09231636673212051, 0.006210867781192064, -0.050468217581510544, 0.0027706024702638388, -0.22259660065174103, -0.03375349938869476, -0.38089555501937866, -0.15734155476093292, -0.15971969068050385, -0.3099338710308075, 0.6252999901771545, -0.26980286836624146, -0.221...
$("a").click(function(event) { alert(event.target.id); }); }); ``` Note also that `this` will also work, but that it is not a jQuery object, so if you wish to use a jQuery function on it then you must refer to it as `$(this)`, e.g.: ``` $(document).ready(function() { $("a").click(function(event) { // this.append wouldn't work $(this).append(" Clicked"); }); }); ```
[ 0.3378904461860657, -0.13489709794521332, 0.2509906589984894, -0.3105795085430145, 0.3091488480567932, -0.30637380480766296, 0.2602495849132538, -0.22706684470176697, -0.1346084177494049, -0.30442214012145996, -0.5365318655967712, 0.8003004193305969, -0.5633383393287659, -0.015302383340895...
I know PHP scripts don't actually compile until they are run. However, say I want to create a small simple program and compile it to a binary without requiring the PHP binary. How could I do this? I've seen a few IDE's out there that would do this, but either they are all for windows or the Linux versions don't actually build properly. What I would like is something like py2exe that does it in the script itself. Check out [phc: the PHP compiler](https://github.com/pbiggar/phc) If you just want to run it like a script, you may not need to compile it per
[ 0.7948818206787109, 0.25049176812171936, -0.20103660225868225, 0.267285019159317, -0.2389620840549469, -0.3621155619621277, 0.08209174871444702, 0.23548094928264618, -0.20604307949543, -0.4962807297706604, 0.3650239109992981, 0.4276053309440613, -0.12948372960090637, -0.09533161669969559, ...
se, but just run it via the command line. [Read running PHP via the command line.](http://www.php.net/features.commandline)
[ 0.48209744691848755, 0.014158504083752632, 0.11152797192335129, -0.21244880557060242, -0.02930670790374279, -0.2774246335029602, 0.2907637655735016, -0.029006345197558403, 0.09388420730829239, -0.7333752512931824, -0.2903086543083191, 0.6182429194450378, 0.07410386204719543, -0.11524334549...
I'm planning on creating a social networking + MP3 lecture downloading / browsing / commenting / discovery website using Ruby on Rails. Partially for fun and also as a means to learn some Ruby on Rails. I'm looking for a social networking framework that I can use as a basis for my site. I don't want to re-invent the wheel. Searching the web I found three such frameworks. Which of these three would you recommend using and why? <http://portal.insoshi.com/> <http://www.communityengine.org/> <http://lovdbyless.com/> It depends what your priorities are. If you really want to learn RoR, **do it all from scratch**. Seriously. Roll your own. It's the
[ 0.8355113863945007, -0.19913315773010254, -0.023448562249541283, 0.2626376152038574, -0.08877366036176682, 0.032207414507865906, 0.10139751434326172, 0.2289934903383255, -0.19310696423053741, -0.5741024017333984, 0.19958685338497162, 0.6474398970603943, 0.16380169987678528, -0.043375458568...
best way to learn, far better than hacking through someone else's code. If you do that, sometimes you'll be learning Rails, but sometimes you'll just be learning that specific social network framework. And **you won't know which is which...** The type of site you're suggesting sounds perfect for a Rails project. If you get stuck, **then** go browse the repositories of these frameworks. Who cares if you're reinventing the wheel? It's your site, your vision, your rules. If you just want a site up and running, then I would pick Insoshi or LovdbyLess simply because they're out of the box apps so
[ 0.5331937670707703, -0.2547443211078644, -0.06090656295418739, 0.5724120140075684, 0.01869743876159191, -0.12665988504886627, 0.2416309416294098, 0.367616206407547, -0.21606169641017914, -0.8367066979408264, 0.0923997312784195, 0.6077307462692261, 0.19639255106449127, 0.006204371806234121,...
you'll have to do less to do get running. I suggest trying to install them both, and introducing yourself in the Google Groups. That'll give you a good indication of wether you're going to get along.
[ 0.5316940546035767, -0.012457873672246933, 0.26591598987579346, 0.24557720124721527, 0.09662646055221558, -0.14136256277561188, 0.44082239270210266, 0.041089218109846115, -0.3641340732574463, -0.3538157641887665, 0.19270752370357513, 0.5753096342086792, 0.16187125444412231, -0.319064676761...
I'm a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with a red square in the upper right corner of the blue square (but not tight in the corner). I am trying to avoid compositing (with ImageMagick and similar) due to performance issues. I just want to position overlapping images relative to one another. As a more difficult example, imagine an odometer placed inside a larger image. For six digits, I would need to composite a million different images,
[ 0.35946643352508545, 0.25602394342422485, 0.2315148264169693, 0.2520040273666382, -0.13961896300315857, 0.1578514277935028, -0.2820878326892853, -0.03745530545711517, -0.2590031325817108, -0.710776150226593, 0.23536966741085052, 0.2278515100479126, -0.14397598803043365, 0.03038135915994644...
or do it all on the fly, where all that is needed is to place the six images on top of the other one. Ok, after some time, here's what I landed on: ```css .parent { position: relative; top: 0; left: 0; } .image1 { position: relative; top: 0; left: 0; border: 1px red solid; } .image2 { position: absolute; top: 30px; left: 30px; border: 1px green solid; } ``` ```html <div class="parent"> <img class="image1" src="https://via.placeholder.com/50" /> <img class="image2" src="https://via.placeholder.com/100" /> </div> ``` As the simplest solution. That is: Create a relative div that is placed in the flow of the page;
[ 0.14372017979621887, -0.41743654012680054, 0.5971091389656067, 0.05214584991335869, -0.11730911582708359, 0.12060826271772385, 0.053093720227479935, -0.14408718049526215, -0.26601502299308777, -0.5438674688339233, -0.25508785247802734, 0.2797428369522095, -0.36178672313690186, -0.229977458...
place the base image first as relative so that the div knows how big it should be; place the overlays as absolutes relative to the upper left of the first image. The trick is to get the relatives and absolutes correct.
[ -0.22224102914333344, -0.17349454760551453, 0.6526529788970947, -0.02041712775826454, -0.09398607164621353, 0.07095667719841003, -0.2644977569580078, -0.2073945701122284, 0.18330399692058563, -0.6166898012161255, -0.21712076663970947, 0.8888797760009766, 0.02440068870782852, -0.10986735671...
I'm looking for a desktop/embedded database. The two candidates I'm looking at are Microsoft SQL Server CE and Oracle Lite. If anyone's used both of these products, it'd be great if you could compare them. I haven't been able to find any comparisons online. The backend DB is Oracle10g. **Update:** Clarification, the business need is a client-server app with offline functionality (hence the need for a local data store on the client) If the backend database is Oracle 10g it will probably be easier for you to use Oracle Lite - that way you don't have to use two completely different SQL dialects in
[ 0.35582512617111206, 0.3498076796531677, 0.31176796555519104, 0.03785395994782448, -0.4133310616016388, 0.2595394551753998, -0.0770379975438118, 0.046485256403684616, 0.21964043378829956, -0.7775382399559021, -0.008928921073675156, 0.44610297679901123, -0.08867358416318893, 0.4354086518287...
the same project. BTW, In my product I use SQLite as the desktop database
[ 0.3136427104473114, 0.3490407168865204, 0.21010354161262512, -0.023220930248498917, -0.1320514678955078, -0.046527888625860214, 0.0330805666744709, 0.23026354610919952, -0.08152686804533005, -0.5028857588768005, 0.21370245516300201, 0.44892531633377075, -0.07243482768535614, 0.314131438732...
I have a Linux web server farm with about 5 web servers, web traffic is about 20Mbps. We currently have a Barracuda 340 Load Balancer (keep away from this device - piece of crap!) that is acting as a firewall. I want to put in a dedicated firewall and I'd like to know what peoples opinions are on building versus buying a dedicated firewall. Main requirements: * Dynamically block rouge traffic * Dynamically rate limit traffic * Block all ports except 80, 443 * Limit port 22 to a set of IPs * High availability setup Also if we go for the build route, how do we
[ 0.39259687066078186, 0.2288026511669159, 0.69973224401474, -0.01818172074854374, 0.14864683151245117, 0.2156471461057663, 0.2940169870853424, -0.048617202788591385, -0.44625845551490784, -0.7477487325668335, 0.07694590091705322, 0.7480886578559875, -0.047842252999544144, 0.0237927883863449...
know what level traffic the system can handle. As they say - "there are more than one way to skin a cat": Build it yourself, running something like Linux or \*BSD. The benefit of this, is that it makes it easy to do the dynamic part of your question, it's just a matter of a few well-placed shell/python/perl/whatever scripts. The drawback is that your ceiling traffic rate might not be what it would be on a purpose-built firewall device, although you should still be able to achieve data rates in the 300Mbit/sec range. (You start hitting PCI bus limitations at this point)
[ 0.43293502926826477, -0.12439675629138947, 0.5708851218223572, 0.3473340570926666, 0.093182772397995, -0.33224257826805115, 0.45291486382484436, 0.17463278770446777, -0.390680193901062, -0.6231586933135986, -0.15038098394870758, 0.752077579498291, -0.17918923497200012, -0.14768177270889282...
This may be high enough to where it won't be a problem for you. Buy a dedicated "firewall device" - Possible drawbacks of doing this, is that doing the "dynamic" part of what you're trying to accomplish is somewhat more difficult - depending on the device, this could be easy (Net::Telnet/Net::SSH come to mind), or not. If you are worried about peak traffic rates, you'll have to carefully check the manufacturer's specifications - several of these devices are prone to the same traffic limitations as "regular" PC's, in that they still run into the PCI bus bandwidth issue, etc. At that
[ 0.4427807331085205, -0.2363392859697342, 0.5545673966407776, 0.5634838342666626, -0.09468291699886322, -0.28294846415519714, 0.39919257164001465, -0.10568634420633316, -0.45058467984199524, -0.8311958909034729, -0.12682867050170898, 0.5757912993431091, -0.24279585480690002, -0.144875332713...
point, you might as well roll your own. I guess you could read this more as a "pro's and con's" of doing either, if you want. FWIW, we run dual FreeBSD firewalls at my place of employment, and regularly push 40+Mbit/sec with no noticeable load/issues.
[ 0.7420066595077515, 0.3913321793079376, 0.3740898370742798, -0.030433474108576775, 0.14358988404273987, 0.046495471149683, 0.367216557264328, 0.7509035468101501, -0.09058056771755219, -0.2995785176753998, 0.24058030545711517, 0.4526440501213074, 0.2630558907985687, -0.04893965274095535, ...
Does anyone know of a similar product to Citrix Server that'll run on the Mac OS? Essentially, I'm looking to allow multiple remote users to log in to the same OSX Server at the same time (with full visual desktop, not SSH). Anyone have experience with [Aqua Connect](http://www.aquaconnect.net/?page_id=26)? Found them from Google, and they claim the next version works on RDP as well as VNC. Wondering if it's just a nice wrapper around the VNC capabilities `@Soeren Kuklau` pointed out. Thanks for the link to Vine Server, that's worth investigating.
[ 0.6313791871070862, -0.268499493598938, 0.3182846009731293, 0.014627343975007534, -0.10624510794878006, -0.12259162217378616, 0.19009193778038025, 0.26083409786224365, -0.39477184414863586, -0.7448225021362305, 0.1763349175453186, 0.5473208427429199, -0.13356031477451324, 0.142292812466621...
I've been looking into different web statistics programs for my site, and one promising one is [Visitors](http://www.hping.org/visitors/). Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's [shell\_exec](http://us.php.net/manual/en/function.shell-exec.php), but my web host ([NFSN](https://www.nearlyfreespeech.net/)) has PHP's [safe mode](http://us2.php.net/features.safe-mode) on and it's giving me an error message. Is there a way to execute the program within safe mode? If not, can it work with CGI? If so, how? (I've never used CGI before) I managed to solve this problem on my own. I put the following lines in a file named visitors.cgi: ``` #!/bin/sh printf "Content-type:
[ 0.12855646014213562, -0.03513050824403763, 0.4539697766304016, 0.061281658709049225, 0.07645934820175171, -0.2938629388809204, 0.05630667880177498, 0.21320919692516327, -0.2852579951286316, -0.5595031976699829, 0.14926326274871826, 0.4152074158191681, -0.16238395869731903, 0.25765582919120...
text/html\n\n" exec visitors -A /home/logs/access_log ```
[ -0.014978240244090557, 0.5654318332672119, 0.5923070311546326, -0.08615386486053467, 0.2499297857284546, -0.13911545276641846, 0.11690368503332138, 0.539198637008667, -0.37875989079475403, -0.7207545042037964, -0.7988048791885376, 0.22805605828762054, -0.25975731015205383, 0.17941513657569...
I am trying to publish an Asp.net MVC web application locally using the NAnt and MSBuild. This is what I am using for my NAnt target; ``` <target name="publish-artifacts-to-build"> <msbuild project="my-solution.sln" target="Publish"> <property name="Configuration" value="debug" /> <property name="OutDir" value="builds\" /> <arg line="/m:2 /tv:3.5" /> </msbuild> </target> ``` and all I get is this as a response; ``` [msbuild] Skipping unpublishable project. ``` Is it possible to publish web applications via the command line in this way? The "Publish" target you
[ 0.26318252086639404, 0.18318717181682587, 0.44868263602256775, -0.185286745429039, -0.22758547961711884, -0.03236432746052742, 0.20229658484458923, -0.06950084120035172, -0.22804555296897888, -0.7538326978683472, -0.20065118372440338, 0.4553392231464386, -0.36306032538414, 0.39266657829284...
are trying to invoke is for "OneClick" deployment, not for publishing a website... This is why you are getting the seemingly bizarre message. You would want to use the AspNetCompiler task, rather than the MSBuild task. See <http://msdn2.microsoft.com/en-us/library/ms164291.aspx> for more info on this task. Your "PublishDir" would correspond to the TargetPath property of the task. [Source](http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1032073&SiteID=1)
[ 0.4066242277622223, -0.22035366296768188, 0.2957704961299896, 0.03481762483716011, -0.09228984266519547, -0.39408478140830994, 0.43317142128944397, -0.07315517216920853, -0.12307631969451904, -0.7334554195404053, -0.3150515556335449, 0.1820097416639328, -0.9615941047668457, -0.072429485619...
I have a windows service that runs various system monitoring operations. However, when running `SNMP` related checks, I always get a `NullReference exception`. The code runs fine when run through the user interface (under my username and password), but always errors running as the service. I've tried running the service as different user accounts (including mine), with no luck. I've tried replacing the `SNMP` monitoring code with calling the `PowerShell cmdlet get-snmp` (from the `/n NetCmdlets`), but that yields the same error. The application I'm working with is [PolyMon](http://codeplex.com/polymon). Any ideas? Some ways to debug: * Is there any additional information in the
[ 0.43712013959884644, 0.21075491607189178, 0.11525508016347885, -0.015679791569709778, 0.060309797525405884, -0.20478394627571106, 0.4230205714702606, 0.2235664576292038, -0.5926774144172668, -0.7435769438743591, 0.0354309156537056, 0.5682184100151062, -0.1818229854106903, 0.30080446600914,...
Windows events log? * I believe you should be able to listen to some kind of global-exception event like Application\_Exception in windows services. I can't remember the exact name but you can atelast dump stack trace from there. * You should be able to start debugging the project in service mode. Some code snippets/stack trace/information will definitely help.
[ 0.3476995825767517, 0.01670016534626484, -0.025058118626475334, 0.25072595477104187, -0.19713054597377777, -0.44248491525650024, 0.46845653653144836, 0.4858987629413605, -0.5795961022377014, -0.6804988384246826, -0.11255960911512375, 0.48630833625793457, 0.02899639494717121, 0.110622271895...
Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first "constructed" did not seem to share a relationship. However, whenever I see architects design an application, the first thing they do is start programming to an interface. How come? How do you know all the relationships between objects that will occur within that interface? If you already know those relationships, then why not just extend an abstract class? Programming to an interface means respecting the "contract" created by using that interface. And so if your `IPoweredByMotor` interface
[ 0.22139222919940948, 0.13994166254997253, 0.01546565257012844, 0.1360308676958084, -0.14236930012702942, 0.029652638360857964, 0.3529820442199707, -0.04396398738026619, -0.14612898230552673, -0.7933266162872314, 0.059939198195934296, 0.5393745303153992, -0.3757280111312866, 0.2084926962852...
has a `start()` method, future classes that implement the interface, be they `MotorizedWheelChair`, `Automobile`, or `SmoothieMaker`, in implementing the methods of that interface, add flexibility to your system, because one piece of code can start the motor of many different types of things, because all that one piece of code needs to know is that they respond to `start()`. It doesn't matter *how* they start, just that they *must start*.
[ 0.11131487786769867, -0.3189331591129303, 0.06931790709495544, 0.5596218109130859, -0.17040497064590454, -0.10726553946733475, -0.1538853645324707, -0.02480628527700901, -0.20846198499202728, -0.6828678846359253, -0.10494393855333328, 0.4614008665084839, 0.051861945539712906, -0.1058938503...
I came across [this article](http://www.ddj.com/cpp/184403758) written by Andrei Alexandrescu and Petru Marginean many years ago, which presents and discusses a utility class called ScopeGuard for writing exception-safe code. I'd like to know if coding with these objects truly leads to better code or if it obfuscates error handling, in that perhaps the guard's callback would be better presented in a catch block? Does anyone have any experience using these in actual production code? It definitely improves your code. Your tentatively formulated claim, that it's obscure and that code would merit from a `catch` block is simply not true in C++ because
[ 0.6082608699798584, 0.4923575818538666, -0.5002469420433044, -0.013100665993988514, -0.18364553153514862, 0.14135919511318207, -0.034696534276008606, -0.5462390184402466, 0.10877030342817307, -0.3073465824127197, 0.01674148254096508, 0.2569107115268707, -0.44596555829048157, -0.01640794239...
RAII is an established idiom. Resource handling in C++ *is* done by resource acquisition and garbage collection is done by implicit destructor calls. On the other hand, explicit `catch` blocks would bloat the code and introduce subtle errors because the code flow gets much more complex and resource handling has to be done explicitly. RAII (including `ScopeGuard`s) isn't an obscure technique in C++ but firmly established best-practice.
[ 0.6120632886886597, -0.0819501131772995, -0.18824709951877594, -0.12415987998247147, -0.4411157965660095, -0.16629040241241455, 0.20396509766578674, -0.5421207547187805, -0.09214554727077484, -0.2998129725456238, -0.4585658013820648, 0.49406662583351135, -0.5855938196182251, -0.20771674811...
I've seen lots of descriptions how anonymous types work, but I'm not sure how they're really useful. What are some scenarios that anonymous types can be used to address in a well-designed program? Anonymous types have nothing to do with the design of systems or even at the class level. They're a tool for developers to use when coding. I don't even treat anonymous types as types per-se. I use them mainly as method-level anonymous tuples. If I query the database and then manipulate the results, I would rather create an anonymous type and use that rather than declare a whole new
[ 0.7948371767997742, 0.17326140403747559, -0.12592647969722748, 0.35257625579833984, -0.28261804580688477, -0.07558922469615936, 0.350784033536911, 0.492876797914505, -0.19319403171539307, -0.5370082855224609, 0.09027953445911407, 0.1949417144060135, -0.6442113518714905, 0.1358550488948822,...
type that will never be used or known outside of the scope of my method. For instance: ``` var query = from item in database.Items // ... select new { Id = item.Id, Name = item.Name }; return query.ToDictionary(item => item.Id, item => item.Name); ``` Nobody cares about `a, the anonymous type. It's there so you don't have to declare another class.
[ 0.07425928115844727, -0.11814864724874496, 0.4826035797595978, -0.23467370867729187, 0.033058132976293564, -0.24856878817081451, 0.3729667663574219, -0.08403070271015167, 0.06883327662944794, -0.5542916059494019, 0.036373745650053024, 0.4110070765018463, -0.5367806553840637, 0.532358646392...
Say I have a `Textbox` nested within a `TabControl`. When the form loads, I would like to focus on that `Textbox` (by default the focus is set to the `TabControl`). Simply calling `textbox1.focus()` in the `Load` event of the form does not appear to work. I have been able to focus it by doing the following: ``` private void frmMainLoad(object sender, EventArgs e) { foreach (TabPage tab in this.tabControl1.TabPages) { this.tabControl1.SelectedTab = tab; } } ``` **My question is:** Is there a more elegant
[ -0.040662363171577454, -0.10099957883358002, 0.6267333030700684, -0.24755261838436127, -0.17157495021820068, -0.14394164085388184, 0.12305383384227753, -0.274508535861969, -0.10585717856884003, -0.7696539759635925, -0.19624961912631989, 0.5472012162208557, -0.3071971833705902, 0.0381249338...
way to do this? The following is the solution: ``` private void frmMainLoad(object sender, EventArgs e) { ActiveControl = textBox1; } ``` The better question would however be why... I'm not entirely sure what the answer to that one is. Edit: I suspect it is something to do with the fact that both the form, and the TabControl are containers, but I'm not sure.
[ 0.031532350927591324, -0.08591531962156296, 0.32354164123535156, -0.03451651707291603, -0.04587444290518761, -0.3344586193561554, 0.41825148463249207, -0.02113456092774868, -0.18889793753623962, -0.5330649614334106, -0.17877043783664703, 0.5109553933143616, -0.5086277723312378, 0.202932044...
I am creating a windows service and want to know best practices for this. In all my windows Program I have a form that asks the user if he wants to report the error and if he answers yes I created a case in FogBugz. What should I do in a windows service. You could also have a system tray representation of the service which would show a small notification about any errors and ask the user whether they want it reported or not. I think that it is still better to be able to give the user the choice whenever
[ 0.48756644129753113, 0.34480980038642883, 0.24339568614959717, -0.10853709280490875, -0.010859108529984951, 0.007396168075501919, 0.3104131519794464, 0.22890585660934448, -0.2061845064163208, -0.625888466835022, 0.30805808305740356, 0.5411815047264099, -0.2611734867095947, 0.21327500045299...
you are sending 'out' data from their computer.
[ 0.48975348472595215, 0.07596446573734283, -0.19725987315177917, 0.2959907352924347, 0.10823462158441544, -0.10970016568899155, -0.01443990133702755, 0.22005458176136017, -0.31806501746177673, -0.37713685631752014, -0.22186420857906342, 0.23906494677066803, -0.26053586602211, 0.066098093986...
I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far: ``` drop table exams; drop table question_bank; drop table anwser_bank; create table exams ( exam_id uniqueidentifier primary key, exam_name varchar(50), ); create table question_bank ( question_id uniqueidentifier primary key, question_exam_id uniqueidentifier not null, question_text varchar(1024) not null, question_point_value decimal, constraint question_exam_id foreign key references exams(exam_id) ); create table anwser_bank ( anwser_id
[ 0.13846664130687714, 0.2904869616031647, 0.31482017040252686, -0.14672227203845978, 0.006993840914219618, -0.037603747099637985, 0.2026204615831375, -0.09372080117464066, -0.060154203325510025, -0.6986778974533081, 0.04311707988381386, 0.1900450438261032, 0.09269551187753677, 0.47038409113...
uniqueidentifier primary key, anwser_question_id uniqueidentifier, anwser_text varchar(1024), anwser_is_correct bit ); ``` When I run the query I get this error: > Msg 8139, Level 16, State 0, Line 9 > Number of referencing columns in > foreign key differs from number of > referenced columns, table > 'question\_bank'. Can you spot the error? ``` create table question_bank ( question_id uniqueidentifier primary key, question_exam_id uniqueidentifier not null, question_text varchar(1024) not null, question_point_value decimal,
[ -0.33209240436553955, 0.34307539463043213, 0.36198198795318604, 0.28295662999153137, 0.07385748624801636, 0.15503279864788055, 0.025860348716378212, -0.3650597929954529, -0.23469457030296326, -0.39386793971061707, 0.04383845999836922, 0.09311952441930771, -0.08242662250995636, 0.3054542541...
constraint fk_questionbank_exams foreign key (question_exam_id) references exams (exam_id) ); ```
[ -0.25246837735176086, 0.24550795555114746, 0.4999402165412903, 0.21255534887313843, 0.23706799745559692, 0.023876076564192772, 0.1374681293964386, -0.12276576459407806, -0.4742335081100464, -0.19343338906764984, -0.4118320047855377, 0.20245513319969177, -0.3996739983558655, 0.4032299518585...
I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called "ResponseData", so I can track exactly what my code couldn't handle. In custom exceptions such as this one, should that extra response data go into the exception "message"? If it goes there, the message could be huge. I kind of want it there because I'm using Elmah, and that's how I can get at that data. So the question
[ 0.37090277671813965, -0.09611442685127258, -0.07133213430643082, 0.09613820165395737, -0.16488181054592133, 0.008159486576914787, 0.197362020611763, -0.3461582362651825, -0.3422810435295105, -0.2625742554664612, -0.0437999963760376, 0.3766650855541229, -0.4962358772754669, -0.1787713021039...
is either: - How can I get Elmah to record extra information from a field in a custom exception OR - Should extra exception details go into the "message" property? You shouldn't fill `.Message` with debug information, but rather with a concise, helpful piece of text. <http://msdn.microsoft.com/en-us/library/system.exception.message.aspx> > **The text of Message should completely describe the error and should, when possible, explain how to correct it.** The value of the Message property is included in the information returned by ToString. > > > The Message property is set only when creating an Exception. If no message was supplied to the constructor for the current instance, the system
[ -0.07584047317504883, 0.27701711654663086, 0.03934502974152565, 0.13595566153526306, 0.04106716066598892, -0.11486265063285828, 0.2920437455177307, -0.38074374198913574, -0.11764080822467804, -0.39091068506240845, -0.41021639108657837, 0.33187150955200195, -0.39757442474365234, 0.109697222...
supplies a default message that is formatted using the current system culture. > > > [..] > > > Notes to Inheritors: > > > The Message property is overridden in classes that require control over message content or format. Application code typically accesses this property when it needs to display information about an exception that has been caught. > > > The error message should be localized. Response data does not qualify as a description. Not being familiar with elmah, I can't tell you how to extend the `Exception` class while using it. Does elmah implement its own subclass to `Exception`? Or an interface? Can
[ 0.06327701359987259, 0.1398531049489975, 0.051735322922468185, 0.06939306110143661, 0.012200785800814629, -0.2744479179382324, 0.3615460991859436, -0.1858075112104416, -0.1399494707584381, -0.7101528644561768, -0.26380443572998047, 0.3804604709148407, -0.4760865271091461, 0.191078186035156...
you subclass it yourself?
[ 0.4505308270454407, 0.25375717878341675, -0.305706262588501, 0.039486080408096313, -0.14885030686855316, -0.11495915055274963, 0.14212778210639954, -0.17063109576702118, -0.2444351315498352, -0.05106164515018463, 0.12600719928741455, 0.1559084802865982, -0.16324551403522491, 0.070502765476...
Does anybody know of a way to list up the "loaded plugins" in **Vim**? I know I should be keeping track of this kind of stuff myself but it would always be nice to be able to check the current status. Not a VIM user myself, so forgive me if this is totally offbase. But according to what I gather from the following [VIM Tips](http://rayninfo.co.uk/vimtips.html) site: ``` " where was an option set :scriptnames : list all plugins, _vimrcs loaded (super) :verbose set history? : reveals value of history
[ 0.6472105979919434, 0.12335718423128128, 0.18118348717689514, 0.1316467970609665, -0.20045122504234314, -0.24975088238716125, 0.3173401951789856, 0.22995305061340332, -0.5186646580696106, -0.3010915219783783, -0.14037415385246277, 0.6389578580856323, -0.04184578359127045, 0.174583807587623...
and where set :function : list functions :func SearchCompl : List particular function ```
[ -0.3909876048564911, -0.007422175258398056, 0.24193218350410461, -0.0895654633641243, -0.05919995903968811, -0.04847782105207443, -0.33074960112571716, -0.030187467113137245, -0.35844066739082336, -0.5485370755195618, -0.4329705536365509, 0.4062970280647278, -0.3976820707321167, 0.05202645...
I'm building an application in C# using WPF. How can I bind to some keys? Also, how can I bind to the [Windows key](http://en.wikipedia.org/wiki/Windows_key)? I'm not sure of what you mean by "global" here, but here it goes (I'm assuming you mean a command at the application level, for example, *Save All* that can be triggered from anywhere by `Ctrl` + `Shift` + `S`.) You find the global `UIElement` of your choice, for example, the top level window which is the parent of all the controls where you need this binding. Due to "bubbling" of WPF events, events at child elements will bubble
[ 0.31054815649986267, -0.11828764528036118, 0.5148577094078064, 0.14549875259399414, 0.11306942254304886, -0.21403633058071136, 0.11568658798933029, 0.01554788276553154, -0.08903882652521133, -0.79364413022995, -0.2233307957649231, 0.34476932883262634, -0.24511437118053436, 0.30987119674682...
all the way up to the root of the control tree. Now, first you need 1. to bind the Key-Combo with a Command using an `InputBinding` like this 2. you can then hookup the command to your handler (e.g. code that gets called by `SaveAll`) via a `CommandBinding`. For the `Windows` Key, you use the right [Key](http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx) enumerated member, **`Key.LWin`** or **`Key.RWin`** ``` public WindowMain() { InitializeComponent(); // Bind Key var ib = new InputBinding( MyAppCommands.SaveAll, new KeyGesture(Key.S, ModifierKeys.Shift | ModifierKeys.Control)); this.InputBindings.Add(ib); // Bind handler
[ -0.22035664319992065, -0.34198349714279175, 0.4961550235748291, -0.009203355759382248, 0.08582578599452972, 0.09243471175432205, 0.12149330228567123, -0.4898544251918793, -0.1278190314769745, -0.690301775932312, -0.31544607877731323, 0.5049808621406555, -0.42036309838294983, 0.015642737969...
var cb = new CommandBinding( MyAppCommands.SaveAll); cb.Executed += new ExecutedRoutedEventHandler( HandlerThatSavesEverthing ); this.CommandBindings.Add (cb ); } private void HandlerThatSavesEverthing (object obSender, ExecutedRoutedEventArgs e) { // Do the Save All thing here. } ```
[ 0.4364480674266815, 0.19957128167152405, -0.015154016204178333, -0.35896483063697815, 0.20095384120941162, 0.1572338193655014, 0.46055057644844055, -0.4278923571109772, -0.36635348200798035, -0.3463064432144165, 0.02631654217839241, 0.37050724029541016, -0.5563689470291138, 0.3821628391742...
I'm working on a command line application for Solaris, written in Java6. I'd like to be able to scroll through a history of previous commands using the up and down arrows like many Unix tools allow (shells, VIM command mode prompt, etc). Is there any standard way of achieving this, or do I have to roll my own? Yes, use the [GNU readline](http://tiswww.case.edu/php/chet/readline/rltop.html) library.
[ 0.7114290595054626, 0.030117252841591835, 0.354536235332489, -0.11349733918905258, -0.05794805660843849, -0.04729444161057472, -0.19911031424999237, -0.00893595814704895, -0.1759234219789505, -0.49654096364974976, -0.0347457192838192, 0.9578219652175903, -0.030019117519259453, -0.120208486...
Actionscript 3.0 (and I assume Javascript and ECMAScript in general) lacks pass-by-reference for native types like ints. As a result I'm finding getting values back from a function really clunky. What's the normal pattern to work around this? For example, is there a clean way to implement *swap( intA, intB )* in Actionscript? I Believe the best you can do is pass a container object as an argument to a function and change the values of some properties in that object: ``` function swapAB(aValuesContainer:Object):void { if (!(aValuesContainer.hasOwnProperty("a") && aValuesContainer.hasOwnProperty("b"))) throw new ArgumentError("aValuesContainer must have
[ -0.27788180112838745, -0.12422975152730942, 0.22937366366386414, -0.2528887391090393, -0.22010600566864014, 0.0333036407828331, 0.4521807134151459, -0.32186418771743774, 0.028397640213370323, -0.39192044734954834, -0.1983889490365982, 0.4598780572414398, -0.700733482837677, -0.233516588807...
properties a and b"); var tempValue:int = aValuesContainer["a"]; aValuesContainer["a"] = aValuesContainer["b"]; aValuesContainer["b"] = tempValue; } var ints:Object = {a:13, b:25}; swapAB(ints); ```
[ -0.08177074044942856, -0.10578671097755432, 0.30399274826049805, -0.2692050635814667, 0.07288568466901779, 0.2677130103111267, 0.39737561345100403, -0.5687958002090454, 0.13811790943145752, -0.4533193111419678, -0.4226931631565094, 1.0034151077270508, -0.4483455717563629, 0.224227532744407...
I'm looking for the basic loop like: ``` for(int i = 0; i < MAX; i++) { doSomething(i); } ``` but for Bash. From [this site](http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html): ``` for i in $(seq 1 10); do echo $i done ```
[ 0.31420525908470154, 0.14988505840301514, 0.11561866849660873, -0.5777286887168884, 0.083271823823452, -0.16288292407989502, 0.520490825176239, -0.5122718811035156, -0.2483281046152115, -0.32896149158477783, 0.007994186133146286, 0.6087730526924133, -0.39101898670196533, -0.034621469676494...
I've used several modules to make EXEs for Python, but I'm not sure if I'm doing it right. How should I go about this, and why? Please base your answers on personal experience, and provide references where necessary. [Auto PY to EXE](https://pypi.org/project/auto-py-to-exe/) - A .py to .exe converter using a simple graphical interface built using Eel and PyInstaller in Python. --- [py2exe](http://www.py2exe.org/) is probably what you want, but it only works on Windows. [PyInstaller](http://www.pyinstaller.org/) works on Windows and Linux. [Py2app](http://pypi.python.org/pypi/py2app/) works on the Mac.
[ 0.2700403034687042, -0.1598002016544342, 0.35281187295913696, 0.005295790731906891, -0.12213481217622757, 0.18061767518520355, 0.02886175736784935, -0.011577844619750977, -0.024299871176481247, -0.5779095888137817, -0.29648149013519287, 0.5441922545433044, -0.45441845059394836, -0.41269743...
I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. Is there a way I can use GreaseMonkey to log me into this site automatically? Edit: I am aware of the store password functionality in browsers, but my scripts go a step further by checking if I'm logged into the site when it loads (by traversing HTML) and then submitting a post to the
[ 0.9837014675140381, 0.4266282618045807, 0.1265893429517746, -0.14250308275222778, 0.07466138899326324, -0.03017563559114933, 0.40891605615615845, 0.3544427752494812, -0.21941810846328735, -0.7142137885093689, 0.2769577205181122, 0.3452169895172119, 0.012412558309733868, -0.3164316713809967...
login page. This removes the step of having to load up the site, entering the login page, entering my credentials, then hitting submit It is possible to log in using HTTP authentication by setting the "Authorization" HTTP header, with the value of this header set to the string "basic username:password", but with the "username:password" portion of the string Base 64 encoded. <http://frontier.userland.com/stories/storyReader$2159> A bit of researching found that GreaseMonkey has a a function built into it where you can send GET / POST requests to the server called GM\_xmlhttpRequest <http://diveintogreasemonkey.org/api/gm_xmlhttprequest.html> So putting it all together (and also getting this JavaScript code to convert
[ 0.6497164368629456, 0.1861555129289627, 0.43723586201667786, -0.032669469714164734, 0.2133941948413849, -0.3374403417110443, 0.176552876830101, -0.2925550937652588, -0.24852354824543, -0.48683780431747437, 0.25601327419281006, 0.5040609240531921, -0.014393274672329426, -0.18692544102668762...
strings into base64 I get the following <http://www.webtoolkit.info/javascript-base64.html> ``` var loggedInText = document.getElementById('metanav').firstChild.firstChild.innerHTML; if (loggedInText != "logged in as jklp") { var username = 'jklp'; var password = 'jklpPass'; var base64string = Base64.encode(username + ":" + password); GM_xmlhttpRequest({ method: 'GET', url: 'http://foo.com/trac/login', headers: { 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3', 'Accept':
[ -0.07840767502784729, 0.03992613032460213, 0.536202073097229, -0.36540937423706055, 0.09262329339981079, 0.11074679344892502, 0.25160732865333557, -0.38729339838027954, -0.27048733830451965, -0.34357184171676636, -0.4338993728160858, 0.3097824454307556, -0.35530513525009155, 0.059409908950...
'application/atom+xml,application/xml,text/xml', 'Authorization':'Basic ' + base64string, } }); } ``` So when I now visit the site, it traverses the DOM and if I'm not logged in, it automagically logs me in.
[ 0.052391167730093, 0.04084216430783272, 0.8728621006011963, -0.32182037830352783, 0.2585872709751129, -0.3623475134372711, 0.2673586308956146, -0.08168541640043259, 0.019410263746976852, -0.6772186756134033, -0.3980054557323456, 0.6454969048500061, -0.1489933878183365, 0.2974373400211334, ...
The first language I learnt was PHP, but I have more recently picked up Python. As these are all 'high-level' languages, I have found them a bit difficult to pick up. I also tried to learn Objective-C but I gave up. So, what language should I learn to bridge between Python to C It's not clear why you need a bridge language. Why don't you start working with C directly? C is a very simple language itself. I think that hardest part for C learner is pointers and everything else related to memory management. Also C lang is oriented on structured programming,
[ 0.11471667885780334, 0.22240924835205078, 0.010200024582445621, 0.173619344830513, -0.3357546627521515, -0.001036417786963284, -0.0680960863828659, 0.3366469442844391, -0.31430745124816895, -0.6410343050956726, 0.5444085001945496, 0.6063539385795593, -0.4210919439792633, -0.439211785793304...
so you will need to learn how to implement data structures and algorithms without OOP goodness. Actually, your question is pretty hard, usually people go from low level langs to high level and I can understand frustration of those who goes in other direction.
[ 0.49593690037727356, -0.06859301775693893, -0.035020697861909866, 0.3475821018218994, 0.10642103105783463, -0.06714332848787308, -0.03711463510990143, 0.07072970271110535, -0.2185949981212616, -0.43760767579078674, -0.07747623324394226, 0.5108475089073181, 0.14018945395946503, 0.0552547685...
I have an existing application that is written in C++ for Windows. This application uses the Win32 CryptoAPI to generate a TripleDES session key for encrypting/decrypting data. We're using the [exponent of one trick](http://www.phdcc.com/cryptorc4.htm) to export the session key out as a blob, which allows the blob to be stored somewhere in a decrypted format. The question is how can we use this in our .NET application (C#). The framework encapsulates/wraps much of what the CryptoAPI is doing. Part of the problem is the CryptAPI states that the TripleDES algorithm for the [Microsoft Enhanced Cryptographic Provider](http://msdn.microsoft.com/en-us/library/aa386986(VS.85).aspx) is 168 bits (3 keys
[ 0.3133484125137329, 0.3094334900379181, 0.37905290722846985, 0.05162874236702919, 0.03991873934864998, -0.10539130121469498, 0.2527499794960022, -0.3834740221500397, -0.10716850310564041, -0.25263142585754395, -0.018485568463802338, 0.15427586436271667, -0.21308518946170807, 0.314531892538...
of 56 bits). However, the .NET framework states their keys are 192 bits (3 keys of 64 bits). Apparently, the 3 extra bytes in the .NET framework is for parity? Anyway, we need to read the key portion out of the blob and somehow be able to use that in our .NET application. Currently we are not getting the expected results when attempting to use the key in .NET. The decryption is failing miserably. Any help would be greatly appreciated. Update: ------- I've been working on ways to resolve this and have come up with a solution that I will post in time.
[ 0.43890610337257385, 0.23871763050556183, 0.5677570104598999, 0.3215201795101166, 0.20495036244392395, 0.03148912265896797, 0.45920807123184204, -0.03354187309741974, -0.17497006058692932, -0.38837897777557373, 0.06070111691951752, 0.37757638096809387, -0.10316071659326553, 0.2187234908342...
However, still would appreciate any feedback from others. Intro ----- I'm Finally getting around to posting the solution. I hope it provides some help to others out there that might be doing similar type things. There really isn't much reference to doing this elsewhere. Prerequisites ------------- In order for a lot of this to make sense it's necessary to read the [*exponent of one trick*](http://www.phdcc.com/cryptorc4.htm), which allows you to export a session key out to a blob (a well known byte structure). One can then do what they wish with this byte stream, but it holds the all important key. MSDN Documentation is Confusing ------------------------------- In this particular example,
[ 0.31238284707069397, 0.035186994820833206, 0.4892435669898987, 0.1441631317138672, 0.16929717361927032, -0.33674123883247375, 0.26550665497779846, -0.02598387561738491, -0.27524125576019287, -0.43394872546195984, -0.09212914109230042, 0.39237844944000244, 0.008503960445523262, 0.1866798400...
I'm using the [Microsoft Enhanced Cryptographic Provider](http://msdn.microsoft.com/en-us/library/aa386986(VS.85).aspx), with the Triple DES ([CALG\_3DES](http://msdn.microsoft.com/en-us/library/aa382020(VS.85).aspx)) algorithm. The first thing that threw me for a loop was the fact that the key length is listed at 168 bits, with a block length of 64 bits. How can the key length be 168? Three keys of 56 bits? What happens to the other byte? So with that information I started to read elsewhere how the last byte is really parity and for whatever reason CryptoAPI strips that off. Is that really the case? Seems kind of crazy that they would do that, but OK. Consumption of
[ 0.3412582278251648, 0.32371941208839417, 0.09316453337669373, -0.21796125173568726, 0.018494194373488426, 0.15565849840641022, 0.155860036611557, -0.1907610148191452, -0.3969172537326813, -0.4145757853984833, 0.031202875077724457, 0.6811885237693787, -0.17887622117996216, 0.188528791069984...
Key in .NET -------------------------- Using the [TripleDESCryptoServiceProvider](http://msdn.microsoft.com/en-us/library/system.security.cryptography.tripledescryptoserviceprovider(VS.80).aspx), I noticed the remarks in the docs indicated that: > This algorithm supports key lengths from 128 bits to 192 bits in increments of 64 bits. So if CryptoAPI has key lengths of 168, how will I get that into .NET which supports only supports multiples of 64? Therefore, the .NET side of the API takes parity into account, where the CryptoAPI does not. As one could imagine... *confused was I*. So with all of this, I'm trying to figure out how to reconstruct the key on the .NET side with the proper parity information. Doable, but not
[ 0.0205235555768013, -0.11901774257421494, 0.4192325174808502, -0.07265152037143707, 0.15350870788097382, -0.22357326745986938, 0.2551763951778412, -0.2616090178489685, -0.09525059908628464, -0.36297422647476196, -0.09489798545837402, 0.575893759727478, -0.2977817952632904, -0.0061024460010...
very fun... let's just leave it at that. Once I got all of this in place, everything ended up failing with a CAPITAL **F**. Still with me? Good, because I just fell off my horse again. Light Bulbs and Fireworks ------------------------- Low and behold, as I'm scraping MSDN for every last bit of information I find a conflicting piece in the Win32 [CryptExportKey](http://msdn.microsoft.com/en-us/library/aa379931(VS.85).aspx) function. Low and behold I find this piece of invaluble information: > For any of the DES key permutations that use a PLAINTEXTKEYBLOB, only the full key size, including parity bit, may be exported. The following key sizes are supported. > >
[ 0.35660961270332336, 0.11981171369552612, 0.21316711604595184, 0.4315679371356964, 0.06916859745979309, -0.2033136487007141, 0.33087170124053955, -0.09124200791120529, -0.44089633226394653, -0.37811824679374695, -0.11796434223651886, 0.734874427318573, 0.1138089969754219, 0.246683016419410...
> Algorithm Supported key size > > > CALG\_DES 64 bits > > > CALG\_3DES\_112 128 bits > > > CALG\_3DES 192 bits So it does export a key that is a multiple of 64 bits! Woohoo! Now to fix the code on the .NET side. .NET Import Code Tweak ---------------------- The byte order is important to keep in mind when importing a byte stream that contains a key that was exported as a blob from the CryptoAPI. The two API's do not use the same byte order, therefore, as [@nic-strong](https://stackoverflow.com/questions/49211/how-can-i-use-a-key-blob-generated-from-win32-cryptoapi-in-my-net-application#49232) indicates, reversing the byte array is essential before actually trying to use the
[ 0.0684010237455368, -0.14163987338542938, 0.6133605241775513, -0.08906222134828568, 0.03410554677248001, -0.3234347403049469, 0.4811048209667206, -0.4550504684448242, -0.18575549125671387, -0.616870105266571, -0.30446991324424744, 0.6884517073631287, -0.14763814210891724, -0.02800632081925...
key. Other than that, things work as expected. Simply solved: ``` Array.Reverse( keyByteArray ); ``` Conclusion ---------- I hope this helps somebody out there. I spent way too much time trying to track this down. Leave any comments if you have further questions and I can attempt to help fill in any details. Happy Crypto!
[ 0.3581961989402771, 0.3204551935195923, 0.32327210903167725, 0.24220731854438782, 0.31776732206344604, -0.3403261601924896, 0.2426578849554062, 0.3858220875263214, -0.3094051480293274, -0.38403305411338806, -0.4141664206981659, 0.5855395197868347, -0.14821864664554596, 0.0652657002210617, ...