Posts

boost - C++: digits vs bits? -

i trying understand difference of vocabulary used in c++ language between digits , bits in : char_bit; std::numeric_limits<char>::digits; is there conceptual difference? maybe weird architectures? if so, called result of operator[] of std::bitset . give access bit or digit? and current documentation of boost not help: cppint provides code digits documentation mention bits (this problem documentation, don't know whether text or code more recent.) from this std::numeric_limits::digits reference : the value of std::numeric_limits::digits number of digits in base-radix can represented type t without change. integer types, number of bits not counting sign bit. and later states char result char_bit - std::numeric_limits<char>::is_signed . and c numeric limits reference : char_bit number of bits in byte so normal modern computer, char 8 bits, char_bits equal 8 , digits function return either 7 or 8 depending on if char sign...

java - Autowired HttpServletRequest in Spring-test integration tests -

i trying test cover login functionality. version of spring 3.2.12. have session bean, declared as: @service @scope(value = "session", proxymode = scopedproxymode.interfaces) public class clientsessionserviceimpl implements clientsessionservice { @autowired private httpservletrequest request; // method called during login routine filter public boolean checkuser() { // rely on request attributes here, set in filter } this works when run on server, when run means of spring-test, problem comes. test method: this.mockmvc = mockmvcbuilders.webappcontextsetup(this.wac).addfilter(springsecurityfilterchain).build(); mockmvc.perform(post(url)); after debugging, found out, when test spring context started, in servlettestexecutionlistener.setuprequestcontextifnecessary instance of mockhttpservletrequest created, mockhttpservletrequest request = new mockhttpservletrequest(mockservletcontext);
 // lets' call instance a. , instance that...

html - How do I add left and slide effect for this basic image slider in jQuery? -

$(document).ready(function(){ $("#circle1").click(function(){ $(".headlines").css('background-image', 'url(bg.png)'); }); $("#circle2").click(function(){ $(".headlines").css('background-image', 'url(bg2.png)'); }); $("#circle3").click(function(){ $(".headlines").css('background-image', 'url(bg3.png)'); }); }); all #circle clickable circles make basic image slide. when click circle works want have slide effect. idea? hope looking for. circles slide left. need change #circle .headliner accordingly in javascript. $(document).ready(function() { $("#circle1").click(function() { $("#circle1").css('background-image', 'url(bg.png)').toggle("slide"); }); $("#circle2").click(function() { $("#circle2").css('background-image'...

c++ - Const array initialization if its too long -

in answer question mentioned code posted wouldn't work if variable declared const . what if want initialize long array that's const type int main (){ const int ar[100]; //this invalid in c++ //something (int i=0;i <100;++i) ar[i]=i; return 0; } are there other ways using #define method proposed in question? there's no way directly, without hacks. in c++ 1 way work around problem take advantage of fact inside constructors const objects still modifiable. so, can wrap array class , initialize in constructor struct arr { int a[100]; a() { (unsigned = 0; < 100; ++i) a[i] = i; } }; and declare const arr arr; of course, have access arr.a[i] , unless override operators in arr .

c++ - Creating a Texture2DArray and populate it with solid values -

i have problems in creating , filling texture2darray in directx11. i want render many quads onto screen, drawing done instancing, every quad should own texture. tried create texture array , added index value instances data format. the problem is, when try create 2 different textures array, fails when try call function createtexture2d following error: d3d11 error: id3d11device::createtexture2d: pinitialdata[4].sysmempitch cannot 0 [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: pinitialdata[6].psysmem cannot null. [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: pinitialdata[7].psysmem cannot null. [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: returning e_invalidarg, meaning invalid parameters passed. [ state_creation error #104: createtexture2d_invalidarg_return] here code use generate texture...

node.js - Mongo/Mongoose - Find by partial document -

i have collection of properties have addresses. "address" : { "street" : "5 orange drive", "city" : "orlando", "state" : { "abbreviation" : "fl", "name" : "florida" }, "zip" : "32822", "geo" : { "lat" : 28.519, "lng" : -81.304 } }, "address" : { "street" : "16 main street", "city" : "tallahassee", "state" : { "abbreviation" : "fl", "name" : "florida" }, "zip" : "32823", "geo" : { "lat" : 28.529, "lng" : -81.314 } }, "address" : { "street" : "125 oak drive", "city" : "salem", "state" : { ...

php - Display saved checkbox value -

i have checkbox options save in db. able view , select multiple options , save them in db. issue want display saved information don't know how that. <form action="save_comp.php" method="post"> <?php //display include ('mysql_connect.php'); $sql = mysql_query("select * competency "); //$row = mysql_fetch_array($sql); while($row = mysql_fetch_array($sql)) { echo"<input type='checkbox' name='comp[]' value= ".$row['id']." /> ".$row['competency']." <br />"; } ?> <input name="submit" type="submit" value="submit" /> </form> save db <?php session_start(); $id = $_session['user_id']; //$id = 3; include ('mysql_connect.php'); $insstr = ''; foreach($_post['comp'] $val){ $insstr .=$val.","; } mysql_query("insert competency_result (user_id,result) values ( '...