Posts

Showing posts from March, 2011

git - updating local copy of repository using GitHub for Windows -

i used github windows clone repository(for contributor) local system.now changes have been pushed master copy @ github , want update local copy updates using github windows. tried sync repository guess sync local copy not update after sync shows 'no uncommitted changes'. how can it? using 'sync' option both pushes , pulls, you've updated copy. the 'no uncommitted changes' message means haven't made changes repository aren't committed.

Ruby takes the doubled amount of RAM it should -

i trying things out homeserver , wrote little ruby program fills ram given amount. have halve amount of bytes want put ram. missing here or bug? here code: class ram def initialize @b = '' end def fill_ram(size) puts 'choose if want set size in bytes, megabytes or gigabytes.' answer = '' valid = ['bytes', 'megabytes', 'gigabytes'] until valid.include?(answer) answer = gets.chomp.downcase if answer == 'bytes' size = size * 0.5 elsif answer == 'megabytes' size = size * 1024 * 1024 * 0.5 elsif answer == 'gigabytes' size = size * 1024 * 1024 * 1024 * 0.5 else puts 'please choose between bytes, megabytes or gigabyte.' end end size1 = size if @b.bytesize != 0 size1 = size + @b.bytesize end until @b.bytesize == size1 @b << '0' * size end size = 0 end def

ios - Have keyboard already presented on view on viewDidAppear? -

i have uipageviewcontroller initialized 3 controllers. when swipe right, presenting uiview has uitextview becomes firstresponder. trying achieve have keyboard appearing when user swipes right, , when swipe away hide keyboard within view. seems keyboard added onto window? facebook seems achieve when posting new post, keyboard seems loaded before view appears? i able keyboard show without animating keyboard when becomefirstresponder invoked on uitextview. there seems delay on when keyboard appears. self.composeview.bodytextview.inputaccessoryview = [uiview new]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(willshowkeyboard:) name:uikeyboardwillshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(didshowkeyboard:)

php - increment in array -

