Posts

Showing posts from August, 2011

html - Why does my border go over my form? -

when make browser window smaller border not stay around form, instead overlap? sentence. how make border stay around the form , have border height adjust length of form padding? #form_border{ margin: auto; width: 400px; border-style: solid; border-color: black; border-width: 1px; } #form { width: 50%; height: 50%; margin: auto; padding-top: 2em; text-align: center; } #form form{display: block;} #existing_account{ text-align: center; text-decoration: none; color: black; } input[type=submit] { background:white; border:1px solid; border-color: #292929; cursor:pointer; border-radius: 5px; } input[type=submit] { background:white; border:1px solid; bor...

c++ - Why does compilation fail when a function template calls a static method template of a class template? -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i don't understand why succeeds when calling static method template directly, not when calling through function template. #include <iostream> #include <type_traits> template <typename a> class test { public: template <typename b> static void test() { if (std::is_same<a, b>::value) std::cout << "type , type b same\n"; else std::cout << "type , type b not same\n"; } }; template <typename c, typename d> void test() { test<c>::test<d>(); } int main(int argc, char* argv[]) { test<int>::test<int>(); test<int>::test<char>(); test<int, char>(); test<int, int>(); ret...

if statement - Why does my program give me the excess output? C program -

i've made program cheque generator. whatever amount input in scanf output in words. example if to input "1234.56" output "one thousand 2 hundred thirty 4 dollars , ... 56 cents", or if wanted input amount "0.01" output "zero dollars , ... 1 cents". program works perfectly, there minor issue , if wanted input amount "9909" output " nine thousand 9 hundred ninety 9 dollars , ... 0 cents ". output should " nine thousand 9 hundred 9 dollars , ... 0 cents ". please help! the code follows: #include <stdio.h> void printnum(int); void printnum2(int); int main() { int = 0; int b = 0; int c = 0; int d = 0; int num = 0; int printcents; //to convert float "cents" integer. float inclusive; float cents; printf("welcome ipc144 cheque generator!!\n"); printf("pay order of... amahmood29 (018359133)\n"); printf("enter monetary value...

Brackets can't find Chromium in Windows -

i have chromium chromium.woolyss.com brackets cannot find live preview. should make type of chrome symlink chromium? file -> "enable experimental live preview" makes work.

Meteor Accounts-UI-Bootstrap - Popups don't close -

i'm learning javascript & meteor , trying out bootstrap accounts package https://github.com/ianmartorell/meteor-accounts-ui-bootstrap-3/ if attempt oauth google, facebook, or twitter popup window verifying access app respective services ( assume setup on services , callback url correct ). once ok access, popup window blank, , doesn't close. i'm running on localhost testing, if makes difference. where start debugging issue? you having problems root_url setting. needs match the domain , protocol user seeing. means can initiate logins http://yoursite.com or https://yoursite.com , since root_url setting needs match site , protocol/port, have choose either 1 , redirect users right 1 before initiating login. usually not problem when developing locally meteor deals automatically ... sure supplying info here? problem comes when have deployed app somewhere, perhaps behind web proxy , meteor unable ports right. this meteor-talk discussion has lots of rel...

ef code first - Entity Framework Migrations: Prevent dropping column or table -

if ef migration decides rename column (or table ), fulfills dropping (old) column , adding column new name. leads data loss. is there way prevent ef migration dropping column , force use renamecolumn instead? well, didn't find clear , straightforward solution. my solution hiding dbmigration class every migration generated using code-based migration derived from. introducing new class same name ( dbmigration ). put inside same assembly , same namespace code files reside. way, reference of code files original dbmigration goes fake dbmigration . then, can prevent dropping column or allow through explicit request: namespace myproject.dal.migrations { /// <summary> /// customized dbmigration protect columns dropped accidentally /// </summary> public abstract class dbmigration : global::system.data.entity.migrations.dbmigration { public bool allodropcolumn { get; set; } protected internal new void dropcolumn(stri...

ember.js - Difference between emberjs and ember-cli -

