text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
rs.getString("ACTIVITY")));
}
} catch (Exception x) {
x.printStackTrace();
}
return al;
/*
CREATE TABLE ACTIVESESSIONSLOG(
ASESSIONID VARCHAR2(30 ) NOT NULL, | [
0.08127111941576004,
-0.23532001674175262,
0.49017444252967834,
-0.23239262402057648,
0.22175107896327972,
-0.07415137439966202,
0.46089163422584534,
-0.6029025316238403,
-0.4257107675075531,
-0.34219056367874146,
-0.26062801480293274,
0.4455339014530182,
-0.7265767455101013,
-0.0846573561... | |
USERID VARCHAR2(30 ),
ACTIVITYSTART TIMESTAMP(6),
ACTIVITYEND TIMESTAMP(6),
ACTIVITY CLOB
)
*/
}
// select all button handle
private Map<Long, Boolean> selectedIds = new HashMap<Long, Boolean>();
// get the list from the JSF page
public Map<Long, Boolean> ge... | [
-0.4747229218482971,
-0.615477442741394,
0.5988872051239014,
-0.0876118540763855,
0.05372846499085426,
-0.13459324836730957,
0.3518487215042114,
-0.3552415370941162,
-0.13960424065589905,
-1.0084648132324219,
-0.2556608319282532,
0.5207747220993042,
-0.5372912883758545,
-0.0483133867383003... | |
return selectedIds;
}
// call this method from the JSF page to delete the selected rows
public String deleteAction() {
// do something with the selected rows
return null;
}
private static Date timestampToDate(java.sql.Timestamp ts) {
Date d = null;
try {
... | [
0.11453453451395035,
-0.49786844849586487,
0.24930885434150696,
-0.19294725358486176,
0.14340049028396606,
0.09329070150852203,
0.23610252141952515,
-0.18816447257995605,
-0.23659805953502655,
-0.46215304732322693,
-0.22450776398181915,
0.02757875993847847,
-0.3637615740299225,
0.526315987... | |
Date(ts.getTime());
} catch (Exception e) {
e.printStackTrace();
}
return d;
}
}
```
This is the JSF page:
```
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="ht... | [
0.04000713676214218,
-0.19305168092250824,
0.9198222756385803,
-0.2611537277698517,
-0.3257791996002197,
-0.15816445648670197,
-0.21341128647327423,
-0.18689782917499542,
-0.34402716159820557,
-0.6142193675041199,
-0.4594171345233917,
-0.07284282147884369,
-0.4504719376564026,
-0.032995037... | |
<ui:include src="header.xhtml"/>
</ui:insert>
</h:head>
<h:body>
<h1><img src="resources/css/images/icon.png" alt="NVIDIA.com" /> History Center</h1>
<!-- layer for black background of the buttons -->
<div id="toolbar" style="margin: 0 auto; width:1180px; height:30px; p... | [
-0.15888921916484833,
-0.25949305295944214,
0.622798502445221,
0.004203932825475931,
-0.019271444529294968,
0.4135734438896179,
-0.26446637511253357,
-0.8066662549972534,
-0.4761030375957489,
-0.5560305714607239,
0.026677396148443222,
0.39502957463264465,
-0.21322742104530334,
0.0690095126... | |
<!-- Include page Navigation -->
<ui:insert name="Navigation">
<ui:include src="Navigation.xhtml"/>
</ui:insert>
</div>
<div id="greenBand" class="ui-state-default ui-corner-allh" style="position:relative; top:35px; left:0px;"> | [
-0.4318450689315796,
-0.07130806148052216,
0.6759070158004761,
0.017100678756833076,
0.016856839880347252,
-0.1512327343225479,
0.02305273525416851,
-0.439960241317749,
-0.20765551924705505,
-0.5555891990661621,
-0.5214815139770508,
0.13839852809906006,
-0.24397504329681396,
0.000165875142... | |
<h:graphicImage alt="Dashboard" style="position:relative; top:-20px; left:9px;" value="resources/images/logo_sessions.png" />
</div>
<div id="main" style="margin: 0 auto; width:1190px; height:700px; position:absolute; background-color:transparent; top:105px">
<div id="mainpage" style="ma... | [
-0.5392561554908752,
-0.03646296635270119,
0.7553465962409973,
0.06819572299718857,
-0.13976380228996277,
0.24529647827148438,
0.3092494308948517,
-0.03484838083386421,
-0.10150287300348282,
-0.7793363332748413,
-0.293474406003952,
0.576452910900116,
0.03543965891003609,
-0.217689663171768... | |
<h:form id="form">
<!-- The sortable data table -->
<h:dataTable value="#{SessionsController.dataList}" var="item">
<h:column> | [
0.015255771577358246,
0.268204003572464,
0.3575514853000641,
0.21616584062576294,
-0.21622765064239502,
-0.05444539338350296,
0.13787627220153809,
-0.43369144201278687,
-0.48792925477027893,
-0.4725460708141327,
-0.47936341166496277,
0.4188939929008484,
-0.2041822373867035,
0.0010583337862... | |
<f:facet name="header">
<h:commandLink value="Account Session ID" actionListener="#{SessionsController.sort}"> | [
-0.047864366322755814,
0.02659468539059162,
0.276176393032074,
-0.12483448535203934,
-0.02208683080971241,
0.011586691252887249,
0.21070215106010437,
-0.23826399445533752,
-0.6560956239700317,
-0.35341304540634155,
-0.3449678122997284,
0.7575964331626892,
0.008053838275372982,
-0.227253526... | |
<f:attribute name="sortField" value="Account Session ID" />
</h:commandLink>
</f:facet> | [
-0.19147877395153046,
0.10225609689950943,
0.289599746465683,
-0.26492875814437866,
0.0999542623758316,
0.1464332938194275,
-0.09794304519891739,
-0.0673067718744278,
-0.2305706888437271,
-0.48038047552108765,
-0.3438597619533539,
0.7349035143852234,
-0.02129599265754223,
-0.25012946128845... | |
<h:outputText value="#{item.aSessionID}" />
</h:column>
<h:column>
<f:facet | [
-0.5608552694320679,
0.002044966211542487,
0.5668967962265015,
-0.05807386711239815,
-0.32435283064842224,
0.5029155611991882,
0.05875759199261665,
-0.301557719707489,
-0.23442792892456055,
-0.6606232523918152,
-0.5973009467124939,
0.3226785361766815,
-0.28033319115638733,
-0.1911028772592... | |
name="header">
<h:commandLink value="User ID" actionListener="#{SessionsController.sort}">
<f:attribute name="sortField" value="User ID" /> | [
-0.007047245744615793,
-0.2400939017534256,
0.32985585927963257,
-0.15440742671489716,
-0.04625311121344566,
0.054564494639635086,
0.097303606569767,
-0.3596780002117157,
-0.5495303273200989,
-0.33531713485717773,
-0.3659493625164032,
0.6451288461685181,
-0.16595767438411713,
-0.2354233413... | |
</h:commandLink>
</f:facet>
<h:outputText value="#{item.userID}" /> | [
-0.4350740611553192,
-0.15191741287708282,
0.5145455002784729,
-0.0994589626789093,
-0.17335709929466248,
0.3301388919353485,
0.02462073601782322,
-0.3111160099506378,
-0.11578700691461563,
-0.639380156993866,
-0.5192649364471436,
0.35648757219314575,
-0.26625117659568787,
-0.0296565219759... | |
</h:column>
<h:column>
<f:facet name="header"> | [
-0.44606345891952515,
0.19327802956104279,
0.30495205521583557,
-0.054516445845365524,
-0.16153091192245483,
0.36286991834640503,
-0.0942760556936264,
-0.01953008957207203,
-0.14497600495815277,
-0.4714304506778717,
-0.4055802822113037,
0.182965487241745,
-0.16372773051261902,
-0.217250972... | |
<h:commandLink value="Activity Start Time" actionListener="#{SessionsController.sort}">
<f:attribute name="sortField" value="Activity Start Time" />
</h:commandLink> | [
0.08167298138141632,
-0.2309868335723877,
0.43295153975486755,
-0.29854562878608704,
-0.09165797382593155,
-0.2770904004573822,
0.10882756114006042,
-0.3170946538448334,
-0.5453411340713501,
-0.45031511783599854,
-0.42799198627471924,
0.7182761430740356,
-0.11225912719964981,
-0.3548161387... | |
</f:facet>
<h:outputText value="#{item.activityStart}" />
</h:column> | [
-0.3159175217151642,
-0.2179557830095291,
0.6526470184326172,
-0.1385757327079773,
-0.13685503602027893,
0.34408363699913025,
0.011251984164118767,
-0.13486777245998383,
-0.3867133557796478,
-0.4961395263671875,
-0.4710078239440918,
0.3512687683105469,
-0.4125402569770813,
-0.2498546987771... | |
<h:column>
<f:facet name="header">
<h:commandLink value="Activity End Time" actionListener="#{SessionsController.sort}"> | [
0.011282713152468204,
-0.26972857117652893,
0.3852977454662323,
-0.1460767686367035,
-0.07408448308706284,
-0.12500441074371338,
0.331038236618042,
-0.39592164754867554,
-0.6807344555854797,
-0.32014980912208557,
-0.39141860604286194,
0.6340317726135254,
-0.18581189215183258,
-0.3548784852... | |
<f:attribute name="sortField" value="Activity End Time" />
</h:commandLink> | [
-0.037780288606882095,
-0.28604060411453247,
0.37759992480278015,
-0.2596690356731415,
0.19968000054359436,
-0.28088539838790894,
-0.03452257066965103,
-0.08972916752099991,
-0.248911052942276,
-0.3905954360961914,
-0.44536691904067993,
0.5448659062385559,
0.00014071333862375468,
-0.140423... | |
</f:facet>
<h:outputText value="#{item.activityEnd}" />
</h:column>
<h:column> | [
-0.4330797493457794,
-0.20905011892318726,
0.5530223846435547,
-0.11730118840932846,
-0.15070366859436035,
0.33050864934921265,
0.0686289519071579,
-0.21832861006259918,
-0.23227931559085846,
-0.5586963295936584,
-0.5041163563728333,
0.40611568093299866,
-0.3875548243522644,
-0.24551819264... | |
<f:facet name="header">
<h:commandLink value="Activity" actionListener="#{SessionsController.sort}"> | [
0.07974819093942642,
-0.18988610804080963,
0.3009204864501953,
-0.0864722803235054,
-0.09316838532686234,
-0.07611636072397232,
0.33265894651412964,
-0.35311445593833923,
-0.6874935626983643,
-0.4013143479824066,
-0.4798886477947235,
0.6947550177574158,
-0.17297406494617462,
-0.24536868929... | |
<f:attribute name="sortField" value="Activity" />
</h:commandLink>
</f:facet> | [
-0.1733829379081726,
-0.13675875961780548,
0.43430405855178833,
-0.28006288409233093,
0.046351805329322815,
0.14776690304279327,
-0.09434361010789871,
-0.20885679125785828,
-0.20934723317623138,
-0.5977396368980408,
-0.4753357172012329,
0.6294525265693665,
-0.1305559128522873,
-0.332333058... | |
<h:outputText value="#{item.activity}" />
</h:column>
</h:dataTable>
<!-- The paging buttons --> | [
-0.3955344557762146,
-0.1012038141489029,
0.3109884560108185,
-0.020300503820180893,
-0.25347140431404114,
0.41103217005729675,
-0.09747891128063202,
-0.23868428170681,
-0.37939125299453735,
-0.5691480040550232,
-0.2125115841627121,
0.3268623650074005,
-0.49294513463974,
-0.355161726474761... | |
<h:commandButton value="first" action="#{SessionsController.pageFirst}"
disabled="#{SessionsController.firstRow == 0}" />
<h:commandButton value="prev" action="#{SessionsController.pagePrevious}" | [
0.006672408897429705,
-0.20678144693374634,
0.35398969054222107,
-0.06960158050060272,
-0.12430747598409653,
0.05287595093250275,
0.411264568567276,
-0.3534889221191406,
-0.37010031938552856,
-0.5904256105422974,
-0.6792455315589905,
0.6041406989097595,
-0.1957424283027649,
-0.021222488954... | |
disabled="#{SessionsController.firstRow == 0}" />
<h:commandButton value="next" action="#{SessionsController.pageNext}"
disabled="#{SessionsController.firstRow + SessionsController.rowsPerPage >= | [
-0.39649271965026855,
-0.1470087617635727,
0.1867077499628067,
0.07675912976264954,
0.040556881576776505,
0.13822191953659058,
0.47650808095932007,
-0.30600887537002563,
-0.5892052054405212,
-0.5837301015853882,
-0.5691500902175903,
0.3907490372657776,
-0.35125139355659485,
-0.002258792985... | |
SessionsController.totalRows}" />
<h:commandButton value="last" action="#{SessionsController.pageLast}"
disabled="#{SessionsController.firstRow + SessionsController.rowsPerPage >= SessionsController.totalRows}" />
<h:outputText val... | [
-0.3010273277759552,
0.04109565168619156,
0.4473005533218384,
0.04493401199579239,
-0.25711962580680847,
-0.0017591462237760425,
0.4563332796096802,
-0.35117918252944946,
-0.48112672567367554,
-0.5169079899787903,
-0.4675602614879608,
0.3179782032966614,
-0.2762419581413269,
0.125480845570... | |
/ #{SessionsController.totalPages}" />
<br />
<!-- The paging links -->
<ui:repeat value="#{SessionsController.pages}" var="page"> | [
0.036712195724248886,
0.10115022957324982,
0.495379775762558,
0.23903484642505646,
-0.4389970004558563,
-0.019955536350607872,
0.3376895487308502,
-0.2014514058828354,
-0.5461670160293579,
-0.5283148288726807,
-0.19880715012550354,
0.37348470091819763,
-0.1311788707971573,
0.12096004933118... | |
<h:commandLink value="#{page}" actionListener="#{SessionsController.page}"
rendered="#{page != SessionsController.currentPage}" />
<h:outputText value="#{page}" escape="false" | [
-0.340065062046051,
-0.0488513819873333,
0.5152614712715149,
-0.08123481273651123,
-0.07604121416807175,
-0.02669530361890793,
0.6789511442184448,
-0.5300570130348206,
-0.330899715423584,
-0.4321992099285126,
-0.5634202361106873,
0.6045399308204651,
-0.10298899561166763,
-0.242705613374710... | |
rendered="#{page == SessionsController.currentPage}" />
</ui:repeat>
<br /> | [
-0.12836697697639465,
-0.04867539182305336,
0.6176028847694397,
-0.11933216452598572,
0.03099881485104561,
0.0703158900141716,
0.459633469581604,
-0.18438869714736938,
-0.428393691778183,
-0.7086087465286255,
-0.45589834451675415,
0.39315053820610046,
0.04117504879832268,
-0.00367322354577... | |
<!-- Set rows per page -->
<h:outputLabel for="rowsPerPage" value="Rows per page" />
<h:inputText id="rowsPerPage" value="#{SessionsController.rowsPerPage}" size="3" maxlength="3" />
<h:commandButton value="Set" action="#{SessionsController.pageFir... | [
-0.1337418109178543,
-0.02885815128684044,
0.619599461555481,
0.027817780151963234,
-0.24798546731472015,
0.10387876629829407,
0.3647296130657196,
-0.6489089131355286,
-0.4326488673686981,
-0.5030435919761658,
-0.47364524006843567,
0.680545449256897,
-0.2389083355665207,
-0.181085914373397... | |
<h:message for="rowsPerPage" errorStyle="color: red;" />
</h:form>
</div>
<div id="settingsdiva" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:400px"> | [
-0.33000442385673523,
-0.09404352307319641,
0.5965666174888611,
0.012254414148628712,
0.049513477832078934,
0.06501464545726776,
0.22029884159564972,
-0.3104051351547241,
-0.05529661104083061,
-0.4668692648410797,
-0.3476215600967407,
0.5485363602638245,
0.10091124475002289,
-0.16603058576... | |
</div>
<div id="settingsdivb" style="width:350px; height:400px; position:absolute; background-color:transparent; top:20px; left:800px">
</div>
</div>
</div>
</h:body>
</html>
```
When I try to display data from the database table no data is displayed... | [
0.43818697333335876,
-0.09166596829891205,
0.6041918396949768,
-0.050812941044569016,
-0.2717803716659546,
-0.005008233245462179,
0.49507850408554077,
-0.5406960248947144,
-0.0940980538725853,
-0.7325213551521301,
-0.22871223092079163,
0.4166429936885834,
-0.1539374440908432,
-0.0412413142... | |
stack in Glassfish:
```
[#|2012-04-09T16:46:33.241+0300|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=173;_ThreadName=Thread-2;|java.lang.NullPointerException
at com.DX_57.HM_57.Sessions.ActiveSessionsArrayList(Sessions.java:375)
at com.DX_57.HM_57.Sessions.list(... | [
-0.25498807430267334,
0.16807930171489716,
0.6375811696052551,
-0.10958334803581238,
-0.047877367585897446,
0.4763123095035553,
0.42639458179473877,
-0.677632212638855,
-0.5470151305198669,
-0.4820750653743744,
-0.15001434087753296,
0.5755615830421448,
-0.26222851872444153,
-0.063742414116... | |
at javax.faces.component.UIData.setRowIndex(UIData.java:473)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeEnd(TableRenderer.java:191)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
at javax.f... | [
-0.22775663435459137,
0.26523980498313904,
0.6516409516334534,
-0.22611773014068604,
-0.18064309656620026,
0.7471020817756653,
0.2556469738483429,
-0.48325520753860474,
-0.42657843232154846,
-0.9055118560791016,
-0.2396204024553299,
0.36580362915992737,
0.11776220798492432,
-0.046566896140... | |
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCalla... | [
-0.267323762178421,
0.09434302896261215,
0.493749737739563,
-0.13158220052719116,
-0.03732031211256981,
0.46415144205093384,
0.26799121499061584,
-0.5529576539993286,
-0.11173440515995026,
-0.6685363054275513,
-0.298709899187088,
0.5151529908180237,
-0.24575260281562805,
-0.113827370107173... | |
which I cannot find. How I can fix this problem?
Best wishes
That's not JSF specific. You have a `null` reference on line 375 in `Sessions.java`. Go and make sure you don't invoke methods on a `null` object. In your particular case this will fix it:
```
ArrayList<ActiveSessionObj> al = new ArrayList<ActiveSessionObje... | [
-0.035389430820941925,
0.2812102138996124,
0.03505992144346237,
-0.03121020458638668,
0.03963933885097504,
-0.1969289630651474,
0.6772652268409729,
0.05932897701859474,
-0.32937830686569214,
-0.7595825791358948,
-0.12435732781887054,
0.4858531355857849,
-0.48898282647132874,
0.022417049854... | |
I have the same states and transitions defined for two type of work items (User Story and Task) and I would like when some work item is transitioned in that particular state that all child work items that have the same state and transitions are set with this state.
Example:
User Story and Task have state Postponed, a... | [
0.4870356619358063,
-0.12014206498861313,
0.25600436329841614,
0.20309393107891083,
0.12298398464918137,
0.3298209309577942,
0.022845374420285225,
-0.1489783376455307,
-0.49934327602386475,
-0.759292483329773,
0.0993211567401886,
0.501969039440155,
-0.02328105829656124,
0.6042000651359558,... | |
no support for it. You can use the TFS-API to invoke state changes. This [post](http://www.dotnetcurry.com/ShowArticle.aspx?ID=336) provides a related example. | [
0.24896755814552307,
-0.629767656326294,
0.262106716632843,
0.09580746293067932,
0.21094073355197906,
-0.09884697198867798,
0.4406399428844452,
0.19052386283874512,
-0.5701009035110474,
-0.6448085308074951,
-0.14579881727695465,
0.15143205225467682,
-0.5933738946914673,
0.12111277878284454... | |
I need to display a company name so that the "main" part of the name appears on one line and is huge and the secondary part of the name is centered below it and smaller. Since it's not a slogan or "subtitle", I feel like it should all be in the same `h1` element and, ideally, be transformed through pure CSS (meaning no... | [
0.8313826322555542,
0.35762834548950195,
0.10755985230207443,
-0.11983779817819595,
0.08129674196243286,
-0.00500611262395978,
0.10188725590705872,
0.291172057390213,
-0.10100962221622467,
-0.2706606090068817,
-0.08697079122066498,
0.38299816846847534,
-0.3797076642513275,
0.36098349094390... | |
a new line in the heading itself? If so you can use the first-line selector like this:
HTML
```
<h1>Foo bar | [
0.45921504497528076,
0.20450887084007263,
0.5323154330253601,
-0.3520925045013428,
-0.23083366453647614,
-0.1404377669095993,
0.17305253446102142,
0.0368545800447464,
-0.21676772832870483,
-0.24496276676654816,
-0.23895487189292908,
0.30786100029945374,
-0.49298033118247986,
-0.07641404867... | |
baz</h1>
```
CSS
```
h1 {
font-size:1em;
white-space:pre;
}
h1:first-line {
font-size:3em;
}
``` | [
-0.26928409934043884,
0.29776132106781006,
0.08310717344284058,
-0.5160481929779053,
-0.0628809854388237,
0.546095073223114,
0.09656021744012833,
-0.19680678844451904,
-0.12767456471920013,
-0.6971696615219116,
-0.885363757610321,
0.2854343056678772,
-0.46761468052864075,
-0.12180384248495... | |
I'm currently brainstorming for an idea of mine that involves a p2p render farm, somewhat like renderfarm.fi but in the difference that you pay for the service and contributors to the processing pool get paid.
Currently renderfarms measure price based on GHZ/h, but when the computers rendering are untrusted is there a... | [
0.7029082775115967,
0.07148642838001251,
0.24764077365398407,
-0.04134589061141014,
-0.26451411843299866,
-0.003949787467718124,
-0.11234171688556671,
-0.07350607961416245,
0.01920139417052269,
-0.6675888299942017,
0.1994691789150238,
0.48556801676750183,
0.014365356415510178,
0.1026295125... | |
bar
baz</h1>
```
CSS
```
h1 {
font-size:1em;
white-space:pre;
}
h1:first-line { | [
-0.24453426897525787,
0.392591655254364,
0.31777504086494446,
-0.5736131072044373,
-0.18611198663711548,
0.5609374046325684,
0.1884807050228119,
-0.30249035358428955,
0.15698228776454926,
-0.4641077220439911,
-0.8092915415763855,
0.22919191420078278,
-0.6023496985435486,
-0.186814039945602... | |
font-size:3em;
}
``` | [
-0.39989539980888367,
0.4373173415660858,
0.2766016721725464,
-0.26717814803123474,
0.04967651888728142,
0.4593085050582886,
0.1838787943124771,
0.0553986057639122,
-0.12586039304733276,
-0.6375088691711426,
-0.4116315245628357,
0.519027590751648,
-0.27447181940078735,
-0.1772375851869583,... | |
I'm trying to add a ViewController to my TableView cell however it is not showing up when testing.
PhotoLocation is a UIViewController subclass. I have a View Controller created on the StoryBoard with a bunch of UILabels, UITextFields, UISwitch, etc configured on it. PhotoLocation is associated with that StoryBoard Vi... | [
0.2991195619106293,
-0.10341357439756393,
0.990706741809845,
0.15000860393047333,
-0.17164652049541473,
0.03571435436606407,
-0.16156481206417084,
-0.17830517888069153,
-0.22763104736804962,
-1.0769875049591064,
0.1243409588932991,
0.42297616600990295,
-0.1827302724123001,
0.47393000125885... | |
`cellForRowAtIndexPath` method I'm doing the following:
```
// snip code above which sets up the cell and performs various other things
PhotoLocation *photoLocation_ = [self.storyboard instantiateViewControllerWithIdentifier:@"PhotoLocation"];
[photoLocation_.view setFrame:CGRectMake(115, 0, 210, 109)];
[cell.content... | [
0.22898700833320618,
0.08817684650421143,
0.8698664307594299,
-0.2163393646478653,
0.01299347449094057,
-0.1047682911157608,
0.33870169520378113,
-0.42587727308273315,
-0.1373632401227951,
-0.766015350818634,
-0.1525597870349884,
0.688335120677948,
-0.4654674530029297,
-0.07510837912559509... | |
cell = tvCell;
self.tvCell = nil;
}
```
The reason being, you cannot have 2 "viewControllers" on screen at the same time with the exception of Controllers of Controllers (Tab Bar, Navigation, SplitView). You are trying to put one view controller in another view controller right now. | [
0.12795329093933105,
-0.23436897993087769,
0.6284284591674805,
0.09852354228496552,
0.04355953261256218,
-0.2496175467967987,
0.14017696678638458,
-0.03722797706723213,
-0.22060143947601318,
-0.8827652335166931,
-0.10203489661216736,
0.806546151638031,
-0.37935900688171387,
0.1767417937517... | |
I have a hash collection:
`my_hash = {"1" => "apple", "2" => "bee", "3" => "cat"}`
What syntax would I use to replace the first occurrence of the `key` with hash collection `value` in a string?
eg my input string:
`str = I want a 3`
The resulting string would be:
`str = I want a cat`
My one liner:
```
hash.each { |... | [
-0.15048836171627045,
0.27393558621406555,
0.5847669839859009,
-0.31618189811706543,
0.16443446278572083,
0.31365442276000977,
0.2389426976442337,
-0.26603981852531433,
-0.13539652526378632,
-0.5677297115325928,
-0.12456698715686798,
0.292815625667572,
-0.42024144530296326,
0.1269156485795... | |
Is there a way how can I send data to RabbitMQ from $.ajax?
My application is made up of several thousands web-clients (written on js) and WCF REST service and now I am trying to figure out how can I create a scalable point for my application. The idea is to have a rabbitmq instance which receives messages from js cli... | [
0.12176116555929184,
0.09871691465377808,
0.11129975318908691,
0.34996798634529114,
-0.169675812125206,
0.318475604057312,
-0.042407672852277756,
0.08919265121221542,
-0.3675536811351776,
-0.6022672653198242,
0.36717697978019714,
0.26350435614585876,
-0.40801772475242615,
0.046413067728281... | |
some sort of gateway for it
There are lots of 3rd-party HTTP plugins listed on RabbitMQ's [developer tools page](http://www.rabbitmq.com/devtools.html), and they also offer an [experimental JSON-RPC plugin](http://www.rabbitmq.com/plugins.html#experimental) that allows for AMQP over HTTP access.
You should also take a... | [
0.18265892565250397,
0.10193400830030441,
0.1529199331998825,
-0.10850534588098526,
-0.2212945520877838,
-0.010501489974558353,
0.42894434928894043,
0.0653001144528389,
-0.41123151779174805,
-0.5384966135025024,
0.10551173239946365,
0.15904635190963745,
-0.37557387351989746,
-0.17814305424... | |
On my site, it displays a table of data.
I've got a link that will load another table of data from a URL.
```
$("#another").click(function() {
var newGeneration = $('<p />').load('another.php?cycle=' + i);
$('tbody').append(newGeneration);
i++;
});
```
Is there a way to get it so that it doesn't add a p... | [
0.3920043110847473,
-0.06652344018220901,
0.6523274183273315,
-0.24314281344413757,
0.19015222787857056,
0.18052345514297485,
0.4685996174812317,
-0.27452194690704346,
-0.15019580721855164,
-0.5886036157608032,
0.021286427974700928,
0.37619903683662415,
-0.4500100016593933,
0.4052482545375... | |
(like it is now)

This is not allowed. Read the [TOS](https://www.google.com/adsense/localized-terms) of adwords.
But a way to do it would be
```
var googleCode = '...your google code';
document.getElementById('googlediv').innerHTML(googlecode);
```
... | [
0.5057046413421631,
0.07454808056354523,
0.9545968770980835,
-0.10905922949314117,
-0.028668075799942017,
-0.2361474335193634,
0.25598129630088806,
-0.03890770301222801,
-0.25469204783439636,
-0.41891205310821533,
-0.2196008861064911,
0.2952241003513336,
-0.46144911646842957,
0.11574747413... | |
I'll like to know if this is a `bug` or `wrong implementation` ..... am try to check if `class_exist`
My Class
```
namespace servers\testing ;
class HelloWord
{
function hello()
{
echo "hello World" ;
}
}
```
Testing
```
use servers\testing\HelloWord as OkWorld ;
$okWolrd = new OkWorld() ;
$... | [
0.08866249769926071,
0.24590085446834564,
0.642748236656189,
-0.15171633660793304,
0.06976982206106186,
-0.1740574836730957,
0.5563966035842896,
-0.2548850178718567,
-0.06409180164337158,
-0.314220130443573,
-0.2253197878599167,
0.45845580101013184,
-0.29629793763160706,
0.4515547156333923... | |
OkWorld()` works fine.
How do you verify that `OkWord` exists without deceleration ?
**Edit 1**
I know that `OkWorld` is an `alias` but its a reference to `servers\testing\HelloWord` which is a valid class ...
Thanks
I think it's neither a bug nor a wrong implementation.
`OKWorld` is not a class, it's an alias,... | [
0.18772220611572266,
0.2521674335002899,
0.13992272317409515,
-0.0034601446241140366,
0.02907887101173401,
-0.47480154037475586,
0.5970938205718994,
0.2568325698375702,
0.018287980929017067,
-0.4897986650466919,
0.03213175758719444,
0.7084946036338806,
-0.6247555017471313,
0.23763161897659... | |
I'm trying to create a simple DBMS and although I've read a lot about it and have already designed the system, I have some issues about the implementation.
I need to know what's the best method in C++ to use a series of bits whose length will be dynamic. This series of bits will be saved in order to figure out which p... | [
0.4385920763015747,
0.18632295727729797,
0.1575046181678772,
0.33228376507759094,
-0.06859375536441803,
-0.17894797027111053,
0.13827402889728546,
-0.2526564598083496,
-0.2649132311344147,
-0.4377496540546417,
-0.06926382333040237,
0.39919206500053406,
-0.591497540473938,
0.258075892925262... | |
will not be fixed. So I don't think bitset would be the best way to do this.
I thought maybe to just use a sequence of characters, since each character is 1 byte = 8 bits maybe if I use an array of them I would be able to create the bit map that I want.
I never had to manipulate bits at such a low level, so I don't r... | [
0.48727452754974365,
0.1673119217157364,
0.3670977056026459,
0.18121273815631866,
-0.01880776137113571,
-0.04960184544324875,
-0.011400945484638214,
0.29244881868362427,
-0.32138070464134216,
-0.33458489179611206,
-0.0863625556230545,
0.5108234286308289,
-0.48416605591773987,
0.22627536952... | |
is not a class, it's an alias, the interpreter will replace it with `HelloWord` whenever it exists. But the interpreter will not search the strings, so the function `class_exists` will get the string `OKWorld` and search for the corresponding class, which doesn't actually exist! What actually exists is an alias. | [
-0.28855639696121216,
-0.01718921773135662,
0.17404970526695251,
0.023500729352235794,
0.1715104877948761,
-0.31058308482170105,
0.46928080916404724,
0.42828723788261414,
0.023843936622142792,
-0.27071133255958557,
-0.30338039994239807,
0.3822256922721863,
-0.670945942401886,
0.37202247977... | |
another question to put out there. I was working on an assignment to create hash functions and all that jazz, and i have stumbled across a small problem.
`Line 35:21, where it reads arrpos += prearrpo & ______,`
in my head works... What im trying to do is access `arr.length` from the `HashTable()` method. I've read... | [
0.12166722863912582,
0.5390286445617676,
0.2325170487165451,
-0.19672995805740356,
-0.3311385214328766,
0.1990281343460083,
0.18721404671669006,
0.16587071120738983,
-0.4159267246723175,
-0.5747161507606506,
-0.07325675338506699,
-0.051818519830703735,
-0.1505468785762787,
0.24186760187149... | |
of `if()` statements in the letter(`char c`) class; im certain there must be a shorter way of doing this... I would have initially used the ascii values; but the specifications were quite particular about using the values 1-26 for lower/upper case letters-
Thanks
```
import java.io.*;
public class HashTable {
p... | [
0.00496247224509716,
0.31776219606399536,
0.3217310607433319,
-0.41682395339012146,
0.019802844151854515,
0.039322927594184875,
0.33221110701560974,
-0.4889281988143921,
-0.23928417265415192,
-0.4195482134819031,
-0.34070074558258057,
0.4248027503490448,
-0.45166459679603577,
0.04606457054... | |
int size = 2 * tsize;
//System.out.println("Size: " + size);
boolean isPrime = checkPrime(size);
//System.out.println("IsPrime: " + isPrime);
while (isPrime == false) {
//System.out.println("Size: " + size);
size++;
isPrime = checkPrime(size); | [
-0.3791836202144623,
-0.17671750485897064,
0.47531381249427795,
-0.5257946848869324,
0.22232238948345184,
0.19868212938308716,
0.3841716945171356,
-0.6254196763038635,
-0.314243346452713,
-0.5655222535133362,
-0.4441954493522644,
0.4229191243648529,
-0.3869031071662903,
0.08076975494623184... | |
}
//System.out.println("Size: " + size);
String arr[] = new String[size];
}
public boolean insert(String line) {
String str = line;
char[] ch = str.toCharArray();
int slen = str.length();
int arrpos = 0;
int hash = slen; | [
-0.10603597015142441,
-0.46851176023483276,
0.5368416905403137,
-0.4763088524341583,
0.10269720107316971,
0.3948264718055725,
0.2909289300441742,
-0.3320942521095276,
-0.20710642635822296,
-0.07418729364871979,
-0.3647725582122803,
0.5567426681518555,
-0.3210391402244568,
0.122655294835567... | |
for (int i = 0; i < slen; i++) {
double prearrpo = letter(ch[i]) * Math.pow(32, (hash - 1));
arrpos += prearrpo % arr.length();
hash--;
}
System.out.println(arrpos);
System.out.println("array size:");
System.out.println();
return | [
-0.13969609141349792,
-0.17606514692306519,
0.5005777478218079,
-0.6465655565261841,
-0.024558458477258682,
0.7049385905265808,
0.5790424346923828,
-0.6463361978530884,
-0.3180583119392395,
-0.32941126823425293,
-0.3233397901058197,
0.36499258875846863,
-0.20032264292240143,
0.063169859349... | |
false;
}
private int letter(char c) {
char ch = c;
if (ch == 'A' || ch == 'a') {
return 1;
}
if (ch == 'B' || ch == 'b') {
return 2;
} | [
-0.19341596961021423,
0.014868270605802536,
-0.20036667585372925,
-0.5462856888771057,
-0.010395914316177368,
0.3376859724521637,
0.7881682515144348,
-0.2125270664691925,
0.3180096745491028,
-0.3104715347290039,
-0.6690416932106018,
0.5607898831367493,
-0.2109088897705078,
0.13572147488594... | |
if (ch == 'C' || ch == 'c') {
return 3;
}
if (ch == 'D' || ch == 'd') {
return 4;
}
if (ch == 'E' || ch == 'e') {
return | [
-0.3857434391975403,
0.09267952293157578,
0.21537162363529205,
-0.17923687398433685,
0.07907729595899582,
0.13675697147846222,
0.4509027898311615,
-0.6074164509773254,
0.2878366708755493,
-0.20169837772846222,
-0.9637402892112732,
0.7133724093437195,
-0.24213510751724243,
0.000724344863556... | |
5;
}
if (ch == 'F' || ch == 'f') {
return 6;
}
if (ch == 'G' || ch == 'g') {
return 7;
}
if (ch == 'H' || ch == 'h') { | [
-0.1965213567018509,
-0.05951807647943497,
0.4202682375907898,
-0.2613358795642853,
0.14099758863449097,
0.16428083181381226,
0.42969003319740295,
-0.4641821086406708,
-0.007483261171728373,
-0.12645119428634644,
-0.8129972219467163,
0.7138325572013855,
0.011927020736038685,
0.366453379392... | |
return 8;
}
if (ch == 'I' || ch == 'i') {
return 9;
}
if (ch == 'J' || ch == 'j') {
return 10;
} | [
-0.3318823277950287,
-0.045601341873407364,
0.21508517861366272,
-0.24382776021957397,
0.1358335316181183,
0.37667450308799744,
0.458503782749176,
0.022789206355810165,
-0.14334042370319366,
-0.2484327256679535,
-0.6223225593566895,
0.622965395450592,
-0.32359281182289124,
-0.0012233137385... | |
if (ch == 'K' || ch == 'k') {
return 11;
}
if (ch == 'L' || ch == 'l') {
return 12;
}
if (ch == 'M' || ch == 'm') {
return 13; | [
-0.18196068704128265,
0.025317367166280746,
-0.016713274642825127,
-0.4013131856918335,
0.35857605934143066,
0.28137150406837463,
0.2858968675136566,
-0.34036898612976074,
-0.11229080706834793,
-0.24935270845890045,
-0.6776909828186035,
0.5416949391365051,
-0.022501109167933464,
0.02193685... | |
}
if (ch == 'N' || ch == 'n') {
return 14;
}
if (ch == 'O' || ch == 'o') {
return 15;
}
if (ch == 'P' || ch == 'p') { | [
-0.2876364290714264,
0.05910063162446022,
0.20206096768379211,
-0.08425359427928925,
0.3130124509334564,
0.4953344166278839,
0.17616191506385803,
-0.17183516919612885,
-0.2140323966741562,
-0.10072385519742966,
-0.7203031182289124,
0.627820611000061,
-0.08340291678905487,
-0.10752547532320... | |
return 16;
}
if (ch == 'Q' || ch == 'q') {
return 17;
}
if (ch == 'R' || ch == 'r') {
return 18;
}
if (ch == | [
-0.05242319777607918,
0.09915631264448166,
0.3131673336029053,
-0.4756573438644409,
0.1901702880859375,
0.4469173550605774,
0.33885955810546875,
-0.5998457670211792,
-0.032101165503263474,
-0.0772673562169075,
-0.5727127194404602,
0.7675950527191162,
-0.22854703664779663,
-0.06248479336500... | |
'S' || ch == 's') {
return 19;
}
if (ch == 'T' || ch == 't') {
return 20;
}
if (ch == 'U' || ch == 'u') {
return 21; | [
-0.2090430110692978,
-0.3836839497089386,
0.6268857717514038,
-0.42274218797683716,
0.11334846913814545,
0.3122086226940155,
0.40978533029556274,
-0.4179115295410156,
-0.20107293128967285,
-0.3994758129119873,
-0.9783512353897095,
0.3839964270591736,
-0.10749459266662598,
0.186577528715133... | |
}
if (ch == 'V' || ch == 'v') {
return 22;
}
if (ch == 'W' || ch == 'w') {
return 23;
}
if (ch == 'X' || ch == 'x') { | [
-0.14256511628627777,
-0.03759102150797844,
0.08267484605312347,
-0.03613267466425896,
0.05497094243764877,
0.2659800946712494,
0.41668272018432617,
-0.2850029766559601,
-0.0328616127371788,
-0.16693070530891418,
-0.6661540865898132,
0.3978603184223175,
-0.1604023575782776,
0.1224892511963... | |
return 24;
}
if (ch == 'Y' || ch == 'y') {
return 25;
}
if (ch == 'Z' || ch == 'z') {
return 26;
}
return 0;
} | [
-0.14092791080474854,
0.17822295427322388,
0.056769657880067825,
-0.3386671543121338,
-0.10278352349996567,
0.34677180647850037,
0.39201807975769043,
-0.3363895118236542,
0.06417231261730194,
-0.2962456941604614,
-0.6549015641212463,
0.667439877986908,
-0.17412246763706207,
0.0425883829593... | |
public boolean lookUp(String string) {
//
return false;
}
public String getNum() {
//
return null;
}
public int length() {
return 0;
}
private static boolean checkPrime(int size) {
if (size % 2 == 0) | [
0.12590210139751434,
-0.3120039403438568,
0.012190884910523891,
-0.38754981756210327,
0.08595871925354004,
-0.15722860395908356,
0.33001795411109924,
-0.4321024715900421,
-0.005347087513655424,
-0.1290634423494339,
-0.38918426632881165,
0.664587676525116,
-0.6583176851272583,
0.12869207561... | |
{
return false;
}
double c = Math.sqrt(size);
for (int i = 3; i < c; i += 2) {
if (size % i == 0) {
return false;
} | [
0.22828316688537598,
-0.022600365802645683,
0.234630286693573,
-0.3518110513687134,
-0.02813214622437954,
0.3515876829624176,
0.57682865858078,
-0.5381444692611694,
-0.16770635545253754,
-0.14885313808918,
-0.27047041058540344,
0.6757344007492065,
-0.219853013753891,
-0.045720331370830536,... | |
}
return true;
}
}
```
`public HashTable()` is a constructor. Your `arr[]` should actually be a private member of your class and you should initialize it in all constructors or make sure you never access without intializing it.
```
public class HashTable {
private String[] arr;
public HashTable... | [
-0.2405335009098053,
0.18002986907958984,
0.15660588443279266,
-0.31981754302978516,
-0.049566831439733505,
-0.19163228571414948,
0.3467019498348236,
-0.27062705159187317,
-0.10211501270532608,
-0.4075601100921631,
-0.36080455780029297,
0.5137757658958435,
-0.5500497817993164,
0.1405472904... | |
System.out.println("Size1: ");
}
etc...
``` | [
-0.20859664678573608,
-0.14407779276371002,
0.1605951339006424,
-0.2566209137439728,
0.3319985270500183,
-0.11731041222810745,
0.1483006775379181,
0.08100494742393494,
-0.36146101355552673,
-0.5138687491416931,
-0.33579862117767334,
0.49793529510498047,
-0.4916955828666687,
0.4313025176525... | |
I have found similar answers to my current needs on SO, however I am still trying to grasp modifying strings based on a rule, except in certain enclosures within those strings.
Example of what Im trying to accomplish now:
```
preg_replace("/\s*,\s*/", ",", $text)
```
I found the above in many places. It will remove... | [
0.13793808221817017,
0.3974684178829193,
0.0706101804971695,
-0.17550772428512573,
-0.11526889353990555,
0.13237380981445312,
0.3471279740333557,
0.07343439757823944,
-0.026786642149090767,
-0.7823228240013123,
-0.08662579208612442,
0.5692819356918335,
-0.3003562092781067,
0.05368906632065... | |
in the following sentence removed, except commas found in double or single quotes:
```
a, b , c "d, e f g , " , h i j ,k lm,nop
```
Expected result:
```
a,b,c "d, e f g , ",h i j,k lm,nop
```
I think this might work (it replacing whitespaces outside "/' but not those within those):
```
function yourFunction($stri... | [
-0.2424619197845459,
0.005088065285235643,
0.49984246492385864,
-0.3555271625518799,
0.2436791956424713,
0.06422644108533859,
0.20486386120319366,
-0.35678574442863464,
0.018070433288812637,
0.025262007489800453,
-0.7362280488014221,
0.7905067205429077,
-0.38768652081489563,
-0.03992181643... | |
}
}
} else {
foreach ($arr as $key=>$value) {
if (($key % 2) == 0) {
$arr[$key] = preg_replace('~\s*,\s*~',',',str_replace('@',' ',$value));
}
}
}
$newString = implode('"',$arr);
$newString = str_replace('@',' ',$newString);
return $newString;
}
```
The @ is a ... | [
-0.013789120130240917,
0.10335087031126022,
0.5260615944862366,
-0.24577511847019196,
0.11725398898124695,
0.2952945828437805,
0.24778632819652557,
-0.08117719739675522,
-0.09834595024585724,
-0.46895086765289307,
-0.20722495019435883,
0.6277452707290649,
-0.4812951683998108,
0.36068341135... | |
i just know that i hat problems without that)
the "if (preg\_match"-construct checks if your string starts with "/' oder with sth. else for the logic in the foreach.
If the string starts with "/' every 2nd entry is inside 2 "/' otherwise the others.
Hope thats what youre looking for | [
0.022820092737674713,
0.16648517549037933,
0.27361777424812317,
0.05193153768777847,
0.3078775405883789,
-0.24778246879577637,
0.6455242037773132,
-0.1745912879705429,
0.0767340138554573,
-0.4492388069629669,
0.005120361689478159,
0.41140857338905334,
-0.0844782218337059,
-0.20964814722537... | |
I am adding a WordPress network to an existing website and one of my requirements is to embed the admin utility within our existing sites' layout.
I've written a custom plugin that registers functions to the `admin_head` and `admin_footer` actions. `admin_head` inserts content inside the `<head>` tag and `admin_foote... | [
0.12119211256504059,
-0.16370004415512085,
0.8349570631980896,
-0.13324300944805145,
-0.2893899381160736,
0.05056645721197128,
0.12132716178894043,
-0.3810436427593231,
-0.06280291825532913,
-0.7902825474739075,
-0.24398265779018402,
0.43532928824424744,
-0.3347338140010834,
-0.29523581266... | |
{
echo '<!-- custom code -->';
}
``` | [
0.28021255135536194,
0.24149343371391296,
0.058282773941755295,
-0.2572917938232422,
0.1481865793466568,
-0.14154919981956482,
0.3967389166355133,
-0.38729339838027954,
-0.038930028676986694,
-0.21118438243865967,
-0.46740320324897766,
0.5204206109046936,
-0.46485623717308044,
0.2532801330... | |
In C++, when is an object defined as "out of scope"?
More specifically, if I had a singly linked list, what would define a single list node object as "out of scope"? Or if an object exists and is being referenced by a variable `ptr`, is it correct to say that the object is defined as "out of scope" the moment the ref... | [
-0.0829479992389679,
-0.21468956768512726,
0.265870064496994,
-0.22729282081127167,
0.03739871457219124,
-0.26002177596092224,
0.09465593099594116,
-0.10369317978620529,
-0.10650898516178131,
-0.27898934483528137,
-0.45771709084510803,
0.43549802899360657,
-0.6599547266960144,
0.0613140128... | |
list_1 = new Node (3);
Node* list_2 = new Node (4);
Node* list_3 = new Node (5);
list_1->next = list_2;
list_2->next = list_3;
list_3->next = null;
}
```
In other words, would the Node being pointed to by `list_1` call its destructor after this line:
```
Node* list_1 = new Node (3);
```
?
Fir... | [
0.030392266809940338,
0.011411958374083042,
0.2958781123161316,
-0.1378461867570877,
-0.16524925827980042,
-0.018152480944991112,
0.21755848824977875,
-0.44287192821502686,
-0.24129565060138702,
-0.5469059944152832,
-0.4839680790901184,
0.3282652497291565,
-0.5645589232444763,
0.2328757345... | |
as a flow control block (`while`/`if`/`for` etc.). An arbitrary `{}` pair enclosing an arbitrary block of code also constitutes a stack frame. Any local variable defined within a frame will go out of scope once the program exits that frame. When a stack variable goes out of scope, its destructor is called.
So here is... | [
0.036769092082977295,
-0.25848251581192017,
0.3860565423965454,
-0.34429776668548584,
0.17799340188503265,
-0.2612599730491638,
0.24848416447639465,
-0.3730379045009613,
-0.2563674747943878,
-0.4196271002292633,
-0.43450605869293213,
0.20884282886981964,
-0.8304491639137268,
0.270469039678... | |
b.doSomeBigHeavyStuff();
}
bigSideEffectGuy();
// a BigHeavyObject called b was created during the call,
// and it went out of scope after the call finished.
// The destructor ~BigHeavyObject() was called when that happened.
```
Here is an example where we see a stack frame being just the body of an `if` statement:
... | [
0.04355547949671745,
-0.16666750609874725,
0.4819318652153015,
-0.44929760694503784,
0.12907402217388153,
-0.3232928216457367,
0.3021794557571411,
-0.2655089199542999,
-0.0941290557384491,
-0.2650357484817505,
-0.36590641736984253,
0.5594807267189026,
-0.5006372928619385,
0.175484493374824... | |
not really "remaining in scope" because the object is being copied. So the original goes out of scope, but a copy is made. Example:
```
Circle myFunc () {
Circle c (20);
return c;
}
// The original c went out of scope.
// But, the object was copied back to another
// scope (the previous stack frame) as a ret... | [
0.33419352769851685,
-0.06829482316970825,
0.27230650186538696,
-0.1817323863506317,
0.15074101090431213,
-0.38129177689552307,
0.02433989755809307,
-0.1508893221616745,
-0.4330194890499115,
-0.3644082248210907,
-0.39102908968925476,
0.3211745321750641,
-0.3908863365650177,
0.4486190974712... | |
de-allocates the necessary memory as you enter and exit stack frames, you must manually reserve and free heap memory.
An object declared on the heap does, after a fashion, "survive" between stack frames. One could say that an object declared on the heap never goes out of scope, but that's really because the object is... | [
0.1853751242160797,
-0.0358150452375412,
0.061441268771886826,
0.3458591103553772,
0.20948432385921478,
-0.10971597582101822,
0.33046817779541016,
-0.1508447378873825,
-0.3651028871536255,
-0.598881185054779,
-0.608577311038971,
0.2508259117603302,
-0.2463861107826233,
0.555298924446106,
... | |
`delete` keyword. The destructor on a heap object is not called until you free the object.
The pointers that refer to heap objects are themselves usually local variables associated with scopes. Once you are done using the heap object, you allow the pointer(s) referring to it to go out of scope. If you haven't explicit... | [
0.23517970740795135,
-0.30433887243270874,
0.31958162784576416,
0.24801751971244812,
0.1997043490409851,
-0.2170109897851944,
0.15013039112091064,
-0.0500095933675766,
-0.5303134918212891,
-0.44716447591781616,
-0.6773486137390137,
0.3861728608608246,
-0.3147065043449402,
0.530603647232055... | |
a chair in a room. When you exit the room, the balloon automatically pops. An object created on the heap is like a balloon on a ribbon, tied to a chair in a room. The ribbon is the pointer. When you exit the room, the ribbon automatically vanishes, but the balloon just floats to the ceiling and takes up space. The prop... | [
0.05728864669799805,
-0.0026263550389558077,
0.65621018409729,
0.5179771184921265,
0.2208033949136734,
-0.07152751833200455,
-0.08099689334630966,
-0.21188007295131683,
-0.8495910167694092,
-0.3048346936702728,
-0.49796217679977417,
-0.43397778272628784,
-0.2826894223690033,
0.690300524234... | |
in your hand, and exit the room and take the balloon with you.
So to go to your linked list example: typically, nodes of such a list are declared on the heap, with each node holding a pointer to the next node. All of this is sitting on the heap and never goes out of scope. The only thing that could go out of scope is ... | [
0.4026135802268982,
-0.26983585953712463,
0.1591425985097885,
0.3058614432811737,
0.16426235437393188,
-0.1642255187034607,
-0.16575570404529572,
0.19687384366989136,
-0.5932507514953613,
-0.5609278082847595,
-0.018746649846434593,
-0.11919090151786804,
-0.37502557039260864,
0.200436010956... | |
on the heap, and the root pointer going out of scope:
```
if (myCondition) {
Node* list_1 = new Node (3);
Node* list_2 = new Node (4);
Node* list_3 = new Node (5);
list_1->next = list_2;
list_2->next = list_3;
list_3->next = null;
}
// The list still exists
// However list_1 just went out of s... | [
-0.08990989625453949,
0.22980378568172455,
0.16407455503940582,
-0.2535291016101837,
0.1375414878129959,
-0.16362248361110687,
0.3921951651573181,
-0.24611735343933105,
-0.487648606300354,
-0.7066956758499146,
-0.1920211762189865,
0.3169677257537842,
-0.3657393753528595,
0.4227437376976013... | |
First of all, forgive me, as my question may seem foolish, but I'm really curious why I get a performance boost in this very simple code.
here's the assembly code:
```
__asm {
mov eax, 0
mov ecx, 0
jmp startloop
notequal:
inc eax
mov ecx, eax
sub ecx, 2
startloop:
cmp eax, 20000000... | [
-0.22138620913028717,
0.20673300325870514,
0.46612387895584106,
-0.20237959921360016,
0.041519373655319214,
-0.05198018625378609,
0.26048052310943604,
-0.4507986903190613,
-0.2021338939666748,
-0.5959937572479248,
-0.2555524706840515,
0.6921563744544983,
-0.22156624495983124,
-0.1409122645... | |
x = ii - 2;
};
```
C code takes approximately 1060 ms (in release build) to complete on my i5 2500k machine and the assembly finishes in 780ms. It's a ~25% gain in speed. I don't understand why do I get this result, because 25% is a big difference. Isn't the compiler smart enough to generate an equal assembly code th... | [
0.07600507140159607,
0.4245116710662842,
0.5384292602539062,
-0.057117145508527756,
-0.03384891152381897,
0.2089386135339737,
0.36565539240837097,
-0.2749527394771576,
-0.05360657721757889,
-0.79362553358078,
-0.16416317224502563,
0.4559289515018463,
-0.22093765437602997,
0.163275063037872... | |
; 77359400H
jl SHORT $LL3@main
```
what does lea instruction do in this case?
UPDATE 2
---
Thank you very much everyone. I just tested this code at work, on Nehalem xeon cpu and the results are identical here. Looks like for an unknown reason, that asm code runs faster on Sandy bridge.
@modelnine's comment is... | [
0.12037169188261032,
0.22834469377994537,
0.3832027316093445,
-0.008350343443453312,
0.021214773878455162,
-0.08226966112852097,
0.2796308398246765,
-0.1402033567428589,
0.14487984776496887,
-0.7805969715118408,
-0.04121656343340874,
0.6427277326583862,
-0.3044871389865875,
-0.118044652044... | |
out (and that's important - dereferencing `eax` in this case will probably cause problems), so you get:
```
esi = eax - 2;
```
Exactly what your C code was trying to do. | [
0.23330152034759521,
0.323244571685791,
-0.005997977685183287,
-0.44550570845603943,
0.13268882036209106,
-0.06035328283905983,
-0.028711318969726562,
-0.2771291136741638,
-0.09039528667926788,
-0.225265771150589,
-0.24650362133979797,
0.5486398935317993,
-0.3862338066101074,
-0.0708181634... | |
A literal grid, of course; `Grid` isn't what I mean. Is there a preexisting control that would allow me to display a grid of checkboxes/toggleable things so that each row would correspond to an object, and each column would correspond to a property of the object? I'm looking for something more elegant/aesthetically app... | [
0.3069862425327301,
0.0289674811065197,
0.052428558468818665,
0.04312452673912048,
-0.1984185129404068,
-0.034635964781045914,
0.37886255979537964,
-0.12723620235919952,
-0.0024342217948287725,
-0.38847866654396057,
0.10245171189308167,
0.6837968826293945,
-0.4302389621734619,
-0.013950875... | |
doing effectively:
```
esi = &(*(eax - 2));
```
The `&` and `*` cancel each other out (and that's important - dereferencing `eax` in this case will probably cause problems), so you get:
```
esi = eax - 2;
```
Exactly what your C code was trying to do. | [
0.2067720741033554,
0.293317586183548,
0.25344720482826233,
-0.2864511013031006,
0.10963833332061768,
-0.2706848382949829,
0.2539612948894501,
-0.36963221430778503,
-0.1353147178888321,
-0.3863174021244049,
-0.3780555725097656,
0.6734497547149658,
-0.33666443824768066,
-0.17245784401893616... | |
I'm developing a game, and I can't seem to draw to the screen at all. When I call SDL\_BlitSurface, nothing happens. However, it does not return an error code. I've written a class to handle image sprites, and when I step through with a debugger, I see it is returning non-empty values for the surface to blit to the mai... | [
0.5365115404129028,
0.12309093773365021,
0.5007156133651733,
-0.09428010135889053,
-0.29112428426742554,
-0.05548924207687378,
-0.14877745509147644,
0.031616535037755966,
-0.12195231020450592,
-0.7974584698677063,
0.25240299105644226,
0.5564990639686584,
-0.2715097963809967,
0.187029033899... | |
main as winmain, but this is a console application so we don't want that
#undef main
const int MAX_FPS = 80;
int main ( int argc, char* argv[] ) {
//Initialization
System game( false, 640, 480, "Platformer", MAX_FPS ); //Create a game that is not fullscreen with a resolution of 640x480
SDL_Surface *buffer... | [
-0.41247326135635376,
-0.47950440645217896,
0.7213360667228699,
0.0557175911962986,
-0.023399466648697853,
0.02852301113307476,
0.13857156038284302,
-0.2736041247844696,
-0.19445525109767914,
-0.397870808839798,
-0.21415631473064423,
0.5688932538032532,
-0.3298395872116089,
0.3809879422187... | |
hitbox.w = 32;
hitbox.h = 32;
hitbox.x = 0;
hitbox.y = 0;
Player player( 100, 100, hitbox, 1.0, RIGHT, player_sprite );
//Main game loop
while( !game.check_is_done() ) {
game.refresh_top();
player.draw( buffer );
game.refresh_bottom();
}
//Cleanup
delete inpu... | [
-0.2973864674568176,
-0.38226044178009033,
0.5625276565551758,
-0.32833799719810486,
0.1441304236650467,
0.19117698073387146,
0.021660031750798225,
-0.34731948375701904,
-0.10801523923873901,
-0.7101597785949707,
-0.18634556233882904,
0.5834591388702393,
-0.23501797020435333,
0.34854197502... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.