Posts

Showing posts from January, 2011

iphone - MKAnnotation protocol -

im currrently going through geolocation tutorial adopts mkannotation protocol class. the tutorial suggests create following methods in theannotation.h class + (id)annotationwithcoordinate:(cllocationcoordinate2d)coord; - (id)initwithcoordinate:(cllocationcoordinate2d)coord; and in implementation + (id)annotationwithcoordinate:(cllocationcoordinate2d)coord { return [[[[self class] alloc] initwithcoordinate:coord] autorelease]; } - (id)initwithcoordinate:(cllocationcoordinate2d)coord { if ( self = [super init] ) { self.coordinate = coord; } return self; } the second method called in viewcontroller theannotation *annotation = [[simpleannotation alloc] initwithcoordinate:coords]; i understand second method im puzzled inclusion of first. class method isn't called @ other place in example tutorial , im struggling understand why use class method in case. you can omit class method in cases useful because provides mechanism create 'temporar

c# - XNA Bloom Sample - Blank purple screen -

i have placed 2 bloom classes project bloom sample , followed same steps sample, although when start project, getting blank purple screen? i'm not getting error or anything, did literally include 2 bloom classes sample, added component , placed begin draw call in main draw function in sample. have other render targets in project they're not being used right away. if take out bloom stuff normal. call begindraw() function, infamous blank purple screen... does have idea why getting this? jamie. the best way diagnose kind of problem use pix (in directx sdk). the purple colour indicates render target contents have been cleared framework. this blog post explains why , offers solutions. put simply, cannot draw stuff back-buffer, switch render target, , switch back-buffer again , expect drawn still there. @ least not on xbox 360 - , pc version of xna framework emulates behaviour. if you'd able switch back-buffer , have unscathed, can change rendertarget

f# - FSharpChoice in C# -

i trying use fsharpchoice type in c# project. have created choice so var = fsharpchoice<t1,t2,t3>.newchoice1of3(instoft1); now how instoft1 out of choice type. i see can ischoice1of3 how value in choice object? cast value fsharpchoice<t1,t2,t3>.choice1of3 , use item property. see compiled form of union types use other cli languages in f# spec more information how discriminated unions represented.

image processing for a noob -

i have been given project need write code such parts of images. example project require me extract river part scenery or so. have no experience in context. please tell me start studying form. books? technologies need learn. tools helpful? opencv complete free image processing library. there book describes both library , image processing techniques. this reasonably complex problem, not graduate research challenging! see this question list of other books.

entity framework - Handle generation of non-identity primary key -

we have tables don't have identity primary key. costly change because of interoperability. i'm thinking handling objectcontext's savingchanges event set values. (pseudocode) void savingchanges(context) { foreach (var entity in context) { if (entity.hasidentity) continue; entity.primarykey = getnextprimarykey(entity.type); } } i can think of using separate connection accomplish this. , yes, getnextprimarykey otimized reduce number of roundtrips, guess suficient explain overall idea. would work? should try different? this depends upon logic within method getnextprimarykey. if method executed in multiple threads have chances of same key being assigned multiple objects. buti if getnextprimarykey advances key , returns new key, regardless of whether used or not, there no problem. but if logic find out last used key , key + 1, in multithreaded situations or web applications, have conflicts. best use sort of stored proced

java - Whats the best way to inject same instance of service in service for Spring AOP -

i'va serviceimpl annotated @service stereotype of spring , have 2 methods in each 1 annotated custom annotations intercepted spring. @service public class serviceimpl implements service{ @customannotation public void method1(){ ... } @anothercustomannotation public void method2(){ this.method1(); ... } } } now spring uses proxy based aop approach , hence i'm using this.method1() interceptor @customannotation not able intercept call, used inject service in factoryclass , in way able proxy instance - @anothercustomannotation public void method2(){ somefactory.getservice().method1(); ... } i'm using spring 3.0.x, best way proxy instance? the other alternative use aspectj , @configurable. spring seems going towards these days (favoring). i if using spring 3 faster (performance) , more flexible proxy based aop.

php - How to display private (or draft) Wordpress blog post outside blog -

i wordpress use edit tool , website renderer, don't want posts created website display on blog. did on website: created private post put on website this: define('wp_use_themes', true); require('blog/wp-load.php'); $args = array( 'post_status' => 'private', 'p' => '3019' ); query_posts( $args ); ?> unfortunately not work. when set p post id published works. when publish private post public works too. when post private not work. what make work? i think use get_posts easier.. http://codex.wordpress.org/template_tags/get_posts

migrations in rails (sqlite) -

hey have small problem rake class createevents < activerecord::migration def self.up create_table :events |t| t.integer :broadcast_id t.integer :position t.string :title t.string :location t.string :link t.text :description t.datetime :time end add_foreign_key :events, :broadcast_id, :broadcasts end def self.down remove_foreign_key :events, :broadcast_id, :broadcasts drop_table :events end end problem => add_foreign_key :events, :broadcast_id, :broadcasts $ rake db:migrate == createevents: migrating =================================================== -- create_table(:events) -> 0.0021s -- add_index(:events, :broadcast_id) -> 0.0004s rake aborted! error has occurred, , later migrations canceled: sqlite3::sqlexception: near "foreign": syntax error: alter table "events" add foreign key ("broadcast_id") references "broadcasts"(id) why defining for

jquery - jScrollPane autoReinitialise and animateScroll -

