Posts

javascript - Dropdown menu bootstrap multilevel -

Image
i have question: how make navbar text in left in bootstrap? i'd make dropdown menu bootstrap , jquery-menu-aim. dropdown submenu piled up. goal is. and i've done.. can me? in advance. i'm using bootstrap 3.3.4. html file <header> <div class="branding">logo <h3>brand</h3> <!--<div style="clear: both;"></div>--></div> </header> <nav role="navigation" class="navbar navbar-fixed-top"> <div class="container"> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="navbar-left"> <a href="index.html" class="dropdown-toggle" data-toggle="dropdown">product</a> <ul class="dropdown-menu" role="menu"> <li class="search row-sm-3"> ...

javascript - JQuery .click event won't turn back on -

i created panel (div) slides in , out of nav bar. right now, it'll open , close once fine won't respond clicks anymore. $('.work-link').mouseover(function(){ if($('.work-link').css('left') === '0px') { $('.work-link').off('click'); } else if($('.work-link').css('left') === '-750px') { $('.work-link').on('click'); }; }); $('.work-link').on('click', function(){ $('.work-link').animate({left: '0px'}, 600); $('.work-link').css('cursor', 'default'); $('.sort-container').animate({marginleft: '0px'}, 800); $('.exit-sort').fadein(600); $('.port-type').animate({marginright: '140px'}, 600); $('.port-type').text("click x close").fadein(); }); $('.exit-sort').on('click',function(){ $('.work-link...

osx - How to copy input from from the clipboard using pbcopy and setting that to another file that can then be called by pbpaste -

i want data main clipboard onto own file when user executes command can retrieve information set upon second file. alternatively pbcopy direcly second file , run command pbpaste . smarter me tell me how this. have searched hours now. pbpaste reads clipboard/pasteboard , writes stdout (as if pasting), can copy pasteboard file using pbpaste > filename . can whatever want file. pbcopy puts onto pasteboard, if want put file's contents pasteboard can pbcopy < filename . the < , > operators shell redirection operators, can learn more in command-line or unix tutorial.

python - How do I loop through each string in my list? -

i tried piece of code, performs function on first string in list: returns first , last 2 characters of given list of strings def both_ends(list): finallist = [] s in list: if s > 2: return s[0] + s[1] + s[-2] + s[-1] else: return s finallist.append(s) return finallist list = ('apple', 'pizza', 'x', 'joke') print both_ends(string) how make function run through of strings in list? yes, because returning result directly , returns after go through first string itself. instead should put result in finallist create , return result @ end. and other things - as said in other answer, want check length of string. the length of string should greater 4 , otherwise, end adding characters multiple times. do not use names list variables, ends shadowing builtin functions , not able use list() create list after that. last issue should call function list, not string . example - ...

math - Factoring fractions in sympy -

how ask sympy factor x**2 - 3/2*x + 1/2 (x-1)*(x-1/2)? closest i've gotten is: >>> (x**2 - rational(3/2)*x + rational(1/2)).factor() (x - 1)*(2*x - 1)/2 a simple way: in [1]: expr = (x**2 - rational(3/2)*x + rational(1/2)) in [2]: expr out[2]: 2 3*x 1 x - --- + - 2 2 in [3]: fe = factor(expr) in [4]: fe out[4]: (x - 1)*(2*x - 1) ----------------- 2 in [5]: fe.args out[5]: (1/2, x - 1, 2*x - 1) in [6]: fe.args[0]*fe.args[2]*fe.args[1] out[6]: (x - 1)*(x - 1/2) that is, factor expression [3] , product arguments [5] , , multiply them [6] . multiplication in step [6] calls evaluation routines simplify expression, not point of expanding it.

C -Element of a structure changes value after printf() call -

[note using c] have issue when call printf twice in row "garbage data" second time. first printf print out "rajan1" expected, , second printf print out random symbols. i'm not sure if random or maybe address. know why might recieving these results? here snippet code highlights problem (not consecutive printf statements: void main(void) { struct listnode **pstart = (struct listnode**) malloc(sizeof(struct listnode**)); load(pstart); printf(" %s\n",*(*pstart)->data->artist); printf(" %s\n",*(*pstart)->data->artist); } as said output expected string first time(it prints "rajan1") , random second time(ussually symbols). have scoured internet similair problem haven't been able find one. searching indicates may need "free" variable have no idea need free, or possibly unique compiler version unsure of(i using whatever default c compiler in visual studio 2012 ultimate v11.0.61219.00 update 5...

r - How to pick the first comma separated value in a column in data.table? -

courtesy of @jaap's answer this stackoverflow question the data this: name text idx c_org 1: john text contains mit 1 mit 2: sussan text stanford university 2 stanford 3: bill graduated yale, mit, stanford. 3 mit,yale,stanford 4: bill text 4 for column c_org , if there's multiple values, in observation 3, mit,yale,stanford , i'd make first value, mit column value. result should this: name text idx neworg 1: john text contains mit 1 mit 2: sussan text stanford university 2 stanford 3: bill graduated yale, mit, stanford. 3 mit 4: bill text 4 (please note in c_org column, field has more 1 value, empty. in expected output, if there's 1 value, keep it...