Posts

Showing posts from May, 2012

c# - Diferrence between two lists with nested values -

i have variables of particular type, classes them : public class user { public int? id { get; set; } public string password { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string email { get; set; } public list<accessiblesite> sites { get; set; } } public class accessiblesite { public int id { get; set; } public string name { get; set; } public list<role> roles { get; set; } public bool ischecked { get; set; } } public class role { public int id { get; set; } public string name { get; set; } public bool ischecked { get; set; } public string userfriendlyname { get; set; } } a user can have many accessiblesite under him , each site has list of role associated it. there 2 objects of user type. need find difference between 2 lists. so far code have written comparing non list objects correctly. static class extentions { public static list<variance&g

html - Div width/height 100% of the free space inside another div -

#external { background-color: #585858; width: 200px; height: 200px; } #internal { background-color: #111858; width: 50px; height: 100%; } <div id="external"> content 1 <div id="internal"></div> </div> in case, how can set remnant height of external div internal div? problem when set 100% height internal div, internal height == external height. your request little unclear flexbox can think after. p { margin: 0; } .external { background-color: rgba(255, 0, 0, 0.5); width: 200px; height: 200px; display: inline-flex; flex-direction: column; margin: 10px; } .internal { background-color: #111858; 100%; flex: 1; } <div class="external"> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <div class="internal"></div> </div> <div class="external"> <p>

node.js - How to test nodejs concurrent Request -

i want write simple code test nodejs concurrency when receives many requests. and use loadtest module simulate send many requests server command : loadtest -c 10 --rps 200 http://localhost:3000/ my simple code write in server.js : var http = require('http'); var server = http.createserver(); var cun=0; var step=0; function handlerequest(req,res) { console.log(step++); while(100000000>cun){ cun++; } cun=0; } server.on('request', handlerequest); server.listen(3000); but requests wait until while loop down and know solve problem should use callback function , don't know how write it. var http = require('http'); var url = require("url"); var server = http.createserver(); function handlerequest(req, res) { res.writehead(200, { 'content-type': 'text/plain'}); var params = url.parse(request.url, true).query; var input = params.number; /* 1- use input param in a

jquery - slideDown function not working -

i have 2 div elements, when mouse enters on div1, div2 should slide down , when mouse leaves div1, div2 should slide up. but, in function slide down function not working properly below code: <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("#text1").mouseenter(function(){ $("#text2").slidedown("slow"); }); $("#text1").mouseleave(function(){ $("#text2").slideup("slow"); }); }); </script> <style> #text1 { border:2px solid #ff0000; width:100px; height:100px; text-align:center; background-color: #9ff; position:relative; } #text2 { display: none; border:2px solid #ff0000; width:100px; height:100px; text-align:center; background-color: #ff0; position:absolute;

arrays - PHP error suppression or isset -

i have array of more 50 indefinite keys means not sure 1 particular field there or not. have 2 option assign array values other. first $array2['someothefield'] = isset($array1['somefield'])?$array1['somefield']:null; second $array2['someotherfield'] = @ $array1['somefield']; can please suggest ,which 1 better case. or, there way can suppress errors 1 block of code . if need code fast, second option better due experience profiling php code. if going 50 elements, use first option, because it's clear kind of problem trying avoid.

vb.net - Inno Setup - Checking if MS Access x64 Engine installed -

i have setup script doesn't seem work way intended. want make installer extract , install office x64 engine if not installed. read through documentation , other questions might me out still no luck. here code in .iss script file: [files] source: ".\kit3\*"; destdir: "{app}"; flags: ignoreversion recursesubdirs createallsubdirs; check: accessenginenotinstalled [run] filename: "{app}\{#accessengine}"; parameters: "/passive"; check: accessenginenotinstalled and here function wrote check if installed: function accessenginenotinstalled: boolean; begin result := not regkeyexists(hkey_local_machine, 'software\microsoft\office\14.0'); end; let me know if have questions. thank you. i added under [setup] line architecturesinstallin64bitmode=x64 , worked!

html - bootstrap column to fit width -

