Posts

Showing posts from July, 2012

iphone - How to implement such a view transition effect -

suppose app display text , thumbnail image on screen. when user tap image, app display larger image size fit screen, remains same ratio, uiimageview.contentmode = uiviewcontentmodescaleaspectfit. want implement such view transition when display larger image, when click folder locates on desktop of mac computer. when double click folder on desktop, open finder transition animation. , there backward transition when close finder, animation finder window zoom out , fade folder located on desktop. suppose folder thumbnail image, , finder window larger image display fit iphone screen. how implement such view transition effect? hope state question clearly. thank you. best regards. take @ cgaffinetransform. scale , makescale methods. go developer documentation in xcode , run search. @ example projects. similar view animations can applied imageview.

ios - NSXMLParser crash in xmlFindCharEncodingHandler -

an ios app has been parsing same xml feed last year , half has developed intermittent crash inside [nsxmlparser parse] . crash logs indicate instantiate nsdata object url , use [nsxmlparser initwithdata:] create parser. snippet of stack trace follows: 0 libxml2.2.dylib 0x366eb1fc xmlfindcharencodinghandler + 124 1 libxml2.2.dylib 0x366f0f84 xmlparseencodingdecl + 416 2 libxml2.2.dylib 0x366f2ed8 xmlparsexmldecl + 304 3 libxml2.2.dylib 0x366fb688 xmlparsechunk + 808 4 foundation 0x32753d5e -[nsxmlparser parse] + 198 the crash reported is exception type: exc_bad_access (sigbus) exception codes: kern_protection_failure @ 0x00000000 i should note performing parse , download in background inside nsoperation 's main method. has ever encountered such crash, , if have tips on how resolve? have reached out maintainers of xml feeds ask if there issues character encoding, indicate ...

vb.net - Convert For Each GridViewRow to Parallel.ForEach GridViewRow -

i trying convert code below parallel loop. proper syntax use parallel.foreach instead of foreach? each grow gridviewrow in gvemployees.rows sendsummaryreport(grow) next this used working: parallel.foreach(of gridviewrow)(gvemployees.rows.oftype(of gridviewrow)(), (addressof sendsummaryreport))

HTML5 custom attributes - Why would I use them? -

i can't seem understand why should happy html5 allowing custom attributes? why use them? i assume you're referencing html5 [data-*] attributes. the advantage can associate scripting data (still semantic, not display) elements without having insert inline javascript on place, , valid html5. same thing in html4 require specifying custom namespace, , add namespaced attributes. say you've got list of items sale, may want store numeric price without trying parse string: <ul> <li data-price="5">item 1 $5 week!</li> <li data-price="1">sale on item 2, $1</li> ... </ul> if allow user mark number of different items buy, can pull out numeric value display running total. alternatively, have put numbers in span specific class, find right span on right item, , pull out value way, [data-*] attributes reduce amount of markup/script necessary same thing. if don't want use it, don't need to. ther...

Why can you read an attribute placed on a const using reflection in C#? -

i playing around reflection , accident realized place custom field attribute on const class variable, (using reflection) read class' fields, find const attribute , perform actions. working fine. i curious why works fine. unless mis-understood how consts work, thought constants "compiled out" , references constant became constant's actual value after compiling. if case, why can reflection still see const values? all references const compiled away - not const declaration itself. const declarations emitted part of il compiler. here's example (notice il retains const field). c#: class foo { const int = 0; } il: .class private auto ansi beforefieldinit foo extends [mscorlib]system.object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { } .field private static literal int32 = int32(0) }

jboss - Viewing images in birt reports -

problem viewing images. ..if deploy report , images in folder called project can view report http://localhost:8080/birt/frameset?__report=project/example.rptdesign that works ok. if want structure things, in folder project: made folders, 1 reports called report , 1 images called resources call report http://localhost:8080/birt/frameset?__report=project/report/example.rptdesign the report looks ok, images not show up. thank you. when changed image's location, did delete image report , re-add new resources" folder? should able store , access image relative path quite easily, needs stored in location relative report when add resource.

python - How can I find out, if a page is full with reportlab PDF? -

i creating pdfs tables reportlib (with c.draw() ). don´t know, when page full because of dynamic content. how can check out, if @ end of page, can add footer , c.showpage() ? canvas.draw() low level. if want stick canvas.draw have take care of everything. instead, use platypus , make flowables, when place them in document reportlab.platypus.doctemplate.basedoctemplate has several hooks can use control placement , flux.

php - CodeIgniter - pass variables to CSS -

i'm rewriting website on code igniter, , need load external ttf. mysql db points path ttfs. can pass somehow these variables css , make foreach loop 'loads' these fonts. i tried $this->load->vars($data); you need understand how retrieve data db , how display them: http://codeigniter.com/user_guide/database/index.html luck edit: need that: after have retrieved links database , let's called them $ttf_links <?php foreach($ttf_links $link){ echo "<link rel='stylesheet' type='text/css' href={$link['row_name']} media='screen' />" } ?> and call fonts need in css

java - hibernate design issue -

