Posts

Showing posts from August, 2011

how to add font-awesome icon in wordpress wp_nav_menu() -

Image
i trying show menu in wordpress using wp_nav_menu(); due less knowledge can't understand how task. kindly me , please share code if have idea. <div class="pull-left"> <nav> <ul class="sf-menu sf-js-enabled sf-shadow l_tinynav1" id="nav"> <li class="first-level-li"> <a href="<?php bloginfo('url'); ?>" class="first-level-link sf-with-ul"> <div class="menu-icon"><i class="icon-home icon-large"></i></div> <div class="menu-item-wrapper"> <div class="first-level-li-text-link">home</div> </div> </a> </li> <li class="first-level-li"> <a href="<?php bloginfo('url'); ?>/?page_id=4" class="first-level-

android - How to add SurfaceView displaying camera preview with opacity -

i want add surfaceview displaying camera preview layout. should semi-transparent (alpha 0.5). add view addview() method. ho that. tried animation seems not works camera. my surfave view looks that: public class showcamera extends surfaceview implements surfaceholder.callback { private surfaceholder holdme; private camera thecamera; public showcamera(context context,camera camera) { super(context); thecamera = camera; holdme = getholder(); holdme.addcallback(this); } @override public void surfacechanged(surfaceholder arg0, int arg1, int arg2, int arg3) { } @override public void surfacecreated(surfaceholder holder) { try { thecamera.setpreviewdisplay(holder); thecamera.startpreview(); } catch (ioexception e) { } } @override public void surfacedestroyed(surfaceholder arg0) { } } my minapi = 8.

JSON format ASP.NET webforms -

