Posts

Showing posts from June, 2014

asp.net mvc - Using ServiceStack's AuthService with Controller and AuthorizeAttribute -

there no simple servicestack sample classic asp.net mvc. both appharbor , socialbootstrap api based on singlepage application. how can implement classic asp.net mvc application servicestack's authentication. i've added authservice property basecontroller (autowired). , got weird "object reference" exception while implemantation. ( authservice line 135 base.requestcontext null) why i'm getting error? or send simple usage. (like asp.net mvc membership starter) services make use of requestcontext, needs injected current request context, e.g: authservice.requestcontext = new httprequestcontext( httpcontext.current.request.torequest(), httpcontext.current.response.toresponse(), null ); this uses extension methods in sessionextensions.cs . you want resolve services ioc - here's example of sharing functionality between servicestack , mvc .

imagebutton - Generic click event in Android -

Image
recently able create tablet software cerebral palsy girl "talk" me, since can't speak. well, friend of mine has amyothrophic lateral sclerosis (als). can move 1 finger , willing use daughter's software able "talk" again. since can move finger, created version each item "blinks" (in yellow) time (just 1 second) , if presses mouse button, item focused (in yellow) activated. see below: it works if leave mouse on black portion of screen. if mouse on buttons, won't work, click button mouse over. also, if uses keyboard , presses enter key, activate first button, then, if clicks left arrow , presses enter again, activate second button , on. so, wish create generic event if press enter key, selected (in yellow) item activated. any ideas? well make 2 different modes. 1 there click listeners each picture,and click anywhere on screen recognized ( ex. find largest layout id , set listener). in second mode, use http://develop...

php - Why does variable say undefined? -

