Posts

Showing posts from June, 2015

android - How to handle views on top of the FlipView? -

i'm using this library allows flipping between views " flipboard " app. it works quite well. the problem need put few views on top of it, i've put inside framelayout, , rest of views after it. it looks ok, has problem: when flipping, views on top of change transparency (and become hidden) till flip over. how can handle problem? edit: i've found this library doesn't have problem, has weird color transition while flipping wish avoid. edit: i've found out known issue ( #49 ) . love know if else has idea of how overcome this. i don't know how fix library, seems library works fine : https://github.com/emilsjolander/android-flipview not sure though how customizable compared 1 i've tested.

PHP/SQL compare two table ID and view the name -

Image
i making script our online game site, want compare result table tabl , view id name. from i've show last characteridx now problem part, comparing 2 tables problm solved! alot! try this: $sql = 'select * '.$db_gam.'.dbo.cabal_character_table characteridx = '.$saint_owner; echo "sql= ", $sql; $query = mssql_query($sql); this output sql command, can check if sql output , send database correct , expect be. however, think error in fact using mssql_ , mysql_ next eachother: make this: $query = mssql_query('select * '.$db_gam.'.dbo.cabal_character_table characteridx = '.$saint_owner); to start.

rspec - rails tutorial 10.3.3 feed_item failing test -

i down 10.43 without errors, following errors occurred after attempting create micropost. tutorial says happen , need go , enter blank array @feed_items. despite making said changes, still 2 errors. in advance. failures: 1) static pages home page signed_in users should render user's feed failure/error: visit root_path actionview::template::error: missing partial shared/feed_item {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. searched in: * "/users/patrick/rails_projects/sample_app/app/views" # ./app/views/shared/_feed.html.erb:3:in `_app_views_shared__feed_html_erb__768030223365309889_70321791671740' # ./app/views/static_pages/home.html.erb:13:in `_app_views_static_pages_home_html_erb___2533148950545762160_70321815481080' # ./spec/requests/static_pages_spec.rb:21:in `block (4 levels) in <top (required)>' 2) micropost pages micropost creation valid information shoul

javascript - Call iframe function in parent window -

how can call iframe function in parent window, did below not seems working in firefox. same code working in chrome. window.frames["original_preview_iframe"].window.exportandview(img_id); i think have use document.getelementbyid('target_frame').contentwindow.callingtargetfunction(); otherwise use url describes solution problem invoking javascript code in iframe parent page

stream - Error at server shut down & start up org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile -

i on struts 1 application! my application show error when ever shut down & start up. find 2 different related error @ both shut & start of server. the shut down error goes below warning: cannot serialize session attribute emailtoclient session c3e8630b365ee27fd5ce6ac6860d4ba8 java.io.notserializableexception: org.apache.struts.upload.commonsmultipartrequesthandler$commonsformfile @ java.io.objectoutputstream.writeobject0(unknown source) @ java.io.objectoutputstream.defaultwritefields(unknown source) @ java.io.objectoutputstream.writeserialdata(unknown source) @ java.io.objectoutputstream.writeordinaryobject(unknown source) @ java.io.objectoutputstream.writeobject0(unknown source) @ java.io.objectoutputstream.writeobject(unknown source) @ org.apache.catalina.session.standardsession.writeobject(standardsession.java:1585) @ org.apache.catalina.session.standardsession.writeobjectdata(standardsession.java:1015) @ org.apache.catalina.sess

iphone - How to create Nested subfolder in iOS? -

i need create structure below inside document directory. document -> folder -> subfolder1 -> subfolder2 -> subfolder3 ----- subfoldern dynamically , show them in uitableviewcontroller. is possible in ios. please help use createdirectoryatpath:withintermediatedirectories:attributes:error: method of nsfilemanager . pass yes withintermediatedirectories , can create entire subtree 1 call.

php - Navigation table not aligning properly in Chrome -