i have earlier asked question mistake, deleted question reposting question. if (isset($_request['receipts'])) { $params['date'] = '31 jan 2000'; $response = $auth->request('get', $auth->url('receipts/travel', 'core'), $params); if ($auth->response['code'] == 200) { $receipt = $auth->parseresponse($oauth->response['response'], $auth->response['format']); pr($receipt->receipts); } else { outputerror($auth); } } this piece of code provides me travel receipts on 31 jan 2000 , wanted include foreach loop travel receipts whole 12 months of 2000 28 feb 2000, 31 mar 2000 , on till 31 dec 2000. i beginner , hence tried following basic foreach loop didnt work know misplaced logic. if (isset($_request['receipts'])) { $months = array( " 31 jan 2000"," 28 feb 2000"," 31 mar 2000","30 apr 2000","31 may 2000","30

c++ - C Tokenize String -

im trying tokenize string delimiters while keeping delimiters. tried using strtok(string, delimiters) function doesn't keep delimiters. example, if string is: "my name < is|john >hi" i want split when see symbols "space", "<", ">" . the tokens be: my, space, name, space, < , space, is, |, john, space, <, hi at first, tried read char char until saw delimiter symbol. if didnt see symbol, append read char string before it. example, string "hi|bye". read "h", read next char. "i" append "h". read next symbol, delimiter put "hi" array , "|" array. repeat until done. ran issues doing this. here's code doesn't work: int main() { char *line = "command1 | command2 command3 > command4 < command5"; do_tokenize(line); return 0; } void do_tokenize(char *line) { char *tokenized[100]; char token[100]; int tokencounter = 0;

textcolor - how to create textview link without underscore in android -

i came wired situation, code follow linearlayout ll = new linearlayout(this); textview tv = new textview(this); ll.addview(tv); tv.settext(html.fromhtml("<a style=\"text-decoration:none;\" href=\"" + stringescapeutils.escapejava(elem.getchildtext("newslink")) + "\">" + stringescapeutils.escapejava(elem.getchildtext("title")) + "</a>")); tv.settextcolor(color.black); but style="text-decoration:none" , tv.settextcolor(color.black) both not working, link still in blue underscore, hints on why they're not working? thanks! you can try this. such as string content = "your <a href='http://some.url'>html</a> content"; here concise way remove underlines hyperlinks: spannable s = (spannable) html.fromhtml(content); (urlspan u: s.getspans(0, s.length(), urlspan.class)) { s.setspan(new underlinespan() { public vo

c# - why nothing shows up in my output file, it comes out to be blank? -

using system; using system.collections.generic; using system.linq; using system.text; using system.text.regularexpressions; using system.io; namespace wordfreq { class program { static void main(string[] args) { string fullreview = file.readalltext("c:\\reviews.txt").tolower(); string[] stripchars = { ";", ",", ".", "-", "_", "^", "(", ")", "[", "]", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\n", "\t", "\r","<",">" }; foreach (string character in stripchars) { fullreview = fullreview.replace(character, ""); } // split o

css - JavaFX 8 Scene BackgroundImage -

i actual problem set background image scene. tried in different ways: public void btn_create_event() throws ioexception, exception{ stage curstage = (stage) config_btn.getscene().getwindow(); stage stage = new stage(); fieldlayercontroller flc = new fieldlayercontroller(); // flc.buildfield("seeschlacht_background.jpg"); flc.buildfield(); flc.buildscene(); flc.buildcamera(); // string image = fieldlayercontroller.class.getresource("seeschlacht_background.jpg").toexternalform(); // flc.root.setstyle("-fx-background-image: url('" + image + "'); " // + "-fx-background-position: center center; " // + "-fx-background-repeat: stretch;" // + "-fx-background-color:transparent;" // ); // flc.root.setstyle("-fx-background-image: url('seeschlacht_background.jpg')");

javascript - Directive talks to controller but cannot call functions residing in controller -

i have directive needs call functions main controller everytime try reference function inside directive nothing happens because it's undefined. when access value instance $scope.someprop desired response not when call function. anyone else who's faced issue? suggestions? few things: your controller exposes startchange function on scope, need call on scope, i.e. 'scope.startchange()' within directive , not 'startchange()' your confirmation directive uses isolate scope great if know youre doing, in essence cutting off parents scope on trying call function you got 3 options in case use scope $emit/$broadcast share state use isolate scope , '&' syntax execute expression in context of parent scope -- example http://plnkr.co/edit/8uedpos6ie5qtfc8e08h?p=preview not use isolate scope , execute startchange function on scope of directive same scope of controller -- example: http://plnkr.co/edit/h1t2qnol7wgng0eprlmc?p=preview

locals in rails partial -

i have partial: <% if flash.any? %> <% flash.each |type, message| %> <%= render 'shared/flash_message', locals: { type: type, message: message } %> <% end %> <% end %> which including partial: <div class="message-box message-box--<%= type %>"> <a class="close" data-dismiss="alert">×</a> <%= message %> </div> when running get: undefined local variable or method `type' for <#:0x007fe510aa3c80> it's pointing error outputting <%= type %> know why? you have specify rendering partial pass in local variables. so change <%= render 'shared/flash_message', locals: { type: type, message: message } %> to <%= render partial: 'shared/flash_message', locals: { type: type, message: message } %>. http://guides.rubyonrails.org/layouts_and_rendering.html#passing-local-variables

How does php time() function works -

how php time() work in following case: user posting in database , posting stamp added time() . but how compensate time zones? if 2 users eu , usa posting @ same time, posting stamp same? the whole point time() -method stores in same timezone, 1 server configured with. if did not this, impossible know when happened. if want display datetime timezones, can output timestamp server, use javascript or calculate clients timezone offset , add/substract hours time.

c# - Changed Screen Orientation MediaElement Disappear From Screen -

i have interesting problem project. m working on orientation of app , problem videoelement disappered when changed screen orientation portrait or landscape. m using same code image , working correctly. so, didn't understand issue is. there idea ? here code is; this line return null mediaelement: mediaelement mediacontrol = recursechildren<mediaelement>(fwquestions).where(p => p.name == "myvideoelement" + elementorder).firstordefault(); but line same structure return image correctly: image imagecontroller = recursechildren<image>(fwquestions).where(p => p.name == "questionimage" + elementorder).firstordefault(); my codes : mediaelement myvideoelement = new mediaelement(); myvideoelement.name = "myvideoelement" + currentquestion; myvideoelement.width = (window.current.bounds.width * 0.2) - 10; myvideoelement.height = 300; myvideoelement.margin = new thickness(10); myvideoelement.source = new uri(appconfiguration.testvide

function - SOLVED Python, Expected an indented block? One complication -

i'm trying make quick text based hockey team management game, whenever reference 1 of functions 'expected indented block'. not sure if i'm stupid , can't find mistake or something. def startup(): print "welcome text based hockey league!" print "you tasked being team's general manager" yourteam = raw_input() class tbhl: def __init__(self): self.teamlist["mustangs", "wolves", "indians", "tigers", "bears", "eagles", yourteam] class game: def __init__(self, homescore, awayscore): #games left in team class startup() #<-the line error points tbhl = tbhl() print tbhl.teamlist[7] when have commented out block code function, use keyword pass prevent error. code block starts new line of indentation cannot left blank (or comments.) ... class game: def __init__(self, homescore, awayscore):

python - many2one field not showing field values -

im having problem linking many2one field many2one field. im getting numbers 1,2,3(i think record number) instead of field value in drop down list. below, have 3 classes activity code, activity data, , activity summary. activity summary has many2one field called 'activity_code' relates activity data , activity data has many2one field relates activity code. able see field values in drop down list in activity data form, works fine, im not able view in activity summary form. single digit numbers can tell me why happening , how may fix show intended value instead of numbers? below code. activity code class activity_yearcode(osv.osv): _name = "budget.activity_code" _description = "activity year code" _rec_name = "activity_code" _columns = { 'activity_code' : fields.char("activity code", size=64, required=true), 'activity_name' : fields.char("activity name", size=128), 'act_status'

multithreading - Using a mutex in an audio callback -

when writing audio application, it's understood there unbounded operations should never used in audio driver callback. these operations typically include things allocating memory, reading or writing disk or network, locking mutex/critical section etc... i'm re-writing audio engine of music app cantabile ( http://www.cantabilesoftware.com ) , entire engine lock free, except 1 area, on i'd appreciate opinion of others. cantabile can leverage multiple processors/cores process audio. constructing tree of work items , waking pool of threads contribute getting job done. of threads in thread pool run @ highest priority possible (time critical + vista mmcss boost on windows) , don't else except audio processing (ie: they're not used other background utility tasks). to implement use condition variable wake worker threads , single critical section serialize access work item tree. critical section has spin count , locked long enough worker pull next work item tre

ios - Pixate updateStylesForAllViews not working after updated to PixateFreestyle -

i change css files @ code side. working when use pixate. updated dependencies freestyle , use updatestylesforallviews not work anymore. have restart application things done. idea ? - (void)applycurrenttheme { #if target_iphone_simulator || target_ipad_simulator pixatefreestyle.currentapplicationstylesheet.monitorchanges = yes; #endif nsstring *filepath = [[nsbundle mainbundle] pathforresource:themefilename oftype:@"css"]; [pixatefreestyle stylesheetfromfilepath:filepath withorigin:pxstylesheetoriginapplication]; [pixatefreestyle updatestylesforallviews]; }

javascript - Editable Text Over Image -

i wondering, there way of getting text go on image, have text can changed without going html, aka using textbox form displayed on webpage, , inputted text being put on image? know can done im struggling on start, , reply pointing me in right direction gratefully recieved. gareth if browser compatibility not issue, can done html5 so: <div contenteditable="true"> text can edited user. </div> then either set image background image div, or place image within div set z-index lower of text.

udp - Format string error in C over network -

why code segment give output? need packet count increment. while(1) { if(argv[3]) { strcpy(buf, argv[3]); } else { msg = "this udp test string! (packet %d)\n", ++pktcnt; strcpy(buf, msg); } ret = sendto(udpsocket, buf, strlen(buf)+1, 0, (struct sockaddr*)&udpserver, sizeof(udpserver)); if(ret == -1) { fprintf(stderr, "could not send message!\n"); return -1; } else { printf("message sent. (packet %d)\n", pktcnt); } sleep(1); } output on receiver: this udp test string! (packet %d) udp test string! (packet %d) udp test string! (packet %d) clearly there problem format string cant figure out :| i'm sure simple error don't know c yet, work in python! msg = "this udp test string! (packet %d)\n", ++pk

call - Running php script from another php script in different folder -

i have web application running in root directory. in directory have application want run , result from. /root/myscript.php want call script /app/index.php returns value. problem index.php includes scripts in /app folder. , because working directory in /root directory, scripts not included. is there other way can run index.php script myscript.php , enable index.php include needed files? you can include file parent directory: include('../somefilein_parent.php');

html - Retrieving specific data from website through excel -

i trying similar below existing example: reference problem with 1 small exception, need pull rating , # of reviews listing 2 separate cells in excel. how in way without pulling entire site's data? seems need call specific html tag or use command this, don't know is. please help! this code retrieve 2 pieces of information requested , place them on activesheet sub test() my_url = "http://www.yelp.com/biz/if-boutique-new-york" set html_doc = createobject("htmlfile") set xml_obj = createobject("msxml2.xmlhttp") xml_obj.open "get", my_url, false xml_obj.send html_doc.body.innerhtml = xml_obj.responsetext set xml_obj = nothing set results = html_doc.body.getelementsbytagname("i") each itm in results if instr(1, itm.outerhtml, "star-img", vbtextcompare) > 0 numb_stars = itm.getattribute("title") exit else

android - Adding admob widget hiding the button -

i trying have admob ad on bottom of activity inside tablerow. problem when adding admob widget is not displaying button below it. when ad not loaded shows button shows ad button disappears. below code : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:id="@+id/outerlinearlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:orientation="vertical" > <scrollview android:id="@+id/scrollview" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:background="@android:color/white" android:fillviewport="true

html - Modifying content width of the Sphinx theme 'Read the Docs' -

i using 'read docs' sphinx theme documentation. in original theme, given below http://read-the-docs.readthedocs.org/en/latest/theme.html the content or main layout width designed mobile friendly. however, project bit more wide. not know html , hence appreciate if 1 give me clues increase content (layout) width. another option create stylesheet in source/_static css want, e.g. .wy-nav-content { max-width: none; } or .wy-nav-content { max-width: 1200px !important; } make sure directory referenced in source/conf.py - believe default there's line this, i.e. # add paths contain custom static files (such style sheets) here, # relative directory. copied after builtin static files, # file named "default.css" overwrite builtin "default.css". html_static_path = ['_static'] then create custom layout in source/_templates/layout.html , include stylesheet {% extends "!layout.html" %} {% block extrahead %}

android - Force app to read from layout-ar -

i asking if there way force android application read arabic layout folders , arabic values folder whatever device language ? you can force different locale this: protected static void setlocale(final context ctx, final string lang) { final locale loc = new locale(lang); locale.setdefault(loc); final configuration cfg = new configuration(); cfg.locale = loc; ctx.getresources().updateconfiguration(cfg, null); } in case, use so setlocale(getapplicationcontext(), "ar") this take values "ar" folders (drawables-ar, values-ar, layout-ar, ...)

gcc - How to statically build ffmpeg with librtmp without root on centos 7? -

i forked stvs's batch build script here . added lines rtmp ? why it's not working , error got *** building ffmpeg *** error: librtmp not found if check config.log file gcc -d_isoc99_source -d_file_offset_bits=64 -d_largefile_source -d_posix_c_source=200112 -d_xopen_source=600 -i/usr/tmp/tmp/ffmpeg-static-test/target/include -i/usr/tmp/tmp/ffmpeg-static-test/target/include -static --static -std=c99 -fomit-frame-pointer -pthread -i/usr/tmp/tmp/ffmpeg-static-test/target/include/opus -i/usr/tmp/tmp/ffmpeg-static-test/target/include -wl,-z,relro -l/usr/tmp/tmp/ffmpeg-static-test/target/lib -c -o /var/tmp/ffconf.ciizes8o.o /var/tmp/ffconf.bbyd2amo.c gcc -l/usr/tmp/tmp/ffmpeg-static-test/target/lib -lm -l/usr/tmp/tmp/ffmpeg-static-test/target/lib -lm -static -wl,--as-needed -i/usr/tmp/tmp/ffmpeg-static-test/target/include -wl,-z,relro -l/usr/tmp/tmp/ffmpeg-static-test/target/lib -o /var/tmp/ffconf.govexkqq /var/tmp/ffconf.ciizes8o.o -lrtmp -lssl -lcrypto -ldl -lz -l/usr/tmp/

Django form with label directly in the Field, but disappear on typing -

i achieve same effect google login page label of text field shown in field itself. when characters typed in filed, label automatically disappeared. i know how achieve similar effect html + java script, like: <input type="text" name="" id="" value="email" class="gray" onclick="if(this.value=='email') {this.value='';this.classname='black'}" onblur="if(this.value=='') {this.value='email';this.classname='gray'}" /> but django form same effect? know can specify initial in charfield, won't disappear on typing. forms.charfield(max_length=100, label=_("email"), initial='xxx') there html5 prop called placeholdertext. here blogpost how use django forms. django html5 input placeholders excerpt: class myform(form): name = forms.charfield(widget=forms.textinput({ "placeholder": "joe recruiter" }))

c - WinUSB Bulk IN transfer fails on transfer size greater than maximum packet size -

i using winusb on windows host side communicate winusb usb device. usb device full speed device. able device handle , out , in data transfers. i facing issue bulk in transfer on fs winusb device. when loop of data pc device , pc, sizes 1 64 working fine. when transfer 65 bytes, first 64 bytes able read in pc. last byte missing. can facing same kind of issue or can suggest solution? regards, nisheedh first should read out maximum_transfer_size . sending, winusb "divides buffer appropriately sized chunks, if necessary" ( source ). also check remarks of winusb_readpipe : if data returned device greater maximum transfer length, winusb divides request smaller requests of maximum transfer length , submits them serially . if transfer length not multiple of endpoint's maximum packet size (retrievable through winusb_pipe_information structure's maximumpacketsize member), winusb increases size of transfer next multiple of maximumpacketsize

html - How to vertically align radio buttons with text on the same line? -

i wrote html below display 2 radio buttons , text. <input id="radio1" type="radio" checked="checked"/>create application name <br/> <input id="radio2" type="radio"/> create source name my issue radio buttons , text not aligning properly. radio buttons displaying little bit below text. how align radio buttons , text on same line proper alignment? demo vertical-align: middle: aligns vertical midpoint of box baseline of parent box plus half x-height of parent. the problem seems caused fact browsers commonly add random uneven margins radio buttons , checkboxes. use inline style, weird true: <input type="radio" style="vertical-align: middle; margin: 0px;"> label <br/> <br/> <input type="radio" style="vertical-align: middle; margin: 0px;"> label <br/> <br/> <input type="radi

android - Updating fragment view after AsyncTask finishes returns nullPointerException -

i developing app uses 3 fragments, (which actual pages). 1 fragment used listener, , on 2 others data being downloaded, , set textviews. working fine, until thought cool if fragment view update/refresh after async finished. problem throws me nullpointer exceptions, every time try updating fragment. btw. think might taking wrong approach type of fragments management, working, , want small cool feature, thought maybe don't need rewrite whole program. so mine mainactivity.java public class mainactivity extends fragmentactivity { //some uninportant initalizations @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // create adapter return fragment each of 3 // primary sections of app. msectionspageradapter = new sectionspageradapter( getsupportfragmentmanager()); // set viewpager sections adapter. mviewpager = (viewpager) findviewbyid(r.id.page

quartus - Error (10170): Verilog HDL syntax error at filename near text "input"; expecting ";" -

working 2014 version of quartus ii software (web edition), receive error 10170 when compiling following code: module shifter16 (a, h_sel, h) input [15:0]a; input h_sel; output [15:0]h; reg [15:0] h; @ (a or h_sel) begin if (h_sel) h={a[14:0],1'b0}; else h={a[15],a[15:1]}; end endmodule error received: error (10170): verilog hdl syntax error @ shifter16.v(2) near text "input"; expecting ";" you need semicolon @ end of first line: module shifter16 (a, h_sel, h);

Android Soft Keyboard Pushing Controls Up Titanium -

i can't seem figure out why appearance of soft keyboard whilst editing text field on android causes of controls pushed page. there way stop view or button being moved up? makes real mess! code: registration = {}; registration.view = titanium.ui.createview({ top : 0, backgroundimage : getfilepath + 'bg.png', }); registration.init = function(view, name) { var scrolview = titanium.ui.createscrollview({ top : viewtop, height : ti.ui.size, layout : 'vertical', scrolltype : 'vertical', showhorizontalscrollindicator : false }); registration.view.add(scrolview); var profileview = ti.ui.createview({ top : 10, height : 100, width : 100, //backgroundcolor : 'red', }); scrolview.add(profileview); var profileimage = ti.ui.createimageview({ image : getfilepath + 'profilepicicon.png', }); profileview.add(profileimage); var chooseprofileview = ti.ui.createview({ top : 8, width : devicename ==