i have jscrollpane (jquery) problem i use jscrollpane on website. have dynamic content makes scroll-area larger. makes attribute autoreinitialise mandatory. want use animatescroll attribute, if use @ same time, scrollbar wil go mad (mad tell you!). does know what's that? http://www.bidadari.nl/?page_id=98 var pane = jquery("#scroll_area"); pane.jscrollpane({ autoreinitialise: true, showarrows: true, verticalarrowpositions: "split", horizontalarrowpositions: "split", animatescroll: true }); var api = pane.data("jsp"); jquery("#button_step_right").bind("click", function() { api.scrollbyx(750); return false; }); thanks! eric ah. correct answer was: var pane = jquery("#scroll_area"); pane.jscrollpane({ autoreinitialise: true, showarrows: true, verticalarrowpositions: "split", horizontalarrowpositions: "split", /// animates

width - Override and reset CSS style: auto or none don't work -

i override following css styling defined tables: table { font-size: 12px; width: 100%; min-width: 400px; display:inline-table; } i have specific table class called 'other' . table decoration should looks like: table.other { font-size: 12px; } so need remove 3 properties: width , min-width , display i tried reset none or auto , didn't help, mean these cases: table.other { width: auto; min-width: auto; display:auto; } table.other { width: none; min-width: none; display:none; } i believe reason why first set of properties not work because there no auto value display , property should ignored. in case, inline-table still take effect, , width not apply inline elements, set of properties not anything. the second set of properties hide table, that's display: none for. try resetting table instead: table.other { width: auto; min-width: 0; display: table; } edi

jquery - problem in remote ajax request -

