text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
be an indication that you're doing something wrong.
In this case your declaration:
```
cities = City.objects.filter(zip=self).distinct()
```
... is both [redundant](http://docs.djangoproject.com/en/dev/ref/models/relations/#ref-models-relations) and bad practice. You can find the cities related to a zip code by ref... | [
0.308692067861557,
-0.135003924369812,
0.22016693651676178,
0.05175476148724556,
-0.12609775364398956,
-0.283405601978302,
0.07410191744565964,
-0.3591752350330353,
-0.3993277847766876,
-0.7856418490409851,
-0.29461708664894104,
0.24060556292533875,
-0.5479474067687988,
0.16655652225017548... | |
%wordpress I've created to tool to turn php functions into Wordpress widgets. I use the register\_sidebar\_widget function but it seems like wp\_register\_sidebar\_widget would give me more options. Is that legal?
P.S. I also generate widgets in the new 2.8 format.
`register_sidebar_widget` is deprecated--though it ca... | [
0.02014431543648243,
0.2351222038269043,
0.703231155872345,
0.028636202216148376,
-0.2164873480796814,
-0.1344551295042038,
0.16840168833732605,
-0.15866555273532867,
0.2664547562599182,
-0.7043606042861938,
0.11055904626846313,
0.22729501128196716,
-0.319754034280777,
0.12556755542755127,... | |
I've google'd around a bit, and haven't really found a good answer for my question: What is the customary way to pass back error information to java from native jni code?
I would normally just pick a design and go with it, but this code is called every 5 milliseconds, (approx), so I thought I'd ask if there's a custo... | [
0.042429838329553604,
0.050151530653238297,
-0.08170226961374283,
-0.16234125196933746,
-0.2758137583732605,
0.07354175299406052,
0.3158518373966217,
-0.1948937624692917,
0.018729962408542633,
-0.38533300161361694,
0.08139496296644211,
0.4405931830406189,
-0.1741945743560791,
-0.0519162043... | |
fills in the error description in this object, and the java code checks it on return. Since errors are not the common case, this creates a lot of objects for the GC to clean up, and 99.99% of them are unnecessary.
2. Similar to #1, create some *single* "error return" object in the java class which is passed to each met... | [
0.20968690514564514,
0.11118961870670319,
-0.07997754961252213,
-0.11648688465356827,
-0.2048456072807312,
-0.3088192343711853,
0.5155872702598572,
-0.3667457401752472,
-0.14293606579303741,
-0.5169920325279236,
-0.05564553290605545,
0.529657244682312,
-0.5335633754730225,
-0.2821227908134... | |
if applicable, and pass it back as a return value to java. After the call in java, check the return for null. This seems less wasteful than #1, but it seems a bit awkward.
4. Simply build a integer return value on the jni method, and pass back an int corresponding to the "exit" value of the native code. Enumerate all p... | [
-0.066585972905159,
-0.14481677114963531,
0.055396683514118195,
-0.17198503017425537,
-0.13055479526519775,
-0.22116690874099731,
0.4686691462993622,
-0.32836100459098816,
0.12112806737422943,
-0.6935268640518188,
-0.20230267941951752,
0.4422319829463959,
-0.18490542471408844,
-0.282676070... | |
code would require someone to go back and update the "error table".
I feel as though I'm missing something obvious... is there a guru out there that can offer any insight?
Thanks!
Throw java exceptions: <http://java.sun.com/docs/books/jni/html/exceptions.html>? | [
0.3391529619693756,
0.46049055457115173,
-0.26609358191490173,
0.2226860225200653,
-0.16015714406967163,
-0.2883056700229645,
0.9153567552566528,
0.13127891719341278,
-0.2844437062740326,
-0.4138261079788208,
-0.0735505074262619,
0.4756661355495453,
-0.16580472886562347,
-0.203291371464729... | |
I am trying to detect when the user is blowing into the mic of an iPhone. Right now I am using the SCListener class from [Stephen Celis](http://stephencelis.com/2009/03/02/now-i-just-need-an-audience.html) to call
```
if ([[SCListener sharedListener] peakPower] > 0.99)
```
in an NSTimer. However, this returns true s... | [
0.3842625319957733,
0.040136463940143585,
0.33336716890335083,
-0.18412913382053375,
-0.09947346895933151,
-0.292505145072937,
0.18612439930438995,
-0.11557115614414215,
0.07413478195667267,
-0.5944440960884094,
0.2302679419517517,
0.7278760075569153,
-0.128935307264328,
-0.107141822576522... | |
this:
```
// Make this a global variable, or a member of your class:
double micPower = 0.0;
// Tweak this value to your liking (must be between 0 and 1)
const double ALPHA = 0.05;
// Do this every 'tick' of your application (e.g. every 1/30 of a second)
double instantaneousPower = [[SCListener sharedListener] peakPow... | [
0.23335587978363037,
-0.5110775828361511,
0.44264906644821167,
0.028500324115157127,
-0.3145253360271454,
-0.3810666501522064,
0.6920889019966125,
-0.38490721583366394,
0.29708805680274963,
-0.4741167724132538,
0.08166375011205673,
0.5089412927627563,
-0.461849570274353,
-0.069869510829448... | |
i was wondering how could i deploy/make it into an installer for an app which is created using vs 2008 express. i know that the setup and deployment feature is only available via the full version of visual studio right?
So are there any add ons or perhaps additional free/or non-free if it has to come to that which i c... | [
0.3354020118713379,
-0.030855881050229073,
0.16612596809864044,
0.18569278717041016,
-0.2608863115310669,
-0.23229391872882843,
0.2797813415527344,
0.11694443970918655,
-0.16035766899585724,
-0.5793546438217163,
-0.009447501972317696,
0.8232100605964661,
-0.09647257626056671,
-0.1629922688... | |
in them](http://blogs.msdn.com/vbteam/archive/2008/10/02/looking-for-setup-and-deployment-project-templates.aspx), i'll check it out, but of course more & better recommendation is always welcomed :)
[WiX is excellent.](http://wix.sourceforge.net/) Here is a [good MSDN article](http://msdn.microsoft.com/en-us/magazine/c... | [
0.3126208484172821,
0.07161615788936615,
0.04280369356274605,
0.18458256125450134,
-0.04775024577975273,
-0.3854697346687317,
0.17013578116893768,
0.10746490210294724,
-0.5187037587165833,
-0.6834230422973633,
-0.09496134519577026,
0.44043976068496704,
0.041897933930158615,
-0.264215171337... | |
How do I start using Mono in Linux as a beginner when I want to switch from Visual Studio?
Is there some easy way to install it like Visual Studio and get started?
So far,with what I've seen,it looks complex to even get started.
Installing and configuring Mono in linux is a lot of work right?
or Is there some distro... | [
0.8825627565383911,
0.14636151492595673,
-0.19777506589889526,
0.15149268507957458,
-0.3307631015777588,
-0.2604047954082489,
0.19304679334163666,
-0.21138878166675568,
-0.20889350771903992,
-0.443366140127182,
0.19052016735076904,
0.83266282081604,
-0.08713129907846451,
0.0503159835934639... | |
easiest method is to get setup with a Linux distro that is Mono friendly such as Suse, or Ubuntu. Personally, I tried it using Ubuntu 8.10.
Once you've got your Linux distro setup properly download and install MonoDevelop. This is an open source IDE that's tightly integrated to work with the Mono platform. MonoDevelop... | [
0.5243850946426392,
-0.18109160661697388,
-0.03465966507792473,
0.22200973331928253,
-0.4026118218898773,
-0.46888744831085205,
0.2954501211643219,
-0.020367838442325592,
-0.07506042718887329,
-0.642096996307373,
-0.15889015793800354,
0.7945616841316223,
-0.3814278244972229,
0.019849715754... | |
complete with Project/Solution management, GUI development using the GTK# framework, an integrated debugger and a host of other features you would expect in an IDE such as code-completion, line numbers, code-folding etc.
The folks at the MonoProject are on to something with this suite of tools.
Hope this helps you ge... | [
0.611706554889679,
0.21793781220912933,
-0.2976493239402771,
0.1519993245601654,
-0.13365711271762848,
-0.30265384912490845,
0.4493233561515808,
-0.3375491499900818,
-0.23486144840717316,
-0.3448181450366974,
-0.36297717690467834,
0.48496919870376587,
-0.0938912034034729,
-0.00369882560335... | |
I have a timezone aware `timestamptz` field in PostgreSQL. When I pull data from the table, I then want to subtract the time right now so I can get it's age.
The problem I'm having is that both `datetime.datetime.now()` and `datetime.datetime.utcnow()` seem to return timezone unaware timestamps, which results in me ge... | [
0.1010892242193222,
0.12940713763237,
0.4080553948879242,
0.08281657099723816,
0.15061505138874054,
-0.06264436990022659,
0.24226875603199005,
0.2941070795059204,
-0.31498751044273376,
-0.6776386499404907,
-0.10420199483633041,
0.2115328311920166,
-0.011761590838432312,
0.3432229161262512,... | |
always insert using:
```
NOW() AT TIME ZONE 'UTC'
```
That way all my timestamps are UTC by default (even though it's more annoying to do this).
have you tried to remove the timezone awareness?
from <http://pytz.sourceforge.net/>
```
naive = dt.replace(tzinfo=None)
```
may have to add time zone conversion as wel... | [
0.1605978012084961,
0.04918164759874344,
0.29147058725357056,
-0.01437310315668583,
0.450492799282074,
-0.18619298934936523,
0.31484922766685486,
0.21739794313907623,
-0.30927538871765137,
-0.7074212431907654,
-0.11184199154376984,
0.7691452503204346,
-0.1409142017364502,
-0.07471957057714... | |
I am trying to see if anybody is aware of any ssh or ftp ways of editing files in expression web. This is similar to notepad++. I am already aware of sftpdrive option. I am looking for something that is free, and robust.
I have not played with open site feature in Expression Web. I am not sure if this will work well w... | [
-0.14488041400909424,
0.08523786813020706,
-0.28625673055648804,
-0.06525441259145737,
-0.43359172344207764,
-0.03054996021091938,
0.28265759348869324,
-0.06847309321165085,
-0.010702535510063171,
-0.5114513635635376,
-0.1344059854745865,
0.7146093249320984,
-0.5033295750617981,
-0.2256649... | |
Award paper](http://www.thocp.net/biographies/papers/backus_turingaward_lecture.pdf) in which he described functional (or "applicative") programming is a good read. The [Wikipedia article](http://en.wikipedia.org/wiki/Functional_programming) is good too. | [
-0.18035392463207245,
0.08780080080032349,
-0.2690223753452301,
0.058728981763124466,
-0.38239675760269165,
-0.2596797049045563,
0.01519598625600338,
-0.20478692650794983,
-0.275275319814682,
-0.21846795082092285,
-0.4493814706802368,
0.37206071615219116,
0.3612987995147705,
0.105323307216... | |
C# 2008
I have developed the class below. I have to get the balance from the web server. Once that is done it will call back into my main app with the result.
However, sometime the web server fails for some unknown reason. Could be high volume of traffic or something else. However, I haven't implemented any exception... | [
0.09553353488445282,
0.4669138491153717,
0.4793296754360199,
-0.15331493318080902,
-0.32910293340682983,
-0.11742696911096573,
0.4482095241546631,
-0.1475830227136612,
-0.22036460041999817,
-0.1914089024066925,
-0.036417070776224136,
0.6014088988304138,
-0.488491415977478,
0.00675042066723... | |
am not sure if I should implement the exception handling in my class. However, I am confused as to why the exception was not caught in my app that as below.
Many thanks for any suggestions, or if you see anything else wrong,
```
private void OnGetBalanceCompleted(object sender, SIPPhoneLibraryEventArgs e)
{
... | [
0.3907764256000519,
-0.009605229832231998,
0.19576404988765717,
0.05685212463140488,
0.03698820248246193,
-0.1634015142917633,
0.3198087513446808,
0.2913650572299957,
-0.24089595675468445,
-0.5354739427566528,
0.17040997743606567,
0.44212105870246887,
-0.27606436610221863,
0.37701052427291... | |
if (e.Balance.StartsWith("null"))
{
statusDisplay1.CurrentBalance = CATWinSIP_MsgStrings.BalanceError;
}
else
{
// Display the current balance and round to 2 decimal places. | [
-0.15393401682376862,
-0.13768413662910461,
0.3513709008693695,
-0.1560530960559845,
0.23159614205360413,
0.1744377315044403,
-0.06752980500459671,
-0.34440141916275024,
-0.41468799114227295,
-0.15085795521736145,
0.07116065919399261,
0.148421511054039,
-0.23129607737064362,
0.216171622276... | |
statusDisplay1.CurrentBalance = Math.Round(Convert.ToDecimal(e.Balance), 2).ToString();
//If the balance is zero display in the status message
if (decimal.Parse(e.Balance) == 0)
{
this.statusDisplay1.CallStatus = "Zero | [
-0.12475954741239548,
-0.5079333186149597,
0.26645058393478394,
-0.14556759595870972,
0.26692208647727966,
0.05020403489470482,
-0.001988532952964306,
-0.13969111442565918,
-0.3562062680721283,
-0.08803079277276993,
0.19150277972221375,
0.49784260988235474,
-0.3866361975669861,
0.128815084... | |
Balance";
}
}
//Remove the event as no longer needed
siplibrary.GetBalanceCompletedEvent -= new EventHandler<SIPPhoneLibraryEventArgs>(OnGetBalanceCompleted);
}
catch (WebException ex)
{
MessageBox.Show(ex.Message); | [
0.2913237512111664,
-0.40480610728263855,
0.5249742865562439,
-0.07328883558511734,
0.13083219528198242,
0.14191293716430664,
0.3905230164527893,
-0.28330522775650024,
-0.13891176879405975,
-0.1309472769498825,
0.12010928988456726,
0.3030756711959839,
-0.6104989051818848,
0.115781992673873... | |
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//Control library for all importing functions
public class Balance : IDisposable
{
//Constructor
WebClient wc;
public Balance()
{
using (wc = new WebClient())
{ | [
0.5823084712028503,
-0.4131401479244232,
0.007463483605533838,
-0.01635049469769001,
0.025296101346611977,
0.014774346724152565,
-0.06523092836141586,
-0.6205542683601379,
-0.33757179975509644,
-0.4105318486690521,
-0.005589681677520275,
0.3456914722919464,
-0.6830195188522339,
0.059907849... | |
//Create event handler for the progress changed and download completed events
wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
}
}
... | [
0.043628010898828506,
-0.4638383984565735,
0.3167314827442169,
0.18447861075401306,
0.43432143330574036,
0.055555593222379684,
0.1643902063369751,
-0.3523250222206116,
-0.16860537230968475,
-0.33145231008529663,
-0.16449441015720367,
0.9625179767608643,
-0.09822302311658859,
0.022858882322... | |
//The method that raises the event
public void OnGetBalanceCompleted(SIPPhoneLibraryEventArgs e)
{
if (GetBalanceCompletedEvent != null)
{
GetBalanceCompletedEvent(this, e);
}
}
//Get the current balance for the user that is logged in.
//If the balance returned f... | [
0.22391130030155182,
-0.1146811991930008,
0.4219439923763275,
0.08091870695352554,
0.17950354516506195,
0.06700905412435532,
0.4540318250656128,
-0.10389206558465958,
-0.1732601374387741,
-0.14027154445648193,
0.2019084393978119,
0.633034884929657,
-0.4958609640598297,
0.15878628194332123,... | |
if the DB has been stopped or the server is down.
public void GetBalance(string sipUsername)
{
//Remove the underscore ( _ ) from the username, as this is not needed to get the balance.
sipUsername = sipUsername.Remove(0, 1);
string strURL = string.Format("http://xxx.xxx.xx.xx:xx... | [
0.06232718750834465,
-0.1392999291419983,
0.7529229521751404,
-0.13253621757030487,
-0.2678569555282593,
0.044928841292858124,
0.3676680326461792,
-0.13950011134147644,
-0.0345921665430069,
-0.11441650241613388,
-0.19326283037662506,
0.39243921637535095,
-0.5000947117805481,
0.413376510143... | |
(!wc.IsBusy)
{
// Sleep for 1/2 second to give the server time to update the balance.
System.Threading.Thread.Sleep(500);
// Download the current balance.
wc.DownloadStringAsync(new Uri(strURL));
}
else
{ | [
0.12398190051317215,
-0.340607225894928,
0.7880423665046692,
0.17382659018039703,
0.4573976397514343,
-0.01868738792836666,
0.11046035587787628,
-0.2306271493434906,
-0.5130738615989685,
-0.5777989029884338,
0.06015516817569733,
0.5973848700523376,
-0.13593320548534393,
0.4278632700443268,... | |
System.Windows.Forms.MessageBox.Show("Busy please try again");
}
}
//return and display the balance after the download has fully completed
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
//Pass the result to the event handler
this.OnGetBalanc... | [
0.08443242311477661,
-0.2687310576438904,
0.7580485939979553,
0.20081061124801636,
0.37450459599494934,
0.17858867347240448,
0.396982878446579,
-0.20048370957374573,
-0.4251900613307953,
-0.4302939176559448,
-0.21159888803958893,
0.7375229001045227,
-0.20655418932437897,
0.1395759582519531... | |
//Write the details to the screen.
Console.WriteLine(e.TotalBytesToReceive);
Console.WriteLine(e.BytesReceived);
Console.WriteLine(e.ProgressPercentage);
}
//Dispose of the balance object
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
... | [
0.4663218855857849,
-0.2127593755722046,
0.21229973435401917,
-0.21390171349048615,
0.4464567303657532,
0.11972228437662125,
0.2132885903120041,
-0.5225853323936462,
-0.27579939365386963,
-0.18747523427009583,
-0.39847442507743835,
0.5958387851715088,
-0.4973592162132263,
0.210973426699638... | |
{
if (!this.isDisposed)
{
if (disposing)
{
wc.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
wc.DownloadStringCompleted -= new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
... | [
-0.03854267671704292,
0.06138313561677933,
0.5882341265678406,
-0.0562564954161644,
0.633181095123291,
-0.208646759390831,
0.038581058382987976,
-0.3571346700191498,
-0.08948984742164612,
-0.40254154801368713,
-0.31946393847465515,
0.8464234471321106,
-0.12484357506036758,
0.45641919970512... | |
}
isDisposed = true;
}
}
}
```
It seems that you are catching the exception on the OnGetBalanceCompleted event only, instead on the process of fetching the balance.
When there is any error on the fetching, the OnGetBalanceCompleted is not even called, that's why your exception h... | [
0.06486086547374725,
0.005229226779192686,
0.12586314976215363,
0.04816824942827225,
-0.04572294279932976,
-0.3410851061344147,
0.10209424048662186,
0.0070781041868031025,
-0.21060402691364288,
-0.3862748146057129,
0.0664585679769516,
0.5193517208099365,
-0.5488548874855042,
0.177106484770... | |
I have a web application that uses a fairly large table (millions of rows, about 30 columns). Let's call that TableA. Among the 30 columns, this table has a primary key named "id", and another column named "campaignID".
As part of the application, users are able to upload new sets of data pertaining to new "campaigns"... | [
0.4673999845981598,
0.14350688457489014,
0.48788702487945557,
0.10181891918182373,
-0.3460697531700134,
0.27107706665992737,
-0.28254377841949463,
-0.20937272906303406,
-0.2091933786869049,
-0.837196946144104,
0.27123627066612244,
0.1642482578754425,
-0.17512045800685883,
-0.04600292816758... | |
new "campaign", so all 10,000 rows have the same "campaignID".
Usually, users are uploading data for a NEW campaign, so there are no rows in TableA with the same campaignID. Since the "id" is unique to each campaign, the id of every row of new data will be unique in TableA.
However, in the rare case where a user trie... | [
0.19187363982200623,
0.07089081406593323,
0.6617517471313477,
0.10014486312866211,
-0.3373642861843109,
0.5656608939170837,
-0.1991288661956787,
-0.23189294338226318,
-0.4229113459587097,
-0.776174783706665,
0.14792771637439728,
0.04158979281783104,
-0.330026775598526,
0.04491981863975525,... | |
stored procedure was simple:
1. BULK INSERT the new data into a temporary table (#tableB)
2. Delete any existing rows in TableA with the same campaignID
3. INSERT INTO Table A ([columns]) SELECT [columns] from #TableB
4. Drop #TableB
This worked just fine.
But the new requirement is to give users 3 options when the... | [
-0.04271901026368141,
-0.13097557425498962,
0.43212443590164185,
-0.014221741817891598,
-0.04626775160431862,
0.3386489450931549,
0.01695258915424347,
-0.36425426602363586,
-0.5153577923774719,
-0.2723143994808197,
0.06783061474561691,
0.2769053876399994,
-0.5197989344596863,
-0.1917286813... | |
If a row in #TableB has the same id as a row in TableA, then update that row in TableA with the row from #TableB (Effectively, this is "replacing" the old data with the new data)
3. If a row in #TableB has the same id as a row in TableA, then ignore that row in #TableB (Essentially, this is preserving the original data... | [
-0.16371111571788788,
0.04356096312403679,
0.2721450924873352,
-0.30198904871940613,
0.012168215587735176,
0.010442501865327358,
0.11289232224225998,
-0.3529748320579529,
-0.1974351704120636,
-0.5021848082542419,
-0.4533929228782654,
0.3431021273136139,
-0.491031289100647,
-0.0807620957493... | |
worked on that used MySQL, I used the "LOAD DATA INFILE" function, with the "REPLACE" or "IGNORE" option. But I don't know how to do this with SQL Server/T-SQL.
Any solution needs to be efficient enough to handle the fact that TableA has millions of rows, and #TableB (the new data set) may have 10k-20k rows.
I google... | [
0.06283961981534958,
0.044615745544433594,
0.4664722681045532,
-0.1480982005596161,
-0.20868797600269318,
-0.005554775707423687,
0.24364826083183289,
-0.08138133585453033,
-0.2898658514022827,
-0.6783668398857117,
0.11822336912155151,
0.43603530526161194,
-0.580718457698822,
-0.09728451073... | |
user selects option 2 (replace):
```
merge into TableA as Target
using #TableB as Source
on TableA.id=#TableB.id
when matched then
update row in TableA with row from #TableB
when not matched then
insert row from #TableB into TableA
```
If user selects option 3 (preserve):
```
merge into TableA as Targe... | [
-0.1210804358124733,
-0.412729412317276,
0.4367273151874542,
-0.01693754829466343,
0.420085072517395,
0.41212767362594604,
-0.07726370543241501,
-0.6035909056663513,
-0.15766999125480652,
-0.6816360950469971,
-0.4031464457511902,
1.0583492517471313,
-0.5257552266120911,
-0.2494968473911285... | |
tran;
```
option 3:
```
begin tran;
delete from tableb where exists (select 1 from tablea where tablea.id=tableb.id);
insert into tablea select * from tableb;
commit tran;
```
As for performance, so long as the id field(s) in tablea (the big table) are indexed, you should be fine. | [
-0.31366923451423645,
-0.32849016785621643,
0.5873917937278748,
-0.1480158418416977,
0.360676109790802,
-0.08466848731040955,
0.04024960845708847,
-0.48016175627708435,
-0.37604132294654846,
-0.4897986352443695,
-0.48511719703674316,
1.0760263204574585,
-0.31652092933654785,
-0.23040181398... | |
Does anybody know if its possible to write a barcode scanning application for the SPT-1800 in Java?
I don't know how to program the Old School Palm OS.. so java would be great.
`^Z` isn't working because the frontmost job is now the shell, and shells don't usually respond to `SIGTSTP`. (If you do really want to suspen... | [
0.21009953320026398,
0.16636885702610016,
0.22927416861057281,
0.13809272646903992,
0.27324485778808594,
-0.39626792073249817,
0.21381238102912903,
0.14974358677864075,
-0.4627574682235718,
-0.21976111829280853,
-0.13022154569625854,
0.8303148746490479,
-0.17926949262619019,
-0.03450460359... | |
running, then `fg` it and use `^C` or `^\` (which by default send `SIGINT` and `SIGQUIT` respectively).
If you want to keep `find` running but suppress its further output, then the easiest solution I can think of is to use `bg ; disown ; exit`. That will stop the shell from killing its child process (`find`) and exit ... | [
-0.09636291116476059,
-0.222306028008461,
0.3508857786655426,
-0.14794310927391052,
0.40713807940483093,
0.07860517501831055,
0.18795697391033173,
0.42630451917648315,
-0.07939667254686356,
-0.6374492645263672,
-0.3545238971710205,
0.5741525888442993,
-0.3215356469154358,
0.219094455242156... | |
Soon i'll start working on a parallel version of a mesh refinement algorithm using shared memory.
A professor at the university pointed out that we have to be very careful about thread safety because neither the compiler nor the stl is thread aware.
I searched for this question and the answer depended on the compiler... | [
0.25410890579223633,
0.31526437401771545,
0.27290648221969604,
0.02590576559305191,
0.04551485925912857,
-0.2505163848400116,
-0.041986916214227676,
0.006960807368159294,
-0.3653874397277832,
-0.6210821270942688,
-0.11277992278337479,
0.5241285562515259,
-0.4163079857826233,
0.224894195795... | |
call to the new operator?
You will have to look very hard to find a platform that supports threads but doesn't have a thread safe `new`. In fact, the thread safety of `new` (and `malloc`) is one of the reasons it's so slow.
If you want a thread safe STL on the other hand, you may consider [Intel TBB](http://www.thread... | [
0.10393728315830231,
-0.3147621154785156,
-0.12713731825351715,
0.18792098760604858,
0.08753174543380737,
-0.3430706858634949,
0.1951686590909958,
-0.01770804449915886,
-0.28193607926368713,
-0.5433593392372131,
-0.18539424240589142,
0.6460965275764465,
-0.5271807909011841,
0.0974597036838... | |
What is the "rails way" to efficiently grab all rows of a parent table along with a count of the number of children each row has?
I don't want to use `counter_cache` as I want to run these counts based on some time conditions.
The cliche blog example:
Table of articles. Each article has 0 or more comments.
I want to... | [
0.3167908191680908,
0.22456882894039154,
0.1496894210577011,
0.18737895786762238,
-0.047129180282354355,
0.043371763080358505,
0.2827281057834625,
0.11234647780656815,
-0.2187337726354599,
-0.6420806050300598,
0.3138260245323181,
0.17187148332595825,
-0.045850418508052826,
0.32374444603919... | |
of the data and process it on the app server.
I want to run one SQL statement and get one result set with all the info.
I know I can hard code out the full SQL, and maybe could use a `.find` and just set the `:joins`, `:group`, and `:conditions` parameters... BUT I am wondering if there is a "better" way... aka "The ... | [
0.26032188534736633,
0.2012556493282318,
0.48912814259529114,
0.15894833207130432,
0.0680769681930542,
0.0642775222659111,
0.26639530062675476,
-0.301509827375412,
-0.12710875272750854,
-0.7619835138320923,
-0.17445793747901917,
0.6984745860099792,
-0.4382341802120209,
-0.17147678136825562... | |
:group => 'articles.id'
)
```
This will return a list of article objects, each of which has the method `post_count` on it that contains the number of posts on the article as a string.
The method executes sql similar to the following:
```
SELECT articles.*, count(posts.id) AS post_count
FROM `articles`
L... | [
-0.1603282392024994,
0.35666683316230774,
0.3757641017436981,
-0.05686652287840843,
-0.4554012417793274,
-0.0754304975271225,
0.10378238558769226,
-0.6652532815933228,
-0.0833350196480751,
-0.4124504029750824,
-0.10708644986152649,
0.2493855059146881,
-0.5507664680480957,
-0.01363107282668... | |
| post_count |
+----+----------------+------------+
| 1 | TEXT TEXT TEXT | 1 |
| 2 | TEXT TEXT TEXT | 3 |
| 3 | TEXT TEXT TEXT | 0 |
+----+----------------+------------+
``` | [
-0.2228005975484848,
0.4573788642883301,
0.5790525674819946,
-0.12282148748636246,
0.019307056441903114,
0.221446231007576,
0.31185877323150635,
-0.41176271438598633,
0.1314212828874588,
-0.3557761609554291,
-0.5369558930397034,
0.40567803382873535,
-0.33130398392677307,
0.2772680222988128... | |
I'm interested in data mining projects, and have always wanted to create a classification algorithm that would determine which specific check-ins need code-reviews, and which may not.
I've developed many heuristics for my algorithm, although I've yet to figure out the killer...
How can I programmatically check the co... | [
0.5303108096122742,
0.36217373609542847,
-0.38286834955215454,
0.292544424533844,
-0.07893091440200806,
0.0519573874771595,
0.22289729118347168,
-0.05972070246934891,
-0.24038228392601013,
-0.6678698062896729,
0.0897785872220993,
0.43624424934387207,
-0.05259116366505623,
0.298002600669860... | |
left - shouldn't that be considered 'good' code?
Interested in your thoughts on this.
**UPDATE**
Apparently I wasn't clear. I want this
double codeValue = CodeChecker.CheckCode(someCodeFile);
I want a number to come out based on how good the code was. I'll start with numbers like VS2008 gives when you calculate co... | [
0.22625896334648132,
-0.20372821390628815,
0.10262089967727661,
0.026698291301727295,
-0.07056011259555817,
-0.06847819685935974,
0.07430002838373184,
0.1734253168106079,
-0.4362614154815674,
-0.887313187122345,
0.18050549924373627,
0.5894684195518494,
0.05983028560876846,
-0.0216499008238... | |
I'd like to show an animated GIF as the tab image on a `TabPage`.
If I add my image to an `ImageList` and use the `TabPage.ImageIndex` property, it only shows the first frame (and doesn't animate):
```
ImageList imageList = new ImageList();
imageList.Images.Add(Properties.Resources.my_animated_gif);
tabControl.Image... | [
0.517147421836853,
-0.04664984345436096,
0.6227672696113586,
-0.12150043249130249,
-0.1546339988708496,
0.10094587504863739,
-0.09199196845293045,
0.25506797432899475,
-0.12215682119131088,
-0.8058056831359863,
0.04892994090914726,
0.6143132448196411,
-0.33313632011413574,
0.14749924838542... | |
in the TabPage, I used it to show an animated loading icon, this assumes that you have extracted the frames of the GIF and included them in the resources.
```
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
namespace GuiLib
{
public class AnimatedTabControl : TabControl
{
... | [
-0.0981675460934639,
-0.31363460421562195,
0.8993360996246338,
-0.30001530051231384,
-0.0951107069849968,
0.6856708526611328,
0.11137912422418594,
0.12429541349411011,
-0.2540118396282196,
-0.5708895325660706,
-0.26666679978370667,
0.7129389047622681,
-0.6410062313079834,
-0.09973298013210... | |
= 50;
static int TEXT_Y = 6;
static int TEXT_WIDTH = 200;
static int TEXT_HIGHT = 15;
int animationIndex;
static System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
Bitmap[] animationImages = {new Bitmap(GuiLib.Properties.Resources._0), new Bitmap(GuiLib.Properties.Resources... | [
0.02728925831615925,
-0.260779470205307,
0.8353065848350525,
0.07514718919992447,
-0.1465883105993271,
0.6666870713233948,
0.08013409376144409,
-0.38769206404685974,
-0.5494500398635864,
-0.6385230422019958,
-0.45322921872138977,
0.3725729286670685,
-0.043073754757642746,
0.085229441523551... | |
new Bitmap(GuiLib.Properties.Resources._6),new Bitmap(GuiLib.Properties.Resources._7)};
Bitmap animatedimage;
public AnimatedTabControl()
: base()
{
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.SizeMode = TabSizeMode.Fixed;
this.ItemSize = new Size(ITEM_WIDTH... | [
-0.17060333490371704,
-0.6407711505889893,
0.6888684034347534,
-0.2044486552476883,
0.30280667543411255,
0.48128649592399597,
0.08817403763532639,
-0.138648122549057,
-0.45362037420272827,
-0.5335813164710999,
-0.36224859952926636,
0.5159952044487,
-0.371115118265152,
0.12206746637821198,
... | |
myTimer.Interval = TIMER_INTERVAL;
animationIndex = 0;
}
private void TimerEventProcessor(Object myObject, EventArgs myEventArgs)
{
animationIndex++;
if (animationIndex >= animationImages.Length)
animationIndex = 0;
animatedimage = animationImages[animationInde... | [
-0.10494494438171387,
-0.28674936294555664,
0.5954691171646118,
-0.12150029838085175,
0.3714442253112793,
0.6190037727355957,
0.2811603248119354,
-0.08210230618715286,
-0.2592131793498993,
-0.49603742361068726,
-0.312425822019577,
0.48618265986442566,
-0.25718510150909424,
0.16160340607166... | |
bool stopRunning = true;
for (int i = 0; i < this.TabPages.Count; i++)
{
if (this.TabPages[i] is LoadingTabPage)
{
LoadingTabPage ltp = (LoadingTabPage)this.TabPages[i];
if (ltp.Loading) | [
0.0843355655670166,
-0.4741361141204834,
0.6245553493499756,
-0.27135974168777466,
-0.09768898785114288,
-0.04960775747895241,
0.9318325519561768,
-0.20103660225868225,
-0.094512440264225,
-0.243967667222023,
-0.27479827404022217,
0.6696670055389404,
-0.6420277953147888,
-0.041369050741195... | |
{
stopRunning = false;
Rectangle r = GetTabRect(i);
this.Invalidate(new Rectangle(r.X + ICON_X, r.Y + ICON_Y, ICON_WIDTH, ICON_HIGHT)); | [
-0.15503226220607758,
-0.27680858969688416,
0.7931528091430664,
-0.1284552961587906,
0.05399126186966896,
0.14229050278663635,
0.6441411972045898,
-0.30354610085487366,
-0.1027764081954956,
-0.3853408992290497,
-0.4888877868652344,
0.5258795619010925,
-0.5553009510040283,
0.255640327930450... | |
}
}
}
if (stopRunning)
myTimer.Stop();
}
protected override void OnDrawItem(DrawItemEventArgs e)
{
Rectangle r = e.Bounds;
r = GetTabRect(e.Index);
DrawAnimationImageIfLoading(e, r);
DrawTabTitle(e, r); | [
-0.26043227314949036,
-0.4819674491882324,
0.6624076962471008,
-0.31155285239219666,
0.23942089080810547,
0.10680550336837769,
0.3397398591041565,
-0.46010667085647583,
0.18281331658363342,
-0.3914739787578583,
-0.5735380053520203,
0.6970618963241577,
-0.4849022924900055,
0.130891323089599... | |
}
private void DrawTabTitle(DrawItemEventArgs e, Rectangle r)
{
string title = this.TabPages[e.Index].Text;
StringFormat titleFormat = new StringFormat();
titleFormat.Trimming = StringTrimming.EllipsisCharacter;
e.Graphics.DrawString(title, this.Font, Brushes.Black, new Rectangl... | [
0.04178454354405403,
-0.3898414075374603,
0.6780791282653809,
-0.19759446382522583,
0.03375356271862984,
0.26402512192726135,
0.2722373604774475,
-0.40417516231536865,
0.009496694430708885,
-0.37727639079093933,
-0.31685546040534973,
0.9485988616943359,
-0.5195783376693726,
0.2146696895360... | |
{
if (((LoadingTabPage)this.TabPages[e.Index]).Loading)
{
if (animatedimage != null)
e.Graphics.DrawImage(animatedimage, new RectangleF(r.X + ICON_X, r.Y + ICON_Y, ICON_WIDTH, ICON_HIGHT));
if (!myTimer.Enabled) | [
-0.15979139506816864,
-0.5088344812393188,
1.0119293928146362,
0.006069638766348362,
0.4429612159729004,
0.37214991450309753,
0.23818476498126984,
-0.004849019926041365,
-0.18124143779277802,
-0.6746674180030823,
-0.34542718529701233,
0.6041348576545715,
-0.3582122325897217,
0.329669177532... | |
myTimer.Start();
}
}
}
}
}
```
And the LoadingTabPage as this:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GuiLib
{
/// <summary>
/// A Class to facilitate tab page with animated loading icon.
/// </su... | [
-0.04432365298271179,
-0.1972779929637909,
0.6557646989822388,
-0.10354988276958466,
0.04292384907603264,
0.3044160306453705,
0.21271958947181702,
-0.020028434693813324,
-0.04961007088422775,
-0.6916829347610474,
-0.278420627117157,
0.29898157715797424,
-0.45894739031791687,
0.146157220005... | |
}
public LoadingTabPage()
: base()
{
loading = false;
}
private bool loading;
public bool Loading
{
get { return loading; }
set
{
loading = value; | [
0.36215123534202576,
-0.3007566034793854,
0.0958336889743805,
-0.36752256751060486,
-0.15921521186828613,
0.22336390614509583,
0.4220806062221527,
-0.14229990541934967,
-0.05819788575172424,
-0.2969013750553131,
-0.3788343667984009,
0.7343164682388306,
-0.49253055453300476,
-0.064024172723... | |
if (this.Parent != null)
{
this.Parent.Invalidate();
}
}
}
}
}
```
The usage will be easy:
```
myLoadingTabPage.Loading = true;
``` | [
0.14191347360610962,
0.02992674522101879,
0.4496350884437561,
-0.10331461578607559,
0.09611067920923233,
-0.34189048409461975,
0.34186363220214844,
0.028573252260684967,
-0.11687725782394409,
-0.43583154678344727,
-0.31654930114746094,
0.7186962962150574,
-0.3346273899078369,
0.12715038657... | |
I am trying to add an autocomplete feature to a textbox, the results are coming from a database. They come in the format of
> [001] Last, First Middle
Currently you must type [001]... to get the entries to show. **So the problem is that I want it to complete even if I type the firstname first**. So if an entry was
>... | [
0.16629868745803833,
0.3215530514717102,
0.5005715489387512,
-0.047203268855810165,
0.04025892913341522,
0.13982143998146057,
0.3217860758304596,
-0.1606471836566925,
-0.1585991084575653,
-0.5473834276199341,
-0.18058794736862183,
0.41689160466194153,
-0.29003670811653137,
0.03745051845908... | |
0)
for (int i = 0; i < results.Rows.Count && i < 10; i++)
{
row = results.Rows[i];
acsc.Add(row["Details"].ToString());
}
}
```
*results is a dataset containing the query results*
*The query is a simple search query using the like statement. The correct results are returned if we do not ... | [
0.10052948445081711,
0.044518619775772095,
0.4383051097393036,
-0.1351126730442047,
0.11999492347240448,
0.16346389055252075,
-0.04072517156600952,
-0.25281399488449097,
0.21498064696788788,
-0.4324571490287781,
-0.30672353506088257,
0.5293017029762268,
-0.2110964059829712,
0.2410353720188... | |
for the searched string.*
The existing AutoComplete functionality only supports searching by prefix. There doesn't seem to be any decent way to override the behavior.
Some people have implemented their own autocomplete functions by overriding the `OnTextChanged` event. That's probably your best bet.
For example, you ... | [
0.03204767405986786,
-0.2600890100002289,
0.2150566726922989,
-0.047952935099601746,
0.004741774406284094,
-0.09260936826467514,
0.306652694940567,
-0.06346053630113602,
-0.28369441628456116,
-0.6778968572616577,
-0.20433607697486877,
0.5030261874198914,
-0.412381112575531,
0.0319323502480... | |
AutoCompleteStringCollection();
textBox1.AutoCompleteCustomSource = acsc;
textBox1.AutoCompleteMode = AutoCompleteMode.None;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
private void button1_Click(object sender, EventArgs e)
{
acsc.Add("[001] some kind of item");
acsc.Add("[002]... | [
-0.1473509967327118,
-0.2027929127216339,
0.3229047656059265,
-0.041177887469530106,
0.1481345146894455,
0.37698736786842346,
0.12705066800117493,
-0.07346467673778534,
-0.4016745984554291,
-0.3631742298603058,
-0.4624546468257904,
0.4867134392261505,
-0.5168942809104919,
0.000074809431680... | |
{
Console.WriteLine("Found text in: " + s);
listBox1.Items.Add(s);
listBox1.Visible = true;
}
}
}
void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
textBox1.Text = listBox1.Items[listBox1.SelectedIndex].ToString();
hideResults();
}
void listBox1_LostFocus(... | [
0.07677316665649414,
-0.19450870156288147,
0.46956539154052734,
-0.0645604208111763,
0.2913113236427307,
0.21813206374645233,
0.4734194278717041,
-0.19712552428245544,
-0.18736429512500763,
-0.5141637921333313,
-0.3307954967021942,
0.6431134343147278,
-0.2846183180809021,
0.223287940025329... | |
I have only little knowledge about LaTeX, basic formatting, basic math fomulae etc.. I found that LaTeX is hard to configure to my own flavor. Recently, I've heard about Docbook, which is also a typesetting mechanism, but much easier since it uses XML. So, if my main job using LaTeX/Docbook is writing a simple document... | [
0.20300579071044922,
0.13579821586608887,
0.09379192441701889,
0.21807491779327393,
0.003125341609120369,
-0.31222403049468994,
-0.08050025254487991,
0.14304840564727783,
-0.012196064926683903,
-0.8628095984458923,
-0.07799777388572693,
0.7011187076568604,
-0.15893802046775818,
-0.17941589... | |
have elements to describe mathematics.](http://www.sagehill.net/docbookxsl/Math.html)
2. DocBook is XML, as you say. To me, that makes it a horrible thing to write by-hand (or, rather, with a basic text editor). Maybe you enjoy writing XML, or have a good IDE. I guess you could look at [this question](https://stackover... | [
0.3120017349720001,
0.24503681063652039,
0.1241254135966301,
-0.06287287175655365,
-0.10545627027750015,
-0.33723706007003784,
0.03959759697318077,
-0.2701164782047272,
0.03118799813091755,
-0.5058447122573853,
0.013729378581047058,
0.3785489797592163,
-0.14444424211978912,
-0.167716965079... | |
particular type of stuff. With maths:
$\int_{x=1}^n 3x^2$
% etc.
```
Google is your friend for finding basic templates that you can start from:
* [One](https://engineering.purdue.edu/ECN/Support/KB/Docs/LaTeXArticleTemplate)
* [Two](http://www.cs.technion.ac.il/~yogi/Courses/CS-Scientific-Writing/examples/simple/... | [
0.2735748291015625,
0.3852025270462036,
0.2853095531463623,
0.17406561970710754,
-0.03654322773218155,
-0.3288958668708801,
0.1706671118736267,
0.07721538841724396,
-0.2539714276790619,
-0.7149631977081299,
-0.34654587507247925,
0.4096810817718506,
-0.264890193939209,
0.026006577536463737,... | |
what is the best way to declare variable names.... in uppercase ...? .. lowercase? in which area must be declared in any case ... and what name is appropriate depending on the roll of the standard variable ... there are some variables to declare?...sorry for the question..I'm new to the world of programming ... I hope ... | [
0.29972565174102783,
-0.05742581561207771,
0.4272073209285736,
0.17583072185516357,
-0.05290472134947777,
-0.21461282670497894,
-0.009593493305146694,
-0.04801282659173012,
-0.2692156136035919,
-0.4306527376174927,
0.058135855942964554,
0.4415038526058197,
-0.27295055985450745,
0.129094049... | |
coding standards article](http://www.cs.uwf.edu/~wilde/gump/codestan.htm) that explains the reasoning behind the coding standards. | [
0.6512374877929688,
0.14299583435058594,
-0.41918525099754333,
-0.12354088574647903,
-0.10259677469730377,
-0.2569286525249481,
0.403717964887619,
-0.2655376195907593,
-0.04798687621951103,
-0.5786619186401367,
-0.23682698607444763,
0.27413854002952576,
-0.20742538571357727,
0.135563537478... | |
I'm looking for a Java web framework that requires the most minimal amount of configuration for a very small app. Spring & Struts are definitely overkill here. This is an app that could be written without any framework at all but I would prefer to use a minimal MVC framework if I can find one.
[Stripes](http://www.stri... | [
0.7308762073516846,
-0.19103313982486725,
0.10282815247774124,
0.24648649990558624,
-0.013199287466704845,
-0.06406038254499435,
-0.11814210563898087,
0.16459836065769196,
-0.38077157735824585,
-0.7989779114723206,
0.4060175120830536,
0.42897850275039673,
-0.11032567918300629,
-0.215415179... | |
I'm using a the WPF datagrid from the Microsoft CodePlex project. I have a custom control that I want to databind to a field from the row of the datagrid. I can't for the life of me figure out how to specify a tooltip on a datagrid row.
The closest I've come is to use a RowStyle with a Setter to set the tooltip, but ... | [
0.1157718151807785,
-0.14511097967624664,
0.43350204825401306,
0.24036170542240143,
-0.01803310588002205,
0.07876485586166382,
0.02607802301645279,
0.03638046234846115,
-0.03905589133501053,
-0.382607638835907,
0.24779698252677917,
0.5084241032600403,
-0.25090131163597107,
0.21242861449718... | |
need to set the "Template" property of the ToolTip, but I can't seem to figure out how to do that...
```
<dg:DataGrid Name="dgResults" AutoGenerateColumns="True">
<dg:DataGrid.RowStyle >
<Style TargetType="{x:Type dg:DataGridRow}">
<Setter Property="ToolTip" >
... | [
0.2674145996570587,
-0.08299373090267181,
0.31481295824050903,
-0.15075208246707916,
0.058656297624111176,
-0.26500335335731506,
0.029484009370207787,
-0.5154772400856018,
0.12617047131061554,
-0.7120654582977295,
-0.1197144016623497,
0.7344861626625061,
-0.2514961361885071,
-0.08361494541... | |
<ControlTemplate TargetType="{x:Type ToolTip}">
<StackPanel>
<TextBlock>txt1</TextBlock><TextBlock>txt2</TextBlock> | [
-0.17189475893974304,
-0.22863449156284332,
0.1533217430114746,
0.07927338778972626,
-0.0471375398337841,
-0.15959300100803375,
-0.07906559854745865,
-0.5684972405433655,
0.13678252696990967,
-0.31940075755119324,
-0.15288884937763214,
0.3710969388484955,
-0.3944181203842163,
-0.2752806246... | |
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</dg:DataGrid.RowStyle>
</dg:DataGrid>
```
Figured it out... took me about 6 hours...
For some reason, I can't set the value | [
0.0008637848659418523,
0.2065121829509735,
0.6570993065834045,
-0.2102544754743576,
0.3268284797668457,
-0.1305747628211975,
0.549071192741394,
-0.5641610026359558,
-0.2255350798368454,
-0.4390186369419098,
0.19147178530693054,
0.5150384902954102,
0.08445525914430618,
-0.20290035009384155,... | |
directly using Value.Setter. If I define the content for the tooltip as a static resource though, and then set it in the Style property of the DataGrid.RowStyle it works.
So, the datagrid row style looks like:
```
<Style TargetType="{x:Type dg:DataGridRow}">
<Setter Property="ToolTip" V... | [
0.31924933195114136,
0.008937433362007141,
0.5917087197303772,
-0.04016360640525818,
-0.0714859589934349,
-0.016922807320952415,
-0.07633952051401138,
-0.37818410992622375,
-0.022165413945913315,
-0.5339561700820923,
0.033650778234004974,
0.6562168598175049,
-0.22716909646987915,
-0.051682... | |
</Style>
</dg:DataGrid.RowStyle>
```
And the resource is
```
<Window.Resources>
<StackPanel x:Key="resKWIC">
<TextBlock>f1</TextBlock>
<TextBlock>f2></TextBlock>
</StackPanel>
</Window.Resources>
```
Thanks! | [
-0.3933175504207611,
0.18747150897979736,
0.7174217104911804,
0.007281691301614046,
0.08328694105148315,
-0.11272181570529938,
0.09913168847560883,
-0.2073202282190323,
-0.36379188299179077,
-0.6656665802001953,
-0.3867388963699341,
0.5114477276802063,
0.29082831740379333,
-0.5074063539505... | |
I've recently managed to create a thread using the boost::bind function.
For the time being, I'm having the thread display to stdout. I can see the output if I use thread.join. However, if I don't do this, I don't see any output.
Why is this?
I'm hoping I don't have to use the join function, because I would like ... | [
0.47917792201042175,
-0.06122426316142082,
0.39421820640563965,
-0.06046995148062706,
-0.1886962652206421,
-0.1305624395608902,
0.5039231181144714,
0.20951896905899048,
-0.48835787177085876,
-0.6725345253944397,
0.29725381731987,
0.5037401914596558,
-0.29506129026412964,
0.3364491760730743... | |
to touch a non-existent file, and it was there afterwards, so the thread did execute.
If you *can* make them all implement an interface, that would certainly be the best option. However, reflection will also work, and your code was nearly there:
```
Object o = getFromSomeWhere.....;
Method m = o.getClass().getMethod("... | [
0.18982505798339844,
-0.0828540027141571,
0.4438018798828125,
-0.20789656043052673,
0.06091590225696564,
0.029044263064861298,
0.573764979839325,
-0.3236866295337677,
-0.16965101659297943,
-0.7708469033241272,
0.06439558416604996,
0.37495967745780945,
-0.3105369806289673,
0.048319812864065... | |
Method m = o.getClass().getMethod("getDate");
Date date = (Date) m.invoke(o);
System.out.println(date);
}
public Date getDate()
{
return new Date();
}
}
``` | [
0.04707806557416916,
-0.30350184440612793,
0.5491824150085449,
-0.324566513299942,
0.3599029779434204,
0.08245794475078583,
0.15611809492111206,
-0.24986505508422852,
-0.21222184598445892,
-0.27631163597106934,
-0.4009128212928772,
0.4458194077014923,
-0.19869136810302734,
0.44716250896453... | |
I want to do something like this:
```
@Entity public class Bar {
@Id @GeneratedValue long id;
List<String> Foos
}
```
and have the Foos persist in a table like this:
```
foo_bars (
bar_id int,
foo varchar(64)
);
```
UPDATE:
I know how to map other entities, but it's overkill in m... | [
0.4237458407878876,
0.23790228366851807,
0.49142986536026,
-0.2217293232679367,
-0.10189500451087952,
-0.18474431335926056,
0.23586218059062958,
-0.2702336013317108,
-0.38917991518974304,
-0.5915224552154541,
0.12440880388021469,
0.35763418674468994,
-0.44452810287475586,
0.217311814427375... | |
of values" or "elements". There is a (Hibernate specific) annotation for it. JPA does not support this (yet).
In short, annotate your collection like this:
```
@CollectionOfElements
@JoinTable(
table=@Table(name="..."),
joinColumns = @JoinColumn(name="...") // References parent
)
@Column(name="...valu... | [
0.14960621297359467,
0.059207212179899216,
0.3697272539138794,
-0.0007214845390990376,
0.01916312798857689,
-0.24808476865291595,
0.060077838599681854,
-0.3576107919216156,
-0.4217022955417633,
-0.27672627568244934,
-0.19478847086429596,
0.17392060160636902,
-0.3527889549732208,
0.12464033... | |
I've got (for example) an index:
```
CREATE INDEX someIndex ON orders (customer, date);
```
Does this index only accelerate queries where *customer and date* are used or does it accelerate queries for a single-column like this too?
```
SELECT * FROM orders WHERE customer > 33;
```
I'm using SQLite.
---
If the a... | [
0.07433050125837326,
0.17913490533828735,
0.3209591507911682,
0.05015144869685173,
-0.22051593661308289,
0.15971943736076355,
-0.07003915309906006,
0.0422302670776844,
-0.3791491687297821,
-0.8323741555213928,
0.10861299932003021,
0.39961445331573486,
-0.11867938935756683,
0.24372592568397... | |
like a single key index but any subsequent keys will not.
As for how much faster the composite index is depends on your data and how you structure your index and query, but it is usually significant. The indexes essentially allow Sqlite to do a binary search on the fields.
Using the example you gave if you ran the q... | [
-0.06308054178953171,
0.08366598933935165,
0.34647858142852783,
-0.02271793782711029,
-0.19657960534095764,
0.21077634394168854,
-0.28637051582336426,
-0.10300114750862122,
-0.4649040102958679,
-0.5030530691146851,
0.07497420161962509,
0.2923458516597748,
-0.31802210211753845,
0.2779190242... | |
for date > 99.
If you did the same query with two separate indexes on customer and date, Sqlite would have to binary search the whole table twice, first for the customer and again for the date.
So how much of a speed increase you will see depends on how you structure your index with regard to your query. Ideally, the... | [
-0.04532886669039726,
-0.11180735379457474,
0.6524298191070557,
0.08761851489543915,
0.023445455357432365,
0.004652006085962057,
-0.17240287363529205,
-0.016263224184513092,
-0.26711517572402954,
-0.740945041179657,
0.013649938628077507,
0.18633554875850677,
-0.22263911366462708,
0.3583227... | |
see this:
<http://www.sqlite.org/optoverview.html> | [
0.16803738474845886,
-0.549560010433197,
0.20918822288513184,
-0.0894695296883583,
0.17354996502399445,
-0.0502396784722805,
-0.4171856939792633,
0.06572235375642776,
0.024721361696720123,
-0.5343239903450012,
-0.2642056941986084,
0.5071748495101929,
-0.26482293009757996,
-0.46440178155899... | |
I'm preparing some table names for an ORM, and I want to turn plural table names into single entity names. My only problem is finding an algorithm that does it reliably. Here's what I'm doing right now:
1. If a word ends with *-ies*, I replace the ending with *-y*
2. If a word ends with *-es*, I remove this ending. Th... | [
-0.10835271328687668,
0.4006883203983307,
0.4453979730606079,
-0.09091539680957794,
-0.2357865571975708,
-0.09941951185464859,
0.28644344210624695,
-0.0029334656428545713,
-0.2373424917459488,
-0.7390536665916443,
-0.23117409646511078,
0.15093594789505005,
-0.08194231986999512,
0.140187472... | |
faint of heart :-).
My own preference would be to have a transformation engine along with a set of transformations (surprisingly enough) for doing the actual work. You would run through the transformations (from specific to general) and, when a match was found, apply the transformation to the word and stop.
Regular e... | [
-0.09480021148920059,
-0.26153507828712463,
-0.09832387417554855,
-0.2750546634197235,
-0.1799871027469635,
0.2771858870983124,
0.6862443685531616,
-0.18212299048900604,
0.16893427073955536,
-0.693942666053772,
-0.18576788902282715,
0.5078675746917725,
0.2508479356765747,
0.008718816563487... | |
with "us" (octopii,virii).
5. If a word ends with -ies, replace the ending with -y
6. If a word ends with -es, remove it.
7. Otherwise, just remove any trailing -s.
```
Note the requirement to keep this transformation set up to date. For example, let's say someone adds the table name `types`. This would currently ... | [
0.11124631762504578,
0.15321798622608185,
0.8352622985839844,
-0.08702582865953445,
-0.14423233270645142,
0.15152226388454437,
0.4022122919559479,
-0.10510404407978058,
-0.06331463158130646,
-0.8153640627861023,
-0.5802292227745056,
0.2663290202617645,
-0.16965673863887787,
0.0793393552303... | |
it can be made more general.
In other words, you'll basically need to keep this transformation table updated as you find all those wondrous exceptions that English has spawned over the centuries.
---
The *other* possibility is to not waste your time with general rules at all.
Since the use case of this requirement ... | [
-0.04766837880015373,
-0.006223816424608231,
0.012957942672073841,
0.11453502625226974,
-0.184747576713562,
-0.027202362194657326,
0.05552472919225693,
-0.02150021865963936,
-0.22818416357040405,
-0.7925088405609131,
-0.31919658184051514,
0.4047115445137024,
-0.13905933499336243,
0.0178320... | |
to singular object names (`employee`, `customer`).
Then every time a table is added to your schema, ensure you add an entry to the singulars "table" so you can singularize it. | [
-0.2025851458311081,
0.17244873940944672,
0.2503516376018524,
0.1387355923652649,
-0.18205700814723969,
0.13352234661579132,
0.02752264030277729,
0.04698020592331886,
-0.36341747641563416,
-0.7326045036315918,
-0.3828657865524292,
0.4279535710811615,
-0.20864616334438324,
-0.00491626746952... | |
I am in the phase of learning Zend Framework for PHP development, I have been doing 'dirty' PHP programming for about 2 years now and I have learnt quite a bit from my mistakes.
I have been introduced to Ruby On Rails, it is a great framework and Ruby is quite an interesting language too, but not everyone wants their ... | [
0.4965401589870453,
0.36703431606292725,
-0.01255058217793703,
-0.03992961347103119,
-0.20309169590473175,
-0.33881381154060364,
0.3485536575317383,
0.13294270634651184,
-0.09797415882349014,
-0.4862867295742035,
0.36618703603744507,
0.6844232678413391,
0.07820488512516022,
-0.091616854071... | |
really excited about the same.
However I am interested to know if there are any 'generator' scripts that help you along the process to generate / automate common tasks such as project structure creation, model creation, controller creation, just like those in RoR?
If such a thing already exists, great, otherwise I wi... | [
0.2004103809595108,
-0.24119801819324493,
0.13177913427352905,
0.020250961184501648,
-0.12669716775417328,
-0.4808264970779419,
0.1104271337389946,
0.41713452339172363,
-0.26001906394958496,
-0.5233922004699707,
0.023942261934280396,
0.6657876968383789,
0.3499721586704254,
-0.1799473911523... | |
I'm creating this rating system using 5-edged stars. And I want the heading to include the average rating. So I've created stars showing 1/5ths. Using "1.2" I'll get a full star and one point on the next star and so on...
But I haven't found a good way to round up to the closest .2... I figured I could multiply by 10,... | [
0.09199855476617813,
0.38577887415885925,
0.5660253167152405,
-0.22039343416690826,
-0.1325874775648117,
-0.09306125342845917,
0.3745032250881195,
-0.2949211001396179,
-0.15583837032318115,
-0.5160295963287354,
0.13921920955181122,
0.5504866242408752,
0.09240060299634933,
0.398796916007995... | |
just wanted to clarify the options for client presentation :
1) winforms - for windows client - older technology
2) wpf - for windows client - newer technology, uses xaml
3) jquery - for web client - uses javascript
4) asp.net ajax - for web client - older technology
5) silverlight - for web client - newer technology... | [
0.14352723956108093,
-0.13838693499565125,
0.3834719955921173,
0.17078106105327606,
-0.2909277081489563,
-0.26106810569763184,
0.059455614537000656,
-0.1749451905488968,
-0.3684315085411072,
-0.45608702301979065,
0.1627298891544342,
0.4922756850719452,
0.03534507751464844,
0.00271854130551... | |
just i want to know What is the actual difference between MVC and MVC Model2 in the development
To illustrate the previous answers (and add explanation from [this article](http://faq.javaranch.com/java/Model1Model2MVC)):
MVC2 is an [abuse of language](http://en.wikipedia.org/wiki/Abuse_of_language) referring actually ... | [
0.36079317331314087,
0.16940471529960632,
0.29817038774490356,
-0.17073169350624084,
-0.22333981096744537,
-0.18558050692081451,
0.40000414848327637,
-0.2501986026763916,
-0.19841895997524261,
-0.39845553040504456,
0.22971923649311066,
0.5579216480255127,
-0.49434521794319153,
0.1863314062... | |
and error-prone. It also made it very difficult for web designers with no Java experience to alter the look and feel of the pages generated by servlets.
[](https://i.stack.imgur.com/0Rvqk.gif)
(source: [javaworld.com](http://www.javaworld.com/javaworld/jw-12-1999/imag... | [
0.12816789746284485,
-0.18702729046344757,
0.3957028388977051,
0.012296758592128754,
-0.5743376016616821,
-0.402954638004303,
0.09235619753599167,
-0.11480680108070374,
-0.5627134442329407,
-0.507235050201416,
-0.06982485949993134,
0.2859608232975006,
-0.5070976614952087,
-0.12944710254669... | |
no separation of concerns.
> * One script would hold database code, business logic, HTML markup and any javascript code needed for the final page rendering.
> * Code reuse was difficult as was automated testing.
>
>
> This came to be known as "Model 1" JSP programming.
>
>
> [MVC or the Model View Controller patter... | [
0.17043720185756683,
-0.22962990403175354,
0.08352819830179214,
0.08651801198720932,
-0.3147076964378357,
0.01928490772843361,
0.08669069409370422,
-0.608874499797821,
-0.4408111870288849,
-0.4032523036003113,
0.0854070857167244,
0.546154260635376,
-0.7164930105209351,
-0.23055659234523773... | |
separation.
>
> Doing so involves writing the Model layer as Beans or Plain Old Java Objects (POJOs), using servlets as the Controller, and then, when all the heavy lifting is done, forwarding to a JSP to format and markup the results.
>
> Servlet/JSP applications written using and MVC architecture came to be k... | [
-0.08762695640325546,
-0.26805368065834045,
0.5993644595146179,
-0.04469999298453331,
-0.2572288513183594,
-0.2733977138996124,
0.020483890548348427,
-0.49102333188056946,
-0.6566110253334045,
-0.27532467246055603,
-0.4004402756690979,
0.09508638083934784,
-0.7268015146255493,
0.3267747163... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.