Posts

Showing posts from July, 2012

pointers - C++ linked list implementation segmentation fault (core dumped) error -

i trying learn c++ on own , have been going through textbooks , trying problems. while learning pointers, decided try , implement linked list on own. have written program, keep getting error says: "segmentation error (core dumped)". have searched through other similar questions on website , although there lot on same topic, none have helped me fix problem. i'm pretty new programming , pointers, appreciated! #include <iostream> #include <cstdio> #include <cstdlib> using namespace std; struct node { int element; struct node *next; }*start; class pointerlist { public: node* create(int num); void add(int num); int first(); int end(); int retrieve(int pos); int locate(int num); int next(int pos); int previous(int pos); void insert(int pos, int num); void delete(int pos);

PHP SwiftMailer: sending email with SMTP give `SSL operation failed` while startTLS is enabled -

i want send email using swiftmailer(v5.4.1) library in yii1(1.1.17) . here configuration mailer component in main.php(configuration file): 'mailer' => array( 'class' => 'application.components.swiftmailer', 'host' => 'xx.xx.xx.xx', 'type' => 'smtp', 'port' => 587, 'username' => 'username', 'password' => 'password', 'fromname' => 'sample_name', 'fromaddress' => 'sample_email', 'security' => 'tls', ), mail server , application server in internal network of our company. when attempt send email receive warning. want know reason , send emails after did handshake server using starttls(it enabled in server, assured network manager). stream_socket_enable_crypto(): ssl operation failed code 1. ope

c# - Entity Framework Code First Approach -

