Posts

Showing posts from May, 2014

ActionEvent get source of button JavaFX -

i have 10 buttons going sent same method. want method identify source. method knows button "done" has evoked function. can add switch case of if statement handle them accordingly. have tried //call: btndone.setonaction(e -> test(e)); public void test(actionevent e) { system.out.println("action 1: " + e.gettarget()); system.out.println("action 2: " + e.getsource()); system.out.println("action 3: " + e.geteventtype()); system.out.println("action 4: " + e.getclass()); } output result: action 1: button@27099741[styleclass=button]'done' action 2: button@27099741[styleclass=button]'done' action 3: action action 4: class javafx.event.actionevent done text on button. can see use e.gettarget() and/or e.getsource() i'll have substring it, "done" appears. there other way string in apostrophe instead of having substring. update: have tried passing butt...

vb6 - How to remove selected item from msflexgrid -

i using vb6 , in using msflexgrid want remove complete row selected user , once done automatically set focus textbox, while searching on internet useful problem when click on button remove rows first row header of flexgrid , don't want remove first row. here code private sub cmddell_click() dim integer grdarticles 'the msflexgrid if .rowsel <> 0 'check if there selected row = .rowsel .rows - 2 'loop selected row las row .textmatrix(i, 0) = .textmatrix(i + 1, 0) 'set rows 1 .textmatrix(i, 1) = .textmatrix(i + 1, 1) .textmatrix(i, 2) = .textmatrix(i + 1, 2) .textmatrix(i, 3) = .textmatrix(i + 1, 3) next .rows = .rows - 1 'make rows 1 less else msgbox "selecet row delete!!!", vbexclamation end if end end sub if allow 1 row selected @ time need use me.msflexgrid1.removeitem me.msflexgr...

react jsx - Material-ui example -

i got code snippet material-ui (simple example) website , seems doesn't work copying , paste directly. it throws error unexpected token ("line#") while parsing , particularly in handlechange = ....... . i'm using visual studio code , i'm new using material-ui in jsx. what missing? please help. import react 'react'; import dropdownmenu 'material-ui/lib/dropdownmenu'; import menuitem 'material-ui/lib/menus/menu-item'; export default class dropdownmenusimpleexample extends react.component { constructor(props) { super(props); this.state = {value: 2}; } handlechange = (event, index, value) => this.setstate({value}); render() { return ( <dropdownmenu value={this.state.value} onchange={this.handlechange}> <menuitem value={1} primarytext="never"/> <menuitem value={2} primarytext="every night"/> <menuitem value={3} primarytext="weeknights...

javascript - Why datepicker not working in firefox? -

