Posts

Showing posts from June, 2014

python - Creating a new virtualenv gives a permissions error -

i'm getting following output when running virtualenv newvenv . traceback (most recent call last): file "/usr/local/bin/virtualenv", line 5, in <module> pkg_resources import load_entry_point file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <module> add_activation_listener(lambda dist: dist.activate()) file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 700, in subscribe callback(dist) file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2727, in <lambda> add_activation_listener(lambda dist: dist.activate()) file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2227, in activate self.insert_on(path) file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2334, in insert_on self.check_version_conflict() file "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2373, in check_version_conflict...

c++ - How to move elements in doubly linked list? -

Image
i have custom list (doubly linked list , not std::list) implemented in code. requirement move element 1 left or right updating references. possible? class elem { elem *next; elem *prev; } ....... void move_element_left(elem *e) { if(e->prev()==null) return; //left ... return elem *left = e->prev(); left->next() = e->next(); e->prev() = left->prev(); if (left->next()) left->next()->prev() = left; if (e->prev()) e->prev()->next() = e; e->next() = left; left->prev() = e; } ....... int main() { elemlist ls; ... ... move_element_left(e); //e of type elem * ... } above code works except 2nd object in list want move left (or top most). (i.e. if list(obj5, obj9, obj11, obj12,..), moving obj9 first in list gives error) works designed ? following code in schema, shows works designed: void move_element_left(elem *e) { if(e-...

javascript - Why angularJS fails to listen text input when using setInterval() method? -

here code <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <body ng-app="" style="background:{{val}};" id="body"> <input type="text" ng-model="val" id="color-input"> <input type="button" onclick="render()" value="render"> </body> <script> function render(){ setinterval(function(){mytimer()},5000); } var i=0; function mytimer() { if(i<4){ colors=["red","green","blue","grey"]; document.getelementbyid("color-input").value=colors[i]; i++; } else i=0; } </script> i using timer of 5sec. when press render button background color of body ...

android development: how does my intent / icon get added to user's list like other social media in Android -

i allow users highlight text , post web site. there way create android intent running service show on social media / share list appears in android system? you know, when user selects picture , 3 dotted share icon appears , gives list? how can application's intent , icon added list twitter, fb etc. ones show up? to receive data external application in application vis share functionality, need create activity in application accept incoming data. add following details in androidmanifest.xml activity accept data: <activity android:name=".ui.myactivity" > <intent-filter> <action android:name="android.intent.action.send" /> <category android:name="android.intent.category.default" /> <data android:mimetype="image/*" /> </intent-filter> </activity> so , if application, shares single image, application visible in list, , if user selects application, ui.myac...

c++ - how to fetch and assign a list of strings which are values of map -

below mentioned map, stored list of string based on string key. std::map<std::string, std::list<std::string>>mapheadertofields; list<string> strlist; now return list, , assign return list newly created list variable. how can that? i tried achieve using below mentioned code snippet. but,i couldn't able assign list. suggestions on how approach on problem. for (iteheadertofield = mapheadertofields.begin(); iteheadertofield != mapheadertofields.end(); iteheadertofield++) { cout << "key :" << iteheadertofield->first<<endl; strlist.assign((iteheadertofield->second.begin(),(iteheadertofield->second.end()); ((_mapheadertofields.find((iteheadertofield)->first))); } i tried fetch second element map , assigned list.but, couldn't able assign list. compiler throwing error when assigned list. is there other way can make it? you can use std::list 's copy assignment ...

php - Rewrite folders and Remove the trailing slash at the end -

i'm trying have 1 url without trailing slash @ end of urls/folders, @ same time want re-write folder use dynamic pages, example: if have: mydomain.com/folder mydomain.com/folder/ and mydomain.com/folder/second mydomain.com/folder/second/ then want open "mydomain.com/folder" , "mydomain.com/folder/second" , urls should open dynamic pages. trying, not work, crash page: rewriteengine on rewriterule ^(.*)/$ /$1 [l] rewriterule ^(.*)$ includes/category.php?url=$1&pagetype=category [l] rewriterule ^(.*)/(.*)/$ /$1/$2 [l] rewriterule ^(.*)/(.*)$ includes/subcategory.php?url=$1&pagetype=subcategory [l] what doing wrong? can me run right syntax please? you need redirect trailing slash url's instead of rewriting them. need add conditions rules: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] rewritecond %{request_filename} !-f rewritecond %{req...

c - Program stuck on Pipe (exec ls grep sort) -

i'm trying make program executes following commands connecting output of 1 input of next using pipes , taking 2 arguments dir (directory) , arg (filetype, example: jpg). ls dir -lar | grep arg | sort here's code: int main(int argc, char *argv[]) { if (argc != 3) { printf("invalid arguments. <dir> <arg>\n"); exit(1); } int pipe_fd1[2]; int pipe_fd2[2]; pid_t ls_pid, grep_pid; int status; pipe(pipe_fd1); pipe(pipe_fd2); ls_pid = fork(); if (ls_pid == 0) { //first child ls dir -lar dup2(pipe_fd1[1], stdout_fileno); close(pipe_fd1[0]); execlp("ls", "ls", argv[1], "-lar", null); } else if (ls_pid > 0) { grep_pid = fork(); if (grep_pid == 0) { //second child grep arg dup2(pipe_fd1[0], stdin_fileno); dup2(pipe_fd2[1], stdout_fileno); close(pipe_fd1[1]); close...

Usage of 'and' in Python -

this question has answer here: python , / or operators return value 4 answers i'm maintaining large codebase , found looks in python code: ... foo = bar(a, b, c) , foo return foo ... where foo assigned boolean, , declared first time here. mean/what purpose serve/what's going on here? python short circuit evaluation c does. this means in "and" case, right side of and evaluated if left side true. so code equivalent to: x = bar(a, b, c) if x: foo = foo else: foo = x return foo with distinction of course, variable x not used (since not needed). the important fact note here is, example if foo set "stringval" , bar(a,b,c) returns can interpreted true, "stringval" returned. unlike in other languages, boolean expression can have non-boolean result.

python - Can not get params from URL - why is my cgi.FieldStorage() empty? -

i cant parameters url. after reading numerous posts on web nothing seems answer question... i have simple html file: <html> <head> </head> <body> <form action="test.py" method="get"> name: <input id="person_name" type="text" name="person_name" > <input id="submit_button" type="submit" value="submit" > </form> </body> and python script looks this: import cgi, cgitb form = cgi.fieldstorage() name = str( form.getvalue('person_name') ) print ("content-type:text/html\n\n") print ("<html>") print ("<head>") print ("</head>") print ("<body>") print ("hello " + name ) print("<br/>") print ("all params: " + str(form) ) print ("</body>") print (...

Netlogo editor for Eclipse -

i see making custom editor eclipse quite involved. before roll own editor/plug-in netlogo wondering if else has done already? alternatively, see eclipse editor quite involved produces complete end product. want that's keyword , indentation aware. inasmuch that's simpler project... too. finally, links can read on building 1 myself appreciated. mike

Javascript find adjacencies -

i have "class" called block . possesses 3 variables : x , y , , z , three-dimensional coordinates, respectively. having trouble finding number of "neighbours" block. is, if this shares face, edge, or vertex other , should return true. so, block.neighbours() returns number of neighbours block . however, returning 0 rather expected 1 . code shown below: var blocks = []; function block(x, y, z) { blocks.push(this); this.x = x; this.y = y; this.z = z; this.neighbours = function() { var n = 0; (var block in blocks) { if (block == this) { continue; } if (math.abs(block.x - this.x) <= 1 && math.abs(block.y - this.y) <= 1 && math.abs(block.z - this.z) <= 1) { n++; } } return n; }; } var b1 = new block(0, 0, 0); var b2 = new block(0, 1, 0); document.getelementbyid("box").innerhtml = b1.neighbours(); why function returni...

textview - Null Object Preferences Edittext on Android -

i new android programming. @ bottleneck. trying chatapp. when click item these errors occur : java.lang.nullpointerexception: attempt invoke virtual method 'void android.widget.edittext.setinputtype(int)' on null object reference @ com.senturk.fatih.chat03.chat.oncreate(chat.java:55) and here line 55 txt.setinputtype(inputtype.type_class_text|inputtype.type_text_flag_multi_line); and guess should add line txt=(edittext)findviewbyid(r.id.text); thanks favor , private arraylist<conversation> convlist; private chatadapter adp; private edittext txt; private string buddy; private date lstmsgdate; private boolean isrunning; private static handler handler; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.chat); convlist=new arraylist<conversation>(); listview list=(listview)findviewbyid(r.id.list); adp=new chatadapter(); list.setadapter(adp); list.sett...

Can I use hiera with a YAML backend to combine arrays? -

i'm using hiera yaml backend manage puppet configuration , i'd append values array. i have configuration file looks bit this: --- some_config: - 1 - 2 - 3 some_more_config: - 1 - 2 - 3 - 4 where some_more_config superset of some_config . i'd improve file remove duplication haven't figured out whether it's possible or syntax be: --- some_config: - 1 - 2 - 3 some_more_config: - "%{::some_config}" - 4 in words rather code, some_more_config entire contents of some_config plus 1 additional value. i don't think can in hiera because can interpolate string-based information (numbers converted strings) , not arrays or hashes. from hiera 3: interpolation tokens, variables, , lookup functions : hiera can interpolate values of of puppet’s data types, value converted string. you can still via puppet dsl though. here few options: the hiera 3: lookup types documentation covers in detail, if these in ...

javascript - change button text color in ExtJS -

i need change text color of button. defined css class like; .mbutton{ background:transparent; color:red; border:none; } and button definition here; ext.create('ext.button', { renderto: ext.getbody(), text: 'red text', cls:'mbutton' }); fiddle: https://fiddle.sencha.com/#fiddle/olj a button generated span elements inside. color need changed in span instead in button . way: .mbutton span{ color:red; }

extjs - How to catch Delete key event in tree panel controller -

i have tree panel view (defined fileseditornavigtree ) , controller . in controller want catch delete key event in order perform procedure. tried this: ... init:function(){ this.control({ 'fileseditornavigtree':{ specialkey:function(a, b){ alert(b.keycode); // testing reasons } but has no effect. use rowkeydown listener of treepanel view. ext.create('ext.tree.panel', { title: 'simple tree', width: 200, height: 150, store: store, rootvisible: false, renderto: ext.getbody(), listeners : { rowkeydown : function(view, record, tr, rowindex, e) { if (e.keycode === 46) { console.log('hit delete'); } } } });

python - Django ModelForm ManyToManyField isn't able to update selected values -

i building first project in django 1.8 python 3.4. have following model called lid in models.py: class lid(models.model): ... vereniging = models.manytomanyfield(vereniging, blank=true) i use following modelform, forms.py class lidform(forms.modelform): class meta: model = lid exclude = [] when use modelform create form make new object, multiple select box appears , able select multipe vereniging objects. view in views.py: def add_lid(request): if request.method == 'post': form = lidform(request.post, request.files) if form.is_valid(): form.save() messages.success(request, 'succes.') return httpresponseredirect(reverse('leden:home')) else: form = lidform() return render(request, 'leden/lid/addlid.html', {'formset': form}) when want edit objects however, not able change selected selected vereniging objects. def edit_lid(request, ...

Array incompatibility Javascript -

when construct square array have , pass new float32array, error, however, when pass temp float32array (and manually assign numtriangles 6), works properly... asdf logged console in both attempts, not sure why happening. var square = [[-1,-1,],[1,-1],[-1,1],[-1,1],[1,-1],[1,1]]; var numtriangles = square.length; square = square.join(); var temp = [-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]; if (square == temp) { console.log("asdf"); } gl.bufferdata(gl.array_buffer, new float32array(square),gl.static_draw); gl.enablevertexattribarray(positionlocation); gl.vertexattribpointer(positionlocation, 2, gl.float, false, 0, 0); gl.drawarrays(gl.triangles, 0, numtriangles); //numtriangles == 6 the method join() produces string , not array. float32array cannot take neither string or 2-dimensional array argument. a hackish way around parse string after join() json: var square = [[-1,-1],[1,-1],[-1,1],[-1,1],[1,-1],[1,1]], float; float = new fl...

java - Checking which raidoButton in a ButtonGroup is selected? -

i created both 2 radiobuttons , buttongroup in swing. "radioascending", "radiodescending", , "buttongroupascdsc" respectively. when "radioascending" selected, array sorted in ascending order, , vice versa. however, when try check if 1 of 2 selected: if (radioascending.isselected()) { arrays.sort(alphaarray, (string[] s1, string[] s2) -> s1[0].comparetoignorecase(s2[0])); alphamodel = new defaulttablemodel (alphaarray, columns); } the top line gives error: non-static variable radioascending cannot referenced static context the code have provided doesn't show much, error looks calling variable radioascending not static (not marked keyword static ) method marked static static , not allowed.

javascript - Bootstrap modal with content cant be opened twice -

just starting out please bear me :) i have searched on site answers not find 1 matched problem. i'm trying open bootstrap modal , content using jquery ajax form plugin. works , content showed in modal, however, when close modal , open again, screen flickers , gets grey (backdrop opens) , goes back. if reload site , try again, works until try open same modal again. if skip loading content modal opens / closes fine many times want. think has old content being there when opening again. content changes need wipe old ones modal div, cant seem work. standard modal div: <link rel="stylesheet" href="css/bootstrap-custom.css"> <link rel="stylesheet" href="css/bootstrap-theme.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="http://malsup.github.com/jquery.form.js"...

c# - How to remove certain characters -

i'm trying remove single vowels string, not if vowel double same. for example string "i keeping foobar" should print out "m keepng foobr" i have tried didn't come solution far. try: regex.replace(input, @"([aeiou])\1", ""); though i keeping foobar , give m keepng foobr , different required m keepng foobr , you're stripped spaces out of required result, too. if want remove extraneous spaces, it's 3 step operation: remove vowels; remove proceeding/trailing spaces; remove double spaces. var raw = regex.replace(input, @"([aeiou])\1", ""); var trimmed = raw.trim(); var final = trimmed.replace(" ", " ");

java 8 - What are the differences between an aggregate operation and a method? -

.......... well, let me tell made mistakes: foreach() refering not aggregate operation method iteable. i've changed title of question , content. my interest know if aggregate operation implemented default , can find implementation. if want dig jdk sources can download them here @jbkm suggest. if have oracle jdk installed, there should src.zip file in installation folder contains public sources. alternatively can check openjdk sources online, example, on grepcode . can see, implementation of foreach iterable quite simple: default void foreach(consumer<? super t> action) { objects.requirenonnull(action); (t t : this) { action.accept(t); } } if you're asking implementation of foreach in stream api, it's more tricky thing should evaluate previous pipeline steps , perform operation in parallel parallel streams. can start investigation examining referencepipeline class stream implementation in openjdk.

Add columns to an SQLite table in a Python loop -

i make database (using sqlite3) scientific program (python). program build makes loops gradually build database. problem add column loop. made example. shows problem variable defines new column name ( name1 ). import sqlite3 import os conn=sqlite3.connect(':memory:') c=conn.cursor() c.execute('''create table tablename (var1 real, var2 real)''') name1='test1' c.execute('''alter table tablename add column "+name1+" integer''') name1='test2' c.execute('''alter table tablename add column "+name1+" integer''') does have advice solve problem please ? , have nice day. string literals must terminated same sort of quoting started them. "+name1+" interpreted literal part of strings , passed on c.execute(...) without variable name1 being inserted. thus both new columns have literal name +name1+ , leads error message sqlite3.operationalerror: dup...

html5 - how do I use the :valid and :invalid selectors for css? -

i’m new coding , heard friend it’s possible use :valid , :invalid selectors inside css form. how do this? actually interesting question. believe it's 1 of things that's brand new css3. not sure whether can apply it. don't think can @ moment, because tried on fiddle , wasn't working me. it's going introduced update of css selectors. the way use this: html: email: <input type="email" required> css: input[type=email]:invalid {   outline: red solid 3px; }   input[type=email]:valid {   outline: lightgreen solid 3px; } with above css, email field styled red outline before user enters anything. once user types in valid email address, outline turn green. hopes helps!

c++ - Relationship of std::unique_lock<mutex> and conditional_variable cond -

here code: class class carl{ public: int x = 0; std::mutex _mu; std::condition_variable cond; bool donecreating = false; void createfood(){ if(x == 0){ std::unique_lock<mutex> locker(_mu); x++; std::cout<<"creating food.."<<std::endl; cout<<"food count: "<<x<<endl; locker.unlock(); cond.notify_one(); //notify std::this_thread::sleep_for(chrono::seconds(1)); //sleep } } void eatfood(){ std::unique_lock<mutex> locker(_mu); //lock std::cout<<"i executing"<<std::endl; //notif cond.wait(locker); //wait x--; //process food std::cout<<"eating food.."<<std::endl; cout<<"food left: "<<x<<endl; locker.unlock(); } }; function aka thread...

how to override text file data in C++ -

i'm creating hotel management program in c++, i'm having trouble appending or fixing guest's completed info file. the file saved text file. when user wants alter guest's info, tell program want alter, i.e. name. program clear name, , prompt user first name , surname of guest. program asks user if want info saved file. if user says yes, file saved. in theory , file should changed, happens, whole new file created. void alterinfo() { system ("cls"); string alter; char filename [100]; ifstream file_ptr; cout << "\n\t\t\t\tsaved members:\n\n"; system ("dir/b *."); cout << "\n\nplease type name of member you\n"; cout << " wish open appears above or\n"; cout << " type z (lower case) return main menu: "; //cin.ignore(); gets (filename); /*if (filename == "z") { system("pause"); }*/ if (fi...

Meteor: data passed to template from Iron Router, is empty at first load -

i'm facing strange problem. i'm using iron router controller pass data template: router.route('/wards/add/:_id?', {name: 'wards.add', controller: 'wardaddcontroller'}); wardaddcontroller = routecontroller.extend({ action: function() { this.render('addward', { data: function(){ return { hospitals : hospitals.find({}), hospital_id : this.params._id } } }); } }); i return variable 'hospitals', should contain collection data. template: <div class="jumbotron"> {{#each hospitals}} {{name}}<br> {{/each}} </div> at first page load, if type directly url of page, there no items. if type hospitals.find({}).fetch() (insecure active) in browser console, return empty object. but if change pages, navigating on website while, , return the listing page, items appears. any idea? in server folder, add publish.js , inside...

javascript - Chrome extension to change chrome settings -

i trying create extension set settings on chrome such popups etc. i asked contentsettings permission in manifesto : "permissions": [ "tabs", "http://*/*", "https://*/*","contentsettings" ], and have following js code change settings var url = 'http://google.com'; var pattern = /^file:/.test(url) ? url : url.replace(/\/[^\/]*?$/, '/*'); var setting = 'popups'; console.log(' setting '+pattern+': '+setting); chrome.contentsettings[setting].set({ 'primarypattern': pattern, 'setting': 'allow' }); and following error in console: uncaught typeerror: cannot read property 'popups' of undefined what doing wrong? most chrome.* apis not available content scripts. can used background or event pages, popups, or other extension views define. if need initiate action in response depends on contents of page, can send message ...

angularjs - How does refreshing of jwt token work in django REST angular -

i using this http://getblimp.github.io/django-rest-framework-jwt/#refresh-token i confused how make work. have done settings said. how make work. currently have code first token when user submits login , save token in cookie store. request use token requests. have seen token expries , don't want that. thats why using this $http .post('/api-token-auth/', logdata) .then(function (response) { // assumes if ok, response object data, if not, string error // customize according api if (!response.data.token) { _vm.authmsg = 'incorrect credentials.'; deferred.reject('incorrect credentials.'); } else { $cookiestore.put('djangotoken', response.data.token); $http.defaults.headers.common.authorization = 'jwt ' + response.data.token; $http.get('/api/account/restricted/').then(function (response) { authservice.loginconfirm...

c++ - Should I use mutable priority queue for dikjstra/A* algorithm? -

i trying implement a* algorithm , dikjstra algorithm special case of a* (just pass h(x){return 0;} a*), when choosing priority_queue, have 2 choices use empty priority_queue, , push start point when initializing, , "pop u, push neighbors of u satisfying conditions", in way, 1 node might pushed twice if common neighbor of 2 other nodes. use mutable priority queue supports update()/decreasekey()/increasekey() , choose data structures in boost::heap or (actually have) implement priority_queue myself, in way, nodes needed pushed container when initializing , handles them need kept. what pros , cons of these 2 strategies , 1 more practical? a common implementation of priority queue dijkstra's in c++ uses std::set , smallest item set.begin() , , can find exact item , erase it. can define facade allows access std::set priority queue-like interface , support additional update/erase/increasekey/decreasekey methods. look here code samples dijkstra...

Java ATM arrays error -

i'm trying make atm can make deposit, withdrawal , show balance, problem comes when i'm trying make 11th transaction (the size of transaction records 10). here how program should work: earlier transactions: ===================== 1 2 3 4 5 6 7 8 9 10 ======================= balance: 55 kr earlier transactions: ===================== 2 3 4 5 6 7 8 9 10 11 ======================= balance: 65 kr i have use methods , haven't translated program english. import java.util.scanner; public class bankomat { public static void main(string[] args) { scanner in = new scanner(system.in); // declarer variables int[] trans = new int[10]; int amount = 0; int balance = 0; int sum = 0; int thechoice = 1; while(thechoice != 4) { thechoice= menu(); switch(thechoice) { case 1: system.out.println("\ndu...

java - Should YamlConfiguration objects be closed? -

i've been working on plugin requires fair amount of data being stored. have being stored in custom config file found online works same default config. the problem i'm having not sure how close file or if need to, know little yaml configurations. code template used below. i'm curious advice on how should store larger amounts of data in future. public class customconfig { //store name of file load/edit private final string filename; //store plugin, file directory private final javaplugin plugin; //store actual hard disk file location private file configfile; //store ram file copy location private fileconfiguration fileconfiguration; //constructor taking plugin , filename public customconfig(javaplugin plugin, string filename) { //ensure plugin exists folder path if (plugin == null) throw new illegalargumentexception("plugin cannot null"); //set classes plugin variable 1 passed m...

Android kill all activities issue -

in project have put drop down menu button on top of layout not know how kill activities .please tell me solution new in android. i doing this. button1 = (button) findviewbyid(r.id.button1); button1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //creating instance of popupmenu popupmenu popup = new popupmenu(datalistactivity.this, button1); //inflating popup using xml file popup.getmenuinflater() .inflate(r.menu.popup_menu, popup.getmenu()); //registering popup onmenuitemclicklistener popup.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() { public boolean onmenuitemclick(menuitem item) { alertdialog.builder a_builder = new alertdialog.builder(datalistactivity.this); a_builder.setmessage("do want close app !!!") .se...

jquery - How to execute code synchronously in angular js -

i facing 1 issue service getting data service , binding ui, text box , drop down there passing model ui binding properly. issue drop down working asynchronously (its guess). please check below code vendorservice.getvendordetailsforvendor().then(function(vendordetails) { if (vendordetails.id !== 0) { $scope.businesstype = vendordetails.businesstypeid; $scope.vendortype = vendordetails.vendortypeid; $scope.category = vendordetails.shopcategory; $scope.discountunit = vendordetails.discountunitid; $scope.selectedstate = vendordetails.stateid; $scope.selectedcityid = vendordetails.cityid; if ($scope.businesstype != null) { $scope.$apply(function() { (var = 0; < $scope.businesstypelist.data.length; i++) { if ($scope.businesstypelist.data[i].businesstypeid === $scope.businesstype) { ...

javascript - Scrollmagic: issue with animating content inside parallax sections -

i'm experimenting parallax , scrollmagic. in parallax example scrollmagic demo i'm trying animated content in first parallax section. here's a fiddle of experiment . i can't letter a in #box move how want it. i'd tried adding bounding box , using triggerelement, did not work. on scrolldown should move down 150px , fade out. right it's using "#parallax1" triggerelement , fading out once reaches bottom of section. want fade out before bottom of section. how that? what doing wrong? ////////////////////////////////////////////////////// //////////// //// parallax animation //////////// ////////////////////////////////////////////////////// // init controller var controller = new scrollmagic.controller({ globalsceneoptions: { triggerhook: "onenter", duration: "200%" } }); // build scenes // build tween1 var tween1 = new timelinemax(); tween1.to("#parallax1 > div", 1, { y:...

html - How can I create a status bar with bootstrap? -

i need create status bar, @ bottom of screen (fixed position) webapp. because haven't lots of css knowledge, i'm using twitter bootstrap. how can create this? i've been looking around web, haven't found example... or possible create second nav-bar (it looks great!), , attach bottom of screen? maybe creating kind of "navbar-fixed-bottom" css rule? a fixed-bottom navbar seems right. there's bootstrap example demonstrates this.

jquery - Django doesn't load a static file -

i'm making plugin django-cms, created first web page in pure html, javascript , css way , worked perfectly, while i'm trying make work on django-cms seems doesn't load jquery-ui , therefore breaking boarguifunctionality.js script , application: <!doctype html> <html> <head> <meta charset="utf-8"> <title>test</title> </head> {% load staticfiles %} <script type="text/javascript" src="{% static "js/jquery-2.1.4.min.js" %}"></script> <script type="text/javascript" src="{% static "js/jquery-ui.min.js" %}"></script> <script type="text/javascript" src="{% static "js/board.js" %}"></script> <script type="text/javascript" src="{% static "js/jquery.simple.timer.js" %}"></script> <link rel="stylesheet" type="text/css" href="{...

What is the best way to add two fields and store the sum in third field in asp.net mvc automatically -

i have model class order this, public class order { public int orderid {get; set;} [datatype(datatype.currency)] [column(typename = "money")] public decimal unitprice { get; set; } public int quantity { get; set; } [datatype(datatype.currency)] [column(typename = "money")] public decimal totalamount { get; set; } } i want add 2 fields unitprice , quantity , store sum in totalamount field. best way this? you can way: public class order { public int orderid {get; set;} [datatype(datatype.currency)] [column(typename = "money")] public decimal unitprice { get; set; } public int quantity { get; set; } [datatype(datatype.currency)] [column(typename = "money")] public decimal totalamount { {return unitprice * quantity; } } }

How to copy subsections multiple time in Azure Templates? -

i'm preparing new azure template using arm , configure inboundnatrules on loadbalancer each vms created. number of vm defined parameters need find way "copy" inboundnatrules section multiple time. how can achieved? i'm going crazy on one. "inboundnatrules": [ { "name": "[concat('rdp-vm',copyindex())]", "properties": { "frontendipconfiguration": { "id": "[variables('frontendipconfigid')]" }, "protocol": "tcp", "frontendport": "[concat('227',copyindex())]", "backendport": 22, "enablefloatingip": false } ...

java - JavaFX static/non static with Controllers -

i've tried make little math programm javafx, have button action in controller 1: @fxml public void showcalc(actionevent event2) { layout.parabel_nullstelle_showcalc.setvariables(a, b, c, x1, x2, ze1, ze2, ze3, ze4, ze5, ze6, ze7); parent root3 = main.main.getparent(); scene showcalc = new scene(root3, 500, 1000); stage paranullcalc = new stage(); paranullcalc.settitle("rechung"); paranullcalc.setscene(showcalc); paranullcalc.show(); } it opens new stage scene contains calculation. in controller showcalc have set variables method. public static void setvariables(double a1, double b1, double c1,double x11, double x22, double ze11, double ze22, double ze33, double ze44, double ze55, double ze66, double ze77){ = (float) a1; b = (float) b1; c = (float) c1; x1 = (float) x11; x2 = (float) x22; ze1 = (float) ze11; ze2 = (float) ze22; ze3 = (float) ze33; ze4 = (float) ze44; ze5 = (float) ze55; ze6 = ...

PHP login, is it secure? -

i hoping take @ first php login script , give me constructive criticism on may of done wrong , if secure. thank you. i wasn't sure if had used password rehash correctly. if (isset($_post['submit'], $_post['username'], $_post['password'])) { $username = null; if (isset($_post['username'])) $username = strip_tags(trim($_post['username'])); $password = null; if (isset($_post['password'])) $password = strip_tags(trim($_post['password'])); $sql = "select * login username=?"; $get = $connect->prepare($sql); $get->execute(array( $username )); // execute query if ($get->rowcount() === 1) { $row = $get->fetch(pdo::fetch_assoc); // fetch result $db_username = $row['username']; $db_password = $row['password']; if ((password_verify($password, $db_password)) && (strlen($username) >= 5) && (strlen($username) <= 10) && (strlen($password) ...

php - Number the iframes and display it -

i have piece of code reads space separated urls input string , replaces them iframe video. want insert number of iframe above each of them. below code: $result = $conn - > query($sql); if ($result - > num_rows > 0) { // output data of each row while ($row = $result - > fetch_assoc()) { $nr = $row['nr']; $playery = $row['player']; $nrplayer = $nrplayer++; //old int (not used) //////remove string iframes , replace tons spaces 1 before every url (that makes string more clear)////// while (strpos($playery, ' ') !== false) { $playery = str_replace(" ", "", $playery); } $playery = str_replace("http", " http", $playery); $playery = str_replace('<iframewidth="420"height="315"src="', ' ', $playery); $playery = str_replace('<iframesrc="', ' ', $playery...