Posts

Showing posts from July, 2012

html - outlook 2007 not displaying image button in email -

i creating html email uses image buttons <input type="image" src="images/right_nav1.bmp" width="200" height="37" name="right_nav1" style="border:0; padding:0; margin:0; display:block;" /> <input type="image" src="images/right_nav2.bmp" width="200" height="37" name="right_nav2" style="border:0; padding:0; margin:0; display:block;" /> <input type="image" src="images/right_nav3.bmp" width="200" height="37" name="right_nav3" style="border:0; padding:0; margin:0; display:block;" /> <input type="image" src="images/right_nav4.bmp" width="200" height="37" name="right_nav4" style="border:0; padding:0; margin:0; display:block;" /> the images not getting

c# - how do i return a count of match items -

i have sorted generic list. return first 10 match condition. sort of method below first 10 items mysortedlist.findall(delegate(myclass tmp){ return tmp.id == 123;}); something following: int count = 0; mysortedlist.findall(delegate(myclass tmp){ return (tmp.id == 123 && ++count <= 10);});

java - programmatically querying LDAP permissions -

is there way programmatically query openldap 2.4 server find out attributes of object user allowed modify? or way tell server ignore modifications current user doesn't have permission make, instead of rejecting whole request? i'm looking way can avoid hard-coding users should see fields editable in ldap management webapp. please check if this helps. in example, trying change acl's specific object. might able re-use same/similar code.

getLastKnownLocation() Android, when the Last Known Location is updated? -

getbestknownlocation returns location indicating data last known location fix obtained given provider. can done without starting provider. note location out-of-date, example if device turned off , moved location. when last known location updated in android? updated if when there's application listening location provider, if if there's no application ask location , asked lastknownlocation() ? please see start location strategy i did investigations: turned on gps , waited fix. turned gps off , drove 50km (31 miles). used code deep dive location getlastknownlocation. tried twice, first gps turned off , second gps turned on, without fix: 1) gps turned off got - provider: network, correct location accuracy 680m - provider: passive (mprovider=network), same location above, same time above - provider: gps, location null so learned when gps turned off no getlastknownlocation gps location provider. 2) gps turned on got - provider: network, correct location acc

Android: Usb storage location in 3.0? -

my app provides file browser. set root of file browser to: environment.getexternalstoragedirectory() ; which, on acer iconia tab, returns "/mnt/sdcard". however, many 3.0 devices support usb storage. there safe/proper way path "/mnt"? (to directory contains sdcard , usb storage) if environment.getexternalstoragedirectory(); gives /mnt/sdcard/ , hoping there safe method /mnt/usb_storage . there not appear be. however, environment.getexternalstoragedirectory().getparentfile() appears reliable give parent directory of /mnt/usb_storage .

Blackberry OS 6 Toolbar PushScreen and PopScreen -

i asked question before on how create toolbar, have created toolbar, , push on next screen, not sure how can remove last screen, know can use popscreen. stuck @ popping screen off in tab bar, because not know last screen may be, since can click of tabs @ top. can provide me code samples on app using tab bar adds new screen , removes last screen? typically, want leave screens on stack, when user done whatever activity have selected, toolbar screen shown again. if know want pop current screen, can via uiapplication.getactivescreen() returns topmost screen in stack.

cakephp - parse the part of url and send to function -

i have controller called customers , function called products. have link http://mysite.com/customers/products/ {customernumber}/imagefile.png i want have function imagefile.png once customer put link in browser on site. howd cakephp your action called products needs 2 arguments deal that: function products($customernumber, $image) { //here can access these variables , use them further processing } i hope problem in case, please comment if need on "getting image" case.

objective c - GCC 4.2 warning for object that no longer exsists -

i had nsstring named responsereference put in @property so... @property (nonatomic) nsstring *responsereference; and got warning: no 'assign', 'retain', or 'copy' attribute specified - 'assign' assumed assign attribute (default) not appropriate non-gc object property 'responsereference' so fix changed code this: @property (nonatomic, retain) nsstring *responsereference; but still got warnings. tried many things , ended trying remove warnings removing object existence. when responsereference no longer part of of code still gave me exact same warning responsereference. restarted x-code. no beans. can explain why it's giving me these warnings though object it's talking doesn't exist? also, these warnings mean compiled code affected?

java - Help on a simple Android ListView problem -

i new android, may seem basic question. got simple class called singleitem, has integer , string , getter , setter each. in application, got arraylist holds collection of singleitem objects. have layout listview widget. what trying populate listview string value in singleitem, when user selects item listview, need integer id singleitem value. how do in android development? if using own adapter populate list in getview() function when building view return can call settag() on view returning , store entire "singleitem" object. in onclicklistener of views return can retrieve info using gettag() method of view has been clicked. edit: specified onclicklistener referring to

php - Kohana 3 - redirect to 404 page -

after searching internet haven't found answer question. example, in base complectation if go http://yoursite/welcome/ you'll see hello world if type http://yoursite/welc om / you'll see fatal error: uncaught http_exception_404 [ 404 ]: requested url welcom/index not found on server. ~ syspath/classes/kohana/request/client/internal.php [ 94 ] thrown in from here, how can redirect user 404 page if type wrong address? kohana 3.1.3.1 here how it: declare our own exception handler somewhere in bootstrap.php or module's init.php. application exceptions sent kw_exception_handler::handle() . exception handler analyses exception type (using getcode() method) , creates new hmvc request special error controller , example ('error/404'). also can add check ajax calls , return json structure error text. ps. this userguide tutorial may helpful.

sql - MySQL - "Most social User" with the most comments in multiple tables -

