text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
story says the `logged_in?` method is protected despite the `features/step_definitions/ra_env.rb` file calling:
```
ApplicationController.send(:public, :logged\_in?, :current\_user, :authorized?)
```
Doesn't that call make those methods available without needing stubbing?
Oh, and I'm trying to run autospec, so I've ... | [
0.41260725259780884,
0.0704135149717331,
0.39302390813827515,
0.07043534517288208,
-0.08421669155359268,
-0.27940574288368225,
0.6206880211830139,
-0.30158451199531555,
0.00468025915324688,
-0.3873874247074127,
-0.09062676131725311,
0.8527466058731079,
-0.023881563916802406,
-0.04234218597... | |
h['HTTP_REFERER'] = @current_url if @current_url
debug_log "REQUESTING PAGE: #{http_method.to_s.upcase} #{url} with #{data.inspect} and HTTP headers #{h.inspect}"
if h.empty?
send "#{http_method}", url, data || {}
else
send "#{http_method}", url, data || {}, h
end
save_an... | [
-0.24676093459129333,
0.21947748959064484,
0.9603869915008545,
0.013381179422140121,
-0.07573435455560684,
-0.14509209990501404,
0.22634336352348328,
-0.4809481203556061,
-0.12668821215629578,
-0.7041558623313904,
-0.5569232106208801,
0.29057639837265015,
-0.2594990134239197,
0.26344740390... | |
reset
@current_url = url
@http_method = http_method
@data = data
if internal_redirect?
check_for_infinite_redirects
request_page(response_location, :get, {})
end
return response
end
```
Notice the `if internal_redirect? ... end`. This if is the one ... | [
-0.03758249431848526,
-0.2745184302330017,
0.5391455888748169,
0.10214501619338989,
0.12452875077724457,
-0.13072611391544342,
0.5769016742706299,
-0.30748435854911804,
-0.24911551177501678,
-0.5541407465934753,
-0.15502995252609253,
0.49527981877326965,
-0.27504944801330566,
0.30976322293... | |
can comment those lines on your webrat session but this is probably not a decent solution. I'll work a bit more and post a patch somewhere. | [
0.7967044115066528,
0.13335849344730377,
0.20377974212169647,
0.1682899445295334,
-0.06304298341274261,
-0.16079537570476532,
0.45770263671875,
0.4550827145576477,
-0.04974965751171112,
-0.654629647731781,
0.23809297382831573,
0.1620808094739914,
0.13475336134433746,
-0.030905118212103844,... | |
I work on a large code base with a large install base of users. The code was originally written in vb6 with a few c++ COM modules for low level work.
It is completely infeasible to rewrite all of the code that is already written in vb6 and is being used by our customers every day, but we are also continuing to make im... | [
0.8493251204490662,
0.28171974420547485,
0.3933321535587311,
-0.3470386862754822,
0.05853033438324928,
-0.06324542313814163,
0.11376878619194031,
-0.15076260268688202,
-0.08666021376848221,
-0.6122459173202515,
-0.052962690591812134,
0.75096195936203,
-0.12722446024417877,
0.10257878154516... | |
anyone out there have experience with long term software suites like this (10+ years) that can't be stopped for a complete rewrite, but need continual new development at the same time. Also, in mixed systems like this, what is the best way to interface the modules? I am using COM right now, but have considered IPC with... | [
0.6069760918617249,
0.05268404632806778,
0.15396155416965485,
0.3186201751232147,
0.1537468284368515,
0.025197599083185196,
-0.029241051524877548,
-0.10525131970643997,
-0.4770779013633728,
-0.8363447785377502,
0.15941795706748962,
0.5699018836021423,
0.07040516287088394,
-0.12848365306854... | |
will essentially boil down to 'developer time'.
First, you want whatever is working to keep working. If you have something that is working, and there is no good reason to rewrite it, keep it.
If some of your existing code needs updating to do its job, then you are looking at maintenance costs. At this point you need ... | [
0.5654144287109375,
0.3800945580005646,
0.14014771580696106,
0.10342776775360107,
0.3221215605735779,
-0.11447692662477493,
0.3643221855163574,
-0.1308830976486206,
-0.07445884495973587,
-0.690251350402832,
-0.19524362683296204,
0.9869519472122192,
-0.05143613740801811,
-0.0359982736408710... | |
modular, you can usually chip away at it one piece at a time. Rewrite the high maintenance components first.
If you will be doing new development in C# then you should be fine working with COM components until you have enough justification to replace them. | [
0.3712848424911499,
0.0189187191426754,
-0.11243896931409836,
0.16846737265586853,
-0.02139422483742237,
0.09628983587026596,
-0.22963516414165497,
-0.03289166837930679,
-0.5524028539657593,
-0.622719943523407,
0.193611279129982,
0.6536661386489868,
-0.07487108558416367,
-0.070733308792114... | |
Greetings
I have a Flex application that does a variety of request to a web application located in a different domain. Thus I've made a custom crossdomain.xml to allow access from my Flex app.
The content of this file is
```
> <!DOCTYPE cross-domain-policy SYSTEM
> "http://www.adobe.com/xml/dtds/cross-domain-policy.... | [
-0.10312718898057938,
0.20929324626922607,
1.1521015167236328,
0.0392487533390522,
-0.30220311880111694,
-0.0573095977306366,
0.19933882355690002,
-0.13913145661354065,
-0.12649820744991302,
-0.7124800682067871,
-0.24100856482982635,
0.024211810901761055,
-0.20285257697105408,
0.1053817048... | |
upload using the FileReference Object. Even when my HTTP Form is located under the services subfolder and that I am correctly loading the crossdomain.xml file (I can do either http requests and web services requests ) everytime i try to do a file upload i get the infamous Security Sandbox Violation.
I am missing somet... | [
0.34186917543411255,
0.025154754519462585,
0.6877102851867676,
-0.09655928611755371,
-0.16462591290473938,
-0.35496091842651367,
0.20934277772903442,
-0.39702168107032776,
-0.3977697491645813,
-0.6258314251899719,
-0.03987725451588631,
0.8922101259231567,
-0.49996399879455566,
-0.051974337... | |
a [socket policy file](http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html).
An easier alternative is to do the upload via a RemoteObject. To do this you will need to use the new FileReference APIs in Flash Player 10 so that you can read the bytes of the file client-side and then send them to the... | [
0.40117165446281433,
-0.14964282512664795,
0.3207363188266754,
-0.08290638029575348,
-0.34665200114250183,
-0.1840972751379013,
-0.18594124913215637,
0.028889425098896027,
-0.29944688081741333,
-0.564943790435791,
-0.5376518964767456,
0.8335239887237549,
-0.341864675283432,
0.1143573895096... | |
I changed my show controller to find records by their permalink rather than their id (for SEO juiciness).
```
def show
@project = Project.find_by_permalink(params[:id])
end
```
But, if I type in localhost:3000/projects/foo (and there is not a project with a foo permalink) I get a 500 server error instead of a 404 ... | [
0.21943159401416779,
0.14545394480228424,
0.5726438164710999,
0.0020807115361094475,
-0.0905412957072258,
-0.3467245399951935,
0.532644510269165,
-0.0821537971496582,
-0.5447813868522644,
-0.4840991497039795,
-0.22812767326831818,
0.3539755642414093,
-0.2962278425693512,
0.4536951184272766... | |
Is there any way to get some Windows event when new application(s) gets added into memory/taskbar?
I can get running applications by iterating through Process.GetProcesses() (although, explorer processes will be excluded for some reason), but that means that I have to check for new processes every few seconds which ... | [
0.35064753890037537,
-0.26306912302970886,
0.16651983559131622,
0.35308414697647095,
0.11176948994398117,
-0.21132658421993256,
0.3257785141468048,
0.1540130078792572,
-0.4830450713634491,
-0.6907236576080322,
0.08098985254764557,
0.7362595796585083,
-0.14311100542545319,
0.136614814400672... | |
have to poll. Using the Win32\_ProcessStartTrace class you don't have to poll. New events are raised as events in your code. Below is an example (Add System.Management as a reference in your project)
```
public System.Management.ManagementEventWatcher mgmtWtch;
private delegate void ListBoxItemAdd(string Item);
publi... | [
-0.02334919199347496,
-0.08594712615013123,
0.49720898270606995,
-0.1468038260936737,
0.023092297837138176,
0.15981322526931763,
0.37258562445640564,
-0.6329078674316406,
-0.26241856813430786,
-0.5763041973114014,
-0.26119565963745117,
0.6637023687362671,
-0.41605839133262634,
0.1968724727... | |
else
lwProcesses.Items.Add(Item);
}
void mgmtWtch_EventArrived(object sender, System.Management.EventArrivedEventArgs e)
{
//MessageBox.Show((string)e.NewEvent["ProcessName"]);
foreach (Process p in Process.GetProcesses("."))
{
string Title = p.MainWindowTitl... | [
-0.12172666192054749,
-0.14397242665290833,
0.5446723103523254,
-0.42985033988952637,
0.4124775826931,
0.2951204180717468,
0.43358245491981506,
-0.30148956179618835,
-0.15768519043922424,
-0.26149505376815796,
-0.619454562664032,
0.524802029132843,
-0.2377040833234787,
0.49835607409477234,... | |
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
mgmtWtch.Stop();
}
``` | [
0.04941351339221001,
0.028376607224345207,
0.44518351554870605,
-0.20217016339302063,
0.38717716932296753,
-0.261859267950058,
0.5002286434173584,
0.06660264730453491,
-0.04410987347364426,
-0.320340096950531,
-0.5369972586631775,
0.628408670425415,
-0.48627251386642456,
0.3756632506847381... | |
I wrote this sql query to search in a table:
```sql
SELECT * FROM TableName WHERE Name LIKE '%spa%'
```
The table contain these row for example:
1. Space Company.
2. Spa resort.
3. Spa hotel.
4. Spare Parts.
5. WithoutTheKeyword.
I want to know how to edit this query so it return the results sorted like this:
> 2... | [
0.3353581428527832,
0.5383580923080444,
0.5678020715713501,
-0.13431638479232788,
0.17375807464122772,
0.15436121821403503,
-0.06963062286376953,
-0.2952514886856079,
-0.24745622277259827,
-0.47582387924194336,
-0.05429407209157944,
0.5377442836761475,
-0.09649592638015747,
0.6239750981330... | |
this will work better
```
Select * from TableName where Name Like 'Spa%'
ORDER BY DIFFERENCE(name, 'Spa') desc;
```
FWIW I did some quick tests and if 'Name' is in a NONCLUSTERED INDEX SQL will use the index and doesn't do a table scan. Also, LIKE seems to use less resources than charindex (which returns less desira... | [
0.3618389070034027,
-0.11205464601516724,
0.6038333177566528,
0.01834171637892723,
-0.1998271942138672,
-0.08749061077833176,
0.34568843245506287,
-0.20128323137760162,
-0.003933727275580168,
-0.46648216247558594,
0.3115818202495575,
0.5828508138656616,
-0.4713856279850006,
0.1664263010025... | |
Given a seed string, I want to find its neighbors with at most differ in 2 positions. All the digits involve in generating string are only four (i.e. 0,1,2,3). This is the example for what I mean:
```
# In this example, 'first' column
# are neighbors with only 1 position differ.
# The rest of the columns are 2 positio... | [
0.03566529229283333,
0.18480660021305084,
0.18391451239585876,
-0.05400240421295166,
-0.11512299627065659,
0.47415488958358765,
0.12042875587940216,
-0.520097017288208,
0.2609131634235382,
-0.5445340275764465,
0.23048487305641174,
0.016580775380134583,
-0.08516009896993637,
0.1882566213607... | |
102 103
201 211 221 231 200 202 203
301 311 321 331 300 302 303
011 010 012 013
021 020 022 023
031 030 032 033
000
003
002
Hence given a tag of length L
we will have 3*L + 9L(L-1)/2 neighbors
```
But why this code of mine fails to generate it correctly? Especially when the see... | [
0.1120484247803688,
0.05099714174866676,
0.5233584046363831,
-0.23136721551418304,
-0.09455262124538422,
0.2526475787162781,
0.3287145793437958,
-0.6002063751220703,
0.009258897975087166,
-0.5464512705802917,
-0.021096011623740196,
0.1504090130329132,
-0.21017560362815857,
-0.0591112859547... | |
improvement. Since
we will be processing millions of seed tags of length 34 to 36.
```
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
using namespace std;
string ConvertInt2String(int IntVal) {
std::string S;
std::stringstream out;
out << IntVal;
S = out.str();
return... | [
-0.060547806322574615,
-0.3653542697429657,
0.7210608720779419,
-0.3330773711204529,
0.04583655297756195,
0.3586016297340393,
0.39107951521873474,
-0.8390470147132874,
-0.15408112108707428,
-0.9715599417686462,
-0.09420929104089737,
0.6707839965820312,
-0.4228142499923706,
-0.2626957595348... | |
std::vector < T >&arg, string sep="")
{
for (unsigned n = 0; n < arg.size(); n++) {
cout << arg[n] << sep;
}
return;
}
vector <int> neighbors(vector<int>& arg, int posNo, int baseNo) {
// pass base position and return neighbors
vector <int> transfVec;
transfVec = arg;
//modified a... | [
-0.31001895666122437,
-0.4521014392375946,
0.6517528295516968,
-0.3387920558452606,
-0.3825923800468445,
0.7362157106399536,
0.12021001428365707,
-0.6790019273757935,
-0.36002686619758606,
-0.5485943555831909,
-0.19009988009929657,
0.11945829540491104,
-0.5638232827186584,
0.19566789269447... | |
numTag.push_back(0);
numTag.push_back(0);
numTag.push_back(1); // If "000" this code works, but not 001 or others
// Note that in actual practice numTag can be greater than 3
int TagLen = static_cast<int>(numTag.size());
for ( int p=0; p< TagLen ; p++ ) {
// First loop is to generate... | [
0.18419770896434784,
-0.5860063433647156,
0.5526045560836792,
-0.3070542514324188,
-0.10761362314224243,
0.25819075107574463,
0.16864013671875,
-0.8471933603286743,
-0.14970903098583221,
-0.26093247532844543,
-0.05206417292356491,
0.3608439564704895,
-0.298848032951355,
-0.1153504401445388... | |
int bval = b;
if (numTag[p] == b) {
bval = 0;
}
vector <int> nbnumTag = neighbors(numTag, p, bval);
string SnbnumTag = Vec2Str(nbnumTag); | [
-0.21061933040618896,
-0.41004613041877747,
0.47766727209091187,
-0.5399174094200134,
-0.15507225692272186,
0.2557762563228607,
0.46518582105636597,
-0.4946039021015167,
-0.11129891872406006,
-0.5519442558288574,
-0.3017096221446991,
0.6081709861755371,
-0.44868355989456177,
-0.03752377256... | |
cout << SnbnumTag;
cout << "\n";
// Second loop for tags in 2 position differ
for (int l=p+1; l < TagLen; l++) {
for (int c=1; c<=3; c++) { | [
-0.005470615345984697,
-0.4290628135204315,
0.5803039073944092,
-0.3880632221698761,
0.09353399276733398,
0.20053048431873322,
0.11142957955598831,
-0.3819865882396698,
0.11836796253919601,
-0.39134567975997925,
-0.2573963701725006,
0.3022248148918152,
-0.643830418586731,
-0.18264453113079... | |
int cval = c;
if (nbnumTag[l] == c) {
cval = c;
} | [
-0.08277439326047897,
-0.43786633014678955,
0.3365510106086731,
-0.5280890464782715,
0.29740744829177856,
0.1592222899198532,
0.05230029672384262,
0.08783755451440811,
-0.11034830659627914,
-0.18555189669132233,
-0.4849097728729248,
0.7942439317703247,
-0.2968207895755768,
0.02575389482080... | |
vector <int> nbnumTag2 = neighbors(nbnumTag, l, cval);
string SnbnumTag2 = Vec2Str(nbnumTag2);
cout << "\t" << SnbnumTag2;
cout << "\n"; | [
-0.08843501657247543,
-0.4645107090473175,
0.5883739590644836,
-0.483471542596817,
-0.23388926684856415,
0.4800397753715515,
0.01408270001411438,
-0.13957075774669647,
-0.29969117045402527,
-0.5976235866546631,
-0.20783336460590363,
0.5194830298423767,
-0.6527029275894165,
0.00663287285715... | |
}
}
}
}
return 0;
}
```
Would this do it? It enumerates the tree of possible strings, pruning all with >2 differences from the original.
```
void walk(char* s, int i, int ndiff){
char c = s[i];
if (ndiff > 2) return;
if (c == '\0'){
if (ndiff > 0) print(s);
}
else {
... | [
-0.15708991885185242,
-0.2275109589099884,
0.3489314019680023,
-0.29343801736831665,
0.1587662547826767,
0.07907795161008835,
0.33248379826545715,
-0.7007512450218201,
-0.07022350281476974,
-0.4727453887462616,
-0.35357803106307983,
0.24033652245998383,
-0.6283925175666809,
-0.031495470553... | |
: ndiff+1);
s[i] = '1'; walk(s, i+1, (s[i]==c ? ndiff : ndiff+1);
s[i] = '2'; walk(s, i+1, (s[i]==c ? ndiff : ndiff+1);
s[i] = '3'; walk(s, i+1, (s[i]==c ? ndiff : ndiff+1);
s[i] = c;
}
}
char seed[] = "000";
main(){
walk(seed, 0, 0);
}
``` | [
-0.21973399817943573,
-0.08110111951828003,
0.3198210895061493,
-0.3108523488044739,
0.14245694875717163,
0.22801102697849274,
0.2945646643638611,
-0.7174971699714661,
-0.1732112169265747,
-0.3792083263397217,
-0.35553085803985596,
0.0672239139676094,
-0.4321070611476898,
0.321187406778335... | |
Basically I want to be able to wrap any command in a $.holdTillFinished() method that will not allow execution to continue until the specified method/jquery animation is finished executing.
I suspect that this may be difficult or even impossible in javascript, but I'm hoping someone will know.
I don't want to hear ab... | [
0.6873812675476074,
-0.08907973021268845,
0.23530042171478271,
0.07084708660840988,
0.06836506724357605,
-0.16085408627986908,
0.10747189819812775,
0.4171847701072693,
-0.3872033655643463,
-0.5581649541854858,
-0.0614943690598011,
0.6052539944648743,
-0.15716810524463654,
0.179961055517196... | |
is capable of queuing both user defined methods and animations, that would be cool too. What I really want is a way to delay execution though.(while still allowing animations to function)
> I suspect that this may be difficult or even impossible in javascript
Your suspicion is correct. Methods like animations, user in... | [
-0.10465892404317856,
-0.17380750179290771,
0.4253196716308594,
0.2963598370552063,
0.09800853580236435,
-0.27599114179611206,
0.45842480659484863,
-0.05077444389462471,
-0.1515839844942093,
-0.382779985666275,
-0.16058877110481262,
0.3949200510978699,
-0.2544071078300476,
0.03414092957973... | |
languages have flow-control features that allow you to effectively execute an asynchronous process as one that appears to the caller to be synchronous, and similarly vice-versa. The best-known are [threads](http://en.wikipedia.org/wiki/Thread_(computer_science)) and [continuations](http://en.wikipedia.org/wiki/Continua... | [
0.007150177378207445,
-0.10266463458538055,
0.1943175494670868,
-0.054457370191812515,
-0.2118137627840042,
0.12481125444173813,
0.39456143975257874,
0.36646533012390137,
-0.12004919350147247,
-0.1875980645418167,
-0.10749770700931549,
0.46665510535240173,
-0.7600850462913513,
-0.176479220... | |
In WPF, **where can I put styles that should be applied throughout the application?**
This is because currently, whenever I use a style, I put it in the `<Window.Resources>` section of every window, which ofcourse is wrong in so many ways.
So where can I put these styles to apply throughout?
`<Application.Resources>`... | [
0.7375164031982422,
0.12895140051841736,
0.5797269940376282,
-0.047635726630687714,
0.11870510876178741,
-0.16885320842266083,
0.07742581516504288,
-0.1658986359834671,
-0.42104533314704895,
-0.9591700434684753,
-0.02194969914853573,
0.48973971605300903,
-0.26473569869995117,
-0.0345969013... | |
Here's a simple problem I need to solve, but it makes me feel my hair turning gray as all my attempts are returning me the same error:
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
I have a sample app written in C++ which makes a call to the dll. Here is the ... | [
0.31093829870224,
0.23246711492538452,
0.4979251027107239,
-0.15428850054740906,
-0.00021683577506337315,
0.16262775659561157,
0.2336605340242386,
-0.5301170349121094,
0.0994172915816307,
-0.42992523312568665,
-0.05698254331946373,
0.33255040645599365,
-0.15354225039482117,
0.2598721981048... | |
code, -1, (char *)_code, 200, NULL, NULL);
ocr->convertHKID_Name(_code,&data)
```
Now when I debug the C++ code, it does the proper thing - writes some Unicode data into the data struct.
Here is my attempt to do the same in C#
```
//my C# wrapper class
public class cnOCRsdk
{
[StructLayout(LayoutKind.Sequen... | [
0.2012765258550644,
0.21530111134052277,
0.4082353115081787,
0.08085762709379196,
0.27161434292793274,
0.09763021767139435,
0.22823907434940338,
-0.6138902902603149,
-0.15834592282772064,
-0.5674658417701721,
-0.2612946033477783,
0.13260960578918457,
-0.1894960105419159,
0.0896826311945915... | |
public string Surname;
};
[DllImport(@"cnOCRsdk.dll", CharSet=CharSet.Auto, EntryPoint = "?convertHKID_Name@CcnOCRsdk@@QAE_NPADPAURECO_DATA@@@Z")]
public static extern bool convertHKID_Name(ref string num, ref RECO_DATA o_data);
[DllImport("Kernel32.dll")]
public static extern int WideCharToMultiB... | [
-0.16851463913917542,
-0.19385389983654022,
0.46075960993766785,
-0.033116817474365234,
0.09187868237495422,
0.32884320616722107,
0.04853742942214012,
-0.22842395305633545,
-0.1001717820763588,
-0.50132155418396,
-0.4726964235305786,
0.5587682127952576,
-0.29207679629325867,
0.437031835317... | |
better to pass
IntPtr lpUsedDefaultChar // NULL
);
}
//my attempt to call the function from the dll
cnOCRsdk.RECO_DATA recoData = new cnOCRsdk.RECO_DATA();
string num = "262125355174";
StringBuilder sb = new StringBuilder(200, 200);
cnOCRsdk.WideCharToMultiByte(65001, 0, num, -1, sb, 200, IntPtr.Zero, ... | [
-0.07510178536176682,
-0.033696822822093964,
0.5992650389671326,
-0.35766905546188354,
0.03623538464307785,
0.10380803793668747,
0.8550357222557068,
-0.5411832332611084,
0.04547787085175514,
-0.6588202118873596,
-0.09216806292533875,
0.4327693283557892,
-0.3084585666656494,
0.0148885138332... | |
it should work if you
1. Change the declaration on
`convertHKID_Name` to `CharSet.Ansi`
2. Remove the "ref" from the string
parameter
3. Pass the `string num`
directly to `convertHKID_Name` instead
of calling `WideCharToMultiByte` | [
0.3757959306240082,
-0.15744446218013763,
0.10173551738262177,
-0.241533100605011,
-0.005723361391574144,
-0.3042510151863098,
0.26795706152915955,
-0.2722598910331726,
0.05206422135233879,
-0.4345720112323761,
0.018482614308595657,
0.6367015242576599,
-0.287591814994812,
0.144573301076889... | |
I'm running a web application that displays some debugging behavior if it's being run locally - quotes around resource strings, etc - and I'd like to demo the application on my laptop at a conference where I won't have internet access, so it has to be local.
The application uses HttpContext.Current.Request.IsLocal to ... | [
0.3879598379135132,
0.27288785576820374,
0.2275390774011612,
0.022391196340322495,
-0.0443691611289978,
-0.2526721954345703,
0.6048570275306702,
0.19969899952411652,
-0.30929505825042725,
-0.561514675617218,
-0.02677983231842518,
0.45748215913772583,
-0.00950070470571518,
0.309706240892410... | |
out), but would rather not make a special build for this demo. If need be, I'll do that, but I'd rather use the existing codebase untouched.
That would require spoofing a non-local IP address in requests to your local instance of IIS. I think you'd probably spend less time just making a demo build than trying to make t... | [
0.5573171377182007,
0.06660620868206024,
0.04437093809247017,
0.060240164399147034,
0.08905451744794846,
-0.23177564144134521,
0.3650338649749756,
0.004971037618815899,
-0.14894264936447144,
-0.5288060903549194,
-0.17885679006576538,
0.500178873538971,
-0.26875072717666626,
0.2471430301666... | |
I've heard that i++ isn't a thread-safe statement since in assembly it reduces down to storing the original value as a temp somewhere, incrementing it, and then replacing it, which could be interrupted by a context switch.
However, I'm wondering about ++i. As far as I can tell, this would reduce to a single assembly i... | [
0.21603021025657654,
0.17629089951515198,
-0.02585277147591114,
-0.21631450951099396,
-0.30367106199264526,
-0.042267344892024994,
0.335165798664093,
0.015315938740968704,
-0.34686288237571716,
-0.3085312843322754,
-0.1932336986064911,
0.39370906352996826,
-0.4534231126308441,
0.0532573647... | |
specific processor architecture but it's not mandated in the standards at all. In fact, since multi-threading isn't part of the ISO C or C++ standards (a), you can't consider anything to be thread-safe based on what you think it will compile down to.
It's quite feasible that `++i` could compile to an arbitrary sequenc... | [
0.0342138409614563,
0.08857211470603943,
0.29109254479408264,
0.09508480876684189,
-0.13540203869342804,
0.010651672258973122,
0.14018447697162628,
-0.22830599546432495,
-0.4484596252441406,
-0.5683786273002625,
-0.08809360861778259,
0.47991642355918884,
-0.45672446489334106,
0.01636893860... | |
and compile it into:
```
lock ; disable task switching (interrupts)
load r0,[i] ; load memory into reg 0
incr r0 ; increment reg 0
stor [i],r0 ; store reg 0 back to memory
unlock ; enable task switching (interrupts)
```
where `lock` disables and `unlock` enables interrupts. But, even then, this ... | [
-0.012297375127673149,
0.039844587445259094,
0.20505182445049286,
-0.17640013992786407,
0.3249143064022064,
0.09927867352962494,
0.3166099786758423,
-0.2410614937543869,
-0.1572251170873642,
-0.4300694167613983,
-0.5592179894447327,
0.6311011910438538,
-0.4197674095630646,
-0.0936338603496... | |
built into the language) will provide thread-safe constructs and you should use those rather than depend on your understanding (or possibly misunderstanding) of what machine code will be generated.
Things like Java `synchronized` and `pthread_mutex_lock()` (available to C/C++ under some operating systems) are what you... | [
0.4096221327781677,
0.2233690768480301,
0.06416109949350357,
-0.0541037991642952,
0.10616746544837952,
-0.1662006676197052,
0.0495234876871109,
-0.11010441184043884,
-0.35838842391967773,
-0.39613595604896545,
-0.21657949686050415,
0.32494255900382996,
-0.2929811477661133,
-0.2160311788320... | |
I have a texture which has only 1 channel as it's a grayscale image. When I pass the pixels in to glTexImage2D, it comes out red (obviously because channel 1 is red; RGB).
```
glTexImage2D(
GL_TEXTURE_2D, 0, GL_RGBA,
dicomImage->GetColumns(), dicomImage->GetRows(),
0, GL_RGBA, GL_UNSIGNED_BYTE, pixelArrayP... | [
0.02496962808072567,
0.025201357901096344,
0.8555735945701599,
-0.3276738226413727,
-0.3289329409599304,
0.2658350169658661,
0.16706562042236328,
-0.1783580183982849,
-0.10992204397916794,
-1.0071097612380981,
-0.1348104327917099,
0.5512813329696655,
-0.26574692130088806,
0.392791926860809... | |
I ran:
```
javac Perf.java
```
and got:
```
ERROR in Prefs.java (at line 36)
HashMap<String, String> map = new HashMap<String, String>();
^^^^^^^^^^^^^^
Syntax error, parameterized types are only available if source level is 1.5
```
When I type: `java -version`
I get:
```
java version "1.6.0_0"
IcedTe... | [
0.12129268795251846,
0.3426961302757263,
0.20902647078037262,
-0.169496551156044,
-0.05190717428922653,
-0.07103962451219559,
0.6066815853118896,
-0.11028143763542175,
-0.10109169036149979,
-0.37384873628616333,
0.0686350017786026,
0.31662169098854065,
-0.6168368458747864,
0.25657272338867... | |
this in ClearCase is to use **attribute** within a **[config-spec](http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.cc_ref.doc/topics/config_spec.htm)**.
According to the [version selector](http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm... | [
0.09366567432880402,
-0.03605826571583748,
0.4318501651287079,
0.21960729360580444,
0.10366271436214447,
-0.35485807061195374,
-0.08321858197450638,
0.03117617405951023,
-0.1923043429851532,
-0.3304581344127655,
-0.4090249240398407,
0.5036140084266663,
-0.2916133403778076,
0.09240987151861... | |
answer](https://stackoverflow.com/questions/680162/wildcards-or-placeholders-in-clearcase-config-specs-possible/680219#680219), a few comments:
The solution to include a common config spec can work for Base ClearCase solution, but:
* need to be in a share available by all concerned developer
* the **[setcs](http://pu... | [
0.09422798454761505,
0.1151433140039444,
0.6986042857170105,
0.08149896562099457,
0.24726083874702454,
-0.1673620045185089,
0.1850874125957489,
-0.5010351538658142,
-0.23221594095230103,
-0.36007940769195557,
-0.350589781999588,
0.46434757113456726,
0.04776244983077049,
-0.0703741535544395... | |
spec file changes (there is no native notification included in ClearCase)
---
If you need to have one "environment" (i.e. one "view" or workspace) with a variable content (depending on a different branch), you need to define a symbolic link (or a windows subst) pointing to different views (each with their own config ... | [
0.38558459281921387,
-0.36766988039016724,
0.6543155312538147,
0.1521797627210617,
0.1541670709848404,
-0.20164988934993744,
0.011257930658757687,
0.041037417948246,
-0.40269699692726135,
-0.5601279139518738,
-0.24722297489643097,
0.5936836004257202,
-0.4479427933692932,
0.1140895783901214... | |
I have created a threaded service the following way:
```
public class TCPClientService extends Service{
...
@Override
public void onCreate() {
...
Measurements = new LinkedList<String>();
enableDataSending();
}
@Override
public IBinder onBind(Intent intent) {
//TODO: Replace with service bindin... | [
0.4090305268764496,
-0.21420764923095703,
0.7293195724487305,
-0.1435849666595459,
0.3556951880455017,
-0.004994296468794346,
0.5921586155891418,
-0.5315274000167847,
-0.03814840689301491,
-0.5593999624252319,
-0.1898358166217804,
0.2751852869987488,
-0.46892958879470825,
0.43354332447052,... | |
...
}
}
private Runnable backgrounSendData = new Runnable() {
public void run() {
doSendData();
}
};
private void enableDataSending() {
SendDataThread = new Thread(null, backgrounSendData, "send_data");
SendDataThread.start();
}
private void addMeasurementToQueue() {
if(Measu... | [
0.6924586892127991,
-0.42759203910827637,
0.5869982242584229,
-0.3419707417488098,
0.19510512053966522,
-0.009901204146444798,
0.46699851751327515,
-0.6481738090515137,
-0.16079138219356537,
-0.5600121021270752,
-0.1554185450077057,
0.3057206869125366,
-0.46176207065582275,
0.3208087682723... | |
while(true) {
try {
if(Measurements.isEmpty()) {
Thread.sleep(1000);
continue;
}
//Log.d("TCP", "C: Connecting..."); | [
0.5081555247306824,
-0.26239606738090515,
0.3200666308403015,
-0.12540516257286072,
0.7360789179801941,
-0.005735021084547043,
0.632392168045044,
-0.09575898200273514,
-0.148208886384964,
-0.41403740644454956,
-0.23869122564792633,
0.48732244968414307,
-0.027572164312005043,
0.449496865272... | |
Socket socket = new Socket();
socket.setTcpNoDelay(true);
socket.connect(new InetSocketAddress(serverAddress, portNumber), 3000);
//socket.connect(new InetSocketAddress(serverAddress, portNumber));
if(!socket.isConnected()) {
throw new Exception("Serv... | [
-0.05830951780080795,
-0.1629563271999359,
0.5072391629219055,
-0.06776995956897736,
0.045570727437734604,
0.24398717284202576,
0.5564968585968018,
-0.05150638520717621,
-0.11858057975769043,
-0.7585402727127075,
-0.26817086338996887,
0.21531298756599426,
-0.18547630310058594,
0.5220896005... | |
}
try {
//Log.d("TCP", "C: Sending: '" + message + "'");
PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())),true);
String message = Measurements.remove(); | [
0.23466342687606812,
-0.23293808102607727,
0.31264951825141907,
-0.25132253766059875,
0.48558831214904785,
0.49103114008903503,
0.3818471431732178,
-0.5190152525901794,
0.1712752878665924,
-0.6011245846748352,
0.041361380368471146,
0.38283902406692505,
-0.3479304909706116,
0.10941067337989... | |
out.println(message);
Thread.sleep(200);
Log.d("TCP", "C: Sent.");
Log.d("TCP", "C: Done.");
connectionAvailable = true; | [
-0.04283112660050392,
-0.251721054315567,
0.45655879378318787,
-0.25882020592689514,
0.35909298062324524,
-0.1340901106595993,
0.5128628015518188,
0.033003274351358414,
-0.3982275128364563,
-0.5118857026100159,
-0.3369923233985901,
0.5645361542701721,
-0.3118920922279358,
0.639254868030548... | |
} catch(Exception e) {
Log.e("TCP", "S: Error", e);
connectionAvailable = false;
} finally {
socket.close();
announceNetworkAvailability(connectionAvailable); | [
0.13171300292015076,
-0.3540658950805664,
0.3178790509700775,
-0.18805097043514252,
0.22927448153495789,
-0.266151487827301,
0.35862353444099426,
0.0014898066874593496,
0.09117027372121811,
-0.34720832109451294,
-0.47849157452583313,
0.4680456519126892,
-0.3540133833885193,
0.3356234133243... | |
}
} catch (Exception e) {
Log.e("TCP", "C: Error", e);
connectionAvailable = false;
announceNetworkAvailability(connectionAvailable);
}
}
}
...
}
```
After I close the application the phone works really slow and I guess it is due to thread termination fail... | [
0.13294421136379242,
0.08286814391613007,
0.6074102520942688,
-0.03502408042550087,
0.4144367277622223,
-0.39245033264160156,
0.7095817923545837,
0.16200663149356842,
-0.10149529576301575,
-0.4401310682296753,
-0.3414778709411621,
0.5254359245300293,
-0.302116334438324,
0.40871813893318176... | |
is the best way to terminate all threads before terminating the application?
**Addendum**: The Android framework provides many helpers for one-off work, background work, etc, which may be preferable over trying to roll your own thread in many instances. As mentioned in a below post, AsyncTask is a good starting point t... | [
0.2628791332244873,
0.022433478385210037,
0.2691109776496887,
0.08594617247581482,
0.11477664858102798,
-0.20718900859355927,
0.5332775115966797,
0.38901689648628235,
-0.30033475160598755,
-0.32981738448143005,
-0.3113178610801697,
0.5163305997848511,
-0.3036547601222992,
0.038362927734851... | |
dependent variables in inconsistent states in some circumstances. See [this Sun answer page](http://java.sun.com/j2se/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html) for more details (Edit: that link is now dead, see [this page for why not to use Thread.stop()](https://www.securecoding.cert.org/confluence/displa... | [
0.02460964396595955,
-0.3975089490413666,
0.4478691518306732,
-0.03541586548089981,
0.04784669727087021,
-0.32065221667289734,
0.47689521312713623,
-0.24854013323783875,
-0.3997107446193695,
-0.1684102863073349,
-0.13201004266738892,
0.6327356696128845,
-0.6761249899864197,
0.4965431690216... | |
run(){
while(Thread.currentThread() == runner){
//do stuff which can be interrupted if necessary
}
}
```
This is just one example of how to stop a thread, but the takeaway is that you are responsible for exiting a thread just as you would any other method. Maintain a method of cross thread communcation (in th... | [
0.5947753190994263,
-0.24126440286636353,
0.2751713693141937,
0.15175601840019226,
0.19475217163562775,
-0.37676486372947693,
0.47797542810440063,
-0.13250933587551117,
-0.4032963812351227,
-0.48053672909736633,
0.06249765679240227,
0.3385390639305115,
-0.43095266819000244,
0.3432420492172... | |
thread) at the same time without any synchronization. It looks like you don't have to roll your own synchronization, you can use a [BlockingQueue](http://developer.android.com/reference/java/util/concurrent/BlockingQueue.html).
3) You are creating a new Socket every iteration of your sending Thread. This is a rather h... | [
0.32844629883766174,
-0.06961002200841904,
0.38934266567230225,
0.13060545921325684,
-0.13610127568244934,
-0.09244012087583542,
0.3740489184856415,
-0.09168626368045807,
-0.4950641691684723,
-0.4839117228984833,
0.1458451896905899,
0.31857869029045105,
-0.45018550753593445,
0.369279950857... | |
note about using a persistent Socket, socket methods which block, such as reading, cannot be interrupted by Thread.interrupt(), and so when you want to stop the thread, you must close the socket as well as calling interrupt)
4) There is little point in throwing your own exceptions from within a Thread unless you expec... | [
-0.041514717042446136,
-0.18201731145381927,
0.17622722685337067,
0.03106626123189926,
0.23656028509140015,
-0.40824586153030396,
0.7039227485656738,
0.01839916780591011,
-0.4807628393173218,
-0.3550031781196594,
-0.2580980360507965,
0.5111106634140015,
-0.4443507790565491,
0.5741561651229... | |
//do stuff which can be interrupted if necessary
if(/*fatal error*/){
stopThread();
return; //optional in this case since the loop will exit anyways
}
}
}
```
Finally, if you want to be sure a thread exits with the rest of your application, no matter what, a good technique is to cal... | [
0.6556318402290344,
-0.11020056158304214,
0.5159060955047607,
-0.15688246488571167,
0.34767743945121765,
-0.48520052433013916,
0.5573036670684814,
-0.07906045019626617,
-0.33202263712882996,
-0.5202136039733887,
-0.3825596570968628,
0.6149061918258667,
-0.36693575978279114,
0.3791725039482... | |
that it is automatically destroyed if there are no non-daemon threads running (such as if your app quits).
Obeying best practices with regards to Threads should ensure that your app doesn't hang or slow down the phone, though they can be quite complex :) | [
0.3510259985923767,
-0.04127269983291626,
0.008116127923130989,
0.3178543448448181,
0.1971350908279419,
-0.3761967718601227,
0.5238483548164368,
0.012827480211853981,
-0.36268487572669983,
-0.16008883714675903,
-0.3278505206108093,
0.5577704310417175,
-0.4671970307826996,
0.142430245876312... | |
A long while ago I developed systems using Egeria an expert system language. It had a really useful feature where variables had three values, a min, max and current. In this way the probability of a partly known value could calculated, with the results ending up as a range. I can't remember the syntax, but it was somet... | [
0.05184606835246086,
0.04474397376179695,
0.2406580001115799,
0.020934604108333588,
-0.4260404407978058,
0.4822676479816437,
-0.1419277787208557,
-0.21911200881004333,
-0.2030574381351471,
-0.27873513102531433,
0.24651873111724854,
0.4896506071090698,
-0.18502084910869598,
0.03646259382367... | |
used in constraint-based programming. For a recent paper see Radul and Sussman, ["The Art of the Propagator"](http://dspace.mit.edu/handle/1721.1/44215 "The Art of the Propagator").
Mr. Radul presented at ILC 2009 last week. He gave an example of (what one might consider) multi-valued variables that represent a proba... | [
0.06332308053970337,
-0.41368570923805237,
-0.06417270004749298,
0.4312196373939514,
-0.5028327107429504,
0.20038866996765137,
0.3463992774486542,
-0.621199905872345,
-0.1215953677892685,
-0.23739992082118988,
-0.014531446620821953,
0.8268412947654724,
-0.6952081322669983,
-0.3454588353633... | |
Should the system fail in the attempt to compute the temperature? Perhaps the "truth" can be expressed in terms of the range where the readings overlap. | [
0.3457798659801483,
0.132905513048172,
0.35423943400382996,
0.2497386336326599,
-0.001878084265626967,
-0.12588068842887878,
0.6668636202812195,
-0.5795432329177856,
0.01724250428378582,
-0.2777741551399231,
0.10087641328573227,
0.3407894968986511,
0.12083538621664047,
0.34995797276496887,... | |
've been running through the MSDN help documents to get a hang of Visual Basic. After trying out the example using timers --one drags a label and timer component into the designer and adds the following to the components subroutine
```
Label1.Text = My.Computer.Clock.LocalTime.ToLongTimeString
```
The output for the... | [
0.18306466937065125,
0.17859984934329987,
0.6131063103675842,
-0.20955777168273926,
0.06391532719135284,
-0.10398734360933304,
0.4108762741088867,
-0.307399183511734,
-0.08966261148452759,
-0.8095124959945679,
-0.3137223720550537,
0.6439244747161865,
-0.2941610515117645,
0.1161082163453102... | |
this error and try to move on? Or, am I dealing with something much more serious?
When you see something about a first chance exception, it only means that an exception was caught within the code you called but does not necessarily mean that the code failed. If the code runs without causing your program to crash and re... | [
0.39936619997024536,
0.1994038075208664,
-0.10353236645460129,
0.1391565501689911,
0.009159950539469719,
-0.1831440031528473,
0.5377936363220215,
0.2217802256345749,
-0.32255685329437256,
-0.6292484402656555,
0.012376240454614162,
0.3879876434803009,
-0.20931293070316315,
0.140442699193954... | |
I am using a checked list box in my project c#.net windows application.
I want to sort the list box such that checked items should come first and unchecked displays after it.
How can i do it ? any code to do it ?
Make a resource of each top-level model in your system. By top-level, I mean models that are independent ... | [
-0.03526328504085541,
-0.11097835004329681,
0.3595286011695862,
0.42319950461387634,
0.18421511352062225,
0.25481361150741577,
-0.2843259871006012,
-0.041020989418029785,
-0.19148197770118713,
-0.7571343183517456,
-0.020211437717080116,
0.3727525472640991,
-0.10507781058549881,
0.189587429... | |
prior work history can be accessed through the Candidate resource, since they don't exist on their own.
**Models**
```
class Position
has_many :candidate_positions
has_many :candidates, :through => :candidate_positions
end
class Candidate
has_many :candidate_positions
has_many :positions, :through => :candid... | [
-0.24665986001491547,
0.17810215055942535,
0.18818449974060059,
0.19923928380012512,
0.1784481555223465,
0.10837895423173904,
0.022792572155594826,
-0.4856865704059601,
-0.5990652441978455,
-0.9722119569778442,
-0.005174559541046619,
0.3101375997066498,
-0.049792319536209106,
0.36328959465... | |
any of the information on this controller, cool! You already have controllers available to handle the form posts, that will automatically be wired with `<% form_for @candidate %>`. You can render your collection of positions with `<%= render @positions %>`, and because you've made them a resource, Rails will know to lo... | [
-0.01866084709763527,
-0.4115932881832123,
0.6378360390663147,
0.57758629322052,
0.03499707207083702,
-0.18015925586223602,
0.05281297490000725,
0.19015727937221527,
-0.25476375222206116,
-0.8008357882499695,
0.08979818224906921,
0.3352974057197571,
0.00238892063498497,
0.10702674835920334... | |
to retrieve and store objects. Same URL, same controller, just a different format. | [
0.09555192291736603,
-0.29168790578842163,
0.11624186486005783,
0.4475473165512085,
-0.20065920054912567,
-0.019870704039931297,
-0.02335839718580246,
0.14826834201812744,
-0.29421913623809814,
-0.37662941217422485,
-0.07707108557224274,
0.29414331912994385,
-0.3285999596118927,
0.43333938... | |
I am creating an Ad system for an ASP.NET website. The website has a section for advertisers. They register their and posts there ads, They will pay the maximum budget for the ad first, There is a daily budget , so the advertiser can control his budget, There will be a lot of ads from different advertisers to show in t... | [
0.7450742721557617,
-0.036200329661369324,
0.2595318555831909,
0.29665467143058777,
-0.22761987149715424,
0.22677233815193176,
-0.25053009390830994,
-0.11121048033237457,
-0.24995411932468414,
-0.7990333437919617,
0.546051025390625,
0.5550289154052734,
-0.015749141573905945,
-0.04962647706... | |
algorithms.
For example, you could use the budget to determine a number of times / period (day/week/etc), and use that as a weighting factor in a [weighted round robin schedule.](http://en.wikipedia.org/wiki/Weighted_round_robin) This would be a simple way to balance out requests from different advertisers evenly thro... | [
0.19181962311267853,
-0.4259878993034363,
0.3544110953807831,
0.26923123002052307,
-0.009479332715272903,
-0.08396520465612411,
-0.23282401263713837,
-0.25521430373191833,
-0.45577946305274963,
-0.7099862694740295,
0.02192225493490696,
0.558662474155426,
-0.3250455856323242,
-0.03518457710... | |
The sentence below is from, **[The Positive Legacy of C++ and Java](http://www.artima.com/weblogs/viewpost.jsp?thread=252441)** by Bruce Eckel, about operator overloading in C++:
> C++ has both stack allocation and heap
> allocation and you must overload your
> operators to handle all situations and
> not cause mem... | [
0.01701119914650917,
-0.08079957962036133,
-0.311343252658844,
-0.21033020317554474,
-0.08300720900297165,
0.12402714043855667,
0.24352975189685822,
-0.2804180681705475,
-0.20545195043087006,
-0.4823378324508667,
-0.2781749665737152,
0.4320273697376251,
-0.5222501158714294,
-0.017174895852... | |
you must be very careful in doing so to ensure you don't introduce leaks.
Second, some types of objects require that you overload `operator=` to avoid memory management bugs. For example, if you have a reference counting smart pointer object (like the Boost shared\_ptr), you must implement `operator=`, and you must be... | [
0.09663615375757217,
-0.32658934593200684,
0.232746422290802,
-0.04020025208592415,
0.1931329220533371,
-0.2637019157409668,
0.2185649871826172,
-0.4897799491882324,
-0.04789518937468529,
-0.5322508811950684,
-0.29381033778190613,
0.7606120705604553,
-0.43006470799446106,
-0.10498975217342... | |
return *this;
}
...
protected:
T *mData;
};
```
The `operator=` implementation here is broken because it doesn't manage the reference counts on `mData` and `other.mData`: it does not decrement the reference count on `mData`, leading to a leak; and it does not increment the reference count on `other.mData`... | [
-0.02818334847688675,
0.0008438832010142505,
-0.11457228660583496,
-0.12762229144573212,
0.115680031478405,
-0.38450732827186584,
0.5796769857406616,
-0.1782218962907791,
0.13953210413455963,
-0.49512141942977905,
-0.22765319049358368,
0.5793229937553406,
-0.5231917500495911,
0.19961956143... | |
will provide a default implementation which has behavior identical to the implementation shown here -- that is, completely broken for this particular case.
So as the article says -- in some cases you must overload operators, and you must be careful to handle all situations correctly.
**EDIT**: Sorry, I didn't realize... | [
0.01333438977599144,
0.05903639644384384,
0.039413560181856155,
0.050380222499370575,
0.21929702162742615,
-0.4083382189273834,
0.5958884358406067,
-0.06212352216243744,
-0.04067311808466911,
-0.7445535659790039,
-0.36974379420280457,
0.763179361820221,
-0.36454176902770996,
-0.42668747901... | |
Consider the following skeleton of a models.py for a space conquest game:
```
class Fleet(models.Model):
game = models.ForeignKey(Game, related_name='planet_set')
owner = models.ForeignKey(User, related_name='planet_set', null=True, blank=True)
home = models.ForeignKey(Planet, related_name='departing_fleet... | [
-0.4573717713356018,
-0.07691224664449692,
0.24011893570423126,
-0.035370055586099625,
0.23264186084270477,
0.5159574151039124,
-0.2754254937171936,
-0.04406103119254112,
-0.4895261824131012,
-0.6688745021820068,
-0.16501139104366302,
0.524664044380188,
0.03133513033390045,
0.5254559516906... | |
complicated interactions between various data objects. I want to avoid lots of unnecessary calls to the database, so once per turn, I do something like
1. Query all the fleets, planets, and other objects from the database and cache them as python objects
2. Process the game objects, resolving the state of the game
3. ... | [
-0.26152172684669495,
0.10650088638067245,
0.18768581748008728,
0.09382791817188263,
0.27984827756881714,
-0.10139503329992294,
-0.1293916553258896,
0.18222738802433014,
-0.5313292741775513,
-0.6937109231948853,
0.12072522193193436,
0.4295005798339844,
-0.3224833607673645,
0.33404737710952... | |
ships at each of the planets, including the planet fleet.home. Unfortunately, the changes made in the above line are not reflected in the QuerySet of planets that I obtained earlier, so that when I save all the planets at the end of the turn, the changes to fleet.home's ships get overwritten.
Is there some better way ... | [
0.0255892276763916,
-0.07301555573940277,
0.6059983968734741,
0.185091033577919,
0.08343175053596497,
-0.04888305068016052,
-0.3625485301017761,
-0.02373044565320015,
-0.6399093866348267,
-0.7477140426635742,
0.05232500284910202,
0.4438914954662323,
-0.03961847350001335,
0.0851753056049346... | |
it](http://spreadsheets.google.com/ccc?key=pSqnCvef6OXmGWQ9qbEVMeA)). This means that if you arrive at the same database object through two different query paths, you are working with different Python objects in memory.
This means that your design (load everything into memory at once, modify a lot of things, then save... | [
0.1090538501739502,
0.057081229984760284,
-0.02163151279091835,
0.20568940043449402,
0.2796441614627838,
-0.32031485438346863,
-0.05894501134753227,
-0.060918159782886505,
-0.37573936581611633,
-0.3741017282009125,
-0.0015155348228290677,
0.6060452461242676,
-0.48036259412765503,
0.0890948... | |
only one QuerySet at a time, saving anything modified before you make another query; or if you load several queries, look up all relations manually, don't ever traverse ForeignKeys using the convenient attributes for them), or use an alternative Python ORM that implements identity map. [SQLAlchemy](http://www.sqlalchem... | [
0.1087411642074585,
-0.009426295757293701,
0.1484145224094391,
0.0013355115661397576,
-0.06881392747163773,
-0.3297988176345825,
0.2001209557056427,
0.10327613353729248,
-0.2919006943702698,
-0.5838494300842285,
-0.024815134704113007,
0.775502622127533,
-0.3334309160709381,
-0.147483885288... | |
choose a different ORM. | [
0.14398109912872314,
-0.17144711315631866,
-0.0867687240242958,
0.026795953512191772,
-0.33716610074043274,
0.22561950981616974,
0.17002208530902863,
-0.19482684135437012,
-0.26527783274650574,
-0.3976398706436157,
-0.022804301232099533,
0.3752657175064087,
0.03791283816099167,
0.082293190... | |
On a website I made, one person sent me a screenshot which shows that my subtitle font is too large.
* I've checked the site on two machines (Vista) with FF, IE6, IE7, IE8, Safari/win, opera/win.
* I can increase the font size of the browser, but the subtitle stays the same size (since it is 8pt as shown below) which ... | [
0.43792885541915894,
0.18115180730819702,
0.6195377707481384,
-0.19961762428283691,
-0.23410822451114655,
0.31930381059646606,
0.48093900084495544,
-0.0037580712232738733,
-0.471579372882843,
-0.7747408747673035,
0.09473910182714462,
0.3405526280403137,
-0.291914165019989,
-0.0253216251730... | |
websites look fine". Is there something about Windows XP that enables the operating to change the font size in browsers, etc.? Or perhaps a problem with arial/italic on Windows XP?
Here is the CSS for it:
```
#subtitle {
position: absolute;
top: 78px;
left: 40px;
width: 738px;
text-align: right;
... | [
0.3370037376880646,
0.17798610031604767,
0.7848947048187256,
0.10638183355331421,
-0.22429795563220978,
-0.28307509422302246,
0.6005871295928955,
0.23714107275009155,
-0.22710581123828888,
-0.6991696953773499,
-0.22032202780246735,
0.5861180424690247,
-0.21631808578968048,
-0.2608287930488... | |
a size unit. Don't do that. The CSS ‘physical units’ (pt, mm, in...) only make sense for physical output (ie. a print stylesheet).
On-screen, points are mapped to pixels using the system's ‘dpi’ setting, which can vary arbitrarily across machines. Macs/Windows/Linux all default differently, and can be reconfigured. Ma... | [
0.2802193760871887,
-0.17655764520168304,
0.5062364935874939,
0.24261239171028137,
0.02726409025490284,
0.17607806622982025,
-0.08351116627454758,
-0.2217157930135727,
-0.07494711130857468,
-0.8554095029830933,
-0.3015320301055908,
0.1733245998620987,
-0.051945749670267105,
0.1628435999155... | |
you should never completely rely on them being what you expect, but this is almost certainly the cause in this case. | [
0.4675779342651367,
0.19696614146232605,
-0.13594765961170197,
-0.12716655433177948,
-0.0174154844135046,
-0.0156342014670372,
0.32564324140548706,
0.23859719932079315,
-0.14112909138202667,
-0.2371603399515152,
0.015657640993595123,
0.4977090060710907,
0.032540686428546906,
0.071661993861... | |
I'm trying to get a specific set of data while joining 4 different entities together to do so. What I've done is setup a DTO to try to get this working:
```
public class LatestThread
{
private readonly string comment;
private readonly DateTime posted;
private readonly string userName;
private readonly ... | [
0.27262401580810547,
-0.048264794051647186,
0.4629964530467987,
-0.10003537684679031,
0.1767278015613556,
0.21570341289043427,
0.25635644793510437,
0.06341807544231415,
-0.2859812080860138,
-0.6733279824256897,
-0.14295761287212372,
0.6434952616691589,
-0.17320269346237183,
0.4737439155578... | |
reputation, int threadId, string topic, int userId, string avatar)
{
this.comment = comment;
this.avatar = avatar;
this.userId = userId;
this.topic = topic;
this.threadId = threadId;
this.reputation = reputation;
this.userName = userName;
this.posted =... | [
-0.11619725078344345,
-0.2755781412124634,
0.20291315019130707,
-0.02653650753200054,
-0.04041843116283417,
0.21076875925064087,
0.31743189692497253,
0.2777650058269501,
-0.30939236283302307,
-0.5292629599571228,
-0.112572081387043,
0.6337615251541138,
-0.33435913920402527,
0.3851916491985... | |
public string Comment
{
get { return comment; }
}
public DateTime Posted
{
get { return posted; }
}
public string UserName
{
get { return userName; }
}
public int Reputation
{
get { return reputation; } | [
0.32569196820259094,
-0.4159478545188904,
0.05266934633255005,
-0.19085334241390228,
-0.07568670809268951,
0.11455969512462616,
0.09710368514060974,
0.5034158825874329,
0.029298802837729454,
-0.6044518351554871,
-0.1258256435394287,
0.6372264623641968,
-0.07229624688625336,
0.1382640004158... | |
}
public int ThreadId
{
get { return threadId; }
}
public string Topic
{
get { return topic; }
}
public int UserId
{
get { return userId; }
}
public string Avatar
{
get { return avatar; | [
-0.12306598573923111,
-0.4643261730670929,
0.32871344685554504,
0.1459287852048874,
-0.23327133059501648,
0.45037105679512024,
0.10674922168254852,
0.5826566815376282,
-0.13496926426887512,
-0.757960319519043,
-0.20805136859416962,
0.6637904047966003,
-0.412277489900589,
0.4254553616046905... | |
}
}
}
```
Now I thought I could use SimpleQuery like so:
```
string hql = string.Format("select new LatestThread(m.Comment, m.Posted, u.UserName, u.Reputation, t.Id, t.Topic, u.Id, u.Avatar) from Thread as t inner join Message as m on t.Id = m.ThreadId inner join User as u on u.Id = m.PostedById inner join Activ... | [
-0.11004795879125595,
-0.2280118763446808,
0.6874757409095764,
-0.0820084735751152,
0.24355527758598328,
0.12831003963947296,
0.21493394672870636,
-0.1345333456993103,
-0.26725485920906067,
-0.7510167360305786,
-0.08989852666854858,
0.6486247181892395,
-0.23099325597286224,
0.4993124604225... | |
= new SimpleQuery<T>(hql, parameters);
query.SetQueryRange(firstResult, maxResults);
return query.Execute();
}
```
Now it's asking for me to put [ActiveRecord] at the top of my LatestThread class. When I do that it wants a primary key, and that just seems to be the wrong route.
I've also read bit... | [
0.03197634965181351,
-0.23833347856998444,
0.7323046922683716,
-0.24111619591712952,
0.03640749678015709,
0.01009942777454853,
0.3507629930973053,
-0.26415202021598816,
-0.22144187986850739,
-0.4278284013271332,
-0.20717431604862213,
0.6652474403381348,
-0.33235135674476624,
0.378411293029... | |
is there something to tell AR that it's a readonly DTO class? OR am I doing this all wrong and there's a really easy way to do what I'm trying to do.
TIA!
Add the Import attribute to your new Thread class
```
[Import(typeof(LatestThread), "LatestThread")]
[ActiveRecord("Thread")]
public class Thread : ActiveRecordBas... | [
0.13282902538776398,
0.02682894840836525,
0.6363434195518494,
-0.11536642909049988,
0.07378607988357544,
0.07366227358579636,
0.1524861752986908,
-0.44652265310287476,
-0.25675052404403687,
-0.5720260739326477,
0.15534712374210358,
0.730753481388092,
-0.4216313660144806,
0.1609788388013839... | |
a.Lineage like '{0}%' order by t.LastPosted desc", activityLineage);
SimpleQuery<LatestThread> query = new SimpleQuery<LatestThread>(typeof(Thread), hql );
LatestThread[] results = query.Execute()
```
Source : <http://www.kenegozi.com/Blog/2006/10/08/projection-using-activerecords-importattribute-and-hqls-select-... | [
0.038186196237802505,
-0.23698918521404266,
0.3127442002296448,
-0.2713291645050049,
0.08126118779182434,
-0.13168640434741974,
0.13894787430763245,
-0.42344632744789124,
-0.2972505986690521,
-0.4326688051223755,
-0.17629468441009521,
0.2833862006664276,
-0.3327019214630127,
0.435015439987... | |
I asked a [question](https://stackoverflow.com/questions/482431/which-local-database-fits-my-situation) a while ago about which local DB was right for my situation. I needed to access the DB from both .NET code and VB6. The overwhelming response was SQLite. However, I decided to pass on SQLite, because the only OLE DB ... | [
0.03831862285733223,
0.3253795802593231,
0.39421650767326355,
-0.02945520542562008,
-0.19517630338668823,
0.18934404850006104,
0.2290796935558319,
-0.21284393966197968,
0.062618687748909,
-0.6273619532585144,
0.04580945149064064,
0.686230480670929,
-0.3251989781856537,
0.35148289799690247,... | |
the only viable choice is using .MDB files created by Microsoft Access (or the Jet engine).
I haven't used it since late 90s, so I have the following questions to those who have experience with it.
1. Have they resolved the problem where the database would corrupt every now and then.
2. Is access to the MDB from c# ... | [
0.21260753273963928,
0.2915164530277252,
0.22532255947589874,
0.14865529537200928,
-0.04744251072406769,
-0.3956559896469116,
0.061140239238739014,
0.13871800899505615,
-0.07071748375892639,
-0.6646938323974609,
0.16376042366027832,
0.5228412747383118,
-0.47565802931785583,
0.1380065381526... | |
System.Data.SQLite provider for SQLite data access within the .NET code.
Then I'd just create a simple COM interop .NET class for use by VB6 that wraps any required SQLite data access functionality. Finally, just reference and use it like a standard COM object from your VB6 projects.
My knowledge of Access is probab... | [
0.3719337582588196,
-0.036962784826755524,
0.28152745962142944,
0.32050856947898865,
-0.03229673206806183,
-0.06489256024360657,
0.0402509830892086,
0.3627792298793793,
-0.3087141811847687,
-0.777587890625,
0.19689355790615082,
0.5317108035087585,
-0.14662379026412964,
0.43788406252861023,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.