public class contextex:dbcontext { public void modelcreate(dbmodelbuilder modelbuilder) { database.setinitializer<contextex>(null); modelbuilder.entity<category>().totable("categories"); modelbuilder.entity<category>().haskey(c=> new {c.categoryid}); modelbuilder.entity<cartitem>().totable("cartitems"); modelbuilder.entity<cartitem>().haskey(ci=> new {ci.cartid}); modelbuilder.entity<product>().totable("products"); modelbuilder.entity<product>().haskey(p=> new {p.productid}); modelbuilder.entity<order>().totable("orders"); modelbuilder.entity<order>().haskey(en=> new { en.orderid}); modelbuilder.entity<orderdetail>().totable("orderdetails"); modelbuilder.entity<orderdetail>().haskey(od=> new {od.o

ocaml - Unbound module Camlp4 -

i aware of similar questions on site none of them have helped solve problem. i new @ ocaml , using following tutorial using camlp4 https://github.com/ocaml/camlp4/wiki/ocaml_code_generation_tutorial however error on first line: open camlp4.precast saying "unbound module camlp4" there camlp4.exe file have downloaded ocaml assumed installed. have tried both on windows 8 , xubuntu this input passing command line compile file: ocamlc -o test.exe test.ml test.ml file contains line error you should know camlp4 deprecated, should use ppx instead. if need compile old programs using camlp4, should have instructions on how build. anyway it's rare use ocamlc directly, should try ocamlbuild or @ least use ocamlfind .

html - Media queries in bootstrap , not letting me change size and color of nav -

i playing around bootstrap , using media queries edit of nav bar settings when page gets smaller. trying make colour of background around navigation turns pink , text white reason not happening. i trying make when gets smaller bootstrap has icon bar can press down , drop down menu, way big when gets mobile version , reason cant make appear smaller. actual text of navigation not small icon css: @media screen , (max-width: 768px) { .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { background-color: #ff00ff; font-size: 15px; padding: 5px; } } again sorry if easy solution starting learn etc using bootstrap , of it's new me. on great. it's because other styles overriding css. should use inspectors chrome's devtools see happens. how using !important temporarily forcing style? background-color: #ff00ff !important; font-size: 15px !important; of course it's not be

C++ Bubble Array Assignment - Adding markers to show change -

i given assignment work through in university , 1 part of assignment add stars( * ) elements moved in array using bubble sort. i've tried few different things try work nothing ends working. here what's asked of me: "5. create array of bools (one each element in array), if pair of elements changed round in cycle, bools change true, , elements displayed surrounded stars ( * ) show change has occurred. reset array of bools false, ready next cycle. remember need test value of boolean in order decide whether output asterisks or not" here code: int main() { double numbers[nmax] = {31.2, 29.7, 53.5, 69.0, 23.7, 71.8, 49.3, 52.9, 51.3, 57.1}; bool change[nmax] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // note top counter, i, counts down int counter = 0; (int i=nmax-1; i>0; i--) { //and counter, j, goes far current value // means doesn't go on elements have 'bubbled up' end of array (int j=0; j<

performance - What does Free and Allocated memory mean in Android Monitor? -

i using android studio profile app. under android monitor->memory tab, see free (9mb) , allocated (15 mb) memory app. mean? per understanding, when zygote starts app, allocates pre-defined memory chunk app. app, might have allocated 24 mb , app using 15 mb. understanding correct? dark blue: amount of memory app using. light blue: available, unallocated memory. https://developer.android.com/tools/performance/memory-monitor/index.html

rsync unknown filter rule merge -

i'm writing script using rsync synchronize 2 local folders. i'm building rsync command variables, set depending on whether .sync-filter file exists or not. here's sync function: function sync { from="$1" to="$2" local filter_file=${from%/}"/.sync-filter" local filter="" if [[ -f ${filter_file} ]] ; filter="--filter='merge ${filter_file}'" fi cmd="rsync -a --delete ${filter} ${from} ${to}" `$cmd` sleep 1 } the result in terminal when running script: execute command: rsync -a --delete --filter='merge ./.sync-filter' --exclude-from=./.sync-exclude . ../dst unknown filter rule: `'merge' rsync error: syntax or usage error (code 1) @ exclude.c(904) [client=3.1.1] if manually run command, works no error. anyone has clue? after having same problem clue: rsync expects (at least) filter-arg of command in own "argv" repr

spring mvc - How do I store a salt in mysql database for secure password encryption? -

i'm using shiro spring mvc login users. configure shiro in applicationcontext.xml (no ini file). this realm configuration: <bean id="myrealm" class="org.apache.shiro.realm.jdbc.jdbcrealm"> <property name="datasource" ref="datasource"/> <property name="authenticationquery" value="select password usuarios email = ?"/> <property name="credentialsmatcher"> <bean class="org.apache.shiro.authc.credential.hashedcredentialsmatcher"> <property name="storedcredentialshexencoded" value="false"/> <property name="hashiterations" value="1024" /> </bean> </property> </bean> this code generating salt , hash when user registers: randomnumbergenerator rng = new securerandomnumbergenerator(); object salt = rng.nextbytes(); string hashedpasswordbase

c# - Inaccessible due to its protection level Unity3D -

this code that's creating error: using unityengine; using unitystandardassets.imageeffects; public class gs_globalfog : gs_sliderbase { protected override void graphicspresetlow() { setfog(false); } protected override void graphicspresetmedium() { setfog(true); } protected override void graphicspresethigh() { setfog(true); } protected override void graphicspresetultra() { setfog(true); } protected override void onslidervaluechange() { setfog(system.convert.toboolean(value)); } void setfog(bool value) { cam.getcomponent<globalfog>().enabled = value; slider.value = system.convert.toint16(value); } } this error visual studio 2015 giving me: cs0122 'globalfog' inaccessible due protection level

java - Swing Worker Thread Says There is no Process() Method In Super Class -

i trying implement swingworker thread in updating gui. understand process() method executed edt, if need update gui, should place update code within method. however, when try override process() method, error, method not implement method supertype. please missing or process() method no longer exist? class swingworkerthread extends swingworker<string, string> { @override protected string doinbackground() throws exception { string pub = "a"; (int = 0; < 20; i++) { pub = string.valueof(i); publish(pub); } return pub; } @override protected string process(string h) { system.out.println(pub); mainframe.textarea.settext(pub); return null; } @override protected void done() { string status; status = get(); try { system.out.println("done"); } catch (exception ex) { system.out.println(&

shell - Create with pipe a user defined filename batch file -

i want read stdin filename batch file need create. in single line , using pipe. when try cmd creating .bat before put in name. set /p filename= | copy nul %a%.bat that's not how pipe works. pipe takes output of previous command, , makes input of next command. set /p filename= command doesn't produce output, copy nul %a%.bat doesn't input, that's irrelevant anyway, because copy command doesn't take input anyway. copy nul %a%.bat command creates empty file called .bat because haven't defined variable called a , , %a% gets expanded empty string. what want requires 2 commands: set /p filename= copy nul %filename%.bat

ios - UILabel incorrectly sized in UITableViewCell (Animation after assigning text) -

Image
the text in uilabel flickering after being displayed, first appearing ellipsis on single line, occupying 2 lines fits in. notice cell height doesn't change. here problem: label "Друзъя, примите участие и наполните Коробку!" ( friends, take part , fill boxes! ) first appears truncated , misaligned "Друзъя, примите участи..." during view transition. this happens on iphone 4s ios 8.1. manipulation label (except text assigning) happens in storyboard. what causing flickering? assuming changing test in cellforrowatindexpath , , further assuming not happen strings, length, ios bug. see lengthy discussion on this stack overflow uitableviewcell post , , possible workaround: override func viewdidload() { super.viewdidload() tableview.setneedslayout() tableview.layoutifneeded() tableview.reloaddata() } notes 1. have noticed using small value estimatedrowheight such 20 , not tall smallest cell, in combination doubled r

c# - Linq Exclude columns in children -

i trying following: given list of dynamic objects perform group using list of columns provided. here's have far: using newtonsoft.json; private static void main(string[] args) { dynamic[] data = { new { = "a1", b = "b1", c = "c1", d = "d1", e = "e1", f = "f1"}, new { = "a1", b = "b1", c = "c1", d = "d1", e = "e1", f = "f1", g = "g1"}, new { = "a1", b = "b1", c = "c1", d = "d1", e = "e1", h = "h1", = "i1"} }; var newlist = data.groupby(row => new { row.a, row.b, row.c, row.d, row.e }) .select( y => new { = y.key.a, b = y.key.b, c = y.key.c, d = y.key.d, e = y.key.e, children = y.tolist() }); var str = jsonconvert.serializeobje

Azure Mobile Apps with Cordova/Ionic -

i evaluating azure's mobile apps , want clarify findings. azure mobile apps not support cordova/ionic database offline sync. coming or not considered? are there hacks or workarounds solve now? we working towards offline sync capabilities within cordova / javascript world. once it's ready release, release on npmjs.com , tag release in github . can check pure js client on github. both updated , released once ready.

ios - call a function when KDCircularProgress animation is done -

have used kdcircularprogress ? if yes, how can when animation done? circularprogressview.animatetoangle(360, duration: 5, completion:nil) any idea how call function when animation done? use completion: circularprogressview.animatetoangle(360, duration: 5) { completed in if completed { // animation completed } else { // animation interrupted } }

PHP Mysqli Fetch from table where -

i'm working on user system on website, i've table setup users users register, want retrieve information table specific users. users table 5 columns username, password, email, level, gold i have $_session['username'] equal logged in username , want level , gold users , set them $userlevel , $usergold. how can this? edit the following code gets users info want specific users info $sql="select username, level, gold users"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "username: " . $row["username"]. " - level: " . $row["level"]. " - gold: " . $row["gold"]. "<br>"; } you'll need prevent mysql injection: $username = mysqli_real_escape_string($conn, $_session['username']); code select row, username equal user logged in $sql = "

php - Eager load extra model attributes -

i using eloquent laravel. the case: i'm building api there possibility include relations resource. example /api/teams?include=users add user model every team . logic includes relationship i'm using fractal . need have logic determines relationship has included, can create optimized query it. problem: when want render collection of team related user models. can eager-load models fine. problems comes when have custom attributes on user model. these cause n+1 query problem because every eager-loaded team, because query custom attributes executed every model. example code: // team model custom attribute class team extends model { protected $appends = ['is_member']; public function getismemberattribute() { $loggeduser = auth::currentuser(); $result = db::table('team_user') ->where('team_id', $this-id) ->where('user_id', $loggeduser->id)

c# - Why am I unable to do an Assembly.Load of WinMD files? -

Image
i'm trying write method of namespaces assembly/winmd file c#. reason, i'm having trouble doing winmd files because i'm unable load them. here relevant portion code (partially stolen this answer reflecting on winmds ): using system; using system.linq; using system.reflection; using system.runtime.interopservices.windowsruntime; public static class load { public static assembly assemblyfrom(string path) { var domain = appdomain.currentdomain; resolveeventhandler assemblyhandler = (o, e) => assembly.reflectiononlyload(e.name); eventhandler<namespaceresolveeventargs> namespacehandler = (o, e) => { string file = windowsruntimemetadata .resolvenamespace(e.namespacename, array.empty<string>()) .firstordefault(); if (file == null) return; var assembly = assembly.reflectiononlyloadfrom(file); e.resolvedassemblies.add(assem

liferay - Failed to copy /home/[...]/ecj.jar to /usr/share/ant/lib/ecj.jar due to java.io.FileNotFoundException /usr/share/ant/lib/ecj.jar (Permission denied) -

while ant clean works fine within liferay ide, when trying command line get: $ ant clean buildfile: /home/nico/myportlet/build.xml [copy] copying 1 file /usr/share/ant/lib attempt copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar /usr/share/ant/lib/ecj.jar using nio channels failed due '/usr/share/ant/lib/ecj.jar (permission denied)'. falling streams. build failed /home/nico/myportlet/build.xml:5: following error occurred while executing line: /home/nico/liferay-plugins-sdk-6.2-ee-sp14/portlets/build-common-portlet.xml:5: following error occurred while executing line: /home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common-plugin.xml:5: following error occurred while executing line: /home/nico/liferay-plugins-sdk-6.2-ee-sp14/build-common.xml:94: failed copy /home/nico/liferay-plugins-sdk-6.2-ee-sp14/lib/ecj.jar /usr/share/ant/lib/ecj.jar due java.io.filenotfoundexception /usr/share/ant/lib/ecj.jar (permission denied) total time: 2 seconds how fix that

c# - Is there a way to get the Generic Type from an Extension method? -

consider method: public static tresult castto<t, tresult>(this t arg) { typeconverter typeconverter = typedescriptor.getconverter(typeof(t)); bool? converter = typeconverter?.canconvertto(typeof(tresult)); if (converter != null && converter == true) return (tresult)typeconverter.convertto(arg, typeof(tresult)); else return default(tresult); } is there way set generic type extension method, mean, instead call: string s = "1"; s.castto<string, int>(); something input type directly class who's calling. i'm pretty new c# , want know issue. you can ommit type when generic method returns nothing: public static void castto<t, tresult>(this t arg, out tresult var) { typeconverter typeconverter = typedescriptor.getconverter(typeof(t)); bool? converter = typeconverter?.canconvertto(typeof(tresult)); if (converter != nul

PHP and XML: How to retrieve attributes in XML -

here xml: <?xml version="1.0" encoding="utf-8" ?> <items> <itemgroup name="atm" column="1" sort="0"> <item formid="atm 01" description="option teller balance sheet - atm dept. ordering only" unit="cello 500"/> </itemgroup> <itemgroup name="data processing" column="1"> <item formid="aacu 01" description="receipt voucher - 2 part" unit="3600/box"/> <item formid="aacu 04" description="contract collection statement" unit="as req."/> <item formid="aacu 07" description="1-part receipt voucher - cont. feed form" unit="5000/box"/> <item formid="aacu 08" description="share ira certificate" unit="2200/box"/> <item formid="aacu 15" description="pta pin mailer" uni

Multiple Header rows in JqGrid -

Image
presently able output binding jqgrid serialized json server side. but can following output.?

javascript - hammer-time.min.js contains undefined function hasTouchNone -

i downloaded hammer-time.min.js , when run, getting exception on browser. typeerror: this.hastouchnone not function. (in 'this.hastouchnone(a.target)', 'this.hastouchnone' undefined) am missing library? update: have tried downloading full javascript (non-minified version). , working fine. when checked code, hastouchnone function not in code. looks answered with: update: have tried downloading full javascript (non-minified version). , >it working fine. when checked code, hastouchnone function not in >the code.

java - ResultSet.getFloat return 0 instead of NULL -

i using jdbc resultset records database. resultset.getfloat() //returns 0 null value. is there way null value using getfloat() or alternate solution? you need call resultset.wasnull() test whether last column read had value of sql null.

python - "Least Astonishment" and the Mutable Default Argument -

anyone tinkering python long enough has been bitten (or torn pieces) following issue: def foo(a=[]): a.append(5) return python novices expect function return list 1 element: [5] . result instead different, , astonishing (for novice): >>> foo() [5] >>> foo() [5, 5] >>> foo() [5, 5, 5] >>> foo() [5, 5, 5, 5] >>> foo() a manager of mine once had first encounter feature, , called "a dramatic design flaw" of language. replied behavior had underlying explanation, , indeed puzzling , unexpected if don't understand internals. however, not able answer (to myself) following question: reason binding default argument @ function definition, , not @ function execution? doubt experienced behavior has practical use (who used static variables in c, without breeding bugs?) edit : baczek made interesting example. of comments , utaal's in particular, elaborated further: >>> def a(): ... print("a exec

meteor - Implementing logical nested select in quickForm SimpleSchema -

property.attachschema(new simpleschema({ 'lga': { label: "l.g.a", type: string, allowedvalues: ["aba","oha", "enu"], autoform: { affieldinput: { firstoption: "(pls, select l.g.a)" } } } , 'town': { label: "town", type: string, allowedvalues: ["abakpa","ewula", "ezeoka", "ubu","echa", "onu" ,"eke", "afor"], autoform: { affieldinput: { firstoption: "(pls, select ward)" } } } }); i have schema above , using quickform implement schema. "abakpa","ewula", "ezeoka" towns in "aba" lga while "ubu","echa", "onu" towns in "oha" lga , "eke", "afor" belong "enu" lga. illustration because list quite numerous. want situation if "aba&qu

node.js - app router in Express -

there difference between app.use(function(req,res,next){ }); and router.use('/some_route', function(req,res,next){ }); ...the difference being app.use runs every request , router.use runs matching routes. my question router must lie underneath app. surely app has default router internal it. there way access router...app.router? thought deprecated? secondly, looking way access current router being used. for example, app.use(function(req,res,next){ var currentrouter = req.app._router // (?) }); or router.use(function(req,res,next){ var currentrouter = req._router //(?) }); where req._router equal same router router.use call of course. in latest express code , default app router in app._router . it created lazily means it's not created until route defined (with app.use() or app.get() or that). it not appear meant public property , subject change. can, of course, define own router root path , use

web services - how to send and receive soap messages in attribute name/value format? -

what needs set in web service soap messages sent , received in param attribute format? example, need send soap requests parameters in attribute name/value format: <param name="controller_name">cpa central</param> and receive them in similar attribute name/value format: <attribute name="channel_number">1</attribute> i've googled literally 14 hours , cannot find how it! appreciative if point me in right direction. here's how ended doing it. seems ridiculous have intercept outgoing soap message , reformat it, rather creating in correct format begin with. if forced use magic black boxes jax-ws was, stuck auto-format provide apparently. public class inneoquestlogicalhandler implements logicalhandler<logicalmessagecontext> { private static logger logger = logger.getlogger(inneoquestsoaphandler.class); @override public boolean handlemessage(logicalmessagecontext context) { boolean isrespo

elasticsearch - Elastic custom filed types -

this related one of other question in elastic i have index 150 fields in different tables , want of them able searched partially. one thing can (as in answer above question) set analyzer , search analyzer in fields want partially searched. but sure elastic having better way of doing it. can define own field type 'string' analyzers preset , set type fields required partially searched? i not sure if can define own type. can achieve using dynamic templates . use dynamic templates : put /my_index { "mappings": { "my_type": { "dynamic_templates": [ { "analysed_string_template": { "match": "*_sometext", "match_mapping_type": "string", "mapping": { "type": "string", "analyzer": "your_analyser" } }

javascript - how to get account details when integrating plaid api -

i trying integrate plaid api ach payments , following " https://plaid.com/docs/link/ " tutorial in ruby. in have written js code , shows me pop select bank accounts. using in sandbox mode in using test credentials verify account , verifies account. server side scripting have installed plaid gem , configured using following code my_app/config/initializers/plaid.rb plaid.config |p| p.customer_id = 'test_id' p.secret = 'test_secret' p.environment_location = 'https://tartan.plaid.com' end where have replaced customer_id , secret key own. using user controller in under create method trying create user this: user = plaid.add_user('auth', 'plaid_test', 'plaid_good', 'usaa', '1234') now confused how work. trying create server side handler using ruby dont understand lacking (as new ruby). want after validating credentials there should option select account in given demo https://demo.plaid.com/stripe

Crystal lang, is it possible to explicitly dispose (free) of instance (object) without waiting for GC? -

the title says all. maybe there's method can called def destruct; delete self;end ? it's possible, not recommended , way i'll show might change or break in future. why need this? idea of gc precisely not worrying such things. class foo def initialize @x = 10 end def finalize puts "never called" end end foo = foo.new p foo # => #<foo:0x10be27fd0 @x=10> gc.free(pointer(void).new(foo.object_id)) # line frees memory p foo # => #<foo:0x10be27fd0 @x=1>

Android Webview goback() issue with loadDataWithBaseURL method -

issue goback() not showing html data back. steps produce issue like loaded html data using method loaddatawithbaseurl. renders html data fine. then click on 1 link inside html data webview moves next page showing link fine. when call method goback() page should show html data showing me blank screen. inside onpagefinished() getting url about:blank. thanks in advance!

mysql - join table.A with table.B, table.B having multiple rows with respect to one id from table.A -

e.g select id,product products; id product 1 iphone 6 2 dell inspiron pid foreign key referencing product id in products select * product_image; id pid image 1 1 he7gu8h9d54w.jpg 2 2 jgeywfyu3r34.jpg 3 1 drtsw54e452r.jpg 4 2 weyr63tr236r.jpg after joining, getting this.. id product img_id pid image 1 iphone 6 1 1 he7gu8h9d54w.jpg 1 iphone 6 3 1 drtsw54e452r.jpg 2 dell inspiron 2 2 jgeywfyu3r34.jpg 2 dell inspiron 4 1 drtsw54e452r.jpg i'm getting multiple rows product_image respect 1 id in product table want 1 row product_image respect product_id...plz help.. i want this... id product img_id pid image 1 iphone 6 1 1 he7gu8h9d54w.jpg 2 dell inspiron 4 1 drtsw54e452r.jpg for each product, can use not exists make sure no image lower id exists: select p.id, p.product, pi.id, pi.pid, pi.image products p join product_image pi on p.id = pi.pid not exists (select * p

php - How can I use this code to add data from multiple feeds in my Database? -

so, currently, code i'm using, enters data last feed in array namely feed4 in databse , doesn't add data other 3 feeds, how can fix this, here code: <?php $db_hostname=""; $db_username=""; $db_password=""; $all_urls = array('feed1', 'feed2', 'feed3', 'feed4'); try { $db = mysql_connect($db_hostname,$db_username,$db_password); if (!$db) { die("could not connect: " . mysql_error()); } mysql_select_db("dbname", $db); foreach ($all_urls $url) { libxml_use_internal_errors(true); $rss_doc = simplexml_load_file($url); } if (!$rss_doc) { echo "failed loading xml\n"; foreach(libxml_get_errors() $error) { echo "\t", $error->message; } } $rss_title = $rss_doc->channel->title; $rss_link = $rss_doc->channel->link; $rss_editor = $rss_doc->channel->managingeditor; $rss_copyright = $rss_doc->channel->copyright; $rss_date = $

How can I read a matrix with missing end elements in R? -

i pass r txt file matrix, tailing zeros omitted rows (except first tailing zero, if any). missing values considered zeros. for example: 8 7 0 5 4 3 2 1 4 8 9 should read as: 8 7 0 0 0 5 4 3 2 1 4 8 9 0 0 the max row size (i.e. number of matrix columns) unknown prior reading matrix. d <- as.matrix(read.table(filename, fill=t)) d[is.na(d)] <- 0

javascript - Is it a bug to discard passed rest-props to a React component? -

i'm developing wrapper on flexbox in react: https://github.com/aush/react-stack . have top level component creates container div , sets flex properties , map on it's children , set flex properties them (i don't create additional wrapper divs children, set flex properties directly them). , it's works flawlessly except 1 case. my component, stripped down: export default ({ someprops, style, children, ...rest }) => <div style={{ ...style, ...flexcontainerstyle }} {...rest}> { react.children.map(children, (child, i) => react.cloneelement(child, { key: i, style: { ...child.props.style, ...flexitemstyle } })) } </div>; consider simple example, when children standard divs: codepen example 1 reactdom.render( <horizontal> <div classname="box1">1</div> <div classname="box2">2</div> <vertical> <div classname="box3">3<

bit manipulation - setting bits of a byte in C -

im try set bits of byte , based on function signature int setbits(int old_value, int position, int width, int set_value) what doing wrong, because keeps returning 0. #include "stdafx.h" int setbits(int old_value, int position, int width, int set_value); int _tmain(int argc, _tchar* argv[]) { //for example turn hex 0xa (10 base 2) ( 8 base 2) int old_value = 0xa; int position = 2; int width = 4; int set_value = 0; printf("setbits, old_value %x, position %i, width %i, set_value %x, output %x",old_value,7,width,set_value,0); getchar(); } //position - least significant bit of old_value wish change //old_value - value before start changing //width - width in bits of value want change (old_value width). //set_value - value want use modify bits int setbits(int old_value, int position, int width, int set_value) { int mask = 0x1; int return_val = 0x0; if (0 < position <= width) { //initialize

c# - How to deactiveating Treeview's CheckBox -

Image
i have 2 treeview nodes there check-boxes behind them using required command. want make nodes gray/deative. so, pick 1 node first treeview , in other treeview nodes node.text not equal text gray. did following function: public void deactive_checkboxs(object sender, eventargs e) { treenodecollection nodes_checked1 = treeview1.nodes[0].lastnode.nodes; treenodecollection nodes_checked2 = treeview2.nodes[0].lastnode.nodes; foreach (treenode node1 in nodes_checked1) { if (node1.checked) { foreach (treenode node2 in nodes_checked2) { if (node1.text.equals(node2.text)) { node2.checked = false; } else { node2.checked = false; } } } } } of course not going gray nodes rather remove checked boxes behind nodes( if let me know making gray methods appreciate it). now not k

node.js - Bower: "command not found" after installation -

i seem getting following when execute npm install bower -g /usr/local/share/npm/bin/bower -> /usr/local/share/npm/lib/node_modules/bower/bin/bower bower@0.8.6 /usr/local/share/npm/lib/node_modules/bower unfortunately executing of bower commands returns -bash: bower: command not found which npm returns /usr/local/bin/npm , running which node returns /usr/local/bin/node . i assume installed node.js through homebrew, annoyingly puts installed npm binaries in place not in users path. have add /usr/local/share/npm/bin $path. adding export path=/usr/local/share/npm/bin:$path .bashrc/.bash_profile/.zshrc file. although rather uninstall homebrew installed node.js , install installer nodejs.org doesn't have problem. this problem not bower specific , noticeable globally installed node.js binary, eg. grunt, uglify, jshint, etc.

ios - how can i auto play a video in my app using wkwebview -

i using wkwebview show site. , site have video. when site showed,the video cannot autoplay.is method let video auto play? following function worked me giving support of auto play - (void)loadwebviewtoplay { nsstring * videohtml = @"<html><head><style>body{margin:0px 0px 0px 0px;}</style></head> <body> <div id=\"player\"></div> <script> var tag = document.createelement('script'); tag.src = 'http://www.youtube.com/player_api'; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var player; function onyoutubeplayerapiready() { player = new yt.player('player', { width:'200', height:'200', videoid:'bhqqvyy5kyo', events: { 'onready': onplayerready } }); } function onplayerready(event) { event.target.playvideo(); } </script> </body> </html>";

vb.net - Index outside bounds in event handler -

i'm having trouble displaying shipping price lblshipping.text option explicit on option strict on option infer off public class frmmain private intmin() integer = {1, 11, 51, 101} private intmax() integer = {10, 50, 100} private dblship() double = {15, 10, 5, 0} private sub btnexit_click(byval sender object, byval e system.eventargs) handles btnexit.click me.close() end sub private sub txtordered_keypress(byval sender object, byval e system.windows.forms.keypresseventargs) handles txtordered.keypress ' allows text box accept numbers , backspace key if (e.keychar < "0" orelse e.keychar > "9") andalso e.keychar <> controlchars.back e.handled = true end if end sub private sub txtordered_textchanged(byval sender object, byval e system.eventargs) handles txtordered.textchanged lblshipping.text = string.empty end sub private sub btndisplay_click(byva

Writing Spark RDD as Gzipped file in Amazon s3 -

i have output rdd in spark code written in python. want save in amazon s3 gzipped file. have tried following functions. below function correctly saves output rdd in s3 not in gzipped format. output_rdd.saveastextfile("s3://<name-of-bucket>/") the below function returns error:: typeerror: saveashadoopfile() takes @ least 3 arguments (3 given) output_rdd.saveashadoopfile("s3://<name-of-bucket>/", compressioncodecclass="org.apache.hadoop.io.compress.gzipcodec" ) please guide me correct way this. you need specify output format well. try this: output_rdd.saveashadoopfile("s3://<name-of-bucket>/", "org.apache.hadoop.mapred.textoutputformat", compressioncodecclass="org.apache.hadoop.io.compress.gzipcodec") you can use of hadoop-supported compression codecs: gzip: org.apache.hadoop.io.compress.gzipcodec bzip2: org.apache.hadoop.io.compre

mysql - How to used select join with specify any fields in laravel5 -

i want to select 3 table join in laravel5 first times me public function getjd($id){ $result = []; $result = journaldetail::select('journal_detail.*, jdid journal_detail, jdj_id journal_detail.journal_id .............,tranid transactions_requiry,..............') ->join('journal_requiry','journal_requiry.id','=','journal_detail.journal_id') ->leftjoin('transactions_requiry','transactions_requiry.id','=','journal_requiry.tran_id') ->where('journal_detail.journal_id','=',$id)->get(); return $result; } errors, queryexception in connection.php line 624: sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'as `as` `tb_journal_detail` inner join `tb_journal_requiry` on `tb_journal_' @ line 1 (sql: select `tb_journal_detail`.* `as` `tb_journal_

Ruby: How to write an array to postgresql? -

this migration file: class adddependentcolumntofeatures < activerecord::migration def change add_column :features, :dependent, :string, array: true, default: [] end end this part of array - important field "dependent": ... display_on_detail_view"=>"1", "description"=>"", "dependent"=>["569", "571"] ... it written on form submit per "update_attributes" (rails 3.2.13) my problem is, in database migrate file created "string" column default length of 255 characters. the above array looks this, after put pg-database: --- - !binary |- nty5 - !binary |- ntcx which not helpful test , array way larger in production mode 800 numbers instead of 2 - column length of 255 characters won't last long - there different way store array database? or doing wrong? class adddependentcolumntofeatures < activerecord::migration def change add_column :f

spring tool suite - What does the blue flash icon in the Outline view in Eclipse mean? -

Image
in outline view java source file, have icon next method: edit: when clicking method in outline view, method not focused in editor. what mean? there's nothing "special" method, here it's signature: private void scoreaddress(scoreresult s, scoreposting p, scoreorder o, subcategoryaddress subcategory, precisionaddress precision, double score, int minlength) { } i using spring tool suite 3.7.2 (eclipse luna sr2 4.4.2). had at docs couldn't find icon - maybe comes spring extension. full image: it seems spark icon introduced ajdt 1.2 , means method pointcut . the blue triangle indicates default (package visible) method as per docs you can find more info here

c# - Team Foundation alternatives for .net applications with a GIT repository -

i´m trying setup continuous integration environment git restriction (i mean git must code repository) , can´t use team foundation. question is... git support build automatization? , code analysis? , test execution? thanks in advance , sorry ignorance. cheers, kike. git source control repository, doesn't "support" build automation, decent build automation tool support git. you mentioned jenkins, automation tool allow create workflows or orchestrations provide ci functionality. alternative team city, although jenkins foss , teamcity commercial product.

lucene query special characters -

i have trouble understandnig handling of special characters in lucene. analyzer has no stopwords, special chars not removed: chararrayset stopwords = new chararrayset(0, true); return new germananalyzer(stopwords); than create docs like: doc.add(new textfield("tags", "23", store.no)); doc.add(new textfield("tags", "brüder-grimm-weg", store.no)); query tags:brüder\-g works fine, fuzzy query tags:brüder\-g~ not return anything. when street name eselgasse query tags:esel~ work fine. use lucene 5.3.1 thanks help! fuzzy queries (as wildcard or regex queries) not analyzed queryparser. if using standardanalyzer, instance, "brüder-grimm-weg" indexed 3 terms, "brüder", "grimm", , "weg". so, after analysis have: "tags:brüder\-g" --> tags:brüder tags:g matches on tags:brüder "tags:brüder\-g~" --> tags:brüder-g~2 since not analyzed, remains single te

browser - Scheme relative URL -

there lot of questions on regarding scheme relative url, don't understand happen in these scenarios: 1) on https clicking on href="//example.com/" (example.com doesn't have ssl (it's http), browser try open https://example.com/ (because wants match current scheme) , if there won't https scheme open http://example.com/ ? 2) vice-versa going http https, when target //example.com/ https. browser open https if destination target not have http? the browser try open url using same scheme it's on; if it's on https, request url https , vice versa http. if target server not support scheme, fail. in case of server supports https, means enforces https; if make http query server often redirects https version of same page. that's entirely server though. if server supports http, means doesn't have https @ all. in case https request fail , browser display error message along lines of "couldn't establish secure connection/coul

unity3d - Reduce the size of empty unity project android -

Image
i working on android game project unity engine (version 5.2.0f3). question is: empty compiled project 18 mb apk file size. why , how can reduce size ? the thing can strip byte code, use .net 2.0 subset, set script optimization "fast no exceptions", vertex compression "everything", , optimize mesh data. in 5.3.2f1 has more options, in 5.2.0f3 think has few of mentioned above. this located under player settings, other settings, bottom.

c# - Which event is fired when Content property is changed -

i have 2 pages productsearch , productdetail , im changing content property navigate between pages. want know if events fired can write code in it? on productdetail page have uielement property public uielement maincontent { get; set; } on productsearch page navigate productdetail setting content property this: private void ongetdetailsclick(object sender, routedeventargs e) { productdetail productdetail = new productdetail(); productdetail.maincontent = this.content; this.content = productdetail; } on productdetail page's back button navigate productsearch : private void onbackbuttonclick(object sender, routedeventargs e) { this.content = maincontent; } now want know how can call method when navigate productsearch page i.e how know have navigated productdetail page? tried check if loads page found out when change content of control doesn't fire load event of page. solution? yea not execute load event since changing conte

SQLite Calculate sum outside group by -

i'm trying calculate percentage of customer has spent on total sales value. have calculated total sales value per customer using sum() , group by, after use group by, cannot differentiate total sales value , individual total each sustomer. is there anyway around this? i got here far , dont know next: select c.firstname ||' '|| c.lastname 'ful name', sum(total) 'sales value', /*something calculate percentage*/, invoice inner join customer c on i.customerid = c.customerid group i.customerid order sum(total) desc limit 5; to calculate simple sum on entire table, move independent subquery: select ..., sum(total) / (select sum(total) invoice) ...;

html5 - Bootstrap row fixed as column header without afecting other divs in a container -

i have 3 column structure: left_sidebar center_content right_sidebar have fixed header (navbar) , fixed sidebars. want make 1 div (the top one) in center_content fixed. <div class="container-fluid"> <div class="row-fluid"> <div class="span1"> <div class="sidebar-nav sidebar-nav-fixed"> <ul class="nav nav-list"> <li class="nav-header">sidebar</li> <li class="active"><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> </ul> </div><!--/.well --> <!--sidebar content--> </div> <div class="span9"> <div class="row-fluid well-white">