Posts

Showing posts from August, 2012

ios - Objective C Converting float to integer produces strange results -

i have float has value 30 core data. when print value using nslog 30. nslog(@"the value of float temp %@", [self.detailitem valueforkey:@"credit"]); when print value casting float int strange numbers , different result each time log printed: nslog(@"the value of float temp %d", (int)[self.detailitem valueforkey:@"credit"]); 137978864 122273424 try nslog(@"the value of float temp %d", [[self.detailitem valueforkey:@"credit"] intvalue]);

sql - select date_add mysql issue -

i have table loans in database schema this loans ----- period (vchar) ' contains number string date amt user i needed select records loans the date + period equal or greater current date. when execute query below select * loans date( date_add( date, interval period day ) ) >= current_date limit 0 , 30 i records in loans table. problem? is you're looking for? select columnlist loans curdate() < date_add(`date`, interval pay_period day)

HTML form with multiple "actions" -

i'm setting form wherein need 2 "actions" (two buttons): 1 - "submit form approval" 2 - "save application later" how create html form supports multiple "actions"? eg: <form class="form-horizontal" action="submit_for_approval.php"> <form class="form-horizontal" action="save_for_later.php"> i need combine these 2 options-for-submitting 1 form. i did basic research couldn't find definitive answer whether or not possible, and/or resources links workaround. thanks in advance. as @alik mentioned, can done looking @ value of submit buttons. when submit form, unset variables evaluate false. if set both submit buttons part of same form, can check , see button has been set. html: <form action="handle_user.php" method="post" /> <input type="submit" value="save" name="save" /> <input type="s...

Determine filesystem type of given file in Java -

is there similar statfs in java determine filesystem type of given file? more i'd determine if file provided user on shared or local filesystem. i'm going use information determine if application opening several identically named files on local filesystem of distributed application, or 1 shared file. i suppose if can "nfs", "lustre", "ext3", etc either string or enumeration can program mapping shared/not shared. let's assume file exists , readable. as far know, no - java not provide access information you're looking for. i think real option write shared library, , use either jni or jna access it.

combinding a list of lists into new lists in python -