this says $total , $sub undefined $total += $sub. $sub declared in while loop , both $sub within function should local variable. why can't use it? public function cart() { foreach($_session $name=>$value){ if (substr($name, 0, 5) == 'cart_') { if((int)$value > 0){ $id = substr($name, 5, (strlen($name)-5)); $st = $this->db->prepare("select id, name, price deals id=?"); $st->bindparam(1, $id); $st->execute(); while($cart_item = $st->fetch(pdo::fetch_obj)){ $sub = $cart_item->price*$value; echo $cart_item->name.' x '.$value.' @ '.$cart_item->price.' = '.$sub.' <a href="cart.php?add='.$id.'">[+]</a> <a href="cart.php?remove='.$id.'">[-]</a> <a href="cart.php?delete='.$id.'">[del...

c# - Application sometimes crashes when opening a dialog on only one machine -

so kind of weird error. on 1 machine 1 of our customers (windows xp sp3) our program crashes when trying open filter dialog via showdialog(). what happens: user works expected he/she nothing unnormal or wrong , he/she is/was tested on several machines (ranging win xp 32 bit win 7 64 bit). now, after time he/she want's use filter dialog (which he/she did @ point dozen times) , application crashes. wonderful "$applicationname caused problem , has terminated" message windows xp, beneath can see filter dialog, partially build (meaning: can see window, scroll bar , transparent 'holes' text controls/labels should be. in windows eventviewer can see entry event id: 1000 source: .net runtime 4.0 error re (maybe stands behind , says 'reporting'?!) faulting application $applicationname.exe, version $versionnumber, stamp $somerandomnumbers, faulting module ntdll.dll, version 5.1.2600.6055, stamp 4d00f27b, debug?0, fault address 0x00446da ...

Align two-button layout left and right in Android -

Image
i want align 2 buttons linear layout, 1 on left, , 1 on right, next , previous buttons on image gallery. tried align them doesn't work. xml layout code: <?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="@android:color/white" android:gravity="bottom" > <linearlayout android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/black" > <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" ...

c# - Retrieving error codes from SQLite when using ExecuteNonQuery() -

in c# project, i'm using system.data.sqlite.dll downloaded codeproject . my problem per title - how error codes after calling sqlitecommand.executenonquery() function? error codes such sqlite_constraint, sqlite_busy, sqlite_locked shown here . use exception.stacktrace or sqliteexception.errorcode try { } catch(sqliteexception ex) { string code = ex.errorcode; }

osx - Dylib ok at link time but not at runtime -

i have problem linking correctly project. project build cmake. have problem linking correctly project. project build cmake. linking seems fine, run time throws error. the command use link: $ /usr/bin/clang -wl,-search_paths_first -wl,-headerpad_max_install_names cmakefiles/project.dir/src/conf.c.o cmakefiles/project.dir/src/tun-compat.c.o cmakefiles/project.dir/src/compress.c.o cmakefil\ es/project.dir/src/mc.c.o cmakefiles/project.dir/src/hexdump.c.o cmakefiles/project.dir/src/server.c.o cmakefiles/project.dir/sys/unix/log.c.o cmakefiles/project.dir/sys/unix/imsg.c.o cmakefiles/project.dir/\ sys/unix/imsg-buffer.c.o cmakefiles/project.dir...

Desire2Learn Office Extensions not working correctly with Office 2010 and D2L 10 -

when attempt use desire2learn office extension office 2010 on windows 7 against our development instance of d2l v10 login integration not work properly. enter url our development instance: screenshot #1 when click "login" button on desire2learn tab in word, popup dialog standard d2l sign-in page: screenshot #2 but when enter valid credentials redirected d2l org-level homepage within same small popup window, not expected behavior idkey authentication redirect. haven't had experience yet d2l valence apis, appears initial request /d2l/auth/api/token fails , redirected standard d2l login page. is there here has been able configure d2l 10 work office extension assist me in getting working? there sites custom portal page organization's login not pass "target=" parameter through login step appropriately. missing results in "deeplinking" not working (which in turn required during valence auth). if control own portal page may able ...

css - jquery mobile lineup controls in a line -

how lineup form controls select boxes , others in line in jquery vs having them displayed vertically? <label for="select-choice-0" class="select">shipping method:</label> <select name="select-choice-0" id="select-choice-1"> <option value="standard">standard: 7 day</option> <option value="rush">rush: 3 days</option> <option value="express">express: next day</option> <option value="overnight">overnight</option> </select> <label for="select-choice-2" class="select">shipping method:</label> <select name="select-choice-2" id="select-choice-2"> <option value="standard">standard: 7 day</option> <option value="rush">rush: 3 days</option> <option value="express">express: next day</option> <o...

javascript - Submit Form onChange with data-native-menu="false" -

i'm trying submit form when select changes using jquery mobile. have no requirements on select element looks like. require form submitted without ajax. code have: <form name="langform" method="post" data-ajax="false"> <select name="syslang" id="chooselang" data-mini="true" onchange="this.form.submit()"> <options /> </select> </form> now works iphone, when try on android select menu doesn't show up. when add data-native-menu="false" select, select menu shows , works on android, form doesn't submitted on iphone. i should mention i'm using jquery mobile 1.1.0 , jquery 1.7.1 all need have submit on both devices. can this? so found solution problem. wanted share in case else ran issue. apparently jquery mobile 1.1 has issues form elements in fixed containers (using position: fixed) android 2.2 , 2.3, referenced here http://jquerym...

vb.net - Unable to retrieve data from XML using linq to xml with multiple namespaces -

i unable retrieve data xml looks might missing the data need retrieve looks this: <rs:data> <z:row billno='b0033582' billdtm='2012-05-21t22:57:02' tab_room=' ' waiter='sup ' pax='1' discount='.00000000' billdisamt='.00000000' /> i unable retrive data because of <z:row vs <row namespace details <xml xmlns:s='uuid:bdc6e3f0-6da3-11d1-a2a3-00aa00c14882' xmlns:dt='uuid:c2f41010-65b3-11d1-a29f-00aa00c14882' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#rowsetschema'> if change row can retrieve data, possible retrieve row information when row starts <z:row z: guess namespace reference given here xmlns:z='#rowsetschema' . please me way data out the answer quite simple, just make these small changes, add these @ top imports <xmlns:rs='urn:schemas-microsoft-com:rowset'> imports <xmln...

data structures - dictionary or map with either string or integer as key in python? -

this might silly question, reason solution escapes me @ moment. i have fast , efficient access data in list format. example list of questions: q = {} q[1] = "my first string" q[2] = "my second string" q[3] = "my third string" i can find question 2's string doing q[2]. retrieve question number indexing q string: q["my second string"] -> gives 2 answer i without iterating on keys (defeats purpose of dictionary) , avoid defining second dictionary using string key avoid wasted memory. possible? ultimately reason access q[2] or q["my second string"] , data associated question 2, whether using number or string key data. possible without having iterating on keys while avoiding data duplication? there's no problem having mixture of int , str keys >>> q = {} >>> q[1] = "my first string" >>> q[2] = "my second string" >>> q[3] = "my third string...

Unexpected behaviour when with HTML Table rowspan -

i creating dynamic table generator, , during testing, found following generated html gives unexpected layout in browsers (firefox, chrome, ie) <table> <tr> <td rowspan="2"></td> <td></td> </tr> <tr> <td rowspan="2"></td> </tr> <tr> <td></td> </tr> </table> i expecting 2x3 table, top corner merged left cell in middle row, , and middle row right cell merged bottom right cell instead ended 2x2 grid side note, if provided height on css or row/cell attribute; doesn't change layout of resulting table. p/s don't intend use layouts; idiot proof codes unintended effects weird layouts such this edit: expected: |------|-------| | | | | | | | |-------| | | | | | | |------| | | | | | | | |------|-------| result: |------|----...

issue in connecting to sqlserver using jtds driver in android? -

this code trying connect sqlserver 2000 using jtds1.2.5 driver getting class not found exception in android i have added driver build path still shows classnot found exception i added jtds jar file build path follows projrct->properties->java buildpath->add external jar->jtds.jar my code package com.sqlconnect.pack; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; import android.app.activity; import android.os.bundle; import android.util.log; import net.sourceforge.jtds.jdbc.driver; public class sqlconnectactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); log.i("android","sqlconnection"); connection con=null; try{ // class.forname("com.microsoft.jdbc.sqlserver....

objective c - RestKit weird error -

i have been , running restkit ios , feel great. but, have serious problem. trying use objectmapper in application. while test application single view controller works fine , able load data in array. but, try integrate existing application, crashes error ; *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring objectforkey:]: unrecognized selector sent instance 0x8b55e90' i have core data datamodel have not used mapping until. code in both test application , existing app same. annoying same code works fine single view controller while same things not work integration. appreciated ! "unrecognized selector sent instance" means trying call method on object no longer existent in memory. first need find out object by enabling zombies in xcode . then have make sure object persists long need it, e. g. make property of parent view controller.