my javascript code : $('#idtourdatedetails').datepicker({ monthnames: [ "januari", "februari", "maret", "april", "mei", "juni", "juli", "agustus", "september", "oktober", "november", "desember" ], daynames: [ "minggu", "senin", "selasa", "rabu", "kamis", "jumat", "sabtu" ], daynamesmin: [ "m", "s", "s", "r", "k", "j", "s" ], // showon: 'both', dateformat: 'yy-mm-dd', changemonth: true, changeyear: true, inline: true, yearrange: '-100:-12', defaultdate: '1916-01-01' }); demo , complete code : http://jsfiddle.net/oscar11/93etu/1751/ when using firefox browser ...

jquery - why add new option empty tag after load from ajax -

i have 2 dropdowns list category , subs . when user changed category dorpdown, second dropdown become reload server : <select id="cats"> @foreach($all_cat $c) <option value="{{$c->id}}">{{$c->title}}</option> @endforeach </select> <br /> <select id="subs"> </select> my jquery code : $('#cats').on('change', function() { var cats = $('#cats').val(); $('#subs option').remove(); $.post('{{base_url()}}cp/vitrinsection/getcategoriesbyajax' , {cats:cats , subs:0 , subs2:0 } , function(data){ $("#subs").append(data); console.log(data); }) }); $('#subs').on('change', function() { }); everything works fine after use append function empty option alternate added subs dropdown list ! my console log after data : <option value='1'>a<option><option value='2'>b...

centos7 - Linux command line rm /* -

centos 7, sudo su . not pro in linux command line. wanted delete files inside current directory. , putted: rm /* after many commands doesn't worked (ls example). command did? , how might harm system? you removed on hard drive! don't run commands super user if don't know , do! rm command removes something. / means root directory. in unix-based os linux, directories this: / ├── bin -> usr/bin ├── boot ├── dev ├── etc ├── home ├── lib -> usr/lib ├── lib64 -> usr/lib ├── lost+found ├── media ├── mnt ├── opt ├── proc ├── root ├── run ├── sbin -> usr/binvar ├── srv ├── sys ├── tmp ├── usr └── var and of them inside root directory show / and should * in terminal means "everything" (code 42). so asked remove "everything inside / directory" inside linux os deleted (exept if stoped before process compeleted) anyway, insatall fresh centos , startover. , thank god didn't write this: rm -rf /* try learn commands webs...

ios - How can i get the data from Swift based IBOutlet UITextField? -

@iboutlet var firstname:uitextfield? @iboutlet var lastname:uitextfield? let string = firstname!.text print(string) the output below: optional("ohh") how can data without optional text , double quotes? your issue text attribute of uitextfield optional - means must unwrapped. that, add ! end, produces string instead of string? . you can conditionally unwrap optional using syntax if let , here be if let string = firstname!.text{ print(string) //outputs if text exists }else{ //text didn't exist }

javascript - How to exclude a folder from YUI compressor -

i want exclude folder containing set of javascript files yui compressor not compile , pump out errors. trying <exclude>folder</exclude> tag, not working - yui still trying compress files in folder. below pom configuration: <plugin> <groupid>net.alchim31.maven</groupid> <artifactid>yuicompressor-maven-plugin</artifactid> <version>1.5.1</version> <executions> <execution> <id>compressyui</id> <phase>process-resources</phase> <goals> <goal>compress</goal> </goals> <configuration> <nosuffix>true</nosuffix> <warsourcedirectory>src/main/webapp</warsourcedirectory> <jswarn>false</jswarn> <sourcedirectory>src/main/webapp/js-max...

qt - C++ - Why do I create these widgets on the heap? -

when creating gui c++ , qt can create label example : qlabel* label = new qlabel("hey you!", centralwidgetparent); this creates object on heap , stay there until either delete manually or parent gets destroyed. question why need pointer that? why not create on stack? //create member variable of class mainwindow qlabel label; //set parent show , give text user can see qwidget* centralwidget = new qwidget(this); //needed add widgets window this->setcentralwidget( centralwidget ); label.setparent(centralwidget); label.settext( "haha" ); this works fine, can see label , did not vanish. we use pointers in c++ let live longer can use object in various scopes. when create member variable, won't stay until object gets destroyed? edit: maybe didn't clarify enough. mainwindow class: class mainwindow : public qmainwindow { q_object qlabel label; //first introduced here... public: mainwindow(qwidget *parent = 0); ~...

java - Selenium WebDriver Firefox error - Failed to connect -

i have done research , found other related issues. none have helped. so far: have date version of selenium installed older version of firefox i have eclipse on windows 7, created .war , tested in eclipse under localhost:8080/jspprojectservlets (on w7) , works fine. selenium opens firefox, gets url, gets source. i put .war file linux (ubuntu) machine under tomcat7/webapps , try visit windows 7 machine under 192.168.1.102:8080/jspprojectservlets not work , gives following error: http status 500 - failed connect binary firefoxbinary(/usr/bin/firefox) on port 7055; process output follows: type exception report message failed connect binary firefoxbinary(/usr/bin/firefox) on port 7055; process output follows: description server encountered internal error prevented fulfilling request. exception org.openqa.selenium.webdriverexception: failed connect binary firefoxbinary(/usr/bin/firefox) on port 7055; process output follows: (process:32704): glib-critical **: g_slice_s...

Javascript Replace with variable in string with Regular Expression -

i want replace lot of keywords in string pre-defined variables, samples below, $1 shows variable name, not variable content, 1 can me, please!!! correct: 1111{t:aa} 2222{t:bb} 3333{t:cc} to: 1111test1 2222test2 3333test3 not: 1111aa 2222bb 3333cc code: var aa = "test1"; var bb = "test2"; var cc = "test3"; var str_before = "1111{t:aa}\n2222{t:bb}\n3333{t:cc}"; var str_after = str_before.replace(/\{t:\s*(\w+)\}/g, "$1"); alert(str_before+"\n\n"+str_after); a regexp constant (i.e. /.../ syntax) cannot directly refer variable. an alternate solution use .replace function's callback parameter: var map = { aa: 'test1', bb: 'test2', cc: 'test3' }; var str_before = "1111{t:aa}\n2222{t:bb}\n3333{t:cc}"; var str_after = str_before.replace(/{t:(\w+)}/g, function(match, p1) { return map.hasownproperty(p1) ? map[p1] : ...

c# - How to safely access actionContext.Request.Headers.GetValues if the key is not found? -

i doing this, throws exception if key not found. this snippet inside of web api filter inherits actionfilterattribute , in overriden method onactionexecuting . if (actioncontext.request.headers.getvalues("some_key") != null && actioncontext.request.headers.getvalues("some_key").first() == "hello") { } am forced wrap in try/catch? class myfilter : system.web.http.filters.actionfilterattribute { public override void onactionexecuting(system.web.http.controllers.httpactioncontext actioncontext) { ienumerable<string> values; if (actioncontext.request.headers.trygetvalues("some_key", out values) && values.first() == "hello") { } } }

windows - Network address inaccessible if ran by the Task Scheduler -

i have c# program this: directory.exists(@"\\pcname\somedir"); and prints whether path accessible (exists) or not. this problem: run app via task scheduler right after log-in (auto-log-in user), using "on login" trigger, , returns false , although path is accessible! (i manage open path using explorer.exe few seconds before app starts). marked to: run highest privileges if run manually runs ok, when right click task , select "run" via task scheduler ! if deselect "run highest privileges", there no problem, must ran highest privileges (accesses registry , whole lot other stuff) it runs under same user if run manually or automatically task scheduler - made sure using process explorer it happens on machines (win8x64, admin-privileges-user no password, auto-log-in, workgroup machines, not domain), not on anothers (same: win8x64, admin-privileges-user no password, auto-log-in, workgroup machines, not domain). even if insert thre...

How would you write this exponent statement in PHP? -

how write exponent in php? ( ( ( ( (3) ^2 ) ^2 ) ^2 ) ^2 ) i took general programming test had problem similar had use algorithm provided write recursive function return result. numbers in question here 3 , 8 16 . you can use pow method code for, want can written - pow(pow(pow(pow(3,2),2),2),2) see documentation here

c++ - Issue accessing/editing pixel location in Mat image -

Image
im trying access , modify pixel values image read opencv. read several posts on how this, however, dont seem work me. my code: int main() { mat src=imread("/home/jaysinh/pictures/shapes.jpg"); cout<<"rows:"<<src.rows<<endl; cout<<"cols:"<<src.cols<<endl; cout<<src.at<cv::vec3b>(10,10)[0]<<endl; waitkey(0); return 0; } gives me result: in image im trying see pixel values @ location (10,10) in image. tried output values of image still special characters. i tried scalar , unchar types instead of vec3b nothing seems give me appropriate value (between 0-255). type double gives me -nan every pixel location. checked src.type() of image , returned 16 figure 16s type. how can modify image or somehow access image pixel values of type , modify it? thanks in advance! (here image im trying access: cout interprets byte char, , tries print ascii ;) cast int: cout << i...

android - Changing the state of selector after list item has been pressed -

i've used list selector display different colours depending on the state (selected , otherwise). below listselector code: //orange on selected <item android:drawable="@color/orange" android:state_selected="true"/> //black otherwise <item android:drawable="@color/black"/> in main activity set view : view.setselected(true); however after selecting list item, colour still orange. does know how resolve this? you using wrong state color, need use activated state. check out question had on this showing current selection in listview

java - Creating a UUID from a string with no dashes -

how create java.util.uuid string no dashes? "5231b533ba17478798a3f2df37de2ad7" => #uuid "5231b533-ba17-4787-98a3-f2df37de2ad7" clojure's #uuid tagged literal pass-through java.util.uuid/fromstring . and, fromstring splits "-" , converts 2 long values. (the format uuid standardized 8-4-4-4-12 hex digits, "-" there validation , visual identification.) the straight forward solution reinsert "-" , use java.util.uuid/fromstring . (defn uuid-from-string [data] (java.util.uuid/fromstring (clojure.string/replace data #"(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})" "$1-$2-$3-$4-$5"))) if want without regular expressions, can use bytebuffer , datatypeconverter . (defn uuid-from-string [data] (let [buffer (java.nio.bytebuffer/wrap (javax.xml.bind.datatypeconverter/parsehexbinary data))] (java.util.uuid. (.getlong buffe...

javascript - Setting background-position with jQuery -

i have span tag let's #span id has property background: url(some image) -22px top no-repeat , wich displays image background. if has property background: url(some image) -22px top no-repeat , image displayed. problem if specify ('#span').attr('background-position','0px top') nothing happens, other image not displayed. explain why ? use .css() $('#span').css('background-position','0px top'); .css() -> value of style properties first element in set of matched elements.

java - Remove javadoc sonar check from specific class -

how go disabling javadoc sonar check on specific class? (we don't want clutter short boiler-plate method unusefull javadoc). is there more specific key @suppresswarnings("all") ? see switch off violations plugin: http://docs.codehaus.org/display/sonar/switch+off+violations+plugin

forms - jquery validation only validates first field - others are ignored -

i'm using jquery validation plugin should validate inputs in form, stops @ first one. if click on second input , leave blank - ok - validates... otherwise - not... i found of same answers - no success... here's fiddle example wrote fiddleerror // // jquery validate example script // // prepared david cochran // // free use -- no warranties, no guarantees! // $(document).ready(function(){ // validate // http://bassistance.de/jquery-plugins/jquery-plugin-validation/ // http://docs.jquery.com/plugins/validation/ // http://docs.jquery.com/plugins/validation/validate#toptions $('.validate').validate({ highlight: function(element) { $(element).parent().removeclass('has-success').addclass('has-error'); }, success: function(element) { element.closest().removeclass('has-error').addclass('has-success'); } }); }); // end document.ready`enter code here` using: boot...

java - max number of actors per host in akka -

how many max actors can have on 1 box in akka? public void myactor extends akkaactor{ receive(objet obj){ // } } 1)is there limit on max number of actors instances?i planning created around 10k actors on 1 box. have 50 such boxes can scale horizontally 2)is there performance problems this? it matter of having enough memory: overhead of 1 actor 400 bytes (plus whatever state keep within it). means on typical systems can have millions of actors. performance not depend on number of actors create, depends on how many messages send between them. should not worry if number few million per second, beyond have benchmark program against chosen hardware see if works out.

java - Dynamic body is null in Box2d -

i have 1 dynamic sprite , few static. dynamic body: bodydef bodydef = new bodydef(); bodydef.type = bodytype.dynamicbody; bodydef.position.set(180, 20); bodymonkey = world.createbody(bodydef); polygonshape abcbox = new polygonshape(); bodymonkey.setuserdata(monkey1); bodymonkey.setfixedrotation(true); abcbox.setasbox(10.0f, 10.0f); fixturedef fixturedef = new fixturedef(); fixturedef.shape = abcbox; fixturedef.density = 0.5f; fixturedef.friction = 0.0f; fixturedef.restitution = 0.9f; fixture fixture = bodymonkey.createfixture(fixturedef); abcbox.dispose(); bodymonkey.setlinearvelocity(new vector2(1f, 0.5f)); bodymonkey.setlineardamping(1.0f); i have implement contactlistener. class: @override public void begincontact(contact contact) { object = contact.getfixturea().getbody().getuserdata(); object b = contact.getfixtureb().getbody().getuserdata();// null gdx.app.log("1", ""+a); gdx.app.log("2", ""+b); if(a!=nul...

codeigniter - How to remove index.php ina codeignitor site to help seo -

i new in codeignitor ...i want remove "index.php"from url http://localhost/simpleblog/index.php/blogger/newblogs i need http://localhost/simpleblog/blogger/newblogs here shows controller code class blogger extends ci_controller { public function newblogs() { $this->load->helper('url'); $this->layout="yes"; //<-- add this*/ /* $this->load->view('welcome_message');*/ $this->load->view('pages/secondpage'); } } default controller public function index() { $this->load->helper('url'); $this->layout="yes"; //<-- add this*/ /* $this->load->view('welcome_message');*/ $this->load->view('pages/mainpage'); } how remove index.php ? removing index.php file by default, index.php file included in urls: example.com/index.php/news/article/my_article you can remove file using .htaccess file simple rules. rewr...

java - How to assertThat something is null with Hamcrest? -

how assertthat null ? for example assertthat(attr.getvalue(), is("")); but error saying cannot have null in is(null) . you can use isnull.nullvalue() method: import static org.hamcrest.matchers.is; import static org.hamcrest.matchers.nullvalue; assertthat(attr.getvalue(), is(nullvalue()));

android - Unclickable EditText in Tabactivity on 4.2.2 -

Image
this on of application activities, tabactivity views , tabhost inside, its works fine on android 2.2 devices,but in 4.2.2 have problem, when try click on edittext, nothing heppens doesn't receive focus , can't modify it, idea did try forcing focus , opening keyboard? this? edit_text.setonfocuschangelistener(new onfocuschangelistener() { @override public void onfocuschange(view v, boolean hasfocus) { if(hasfocus){ ((inputmethodmanager)getsystemservice(context.input_method_service)) .showsoftinput(edit_text, inputmethodmanager.show_forced); }else toast.maketext(getapplicationcontext(), "lost focus", 2000).show(); } }); check out post edittext force focus hope helps

knockout.js - Extending a generic parameter in Typescript -

i want create utility function creates checklist adding ischecked knockout observable property each item in array. function should this: createchecklist<t>(allentities: t[], selected: t[]) : checklistitem<t> { ... } i returning checklistitem<t> because interface should extend t add ischecked property. however, typescript not allow me this: interface checklistitem<t> extends t { ischecked: knockoutobservable<boolean>; } gives me error: an interface may extend class or interface. is there way this? there isn't way express in typescript. you can instead: interface checklistitem<t> { ischecked: knockoutobservable<boolean>; item: t; } this has advantage of not breaking object when happens have own ischecked property.

coordinates in front of me (webgl / opengl) -

i'm learning webgl , i've been stuck on problem half day. i'm moving scene way : mat4.rotate(mvmatrix, degtorad(-angle), [0, 1, 0]); mat4.translate(mvmatrix, [-currentx, 0, -currentz]); how supposed coordinates (x/z) of point in front of me (let's 10 units) ? modelview matrix matrix transforms model local space view space. point "10 units in front of you" can anywhere, depending on space you're interested in. want know point 10 units in front of located in model space. well, nothing simple that. the point 10 units in front of viewer located in view space @ (0,0,-10). have applying inverse transform, i.e. multiply vector inverse ov mvmatrix: mat4.inverse(mvmatrix) * vec4(0,0,-10,1); if wonder last 1 element comes , why 4 element vector used 3 dimensional coordinate (which should wonder about) have read homogenous coordinates .