i have 2 tables of concern - 'videocomments', 'storycomments'. i need find 'posterid' has entries in videocomments , storycomments . here's code have far, calls videocomments : $sql = "select (select posterid videocomments group posterid order count(posterid) desc limit 1) ) mostsocialuser "; how pull , compare count of posterid both tables? use: select x.posterid, count(y.posterid) + count(z.posterid) numcomments (select vc.posterid videocomments vc union select sc.posterid storycomments sc) x left join videocomments y on y.posterid = x.posterid left join storycomments z on z.posterid = x.posterid group x.posterid order numcomments desc limit 1

CURL + SSIS filedownload errors -

i wrote ms ssis package download set of xml files given url. ssis package uses curl download these xml files execute process task. reading curl argument sql table. checked curl commands manually in shell , tehy work fine. i passing curl argument in variable task reading sql table. downloads files fails on file. when take exact same curl command , run manually in shell, downloads file. when rerun package, execution fails @ other file , processes failed file successfully. error: 0xc0029151 @ curl, execute process task: in executing "c:\curl\curl.exe" "-o somefilename.xml "url"" @ "", process exit code "56" while expected "0". if have suggestions, please let me know. thank you, nagu curl error 56 curle_recv_error, failure in receiving network data. occurs due network problem of sort, , fact works next time try shows it's transient problem. perhaps doing many requests @ once, causing server overloaded ,

android - Pass a String to setContentView? -

is there way pass string 'setcontentview()'? ie: setcontentview(output). reason have class use several activities (a custom listview adapter) , need use different layout 1 activity , not have duplicate class change setcontentview(). know xml needs compiled in apk thinking inflation of layout not need in oncreate...? so, can done using variable? or have idea/way of doing this? thnx. *the class using here in 'revised' code section. when starting calling activity give extras. in activity, test extras , call appropriate setcontentview.

c# - Append Data to Byte Array -

currently, reading data binary file (file.readallbytes), converting byte array string , appending data onto string. lastly, converting string byte array , writing data new file. yeah - method idiotic, , i've been curious whether or not there way append new data onto end of byte array (in form of byte). string s = @"c:\file.exe"; byte b[] = file.readallbytes(s); string newstring = converttostring(b[]); newstring = newstring + "some data"; b[] = converttobytearray(newstring); file.writeallbytes(b[]); // converttobytearray , converttostring represent functions converts string > byte > string. what do: b[] = file.readallbytes(s) b = b + "new data" file.writeallbytes(b[]) thank insight on matter. you should used working streams - in case use memorystream achieve exact same thing without nasty arrays. byte[] bytes = file.readallbytes(infilepath); using (memorystream ms = new memorystream()) { // use streamwriter &quo

c# - Can I make this TimerQueueTimer class any more performant? -

