Posts

Showing posts from September, 2010

osx - Why is /usr/bin/arch not installed? -

my application has been depending on presence of /usr/bin/arch , , understanding part of standard mac os x installation. it's there if install snow leopard dvd, without installing developer tools. however, i've encountered 2 users 10.6.7 missing file. there normal way of getting mac os x omits arch ? or these users' installations happen broken? /usr/bin/arch part of com.apple.pkg.basesystem package, should present in every stock mac os x installation. running: $ pkgutil --file-info /usr/bin/arch will tell package installed /usr/bin/arch , , running: $ pkgutil --files com.apple.pkg.basesystem will tell contents of package. it might worth run latter in machines of users haven’t got arch .

linux - bash - automatically capture output of last executed command into a variable -

i'd able use result of last executed command in subsequent command. example, $ find . -name foo.txt ./home/user/some/directory/foo.txt now let's want able open file in editor, or delete it, or else it, e.g. mv <some-variable-that-contains-the-result> /some/new/location how can it? maybe using bash variable? update: to clarify, don't want assign things manually. i'm after built-in bash variables, e.g. ls /tmp cd $_ $_ holds last argument of previous command. want similar, output of last command. final update: seth's answer has worked quite well. couple of things bear in mind: don't forget touch /tmp/x when trying solution first time the result stored if last command's exit code successful this hacky solution, seems work of time. during testing, noted didn't work when getting ^c on command line, though did tweak bit behave bit better. this hack interactive mode hack only, , pretty confident not recommend a

c# - How do I obtain the client coordinates where a Panel (Canvas, stackpanel, etc) is located in a WPF app? -

i need programatically obtain client coordinates panel (stackpanel instance) located. when using windows api, button has topleft , bottomright coordinate determines location within window in resides. how obtain coordinates stackpanel in wpf window ? thank help, john. you can call transformtovisual() gets generaltransform relative other element can use container (frame/ window) generaltransform gt = stackpanel1.transformtovisual(parentwindow); point p = gt.transform(new point(0, 0));

jQuery Datepicker beforeShowDay works only after 1st click -

i'm having problem beforeshowday . when page loads, days i've told highlight not highlighted until click day in calendar. if click next-month button , come original month, 'selected' days highlighted expected. so, on initial draw of calendar dates not highlight have programmed them do. click in calendar fixes itself. am missing init option? please see code example below. test url in protected directory user/pass of test/test. @ mini-cal in right column bottom. switch next month , see problem. note highlighted days im may. also, note 'year' dropdown missing until click happens. http://www.urbanbands.com/dev/cgi-bin/links/eventmgr.cgi?do=list the code: <script> $(document).ready(function(){ // current date var today = new date(); var m = today.getmonth(), d = today.getdate(), y = today.getfullyear(); // need list of event dates month database. // declare 'dates' var before adding "beforeshowday" optio

eclipse - Flash Builder Export Release Build Fails -