on 1 of old sites, has pretty messy , outdated code, having problems navigation menu in chrome. aligns in firefox , ie reason in chrome first 3 tabs centered. http://jsfiddle.net/8b2cm/1/ <table width="765" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff"> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"> <td width="19%"><a href="http://link"><img src="http://link" alt="" width="331" height="95" border="0"></a></td> <td width="81%"><img src="http://link/images/logo.jpg" alt="" width="434" height="95"></td> </tr> </table> </td> <td valign="top

python - Incorporate third-party module into Django models -

i'm creating product id conversion app. have 2 models representing 2 id styles: class id1(models.model): number = models.charfield(max_length=10) converted = models.charfield(max_length=13) status = models.charfield(max_length=5) # validation status error = models.charfield(max_length=10) # error message def __unicode__(self): return self.number class id2(models.model): number = models.charfield(max_length=13) converted = models.charfield(max_length=10) status = models.charfield(max_length=5) # validation status error = models.charfield(max_length=10) # error message def __unicode__(self): return self.number there third-party python (non-django) module i'd incorporate django models 2 reasons: it provides conversion functionality need i want use oo approach in doing conversion - create instance of class (e.g. id1) encapsulates relevant data , methods instance. the third-party module has following classes s

android - Facebook SDK 3 - Session Re-log in issue -

i'm using facebook login described in "getting started" document - https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ // start facebook login session.openactivesession(this, true, new session.statuscallback() { // callback when session changes state @override public void call(session session, sessionstate state, exception exception) { if (session.isopened()) { // make request /me api request.executemerequestasync(session, new request.graphusercallback() { // callback after graph api response user object @override public void oncompleted(graphuser user, response response) { if (user != null) { textview welcome = (textview) findviewbyid(r.id.welcome); welcome.settext("hello " + user.getname() + "!"); } } }); } } }); when using code facebook recognize user (that loged-in in facebook app) , assumes user

html - Align text and input issues with CSS -