using system; using system.threading; internal class timerqueuetimer : idisposable { public timerqueuetimer(int interval, int msbeforefirstcall) { this.interval = interval; this.msbeforefirstcall = msbeforefirstcall; this.callback = this.ticked; this.isthefirsttick = true; this.isstopped = true; } public event eventhandler ticked; public void start() { if (!this.isstopped) { return; } this.isthefirsttick = true; this.isstopped = false; computer.changetimerresolutionto(1); nativemethods.createtimerqueuetimer( out this.handle, intptr.zero, this.callback, intptr.zero, (uint)this.msbeforefirstcall, (uint)this.interval, callbackexecution.executeintimerthread); } public void stop() { if (this.isstopped) { return; }

jQuery: working within iframe without re-linking -

maybe title little misleading , question too, i'm curious, how 1 work jquery internal (same host/domain) iframe without re-linking jquery's source in iframe's loaded html. well, i'm able access parent.jquery(); , whenever i'm trying manipulate elements it, works in parent frame not current, active one. iframe generated colorbox v.1.3.16 . here i've tried far, no luck @ all.. (this comes within iframe): jquery = parent.jquery; jquery(document).ready(function(){ jquery('#time-bar .slider', document).css({ 'background-color' : 'blue', 'left' : '-99%' }); }); i've used document parent selector here, doesn't work, , have no idea should used there. thanks in advance! edit: derived t.j. crowder: parent.jquery(function($) { var element = $("#time-bar", document); console.log(element); }); console.log() returns empty object, or actually, have no idea if can called object: []

database - In Android can I do a sql query on a cursor? -

i might have more 1 filter being chosen on database, query database cursor, query on cursor return one. you can't query on cursor. cursor result of query. not source of query. need new query same place got original cursor, new arguments specify new data set want.

swing - Java Glass pane -

i have problem. want ask how can implement glasspane paint on it. i mean, if click mouse button, in mouseclicked event, transparent glass pane should created, because want see components behind glasspane , can paint on using mousedragged event. when release mouse button glasspane disappears. i have question too. when paint on glass pane components behind them refreshing , repainting? maybe have nice example glass pane might me. how create translucent , shaped windows

deployment - How to precompile ASP.NET web application from TeamCity? -

i have question precompiling asp.net web application projects teamcity. sort of follow-up question following thread: how deploy after build teamcity? i'm done implementing ci unit testing autodeploy using above thread , i'd complement process precompiling project. project rather large , want avoid unnecessary delays in response time after new deploy. so, there way teamcity? calling msbuild specific arguments? sure, can done custom msbuild script. here's 1 run precompile our asp.net mvc 3 website (not varies asp.net version). first runs regular build running msbuild against solution file, runs custom msbuild code: <?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <import project="$(msbuildtoolspath)\microsoft.csharp.targets" /> <import project="$(msbuildextensions

link with same url in php -

i have thumbnail images larger version.i placed thumbnail images in page.now link gave link <a href="image/largerimage1.jpg"><img src="thumbnail1.jpg></a> but have make different pages showing larger one.i want give link show them in single page.means whenever click thumbnail open larger 1 in page same url name like imagegallery.php?news=images/largerimage1/13.jpg imagegallery.php?news=images/largerimage1/14.jpg so how that? pretty basic stuff, suggest read php tutorials on internet knowledge on 1 thing , another. the ?news= part in url parameter can read php. type known $_get . part need $_get['news'] if we'd use first link , place inside script: echo $_get['news']; page images/largerimages1/13.jpg . in order image loaded on website need simple steps, i'm changing news parameter image , suits better script since ain't news items: <?php // define path (used see if image exists) $path = 'y

magento - 'FORM_KEY is not defined' throws error when checkout process as guest or register -

i'm having issue on checkout page not working when login guest or register works fine on normal login. throws error, "form_key not defined [break on error] this.options.parameters.form_key = form_key; " when checkout process guest or register. anyone got idea? in advance. usually if checkout page throwing error , not letting checkout due user modification of checkout template files. them , replace them base or default files , see if can checkout. bet can , need add in changes 1 one until find out breaks. can fix code.

How to make a limit points by month in Rails? -

in new rails project,i want limit user's post number point.at begining of every month,every user given limited points.when user use points,they can't thing. my question is,how give user points @ begining of every month automatically in rails?how design model , controller? thank you. i think should use whenever schedule tasks. here ' monthly jobs syntax question ' whenever mailing list. in general have like: # shedule.rb every 1.month, :at => "beginning of month @ 3am" runner "user.set_points" # or rake "task:for:user:set_poins" if have rake task end # user.rb def self.set_points user.all.each{|u| u.update_attribute(:points, some_function_to_calculate_points(u)} end i hope helps.

c# - Sending a class as a parameter to a thread? -

so trying find way dynamically pass class type thread, can recall class issued by, , thereby dynamically return data class again. here trying, serverclass class of main function: public static void main() { udpclass clsudp = new udpclass(); thread clsudpthread = new thread(new threadstart(delegate() { clsudp.udplisten(64000, serverclass); })); clsudpthread.start(); } this receiving end, in udpclass: public void udplisten(int udpport, type oldclass) { } you can lot code this. class x : baseclass { ... } class y : x { int yfield; } ... int main(baseclass instance) { if (instance y) (instance y).yfield = 1; }

Azure and In Proc Session -

i have site (asp.net 4.0 c#) hosted on azure server multiple instances. session state mode "inproc". somehow not working on azure instances, doesn't maintain state properly. please advice. regards vivek if have multiple instances , using inproc session, session data not work - won't shared across instances. azure load balances http requests , may send each client http request different server instance. if want use session state, need use shared session state provider, such as: the sql session state provider (although believe has limitations on sql azure cannot use sqlagent code periodically clear state) the demonstration azure table session state provider (not officially supported , reported buggy) the latest appfabric session state provider (currently recommended ms) - see http://appfabricdemos.codeplex.com/releases/view/65427

php - Doctrine --- search -

we use zend frame work , doctrine data base. problem want search string (for example: testin'g) string "single quotes". doctrine query fails retrives data query joins , works fine normal query out joins. my method public function getnewslistgrid($campid,$currentpage,$resultsperpage,$quicksearchtype,$queryv,$sortname,$sortorder,$letterpressed) { $query = new doctrine_query(); $wherecond =''; $where='eng.id='.$campid; $select=''; $search = ''; if($letterpressed == 'all') { $where .=""; } else if($letterpressed == 'radian6') { $where .=" , c.news_type = 1"; } else if($letterpressed == 'google news') { $where .=" , c.news_type = 3"; } else if($letterpressed == 'google blogs') { $where .=" , c.news_type = 4"; } else if($letterpressed == 'hide twitter')

python: many to many groupings using iterator module -

i have iterable, items of map multiple groups. how group items using iterator module? animals = (human, frog, giraffe, fish) here human, frog, etc objects attributes: is_land_dwelling , is_water_dwelling. i want group animals based on these attributes groupings = dwelling_classifier(animals) should return group iterator splits animals into is_land_dwelling: human, frog, giraffe is_water_dwelling: frog, fish i prefer make single pass on iterable. so, apart writing custom iterator function, there other way? def is_water_dwelling(animal): return animal in ('frog', 'fish') def is_land_dwelling(animal): return animal in ('frog', 'human', 'giraffe') animals = ('human', 'frog', 'fish', 'giraffe') land_dwelling = (x x in animals if is_land_dwelling(x)) water_dwelling = (x x in animals if is_water_dwelling(x)) print list(land_dwelling) print list(water_dwelling) note land_dwelling

What does || mean in Erlang? -

i found there || in list manipulation. || mean? there examples || ? lists:sum([a*b || {a, b} <- foo]). it used in list comprehensions . list comprehensions shorter way create lists without having use funs, maps or filters. from programming erlang : if have list l: l = [1,2,3,4,5]. and want double every element, can do: lists:map(fun(x) -> 2*x end, l). but list comprehensions can do: [2*x || x <- l].

.net - WCF REST StarterKit and RequestInterceptor thread safety -

i looking technical information how requestinterceptor wcf rest starter kit works, didn't find wanted. let's @ code snippet took custom service host factory: protected override system.servicemodel.servicehost createservicehost(type servicetype, uri[] baseaddresses) { var host = (webservicehost2)base.createservicehost(servicetype, baseaddresses); var authenticationprovider = container.trygetinstance<iauthenticationprovider>(); var authorizationrepository = container.trygetinstance<iuserfinder>(); if (authenticationprovider == null) authenticationprovider = new defaultauthenticationprovider(authorizationrepository); var securitycontext = new securitycontext(); host.interceptors.add(new authenticationinterceptor(authenticationprovider, securitycontext)); return host; } that code increateservicehost method executed once. however on every http request authenticationinterceptor execu

Springs Transaction Management - Understanding Spring Reference, Global/Local, Programmatic/Declarative - Two Questions -

im working spring framework 3.0.5 , hibernate framework , im starting use springs transactionmanagement. have questions, understand how springs transactionmanagement works. 1) i read things in spring reference: a) consistent programming model across different transaction apis such java transaction api (jta), jdbc, hibernate, java persistence api (jpa), , java data objects (jdo). b) spring resolves disadvantages of global , local transactions. enables application developers use consistent programming model in environment. write code once, , can benefit different transaction management strategies in different environments. c) gone days when alternative using ejb cmt or jta write code local transactions such on jdbc connections, , face hefty rework if need code run within global, container-managed transactions. spring framework, of bean definitions in configuration file, rather code, need change. from a) understand can use apis spring without changing code f