Loading php pages outside of wordpress -

i want load page, /foo.php, on server has wordpress installed, without adding page wordpress. right http request /foo.php returns 404. how can load content outside of wordpress without creating pages in template? i figured out problem. in .htaccess file. # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /blog/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /blog/index.php [l] rewriterule ^/([^-]*)$ /$1.php options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / ## hide .php extension # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r,l,nc] ## internally forward /dir/foo /dir/foo.php rewritecond %{request_filename}.php -f rewriterule ^ %{request_filename}.php [l] </ifmodule> # end wordpress the top rules wordpress mucking up. removing or commenting them out,...

ruby - Execute commands in irb from java -

i want start irb (interactive ruby shell) in terminal using java , execute different commands on opened irb shell when particular event occurs. have tried runtime.exec() method executes commands on terminal or command prompt , unable execute commands in irb shell. every time executes commands on new instance of terminal instead of same instance. want execute multiple commands on same terminal instance instead of newly created instance of terminal. please suggest. in advance.

ios - MFMailComposeViewController treats html attachment as image on iOS7 -

when i'm adding html file mfmailcomposeviewcontroller instance attachment final email generated attachment embedded image on ios7, worked fine on previous versions (ios4, 5, 6). [mailcontroller addattachmentdata: filedata mimetype: @"text/html; charset=utf-8" filename:@"file.html"]; final .eml content <div><br><br> <img src="cid:c7bff544-754d-4322-a71c-12345667789" id="c7bff544-754d-4322-a71c-12345667789"></div></body></html> content-type: text/html; charset=utf-8; name=file.html content-disposition: attachment; filename=file.html content-transfer-encoding: quoted-printable content-id: <c7bff544-754d-4322-a71c-12345667789> when opened in gmail attachment displayed 'not found' image. looks native mail client treats document embedded image it's not. i've tried use different content-type combinations (application/pdf, charset-8/16) , doesn't works. changing filena...