Image
would term , faculty student name , clinical site text in top left , input in bottom right. this wants me add more information code have nothing more it. <?php include ($_session['root_path_full'].'roles/student/scripts/studentqueries.php'); function drawstudentlabel($currentuser, $userinfo) { echo ('<table id="user_label" border="1"> <tr> <th>student name: <input class="u_label" readonly type="text" value="'.$userinfo['fullname'].'" name="student_name"/></th> <th>term: <input class="u_label" readonly value="'.$userinfo['termid'].'" type="text" name="term"/></th><br> <th> <b>key: </b> <a href="../../main/keyfull.php" target="

wpf - Sort DataGrid by Combobox displayed value -

Image
i have 2 datagrids parent child relationship, , both bounded data collections. child datagrid implements datagridcomboboxcolumn displaying parent's name instead of id. problem : how sort second datagrid column, parent's name, not id? xaml: <window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:wpfapplication1" x:name="mainwnd" title="mainwindow" height="500" width="650" loaded="mainwindow_onloaded"> <grid> <grid.rowdefinitions> <rowdefinition height="*"/> <rowdefinition height="auto"/> <rowdefinition height="2*"/> </grid.rowdefinitions> <gridsplitter grid.row="1" verticalalignment="center" horiz

database - Print Data from Array to Viewlist Android -

i'm trying data sqlite table view list, when try connect database, have error: 05-02 13:59:18.123: e/androidruntime(714): java.lang.runtimeexception: unable start activity componentinfo{com.example.add/admed.listar}: java.lang.nullpointerexception the code of db connector is: private static final string db_name = "admed"; private sqlitedatabase database; private basedados basedados; public basedadosconect(context context) { basedados = new basedados(context, db_name, null, 1); } public void open() throws sqlexception { //open database in reading/writing mode database = basedados.getwritabledatabase(); } public boolean isopen(){ if (database!=null){ return true; } else{ return false; } } public void close() { if (database != null) database.close(); } the code of class want print data (listar.java): basedadosconect db; protected void oncreate(b

Highlight R syntax using knitr and Package Highlight -

i try highlight r code using knit , highlight pachages rstudio, have errors when kniting; there's code : opts_chunk$set(fig.width=7, fig.height=5) opts_knit$set(use.highlight = true) opts_knit$set(out.format = "html") opts_chunk$set(highlight = true) opts_knit$set(...., highlight=false) render_html() and when compiling, have error error in library(package = "parser", character.only = true) : there no package called 'parser' i use r 3.0 thanks in advance i think have fixed problem in development version, , can install from: install.packages('knitr', repos = 'http://www.rforge.net/', type = 'source')

iphone - How to load a UICollectionViewController on clicking a button in the navigation bar? -

i have class, displayoptviewcontroller, subclass of uicollectionviewcontroller. want display collectionviewcontroller when user clicks button in navigation bar on current page. able load collectionview on button click navigation bar not coming. want user able see button in navigation bar , clicking button should take him current page. tried via storyboard programmatically. when try via storyboard, viewcontroller not displayed , when create view controller object programmatically, not getting navigation bar. idea how to this? i tried add code viewdidload method in displayoptviewcontroller : uinavigationbar *navbar=[[uinavigationbar alloc] init]; [[self navigationcontroller] setnavigationbarhidden:no animated:yes]; [self.navigationcontroller.navigationbar addsubview:navbar]; but navigation bar still didn't come. kindly help. update i loading uicollectionview here uicollectionviewflowlayout *aflowlayout = [[uicollectionviewflowlayout alloc] init]; [aflowlayout setitem

ios - Resize UIWebView on webViewDidFinishDownload dilemma -

Image
suppose have uiwebview that's stacked against uiimageview (or other view): i want resize uiwebview know put uiimageview. way wait uiwebview finish loading: webviewcalculating = yes; while (webviewcalculating == yes) { [[nsrunloop currentrunloop] runmode:nsdefaultrunloopmode beforedate:[nsdate distantfuture]]; } then resize when uiwebview has finished loading, according this suggestion : -(void)webviewdidfinishload:(uiwebview *)webview { cgrect frame = webview.frame; frame.size.height = 1; webview.frame = frame; cgsize fittingsize = [webview sizethatfits:cgsizezero]; frame.size = fittingsize; webview.frame = frame; heightsofar += webview.frame.size.height; webviewcalculating = no; } after point, i'd know how tall uiwebview is, , can place uiimageview accordingly. when push view controller , came this, hacky [[nsrunloop currentrunloop] runmode:nsdefaultrunloopmode doesn't seem wait until webview finished calculating heigh

javascript - Using tel: Hyperlinks on Android < 4 alternative? -

i have app gives normal landline numbers uk 08 numbers. currently web page shown in app, when user finds number want , click on green phone icon. i'm using following javascript force force tel: link number bring dailer. document.location.href = 'tel:'+number;//push browser call number this method works fine newer android 4.0 , above far can see. when use old orange san francisco phone (android 2.3) doesnt bring dailer. instead attempts open new page tel:01xxxxxxxx url in turn displays web page not available message. i assume because tel: part of html5 why it's not working. there alternative work on versions? tel: preferred - since 1990's. callto: may work better devices. see also: how mark-up phone numbers? edit since have page running inside android webview, can handle error hack (also described @ android webview "tel:" links show web page not found ): mywebview.setwebviewclient(new webviewclient() { @override pub

java - NumberFormatException.forInputString -

can explain why numberformatexception.forinputstring this: string: "01000000000000000000000000000001" integer.parseint(string, 10) and how can fix it, when need positive int representation of number? thanks the "01000000000000000000000000000001" not valid int . int has minimum value of -2,147,483,648 , maximum value of 2,147,483,647 (inclusive). you can convert biginteger : biginteger myint = new biginteger(mystring);

c# - Validate if data contains data from another table before delete -

i need validate parameter if contains values before delete it. parameter in table , values in table. trying using lambda expression, can't find right way. gets data calculationparameters table: factory.definitions.calculationparameters.list(); // list() lists data. and gets data calculationparametersvalues table: factory.definitions.calculationparametersvalues.list(); // list() lists data. now if "id" (from calculationparameter) equals "calculationparameterid" (from calculationparametersvalue) means calculationparameter contains values , can't delete it. does have idea me out here ? i understand want remove calculationparameters have no records in calculationparametersvalues. if so, try : calculationparameters.removeall(p=> !(calculationparametersvalues.select(c=> c.calculationparameterid)).contains(p.calculationparameterid))

asp.net mvc - MVC4 Passing model from view to controller -

Image
i have view model populated data relating booking taxi. in model list of quotations time, price, vehicle type in display list of using foreach. each time foreah loops builds form , submit button take me "bookingstage1" action in controller. have added hidden field populated bookingrefernce particular quotation. so, hoping when hit action result in controller model returned populated view. it's null, no data in whatsoever. i hoping pass populated model between number of controllers user progresses through various search, results , booking screens... is possible pass populated model view next controller? thanks in search results page have following form: using (html.beginform("bookingpage1", "searchresults", formmethod.post)) i have hidden field in form below: <input type="hidden" id="bookingid" name="chosenbookingid" value='@item.quotationid' /> which posts controller looks this: [htt

python - Converting a numpy string array to integers in base-16 -

i looking way convert array of strings in numpy integers represent in hexadecimal. in other words, array version of: int("f040", 16) i can convert string array integers base-10 calling arr.astype(numpy.int32), can't see obvious way convert them base-16. know of way this? ar = ['f040', 'deadbeaf'] int_array = [int(a, 16) in ar] print int_array output: [61504, 3735928495l]

api - Facebook: How to set app test users as friends? -

1) try access token app described in docs : to obtain app access token, invoke following http request https://graph.facebook.com/oauth/access_token? client_id=your_app_id &client_secret=your_app_secret &grant_type=client_credentials api respond query-string formatted string of form: access_token=your_app_access_token i access token strange splitter sign | result: access_token=568852943149232|ah1x8caxhksvfrtrz4xybg0gzr4 this seems in conflict docs, because first parameter app_id (before sign |). 2) try use strange access_token friend's access tokens (it requires make invisible test users friends): https://graph.facebook.com/app_id/accounts/test-users?access_token=568852943149232|ah1x8caxhksvfrtrz4xybg0gzr4 it returns: { "error": { "message": "(#803) of aliases requested not exist: app_id", "type": "oauthexception", "code": 803 } }

Java - Creating Dynamic Vertex + Edges (Dijkstra Algorithm) -

i'm trying generate vertex + edges dynamically, i'm getting errors when try compute shortest path between coordinates. testdijkstra3.java: package maze_drawing; import java.io.filenotfoundexception; import java.io.printwriter; import java.io.unsupportedencodingexception; import java.util.priorityqueue; import java.util.list; import java.util.arraylist; import java.util.collections; class vertex implements comparable<vertex> { public final string name; public static string facedirection; public edge[] adjacencies; public double mindistance = double.positive_infinity; public vertex previous; public vertex(string argname) { name = argname; } public string tostring() { return name; } public int compareto(vertex other) { return double.compare(mindistance, other.mindistance); } } class edge { public final vertex target; public final string direction; public edge(vertex argtarget, string argdirection){ target = argtarget; direction = argdirec

Display error on google maps in 2 tabs jQuery -

i have problem display google maps in tabs, this wath have tried no sucess, in ie works fine in firefox tab not showing corect , line on route planner not work-ing. point poin b - there shoud line.. please see link: http://s1.xfactor-online.com/ wath have done rong? this html <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>route planner</title> <script type="text/javascript" src="/js/script.js"></script> <script type="text/javascript" src="/js/tabs.js"></script> <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript" src="/js/jquery.maphiligh

c - UTF-8 string size in bytes -

i need determine length of utf-8 string in bytes in c. how correctly? know, in utf-8 terminal symbol has 1-byte size. can use strlen function this? can use strlen function this? yes, strlen gives number of bytes before first '\0' character, so strlen(utf8) + 1 is number of bytes in utf8 including 0-terminator, since no character other '\0' contains 0 byte in utf-8. of course, works if utf8 utf-8 encoded, otherwise need convert utf-8 first.

scala - Is the method name "is" of "RequestVar" a short name of some other words? -

in lift web framework, requestvar has method is : def is: t current value of variable i wonder why method name is ? short name of other words? if word is , expect return boolean values, return value holds. i'd is supposed answer question "what is current value of variable?". it not make sense test existence, requestvars (and sessionsvars matter) are always. if confuses you, use get ;)

vba - Array Concatenate text and variable -

i create array follows: dim vhdr variant vhdr = array("jogo", "sala", "operadora", "semana", "nsemana", "acumulado semana 3") however, in "acumulado semana 3", 3 variable called semana_atual. i tried: vhdr = array("jogo", "sala", "operadora", "semana", "nsemana", ""acumulado & "" - "" & " & semana_atual") but didn't work. what if try (for vba): vhdr = array("jogo", "sala", "operadora", "semana", "nsemana", "acumulado semana " & semana_atual) just need order quotation marks. (i added 'semana' referring need, not have tried).

php - Overwriting Text in a File When It's Already Open -

i have file i'm opening writing, this: if (!$idhandle = fopen($filename, 'w')) { echo "cannot open file ($filename)"; die(); } i enter loop i'm incrementing variable, $beerid , during each iteration. want save variable file have open, use following code: if (fwrite($idhandle, $beerid) === false) { echo "cannot write file ($filename)"; die(); } $beerid++; however, ends creating massive string of every beerid encounter. want have file populated last id left off on. i realize put write outside of loop, script volatile , terminate prematurely error, want have reference last $beerid variable in event of error terminates script before loop terminated. you must go beginning of file because fwrite keeps track of in file. use fseek . opening , closing file several times in loop expensive , don't see reason in case. should of course close file when you're done it. you should add before write fi

python - Pythonic way of writing a sequence of integers in monotonically increasing order -

what pythonic , efficient way of writing integers 1 10**6 digits in monotonically increasing order? for example: (1,2,3,4,5,6,7,8,9,10,11,20,21,22,30,31,32,33,...) this gets job done looks pretty ugly. nums = [10**0*k6 k6 in range(1,10)] + [10**1*k5 + 10**0*k6 k5 in range(1,10) k6 in range(k5+1)] + [10**2*k4 + 10**1*k5 + 10**0*k6 k4 in range(1,10) k5 in range(k4+1) k6 in range(k5+1)] + [10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6 k3 in range(1,10) k4 in range(k3+1) k5 in range(k4+1) k6 in range(k5+1)] + [10**4*k2 + 10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6 k2 in range(1,10) k3 in range(k2+1) k4 in range(k3+1) k5 in range(k4+1) k6 in range(k5+1)] + [10**5*k1 + 10**4*k2 + 10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6 k1 in range(1,10) k2 in range(k1+1) k3 in range(k2+1) k4 in range(k3+1) k5 in range(k4+1) k6 in range(k5+1)] this returns 8001 numbers max_digits=6 : def ascending(ndig, first_digit_max):

Facebook Javascript error on dialog opening, only happening for a selection of users -

so having trouble error popping sample of users code in app https://developers.facebook.com/docs/reference/dialogs/requests/ it happening sample , not have lot of intel on happening , problem cannot replicate error on own machine or have idea problem is. i not sure how alerted of message can see problem , don't know how debug it here error: http://i.imgur.com/0mzbw2w.png one person sent me console info on issue , got message: "unsafe javascript attempt access frame url" doesn't seem happen getting error , have read in cases error doesn't cause error client. so how heck debug error has causation cannot figure out? i added service app: http://errorception.com/ not sure if catch error looking for, helpful regardless. i report if bottom of this.

In a CSV to access a two word header with powershell -

consider code: $header = '#', 'status', 'affected version', 'priority', 'subject', 'description' $csv = import-csv -path $path -delimiter ' ' -header $header select-object -skip 1 | foreach-object { $_.description = "something" } as can see adding columns csv file , adding values them. question is: how should access 'affected version' column? don't want add '_' between words. space must remain. thanks!! like this: ... | foreach-object { $_.'affected version' = "something" }