Image
i hope image can me describe mean. want make arrow , boxes inline without vacant space on right. can notice left box alligned on white box on top, want achieve in right. attach code can see how did this. note: updated image above. there white box on top , under 4 boxes. need align eplay box white box above , under it. align slide show demo box on white box above , below it. plus evenly space , size. , after eplay demo, theatre script demo, , audio speech demo box need put arrow image in between. image below need right side box align top white box , under it. <!--===================demos ==================--> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12 container-nopads" style=""> <div class="col-sm-2 col-md-2 col-lg-2 " > <div class="demo-box col-sm-12 col-xs-12" id="demo-pdf"> <a href="/verseb

c# - Whats the overhead of await without I/O -

one downside of async pattern in c# 5 tasks not covariant, i.e there no itask<out tresult> i have noticed devs do return await someasyncmethod(); to come around this. exactly impact performance wise crate? there no i/o or thread yield await , cast correct covariant, async framework under hood in case? there thread context switch? edit: more info, code wont compile public class listproductsqueryhandler : iqueryhandler<listproductsquery, ienumerable<product>> { private readonly ibusinesscontext _context; public listproductsqueryhandler(ibusinesscontext context) { _context = context; } public task<ienumerable<product>> handle(listproductsquery query) { return _context.dbset<product>().tolistasync(); } } beacuse task not covariant adding await , cast correct ienumerable instead of list tolistasync returns configureawait(false) everywhere in domain code not feel viable solution use lowlev

unity3d - Inviting test users facebook SDK? -

i have integrated game facebook in unity. sharing , leaderboards work properly. problem invites(fb.apprequest). able send them never received others. know fb doesnt allow publish_actions without approval , have created test users still unable invite them. how can invite test user play game using facebook sdk since friends each other , using app?

c# - Implicitly typed local variables must be initialized -

here code :- how initialize data ? var data; if (mode == "view") { data = (from in ctx.tblemployee a.companyid == companyid join b in ctx.tblto_shiftschedule on a.id equals b.employeeid b.companyid == companyid select new { a, b, c, d }).tolist(); } else { data = (from in ctx.tblemployee a.companyid == companyid select new { a, b, c, d }).tolist(); } you can't initialize anonymous type, so: var data = mode == "view" ? (from in ctx.tblemployee a.companyid == companyid join b in ctx.tblto_shiftschedule on a.id equals b.employeeid b.comp

how to implement card viewer with swipe event in xamarin.forms -

i want create card-viewer in xamarin.forms bind list of custom class.it needs support swipe event.after each swipe next item of list binded in card view. i unable track swipe event.there ready-made solution of using mgesture don't want want create own control. if has worked on cardview control , swipe gesture please me?

initialization - Initialize property of type immutable dictionary in Swift init() -