c# - Convert UTF8 string to UTF-16 in .net -

i have string utf8 , want convert unicode (utf16). please help. if have file , know encoding of file utf8 can use streamreader read file if encoded in utf8. regarding conversion utf8 unicode, comparing 2 different things. check link in comment question. system.text.utf8encoding utf8 system.text.unicodeencoding utf16. check this link conversion. using encoding.convert()

indexing - Python - AttributeError: index -

i stuck here... connecting t3://localhost:7001 userid weblogic ... connected admin server 'examplesserver' belongs domain 'wl_server'. warning: insecure protocol used connect server. ensure on-the-wire security, ssl port or admin port should used instead. [mbeanserverinvocationhandler]com.bea:name=mainwebapp,type=appdeployment parcelliendata.war parcelliendata p problem invoking wlst - traceback (innermost last): file "d:\rm-share\rm-scripts\wl_deploy_localhost-wc.py", line 30, in ? attributeerror: index my code looks like: import sys import getopt import os loadproperties(sys.argv[1] +".props") connect(username,password,adminurl) cmd = "awk -f'name=' '{print $2}' | awk -f',' '{print $1}'" f = open(r'./applicationslist.txt','r') #in above line can specify complete path of "applications.txt" print f in range(5): line=f.readline() line1=line[:-4]

iphone - Is there a way to set the number of animation steps for CABasicAnimation? -

i want create animation interpolates property 2 seconds , 20 frames (presentation layers) have generated coreanimation framework. know how provide duration explicit animation property have change in order particular number of frames calculated interpolation process? thanks in advance. core animation works using interpolation--calculating intermediate values in between key values specify. if it's keyframe animation, interpolates between number (n) of values in values array. if it's basic animation, interpolates between 2 values--your start , end values. if want change frame rate of animation instance go through how change frame rate of core animation instance?

entity framework - What's required for ExecuteStoreQuery to respect relationships? -

