Posts

Showing posts from July, 2012

.net - Google Drive SDK for Portable Libraries -

i in process of creating application winforms. have plans ship application windows phone later. decided use portable libraries. have following target frameworks portable libraries: .net framework 4 , higher silverlight 4 , higher windows phone 7 , higher .net windows store apps in portable libraries, have referenced following libraries google drive sdk: dotnetopenauth.dll google.apis.authentication.oauth2.dll google.apis.dll google.apis.drive.v2.dll google.apis.oauth2.v2.dll log4net.dll newtonsoft.json.net35.dll till when build solution, works fine have these references anywhere. when use these references in code like: using google.apis.authentication; using file = google.apis.drive.v2.data.file; public interface iutilities { void samplemethod(iauthenticator authenticator, file file); } now, no compilation error. when try building solution following error 1 type or namespace name 'iauthenticator' not found (are missing using directive or assembly refer

Facebook Page Tab fails to load in rails 4.0 -

i using rails 4.0 develop facebook page_tab. got blank content showed on facebook tabpage. think, issue related turbolink. following firefox requrest , response headers response header http/1.1 200 ok date: mon, 01 apr 2013 08:54:54 gmt status: 200 ok connection: close x-frame-options: sameorigin x-xss-protection: 1; mode=block x-content-type-options: nosniff x-ua-compatible: chrome=1 x-xhr-current-location: /page_tab content-type: text/html; charset=utf-8 etag: "5d34060006e527f1a21db545df3d919f" cache-control: max-age=0, private, must-revalidate set-cookie: _likenotlike_session=sehkbk5oz0fht2o0rkrmk3k2othidhy1yk5hyjdiwgnknfirwisxbkvkritlt2tjm2d2b1nvv0xqyw5qc015l0ljvjddwctitwr4cuhlc2vjk3hguhncbhazb0yxv1f4ounaa0hudde0mkfzrlhyuggxk2m5edbnmtrizzdhzxvyrtbmzex3q1rkaxrrzfjwauyyy2jmdunpsmlzrmhns0z6dgfemee5b2rloxjgdwf0z1nhcdr1n0zlevgvzdrjls1kcjhndzruujjasxznd1lndjuyntjbpt0%3d--a51e845979d81ace643d14b399ffa655ece63d79; path=/; httponly x-request-id: aac0e275-92b7-4b4b-9be7-b8

c++ - Ray Cylinder intersection -

Image
i developing ray tracing system , working, trying support more primitives (for supports: spheres, boxes, planes , triangles), , having problems cylinders. i know intersect ray cylinder need 2 check, first body (with infinite cylinder), assume circle in 2 dimensions, in plane xz (x² + z² = r, r radius) need check y coordinate between 0 , height , need check if intersection in caps (x²+z²<=r, r radius). my code follow (see comments more explanations) intersection cylinder::hit(ray ray) { ray.setorigin(vec3(getinversetransform() * vec4(ray.getorigin(),1))); ray.setdirection(glm::normalize(vec3(getinversetransform() * vec4(ray.getdirection(),0)))); // r(t) = o + td // x² + z² = r² // (ox+tdx)² + (oz+tdz)² = r² // (ox)² + 2oxtdx + (tdx)² + (oz)² + 2oztdz + (tdz)² = r² // t²(dx + dz) + 2t(oxdx + ozdz) + (ox)² + (oz)² - r² = 0 // a=(dx + dz); b = 2(oxdx + ozdz); c = (ox)² + (oz)² - r² float = ray.getdirection().x*ray.getdirection().x + ray.get

variables - Printing selective elements -

i new python , coding in general. i've been coding 2 months , i'm working on first simple game. in game control army , can attack cities , upgrade army money conquering cities. there places in code want selectively print elements give player options: a list cities can attacked a list upgrades can bought i want display upgrades , cities still available (so print upgrades haven't been bought yet , cities haven't been conquered yet). how can print out cities , upgrades available? thanks! i recommend use multidimensional lists, similar post: how define two-dimensional array in python you can define lists name first, , availability second argument. loop through lists.. away lists... such task, recommend classes , object oriented programming.

c++ - Trying to test unicode filename retrieval/conversion to/from UTF8-UTF16 -

i've looked @ lot of examples widechartomultibyte, etc. question more testing. i downloaded language set, chinese, simplified china machine. using virtual keyboard created directory on c:\ chinese characters in path, , placed file inside directory. i'm trying see correct filename testing _wfopen path. have same file in location testing: //setlocale(lc_all, "zh-cn"); //setlocale(lc_all, "chinese_china.936"); setlocale(lc_all, ""); wchar_t* outfilename = l"c:\\特殊他\\和阿涛和润\\bracket3holes.sat"; //wchar_t* outfilename = l"c:\\heather\\bracket3holes.sat"; wchar_t w[] = l"r"; file* foo = _wfopen(outfilename, w); first tried without setting locale, tried various combinations of setting locale language downloaded (therefore language of path). _wfopen works fine c:\heather path, returns null pointer unicode path. what missing? insight appreciated. note code must compilable vc9. --- based on feed

Explain how basic code is working - Eloquent JavaScript book -

here code - https://github.com/novaugust/code-wyoming-wiki/blob/master/day-21.md here info if want bigger picture (eloquent javascript marijn haverbeke) - http://eloquentjavascript.net/00_intro.html i'm new in computer world of programming , don't understand how simple digits (00110001 etc.) mean 1 + 2 + ... + 10 = 55 i understand var total = 0, count = 1; while (count <= 10) { total += count; count += 1; } console.log(total) and console.log(sum(range(1, 10))); but 00110001 00000000 00000000 not 'magic' me. can explain in 'simple mode'? btw is embarrassing stop on page 4... from understand you're struggling concept of binary. common lot of people, life long coders (you don't need know except hardware stuff). essentially binary works identical base-10 number system know where: 123 = 1 x 100 + 2 x 10 + 3 x 1 or 123 = 1 x 10^2 + 2 x 10^1 + 3 x 1^0 (^ means exponent) in binary there 2 digits, 0 , 1. place-value idea abov

android - Force Close error when changing from portrait to landscape -

i learning android programming book of ed brunette "hello,android" in code(following) give , typed is, still force close error . <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/background" android:gravity="center" android:padding="35dip" > <textview android:text="@string/main_title" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginbottom="20dip" android:textsize="24.5sp" /> <tablelayout android:layout_height="wrap_content"

php - Doctrine where not -

i have table in db i want select except record contain (x=1, y=1) mean id=8 id | x | y --------------- 1 | 2 | 1 2 | 0 | 1 3 | 5 | 6 4 | 6 | 4 5 | 7 | 4 6 | 7 | 4 7 | 5 | 7 8 | 1 | 1 try this: see demo select * tablename 1 not in(x,y)

algorithm - Getting the Average Height of a Binary Search Tree -

i have come problem statement tree in form: 4 2 6 1 3 5 7 it said average height 1.4285715 based know, average height of tree sum of height of each node divided total number of nodes. getting different result. need hint on how value 1.4285715 computed. use formula ans set root depth 0: (0 + 1 + 1 + 2 + 2 + 2 + 2) / 7 = 10 / 7 = 1.4285715 .

python - Search path of Dll file set by Lib file after packaging -

i have c++ program on visual studio imported python library linked header files , python27.lib file pointing windows/system32/python27.dll @ runtime. my question is, when package program , ship it, client required have same dll in system32 well? or dll packaged along it?

ios - Transfer image from one VC to another not working -

i image, when clicked upon, go view controller can view image itself! having little trouble doing , not sure how go there! this variable declared pfobject var postsarray = [pfobject]() this code in cellforrowatindexpath tableview function postsarray[indexpath.row]["image"].getdatainbackgroundwithblock { (data, error) -> void in if let downloadedimage = uiimage(data: data!) { postcellobj.postimage.image = downloadedimage postcellobj.postimage.layer.maskstobounds = true postcellobj.postimage.layer.cornerradius = 5.0 } } i have button overlayed on top of button when button clicked, need image go vc said above. code in prepareforsegue function if username != pfuser.currentuser()?.username { let profilevc: userprofileviewcontroller = segue.destinationviewcontroller as! userprofileviewcontroller profilevc.usernamestring = username } else if segue.identifier == "tophot

sharepoint - How can I perform a mathematical function in Column A, where Column B equals a specific value? -

for example, if have 2 lists, alpha , bravo, list alpha operational list, , list bravo draws list alpha display information administrators: list alpha (source list) column (player name)/column b (number of home runs) john/2 john/5 john/11 mary/3 suzy/7 suzy/6 list bravo (administrator list) column (name)/column b (number of items in other list)/column c (total hrs) john/3/18 mary/1/3 suzy/2/13 or: list bravo column shows single instance of each name appearing in list alpha column a. list bravo column b counts number of items in list where: list bravo column = list column list bravo column c adds list alpha column b where: list bravo column = list column i apologize if i'm being unclear, first attempt @ writing question. thank in advance assistance. "thank you. second list not needed. how set double grouping achieve result?" -darryl cooper this explanation sharepoint 2013. menu may vary other versions. navigate list -> i

wso2esb - how we can store a data or string in txt file in wso2 esb -

my issue getting data or json or string front end or mobile app contains details of error need append details in single txt file in local system how can have mediator or may use vfs trnsport let me knoe tried code giving error config is: <proxy xmlns="http://ws.apache.org/ns/synapse" name="filewrite" transports="https,http" statistics="disable" trace="disable" startonload="true"> <target> <insequence> <log level="custom"> <property name="sequence" value="filewritesequence"/> </log> <log> <property name="transport.vfs.replyfilename" expression="fn:substring-after(get-property('messageid'), 'urn:uuid:')"/> <property name="out_only" value="true"/> </log> <send> <endpoint>

algorithm - the logic behind bash power set function -

the function (output power set of given input) p() { [ $# -eq 0 ] && echo || (shift; p "$@") | while read r ; echo -e "$1 $r\n$r"; done } test input p $(echo -e "1 2 3") test output 1 2 3 2 3 1 3 3 1 2 2 1 i have difficulty grasping recursion in following code. tried understand placing variables inside of code denote level of recursion , order of execution, still puzzled. here things can tell far: the subshell's output not shown on final output, gets redirected read command via pipe the echo command appends new line of output the order of execution see is: p (1 2 3) -> 1 followed combination of output below\n combination of output below p (2 3) -> 2 3\n3\n p (3) -> 3 p () -> so think should have p(2) instead of p(3) on execution #3, how happen? since shift goes in 1 direction. if use "p(1 2 3 4)" input, part shows "1 2 3" in output confuses me.

azure event hub logging policy context filtering? -

azure event hub logging has policy configuration defines information gets logged downstream. i've set ieventprocessor listener gets handle of eventdata configured in policy. write code in ieventprocessor log data through company-specific logger. write code in ieventprocessor skip additional logging if context.lasterror.reason = "operationnotfound". is there way configure filters in policy handle type of logic prefilter events want log or don't want log? also, there way programmatically through type of pre-event handler? time ieventprocessor listener implementation reached, i'm assuming event has been logged somewhere. i suggest using choose policy , putting <logtoeventhub> policy inside choose.

excel - VBA Solver code issue -

i using loop access excel solver. every time solver solves optimization problem, have click ok. tried record macro, no code came when click ok button. accept solution suggested solver.i not want keep pressing ok button time. there potentially 2000+ optimization problems being solved. there way of making work? also, there way of solving unbalanced transportation problem solver without having make dummy supplies or demand nodes? thank you. the codes follows: solverreset solverok setcell:="$b$18", maxminval:=2, valueof:=0, _ bychange:="$m$5:$t$12", engine:=2, enginedesc:="simplex lp" solveradd cellref:="$u$5:$u$12", relation:=1, formulatext:="$v$5:$v$12" solveradd cellref:="$m$13:$t$13", relation:=2, formulatext:="$m$14:$t$14" solversolve the documentation @ solver.com (the website of company made solver add-in) contains: solversolve(userfinish, showref) userfinish optional variant.

mysql - devide operation in sql -

i have database in table employee exist follow +-----------+--------------+ | lastname | departmentid | projectname +-----------+--------------+ | rafferty | 31 | ims | jones | 33 | ibm server | steinberg | 33 | null | robinson | 34 | ims | smith | 34 | ibmserver | john | null | ims +-----------+--------------+ i want retrieve last name work on project on jones working select * employee ??? any suggestion please following should query - select * employee projectname = (select projectname employee lastname = 'jones'); we have not used in clause jones working in 1 project. if working in multiple projects then query can - select * employee projectname in (select projectname employee lastname = 'jones'); thanks

How can I configure the perf counters in a Service Fabric Stateless service? -

i have looked @ options in portal , resource group templates, not find way customize list. also, possible add custom perf counters (assuming code creates them) monitoring in service fabric application? there no integrated way today, there 3 ways this: use application insights monitor application. there details of how application insights not service fabric specific here . there project on github shows how integrate azure service fabric application insights. collect performance counters using azure diagnostics. service fabric running on vms, configuring diagnostics collection azure vm can found here . use operations management suite can collect standard , custom performance counters. see links in post below (i'm not allowed post more 2 links)

php - Remove 'home' link from breadcrumb -

i have breadcrumbs such home > instance > action in view pages. how can remove 'home' link breadcrumbs? $this->breadcrumbs=array( 'keypairs'=>array('admin'), 'manage', ); this can done setting homelink property false , in cbreadcrumbs widget initialization. done in layout file. in default yii app, in protected/views/layouts/main.php : <?php if(isset($this->breadcrumbs)):?> <?php $this->widget('zii.widgets.cbreadcrumbs', array( 'links'=>$this->breadcrumbs, 'homelink'=>false // add line )); ?><!-- breadcrumbs --> <?php endif?>

Displaying output of php within jquery colorbox ... getting undefined index error -

i hope can me, have created simple html form drop down menu's, drop down menus populated mysql data base, user must select 2 drop downs , display data ( both selections make sql query) works correctly within html trying jazz bit , have output display within jquery colorbox (popup). i not sure how format syntax jquery function .. have far <script> $(document).ready(function(){ $(".inline").colorbox({inline:true, width:"50%"}); $("input#formsubmit").colorbox({href: function(){ var url = $(this).parents('form').attr('action'); return url; }, innerwidth:920, innerheight:"86%", iframe:true}); }); </script> this correctly launches colorbox pop , fires php "action" form $_post attributes not sent across , unidentified index error mysql. can 1 please me ? im sure simple, cant figure out. many thanks adding php ... <?php mysql_

codenameone - Codename One Strange Screen behaviour -

Image
when run device on simulator of cn1 see different , strange results. not refereed screen size, refereed components position, button side bar aper on middle of screen. where fix behaviour? the layout tree i think if way should work main form -> layout=borderlayout container1 -> layoutconstraint=north (set layout per requirement) add fields (containers/components) want header container2 -> layoutconstraint=center, layout=boxlayouty container1tablelayout -> layout=tablelayout make container1tablelayout have done in yours , add components/buttons. hopefully may work..

python - using os.system for multiple line commands -

i trying run shell code python file submit python file computing cluster. shell code follows: #bsub -j proc[1] #bsub -e ~/logs/proc.%i.%j.err #bsub -o ~/logs/proc.%i.%j.out #bsub -r "span[hosts=1]" #bsub -n 1 python main.py but when run python following can't work: from os import system system('bsub -n 1 < #bsub -j proc[1];#bsub -e ~/logs/proc.%i.%j.err;#bsub -o ~/logs/proc.%i.%j.out;#bsub -r "span[hosts=1]";#bsub -n 1;python main.py') is there i'm doing wrong here? if understand correctly, #bsub stuff text should fed bsub command input; bsub run locally, runs commands on compute node. in case, can't do: bsub -n 1 < #bsub -j proc[1];#bsub -e ~/logs/proc.%i.%j.err;#bsub -o ~/logs/proc.%i.%j.out;#bsub -r "span[hosts=1]";#bsub -n 1;python main.py that's interpreted shell "run bsub -n 1 , read file named oh crap comment started , don't have file read!" you fix moar hackery (using echo

javascript - Bootstrap datetime picker disable hours -

i using bootsrap 3 datetime picker . find documentation doesn't how disable/enable hours, says this: disabledhours default: false does how declare disabled hour? format?. need disable different hours weekdays , weekends. you use workaround using ajax : html : <div class="form-group"> <div class="input-group bootstrap-timepicker"> <span>pick delivery time :</span> <input id="datepicker" data-format="dd/mm/yyyy - h:mm" name="delivery_time" type="text" class="form-control input-small"> </div> </div> js : $('#datepicker').on('dp.change', function(e) { $.ajax({ cache: false, datatype: 'json', type: 'post', data: 'theday='+json.stringify(e.date._d), url: 'ajax/disable_hours.php', success: function(data) { if (data

machine learning - Implementation of Gaussian Process Regression in Python y(n_samples, n_targets) -

Image
i working on price data x = day1, day2, day3,...etc. on day1, have let's 15 price points(y), day2, have 30 price points(y2), , on. when read documentation of gaussian process regression: http://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.gaussianprocess.html#sklearn.gaussian_process.gaussianprocess.fit y shape (n_samples, n_targets) observations of output predicted. i assume n_targets refers price points observed on each day. however, number of price points on each day not same. wonder how deal case this? many thanks! i have made implementation of gaussian process regression in python using numpy. aim understand implementing it. may helpful you. https://github.com/muatik/machine-learning-examples/blob/master/gaussianprocess2.ipynb import numpy np matplotlib import pyplot plt import seaborn sns sns.set(color_codes=true) %matplotlib inline class gp(object): @classmethod def kernel_bell_shape(cls, x, y, delta=1.0):

How can i get my file size in Objective-C -

after search did not find problem: nsstring *path = @"~/desktop/folder/"; pathg = [path stringbyexpandtitlepath]; nsfilemanager *fm = [nsfilemanager defaultmanager]; nsarray *array = [fm contentsofdirectoryatpath: path error: null]; for(int = 0; < array.count; ++i) { nsfilesize *num = [array[i] filesize]; } error: use of undeclared identifier 'num' if need file size of single file, can constructing file url , querying url's attributes directly. nsstring *filepath = [@"~/.bash_history" stringbyexpandingtildeinpath]; nsurl *fileurl = [nsurl fileurlwithpath:filepath]; nsnumber *filesizevalue = nil; nserror *filesizeerror = nil; [fileurl getresourcevalue:&filesizevalue forkey:nsurlfilesizekey error:&filesizeerror]; if (filesizevalue) { nslog(@"value %@ %@", fileurl, filesizevalue); } else { nslog(@"error getting size url %@ error %@", fileurl, filesizeerror

facebook - Python. A user access token is required to request this resource -

i trying send facebook notification through python facebook sdk. using following http request it: https://graph.facebook.com/<user id>/notifications?&access_token=<my app access token>&template=my message!!!! all requests return following response: { "error": { "message": "a user access token required request resource.", "type": "oauthexception", "code": 102 } } i have tried manually in browser. result same. facebook says: post /{recipient_userid}/notifications?access_token= … &template= … &href= … so user access token required.... how resolve issue? thanks in advance. if stil in development , need valid user token , go https://developers.facebook.com/tools/explorer , generate 1 own user account. however, if authenticating python, python facebook sdk provides few options. get_access_token_from_code get_user_from_cookie parse_signed_request

ruby - QtRuby: Stack Level too deep (SystemStackError) -

i have following code: require 'qt' class menu < qt::widget slots 'on_clicked_uauth()' slots 'quit()' def initialize(parent = nil) super(parent) setwindowtitle "menu" uauth_ui exit_ui resize 350, 500 move 300, 300 show end def uauth_ui uauth = qt::pushbutton.new 'auth', self uauth.resize 150, 35 uauth.move 100, 100 connect uauth, signal('clicked()'), self, slot('on_clicked_uauth()') end def exit_ui exit = qt::pushbutton.new 'exit', self exit.resize 120, 40 exit.move 115, 420 connect exit, signal('clicked()'), self, slot('quit()') end end app = qt::application.new(argv) menu.new app.exec when click either button, following error: stack level deep (systemstackerror) can let me know changes should make that, when click buttons, next screen? first of all, had change require 'qt' require 'qt'

Is the controls in android is not publicly accessible within that activity? -

is controls in android not publicly accessible within activity (.java file) here edittext field txt1 - want access in function public void clr() how can it? possible or doing wrong? this may basic qn. quite new java & android - though experienced in c#. pl help public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final textview res=(textview)findviewbyid(r.id.textview1); final edittext txt1 =(edittext) findviewbyid(r.id.edittext1); final edittext txt2 =(edittext) findviewbyid(r.id.edittext2); button btn = (button) findviewbyid(r.id.button1); btn.setonclicklistener(new onclicklistener() { public void onclick(view v) { // todo auto-generated method stub //some code here } }); button btnclr=(button) findviewbyid(r.id.button2); btnclr.setonclicklistener(new onclick

C++ pass by reference local variable -

i'm new c++ i have following class: class user { public: user(const string& username) { m_username = username; } string username() const { return m_username; } void setusername(const string &username) { m_username = username; } private: string m_username; }; here main.cpp code user *createuser() { string username = "someuser"; user *u = new user(username); return u; } int main(int argc, char *argv[]) { user *u2 = createuser(); cout << u2->username() << endl; return 0; } in function createuser() i'm creating local variable username , pass reference user class constructor. when function ends, variable username goes out of scope, therefore value of m_username member of class user should deleted. but still accessible outside of function, e.g. main method prints "someuser" console. why? when function ends, variable username

php - Long polling - Message system -

i'm looking doing long polling jquery , php message system. i'm curious know best/most efficient way achieve this. i'm basing off simple long polling example . if user sitting on inbox page, want pull in new messages. 1 idea i've seen adding last_checked column message table. php script this: query check null `last_checked` messages if there any... while(...) { add data array update `last_checked` column current time } send data i idea i'm wondering others think of it. ideal way approach this? information helpful! to add, there no set number of uses on site i'm looking efficient way it. yes way describe how long polling method working generally. sample code little vague, add should sleep() small amount of time inside while loop , each time compare last_checked time (which stored on server side) , current time (which sent client's side). something this: $current = isset($_get['timestamp']) ? $_get['timestamp&#

ios - Issues with singleton -

i have created single ton arc, + (myclass *)sharedinstance { static myclass *sharedspeaker = nil; static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ sharedspeaker = [[self alloc] init]; }); return sharedspeaker; } - (id)init { if (self = [super init]) { } return self; } but here creating instances this: id speaker3 = [[myclass alloc] init]; id speaker = [myclass sharedinstance]; id speaker2 = [[myclass alloc] init]; nslog(@"speaker 1= %@ \n speaker 2 = %@\n speaker3 = %@",speaker,speaker2,speaker3);` i got output as: speaker 1= <myclass : 0xa45f5e0> speaker 2 = <myclass : 0xa461740> speaker3 = <myclass : 0xa4529e0> this looking desired behaviour. how stop when giving singleton in library user. need block him creating new instance. need make static global if make global cant create global variable of same name there conflict right. memebers can give solution on this? for examp

printf - Access violation while running app via windbg -

my application access violation sometimes. runned application through windbg, , stopped in following function . tried _vscprintf instead of vsnprintf, , result same. 'm newbie windbg. appreciated. int tsk_sprintf_2(char** str, const char* format, va_list* ap) { int len = 0; va_list ap2; ap2 = *ap; len = vsnprintf(0, 0, format, *ap); /*-> access violation in point! */ *str = (char*)calloc(1, len+1); vsnprintf(*str, len, format, ap2); va_end(ap2); return len; } ==> following result windbg managed_stack: !dumpstack -ee os thread id: 0x5b8 (22) current frame: childebp retaddr caller, callee primary_problem_class: wrong_symbols bugcheck_str: application_fault_wrong_symbols last_control_transfer: 1026d3d8 102e14cf stack_text: warning: stack unwind information not available. following frames may wrong. 1d3cde7c 1026d3d8 1d3cdea8 0898eeeb 00000000 msvcr100d!vcwprintf_s_l+0x52ef 1d3cded0 1026d46c 00000000 00000000 0898

android - How can I remove divider before actionbar menuItem which only have text on it? -

i want remove short divider before actionbar's menuitem has "withtext" option in it. i've tried many different theme setting it, failed. is there solution remove it? this theme xml. <style name="my_actionbar" parent="@style/widget.sherlock.light.actionbar.solid"> <item name="android:background">@drawable/actionbar_bg</item> <item name="background">@drawable/actionbar_bg</item> <item name="android:actionbardivider">@null</item> <item name="actionbardivider">@null</item> <item name="android:showdividers">none</item> <item name="android:dividervertical">@null</item> <item name="android:dividerpadding">0dp</item> <item name="android:divider">@null</item> </style> the android:actionbardivider attribute belongs the

racket - Recursive procedure for sum of squares of first n odd numbers? -

i'm trying implement recursive procedure sum of squares of first n odd numbers on racket (starting 1) e.g., (sum-alt-squares-recursive 0) 0 (sum-alt-squares-recursive 1) 1 (1^2) (sum-alt-squares-recursive 2) 10 (3^2 + 1^2) (sum-alt-squares-recursive 3) 35 (5^2 + 3^2 + 1^2) this recursive procedure uses linear iterative process (define (sum-alt-squares-recursive x (y 1) (z 0)) (if (zero? x) z ; if x zero, return accumulator z (sum-alt-squares-recursive (- x 1) ; x goes down 1 each iteration (+ y 2) ; y starts @ 1 , goes 2 each iteration (+ z (* y y)) ; z, goes y^2 each time ))) (sum-alt-squares-recursive 1) ; => 1 (sum-alt-squares-recursive 2) ; => 10 (sum-alt-squares-recursive 3) ; => 35

php - Show server status using user input -

you have excuse php innocence have never formally studied launguge , been along time since html class. i have written <form> <input type="text" name='address' /> <input type="text" name='port' /> </form> <?php // script akensai $ip = $_post['address']; $port = $_post['port']; if (!$socket = @fsockopen($ip, $port, $errno, $errstr, 30)) { echo "<font color='red'><strong>offline!</strong></font>"; } else { echo "<font color='green'><strong>online!/strong></font>"; fclose($socket); } ?> i trying achieve user input address , port compare values if statement determine if address ping-able if echo statements accordingly. if of fine programs tell me if work or if not fix errors accordingly. my site using word press , trying add php , html php widget, widget wont load code ether 1. widgets got issue or 2. c

Missing PID for process inside docker container -

i'm running simple web application inside docker container. when @ output of netstat, pid/program name blank. root@fasf343344423# sudo netstat -tulnp active internet connections (only servers) proto recv-q send-q local address foreign address state pid/program name tcp 0 0 0.0.0.0:5697 0.0.0.0:* listen - tcp 0 0 0.0.0.0:9090 0.0.0.0:* listen - i've seen pid before on different setup. so, want understand if because of setup issue. appreciate help i able resolve following change: edit /etc/apparmor.d/docker file , add following line ptrace peer=docker-default, sudo service apparmor restart

putting php array into html code -

i use template php system, called smarty. not able smarty have manually have forgotten how , possible.... <? foreach ($searchresults $row) { ?> <tr class="tablerows"> <td><img style="cursor: pointer;" src="img/expand.png" id="1" alt="hidden" onclick="changesign()" /></td> <td><a href="#"><? echo $row[0]; ?></a></td> <td><? echo $row[1]; ?></td> <td><? echo $row[2]; ?></td> <td><? echo $row[3]; ?></td> <td><? echo $row[4]; ?></td> <td><input type="button" value="delete" class="deletebtn" /></td> </tr>

ruby on rails 3 - need to add date picker in all the rows using Jquery -

Image
i have view image attached. want add date picker column expiry date in rows. here first row contains id column expiry date 'expiry_1_date' 2nd row -> 'expiry_2_date' 3nd row -> 'expiry_3_date' 4nd row -> 'expiry_4_date' 5nd row -> 'expiry_5_date' please me acheive desired result in jquery. in advance!!! use starts selector. , call datepicker method. try this $('input:text [id^="expiry_"]').datepicker(); or alternate way add class each text box. then use $('.someclass').datepicker(); demo

.net - Regex ? in lookbehind not consuming -

lookbehind ? not consuming : regex: (?i)(?<=\bsubject:?).+$ text: subject: asdf adsf match : asdf adsf i don't want : included in match if search on: subject asdf adsf matches: asdf adsf behavior want appears treat : optional not consuming if match on subject:? greedy , includes : use regex (?i)(?<=\bsubject:?)[^:].*$

android - Converting this AsyncTask to RxAndroid? -

bit new rx, looking on converting following asynctask rx, can visualize rx bit more code know something. i've found few other answers relevant, alot of them werent network requests , many used different operators different answers, bit confused. heres asynctask : public class backgroundstuff extends asynctask<void, void, void> { @override protected void doinbackground(void... params) { useragent myuseragent = useragent.of("xxx:xxxx:xxx"); redditclient redditclient = new redditclient(myuseragent); credentials credentials = credentials.userlessapp("xxxxxxxx", uuid.randomuuid()); oauthdata authdata = null; try { authdata = redditclient.getoauthhelper().easyauth(credentials); redditclient.authenticate(authdata); } catch (oauthexception e) { e.printstacktrace(); } subredditpaginator sp = new subredditpaginator(redditclient); sp.setli

javascript - Chrome extension with DB sql query in cloud -

we want develop application google chrome extension have query-intensive databases in cloud service. have following questions: a) can done javascript chrome extension? b) understand have have layer of application logic, such mvc controller. other options there , 1 better? c) cloud service recommended (oracle, azure, rackspace, etc ...), taking account important speed of response? d) advice , response format json? thanks a) yes, can done javascript, you'd sending ajax request server on cloud , returning response. b) 1 better solicit debate, best if check options , decide better in particular use case. here comparison of all(most) mv* javascript frameworks started. c) of cloud services have advantages , disadvantages. worked azure , heroku , successful. depends on need, server side language using? d) data exchange response doesn't matter. json, xml, sen whatever. json standard big pro it, data-exchange can accomplished data-exchange format.

Financial Plots in Python -

i trying graph candlestick stock charts in python. code have works fine except last line generates error message , don't know how fix it. appreciate help. import plotly plotly.__version__ import plotly.plotly py plotly.tools import figurefactory ff datetime import datetime import pandas.io.data web df = web.datareader("aapl", 'yahoo', datetime(2007, 10, 1), datetime(2009, 4, 1)) fig = ff.create_candlestick(df.open, df.high, df.low, df.close, dates=df.index) py.iplot(fig, filename='finance_aapl_candlestick', validate=false) >>> py.iplot(fig, filename='finance_aapl_candlestick', validate=false) traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\plotly\plotly\plotly.py", line 151, in iplot url = plot(figure_or_data, **plot_options) file "c:\python27\lib\site-packages\plotly\plotly\plotly.py", line 241, in plot res = _send

iphone - Autorelease pool page corrupted -

whenever using asihttprequest making webservice calls randomly getting following crash: autorelease pool page 0x9418000 corrupted magic a1a1a100 4f545541 454c4552 21455341 pthread 0xb0103000 my code arc-fied , used -fno-objc-arc .m files of asihttp class. does have idea or did face kind of issue before? in advance! this indicates you're stomping memory somewhere else. i'd start turning on memory diagnostics , looking mistakes. place cause these kinds of mistakes in c code, particularly when using c arrays or c strings. you're writing outside of allocated memory, or writing memory after freed it. there have @ times been compiler bugs cause kind of problem, these rare, , suspect code first.

c - Why is this free statement causing a heap corruption error? -

i wrote code not sure how free memory dynamically allocated inside of function. what proper way free memory without causing heap corruption, or better yet, causing corruption when trying free `returnedary`` #include <stdio.h> #include <stdlib.h> #define max_num_digits 10 void displaymainmenu(void); int* extractuncommondigit(int*, int); int main() { displaymainmenu(); return 0; } void displaymainmenu() { int* userary = null; int* returnedary = null; int menuoption; int numofints; int i; { printf("\n\n*********************************************\n" "* menu *\n" "* 1. calling extractuncommondigit() *\n" "* 2. quit *\n" "*********************************************\n" "select option (1 or 2): "); scanf_s("%d"