dependencies - TeamCity : project parameters inheritance issue? -

i have teamcity 8.0.3 project multiple configs inside have common parameter (defined project parameter) : targetserverip . 1 of these configs " 1 click deployment " starts others configs using snapshots dependencies. i've set parameter "prompt" ip asked on each run of configs, problem : individually works fine, on each config run ip asked , applied config. when execute " 1 clic deployment " asks ip not transmit other dependants configs (the value stays <empty> ). my question : how can set parameter applyed others configs when prompted ? ps : i've tried set env. parameter not helps. ps2 : using templates not seems solution me. there 2 problems. 1 can with, one trying solve myself solved myself. your problem how setup chain. 1 click deployment "depends" on others. it cannot pass parameters other builds. can use parameters dependent builds dep.dependent_build_configuration.paramter_name . the fix ...

spring - @Value annotations inside my Java class don't load values from .properties file -

before asking question tried follow following questions similar: injecting properties using spring & annotation @value how can inject property value spring bean configured using annotations? loading properties file class in spring however, in case not using web applications or tomcat; i'm trying load cluster.properties file regular java project via spring can ingest dummy data accumulo. also, i'm trying load properties cluster.properties file, not key value pairs defined in xml file. using learned links above , lots of reading on spring, here's have: i created following context.xml file: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> ...