have custom filter querying database. api layer build filter,send dao layer , dao execute filter ( filter.tocreteia() ) , return list of results. public interface ifilter { creteria tocriteria(); } i want make dao api filter + securityfilter in every method. list getall(ifilter filter, ifilter security); //each filter creteria in end i end inside dao 2 creterias: regular filter , security filter. how can render 2 creteias returning 1 list of results? or, think should use 1 filter , in api layer add security content it? unless want go interceptor approach (e.g., have securityinterceptor/proxy class transparently modifies criteria) think nicer design have 2 separate filters. note don't see possible join 2 detachedcriteria objects together. although can have routine based on 2 ifilter objects returns single detachedcriteria based e.g. on restrictions.and(criterion1, criterion2) .

How to treat warnings from clang static code analysis as errors in Xcode 3? -

question the run_clang_static_analyzer ("run static analyzer") project setting has found important issues in our project. have addressed them , want prevent future issues creeping in. we're trying clang analysis warnings treated errors break our build . far no success despite having -werror ("treat warnings errors") enabled. example of problem the following analysis call generated within xcode: /developer/usr/bin/clang -x objective-c [...] --analyze [...]/troubledcode.m -o [...]/troubledtarget.build/staticanalyzer/normal/i386/troubledcode.plist produces static code analysis warning: [...]/troubledcode.m:38:34: warning: potential leak of object allocated on line 38 , stored 'leakingmanager' manager *leakingmanager = [[manager alloc] init]; ^ 1 warning generated. but xcode reports "build succeeded ... 1 analyzer result". solution we're looking make example above generate "build f...

Linear time algorithm that takes a direct graph and returns the number of vertices -

how describe linear time algorithm takes directed graph input , returns number of vertices can reached every other vertex. know algorithm take linear time why. , why (o(v2) on adjacency matrix; o(e+v) on adjacency list). check out kosaraju's algorithm . should able deduce why running times algorithm.

java - Zipping a HTTP Response? Possible? -

having issue page's contents abnormally huge. in 5 10 megs range. this rendered using velocity , java on server side. it's possible compress/zip response what's reasonable way handle unzipping on browser/client side? it's built-in modern browsers. long response kind of text or compressible request/response have have correct headers. request accept-encoding: gzip,deflate response content-encoding: gzip if accept-encoding header of request doesn't include gzip shouldn't zip because client/browser can't handle it. in general should gzip text content long makes sense so. if resource 500 bytes instead of 500kbytes might not make sense performance reasons. examples html, xml, json, javascript , can configure server, types of files compress , size limit should be. enabling gzip tomcat iis glassfish

c# - WCF service access from client application when user is behind proxy -