javascript - JQuery - perform task on browser close event -

very simple question. need perform task when user closes browser. i'm aware of functions below: $(window).bind("beforeunload", function() { return false; }) $(window).unload(function() { return false; }) but both of these - bring alert asking user - "stay on page" - "leave page" (atleast on chrome). i dont want happen. want perform task when closes updating time on db when left. any ideas thanks this impossible done cross browser since opera not support :\ stated here: cross-browser onunload , onbeforeunload ? (particularly opera 11) , in many other documented places. also others mention there varying degrees of implementation, example firefox can add own message alert box shows on beforeunload in chrome cannot , show generic message of not make sense.

How to verify that, using regex, all characters in a string are digits? -

how can verify every character in string 0-9 digit? example: 1343151234234 valid 2342343abc34234 not valid. thank you. ^\d+$ using 'singleline' option (in c# regexoptions.singleline ).

ajax - Spinner on a window -

i have window has treeview nodes , sub-nodes. when copy subnode/node , try paste node, window tends unresponsive. , once paste completed, refreshes destination paste. functionality takes place below. now how can show spinner between copy , paste such window treeview becomes faded , displays spinner until paste completes. appreciated. $.ajax({ type: 'post', url: '/test.aspx', data: data, success: function(result) { refresh(id); if (result != "success") alert("copy failed"); else { alert("successfully copied"); } } }); $("#divprogress").html("<img src='yourimg.gif' alt='loading..' />").fadein(100,function(){ $.ajax({ type: 'post', url: '/test.aspx', data: data, success: function(result) { $("#divprogress").fadeout(300,function(){ refresh(id); // not s...

ios - plist array null although the plist does contain a string -

i have plist file copied docs dir main bundle. if file exists in docs doesn't copy on how should work. the problem have when initialise plist array either in appdelegate applicationdidfinishlaunching or rootviewcontrollers viewdidload or viewdidappear methods. now plist in mainbundle gets copied on docs dir has 1 item string the plist source contain string called gbp enclosed in array node correct. i initialise plist nsmutablearray this nsstring *rootpath2 = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *plistpath2 = [rootpath2 stringbyappendingpathcomponent:@"currency.plist"]; thecurrency = [[nsmutablearray alloc] initwithcontentsoffile:plistpath2]; and in viewdidload or viewwillappear check array with: nslog(@"array contains %@", thecurrency); how result null? assuming found file, plist ought dictionary. array in plist ought have name identify it, try like: nsdictionar...

jsf 2 - Using JPA2 in Tomcat 6: @PersitenceContext doesn't work, EntityManager is null -

i using jsf2 pure jpa2. problem entitymanager, @persistencecontext private entitymanager entitymanager; here entitymanager not getting injected , null. can 1 please me wrong in code. here configuration. user.java @entity @table(name="user") public class user { private int id; private string name; private string surname; @id @sequencegenerator(name="user_id_seq_gen", sequencename="user_id_gen_seq", allocationsize=1) @generatedvalue(strategy=generationtype.sequence, generator="user_id_seq_gen") @column(name="id", unique = true, nullable = false) public int getid() { return id; } public void setid(int id) { this.id = id; } @column(name="name", unique = true, nullable = false) public string getname() { return name; } public void setname(string na...

cryptography - Length of data to hash for PGP -

i have managed verify simple pgp signed message blocks. however, discovered reason, implementation limits me verifying data 9-16 bytes long. no less. no more. is there instruction somewhere ( rfc4880 or elsewhere) specifies how deal plaintext data of length? maybe there sort of padding missed? pkcs1? i pretty sure formatted data hash properly, since instructions in rfc 4880 sec 5.2.4 text documents, replace \n \r\n , add trailer. since test values single lines of data, nothing had replaced all of these values in base 10 unless otherwise noted: // dsa public key values p = 175466718616740411615640156350265486163809613514213656685227237159351776260193236923030228927905671867677337184318134702903960237546408302010360724274436019639502405323187799029742776686067449287558904042137172927936686590837020160292525250748155580652384740664931255981772117478967314777932252547256795892071 q = 809260232002608708872165272150356204306578772713 g = 127751900783328740354741342100721884490...

c++ - how to find the source of some macros -

there many places defining macro.when macro defined in our own project us,the easy find definition position them. when try learn famous open source project,i pestered question:where find source of macros,if can not it's definition,i won't understand of them (e.g. of them can guessed name). example,some statement apache: #if defined(__osf__) && defined(__alpha), #elif defined(__nsig) as knowledge,i know there possible originating place macro: from project itself,in source file(this easiest,because can find tool) from header file of 3rd lib ,we can grep it from c/c++ standard header file(where in linux?) from os (where in linux?) automatically generated configure tool(it bitter,i have no idea) from compiler tool gcc/g++,or in makefile can define macro i have question consult: how differentiate them between os defined , gcc/g++ defined , configure tool generated macros? have characteristic respectively? how find source of defined os or stand...

mysql - Rewrite manually created nested JSON to use PHPs built in functions -

i have in table records related 1 parentid field. when fetching them db need create json array of objects child records added 'children' property of parent objects : [{ //main object children : [ { //#1st level children object children: [ { //#2nd level children object } ] } ] }, { (...) ] but if there no records parentid equal current record, property shouldn't added object. right i'm building json string manually : //first parents $q = 'select * table parentid = 0'; $r = mysql_query($q); $x=1; $nr = mysql_num_rows($r); while($e = mysql_fetch_array($r)){ if($x==1){ echo '[ { '; } else{ echo ' { '; } if($e['leaf']==1){ $leaf = 'true'; } else { $leaf = 'false'; } ...

c# - Change the color of the selected page number in the gridview paging footer -

i have gridview , sqldatasource. gridview , paging numbers. when select number page in footer of gridview underline selected number . is there way of changing color of selected number ? thank you see pagination class assigned cssclass="pagination" <pagerstyle cssclass="pagination" horizontalalign="center" verticalalign="middle"/> .pagination .current { background: #26b; color: #fff; border: solid 1px #aae; }

objective c - Disable edit button from more tab bar application -

i using storyboard create tab bar has 6 tabs. tab bar initial view controller. not using custom class tabbarcontroller. more tab gets "edit" button. how can remove button? set customizableviewcontrollers of tabbarcontroller nil. tabbarcontroller.customizableviewcontrollers = nil;

removing a li by clicking another li using jquery and javascript -

i have problem in removing li clicking li present on page.. , removing li id present in localstorage variable.. here 2 divs present on same page. first li code <div data-role="page" id="wishlistpage" data-add-back-btn="true"> <div data-role="header" data-position="fixed"> <header id="mainheader" align="center"> <a href="#"><img src="images/logoname.png" /> </a> </header> </div> <div data-role="content" data-theme="a" id="wishproducts"> <ul id="wishlist" data-role="listview"></ul> </div> </div> li sets attributes values coming databse rs.rows.item(i).id $("#wishlist").append('<li id="'+rs.rows.item(i).id+'"...

Titanium Mobile - Creating Views on button click -

i new titanium. have 1 main window has 5 buttons vertically aligned. on click of each button creating new views. each view has child view well. example on click of button1 called view1. view1 has again 1 button, on click of other view gets opened. all views attached 1 main window. i want have view content in external js file. please let me know how that. thank monica mandal

java - How to avoid this NullPointerException -

i'm working on small arcade video game, , looking double buffer improve animation. have 1 class that's supposed draw blank image, , class that's supposed draw simple line. however, keep getting nullpointerexception on line line supposed drawn class render extends jpanel { public int dbwidth = 500, dbheight = 400; public image dbimage = null; public graphics dbg; public void gamerender() { if( dbimage == null ) dbimage = createimage( dbwidth, dbheight ); dbg = dbimage.getgraphics(); dbg.setcolor( color.white ); dbg.fillrect( 0, 0, dbwidth, dbheight ); } } class mc extends render { public render render = new render(); public void draw() { render.gamerender(); dbg.drawline( 100, 100, 200, 200 ); // line nullpointerexception occurs } } i suppose it's graphics variable dbg that's null, gets value of dbimage.getgraphics(); in gamerender(); how fix nullpointerexcept...

Using a RegEx to match IP addresses in Python -

i'm trying make test checking whether sys.argv input matches regex ip address... as simple test, have following... import re pat = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}") test = pat.match(hostip) if test: print "acceptable ip address" else: print "unacceptable ip address" however when pass random values it, returns "acceptable ip address" in cases, except when have "address" equivalent \d+ . you have modify regex in following way pat = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") that's because . wildcard stands "every character"

ruby on rails - RSpec reporting an error, but outputs are the same -

i specing videocontroller create action : it 'creates new video given valid parameters' video = { :title=>"example title", :description=>"description", :url=>"http://www.youtube.com/watch?v=b6spea_xhp4", :provider=>"youtube" } video.should_receive(:save).with("title"=>"example title", :description=>"description", :provider=>"youtube", :views=>0, :likes=>0, :provider_video_id=>'b6spea_xhp4', :thumb=>"http://img.youtube.com/vi/b6spea_xhp4/2.jpg") post :create, :video => video end i error : 1) videoscontroller post create creates new video given valid parameters failure/error: video.should_receive(:save).with("title"=>"example title", :description=>"description", :provider=>"youtube", :views=>0, :likes=>0, :provider_video_id=>'b6spea_xhp4', :thumb=>"http://img...

php - CakePHP rest API not working -

i've model "note" controller looks this- http://pastebin.com/tqvjm7uw when send request http://hostname/notes.json able see notes in json format. example- http://pastebin.com/haf6fq9s but when send request http://hostname/notes/4febea9d928488a443000000.json message- {"code":"404","url":"\/notes\/4febea9d928488a443000000.json","name":"action notescontroller::4febea9d928488a443000000() not found."} my route.php file looks this- cakeplugin::routes(); router::parseextensions(); router::parseextensions('json'); router::mapresources('notes');/** require cake . 'config' . ds . 'routes.php'; what wrong here? why rest requst index working fine not view? i using mongodb datasource cakephp, moment switched old mysql driver, started working fine. not sure wrong mongodb datasource.

php data difference giving fatal error -

i have 1 date value coming database , want calculate difference between today date , database date. the dates coming database is 2012-06-11 18:20:40 i use code see values echo date('y-m-d h:i:s'); echo $result['dt_pub_date']; i have written code $val=date('y-m-d h:i:s') ->diff($result['dt_pub_date']); but getting error fatal error: call member function diff() on non-object in..... thanks date() function don't return datetime object, return string. you need use datetime object. $now = new datetime(); $val = $now->diff(new datetime($result['dt_pub_date']));

android - why string.matches and pattern.matches get different results? -

// pattern 20xx/xx/xx, e.g. 2012/2/22 string regex_date_1 = "20\\d\\d/\\d{1,2}/\\d{1,2}"; string cell = "from 2011/7/31 2011/8/15 15:10-17:40,18:30-21:00"; system.out.println(cell); system.out.println("--- ---"); system.out.println( cell.matches(regex_date_1) ); system.out.println("--- b ---"); pattern p = pattern.compile(regex_date_1); matcher m = p.matcher(cell); while(m.find()){ system.out.println( m.group(0) ); } results: 2011/7/31 2011/8/15 15:10-17:40,18:30-21:00 --- --- false --- b --- 2011/7/31 2011/8/15 why string.matches return false? pattern.matches can matches? because string#matches return true "if, , if, string matches given regular expression". can check documentation here : string#matches however matcher#find return true " if, , if, subsequence of input sequence matches matcher's pattern". documentation available here : matcher#find . so sum - string#matches returns tru...

xampp - Python 2.7 Django/MySQL issue -

i using django python 2.7 on windows 7 , installed xampp , used phpmyadmin mysql included create database use in django, when went , used "python manage.py syncdb" command, got error: traceback (most recent call last): file "ifriends\manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 443, in execute_from _command_line utility.execute() file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 261, in fetch_comman d klass = load_command_class(app_name, subcommand) file "c:\python27\lib\site-packages\django\core\management\__init__.py", line 69, in load_command_ class module = import_module('%s.management.commands.%s' ...

Html5 audio can't play again after it stopped -

i declare audio file in page: var audio = new audio('my.mp3'); then use click event play it: $(document).click(function () { audio.currenttime = 0; // make sure play begain audio.play(); }) it can play @ first click time, after ended, click document, can not play again.how can let play again? i tested in chrome , exception occurs due audio.currenttime statement. this worked (also in ie9): $(document).click(function () { audio.src = "my.mp3"; audio.play(); })

java - Runnig spring via Daemon as Standalone -

i trying run spring via daemon service stand alone application ofcourse. i have configured run.sh script , added spring jars framework. now trying execute starting point class daemon classes way: code: public class feeddaemon implements daemon { public feeddaemon() { } protected final static logger log = loggerfactory.getlogger(feeddaemon.class); protected boolean shouldberunning = false; protected providerfactory runner = null; @override public void destroy() { runner = null; } @override public void init(daemoncontext arg0) throws exception { runner = new providerfactory(); } public void start() throws runtimeerror, configerror { log.info("starting daemon"); runner.start(); } public void stop() throws exception { log.info("starting shutting daemon ..."); runner.stop(); } } code: package com.spring.test; import org.apache.log4j.logger; import org.apache.log4j.propertyconfigurator; import org.springframework....

Android align contents of a table -

i'm struggling contents of table cell align left/right. code is: <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tablelayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <tablerow android:id="@+id/tablerow4" android:layout_weight="1" > <imagebutton android:id="@+id/button_one" android:layout_height="fill_parent" android:layout_weight="1" android:adjustviewbounds="true" android:background="@null" android:scaletype="fitcenter" android:src="@drawable/button_one" /> <imagebutton android:id="@+id/button_two" android:layout_height="fill_parent" android:layout_weight="1" android:adjustviewbounds="true" android:b...

performance - When does a slow MySQL query on a given connection affect other connections? -

i think have basic understanding of this, hoping can give me more details interested in learning more database performance. lets have large database, many millions of entries, database supports many connections. doing simple queries on database slow there's data. i'm trying understand when query on given connection starts have direct effect on performance of queries running on other connections. if 1 connection locks elements, understand that hold queries running other connections need elements . example doing: select update will lock selecting. what happens when simple like: select count(*) mytable lets have table billion rows running count going take time (running on innodb). affect queries running on other connections? what if select large amount of data using select , join, like: select * mytable1 join mytable2 on mytable1.id = mytable2.id; does having join lock other queries? i'm finding hard know queries have direct effect on performance ...

Get all calendars in Google Apps Scripts CalendarApp class -

so google apps scripts allow getcalendarbyid , getcalendarsbyname , getdefaultcalendar , works great when need target specific calendar. however, wondering if there's way me all calendars associated account? i've tried getcalendarsbyname() , getcalendarsbyname('') , getcalendarsbyname('*') , none of works. have tried getallcalendars() ? get calendars subscribed user

joomla - Virtuemart login page - missing info -

i running virtuemart 1.1.9 & joomla 1.5.25. when users click on register, prompted name, username, email, password, verify password. have change registration page similar this ?? my site ssgiorder.com . ahia, larryr..... from vm admin,you can configure custom fields, , whether or not appear, whether or not required.

perl - Deleting multiple labels in perforce -

i working on perforce-perl script creates labels. due repeated execution of script have created hundreds of labels of type label_a.180 etc. want know if there command or other way can delete multiple labels @ time? there no command or feature in p4v delete multiple labels. best approach write script finds labels , removes them one-by-one. i not know p4perl api i'm unable give example, very similar existing label creation additional -d flag passed p4 label command . hth,

php - How to Check if value exists in a MySQL database -

suppose have table: id | name | city ------------------ 1 | n1 | c1 2 | n2 | c2 3 | n3 | c3 4 | n4 | c4 i want check if value c7 exists under variable city or not. if answer 'yes' something. if answer 'no', else. preferred way, using mysqli extension: $mysqli = new mysqli(server, dbuser, dbpass, database); $result = $mysqli->query("select id mytable city = 'c7'"); if($result->num_rows == 0) { // row not found, stuff... } else { // other stuff... } $mysqli->close(); deprecated: $result = mysql_query("select id mytable city = 'c7'"); if(mysql_num_rows($result) == 0) { // row not found, stuff... } else { // other stuff... }

ios - way to create objective c program on another platform? -

possible duplicate: objective c windows iphone development on windows is there way build objective c or iphone program on windows 7 ? or other software same xcode. i not want deploy, want build , test learning purpose. i don't want install mac osx using vmware. you objective c compiler on windows, dont think able cocoa framework on it, able learn objective c language not cocao , cocoa touch some resources objective c windows http://www.roseindia.net/iphone/objectivec/objective-c-windows.shtml

java - Single mangedQuery to scan multiple folders for audio files -

i have arraylist containing folder name contains songs: private arraylist<string> searchabledir = new arraylist<string>(); searchabledir.add("/mnt/sdcard/tracks/u2/"); searchabledir.add("/mnt/sdcard/tracks/coldplay/"); now want run managed query fetch songs both these folders. i'm able fetch 1 folder @ time: string abc = "/mnt/sdcard/tracks/u2/"; cursor = managedquery(mediastore.audio.media.external_content_uri, projection, mediastore.audio.media.data + " \"" + abc + "%\"", null, mediastore.audio.media.title + " asc"); above query working like: select _id audio _data "/mnt/sdcard/tracks/u2/%"; but want make single managedquery fetch tracks folders in searchabledir arraylist. please suggest. thanks in advance. use following audio files available in sdcard : string[] star = { "*" }; uri allaudiosong = ...

java - how to get the coordinates of a transformed shape in javafx2? -

i have 2 ellipses on pane, 1 has rotation transformation applied (the rotation point not being ellipse :)), other doesn't. need draw line center of transformed ellipse center of untransformed ellipse. need coordinates of transformed ellipse, there way retrieve those? (i need them other calculations besides line drawing too) use localtoparent method. example: @override public void start(stage stage) { stage.settitle(versioninfo.getruntimeversion()); group root = new group(); // ellypsis center in 100,100 arc ellypsis = arcbuilder.create().centerx(100).centery(100).length(360).radiusx(100).radiusy(50).fill(color.transparent).stroke(color.red).build(); // rotate ellypsis.gettransforms().add(new rotate(50, 50, 45)); // find out 100,100 in rotated ellypsis point2d localtoparent = ellypsis.localtoparent(100,100); // draw line point line line = new line(localtoparent.getx(), localto...

node.js - Why are the Google Maps Marker and InfoWindow not centered? -

i make map code var map; var myoptions = { center: new google.maps.latlng(-31.403759,-64.174232), zoom: 12, pancontrol: true, zoomcontrol: true, maptypecontrol: true, scalecontrol: true, streetviewcontrol: true, overviewmapcontrol: true, maptypeid: google.maps.maptypeid.roadmap }; function iniciar() { map = new google.maps.map(document.getelementbyid("map"),myoptions); } function marcar(lat, lng) { var contentstring = '<div id="content">'+ '<div id="sitenotice">'+ '</div>'+ '<h1 id="firstheading" class="firstheading">uluru</h1>'+ '<div id="bodycontent">'+ '<p><b>uluru</b>, referred <b>ayers rock</b>, large ' + 'sandstone rock formation in southern part of '+ 'northern territory, central australia...

ios - I'm trying to get a UILabel to scroll inside of a UIScrollView but it doesnt scroll -

this in .m - (void)viewdidload { [super viewdidload]; [self.scrollview addsubview:self.contentview]; self.scrollview.contentsize = self.contentview.bounds.size; nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init]; nsmutablearray *arr = [[nsmutablearray alloc]init]; arr = [singleton getarray]; nsstring *str = [arr componentsjoinedbystring:@"\n"]; summarylabel.text = str; } this in .h @interface totalviewcontroller : uiviewcontroller { uiscrollview *scrollview; uiview *contentview; } @property (nonatomic, retain) iboutlet uiscrollview * scrollview; @property (nonatomic, retain) iboutlet uiview * contentview; @property (nonatomic,strong) iboutlet uilabel * summarylabel; my label connected view controller, contentview connected view controller, , summarylabel connected view controller. need label scroll , not. a simple answer, if want single scrollable label, use uitextview instead ( ref...

root - Android Rooted how to run ASL(Android screenshot library) without running service(run.bat) from PC? -

i wondering develop app having same functionality of asl(android screen shot library ).to run asl first need invoke service our adb . want avoid , instead of want keep asl-native file in mobile itself. want invoke service our app . how ?? note: trying on rooted mobile support alone. if device rooted, avoid use of asl make service can read framebuffer of device , make image(png or jpg) file it. @ code of asl , fb2png how read framebuffer , convert image. also ddmlib you, library used android ddms image capture functionality. edit: on rooted device process = runtime.getruntime().exec("su -c cat /dev/graphics/fb0"); inputstream = process.getinputstream(); and in manifest file give permission: read_framebuffer

android - Track Admob Event in the Google Analytics -

is possible track admob event user clicked on ads in google analytics . i use admob showing ads. want track every click on ads in google analytics . how can set event ? i found solution. implement admob interface adlistener activity . public interface adlistener { public void onreceivead(ad ad); public void onfailedtoreceivead(ad ad, adrequest.errorcode error); public void onpresentscreen(ad ad); public void ondismissscreen(ad ad); public void onleaveapplication(ad ad); } then set listener adview element. adview.setadlistener(this); and override onpresentscreen method tracking events if user clicks on ads. onpresentscreen - called when activity created in front of app, presenting user full-screen ad ui in response touching ad. private googleanalyticstracker tracker; ... @override public void onpresentscreen(ad arg0) { tracker.trackevent( "admob", // category "adview", // action ...

Import data from Excel file in Silverlight application -

i using vs2010, silverlight 5.0 i trying import data excel file grid, using 'openfiledialog'. user can input excel file using openfiledialog this openfiledialog dlg = new openfiledialog(); dlg.multiselect = false; dlg.filter = "excel sheet(*.xls)|*.xls|all files(*.*)|*.*"; bool bresult = (bool)dlg.showdialog(); if (!bresult) return ""; fileinfo info = dlg.file; statustext.text = info.name; stream s = info.openread(); streamreader reader = new streamreader(s); string xml = reader.readtoend(); var doc = xdocument.parse(xml); in case of microsoft excel format 2003 or 2007(.xls file) above code works fine , gives me values excel in string. but in case of microsoft excel format 2010(.xlsx file) reader.readtoend() not return values in proper format next line, give me following error. var doc = xdocument.parse(xml); 'data @ root level invalid. line 1, position 1' how can solve error, or best way import data excel?

MIME types missing in IIS 7 for ASP.NET - 404.17 -

when getting newly configured windows 7 box, noticed asp.net turned off default. classical asp. getting 404.17 error web application. think it's because don't have "aspx" mime type. although that's guess. when turned them on under control panel > programs , features > turn windows features on or off, , restarted windows 7 machine, mime types never showed up. can check mime type have *.aspx pages, , tell me configuration in edit mode? other mime types missing asp.net extensions (ie: ashx, asax, etc...)? best way configure them all? error summary http error 404.17 - not found requested content appears script , not served static file handler. ... module: staticfilemodule notification: executerequesthandler handler: staticfile error code: 0x80070032 requested url: ... physical path: ... logon method: ntlm logon user: {domain}\{windows login} ... causes: request matched wildcard mime map. request mapped static file handler. if there...