i have list of lists list_of_lists[['front','stuff'],['back1,'stuff'],['back3','stuff'], ...['back...', 'stuff']] i want take front list , append each of lists: ['front','stuff','back1','stuff'] ['front','stuff','back2','stuff'] ['front','stuff','back3','stuff'] .... ['front','stuff','back..','stuff'] i know can set front = lists_of_lists[0] ['front','stuff'] how iterate , combine front , backs, each own list? [list_of_lists[0] + in list_of_lists[1:]] or if want avoid temporary slice front = list_of_lists[0] [front + j i, j in enumerate(list_of_lists) if i]

SQL Server : call stored procedure with side effects for each row without using a cursor -

before identical sql call stored procedure each row without using cursor let me clarify question: the stored procedure have side effects. in fact, it's side effects, results of each call influence further processing. think of this: table contains rule definitions, , proc executes rules literally rbar, making changes table. under conditions not see how set operation possible, cross apply can't used because of side effects, it's not needed, since i'm not joining rule table results. if solution rbar, should still try avoid using cursor? using while read top 1 key > @key better solution? why? the more searched, more came conclusion fast_forward read_only cursor simplest , fastest solution. cursors inherently bad no. cursors misused, , tend leapt upon people new sql because they're procedural background , haven't heard of "set-based". cursors have place, , if you've assessed available approaches , concluded cursors fit, ...

OpenGL 3D Picking -

i read many sample code opengl picking. of them use gluperspective funcion projection.i'm using glortho instead of gluperspective function. and selection function below(drawbuffer paint code): void selection( int x, int y ) { gluint buffer[512]; glint hits; glint viewport[4]; glgetintegerv(gl_viewport, viewport); glselectbuffer(512, buffer); (void)glrendermode(gl_select); glinitnames(); glpushname(0); glmatrixmode(gl_projection); glpushmatrix(); glloadidentity(); gldouble w = (double)m_clientrect.width(); gldouble h = (double)m_clientrect.height(); glupickmatrix((gldouble)x, (gldouble)(viewport[3] - y), 500, 500, viewport); glortho(-w / 2, w / 2, -h / 2, h / 2, -1000000.0, 100000.0); glmatrixmode(gl_modelview); drawbuffer(); glmatrixmode(gl_projection); glpopmatrix(); glmatrixmode(gl_modelview); hits = glrendermode(gl_render); if (hits > 0) { trace(_t("%d %d %d ...

ios - How to update the UITableViewDataSource when inserting new sections or deleting sections on UITableView? -

i've uitableviewdatasource maintains sections of data items presented uitableview instance. table view editable, allowing insertion , deletion of rows , sections, , changes on view should written data source. after reading through apple documents, can deal insertion , deletion on rows sending message tableview:commiteditingstyle:forrowatindexpath: data source. but, however, can't figure out standard way feedback changes on sections data source. please kindly help. the delegate method tableview:commiteditingstyle:forrowatindexpath: called table view tell user has done (what have added / removed). responsibility of code make appropriate changes model , reload table view. the simplest way reload call reloaddata , , have more specific options reloading / inserting / removing individual rows or sections - ui perspective , table view requires have updated model before call of these methods or table view throw exception.

javascript - creative puzzle how to animate brids eye view wave ripples -

Image
so have these 2 divs (the water , continent) , have subtle wave animation @ shoreline of landmass small waves emanate , spread outward. javascript? canvas? mootools? jquery? appreciate people brainstorming or offering resources and/or examples coud at. found amazing demo : ) http://29a.ch/2010/10/23/html5-water-ripples-demo heres http://www.mrdoob.com/lab/javascript/effects/water/00/ javascript , canvas both important realistic , pragmatic clientside animations, browsers better @ handling these animations others of course (chrome). mootools, or jquery, both libraries - may choose best you, jquery popular. surprised see how short first demos source code was.

javascript - Displaying an image when selecting an option from a drop down list -

i'm trying change image upon selection of option in drop down list: function volvocar() { var img = document.getelementbyid("image"); img.src="volvo.png"; return false; } and on each car. <img id="image" src="null_image.png"/> <select id="carlist"> <option onclick="nullcar()">no car</option> <option onclick="volvocar()">volvo</option> <option onclick="audicar()">audi</option></select> i can't seem find online gives me solution. whether it's because i'm phrasing awkwardly or because i'm trying impossible javascript, don't know. instead of setting onclick event option, set onchange event select. html <img id="image" src="null_image.png" /> <select id="carlist"> <option value="null_image.png">no car</option> <option value="volvo...

c# - Multiple Inheritance Levels Using Entity Framework TPT -

Image
considering following table schema: i want use entity framework table-per-type (fluent api) map following class diagram: how can this? have tried doing examples @ microsoft site looks no example covers two-depth inheritance scenario , errors related invalid discriminator columns , on. using 1 entitytypeconfiguration per type. how can specify name of foreign key cascading down children? if has example of how such mapping, grateful forever. thanks! so table per type won't quite work schema because table per type links tables through shared primary key. modify schema useraccounts, externaluseraccounts, , systemuseraccounts keyed on useraccountid. code below close want. otherwise, you'll want use regular association properites. read table per type here , shared primary keys here . public class useraccount { public int useraccountid {get;set;} public int userid {get;set;} public datetime lastlogin {get;set;} p...

javascript - How to get node asset_builder working with current express? -

i've been trying use asset_builder node module express 3.1, can't seem make far in setup before receiving error upon starting server: var parsed_url = url.parse(request.url); typeerror: cannot read property 'url' of undefined this being thrown within middleware.js file of asset_builder module itself. i'm guessing due fact express apps no longer extend server, , setup in base ( app.js ) file bit different once was. ideally i'm trying use asset_builder grab javascript , serve single file rather many have (ember app). the base project i'm working off of uses ejs express view engine (instead of default jade ).

xdebug - Debugging APS package in Eclipse -

i new aps technology (for saas). know eclipse has plugin creating , debugging aps. i've installed it. @ moment can't debug "helloworld" aps package contains php scripts. need run aps player purpose. i've added pdt , zend debugger support in eclipse. problem linked web server wamp , zend debugger. i've added different combinations of settings in php.ini after adding zenddebugger.dll. phpinfo shows zenddebugger not activated. dummy.php must put when deal aps? so, need working combination of eclipse, aps plugin, web server , zend debugger. in fact, can use application,debugger stuff, not pure eclipse. use windows 7, 64bit. file should choose here http://downloads.zend.com/pdt/ ? should use zend server in order have easy support of zend debugger? xdebug work instead of zend debugger aps debugging? in order test aps package must integrate in parallels panel, simple hello world package, because php scripts aps types need provisioned first. luck

forms - JQuery selectors fine point -

was working on website involved simple form submittals. rather handle submittals classic, old-school html way (i.e. form tag, "action=" attribute, button, etc.), decided submit data via jquery's .ajax() method. handling things way, necessary explicitly clear form fields, after "submittal". let's actual form looked this: <form action="some_page.asp" id="my_form" method="post"> <input type="checkbox" name="form_field" value="some_value" /> <input type="checkbox" name="form_field" value="some_other_value" /> <input type="checkbox" name="form_field" value="yet_another_value" /> <input type="text" name="form_field" /> <input type="hidden" name="form_field" class="must_not_clear" value="" /> ...

MySQL: Select orders that have completed lines -

this has got simple. i have 2 tables: orders , order_lines. pretty simple , self-explanatory; one-to-many relationship. order_lines has fulfilled column containing date when particular line completed. here's need do: select orders.id of orders complete; i.e. none of fulfilled columns in order_lines table null particular order. example: order #1 has 2 lines, both of not null order #2 has 1 line null the query should return #1 because complete. select * orders o not exists ( select 1 order_lines ol1 ol1.fullfilled null , ol1.orderid = o.orderid ) sql fiddle version an alternate version uses in function: select * orders o o.orderid not in ( select ol1.orderid order_lines ol1 ol1.fullfilled null ) sql fiddle version addition there desire ...

css - Why can't I add more paragraphs to this HTML document? -

i've finished html , css course @ codecademy , want study python. before do, build small website things i'm learn, practice html , css skills. i'm having trouble, because can't add more content below html file , don't know why. here html (also on http://pastebin.com/br4w1ygl ): <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <title>python</title> </head> <body> <div class="texto"> <h2>welcome flying circus</h2> <p>python powerful, flexible programming language can use in web/internet development, write desktop graphical user interfaces (guis), create games, , more. python is:</p> <ul> <li><...

c# - SQL Server Remote Connections Error -

getting error message in creating remote sql connections works fine in local connections error message: attempted read or write protected memory. indication other memory corrupt. (system.data) hi not sure has happened in case may try changing references system.data.sqlclient in project when project moved new machine, sometime need renew references added in project.

algorithm - Tabu Search in TSPTW -

i applied tabu search in tsptw problem, gives me result similar getting best improvement using exchanging pivot rule (exchange between 2 cities ), in papers, stated tabu gives result near optimal 1 (i have best solution of same initial solution 0 constraints violation using algorithm). sure, result normal ?, , here's pseudo code of applying tabu: running tabu number of iteration tabu tenure=7 list tabulist each solution saved, 2 exchanged cities bestsol=initial solution currsol=initial solution tabufun() { while(i<iteration) { i++; currsol=bestneighbourhood(currsol) if(currsol.fitness < bestsol.fitness) // curr better best bestsol=currsol } return bestsol // result of tabu search } bestneighbourhood(currsol) { solutions=getallexchanepossiblesolution(currsol) // if first time save global min, firsttime global variable set true for(each sol in solutions) { bestneigh=sol; if(firsttime) { globalmin= sol.fitness firsttime=...

html - Javascript Resize Images on shuffle -

ok, have bootstrap thumbnails set script shuffles images inside thumbnails or a element inside li parts works fine except images larger/smaller others. images resize on shuffle match space allowed in <li class="span#"> possible in javascript function have? bootstrap thumbnails: <ul class="thumbnails" id="list"> <li class="span4"> <a href="#" class="thumbnail"> <img src="http://placehold.it/360x270" alt=""> </a> </li> <li class="span3"> <a href="#" class="thumbnail"> <img src="http://placehold.it/260x120" alt=""> </a> </li> ...

jquery - Having trouble using Kwicks to open first li of accordion slider -

i have tried few different methods have first li of accordion slider open default nothing working properly. i have tried add class active doesn't unless inline style set 686px. if add changes other images well. i'm sure simple solution on looking. http://roofing.kellykruschel.com/ use , working fiddle kwicks 2.0 $('.kwicks').kwicks('expand', 0); kwicks 1.5 $('.kwicks').kwicks({ size: 321, max : 686, spacing : 0, behavior: 'menu', sticky :true }); });

eclipse - Do java applets have to be signed with trusted cert authority with new v7 update 21? -

i require fixing problem. as posted in 1 of previous questions have problem java applet. java viewer not working after jre 1.7.0.21 update i tried several things, unable make app work. try obtain trusted cert, spending 300$ without being sure not acceptable. i kindly ask if willing me out fix problem... with kind regards, no9. with java 7 update 21 depends on java security settings of java control panel if self-signed certificates accepted java applets. if slider of java control panel set highest security setting, trusted cert authorities accepted. in future version (october 2013) oracle remove slider , make highest security setting remaining selection. (source: jax2013 talk "moving java platform forward" of wolfgang weigend )

If Remote Desktop minimize or close c# form application stopped -

i wrote program using c# form application, using clipboard , capture screen. program running remote desktop (mstsc). if close remote desktop window (not disconnect close window or minimize window) program stopping. i didn't find solution. can me please error:stack trac location: system.drawing.graphics.copyfromscreen(int32 sourcex, int32 sourcey, int32 destinationx, int32 destinationy, size blockregionsize) error:message handle invalid your program stops because not able take screen shot (which exception shows). this because, when on remote session there not screen , screen in fact screen opened session (your screen), when close or minimize mstsc window remote session not have screen anymore. try handle exception application not finish (try.catch block instance).

xml - How can I prevent text from going over the before and after regions using xsl-fo? -

i'm loading allot of text pdf using xsl-fo. when loads fills page entirely border border. there way prevent text being able go on before, after, start , end blocks, or should put margins on blocks containing text? <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0" xmlns:fo="http://www.w3.org/1999/xsl/format"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <fo:root> <!-- overall layout --> <fo:layout-master-set> <fo:simple-page-master master-name="forsalepage"> <fo:region-body/> <fo:region-before extent="1in" background-color="#0000ff" /> <fo:region-after extent="1in" background-color="#0000ff" /> <fo:region-start/> ...

javascript - Reload XML data without reload page -

i xml data mysql.. , change save again mysql. want see changed data without reload page. how can ? i data that: downloadurl("gxml.php", function(doc) { var xmldoc = xmlparse(doc); var markers = xmldoc.documentelement.getelementsbytagname("marker"); i`v tried calling function that. didnt work.. function reloaddata() { downloadurl("gxml.php", function(doc)); } thanks.. maybe try using ajax. pass values php ajax via javascript. , in ajax retrieve xml data ever want it. , give response. use success: function(){ //append html. }

When to load database drive configuration settings in ASP.NET? -

at application start our application connects database , fetches language translation table , caches memory. code placed in application_start in global.ascx the problem approach if database not available, there unhandled exception. because code set @ application_start, request , response not available. i wondering if there's general lightweight approach this. my plan implement singleton store state of connection attempt, , check on default routed page. it's solution, feel there's missing. there other approaches this? the problem approach if database not available, there unhandled exception. well handle then. implement retry policy in code if result not cached in memory fetch database once again.

iphone - WebSocket server implementation on iOS -

Image
i want implement websocket server on ios , client side on browser. found library for server side implementation in objective c . i'm having trouble building project , need urgently. followed steps given in installation guide add corewebsocket.xcodeproj project in targets build phases in target dependencies add corewebsocket in link binary libraries add cfnetwork.framework coreservices.framework --------------- //could not add ios libcrypto.dylib --------------- //could not add ios corewebsocket.framework add build phase > add copy files set destination frameworks add corewebsocket.framework clean build corewebsocket --------------- //build targeted mac os x build app --------------- //build fails here result after step #3 for step #4 selected corewebsocket , did clean , build successful. but when selected project again (serversocktrial) , built got linker error. clang: error: no such file or directory: '/users/administrator/libra...

c++ - variadic templates sum operation left associative -

the code below works the: goal left associative sum operation: sum(1,2,3,4); however, won't work correctly sum(1,2,3,4,5) or sum(1,2,3,4,5,...) . more 4 arguments gives error: error: no matching function call sum(int, int, int, int, int) ================================= template <typename t> t sum(const t& v) { return v; } template <typename t1, typename t2> auto sum(const t1& v1, const t2& v2) -> decltype( v1 + v2) { return v1 + v2; } template <typename t1, typename t2, typename... ts> auto sum(const t1& v1, const t2& v2, const ts&... rest) -> decltype( v1 + v2 + sum(rest...) ) { return v1 + v2 + sum(rest... ); } int main() { cout << sum(1,2,3,4); //works correctly //cout << sum(1,2,3,4,5); //compile error } that seems bug in gcc, when working variadic templates, auto return types , recursive reference same variadic template in trailing return type. it solvable, through old t...

ios - I want unique identifier string which detect iPhone device (just like UDID)? -

i want unique identifier string iphone devices instead of udid , mac . 1. udid , mac deprecated apple. 2. can use uuid change after reinstalling app or delete app. i want unique value of device remain same after app reinstall or delete or upgrade ios version. what can unique identifier using [[uidevice currentdevice] identifierforvendor] or other unique identifier generator. after should store value on keychain using keychainitemwrapper , use. once store value on key chain it'll not remove after delete , reinstall app. here guide keychain access - link

r - Mean of variable by two factors -

i have following data: a <- c(1,1,1,1,2,2,2,2) b <- c(2,4,6,8,2,3,4,1) c <- factor(c("a","b","a","b","a","b","a","b")) df <- data.frame( sp=a, length=b, method=c) i can use following count of number of samples of each species method: n <- with(df,tapply(sp,method,function(x) count(x))) how mean length method each species? personally use aggregate : aggregate(length ~ sp, data = df, fun= "mean" ) # species # sp length #1 1 5.0 #2 2 2.5 aggregate(length ~ sp + method, data = df, fun= "mean" ) # species , method # sp method length #1 1 4 #2 2 3 #3 1 b 6 #4 2 b 2 for may want: aggregate(length ~ method, data = df, function(x) c(m = mean(x), counts = length(x)) ) # counts , mean each method # method length.m length.counts #1 3.5 4.0 #2 b 4.0 ...

asp.net - Unable to access Hidden Field value in server side -

i have hidden field assign value in javascript so. var rowindex; function getselectedrow(lnk) { var row = lnk.parentnode.parentnode; rowindex = row.rowindex - 1; var ri = rowindex; document.getelementbyid('<%= hiddenrowindex.clientid%>').value = ri; } in server side try field like dim dtsub new datatable dtsub = ctype(viewstate("uploadtimeslotgroupdata"), datatable) dim dtrow() datarow = dtsub.select(expression) if dtrow(0) isnot nothing dtsub.rows(val(hiddenrowindex.value.tostring)).delete() end if but getting 0 in server side. how fix this? i have fixed issue. code: function getselectedrow(lnk) { var row = lnk.parentnode.parentnode; rowindex = row.rowindex - 1; var ri = rowindex; document.getelementbyid('<%= hiddenrowindex.clientid%>').value = ri; }

php - CodeIgniter redirect user on the same page but on other language -

i have layout (master) page have section divs, header, content, footer, ... inside header div have country flags. i'm trying implement solution user location when clicked on country flag being redirect same page country prefix. i'm using location http://jeromejaglale.com/doc/php/codeigniter_i18n , have pages like /en/company/ , /fr/company/ now when user example surfing /en/company/history , click on french flag redirected /fr/company/history consider flags under layout view cannot link flag language link (company/history)view itself. should grab url value , parse url , replace language prefix language prefix or there better approach. you use i18n codeigniter library . you can put switch language logic inside controller (default or 1 want switch lang) switch selected language value. value can retrieved using $this->lang->lang(); this return either en or other language use and there pretty easy, invert value , put inside $data['switc...

python - Compare if two items from os.listdir are similar? -

ignore question. different actual question needed ask. people answered question, i'm sorry. in future, though. read new thread here: opening files found os.listdir() , comparing lines inside? basically, i'm running os.listdir() listing of files, , trying compare if 2 different files have similar names. how go this? basically, code this: config_dir = "/etc/netctl/" profiles = os.listdir(config_dir) in profiles: if os.path.isfile(config_dir + i): if in i: print "true" else: pass i'm not sure use check similarities in names, though. however, know "if in i" checking same word... don't know how go saving last one... i tried: i2 = "" profiles = os.listdir(config_dir) in profiles: if os.path.isfile(config_dir + i): if i2 == "": i2 = print i2 elif i2 == i: continue if i2 in i: print "true" ...

how to revert android:sharedUserId change -

i have app in play store (let's version code 1.1) not using android:shareduserid in manifest. needed users share data app, make new version (the 1.2) using android:shareduserid in manifest, allow sharing. caused when users updated 1.1 1.2 not acces data. when realised problem make new version (1.3) removing android:shareduserid manifest, leaving in first version. now see users upgrade 1.1 1.3 directly, has no problems , app works well. users upgraded 1.1 1.2 , upgraded 1.3, still have no acces data. readings i've done, can understand 1.2 can't acces data since user specified shareduserid diferent 1 created directory in version 1.1. in 1.3 there's no android:shareduserid (the manifest same in version 1.1). can't understand why there's no acces. somebody can figure out problem , how solved? thank's

java - How much space will be reserved for a non genric Arraylist while defining it -

by default when create arraylist without specifying size , create array of 10 elements in memory question is, if create list lst = new arraylist(); how many bytes reserved in memory lst? the default capacity of arraylist has nothing generics. if don't specify capacity, default capacity of 10. object array of 10 elements created, filled nulls. an object array array of object references. the memory cost of object reference depends on platform program running (typically 8 bytes on 64 bits os, 4 bytes on 32 bits os).

ios - How to change style of tabbar in iphone sdk -

Image
i developing application in need bit customize tabbar have attached image below. in image home tabbar item show want is, tried couldn't change highlighted area show in first image , getting result shown in second image . want in first image need crop whole tabbar item image in home button or need change color of selected area? thanks advance guidance. try this, didfinishlaunchingwithoptions uiimage *selectedimage0 = [uiimage imagenamed:@"home_sel.png"]; uiimage *unselectedimage0 = [uiimage imagenamed:@"home.png"]; uiimage *selectedimage1 = [uiimage imagenamed:@"weight_sel.png"]; uiimage *unselectedimage1 = [uiimage imagenamed:@"weight1.png"]; uiimage *selectedimage2 = [uiimage imagenamed:@"rewards_sel.png"]; uiimage *unselectedimage2 = [uiimage imagenamed:@"rewards.png"]; uiimage *selectedimage3 = [uiimage imagenamed:@"menu_sel.png"]; uiimage *unsel...

c# - Alignment issue of images -

i request in patience read till end. back ground : have app accepts file usb , prints formatted data graph plots via printer , when user clicks button - print process : ever running application. user removes drive after every file printed, copies new files, insert in application , clicks print button. problem : first time ok. when user removes drive, return new file, alignment of images gone when printing. eg : bitmap drawn @ right end of paper, shifted left on next time. i tried : resets printdocument objects on every print button click. (no use). tried application restart every time print button clicks : works expected. having assumption that, related application start up. i know vague question. confused data presented here. since don't know part making problem. please ask clarifications, or code part needed verification , post. edit 1,2 : code explanation var trackchart3 = new chart(); var chart3area = new chartarea { name = "chart3" }; trackc...

Boost C++ regex - how to return all matches -

i have , string "solutionan ananana solutionbn" want return string start solution , end n . while using regex boost::regex regex("solu(.*)n"); getting output solutionan ananana solutionbn . while want out solutionan , solutionbn . new regex in boost appreciated. snippet if code using #include <boost/regex.hpp> #include <iostream> int main(int ac,char* av[]) { std::string strtotal("solutionan ananana solutionbn"); boost::regex regex("solu(.*)n"); boost::sregex_token_iterator iter(strtotal.begin(), strtotal.end(), regex, 0); boost::sregex_token_iterator end; for( ; iter != end; ++iter ) { std::cout<<*iter<<std::endl; } } the problem * greedy. change using non-greedy version (note ? ): int main(int ac,char* av[]) { std::string strtotal("solutionan ananana solutionbn"); boost::regex regex("solu(.*?)n"); boost::sregex_token_iter...

Android SlidingDrawer : How can I slide an activity just using motion event except handle -

i'd make layout avast! mobile security app's main view. is sliding drawer or using overridependingtransition animation effect? i think sliding drawer. there no handle. makes me confused. how can slide activity app? check app here . there navigation drawer in android since last google io. http://developer.android.com/design/patterns/navigation-drawer.html it's added in recent version of supportlibrary.

web - Exception while loading Webpage Primefaces -

when try load webpage, i'm getting following exception: java.lang.nosuchmethoderror: org.primefaces.context.defaultrequestcontext.(ljavax/faces/context/facescontext;)v i tried figure out it's coming from, couldn't find out :( have ever encountered exception , know how resolve it? here full stack-trace glassfish: warnung: standardwrappervalve[faces servlet]: pwc1406: servlet.service() servlet faces servlet threw exception java.lang.nosuchmethoderror: org.primefaces.context.defaultrequestcontext.<init>(ljavax/faces/context/facescontext;)v @ org.primefaces.context.primefacescontext.<init>(primefacescontext.java:16) @ org.primefaces.context.primefacescontextfactory.getfacescontext(primefacescontextfactory.java:23) @ com.sun.faces.context.injectionfacescontextfactory.getfacescontext(injectionfacescontextfactory.java:121) @ javax.faces.webapp.facesservlet.service(facesservlet.java:583) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1...

Chrome & Firefox keep asking for authentication when going to localhost -

i'm having problem chrome & firefox have both started bringing popup window saying authentication required when going localhost (401 page). if on network can put in usual network username/password , works fine, if i'm offline (the reason i'm using localhost) authentication fails , sent 403 page. this not happen in ie , not happening few days ago, network settings set ignore proxy on localhost , auto detect settings switched off. any ideas? problem permission of site directory. if put folder under home (~), problem occurs. try give home folder wider permission. read permission others.

testing - Making a JUnit test case for an abstract java class? -

this question has answer here: how test abstract class in java junit? 9 answers i have develop junit test cases application has several abstract classes , methods. is possible create junit test cases abstract classes without being extended class? if subclass extends abstract class, enough test subclass? how create test cases non abstract methods of abstract class? since cannot create instance of abstract class must use derived class test it. can create simple class extends abstract class testing purposes. when testing ensure subclass used test methods requiring testing in abstract class.

gdb - gdbserver tracepoint arm support -

i compiled gdbserver 7.6 arm with: cd /gdb-7.6-src/gdb/gdbserver ./configure --target=arm-linux --host=arm-linux make cc=/path/to/cross-compiler-gcc then compiled gdb 7.6 arm with: cd /gdb-7.6-src/ ./configure --target=arm-linux --prefix=/opt/gdb-arm/install/ make && make install i compiled trivial application with: /path/to/cross-compiler-gcc hello.c -g -o hello i copied gdbserver , cross-compiled application on board. pc (x86-pc-linux) run: gdb hello (gdb) set target-async on (gdb) tvariable $c (gdb) actions >teval $c=$c+1 >end (gdb) break main (gdb) target remote <ipaddr>:<port> [thread 1585] #1 stopped. 0x40000800 in ?? () cannot access memory @ address 0x0 (gdb) continue & (gdb) tstart target not support command. (gdb) tstatus target not support command. the behaviour 'normal' until tstart command: can debug application want, unable start tracing app. the question is: does gdbserver support tracepoints arm or x86/amd_64?...

php - form select on laravel -

i have data id rel word 1 word 2 b word b 3 b word c to data controller : public function get_new() { return view::make('form.new') ->with('datas', data::all()); } and view : <select> @foreach($datas $data) <option value="{{ $data->id }}" rel="{{ $data->rel }}">{{ $data->word }}</option> @endforeach </select> how can data form::select ? if use form::select can call data::lists('word','id') , pass view. if use can 2 data id , word. how can data id, rel , word form::select . please me. laravel 4s formbuilder , htmlbuilder aren't going produce everything everyone . taylor himself has said wants keep lean , simple. solution have best way go (using simple loop). form::select isn't capable of automatically populating other attributes of option element. if want functionality you're going either have make custom macro or wri...

sql server - How to pass string to stored procedure -

my stored procedure is: alter proc [hometution].[sp_gethomepageproducts] @catids nvarchar(500) begin select top 3 * product p p.id in (select productid product_category_mapping pcm pcm.categoryid in (@catids)) , p.showonhomepage=1 , p.deleted=0 order updatedonutc end i calling this exec sp_gethomepageproducts @catids='17,12' i getting error conversion failed when converting nvarchar value '17,12' data type int. try 1 - alter proc [hometution].[sp_gethomepageproducts] @catids nvarchar(500) begin ;with cte ( select id = p.value('(./s)[1]', 'int') ( select field = cast('<r><s>' + replace(@catids, ',', '</s></r><r><s>') + '</s></r>' xml) ) d cross apply field.nodes('/r') t(p) ) select top 3 * dbo.p...

html - Textarea overflow:auto difference in height -

following code renders textarea should have 3 visible rows: <textarea id="txtinput" rows="3" cols="20" style="overflow:auto"></textarea> however, in firefox (version 20.0.1), 4 rows shown instead of 3. see http://jsfiddle.net/kxxss/ how can fix this? firefox adds lines after textfields. can fix css : @-moz-document url-prefix() { textarea { height: 4em; } } the @-moz... is mozilla specific rule, url-prefix rule applies rule page url starts it.

c# - Linq to Twitter status update -

this code for reason unable update status getting error . your credentials not allow access resource @ var tweet = twitterctx.updatestatus("hello world"); var auth = new applicationonlyauthorizer { credentials = new inmemorycredentials { consumerkey = "", consumersecret = "" } }; auth.authorize(); //auth.invalidate(); var twitterctx = new twittercontext(auth); var tweet = twitterctx.updatestatus("hello world"); i checked consumerkey , secret correct , gave app read write acccess. able previous status , user name unable tweet new status application authorization can perform operations application-level. differs other authorizers let operate on behalf of user. logic user has account, application doesn't. therefore, can't tweet on behalf of application because tweet can't assigned anywhere. however...

unable to browse asp.net mvc 4 page -

i'm not sure did, , happened today. i unable browse 1 of mvc 4 applications, able do. there's no error message. when right click on project , view in browser, shows "connecting..." - localhost:55223, , remains there forever. i have tried following: 1) copied proejct onto pc , browse - works! 2) create new mvc application in visual studio , browse - works! i have set breakpoint in global.asax's start method, , doesn't there. what else have check? please help have tried right clicking on iis icon in taskbar , exiting it? build project again restart iis.

javascript - PDFJS: how to render pages and load data on request? -

i show pdf files in web app, pdfjs working fine load pages on scrolling. found pdfjs supports rendering on loading. dont want load whole document @ time. user clicks on next page next page data , render. i show pages on request? how render pages on request using pdfjs?

javascript - Ajax search function with pagination -

i have search form submitted using ajax. form , results work well, having issues pagination. the pagination pulled in search results, when click link, directed search results page, has no styling. i looking disable default behaviour of pagination. code below: function dothesearch () { var options = { target: '#results', beforesubmit: showrequest }; $('#filter').ajaxform(options); }; function showrequest(formdata, jqform, options) { $('#results').prepend('<p class="searching">searching database</p>'); return true; } $(".pagination a").click(function(event) { event.preventdefault(); dothesearch(); }); any appreciated. many ben -------------- edit ---------------- the section below current results displayed: <section id="results"> <!-- items displayed here (using expressionengine) --...

android - AsyncTask in onCreate method -

i have simple application plays online radio. showing title online php service use asynctask , call oncreate method. in android 4 everythin ok, in android 2 it's crushed error java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare() then in internet found, must use code new thread(new runnable() { @override public void run() { mainactivity.this.runonuithread(new runnable() { @override public void run() { //my code } }); } }).start(); but after using tip, can't see button , text views in android 4 , android 2 versions. code: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //thread update title every second new thread(new runnable() { @override public void run() { mainactivity.thi...

F# Pattern-matching by type -

how pattern-matching type of argument works in f#? for example i'm trying write simple program calculate square root if number provided or return it's argument otherwise. open system let my_sqrt x = match x | :? float f -> sqrt f | _ -> x printfn "enter x" let x = console.readline() printfn "for x = %a result %a" x (my_sqrt x) console.readline() i error: error fs0008: runtime coercion or type test type 'a float involves indeterminate type based on information prior program point. runtime type tests not allowed on types. further type annotations needed. since sqrt works float check float type, guess there better solution - check if input number (in general) , if so, cast float? the problem here type of x string . adding comes console.readline , kind of information stored in string possible determine @ runtime. means can't use neither pattern matching, nor pattern matching coercion here. ...

json - Backbone toJSON not rendering -

when use backbone tojson method of model this: this.$el.html(this.model.tojson()); it doesn't render model view root element ( more 1 attribute ). but when 1 property model, this; this.$el.html(this.model.get("city")); it rendered properly. also, when use template in first case (tojson) - rendered fine. this.$el.html(this.template(this.model.tojson()); why ? thanks so, this.template (in of cases) compiled version of html template have view. it have placeholders in it, , take parameters same key placeholders in template. example (handlebars templates), <section id="{{id}}"> <header>{{header_text}}</header> </section> considering above code template, when compile , store in this.template , returns function, takes json object parameter, this.template function. you can call below, var html_text = this.template({ id : "main_content", header_text : "hi welcome !!" }); th...

jquery - left right floating div according to width of parent div -

sorry if title confusing couldn't find appropriate title problem.but know trying achieve. if dropdown of http://applearn.tv/ can see on mouseover dropdown changing it's direction ie if mouseover on first menu div displays right left , last menu displays left right.currently static concept of same thing using jquery. sorry don't have jsfiddle this. please let me know if there kind of tutorial or fiddle. thank you. you can find out position of dropdown box checking window width, dropdown box width & navigation item position left you cantry logic, id left co-ordinate of current navigation comes in left half of window apply float:left else apply float:right code: $('.navlink').click(shownavigation); function shownavigation() { var navigationitem = $(this);//assuming anchor tag var holderitem = navigationitem.next('div.navigationitem'); var windowwidth = $(window).width(); var navigationlef...

How to add contents of file to MySQL query inside php -

i'm using following php query install tables in cms system: $q=new mysql(" insert `adm` (`id`, `login`, `adm`, `passwd`, `czas`, `logged`, `ip`, `email`) values (0, 'admin', 1, password('admin'), 0, 0, '0.0.0.0', 'admin@domain.com'); "); however instead of e-mail admin@domain.com use e-mail stored inside /settings/contact.inc.php file is: <?php $emailaddress='admin@domain.com'; ?> you can use like, $query = "insert `adm` (`id`, `login`, `adm`, `passwd`, `czas`, `logged`, `ip`, `email`) values (0, 'admin', 1, password('admin'), 0, 0, '0.0.0.0', '$emailaddress')"; note: need include /settings/contact.inc.php file. do read: sql injection attacks ! learn prepared statements instead, , use pdo or mysqli - this article decide which.