Posts

Showing posts from January, 2012

c++ - Why am I getting "error: type name is not allowed" with these spaghetti templates? -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i have following code bit of "spaghetti" of templates: template <typename a, typename b, typename... args> class c { /*... */ bar& getbar() { /* ... */ } public: template <typename u> static void foo() { a = geta<u>(); baz& bar = getbar(); bar.frob<u>(a); /* @@@ */ } /*... */ } /* no template */ class d : public c<somea, d, const somee&> { /* ... */ } /* no template */ class f : public d { /* ... */} and when try compile function following statement: d::foo<f>(); i error type name not allowed , on line marked @@@ . why getting that? know when try call function type name, doesn't i'm doing here. it's classic template ambiguity, unfortunate

android fragments - Changing background (image not color) of an activity with a button. ENG/HUN -

im working on own application contains thoughts, ideas of life. system works like random facts app , clicking on button , idea (a textview) changing. made settext text changing , multiple texts in string. what want achieve: 1. background (i made multiple png files) changing when button click. (not text). 2. prefer swipe action button click method, because go forward. next button, , want swipe previous text , swipe right next text. these complicated classes , xmls :/ ( hope can understand) mainactivity.java public class mainactivity extends appcompatactivity implements navigationview.onnavigationitemselectedlistener { navigationview navigationview = null; toolbar toolbar = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //set fragment mainfragment fragment = new mainfragment(); android.support.v4.app.fragmenttransaction fragmenttr

PHP mkdir() Invalid Path -

i'm trying save files on server, , prerequisite, create directories don't exist. i running script, dl.php , @ /home/public_html/www3/scripts/dl.php : $request['savedir'] = '/home/public_html/www3/scripts/images/logs'; if( !is_dir($request['savedir']) ) mkdir($request['savedir']); and get: warning: mkdir(): invalid path in /home/public_html/www3/scripts/dl.php the "images" exist. please check "images" folder owner , permissions. requires write enabled used "apache" user/group when executed in browser. error "permissions" since not visible "apache" user.

java - Add space between string to display in HTML file -

i doing assignment create html java code. knows how add space between words? example, when type java fun then create html display word without space javafun i did try add space textrow.append("<td>" + words.get(i).getword().replaceall("", " ") + "</td>"); didn't work this code: private void addwordlist(arraylist<wordtracker> words) { // holds 1 line of table text @ time. out.write("<table align='center' >"); stringbuilder textrow = new stringbuilder(); int rowcounter = 0; (int = 0; < words.size(); i++) { if (rowcounter == 0) { textrow.append("<tr class='answerkey'>"); } textrow.append("<td>" + words.get(i).getword() + "</td>"); rowcounter++; if (rowcounter == 5 || == words.size() - 1) { rowcounter = 0; textrow.append("

reactjs - React rerender only one child -

in form have few dropdown components. whenever first dropdown option changes want update props second dropdown , rerender it. code looks this handleprojectchange(option) { //this.setstate({ selectedproject: option }) this.refs.phase.props = option.phases; //this.refs.forceupdate() this.refs.phase.render() } render() { var projectoptions = this.projectoptions var defaultprojectoption = this.state.selectedproject var phaseoptions = defaultprojectoption.phaseoptions var defaultphaseoption = phaseoptions[0] var worktypeoptions = api.worktypes().map(x => { return { value: x, label: x } }) var defaultworktypeoption = worktypeoptions[0] return ( <div> <dropdown ref='project' options={projectoptions} value={defaultprojectoption} onchange={this.handleprojectchange.bind(this)} /> <dropdown ref='phase' options={phaseoptions} value={defaultphaseoption} /> <dropdow

java - setOnMouseDragged not working on browser view -

Image
i'm writing simple application in java using jxbrowser engine i'm stuck @ beginning. in code, there undecorated stage want make draggable. so, searched , found following link: how drag undecorated window so set mousepressed , mousedragged event on stackpane mousepressed event gets fired , mousedragged event no way gets fired. idea of what's problem? thanks in advance. import com.teamdev.jxbrowser.chromium.browser; import com.teamdev.jxbrowser.chromium.javafx.browserview; import javafx.application.application; import javafx.application.platform; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.input.mouseevent; import javafx.scene.layout.stackpane; import javafx.stage.stage; import javafx.stage.stagestyle; private static double xoffset = 0; private static double yoffset = 0; public class main extends application { public static void main(string[] args) { launch(args); } @override public void sta

ios - Do I need to edit provisioning after changing AppID -

Image
i have app on appstore. until day not using push notifications. right add aps app. edited appid generate ssl certificates push notification server. need regenerate provisioning profile associated changed appid? yes regenerate provisioning profile when changing app id . as seen in documentation , if change app id, need change provisioning profile. as exemplified in diagram below (for team provisioning profile) , explained here , provisioning profile contain set of iphone development certificates, unique device identifiers , app id . you can edit app id directly using member center. in member center, select certificates, identifiers & profiles. under identifiers, select app ids. select app id want change, , click edit. select corresponding checkboxes enable app services want allow. followed by later, you’ll regenerate provisioning profiles use app id.

arrays - How to get specific keys from a json file with php -

so have json file [ { "var1": "6", "var2": "13", "var3": "17" }, { "var1": "9", "var2": "11", "var3": "6" } ] how can values of var2 13 , 11 ? use json_decode() $json = '[{ "var1": "6", "var2": "13", "var3": "17"},{ "var1": "9", "var2": "11", "var3": "6"}];' $array = json_decode ($json, true); $values = []; foreach ($array $ar) { $values[] = $ar['var2']; } var_dump($values);

database - Find all users having rented every car in SQL -

find users having rented every car in sql the database has following structure (the primary keys in bold): rent ( people , cars , daterent , expectedreturndate , effectivereturndate ) lateness ( people , cars , daterent , latenessfee ) my attempt: select rent forall cars exists daterent can me expressing correctly such query? from you've provided, following works. first, want determine how many different/unique cars there are: select count(distinct car) rent) next, want select people have rented every different/unique car - 1 way checking count of distinct cars each person same count of distinct cars: select people rent group people having count(distinct car) = (select count(distinct car) rent)

Python differences in class definitions -

this question has answer here: python class inherits object 7 answers what difference between old style , new style classes in python? 9 answers i know following works never understood difference between class animal: class animal(): class animal(object): is style difference or more it? in python 3, 3 same, i.e. derive object .

java - What is the reason why this variabe change from main method is not effected on upper Class -

please forgive if of novice question, need understand why call b.createnumb(1) in main method effect change on numb in classb. class classb { int numb = 0; public int getnumb(){ return numb; } void createnumb(int num){ numb = num; } } public class classa { classb b = new classb(); // returns numb classa public int returnb(){ return b.getnumb(); } public static void main(string[]args){ classa = new classa(); classb b = new classb(); //my espectation b.createnumb(1) should update numb in classa b.createnumb(1); system.out.println(a.returnb()); } } the code when run prints 0 instead of 1; please need explanation happening behind code. thanks. this wouldn't work because creating separate instances of classb . if want work, have pass instance classa . this

Two HTML Issues: Width 100% not working and Divs not separating from each other -

first of all, in portfolio section images shown, css property width: 100% is not working. second, have 2 divs are, reason, stuck together. how fix these? the fiddle here: http://jsfiddle.net/wjp9h/ clarification: 2 divs stuck "images" , "about" divs. can see, background color "about" div stuck "images" div. is there content in divs? if there not content in divs, collapse when set width 100%. as divs being stuck together, have tried adding margin divs? <div style="margin: 5px">some content here.</div> <div style="margin: 5px">other content here.</div>

r - Using a global function to identify which subfunctions to run -

i have dataset categorical variable may take around 6 or 7 unique variables. depending upon variable is, need run several functions - each of different depending upon value of categorical variable. i don't know how go programming things called correctly. keep in mind might simple here, in scenario more complicated lots of sub functions. library(dplyr) func1_value_one = function(multiplication_value){ mtcars$check="value_one" mtcars$mpg =mtcars*multiplication_value filter(mtcars, mpg>60) } func0_value_zero = function(division_value){ mtcars$check="value_zero" mtcars$mpg =mtcars$mpg / division_value filter(mtcars, mpg <3) } help_function=function(category_p,change_p){ mtcars=return(filter(mtcars, vs==category_p)) data=ifelse(category_p==0,return(func0_value_zero(change_p)),return(func1_value_ one(change_p) )) return(data) } #i want filter va

How to import jQuery UI using ES6/ES7 syntax? -

i trying use jquery ui functionality in reactjs/redux application. i've imported both jquery , jquery ui using: npm install jquery jquery-ui and i've tried: import $ 'jquery'; import jquery 'query'; import jquery-ui 'jquery-ui'; however jquery ui not seem imported when try like: componentdidmount() { $('ol#mylist').selectable(); } i believe issue jquery ui. doing wrong? how can jquery ui work stack? thank you! i'm using partial import jquery-ui. mean import module needed jquery-ui: import $ 'jquery'; import 'jquery-ui/themes/base/core.css'; import 'jquery-ui/themes/base/theme.css'; import 'jquery-ui/themes/base/selectable.css'; import 'jquery-ui/ui/core'; import 'jquery-ui/ui/widgets/selectable'; ( take in account i'm using webpack https://webpack.github.io/ , in other environment approach may differ)

mysql - GROUP_CONCAT: search for subset and retrieve all values -

i have 2 tables: posts +--------------------------------------------------------------------+ |id ¦status¦type ¦url | +------------+------+-----+------------------------------------------+ |25949664 ¦80 ¦link ¦http://example.com/25949664 | |25777570 ¦80 ¦photo¦http://example.com/25777570 | +--------------------------------------------------------------------+ attributes ╔════════════╦════════════╦══════════════════════════════════════════╗ ║id ║attr ║value ║ ╠════════════╬════════════╬══════════════════════════════════════════╣ ║25949664 ║timestamp ║1430836105 ║ ║25949664 ║tag ║red ║ ║25949664 ║tag ║yellow ║ ║25949664 ║tag ║brown ║ ║25949664 ║source ║http

Geting new versionId on marklogic node.js write with versionId -

is possible obtain new versionid when modifying document optimist locking enabled without performing read after write? @ https://docs.marklogic.com/guide/node-dev/documents#id_26261 success data doesn't containt new versionid. it's question but, unfortunately, @ present isn't possible return version id after update. you can perform probe (the equivalent of head request in node.js api), should less expensive read (the equivalent of request in node.js api). you may want have customer support contact file rfe (request enhancement) return versionid after write.

llvm - Making lldb work inside lxc -

i wanted play new lldb since supposed work better on linux , tried use inside container. sadly seems consider connection coming container ipv4 , not localhost rejects it: error: rejecting incoming connection 192.168.1.2 (expecting 127.0.0.1) i couldn't see how make work far. work on lldb on linux ongoing, please file bug @ lldb.llvm.org bugzilla.

Detecting application crash in XCode/swift -

for os x app persistent state, there anyway programatically detect whether last time application open, crashed, or closed unexpectedly? (so can perform actions ensure application in consistent state) you can use nssetuncaughtexceptionhandler described here . nssetuncaughtexceptionhandler { exception in print("exception: \(exception.name) \(exception.reason!) \(exception.description)") print(exception.callstacksymbols) } the code using is... nssetuncaughtexceptionhandler { exception in exceptionmanager.handle(exception) } and exceptionmanager class includes... class exceptionmanager { class func handle(exception: nsexception) { var exceptions = [exceptionitem]() if let items = nsuserdefaults.standarduserdefaults().arrayforkey("uncaughtexceptions") as? [nsdata] { item in items { if let exception = nskeyedunarchiv

javascript - Form with lots of controls with interaction between them. Cleaner approach than $scope.$watch? -

i building angular app , form has 15 controls. it’s finance application. please don’t suggest break down page etc. some of controls depend on each other. there 5 input controls (lets call them source controls), of can change, , impact 1 or more of 5 other controls (lets call them dest controls). way have structured have $scope.$watch on each of 5 source variables , in each watch function have code decide of 5 dest variables updated , update them. example of 1 of watches shows below. $scope.$watch('money.price',function(newval,oldval) { if(newval != oldval) { if($scope.money.quantity != undefined) { updateprincipal($scope) updatefees($scope); $scope.money.net = $scope.money.principal + $scope.money.fee } } }); i don’t find elegant. there better / cleaner way ? (the form little more complex in future i.e. 2-3 more dependency fields not more that). assuming input controls have ng-model attached them,

c++ - Dll injector don't works for x64 processes -

i have code , want inject dll file x64 process, code don't works, if compile 64 bits plattform. someone can me please? any suggestion welcome. here complete code , compiling perfectlly: #include <iostream> #include <direct.h> #include <windows.h> #include <stdlib.h> #include <strsafe.h> #include <tlhelp32.h> #include <tlhelp32.h> #include <tchar.h> #include <psapi.h> #include <cstring> #include <string> #include "injector.h" using namespace std; typedef tchar *ptchar; bool getprivileges(); bool injector::injectdll(dword processid, std::string dllpath) { handle hthread, hprocess; void* plibremote = 0; hmodule hkernel32 = getmodulehandlea("kernel32"); char dllfullpathname[_max_path]; getfullpathnamea(dllpath.c_str(), _max_path, dllfullpathname, null); printf("loading dll: %s\n", dllfullpathname); getprivileges(); hprocess = openprocess(

javascript - Tab transitions within Modal (Ionic) -

i need open modal, displays page uses tab style of transitioning between pages. i cannot browse between links within modal (without closing modal). want create tab-like transition between tabs in modal. for links close modal, use closemodal() . works on browser on devices, must use ionic's native href behaviour over-rides closemodal(): <a href="#/storeshop/{{stores[i].id}}" ng-click="closemodal()"> here $ionicmodal.fromtemplateurl('app/components/stores/stores.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modal = modal; }); $scope.refineevent = function() { $scope.modal.show(); }; $scope.closemodal = function() { $scope.modal.hide(); }; $scope.$on('modal.shown', function() { console.log('modal shown!'); }); my html: <ion-modal-view> <ion-view name="stores"><ion-pane ng-controller="storesctrl">

get specific attribute xml java -

i trying read xml file, , interested in item name="pubdate" attribute. <esummaryresult> <docsum> <id>23373820</id> <item name="pubdate" type="date">2013 mar</item> <item name="epubdate" type="date">2013 feb 1</item> <item name="source" type="string">expert opin emerg drugs</item> <item name="authorlist" type="list">...</item> <item name="lastauthor" type="string">rascol o</item> <item name="title" type="string">...</item> <item name="volume" type="string">18</item> <item name="issue" type="string">1</item> <item name="pages" type="string">39-53</item> <item name="langlist" type="list">...</item> <item name="nlmuniqueid"

Modify a Solidworks Global Variable Value - C# -

i trying modify global variables within c# code. based on these 2 examples: re: macro change global variable 2015 solidworks api - add , modify equations example (c#) i have come following code, doesn't change global variables. also, when go equation manager after code runs has red xs equations , says "the syntax of equation incorrect". string depth = "\"depth\" = " + param["part"].substring(0, param["part"].indexof("x")); string flangewidth = "\"flangewidth\" = " + param["width"]; swequationmgr = swmodel.getequationmgr(); swequationmgr.setequationandconfigurationoption(0, depth, (int)swinconfigurationopts_e.swallconfiguration, null); swequationmgr.setequationandconfigurationoption(0, flangewidth, (int)swinconfigurationopts_e.swallconfiguration, null); note: depth variable correctly evaluates ("depth" = 8) & flangewidth evaluates ("flangewidth" = 3.5).

python - Create PyGal graph from pandas dataframe -

i wanted try using pygal it's ability create svg data i'm going create printed pdf page merged html svg graph. what want equivalent of pygal.plot(dataframe) i'm not seeing in docs. i know can do: df = pd.series(np.random.randn(5), index = ['a', 'b', 'c', 'd', 'e']) chart = pygal.line() index, row in df.iteritems(): chart.add(index,row) but seems wrong python point of view. should doing differently? plus how if dataframe had multiple columns? you using pygal api wrong way. labels should correspond index. also, should avoid iteritems when using pandas. line_chart = pg.line() line_chart.x_labels = ['a', 'b', 'c', 'd', 'e'] line_chart.add('firefox', pd.series(np.random.randn(5))) line_chart.render_to_file('bchart.svg') hope helps. edit: dataframe can use of series , add them 1 one line_chart.add('series name', pd.series(np.random.randn(5)))

solr - Cant start jetty from terminal - get error on start up -

directory jetty installed, used brew install jetty vallis-macbook-pro:9.3.7.v20160115 vallisa$ cd libexec/ vallis-macbook-pro:libexec vallisa$ ls -ltr total 1208 drwxr-xr-x 60 vallisa admin 2040 jan 15 16:37 modules drwxr-xr-x 8 vallisa admin 272 jan 15 17:04 demo-base drwxr-xr-x 3 vallisa admin 102 jan 15 17:05 webapps drwxr-xr-x 3 vallisa admin 102 jan 15 17:05 resources drwxr-xr-x 3 vallisa admin 102 jan 15 17:05 bin drwxr-xr-x 44 vallisa admin 1496 jan 15 17:05 lib -rw-r--r-- 1 vallisa admin 3978 jan 15 17:05 start.ini -rw-r--r-- 1 vallisa admin 142605 jan 15 17:06 start.jar -rw-r--r-- 1 vallisa admin 30012 jan 15 17:06 license-eplv10-aslv20.html drwxr-xr-x 50 vallisa admin 1700 jan 15 17:06 etc -rw-r--r-- 1 vallisa admin 428261 jan 15 17:06 version.txt -rw-r--r-- 1 vallisa admin 5 feb 7 19:05 jetty.pid drwxr-xr-x 4 vallisa admin 136 feb 7 19:05 logs -rw-r--r-- 1 vallisa admin 98 feb 7 19

angularjs - Angular - Filtering a list where { Item.user.id : something } -

i have list of "savings" in ng-repeat. model savings is var savingschema = new schema({ title: { type: string, }, link: { type: string, }, user: { type: schema.objectid, ref: 'user' } }); therefore need saving.user._id im trying like <div ng-repeat="saving in savings|filter:{ 'user._id': 'otherid' }"> but doesnt user._id works fine ._id if want filter top level _id not embedded user._id how filter embedded user._id left side parameter

excel - How to redefine last row within a loop -

the following code inserts rows when blank cell in col b encountered , specific values present in col a. inserted rows populated values arrays depending on condition. each time rows inserted need last row value change, code can evaluate next blank cell in col b can’t figure out how redefine last row. how make work? what kind of loop need use? where redefine last row? how move next blank cell in column b? thank much, sub missingvalues() dim zarr variant dim yarr variant dim lastrow long dim sht worksheet dim long set sht = thisworkbook.worksheets("qc") application.enableevents = false application.screenupdating = false yarr = array(array("hd300 removed alt", "egfr", "", "", "l861q", "5"), _ array("hd300 removed alt", "egfr", "", "", "kelre745delinsk", "5"), _ array("hd300 removed alt", "egfr", "&q

Unable to evaluate if not for python -

i'm writing program python , i'm new python. i'm stuck problem need achieve 'if not' condition after validation on input data. please guide me i'm doing wrong , how can fix this. thanks, code if(options == 1): print"please enter degrees fahrenheit:" val1 = input('') val2 = str(val1) commaexist = any([st in ',' st in val2]) if not commaexist: print"1" elif: print"2" elif(options == 2): print"2p" elif(options == 3): print"3p" else: print"invalid" can please guide me best approach use input() instead raw_input ? need validate input numbers decimal point , minus sign other input invalid. approach use any() ? or python give other methods too. why not use: if "," not in val2: print ("1") else: print ("2") btw, print statements without parenthesis not work in python 3, pyth

c# - Managed Debugging Assistant 'PInvokeStackImbalance' has detected a... on trivial method -

Image
i calling delphi function c# , error: managed debugging assistant 'pinvokestackimbalance' has detected problem in ... i've exhausted attempts changing .net code fit delphi signatures, why doesn't work basic integers has me stumped, know going wrong? even simplest function using 2 integers produces error. i'm targeting x86 , have put in couple of hours research following solutions haven't helped here , here , here , one . this delphi code (compiled dll version can downloaded here ): unit pasballentry; interface procedure entrypoint( inint: integer; instr: pchar; var outint: integer; var outstr: pchar); stdcall; procedure releasestring( outstr: pchar); stdcall; procedure timtamc( inint: integer; instr: pchar; var outint: integer; var outstr: pchar); cdecl; procedure releasestringc( outstr: pchar); cdecl; procedure timtamcs( inint: integer; instr: pchar; var outint: integer; va

Error 404 not found with .htaccess in folder on XAMPP/Apache -

i have test server xampp (apache/php/mysql) running on windows server 2003. i used without problems .htaccess , .htpasswd files. on site i'm working on error 404 (yes! not 403) when trying open file inside directory protected .htaccess , looks like: <files .htaccess> order allow,deny deny </files> authname "area riservata" authuserfile \web\test\keys\.htpasswd authtype basic require valid-user i changed .htpasswd directory same of .htaccess ( \web\test\public_html\admin\.htaccess ) file without success! if remove file works fine: apache logs , error logs nothing. where problem/error? edit on document_root ( \web\test\public_html\ ) have .htaccess file. discovered when commenting last line (as following - no redirect index.php non file , symlinks) problem disappear. don't understand why! rewriteengine on rewritecond %{request_uri} ^/(it|de|fr|en)/(.*)$ [nc] rewritecond %{document_root}/multi_html/%2 -s rewriterule ^(it|de|fr|e

loops - How to set up jQuery dynamic event handlers properly? -

i still beginner, , tried set dynamic event handlers on input of type(text) in <td> in dynamic html table, following code: for(var i=0; i<5; i++){ table += '<td><input type="text" name="vote['+i+']"></td>'; $("#table").on("keyup", "input[type='text'][name='vote["+i+"]']", function() { console.log("called: "+i); calculate(i); }); } it did not work. value of i(as displayed in console.log) not supposed be, is, 0 4 successively, 5. elsewhere use similar patterns in example below, , works. $.each(array_parties, function(i, objparty) { var stationid = objstation.stationid; var partyid = objparty.partyid; table += '<td><input type="text" name="items['+stationid+']['+partyid+']"></td>'; $("#table").on("keyup", "input[type='

javascript - Dynamically expand the height of a textarea when typing more then the max width -

how grow textarea horizontally when typing more max width of text area element? don't want see horizontal scrollbar. rendered html <textarea name="catchphrase" class="input-validation-error" id="catchphrase" aria-invalid="true" aria-required="true" aria-describedby="catchphrase-error" rows="2" cols="20" data-val-required="the catch phrase field required." data-val="true" data-val-maxlength-max="50" data-val-maxlength="the field catch phrase must string or array type maximum length of '50'." htmlattributes="{ id = profilecatchphrase, class = form-control }">i yoga sd;lasdlk asdks';aksd'asd 'asd';las ';asd'lasd';las'dl as'dla'sdl'asld as'd;las'dl; a;sdlka;sdklasd ;alsd;lkasda ;alskd;lkasd ;lkasd;lk</textarea> before rendering html <div class="form-gro

c++ - Displaying single QML item in several views -

in qt application, have 2 separate views, supposed display single qml item. means, changes adding child items displayed in both views. yet, views have rendered separately. similar example displaying 1 image in 2 views different position, zoom level , resolution

regex - how to find all the double characters in a string in c# -

i trying count of double characters in string using c#,i.e "ssss" should 2 doubles not 3 doubles. for example right have loop in string this string s="shopkeeper"; for(int i=1;i<s.length;i++) if(s[i]==s[i-1]) d++; the value of d @ end should 1 is there shorter way this? in linq or regex? , perfomance implications, effective way? help i have read [how check repeated letters in string c# ] , it's helpful, doesn't address double characters, looking double characters try following regex extract double characters: "(.)\1" upd: simple example: foreach (var match in regex.matches("shhopkeeper", @"(.)\1")) console.writeline(match);

authentication - Enabling mongodb auth -

i have install of ubuntu 14.04 x64 thing have done fresh update , install mongodb , pritunl. here how installed both $ nano /etc/apt/sources.list.d/mongodb-org-3.0.list deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse $ nano /etc/apt/sources.list.d/pritunl.list deb http://repo.pritunl.com/stable/apt trusty main $ apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7f0ceb10 $ apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv cf8e292a $ apt-get update $ apt-get install pritunl mongodb-org $ service pritunl start now enable auth on mongodb 3.0.9 have used guide here https://medium.com/@matteocontrini/how-to-setup-auth-in-mongodb-3-0-properly-86b60aeef7e8#.a1nfxsy3a after create first user , i security: authorization: enabled i run problems cant make connection locahost here error receive ~# mongo pritunl --port 27017 -u admin -p passwordhere --authe

c - Returning address of a local variable error -

i typed code: void main() { int *a; = foo(); printf("%d\n", *a); } int* foo() { int b = 10; return &b; } after compiling, there 2 problems: 1. error - conflicting type foo() 2. warning - function returns address of local variable but write int* foo(); void main() { int *a; = foo(); printf("%d\n", *a); } int* foo() { int b = 10; return &b; } now, not give error after compiling, obvious, but, why compiler not give warning returning address of local variable? how declaring or not declaring function affects returning address of local variable? sorry not mentioning before, using gnu gcc compiler the c standard not require compilers give warnings except syntax errors. iso/iec 9899:1999, 5.1.1.3: a conforming implementation shall produce @ least 1 diagnostic message (identified in implementation-defined manner) if preprocessing translation unit or translation unit contains violation

html - php require method wont display css styling -

i created index.php file that's uses <?php require("sidebar.html"); ?> include sidebar; html element of sidebar shows, css styling isn't showing. i've search google , tried different method it's not showing, highly appreciated. the sidebar.html located in html/ folder. , index.php located in root/ folder the css styling sidebar being reference within sidebar.html file my css file located in css/ folder new web development; trying make sidebar can call on every page instead of hard-coding every page. when include html file php script, path supporting files (i.e css,js or referenced in html document) listed in html file needs relative php script in have included html. if have index.php in directory named home , include html page in named sidebar.html (let's consider path file home/foo/sidebar.html ) contains 1 or more link elements in head element reference css stylesheets saved in same directory, can't write href a

python - Reserving space for list -

i have make list2 use name list1 number of name in list1 can vary. foo = ['spam', 'eggs'] bar = [['spam', ['a', 'b']], ['eggs', ['c', 'd']]] so, reserve bar by bar = [[none] * 2] * len(foo) and copy names list1 looping bar[i][0] = foo[i] but result name in every sublist same this bar = [['eggs', ['a', 'b']], ['eggs', ['c', 'd']]] i try reserve by bar = [[none, none], [none, none]] and no issue @ all. think problem come how reserve list. how can fix this. if don't understand english, please ask. thanks. create second list this: list2 = [[none]*2 x in range(len(list1))] or alternativly, if reason don't use comprehensions, do list2 = [] x in range(len(list1)): list2.append([none,none]) the problem when like [listitem] * numcopies you list contains numcopies copies of the same listitem , sublists same - when change 1

embedded - Why the delimiters are used in CAN protocol -

what purpose of delimiters in can protocol .. know there crc delimiter, ack delimiter , on.. there specific purpose this. kindly on topic.. in advance :) the "recessive" delimiter bits ensure there bit transitions in fields not have bit-stuffing applied. bit transitions necessary recover timing synchronisation might not otherwise available due nrz encoding.

c# - Change CSS of li tag which is inside div and ul tag : jQuery or JavaScript -

this menu. using metro ui template. <div id="divmenu" class="fluent-menu" data-role="fluentmenu" data-on-special-click="specialclick"> <ul class="tabs-holder"> <li id="litabhome" class="active"><a href="#tab_home">home</a></li> <li id="litabmailings" class=""><a href="#tab_mailings">mailing</a></li> <li id="litabfolder" class=""><a href="#tab_folder">folder</a></li> <li id="litabview" class=""><a href="#tab_view">view</a></li> <li id="limasters" class="active"><a href="#tab_masters">masters</a></li> </ul> <div class="tabs-content"> <div class="tab-panel" id="tab_home" sty