i have wcf service hosted on server. client application accessing service on windows 7 machine. there 2 users on windows 7 machine. windows application installed through clickonce separate instance there 2 users. when usera accessing service through winforms application works fine, when userb on same machine trying access throws following exception: communication exception: remote server returned unexpected response: (417) expectation failed. server stack trace: @ system.servicemodel.channels.httpchannelutilities.validaterequestreplyresponse(httpwebrequest request, httpwebresponse response, httpchannelfactory factory, webexception responseexception, channelbinding channelbinding) @ system.servicemodel.channels.httpchannelfactory.httprequestchannel.httpchannelrequest.waitforreply(timespan timeout) @ system.servicemodel.channels.requestchannel.request(message message, timespan timeout) @ system.servicemodel.dispatcher.requestchannelbinder.request(message message, tim...

.net - Add button control(s) to SplitContainer Splitter -

Image
is there way display controls (like buttons) on adjustable splitter displays between 2 panels in .net splitcontainer ? example: i don't think splitcontainer natively supports this, overriding control functionality seems omni-present in numerous applications seems bit me - feel i'm over-thinking or missing obvious. here's example uses tablelayoutpanel simulate splitcontainer. using system; using system.diagnostics; using system.drawing; using system.windows.forms; class form1 : form { [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } tablelayoutpanel rootpanel; float originalwidth; int splitpointx; public form1() { controls.add(rootpanel = new tablelayoutpanel { columncount = 3, columnstyles = { // notice use of absolute h...

php - Doctrine 2 ManyToMany cascade -

is possible in doctrine 2 create 2 objects many many related , call persist on 1 of them save both? user entity: /** * owning side * * @manytomany(targetentity="role", inversedby="users", cascade={"persist"}) * @jointable(name="user_roles", * joincolumns={@joincolumn(name="user_id", referencedcolumnname="id")}, * inversejoincolumns={@joincolumn(name="role_id", referencedcolumnname="id")} * ) */ public $roles; role entity: /** * inverse side * * @manytomany(targetentity="user", mappedby="roles") */ public $users; saving: $role = new role(); $user = new user(); $user->roles->add($role); $role->users->add($user); $em->persist($user); $em->flush(); it doesn't work , trows error "a new entity found through relationship not configured cascade persist operations: entities\role@0000000004a29c11000000005c48...

C question from an interview -

in lines code fail (meaning: don't supposed do), , why? int main(void) { char student[64] = "some guy"; char* teacher; /* line1 */ strcpy(teacher, student); /* line2 */ teacher=student; /* line3 */ strcpy(student, "alber einstein"); /* line4 */ student = teacher; } line 1 causes undefined behaviour. line 4 won't compile. since seems homework question, , don't give whole thing away, quick read of comp.lang.c faq or c language specification explain why.

Do I need to sanitise the parameters to a SQL Stored Procedure? -

i'm writing quick website in asp (classic) javascript. i'm using prepared statement parameter. nothing special. my question need sanitise input parameter (if so, there native functions in php?), or fact i'm using parameter rather concatenating inline sql make me safe? //set command run getmigrationdate stored procedure. var command = new activexobject("adodb.command"); command.commandtext = "exec mystoredproc ?"; //set parameters command.parameters.append(command.createparameter("name", 200, 1, 255)); command.parameters("name") = name; //set result recordset var results = new activexobject("adodb.recordset"); //run command results.open(command); [edit] stored proc this: @name varchar(255) select * customers name = @name your stored procedure using bind variables , not building sql statement parameters you're passing in don't need sanitize parameters in order avoid sql injection. in other...

blackberry - Labelfield text not wrapping -

the below class extends labelfield when display large amount text does'nt wrap new line. text trails across screen. when use labelfield text wraps. need update paint method? thanks import net.rim.device.api.ui.drawstyle; import net.rim.device.api.ui.font; import net.rim.device.api.ui.graphics; import net.rim.device.api.ui.component.labelfield; public class fclabelfield extends labelfield { private object text; private font font; private int colour; private long style; public fclabelfield(object text, long style , font font, int colour) { super(text, style); this.text = text; this.font = font; this.colour = colour; } protected void paint(graphics graphics) { graphics.setcolor(colour); graphics.setfont(font); graphics.drawtext(text.tostring(), 0, 0, drawstyle.hcenter, getcontentwidth()); } } this works - import net.rim.device.api.ui.drawstyle; import net.rim.device.api.ui.font; ...

fork - How are PIDs generated on Ubuntu? -

i've wrote program forks 1 process. child process displays "hi" 200 times. father process says he's father. i've printed out both pids. when run program multiple times, see parent's pid stays same, normal. don't understand why child's pid keeps getting incremented 2, , 2. question: standard method of pid generation in ubuntu? incrementing 2? pids happen handed out monotonically increasing in linux 2.6, why matter get? don't rely on specific behavior. if there skip of +2 might because process happened spawn child. or because +1 have reached pid in use.

asp.net - .NET 4 web.config file refactoring - what's the value? -

according what's new in .net 4 : "major configuration elements have been moved machine.config file, , applications inherit these settings." i'm on project upgrading .net 3.5 .net 4, , have questions change: i assume change optional: if leave current web.config file as-is, should run fine under .net 4 - correct? this enhancement seems have dubious value: config hasn't been simplified - complexity/bloat has been relocated machine.config file instead of web.config. missing something? it seems enhancement makes deployment more difficult: in addition deployment steps had, need modify machine.config file ensure contains our expected settings/values. as can see, initial take on is: it's hassle , don't want it. there perspective i'm missing makes change useful , valuable? edit: nathan , rob - both answers helpful , appreciated - difficult decide flag "real" answer. upvoted both, of course. again! you don't ever need ...

memory management - Detecting leaks in Cocoa thread? -

i have been working on application in xcode while , had detected lot of memory leaks using instruments. fast forward few months , have added threading application , instruments not show memory leaks though has growing memory footprint. does instruments not detect memory leaks in threads create? reason these leaks flying under radar? leaks means objects there no references said objects. if app allocating memory , filling, say, cache or global dictionary or whatever, it'll grow unbounded , show nary leak. you'll want use heapshot based analysis track down.

iphone - NSString encoding conversion -

i have problem particular nsstring b , ï¼¢ . can see encoding different. wondering if there way convert ï¼¢ b computer can standardize character. does work? nsstring *newstring = [oldstring stringbyreplacingoccurrencesofstring:@"ï¼¢" withstring: @"b"];

What is HTML ending tag called? -

just wondering, call </div> in <div></div> ? front called tag, called same thing? it's called closing tag, in "self-closing tag". can called end(ing) tag.

javascript - writing more complex json schemas that have dependencies upon other keys -

i've been writing simple json schemas ran api input call bit more complex. have 1 restful end route can take 3 different types of json: localhost/foo can take: { "type" : "ice_cream", "cone" : "waffle" ...} or {"type" : "hot_dog", "bun" : "wheat" ...} if "type" key contains "ice_cream", ever want see key "cone" , not key "bun". similiarly if "type" contains "hot_dog" want see "bun" , not "cone". know can pattern match make sure ever see type "ice_cream" or type "hot_dog", don't know how force requirement of other fields if key set value. see there json schema field called "dependency" haven't found examples on how use it. btw, i'm not sure if input json form (overloading type of json structure takes, effectively), don't have option of changing api. i go...

Scala-fy a java function? -

i've switched assignment java scala. however, still looks java. example, function below search on range tree, , inside there "isinstanceof" checks. however - replacing them "match" seems take more space. can suggest improvements on how "scalify" code? def rangesearch2d(treeroot: node, lower: data2d, upper: data2d, visited: visited): seq[data2d] = { if (treeroot == null) { // return empty list return vector() } // increment visit count if (visited != null) visited.visit2d(treeroot) var results = arraybuffer[data2d]() // find nearest common ancestor value between lower.x , upper.x var common: node = commonancestor(treeroot, lower, upper, visited) if (common.isinstanceof[leafnode]) { return vector(common.asinstanceof[leafnode].data) } /** common non-leaf node, must process subtree */ /** process left subtree */ var current = common.left while (!current.isinstanceof[leafnode]) { if (visited != null) visited.vi...

Simplest XML Node Editor for PHP -

could please provide simplest/shortest code can edit values within xml node? have been searching hours , errors , failures. need can node (/node/node1/node2) , edit contents within it. using php-5. thanks edit: lets have xml file: <node> <node2> content </node2> </node> what need change value of <node2> "content" else. simplexml $doc = simplexml_load_file('http://example.com/example.xml'); // note simplexmlelement root node, ie <node> $doc->node2 = 'new content'; $doc->asxml('new-filename.xml'); // note, saves locally // or $xmlstring = $doc->asxml();

mysql - Return row from subselect -

i have mysql db scheme: users (id, login) coins (userid, value, curr) i need write select return result: login , max coin have , currency of coin. i've tryed that: select login, ( select value, curr coins coins.userid = users.id order value desc limit 1 ) row(value, curr) users its not working... i'll recieve error, "operand should contain 1 column(s)". expected it, dont know way, how make it. so guess: there way return multiple-column-single-line (row) subquery parent query? (yes, can use 2 subqueries, not effective.) thanks time. select u.login, g.maxval, c.curr users u join coins c on u.id = c.userid join ( select userid, max(`value`) maxval coins group userid ) g on c.userid = g.userid , c.value = g.maxval in case of ties, above query return coins highest value, if want select 1 of coins, can add group by outer query: select u.login, g.maxval, c.curr users u join coins c on u.id = c.userid join ( ...

android - Displaying pictures stored on the SD Card using a Gridview -

i relatively new android , need one. trying write code display pictures on sd card using gridview, far when run application textview @ top shown. know if there serious flaw in logic of code in main activity code, image adapter class code or both. code: package com.newtestforsdcarddisplay; import android.app.activity; import android.os.bundle; import android.database.cursor; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.view.view; import android.widget.gridview; import android.widget.adapterview; import android.widget.toast; import android.provider.mediastore; import android.provider.mediastore.images.thumbnails; import android.net.uri; import android.widget.adapterview.onitemclicklistener; public class mainactivity extends activity { public cursor myimagecursor; public int columnnumber; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); se...

javascript - jQuery if (x == y) not working -

so, have faux checkboxes (so style them) work jquery act checked or not checked. there number of faux checkboxes in document, , each 1 have click function: var productinterest = []; productinterest[0] = false; productinterest[1] = false; productinterest[2] = false; // here 1 function of three: $('#productone').click(function() { if (productinterest[0] == false) { $(this).addclass("checkboxchecked"); productinterest[0] = true; } else { $(this).removeclass("checkboxchecked"); productinterest[0] = false; } }); the problem seems there error in if statement, because check, not uncheck. in other words add class, variable won't change still thinks checked. have ideas? help. update: so, need show code because works in way supplied (thanks commenters helping me realize that)... not in way being used on site. below please find code in entirety. everything needs happen in 1 function, because ui , data each ...

dynamic - Getting the values of a dynamically created control inside Telerik:RadGrid -

i have telerik radgrid adding columns dynamically on click of button. code follows : private void addcolumns() { try { datatable dtparmaintenancelistheaderdata = (datatable)session["parmaintenancelistheaderdata"]; foreach (datacolumn dc in dtparmaintenancelistheaderdata.columns) { dc.readonly = false; } if (!dtparmaintenancelistheaderdata.columns.contains("parcombodatafield")) dtparmaintenancelistheaderdata.columns.add("parcombodatafield", typeof(string)); dtparmaintenancelistheaderdata.acceptchanges(); foreach (datarow dreachrow in dtparmaintenancelistheaderdata.rows) { string cuscombo = dreachrow["cusfstnam"].tostring() + " - " + dreachrow["cuslstnam"].tostring(); string parcombo = dreachrow["parcod"].tostring() + " - " +...

unit testing - How to use FireUnit to test my web page? -

can please tell me how can test web page in fireunit? http://ejohn.org/blog/fireunit/ i played around last week , wrote few test cases. you'll want create test case file , include part of page. (perhaps use conditional "debug=true" prevent inclusion during production) i found .compare method useful. can write stuff like: fireunit.compare( "expected result", calltofunction2(), // tested "this test name" ); note since comparing strings here, if want json instead, you'll have json.stringify output first. upon running page included js file, you'll see test results under "test" panel of firebug. (assuming have extension installed)

vbscript - How to write a VBS Script to check a website and then stop and start a windows service -

i need write vbs script check website text : "service unavailable" , "error in /" when finds need restart windows service "world wide publishing service" where start? any appreciated! cheers! andy you can check on web site using msxml2.xmlhttp object (ie same object internet explorer uses fire ajax requests) , checking status code (200 status ok, 404 page not found etc) dim http: set http = createobject("msxml2.xmlhttp") http.open "get", "http://site.com?param=value", false http.send if not http.status = 200 ' not right, start service end if as far starting service concerned, this page has quite few examples of working services, of how start 1 (copied verbatim, not tested): strcomputer = "." set objwmiservice = getobject("winmgmts:" _ & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") set colservicelist = objwmise...

javascript - Moving an element to another location -

i want each row's first col content moved corresponding third column content. how do this? moving content parent's sibling identified colb class <tr> <td class="move"> <div id="move-0">move me 0</div> </td> <td class="cola"> <div>cola</div> </td > <td class="colb"> <div>colb</div> </td> </tr> <tr> <td class="move"> <div id="move-1">move me 1</div> </td> <td class="cola"> <div>cola</div> </td > <td class="colb"> <div>colb</div> </td> </tr> ... to: <tr> <td class="move"> </td> <td class="cola"> <div>cola</div> </td > <td class="colb"> <div>colb</div> <div id="move-0">move me 0</div...

cocoa touch - Realtime access to iPhone's camera images -

i'm trying read (average) rgb-value of center pixel(s) of iphone camera. should happen in realtime. therefore open uiimagepickercontroller, use timer take picture every x seconds. processing picture made in separate thread such not block app while computing rgb-value. tried several ways access rgb/pixel values of taken image, have problem slow , cause camera view lag. tried following: - (uicolor *)getaveragecolorofimage:(uiimage*)image { int pixelcount = kdetectorsize * kdetectorsize; cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); nsuinteger bytesperpixel = 4; nsuinteger bytesperrow = bytesperpixel * kdetectorsize; nsuinteger bitspercomponent = 8; unsigned char *rawdata = malloc(pixelcount * bytesperpixel); cgcontextref context = cgbitmapcontextcreate(rawdata, kdetectorsize, kdetectorsize, bitspercomponent, bytesperrow, colorspace, kcgimagealphapremultipliedlast | kcgbitmapbyteorder32big); cgcolorspacerelease(colorspace); cgcontextsetinterpolationquality(context...

android - Problems with calling from strings.xml -

i having problem calling string values strings.xml resource in android. strings.xml file below: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="name1">contact_name1</string> <string name="phone1">contact_phone1</string> </resources> and code calling string values is: private final string name1 = getstring(r.string.name1); private final string phone1 = getstring(r.string.phone1); i calling strings main.java extend activity , have context. problem when run app (physical device (evo) or emulator (api levels 5 - 8) nullpointerexception @ line first getstring() call located. have been on google's documentation, number of posts here , @ anddev.org no change end result. 1 please tell me whats wrong before pull of hair out!? strings.xml file in standard location ( <project_folder><res><values> directory) in same package rest of app. you c...

android - Only specific apps for action.send -

i want send link app. use following code: intent.settype("text/plain"); intent.putextra(intent.extra_subject, subject); intent.putextra(intent.extra_text, text); startactivity(intent.createchooser(intent, "share")); this brings dialog apps. filter list, i.e. remove blutooth app. how can remove apps dialog? you cannot "remove apps dialog" directly. you welcome use packagemanager , queryintentactivities() , present own custom dialog of stuff. however, not able reliably identify "the bluetooth app", since extent there might qualify on given device, may have different names based upon device manufacturer.

java - What is this component name -

Image
what name of component in java swing shown in following link http://www.scriptocean.com/template3.html it known extended listview in android. want know same in java swing. do mean component ? if so, display in java, have choices. if want items clickable (that's action senders), tend use jbuttons in vertical boxlayout 'ed jpanel if want display items, customize display, undoubtly go jlist way. take @ swing tutorial , of great help. edit accordint o comment, have area below button displaying content, you'll use second solution twist. elements in swing in fact jcomponents , can put in thers, you'll use jpanel jlist elements. in each jpanel, you'll have ione button visible , 1 sub-panel hidden @ startup. when clicking jbutton, you'll show or hide associated sub-panel. if want have kind of effect, can either wait upcoming javafx transitions effects use filthy rcih clients animations library (take @ links page).

Testing a server using Python script -

i want conformance testing of thttpd server. need use python scripts test it. can please share script test transmission , reception of data server? also, kind of possible tests need performed? there specific parameters tested? this can done using builtin urllib urllib.urlopen(yourserveraddress).read() you can other things urllib2 allow test more functionality. if want more intence tests might want build twisted reactor test functionality.

filewriter - How do I get Java to write the contents of an ArrayList to a file once every minute? -

just quick question above subject. basically, i'm writing piece of software captures data network , writes external file further processing. what want know code best use in order desired effect. thanks time david i'd implement using timertask . e.g., int hour = 1000*60*60; int delay = 0; timer t = new timer(); t.scheduleatfixedrate(new timertask() { public void run() { // write disk ... } }, delay, hour); otherwise quarts powerful java scheduler capable of handling more advanced scheduling needs.

c# - Why is my web server making calls to the URL in the TargetNamespace? -

we have c# webservice running on iis, , part of wsdl definition have following: targetnamespace='http://myappname.com' recently, networks team have told me there thousands of attempts being made web server, trying connect via our proxy server 'http://myappname.com' - bogus site doesn't exist. is correct? should iis making connection each time makes call our web service?

javascript - REST request to JAVA Servlet -

i have javascript want perform rest request (get) servlet. format of record want send in following format ... /id1/vara/varb/varc/timedelta1,timedelta2,timedelta3,....,timedeltan/ so there 5 attributes in each record send. need batch these - i'm sending multiple records in single request. url might little following. myservletname/id1/vara/varb/varc/timedelta1,timedelta2,timedelta3/id2/vara/varb/varc/timedelta1,timedelta2,timedelta3/id3/vara/varb/varc/timedelta1,timedelta2,timedelta3/ i'm aware on limit of around 2000 chars in url string keep things safe i'll ensure length of url less this. in above example 3 records sent servlet. i'm wondering how might process these on server end. havent worked rest before in java. need on server end process these urls extract data ? thanks basically public class restservlet extends httpservlet { public void doget(httpservletrequest request, httpservletresponse response) { string uri = request....

How to do conditional required field validations in ASP.net MVC2 -

i have 2 , 1 update user details change password panel. both has separate "update" button. don't want user details part validated when click on update button of change password , vice versa applies same. presently using following code in view. [required] [datatype(datatype.password)] [displaynamelocalized(typeof(capnorresource), "repeatnewpassword")] public string repeatnewpassword { get; set; } in ui following code. <div class="passwordtd"> <%: html.labelfor(view => view.repeatnewpassword)%> <%: html.passwordfor(view => view.repeatnewpassword)%> <%: html.validationmessagefor(view => view.repeatnewpassword)%> </div> i'm not quite sure wording of question, 2 different buttons, sounds 2 different forms 2 different viewmodels. viewmodels make 1 large viewmodel, or use renderpartial separate them completely.

wpf - Collection Control and Attached Property -

i have 2 questions: 1) want create collection control can use in xaml this: <local:mycollection x:key="mc"> <local:mycollection.groups> <local:mycollectiongroup x:name="cg1"/> <local:mycollectiongroup x:name="cg2"/> </local:mycollection.groups> </local:mycollection> <textbox local:collectioncontrol=mc/> how can this? 2) similiar above. <local:mycollectiongroup x:name="cg1"/> <local:mycollectiongroup x:name="cg2"/> <textbox local:collectioncontrol=cg1,cg2/> have looked using compositecollection? http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx typically you'd like <local:mycollection x:key="mc"> <compositecollection> <local:mycollectiongroup x:name="cg1"/> <local:mycollectiongroup x:name="cg2"/> </compositecollect...

iphone - Which is this NSDateFormatter style Friday, December 18th -

i want know date format friday, december 18th , standard date format or have hard work this. thanks. i don't think th possible achieve via formatters. although can this: nsdate *today = [nsdate date]; nsdateformatter *dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"eeee, mmmm d"]; nsstring *datestring = [dateformat stringfromdate:today]; nscalendar *cal = [nscalendar currentcalendar]; unsigned unitflags = nsyearcalendarunit | nsmonthcalendarunit | nsdaycalendarunit; nsdatecomponents *dtcomp = [cal components:unitflags fromdate:today]; switch ([dtcomp day]) { case 1: case 31: case 21: datestring = [datestring stringbyreplacingoccurrencesofstring:[nsstring stringwithformat:@"%i",[dtcomp day]] withstring:[nsstring stringwithformat:@"%ist",[dtcomp day]]]; break; case 2: case 22: datestring = [datestring string...

Magento - importing images from a 3rd party XML file -

i wondering how i'd upload images 3rd party xml feed use products images? i've seen use of addimagetomediagallery() unsure i'd need do. my assumptions are: 1) need download images folder xml feed 2) pass image path addimagetomediagallery method , set image, small_image , thumbnails 3) call method thanks ok, solution download images using curl , save them to: media/import then use following: $product->addimagetomediagallery(mage::getbasedir('media') . ds . 'import/' . $filename, array('image', 'small_image','thumbnail'), false, false); where $filename filename of image on server. thanks looked!

JavaScript to generate/render dynamic HTML form from JSON or similar data? -

i offer viewers contact form modified according user's input. example of such form on ext js site . have not looked product, know if there other programs/functions generate such form dynamically? found samples on adding other input elements existing forms. here other implementations: http://neyeon.com/p/jquery.dform/ (depends on jquery) http://neyric.github.com/inputex/ (depends on yui) http://robla.net/jsonwidget/ i plan add functionality own js-forms library, handle validation.

silverlight - WCF RIA Service hosted outside IIS -

i have need host wcf ria services outside iis on client machine. after reading following threads: http://forums.silverlight.net/forums/p/182302/413287.aspx can wcf ria services self hosted? http://forums.silverlight.net/forums/p/213861/512468.aspx http://social.msdn.microsoft.com/forums/en-ca/silverlightdeveloper/thread/804341f3-9f1e-420b-9cdc-c1334bd9302f i gave on idea due "aspnetcompatibilityrequirementsattribute" ria service uses , started researching alternative solutions. however, yesterday read more visual studio lightswitch , fact uses wcf ria services internally. lightswitch, can deploy appliction in 2-tier scenario on desktop gets installed using clickonce , runs silverlight out-of-browser application can access data without connectiong iis. does know how can accomplished? thank in advance lightswitch uses visual studio's cassini server in 2-tier scenario. don't know more how it's hosted. in summary, it's still asp.net com...

why cannot an emulator send email in android -

i looking code send email android application. have googled , read code given not run on emulators. have put code on actual devices send email. why so? thank in advance this migh helpful android email intent if using emulator, you’ll need configure email client. if email client not configured, not respond intent we’ll discussing. if want see chooser in action, you’ll need configure device using multiple messaging applications, such gmail application , email application. but using phone might way better , easy sure.

sql server 2005 - How do you do to keep useless datas with good performance? -

environment : sql server 2005, windows server 2003 the system in question online booking system. in it, can create special offers. a special offer has period of validity. we keep in our database every period entered our client if period in past. have keep these periods. the system exists since 10 years of periods in database past. the problem : to select periods special offer long i select special offers no valid period associated, have select offers , periods, , after remove offers doesn't have valid period. how manage kind of case ? there built-in tool ignore part of data in case ? you can speed things adding right indexes, if doesn't (enough) can think creating second table archive past offers in. way, won't bothered old data, if need (for reports or other reasons) can still refer archive.

Best and fast way to list a local drive's root folders and files and the size of them in php? -

e.g: local drive c: folder1 346mb folder2 567mb .... file1 345mb file2 343mb .... because have thousands of folder or files in local drives , , want display in web page , remove them web page base on total access times . , folders or files have no access deleted!so way or have others better!? any idea help!! [update] i found windows tool calculate folder size command line . disk usage v1.34 . return folder , their's size. , question: which faster.php or internal command line tool!? thank yo much!! use shell command .

iphone - becomeFirstResponder: automatically scroll to the UIControl that becomes first responder -

i have grouped uitableviewcontroller 1 section , many rows. each cell consists of 2 elements: uilabel description , uitextfield input. form, say. on bottom button "next" go next view. before that, validate uitextfield 's: if user hasn't filled field, field should focus, user sees needs enter something. tried this: [inputfield becomefirstresponder]; remember, button pressed on bottom of view , imagine uitextfield on top . in situation, field doesn't focus because far away. when scroll , field gets visible, field becomes first responder , gets cursor :-) conclusion: becomefirstresponder worked, not wanted to. don't want scroll finger, field should focus , visible automatically. is there way "jump" directly field? use alternative becomefirstresponder ? scroll field automatically? thanks help! if know index of cell uitextfield want edit, use nsindexpath* indexpath = [[nsindexpath indexpathwithindex:your_section_index] in...

Grails service not saving Domain Object When triggered by Message Queue -

i have grails application has service creates reports. report defined as: class report { date createdate string reporttype list contents static constraints = { } } the service generates report , populates contents list returned createcriteria . my problem service claims saving report, no errors turn up, logging says there, when go call show controller on report, says contents null. another relevant bit, service called activemq message queue. message originating report controller. controller: class reportcontroller { def scaffold = report def show = { def rep = report.get(params.id) log.info("report " + (rep? "not null" : "null")) //says report not null log.info("report content " + (rep.contents? "not null" : "null")) //always says report.contents null. redirect(action: rep.reporttype, model: [results: rep.contents, resultstotal: rep.contents.size...

Bitmap Image Output in C -

i'm working on small project in c , @ 1 point, need write picture content of array file. have run on embedded system @ point, additional libraries not option. the code have far works (in modified version) rgb, fails 8bit grayscale. this stripped down version of code far: http://pastebin.com/u1uyaput as suspect header broken in way, question comes down to: correct header bmp file 8bit grayscale? your code a lot simpler if ditched bmp , wrote images pgm files instead. format lot more portable , easy work in code. both formats uncompressed data rates same. thing lose ability view images natively on windows systems -- whether or not big deal depends on requirements. here examples . edit at least, if write images in pgm and broken bmp, can use imagemagick reliably convert pgm working bmp. compare headers of working , broken bmp images using binary diff tool , fix bmp writer, if required.

icefaces - JSF and links: the target property doesn't work? -

i need render simple link in page open pdf file in new browser window. wrote following tag: <h:commandlink target="_blank" action="showpdf" title="show attached pdf" actionlistener="#{bean.doshowpdf}" value="show pdf"> <f:attribute name="path" value="#{bean.pdfpath}" /> </h:commandlink> the target attribute seems ignored. destination page appear on current. i tried h:outputlink: <h:outputlink target="_blank" title="show attached pdf" value="/visattached.jspx"> <f:param name="path" value="#{bean.pdfpath}" /> show pdf </h:outputlink> but same result. generated html , in both cases, has not target attribute. where's fault? there better strategy in jsf show file in new browser window? try ice: ve...

ant - How to invoke a macrodef from within another file -

i wrote small macrodef in separate file: macrodefs.xml <macrodef name="do-cool-stuff"> <attribute name="message"/> <sequential> <echo message="@{message}" /> </sequential> </macrodef> i got second file, main build file: build.xml <target name="build"> <!-- , --> <!-- cheking out macrodefs.xml via cvs --> <ant antfile="macrodefs.xml" target="do-cool-stuff" > <property name="message" value="hello, world!" /> </ant> </target> as might guess dosen't work. error message like: target 'do-cool-stuff' not exist in project. the possible solution found provide target in macrodefs.xml forward ant calls. is there possibility invoke macrodef within file? thanks in advance. you can import file , use macro this: <import file="macrodefs.xml" /> <do-cool-st...

accessibility - Android Instant Speech to Text voice recognition -

i don't have experience android, asked hearing-impaired friend if there way "stream" voice text on mobile device. i've used , looked android built in api, seems sends speech off processing after speech input completed. i'm looking works contiguously (similar how dragon works microsoft word). perhaps there app this. if not, there way implement current android os/api? any suggestions appreciated. as you've mentioned, speech-to-text recognition sent google processing. can take enormous computing power, current devices can't handle (yet). because processed server-side, won't able immediate speech recognition in real time directly on phone. it's possible has created 3rd-party library this, i'm not aware of any. so, have significant limitations or reduced accuracy.

ruby on rails - can you use activerecord to find substring of a field? (quick & dirty keyword finder) -

suppose database contains field 'keywords' , sample records include: "pipe wrench" "monkey wrench" "crescent wrench" "crescent roll" "monkey bars" is there way in activerecord find records keyword field contains substring "crescent"? (it's quick , dirty lookup quick concept prototype) yeah, use statement in mysql. in rails 2.x: table.find(:all, :conditions => ['keywords ?', '%crescent%']) in rails 3.x: table.where('keywords ?', '%crescent%').all

graph - How to set Guide's Title in amChart? -

i using bundle chart ( amchart ) of line area type. display text inside plot area, using following: <title> reach: 256 </title> the dashed line option enabled start_value & end_value. problem dashed line strikes through title ( i.e. reach: 256 ). possible give margin line may not strike through/cut title? i have found answer: remove <end_date> tag , use start_value tag only.

visual studio - Making a good XY (scatter) chart in VB6 -

i need write application in vb6 makes scatter plot out of series of data points. the current workflow: user inputs info. a bunch of calculations go down. the output data displayed in series of 10 list boxes. each time "calculate" button clicked, 2 9 entries entered list boxes. one list box contains x coordinates. one list box contains y coordinates. i need to: scan through list boxes, , select x's , y's. another list box field change time time, varying between 0 , 100, , field needs differentiate series on eventual graph x's , y's go into. have series 1 6 (x,y) data points, series 26 6 data points, series 99 6 data points, etc. or 8 data points. or 2 data points. user controls how many x's there are. ideally, i'll have graph multiple series displaying info. i not allowed use 3rd party solution (e.g. excel). has contained in vb6 application. i'm trying ms chart, there seems documentation that. however, seems focus on pie ...

css - Prevent HTML elements from overlapping each other on smaller screens -

i have 2 elements on page aligned side side each other. element on left fixed. default screen resolution 1280x800. screen resolution decreases 1024x* or less, left , right containers tend overlap each other. there fix problem? how do it? -----------------------------------------------------------edit----------------------------------------------------------- actually, element right assigned pre-defined width , set margin:0 auto keep oriented center of screen. element right left vertical menu, , hence, want stay fixed when user scrolls page. hence i've specified position:fixed it. you client side, shrinking containers appropriately in window.onresize event handler.

android - Soundpool game with mp3 questions -

i making game using questions stored on mp3, each question there mp3 file. the user press play hear mp3 , add answer mp3 in edittext field. show correct or incorrect answer. when user clicks confirm answer mp3 move next question. when user presses play question 2. possible , if how go implementing this. highly appreciate advice on this. thanks. it recommended use wav or ogg format sounds on android, in case, can play mp3s mediaplayer class. example: mediaplayer mp = mediaplayer.create(youractivityclass.this, r.raw.your_mp3_resource); if(mp != null) { mp.start(); } read documentation regarding state , calling release() on finished mediaplayer objects. alternatively use 1 mediaplayer object setdatasource() , prepare() methods.

oracle11g - Is there a tool for tracing SQLs executed on Oracle -

is there tool (that comes oracle) tracing sqls have been executed? in db2 there called 'event monitor' use track tables have been updated. there equivalent tool in oracle? i plan to enable tracing go on website (that uses db) , change entry disable tracing see output file , record table has been updated. there table looking should updated when entry changed. not know name of table (and there many tables), , need trace sql executed find out. i have tried: alter session set sql_trace = true; -- go on website , change entry alter session set sql_trace = false; tkprof the_trace_file.trc file.out explain=system/manager sys=no however when following steps above, no sqls recorded. is there tool oracle provides? (i avoid downloading external software) there table looking should updated when entry changed. not know name of table (and there many tables), , need trace sql executed find out. i'm thinking using word "trace...