apache - SVN Local Repository -

i imported apache nutch source code local ubuntu installation. have subversion installed on eclipse kepler. sourcecode has several branches , 1 main project in trunk. thinking of specifying source-code location repo location svn , check out & or commit changes based off of this. svn seem expect remote repo location. there anyway can make dumping ground of apache nutch source code repo location svn? thanks dvcs systems may help, such git, hg, etc. subversion centerized version control system, workspaces directly connect center repository. dvcs have local repository, before commit remote repository, need commit local rep first.

c++ - MFC: How to catch set focus of each control of dialog in one function -

i have "n" dialogs have same base dialog. each dialog has own controls edit boxes combo boxes list controls etc. in base dialog, how set focus messages of each control and,for example, give message box text("hello got focus, id %d")? according this article , can hook wm_setfocus message. you can control id using getdlgctrlid hwnd returned hook. but beware of popping messagebox , change focus , trigger hook proc, making go loop!

c# - Elegant way to filter a complex array of objects -

so have object following properties in powershell (this json representation containing 1 item): "networkresourcepermittedusers": [ { "permitteduser": { "username": "somedomain\\someuser" }, "securityaccesslevel": { "level": "read" }, "securityaccessmode": { "mode": "allow" } } ] what want filter networkresourcepermittedusers array based on level field inside securityaccesslevel , basically: securityaccesslevel.level in linq like: networkresourcepermittedusers.any(x => x.securityaccesslevel.level.equals("myvalue")) i know in powershell can use like: $networkresourcepermittedusers -contains "value" but in case, -contains parameter assumes have array composed of value objects ( string , int , etc) ...

Global GIT Ignore: Not pulling -

applied: git config --global core.excludesfile ~/.gitignore_global tried removing $home variable: git config --global core.excludesfile ~/.config/git/ignore can't apply plethora of local projects. love seeing .sass-cache folder appear on every project, hide folder git... wish 1 simple which -a gitignore find 1 being used. marvelous. thanks ahead of time leads. used: git config --get-all core.excludesfile edited file presented. works. @jszakmeister