i new json , when looking @ format of message, getting below. [{"id":"000078","name":"-name not listed-","column1":"","column2":"","column3":"","city":"","lname":"unknown"},{"id":"00139800181","name":"sample name (office address, henderson)","column1":"office address","column2":"","column3":"","city":"henderson","lname":"clear"}] the following code generate above message dim serializer new system.web.script.serialization.javascriptserializer() dim rows new list(of dictionary(of string, object))() dim row dictionary(of string, object) each dr datarow in datatable.rows row = new dictionary(of string, object)() each col datacolumn in datatable.columns row.add(col.columnname, dr(col)

javascript - Angular Kendo Dropdownlist automatically adds blank option -

i using angular kendo , having strange issue kendo's dropdownlist control field bound first dropdown control on form has default ? undefined:undefined ? in it. although generated html has selected="selected" in first option. when explicitly select value in dropdown model updated properly. the dropdown filled array in root scope. also noticed if enable chrome's extension angularjs batarang works well. i did debugging of angular-kendo , found out kendo automatically adding blank option has value of ? undefined:undefined ?. <select class="s-select" kendo-drop-down-list k-data-source="lookupcache.getlookupvalues('gender')" k-data-text-field="'displayname'" k-data-value-field="'id'" k-value="'m'" ng-model="model.gender" /> where model {} default for dynamic data source can use data-option-label , follows: <select name="packagename"

qt creator - qmake install without sdk (Win) -

i'm using qmake build system in project. , not using qt sdk. how correctly install qmake without sdk on clean mashine(win7 + msvc). simple copy bin, mkspec dirrectories wrong result. can't speciefied qmake tools in qtcreator (invalid profile). try this solution . maybe test method. different told in question. use qt.conf something. sorry don't know purpose

ruby on rails - Is it possible to force concurrent jobs to run in separate Sidekiq processes? -

one of benefits of sidekiq on resqueue can run multiple jobs in same process. drawback, however, can't figure out how force set of concurrent jobs run in different processes. here's use case: have generate 64m rows of data, , have 8 vcpus on amazon ec2 instance. i'd carve task 8 concurrent jobs generating 8m rows each. problem if i'm running 8 sidekiq processes, sidekiq decide run 2 or more of jobs in same process, , doesn't use 8 vcpus , takes longer finish. there way tell sidekiq worker use or force spread jobs in group evenly amongst processes? answer can't easily, design. specialization leads spofs. you can create custom queue each process , create 1 job each queue. you can use jruby doesn't suffer same flaw. you can execute processing rake task spawn 1 process per job, ensuring load. you can carve 64 jobs instead of 8 , more load way. i latter unless resulting i/o crushes machine.

Database - Should I define a max length for stored url? -

i'm building small webapplication should store urls input of form. urls can have attributes, parameters etc. https:/www.stackoverflow.com/search?q=this+could+be+a+very+long+string . 'experts' make use out of missing validator, checks length of string. otherwise limitation may let occur error if url long. i'm using sqlite3, solution should work database-independent.

rvm - capistrano 3 + rvm1-capistrano3 rails 4.1 secrets.yml environmental variables issue -

i have been deploying rails 4.1 application capistrano 3. has been working fine. when tried rake tasks (uncommenting require 'capistrano/rails/assets'). error cap aborted! sshkit::runner::executeerror: exception while executing on host xxx.xxx.xxx.xxx: rake exit status: 1 rake stdout: nothing written rake stderr: config.eager_load set nil. please update config/environments/*.rb files accordingly: * development - set false * test - set false (unless use tool preloads test environment) * production - set true rake aborted! argumenterror: missing required arguments: google_storage_access_key_id, google_storage_secret_access_key /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:237:in `validate_options' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:261:in `handle_settings' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:98:in `new' /home

Android: FragmentStatePageAdapter not updating ListView -

i have android application. application minsdk:15 i have navigationdrawer. when click on first navigation drawer menu item, new fragment appears called mainfragment. good, in android tutorial. now in fragment need implement simple viewpager. viewpager page fragments. here code: public class mainfragent extends fragment @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(r.layout.main_fragment_layout, container, false); } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); arraylist<books> books; bookspageadapter contentpageadapter = new bookspageadapter(getfragmentmanager(), books); viewpager pager = (viewpager) getactivity().findviewbyid(r.id.viewpager); pager.setadapter(contentpageadapter); } private class bookspageadapter extends fragmentstatepag

Code Analysis with FXCop (issue after upgrading to 4.5) -

i using static code analysis , have own custom rules. recently migrated project vs2013 , after when running build team city throwing error saying cannot load ruleset... unable load 1 or more of requested types. retrieve loaderexceptions property more information what reason, how can tell project use latest version of fxcop? regards amal thomas

ibm mobilefirst - Import Root Certificate of Google/iTunes into WebSphere Application Server - Liberty Profile 8.5.5.1 -

i trying configuring websphere application server - liberty profile 8.5.5.1 support applications in public app stores , following link : [ http://www-01.ibm.com/support/knowledgecenter/sszh4a_6.2.0/com.ibm.worklight.installconfig.doc/appcenter/t_ac_applinks_google.html][1] its saying have import root certificate of google play websphere trust store. part got stuck since don't know how open liberty profile console. liberty profile not have console yet. whole configuration held in server.xml file. in file find reference keystore, this: <feature>ssl-1.0</feature> <keystore id="defaultkeystore" password="password" /> if default settings used should have key.jks file in servername\resources\security\key.jks then need add cert there using tool e.g. keytool, or ikeyman (if have full @ hand). example keytool: keytool -importcert -alias certalias -file certificate.crt -keystore key.jks

groovy ant execute with pipeTo -

i trying use awk pipeto , need syntax. this works: def myid = 'myid' print "ls -al".execute().pipeto("grep ${myid}".execute()).text this fails: print "ls -al".execute().pipeto('awk \'{print $2}\''.execute()).text print "ls -al".execute().pipeto('''awk '{print $2}' '''.execute()).text you may want try removing space between print , \$1 : p1="ls -la".execute() p2='awk {print\$1}'.execute() p1 | p2 p2.waitfor() print p2.text note p2.err.text contain error messages, if (useful if p2.text blank).

CSP style asynchronous programming in Scheme (CHICKEN) -

is there egg or library allow me write csp style programs in scheme? csp style mean what's implemented in go (go/channel/select) or clojure's core.async. chicken scheme has channel egg try out. $ chicken-install -s channel

html - How to add disabled attribute to input tag with ngTagsInput? -

i have custom directive use manage user access through website. use add 'disabled="disabled"' attribute html tags. however, when try use tag-input, doesn't work. i'm guess down fact ngtagsinput uses it's own directive tags-input. i have read documentation , cannot find solution looking for. here code: html: <div access-level="admin"> <tags-input ng-model="tags" on-tag-added="addnewtag($tag)" on-tag-removed="removetag($tag)"> <auto-complete source="loadtags($query)" min-length="0"></auto-complete> </tags-input> </div> is there work around this? thanks. it's unsupported, looks in next major version (2.3.0): https://github.com/mbenford/ngtagsinput/issues/102 edit: 2.3.0 out; see following link details https://github.com/mbenford/ngtagsinput/blob/master/changelog.md#features

Bigcommerce and Google Trusted Store integration -

i'm wondering if has had experience implementing google trusted stores bigcommerce merchant. bigcommerce offers if pay them, i'm trying myself. on google trusted stores order confirmation module, require information passed them. far know, of information not available variables on bigcommerce order confirmation page. here docs order confirmation module . as can see, requires data customer email, customer country, whether or not item in order on preorder. there way information bigcommerce? output variables of type %%global_customeremail%% can used? if not, bigcommerce must populate information on server when handle google trusted integration you. means can not google trusted store using bigcommerce unless pay them integration. i'm hoping not case. does have experience this? i have experience in enabling google trusted stores code without having subscribe platinum level (i'm on gold level plan). have set automated daily shipping , cancellation feed

How to implement Navigation to ViewControlller on RowSelect delegate method in Xamarin.ios? -

i working navigation table view view controller, when clicking row got exception system.nullreferenceexception has been thrown object reference not set instance of object in xamarin.ios public override void row selected (uitableview tableview, nsindexpath indexpath) { // error system.nullreferenceexception _contact.navigationcontroller.pushviewcontroller(new incomingscreen(),true); }

c# - Whats the difference between Field and Variable? -

i've been using visual studio develop c++ application. i'm not expert in c++, neither other languages derived c c#. so, studying visual studio's symbology found reference same symbol saying "field or variable". correct if i'm wrong please, sounds me pretty "method or function" definition. in c++ there no methods, instead commonly called functions. so, in c++ there no fields, it's particularity c# works variable except should private , needs accessed "get" call. wrong? not variables fields. local variables of method variables, not fields. parameters method, property, constructor, or anonymous method variables, not fields. not fields variables. const member technically field, not variable.

Non static members in C++ -

error c2648: 'stack::y' : use of member default parameter requires static member error c2648: 'stack::x' : use of member default parameter requires static member intellisense: nonstatic member reference must relative specific object intellisense: nonstatic member reference must relative specific object please, fix it class stack{ node *head, *tail; int maze[10][10], x, y, _x, _y; public: stack():head(0), tail(0){}; ~stack(); void load(); void makelist(int = x, int = y); //error here void push(int, int); void pop(); void print(); }; void stack::load(){ ifstream fin("maze.txt"); fin >> x >> y >> _x >> _y; cout << "loaded matrix:" << endl << endl; (int = 0; < 10; i++){ (int j = 0; j < 10; j++){ fin >> maze[i][j]; if (i == x && j == y) cout << "s ";

ruby - Require a gem outside the Gemfile -

i'm trying require gem temporarily not in gemfile, without altering gemfile . you can see why answers questions such as: is possible require files outside gemfile? bundler how require gems separately in gemfile in 1 file? have been useless pursuit. you should try if debundle.rb works purpose!

html - How can I reverse a transition? -

i have made transition change background of navigation elements on hover. when take mouse of element instantly changes 1 had before. change slow initial transition. here code in html <ul> <a href="#"><li><i class="home primary-nav-element"></i></li></a><!-- --><a href="#"><li><i class="upload primary-nav-element"></i></li></a><!-- --><a href="#"><li><i class="favs primary-nav-element"></i></li></a><!-- --><a href="#"><li><i class="search primary-nav-element"></i></li></a> </ul> here current css have: .primary-nav li:hover .home { background-position: 0 100%; -webkit-transition: background 400ms; -moz-transition: background 400ms; -o-transition: background 400ms; transition: background 400ms; }

Go and custom struct type in another struct -

i'm struggling understand how save custom struct in struct (amongst great many other things). code looks this: type dogs struct { bleeh string blaah string bluuh string } type stuff struct { collection *mgo.collection //myanimalstruct type comes here? } func newstuff(c *mgo.collection) *stuff { return &stuff{ collection: c } } func getall(s *stuff) interface{} { collection = s.collection var results []dogs err := collection.find(bson.m{}).all(&results) if err != nil { panic(err) } return results } now, rid of var results []dogs in getall function. instead, []dogs bit stuff struct somehow, can't figure out how. this how call function: func getmedogs(w http.responsewriter, r *http.request) interface{} { collection = collection("animals") s := newstuff(collection) return getall(s) } so how s := newstuff(collection, dogs) stuff struct without declaring dog type in stuff (it anything, in function cats kn

Cleaning up after a python script has been run locally vs from Django -

edit: when "global variables" in post, i'm referring mtcbody script; django code doesn't make use of global variables. i have rather cryptic problem; have python script takes in xml file, parses , returns sort of result. script has global variables uses job. when run script locally, eclipse example, these global variables , else automatically destroyed @ end , new run uses new resources (as expected). however, when run script django view, expect same behaviour instead, script persists global variables , adds them every time request made. here's example of running locally eclipse: import mtcbody def doshit(): context = {} result = mtcbody.getdata() # variable result['tvas_after'] 1 of global variables in mtcbody script print 'tvas after: ' + str(result['tvas_after']) return context if __name__ == '__main__': doshit() and result after first run: tvas after: {'1': <mtcbody.tva inst

How to round a number to n decimal places in Java -

what method convert double string rounds using half-up method - i.e. if decimal rounded 5, rounds previous number. standard method of rounding people expect in situations. i significant digits displayed - i.e. there should not trailing zeroes. i know 1 method of doing use string.format method: string.format("%.5g%n", 0.912385); returns: 0.91239 which great, displays numbers 5 decimal places if not significant: string.format("%.5g%n", 0.912300); returns: 0.91230 another method use decimalformatter : decimalformat df = new decimalformat("#.#####"); df.format(0.912385); returns: 0.91238 however can see uses half-even rounding. round down if previous digit even. i'd this: 0.912385 -> 0.91239 0.912300 -> 0.9123 what best way achieve in java? use setroundingmode , set roundingmode explicitly handle issue half-even round, use format pattern required output. example: decimalformat df = new decimalformat(

How to replace union in stored procedure in sql server -

i have stored procedure having below queries. there way replace union 1 query or other way optimize it. select col1,col2 logs lg inner join employeetype_1 et1 on et1.empid=lg.userid lg.usertype=1 union select col1,col2 logs lg inner join employeetype_2 et2 on et2.empid=lg.userid lg.usertype=2 union select col1,col2 logs lg inner join employeetype_3 et3 on et13.empid=lg.userid lg.usertype not in (1,2) presumably, col1 , col2 come logs . here 1 way: select col1,col2 logs lg (lg.usertype = 1 , exists (select employeetype_1 et1 et1.empid = lg.userid) ) , (lg.usertype = 2 , exists (select employeetype_2 et1 et1.empid = lg.userid) ) , (lg.usertype not in (1, 2) , exists (select employeetype_3 et1 et1.empid = lg.userid) )

java - How to use correctly InputStream.read(buffer) method and process my Data? -

i have create application in android connect galaxy s3 device, in answer call device1. use socket , inputstream. - first: connect phone using socket, when connection established, device1 send me string store in 1 buffer. second: send device1 "s" string, when device1 receive string, send me continuos data without interruption. -tree: want read data , elaboration the problem inputstream.read(buffer) blocking, receive data i'm not able processing it. here code: public void run() { try { socket=new socket(); socket.connect(new inetsocketaddress(ipdevice,portdevice),20); //settare il timeout per evitare che tutto si blocchi su receive string controllo="connesso"; showtoast(controllo); inputstream = socket.getinputstream(); byte[] buffer_controllo = new byte[1024];

java - getByName() - how to elaborate on cause? -

with inetaddress.getbyname() able distinguish between the name service replied, , result negative and the name service did not reply (no connectivity dns server or whatever) i believe there's huge difference between 2 in terms of support, i.e. telling problem. it's difference between problem argument vs infrastructure problem. so how can distinguish between two? as see there's unknownhostexception in both cases , message text similar. ideas ? code snippet clarify: try { inetaddress addr = inetaddress.getbyname(hostname); } catch (unknownhostexception ex) { if ( ..... ) { system.out.println("name server replied did not know \"" + hostname + "\""); } else { system.out.println("name server not contacted"); } } to specific: ..... in example ?? as extension, code try/catch function ping ip address given see response (as defined in ( java code ping ip address ) posting).

php - How to configure gettext with Yii::t() in Yii2 advanced? -

i'm installed yii2 advanced template , configure yii::t() phpmessagesource, need configure gettextmessagesource. i'm added common/config/main-local.php code: 'i18n' => [ 'translations' => [ 'app*' => [ 'class' => 'yii\i18n\gettextmessagesource', 'basepath' => '@app/messages', 'sourcelanguage' => 'en-us', ], ], ], put @ frontend/messages/ru-ru app.po file sample text: msgid "test" msgstr "Текст" add in view file: yii::t('app', 'test'); but doesn't work, need store .po files or i'm doing wrong? 'basepath' => '@app/messages', change 'basepath' => '@common/messages', or 'basepath' => '@root/common/messages and replace messages common/messages.

Rails Axlsx New Line in Cell -

is there way can add new line cell using axlsx gem in rails? so replicating in excel once enter value can alt + enter add additional text new line in cell. tried sheet.add_row ["testing cell row 1" + \r\n + "testing cell row 2"] but throws error. for forced line feed use "\x0a" (breaks between paragraphs.) if want both carriage return , line feed, use "\x0d\x0a".

angularjs - isolate scope within directive doesn't behave as expected -

i'm creating test directive can seen here: http://jsbin.com/xosusozipufe/1/ this isn't behaving expected. thought h4 within directive div read 'within app hello world' on load , end change buttons clicked. html nested within directive div doesn't inherit isolate scope of directive, correct? any thoughts appreciated c @ isolated scope 1 way , works in up-down fashion means whatever pass go string can not update scope of directive. either should use transclude or put html of directive inside template/templateurl option. if want update directive scope either can use "=" isolated scope or can pass function "&" isolated scope. jsbin demo

mongodb - ruby gem mongo depend on bson1.10.12 -

i in trouble situation above, bson version 2.2, mongo gem depends on bson 1.10.12 only. why mongo depend on bson 1.10.12 only? why can't compatible upwards? need help, thx. mongo depend on bson 1.10.12 only: https://rubygems.org/gems/mongo the bson gem version numbers follow semantic versioning, see http://semver.org/ - bson 2.x not backwards compatible bson 1.x. mongo 1.x gem depends on bson 1.x. mongo 2.x gem specify dependency on bson 2.x when released. so if using mongo gem version 1.x, have use bson 1.x specified in gem dependency, can't use bson 2.x. there reason must use bson 2.x program?

logstash with date specific file names -

i have app writes logs like access_log-2014-09-08 access_log-2014-09-09 access_log-2014-09-10 it seems if have input=>file=>path defined access_log* works on files there when started up. when midnight rolls around, , makes new file, logstash doesn't see it. there way specify path catch this? don't need tailing except current day. it's not huge problem if looks @ cleaner , nice not that. logstash config: input { file { path => [ "/var/log/apache/access_log-*" ] } ... filters , output ... }

How to enable IPN in the new paypal view? -

got brand new business account , since it's new 1 - "switch classic view" button isn't there (at least can't find under more tab). how turn on instant payment notifications (ipn) in new layout? go tools , don't see ipn option anywhere. i sorry if question sounds stupid, i've been looking for half hour already. you can try go set ipn using direct link : https://www.sandbox.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-ipn-notify

Pipe output through a bash or, double pipe, || expression? -

i have noisy command output want hide on success. however, in failure case, output might prove helpful debugging, want show before printing error message. currently, way: output=$( cmd1 2>&1 ) || { echo $output echo cmd1 failed exit 1 } is possible pipe cmd1 's output through || (or, double-pipe) can avoid creating variable output? you need save output of command somewhere because don't know until command finishes whether or not send output console. piping output won't help, since pipes don't have large buffers. you have few options buffering, using variable reasonable 1 if don't expect megabytes of output, go beyond definition of noisy . use temporary file, there few advantages unless you're intending deploy on system limited memory (by today's standards).

r - Select columns of dataframe filling with NA's in selected column doesn't exist -

take example data frame temp <- data.frame('a' = 1:3, 'b' = 4:6, 'd' = 7:9) i want subset data frame using vector of column names, if vector contains columns don't exist in data frame want them still returned na. so if vector colvec <- c('a', 'b', 'c') i want run along lines of subset(temp, select = colvec) to get a b c 1 4 na 2 5 na 3 6 na you can in 2 steps -- limiting requested columns in data frame , adding requested columns not in data frame. can use intersect , setdiff these 2 sets of column names: temp2 <- temp[intersect(colvec, names(temp))] temp2[setdiff(colvec, names(temp))] <- na temp2 # b c # 1 1 4 na # 2 2 5 na # 3 3 6 na

ide - Single Click Preview File with Phpstorm Like Sublime Text -

is possible preview file 1 click on file name sublime text in phpstorm? yes, it's possible little bit different sublime-text. you can use phpstorm shortcut " quick definition ", default on linux: ctrl shift i select file @ project window , press hotkeys.

unit testing - How to test whether my factories are properly bound? -

using ninject , have following , wish test using fluentassertions : [test] public void interfacesendingwithfactoryshouldbeboundasfactories() { // given ikernel kernel = new standardkernel(); kernel.bind(services => services .from(appdomain.currentdomain .getassemblies() .where(a => !a.fullname.contains("tests"))) .selectallinterfaces() .endingwith("factory") .bindtofactory() ); // when var factory = kernel.get<icustomermanagementpresenterfactory>(); // factory.should().notbenull(); } is there ways test whether factories bound properly? i wrote extension package fluent assertions test ninject bindings. using test rewritten this: [test] public void interfacesendingwithfactoryshouldbeboundasfactories() { // given ikernel kernel = new standardkernel(); kernel.bind(services => services .from(appdomain.currentdomain

c++ - Creating my own strcopy function -

i trying create own str copy function. error telling me strcopy not declated in scope strcopy(deck[i].suit,source[]); wehre error occurs. please! #include <fstream> #include <iostream> using namespace std; struct{ char suit[]; char rank[]; int cvalue; }; int main() { char source[] = "name"; cards deck[52]; strcopy(deck[].suit,source[]); } void strcopy(char destination[], char source[]) { for(int i=0; source[i] != '\0' && destination[i] != '\0'; i++) { destination[i] = source[i]; } } first of forgot specify name of structure. think should have name cards also arrays defined within structure have defined having sizes. struct{ char suit[]; // size of array? char rank[]; // size of array? int cvalue; }; function strcopy has declared before isage. and function wrong. i not invent new algorithm of function , write following way char * strcopy( char destination[], const char source[] ) { char *p = destination;

Cascading functions in Python using reduce and decorators -

i have method called render implemented subclass , called this: class myclass(object): def __call__(self, *args, **kwargs): api_response = self.render(*args, **kwargs) return api_response def render(self, *args, **kwargs): """ method implemented subclass.""" raise notimplementederror def cascade_callables(): print 'ask awesome people @ stackoverflow solution problem.' i have list of callables [c1, c2, c3] . want inside cascade_callables method should this: def cascade_callables(): callables = [c1, c2, c3] callables.append(self.render) self.render = reduce(some_decorator_that_accepts_two_functions, callables) so essentially, trying render work without modifying actual implementation: c1(*args, **kwargs) c2(*args, **kwargs) c3(*args, **kwargs) render(*args, **kwargs) i tried work decorator me can use in reduce : def cascade_modifiers(modifier1, modifier2):

How To Dismiss Popover From Destination View Controller in Swift -

i have main view controller has been setup in interface builder open table view controller via popover segue connected button. want able dismiss popover when item inside of popover table view selected in didselectrowatindexpath . in objective-c can typecast the segue in prepareforsegue delegate uistoryboardpopoversegue and pass along uipopovercontroller table view controller. however, in swift downcast fails because sees segue type uistorybaordpopoverpresentationsegue (when stepping through debugger) doesn't appear public api. here's code: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject!) { if segue.identifier == "showcollectionssegue" { if let collcontroller:collectionstableviewcontroller! = segue.destinationviewcontroller as? collectionstableviewcontroller { if let popoversegue = segue as? uistoryboardpopoversegue { // <-- fails collcontroller.popover = popoversegue.popovercontroller

c++ - tinyxml load fails after using GetOpenFileName to retrieve xml filename -

i using tinyxml 1 before implemented function getopenfilename in code, know load works whenever give relative path or absolute path. i don't understand why doesn't work whenever function getopenfilename executes first. tried few times test , every time executed function, regardless of whether used filepath gave me or not, tinyxml still wouldn't find xml. std::string tutname = gettutorialfilename(); if(tutname != "") { std::cout << "before replacing: " << tutname << std::endl; boost::replace_all(tutname, "\\", "/"); bool loadtutorial = tutorial->loadtutorialsteps(tutname); if(loadtutorial) { std::cout << "success!" << std::endl; } else { std::cout << "failed: " << tutname << "to load" << std::endl; } } the function gettutorialfilename, uses getopenfilename: std::string gettutorialfilename() { op

c# - How to fast fill with data one poco model from other model -

does know tools (may resharper or tool) or techniques fast filling poco objects data object? mean best way that: var some_object = new firstmodel { property1 = second_model.property1, property2 = second_model.property2, property3 = second_model.property3, //...etc. } from question not quite clear whether want in ide auto-generate code have shown, or want object-object mapping. automapper if want latter.

xaml - Set initial section for a Hub control -

is there way set visible section hubcontrol, while keeping order intact? using defaultsectionindex moves previous sections end, while using hubcontrol.scrolltosection(1) in constructor of page snaps section view. either section start visible or there smooth scroll section 1 once page visilbe. what mean defaultselectionindex moves previous sections end? hub wrap around; using defaultselectionindex preserve order. happens if continue scrolling right, previous index defaultselectionindex @ end; however, if scroll left of defaultselectionindex, previous section should still there. i think using defaultselectionindex answer.

itextsharp - Color Document Sections in iText Sharp -

Image
help, need create pdf itextsharp has 1) green background entire document 2) text (headings, tables, paragraphs) appear on white background. 3) special sections appear pink (or other color) 4) headings on blue background white text. i can build simple document, background colors throwing me off. i add content using paragraphs, i'm not sure how set background color of paragraph, or group them together. you create document using objects such paragraph s, pdfptable s, , on. draw rectangles using pdfcontentbyte methods. obtain pdfcontentbyte instance pdfwriter this: writer.getdirectcontentunder(); // java or writer.directcontentunder; // c# by using getdirectcontentunder() instead of getdirectcontent() , rectangles drawn under paragraph s, pdfptable s, , on. your main problem keeping track of coordinates: need know coordinate of lower-left corner , of upper-right corner. drawing background full page no-brainer. i've answered question yesterday: ho

google app engine - Print a Jinja2 list on a single line in a table element -

if have list [1,2,3,4,5,6] it prints out 1, 2, 3, 4, 5, 6 how can print without line break between each 1, 2, 3, 4, 5, 6? code except outputs in td <tr> {% field in li %} {% if field not string , field iterable %} <td> {% item in field %} {{item}}{% if not loop.last %},{% endif %} {% endfor %} </td> {% else %} <td>{{ field }}</td> {% endif %} {% endfor %} </tr> nvm, issue css template forcing line breaks. works expected.

Android increase polyline width by zoom level (Google Maps V2) -

is there way how can automatic increase , decrease width of polyline when zoom in , out on google maps v2? it looks horrible on newer devices when stays extremely thin. need thin when zoomed out. save polyline when added map. perform actions on polyline. example saving polyline arraylist when added map. polylines = new arraylist<polyline>(); protected void onprogressupdate(polylineoptions... progress) { if (iscancelled()) { return; } if (progress[0] != null) { // add poly line map // save polyline later user if (mmap != null) { polylines.add(mmap.addpolyline(progress[0])); } } } meanwhile in code act on polyline polylines.get(0).setwidth(width) or for (polyline po: polylines){ po.setwidth(newwidth); }

Django XFrameOptionsMiddleware (X-Frame-Options) - allow iframe by client IP -

i'm using django xframeoptionsmiddleware control clickjacking, have customer needs able browse app in iframe within network. want able apply (or remove) xframe_options_exempt decorator within view method. best approach override get_xframe_options_value. xframe_exempt_ips glob_list in case detect allowable networks using fnmatch (192.168.*). class tfxframeoptionsmiddleware(xframeoptionsmiddleware): def get_xframe_options_value(self, request, response): if request.meta['remote_addr'] in settings.xframe_exempt_ips: return 'allowall' # non standard, equivalent omitting return getattr(settings, 'x_frame_options', 'sameorigin').upper()

error handling - Using the [Take New] restart in SBCL -

when try re-define package in sbcl in such way causes name conflicts, name-conflict error restarts 0: [keep-old] keep symbols accessible foo (shadowing others). 1: [take-new] make newly exposed symbols accessible in foo, uninterning old ones. 2: [resolve-conflict] resolve conflict. 3: [retry] retry slime repl evaluation request. 4: [*abort] return slime's top level. 5: [abort] abort thread (#<thread "new-repl-thread" running {10060e47b3}>) i'd write automatically invoke take-new restart, (force (defpackage :foo (:use :cl :bar :baz :mumble))) the result of should same calling defpackage , followed manually invoking take-new restart. problem is, cl-user> (handler-case (defpackage :foo (:use :cl :bar :baz :mumble)) (error (e) (compute-restarts e))) (#<restart swank::retry {1006dc40f3}> #<restart abort {10068007e3}> #<restart abort {10060c7f93}>) cl-user> i don't seem have access particular rest

TopLink to EclipseLink migration - Missing class for indicator field value -

i migrating toplink 11g eclipselink 12.1.3. have eclipselink.jar classpath. have few mapping xml files. when executing application, getting following error. exception [eclipselink-9005] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.sessionloaderexception exception description: exception thrown while loading project-xml file [meta-inf/business.xml]. internal exception: exception [eclipselink-43] (eclipse persistence services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.descriptorexception exception description: missing class indicator field value [toplink:object-type-mapping] of type [class java.lang.string]. descriptor: xmldescriptor(org.eclipse.persistence.mappings.databasemapping --> [databasetable(attribute-mapping)]). how resolve this. you required run package renamers etc described here http://docs.oracle.com/middleware/1212/toplink/tladg/migrnativetoplink.htm if have run package renamer tool

html - clicking on a link with the same href value using selenium python -

i have html code has 2 links both links have same href value, onclick , text different. wasn't sure how access second link. tried using driver.find_element_by_link_text('text'), no such element found error. <div id="member"> <"a href="#" onclick="add_member("abc"); return false;">run abc<"/a> <br> <"a href="#" onclick="add_member("def"); return false;">run def<"/a> </div> there multiple options desired link. one option use find_element_by_xpath() , check onclick attribute value: link = driver.find_element_by_xpath('//div[@id="member"]/a[contains(@onclick, "add_member(\"def\")")]') link.click() another 1 find both links , desired 1 index: div = driver.find_element_by_id('member') links = div.find_elements_by_tag_name('a') links[1].click() which option

localization - Can I specify a custom decimal_point in PHP locale settings? -

i coding region speaks spanish , uses . (dot, period) decimal point instead if , (comma) i using dictionary files translation , have successfuly set locale es , works fine, including translations, etc. except, in region don't use comma numeric decimal points. ie getting 33,66 instead of 33.66 how can specify custom decimal_point value current locale?

security - Open Redirect or Header Manipulation issues from Fortify scan on asp.net -

we did fortify scan on our asp.net application. found there many header manipulation issues. issues pointing response.redirect(). please have @ below code encoded parameters. below code counted header manipulation issue. int icount = 0; foreach (string name in request.querystring.keys) { icount++; if (icount > 1) { url += "&"; } url += name; if (request.params[name]!=null) { url += "=" + antixss.urlencode(request.params[name]); } } response.redirect(server.urlpathencode(page.root) + "\test.aspx?" + url); can body let me know else required change here resolve issue? take off server.urlpathencode(page.root) portion , use server.transfer() instead of response.redirect() . server.transfer() transfers user pa

operating system - execute bash commands in a c file and store the output in an array -

i'm trying store number of page faults array in c program. want execute bash command , store output of in array. here's command $ cat /proc/vmstat | grep pgfault a simple start, can embellished , improved... char * lines[2000]; /* 2000 lines enough? */ int n = 0; file * fp = popen("your command here", "r"); if (fp == null) abort(); lines[0] = malloc(1000); /* 1000 byte lines enough? */ while ((fgets(lines[n], 1000, fp) != null) { if (n == 1999) abort(); /* oh crud... */ lines[++n] = malloc(1000); } free(lines[n]); pclose(fp);

java - How can I store log into a file via GridLogger? -

currently can print out logs in console via gridlogger, wondering how can store logs file via gridlogger. in gridgain conf directory, there 2 files: gridgain-log4j.xml , java.util.logging.properties. how can load these files in application? thanks, bill gridgain writes log file default (and additionally console if verbose mode enabled). if haven't done changes configuration, log files stored in $gridgain_home/work/log folder. note when nodes started using ggstart.{sh|bat} script, $gridgain_home automatically resolved gridgain distribution root directory if it's not set via system property or environment variable. in case $gridgain_home unknown (e.g., you're running node in embedded mode inside web container), log files stored in $tmp_dir/gridgain/work/log folder, $tmp_dir temporary directory in os. can override behavior via gridconfiguration.setworkdirectory() configuration property. work directory provided here used different gridgain components inc

javascript - render complex html in express.js node.js -

i use node.js 0.10.12 , express.js 4.2.0 i want set app.engine render complex html files, files contain javascript and/or php functions. i tried drew noakes's answer here , nothing. in case have app.set('views', './views'); app.engine('html', require('jade').renderfile); app.get('/', function(req, res) { res.render('qs.html'); }); and when visit page, get syntaxerror: views\qs.html:27 25| <p>the hash has end of url, well-defined.<br> 26| when click add hash first , query string, page not reload , query string added after hash, wich both wrong</p> > 27| =============================<br> 28| <button name="hey1" onclick="historytestindex();">history test index</button> 29| <button name="hey2" onclick="historytestajaxtwo();">history test ajaxtwo</button> 30| <button name="hey3" onclick="historytestajaxfour();"

Create a 24 hour vector with 5 minutes time interval in R -

is there way create in r 24 hour vector 5 minutes time interval scratch or integer format this: 2355 correspond 23:55 155 correspond 1:55 and on. basically want vector 00:00 23:55 can plot graphic data corresponding each time interval. thank you there seq.posixt function has nice property by argument parsed "numeric interval" meaning. if print results format(z, "%h%m", tz="gmt") appear desired: format( seq.posixt(as.posixct(sys.date()), as.posixct(sys.date()+1), = "5 min"), "%h%m", tz="gmt") [1] "0000" "0005" "0010" "0015" "0020" "0025" "0030" "0035" "0040" "0045" "0050" [12] "0055" "0100" "0105" "0110" "0115" "0120" "0125" "0130" "0135" "0140" "0145" [23] "0150&qu

css3 - max width of css backgroudn image and background color -

i have css class has ground image. want fix background's image's max width 1024px , use background color render browser extends beyond that. there way can that? right now, have background-size: cover; and, distorts image height beyond 1024px. .imageform { width: 100%; display: inline-block; background: url("http://i.imgur.com/fpmyvio.jpg") no-repeat; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; background-color: #000; } jsfiddle: http://jsfiddle.net/fwkqos0c/8/ you have change background-size:1024px; and ypu missed background-repeat: no-repeat;

java - How can I retrieve POST data from a Jetty AbstractHandler handle() method? -

searched quite bit, didn't see posts seemed match particular situation/question. using jetty, have handler class extending org.eclipse.jetty.server.handler.abstracthandler. the handle method follows: @override public void handle(string target, request baserequest, httpservletrequest request, httpservletresponse response) throws ioexception, servletexception { i need grab post data sent in request, if this: curl -h "content-type: application/json" -d '{"url":"http://www.example.com"}' http://localhost:8080/ basically, i'm sending post request localhost json dictionary keyed on 'url'. how can retrieve post data? use standard servlet features available httpservletrequest parameter in handler.handle() method. the httpservletrequest has 2 methods have access request body. for text content, use httpservletrequest.getreader() for binary content, use httpservletrequest.getinputst

facebook - FB user with 2 ad accounts, but the AdUser can't see it -

i'm using ads api call in order ad accounts: me/?fields=adaccounts i see 1 account result: {"adaccounts": {"data": [{"account_id": "1234567", "id": "act_1234567"}], "paging": {"cursors": {"after": "njaxnda2otk5mzg3ng==", "before": "njaxnda2otk5mzg3ng==" }}}, "id": "111111"} but, when our client uses ads manager can see 2 accounts. 1 result , one. our client told me user has advertising permissions second account. how can be? missing something? why can't see both adaccounts? thanks. apparently, when generated new access token user problem solved , able see second ad account.

css - How to disableTheme -

i have input control several labels on it, using extension library , oneui labels blank bold default. have style sheet entry in it: .labelgrn10 { font-family:tahoma;font-size:10pt; font-weight:bold;color:rgb(95,170, 90);} the labels in same column have tried every combination of disabletheme , applying style class these labels 1 of them green can't life of me figure out why not green have same style applied them: <xp:td style="width:150px" > <xp:label value="approvers on limit :" id="approvers_over_label1" for="approvers_over1" disabletheme="true" styleclass="labelgrn10"> </xp:label> </xp:td> i'm not great on css stuff pain in butt. disabletheme not seem work, or @ least way think should. you overwrite oneui class css. nice documentation of classes of oneui , it's structure one: http://infolib.lotus.com/resources/oneui/3.0/docpublic/components/overview.ht

Overwrite git branch while keeping history -

our team has been developing 2 versions of project side side. the commits in master branch bugfixes old code, while v2setup branch contains complete rewrite. had bugfixes not occured squash new branch master, if i'm not mistaking lead annoying conflicts now. so how it? it sounds want merge master v2setup...but code @ head v2setup now, correct? if so, easy acheive using merge strategy "ours" so merge master v2setup with git merge -s ours master edit ok, reading comments, sounds want move ahead on master, v2setup changes. above command can merge master , have want. or better option use theirs strategy master git merge -x theirs v2setup

android - geting extra in activityForResult -

i have been googleling far no luck. have app in wich start activityforresult , in put string extra. edit couldn't post complex code since on table, got on laptop here code the activityforresult: @override protected void oncreate(bundle saved) { super.oncreate(saved); setcontentview(r.layout.camera); = new aquery(this); output = getintent().getextras().getstring("output");//here, nothing passed!!!!!!!! //log.d("out",output); /** check if device has camera */ if (this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_any)){ text ="yes"; //now check cam features if(this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_front)) front ="yes"; if(this.getpackagemanager().hassystemfeature(packagemanager.feature_camera_flash)) flash = "yes"; if(this.getpackagemanager().hassystemfeature(packagemanager.featu

mysql - Update new SQL column with random strings -

i have table , want add field identity id | name | identity 1 | sam | 2 | joe | 3 | jen | right there no data identity. have string of 5 random character (ex: kdu3k) populate each row. what best way alter/update table in manner? since have php backend, technically loop through sql statement identity = null, want know how sql. while do not recommend doing this, because mysql makes aspects less fun, can done entirely in mysql dml without use of user-defined procedures. procedures allow use of procedural while loops, etc. i've created sqlfiddle . first step create random values; in case ensured distinct in table afterwards, ensures there 1 less thing worry about. -- create lots of random values without using proceure , loop. -- there may duplicates created. temporary table. -- simplified if there numbers table. create table idents (value char(5)); insert idents (value) values (left(md5(rand()), 5)); -- 1 insert idents (value) select (