at moment seems me kind of arbitrary when fails. here case. entity foo: class foo { int fooid {get;set; user creator {get;set;} bar thebar {get;set;} datetime createddatetime {get;set;} } entity user: class user { int userid {get;set;} objectwhatchamacallit foos {get;set;} datetime lastlogindatetime {get;set;} } so return db.executestorequery<foo>("select *, created createddatetime, lastlogin lastlogindatetime [user] join foo on foo.creatorid = [user].userid join bar on foo.barid = bar.barid", "foo"); will load foos fine, bars not creators. return db.executestorequery<user>("select *, created createddatetime, lastlogin lastlogindatetime [user] join foo on foo.creatorid = [user].userid", "user"); doesn't perform better. users loaded, without foo. can because of aliases in both

flex - Prevent drag and drop outside of branch -

i have advanceddatagrid populate hierachialdata xml. i've enabled drag , drop of children nodes, want prevent child node being dropped outside of branch. child must in branch. how can test if dropped node outside of branch? i managed solve using dragcomplete event check nodes should in branch , copy node , append last found branch node , delete dragged one. if user drags leaf top of tree appends first branch node. works being able drag , drop leafs closed branches. is there way move/re-parent nodes or limited append copy/delete old node?

asp.net - how can i make this into one div -

how can make in 1 div? has 2 divs need make in 1 div images showing on left , text on right. <div style='float: left; margin-left: 6px; margin-bottom: 6px; height: 191px;'> <img src='http://www.cnn.com/features/150px.jpg' width='100' height='100' border='0' alt='lipsum' /> <br /> <img src='http://www.cnn.com/features/b150px.jpg' width='100' height='100' border='0' alt='lipsum' /> <br /> <br /> <br /> </div> <div id='lipsum'> <p>first paragraph</p> <p>second paragraph</p> </div> you can use clear: left : see: http://jsfiddle.net/thirtydot/fn4h4/ css: img { float: left; clear: left; margin: 0 6px } html: <div id='lipsum'> <img src='http://www.cnn.com/features/150px.jpg' width='100' height='100'

app store - iPhone program standard for companies? -

i'll publish application on store. if make iphone program standard (99$) account, can put name of society , name developer? (enrollment company , not individual ?) thank ;-) you can have 1 name assigned developer account. apple require form of legal documents proves name valid , allowed act on behalf of name. your own apple-id can assigned many developer accounts.

service status of hostnames from a text file -

i have following code starts service called uvnc_service on hostnames have in text file called find.txt (see below). want add sort of check test if service running on if - nothing , output message screen saying running or if not running on 1 of hosts in find.txt file - start service , output/append hostname file. can me please? thanks find.txt... pc1 pc2 pc3 ... set service = uvnc_service /f %%a in (c:\temp\find.txt) sc \\%%a start %service% && >> out.txt echo %%a you can use service control query machine , see status of service ie running http://ss64.com/nt/sc.html try this set service = uvnc_service /f %%a in (c:\find.txt) call :servicecheck %%a :servicecheck sc \\%1 query %service% | find "running" if %errorlevel% == 0 goto startservice %1 goto end :startservice sc \\%1 start %service% && >> out.txt echo %1 :end i cant test on machine , haven't done batch in while might not perfect

c# - Question about using SelectedTab -

i creating app uses tabs. want able add, edit, , delete on each tab. have these 3 buttons outside of tabs can used each one. trying figure out how use selectedtab tab on 1 gets changed. appreciated. thanks you in buttons' event handlers: if (tabcontrol1.selectedtab == tabpage1) { /* */ } else if (tabcontrol1.selectedtab == tabpage2) { /* else */ }

java - Hibernate interfering with Javamail logging -

i building application using javamail. for logging purposes, set: properties.put("mail.debug", true); that enabled logging javamail , gives me lot of useful debugging info. now, installed hibernate prints lot of info console (except sql statements uses) out of sudden, javamail logging info disappeared. i not sure cause assume hibernate has this. does know how solve or @ least debug issue? i replaced entire log4j config file , solved problem: log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.target=system.out log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{absolute} %5p %c{1}:%l - %m%n log4j.appender.file=org.apache.log4j.fileappender log4j.appender.file.file=hibernate.log log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%d{absolute} %5p %c{1}:%l - %m%n log4j.rootlogger=info, stdout log4j.logger.net.sf.hiber

c# - Lambda expression as function parameter -

i have following code list<int> getindices<t>(list<t> list, ?????? condition { var result = list .select((p, index) => index) .where(condition); return result.tolist(); } and call getindices(somelist, (p, index) => (somelist[index].height < somelist[index - 1].height)) what correct type of condition ? there's error in code: where expects delegate returns bool value , has list element type input. var result = list .select((p, index) => index) // projects element it's index (of type int) .where(condition); // => expects func<int, bool> so need func<int,bool> however, spec think want func<t,int,bool> , means have rewrite implementation of getindices as var result = list .select((p, index) => new {p, index}) .where(x => condition(x.p, x.index)) .select(x => x.index);

jQuery onClick GoTo ID or Class -

for odd reason header gets messed when click on tag go id. instead there way use jquery this, such click(), goto id? <a href="#allreviewstop">read reviews (1)</a> <div style="height:1500px;"> long stuff</div> <div id="allreviewstop"> reviews go down here</div> this page i'm dealing click here $("div").click(function() { window.location.hash = "#"+$(this).attr("id"); } is you're after? [edit] can't remember if need # or not. try without if doesn't work.

java - Relative path for properties file -

i'm using properties file: try { properties.load(new fileinputstream("filename.properties")); } catch (ioexception e) { } where should place filename.properties ? don't want specify absolute path code has work in different platforms. tried place in same directory de class doesn't work. (sorry if it's stupid question) maybe can path current class placed somehow? be sure property file available compiled (.class) file , way getclass().getresource("filename.properties") // url, openstream or getclass().getresourceasstream("filename.properties") // inputstream example: import java.net.url; public class sampleload { public static void main(string[] args) { final url resource = sampleload.class.getresource("sampleload.class"); system.out.println(resource); } } this main retrieves own compiled version @ runtime: file:/c:/_projects/toolbox/target/classes/org/game/toolbox/s

iphone - UIWebView Zoom Issue -

how can identify user has zoomed webview resize other components present. webview starts middle of screen , when user zooms webview starts scroll horizontally , vertically happens within webview.the scrolling happens internally. want lock webview scrolling internally when user scrolls vertically, labels,textfields etc. on top of webview scroll , not webview alone. want achieve pretty similar iphone native email client. accomplishing this, put webview on top of scrollview , when user zooms it, reset content size of scrollview whatever added scrollview labels , textfields above webview scroll when scroll webview. any ideas? you do: disallow user pinch zoom webview detect double tap on scrollview , toggle webview's scalespagetofit property , set userinteractiondisabled on webview now can scroll scrollview has controls..

How to change a nullable column to not nullable in a Rails migration? -

i created date column in previous migration , set nullable. want change not nullable. how go doing assuming there null rows in database? i'm ok setting columns time.now if they're null. if in migration this: # make sure no null value exist mymodel.update_all({ date_column: time.now }, { date_column: nil }) # change column not allow null change_column :my_models, :date_column, :datetime, null: false

algorithm - C++: Using boost lambda to get maximum values in a std::tr1::unordered_map -

i have std::tr1::unordered_map<int, a> map; class member variable (int x). i find key in map such map[i].x maximum. i know can write functor go std::max_element. how do instead, using boost lambda (i trying learn it) ? not have c++0x. as added question, if had class defined below: class { int x; int y; }; and wanted find maximum w.r.t x (if maximum 0, find maximum wrt y). again, 1 solution iterate on tuples of map (keeping both maxima in memory). there way modify max_element ? boost.lambda uses boost.bind access member variables. comes bit wordy: typedef std::tr1::unordered_map<int, a> map_t; map_t m; max_a = std::max_element(m.begin(), m.end(), bind(&a::x, bind(&map_t::value_type::second, _1)) < bind(&a::x, bind(&map_t::value_type::second, _2)) )->second; test: https://ideone.com/v6szl you may save half headache boost.range a max_a = *boost::max_element(m | map_values, bind(&a

javascript - Using slideshow like navigation with localscroll -

how create following? on virtually every slideshow have previous , next arrow , bunch of dot's indicating "slide" you're viewing. i'd use entire site. i'm using scrollto-1.4.2 localscroll-1.2.7, it's bunch of div's user can scroll to. i'd able have dot's , back/next buttons use menu. know how create this, or should start create this? thanks! (if need me post html, js or css i'm using, tell me , will) make carousel. always, recommend using jquery cycle plug-in . has lots of options customize can do. be sure markup degrades nicely non-javascript. every slide in slideshow should have unique , human-understandable id. an example of i've done: http://jquery.malsup.com/cycle/ link hash carousel. when page loads, grab hash , tell cycle want start on page. if need details, comment on post. update: http://jsfiddle.net/morrison/qhvcu/embedded/result/

sdk - android process crash on adb with simple app, not sure what i'm doing wrong -

package com.russell.saw; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; public class learnandroid extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button landroid_button = (button) findviewbyid(r.id.landroid_button); { landroid_button.setonclicklistener( new view.onclicklistener() { public void onclick(view v) { // todo auto-generated method stub setcontentview(r.layout.button); } }); } button back_button = (button) findviewbyid(r.id.back_button); { back_button.setonclicklistener( new view.onclicklistener() { public void onclick(view v) { // todo auto-generated method stub

android - MenuItem#getTag() -

on subclasses of view there gettag() method, returns android:tag attribute's value .xml. same menuitem ... okay cast view ? because item elements allow tag attribute in .xml... update: goal setting tag in .xml, i.e. "notranslate" , , querying @ runtime (we localize hand @ runtime, don't ask...) menuitem interface. class can implement interface , not always safe cast menuitem view. can use "instanceof" operator test see if object implements menuitem interface indeed view or not. i understand want define flag in xml definition of menu , @ run time interrogate flag make programmatic decision. the menu resource documentation records attributes can set in xml. can consider using (abusing) 1 of settings such "android:alphabeticshortcut" encode flag , use menuitem::getalphabeticshortcut() method value. not require casting - uses existing fields in menuitem xml construct/class own purposes. perhaps less hacky way keep simple tabl

silverlight - How can I find out what items get generated in memory when debugging c#? -

just curious, possible find out, items generated while program running in stack , heap? there tool or meachanism out there identify memory usage in vs2010 c# (silverlight)? thanks, yes, can use visual studio profiler (or other profiler). tutorial: http://msdn.microsoft.com/en-us/magazine/cc337887.aspx other memory profilers: http://memprofiler.com http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/ http://www.xteprofiler.com/ (supports silverlight) so question: what .net profilers?

asp.net mvc - Using a JSONResult in a C# function -

i have function returns jsonresult in below way. var attachments = (from in ar.attachments select new { id = a.id, filename = a.filename }).toarray(); var result = new { comments = "some string", attachments = attachments }; return this.json(result); i need use result in class need access "comments" , "attachments". here attachments string array , comments string. please let me know how can this. you create viewmodel result , reuse class. viewmodel is, poco or dto. idea gives different way "look" @ data, nothing special really. so end 3 parts. the data method: public commentsviewmodel getviewmodel() { var attachments = (from in ar.attachments select new { id = a.id, filename = a.filename }).toarray(); var result = new commentsviewmodel { comments = "some string", attachments =

javascript - Alternative to eval for accessing object by string name? -

i have following eval(id+' = new myobject()'); and want access resulting object , methods. with myobject = eval(id); myobject.mymethod(); but elegant alternatives there using eval? assume id intended global object , you're executing in browser, window[id] = new myobject(); myobject = window[id]; myobject.mymethod(); or modify code store id object. var objectstore = {}; objectstore[id] = new myobject(); myobject = objectstore[id]; myobject.mymethod();

tsql - SQL Server 2008 T-SQL UDF Split() Tailoring -

i'm useing sql ser 2008 , have large table 1 column of data. data random string little consistency. eample: name account 445566 0010020056893010445478008 afd 369. i've been working split function stackoverflow user suggested. works great function assigns split string 1 column. need row of individual columns. present result 1col values name, account, 445566,... in result i'm looking col1 name, col2 account, col3 445566,... if provide insight on how tailor script or usage desired result appreciated. create function [dbo].[split] ( @string varchar(max) ,@delimiter char ) returns @results table ( ordinal int ,stringvalue varchar(max) ) begin set @string = isnull(@string,'') set @delimiter = isnull(@delimiter,'') declare @tempstring varchar(max) = @string ,@ordinal int = 0 ,@charindex int = 0 set @charindex = charindex(@delimiter, @tempstring) while @charindex != 0 begin set @ordinal += 1 insert @results va

iis - IIS7 doesn't display bound IP addresses -

so have ten ips bound network adapter. when go add binding iis7 presents me list of ip addresses available, have 127.0.0.1. can manually enter ip address bind host headers websites. still iis function , present me of ip adresses bound adapter. any ideas how fix this? ok figured out, should stop asking questions on here seem answer lot of own. there entry in hosts file bound 127.0.0.1 hostname of computer, removing solved iis issue.

c# - How Can I Use IEnumerator.Reset()? -

how right way call ienumerator.reset ? the documentation says: the reset method provided com interoperability. not need implemented; instead, implementer can throw notsupportedexception . okay, mean i'm not supposed ever call it? it's so tempting use exceptions flow control: using (enumerator = getsomeexpensiveenumerator()) { while (enumerator.movenext()) { ... } try { enumerator.reset(); } //try inexpensive method catch (notsupportedexception) { enumerator = getsomeexpensiveenumerator(); } //fine, 1 while (enumerator.movenext()) { ... } } is how we're supposed use it? or not meant use managed code @ all? never ; mistake. correct way iterate sequence more once call .getenumerator() again - i.e. use foreach again. if data non-repeatable (or expensive repeat), buffer via .tolist() or similar. it formal requirement in language spec iterator blocks throw exceptions method. such, cannot rely on working . ever.

asp.net - Tutorial on using Loop Helper for WebMatrix -

i learned of nuget package loop helper webmatrix . unfortunately can't seem find documentation or project site. have information on how use or project site is? i think supplied sample pretty covers need know, loop tracker isn't mysterious might think. all loop.outerloop doing referencing parent loop if you're in 1 , it's being tracked, example: @{ int[] outerthings = new int[] {1,2,3,4}; var innerthings = new[] {"a","b","c", "d"}; foreach (int outerthing in outerthings.track()) { <li>@outerthing @foreach(var innerthing in innerthings.track()) { <li>---->@innerthing @if (loop.outerloop.first) { <strong>start of outer loop (index is: @loop.outerloop.index)</strong> } @if (loop.outerloop.last) { <strong>end of outer loop (index is: @loop.outerloop.index)</strong> } </li> }

Problem Executing Vacuum command in sqlite3 on iphone -

i found snippet executing vacuum of sqlite3 db doesn't work. can tell me wrong it. sqlite3_exec(database, "vacuum;", 0, 0); thanks... ok here's solution make vacuum command work. if(sqlite3_exec(database, "vacuum;", 0, 0, null) == sqlite_ok) { nslog(@"vacuumed database"); } that makes command work app locked out of database while runs.

imap - How to override php.ini timeout for imap_timeout functionality with secure POP3 servers -

the php imap library doesn't have built in ways change imap_timeout function secure pop3 connections. i'm looking build functionality can set timeout 1 second connections secure pop3 servers, i'm not sure start learn overriding php.ini command within php function. ideas? imap_timeout(1, ) works fine pop3 connections, but apparently not pop3s (ssl, port 995) connections, default socket timeout still applies. applies php 4.3.10, not tested on other versions. we looked source find out function , how use it. the function overrides default_socket_timeout setting php.ini file you can retrieve current timeout length each timeout type calling function as: imap_timeout(timeout_type); or imap_timeout(timeout_type,-1); you can set timeout length of timeout types setting timeout value number of seconds. imap_timeout(timeout_type,); the timeout types follows: 1: open 2: read 3: write 4: close

c# - removing duplicates in a list with linq -

suppose have list of myobject this: public class myobject { public int objectid {get;set;} public string prop1 {get;set;} } how remove duplicates list there multiple instance of objects same objectid. thanks. you can use groupby() , select first item of each group achieve want - assuming want pick 1 item each distinct objectid property: var distinctlist = mylist.groupby(x => x.objectid) .select(g => g.first()) .tolist(); alternatively there distinctby() in morelinq project allow more concise syntax (but add dependency project): var distinctlist = mylist.distinctby( x => x.objectid).tolist();

distributed - How to send nested structure using MPI_Datatype in MPI using C -

i trying use mpi_datatype send below structure mpi_send crashes while sending structure. wondering how handle situation. here code have written define new mpi data-type: typedef struct { double x; double y; } vertex; typedef struct { int num_vertices; vertex vertex[2]; } vertex_list; mpi_datatype vertextype; mpi_type_contiguous(2,mpi_double,&vertextype); mpi_type_commit(&vertextype); mpi_datatype vertexlisttype; mpi_datatype typev[3] = {mpi_int, vertextype, mpi_ub}; int blocklenv[3] = {1, 2, 1}; mpi_aint dispv[3]; /* compute displacements of structure components */ mpi_address( vertexl, dispv); mpi_address( vertexl[0].vertex, dispv+1); mpi_address( vertexl+1, dispv+2); base = dispv[0]; (i=0; <3; i++) dispv[i] -= base; /* build datatype describing structure */ mpi_type_struct( 3, blocklenv

css - displaying html form inputs horizontally -

Image
i trying recreate login form shown on tinypic's main page. in html, have 3 elemnts this: e-mail: <input type="text" name="id" maxlength="30" value="" /> password: <input type="text" name="pw" maxlength="30" value="" /> <input type="submit" name="submit" value="login" /> i have tried putting them separate divs, using float:left unique class in css code messy unreasonably long. essentially, wanted know if there simple way achieve layout html , css. thanks time! this css should work, though haven't tested: input { display: inline; }

clang++ - Fatal error: 'bits/c++config.h' file not found -

i'm using clang 2.9, compiled source , when try compile simple code this: #include <iostream> int main (){ std::cout << "hello\n"; } i error: /usr/include/c++/4.5/string:39:10: fatal error: 'bits/c++config.h' file not found when include /usr/include/c++/4.5/i686-linux-gnu , get /usr/bin/ld: cannot find crt1.o: no such file or directory /usr/bin/ld: cannot find crti.o: no such file or directory /usr/bin/ld: cannot find crtbegin.o: no such file or directory /usr/bin/ld: cannot find -lstdc++ /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find -lgcc clang: error: linker command failed exit code 1 (use -v see invocation) any ideas on how solve one?

matlab - FDTD keeps overflowing on quasi boundaries and some other questions -

i have fdtd assignment, it's not going well. whenever put source in , let simulation run bit (note - if test have use debugger , step through loop increments otherwise there hefty overflow). in of simulations i've seen, people break ex , ey separate parts, put them 1 large e matrix , used index offset (seen in ep(u,v+1) , e(u+1,v) calculate ey , ex independently). the sources used reference were: http://fdtd.wikispaces.com/ , http://www.mathworks.com/matlabcentral/fileexchange/21000-tiny-fdtd-v1-0 1 acoustics, works well. close all; %% user modifiable parameters mu0 = pi*4e-7; % ph/µm e0 = 8.854187e-12; % picofarads/micron c = 1/sqrt(mu0*e0); cellsizex = 100; % size of yee-cell in microns cellsizey = 100; % size of yee-cell in microns numx = 100; % number of cells in x direction numy = 100; % number of cells in y direction lambda = 700*10^-9; dx = lambda/20; dy = lambda/20; dt = (c*sqrt(dx^-2+dy^-2

php - Using preg_replace to back reference array key and replace with a value -

i have string this: http://mysite.com/script.php?fruit=apple and have associative array this: $fruitarray["apple"] = "green"; $fruitarray ["banana"] = "yellow"; i trying use preg_replace on string, using key in array reference apple , replace green, this: $string = preg_replace('|http://mysite.com/script.php\?fruit=([a-za-z0-9_-]*)|', 'http://mysite.com/'.$fruitarray[$1].'/', $string); the process should return http://mysite.com/green/ obviously isn’t working me; how can manipulate $fruitarray[$1] in preg_replace statement php recognised, referenced, , replaced green? thanks! you need use /e eval flag, or if can spare few lines preg_replace_callback . $string = preg_replace( '|http://mysite.com/script.php\?fruit=([a-za-z0-9_-]*)|e', ' "http://mysite.com/" . $fruitarray["$1"] ', $string ); notice how whole url concatenation expressi

osx - Converting to const in C++ -

c++, os x, carbon api. i need pass in const fsspec method fspopendf i have follows: const fsspec fsspec = ffilespec.getfsspec();/* declared fsspec getfsspec() const; */ err = ::fspopendf(fsspec, 1, &refnumber); but error is: error: cannot convert 'const fsspec' 'const fsspec*' argument '1' 'oserr fspopendf(const fsspec*, sint8, short int*)' i have tried defining as: const fsspec* fsspec = ffilespec.getfsspec(); and doesn't help. confused. can explain concept missing? try this: fsspec fsspec = ffilespec.getfsspec(); err = ::fspopendf(&fsspec, 1, &refnumber); you seem understand need take address of object when calling function wanting pointer, refnumber ; same merely needs done fsspec object since const fsspec* expected.

javascript - How to merge two $(document).ready(function() in jQuery -

<script src="jquery/jquery.tablesorter.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> $(document).ready(function() { $("#mytable").tablesorter({ }); $("#accordion").accordion({ autoheight: false, collapsible: true, active: false }); }); ... <div id="accordion"> <h3><a href="#">first header</a></h3> <div>first content</div> <h3><a href="#">second header</a></h3> <div>second content</div> </div> <table border =1 cellpadding =8 id="mytable" class="tablesorter" width="80%"> <thead> <th><h3> date </h3></th> <th><h3&g

add in - Generate XSD from class in Visual Studio -

it nice if, in visual studio 2010, right click .cs class file , see menu option "generate xsd", shortcut call through xsd.exe. generated xsd automatically added project. know of such tool? you can take here @ site explaining how add external tools way call directly vss. just remember use right xsd.exe target project .net framework version. for .net framework 4 use 1 located @ c:\program files (x86)\microsoft sdks\windows\v7.0a\bin\netfx 4.0 tools i hope helps you.

iphone - objective c class instance declaration error? -

i very new objective-c , im trying declare new instance of uitableview in xcode. here code: uitableview *maintable = [[uitableview alloc] init]; and xcode pointing @ = , bothering me semicolon @ end of declaration statement, there. edit: #import <uikit/uikit.h> @interface testrunappdelegate : nsobject <uiapplicationdelegate> { uitableview *maintable = [[uitableview alloc] init]; } you can't make assignments inside class's interface . move assigment app delegate's init method: #import <uikit/uikit.h> @interface testrunappdelegate : nsobject <uiapplicationdelegate> { uitableview *maintable; } @end @implementation testrunappdelegate - (id)init { if( !(self = [super init]) ){ return nil; maintable = [[uitableview alloc] init]; return self; } @end the @interface block (everything @interface @end ) tells other code expect class. doesn't do itself. between curly braces, declare ins

visual studio 2010 - XNA 4.0 Tutorial? -

hey everybody, @ first "go google it" type of question, after extensive googleing can't seem find anything. i'm cs major @ university hopes go game programming , know java , c++ , i've started dabble c# creating 2d game had 3d counter part. problem don't have copy of 3d part learn from. sorry long-winded rant, question; can please point me tutorial using xna 4.0 (with vs2010) create 3d game?! there loads of tuturials on youtube basic step step game tutorial found. problem of game static if want alot of movement starting point maybe try check out microsofts msdn site too. youtube tutorial xnamktg2's: http://www.youtube.com/user/xnamktg2#p/u/41/bwu8bgkt_wq . hope helps type google creating xna 4.0 in 60 minutes , decent tuorial pop too. decent starting tutorial has helped me: http://msdn.microsoft.com/en-us/library/dd940288.aspx . hope helps good luck mate

How to convert WCF REST 4.0 service so it runs in Azure web role? -

i have written stand alone wcf rest service in 4.0 under studio 2010 decided host under azure opposed amazon aws. there easy way me convert or need runs under azure's web role? created blank web role project in studio structure of wcf seems totally different. you shouldn't have special service on azure. depending on how wcf service, can add cloud role. if want see example of wcf service used in azure can download our windows phone 7 guidance has wcf 4 rest service hooked windows phone 7 project. can chapter here . can code here , check out service.

sql - joining two tables and overwriting one colum -

Image
i trying join tables image attached shows, table 1 have same records table 2 except 1 field not equal i merge them have extended table : have records table2, if ignore isempty field, table 1 in table2 when table1.isempty=1 , merged result have isempty=1, , record overwritten check attached images more details the table 3 shown, have records table 2 overwritten when necessary select a.id, a.name, a.desc, case b.isempty when 1 1 else a.isempty end case isempty table2 left join table1 b on a.id=b.id

iphone - Including Javascript as a local resource in Xcode 4 while using a UIWebView -

i saw question answered xcode 3, xcode 4 seems have changed. i unable figure out how include javascript file local resource iphone app using uiwebview. compiler tries interpret included .js files code rather including them in root app bundle resource reference in html file. in case trying include local copy of javascript file uiwebview portion of app can perform functions while not connected internet, need local copy.... anyone have figured out xcode 4? thanks -steve wow. spent hours trying figure out, posted question. 10 minutes later run across totally unrelated thread pointed me in right direction. in xcode 4 in project navigator click on top item, project, select target , click on build phases tab. there copy bundle resources in window let add .js files need in local resources. html references such as: <script type="text/javascript" src="yourawesomecode.js"></script> will work

MYSQL ON DUPLICATE KEY UPDATE with more than one key? -

say have record id=1, b=20 , c=30. id primary key. insert database new record if there no record b=20 , c=30. far have set primary key id b & c? how can query? thank you. you can create unique key on b , c with. alter table mytable add unique myindex(b,c);

how connect to mysql from oracle form -

i know can connect mysql oracle forms? if yes put , example me? i suggest creating database link in oracle db points @ mysql db. can write queries such this: select * oracle_table_1, mysql_table@mysql_link; this document appears have helpful information on how set up; apparently isn't simplest of tasks.