Posts

Showing posts from June, 2012

math - exponential gauge calculation in JavaScript -

Image
i have little javascript ajax script gets speed on progress in kbps or whatever - let's mb/s. , want add gauge shows speed graphically. i have image containing gauge design , pointer. pointer default points @ top - lowest value -120deg , highest 120deg. wouldn't nice if has 1mb connection, need add exponential calculation. here values... 0-1mb: -120deg -> -90deg 1-5mb: -90deg -> -60deg 5-10mb: -60deg -> -30deg 10-20mb: -30deg -> 0deg 20-30mb: 0deg -> 30deg 30-50mb: 30deg -> 60deg 50-75mb: 60deg -> 90deg 75-100mb: 90deg -> 120deg i totally don't know how start calculation. the animation done css -webkit-transform:rotate(xdeg) and update on xhr.onprogress the calculation speed is: kb/s=((e.loaded/((new date()-start)/1000))/1024).tofixed(2), mb/s=(d/1024*8).tofixed(2) when have mb/s want set gauge deg. how can achieve these values? here not-completely-working variant. wrote while think it's not proper way. ...

math - why we get only one unique straight line in a,b co ordinates for a point given in x,y co-ordinates? -

if there point given in x,y co-ordinate, can pass infinite number of straight lines varying slope , intercept b. when fix our x , y , vary our , b in a,b co-ordinate single unique line. why? found annoying while studying hough transform. i don't understand want ask....but yes may clear things bit. when fix point can make infinite lines pass through it.this obvious. fix a,b co-ordinates have fixed 1 particular case slope , y-intercept both. now note slope can vary between definite range. if consider argument, vary 0 degrees 180 degrees. out of infinite lines having different slopes pass through point (in case point on y-axis i.e. y-intercept of line) selecting 1 line in particular having specific slope. 1 such line possible. i hope answers question...

javascript - $('body, html').is(':animated')) doesn't seem to be working -