c++ - Passing custom class object as a value into STL map -

i want pass object of custom class value stl map. how do that..? here code: class demo { int a, b,c,d,e; } // here how declare map: map<int, demo*> my_map; this how, using function: demo *ptr = null; ptr = new demo; here how inserting map my_map.insert(make_pair(int, ptr); // delete current instance delete ptr; is correct way..? actually, no. if want store demo objects in map , should use map<int, demo> . leave resource management std::map . also, using delete ptr destroy created object, , my_map[index] invalid pointer. just use my_map.insert(make_pair(myindex, mydemoobject)); . also note using my_map[myindex] create object given index if doesn't exist, can following: std::map<int, demo> my_map; my_map[1].a = 42; my_map[2].b = 1337; my_map[3].c = 314159; my_map[4].d = 23;

wordpress - Old as this Earth horizontal wp menu issue :) -

problem seen here http://soloveich.com/ trying make whole menu horizontal, home link keeps running away <div id="navmenu"> <ul> </li><a href="<?php echo get_settings('home'); ?>">home</a></li> <li><?php wp_nav_menu( array( 'theme_location' => 'main-menu' ) ); ?></li> </ul> </div> and css #navmenu ul {margin: 0; padding: 0; list-style-type: none; list-style-image: none; float: right; } #navmenu li {display: inline; padding: 5px 5px 35px 5px} #navmenu {text-decoration:none; color: white; } #navmenu a:hover {color: purple; } thanks in advance! the wordpress wp_nav_menu items outputting div , ul inside placing it. output going be: <ul> <li>home</li> <li> <!-- call wp_nav_menu --> <div> <ul> <li>...</li> </ul...

c++ addition of header files in linux - g++ -

all right tired looking question guess time ask :) before describe problem, project works fine on visual 2013 not suse linux g++ 4.6.2 we suppose use library cio consist of 3 files console.h, console.cpp , keys.h . main program uses 3 files called happy.cpp. now on visual studio 2013 works fine. when try compile on linux, gives me lots of errors. following brief code description of project //console.h namespace cio { // console holds state of console input output facility // class console { //some varialbes , functions int getrows() const; }; extern console console; // console object - external linkage } // end namespace cio =============================================================================== //console.cpp /* table of platforms */ #define cio_linux 1 #define cio_microsoft 2 #define cio_borland 3 #define cio_unix 4 /* auto-select platform here */ #if defined __borlandc__ #define cio_platform cio_borland #define cio_lower...

extjs4 - sass vars in extjs custom theme -

in extjs custom theme, sass/etc/all.scss gets compiled before sass variables defined. there better file creating custom css can share sass vars we've set rest of theme? usually, viewport used purpose. etc/all.scss place dump css has else go, speak.

ruby on rails - Devise 3.1 Upgrade Invalid Token Error -

my app has been using devise (3.1.0, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.2.4), current version 3.1.0. upgrade there new way devise token confirmation ( blog ). when click on email link leads invalid token error, i'm trying find out how resolve this. please let me know pointers have. thank you. with 3.1.0, devise has changed way handles token authentication. rather storing unencrypted token in database, devise encrypts token , sends unencrypted token in confirmation email. need set config.secret_key in order facilitate encryption. more info on here: devise secret key not set thus, if have old email, or old token in database, not match expect. can set config.allow_insecure_token_lookup = true in devise initializer file remedy problem, supposed short-term solution while wait users click on confirmation emails sent out before switch. lastly, if you've changed mail message reference token directly (e.g. @user.reset_password_token ), using encrypted version in e...

django - python manage.py runserver not working on Macbook 10.8 -

running folllowing command $python2.6 manage.py runserver gives ouput: traceback (most recent call last): file "manage.py", line 8, in <module> django.core.management import execute_from_command_line importerror: no module named django.core.management i tried many solutions out there of no use. when try install django again using pip, $ pip install django it give following output: requirement satisfied (use --upgrade upgrade): django in /library/python/2.7/site-packages cleaning up... and trying $ pip freeze gives following output, django==1.5.4 mysql-python==1.2.4 ... ... ... wsgiref==0.1.2 xattr==0.6.2 zope.interface==3.5.1 i dont know do? please wasted whole trying run successfully. thanks. update: when tried running $ python2.7 manage.py runserver it gives me following error validating models... unhandled exception in thread started <bound method command.inner_run of <django.contrib.staticfiles.management.command...

c# - Databind a 0 or 1 Value to CheckBox -

if using sqldatasource bound data grid, how extend check box control read value query passing , checking or unchecking box because of that? i have tried this: public class checkboxyn : system.web.ui.webcontrols.checkbox { public string yesno { { if (this.checked) return "1"; else return "0"; } set { if (value == "1") this.checked = true; else this.checked = false; } } } but can't find control in asp.net, errors in html. you don't need override checkbox class, bind checked property datasource's bit column: <asp:checkbox checked='<%# eval("bitcolumnname") %>' />

cannot achieve desired output (cout) from a C++ loop -