ember-cli adds generators similar ones rails , ask if there difference between 2 libraries/frameworks. ember cli build system / tool belt use ember. ember-cli preferred way of working ember application introduces standardizations in directory structures , build process. the documents of 1.11.x refer directory structures ember-cli setup , keep consistent project project , addon addon. it provides watching (auto building on change) , live reload capabilities it has generators mentioned generate test stubs , ensure stuff in proper folders. it provides of tooling started tests quickly. sets test runners , plenty of helpers make writing tests quick , easy. it provides addon ecosystem makes addons ember consistent , easy produce , consume skill levels might best peruse documents , check out of capabilities http://www.ember-cli.com/

ruby - DRY code using Rspec matchers -

i want improve following block of code more readable/concise/dry (my actual arguments bit more complicated #have_css ): negate ? expect(page).to(have_css('selector', text: 'text')): expect(page).to_not(have_css('selector', text: 'text')) is there anyway store 'selector', text: 'text' in variable reused method arguments? or alternatively there special trick call correct matcher based on negate boolean value? perhaps similar expectation = negate ? :should_not : :should page.send(expectation, have_css('selector', text: 'text'))` but using new rspec expect syntax? you can store arguments used more once in array, splat ( * ) them argument list: css_args = ['selector', {text: 'text'}] expect(page).to(have_css(*css_args)) you can pick matcher negate so: expectation = negate ? :to_not : :to expect(page).send(expectation, have_css('selector', text: 'text'))

c# - Showing and closing a usercontrol using javascript -

i have asp.net application did not write trying modify. it contains aspx page contains data grid , usercontrol. page starts life items in datagrid, , allows user chose item edit, user can click on edit button causes usercontrol open in modal fashion using javascript. on user control, user can edit details , can finish clicking on close button or save button. at point usercontrol stays on page - want disappear , show me page behind - i.e. page datagrid of items. also, 1 of items has changed, want refresh grid. the html code have in main file (mytest.aspx) like: : : <%@ register tagprefix="uc" tagname="mymodal" src="~/usercontrols/mymodal.ascx" %> : : <script language="javascript" type="text/javascript"> function openusermodal() { $("#mdlmycontrol").modal({ 'show': true, 'backdrop': "static", 'keyboard': false }); } </script> : : <asp:button ...

Trouble connecting to SQL server with python -

i have installed microsoft sql server 2014 on pc want create database web application building (i have been learning python year , have basic experience sqlite). after installing sql server 2014 , creating database called users, trying run basic commands database falling @ first hurdle on , over! i have installed pymssql , pyodbc , tried running commands directly these have failed. (e.g. pymssql gives me typeerror: argument of type 'nonetype' not iterable when set variable conn = pymssql.connect(server, user, password, "tempdb") my latest attempt use sqlalchemy achieve long awaited connection sql database. however, after installing this, failing on following error: "sqlalchemy.exc.operationalerror: (pymssql.operationalerror) (20009, 'db-lib error message 20009, severity 9:\nunable connect: adaptive server unavailable or not exist\nnet-lib error during unknown error (10035)\n')" the question need answering is, how start talking database us...

ruby - Failed to load SASS plugin -

i'm using gulp , sass , compass sass-css-importer in order build project. today i've tried initialize project on 1 of ubuntu 15.04 machines, during build couldn't find sass-css-importer . here's error message: loaderror on line ["179"] of /home/sfomin/.rvm/gems/ruby-2.2.2/gems/compass-core-1.0.3/lib/compass/configuration/data.rb: cannot load such file -- sass-css-importer run --trace see full backtrace i've installed ruby via rvm , dependencies via bundler . $ bundler list gems included bundle: * bundler (1.10.3) * sass (3.4.14) * sass-css-importer (1.0.0.beta.0) and i'm invoking compass through gulp task. i'm not sure cause problem such amount of third-parties involved. i'm not ruby myself. any advice highly appreciated. $ cat /etc/issue ubuntu 15.04 \n \l $ uname -a linux destiny 3.19.0-20-generic #20-ubuntu smp fri may 29 10:10:47 utc 2015 x86_64 x86_64 x86_64 gnu/linux $ rvm --version rvm 1.26.11 (latest)...

twitter bootstrap 3 - form-horizontal not working with django-crispy-forms and django-registration-redux -

disclaimer: i'm complete novice django , python. i'm using crispy forms django registration redux. i've applied form-horizontal subclass of registration form doesn't render labels on same line input fields can see here: http://imgur.com/hdrpei9 i've hard coded form-horizontal html in template shifts form contents outside of container: http://imgur.com/kqikq7q i've tried creating sublclass form called supplyhelixregistrationform includes label , field classes crispy forms docs says include: (would include link don't have enough reputation) part of forms.py registration redux app includes modifications: from crispy_forms.helper import formhelper crispy_forms.layout import layout, div, submit, html, button, row, field crispy_forms.bootstrap import appendedtext, prependedtext, formactions user = usermodel() class registrationform(usercreationform): required_css_class = 'required' email = forms.emailfield(label=_("e-ma...

c++ - Name lookup for local class members inside templates -

consider following code, simulates constexpr lambda (proposed c++17, not available in c++14). #include <iostream> template<int m, class pred> constexpr auto fun(pred pred) { return pred(1) <= m; } template<int m> struct c { template<int n> static constexpr auto pred(int x) noexcept { // simulate constexpr lambda (not allowed in c++14) struct lambda { int n_, x_; constexpr auto operator()(int y) const noexcept { return this->n_ * this->x_ + y; // ^^^^ ^^^^ <---- here } }; return fun<m>(lambda{n, x}); } }; int main() { constexpr auto res = c<7>::template pred<2>(3); std::cout << res; // prints 1, since 2 * 3 + 1 <= 7; } here, lambda defined inside function template ...

javascript - Sending data using Ajax data not sending to PHP -

i'm trying use ajax send form data, on php page it's not echoing. i'm new ajax not sure if have done wrong it. here's have: $(function () { $('form').on('submit', function (e) { e.preventdefault(); $.ajax({ type: 'post', url: 'two.php', data: $('form').serialize(), success: function () { alert('form submitted'); } }); }); }); one of form fields has name="selection" , id="selection" in two.php i'm trying simply: echo $_post['selection']; but nothing set. ideas? you should passing response (from two.php) success callback: success: function ( response ) { alert( 'submitted data: ' + response ); } which should work provided selection set. (check in console under network requests confirm this) also, consider adding error callback: error: function( res...

for loop - How to find all files that don't contain a string? -

i've found following code on site: @echo off setlocal set "rootfolder=c:\yourrootpath" set "filemask=*.txt" set "outfile=missing.txt" >"%outfile%" ( /d %%d in ("%rootfolder%") %%f in ("%%d\%filemask%") ( findstr /nbr "$o..*\.min%%" "%%f" | findstr /bl "1:" >nul || echo %%f ) ) however, when run batch file, receive following error: "for unexpected @ time." my research says caused not using double %% , not case. guess simple, can't work out, tips please? this method should run faster: @echo off setlocal set "rootfolder=c:\yourrootpath" set "filemask=*.txt" set "outfile=%~p0missing.txt" cd "%rootfolder%" findstr /s /m /b /r "$o..*\.min%%" "%filemask%" > temp.tmp ( dir /s /a-d /b "%filemask%" | findstr /v /g:temp.tmp ) > "%outfile%" del temp.tmp the missing.t...

iphone - valid iOS Distribution Cetificate - developer name change -

here's how i've been led path. i started on macbook, standard developer account. submitted few applications. moved imac, same developer account. submitted few applications. now, developer account company account i.e, got name changed company name. however, cannot submit app store. your account has valid ios distribution certificate i cannot past hurdle! i'll try , explain profiles , signing identities have in developer account. certificates company name - ios distribution my old account name and/or actual name - ios development app ids application name - correct bundle identifier provisioning profiles iosteam provisioning profile: app-name - ios development app name - ios distribution - active ( correct app id , correct certification distribution ) all of these certificates locally in keychain. however, cannot work. appreciated, i'm having absolute nightmare. the certificate used prove person (signed and) submitted app. apple r...

javascript - jQuery Datatables get first displayed row custom attribute -

i need first displayed row value of data-rownum attribute when next page event if fired. my html table: <tr data-rownum="1">some text</tr> <tr data-rownum="2">some text</tr> <tr data-rownum="3">some text</tr> here code use, not getting value, object. $('#historico').on( 'page.dt search.dt order.dt', function () { alert(tabla.row( 0 ).data('rownum')); } ); you need use row().node() row tr node , to$() convert jquery object. argument { 'order': 'current', 'search': 'applied', 'page': 'current'} selector-modifier row() api function used retrieve row current page sorting , filtering applied. $('#historico').on( 'page.dt search.dt order.dt', function () { alert( tabla .row( 0, { 'order': 'current', 'search': 'applied', 'page': 'current'} ...

Can we create stored procedure in ms access 2007 -

this question has answer here: can make stored procedure or function in access 2003? 2 answers how can create stored procedure in ms access 2007. if can how should write procedure insert statement. it not possible create stored procedures in ms access 2007. need access 2013 - https://msdn.microsoft.com/en-us/library/office/ff845861(v=office.15).aspx

hadoop - Hive(Bigdata)- difference between bucketing and indexing -

what main difference between bucketing , indexing of table in hive? the main difference goal: indexing the goal of hive indexing improve speed of query lookup on columns of table. without index, queries predicates 'where tab1.col1 = 10' load entire table or partition , process rows. if index exists col1, portion of file needs loaded , processed. indexes become more essential when tables grow extremely large, , undoubtedly know, hive thrives on large tables. bucketing it used join operations, because can optimize joins bucketing records specific 'key' or 'id'. in way, when want join operation, records same 'key' in same bucket , join operation faster. can see technique decomposing data sets more manageable parts. link gives 5 tips efficient hive queries , 1 of them bucketing.

WPF Video loop from point a to b -

is there way loop video in wpf point b? & b indicates time. example want loop video & loop starts 1 minute of video , ends @ 2 minute of video. xaml <mediaelement x:name="myvideo" loaded="myvideo_loaded" loadedbehavior="manual" source="c:\somefolder\somevideo.mp4" /> codebehind public partial class mainwindow : window { private dispatchertimer dispatchertimer; /// <summary> /// initializes new instance of mainwindow class. /// </summary> public mainwindow() { initializecomponent(); //set dispatchertimer tick interval of 1 minute dispatchertimer = new dispatchertimer(); dispatchertimer.tick += new eventhandler(dispatchertimer_tick); dispatchertimer.interval = new timespan(0, 1, 0); } //occurs when mediaelement loaded private void myvideo_loaded(object sender, routedeventargs e) { ...

ruby - Best way to implement superclass subclass model based design in rails database? -

suppose designing database online-shop, sell different kind of items. every item has own distinct property, beside few in common price, manufacturer, etc. can segregated superclass (common fields) , subclass (distinct fields) say have following tables: product manufacturer:decimal pen ink:string shirt size:int making product_id field in both pen , shirt table solve problem, there other way that? , idea here segregate superclass , subclass? the common approach in situation use single table inheritance( sti ). product base class: class product < activerecord::base end and pen / shirt subclasses: class pen < product end class shirt < product end usually information being stored in base product table(that why it's single table inheritance) , differentiated of special type column(of course have nil s in ink field shirts). if want store common fields in product s table, can create separate tables subclasses. then, think need not specify t...

javascript - Visualforce page is not refreshing after deleting a row from table -

script: function dodelete(id,deleted) { /*alert("userid");*/ $("input[id$='hduserid']").val(id); $("input[id$='hdndeleted']").val(deleted); //alert(id); //alert(deleted); setparams(id,deleted); //setinterval(50000); alert('record deleted successfully!'); } page: </tr> <apex:repeat value="{!staffinfo.staffaccepted}" var="u" id="staffaccepted" rendered="{!staffinfo.staffaccepted.size <> 0 && staffinfo.staffaccepted.size <> null}"> <tr> <td>{!u.fullname}</td> <td>{!u.email}</td> <td>{!$label[u.role]}</td> <td>{!$label[u.regtype]}</td> <td> <a href="#" class="reset" onclick="doresetpassword('{!u.contact}');return false;">{!$label.pg_approvalprocess_reset}</a>/ <apex:out...

javascript - Highcharts position polar area labels around outside -

i'm creating polar area chart in highcharts. can't seem on issue of labels colliding eachother when chart segments smaller others (if turn off allowoverlap disappear). possible arrange labels around outside of circle? need keep chart responsive or else i'd absolutely position them. chart: { polar: true, backgroundcolor: 'transparent', plotborderwidth: null, margin: [0, 0, 0, 0], spacingtop: 0, spacingbottom: 0, spacingleft: 0, spacingright: 0 } here's have far: http://jsfiddle.net/u9w5hasw/ i've tried creating new column series every value set 10 squishes data had. tried line series labels labels position in center of point, not outside circle, obscured color fill.

ms access - Return True if specific value exists in table - sql -

i want create sql query return true if specific value exists in specific column; if not, return false. i know can create 'select somewhere something' . in case don't want select anything, check. my question how can it. you can use iif function : select iif(something = 'some value', true, false) somewhere;

c# - How to protect a Web API from data retrieval not from the resource owner -

i have asp.net web api. i want own selfhost web api later on azure website. a logged in user in browser /api/bankaccounts/3 to details bank account number 3 . but logged in user not owner of bank account number 3 . how have design controllers , services behind logged in user can retrieve/modify own resources in database? update after created a: public class useractionsauthorizationfilter : authorizationfilterattribute { public override void onauthorization(httpactioncontext actioncontext) { if (actioncontext != null) { bool canuserexecuteaction = isresourceowner(actioncontext); // stop propagation } } private bool isresourceowner(httpactioncontext actioncontext) { var principal = (claimsprincipal)thread.currentprincipal; var useridauthenticated = convert.toint32(principal.claims.single(c => c.type == claimtypes.sid).value); int targetid = convert.toint32(actio...

ruby on rails - generate connected models with the primary at the same time -

i have model user. have model user_info. 1 user has 1 record in user_info , every user_info record belongs 1 user. want when create new user empty record in user_info created. user.rb has_one :user_info, :dependent => :destroy user_info.rb belongs_to :user validates :user_id, presence: true, uniqueness: true user_controller.rb @user = user.new(user_params) @user.user_info.new <----- error "undefined method `new' nil:nilclass" if @user.save......... the table :users has column :user_info_id , table :user_infos has column :user_id what do wrong? i have found answer here: rails 3 undefined method `create' nil:nilclass error while trying create related object when use has_one, don't use .create has_many. because relation object directly returned, , not "proxy" method has_many. equivalent method create_profile (or create_x x object)

java - Android project: errors after changing machine -

so more halfway through book, android programming: big nerd ranch guide , , finished criminalintent app when had change desktop laptop. copied workspace , installed eclipse , sdk. logcat gives me when trying add new crime: 06-13 09:10:47.720: e/androidruntime(535): java.lang.nullpointerexception 06-13 09:10:47.720: e/androidruntime(535): @ com.bignerdranch.android.criminalintent.crimefragment.oncreateview(crimefragment.java:102) 06-13 09:10:47.720: e/androidruntime(535): @ android.support.v4.app.fragment.performcreateview(fragment.java:1789) 06-13 09:10:47.720: e/androidruntime(535): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:955) 06-13 09:10:47.720: e/androidruntime(535): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1138) 06-13 09:10:47.720: e/androidruntime(535): @ android.support.v4.app.backstackrecord.run(backstackrecord.java:740) 06-13 09:10:47.720: e/androidruntime(535): @ android.support.v4.app.frag...

spring - Calling stored function in hibernate -

i have tried multiple ways call stored function in hibernate--- 1) via session.dowork callback method session.dowork(new work() { @override public void execute(connection conn) throws sqlexception { callablestatement stmt = conn.preparecall("{? = call test(?)}"); stmt.registeroutparameter(1, types.integer); stmt.setstring(2, "callindex"); stmt.execute(); eventval = stmt.getint(1); } }); this works fine cannot return thing here, doesn't solve purpose. 2) via native query stringbuilder query = new stringbuilder(); query.append("s...

php - Zend Framework 2 - Showing the content of a database -

i'm making kind of market site zend framework 2. home got slider showing products (realized css3 keyframes) , text. both sliding pictures , text read mysql database. result, no output no errors. slider gets many pictures database rows, still no content echoed; plus if try change things (like db credentials or getter functions in model) throws errors expected, reads db , problem elsewhere. db text has 3 fields: id name text model text (home.php; there's homeinterface.php defining functions) <?php namespace site\model; class home implements homeinterface { protected $id; protected $name; protected $text; public function getid() { return $this->id; } public function getname() { return $this->name; } public function gettext() { return $this->text; } } ?> mapper text <?php namespace site\mapper; use site\model\homeinterface; use zend\db\adapter\adapterinterface; ...

Swift and C Interop -

i want interoperate swift firebird database. there function named fb_interpret following header. sc_long isc_export fb_interpret(isc_schar*, unsigned int, const isc_status**); the first 2 parameters clear me, third don't see how write pendant in swift. tried lot compile error on line. var status = [clong](count: 20, repeatedvalue: 0) var buffer = [cchar](count: 1024, repeatedvalue: 0) let r = fb_interpret(&buffer, 0, &status) i know isc_status typedef long intptr_t; typedef unsigned long uintptr_t; typedef intptr_t isc_status;

How to undo "git revert head"? -

i wanted discard changes in current branch , without committing, accidentally entered command git revert head . changes in prev branch (committed earlier) appear lost? how can undo a git revert head command? you can do git reset --hard head~1 it take commit before current head.

ruby - Rendering JSON for multiple Rails objects -

this might terribly simple question, noticed bothering me. i'm trying render json 1 of controller's methods, it's giving me "undefined method `new' nil:nilclass" error. here's code that's causing problem: def index @users = user.all render json: @users end i noticed when try render 1 object json, works fine: def show @user = user.find(params[:id]) render json: @user end or when call to_json on @users object: def index @users = user.all render json: @users.to_json end i under impression calling render json: implicitly calling to_json anyway, why calling twice solve issue? i believe it's issue @users being array of objects needs each object converted first before whole array reassembled , output json.

How to post json data using angularjs? -

i try below logic, not working. in angular js: $scope.save = function () { var items = $scope.invoice.items; var obj = [{ smembercode: 'alma0502' }]; var request = $http({ method: "post", url: sserviceurl + 'savedata', data: obj }); }; in wcf service : [operationcontract] [webinvoke(uritemplate = "savedata", requestformat = webmessageformat.json, responseformat = webmessageformat.json, method = "post")] bool savedata(wcfservice1.common obj); please tell me wrong... try this this.post = function (itemdetails) { $http.post('http://localhost:4191/service1.svc/additemmaster', itemdetails). success(function (data) { console.log('data', data); // when call successful code here }). error(function (err){ console.log('error:', err); }); }; did inject $htt...

java - JFileChooser not opening on tomcat server but it opens when it runs using eclipse -

i have created web application in struts 2 , want folder chooser activates after click on brows button have created class generate window using jfilechooser. public class folderpath extends jpanel{ private string pathd; public string folderpath() { jfilechooser chooser = new jfilechooser(); chooser.setcurrentdirectory(new java.io.file(".")); chooser.setdialogtitle("choose directory"); chooser.setfileselectionmode(jfilechooser.directories_only); chooser.setacceptallfilefilterused(false); if (chooser.showopendialog(null) == jfilechooser.approve_option) { setpathd((chooser.getcurrentdirectory()).tostring()); return "success"; } return "success"; } public string getpathd() { return pathd; } public void setpathd(string pathd) { this.pathd = pathd; } } but work fin...

.net - Should I write unit tests for unimpemented methods? -

we have created interface our repository classes have common methods. there scenario new repository created not need implement method in interface. in scenario, have written method in our repository class throw notimplementedexception . worth writing unit tests method? if yes, better use expectedexception attribute? yes, should write test method, shouldn't take long if you're testing other methods in class. writing test helps document conscious decision not implement method, not forgotten. acts reminder if in future comes along , implements method need write tests it. as far expectedexception attribute goes, it's subjective. use it, other people use time. should use whatever approach common within rest of tests checking exceptions.

javascript - passing looping data through ajax data -

my form contains hidden input looping. in case, declare hidden input in ajax data manually without looping. how loop them in ajax data? here's form script <form method="post" name="myform"> <?php for($i=1;$i<=5;$i++) { ?> <input type="hidden" name="data<?php echo $i; ?>" value="data<?php echo $i; ?>"> <?php } ?> <input type='button' name='submitdata' value='submit' onclick='submitdata();'> </form> here's ajax script function submitdata() { var form = document.myform; $.ajax({ url: 'process.php', type: 'post', data: { data1 : form["data1"].value, data2 : form["data2"].value, data3 : form["data3"].value, data4 : form["data4"].value, data5 : form["data5"].value }, success: ...

html - CSS3 Flexbox spacing between items -

Image
being new flexbox (although experienced in css), seems me 1 thing conveniently "glossed over" tutorials i've read spacing between flex items. for example, 1 of cited tutorials this 1 @ css tricks . it's , has been helpful, diagrams have thrown me off: notice spaces between flex items. although not mentioned anywhere, nor in sample code, seem way spaces css margins. correct, or missing important here? because need create this, lot "center" demo above: however, when try myself, of course this: if use space-around, instead. huge space. therefore seems need add margin-right first 2 boxes 3 centered boxes small gap between them. is bad use case flexbox? because see little advantage creating 3 boxes flexbox on using simple margins , centering. am missing obvious here? nope - you're not missing anything. flexbox terrific ordering elements , defining general alignment of elements along either main or cross axes, doesn'...

maximum sum of value from root to leaf in a binary tree using stack -

i trying find maximum sum of value root leaf nodes in binary tree using stack. wrote following code there bug in . <> stacks s; s.push(root); maxsum=currsum=0; while(!s.isempty()) { temp = s.top(); s.pop(); if( temp->left == null && temp->right == null ) { currsum = currsum+temp->data; if(currsum > maxsum) { maxsum = currsum; } currsum =0; } else { currsum = currsum + temp->data; if(temp->left) s.push(temp->left); if(temp->right) s.push(temp->right); } } what trying calculate sum till leaf node , assign maxsum. ex:- binary tree 1 / \ 2 3 / \ 4 5 1)i first push 1 , pop . currsum =1; 2) push 3 , 2 , pop 2. cursum = 3 , push 5 , 4; 3) stack looks 4<-5-<3-<1 (4 top element) 4)now 4 leaf node , enter if loop , add currsum = 3+4=7 , pop 4 . 5)now temp 5 , set...

javascript - Grid Element initialising vertically Gridster.js -

Image
well using gridster.js make dashboard environment , wrote following code. problem elements stack vertically when want them initialised according row , col numbers specified in html tag attributes 'data-row' , 'data-col'. i checked console there no js errors. after page loaded , elements stacked vertically can still drag them , can formed grid dragging 1 after other. please can tell me doing wrong not getting elements stacked in grid format when page loads. here image of output: here code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>gridster test page</title> </head> <body> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <link href="../third party libraries/gridster/gridster.min.css"></link> <script src="../third party libraries/gridster/gridster.min.js"></script> <script> va...

jquery - Draw lines between divs using css border -

Image
this below "jquery plugin adds stylable connecting lines using css border among block elements of page, web based mind map or project flow." i trying use when do, connects every box every box. can't connect 1 or 1 2 others. this get. please check out link below. http://www.jqueryscript.net/layout/add-connecting-lines-between-block-elements-connections.html code i'm using: <table> <td/> <td/> <th>example <tr> <td/> <th>example</th> <td/> <td/> <th>example</th> </tr> <th>example</th> <td/> <td/> <td/> <td/> <th>example</th> <tr> <td/> <td/> <th>example</th> </tr> </table> my full code is: <!doctype html> <style> th { width: 64px; height: 64px; background: white; border: 1px solid ...

node.js - Mongoose Plugin - schema.add to Subschema -

i writing mongoose plugin involves adding elements subschema. thinking quite straightforward, i've been trying unsuccessfully few days now. below simplification of schema: var inheritables = require('./inheritables.server.module.js'); var oufieldtypeschema = new schema({ name: string, desc: string }); var oufieldtype = mongoose.model('oufieldtype', oufieldtypeschema); var ouschema = new schema({ name: string, fieldtypes: [oufieldtypeschema], }); ouschema.plugin(inheritables, {inherit: ['fieldtypes']}); mongoose.model('ou', ouschema); within body of mongoose plugin, i'd iterate on "inherit" array , add following schemas represent each of these elements in ou schema; a simplification of plugin follows: var _ = require('lodash'); module.exports = exports = function(schema, options) { _.each(options.inherit, function(curritemschema){ var addtoschema = {inheritedfrom: {name: string}}; //r...