Posts

Showing posts from June, 2014

css - Styling and collapsing with Bootstrap -

i'm going crazy styling predifined bootstrap classes. first of all, i've got problems access icon-bar class, doesn't styled. second of all, when shrinking browser, navigation bar collapses @ point before that, it's rearranged in 2 rows (brand continues in place menu gets second row). want collapsed when there's no space both menu , brand coexist in same row. how can solve this? html <header id="header-bar" class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu"> <span class="icon-bar"></span> <!-- not styled --> <span class="icon-bar"></span> <!-- not styled --> <span class="icon-bar"></span> <!-- not sty

go - MongoDB admin commands with mgo driver -

is possible, given admin creds, run mongo shell commands such db.stats() , rs.status() , db.serverstatus() external mongo shell via official go driver mongodb (mgo)? this possible, first need bear in mind "commands" have listed shell helpers. need real commands represent run them via mgo session.run . there couple of ways that, first run db.listcommands() in shell , find appropriate one. second way run helper wish emulate without parentheses. example: > rs.status function () { return db._admincommand("replsetgetstatus"); } as can see, helper run replsetgetstatus command against admin database. find db.stats() runs dbstats command. db.serverstatus() helper 1 of 3 listed can pretty run as-is. here's simple example of running 3 - show 2 forms of call, 1 passes string , more general option passes in full command document - ran on test mongod without auth, have add piece test on auth-enabled instance: package main import (

c++ - Capturing H264 stream with OpenCV -