thanks last night able program computing input properly, have trouble formatting output properly. problem: my program should print "is prime" on lines prime numbers. prints on ever line this: http://oi42.tinypic.com/30igbvq.jpg i cannot life of me figure out why doing this, of functions should work. stack need again! #include <iostream> using namespace std; void primecheck(int x); // proto void countr(int rnm, int lnm); // proto void prime(int x) // function finds prime factors of number. { int lastr = 2; int count = 0; while (lastr < x) { if (x % lastr == 0) { cout << x << " " << lastr << "*"; x /= lastr; } else ++lastr; } primecheck(x); // calls check if number prime, "is prime" } void console(int rnum, int lnum) // prompts user 2 numbers stores answers { cout << "please enter 2 numbers "; cin >> rnum; cin >> lnum; countr...

how is hashmap internally implemented in java using linkedlist or array -

how hashmap internally implemented? read somewhere uses linked list while @ places mentioned arrays. i tried studying code hashset , found entry array , linkedlist used it looks this: main array ↓ [entry] → entry → entry ← here linked-list [entry] [entry] → entry [entry] [null ] [null ] so have main array each index corresponds hash value ( mod 'ed* size of array). then each of them point next entry same hash value (again mod 'ed*). linked-list comes in. *: technical note, it's first hashed different function before being mod 'ed, but, basic implementation, modding work.

jsf 2 - <c:if><c:otherwise> does not work, both conditions evaluate like true -

i trying toggle between 2 different command buttons depending on whether list contains given item id: <c:if test="#{roomservicemanagerbean.holdinghotelvilla.contains(hotel.hotelvillaid)}"> <p:commandbutton ajax="true" id="commanddeactivate" update=":roomserviceform:hoteltable,:roomserviceform:msgs" actionlistener="#{roomservicemanagerbean.deactivateserviceforhotel(hotel.hotelvillaid)}" icon="ui-icon-radio-off" type="submit" value="remove service"> <f:param name="roomserviceid" value="#{roomservicemanagerbean.roomserviceid}" /> </p:commandbutton> </c:if> <c:otherwise> <p:commandbutton id="commandactivate" update=":roomserviceform:hoteltable,:roomserviceform:msgs" actionlistener="#{roomservic...

python - Should i use multi-threading? (retrieving mass data from APIs) -

i have python script gathers 10,000's of 'people' api , goes on request 2 other apis gather further data them , save information local database, takes around 0.9 seconds per person. so @ moment take long time complete. multi-threading speed up? tried multi-threading test locally , slower, test simple function without api interaction or web/disk related. thanks how many cores have? how parallelizable process? is problem cpu bound? if have several cores , it's parallelizable across them, you're speed boost. overhead multithreading isn't 100% unless implemented awfully, that's plus. on other hand, if slow part cpu bound might lot more fruitful c extension or cython. both of @ times can give 100× speedup (sometimes more, less, depending on how numeric code is) less effort 2× speed-up naïve usage of multiprocessing . 100× speedup translated code. but, seriously, profile. chances there low hanging fruit easier access of this. try line pr...

Adding ObjectID manually in MongoDB (Rails/Mong -

i'm working rails 4.0 , mongodb (mongoid) , have following code create documents: lines.each |l| insert.create(:position => 0, :content => l, :schema_id => moped::bson::objectid.from_string("52419d2f80a9b88bb9000002")) end this works fine , following output in mongo-database: { "_id": { "$oid": "5241ff1280a9b8f16e000057" }, "position": "0", "content": "blabla", "schema_id": "52419d2f80a9b88bb9000002" } the problem is, want have "$oid": before actual schema_id this: ... "schema_id": { "$oid": "52419d2f80a9b88bb9000002" } and got confuse of how can insert "$oid" followed colon manually.... would great if me... thx in advance!! you should not have $oid @ all, neither in schema_id or in _id , make indexing operations hard, or not possible mongodb. have $oid because parsing d...

c# - Looking for a way to override the GetResponseStream Method of HttpWebResponse -

i looking way override getresponsestream method of httpwebresponse class, in order have custom stream returned. goal modify stream. not sure if possible? being done in context of integrating web service , need strip away of content response stream. thoughts? you can't override httpwebresponse 's behavior. either wrap web-service api on client side, @jon suggested in comment, or, if want adventurous, change request , pointing proxy server modify stream required. it's not going trivial, though.

vb.net - Load webbrowser content into another webbrowser control -

i have such situation: 1) 1 form named 'frm_iexplorer' webbrowser , loaded document it. 2) 1 class named 'printhtmldocument' creates webbrowser dynamically. load same document second, dynamically created webbrowser first webrowser. my approach in class like: dim ie new internetexplorer ie.navigate(frm_iexplorer.webbrowser1.document()) ... don't work. frm_iexplorer not accessible. how this?

python - Is it a good habit to print the bool value from a function? -

def f(): return true print(f()) or def f(): return true if f(): print('true') else: print('false') should round in if statement or print out value, in python 3.3.2? print automatically converts input string representation. so, 2 methods exact same thing. considering that, why not use first? lot cleaner. also, second method can simplified: print('true' if f() else 'false') having code simple isn't necessary.

