text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
hours, insert in respective row
if x[0] == 'Extra Magic Hours':
#insert in morning row | [
0.4748392403125763,
0.08791253715753555,
0.328071653842926,
0.109554722905159,
0.22022317349910736,
0.16213417053222656,
-0.09448309987783432,
0.2268441766500473,
-0.31313711404800415,
-0.5058127641677856,
-0.29373517632484436,
0.6115760803222656,
-0.17279303073883057,
0.0603318065404892,
... | |
if int(x[1][0:1]) in range(2,9):
wbook.get_sheet(0).write(5, colnum+6, x[1])
#insert in evening row | [
-0.10261064022779465,
0.0871083065867424,
0.4181987941265106,
-0.23666152358055115,
0.09771221876144409,
0.18326392769813538,
0.2545819878578186,
-0.0014586297329515219,
-0.03433471918106079,
-0.39652934670448303,
-0.35585013031959534,
0.3892729580402374,
-0.029318546876311302,
-0.19630342... | |
else:
wbook.get_sheet(0).write(7, colnum+6, x[1])
if month == 05:
break
print 'Done editing. Now saving...'
wbook.save('new.xls')
print 'new.xls saved'
```
Any idea why it might be changing the year? I haven't seen anyone else have the same issue elsewhere.
You evidently ... | [
0.28302231431007385,
0.17806489765644073,
0.46327832341194153,
-0.35055842995643616,
-0.08351205289363861,
0.01576973870396614,
0.3475266695022583,
0.20147721469402313,
-0.29783377051353455,
-0.6671807169914246,
-0.06777985394001007,
0.305581271648407,
-0.17804725468158722,
0.2306586205959... | |
file that is using the 1904 date system. Your immediate problem is that `xlutils` doesn't support copying these files correctly. Fortunately the fix is a one-liner and you can even do it yourself in your script after you have done the copy:
```
wbook = copy(book)
wbook.dates_1904 = book.datemode
```
This works for c... | [
0.4168028235435486,
0.4743430018424988,
0.21923746168613434,
-0.06450308114290237,
0.08339517563581467,
-0.3264290988445282,
0.08051948249340057,
-0.0893348902463913,
-0.01842031069099903,
-0.6716027855873108,
0.03595723956823349,
0.5091734528541565,
-0.5931408405303955,
0.2658668458461761... | |
written and tested a fix which replaces the whole body of the `Row.__excel_date_dt` method. It will be committed to the new `xlwt` repository on `github` soonish. In the meantime here is the code if you are in dire need:
```
def __excel_date_dt(self, date):
adj = False
if isinstance(date, dt.date):
if ... | [
-0.08425205945968628,
0.32040831446647644,
0.332449346780777,
0.025008879601955414,
0.33012300729751587,
0.3534713685512543,
0.04878372326493263,
-0.11474829912185669,
-0.015589595772325993,
-0.7172415256500244,
-0.01852542720735073,
0.24142631888389587,
-0.18484202027320862,
0.41271123290... | |
12, 31)
adj = True
if isinstance(date, dt.datetime):
epoch = dt.datetime(*epoch_tuple)
else:
epoch = dt.date(*epoch_tuple)
else: # it's a datetime.time instance
epoch = dt.datetime(1900, 1, 1) | [
0.2023574411869049,
-0.14142155647277832,
0.3519197702407837,
-0.17355787754058838,
0.19153635203838348,
0.18296654522418976,
-0.001134812948293984,
0.03978382796049118,
-0.10393130779266357,
-0.6296517252922058,
-0.1678319275379181,
0.30668118596076965,
-0.18925634026527405,
0.45067724585... | |
date = dt.datetime.combine(epoch, date)
delta = date - epoch
xldate = delta.days + delta.seconds / 86400.0
# Add a day for Excel's missing leap day in 1900
if adj and xldate > 59:
xldate += 1
return xldate
```
**WARNING** Trying to convert your file to the 1900 system by opening it in ... | [
0.3670583665370941,
-0.0008115764940157533,
0.30709418654441833,
0.0635773092508316,
-0.03524310514330864,
0.03541037067770958,
0.24683597683906555,
-0.025367336347699165,
-0.36192092299461365,
-0.4913705587387085,
-0.0613381564617157,
-0.1609536111354828,
-0.24070048332214355,
0.401340454... | |
appears to work properly is this:*
* open the file in Excel, save it as `XML Spreadsheet 2003 (*.xml)` ...
this format records dates in text format e.g.
`1999-12-31T23:59:59.999`
* open the XML file in a text editor, find the line that reads
`<Date1904/>` ... yes, the XML is human-readable straight out of the
box... | [
0.12069657444953918,
0.41260093450546265,
0.4574905335903168,
0.008091987110674381,
0.029476702213287354,
-0.20361992716789246,
0.03419075161218643,
-0.22024691104888916,
-0.22155188024044037,
-0.6286552548408508,
-0.04658797010779381,
0.3127349317073822,
-0.10318119823932648,
0.3829067945... | |
XLS file | [
-0.038861121982336044,
0.02414879947900772,
-0.13742196559906006,
0.058681756258010864,
-0.012693298980593681,
-0.2390204817056656,
-0.4690941870212555,
0.2605801522731781,
-0.21545690298080444,
-0.6369063258171082,
-0.29809659719467163,
0.04613559693098068,
-0.5311216115951538,
0.19296728... | |
I'm quite new to C++ and I've ran across a problem.
I'm trying to write a game of Blackjack. I have an array of size 52 of type 'char' with the different cards and I want to shuffle it. I'm not sure how but that's not the problem. I made a function called 'ShuffleDeck' but it doesn't work, says it can't return an ar... | [
0.23955734074115753,
0.3976426124572754,
-0.09785261005163193,
-0.33925116062164307,
0.09088271111249924,
-0.06773686408996582,
-0.004166919272392988,
-0.4422760009765625,
-0.6192262768745422,
-0.3586265742778778,
0.18458406627178192,
0.32865503430366516,
-0.37205222249031067,
0.1976607888... | |
{
//something
}
return rgCards[];
}
```
All help appreciated.
You use a `std::vector` and shuffle the values in it. Preferably, pass it by reference to the function and work on the original vector.
From your snippet, it's not entirely clear what you expect it to do - you pass an array of `bool` by re... | [
0.28898435831069946,
-0.13740593194961548,
0.137900710105896,
0.0698218047618866,
-0.025331681594252586,
-0.20257450640201569,
-0.12034415453672409,
-0.11480096727609634,
-0.3663061559200287,
-0.3720279932022095,
-0.27161261439323425,
0.2678438723087311,
-0.39759016036987305,
0.16934834420... | |
When I have a bunch of tabs open, the "close all but this" option is very useful. There are times that I'd like to keep 2 or 3 windows open. Is there a way to multi-select the tabs I want and "close all but selected"?
I use the [Productivity Power Tools extenstion](http://visualstudiogallery.msdn.microsoft.com/d0d33361... | [
0.28183627128601074,
-0.1014021635055542,
0.7734231948852539,
0.0649779736995697,
-0.3299284279346466,
0.11978048086166382,
0.10958228260278702,
-0.054335713386535645,
-0.444684237241745,
-0.7266497015953064,
-0.12431691586971283,
0.6005746722221375,
-0.05362989753484726,
0.157952353358268... | |
What **gems** do you use for helping you be **more productive** or **debug** more easily while coding in Rails?
Some gems are specific to a task, and you find them easily when you need to implement the feature. With this question, I'm looking for all the others, that you might not think to search for, but once you hav... | [
0.4917723834514618,
-0.19745615124702454,
-0.18651631474494934,
0.3029857873916626,
-0.3669421374797821,
0.04244532436132431,
-0.032137855887413025,
0.008880237117409706,
-0.22930416464805603,
-0.7297627329826355,
0.13880214095115662,
0.5779315829277039,
0.014768728986382484,
-0.0897271186... | |
(we have access to all models, etc) and debugger - we might set break-points, watch variables. | [
0.15386302769184113,
-0.01750755123794079,
0.11729355156421661,
0.5909251570701599,
0.2914044260978699,
-0.058270346373319626,
-0.002396871568635106,
-0.2753821015357971,
0.05303755775094032,
-0.45503106713294983,
-0.07261946052312851,
0.7952761054039001,
-0.017692720517516136,
0.090664617... | |
Right now, the white background is killing my eyes, as it's a *looong* dark night.
Is it possible to change the theme (to something darker) from the Dart Editor (v 0.1)? What about picking a background colour and syntax highlighting?
Yes, it is possible and I have just verified this quickfix for a darker background on ... | [
0.08071236312389374,
0.1946658194065094,
0.47649863362312317,
-0.39710432291030884,
-0.06951835006475449,
-0.07562464475631714,
0.3789425790309906,
-0.11128007620573044,
-0.23549427092075348,
-0.5662062764167786,
-0.09572308510541916,
0.5952330827713013,
-0.3977968096733093,
0.028346125036... | |
may create a "complete theme" simply adding more properties to the `org.eclipse.ui.editors.prefs` and `org.eclipse.jdt.ui.prefs` files.
I strongly suggest you to have a look inside the "Eclipse Preferences (EPF)" sample files of the project <http://www.eclipsecolorthemes.org/>
I haven't tried yet but in theory you co... | [
0.3118079900741577,
-0.2557156980037689,
0.6061053276062012,
-0.023949848487973213,
-0.3170361816883087,
-0.3183303475379944,
0.13419818878173828,
-0.24141865968704224,
-0.32162904739379883,
-0.3314700126647949,
0.005260561127215624,
0.36002662777900696,
-0.12095024436712265,
0.04998214915... | |
I have a portrait/portraitupsidedown only app in which I've implemented iAds - it all seems to work successfully, the page I've implemented it on is just an image view and a bunch of buttons so I have it set not to move when the ad moves above the main view, but if I rotate the device I get the banner may be obscured e... | [
0.579817533493042,
0.10635922849178314,
0.7452800869941711,
-0.22727014124393463,
-0.13706663250923157,
-0.0066360183991491795,
0.4142443835735321,
-0.09670933336019516,
-0.131528839468956,
-0.8208754658699036,
0.5215647220611572,
0.6468146443367004,
-0.1540471613407135,
0.0902180373668670... | |
leave the app running for a while ads come and go depending on their availability without warnings - it doesn't seem as though there are ads on top of each other.
Is this likely a brief glitch occurring during rotation and is there some way I can diagnose further?
I have added [self.view bringSubviewToFront:theBanne... | [
0.5343564748764038,
0.05515009164810181,
0.7019264698028564,
0.0034465028438717127,
0.059596721082925797,
-0.15270288288593292,
0.2682589888572693,
0.15254589915275574,
-0.19203776121139526,
-0.42343512177467346,
-0.024611592292785645,
0.5079746842384338,
-0.3065396547317505,
0.01767376624... | |
before using 'DatePart(dw,dates)'
of the week. That means that every time you run the script you should call that datefirst. In case you decide to put it in a function you are screwed because you can't use it inside that function. So every time you call that function you rely on people remembering that datefirst part.... | [
0.2833878695964813,
-0.189944326877594,
0.4109145998954773,
0.07127847522497177,
0.11976735293865204,
0.161586731672287,
0.34601566195487976,
0.025905784219503403,
-0.3007095158100128,
-0.3996819853782654,
0.2669743597507477,
0.22469741106033325,
-0.04967566207051277,
0.6045289039611816,
... | |
weekday. | [
-0.15222910046577454,
-0.08919843286275864,
0.16645048558712006,
-0.28195828199386597,
-0.03732964023947716,
-0.07179787755012512,
0.26853615045547485,
0.7441335320472717,
-0.22211138904094696,
-0.5003119111061096,
-0.6418617367744446,
0.4096851944923401,
-0.35754212737083435,
-0.041152413... | |
All. I am reading a book called and one of the idea is "Don't return null" when writing a method. He suggests either "throw out exception" or "use special case" when the function has to return null.
If the method return type is a list, I know I can return a empty list instead of null. However, what if the return type... | [
0.17121785879135132,
0.12183122336864471,
-0.24169935286045074,
0.1126030907034874,
-0.3339683711528778,
-0.3180606961250305,
0.3925701379776001,
-0.16423490643501282,
0.03194086626172066,
-0.4698712229728699,
-0.06547723710536957,
0.4350876212120056,
-0.7420728802680969,
0.220975920557975... | |
writing more coded and additional logic for any place calls the function.
Any suggestion will be appreciated.
Throwing an exception is an expensive operation, since there is a context switch and a lot of debug information has to be gathered, so you want to avoid throwing them as a way to control process flow (especia... | [
0.15312179923057556,
0.02396490052342415,
-0.16279855370521545,
0.07427652180194855,
-0.3165050745010376,
-0.2708553969860077,
0.41650131344795227,
-0.26486727595329285,
-0.3716423809528351,
-0.49634841084480286,
-0.2386040836572647,
0.2579501271247864,
-0.5092407464981079,
0.0541739463806... | |
instance of an object, or null if not found
FirstOrDefault(); // returns the first matching object, or null if not found
```
This allows you to check for null without trying to figure out control flow using exception handling.
One exception (pardon the pun) that I can think of is using exceptions to communicate acr... | [
-0.15294072031974792,
0.06086810305714607,
-0.28401806950569153,
0.08868849277496338,
-0.25866949558258057,
-0.3355894982814789,
0.4589706361293793,
0.23630942404270172,
-0.33319801092147827,
-0.8126559257507324,
-0.20403458178043365,
0.34193575382232666,
-0.48964396119117737,
0.0754168257... | |
Consider a web service written in ASP.NET Web API to accept any number files as a 'multipart/mixed' request. The helper method mat look as follows (assuming `_client` is an instance of `System.Net.Http.HttpClient`):
```
public T Post<T>(string requestUri, T value, params Stream[] streams)
{
var requestMessage = ne... | [
0.07398833334445953,
-0.3543877899646759,
0.6185631155967712,
-0.029183031991124153,
-0.24179495871067047,
0.24664390087127686,
0.22213704884052277,
-0.5331610441207886,
-0.270876944065094,
-0.6816667914390564,
-0.4786592423915863,
0.35625404119491577,
-0.4445642828941345,
0.16532191634178... | |
content.Add(objectContent);
foreach (var stream in streams)
{
var streamContent = new StreamContent(stream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
streamContent.Headers.ContentDisposition =
new ContentDispositionHeaderValue(... | [
0.1302056908607483,
-0.22313962876796722,
0.7832055687904358,
0.041222989559173584,
0.2741081714630127,
-0.05486088618636131,
0.2591645419597626,
-0.2836645245552063,
-0.11335639655590057,
-0.672794759273529,
-0.5793529748916626,
0.4359084963798523,
-0.4643998146057129,
0.5028361678123474,... | |
FileName = "mystream.doc"
};
content.Add(streamContent);
}
return _httpClient.PostAsync(requestUri, content)
.ContinueWith(t => t.Result.Content.ReadAsAsync<T>()).Unwrap().Result;
}
```
The method that accepts the request in the subclass of ApiController has a signature as follows... | [
0.10611746460199356,
-0.10366267710924149,
0.5779533982276917,
-0.026505233719944954,
0.1471734493970871,
-0.09478422999382019,
0.26583102345466614,
-0.28048667311668396,
0.04803866147994995,
-0.7484568953514099,
-0.3090004622936249,
0.3533044159412384,
-0.2825463116168976,
0.2581857442855... | |
'Content-Disposition' header.
```
public HttpResponseMessage Post(Contact contact, Stream source, Stream target)
{
// process contact, source and target
}
```
However, with my existing signature, posting the data to the server results in an `InvalidOperationException` with an error message of:
> No 'MediaTypeF... | [
0.269622802734375,
-0.038722652941942215,
0.5538367629051208,
0.020985165610909462,
-0.30195102095603943,
-0.2559356391429901,
0.23041203618049622,
-0.19466252624988556,
-0.2485821545124054,
-0.7806426882743835,
-0.11485954374074936,
0.42964157462120056,
-0.4263075590133667,
0.293621629476... | |
with the global configuration. However, while it is easy to deal with serializing XML and JSON in a custom `MediaTypeFormatter`, it is unclear how to deal with 'multipart/mixed' requests which can pretty much be anything.
Have a look at this forum: <http://forums.asp.net/t/1777847.aspx/1?MVC4+Beta+Web+API+and+multipart... | [
0.27689483761787415,
-0.0860397145152092,
0.5383005142211914,
-0.009738312102854252,
-0.14693698287010193,
-0.2827300727367401,
0.4196043610572815,
-0.30748388171195984,
-0.3349677622318268,
-0.6359893083572388,
-0.3037686347961426,
0.2824828028678894,
-0.6502277255058289,
0.37065437436103... | |
{
return true;
}
protected override bool CanWriteType(Type type)
{
return false;
}
protected override Task<object> OnReadFromStreamAsync(Type type, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext)
{
var contents = formatterContext.Req... | [
0.01444372721016407,
-0.2908579707145691,
0.601852297782898,
-0.25966697931289673,
0.14609549939632416,
-0.03274140879511833,
0.6642451882362366,
-0.5757357478141785,
-0.05450015887618065,
-0.5031542778015137,
-0.3274627923965454,
0.6539443731307983,
-0.3355514109134674,
0.3903389275074005... | |
});
}
class MultiFormKeyValueModel : IKeyValueModel
{
IEnumerable<HttpContent> _contents;
public MultiFormKeyValueModel(IEnumerable<HttpContent> contents)
{
_contents = contents;
}
public IEnumerable<string> Keys
{ | [
-0.22736528515815735,
-0.22231371700763702,
0.6058619618415833,
-0.16488590836524963,
0.10055530071258545,
-0.05655891075730324,
0.30600112676620483,
-0.41821062564849854,
-0.35047924518585205,
-0.8219698071479797,
-0.42150601744651794,
0.5409283638000488,
-0.2921407222747803,
0.3424842357... | |
get
{
return _contents.Cast<string>();
}
}
public bool TryGetValue(string key, out object value)
{
value = _contents.FirstDispositionNameOrDefault(key).ReadAsStringAsync().Result;
return true; | [
-0.21560335159301758,
-0.3766842782497406,
0.27105817198753357,
-0.031205561012029648,
0.14772681891918182,
0.05495097488164902,
0.596566915512085,
-0.16079571843147278,
-0.06704805791378021,
-0.45749998092651367,
-0.5593405961990356,
0.6426979899406433,
-0.21936368942260742,
0.14371030032... | |
}
}
}
```
You then need to add this formatter to your application. If doing self-host you can simply add it by including:
```
config.Formatters.Insert(0, new MultiFormDataMediaTypeFormatter());
```
before instantiating the HttpSelfHostServer class.
**-- EDIT --**
To parse binary streams you'll need another f... | [
0.25699660181999207,
0.046857625246047974,
0.6197615265846252,
0.014315248467028141,
-0.091576486825943,
-0.3464743494987488,
0.22182448208332062,
-0.4049043655395508,
-0.06322132796049118,
-0.7870671153068542,
-0.18435558676719666,
0.6149072647094727,
-0.4812096059322357,
0.12358070164918... | |
{
return false;
}
public JpegFormatter()
{
SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/jpeg"));
SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/jpg"));
SupportedMediaTypes.Add(new MediaTypeHeaderValue("image/png"));
}
protected override Task<obje... | [
0.18055811524391174,
-0.2700256109237671,
0.5792431235313416,
-0.10968144983053207,
0.004691711626946926,
0.08095146715641022,
0.31846871972084045,
-0.42664653062820435,
-0.06788541376590729,
-0.6174729466438293,
-0.35371407866477966,
0.7353726029396057,
-0.3318076431751251,
0.171587139368... | |
byte[] fileBytes = new byte[stream.Length];
stream.Read(fileBytes, 0, (int)fileBytes.Length);
return (object)new Binary(fileBytes);
});
}
protected override Task OnWriteToStreamAsync(Type type, object value, Stream stream, HttpContentHeaders contentHeaders, Formatte... | [
-0.17279386520385742,
-0.08274234086275101,
0.4186379015445709,
-0.15257087349891663,
0.12386918812990189,
0.06275860220193863,
0.30386120080947876,
-0.4253566861152649,
-0.3060510456562042,
-0.5972115993499756,
-0.29804331064224243,
0.6648935675621033,
-0.25253188610076904,
0.417674183845... | |
NotImplementedException();
}
}
```
In your controller/action you'll want to do something along the lines of:
```
public HttpResponseMessage UploadImage(Binary File) {
//do something with your file
}
``` | [
0.11610039323568344,
-0.3892577588558197,
0.2595815658569336,
0.16365446150302887,
0.2745853066444397,
-0.39694762229919434,
0.15176139771938324,
0.10176803171634674,
-0.20940779149532318,
-0.7040544152259827,
-0.4244234561920166,
0.560177743434906,
-0.3927575349807739,
0.02415687777101993... | |
I am compiling several stylesheets into one min stylesheet in a staging environment The styles are applied locally in IE where each stylesheet is separate, but they are not being applied in the staging environment in IE where the stylesheets are compiled into one min stylesheet. I have run the stylesheets through a CSS... | [
0.3414393365383148,
0.027650440111756325,
0.23818494379520416,
-0.08314429968595505,
0.07698183506727219,
0.31147313117980957,
-0.009627455845475197,
0.08642932772636414,
0.071548230946064,
-1.0141900777816772,
-0.0065285759046673775,
0.45916256308555603,
-0.06818076968193054,
-0.142411574... | |
the problem of styles not being applied.
Here is a link to the login page in the staging environment: <https://s-app.joinhere.com/manage/sessions/new>. The styles are in the stylesheet, they just aren't being applied in IE. Here's a link to the compiled min stylesheet: <https://staging.joinhere.com/assets/manage-d4f7... | [
0.5128989815711975,
-0.010122808627784252,
0.6499025821685791,
0.06603078544139862,
-0.030650466680526733,
-0.12202081829309464,
0.18779708445072174,
-0.051764603704214096,
-0.31376662850379944,
-0.7301653623580933,
0.1772783100605011,
0.6597095131874084,
-0.162944495677948,
-0.15159897506... | |
there, which explains how it is not working. To find out why, I used the networks inspector from the developer tool and examined the response when IE9 is downloading the css, and the style `body#manage-sessions #main_container #login_container` is indeed in the response. This lead me to believe that there must be some ... | [
0.41327109932899475,
-0.23847219347953796,
0.47733280062675476,
-0.008381729945540428,
-0.2243443727493286,
-0.2785855531692505,
0.29072079062461853,
-0.05809744819998741,
-0.49280622601509094,
-0.5305704474449158,
-0.07081039249897003,
0.4626941680908203,
-0.24957489967346191,
0.069272041... | |
why things fall apart after you combine them. To solve the problem try splitting up your large css file into 2 or more smaller ones that fall under the IE limit, and see if this corrects the problem. | [
0.4056824743747711,
-0.18875622749328613,
-0.4488181173801422,
0.27985766530036926,
0.22620537877082825,
-0.2979782521724701,
0.17008841037750244,
-0.15231265127658844,
-0.20912186801433563,
-0.45810404419898987,
-0.022909244522452354,
0.06315989792346954,
-0.3813350796699524,
0.1056330054... | |
I know you can use `signal.alarm()` to schedule alarms in your main thread, but is there a way to do something like this in a thread that isn't your main thread, since these threads can't receive signals? I need to schedule something to happen 5 minutes in the future.
Use `Timer` instead of signals. Dealing with signal... | [
0.6824150681495667,
-0.08623050153255463,
0.014767327345907688,
0.132329523563385,
0.1917630285024643,
-0.3761194050312042,
0.6155661344528198,
0.301410973072052,
-0.2718653380870819,
-0.7036491632461548,
0.44323042035102844,
0.4245341718196869,
-0.3944968283176422,
0.050652168691158295,
... | |
Thanks in advance for any help. I am very new to Android.
Here's my problem. I am using a TableLayout to display editable fields. There are about twenty rows to display.
The rows overflow the screen on smaller devices. I need the View to allow the user to scroll up and down. What am I missing?
Tried wrapping the Tab... | [
-0.23567090928554535,
0.1928357034921646,
0.7449051737785339,
-0.12429454922676086,
-0.09352055937051773,
0.22947993874549866,
-0.0018153737764805555,
-0.0988306999206543,
-0.14449046552181244,
-0.9398400187492371,
0.28787750005722046,
0.4063666760921478,
-0.2323778122663498,
0.11782475560... | |
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content" | [
-0.4913588762283325,
-0.16080035269260406,
0.6349725723266602,
-0.3568897545337677,
0.07758957892656326,
0.33845406770706177,
-0.3043876886367798,
-0.18736308813095093,
-0.212921604514122,
-0.623543918132782,
-0.18465079367160797,
0.10937169194221497,
-0.01868601329624653,
-0.0494860596954... | |
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
</ScrollView>
``` | [
0.013548488728702068,
0.0665040910243988,
0.5483065843582153,
-0.35068297386169434,
0.006301315501332283,
0.23228001594543457,
0.01828882284462452,
-0.1579076051712036,
-0.13576635718345642,
-0.9124888777732849,
-0.18149371445178986,
0.6408638954162598,
-0.3389604985713959,
0.0173737891018... | |
I am trying to:
1. Loop through a bunch of files
2. makes some changes
3. Copy the old file to a sub directory. Here's the kicker I don't want to overwrite the file in the new directory if it already exists. (e.g. if "Filename.mxd" already exists, then copy and rename to "Filename\_1.mxd". If "Filename\_1.mxd" exists,... | [
0.40507376194000244,
0.11605773866176605,
0.43005087971687317,
-0.2618323266506195,
0.19113531708717346,
0.04468739405274391,
0.5895604491233826,
-0.08930192142724991,
-0.12033873051404953,
-0.9796610474586487,
-0.16424939036369324,
0.29510995745658875,
-0.37727004289627075,
0.206107348203... | |
arcpy.mapping.MapDocument(filename)
if os.path.isfile(fullpath):
basename, filename2 = os.path.split(fullpath)
# Make some changes to my file here
# Copy the in memory file to a new location. If the file name already exists, then rename the file with the next instance of i (e.g. filename + "_" + ... | [
0.17304906249046326,
-0.30093348026275635,
0.3207097053527832,
-0.18153470754623413,
0.2201092392206192,
0.13807770609855652,
0.3232324421405792,
-0.2551136016845703,
0.011481576599180698,
-1.0351970195770264,
0.02024715021252632,
0.6283147931098938,
-0.19727614521980286,
0.003477861639112... | |
if arcpy.Exists(draftloc + "\\" + filename2) or arcpy.Exists(draftloc + "\\" + shortname + "_" + str(i) + extension):
print "Test2"
pass
else:
print "Test3" | [
0.2401774674654007,
-0.08701681345701218,
0.011232594959437847,
-0.13560575246810913,
0.20058806240558624,
-0.03348315507173538,
0.3688545823097229,
-0.2980656325817108,
0.20786139369010925,
-0.6616751551628113,
-0.2435866892337799,
0.1632767766714096,
-0.10425516963005066,
-0.212633565068... | |
arcpy.Copy_management(filename2, draftloc + "\\" + shortname + "_" + str(i) + extension)
mxd.save()
```
So, 2 things I decided to do, was to just set the range of files well beyond what I expect to ever occur (50). I'm sure there's a better way of doing this, by just incrementing to the next number without settin... | [
0.5615131855010986,
0.06897003203630447,
0.2604488730430603,
-0.10052408277988434,
-0.11052853614091873,
-0.04457870125770569,
0.3705466091632843,
0.010331956669688225,
-0.2460486888885498,
-0.7978295683860779,
0.09667149186134338,
0.7665250301361084,
-0.32009539008140564,
-0.1072273179888... | |
come up with my answer. For those who are interested, my code is:
```
result_name = filename2
print result_name
i = 0
# Check if file exists
if arcpy.Exists(draftloc + "\\" + result_name):
# If it does, increment i by 1
i+=1
# While each successive filename (including i) do... | [
0.19687911868095398,
0.21617630124092102,
0.43761447072029114,
-0.11867636442184448,
0.1368214339017868,
0.28943026065826416,
0.020041611045598984,
-0.3205726146697998,
0.044201917946338654,
-0.8202789425849915,
0.03978169336915016,
0.21425098180770874,
-0.08418018370866776,
0.170119106769... | |
not arcpy.Exists(draftloc + "\\" + shortname + "_" + str(i) + extension):
mxd.saveACopy(draftloc + "\\" + shortname + "_" + str(i) + extension)
# else if the original file didn't satisfy the if, the save it.
else: | [
0.22820308804512024,
0.028859036043286324,
0.3730854392051697,
0.02917281910777092,
0.26257216930389404,
-0.011389298364520073,
0.22585690021514893,
0.12816789746284485,
0.06265372037887573,
-0.7491088509559631,
-0.1975107342004776,
0.24079731106758118,
-0.3217330873012543,
0.0434318557381... | |
mxd.saveACopy(draftloc + "\\" + result_name)
``` | [
0.0017301203915849328,
0.0030541426967829466,
0.32545018196105957,
0.12689001858234406,
0.44790831208229065,
0.05642281845211983,
0.09201959520578384,
0.23225626349449158,
-0.09333840012550354,
-0.9682573080062866,
-0.4581068754196167,
0.3451589047908783,
-0.6236591339111328,
-0.0280785560... | |
I have a bunch of functions like: `method1`, `method2`, `method3`. For all of them there are `HUnit` test functions like: `testMethod1`, `testMethod2`, `testMethod3`.
```
testMethod1 = TestCase $
assertEqual "testmethod1" ...
testMethod2 = TestCase $
assertEqual "testmethod2" ...
testMethod3 = TestCase $
asser... | [
0.0969807431101799,
0.21879860758781433,
0.04575880989432335,
0.07642212510108948,
-0.14205855131149292,
-0.02735595777630806,
0.2241884469985962,
-0.2695712745189667,
0.23241181671619415,
-0.42860835790634155,
0.1110086515545845,
0.5510470271110535,
-0.05555947497487068,
0.140644177794456... | |
wanna handle that type of situation too:
```
tProcess = TestCase $ do
assertEqual "tProcess" testResult $ someTest
assertEqual "tProcess" anotherTestResult $ anotherTest
assertEqual "tProcess" resultAgain $ testAgain
```
Finally I want to write something like that:
```
tProcess = TestCase $ do
assertEqual_ ... | [
0.31244197487831116,
0.22219453752040863,
0.36783158779144287,
-0.033213984221220016,
0.13823065161705017,
-0.32210949063301086,
0.3259236514568329,
-0.3538943827152252,
0.0021720624063163996,
-0.2981720268726349,
-0.06740076839923859,
0.6870868802070618,
-0.22226350009441376,
-0.065673515... | |
-> Q Exp -> Q [Dec]`, a function to turn the name of the test case and a quoted expression into a list of declarations. For instance:
```
{-# LANGUAGE TemplateHaskell #-}
import Data.Char
import Control.Applicative
import Control.Monad
import Language.Haskell.TH
import Data.Generics
assertEqual :: (Eq a) => String -... | [
0.03227480873465538,
0.1381431668996811,
0.11458685249090195,
-0.09336692839860916,
-0.5574008226394653,
0.21838296949863434,
0.35797223448753357,
-0.7117628455162048,
0.3551262319087982,
-0.2951122224330902,
-0.17683357000350952,
0.57515949010849,
-0.22765247523784637,
0.08726894855499268... | |
name
e' <- [| assertEqual lowerName |]
pure <$> valD
(varP (mkName name))
(normalB (everywhere (mkT (replaceAssertEqual_ e')) <$> expr))
[]
where
replaceAssertEqual_ e' (VarE n) | n == 'assertEqual_ = e'
replaceAssertEqual_ _ e = e
```
The basic idea here is to generate a def... | [
0.08573733270168304,
0.0029795579612255096,
0.35101431608200073,
-0.21259699761867523,
-0.13087855279445648,
-0.20788107812404633,
0.49563315510749817,
-0.45873868465423584,
0.46380043029785156,
-0.44131743907928467,
-0.32314521074295044,
0.798366129398346,
-0.24116015434265137,
-0.0110230... | |
transformation for each `Exp` node.
Note that `assertEqual_` must be a bound identifier with the correct type, since the quoted expression is typechecked before being passed on to `testCase`. Additionally, `testCase` must be defined in a separate module than the one it's used in, due to GHC's stage restriction. | [
-0.28479939699172974,
-0.4620799124240875,
0.15920589864253998,
0.03891952335834503,
0.02533874846994877,
-0.1296597272157669,
0.2447691559791565,
-0.23836593329906464,
0.2776559889316559,
-0.5321369767189026,
-0.4106624126434326,
0.4130324721336365,
-0.22098983824253082,
-0.00974853895604... | |
I have a little problem, I'm making project and I'm sending data from client to server, server sends it to the mysql database.
I have client and admin tabs in client application,
In client tab i type Username and connect to the server, this username is beeing send to the server and server saves is into database in tabl... | [
-0.011700673960149288,
0.23085585236549377,
0.47462886571884155,
-0.043232377618551254,
-0.034687772393226624,
0.15290567278862,
0.2544691562652588,
-0.18157480657100677,
-0.24034105241298676,
-0.5657398700714111,
0.34009313583374023,
0.47542014718055725,
-0.5436801314353943,
0.22056098282... | |
in table users
2. Next, I go to the admin tab, I want to add some data to be inserted to the mysql (it's question in string) so I type that question in textField and press add and the problem is that server reads it as a username and insert it to users table not to the questions table.
Here is the code from client whe... | [
-0.24578890204429626,
0.22240906953811646,
0.7356736063957214,
-0.07808208465576172,
0.017013534903526306,
0.051016394048929214,
0.00407305546104908,
-0.29876336455345154,
-0.0366470105946064,
-0.7881993055343628,
0.1324508935213089,
0.6435444355010986,
-0.40973058342933655,
-0.01884716749... | |
I send data:
```
DataOutputStream os = new DataOutputStream (socket.getOutputStream());
String name = client.nameField.getText();
String title = Configuration.titleField.getText();
String question = Configuration.questionField.getText();
String answer1 ... | [
-0.03026360459625721,
-0.26182278990745544,
0.4694928824901581,
-0.016041168943047523,
0.11000300943851471,
0.1900462657213211,
0.17385819554328918,
-0.14176948368549347,
0.03526226803660393,
-0.7912886142730713,
-0.4564817547798157,
0.49209219217300415,
-0.1394970417022705,
0.424759924411... | |
out = new PrintWriter (os, true);
out.println(title);
out.println(question);
out.println(answer1);
```
And here is the code where are recieve data on the server side:
```
while(RunThread){
String name;
name = in.readLine(); | [
-0.1804238259792328,
-0.02921310067176819,
0.599470853805542,
-0.3366147577762604,
0.29062357544898987,
0.17421548068523407,
0.16063377261161804,
-0.3871845304965973,
0.08717568963766098,
-0.2523036599159241,
-0.44068777561187744,
0.5699455738067627,
-0.139094740152359,
0.33027535676956177... | |
st.execute("INSERT INTO "+db+" .poll_users (name) VALUES ('" + name + "')");
String title;
title = in.readLine();
if(title!=null)
st.execute("INSERT INTO "+db+" .poll_titles (title) VALUES ('" + title + "')");
String question;
question | [
-0.07197288423776627,
0.14425580203533173,
0.19386811554431915,
-0.07849423587322235,
-0.18599168956279755,
0.2418779730796814,
0.41483762860298157,
-0.5592343211174011,
-0.02625914290547371,
-0.4188498258590698,
-0.5455718040466309,
0.5489300489425659,
-0.39836549758911133,
0.079840995371... | |
= in.readLine();
if(question!=null)
st.execute("INSERT INTO "+db+" .poll_questions (question) VALUES ('" + question + "')");
String answer1;
answer1 = in.readLine();
if(answer1!=null)
st.execute("INSERT INTO "+db+" .poll_answers (answer) VALUES ('... | [
-0.038073718547821045,
-0.03939787670969963,
0.43161264061927795,
-0.2673962414264679,
0.5730833411216736,
0.2699486315250397,
0.5597715377807617,
-0.3744123578071594,
0.2289748340845108,
-0.48323890566825867,
-0.8509500026702881,
0.2710196375846863,
-0.1673225313425064,
0.2874286472797394... | |
working?
Thanks for any help
Change links to this:
```
<a href='page.php?id=1' class='changeMe'>1</a>
<a href='page.php?id=2' class='changeMe'>2</a>
<a href='page.php?id=3' class='changeMe'>3</a>
```
Add a javascript like this:
```
$(document).ready(function(){
$('a[class="changeMe"]').each(function(){
... | [
0.039510346949100494,
-0.07023271918296814,
0.7021588087081909,
-0.27242356538772583,
0.2236693948507309,
-0.1066797599196434,
0.3902629315853119,
-0.4897022843360901,
-0.2008165419101715,
-0.6283177137374878,
-0.3189547657966614,
0.7487961649894714,
-0.44594576954841614,
-0.30410847067832... | |
I have a database with
```
books (primary key: bookID)
characterNames (foreign key: books.bookID)
locations (foreign key: books.bookID)
```
The in-text-position of character names and locations are saved in the corresponding tables.
Now I want to write a Python script using psycopg2 to find all oc... | [
-0.25860363245010376,
0.48146671056747437,
0.33098024129867554,
-0.025251565501093864,
0.1600862443447113,
0.04517721012234688,
0.2167387157678604,
-0.177840918302536,
-0.06442789733409882,
-0.592906653881073,
-0.1767798364162445,
0.3965076804161072,
-0.08456351608037949,
0.222690910100936... | |
in list 'charnamesIDs'
SELECT bookID, position FROM locations WHERE locName='YYY';
--> result is saved in list 'locs'
SELECT bookID FROM locations WHERE locName='YYY';
--> result is saved in list 'locsIDs'
```
Both queries could give me bookIDs where just the name OR the location appears. So my goal is to eliminate... | [
-0.6389256715774536,
0.2618967890739441,
0.3440016508102417,
-0.2595333158969879,
-0.20303210616111755,
0.2983520030975342,
0.2690891921520233,
-0.029488688334822655,
-0.04238692298531532,
-0.7710701823234558,
-0.4634440839290619,
0.2932530343532562,
-0.07373131811618805,
-0.10117539763450... | |
task quicker?
This could be **much faster and simpler** with a query using JOINs.
Something like this:
```
SELECT b.*, c.position, l.position
FROM books b
JOIN characternames c USING (bookid)
JOIN locations l USING (bookid)
WHERE c.name = 'XXX'
AND l.locname = 'YYY';
```
* It is generally a good idea to... | [
-0.04359355568885803,
-0.19839681684970856,
0.23318637907505035,
0.024482669308781624,
-0.06209728121757507,
0.07177196443080902,
0.146659716963768,
-0.2551441490650177,
-0.6222935914993286,
-0.6695749163627625,
0.028616294264793396,
0.7247814536094666,
-0.09206153452396393,
-0.25502714514... | |
names. Read the [manual about identifiers](http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS).
* The manual on the [SELECT statement, in particular about JOINs](http://www.postgresql.org/docs/current/interactive/sql-select.html#SQL-FROM).
---
### More info after comment... | [
0.18867571651935577,
0.44400304555892944,
0.5211028456687927,
0.40541258454322815,
0.0733337476849556,
-0.2849912643432617,
-0.07716978341341019,
-0.21406060457229614,
-0.18788446485996246,
-0.6449198722839355,
-0.08930473774671555,
0.19949960708618164,
-0.044293615967035294,
0.24928411841... | |
show you which indexes get used and how fast the query is. Creating indexes is very fast, experimenting with them is easy. Just don't keep indexes you don't need. They carry a maintenance cost, too.
---
### Optimized query
I `think` I understand now, what you are looking for. This query should be optimized to get al... | [
-0.10040902346372604,
-0.11144851893186569,
0.5357037782669067,
0.21826763451099396,
0.2124670296907425,
-0.10582233220338821,
0.10192780196666718,
0.10776136070489883,
0.04543624073266983,
-0.7930485010147095,
-0.10953624546527863,
0.5041756629943848,
-0.34219589829444885,
-0.356170803308... | |
= 'XXX'
GROUP BY 1
INTERSECT
SELECT bookid
FROM locations
WHERE l.locname = 'YYY'
GROUP BY 1
)
SELECT bookid, position, 'char' AS what
FROM b
JOIN characternames USING (bookid)
WHERE name = 'XXX'
UNION ALL
SELECT bookid, position, 'loc' AS what
FROM b
JOIN locations USING (boo... | [
-0.22599752247333527,
0.23608873784542084,
0.7777074575424194,
0.1360441893339157,
0.15014764666557312,
0.18455994129180908,
-0.010878252796828747,
-0.331725150346756,
-0.014686333946883678,
-0.45600590109825134,
-0.32233762741088867,
0.1755698174238205,
-0.3803911507129669,
0.277932941913... | |
picks only `bookids` that feature both location *and* name.
* The [`UNION ALL`](http://www.postgresql.org/docs/current/interactive/queries-union.html) in the final `SELECT` returns *all* found positions. Use `UNION` instead if you want to trim duplicates with the same position.
* I order by `bookid, position` - guessin... | [
-0.24655015766620636,
-0.04304048791527748,
0.7834759950637817,
0.21405579149723053,
0.13903695344924927,
0.09716026484966278,
-0.30611559748649597,
-0.137579545378685,
-0.04759594425559044,
-0.7304495573043823,
-0.3757499158382416,
0.18421822786331177,
-0.23285774886608124,
0.252795338630... | |
Create one such table for locations and another one for names. Keep them up to date with triggers if need should be, but I assume the content of books is not changing much. Would simplify and speed up the CTE.
If that still isn't fast enough, look into [Full Text Search](http://www.postgresql.org/docs/current/interact... | [
0.3277621269226074,
-0.049954891204833984,
0.35806557536125183,
0.21824708580970764,
0.16808682680130005,
-0.3598637878894806,
-0.055813729763031006,
0.1397472470998764,
-0.04805741459131241,
-0.5982551574707031,
-0.11603368073701859,
0.3710024356842041,
-0.06425394117832184,
-0.1121670827... | |
My web client sends Json. MongoDB is practically Json. It should be easy, but I'm getting tied in knots fighting the C# driver in MVC3. It seems there's no easy way to avoid working in C# classes. I'd have thought it would be easy just to pass Json back and forth with a little filtering. Its like I'm fighting an ORM an... | [
0.12165495753288269,
-0.06342008709907532,
0.4191572666168213,
0.05119840055704117,
-0.23467035591602325,
-0.2864936590194702,
0.31174391508102417,
0.1041056290268898,
-0.23380908370018005,
-0.6285156011581421,
-0.07405228912830353,
0.6511277556419373,
-0.42056703567504883,
0.2600334286689... | |
var serializedObject = JsonConvert.SerializeObject(Data, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
}
```
I can't for the life of me figure out how to do this without an object mapping. I have a controller action thus;
```
public JsonResult test()
{
var col = ... | [
-0.2911794185638428,
-0.5059359669685364,
0.7384936213493347,
0.045668911188840866,
-0.11557303369045258,
-0.07024627923965454,
0.28434574604034424,
-0.5060585141181946,
-0.3812546133995056,
-0.715660572052002,
-0.17857061326503754,
0.6177026033401489,
-0.5577632188796997,
0.21479094028472... | |
now understand the above fails because it's trying to serialize the actual BsonDocument rather than the underlying data. I get an error when it tries to serialize the first field as some other type, usually trying to convert a string or a date to AsBoolean(). It's a shame the driver can't allow the doc to be serialized... | [
0.31046396493911743,
0.19799137115478516,
0.13909916579723358,
0.08929042518138885,
-0.22258183360099792,
-0.2532479763031006,
0.3635345995426178,
0.2260483354330063,
-0.3596561551094055,
-0.6275534629821777,
-0.019199075177311897,
0.49998557567596436,
-0.39967474341392517,
0.3406899571418... | |
also tried these with similar results;
```
return Json(mr.GetResults());
return Json(mr.GetResults()).ToArray();
```
So I've also tried the following I've seen people have success with;
```
var jsonText = mr.ToJson(); // empty
var jsonText = mr.GetResults().toJson(); // Exception: No serializer found for type Syste... | [
-0.0656680166721344,
0.02147671766579151,
0.32378390431404114,
-0.09940584748983383,
-0.12331738322973251,
-0.14567603170871735,
0.6621519923210144,
-0.08372282981872559,
-0.3207192122936249,
-0.6194308400154114,
-0.38316619396209717,
0.6805269122123718,
-0.3729054033756256,
0.154029861092... | |
really is more of a hindrance than a help. I think I'd rather just have the Json please.
I don't see any reason why you would need to create an object model for this, unless MVC3 is imposing that requirement on you. Using BsonDocument and serializing straight to a JSON string should be fine. It's hard to wade through m... | [
0.14710789918899536,
-0.07860856503248215,
0.19794996082782745,
0.08898656070232391,
-0.18733695149421692,
-0.3032791018486023,
0.43204647302627563,
0.14235012233257294,
-0.197850301861763,
-0.9398913383483887,
-0.1161886602640152,
0.7200483083724976,
-0.25055116415023804,
-0.0211325325071... | |
new BsonDocument("x", 1),
new BsonDocument("x", 2)
};
var json = results.ToJson();
```
When I run this code the json variable end up with the following content:
```
[{ "x" : 1 }, { "x" : 2 }]
```
In particular, I don't get the exception you mentioned. Can you make sure you are using a new enough version of the... | [
0.28079795837402344,
0.2578306496143341,
0.13929526507854462,
-0.19091032445430756,
-0.11696328967809677,
-0.18637987971305847,
0.46395909786224365,
-0.13382366299629211,
-0.32365310192108154,
-0.554545521736145,
-0.24689988791942596,
0.6960268616676331,
-0.6285539865493774,
0.196191579103... | |
the Json method you are using that returns a JsonResult) typically impose their own constraints on what they can and can't serialize. So the problems you are encountering would appear to be external to the MongoDB C# driver.
Sorry, I really don't know enough about MVC3 and how it expects to converts results back to JS... | [
0.2594306170940399,
0.0068825120106339455,
0.07119311392307281,
0.03860750421881676,
-0.3252180814743042,
-0.36421117186546326,
0.24341151118278503,
0.20363634824752808,
-0.4165567457675934,
-0.3618229925632477,
-0.02125469408929348,
0.7216632962226868,
-0.5487217307090759,
0.1102951541543... | |
I'm trying to use -y C command in iperf which is used to write the throughput between the client and server in CSV format. So this is the command that is used to start the server
```
iperf -s -w 8M -f m -i 10 -p 4 // This works
```
But when i use the -y C which writes the output to in CSV format. The ser... | [
0.316631942987442,
0.2873101532459259,
0.5252129435539246,
-0.22709307074546814,
-0.06547700613737106,
-0.11585550010204315,
0.2017509639263153,
0.04182818904519081,
-0.05287410318851471,
-0.8441921472549438,
-0.13242676854133606,
0.7058718800544739,
-0.3236099183559418,
0.3628256618976593... | |
C // This doesn't work.
```
i dont know why this is not working. But the same -y C on the client seems to be working.The answers are highly appreciated.
Try this:
```
void(^myAwesomeBlock)() = [blocks objectForKey:key];
myAwesomeBlock();
``` | [
0.12385408580303192,
0.19416587054729462,
0.20189040899276733,
-0.097300224006176,
0.30391356348991394,
-0.25970321893692017,
0.38490211963653564,
0.16745145618915558,
-0.11515676975250244,
-0.6830034255981445,
-0.3062369227409363,
0.6662383675575256,
-0.33850395679473877,
-0.0250159427523... | |
I have to subtract two dates and divide it by the number of cells
```
Suppose:
DateTime d1 = 10/6/2010 12:00:00 AM
DateTime d2 = 10/9/2010 11:59:59 PM
#Cells = 5
```
Now how do I find the delta? Is the delta a TimeSpan? `delta = (d2.subtract(d1))/5`? This does not work.
Pls suggest
Sun
```
TimeSpan delta = TimeSp... | [
0.10361713916063309,
-0.10961147397756577,
0.5892600417137146,
-0.33782047033309937,
0.3652721047401428,
0.2169801890850067,
0.34587857127189636,
-0.238465815782547,
-0.2947772443294525,
-0.8081218004226685,
0.07373242825269699,
0.09707769006490707,
-0.056730255484580994,
0.480428129434585... | |
In my custom view I'm looking into using [Canvas.getClipBounds()](http://developer.android.com/reference/android/graphics/Canvas.html#getClipBounds%28%29) to optimize my onDraw method (so that I'm only drawing what's absolutely necessary each time it's called).
However, I still want to absolutely avoid any object crea... | [
0.12013126164674759,
-0.277995765209198,
1.037498950958252,
-0.02246132120490074,
-0.28336119651794434,
0.2505522668361664,
0.038927290588617325,
-0.541843831539154,
-0.27534228563308716,
-0.5797061920166016,
-0.08608690649271011,
0.5890878438949585,
-0.2531128227710724,
-0.257497727870941... | |
*many* times each second)
I have looked into the source code for Canvas as of Android 4.0.1, and it is as follows:
```
/**
* Retrieve the clip bounds, returning true if they are non-empty.
*
* @param bounds Return the clip bounds here. If it is null, ignore it but
* still return true if the current c... | [
0.2675624191761017,
-0.18666432797908783,
0.5454040765762329,
-0.14715828001499176,
-0.10108239948749542,
0.17673152685165405,
0.35609570145606995,
-0.704613983631134,
-0.4813922047615051,
-0.7339481711387634,
-0.10907437652349472,
0.7302684187889099,
-0.18599571287631989,
-0.2569547593593... | |
the clip bounds, or [0, 0, 0, 0] if the clip is empty.
*/
public final Rect getClipBounds() {
Rect r = new Rect();
getClipBounds(r);
return r;
}
```
So, answering your question, getClipBounds(Rect bounds) will spare you from one object creation, but getClipBounds() will actually create a new Rect() objec... | [
0.06169292703270912,
-0.29254549741744995,
0.7253862023353577,
-0.06474768370389938,
0.22375619411468506,
0.14003083109855652,
0.12272613495588303,
-0.45604878664016724,
-0.2636306583881378,
-0.33045101165771484,
-0.43261417746543884,
0.7477092742919922,
-0.37866291403770447,
-0.0859604105... | |
I have the following function:
```
(def elapsedtime (with-out-str (time (run-my-function))))
```
and I was wondering if is possible to store only the integer value of the time, as I can only store a String at the moment....
Any suggestion?
Thanks a lot
**UPDATE**
```
So I did use this:
(defmacro nsecs
[expr]
... | [
-0.00831788219511509,
0.06519273668527603,
0.5553870797157288,
-0.13007283210754395,
0.18362337350845337,
-0.040618885308504105,
0.4883072078227997,
-0.24769611656665802,
-0.23683151602745056,
-0.294314444065094,
0.07020995020866394,
0.6087162494659424,
-0.3692386746406555,
0.2330104261636... | |
so I used this filtering solution:
```
(filter #(#{\0,\1,\2,\3,\4,\5,\6,\7,\8,\9,\.} %) my-double-number)
```
The returned value is exactly what I wanted. Thanks anyway for your suggestions and for your time. Chers | [
0.13811838626861572,
0.11492129415273666,
0.2978001832962036,
-0.016275674104690552,
-0.19182293117046356,
0.4673367738723755,
0.05087115988135338,
-0.052914224565029144,
-0.3092014193534851,
-0.43291276693344116,
-0.11112741380929947,
0.5139689445495605,
-0.3307334780693054,
0.10123941302... | |
I'm planning to use very big numbers in Python, but wonder if Python can handle very big numbers. The numbers are going to have up to 3,000 zeros.
And, how much bytes does a 1 with 3,000 zeros use?
Third question, how can I save a number as integer into a file with Python without having to str() it?
Python can store ... | [
0.2744108736515045,
-0.011789297685027122,
-0.00788173545151949,
0.114189013838768,
-0.12411752343177795,
0.06726080924272537,
-0.02168324403464794,
-0.0053274547681212425,
-0.248927041888237,
-0.43316060304641724,
0.21648138761520386,
0.5456712245941162,
0.02149132825434208,
-0.0269889160... | |
from `int`s to `long`s when the result of a calculation is too large to be represented by an `int`. `long` is a full-fledged numeric type and is compatible with all Python numeric operations.
If you need more than integers, then you want the `decimal` module, which features a `Decimal` type that provides real numbers ... | [
0.014695380814373493,
-0.0069336313754320145,
0.1652986705303192,
-0.03548175469040871,
0.06596402823925018,
-0.056505829095840454,
-0.13175566494464874,
-0.13410791754722595,
-0.25447961688041687,
-0.28139421343803406,
-0.23305778205394745,
0.45526278018951416,
-0.02026858739554882,
-0.13... | |
able to use such numbers at all.
As for size, `int` objects are 12 bytes in 32-bit Python. This seemingly large size for what is internally a 32-bit quantity is due to Python's "everything's an object" approach. (I believe, but don't quote me, that there's 4 bytes for the value, 4 bytes for a pointer from the instance... | [
0.271301805973053,
-0.16064533591270447,
0.0655081495642662,
-0.04215839505195618,
-0.0960279181599617,
-0.005406580399721861,
0.3055586516857147,
-0.272124320268631,
-0.4138651490211487,
-0.11976150423288345,
-0.2729659676551819,
0.5521554350852966,
-0.19078563153743744,
-0.17869697511196... | |
(plus object overhead), but the size of any `long` value can be determined using `sys.getsizeof()`. | [
0.23864571750164032,
-0.374164342880249,
0.21879525482654572,
0.06765717267990112,
0.3611435294151306,
-0.08358190208673477,
-0.03178590163588524,
-0.31696170568466187,
-0.11752299219369888,
-0.1502748429775238,
-0.41903823614120483,
0.3852778971195221,
0.0412827767431736,
0.01143692154437... | |
I just started learning Scheme (Petite Chez Scheme) and as a challenge to myself I'm trying to implement quicksort. However I get the following exception when I run it:
```
Exception: attempt to apply non-procedure (1 2 3 4 5 7 ...)
```
Here's my Scheme session from Emacs:
```
Petite Chez Scheme Version 8.4
Copyrig... | [
0.05539468675851822,
0.016692087054252625,
0.3022196590900421,
-0.18981565535068512,
0.1709510087966919,
-0.08612865209579468,
0.52409827709198,
-0.05315505340695381,
-0.3486718237400055,
-0.37203148007392883,
-0.07494757324457169,
0.622111439704895,
-0.2352299690246582,
-0.248782441020011... | |
(cons k (cdr a))
(let ((b (cons k (reduce-list a 0 (+ i 1)))))
(let push-front ((lst b) (original-list a) (n (- i 1)))
(if(<= n 0)
(cons (list-ref original-list 0) lst)
(push-front (cons (list-ref original-list n) lst) original-list (- n 1)))))))
(define (swap lst i j)
(let (... | [
-0.36421629786491394,
-0.27118074893951416,
0.6653463840484619,
-0.6334183216094971,
0.10195304453372955,
0.15587206184864044,
-0.030318066477775574,
-0.493265300989151,
-0.05324839428067207,
-0.15842074155807495,
-0.8912144899368286,
0.6708374619483948,
-0.45068326592445374,
-0.0962200909... | |
(set (set lst i b) j a)))
(define (partition a i j r)
(cond [(= j r) (cons (+ i 1) (swap a (+ i 1) j))]
[(<= (list-ref a j) (list-ref a r)) (partition (swap a j (+ i 1)) (+ i 1) (+ j 1) r)]
[else (partition a i (+ j 1) r)]))
(define (quicksort a p r)
(if(< p r)
(begin(
(let* | [
-0.39576053619384766,
-0.34400954842567444,
0.3667376935482025,
-0.5179182291030884,
0.27944937348365784,
0.13818573951721191,
0.3812527656555176,
-0.6886579394340515,
-0.11042828112840652,
-0.5279899835586548,
-0.6417839527130127,
0.40641477704048157,
-0.4289403259754181,
-0.0631133913993... | |
((c (partition a (- p 1) p r))
(q (car c))
(b (quicksort (cdr c) p (- q 1))))
(quicksort b (+ q 1) r))))
a))
> (define lst (list 1 9 2 8 3 7 4 6 5))
> (define n (length lst))
> (trace quicksort)
(quicksort)
> (quicksort lst 0 (- n 1))
|(quicksort (1 9 2 8 3 7 4 6 5) 0 8)
| (quick... | [
-0.21912559866905212,
-0.28011444211006165,
0.18032300472259521,
-0.23416733741760254,
0.4307135343551636,
0.20218497514724731,
0.14432232081890106,
-0.2555684447288513,
-0.17085738480091095,
-0.6689497828483582,
-0.39491602778434753,
0.37255510687828064,
-0.2406298667192459,
0.02172013185... | |
4 5 7 8 6 9) 0 3)
| |(quicksort (1 2 3 4 5 7 8 6 9) 0 2)
| | (quicksort (1 2 3 4 5 7 8 6 9) 0 1)
| | |(quicksort (1 2 3 4 5 7 8 6 9) 0 0)
| | |(1 2 3 4 5 7 8 6 9)
| | |(quicksort (1 2 3 4 5 7 8 6 9) 2 1)
| | |(1 2 3 4 5 7 8 6 9)
Exception: attempt to apply non-procedure (1 2 3 4 5 7 ...)
>
```
Can anyone tell me wha... | [
-0.25695592164993286,
0.09672540426254272,
0.26603952050209045,
-0.06937804818153381,
0.12230686098337173,
-0.17346586287021637,
1.0613261461257935,
0.24909046292304993,
-0.43414631485939026,
-0.6331244111061096,
-0.3885580897331238,
0.3190980553627014,
-0.3429392874240875,
-0.258001029491... | |
advance
The problem is with the
```
begin
```
in quicksort. When
```
(quicksort b (+ q 1) r)
```
eventually returns a (which is actually b in the parent quicksort), then the let\* block reduces from
```
(define (quicksort a p r)
(if(< p r)
(begin(
(let* ((c (partition a (- p 1) p r))
... | [
-0.35632920265197754,
0.08349087089300156,
0.4443218410015106,
-0.3711234927177429,
0.11234139651060104,
0.4206712543964386,
-0.030013220384716988,
-0.3221610486507416,
-0.0010300035355612636,
-0.6037894487380981,
-0.345015287399292,
0.6051406860351562,
0.07854107022285461,
0.0366969481110... | |
(b (quicksort (cdr c) p (- q 1))))
(quicksort b (+ q 1) r))))
a))
```
to
```
(define (quicksort a p r)
(if(< p r)
(begin
(b)) ;this is the cause of the error
a))
```
And since b is a list, trying to call it fails with an error. If you remove the begin, the let block will be... | [
0.08867013454437256,
-0.06889045238494873,
0.17913201451301575,
-0.512855052947998,
0.3083399534225464,
-0.20652051270008087,
0.48370561003685,
-0.3566872179508209,
-0.049018435180187225,
-0.46808233857154846,
-0.7372986078262329,
0.4791021943092346,
-0.637786328792572,
0.02684146165847778... | |
The only way I know how to do this is to convert the file into a C source file with a single byte/char array containing the contents of the resource file in hex.
Is there a better or easier way to do this?
Here's a nice trick I use with a gcc-arm cross compiler; including a file through an assembly language file. In t... | [
0.2694220244884491,
0.5241612195968628,
0.359293669462204,
-0.08364976197481155,
-0.08049752563238144,
0.19749170541763306,
-0.05926704779267311,
-0.2300281524658203,
0.018338194116950035,
-0.5088719725608826,
-0.13606387376785278,
0.4178919792175293,
-0.15085338056087494,
0.28215274214744... | |
format,
* brought in by pubkey.s
*/
extern const char pubkey[];
#endif // PUBKEY_H
```
Now the C sources can include `pubkey.h`, compile the `pubkey.s` with gcc and link it into your application, and there you go. `sizeof(pubkey)` also works. | [
0.08781716227531433,
0.35882192850112915,
0.7181453108787537,
-0.2593936324119568,
-0.013086631894111633,
-0.15426912903785706,
0.0024322671815752983,
-0.06016441807150841,
-0.3489030599594116,
-0.37113574147224426,
-0.5468456149101257,
0.6270272135734558,
-0.22009152173995972,
0.150526493... | |
Sorry if this is a newbie question. Is it possible to get a list of Count using different where conditions in a single query.
Basically I am trying to get a list showing the number of applicants by age.
example
20 - 29
30 - 39
etc
Thanks so much,
Andy
Here's a nice trick I use with a gcc-arm cross compiler; including ... | [
0.5103870630264282,
0.3444623649120331,
0.5710768103599548,
-0.07687165588140488,
-0.19400224089622498,
0.21016475558280945,
0.21218611299991608,
-0.42340460419654846,
-0.4763142764568329,
-0.5931574106216431,
-0.03856983408331871,
0.042792823165655136,
-0.2120778113603592,
0.2546856403350... | |
in PEM format,
* brought in by pubkey.s
*/
extern const char pubkey[];
#endif // PUBKEY_H
```
Now the C sources can include `pubkey.h`, compile the `pubkey.s` with gcc and link it into your application, and there you go. `sizeof(pubkey)` also works. | [
0.11229153722524643,
0.4300440847873688,
0.5322001576423645,
-0.2755628228187561,
0.02955940179526806,
0.028824355453252792,
-0.067252017557621,
-0.0023097286466509104,
0.008076810277998447,
-0.3222845792770386,
-0.5051774978637695,
0.5599325299263,
-0.0827023983001709,
0.03267578408122063... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.