excuse me,i using rails 2.3.8 . have remote form in popup. use javascript code submit post because need post in multipart. ok? the partial of form in popup is: <script type="text/javascript"> $j(document).ready(function() { $j('#product_submit').click(function(event) { event.preventdefault(); $j('#uploadform').ajaxsubmit({ beforesubmit: function(a, f, o) { o.datatype = 'json'; }, complete: function(xmlhttprequest, textstatus) { // xmlhttprequest.responsetext contain url of uploaded image. // put in image element create, or will. // example, if have image elemtn id "my_image", // $('#my_image').attr('src', xmlhttprequest.responsetext); // set image tag display uploaded image. } });

taskdef class com.sun.tools.ws.ant.WsImport cannot be found Following "The java web services tutorial" -

i saw same issue in many different locations , after portion of googling, not resolve it. trying (the bigger picture) go through the java web services tutorial , seems @ points out of sync, specially here , when try compile, following message: c:\javaeetutorial5\examples\jaxws\common\targets.xml:26: taskdef class com.sun.tools.ws.ant.wsimport cannot found i have tried many different combinations of placing jars or changing environment variables, no result. successful stories? the full build error message following: build failed c:\javaeetutorial5\examples\jaxws\helloservice\build.xml:4: following error occurred while executing line: c:\javaeetutorial5\examples\jaxws\common\targets.xml:26: taskdef class needed class com.sun.tools.ws.ant.wsimport cannot found: org/apache/tools/ant/dynamicconfigurator using classloader antclassloader[c:\program files (x86)\java\jdk1.6.0_23\lib\tools.jar] total time: 0 seconds and corresponding taskdef : &

.net - accessing a webservice through class library in .net3.5 vs2008 -

i had webservice directly accessing webform. used service reference in wesite , used serviceclient on webform worked fine. now removed service reference website , created class library hich consumes webservice same way usinfg service reference , service client in class. when try use class library gives me error no default endpoint found contract. had changed namespace of class library , changed in settings , assembly files. dll still has old name :( i've added reference of class library in website. where going wrong. if put wcf service reference class library, app.config binding information created in class library. unfortunately when reference library, config information isn't loaded. you need copy portion of app.config in class library main application's config area. make available when service called.

plsql - How do I display a field's hidden characters in the result of a query in Oracle? -

i have 2 rows have varchar column different according java .equals() . can't change or debug java code that's running against particular database have access queries directly against database using sqldeveloper. fields same me (they street addresses 2 lines separated new line or carriage feed/new line combo). is there way see of hidden characters result of query?i'd avoid having use ascii() function substr() on each of rows figure out hidden character different. i'd accept query shows me character first difference between 2 fields. try select dump(column_name) table more information in documentation . as finding position character differs, might give idea: create table tq84_compare ( id number, col varchar2(20) ); insert tq84_compare values (1, 'hello world'); insert tq84_compare values (2, 'hello' || chr(9) || 'world'); c ( select (select col tq84_compare id = 1) col1, (select col tq84_compare id = 2) col2

asp classic - VBScript Out Of Memory Error -

i have classic asp crm built third party company. currently, have access source code , able make changes required. randomly throughout day, after prolonged usage users, of pages start getting out of memory error. the way application built, pages , scripts pull core functions global.asp file. in file embeds other global files well, error presented shows out of memory whateverscriptyoutriedtorun.asp line 0 line 0 include global.asp file. once error occurs, after unspecified amount of time error occurence subsides time begins reoccur again. how application written, , functions uses, , "diagnostics" i've done - seems common used function withholding data such recordset or of nature , not releasing properly. other users try use same function , fills causing error. way me clear error restart iis, recycle app pool, , restart sql server services. needless say, myself , users getting annoyed.... i can't pinpoint error due actual error message

java - Google maps getdirections api - polyline -

i using google maps getdirections api . use json type webservice info google webservice. here sample json output webservice. using java process result. don't know how read polyline data. have given snippet of polyline object below. "polyline": { "points": "a~l~fjk~uowhjy@p", "levels": "b?b" }, the documentation says polyline contains object holding array of encoded points , levels represent approximate (smoothed) path of resulting directions. how read encoded data in java. i need decode both points , levels . sample java code snippet me lot. thanks. i think want: http://www.geekyblogger.com/2010/12/decoding-polylines-from-google-maps.html

python - How to run another process in a loop on a different thread -

i creating gui application(wxpython). need run (.exe) application gui application. subprocess perform operation on user action , return output gui application i running subprocess in loop, subprocess available execute. doing is, start thread(so gui not freeze) , popen subprocess in loop. not sure if best way. self.thread = threading.thread(target=self.run, args=()) self.thread.setdaemon(true) self.thread.start() def run(self): while self.is_listening: cmd = ['application.exe'] proc = subprocess.popen(cmd, stdout=subprocess.pipe, stderr=subprocess.stdout) proc.wait() data = "" while true: txt = proc.stdout.readline() data = txt[5:].strip() txt += data now happens is, if main application shutdown, thread still waiting user action never came. how can exit cleanly? application.exe process can still seen in process list, after gui app has

c# - Intercept the query that SqlCommand executes on the database -

is somehow possible intercept query given sqlcommand going execute on database? i'd track debugging purposes queries data class invokes, , can't find clever way this. i tried use weird "replace" of sql command string, or appending parameters funky sb.appendline("@" + p.parametername + " = " + p.todebugstring()); (with "todebugstring()" being extension method "tostring()" or without single quotes depending if it's string or not) but seems kinda unprofessional, , fails horribly when encounters an sqldbtype.structured parameter. more or less, i'd intercept db call inside application in same way sqlserver profiler inside db itself. thank in advance. big edit: i know given simple query this: select * mytable id=@id rather running this: select * mytable id=1234 the database runs procedure this: declare @id int set @id = 1234 select * mytable id=@id can intercept @ application level last bl

testing - How to list the slowest JUnit tests in a multi-module Maven build -

how can list slowest junit tests in multi-module maven build? this should accross modules. a hudson/jenkins solution do. disclaimer: apologize bash solution, although works , fits in 1 line :-). if impatient, go bottom. first need find test-*.xml files produced maven-surefire-plugin . run after mvn test in root directory of project discover test results in submodules: $ find . -iname "test-*.xml" fortunately format of these files pretty straightforward, simple grep , have need: $ grep -h "<testcase" `find . -iname "test-*.xml"` now sed magic extract invocation time, test case class , method name: $ sed 's/<testcase time="\(.*\)" classname="\(.*\)" name="\(.*\)".*/\1\t\2.\3/' there's nothing more left sort result , display longest running tests: $ sort -rn | head promised one-liner : $ grep -h "<testcase" `find . -iname "test-*.xml"` | sed 's/

Django {{site}} template context not working? -

this should super simple one. i'm pretty sure i've used context in past in templates linking purposes. belief built requestcontext instance somehow or other. the site_id record in settings file correct. i've included requestcontext instance views , have included contrib.auth app, may relevant in case. is {{site}} context somehow built in or should query sites object instance? thanks all, brendan django strives explicit, unlikely set context self. there has context processor sets {{site}} in settings.context_processors . i've checked django.core.context_processors , django.contrib.sites , there no such processor sets site . had third-party context processor that. it easy write context processor: myproject/context_processors.py: django.contrib.sites.models import site def site(request): return { 'site': site.objects.get_current() } myproject/settings.py: context_processors += ['myproject.

r - changing factors to numeric - how to cope with unavailable values -

i have big data set questionary. importing spss r (using spss's stata-output) gave me answer each question factor. a question has answers 1 10. however, there lot of missing values. r recoginzes them aswell. however, i'd calculations - example want calculate mean of answer (not statistics, know, never mind). so have make recode factors numerics. did as.numeric() . however, have missing values encoded 11 14. of course can't calculate mean this. what proper way recode factors numerics , tell r set value bigger 10 na? example: fish? not @ | don't know no answer don't tell r: 1 2 3 4 5 6 7 8 9 10 | 11 12 13 if don't need missing values, i'd like: a[a>10] <- na then, can use: mean(a, na.rm=true) alternately, if want work around missing values, can use: mean(a[a<=10])

ASP.NET MVC3 Model Binding on Edit -

i'm working on 5th or asp.net mvc webapp in past few years, , still haven't seen way take data submitted in edit/update form , save database efficiently when using orm linq sql or entity framework. just clear, problem create action can take object parameter: public actionresult create(questiongroup newgroup) with edit action, object must linked orm , updated, rather created scratch modelbinder do. i have solved problem 1 of 2 ways: either manually update each property on object (one line of code per property) or write method uses reflection find every property update , copies value over. i feel certain that, in version 3 of mvc, there blessed way better, cannot find it! what's secret more , gracefully?? well embarrassing... there method controller.updatemodel several overloads trick. searched internet hi , low, accidentally find answer intellisense right after posting question.

flash - how to get X,Y coordinates of a movieclip (inside another movieclip) but relative to the _root? -

i have movieclip inside movieclip... //create on stage empty movieclip... var mc_container:movieclip = _root.createemptymovieclip("container_name", _root.getnexthighestdepth()); //new position on stage... mc_container._x = 200; mc_container._y = 200; //create movieclip inside main movieclip... var mc_inside:movieclip = mc_container.attachmovie("mc_from_library", "mc_name", mc_container.getnexthighestdepth(), {_x:0, _y:0, _alpha:100}); i can mc_inside._x , mc_inside._y properties relative container movieclip, how can mc_inside._x , mc_inside._y relative _root (the stage)? use localtoglobal: var point:object = {x:myclip.inner_mc._x, y:myclip.inner_mc._y}; myclip.inner_mc.localtoglobal(point); trace(point.x) trace(point.y) http://help.adobe.com/en_us/as2/reference/flashlite/ws5b3ccc516d4fbf351e63e3d118ccf9c47f-7d06.html

c# - deleting a graph from an excel file -

i have function here takes worksheet , generates graph it. delete graph, excel sheet, after save have tried .delete() threw , error, how go doing that private void generategraph(worksheet worksheet, int lastrow, int lastcolumn, string filename) { string topleft = tocell(0, 0); string bottomright = tocell(lastrow - 1, lastcolumn - 1); worksheet.get_range(tocell(0, 0), missing).formula = "max(b2:" + bottomright + ")"; worksheet.get_range(tocell(0, 0), missing).formulahidden = true; worksheet.get_range(tocell(0, 0), missing).calculate(); range range = (range)worksheet.cells[1,1]; string small = (string)range.value2; double min = convert.todouble(small); worksheet.get_range(tocell(0,0),missing).formula = ""; //generates graph range = worksheet.get_range(topleft, bottomright); chartobjects xlchart = (chartobjects)worksheet.chartobjects(missing); chartobject chart = (chartobject)xlchar

when i click check all all the records is selected even in the next page records(in javascript table) -

i showing checkbox,article title,description,status in table(using javascript table sorting etc) when have 20 records,the table display 10 records per page,when click checkall records selected i.e 2 page records selected... i want ,when click checkall 1 page showing should checked... how in javascript? my script checkall this function checkall(){ $("input[type='checkbox']").each(function(){ if (this.checked == false) { //$("input[type='checkbox']").attr('checked', this.checked); this.checked = true; $("#checkall").val("uncheck all"); } else { this.checked = false; $("#checkall").val("check all"); } }); } try this: $("input[type='checkbox']:visible") to select visible check boxes

jquery - Adding a close button to a DIV that was appended on .click -

i have been working on jquery code interactive map. i've gotten fantastic user named "kevin gurney" on here, big him. i'm having little issue, , wondering if advise. basically, when user clicks on point on map, div appended full description of map point. want add closing "x" icon in top right of div, user can close it, seems first click event stopping second click event working. here some sample of code : $(".point").live("mouseenter", function() { //code show description $(this).append('<div class="mapitem-smalldescription">small description</div>'); }); $(".point").live("mouseleave", function() { //code show description $(".mapitem-smalldescription").fadeout("normal", function() { $(this).remove(); }); }); $(".point").live("click", function() { //code full description $(this).append('<div cl

c++ - Different sizes of lambda expressions in VS2010? -

out of curiosity, tested size of lamba expression. first thought was, they'd 4 bytes big, function pointer. strangely, output of first test 1 : auto my_lambda = [&]() -> void {}; std::cout << sizeof(my_lambda) << std::endl; then tested calculations inside lambda, output still being 1 : auto my_lambda2 = [&]() -> void {int i=5, j=23; std::cout << i*j << std::endl;}; std::cout << sizeof(my_lambda2) << std::endl; my next idea kinda random, output changed, displaying awaited 4 : auto my_lambda3 = [&]() -> void {std::cout << sizeof(my_lambda2) << std::endl;}; std::cout << sizeof(my_lambda3) << std::endl; at least in visual studio 2010. ideone still display 1 output. know of standard rule, lambda expression cannot appear in unevaluated context, afaik counts direct lambda use like sizeof([&]() -> void {std::cout << "forbidden." << std::endl;}) on vs2010 prompt

Firefox white flash upon certain javascript events -

this similar question: ( firefox-making-white-flash-as-it-builds-the-page ) difference in situation, page loaded. well after page has loaded, on javascript events trigger adding elements page, firefox produces white flash (not on entire page, not on specific div elements being added) covering large area of page (basically happens ancestor of div adding content to, not direct ancestor). the elements i'm adding in horizontally scrolling div, not page width gets changed @ all. also, not consistent. adding or removing elements triggers white flash, , other times not. i'm assuming issue way ff redraws page. i know question may little vague, wasn't sure if has had experience or has suggestions. advice appreciated.

c# - Q about AES (CBC) and IV (Is it possible to continue with aes(CBC) encryption? ,... ) -

i'm relatively new c# , encryption, please bear me. i'm writing data file , wanted encrypt using aes (cbc), i'll new data each day , wanted write data 1 file per week, month, year, depends on content. "server" restarted / shut down (it's not going real server) , wanted know if possible somehow (and save file) latest initialization vector after restart continue encrypting data , writing same file. when decrypt file somewhere iv of file , decrypt 1 iv? pseudocode: encryption: 1.) encrypting data according iv , key 2.) after data flow stops "special iv" saved 1 other file 3.) data flow stops, time passes, "server" shut down or restarted 4.) read "special iv" file , continue encryption 3. , 4. loop week, month, year decryption: 1.) read (somehow obtain) iv , key file 2.) decrypt file iv , key decryption should not notice encryption ever stopped , application exited, ... i've got no idea how realize this, h

email - VB.net sendmail smtp error -

i'm using following code send email vb.net web application. public function sendmail(byval strto string, byval strfrom string, _ byval strsubject string, byval strbody string) string try dim smtpserver new smtpclient() dim mail new mailmessage() smtpserver.credentials = new _ net.networkcredential("ns1.jasmine.arvixe.com", "<password>") smtpserver.port = 587 smtpserver.host = "mail.<mydomain>.com" mail = new mailmessage() mail.from = new mailaddress(strfrom) mail.to.add(strto) mail.subject = strsubject mail.isbodyhtml = true mail.body = strbody smtpserver.send(mail) return true catch ex exception return false end try end function it works fine when use personal live.co.uk email address strfrom value,

javascript - How to handle closing of a previously opened window -

i have form user fills out stuff. towards end click on link opens new window record video. once done recording close window. how can react closing of window on first window form? may want submit form automatically or have ajax request started display info etc... if isn't possible suggest? edit: parent window: function somealert() { alert("success"); } child window: window.onunload =window.opener.somealert(); if opened window.open, can call window.opener.somejavascriptfunctioninparent(); call window.onunload or right before window.close()

javascript - document.myform.checkbox.checked without a form -

i know mentioned on question (above) isn't possible, have problem here, have double tripe , on, forms inside page, , need submit form gets data inside previous forms. warning: started javascript 3 or 4 days ago, used server-side programming. let's see: javascript checks if checkboxes checked (several of them): function keepcount() { var newcount = 0; if (document.iphone3g.iphone3g1.checked) {newcount = newcount + 1;} if (document.iphone3g.iphone3g2.checked) {newcount = newcount + 1;} if (document.iphone3g.iphone3g3.checked) {newcount = newcount + 1;} if (document.iphone3g.iphone3g4.checked) {newcount = newcount + 1;} if (document.iphone3gs.iphone3gs1.checked) {newcount = newcount + 1;} if (document.iphone3gs.iphone3gs2.checked) {newcount = newcount + 1;} if (document.iphone3gs.iphone3gs3.checked) {newcount = newcount + 1;} if (document.iphone3gs.iphone3gs4.checked) {newcount = newcount + 1;} if (document.iphone4.iphone41.checked) {newcount = newcount + 1;}

iphone - using NSInteger in a loop -

do nsinteger occupies memory? should use in loop? look @ apple documentation, nsinteger : #if __lp64__ || target_os_embedded || target_os_iphone || target_os_win32 || ns_build_32_like_64 typedef long nsinteger; #else typedef int nsinteger; #endif it's 4 bytes on iphone, int, don't have worry memory.

MongoDB C# offi : Lat, Lng as doubles are stored at precision13 and rounding? -

i store lat , lng double in mondodb , c# official driver. have problems points not matching right places after rounding of double values internaly in mondodb(by driver or intern). have searched posible rounding before post repository haven´t found anything. why not use decimal, because query.near use doubles. v1.6.5 ; c#v0.11 ; win64. xx.444057295828145;xx.63416004180907 captured string xx.444057295828145;xx.63416004180907 receipt repository before save method inside mongodb , returned : xx.4440572958281, xx.6341600418091, saved , returned (only 13 after dot) this resulting moved map. advices. thanks. i use update method public void savegeopoints(string id, string lat, string lng) { //--> xx.444057295828145;xx.63416004180907 db.repository.update( query.eq("_id", id), update.set("lat", double.parse(lat)) .set("lng", double.parse(lng))); } the default format console.writeline prints 13 digits after

javascript - Performing Functions on a Dynamically Created Table -

i retrieving 30 bakery items mysql database dynamic html table using php. data retrieved product , item (primary key), weight , , price . code creates input box, called quantity , each item user can type in how many cases wants. below segment of code used generate dynamic table: $i=0; while ($i < $num) { $item=mysql_result($result,$i,"item"); $product=mysql_result($result,$i,"product"); $weight=mysql_result($result,$i,"weight"); $bgprice=mysql_result($result,$i,"bgprice"); echo "<tr>"; echo "<td>$product</td>"; echo "<td><input name=item size=5 value=$item readonly></td>"; echo "<td><input name=weight size=5 value=$weight readonly></td>"; echo "<td><input name=price size=5 value=$bgprice readonly></td>"; echo "<td><input name=quant

properties - What is the { get; set; } syntax in C#? -

i learning asp.net mvc, , can read english documents, don't understand happening code: public class genre { public string name { get; set; } } what mean: { get; set; } ? it's so-called auto property, , shorthand following (similar code generated compiler): private string name; public string name { { return this.name; } set { this.name = value; } }

osx - Bidirectional communication with AuthorizationExecuteWithPrivileges -

i need execute helper tool authorizationexecutewithprivileges , send data stdin, , read reply on stdout. can execute helper tool , read stdout via communicationspipe, if write stdin have close file descriptor send eof, otherwise helper tool waits indefinitely. since that's returned file descriptor opened reading , writing, how close write end, keep read end open? you write eof (see stdin.h define of eof) stdin. should it. communicate helper tool via named pipes or sockets, though helper tool have support that.

genetic algorithm - Has anyone tried to compile code into neural network and evolve it? -

do know if has tried compile high level programming languages (java, c#, etc') recurrent neural network , evolve them? i mean whole process including memory usage stored in graph of neural net, , i'm talking complex programs (thinking natural language processing problems). when neural net mean directed weighted graphs spreads activation, , nodes functions of inputs (linear, sigmoid , multiplicative keep simple). furthermore, people mean in genetic programming or there difference? neural networks not particularly suited evolving programs; strength tends in classification. if has tried, haven't heard (which considering barely touch neural networks not surprise, active in general ai field @ moment). the main reason why neural networks aren't useful generating programs represent mathematical equation (numeric, rather functional). given numeric input, numeric output. difficult interpret these in context of program more complicated simple arithmetic. ge

.net - How long does a GC take? -

we have theory gen 2 gcs introducing delays application, there way profile how long gcs take? there performance counters total time spent in gc , various info number of collections, heap sizes , on. see this article detailed instructions. if want quick @ application, use process explorer . can show of .net statistics process.

iphone - Multiple UIButtons 1 function -

basically need have several buttons in view. them call 1 function can keep track of 'state'. how can tell button called function? there anyway text of sender? in ios action methods, including ibaction methods, can have of following signatures (see " target-action in uikit "): - (void)action - (void)action:(id)sender - (void)action:(id)sender forevent:(uievent *)event if use method signature accepts sender have access object triggered action. can access properties on calling object including title , tag. can compare sender pointers may have buttons determine button sender of particular event. i favor comparing pointers because believe if (sender == self.nextpagebutton) easier understand , less break if (sender.tag == 4) or if ([((uibutton *)sender).currenttitle isequaltostring:@"foo"]) . looking @ tags in ib tells nothing code assumes mean , if or not important. titles change update ui or localize app , changes should not require code c

html - CSS z-Index with position: relative -

Image
i using css create "gantt-chart" style progress bar. it consists of empty progress bar, inside green bar represents expected progress. on top of should (thinner) black bar represents actual progress. the "actual" , "expected" bars independent - i.e. actual more or less expected, can't nest actual bar inside div expected. i want have number of these little progress bars, in gridview or repeater, can't use position absolute. how can z-index work actual bar sits "on top" of actual bar? the css have is: div.progressbarempty { height:11px; background-color:silver; border: 1px solid black; font-size: 0.1em } div.progressbargreen { position:absolute; top:0;left:0; height:11px; background-color:#00ff33; border-right: 1px solid black; font-size: 0.1em z-index:0; } div.progressbaractual { position:absolute; top:3;left:0; height:5px; background-color:black; border-sty

Google Custom Search does not return structured data which I entered using PageMap -

here page map added comment in head section <!--<pagemap> <dataobject type="document"> <attribute name="id">2067</attribute> <attribute name="title">empowering middle , creating workforce readiness</attribute> <attribute name="urltitle">empowering-the-middle-and-creating-workforce-readiness</attribute> <attribute name="category">business</attribute> <attribute name="briefdescription">join stacey harris , stacia garr share recent bersin & associates’ findings regarding impact of…</attribute> <attribute name="description">have given enough thought how empowering middle of organization? market has been focused on leveraging top talent, investing in high pote

c++ - How do I specify the .DLL search path for an MFC .EXE? -

how specify .dll search path mfc .exe? need relative path, not absolute. manifest file for? have @ setdlldirectory ().

Windows Installer changing file last modified dates -

so created windows installer deploy variety of dlls, batch files, , config files. problem reason after files installed on system last modified dates changed time installer deployed them. this problem because system files installed validated , important modified dates accurate possible. has seen behavior before windows instalers? standard behavior of windows installers, or did wrong? thanks in advance. this happens because package installs copies of files, doesn't install actual files. when copy created, it's last modified date same creation date (when copied). an installed application shouldn't rely on modified date of it's files. why of them use configuration files or registry entries. example save these dates in file when creating package.

iphone - doesnt remove cells -

i have custom uitableview allows user select multiple images. problem delete method isnt working. i keep track of selected images , when user confirms delete images removed array , table should update. the call [self.tableview reloaddata] not removing cells tableview. how can achieve this? how can call - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { or similar force table check data source , redraw cells? looking @ scenario , can perform thing in 2 ways 1)using reloaddata function while using please make sure 2 thing when choose delete cell first check whether particular record has been deleted @ indexpath want be. secondly once data deleted array after use [self.tableview reloaddata] or [objectoftableview reloaddata]. way works fine. but apple has provided methods remove cells table effects.so it's use below way. 2)way prefer use since looks great in app uitableview. (void)tab

database - Happstack-state concept and docs? -

i'm starting making haskell web server. i've decided start happstack , happstack-state. , i'm feeling hard understand concept , attribute of happstack-state. new kind of database? or object-graph system? can explain it's concept , attribute (especially acid, how persistent data on disk!) or point me document describes well? here 2 basic introductions macid: http://happstack.com/docs/crashcourse/happstackstate.html#happstack_state http://www.kuliniewicz.org/blog/archives/2009/04/05/happstackstate-the-basics/ alas, neither covers ixset, datatype used macid provide sets multiple indexes (similar sql table). macid "ram cloud" style persistent store, meaning entire dataset stored in ram. supports replication. development version focused on adding sharding support (among other things). the thing makes macid unique stores normal haskell dataypes , queries written using normal haskell functions. not limited small subset of haskell datatypes su

string - How to use calloc() in C? -

shouldn't error if string goes on 9 characters long in program? // cstring.c // 2.22.11 #include <stdio.h> #include <stdlib.h> #include <string.h> main() { char *astring = calloc(10, sizeof(char)); if (astring == null) { return 1; } printf("please enter word: "); scanf("%s", astring); printf("you typed in: %s\n", astring); //printf("string length: %i\n", strlen(astring)); } thanks blargman you don't compiler error because syntax correct. incorrect logic and, undefined behavior because writing memory past end of buffer. why undefined behavior? well, didn't allocate memory means doesn't belong -- intruding area closed off caution tape. consider if program using memory directly after buffer. have overwritten memory because overran buffer. consider using size specifier this: scanf("%9s", astring); so dont overrun buffer.

Back-end performance testing for apache wicket -

we create app based on apache wicket , i'm working on performance testing it. i'm familiar jmeter it's first choice load generate tool end performance testing. but, looks can't record "ajax call" actions our app according wicket's behavior. i'm using grinder, not work well. i'm thing using htmlunit instead of jmeter back-end web app performance load testing. so have better choice? thanks in adv. i jvisualvm in jdk/bin (1.6+?), jvm monitor eclipse plugin works fine me we doing performance testing of wicket page rendering, seen many comparisons on web, cannot close it, on average desktop 100 threads 2-10 times more memory usage , 10-100 times longer response times, havily dependant on parameters (compared pure jsp) any similar experience? later spotted, if threads pre-initialized, response time 6-10x longer , memory usage lower (lets assume same) after server start sent many requests many threads server designed handle,

iphone - how can i make my UIImage autoSizing -

in area of uiview, want display uiimage, width , height of not determinate. want uiimage can autosize determinate size. thanks!! not problem. if want adjust image view height , width according view use thing this, float height=yourview.height; float width=yourview.width; cgrect imageframe=yourimageview.view.frame; //set these values according imageframe.size.height=height-50; imageframe.size.width=width-50; imageframe.origin.x=20; imageframe.origin.y=40; yourimageview.view.frame=imageframe;

cassandra upgrade from 0.6 to 0.7.2 -

i followed instructions in news.txt upgrade cassandra 0.6 0.7.2. instructions are: process upgrade is: 1) run "nodetool drain" on each 0.6 node. when drain finishes (log message "node drained" appears), stop process. 2) convert storage-conf.xml new cassandra.yaml using "bin/config-converter". 3) rename of keyspace or column family names not adhere '^\w+' regex convention. 4) start cluster 0.7 version. 5) initialize keyspace , columnfamily definitions using "bin/schematool import". you need 1 node . i did first 3 steps. drain node, stop cassandra 0.6, convert old storage-conf.xml cassandra.yaml. start cassandra 0.7.2 using: "bin/cassandra -f". complains following errors. wondering whether followed right instructions. if so, how fix problem? "fatal configuration error org.apache.cassandra.config.configurationexception: saved_caches_directory

xfbml - Facebook Connect Facepile error -

i've developed simple website using facebook connect, , has been working fine last month or so. underneath fb:login-button code fb:facepile. has worked expected until today, when instead of showing friend's pictures displays facebook homepage. here screenshot of problem http://i.stack.imgur.com/nzsbq.png here relevant code. worked @ 1 time, i'm confused happened cause weird error. appreciated. <div id="fb-root"></div> <script type="text/javascript"> window.fbasyncinit = function() { fb.init({appid: '<?php echo $appkey; ?>', status: true, cookie: true, xfbml: true}); /* events registered */ fb.event.subscribe('auth.login', function(response) { // response login(); }); fb.event.subscribe('auth.logout', function(response) { // response logout(); }); }

how to use the token in drupal? -

i have installed token module, don't know how use it. have searched lots of time.and don't find tutorials of it. expect can make me example use it. in views module. thank you. the token module provides centralized api using placeholders replaced text. start off, suggest reading module documentation , see list of modules use token. in essence takes token [user-name] , replaces enjoylife or whatever username is. you cannot use token in views such. can use in cck, node body, node title etc. which, in turn, can used in views. one simple example of tokens pathauto module — go /admin/build/path/pathauto , check of 'node paths' suggestions.

Is there an Objective-C library that does the same thing as Ruby-English Gem does? -

http://english.rubyforge.org/ require 'english/inflect' "boy".plural #=> "boys" "ox".plural #=> "oxen" "boys".singular #=> "boy" "oxen".singular #=> "ox" there isn't provided apple , haven't heard of third-party libraries can in objective-c.

php - Drupal 6 Adding comment field in a view list of nodes creates duplicates -

i have view list of nodes , part of each line returned show last comment per node. unfortunately, view creates multiple copies of each node - 1 each comment thats been added how can restrict 1 line each node last comment body added? after googling found answer @ http://drupal.org/node/727106#comment-4133208 . however if have better idea, please post here beginners.

android - textview overflowing out of the screen -

Image
i have problem create x number of textview in layout store 1 character in each text view. however when text gets long, text not go next line , overflowed out of screen is there anyway me keep textviews in 1 screen? linearlayout linearlayout = new linearlayout(this); linearlayout.setlayoutparams(new layoutparams(layoutparams.fill_parent, layoutparams.fill_parent)); textview[] tv = new textview[counter]; float textsize = 65; (int = 0; < counter; i++) { tv[i] = new textview(this); tv[i].setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); tv[i].settextsize(textsize); tv[i].settext(""+singletext[i]); linearlayout.addview(tv[i]); } setcontentview(linearlayout); i think should try using textview.setsingleline(false) then not have issue of text overflow.

Are there any W3C recomendations to add a local shared object (Flash) type system to javascript -

currently local storage javascript limited cookies, makes robust client side programs limited as start getting many kilobytes of cookie data servers start throw 400 errors. besides when comes saving client state in cases don't need server know whats going on. so i'm asking know if local shared object type thing on books future of javascript? there's html5 localstorage , sessionstorage. see: http://dev.w3.org/html5/webstorage/

Maps not working in the android emulator -

i trying google maps api example, when run code emulator gives error "the application has stopped unexpectedly". have put down logcat details below , attached the screenshot of error . 02-24 13:31:42.841: error/androidruntime(676): fatal exception: main 02-24 13:31:42.841: error/androidruntime(676): java.lang.runtimeexception: unable start activity componentinfo{net.learn2develope.googlemaps/net.learn2develope.googlemaps.mapsactivity}: android.view.inflateexception: binary xml file line #6: error inflating class com.google.android.maps.mapview 02-24 13:31:42.841: error/androidruntime(676): @ android.app.activitythread.performlaunchactivity(activitythread.java:1622) 02-24 13:31:42.841: error/androidruntime(676): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1638) 02-24 13:31:42.841: error/androidruntime(676): @ android.app.activitythread.access$1500(activitythread.java:117) 02-24 13:31:42.841: error/androidruntime(676): @ android

code injection - Can a php shell be injected into an image? How would this work? -

i remember seeing exploit image uploading function, consisted of hiding malicious php code inside tiff image. i'm making own image uploading script, , assume i'll have protect myself possibility. except, have no idea how work. know how php shell hidden inside image execute itself? need loaded in way? thanks. re encoding image not stop uploading shell. sure way prevent re-encode , scan image presence of php tags. for example of php png shell survive re-encoding

javascript - How to use progressmeter in an XUL application? -

this might simple question geeks, not me, @ least. developing simple xul program scratch. used wizard tag simplify gui appears user. on wizard page have inserted progressmeter show progress of function called myfunction() belongs javascript available in xul file. how can update progressmeter based on real progress of function? have tried setting progression of progressmeter using "value" property? myprogressmeter.value = 50; you need increment value depending on progression of function. note value should set between 0 , myprogressmeter.max

asp.net mvc 3 - Clear values in Razor MVC EditorTemplate -

i want create date, time , datetime editortemplate using mvc3 , razor. for now, let's focus on time (i can fix remaining templates later). @model datetime? @using mymvcapp.properties @html.dropdownlistfor(model => model.value.hour, new selectlist(new[] {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }, model.hasvalue ? model.value.hour.tostring("d2") : "00"), null, new { style = "width: auto; margin-left: 5px;" }) : @{ list<string> availableminutes = new list<string>(); (int minute = 0; minute < 60; minute += 1) { availableminutes.add(minute.tostring("d2"));

php - Analysing alogithm possibly based on regular intervals to check for bots and spiders -

i'm trying build script shows me list of ip's bots/spiders. i wrote script imports access log of apache mysql db can try manage php , mysql. i've noticed lot of bots have regular intervals, send out request every 2 or 3 seconds. there easy way of showing these patterns query or php script? or, harder think, there algorithm can recognise these bots / spiders. db: create table if not exists `access_log` ( `ip` varchar(16) not null, `datetime` datetime not null, `method` varchar(255) not null, `status` varchar(255) not null, `referrer` varchar(255) not null, `agent` varchar(255) not null, `site` smallint(6) not null ); official bots identify themselves. there's list @ http://www.robotstxt.org/db.html for unofficial ones guess try looking of following: page requests no other resource requests (images, css , javascript etc) strange url requests (lot's of requests login pages, ones don't exist such wp-admin on drupal site) suc

windows - Why python.exe stopped working? -

i try use opencv python. have 2 lines of code: import cv capture = cv.createfilecapture('test.avi') if run code command line, windows creates window following message: python.exe stopped working problem caused program stop working correctly. windows close program , notify if solution available. what can reason of that? i add details. not sure if relevant. in examples found people use cvcreatefilecapture instead of cv.createfilecapture . in case program generate nameerror (cvcreatefilecapture not found). in general able simple stuff opencv (so, installed , works). example able change format of image: import cv im = cv.loadimagem("test.jpg") print type(im) cv.saveimage("test.png", im) added "in opencv2.2\samples\python" found many *.py samples. run of them , work fine (i see animation , on). tried find file contains "createfilecapture". found 1 such file (minidemo.py) , run it. result got same problem described abov

actionscript 3 - How call the function that is in my main.mxml app from a as3 class in Flex -

i write sound playback class stop older sound , play new sound.after need method in class trigger when sound play complete.i achieve this, need inform main app (main.mxml) completion of sound playing. how ? in advance. here sound playback class. package com.m2b.data { import flash.events.event; import flash.media.sound; import flash.media.soundchannel; import flash.media.soundmixer; import flash.net.urlrequest; import mx.controls.alert; public class soundplayback { private var channel:soundchannel = new soundchannel(); private var sm:soundmixer = new soundmixer(); public var snds:sound; public function soundplayback() { // constructor function } /** call if need close previous sound , play new 1 **/ public function playsound():void{ // stopall method used close/shutdown sound // in domin describe in cross doamin soundmixer.stopall(); // play new sound. channel = snds.pla