excel - Vlookup returns #N/A if string contains a ' -

i using vlookup statement: =vlookup(b1232,sheet1!a:b,2,0) . cell in b1232 contains string: 'you rawk!!~' with "'" inside string want go , find, program retursn #n/a. believe vlookup command omitting opening single-quote when runs search, true? there way work around can run vlookup? i don't think quote problem - excel uses "~" [tilde] "escape character" has problem values contain "~". can use substitute function within vlookup replace "~" "~~" - when using 2 tildes first 1 tells excel treat second literal "~", i.e. use =vlookup(substitute(b1232,"~","~~"),sheet1!a:b,2,0) that work whether b1232 contains "~" or not

struts2 global result not redirecting to action -

i have custom interceptor (transferinterceptor) checks function change within application. when changes, interceptor returns post-processing string (the result) containing global results name of action want redirect to. have results defined in global results of struts.xml file, not redirect specified action. have 'login' global result works fine, being called jsp with: <s:a action="login.action">login</s:a> the struts.xml file: <package name="default" extends="struts-default" namespace="/"> <interceptors> <interceptor name="authenticationinterceptor" class="com.purchasing.utils.authenticationinterceptor" /> <interceptor name="transferinterceptor" class="com.purchasing.utils.transferinterceptor" /> <interceptor-stack name="securestack"> <interceptor-ref name="transferinterceptor" /...

php - mod_rewrite issue in code igniter -

setting 'rewritebase /' on production site and 'rewritebase /mysitefolder' on development site solved this, hope helps guy. i have big issue modrewrite , codeigniter, , have these rewrite rules: ### go godpanel rewriterule ^/godpanel$ /panel/godpanel [l] i can't make rule rewrite page in way: myhosting.com/godpanel to myhosting.com/panel/godpanel it keeps saying pages doesn't exist. can't make other rules work properly, rule works original rewrites index.php # if default controller other # "welcome" should change rewriterule ^(start(/index)?|index(\.php)?)/?$ / [l,r=301] rewriterule ^(.*)/index/?$ $1 [l,r=301] hope can understand me. thanks! (edited) well changed since yesterday, when point localhost/mysite.com/mycontroller works, when poin localhost/mysite.com/godpanel url changes localhost/panel/godpanel seems rules apllying in wrong way im noob regexp in mod rewrite files :( heres entire file #rewrit...

google apps script - Why can't you use setValue in a custom function? -

i'm curious, know why can't use setvalue write in different cell in custom function? the readme explains can't this, doesn't give reason on why: link custom functions return values, cannot set values outside cells in. in circumstances, custom function in cell a1 cannot modify cell a5. however, if custom function returns double array, results overflow cell containing function , fill cells below , right of cell containing custom function. can test custom function containing return [[1,2],[3,4]];. anyone knows if there reason this? i think quite logical. when you're calling custom function in cell, a1, expecting function calculation (or whatever) , place result in a1. if want see result in b1, you'd write same formula in b1. as doc explains, there might cases want function return more 1 value in case, returning 2d array populate cells adjacent 1 formula called. in case, can give use case have want populate different cell using c...

c# - Why are these functionally equivalent methods not discovered by VS2013's "Analyze Solution for Code Clones"? -

i select "analyze > analyze solution code clones" in vs2013 rc, expecting realize these 2 methods: private static char getbarcodechecksumwithlegacycode(string barcodewithoutczechsum) { contract.requires(!string.isnullorwhitespace(barcodewithoutczechsum)); if (barcodewithoutczechsum.length > 6) { int = 0; int b = 0; int j = barcodewithoutczechsum.length - 1; int = j; while (i >= 0) { = + barcodewithoutczechsum[i] - 48; = - 2; } j = barcodewithoutczechsum.length - 2; = j; while (i >= 0) { b = b + barcodewithoutczechsum[i] - 48; = - 2; } = 3 * + b; b = % 10; if (b != 0) b = 10 - b; var ch = (char)(48 + b); return ch; } return ' '; } public static string getbarcodechecksum(string barcode) { int oddtotal; int oddtotaltripled; int eventotal...

php - Cannot share session with subdomains with Laravel 4 -

i'm trying use laravel on host has many subdomains. 1 subdoman have laravel's app running on i'd share things (like current user) via php native session. i've edited laravel's session config work subdomains, changing domain value: 'cookie' => 'mydomain_session', 'domain' => '.mydomain.com', in subdomain, laravel not running, i'm trying access session in way: session_name("mydomain_session"); session_set_cookie_params(0,'/','.mydomain.com',false,true); session_start(); but it's not working, if try echo $_session variable empty. the strangest thing if try echo session_id() it's same in both subdomains. moreover if set same script in third subdomain share session other non-laravel subdomain no problem. so i'm doing wrong? i'm missing or laravel not managing native php session in ordinary way? any appreciated! or laravel not managing native php session in o...