text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
Use a `for ( key_name in pins)` in conjunction with [`Object.hasOwnProperty`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/HasOwnProperty) (to exclude inherit properties) to loop through the properties. The problem of your third test case is that it reads the values of keys 0, 1 and 2 (i...
[ 0.15334375202655792, 0.019044728949666023, -0.051987241953611374, 0.08422478288412094, 0.17999093234539032, -0.2808915078639984, -0.048565808683633804, -0.5460003018379211, -0.33814871311187744, -0.12536992132663727, -0.1291908323764801, 0.45800942182540894, -0.09570387005805969, 0.1974061...
Using Rails 3.1.1 and the gem acts\_as\_tree. I have googled the issue and checked similar questions here at SO (the answers are too old, or irrelevant). I have a model called articles with a route that today looks like: ``` resources :articles, :path => '', :only => :show resources :articles, :path => 'articles...
[ 0.17825746536254883, 0.3131425380706787, 0.3462672233581543, -0.01363785658031702, -0.20785585045814514, -0.125112384557724, 0.4101409316062927, -0.3390873968601227, -0.12797632813453674, -0.6166887283325195, 0.3774523138999939, 0.5604649186134338, -0.15154267847537994, -0.0453021191060543...
in a clean simple manner? Basically, I want a path that will be host.com/:parent\_id/:parent\_id/:id with N numbers of :parent\_id. Pretty much how Wordpress-articles are routed. I don't believe route globbers is the solution, but I might be wrong. It seems to give the same result for host.com/:id and host.com/foo/ba...
[ 0.6281751394271851, 0.11816463619470596, 0.34095078706741333, 0.1037336140871048, -0.1551508903503418, -0.17794714868068695, 0.47937315702438354, 0.028578223660588264, -0.21787235140800476, -0.7616395354270935, 0.14832863211631775, 0.15678058564662933, -0.40862929821014404, 0.2426894158124...
if the route globbers solution would take care of generating the URLs with parent IDs though. ### B) You don't need the parent IDs to perform the routing, correct? You just want to include them in the URLs and route those requests the same as if using the URLs like `example.com/chapter1`, correct? If you'd consider ...
[ 0.12856511771678925, 0.020678015425801277, 0.24980661273002625, 0.12977226078510284, -0.06192204728722572, -0.20679055154323578, 0.055277276784181595, 0.12112171202898026, -0.18813791871070862, -0.5284035801887512, 0.03972692787647247, 0.3301980197429657, -0.31311339139938354, 0.0738286003...
URLs with parent IDs for linking to those resources. ### Duplicate Content Either way, you'll need to generate URLs that include the parent IDs, so duplicate content issues probably aren't too likely if you only link to those resources using those URLs.
[ 0.5071006417274475, 0.08246470987796783, 0.256205677986145, 0.6164219975471497, -0.03256082907319069, -0.2742587625980377, -0.017475314438343048, 0.6302017569541931, -0.4533465802669525, -0.5315201878547668, -0.12782396376132965, 0.23484891653060913, -0.12378178536891937, 0.471357554197311...
how would i tranfoms this curl command: ``` curl -v -d email=onlinecrapbox@gmail.com -d password=mypassword -X POST https://www.toggl.com/api/v6/sessions.json ``` into urlib2? Why is this not working: ``` url= 'https://www.toggl.com/api/v6/sessions.json' username = 'onlinecrapbox@gmail.com' password = 'myp...
[ 0.046644385904073715, 0.2024916708469391, 0.7536229491233826, -0.1037447527050972, 0.06555969268083572, 0.0005613249377347529, 0.4851434528827667, -0.5122181177139282, -0.014607795514166355, -0.5793845653533936, 0.016466718167066574, 0.6357353329658508, -0.29900968074798584, 0.108155675232...
response = meth(req, response) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 'http', request, response, code, msg, hdrs) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error return ...
[ -0.2070179581642151, -0.013464761897921562, 0.9693431854248047, -0.2536870241165161, -0.21446417272090912, 0.35795000195503235, 0.5047332644462585, -0.8711149096488953, -0.1140139028429985, -0.2925407886505127, -0.5287302732467651, 0.6198979020118713, -0.3993675112724304, 0.132246330380439...
I have this code here: ``` var Person = (function() { var name; var PersonConstructor = function(n) { name = n; }; PersonConstructor.prototype.getName = function() { return name; }; return PersonConstructor; })(); var people = []; var person1 = new Person("Foo"); var person...
[ -0.07392282783985138, -0.13918223977088928, 0.3012242019176483, -0.6056726574897766, -0.06481277197599411, 0.5820484757423401, 0.27549996972084045, -0.30666685104370117, -0.11763525754213333, -0.5783467888832092, -0.03161648288369179, 0.4442431628704071, -0.5205466151237488, 0.153882727026...
is also a static variable. Since this is tripping my current efforts I would like to know if there is a way to keep the private behaviour in this example but avoid the static one? There is no "private" when working with prototypes. It should be noted there is no value in private state, avoid it like the plague. Closur...
[ -0.07088304311037064, 0.0937424823641777, 0.09132005274295807, -0.06032177433371544, -0.10544747859239578, 0.05001957714557648, 0.4945024251937866, 0.34651991724967957, -0.2560156285762787, -0.3381776809692383, -0.08329292386770248, 0.4765337407588959, -0.413644939661026, 0.709185183048248...
get name() { return name }, set name(n) { name = n } } } ``` Note this is highly inefficient and has little benefit. Alternatively you can store state in a weakmap ``` function privates() { var map = new WeakMap() return function (key) {
[ -0.247524231672287, -0.5843037366867065, 0.18563249707221985, -0.09528762847185135, 0.029385080561041832, -0.22202686965465546, 0.4470198452472687, -0.1638028472661972, -0.20183581113815308, -0.7716284990310669, -0.38838934898376465, 0.5075752139091492, -0.33121681213378906, 0.409994214773...
var v = map.get(key) if (!v) { v = {} map.set(key, v) } return v } } var NameHolder = (function () { var state = privates() return { constructor: function (name) {
[ -0.22026818990707397, -0.5168717503547668, 0.36172735691070557, -0.13777203857898712, -0.05679842457175255, 0.11927739530801773, 0.3323669135570526, -0.4417928159236908, 0.01925206556916237, -0.6201422810554504, -0.39368289709091187, 0.6859731674194336, -0.28128430247306824, 0.367697268724...
state(this).name = name }, getName: function () { return state(this).name } } }()) ``` `WeakMap` browser support is non-existant so emulate it using [pd.Name](https://github.com/raynos/pd#pdName)
[ -0.11860481649637222, -0.11920061707496643, 0.34811317920684814, -0.2763504683971405, 0.21283718943595886, -0.11530076712369919, 0.5026222467422485, 0.059761691838502884, -0.05805298313498497, -0.9387940168380737, -0.2516787350177765, 0.31100335717201233, -0.4277763068675995, 0.19226938486...
i want to create a div under document.body. The width and height of that div should be such that it exactly fits the mobile device, now that device can be a tablet like an ipad or a mobile deivce like iPhone, or any web page on desktop browsers. i tried with screen.width, and screen.height, but these values are not exa...
[ 0.40261948108673096, 0.16548669338226318, 0.6902319192886353, 0.022555146366357803, -0.15157827734947205, 0.1552988588809967, 0.012835920788347721, -0.3001704812049866, -0.11603179574012756, -0.7187597751617432, 0.1731773018836975, 0.4371916353702545, 0.18252800405025482, 0.040910527110099...
more question, on iphone if we change the view from portrait to landscape, why does the font size change ? i have this meta tag on the html page There is no "private" when working with prototypes. It should be noted there is no value in private state, avoid it like the plague. Closures are ugly and expensive. ``` var...
[ 0.24204875528812408, 0.13260406255722046, 0.5299153327941895, -0.19759120047092438, 0.030108340084552765, 0.24562372267246246, 0.623701274394989, 0.15079323947429657, -0.15282870829105377, -0.7752202749252319, -0.041206929832696915, 0.5895092487335205, -0.3321007192134857, 0.13526533544063...
return name }, set name(n) { name = n } } } ``` Note this is highly inefficient and has little benefit. Alternatively you can store state in a weakmap ``` function privates() { var map = new WeakMap() return function (key) { var v = map.get(key)
[ -0.2693825662136078, -0.5484965443611145, 0.2544536888599396, -0.1609276384115219, 0.013654216192662716, -0.08610023558139801, 0.5140476822853088, -0.25666239857673645, -0.24246744811534882, -0.857529878616333, -0.3893386721611023, 0.4874255955219269, -0.34359654784202576, 0.48292762041091...
if (!v) { v = {} map.set(key, v) } return v } } var NameHolder = (function () { var state = privates() return { constructor: function (name) { state(this).name = name
[ -0.1707712560892105, -0.4377102553844452, 0.1774997115135193, -0.10901904851198196, 0.14239925146102905, 0.016316402703523636, 0.15463070571422577, -0.40355372428894043, 0.09625204652547836, -0.46344220638275146, -0.34674304723739624, 0.6104587316513062, -0.24657727777957916, 0.54352450370...
}, getName: function () { return state(this).name } } }()) ``` `WeakMap` browser support is non-existant so emulate it using [pd.Name](https://github.com/raynos/pd#pdName)
[ -0.09928164631128311, -0.18720701336860657, 0.4344659149646759, -0.2869283854961395, 0.29000231623649597, -0.1974828988313675, 0.41167670488357544, 0.1813170164823532, -0.03481592237949371, -0.9070343375205994, -0.40876731276512146, 0.505272388458252, -0.4042511284351349, 0.096117168664932...
I have a UIImageView being moved with a timer towards the edge of the view but it carries on and I don't know how to stop the UIImageView as soon as it hits he edge! Please Help? This is what I have tried so far in my method! Code: ``` -(void)moveBack { CGPoint manCenter = man.center; if (manCenter.x > 480) { man...
[ -0.09711241722106934, -0.2758601903915405, 0.8411532640457153, -0.055603619664907455, -0.13495220243930817, 0.08274362236261368, 0.25716671347618103, -0.22962239384651184, -0.23433533310890198, -0.9866561889648438, -0.1140715703368187, 0.6172522306442261, -0.12185648083686829, 0.4230189025...
[self ifCollided]; if (man.center.x > 480) { man.center = CGPointMake(480 , man.center.y); } } ```
[ -0.048391468822956085, 0.060867082327604294, 0.30112889409065247, -0.08325400948524475, 0.20607218146324158, 0.14322452247142792, 0.19178436696529388, -0.28929951786994934, -0.18356192111968994, -0.4295795261859894, 0.04204527661204338, 0.7010887861251831, -0.17269380390644073, 0.266509711...
can we make validations with arrays i.e. ``` $x="123@ex.com"; ``` it's validation rule is ``` array("x","email"); ``` how can we do the following: ``` $x=array("a1@ss.com","a2@ss.com","a3@ss.com"); //--------what the rule(s) should look like ``` I think it would be better to make your own callback, in which y...
[ 0.4165593683719635, 0.18393093347549438, 0.25129079818725586, 0.02389620989561081, -0.02356395684182644, -0.23658011853694916, 0.2058182656764984, -0.45764702558517456, -0.1417342722415924, -0.14490780234336853, -0.14578969776630402, 0.6345771551132202, -0.36622586846351624, -0.13698802888...
How can I replace storyboard with XIB? While trying to create dynamically views and their controllers, I lost all advantages of the new storyboard. Now, when trying to remove it from the project, I created a new XIB with its own controller and replaced it in project settings: ![enter image description here](https:/...
[ -0.019659636542201042, -0.06116575375199318, 0.5052977204322815, 0.19427557289600372, 0.007074589375406504, -0.11318807303905487, 0.2822014093399048, -0.08243966847658157, -0.20607586205005646, -0.8049703240394592, -0.03529787436127663, 0.4375803768634796, -0.4190139174461365, 0.2264322191...
UIRootWindow : UIViewController @end ``` And its corresponding implementation: ``` #import "UIRootWindow.h" @implementation UIRootWindow - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; return self; } - (voi...
[ -0.15855449438095093, -0.28678277134895325, 0.990019679069519, 0.3515050709247589, 0.10728771239519119, -0.12230425328016281, 0.3530115485191345, -0.2843571603298187, -0.13386815786361694, -0.7172647714614868, -0.27195873856544495, 0.688504695892334, -0.14346148073673248, 0.021491281688213...
set the window's root controller there. Application start-up assumes that a xib mentioned there has a File's Owner that is a UIApplication. (Older templates used to do that and some sample projects still do.)
[ 0.18161530792713165, -0.3250170648097992, 0.20677067339420319, 0.16233152151107788, 0.017522497102618217, -0.22331467270851135, 0.02420048601925373, 0.03565944731235504, -0.046101637184619904, -0.7049319744110107, -0.41835132241249084, 0.17853997647762299, -0.390103280544281, 0.18341182172...
One of the things I love is the new Android Favorites Contact screen: ![enter image description here](https://i.stack.imgur.com/QpVFz.jpg) I want to implement something similar in my app, but I don't know how do I make a list activity show two items per row instead of just one. If anyone has any code to do something ...
[ 0.3271755576133728, -0.16221478581428528, 0.4946349561214447, 0.16421906650066376, -0.17163942754268646, 0.11018770933151245, 0.17246359586715698, 0.3717373311519623, -0.5880423784255981, -0.8765071630477905, 0.052681390196084976, 0.4707452356815338, -0.08701851963996887, 0.369280666112899...
I'm a beginner in JS and jQuery, and I want to add 2 rows dynamically (the orange one and the row which contains the cols) when I click on a link (the gray rectangle on the bottom of the page). Here's a screenshot : ![enter image description here](https://i.stack.imgur.com/o8VsY.jpg) This is my HTML code : ``` <div ...
[ -0.051451873034238815, 0.23976971209049225, 0.6470777988433838, -0.31700950860977173, -0.06250637024641037, 0.36170995235443115, 0.20661096274852753, 0.11977608501911163, -0.030848130583763123, -0.694658100605011, -0.33639299869537354, 0.40614739060401917, -0.1702287197113037, -0.041305176...
$('.AddResults').click(function(){ var rowNumber = 3; // All the cols var jourVar = $('<td class="jr_td"><p><input type="text" class="datepicker" /></p><p class="ou">ou</p><p><input type="text" class="datepicker" /></p></td>') ; var creneauVar = $('<td class="cr_td"><select><option valu...
[ -0.12223100662231445, -0.06673489511013031, 0.7303937673568726, -0.30466774106025696, -0.07919149845838547, 0.7170884609222412, 0.24007628858089447, -0.8963184952735901, -0.37150517106056213, -0.5473912954330444, -0.4910271465778351, 0.7217600345611572, -0.2853625416755676, -0.026978980749...
var totalVar = $('<td class="tt_td"><strong>4h.</strong></td>') ; var pttcVar = $('<td class="pttc_td"><strong>88 &#8364;</strong></td>') ; var corVar = $('<td class="cor_td"><a href="#"><img src="img/ico/corbeille.png" alt="" width="13" height="13" /></a></td>') ; //Create 2 new rows ...
[ -0.21503578126430511, -0.018947426229715347, 0.7837774753570557, -0.39288896322250366, -0.28054025769233704, 0.669504702091217, 0.3558941185474396, -0.8967418074607849, -0.4864640533924103, -0.32954344153404236, -0.14037014544010162, 0.6540480256080627, -0.16703736782073975, -0.09314379841...
+ '' + totalVar + '' + pttcVar + '' + corVar + '); //Append the new row to the body of the #table_prest table $('#table_prest tbody').append(newTitreRow); $('#table_prest tbody').append(newContentRow); //Iterate row number rowNumber++; }); </script> ``` But of course noth...
[ -0.14706625044345856, 0.17815734446048737, 0.6475549936294556, -0.2632368505001068, 0.0016621090471744537, 0.10793391615152359, 0.6235269904136658, -0.26829299330711365, -0.12626245617866516, -0.7635891437530518, -0.19001837074756622, 0.8404762744903564, -0.27884408831596375, -0.0067745526...
+ '' + creneauVar + '' + repassageVar + '' + menageVar + '' + totalVar + '' + pttcVar + '' + corVar + '); ``` at the end of the concatentation there is an extra + ' it should probalby be: ``` var newContentRow = $('<tr>' + jourVar + '' + creneauVar + '' + repassageVar + '' + menageVar + '' + totalVar + '' + pttcVar...
[ -0.3349776268005371, 0.09389311820268631, 0.824094831943512, -0.2850781977176666, -0.02352605015039444, 0.2773732542991638, 0.31021299958229065, -0.30089104175567627, -0.1778644472360611, -0.5722585320472717, -0.675584077835083, 0.840936541557312, -0.2504207193851471, 0.05776723846793175, ...
a global variable for that, or just get the count of rows form the table each time the button is clicked instead if you want to update the Title line with the row number.
[ -0.2356056571006775, -0.18930311501026154, 0.5608111023902893, 0.31736451387405396, 0.030308714136481285, -0.09768098592758179, -0.15564201772212982, 0.27114179730415344, -0.42114371061325073, -0.4439983069896698, 0.1365642249584198, 0.6188857555389404, -0.1935379058122635, 0.1723695993423...
I have a large javascript function init() that hides and shows a large number of div's. When the page is loaded the javascript function is triggered by the script below. ``` <script type="text/javascript"> $(document).ready(function() { init(); }); </script> ``` Most of the time the javascript is triggered by the s...
[ 0.26104652881622314, 0.09279574453830719, 0.6153006553649902, -0.16313637793064117, -0.24600321054458618, -0.1974380612373352, 0.3922070860862732, -0.43441885709762573, 0.15079288184642792, -0.9166206121444702, -0.2037743777036667, 0.5520352125167847, -0.3354073166847229, 0.018817035481333...
error occurs when Pressing F5 20 times. I checked that init() seems to not being called at all because the first statement (alert("function called");) in init() wasn't called. In the cases that the javascript was working fine I got the alert message and the page was loaded fine without any errors. I tried different ...
[ -0.32481849193573, 0.10001738369464874, 0.3447830379009247, -0.5073660016059875, 0.03729207068681717, 0.18835952877998352, 0.7467919588088989, -0.2333991676568985, -0.189927339553833, -0.5669800043106079, -0.2579411566257477, 0.7396639585494995, -0.4407760500907898, -0.20808009803295135, ...
variables generated by the php script, to get activetab var a=1; b=1; highlightboxinitiate(a,activetab__gl_var,load2__gl_var); highlightlistinitiate(a,b); pauzereload__gl_var=0; } ``` This is the highlightboxinitiate function that is being called from the init() function: ``` function highlightboxinitiate(divnr,li...
[ -0.37706130743026733, -0.11082880198955536, 0.6988289952278137, -0.3423275649547577, -0.07645554095506668, 0.3441626727581024, 0.4262140393257141, -0.47870513796806335, -0.1425178200006485, -0.4313327670097351, -0.5510900020599365, 0.34067824482917786, -0.33629897236824036, 0.0715559124946...
(i = 1; i < 8; i++) {document.getElementById("reprevnr" + i).style.display = "none";} if(settab__gl_var[linenr] > 2){ document.getElementById("reprevnr" + linenr).style.display = "block";} for (i = 1; i < 8; i++) {document.getElementById("repagenr" + i).style.display = "none";} if(counttab__gl_var[linenr]>9){ document...
[ -0.3106064796447754, -0.25359585881233215, 0.726334273815155, -0.40015825629234314, -0.023348353803157806, 0.3655818998813629, 0.41278916597366333, -0.8150582909584045, -0.35010555386543274, -0.5783686637878418, -0.7596399784088135, 0.15922194719314575, -0.3070439398288727, 0.1509466618299...
document.getElementById("it"+1+"n"+linenr).style.display = "block";} } ``` This is the highlightlistinitiate function that is being called from the init() function: ``` function highlightlistinitiate(divnr,linenr) { var box = document.getElementById("listmenu").getElementsByTagName("a"); current_list__gl_var=lin...
[ -0.26740312576293945, -0.2419584095478058, 0.7337413430213928, -0.44034916162490845, -0.020427508279681206, -0.15441349148750305, 0.2129896879196167, -0.3987696170806885, -0.2395097017288208, -0.5111974477767944, -0.7981899380683899, 0.3798762261867523, -0.33964234590530396, 0.005896886810...
new Array (7); settab__gl_var = new Array (7); counttab__gl_var [1] = 83; settab__gl_var [1] = 0; activetab__gl_var = 2; counttab__gl_var [2] = 111; settab__gl_var [2] = 0; activetab__gl_var = 2; counttab__gl_var [3] = 137; settab__gl_var [3] = 0; activetab__gl_var = 2; counttab__gl_var [4] = 1; settab__gl_var [4] = 0;...
[ -0.18389369547367096, -0.01816241443157196, 0.7511770129203796, -0.46451398730278015, -0.04948645085096359, 0.022485913708806038, 0.7646759748458862, -0.3485824763774872, -0.45852822065353394, -0.4127148389816284, -0.7444378733634949, 0.8443910479545593, -0.6145365238189697, 0.263741374015...
the first statement in the init() function was not executed. I checked that crossbrowser is not influencing this problem. This problem occurs in all browsers. When the error occurs I don't see any error messages in the firebug console. I've been searching and debugging a lot so any help will be very welcome and ap...
[ -0.16947035491466522, 0.10333418101072311, 0.31168332695961, -0.19292733073234558, -0.1301075518131256, 0.0053969090804457664, 0.7336491942405701, 0.014180485159158707, -0.06580758839845657, -0.7678258419036865, -0.14256992936134338, 0.3710140585899353, -0.6247590184211731, -0.054721780121...
the browser.
[ 0.0323636457324028, 0.21511229872703552, 0.04246502369642258, 0.23241135478019714, -0.16362273693084717, -0.21106752753257751, -0.011451555415987968, 0.3460703194141388, -0.094114288687706, -0.5825262069702148, -0.26988717913627625, 0.4606778621673584, -0.1650274246931076, 0.34039935469627...
I have these two statements : ``` printf("%u",a+1); ``` and ``` printf("%u",(int *)a+1); ``` Actually I was working on this code when I came across this confusion. ``` #include<stdio.h> int main() { int a[2][2]={1,2,3,4}; int i,j; int *p[] = { (int*)a, (int*)a+1, (int*)a+2 }; for(i=0; i<2; i++){ for...
[ -0.006384087260812521, 0.17334218323230743, 0.2937011420726776, -0.374508261680603, -0.03813774511218071, 0.26541250944137573, 0.3815425932407379, -0.32160624861717224, -0.04439106583595276, -0.4959661662578583, 0.04349813982844353, 0.679939329624176, -0.277775377035141, 0.2667725682258606...
can be solved if I know the difference between above two statements. My current understanding: `(a+1)` will give me the address of 2nd element of array. In this case a 2-d array can be visualized as 2 1-d arrays, each with 2 elements. So `(a+1)` will give me the address of `a[1][0]`, but then why is `(int *)a+1` givin...
[ -0.5718982219696045, 0.2340007722377777, 0.11460673063993454, -0.2803630828857422, -0.12740513682365417, 0.3638056218624115, 0.4319925010204315, -0.487045019865036, -0.04308277368545532, -0.5379807949066162, -0.40941736102104187, 0.3369416892528534, -0.46532487869262695, -0.175998955965042...
array as ptr-to-int, offset by 1, which returns the second element in the array (`2`). Two critical rules of programming: **Rule 1:** When you *write* code, make the layout reflect the functionality. **Rule 2:** When you *read* code, read the functionality, not the layout. (Corollary: debug the *code*, not the *c...
[ -0.04577799513936043, 0.08127668499946594, 0.0954570323228836, -0.2302684187889099, -0.22892151772975922, -0.04720255360007286, 0.22315442562103271, -0.6329914927482605, -0.260484904050827, -0.5401101112365723, -0.11794394999742508, 0.5131875872612, -0.26289740204811096, -0.198212414979934...
when you cast `a` from its original type to `int *`, you're telling the compiler to forget about its original declaration, effectively losing its 2-dimensionality and becoming a simple vector of `int`s. Here's how to understand the declaration of `p`: ``` int *p[] = { (int*) a, (int*) a+1, (int*) a+2 }; // A...
[ 0.004726474639028311, 0.013009720481932163, 0.2688109278678894, -0.3532698452472687, -0.27702826261520386, 0.41954925656318665, 0.324777215719223, -0.5628703236579895, -0.15618214011192322, -0.4095955491065979, -0.3696100115776062, 0.32369449734687805, -0.6286757588386536, -0.2305530905723...
Resulting values ``` From this, you can see that `p` is a one-dimensional array of vectors: ``` p[0] = { 1, 2, 3 } p[1] = { 2, 3 } p[2] = { 3 } ``` If you recognize that `(p+i) == (i+p)`, then the last two items are the same as the first two in the line ``` printf("%d %d %d %d\n",* (*(p+i)+j), *(*(j+p)+i), *(*(i+...
[ -0.1590442806482315, 0.31311559677124023, 0.3653692305088043, -0.1539146453142166, -0.07230876386165619, 0.4048352837562561, 0.17983105778694153, -0.6098570823669434, -0.11187595874071121, -0.48618510365486145, -0.2942698001861572, 0.5507017374038696, -0.27972978353500366, -0.0837509408593...
%d\n", p[i], i[p], p[1], 1[p]); ``` Of course, your tech lead had better *not* allow you to write that. If you write that in my group, you're fired. ;-)
[ -0.1984195113182068, 0.25403180718421936, 0.048690635710954666, -0.029476622119545937, 0.35183265805244446, -0.1444459855556488, 0.17384028434753418, 0.12153670936822891, 0.14221882820129395, -0.45340976119041443, -0.4760548174381256, 0.4581471085548401, -0.3187814950942993, 0.037489362061...
How can i split such text fetched from a file ? ``` USA Florida Russia Murmansk Germany Bonn ``` In USA,Florida,Russia,Murmansk ... Each word should be saved in a QString. Basically i'm doing this way : ``` QFile df("../MyData/visit.DAT"); if (!df.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug...
[ 0.383218914270401, -0.3081245422363281, 0.6437563896179199, -0.1398826241493225, 0.12539075314998627, -0.12447004020214081, 0.30723699927330017, -0.16917046904563904, -0.170352503657341, -0.5551636219024658, -0.5290213823318481, 0.40258967876434326, -0.5397411584854126, 0.3008323013782501,...
qDebug() << "-"<<splitD; } dataFile.close(); ``` When i try to get value from QStringList with `.value(index)` i get same line with both words. How to split these words in correct way ?? The idiom `(int*)a+1` is interpreted as `((int*)a) + 1)`. That is, the cast takes precedence over the addition. So this ev...
[ 0.2223106324672699, -0.14603380858898163, 0.14958573877811432, -0.49661436676979065, -0.13634179532527924, -0.017719287425279617, 0.1405695229768753, -0.5378150939941406, 0.14748099446296692, -0.50072181224823, 0.04841200262308121, 0.6154586672782898, -0.4427630305290222, -0.00905617419630...
**Rule 2:** When you *read* code, read the functionality, not the layout. (Corollary: debug the *code*, not the *comments*.) Conceptually, when you declare ``` int a[2][2]={1,2,3,4}; ``` you envision a 2 dimensional array like this: ``` 1 2 3 4 ``` But C actually stores the data in a contiguous block of memo...
[ -0.09786663949489594, -0.023870006203651428, 0.03619396314024925, -0.15932823717594147, -0.14962834119796753, -0.2062900811433792, 0.28585681319236755, -0.45283299684524536, -0.16819359362125397, -0.5279382467269897, -0.26498663425445557, 0.41512951254844666, -0.446992427110672, -0.1683125...
`int`s. Here's how to understand the declaration of `p`: ``` int *p[] = { (int*) a, (int*) a+1, (int*) a+2 }; // As written int *p[] = { (int*) a, ((int*) a) + 1, ((int*) a) + 2 }; // As interpreted int *p[] = { &a[0][0], &a[0][1], &a[1][0] }; // Resulting values ``` From this, you can see th...
[ 0.1224730908870697, 0.1962936669588089, 0.40513187646865845, -0.3147534430027008, -0.3351263999938965, 0.38998329639434814, 0.22140927612781525, -0.658109724521637, -0.19066449999809265, -0.35272103548049927, -0.29829758405685425, 0.3608776926994324, -0.5229300856590271, -0.080497764050960...
that `(p+i) == (i+p)`, then the last two items are the same as the first two in the line ``` printf("%d %d %d %d\n",* (*(p+i)+j), *(*(j+p)+i), *(*(i+p)+j), *(*(p+j)+i)); ``` which is equivalent to this: ``` printf("%d %d %d %d\n", p[i+j], p[j+i], p[i+j], p[j+i]); ``` --- It's interesting to note that, since the ...
[ -0.013086906634271145, 0.381374329328537, 0.09854612499475479, -0.05058944225311279, 0.1190836951136589, -0.09252411872148514, 0.30472275614738464, -0.30815520882606506, -0.0011524646542966366, -0.30493199825286865, -0.37792181968688965, 0.777725338935852, -0.2612578272819519, 0.1559329479...
For iOS 4, how can I customize the UITabBar to build something like this?? <http://prntscr.com/7vuvj> Thanks!! That's mostly some fancy UI images, but as for the raised center tab, the [RaisedCenterTabBar](https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar) project handles that quite nicely.
[ 0.01625196449458599, -0.23714084923267365, 0.7444719672203064, 0.0484967939555645, -0.24825413525104523, 0.1494441032409668, 0.15198250114917755, -0.0913098007440567, -0.41723528504371643, -0.2353551834821701, -0.1032252386212349, 0.5871913433074951, -0.23757988214492798, -0.38617044687271...
In my iPhone app I need to round an integer to the nearest multiple of 5. E.g. Round 6 to = 10 and round 23 to = 25 etc Edit ---- I forgot to say, I only want to round up! In all situations, so 22 would round up to 25 for example. If you want to always round up, you can use the following: ``` int a = 22; int b = (a...
[ 0.18227191269397736, 0.2640549838542938, 0.5218859314918518, -0.4584023654460907, -0.09691636264324188, 0.48093146085739136, 0.3068201541900635, -0.4218529462814331, -0.39906764030456543, -0.17456167936325073, 0.06789758056402206, 0.3320915400981903, -0.3278305232524872, -0.282235831022262...
b = 25; ``` Note that you can use the function `ceil` to accomplish the same result: ``` int a = 22; int b = ceil((float)a / 5) * 5; // b = 25; ``` --- **Old Answer:** To round to the nearest multiple of `5`, you can do the following: ``` int a = 23; int b = (int)(a + 2.5) / 5 * 5; ```
[ 0.06568633764982224, 0.5356063842773438, 0.3614470362663269, -0.4181167483329773, -0.146293044090271, 0.2611420452594757, 0.2663647532463074, -0.7317165732383728, -0.10238451510667801, -0.2971328794956207, -0.19605448842048645, 0.3580387532711029, -0.1257164031267166, 0.1921880543231964, ...
Starting Situation ------------------ These two commands should be equivalent. ``` jQuery('a').filter(':contains(about)'); ``` and ``` jQuery.find('a').filter(':contains(about)'); ``` Problem ------- In fact, the first command performs well, whereas the second throws the following exception: ``` TypeError: :co...
[ -0.6416913866996765, -0.1813298761844635, 0.23740684986114502, 0.08187341690063477, -0.06796666234731674, -0.05295361578464508, 0.16604077816009521, -0.19152569770812988, -0.04662001505494118, -0.7574892044067383, -0.3759450614452362, 0.7953726649284363, -0.3489917814731598, -0.16405357420...
Is there an idiomatic way of encoding and decoding a string in Clojure as hexadecimal? Example from Python: ```python 'Clojure'.encode('hex') # ⇒ '436c6f6a757265' '436c6f6a757265'.decode('hex') # ⇒ 'Clojure' ``` To show some effort on my part: ```clj (defn hexify [s] (apply str (map #(format "%02x" (int %)) s...
[ -0.10342760384082794, 0.32469525933265686, 0.6757762432098389, 0.051821429282426834, -0.08478203415870667, -0.11522213369607925, 0.2789192497730255, -0.3695659637451172, -0.11072546988725662, -0.1393226683139801, -0.5932692289352417, 0.34364596009254456, -0.4834098517894745, -0.35057982802...
way: ``` (defn hexify [s] (format "%x" (new java.math.BigInteger (.getBytes s)))) ```
[ -0.14762574434280396, -0.01861051842570305, 0.3631385266780853, -0.13077813386917114, 0.24014241993427277, -0.2364252656698227, 0.4755742847919464, -0.18470099568367004, -0.11746979504823685, -0.5452496409416199, -0.5078918933868408, 0.44665223360061646, -0.1894189715385437, -0.14732523262...
I have written the code for `AmortizationLoanSchedule` in Swing but the look is not good. How to adjust the sizes of the labels , text-field & button? ``` import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; impo...
[ 0.25978583097457886, -0.02976255863904953, 0.6665493845939636, -0.4013661742210388, 0.3741343319416046, 0.0848015695810318, 0.31953197717666626, -0.67426598072052, -0.10019762068986893, -0.17205947637557983, -0.4717002511024475, 0.7015440464019775, -0.2728744447231293, -0.18302343785762787...
private JTextField jtfInterestRate = new JTextField(10); // Calculate button is also needed private JButton jbtCalculate = new JButton("Amortize Loan"); // ...and a text area where the results will be displayed private JTextArea jtaResults = new JTextArea(); public void init() { try { ...
[ -0.1189410537481308, -0.3446490168571472, 0.5711173415184021, -0.219279482960701, 0.03263881057500839, 0.34015417098999023, 0.29133641719818115, -0.3460119664669037, 0.026970479637384415, -0.5694513320922852, -0.6786174774169922, 0.7204822897911072, -0.46776530146598816, -0.373591870069503...
p1.setLayout(new GridLayout(3, 3)); p1.add(LoanAmount); p1.add(jtfLoanAmount); p1.add(NumberOfYears); p1.add(jtfNumberOfYears); p1.add(InterestRate); p1.add(jtfInterestRate); // Panel p2 will hold
[ 0.22192193567752838, -0.04582591354846954, 0.7726054787635803, -0.43227460980415344, 0.2127092480659485, 0.28798288106918335, -0.12166745960712433, -0.6502942442893982, -0.445142924785614, -0.40963003039360046, -0.4622916579246521, 0.7918274998664856, -0.11565538495779037, -0.3769773244857...
panel p1 and the calculate button JPanel p2 = new JPanel(); p2.setLayout(new BorderLayout()); p2 .setBorder(new TitledBorder( "Enter loan amount, Number of
[ -0.005874624941498041, -0.21437594294548035, 1.088175892829895, 0.11697202920913696, 0.00007359647133853287, 0.2723010182380676, -0.22829365730285645, -0.4941543638706207, -0.3711753487586975, -0.2775977849960327, -0.5225247144699097, 0.3250217139720917, -0.008770476095378399, -0.124419130...
years and annual interest rate")); p2.add(p1, BorderLayout.BEFORE_FIRST_LINE); p2.add(jbtCalculate, BorderLayout.AFTER_LAST_LINE); // Action listener for the button jbtCalculate.addActionListener(this); // Make the text area scrollable and uneditable ...
[ 0.0002665809297468513, -0.2594546377658844, 0.9475319385528564, -0.5524199604988098, 0.2449648082256317, 0.13815955817699432, 0.17456552386283875, -0.3516296446323395, -0.3117249011993408, -0.41615360975265503, -0.39535731077194214, 0.5818911790847778, -0.05242297053337097, 0.0147530268877...
jtaResults.setRows(12); jtaResults.setEditable(false); // Place the two panels to the applet getContentPane().add(p2, BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.SOUTH); } catch (Exception e) { e.printStackTrace(); } ...
[ -0.10948240011930466, -0.2652421295642853, 0.48832520842552185, -0.14113427698612213, 0.28308165073394775, 0.19913482666015625, 0.3888329565525055, -0.4437820017337799, -0.29078808426856995, -0.5071731209754944, -0.3368997871875763, 0.4504052400588989, -0.2364848107099533, -0.1587820202112...
public void actionPerformed(ActionEvent e) { if (e.getSource() == jbtCalculate) calculateLoan(); else System.out.println("you will never see this text!"); } public void calculateLoan() { if ((jtfNumberOfYears.getText().equals("")) || (jtfLoanAmou...
[ -0.042017240077257156, -0.2771255671977997, 0.7453268766403198, -0.13535630702972412, 0.41562527418136597, 0.014802826568484306, 0.6134049892425537, -0.12693066895008087, -0.20307888090610504, -0.4339968264102936, -0.37990742921829224, 0.7520255446434021, -0.3180556297302246, 0.01743644103...
|| (jtfInterestRate.getText().equals(""))) { JOptionPane.showMessageDialog(null, "All fields are mandatory", null, 1); } else { int numberOfYears = Integer.parseInt(jtfNumberOfYears.getText()); double loanAmount = Double.parseDouble(jtfLoanAmount.getText()...
[ 0.13884179294109344, 0.0351572223007679, 0.38145262002944946, -0.5305750966072083, 0.20072858035564423, 0.15468040108680725, 0.3762114346027374, -0.3748110830783844, -0.14102475345134735, 0.009502286091446877, -0.39392489194869995, 0.8242817521095276, -0.24470186233520508, -0.0594869181513...
annualInterestRate = (Double.parseDouble(jtfInterestRate .getText())) / 100; double monthlyInterestRate = annualInterestRate / 12; double numberOfMonths = numberOfYears * 12; double monthlyPayment = loanAmount * (monthlyInterestRate / (1 - Mat...
[ -0.07152926176786423, 0.2527886629104614, 0.6601170897483826, -0.2553800642490387, 0.05970105901360512, 0.21941694617271423, 0.41391536593437195, -0.21834102272987366, -0.25651460886001587, -0.002707969630137086, -0.13673053681850433, 0.6623901128768921, 0.3587794005870819, 0.0825067088007...
1 + monthlyInterestRate, -numberOfMonths))); double totalPayment = monthlyPayment * numberOfMonths; double balance = loanAmount; double interest; double principal; jtaResults.append("Payment#\t"
[ 0.0403749980032444, -0.2268795520067215, 0.7013826370239258, -0.38714340329170227, 0.3143528997898102, 0.48680922389030457, -0.0370795913040638, -0.12316060066223145, -0.22225356101989746, -0.01628996804356575, -0.37772077322006226, 0.8953068852424622, -0.12113261222839355, 0.1849524825811...
+ "Interest\t" + "Principal\t" + "Balance\n\n"); for (int i = 0; i < numberOfYears * 12; i++) { interest = (int) (monthlyInterestRate * balance * 100) / 100.0; principal = (int) ((monthlyPayment - interest) * 100) / 100.0;
[ 0.14824138581752777, -0.2927974760532379, 0.5267605185508728, -0.36163848638534546, 0.35277101397514343, 0.36285731196403503, -0.19566114246845245, -0.155523419380188, -0.1423553079366684, 0.0004030916024930775, -0.2213219553232193, 0.7656358480453491, 0.006198050919920206, 0.2265589684247...
balance = (int) ((balance - principal) * 100) / 100.0; jtaResults.append(i + 1 + "\t" + interest + "\t" + principal + "\t" + balance + "\n"); }
[ 0.1963944435119629, -0.1366858184337616, 0.2424139678478241, -0.3002913296222687, 0.3407009243965149, 0.4777882993221283, -0.10938406735658646, -0.27551716566085815, -0.01563040167093277, -0.22188305854797363, -0.11059122532606125, 0.48365646600723267, -0.349209725856781, 0.096829459071159...
jtaResults.append("\n\nMonthly Payment: $" + (int) (monthlyPayment * 100) / 100.0 + "\n"); jtaResults.append("Total Payment: $" + (int) (totalPayment * 100) / 100.0 + "\n\n"); } } } ``` ![AmortizationLoanSchedule](https://i.stack.imgur.com/ByZyG.png) Up...
[ 0.031109612435102463, -0.06770451366901398, 0.6321498155593872, -0.2586541771888733, 0.1525072157382965, 0.2589488625526428, 0.29017338156700134, -0.30695074796676636, -0.14651437103748322, -0.32056766748428345, -0.343377023935318, 0.9346902370452881, -0.20791979134082794, -0.1588898301124...
AmortizationLayout() { JPanel gui = new JPanel(new BorderLayout(2,2)); JPanel labelFields = new JPanel(new BorderLayout(2,2)); labelFields.setBorder(new TitledBorder("BorderLayout")); JPanel labels = new JPanel(new GridLayout(0,1,1,1)); labels.setBorder(new TitledBorder("GridLa...
[ -0.006587282754480839, -0.2881479263305664, 0.9627716541290283, -0.07546337693929672, -0.056270379573106766, 0.2622329890727997, 0.1610833704471588, -0.7737600803375244, 0.122256338596344, -0.5392337441444397, -0.38321900367736816, 0.7819055318832397, -0.255425363779068, 0.0535507909953594...
labels.add(new JLabel("Label " + ii)); // if these were of different size, it would be necessary to // constrain them using another panel fields.add(new JTextField(10)); } labelFields.add(labels, BorderLayout.CENTER); labelFields.add(fields, BorderLayout.EAST...
[ -0.05867069959640503, -0.3382737934589386, 0.4754020869731903, 0.11026965826749802, 0.07976783066987991, -0.02180178463459015, 0.159429132938385, -0.2743033468723297, -0.13136506080627441, -0.6564968824386597, -0.40012335777282715, 0.47258415818214417, -0.3805459141731262, 0.20319740474224...
new JPanel(new BorderLayout(2,2)); guiCenter.setBorder(new TitledBorder("BorderLayout")); JPanel buttonConstrain = new JPanel(new FlowLayout(FlowLayout.CENTER)); buttonConstrain.setBorder(new TitledBorder("FlowLayout")); buttonConstrain.add( new JButton("Click Me") ); guiCenter.a...
[ -0.33370715379714966, -0.2769390642642975, 0.872035801410675, 0.04629605636000633, -0.2066609412431717, 0.1851828694343567, 0.29639002680778503, -0.0781131312251091, -0.2691080570220947, -0.7771400809288025, -0.6878474354743958, 0.39069268107414246, -0.4036532938480377, 0.09151750802993774...
public static void main(String[] args) throws Exception { //Create the GUI on the event dispatching thread SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { new AmortizationLayout(); } });
[ 0.17122885584831238, -0.2461504489183426, 0.27316799759864807, -0.20144465565681458, 0.3460279405117035, -0.05111096426844597, 0.25292861461639404, -0.1612159013748169, -0.1404769867658615, -0.12319698184728622, -0.37950971722602844, 0.6543245911598206, -0.5602629780769348, 0.2545011341571...
} } ```
[ 0.17493881285190582, 0.41805654764175415, 0.05209751054644585, -0.04864929988980293, 0.437467485666275, -0.15825650095939636, 0.13202530145645142, 0.5446501970291138, 0.35430577397346497, -0.4846813380718231, -0.2295716553926468, 0.546978771686554, -0.3188462555408478, 0.2798506021499634, ...
I have .csv file that contain 2 columns delimited with `,`. ### file.csv ``` word1,word2 word3,word4 word5,word6 . . . . word1000,1001 ``` I want to create a new file from file.csv and insert sed command like this: ### mynewfile ``` sed -e 's,word1,word2,gI' \ -e 's,word3,word4,gI' \ -e ...
[ 0.3028855621814728, 0.08966603130102158, 0.7113708853721619, -0.21570751070976257, 0.2614699602127075, 0.21981234848499298, 0.23098739981651306, -0.4260825216770172, 0.05047719553112984, -0.8328813314437866, -0.01806454174220562, 0.46497929096221924, -0.21956767141819, 0.025963198393583298...
JPanel labelFields = new JPanel(new BorderLayout(2,2)); labelFields.setBorder(new TitledBorder("BorderLayout")); JPanel labels = new JPanel(new GridLayout(0,1,1,1)); labels.setBorder(new TitledBorder("GridLayout")); JPanel fields = new JPanel(new GridLayout(0,1,1,1)); fields.set...
[ -0.03512599691748619, -0.2724955379962921, 0.620267391204834, -0.03563423082232475, -0.37716805934906006, 0.11048392206430435, 0.3489730954170227, -0.5849050879478455, -0.024463258683681488, -0.6927967667579651, -0.5586416721343994, 0.3308417797088623, -0.3262554705142975, 0.26700663566589...
// if these were of different size, it would be necessary to // constrain them using another panel fields.add(new JTextField(10)); } labelFields.add(labels, BorderLayout.CENTER); labelFields.add(fields, BorderLayout.EAST); JPanel guiCenter = new JPanel(new Borde...
[ -0.008678765036165714, -0.35759544372558594, 0.6785922050476074, 0.07382805645465851, -0.054255805909633636, -0.000052491210226435214, 0.22336503863334656, -0.43305909633636475, -0.14474286139011383, -0.5401498079299927, -0.45855283737182617, 0.4047277569770813, -0.2812592089176178, 0.2170...
JPanel buttonConstrain = new JPanel(new FlowLayout(FlowLayout.CENTER)); buttonConstrain.setBorder(new TitledBorder("FlowLayout")); buttonConstrain.add( new JButton("Click Me") ); guiCenter.add( buttonConstrain, BorderLayout.NORTH ); guiCenter.add(new JScrollPane(new JTextArea(5,30))); ...
[ -0.38778188824653625, -0.19189095497131348, 0.6778736710548401, -0.1417175978422165, 0.05270254984498024, 0.15864472091197968, 0.43880558013916016, -0.08034010976552963, -0.11560650169849396, -0.5789815783500671, -0.6129828691482544, 0.30472055077552795, -0.5364053845405579, 0.189123198390...
GUI on the event dispatching thread SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { new AmortizationLayout(); } }); } } ```
[ 0.17864729464054108, -0.3480219542980194, 0.40081292390823364, -0.00595886679366231, 0.35565289855003357, -0.2855299413204193, 0.25977587699890137, -0.1415867805480957, -0.13293786346912384, -0.3704139292240143, -0.22845038771629333, 0.8088328242301941, -0.4871569275856018, 0.1604256033897...
To narrow it down: I'm currently using [Boost.Unordered](http://www.boost.org/doc/libs/1_49_0/doc/html/unordered.html). I see two possible solutions: 1. Define my own [Equality Predicates and Hash Functions](http://www.boost.org/doc/libs/1_49_0/doc/html/unordered/hash_equality.html) and to utilize templates (maybe `is...
[ -0.12213441729545593, 0.05308808758854866, 0.31696322560310364, -0.16281715035438538, -0.2146831452846527, 0.12319912761449814, 0.08714719116687775, -0.30605852603912354, -0.11613569408655167, -0.6313015818595886, 0.007900405675172806, 0.639687716960907, -0.44882744550704956, -0.2025187462...
{ bool operator()(T const& left, T const& right) const { return left == right; } }; template<class T> struct Equals<T*> : std::binary_function<T*, T*, bool> { bool operator()(T* const& left, T* const& right) const { return *left == *right; } }; ``` **EDIT 2:** I've just defined: ```...
[ -0.237519770860672, -0.0024640033952891827, 0.5896981954574585, -0.42703190445899963, 0.12395673245191574, 0.028628818690776825, 0.33021169900894165, -0.5400784611701965, 0.07823304831981659, -0.3205828368663788, -0.5091081857681274, 0.8646230101585388, -0.2414272278547287, -0.010218483395...
hash_value(Base* const& base)` is never called (GCC 4.7). Why is that? **EDIT 3:** I found out that `template <class T> std::size_t hash_value(T* const& v)` in `boost/functional/hash.hpp` on line #215 (Boost 1.49) is Boost's specialization for pointers and it simply masks your custom implementation of `hash_value` suc...
[ 0.03777468204498291, 0.08095595985651016, 0.40414589643478394, -0.08137017488479614, -0.13997916877269745, -0.17508000135421753, 0.10168425738811493, -0.2078547179698944, -0.2772940695285797, -0.37380844354629517, -0.00607577757909894, 0.7310313582420349, -0.30664414167404175, -0.006230423...
functor, because you cannot redefine the equality operator over pointers. It's a built-in operator (defined in functional terms as `bool operator==( T const *x, T const *y )`) and cannot be replaced. Both of these can be defined generically by using a templated `operator()` in a non-templated class. ``` struct indire...
[ -0.2577289044857025, -0.15037477016448975, 0.19777731597423553, 0.17592161893844604, -0.32759493589401245, -0.05005010962486267, -0.06769963353872299, -0.30846333503723145, -0.18760177493095398, -0.2966950833797455, -0.1980186402797699, 0.676736056804657, -0.6751891374588013, -0.1067897304...
I'm using Simple\_form with Rails 3.2.1 All fine, except that I need to set the 'data-content' attribute for the input\_html for bootstrap popover However, when I use the following Rails/Ruby doesn't like the code as there is a dash in the 'data-content' method: ``` <%= f.input :first_name, :required => true, :label...
[ 0.12410932779312134, 0.09404811263084412, 0.20767931640148163, -0.01803123578429222, -0.19060009717941284, -0.31483983993530273, 0.4848922789096832, -0.12356938421726227, 0.027773503214120865, -0.7592705488204956, 0.0341520756483078, 0.6136631369590759, -0.360990047454834, 0.01271501369774...
like `"data-content"`. So, this will probably work: ``` <%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", 'data-content'=> "Popover content"} ```
[ 0.1448548287153244, 0.03976161405444145, 0.4135895073413849, 0.304127037525177, 0.22203616797924042, -0.4092714190483093, -0.04019862413406372, -0.13896875083446503, 0.09412072598934174, -0.6091243624687195, -0.4355650842189789, 0.684451162815094, -0.11836987733840942, -0.04059349000453949...
i have these two models ``` public class Group { [Key] public int GroupID { get; set; } [Required] public string GroupName { get; set; } } public class User { [Key] public int UserID { get; set; } [Required] [StringLength(20)] public string UserName { get; set; } ...
[ -0.09175290167331696, -0.2731750011444092, 0.3751768171787262, -0.1803489774465561, 0.16590158641338348, 0.10550110042095184, -0.019984032958745956, -0.41958025097846985, 0.17837531864643097, -0.7621998190879822, -0.12236543744802475, 0.6276983618736267, -0.11895967274904251, 0.25796872377...
virtual Group Groups { get; set; } } ``` using code first approach it creates Groups\_GroupID as the foreign key in the user table when it generates the database. Specifying GroupID with displayname didn't work either because it is creating the same name.so how would i make it generate GroupID in the User Table? i am...
[ -0.40634313225746155, -0.05916044861078262, 0.7788837552070618, 0.03330438584089279, 0.0069061508402228355, 0.01745760068297386, -0.011301828548312187, -0.4117196202278137, -0.14039647579193115, -0.6798430681228638, -0.15825015306472778, 0.41546767950057983, -0.4699605703353882, 0.25262719...
[Required] public string Password { get; set; } [ForeignKey("GroupId")] public virtual Group Groups { get; set; } } ```
[ -0.20895032584667206, -0.04696284607052803, 0.08192048221826553, -0.0006894006510265172, 0.2861911952495575, -0.3671589493751526, 0.13414055109024048, 0.015894174575805664, -0.0009470087825320661, -0.458828330039978, -0.628695011138916, 0.6921964883804321, -0.257121741771698, 0.11080998927...
I've been using rewrite rules for a while, however this is strange. the site is hosted on dev.domain.com, htaccess code is ``` Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^order/([^/]+) order.php?id=$1 [QSA] ... ``` however when I go to <http://dev.domain.com/order/4> the $\_GET isn't being ...
[ 0.3161061108112335, 0.013084274716675282, 0.6784254312515259, -0.10469485819339752, -0.06190431863069534, -0.055191632360219955, 0.5206488966941833, -0.2655569911003113, -0.023472703993320465, -1.1537543535232544, 0.08784674108028412, 0.43482905626296997, -0.22573259472846985, 0.4014948010...
I have a question regarding core data and notifications. After reading Apple docs, I didn't find the answer. This is the problem: I have a managed object with a one-to-many relationship. I would like to know when an object has been added or removed from this relationship. (A "Category" has many "Items") I use this ...
[ -0.3041324019432068, -0.17676685750484467, 0.1983436495065689, -0.0035165417939424515, -0.0047286502085626125, 0.1410328596830368, 0.41475430130958557, -0.16456303000450134, -0.44897088408470154, -0.6046245694160461, -0.20812830328941345, 0.5563828945159912, -0.43711018562316895, 0.0706802...
one of them. Now the category has only 1 item. However, if I launch a fetched request from `observeValueForKeyPath`, it says the category has 2 items, but that is wrong, because it has now 1. I guess this is because `observeValueForKeyPath` is called while context is being saved, `[context save:&error]` (that's the on...
[ -0.11892646551132202, -0.07156143337488174, 0.40102869272232056, -0.027055790647864342, -0.4416195750236511, 0.12742109596729279, 0.5035173892974854, -0.47029948234558105, -0.4304651618003845, -0.32053154706954956, -0.14494436979293823, 0.4199187755584717, -0.45048612356185913, 0.110016338...
order to execute that method the next run loop, that is, after `[context save:&error]`. And voilá, everything works fine now. So, if I want to launch a fetch request inside `observeValueForKeyPath`, do I have to launch it the next run loop? Is this a normal behavior? How do you do this usually? I'd like to know your ...
[ 0.13229262828826904, -0.3182014226913452, 0.6747658848762512, -0.15892672538757324, 0.242963507771492, 0.015492360107600689, 0.3245809078216553, 0.03424929082393646, -0.3451807200908661, -0.4243309795856476, -0.020818954333662987, 0.7235019207000732, -0.47387999296188354, -0.05801778286695...
so `assoc` again returns your old value, use this code: ``` (setq a1 (delq (assoc :k1 a1) a1)) ``` This will remove the **FIRST** match for `:k1` from `a1`.
[ -0.033641595393419266, 0.12989254295825958, 0.38633987307548523, -0.40473219752311707, 0.08375709503889084, 0.02384527027606964, 0.12578023970127106, -0.19793729484081268, -0.3580857217311859, -0.36591705679893494, -0.4339642822742462, 0.6855734586715698, -0.21781671047210693, -0.038731392...
I've been building this website without problems in Firefox, and when I start to use chrome for cross browser testing, I've noticed a slight border around my `<div>`. ![enter image description here](https://i.stack.imgur.com/6NMox.jpg) This is what it's supposed to look like without border ![enter image description ...
[ 0.384649395942688, 0.16840046644210815, 0.5301737189292908, -0.18008890748023987, -0.10541334003210068, -0.1553761065006256, 0.45808619260787964, 0.16273948550224304, -0.16289103031158447, -0.7167817950248718, 0.04449829086661339, 0.5160810947418213, -0.34879979491233826, 0.213058099150657...
appreciate any help from you guys. Please do not hesitate to ask me any questions that may aid in the solving of this problem. Thanks in advance **EDIT** Just learnt that this is a chrome's focus indicator, is the conventional `border:0`, `border:none` workable for this type? Use pseudo selector Element:focus { Out...
[ 0.3773665428161621, -0.10502002388238907, 0.4879858195781708, 0.1190384179353714, -0.11889885365962982, -0.15282359719276428, 0.10819343477487564, 0.2514932453632355, -0.1408771574497223, -0.8321294188499451, -0.017324794083833694, 0.48257702589035034, -0.26541656255722046, -0.452703475952...
It might be a simple task. But I am new to PHP. I am creating a string of values getting from database for a specific purpose. How to remove last char from string. ``` $str=''; foreach($dataarray as $value) { $str.=$value."##"; } ``` it gives me string like `ABC##DEF##GHI##` I have to remove last 2 chars `##`...
[ 0.26829686760902405, 0.060068465769290924, 0.5425450801849365, -0.10110952705144882, -0.13539738953113556, 0.14709486067295074, 0.12818650901317596, -0.24289366602897644, -0.21908383071422577, -0.45633912086486816, 0.027413036674261093, 0.696787416934967, -0.4294488728046417, 0.25943219661...
$foo as $bar ) foreach( $bar as $part ) $a[] = $part; $str = implode('##',$a); ```
[ 0.012310558930039406, 0.26717469096183777, 0.6247299313545227, -0.6340712904930115, -0.06844256818294525, 0.39081141352653503, 0.4407840371131897, -0.2203010618686676, 0.0035657742992043495, 0.3143296539783478, -0.47925901412963867, 0.5364518165588379, -0.7120181322097778, 0.51984101533889...
I'm running perl -d on some script. the script uses some sub which causes it to crash, how can I find where the script actually calls that sub? (it could be in any of the modules the script uses, not only the script itself) Take a look at the Devel::Trace module. You should be able to trace program execution with it.
[ 0.4754427671432495, -0.08053933084011078, -0.1189800351858139, 0.14126023650169373, 0.09246261417865753, -0.4606612026691437, 0.4406070113182068, 0.18307627737522125, -0.24108338356018066, -0.3681205213069916, 0.37140727043151855, 0.2694813311100006, -0.3470110595226288, 0.1785277128219604...
I am building a server back-end for a mobile social network using Windows Azure. I have these 3 entities: 1. Users - Stored in SQL Azure 2. Threads (sort of relations between **2 users** which are then able to send messages to each other) - Stored in SQL Azure 3. Messages - Stored in Azure Tables As I store Messages...
[ 0.1948230117559433, 0.3578912019729614, 0.5799126029014587, -0.07314889878034592, -0.22408464550971985, 0.039744891226291656, 0.05617661401629448, 0.1210065707564354, -0.07831474393606186, -0.9504234790802002, 0.13523489236831665, 0.07139337807893753, -0.13282035291194916, 0.35995662212371...
need to order Threads by the last message date when displaying. Scanning many different table partitions and looking for the messages will obviously be performance killer, so I need to somehow denormalize data to other table partitions to be able to fetch the most recent threads efficiently. What based on your experi...
[ 0.4315209984779358, -0.2636682391166687, 0.0942167416214943, 0.10969597846269608, -0.02704009972512722, -0.2392420470714569, 0.20996277034282684, -0.09347015619277954, -0.30210596323013306, -0.7135044932365417, 0.21400479972362518, 0.5404089093208313, -0.08963113278150558, 0.11662068963050...
In the code below, the image "imgNew" doesn't show on the canvas when I launch the application, all the other images show. It is the fourth one from the bottom : ```xml <Image Height="100" HorizontalAlignment="Left" Margin="12,656,0,0" Name="imgNew" Source="/Elementals;component/NoughtsAndCrosses/NACImages/N%26C_new_1...
[ -0.32983818650245667, -0.12221821397542953, 1.127091884613037, -0.027479827404022217, -0.14580130577087402, 0.3616650402545929, -0.045670244842767715, -0.6125547289848328, -0.14371417462825775, -0.7038623690605164, -0.19923259317874908, 0.7173455357551575, 0.19940781593322754, 0.0076381326...