i'm having issue when trying export release build of air application in flash builder 4.5. after choosing key sign package , clicking finish complete export, errors saying "error occurred while saving project settings: "default" build target cannot found selected project." i've included error message output log in .metadata folder. great baffling me. !entry com.adobe.flexbuilder.project 4 43 2011-05-10 15:56:11.432 !message failed build target settings: default !stack 0 java.lang.exception @ com.adobe.flexbuilder.project.internal.flexprojectcore.createerrorsta tus(flexprojectcore.java:1009) @ com.adobe.flexbuilder.util.logging.globallogimpl.log(globallogimpl.ja va:66) @ com.adobe.flexbuilder.util.logging.globallog.log(globallog.java:52) @ com.adobe.flexbuilder.project.ui.utils.projectbuildpackagingui.doappl ysettings(projectbuildpackagingui.java:754) @ com.adobe.flexbuilder.project.ui.utils.projectbuildpackagingui.applys ettings(projectbuildpackagin

Java: Can I use two different names in an enum to count as the same thing? -

i have enum class cardinal directions(north, east, south, west): public enum direction { north, east, south, west; } is there way able use multiple names same thing? example this: public enum direction { north or n, east or e, south or s, west or w; } in practice want able , sign variable either n or north , have 2 operations same. example: direction direction1=new direction.north; direction direction2=new direction.n; //direction1==direction2 public enum direction { north, east, south, west, ; // convenience names. public static final direction n = north; public static final direction e = east; public static final direction s = south; public static final direction w = west; } is legal, "n" not work auto-generated valueof method. i.e. direction.valueof("n") throw illegalargumentexception instead of returning direction.north . you cannot write case n: . have use full names in swit

json - Google Geocoding Result into MVC Controller -

i utilizing javascript api v3. geocoding address follows: geocoder.geocode({ 'address': address }, function (results, status) { //get results array here } this working successfully. need pass json mvc controller. have seen numerous ways this, cannot working geocode result. from haack : (i have collection on objects duplicate structure of result. @ outermost object being result[] (see below)). geocoder.geocode({ 'address': address }, function (results, status) { var jsont = json.stringify(results); $.ajax({ url: '/ctrl/action', type: "post", datatype: 'json', data: jsont, contenttype: "application/json; charset=utf-8", success: function (result) { alert(result.result); } }); } the controller method fires, value null . [httppost] public actionresult action(googlegeocoderesponse georesponse) { //georesponse

How to handle YouTube video events (started, finished, etc) in uiwebview iOS -

currently i'm using new iframe api embed youtube video inside uiwebview on ipad , i've been able make auto play without user interactions. in iframe api described how use onstatechange event in application doesn't seem work , unfortunately can't see debug in uiwebview. i want able able detect when video ends, have got advice on it? has got work? have tried (from documentation) assign integer event of movie ending?: onstatechange event fires whenever player's state changes. data property of event object api passes event listener function specify integer corresponds new player state. possible data values are: -1 (unstarted) 0 (ended) 1 (playing) 2 (paused) 3 (buffering) 5 (video cued). when player first loads video, broadcast unstarted (-1) event. when video cued , ready play, player broadcast video cued (5) event. in code, can specify integer values or can use 1 of following namespaced variables: yt.playerstate.ended yt

Embedded System USB to Android Device -

i writing android 2.1 application needs data usb device. usb device embedded system created. embedded system has no os. also, android device not send data embedded system. how should go this, i'm guessing need make high-level driver communicate usb application. but, have never made linux driver before. if creating high-level driver best way this, can give me references have somewhere start. if there other ways accomplish hear it -thanks the android open accessory development kit should start looking. many of other google's documents, tutorial reasonably complete , should provide starting point good luck!

heap - Why does malloc only work immediately after flashing cortex-m3? -

i'm trying dynamically allocate memory using newlib's malloc running on cortex-m3 (bare-metal) , i've run perplexing problem. after flashing device, malloc , free both work expected. however, once reset device malloc returns null. else works except malloc. hints on cause kind of behaviour? here linker script: memory { flash (rx) : origin = 0x00000000, length = 512k sram (rwx) : origin = 0x10000000, length = 32k } /* section definitions */ sections { .text : { keep(*(.isr_vector .isr_vector.*)) *(.text .text.*) *(.gnu.linkonce.t.*) *(.glue_7) *(.glue_7t) *(.gcc_except_table) *(.rodata .rodata*) *(.gnu.linkonce.r.*) _etext = .; } > flash __exidx_start = .; .arm.exidx : { *(.arm.exidx* .gnu.linkonce.armexidx.*) } > flash __exidx_end = .; /*.data : @ (_etext)*/ .data : @ (__exidx_end) { _data = .; *(vtable vtable.*) *(.data .data.*) *(.gnu.linkonce.d*) . = align(4); _edata

caching - How Do I Ensure IE 8 will Never Cache My Data -

i have following 2 pages: check-cookie.html, checks see if user has given cookie set-cookie.html, sets given user cookie in ie 8, following empty cache/cookie file: load check-cookie.html. 'no cookie' output, expected load set-cookie.html, sets user cookie load check-cookie.html. correct 'cookie present' output delete cookies , clear cache. reload check-cookie.html. still 'cookie present' output, though cookie/cache clear. close ie8 browser , reopen it, loading check-cookie.html. 'no cookie' output. this documented on microsoft site here: http://windows.microsoft.com/en-us/windows7/delete-webpage-history . essentially, though cache files have been cleared, of stored in memory need close browser clear cache fully. know how around ie limitation? fyi, using following no cache headers: cache-control: no-cache,no-store,must-revalidate,post-check=0,pre-check=0 pragma: no-cache your cookie session cookie , not persistent

scripting - Detecting conflict on git rebase -

i'm coding scripts execute git-rebase , need identify when conflict happened. git-rebase terminates same exit status every error, can't use exit status detect conflict. directory named rebase-apply created on conflicts, seems it's implementation detail cannot rely (e.g. in past directory had different name). is there reliable way detect git-rebase terminated conflict? well, i've realized can run git status --porcelain , check if there file "u" in status.

Android: What's wrong with my fragment transition animation? -

i need plain slide in , slide out animation fragment transition, below code: slide_in_left.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="true"> <translate android:fromxdelta="-100%" android:toxdelta="0%" android:fromydelta="0%" android:toydelta="0%" android:duration="700"> </translate> </set> slide_out_right.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <translate android:fromxdelta="0%" android:toxdelta="100%" android:fromydelta="0%" android:toydelta="0%" android:duration="700"> </translate> </set> the code used: somefrag

actionscript 3 - AS3 Custom Depth Control -

i trying create way of controlling movieclip depths, movieclip show above another, can set depth of movieclip number , displayed higher values above lower values. i thinking of creating movieclipdepth class extends movieclip added property depth, and container class extends displayobjectcontainer all objects placed inside of . the container class override addchild method update child display order when child added. what need how reorder children according depth value? as can read in comment below question, there several methods this. but actually, asked " set depth of movieclip number " can't done in as3. if i'm correct, in as2, so... ... how ... _root.createemptymovieclip("mc", -1000); or _root.createemptymovieclip("mc1", 1); _root.createemptymovieclip("mc2", 10); worked, not work in as3. in as3 depth starts 0 , can't force displayobject sit on level not continous zero. so depths' of

php - Random banner change and not displaying the first image whenever it complete the cycle -

actually have 10 banner , want change random when page refresh. banner change , complete cycle of 10 banners before repeating it.. i using code $banners=$objcms->getbanners(); for($count=0;$count<count($banners);$count++) { $image[$count]['path']= $banners[$count]['path']; $image[$count]['bid']= $banners[$count]['bid']; $image[$count]['bannerlink']=$banners[$count]['bannerlink']; $image[$count]['name']=$banners[$count]['banner_name']; $image[$count]['url']=$banners[$count]['bannerlink']; } $banneradtotals=count($image)-1; if($banneradtotals>0) { //mt_srand((double)microtime() * 1234567); $bannerpicked = mt_rand(0,$banneradtotals); } else { $bannerpicked = 0; } ?> ...................banner show here................. please me............ here example session: session_start(); // check last image loaded if (isset($_session['currentimage

visual studio 2008 - WTF happened to my toolbox? Mobile controls vanished :( -

man being developer great days make want become plumber :( for reason when opened "smart device" solution today , tried use forms designer mobile controls had vanished toolbox. in place normal winforms controls. i'm using visual studio 2008. i've tried starting new smart device project comes desktop controls. works fine if start new project targeting .net 2.0 if target 3.5 problem appears. doesn't make difference version of windows mobile choose. i've tried 5.0 , 6.0. after 7 hours of struggling i'm getting desperate (i'm on phone microsoft) appreciated. i've tried: - resetting toolbox - deleting hidden toolbox files (http://weimenglee.blogspot.com/2007/12/tip-missing-controls-in-toolbox-visual.html) - resetting vs using following command: "devenv.exe /setup /resetuserdata" - resetting using "cmd /c start /wait devenv /setup /resetuserdata /selfreg /resetskippkgs" - punching monitor thanks lot cheers mark

javascript - phonegap update file from external server -

hi have working phonegap application number of files (both .csv , .jpg) check updates on web server (say example.com/app) when pages loaded. if there new files overwrite files on phone app these updated files for example: when click to: page2.html, check updates on 2.csv , 2.jpg thanks in advice tim you should client side html5 storage. i'm using html5 sqllite database store json objects relating each page within app. have master configuration file in essence sitemap each app page, , timestamp, when check against webserver configuration file copy run comparison see if files out of date/even new , if download , store within client database. also take at https://github.com/brianleroux/lawnchair http://sixrevisions.com/web-development/html5-iphone-app/ hope helps regards andrew

JSF <h:selectManyCheckbox> check box editable issue -

i want make checkboxes non editable dynamically using <h:selectmanycheckbox> . have set editable="true" property in code. working inconsistently. please me in resolving issue. you need return false on onclick . <h:selectmanycheckbox onclick="return false;">

c# - Button click not working -

i have web application in multi language . in application have web page contains text box book name,and button update book name database. when text box contains dutch words button not getting clicked. it's working fine english words. dutch words like: grün und für gebäuden behagliche, angenehm warme oder kühle bedingungen. error message upon button click: i'm getting following exception on button :microsoft jscript runtime error: sys.webforms.pagerequestmanagerservererrorexception: unknown error occurred while processing request on server. status code returned server was: 500 try put autopostback property true. once have faced such type of situation, have made autopostback true , ran finally.

is there a shorter way to call a function from the sub-namespace in jQuery? -

i'm writing function inside : index.fragment.singleentry , expect call function of index.fragment.singleentry.edittitle . instead of writing complete namespace of function, there shorter way call it? i'm calling: index.fragment.singleentry.edittitle.load(); inside: index.fragment.singleentry.load thanks in advance. jquery.namespace("index.fragment.singleentry"); index.fragment.singleentry.load=function(vasid) { //================================================== // init gui components tinymce.init({ mode : "textareas", theme : "simple", width: "500", height: "300" //elements : "editcontentta" }); initeditcontrol(vasid); index.fragment.singleentry.edittitle.load(); updategui_content(); //=================================================== index.fragment.singleentry.load= (function(singleentry) { return function(vasid) { //================================================== //

mysql - Best way to simulate default value for TEXT column using Ruby on Rails? -

i'm using text column in mysql database. documentation says, not possible set default value these columns. i'm using following code simulate behavior: class data before_save lambda {text_column ||= ''} end is there better, more railis/active_record way this? if you're happy html5 solution, have tried :placeholder attribute on :text_field? also want stuff text_field (which captures small amount of text) "text" type column? did mean text_area? if want "default value" stored in database if user doesnt input suggest following. it's "factory" pattern. instead of calling "new" on activerecord model class, create "setup" method in model def self.setup(params = {}) new(params).tap |v| v.text_column = "default value" # other defaultings end end in controller instead of calling new on class call setup.

Displaying data from a mysql database from start date to end date using php where user provides the start and end date -

hi how display data mysql database start date end date using php codeigniter user provides start , end date through view page.. start , end date been fetched view page.... should able fetch values start date till end date mysql database.. .... i output... displays current date 2009-11-01 00:00:00 select * border dateordered='2009-11-01 00:00:00'2011-05-04no records found2010-11-01 00:00:00 gave start date 04-05-2011 , end date 05-05-2011 $sql = 'select * table order start_date asc'; $q = $this->db->query($sql); $results = ($q ? $q->result() : false); there go....

java - float array to byte array for displaying bitmap on canvas in android -

i have float array in java , want convert each element byte array counterpart display using android.graphics.bitmap , bitmapfactory, operation doesn't seem work words of wisdom appreciated. package com.bitmapdisplay; import android.app.activity; import android.os.bundle; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.canvas; import android.graphics.color; import android.view.view; import android.view.window; public class bitmapdiplay extends activity { /** called when activity first created. */ float[] array = {1, 6, 1, 4, 5, 0, 8, 7, 8, 6, 1,0, 5 ,6, 1,8}; float[] new_array= new float[array.length]; int[] int_array; byte[] byte_array; private static final int mask = 0xff; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); for(int k = 0;k<array.length;k++)

Deadlock issue in SQL Server -

i have 2 teams working in project, 1 extracting data table customer & products , other team trying view data tables. both of them performing operation simultaneously. causing deadlock. how solve issue? use read committed snapshot isolation if using sql server 2005 , above. way readers not block writers.

django - Product of two fields annotation -

i have line in django app this: db.execute("select sum(price * qty) inventory_orderline order_id = %s", [self.id]) i'd rather perform through models interface provided django, can't find references. i'm pretty sure can done annotation, examples cover few of them , can't find list in documentation. i'd this: self.line_items.annotate(lineprice=product('orderline__price', 'orderline__qty')).aggregate(sum('lineprice')) can suggest annotation class use perform multiplication? better, link api listing these annotation/aggregation classes? unfortunately, there aren't enough inbuilt aggregate functions , specifically, there not 1 product. but doesn't limit in way other having write "non-concise" orm query. case, should able do: self.line_items.extra(select=("lineprice": "orderline__price*orderline__qty")).aggregate(sum('lineprice'))

c# - How to store a collection of Dictionaries? -

i need create various number of dictionary<string, string> s in c#; how can so? i've tried using list<dictionary<string, string>> , doesn't work. see example: list<dictionary<string,string>> list = new list<dictionary<string,string>>(); dictionary<string,string> dict1 = new dictionary<string,string>(); list.add(dict1); list.add(new dictionary<string,string>());

iphone - Reusing detailed view controller in UISplitViewController -

basically when implement split view 1 presented in apple example 'multipledetailsviews', works fine, allocates new detailed view each time row selected. here relevant code example: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uiviewcontroller <substitutabledetailviewcontroller> *detailviewcontroller = nil; if (row == 0) { firstdetailviewcontroller *newdetailviewcontroller = [[firstdetailviewcontroller alloc] initwithnibname:@"firstdetailview" bundle:nil]; detailviewcontroller = newdetailviewcontroller; } // ... nsarray *viewcontrollers = [[nsarray alloc] initwithobjects:self.navigationcontroller, detailviewcontroller, nil]; splitviewcontroller.viewcontrollers = viewcontrollers; // ... } but i'm looking reusing detailed view controllers, lazily allocating view controller when selected, , keeping reference on in object. way when row selected view contro

.net - infinite loop example with minimum code in c# -

can give me infinite loop example on c# minimum code? came thought there more easier way. the typical examples , while loops. example for(;;) {} and while(true) {} however, looping construct without break or terminating condition loop infinitely. different developers have different opinions on style best. additionally, context may sway method choose. hth

.net - How do I copy the content of a dictionary to an new dictionary in C#? -

how can copy dictionary<string, string> new dictionary<string, string> not same object? assuming mean want them individual objects, , not references same object: dictionary<string, string> d = new dictionary<string, string>(); dictionary<string, string> d2 = new dictionary<string, string>(d); "so dont same object." ambiguity abound - if want them references same object: dictionary<string, string> d = new dictionary<string, string>(); dictionary<string, string> d2 = d; (changing either d or d2 after above affect both)

cdn - How do you disallow crawling on origin server and yet have the robots.txt propagate properly? -

i've come across rather unique issue. if deal scaling large sites , work company akamai, have origin servers akamai talks to. whatever serve akamai, propagate on cdn. but how handle robots.txt? don't want google crawl origin. can huge security issue. think denial of service attacks. but if serve robots.txt on origin "disallow", entire site uncrawlable! the solution can think of serve different robots.txt akamai , world. disallow world, allow akamai. hacky , prone many issues cringe thinking it. (of course, origin servers shouldn't viewable public, i'd venture practical reasons...) it seems issue protocol should handling better. or perhaps allow site-specific, hidden robots.txt in search engine's webmaster tools... thoughts? if want origins not public, use firewall / access control restrict access host other akamai - it's best way avoid mistakes , it's way stop bots & attackers scan public ip ranges looking webservers.

iphone - How do I register defaults in MonoTouch? -

i want register default values in nsuserdefaults user settings not return null values values not explicitly set user, rather return default values specified in settings bundle. read here: how register user defaults using nsuserdefaults without overwriting existing values? that following should executed in applicationdidfinishlaunching: [[nsuserdefaults standarduserdefaults] registerdefaults:[nsdictionary dictionarywithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"defaults" oftype:@"plist"]]]; how can done in monotouch? you try along lines of: nsuserdefaults.standarduserdefaults.registerdefaults(nsdictionary.fromfile("defaults.plist")); (assuming you've created defaults.plist file default values in! (and it's in root of bundle!))

android - Toast from FileObserver -

i have problem. i'm using fileobserver , moves new files watched directories another, former specified directory. in thoughts there should shown toast message says 'file xy has been moved', long observer watches directory, if applications in background. didn't working. tells me, there runtimeexception , , cannot been done without calling looper.prepare() . 05-11 13:21:28.484: warn/system.err(3397): java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare() i tried way using handler too, didn't work. has else idea? in advance. best regards, tobi obviously, fileobserver runs(or is) thread. can not modify ui non-ui thread. pass handler fileobserver , send messages it. read handlers .

java - Why textStyle italic is not applied in Android layout for other typefaces than serif? -

below simple xml snippet android:textstyle="italic" not applying. if remove android:textstyle="italic text appear. <textview android:text="row one" android:textsize="15pt" android:typeface="serif" android:textstyle="italic" android:textcolor="#00abcd" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"/> in above android:textstyle="italic" working android:typeface="serif" , if change typeface sans, monospace or normal android:text not displaying. why that? try making text italic through strings file alternative might you example <?xml version="1.0" encoding="utf-8"?> <resources> <string name="row_one"><i>row one</i></string> <string name="row_two"><i>row two</i>

jquery - Cloase iframe Colorbox with .Net submit button -

i have simple login form invoked colorbox link , opening in iframe. <script> $(document).ready(function () { $(".logincb").colorbox({iframe:true, innerwidth:240, innerheight:200}); }); </script> <li><a href="/login/login.aspx" class="logincb">login</a></li> the issue have having once user has correctly entered there login details in ifrmae, checked via post in code behind how can redirect parent page , close frame? with using .net buttons in form makes bit strange in end did include following function in page <script language="javascript" type="text/javascript"> function closepage() { parent.$.fn.colorbox.close(); parent.location = '/support/marketing-media.aspx'; } </script> then called in code behind button event using clientscript manager. if (!clientscript.isstartupscriptregistered("alert&

ruby - watir-webdriver checking table size rows and columns count -

i starting process of converting watir scripts use watir webdriver. there couple of table methods using in watir scripts check size (rows , columns) of html table. mytable.row_count mytable.column_count these methods don't exist in webdriver looking way of doing same check. for rows seems give same result row_count method mytable.rows.length for column count of table i've tried converting table array of strings , getting length of first row, conversion string array taking while. mycols = mytable.strings[0].length can suggest better/ quicker method of getting table size? assuming first row has correct number of cells: table.row.cells.length

layout - Overlapping Flare canvas in Flex, how to clip it to the container? -

i'm having serious issue when trying display flarecanvas within application. doesn't respect bounds ( see image here ) i've tried "clipcontent" , bunch of alternatives nothing seems prevent canvas of being "passing" on container. should do? taking me several weeks! in flex main.mxml: <flexvis:flarecanvas id="graph" width="800" height="600" verticalscrollpolicy="on" clipcontent="true" horizontalscrollpolicy="on" /> the full class flarecanvas fcacanvas extends in: https://github.com/prefuse/flare/blob/master/flare/src-flex-integration/flare/flex/vis/flarecanvas.as yeah, code used flarecanvas isn't best. if you, i'd wrap flarecanvas container clip contents solve problem.

Syntax hinting in Vim -

i've been using vim quite while now, , while code-completion (omni, dictionary, etc) works fine i've been missing 1 thing. syntax-hinting, i'd know arguments function accepts, rather online i'd have somewhere in vim, preferably in box above current line or something. is there way achieve this, work php, python , c++ need languages. edit: have ctags installed, tell didn't provide syntax-hinting, tried php standard functions, dunno if i've overlooked something. there's option of using snipmate , entering standard library functions, that's lot of work, would've imagined did (and yes there's ultisnips it's inferior snipmate) i think plugin echofunc that. when writing code, after press ( function prototype displayed in statusbar. check plugin srcexpl.vim think similar (i don't use though).

android - Get last location latitude and longitude -

this code. public class mylocationlistener implements locationlistener { @override public void onlocationchanged(location loc) { location location = getlastknownlocation(locationmanager.network_provider); lastlocationlat = location.getlatitude(); lastlocationlongi = location.getlongitude(); locationlat = loc.getlatitude(); locationlongi = loc.getlongitude(); if(loc.hasspeed()) { float myspeed = loc.getspeed(); toast.maketext(getapplicationcontext(), ""+myspeed, 2000).show(); } } @override public void onproviderdisabled(string provider) { toast.maketext(getapplicationcontext(), "gps disabled", toast.length_short).show(); } @override public void onproviderenabled(string provider) { toast.maketext(getapplicationcontext(), "gps enabled", toast.length_short).show(); } @override public void onstatuschanged(string

javascript - I need a function or something to change internet explorer settings before printing -

Image
is possible change internet explorer printing settings before printing? i want following options enabled function in background , printer dialog showing user click 'print' if not possible, there alternatives? can't done. can imagine havoc wreak if change browser's settings javascript? don't forget security , privacy settings reside well.

Download jars from nexus using ant build tool as done automatically in Maven -

i have build.xml(ant based) requires jar nexus copied in existing lib folder. i.e when builds should copy jar nexus version defined & copy in lib & compilation. happen in maven define artifact & version . if changed automatically download maven repo. how can in ant based builds? experts pls advice. i have taken example listed in thread 1 step further , created macrodef clean things bit re-use. see below downloading 2 artifacts nexus (one snapshot, 1 release). <project> <target name="get-all"> <mkdir dir="lib" /> <nexus-get groupid="foo.bar" artifactid="some-artifact" version="1.0.28" repo="releases" extension="jar" dest="lib" /> <nexus-get groupid="foo.bar" artifactid="another-artifact" version="1.0.0-snapshot" repo=&quo

sql server - returning to default LOCK_TIMEOUT -

after doing set lock_timeout in sql query possible return default timeout? or rather default timeout defined dba? the default -1 means "no timeout" to reset previous value may not default in connection, store value @@lock_timeout , change later. you'll need dynamic sql. however, it's reset when connection dropped per set lock_timeout at beginning of connection, setting has value of -1. after changed, new setting stays in effect remainder of connection. so, unless persist connection indefinitely don't need anything...

javascript - Input box key Up Check (Validation) -

my array var foo = {}; foo['xarr'] = [ "23" ]; foo['yarr'] = [ "21","21","22","23","24"]; foo['zarr']= [ "70","71","72","73","74","75" ]; input box takes maximum 4 character , have array object want when user enter first tow character , matches array want add class on div. if matches foo['xarr'] add diffrent class,when matches foo['yarr'] add diffrent class , on. my html markup: <li class="images"> <div> <input type="text" name="cnumber1" class="inputbx" style="width:58px;" maxlength="4" size="4"/> </div> <span class="test"></span> </li> java script i trying through way didnt success $('.inputbx').keydown(function() { var inputval

ruby on rails 3 - Carrierwave is not displaying file path in xml view - Is this normal? -

i've got app works carrierwave. can @product.image.url give me path url of stored image. however, when browse products#show (i.e. http://localhost:3000/products/1.xml ), displays correctly except image. in console, @product.image.url, returns: "https://bucket_name.s3.amazonaws.com/uploads/products/2/prod1.jpg" the image displays name , extension. not path. normal? for example, xml looks like: product> <attachment>prod1.jpg</attachment> <cached-slug>adsfsadf</cached-slug> <category-id type="integer">1</category-id> <company-id type="integer">1</company-id> <created-at type="datetime">2011-05-10t05:10:35z</created-at> <description>description here</description> ... yep, think carrierwave generating url dynamically (within method), can change or override way computed. format.xml { render :xml => @product.to_xml(:include =>

delphi - How to draw transparent image on a form? -

Image
i want draw transparent image on delphi form, not working. here original png: i have loaded image in timage:: image1.transparent := true; form1.color := clwhite; form1.transparentcolor := true; form1.transparentcolorvalue := clwhite; the application: image isnt transparent. image can drawed control or canvas. use bmp images. maybe doing wrong? please help! i found solution let draw bmp image alpha channel onto form using windows api: const ac_src_over = 0; ac_src_alpha = 1; type blendfunction = packed record blendop, blendflags, sourceconstantalpha, alphaformat: byte; end; function winalphablend(hdcdest: hdc; xorigindest, yorigindest, wdest, hdest: integer; hdcsrc: hdc; xoriginsrc, yoriginsrc, wsrc, hsrc: integer; ftn: blendfunction): longbool; stdcall; external 'msimg32.dll' name 'alphablend'; procedure tform4.formclick(sender: tobject); var hbm: hbitmap; bm: bitmap; bf: blendfunction; dc: hdc; begi

php - Separate base class(template) and derive classes (data).? -

general require('fpdf.php'); $pdf=new fpdf(); $pdf->addpage(); $pdf->setfont('arial','b',16); $pdf->cell(40,10,'hello world!'); $pdf->output(); i want separate 2 class (base , child(child data) ) base class (present template of output ) require('fpdf.php'); class base{ //todo function def(){ $pdf=new fpdf(); $pdf->addpage(); // page header in here // ->do in derived class(leave derived data ) // page footer in here $pdf->output(); } } child class (manipulate data ) class child extends base{ //todo function def(){ $pdf->cell(40,10,'hello world!'); } } when call use child class out pdf file $obj_pdf = new child(); $obj_pdf->def(); how should implement it? or not possible this? what want accomplish here wrapper pattern. don't know if right solution problem. inheritance meant add complexity in child classes,

jquery - javascript check if image exists iOS app -

i building simple app ipad. easier, decided go html , little bit of javascript, have hit wall. how can check in javascript if image (local image) exists? this might useful http://www.irt.org/script/52.htm

c# socket: get server when client connects -

i have server socket using async functions allow client socket connect. , when call socket.endaccept() returns copy of client socket, i'd way client socket connecting copy of server socket is possible? edit: question rather forumlated weird, sorry, found solution problem though. the problem when tried send reply client used server socket instead of socket returned socket.endaccept() thank you ehh? used when calling socket.endaccept() ? socket server socket.

deployment - How to get value of checkbox added in vsfolderdialog.wiz file -

i have added checkbox in vsfolderdialog.wiz file customizing folder path dialog in setup , deplopyment project. have not idea how value on have take decisions. note: using custom installer action accessing value , tried installer.context.parameters on install event please me in regard. regards, jhan zaib checkbox control in windows installer associated property. when checkbox selected, associated property have value defined; when it's cleared, property set null.

jquery tabs in ajax mode change source -

i trying change source of particular jquery tab (ajax mode) created. have 5 tabs when user clicks on second tab after 50 seconds source url of iframe needs change (only once). i know need use select code below determine when user clicked on tab not know start. thank help. code appreciated. select: function(event, ui) <div id="example"> <ul> <li><a href="ahah_1.html"><span>content 1</span></a></li> <li><a href="ahah_2.html"><span>content 2</span></a></li> <li><a href="ahah_3.html"><span>content 3</span></a></li> </ul> </div> here's how i've done this. change url using built in function. changing url in "a" tag won't anything, because link changes when bound tab layout.: $("#tabdiv").tabs("url", tabindex, newlink);

black box - Stabilizing a fragile web application by proxy -

i'm having unstable dynamic web application want stabilize running in settings: given request url u look u in cache - if it's there - fetch cache if it's not, generate cache web application. administrator able access web application directly. whenever access webpage - generated web page used update cache. this way, know sure if web application down, of pages still accessible. , easy administrator update cache (whenever edits there - it'll updated automatically, since he'll access page afterwards). is there generic cache similar behavior? better ideas stabilizing existing web application without changing source code?

How can I workaround this CSS anomaly? -

Image
i have think pretty basic css, , behaves differently in ff4 , ie8. the css in question this: div.showme { border: 1px dotted blue; position: absolute; top :10px; bottom :10px; left: 1%; right: 33%; overflow: auto; padding: 0.8em 1em 0.8em 1em; line-height:1.75em; } div.showme { padding: 0em 5px 0em 5px; margin: 0; white-space: nowrap; color: #ff00ff; background-color:#e6e6fa; border: 1px solid grey; padding: 0em 4px 0em 4px; } div.showme a:link { color: blue; } div.showme a:visited { color: #1e90ff; } div.showme a:active { color: red; } the relevant html looks this: <div class='showme'> <a href='one'>one</a> <a href='two'>two</a> ... </div> the problem is, padding not consistently displayed, in ie8. in firefox, works expect. working example: http://jsbin.com/ogosa4 using above working demons

Twitpic Upload API -

just wondering if there rate limits when comes uploading images twitpic api. find on odd occasion image doesn't upload. have experience similar problem or how might go fixing it. should have mentioned images around 200kb or less. there 10mb image upload limit: we take gif, jpg, & png images 10mb in size, , videos 1:30 in length in formats. source: http://twitpic.com/upload it api having issues, if that's case need pass error user know happened.

Working with tags in Tkinter text widget using python -

i'm trying color text in tkinter text widget of tags in way: text = self.text_field.get(1.0, 'end') #text_field text widget s = re.findall("\d+", text) in s: self.text_field.tag_add(i, '1.0', 'end') self.text_field.tag_configure(i, background='yellow', font='helvetica 14 bold', relief='raised') the idea tags being dynamically created, because numbers text widget , can have length. code colors text in widget, need numbers colored. any suggestions? when do tag_add(i, '1.0', 'end') you're making tag covers whole text field. need add text on numbers, using .start() , .stop() methods of regex match. there's example doing syntax highlighting here: http://forums.devshed.com/python-programming-11/syntax-highlighting-172406.html

PHP - REGEX - Match Length -

i have regex : ^((?:(?:\s*[a-za-z0-9]+)*)?)\s*function\s+([_a-za-z0-9]+)\s+\(\s*(.*)\s*\)\s* to match string : public function private ($var,type $typed, $optional = 'option'); it works, when comes match 1 : public function privatex ($var,type $typed, $optional = 'option'); it fails. i noticed when length of function's name exceeds 6 chars, not match anymore. here full code : $stra = 'public function 6chars ($var,type $typed, $optional = "option");'; $strb = 'public function morethan7 ($var,type $typed, $optional = "option");'; preg_match('!^((?:(?:\s*[a-za-z0-9]+)*)?)\s*function\s+([_a-za-z0-9]+)\s+\(\s*(.*)\s*\)\s*!',$stra,$ma); preg_match('!^((?:(?:\s*[a-za-z0-9]+)*)?)\s*function\s+([_a-za-z0-9]+)\s+\(\s*(.*)\s*\)\s*!',$strb,$mb); print_r($ma); print_r($mb); my question pretty simple : why second string not match ? i can't reproduce in regexbuddy; both declarations match. h

jquery iframe src loading delay -

i have jquery modal on page[parent aspx]. div opens has iframe in it. set source on modal open function aspx page values parent aspx. now other aspx page takes time display formatted results external datasource. hence modal window opens , user has wait before content loaded. is possible display label wait or working or anyother gif till aspx page returns values. edited add:- function opendialog() { var url = "result.aspx?name=" + encodeuricomponent($("#<%=txtcity.clientid %>").val()) + "&type= " + encodeuricomponent($("#<%=txttype.clientid %>").val()) ; $("#popup").attr("src", url); $("#carmodal").dialog('open'); } } my div below: <div id="carmodal" > <iframe id ="popup" width ="100%" height="100%"></iframe> <

html - How to get a table to overlap an image? -

Image
here small snippet of html: <img src="http://hss.fullerton.edu/philosophy/red%20square.gif" id="test1" /> <table id="test2"> <tr><td>test</td></tr> </table> i have image of red square , want table overlap bottom of it. here css: #test1 { width: 42px; height: 42px; display: block; margin-left: auto; margin-right: auto; margin-bottom: -15px; } #test2 { z-index: 1; background-color: pink; width: 80px; height: 50px; margin-left: auto; margin-right: auto; } it isn't working, however: as can see, image still on top of table - not want. notice in css i've explicitly set table's z-index 1 , still won't overlap image. doing wrong? jsfiddle: http://jsfiddle.net/george_edison/uk7pz/ try positioning each element. add position:relative each element, demonstrated here: http://jsfiddle.net/8ngkk/1/

android - Best Way to Store Previously Entered User Input in EditText? -

what best way store entered user input edittext , have edittext suggest user when begin type next time use application? my original idea use autocompletetextview store user inputed data array (maybe using sharedpreferences?). upon application reload, pull string array , available suggest entered input user. sharedpreferences can't store arrays, best way go doing this? i can't seem find question posted elsewhere. thoughts? you can store arrays in shared preferences. truth told, can store objects in them ;) i store data in comma delimited string out this: string [] tth_array = textutils.split(appprefs.gettransmissiontimehistory(), ",");

Yahoo Pipe: How to parse sub DIVs -

for page has multiple divs, how fetch content divs contain useful text , avoid other divs ads, etc. for example, page structure this: ... <div id="articlecopy"> <div class="advertising 1">ads not want fetch.</div> <p>useful texts go here</p> <div class="advertising 2">ads not want fetch.</div> <div class="related_articles_list">i not want read related articles parse part too</div> </div> ... in fictional example, want rid of 2 divs advertising , div related articles. want fetch useful content in inside parent div. can pipe this? thank you. try yql module xpath. along these lines: select * html url="http://mywebpagewithads.com" , xpath='//div/p' the above query retrieve part of html inside <p> tag under parent <div> tag. can fancy xpath if divs have attributes. say example had page several divs, 1 wanted looked

Jquery AJAX (json) cross domain request and ASP.NET MVC -

seemed me beaten theme, couldn't find answer. =( make jquery ajax requst localhost:666 localhost:555 application $.ajax({ url: "http://localhost:666/request", datatype: 'json', timeout: 5000, success:... i've got in chrome: xmlhttprequest cannot load http://localhost:666/request . origin http://localhost:555 not allowed access-control-allow-origin. what solution of problem? you can initiate cross-domain request in webpage creating either xmlhttprequest object or xdomainrequest object. end user's web-browser request data domain's server sending " origin " header value of origin. if server responds " access-control-allow-origin: * | origin " permitted access data; otherwise response unauthorized request. protected void application_beginrequest(object sender, eventargs e) { httpcontext.current.response.addheader("access-control-allow-origin"

Change the sharepoint icon for a site programmatically -

i needing change site icon every site in site collection in sharepoint 2007. know can change site settings -> , feel. there way programmatically? do mean site logo? check out spweb.sitelogourl property . want set as: site.rootweb.sitelogourl = pictureurl;

sql - Validation stored procedure for Replication -

does know of correct stored procedure validates actual code in transactional replication? have view select * table1. changed view select * table2 in publisher , there error in replication monitor (as there should be) when run sp "sp_publication_validation" validates. sp_publication_validation row count and/or checksum check @ publisher , subscriber , compares 2 results. if compare same, article considered "good" , if not, it's considered "bad". now, how view fit replication setup? have view published article? if so, value schema_option in sysarticles (at publisher)? also, error getting in replication monitor?

c++ - Passing an array of objects, the count of objects and a desired term to a function -

i've run trouble in programming book while completing exercise bankaccounts. question asks: create main() function declares array of 10 bankaccount objects. after first bankaccount object entered, ask user if or wants continue. prompt user bankaccount values until user wants quit or enters 10 bankaccount objects, whichever comes first. each bankaccount entered, display bankaccount details. prompt user term value between 1 , 40 inclusive. continue prompt user until valid value entered. then pass array of bankaccount objects, count of valid objects in array, , desired term function calculates , displays values of each of bankaccounts after given number of years @ standard interest rate. i have use 3 public functions complete task. start running problems when try computeinterest(). if attempt pass term , count function , set in 2 loops receive numbers , balances single object. guess i'm asking is: how program call computeinterest , run through each bankaccount object? a