i initialize immutable dictionary calculating values in init() . have: class myclass { var images: [string: uiimage] func init() { images = [:] // ... loop on strings // ... calculate image images[string] = image } } is there way define property let instead of var semantics. convenient , seem appropriate content won't changed after object has been initialized. (if change var let receive error assignment inside loop: "immutable value 'self.images' may not assigned to".) make additional variable in init , assign once images : class myclass { let images: [string: uiimage] func init() { var tempimages = [string: uiimage]() // ... loop on strings // ... calculate image tempimages[string] = image // assign tempimages images images = tempimages } }

ninject - WhenTargetHas<> Binding Does not Work as Expected -

i've got class constructor: public abstractaddon([configuration]object configuration) { this.configuration = configuration; } as can see, has constructor parameter configurationattribute . configurationattribute is: [attributeusage(attributetargets.property | attributetargets.parameter, inherited=true)] public class configurationattribute : attribute { } my module as: public override void load() { this.bind(b => b.fromassembliesmatching("*") .selectallclasses() .inheritedfrom(typeof(uiextensibility.abstractaddon)) .bindallbaseclasses() .configure(c => c.insingletonscope()) ); this.bind<object>().toprovider<configurationprovider>().whentargethas<uiextensibility.configurationattribute>(); } and then, object provider is: private class addonprovider : iprovider<object> { public object create(icontext context) { return "configuration settings"; } }

c - Efficient test for pythagorean triples in modulo integer space -

i wondering effective formula, testing if 3 numbers pythagorean triple is. reminder: pythagorean triple 3 integers a²+b²=c² . i mean not effective formula in terms of time, formula efficient in terms of not causing overflow on specific integer(lets 32-bit unsigned int ). i trying bit rearrangements of a*a + b*b == c*c : let's assume a<=b<c , best formula is: 2b*(c-b) == (a+b-c) * (a-b+c) formula can proven, right side smaller a*c , should left side, a*c doesn't huge improvement of c*c . so question is, if there better formula conditional works bigger numbers without overflowing integer space. execution time of formula doesn't matter much, besides should o(1). ps: don't know if should post such question here or on mathematics se , me seems more programming. edit if need have 32bit integers way down can modify math fit requirement. keep simple math (squaring , summing) on 16bit chunks of data , use struct contains 2 unsigned int

node.js - ebay api using nodeJs gives error "Unable to create xml stream reader for JSON: payload format incorrect or payload is empty" -

i trying list product keyword using ebay api maintained here using following code var params = {}; params.keywords = ["canon"]; params.outputselector = [ 'aspecthistogram' ]; params['paginationinput.entriesperpage'] = 10; var filters = {}; filters.itemfilter = [ new ebay.itemfilter("freeshippingonly", true) ]; filters.domainfilter = [ new ebay.itemfilter("domainname", "digital_cameras") ]; ebay.ebayapigetrequest({ servicename: 'findingservice', optype: 'finditemsbykeywords', appid: '*********************', // fill in own app key, 1 here: https://publisher.ebaypartnernetwork.com/publishertoolsapi params: params, filters: filters, parser: ebay.parseitemsfromresponse // (default) }, // gets items in merged array function itemscallback(error, items) { if (error) throw error; console.log('found',

testing - How to get text field history in selenium? -

is possible field's history (if exists) field in array or of sort in selenium? example, user id field, can see ids have been used far. the purpose i'd use create new ids haven't been used before. example testid45 taken, i'll use testid46 create new one. it's lazy without keeping track of ids. i don't understand why want create ids using selenium. if post more info on problem trying solve, try provide better answer. if want pull ids existing elements this. finds input elements have id specified , writes out ids. parse ids , determine id use next. wouldn't recommend because faster generate new id unique maybe need reason. list<webelement> ids = driver.findelements(by.cssselector("input[id]")); (webelement id : ids) { system.out.println(id.getattribute("id")); } i recommend generating new id of own format unique on page. should enough purposes. random rnd = new random(); string id = long.tohexstring(rnd.next

ios - import swift class in objective-c, <myModule>-Swift.h file not found -

i have ios project written objective-c. created swift class in project, bridging header file accessing objective-c in swift generated successfully, , works fine. my problem other way around. want import swift class in objective-c code. in xcode, target -> build settings--> swift compiler section, see objective-c generated interface header name field value mymodule-swift.h , when import header in objective-c class: #import "mymodule-swift.h" i compiler error: mymodule-swift.h file not found and in project, cannot find file either. how can solve problem? my xcode version 6.4 go to build settings->objective-c generated interface header name and set value yourmodule-swift.h (this set, filename need import on .m file #import "yourmodule-swift.h" go build settings , search "defines module", set both values yes create class in swift prefix of @objc example @objc class myswiftclass{...} go window->projects , press

php - Laravel validation causing query exception on save models -

my application has 2 database connection: mysql_default_connection => default_database mysql_custom_connection => custom_database and i'm having problems laravel unique validation. protected $connection = 'mysql_custom_connection'; protected $table = 'aluno'; public $rules = [ 'email' => 'required|email|unique:custom_database.aluno' ]; when try save new model, unique rules works when retrive model aluno , try save like: $aluno = aluno::find(1); $aluno->attribute = 'new value'; $aluno->save(); this log: sqlstate[42s02]: base table or view not found: 1146 table 'default_database.aluno' doesn't exist (sql: select count(*) aggregate `aluno` `email` = aluno3@email.com , `id` <> 50) if remove unique rules validation, work fine. particularly, can't understand why querying in table 'default_database.aluno' because database isn't model connection above. can explain me w

How to make a specific physics body in a moving animation in corona sdk? -

i have moving animation called "instance1" has 8 frames in corona sdk game. unfortunately dynamic physics body try add picks transparent space in rest of animation , when instance1 jumps on platform goes off of screen because of transparent space. there way set physics body current frame's opaque colour only? here code: local sheet1 = graphics.newimagesheet( "runningcat.png", { width=496, height=206.5, numframes=8 } ) local instance1 = display.newsprite( sheet1, { name="cat", start=1, count=8, time=1000 } ) instance1.x = display.contentwidth / 4 + 10 instance1.y = baseline - 100 instance1.xscale = .3 instance1.yscale = .3 instance1:play() physics.addbody( instance1, { density=3.0, friction=0.5, bounce=0.3 } ) any appreciated. mitra0000 if don't define, body create square equals image. try set body vertices make work want local pentagonshape = { 0,-37, 37,-10, 23,34, -23,34, -37,-10 } physics.addbody( pentagon, { density=3.0,

video - How to convert/Play *.STR files in PC -

i recorded show tv on airtel dth (in india) in pen drive. can play recorded show in tv, however, unable find way play recorded video on pc. after searching lot came know video stored str format file. browsed pen drive in pc, , found .str file. know how able play video on pc.

c# - Function Call inside IQueryable's Select Anonymous object -

i have following code: expression<func<int, string>> mystatuscode = (t) => pluginapplication.types.totypename(t); var model =_context.usersrepository.include("emails").include("website"). include("userdetail").include("profile").asexpandable().where(t => t.typeid == (usertype)10017).select(t=> new { userid = t.userid, username = t.username, chatname = t.chatname, email = t.emails.firstordefault(z => z.typeid == emailtype.main).emailaddress, lastlogindate = t.lastlogindate, statusid = t.statusid, website = t.signeduponwebsite.shortname, statuscode = mystatuscode.invoke((int)t.statusid) }); here i'm using linqkit seems me call method when select dat

plsql - how to create and execute a procedure dynamically having schema name and table name as in parameter in oracle -

update statement using dyanmic sql passing schema name , table name in parameter stored procedure. working. create or replace procedure p11(v_sal in number,v_schema varchar2,v_tab varchar2) v_sql varchar2(100); begin v_sql:='update '|| v_schema||'.'||v_tab||' set sal= '||v_sal||' empno= :1 '; dbms_output.put_line(v_sql); execute immediate v_sql using 7839; end; you should consider spaces @ least. create or replace procedure p11(v_sal in number,v_schema varchar2,v_tab varchar2) begin execute immediate 'update '|| v_schema.v_tab||' set sal='||v_sal||' empno= :1' using 7839; end;

sql server - Umlauts with PHP and MSSQL -

i facing problem umlauts , php / mssql. on php have following code: ini_set('mssql.charset','latin1_general_ci_as'); $dbhandle = mssql_connect('xxxxx', 'xxxxx', 'xxxxx') or die("couldn't connect sql server"); mssql_select_db('xxx', $dbhandle); $stmt = mssql_init('esy_getpricevp', $dbhandle); //item code umlaut $itemid = 'he51grün'; mssql_bind($stmt, '@itemid', $itemid, sqlvarchar); $result = mssql_execute($stmt); if (!mssql_num_rows($result)) { echo 'keine datensaetze gefunden<br>'; } else { ($i = 0; $i < mssql_num_rows($result); ++$i) { echo 'preis fuer artikel ',mssql_result($result, $i, 'amount'); } } i executing stored procedure esy_getpricevp finds price of item itemid . if have itemid without umlaut doing fine. in procedure converting itemid nvarchar: convert (nvarchar(50), @itemid) the complete stored procedure: alter

javascript - Upload File (Photos and videos) to Server PHP with PhoneGap -

i've been working on phonegap based iphone application past few weeks , have run issue of file submission form. i'm new javascript , hoping help. need form users can submit name, email address, text, , photo or video submitted web server. tutorials i've found on topic far seem vague doesn't know in's , out's of js. following code seemed work pushing button didn't anything. <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> var picturesource; // picture source var destinationtype; // sets format of returned value // wait device api libraries load // document.addeventlistener("deviceready",ondeviceready,false); // device apis available // function ondeviceready() { picturesource = navigator.camera.picturesourcetype; destinationtype = navigator.camera.destinationtype; } // called wh

subset - How to select columns based on criteria in a certain row in R -

i have matrix of values both row names , column names, shown here. c5.outliers days j1 j2 j3 j4 0.01 458 -160 -151 -52 0.02 459 -163 -154 -46 0.03 457 -165 -150 -51 perc 0.99 0.04 0.00 0.52 i create separate matrix using columns value row "perc" =<50.0. in example, extracting columns j2 , j3. this code tried isn't working (the "perc" row row #1414 on matrix): c5.final<-subset(c5.outliers, 1414<.51) i assume mean 0.50 since columns "perc" above 50.0. this might not best way works: #data: df <- data.frame(days=c(0.01,0.02,0.03,"perc"),j1=c(458,459,457,0.99), j2 =c(-165,-163,-160,0.04),j3=c(-151,-153,-131,0.00),j4=c(-52,-45,-51,0.52)) dfc <- subset(df,,select= which(c(true,(df[which(df$days == "perc"), ] <= 0.50)[2:5]))) dfc days j2 j3 1 0.01 -165.00 -151 2 0.02 -163.00 -153 3 0.03 -160.00 -131 4 perc

c# - Cannot Convert Type System.Collection.Generic.List<T> -

i trying use generics reduce codebase, ran situation. can't seem create google query expresses trying do. in essence passing in generic make list<t> , pass list<t> function requires list<specificclass> my jsonuser class public class jsonuser { public string documentid { get; set; } [jsonproperty(propertyname = "username", required = required.always)] public string username { get; set; } [jsonproperty(propertyname = "firstname", required = required.allownull)] public string firstname { get; set; } [jsonproperty(propertyname = "lastname", required = required.allownull)] public string lastname { get; set; } } assume there class jsoncompany company fields. main code: static void collectuserdata() { boolean j = getjson<jsonuser>(); boolean k = getjson<jsoncompany>(); ... } static boolean getjson<t>() { ... // json

c# - ICollection<T> Why SerializationBinder is call on HashSet<T> but not on List<T> -

i have object : public class mycollec { public icollection<myobject> mycollection { get; set; } public mycollec() { mycollection = new list<myobject>(); } } in webapi had serializationbinder, in webapiconfig : jsonformatter.serializersettings.binder = new defaultserializationbinder(); when call controller return object structure this { "mycollection": [ { ... }, { ... } ] } but if change constructor hashset public mycollec() { mycollection = new hashset<myobject>(); } the result of controller : { "mycollection": { "$type": "system.collections.generic.hashset`1[[webapplication1.models.myobject, webapplication1]], system.core", "$values": [ { ... }, { ... } ] } } i understand why ? difference induce behavior ? is-it possible use ha

java - Sesame/Jena SPARQL results to JSON-LD -

i've seen answer on how return sparql results in json-ld? , it's not satisfying/working. used json-ld java integration sesame, standalone version. what want achieve: send sparql construct query sparql endpoint via blazegraph remoterepository (based on sesame/sail), rdf result, serialize rdf json-ld. rdf result works fine. the problem is, following code (with sesame) producing no output: stringwriter sw = new stringwriter(); final rdfwriter writer = rio.createwriter( rdfformat.jsonld, sw ); //writer.getwriterconfig().set( jsonldsettings.jsonld_mode, jsonldmode.compact ); graphqueryresult queryresults; rio.write(queryresults.asmodel(queryresults), writer); i used conversion jena internal model, because know jena json-ld output worked fine in side project of mine. unfortunately, same approach doesn't work conversion jena. my code sesame jena adapter : while(queryresults.hasnext()) { jenautils.asjenastatement(); } stringwriter sw = new stringwriter(); // jen

raspberry pi2 - Alljoyn c# implementation for Windows 8 -

i've been playing raspberry pi 2 windows 10 iot. , want send commands device using alljoyn. however unable find kind of client/router sample c# code. microsoft offers windows.devices.alljoyn namespace windows 10 :( https://msdn.microsoft.com/library/windows/apps/windows.devices.alljoyn.aspx am person want use alljoyn in c# app other in windows 10? i've started c# wrapper project here: https://github.com/dotmorten/alljoyndotnet currently supports windows desktop, windows 10, , xamarin android, don't see why windows 8.1 store app wouldn't possible - need alljoyn_c.dll compiled 8.1.

PHP snippet to Smarty code -

i'm looking convert php code smarty code, struggling function part. <?php function get_client_ip_env() { $ipaddress = ''; if (getenv('http_client_ip')) $ipaddress = getenv('http_client_ip'); else if(getenv('http_x_forwarded_for')) $ipaddress = getenv('http_x_forwarded_for'); else if(getenv('http_x_forwarded')) $ipaddress = getenv('http_x_forwarded'); else if(getenv('http_forwarded_for')) $ipaddress = getenv('http_forwarded_for'); else if(getenv('http_forwarded')) $ipaddress = getenv('http_forwarded'); else if(getenv('remote_addr')) $ipaddress = getenv('remote_addr'); else $ipaddress = 'unknown'; return $ipaddress;} $user_ip = get_client_ip_env();

jquery - Matching element that does not have specific element -

i need run through html blocks .myem class , remove class first div in element if .myem doe not have <p> tags. this came with, still not remove class. missing? $('.myem').each(function() { $(this).not(':has(p)').find('.row:first-child').removeclass('myclass'); }); you can in once sweep; many of jquery methods use .each() internally: $('.myem:not(:has(p)) .row:first-child').removeclass('myclass');

javascript - Add new alias for unicode character to HTML/CSS -

i trying write documents web have special characters in them. there's few unicode characters not have "named character reference" include in web pages. example, here's funky arrow: 0000 21fb rightwards arrow double vertical stroke which looks this: ⇻ if want make habit of this, need keep big list handy shows these characters , equivalent hex codes. easier if link css or javascript file, , type "alias" instead (similar named character reference). in other words, i'd able this: <p>here arrow: &my-special-arrow; </p> can suggest way easily?

Spring - RESTful authentication using cookies -

i try implement authentication (for android client app) using cookies, based on article - http://automateddeveloper.blogspot.co.uk/2014/03/securing-your-mobile-api-spring-security.html securityconfig: @configuration @enablewebsecurity public class securityconfig extends websecurityconfigureradapter { private final static string token_string = "my_token"; private final static string cookie_string = "my_cookie"; @autowired private userdetailsservice usersvc; @autowired private mytokenbasedremembermeservice tokensvc; @autowired private remembermeauthenticationprovider remembermeprovider; @autowired private myauthsuccesshandler authsuccess; @autowired private myauthfailurehandler authfailure; @autowired private mylogoutsuccesshandler logoutsuccess; @autowired protected void configureglobal(authenticationmanagerbuilder auth) throws exception { auth .userdetailsservice(usersvc

html - Changing Div Width via Javascript -

i'm making website art gallery. part of need display images viewers in way in can view them. , want without reducing quality of images, or having save of images in many different sizes cater every user. so, i've made javascript function resize images fit on viewer's screen. code looks like <img src="[image.png]" onload="setgoodheight(this);"> where function setgoodheight(element) defined as: function setgoodheight (element) { if(window.innerheight-50 < element.height) { var h = element.height; var w = element.width; element.height = window.innerheight - 50; element.width = w * element.height / h; } if (window.innerwidth-100 < element.width) { var h = element.height; var w = element.width; element.width = window.innerwidth - 100; element.height = h * element.width / w; } } in shorthand, first checks whether image higher screen it's trying displ

javascript - Angular $resource: Use POST to query array of values? -

i'm building out search functionality within angular app allow user search multiple 'tags'. results of search list of customers of provided tags associated them. the problem i'm running attempting pass array of 'tags' through get request using $resource . in case using post , passing array in request body better approach? logically seems strict get me i'm not altering server side, array makes tricky.

How do I generate a list of textboxes in JavaScript? -

i'm making js application automatically textbox on user input. i'm not sure how append input li the end result want @ this: <ul id="lst"> <li>item1: <input type="text"></li> <li>item2: <input type="text"></li> <!-- more li added on button press --> </ul> what got far this: var onclick = function() { var ul = document.getelementbyid('lst'), li = document.createelement('li'); li.appendchild(document.createtextnode('item' + counter + ': ')); counter++; ul.appendchild(li); } how append <input type="text"> node? the same way added text element. var onclick = function() { var ul = document.getelementbyid('lst'), li = document.createelement('li'), input = document.createelement('input'); input.type="text"; li.appendchild(document.createtextnode('item'

python - Scrolling a Kivy Label horizontally -

Image
i'd have label in kivy app scroll horizontally fixed vertical size rather vertically wrapping. imagine marquee tag in bad old days. eventually i'd have automatically scroll left right (and back) show string long display. all of scrollable label examples i've seen vertically scrolling , 2 days of working on has gotten me nowhere. edit: note: working on windows time being. target android , iphone here's example of ui want... the track name @ bottom should height of 1 line of text , scroll horizontally. the same way of doing vertical scroll: scrollview: label: text: 'hellooooooooooooooooooooosdsadas' text_size: none, self.height # set text wrap box height size_hint_x: none width: self.texture_size[0] # set label width text width result be:

php - Multiple checkbox validation before sql insert -

i have problem similar post: how check multiple $_post variable existence using isset()? my issue is, have rather large list of checkboxes need know if checked in order set status of $row. mentioned script,all and's, except have , or thrown in works. if ( isset($_post['facial1']) && ($_post['facial2']) && ($_post['facial3']) && ($_post['facial4']) && ($_post['intra-oral1']) && ($_post['intra-oral2']) && ($_post['intra-oral3']) && ($_post['intra-oral4']) && ($_post['intra-oral5']) && ($_post['intra-oral6']) && ( ( ($_post['x-ray1']) && ($_post['x-ray3']) ) || ($_post['x-ray5']) ) ) { $status = 1; } else { $status = 0; } each time run test, gets element not check

C++ Tokenizer Complexity vs strtok_r -

i'm making question because moved tokenizer strtok_r equivalent version in c++. have use strtok_r in place of strtok, because have 2 nested tokenizations perform of time. the strtok_r algorithm this: char *end_token, *token, *word ; // fill 'word' token = strtok_r (word, " ", &end_token) ; while (token != null) { // token = strtok_r (null, " ", &end_token) ; } and c++ version (taken post here): string mystring, token ; size_t next_token ; // fill 'mystring' while (token != mystring) { next_token = mystring.find_first_of (" ") ; token = mystring.substr (0, next_token) ; mystring = mystring.substr (next_token + 1) ; // } now question: why c++ version heavy respect c version? long strings have wait 10 seconds c++ version, while c version instantaneous same strings. so, seems c++ version has higher complexity... think about? strtok() modifies string, replacing token delimiter null terminat

java - Is there a way I can edit Eclipse's code to add some custom shortcuts, my own code completion, and some formatting stuff? -

there few things want intellij, can't live it. eclipse better me in more ways , add of intellij functionality it. pretty want intellij pretty simple (just few shortcuts), use them often. want know if possible me add want. for of stuff know can use external script, rather include want within eclipse not externally. you can use plug-in development environment in order create own eclipse custom functionallity. example hello world plugin.

java - Insert unique entities to the sqlite DB -

there 100k entities in sqlite db following structure: id (numeric, pk) key (varchar, unique/pk) other fields, varchars i have list of 100-1k entities. want add db entities, key not present in db , show list of added ones. example as relevant example may consider this: library books entities. each book has global unique isbn number (key) , unique id (id) in library catalog. some person brings library set of books. library checks books isbn in catalog, takes 'new' books , shows person list of taken books. some thoughts how can achieved: 1) select keys db, put them [hash]set, in loop verify key new entities not exist in set. 2) #1 instead of selecting keys, select keys present both in db , list 3) in loop check existence of entity additional select query 4) enable constraints in db, check existence catching exceptions all of them have own disadvantages, believe. can suggest better? for i'm asking 'best practices', believe of approach work