so. have been trying raspberry pi 2 capture h264 stream opencv logitech c920 quite time now. have been scavenging internet info, no luck. a short system description: raspberry pi 2, running raspbian, kernel 3.18 logitech hd pro webcam c920 opencv 2.4.11 bonecv - credits derek molloy ( https://github.com/derekmolloy/bonecv ) libx264 , ffmpeg (built x264 support) libv4l-dev, v4l-utils, qv4l2, v4l2ucp i know opencv forces format bgr24 (mjpg). specified in cap_libv4l.cpp . looks this(line 692->): /* libv4l convert format v4l2_pix_fmt_bgr24 */ clear (capture->form); capture->form.type = v4l2_buf_type_video_capture; capture->form.fmt.pix.pixelformat = v4l2_pix_fmt_bgr24; capture->form.fmt.pix.field = v4l2_field_any; capture->form.fmt.pix.width = capture->width; capture->form.fmt.pix.height = capture->height; i can set pixelformat manualy v4l2-ctl --set-fmt-video pi@raspberrypi ~/bonecv$ v4l2-ctl --set-fmt-vi

javascript - Is Model.update a promise in Sails.js? -

i'm working on sails.js app, , in model function, need execute queries in order. i'm using default promises in waterline, it's not working following code: model.find().where({id: 1}).then(function(value){ return model.update({id: value[0].id}, {/**some value assignment here*/}); }).then(function(morevalues){ //here 'morevalues' empty array //more code here }); the update function of models returns promise? if does, doing wrong? thank you!

java - Android Service for PubNub -

i have implemented pubnub subscribe , publish code. code working fine on activity. want execute code in background of service class. have created class extending intentservice . , subscribing pubnub channel in oncreate method. whenever running app service stopping without showing pubnub status. getting following pubnub error. have linked pubnub required libraries too. 04-09 23:39:32.621: d/service message(10033): error[error: 100-1] : timeout occurred mainactivity.java public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } public void startservice(view v){ startservice(new intent(this, myservice.class)); } public void stopservice(view v){ stopservice(new intent(this, myservice.class)); } } pubnubhandler.java public class pubnubhandler{ public static final string global_chan

sublimetext - How to suppress Package Control Messages popup in Sublime Text 3 -

ok, i've suffered long enough: can't stand package control messages tab pops , grabs focus when open st3. know, 1 looks like package control messages ======================== package control: --------------- version 3.0 release notes ... is there way suppress popup? so, (hackish) way far i've found comment out line in package control package... responds better answer this. better way install packageresourceviewer package control open resource via packageresourceviewer -> select package control select package_control/package_manager.py edit comment out line self.print_messages(package_name, package_dir, is_upgrade, old_version, new_version) putting hash # in front save file. clunky way locate package control.sublime-package (on machine [linux] it's in ~/.config/sublime-text-3/installed packages) (on win7 it's in c:\users[your_name]\appdata\roaming\sublime text 3\installed packages) make copy of package in case bork proc

ruby on rails - ERROR: Error installing puma: ERROR: Failed to build gem native extension -

i know there several related posts, have tried several solutions. i have reviewed , tried soulutions from: cannot install puma gem on ruby on rails , puma issues 202 on github, puma issues 424 on github, , hicknhack-software/rails-disco/wiki/installing-puma-on-windows , few other sources, cannot post full links because have no rep. i aware of need download openssl , reference in gem install command. have downloaded , tried various versions of openssl, last 1 used 1040064 openssl-1.0.2a-i386-win32.zip http://indy.fulgan.com/ssl/ i running: version of ruby = ruby 2.0.0p598 (2014-11-13) [i386-mingw32] version of rails = 4.1.8 windows 7, 64 bit full error: jon@jon-pc /c/with_forked_on_4_8 (master) $ gem install puma -- --with-opt-dir=c:\openssl temporarily enhancing path include devkit... building native extensions with: '--with-opt-dir=c:openssl' take while... error: error installing puma: error: failed build gem native extension. c:/railsinstalle

Matlab Compiler and Startup script -

so i'm trying use matlab compiler in order build standalone application run on separate machine using mcr. actual application follows guide benchmark gpu. when open matlab following this make following command: mcc -mv -o gputest mainbench.m benchfcn.m executebenchmarks.m getdata.m paralleldemo_gpu_backslash.m timesolve.m waitforcpu.m waitforgpu.m the output is: compiler version: 5.1 (r2014a) dependency analysis requirements. parsing file "/media/hdd/work/matlab/gpubench/mainbench.m" (referenced from: "compiler command line"). parsing file "/media/hdd/work/matlab/gpubench/benchfcn.m" (referenced from: "compiler command line"). parsing file "/media/hdd/work/matlab/gpubench/executebenchmarks.m" (referenced from: "compiler command line"). parsing file "/media/hdd/work/matlab/gpubench/getdata.m" (referenced from: "compiler command line"). parsing file "/media/hdd/work/matlab

Spring Boot and Microservices - Consolidation strategies for development? -

my company looking @ migrating existing code more micro-service architecture. have 2 spring boot-based services did trial, , looking build out few more (20 or so). while seems great thing many aspects of our development , live operations, i'm wondering how others might handle more 1 micro-service in development environment? specifically, have 1-microservice 1 spring boot container mapping, fine couple of services. grow, become unmanageable developers, when trying run full-stack (all services) on single laptop limited resources. makes sense (to me, @ least) you'd have consolidate micro-services single spring boot container. i'm wondering if other people have run this, , strategies dealing this, while maintaining class separation? maintain separation of services in single spring boot container? do load each services new web context under same servlet container? use sort of dynamic configuration @ boot? (conditional beans, etc) how handle name spaces , packa

sqlite3 - Python scrapy pipeline error -

i'm developing spider scraping pages , have issues scrapy-pipeline.. don't know why.. what's wrong in script? # -*- coding: utf-8 -*- # define item pipelines here # # don't forget add pipeline item_pipelines setting # see: http://doc.scrapy.org/en/latest/topics/item-pipeline.html scrapy.exceptions import dropitem import sqlite3 con = none class realtybasepipeline(object): def __init__(self): self.setupdbcon() self.createtables() def process_item(self, item, spider): self.storeindb(item) return item def storeindb(self, item): dealerid = self.cur.lastrowid self.storesrealityinfoindb(item) self.storedealerinfoindb(item) def storesrealityinfoindb(self, item): self.cur.execute("insert sreality(\ name, \ price, \ url, \ estatetype, \ adress, \ createdate, \ source, \ dealername, \

c# - Error when configure HTTPS in WCF Service -

i have wcf service in vs 2010, .net 4.0. iis site virtual directory. i try configure , access using https https://pruebaslba.xxxx.net/serviciopys/service.svc?wsdl but error could not find base address matches scheme https endpoint binding wshttpbinding. registered base address schemes [http]. or could not find base address matches scheme https endpoint binding basichttpbinding. registered base address schemes [http]. googleing, have seen several alternatives configurations: servicemetadata, bindings, baseaddresses, .. i try different configurations, same error: servicemetadata <servicemetadata httpgetenabled="false or true" httpsgetenabled="true" /> bindings i use <security mode="transport"> <bindings> <basichttpbinding> <binding name="securetransportonly"> <security mode="transport"> <transport clientcredentialtype="non

javascript - Event listener giving error -

i have code example: <html> <input class="basketquantity" type=number>basket item 1</input> <input class="basketquantity" type=number>basket item 2</input> </html> <script> quantityinputs = document.queryselectorall(".basketquantity"); for(var in quantityinputs){ quantityinputs[i].addeventlistener('change', function(){ console.log(quantityinputs[i]); }); } </script> when run error message: typeerror: quantityinputs[i].addeventlistener not function could tell me why happening? quantityinputs = document.queryselectorall(".basketquantity"); first of quantityinputs nodelist object . so for(var in quantityinputs){ console.log(i); } will return enumerable properties - quantityinputs object , prototype chain, not own (just quantityinputs enumerable properties). for .. in return length field , item enumerable properties prototype chain , propert

c# - Regex in between characters -

im trying create regex match ascii characters in string converted hex afterwards. string received follows: <<<441234567895,ascii,4,54657379>>> looking match between third comma , >>> characters @ end of string so. <<<441234567895,ascii,4, 54657379 >>> so far have managed create regex (/([^,]*,[^,]*)*([^;]*)>>>/) third comma picked don't want. need remove match? thanks callum do need use regex? string input = "<<<441234567895,ascii,4,54657379>>>"; string match = input.substring(3, input.length - 6).split(',')[3]; you can use further splits on beginning , ending padding strings or check lengths if want safer substring magic.

javascript - Parsing JSON nested array using JQuery -

i have api returns following json values string. "[ ["west baton rouge test hello world", "1"], ["lsu parking \u0026 transportation services", "2"], ["demokljafsk", "3"], ["latest", "19"], ["hello check", "20"], ["dinesh devkota", "21"], ["world", "22"], ["altered value.", "23"], ["dinesh devkota", "24"], ["dinesh devkota", "25"], ["dinesh devkota", "26"], ["dinesh devkota", "27"], ["dinesh devkota", "28"], ["rocking client", "29"], ["west baton rouge", "30"], ["test client", "31"] ]" i having hard time trying first value of each array jquery , log console following code. $.get("/co

algorithm - Time complexity of finding whether graph has a unique topological order -

i have algorithm finding whether directed graph has unique topological order initialise list l find vertex v sink in graph (sink = vertex not going ordered edges) from graph remove edges going v , vertex v add v l if there vertices left in graph go step number 2 at end have topological order of vertices in l. if can choose more 1 vertex in step number 2 topological order not unique. if got stuck in of steps before graph empty means graph has no topological order @ all. i assumed time complexity of algorithm o(n), n number of vertices in graph apparently not right. let m number of edges, , n number of vertices. naive implementation of algorithm o(nm) . if implement step 2 iterating on set of edges o(m) iteration within loop executed n times. however, can in time complexity o(n+m) follows. assume vertex stored integer , edge stored pair of integers tail , head. step a in addition l , initialise following (a) array a 1 slot each vertex. array should

excel conditional formatting for minimum rainfall -

Image
as may know, there "trace" rainfall if rains amount less 0.1mm, have 0.0 mm < trace < 0.1 mm. now example, have table of rainfall data follow: year jan feb mar apr 2011 24.0 0.0 9.4 57.8 2012 tr 6.8 29.3 109.2 2013 tr 46.1 49.3 71.0 2014 0.1 7.9 0.1 14.6 2015 15.4 tr 25.3 (blank) if want highlight max. rainfall each month yellow fill. that's simple, set rule highlights top 1 item. but problem highlighting min. rainfall each month green fill. if set rule highlights bottom 1 item, fine feb, mar , apr. (2011 feb, 2014 mar , 2014 apr highlighted.) however, jan, 2014 jan highlighted. expect 2012 , 2013 highlighted trace < 0.1 mm. if add rule highlights cell contains "tr" in addition bottom 1 item rule: 1) january, 2012, 2013, 2014 highlighted (i want 2012&2013) 2) february, both 2011 , 2015 highlighted (i want 2011) i tried following: 1st rule: formula: =and(countblank($b2)=0,$b2=0) --> format green fill [stop if true checked] 2

android - Nexus 5 not being detected on pc -

till yesterday nexus 5 connecting, when last connected brother's computer here's did: trying take 20 gb file comp didn't have enough space, did figure need photos backed em @ comp , pressed ctrl + on internal memory , deleted mean in phone memory make space, took file came home pc , zoink nexus phone not being detected, mean went device manager , there's mtp sign sitting exclamation mark, before here me out. keep short , sweet have read lot of posts done lot of things , none worked, did mtp ptp switch, device manager uninstall , reconnect, turn on usb debug install drivers downloaded google, turn off usb debugging, belive me done of none of em working, m betting has ctrl + delete on internal memory , if wht's solution. i had same problem , here how solded it: on device manager, right-click device entry, , click uninstall on confirm device removal dialog box, click delete driver software device option delete driver package used device. unplug/repl

regex - Perl regular expressions to capture parts of command output -

edited question : have added third function. have come regex seems correct . (1st , 2nd function work expected. ) i have written couple of functions in library, , call functions test script. i'm having issues regular expressions. can me out regular expressions? function 1: sub ipsec_version { ($self) = @_; $cmd = 'sudo -s ipsec version '; $version = 0; #execute command $self->execute($cmd); foreach $line ( @{ $self->get_stdout() } ) { if ( $line =~ m/strongswan/msx ) { $version = $1; } } return $version; } function call: $self->{'ipsec_version'} = $self->{'ipsec_obj'}->ipsec_version(); info('[startup] ipsec version : ' . $self->{'ipsec_version'} ); actual output: use of uninitialized value in concatenation (.) or string @ ... line 37. ipsec version : expected output: strongswan u5.1.2/k3.16.0-30-generic command output: i need s

asp.net - Will my website assemblies always run in the same AppDomain together? -

i have built 2 different user control libraries use on sharepoint 2007 site. 1 provides user controls ecommerce functions, other account dashboard. both of them make use of authenticated users/site membership. so i've built assembly called webaccounts.dll contains of basic, common, account functionality such logging in, logging out, retrieving member data , storing pieces of member data in session. both ecommerce library , account dashboard library reference account , build on top of it. instance, both provide own version of login/logout control captures user credentials, , pass them along webaccounts authenticated , store authenticated member object in session. where i'm lost how iis creates appdomains , instances of these libraries. if place 3 assemblies in bin of sharepoint site, user guaranteed using instances of 3 assemblies contained within same appdomain? or on 1 page might user's request process in appdomain ecommerce , webaccounts loaded, , next request pr

C# Cast list using Linq using Where function -

i'm trying optimize part of function gets objects within unity contains component. current code looks this collider[] collisions = physics.overlapsphere(point, range); foreach (collider item in collisions) { if (item.getcomponent<rigidbody2d>()) { rigidbodies.add(item.getcomponent<rigidbody2d>()); } } first list of objects colliders, run thought foreach loop ones contains rigidbody2d component i'm trying turn single line of code using linq. i'm trying along line collider[] collisions = physics.overlapsphere(point, range); rigidbodies = (list<rigidbody2d>)collisions.tolist().oftype<rigidbody2d>().where(x => x.getcomponent<rigidbody2d>() == true); unfortunately throws invalidcastexception you need add call tolist() on method chain. you'll able rid of cast altogether: rigidbodies = collisions .oftype<rigidbody2d>() .where(x => x.getcomponent<rigidbod

Ember.js - Not sure how to model data -

i'm using restadapter ember data work json payload. part of payload contains data such "links": { "facebook": "http://www.facebook.com/dailypuppy", "twitter": "http://twitter.com/dailypuppy", "officialwebsite": "http://www.dailypuppy.com/" }, i'm not sure how model data. noticed restserializer has normalizepayload function, figured i'd give shot instead of restadapter. used so normalizepayload: function(payload) { payload.facebookurl = payload.links.facebook; payload.twitterurl = payload.links.twitter; payload.myspaceurl = payload.links.myspace; payload.officialwebsiteurl = payload.links.officialwebsite; delete payload.links; return payload; } problem approach restserializer doesn't support findquery method, rely on. error saying tried load query adapter not implement findquery any on appreciated. from you're describing, think, mis-use s

Regex not correctly identifying string (Python) -

i using online regex debugger regexr (www.regexr.com), correctly identifying working , non-working regex's me part. however, stuck on 2 specific regex's regexr identifies working correctly, yet won't work in implementation. first using locate pgp keys, header , footer. regex is: [-]{5}[a-z]{3,5}\spgp\smessage[-]{5}[^.] and using identify: -----begin pgp message----- and -----end pgp message----- my other regex won't work in actual implementation identifying uk passport numbers: \b[0-9]{10}gb[rp][0-9]{7}[umf]{1}[0-9]{9}\b examples work in regexr: 7086493126gbr6510204m150224602 1234567890gbp1234567f123456712 could offer insight why these not work? i think problem final part of regex: [^.] that match character not literal period. don't think intended use it, , cause regex not match beginning , end messages themselves. just clear -- while . metacharacter, within [] it's literal character. as gb passport ids, i'd have se

Spark with custom Hadoop FileSystem -

i have cluster yarn, configured use custom hadoop filesystem in core-site.xml: <property> <name>fs.custom.impl</name> <value>package.of.custom.class.customfilesystem</value> </property> i want run spark job on yarn cluster, reads input rdd customfilesystem: final javapairrdd<string, string> files = sparkcontext.wholetextfiles("custom://path/to/directory"); is there way can without re-configuring spark? i.e. can point spark existing core-site.xml, , best way that? set hadoop_conf_dir directory contains core-site.xml . (this documented in running spark on yarn .) you still need make sure package.of.custom.class.customfilesystem on classpath.

c# - Trying to subtract setup from cost in a NumericUpDown -

i trying subtract setup cost . so, need value numericupdown box , store integer, can use subtract setup from. public partial class form1 : form { int setup = 100; int finalcost; int cost; int priority; public form1() { initializecomponent(); } private void button2_click(object sender, eventargs e) { priority = trackbar1.value; int cost = (int)numericupdown1.value; if (radiobutton1.checked) { finalcost = cost - setup; messagebox.show(finalcost.tostring()); } } set numericupdown maximum property higher 100.

Using enumerate loop to update a list of dicts in python not working as expected -

this question has answer here: list of lists changes reflected across sublists unexpectedly 13 answers i have list of dictionaries in python. want update 1 key:value pair dicts unique values instead of them getting same value. here's code: num_cntxts=4 pkt_eop =[{'type' : 'eop', 'number':1}] pkt_eop_pattern = pkt_eop*num_cntxts #i want add 'cntxt' key each of 4 dicts #which should have value list position i,pkt_eop_inst in enumerate(pkt_eop_pattern): print i,pkt_eop_inst pkt_eop_inst['cntxt']=i >0 {'cntxt': 0, 'type': 'eop', 'number': 1} 1 {'cntxt': 2, 'type': 'eop', 'number': 1} 2 {'cntxt': 4, 'type': 'eop', 'number': 1} 3 {'cntxt': 6, 'type': 'eop', 'number': 1} print statement

phonegap build - Can you upload .ipa files to Testflight without Mac? -

i using phonegap build deploy , test applications. work, had go through elaborated tutorial on creating provision files , certificates , borrow mac make use of keychain. however, registered 1 device udid. now want add more devices, dont want go through whole process again, if have add other devices later? so thinking use testflight, requires upload .ipa file (apart having developers account etc). phonegap build can create these .ipa files. however, since working windows, dont see how can upload .ipa files on testflight. tutorials online talk using xcode , other mac program. is there way upload anyway? hacks might available since apple integrated testflight itunes connect - (at time) not have public api - official solution use xcode or application launcher ipa uploads. both available os x. an alternative solution might use ios ci/cd (continuous integration , delivery) service upload. happen have 1 - bitrise.io , cto here - can find couple of other services well.

c++ - Saving an object of a derivated class in a std::list of an base c -

i'm trying save object of x class, derivated base class y in std::list<y> . x class has stuff y class doesn't has, , when save object std::list , object slicing happens. there more, different classes use y base, simplicity, using 1 storage ideal, thing have different members, using static_cast didn't work expected. there workaround problem? or should give , use different containers each type? keep list of y* . have full virtual function resolution @ disposal and, if needed, can dynamic_cast (although advise against that). the reason latter being there reason why keep list-of-y's in stead of else.

c# - How to test methods where DBContext is created? -

i don't have lot of experience unit testing. example have simple method in application: public void getname() { userrights rights = new userrights(new databasecontext()); string test = rights.lookupnamebyid("12345"); console.writeline(test); } in case i'm able test methods of userrights class passing mocked databasecontext, how can test getname() method? best practice? databasecontext should created? if want test getname method in isolated way (i.e. unit test) can't use new create userrights instance in method itself; because test client of code, therefore can't (and shouldn't) know how getname works internally so means proper unit test must able replace dependencies of method ones client controls - in case, code in unit test client. in posted code, client code has no control @ on userrights nor databasecontext , first thing has change. you need rework code userrights implementation can suppl

html - Problems with moving element CSS -

i'd move element h1 bit down without moving whole div block. html code here: <div class="mainblock"></div> <div class="under"><h1>some text</h1></div> css rules here: .mainblock { margin: 40px auto 0 auto; width: 40%; height: 250px; background-color: cadetblue; } .under { margin: 0 auto; width: 40%; height: 250px; background-color: coral; } h1 { text-align: center; font: 40px/30px tahoma,sans-serif; font-weight: 900; color: azure; /* here add margin h1 */ margin-top: 20px; } how can move h1 tag only? using padding not suitable because adds space , if link created clickable space don't need. use position:relative on h1 element move without affecting position of other elements. h1 { position:relative; top:20px; text-align: center; font: 40px/30px tahoma,sans-serif; font-weight: 900; color: azure; /* here add

php - Wordpress: div enclosing each group of three posts -

in wordpress, want have div wrapping around every 3 posts (because posts in grid, 3 per line, , want each line have uniform height "read more" buttons line @ bottom - http://restartcomputer.com/category/products/mac-products/ ). figured out (logically) how - outlined in accepted answer of question: php loop: add div around every 3 items syntax however, i've tried , cannot code work. divs not added, @ all. here code: if (have_posts()) : $counter = 1; ?> <div class="entries-wrapper"> <?php while (have_posts()) : the_post(); ?> //post stuff <?php if ($counter % 3 == 0) { ?> </div><div class="entries-wrapper"> <?php } $counter += 1; ?> <?php endwhile; ?> </div> //some more code <?php endif; wp_reset_query(); ?> any idea why? you have not entered script (line 4): if (have_posts()) : $counter = 1; ?>

ruby on rails - How to stop double rendering in sidebar? -

Image
the code double rendering so: when should list out once so: ran 1 miles apr journal 1 days apr views/layouts/_stats.html.erb <% @averaged_quantifieds.each |averaged| %> <% averaged.results.each |result| %> <div class="<%= result.good? ? 'green' : 'red' %>"> <li> <%= raw averaged.tag_list.map { |t| link_to t.titleize, tag_path(t) }.join(', ') %><%= link_to edit_quantified_path(averaged) %> <%= averaged.results.first.result_value %> <%= averaged.metric %> <span class="<%= date_value_label_class(result) %>"> <%= averaged.results.first.date_value.strftime("%b") %></span><% end %> </li> </div> <% end %> <% end %> application_controller def set_stats @averaged_quantifieds = current_user.quantifieds.averaged if current_user @instance_quantifieds = current_user.quantifieds.instance if current_u

c - For what reason there are 3 bytes more in structs? Can remove? -

struct things { char foo[25]; int bar; }; struct morethings { char morefoo[25]; int morebar; int another; }; int main() { printf("char[25] + int: %d | struct things: %d\n\n", sizeof(char[25]) + sizeof(int), sizeof(struct things)); printf("char[25] + int + int: %d | struct morethings: %d\n\n", sizeof(char[25]) + sizeof(int) + sizeof(int), sizeof(struct morethings)); return 0; } return: char[25] + int: 29 | struct things: 32 char[25] + int + int: 33 | struct morethings: 36 i believe return of sizeof should same in both cases, struct have 3 bytes. reason happens? can remove? can disrupt i'm doing, save in file structure. it depends on compiler you're using, need like #pragma pack(push) struct things { char foo[25]; int bar; }; #pragma pack(pop). check these links more information gnu compiler gcc microsoft compiler msdn there gcc specific solution, is struct __attrib

scala - How to maintain an immutable list when you impact object linked to each other into this list -

Image
i'm trying code fast non dominated sorting algorithm (nds) of deb used in nsga2 in immutable way using scala. but problem seems more difficult think, simplify here problem make mwe. imagine population of seq[a] , , each a element decorateda list contains pointers other elements of population seq[a] . a function evala(a:decorateda) take list of linkeda contains, , decrement value of each. next take subset list decoratedapopulation of population a, , call evala on each. have problem, because between each iteration on element on subset list decoratedapopulation , need update population of a new decorateda , new updated linkeda contain ... more problematic, each element of population need update of 'linkeda' replace linked element if change ... hum can see, seem complicated maintain linked list synchronized in way. propose solution bottom, need recursion return after each evala new population element replaced. how can correctly in immutable wa

php - Can't seem to get query to work? -

<?php error_reporting(e_all); session_start(); include ('connect.php'); if(!empty($_post['budgetbox'])) { $budgetboxvar = $_post['budgetbox']; $sql="insert users username = '".$_session['usernamebox']."'(budget) values ('$budgetboxvar')"; mysqli_query($db,$sql); } ?> does have idea why code above doesn't work ? seems code works if leave code below out. i'm sorry can't seem figure out how not correct ? i'm not getting error messages either. when take out when username session usernamebox part out.. query input database, not in field of logged in user.. i tried echo if query succeeded doesn't show either.. means query can't executed (i think). can't figure out why though(it's hard being noob sometimes) thank in advance, hope can ! if understand correctly, this: $sql = "update users set budget='".$budgetboxvar."' us

c# - How to use view models for windows inside a DLL -

i'm new wpf. here xaml defining window defined inside dll: <window x:class="mynamespace.myclass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:ignorable="d" xmlns:attachedproperties="clr-namespace:mynamespace.attachedproperties" xmlns:viewmodels="clr-namespace:mynamespace.viewmodels" datacontext="{binding source={staticresource vmlocator}}" title="{binding myvm.mytitle, mode=onetime}" height="300" width="460"> <window.resources> <viewmodels:viewmodellocatorteststeps x:key="vmlocator" d:isdatasource="true" /> </window.reso

Python GUI package with HTML capabilities -

i writing data processing application in end produces html file can openend in browser (chrome,firefox etc.). html file google maps page points plotted (made pygmaps package). want know if there python gui packages support displaying of google maps points plotted inside gui application.