i have 4 divs heights set window height. want on each scroll down scroll next one, after first scroll down keeps on scrolling, seemingly ignoring is:animated <style> .div { width: 100%; } .red { background: red; } .yellow { background: yellow; } .green { background: green; } .blue { background: blue; } </style> <div id="id0" data-id="0" class="nbhd red scrolledto"></div> <div id="id1" data-id="1" class="nbhd yellow"></div> <div id="id2" data-id="2" class="nbhd green"></div> <div id="id3" data-id="3" class="nbhd blue"></div> function setheights() { $('.nbhd').css('height', window.innerheight); } function scrollsections() { if ($('body, html').is(':animated'))...

mysql - Convert string with array of json (PHP) -

i stored array of json in mysql string [{"id": 1, "mark": 5}, {"id": 2, "mark": 3}, {"id": 3, "mark": 2}] when try use @foreach ($places $place) @foreach ($place->rates $rate) {{var_dump($rate->marks)}} @endforeach @endforeach there problem. $rate->marks string. how shoul decode array? upd of course tried use json_decode, returns error htmlentities() expects parameter 1 string, array given solved i', stupid. problem not in json_decode. tried print result {{ }} needs string argument. there no rate in json, , no marks . check online $json = '[{"id": 1, "mark": 5}, {"id": 2, "mark": 3}, {"id": 3, "mark": 2}]'; $places = json_decode ($json); foreach ($places $place) var_dump($place->mark); design code laravel, online debug does't have feature. let me know.

android - Change text colour of SwitchCompat -

how can change text colour of switchcompat?i showing on , off text in switchcompat , want change text colour white. <android.support.v7.widget.switchcompat android:id="@+id/switchttodisableorders" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:padding="5dp" android:layout_marginright="10dp" android:checked="true" android:texton="on" android:textoff="off" app:showtext="true" /> <style name="theme.mainactivity" parent="theme.appcompat.light.darkactionbar"> <!-- set appcompat’s color theming attrs --> <item name="windowactionbar">false</item> <item name="android:actionmenutextappearance">@style/mymenutextappearance</item> <item name="windownotitle">true</item> <...

applescript - Why is save attachment in path giving "error "Microsoft Outlook got an error: An error has occurred." number -2700"?" in Outlook 2016? -

save f in saveasname fails times. f attachment, saveasname path file name. the error message tab is: save attachment 1 of incoming message id 442 in "/users/path/att-1-1 image001.jpg" --> error number -2700 applescript result tab bottom: error "microsoft outlook got error: error has occurred." number -2700 it fails because save ... in ... takes file reference, not string. try save f in posix file saveasname

jquery - Can videos within an iframe be controlled by javascript? -

i know youtube videos can stopped , started javascript commands google provides. know vimeo videos can stopped , started javascript commands vimeo provides. the videos of both within 'iframes'. my question - did have video or sound-file in iframe not either company? there way, instance, know if user has clicked on pause icon? thanks. yes. answer question yes possible know if user has clicked pause button. but may not correct unless describe complete context. example html5 audio video players, have events invoking can tap goes on them. e.g. have 'pause' event fired when user clicks pause button. also depends on media, infact page in iframe loaded.

mongodb - Rename/update a specific tag in all documents -

i have these documents in collection: [{ "_id" : objectid("57496afadc964de30a8084a1"), "name" : "mongodb: definitive guide", "tags" : [ "it", "sql" ] },{ "_id" : objectid("57496afadc964de30a8084a2"), "name" : "mongodb applied design patterns", "tags" : [ "sql", "mongodb" ] }] i need rename "sql" tags "nosql" in documents. can first adding new tag-name, , removing 1 needs updating: db.getcollection('book').update( { tags: 'sql' }, { '$push': { tags: 'nosql' } }, { multi: true }) db.getcollection('book').update( { tags: 'sql' }, { '$pull': { tags: 'sql' } }, { multi: true }) but requires 2 separate queries. how can achieve singe statement? you using wrong operators. need use $set operator , $...

asp.net mvc 5 - asp mvc-5 client side requried validation for List dosn't work -

i've view model list attribule [required] public list<surgeons> surgeons { get; set; } the validation works fine on server side, didn't work on client side. want use required validation not custom 1

sorting - c++ sort vector of template <char*, char*> objects -

i need implement code works: pair<char*, char*> p1, p2, p3; vector<pair<char*, char*> > v; cin >> p1 >> p2 >> p3; v.push_back(p1); v.push_back(p2); v.push_back(p3); sort(v.begin(), v.end()); (it = v.begin(); != v.end(); ++it){ cout << *it << endl; } i made template class, tested operators , works fine, need make specialization class upper code works. here did: template<typename t1, typename t2> class pair { t1 first; t2 second; public: pair(const t1& t1=0, const t2& t2=0) : first(t1), second(t2){} pair(const pair<t1, t2>& other) : first(other.first), second(other.second){} bool operator==(const pair<t1, t2>& other) const{ return first == other.first && second == other.second; } bool operator!=(const pair<t1, t2>& other) const{ return first != other.first && second != other.second; } bool operator<(const pair<t1,...

git - GitHub and Visual Studio Community 2015 - Error trying to push -

Image
i contributor in git repository trying share , work on visual studio project, , using git extension interface git. have added files project , extension , there incoming commit. when try push commit under outgoing commit, error pops up: translation not possible push branch master repository origin because there new commits on remote. not possible perform fast-forward merge branch on remote repository. how can fix it? if wife's translation of italian correct problem have incoming commits remote repository , need perform pull (& merge) before can push changes remote. alternatively perform fetch , rebase local changes on top of origin/master.

xcode - NSMenu directly open popover on icon click -

when click logo of app above statusbar, 2 options: open , close. let menu = nsmenu(); menu.additemwithtitle("open", action: "menu_open", keyequivalent: "m") menu.additemwithtitle("close", action: "menu_close", keyequivalent: "c") what want is: when user clicks on icon, want directly open nspopover

html - Formatting error while rotating header in table -

Image
i working on table in rotate table fit big header names using following code. <html><body> <style type="text/css"> .tftable {font-size:12px;color:#333333;width:1%;border-width: 1px;border-color: #ebab3a;border-collapse: collapse;} .tftable th {font-size:12px;border-width:1px;padding: 1px;border-style: solid;border-color: #ebab3a;text-align:left;} .tftable tr { line-height: 14px;} .tftable td {font-size:12px;border-width: 1px;padding: px;border-style: solid;border-color: #ebab3a;height: 14px;} .tftable tr:hover {background-color:#ffffff;border:none;} th.rotate { /* can count on */ height: 140px; white-space: nowrap; } th.rotate > div { transform: /* magic numbers */ translate(25px, 51px) /* 45 360 - 45 */ rotate(270deg); width: 30px; } th.rotate > div { border-bottom: 0px solid #ccc; padding: 0px 0px; } </style> <table class="tftable" border="1"> <tr><th class="rota...

c# - Hash algorithm SHA256, is my method secure? How do I add a salt value to make more secure -

i quite new cryptography , want head around hashing algorithms. i have sources following create hashed version of password, can stored in database. public static string hashpasswordgenerator(string password) { system.security.cryptography.sha256managed crypt = new system.security.cryptography.sha256managed(); stringbuilder hash = new stringbuilder(); byte[] cry = crypt.computehash(encoding.utf8.getbytes(password), 0, encoding.utf8.getbytecount(password)); return convert.tobase64string(cry); } my example user user1 password password1 , returns hashed version of gve/3j2k+3kkof62ardujtyq/5tvqz4fi2puqj3+4d0= my questions are: is secure? should add salt this? if can show me simple example not understand how salt generated match password every time? if has hashpasswordgenerator method reverse engineer password? thanks in advance. is secure? not if you're using sha2 without salt. (not saying s...

jquery - Retrieve Check box from array they stored in -

i have function , want create function retrieve check box array (user_card_declare_data_list) on model again userobj.savedeclarationform = function () { var user_card_declare_data_list = [] $(".option").map(function () { var user_card_declare_data = {} if ($(this).find(".result_val")[0].checked == true) { user_card_declare_data.result_val = 1; } else { user_card_declare_data.result_val = 0; } user_card_declare_data_list.push(user_card_declare_data); }) $('#mymodal').modal('hide'); userobj.declaration = user_card_declare_data_list; } change var user_card_declare_data_list = [] to: var user_card_declare_data_list = this.user_card_declare_data_list = [] now can access array in other methods of userobj with: this.user_card_declare_data_list

xml - Android Floating Action Button Semi Transparent Background Color -

Image
i want use fab semi transparent background color. getting fab 2 different colors. what's problem? <android.support.design.widget.floatingactionbutton xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" android:fadingedgelength="5dp" app:borderwidth="0dp" app:elevation="4dp" app:backgroundtint="#99f03456" app:fabsize="normal"/> and without drawable. got same issue here. tried set alpha transparency in xml using backgroundtint didn't work , resulted in same appearance in screenshots (two circles). so set in code : floatingbutton = (floatingactionbutton) findviewbyid(r.id.fab); floatingbutton.setalpha(0.25f); and consistent.

javascript - Realign Google Maps to fit all markers into to the right 70% of the map -

i provide client solution displaying of branches in 1 city on map (google maps javascript api). map behaves more in-website app typically google map - not draggable, zoomable, , on. i put tiny function handles repositioning of map have markers in maps viewport. function called on pageload , everytime window resized. while works perfectly, need fine-tune script more , have no clue on how it: later on, there permanent info-window overlaying left 30% of map. prevent markers being hidden under it, nice if the realign function restricted use right 70% of map object calculation. here funtion looks like: function realignmap() { resizefinished(function(){ var bounds = new google.maps.latlngbounds(); (var = 0; < markers.length; i++) { bounds.extend(markers[i].getposition()); } map.fitbounds(bounds); }, 300, 'mapresizeuniqueid'); } map , markers global variables containing google maps map-object , array google maps marker-objects. resizefinis...

javascript - Need regex to replace entire folderpath while preserving file name where last folder could by anything -

this question has answer here: how file name full path using javascript? 17 answers i need regex replace leave file name. /folder1/folder2/folder3/anything/somefile.html also show me how implement replace method? replacing entire path match empty string , again leaving file , anything. thanks in advance. you can use .*\/ . . match anything * repeat previous 0 or more times. \/ literal slash ( / ). needs escaped because it's part of regex construct: var str = '/folder1/folder2/folder3/anything/somefile.html'; str.replace(/.*\//, ''); // "somefile.html"

node.js - Are there any (GUI) tools for MongoDB use Mongoose like syntax? -

i'm new both node.js , mongodb. i'm using mongoose query , aggregation. mongoose's syntax bit different native mongodb. i'm looking kind of tools, gui tools better, test mongoose query. you give mongobooster try. mongobooster support mongoose-like fluent query builder enables build query using chaining syntax, rather specifying json object. // instead of writing: db.user.find({age:{:18,:65}},{name,1,age:1,_id:-1}).sort({age:-1, name:1}); // can write: db.user.where('age').gte(18).lte(65).select('name age -_id').sort("-age name"); // passing query conditions permitted db.collection.find().where({ name: 'mongobooster' }) // chaining db.collection .where('age').gte(18).lte(65) .where({ 'name': /^mongobooster/i }) .where('friends').slice(10) // aggregation db.companies.aggregate(qb.where('founded_year').gte(2000).lte(2010)) //qb:querybuilder .group({_id:...

phpbb3 - phpbb variable empty on custom page -

i have phpbb 3.1 forum, have put html portal, (using custom page tutorial) i have included functions.php can use {s_username} , s_ in page... but, want put forum statistics, using, example: {total_users_online} {logged_in_user_list} {total_posts} and on the variables, empty when using them in page... there problem? need add more file? thanks! the variables mentioned initialized in page_header function in functions.php in custom pages call function initialize common variables s_ variables mentioned. since loading of online users little heavier , not needed on every page, function has parameter $display_online_list enable it. check method signature , set $display_online_list true to display total_posts , need add bit of code, see assign_vars call in index.php , $config global variable should available in every page.

angularjs - Error: [ng:areq] controller is not function got undefined -

for above error have referred solutions avalilable on , other sites still facing same issue. following html code: <div ng-app="importcontactsapp" class="modal fade" id="invitemodal" tabindex="-1" role="dialog" aria-labelledby="modallabel" aria-hidden="true"> <div class="modal-dialog import-contacts-dialog"> <div ng-controller="importctrl" class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">close</span></button> </div> <div class="modal-body"> <h4 class="modal-title" id="linemodallabel">invite friends email....

actor - Can I avoid cache consistency checks by declaring variables as thread-local? -

i'm reading how cpus maintain consistency of caches in multithreaded application. write in 1 core's cache labels dirty , other cores must careful not read segment main memory, because main memory copy not date. many of applications write work like actor system, mutability limited local variables on single thread. don't label them "thread local" unless have semantics reason doing so. however, missing optimization opportunity? explicitly labeling variable thread local, opposed using way, inform hardware doesn't have check consistency because variable never visible other threads, in principle? edit: higher-level way of expressing same thing, should expect performance gains using formal actor system, akka, instead of adhering actor paradigm in classes? formal actor system adds strictness, ability scale across computers, , presumably overhead, low-level details letting threads skip consistency checks on cached data known non-shared? does labeling data...

PHP file_get_contents errors at 128K -

i searching clues why post requests larger 128k dying returned 500 or 404 . the php script includes similar portion $arcontext['http']['timeout'] = 60; $context = stream_context_create($arcontext); $filecontents = file_get_contents('php://input', 0, $context); syslog(log_info, "file length = " . strlen($filecontents); server side: post_max_size = 8m memory_limit = 32m syslog shows file length 131702 on these failed posts. at point, seems problem satellite connections, not sure how plays problem. wireshark serverside includes: post /farms/somewhere.php?id=lalala http/1.1 host: nowhere.net content-length: 96 expect: 100-continue connection: keep-alive .g.c.!.......&.>...&..k..-.)..^b?.(..4xh..veu..ku..w...i..xr.&c...+^h...`.............x..c=.2...http/1.1 100 continue http/1.1 200 ok date: fri, 27 may 2016 22:32:39 gmt server: apache/2.2.31 (unix) mod_ssl/2.2.31 openssl/1.0.1e-fips mod_bwlimited/1.4 x-power...

ios - ViewControllers are not destructing -

i've got serious problem ios app. i have login logic in application. when logging in , logging out, view controllers not destructing. causes issues, example, events emit using nsnotifcationcenter emitted few times. these issues avoidable, want solution avoid view controllers stay open in background without me controlling it. the way control login logic follows: in app delegate start function, if user logged in, set root view controller main usable view controller. therefore, i'm not doing , root view controller set login view controller navigation controller through storyboard. when user logs off, use modal segue transition view controller login view controller navigation controller. as may understand i'm using storyboards, swift , newest ios. my logout code segue take me loginviewcontroler: self.performseguewithidentifier("logout", sender: self) my app delegate code: if (userdefaults.valueforkey("uid") != nil) { let tabbarview...

java - Spring REST validation on custom annotation -

i'm trying add validation logic on rest beans using annotations. example, point annotation used on multiple rest resource objects / dto's. i hoping solution this: public class entity { @notnull // jsr-303 private string name; @phone // custom phonenumber has exist in database private string phonenumber; } @component public class phonenumbervalidator implements validator { // spring validator @autowired private phonerepository repository; public boolean supports(class<?> clazz) { return true; } public void validate(object target, errors errors) { phone annotation = // find fields annotations iterating on target.getclass().getfields().getannotation object fieldvalue = // how do this? can annotation, wish call repository checking if field value exists. } } did try jsr 303 bean validator implementations hibernate validator e.g. available here http://www.codejava.net/frameworks/spring/spring-...

tmux jump 5 lines in history / copy mode -

in ~/.tmux.conf have works great: bind-key -t vi-copy n cursor-down it allows me move cursor in history / copy mode. i want jump more rapidly (like in vim). i want jump 5 lines, doesn't work : bind-key -t vi-copy e 5 cursor-up how can add keybinding jump several lines? originally, tmux has restricted support commands in copy-mode. can't assign multiple commands, can't repeat them. option assign single command keystroke. however, there's mod tmux allows full-fledged support scripting in tmux: http://ershov.github.io/tmux/ (i'm author) using mod, can way: bind-key -t vi-copy k tcl { {set 0} {$i < 5} {incr i} { cursor-up } } also, you'd able use variables, loops, define own procedures , have more control on tmux internals.

hadoop - How to use MAX and COUNT function simultaneously on two different tables which are applied with a JOIN? -

//pig program user = load 'path' using pigstorage(',') (id:int, reputation:int, displayname:chararray, loc:chararray, age:int); post = load 'path' using pigstorage(',') (id:int, post_type:int, creationdate:chararray, score:int, viewcount:int, ownerus)er_id:int, title:chararray, answercount:chararray, commentcount:chararray); join user id, post id; = join user id, post id; dump a; user_group = group all; max_reputation = foreach user_group generate(user.displayname, user.reputation, post.id), max(user.reputation), count(post.id); so grouped 2 different tables i.e. user , post applied join it. problem statment :to find displayname , no of posts of user having maximum reputation. so need displayname , reputation user and id post and want apply max(user.reputation) , count(post.id) on join i.e. a please help. what more useful , applying join , doing max , count or applying max , count , doing join. problem statement :to find...

objective c - XCode/PhoneGap - Apple Mach-O Linker Error -

i finished programming application. tried archive app submission , didn't work, following error displayed. problem happens when want archive app, running on test device or simulator works perfect (no errors). ld /users/admin/library/developer/xcode/deriveddata/myapp-ekptdmvfytpoeoaedgfvjzqudoqa/build/intermediates/archiveintermediates/myapp/installationbuildproductslocation/applications/myapp.app/myapp normal armv7 cd /users/admin/desktop/myapp3 setenv iphoneos_deployment_target 6.1 setenv path "/applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/sdks/iphoneos6.1.sdk -l/users/admin/library/developer/xcode/deriveddata/myapp-ekptdmvfytpoeoaed...

php - What is the best way to add double input field form type in Symfony? -

Image
i create double input field form. feature name , feature value. what best approach in on product form? i using symfony 2 , mysql entity. i achiev this. thanks. create featuretype includes required fields use builtin collectiontype: http://symfony.com/doc/current/reference/forms/types/collection.html

elasticsearch - full text search in databases -

i have 2 general question full text search in database. looking elastic search , solr , seems me 1 needs produce separate documents made of table entries, searched. result of such search not database entry? or did misunderstand something? i looked whoosh search, index table columns , result of whoosh actual table rows. when using solr or elastic search, should put row id document gets searched , after have result use id retrieve relevant rows table? or there better solution? another question have if have id abc/123.64664, stored string, there advantage in searching such column fts? seems me there not gained indexing? or wrong? thanks elasticsearch can store indexed document, , can retrieve part of query result. ppl still store original data in usual db, gives more reliability , flexibility on reindexing. mind es indexes non-relational data. can have data stored in relational manner , compose denormalized documents indexing. as "abc/123.64664" can index tok...

r - multiple line and facet_grid in Bar plot -

i have dataframe 53 states , sex variable. e.g. below df having 26 states. set.seed(25) test <- data.frame( state = sample(letters[1:26], 10000, replace = true), sex = sample(c("m","f"), 10000, replace = true) ) now want see state has more female member, created bar plot in grid each state , each grid has 2 bars (m,f). test.pct = test %>% group_by(state, sex) %>% summarise(count=n()) %>% mutate(pct=count/sum(count)) ggplot(test.pct, aes(x=sex, y=pct, fill=sex)) + geom_bar(stat="identity") + facet_grid(. ~ state) the problem these 26 grid appearing in single line - visibility issue. want construct plot in multiple frame, e.g 3x9 instead of 1x26. also state should ordered based of female percentage. thanks help. problem #1: use facet_wrap . problem #2: reorder state levels beforehand. it this: ggplot(transform(test.pct, state=factor(state, levels=with(subset(tes...

How can I logon and POST to RESTful resource protected by Spring Security? -

i creating restful web appliaction , using spring backend. when wasn't implementing spring security, add new record jpa entity "timestamp" using curl command command line. using spring security when user not authenticated redirected login page. when try curl add record following: curl -i -x post -v -u myusername:mypass -h "content-type:application/json" -d '{ "timestamp" : "2016-06-16t08:17:20.000z", "peoplein" : "1", "peopleout":"0", "venue": "localhost://8181/venues/12" }' http://localhost:8181/timestamps this displayed in terminal: * trying ::1... * connected localhost (::1) port 8181 (#0) * server auth using basic user 'harry.quigley2@mail.dcu.ie' > post /timestamps http/1.1 > host: localhost:8181 > authorization: basic agfycnkucxvpz2xletjabwfpbc5ky3uuawu6b2s= > user-agent: curl/7.43.0 > accept: */* > content-type:application/json ...

c# - SSIS Getting Execute Sql Task result set object -

i have execute sql task item , getting multiple rows of data stored proc. declared variable objshipment under variable table , assigned under result set following info: result set: full result set result name: 0 variable name: user::objshipment i have written script task objshipment variable assigned readonly wondering how retrieve data within it? the stored proc returns multiple rows id, itemid, datecreated.. , how retrieve them if interested in itemid? , since returns multiple rows there more 1 itemid. i new ssis appreciated! so speaking use object variables within ssis package enumerator of each container. create each loop container. set enumerator "for each ado enumerator". set source variable user::objshipment. assign each column object own variable in variable mappings tab. within each loop container, use variables whatever want: insert them database, lookups , audits, etc. if going use script task, need datatable dt = new dat...

android - How to get Gamer ID and display picture? -

since google added gamer id google play games. how acquire gamer id + associated google provided display picture? need use them sharedpreferences function. to create gamer id , sign in when sign in game on play games or play games app itself, you'll prompted create gamer id: when see prompt, tap next . you'll see default gamer id , photo. to change gamer id, type on it. to change photo, tap edit google play pencil icon. you can change gamer id , photo later. choose whether allow others see game activity and/or discover gamer id using email or name. tap sign in . once you're signed in play games gamer id, you'll automatically signed in of games play. can change gamer profile or privacy setting choosing whether make game activity public discussed further in play games gamer id .

Defining a class member that has required constructor arguments in C++ -

suppose have class foo constructor has required argument. , further suppose i'd define class bar has member object of type foo : class foo { private: int x; public: foo(int x) : x(x) {}; }; class bar { private: foo f(5); }; compiling give errors (in exact case, g++ gives " error: expected identifier before numeric constant "). one, foo f(5); looks function definition compiler, want f instance of foo initialized value 5. solve issue using pointers: class foo { private: int x; public: foo(int x) : x(x) {}; }; class bar { private: foo* f; public: bar() { f = new foo(5); } }; but there way around using pointers? if have c++11 support, can initialize f @ point of declaration, not round parentheses () : class bar { private: foo f{5}; // note curly braces }; otherwise, need use bar 's constructor initialization list. class bar { public: bar() : f(5) {} private: foo f; };

swift - Trying to access property of a class which subclasses a cocoa class gives run-time error -

i made customized button type(class) inherits nsbutton , has additional methods well, when try access methods declared myself, run-time error. here's code: import cocoa class mcbutton: nsbutton { func testfunc()->bool { return true } } class viewcontroller: nsviewcontroller { @iboutlet weak var button: mcbutton! override func viewdidload() { super.viewdidload() if button.testfunc() { //thread 1: exc_bad_access(code=2, address=0x608000264600) button.title = "hi!" } } } note don't have problems when use methods declared in superclass( nsbutton ). what's problem? should fix it? you have correctly set button's class in interfacebuilder. has predefined value set, nsbutton . have set mcbutton instead. only reference correct instance of 1 of mcbutton s.

c# - Is there a built in function to determine the newest ClickOnce version that was published? -

i deploying winforms application clickonce. app has 40 users. users access app via app installed on pc , not shortcut icon on desktop. shortcut routing them local network folder download latest software updates. i using system.version class determine version number of application user runs on pc: dim versionbeoforestring version = nothing 'version number versionbeoforestring = main_menu.currentversion i wondering if there built in function can use determine if version client running on pc newest version? or need develop myself.

c - Storing integers from a text file into an integer array -

i have problem exercise, statement following: save matrix name matriu[7][10] , getting numbers file. here text of file: matrix.txt 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,0 ,1 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,0 ,0 ,1 ,0 ,0 ,0 ,1 ,0 ,1 ,1 ,0 ,0 ,0 ,1 ,0 ,1 ,0 ,0 ,1 ,1 ,0 ,0 ,0 ,0 ,1 ,0 ,0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , following version did, fails. can me fix? int main() { int i; char linea[3024]; int j; file* file; file = fopen("matriu.txt", "r"); int matriu[7][10]; while (fgets(linea, sizeof(linea), file) != null) { char* token; token = strtok(linea, ","); printf("%s\n", token); while (token != null) { token = strtok(null, ","); if (token != null) matriu[i][j] = atoi(token); printf("%s\n", token); } } (i = 0; < 7; i++) { (j = 0; j < 10; ...

python - Use different view in Django if the url contains specific character -

i have view: def url_redirect(request,id): url = get_object_or_404(url,short_id=id) return httpresponseredirect(url.httpurl) and these urls: urlpatterns = [ url(r'^admin/', admin.site.urls), url(ur'^(?p<id>.*)$', views.url_redirect), ] basically redirecting http://127.0.0.1:8000/xyz different site now have possibility use different view if url varies adding "!" character, i.e : http://127.0.0.1:8000/!xyz so whenever use url else redirecting. any idea how can this? appreciated. if want deal in same view, leave urls , change view: def url_redirect(request,id): if id.startswith('!'): id = id[1:] # whatever want id else: url = get_object_or_404(url,short_id=id) return httpresponseredirect(url.httpurl)

c# - Access content-length in custom WCF MessageEncoder -

i attempting show progress of streamed wcf message implementing custom messageencoder , overriding readmessage method. can download data , report progress coming in interested know full message size before happens. is possible in encoder or somewhere else see size of incoming message before downloaded? know length available in http headers don't see way access them. here have far: public override message readmessage(stream stream, int maxsizeofheaders, string contenttype) { memorystream content = new memorystream(); byte[] buffer = new byte[512]; var bytesread = 0; { bytesread = stream.read(buffer, 0, buffer.length); content.write(buffer, 0, bytesread); // report progress this.reportprogress("downloading...", bytesread); } while (bytesread > 0);

javascript - Edit newly added items within array of objects and update DOM -

here's jsfiddle . the array of objects looks below: var data = [{ "conferenceusers": [{ "id": 3006, "conferenceid": 8, "name": null, "email": "mail@lala.com", "username": null, "phonenumber": "234234234234" }], "id": 8, "subject": "yyyhaaaaa", "starttime": "2016-05-29t18:30:00", "endtime": "2016-05-29t19:30:00", "organizeremail": "elpas@live.com", "organizername": "dasdasd", }, { "conferenceusers": [{ "id": 3013, "conferenceid": 12, "name": null, "email": "dsfdfsdfdsf@dfdfdf.com", "username": null, "phonenumber": null }], "id": 12, "subject": "dsfsdfdsfsdf", "starttime": "2016-05-3...

Integrate facebook sdk5 to codeigniter manually -

what difference facebook-php-sdk v3 v5. how can integrate lastest facebook php sdk 5 codeigniter v3? i looking way set manually. did round of searching , find documentation on sdk 3. new codeigniter , want implement way use facebook login , validate user throughout website. have installed codeigniter in subfolder , made changes in .htacess remove index.php urls. i sorry, don't have been searching online , couldn't find on this. so managed pull off finally. installed xampp in windows laptop, copied files hosted server folder in htdocs folder of xampp ( yeah should have started here begin :) ) steps followed install recent version of xampp move website files including codeigniter installation htdocs folder or sub-folder within htdocs install exe file composer https://getcomposer.org/ copy files , follow step step @ instruction https://github.com/darkwhispering/facebook-sdk-codeigniter the steps mentioned there given below quick glance. [ 1.download ...

ubuntu - GitLab Omnibus has missing 'nginx' folder in 'etc' -

i'm trying host other apps on same server gitlab installed on using ubuntu. per searching on gitlab's documentation , see can enable custom .conf files , direct them should live inside /etc/nginx/conf.d/ path. reference says put them in specified path, i'm lacking nginx folder in /etc . not sure if it's intended not installed in /etc , why reference saying nginx should there? update 1: per, @bradrini's response i've managed create directories within /etc/nginx/conf.d configuration file named example.conf . domain structure have setup have gitlab @ dev.example.com , have other app pointed test.example.com . below nginx configuration new domain: server { # using actual ip here houses gitlab , test.example.com domain listen 111.111.111.11:443 default_server ssl; # domain called server_name test.example.com; # wildcard cert used gitlab ssl_certificate /etc/gitlab/ssl/dev.example.com.crt ...

angularjs - angular-materialize DatePicker doesn't show on Edge browser, scrolls the page down on IE and Edge -

i'm using angular-materialize demo project , far it's been pretty easy use. however, when doing browser compatibility test pass found datepicker component doesn't work when using ie , edge browsers. on ie scrolls page down when overlay appears , doesn't work on edge browser. can see bugs on angular-materialize demo page open link in ie or edge. please refrain answering question "why not use angular-material". although ui similar, there parts of materializecss prefer on google's angular-material. far, issue i've found.

javascript - AngularJS applications imply single page applications? -

so spent past 5 hours reading on angular js. seems lot of people heavily associating framework single page applications when accommodated back-end mvc framework nice api usage ruby on rails or laravel. i have 2 main questions have been boggling me: how initialize such apps considering content dynamic in nature. when using ror/laravel, i'd prepare html dynamic data @ back-end , serve initial pages. seems people using angular serve basic skeleton of html , round trip web server again data. how done? if not, please suggest right way. secondly, dont think embark on project single paged application in mind. mean overkill use angularjs project. have use case think appropriate require angularjs non single page application jquery cant handle easily?

recursion - C: Finding Huffman-coded path of specific leaf in tree -

i'm trying write recursive function locates specific leaf within huffman tree, prints shortest path zeros , ones (zero being traversal left, , 1 being traversal right). understand logic of need do, i'm not having success @ implementing it. believe have skeleton here, part i'm missing more complicated logic tell when should run printf , when should not (since prints every 0 , one). also, know rest of logic outside of working because if normal traversal not have plot shortest paths, each of elements searching found. i've tried looking @ quite few resources online , cannot find solution, or @ least, cannot recognize solution properly. i've rewritten 50 or more times. let me know think! void traverse(struct tree *curr, struct tree *cmp) { if (curr == null) { return; } if (getleft(curr) == null && getright(curr) == null) { if (curr == cmp) { return; } } if (getleft(curr) != null) { printf("0"); ...

css - In LESS, is it possible to import one selector's content into another one? -

my goal import content: '\e826'; icon class selector in case content property changes in future. .icon-hi:before {content: '\e826';} .panel { background: white; .panel-title { &:before { @include .icon-hi; text-align: center; width: 20px; height: 20px; } } } of course @import doesn't work that, there way? for purpose of defining value in 1 place, should use variables: @icon-hi: '\e826'; .icon-hi:before {content: @icon-hi;} .panel { background: white; .panel-title { &:before { content: @icon-hi; text-align: center; width: 20px; height: 20px; } } } you can 'import 1 selector another'. mixins do. these first 2 features in less documentation - http://lesscss.org/features/ a third option use extend feature: http://lesscss.org/features/#extend-feature

Will it be possible that implementing Clojure (or Clojure syntax) over SBCL(or Other fast Lisp)? -

i've tried both sbcl , clojure , found syntax of clojure slow compared sbcl me. there implementation of clojure on sbcl or possible? i found https://github.com/ayrnieu/disclojure can enlighten me. :-) clojure intended target several backends. side effect clojure being hosted language designed philosophy of embracing host . never goal, instance, make same code written clojure on jvm run unmodified on, again instance, clr. substantial amounts of code common between clojure jvm , clojurescript, nice bonus. it stable for: jvm javascript/ecmascript generally stable for: clr/.net and know of experimental builds for: python c scheme ios (via scheme) more targets showing interest , time intersect. if provide implementation favorite lisp, patches welcome! advisable base implementation on clojurescript compiler best exemplifies intended development methods compiler.

.htaccess - htaccess rewrite subdomains to 1 file -

i helping site , want template page (example.com/template) shown on each of subdomains. so when user navigates a.example.com or b.example.com , etc. they see example.com/template.php but url stays a.example.com or b.example.com , etc. i know there way can't figure out. want able change of pages @ once making change 1 file. i think close code keep 500 errors rewritecond %{http_host} ^$.example.com$ [nc] rewriterule ^$ $1.example.com/template.php ps: these actual domains, not virtual have rewriteengine on rewritecond %{http_host} ^.+\.dfwfamilylifenews\.com [nc] rewriterule ^$ /template.php [l] # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress firstly, make sure rewrite module loaded in apache. see this answer more info. second, need change rules to: rewri...