Posts

Showing posts from January, 2010

windows - how to stop a running script in Matlab -

this question has answer here: how abort running program in matlab? 1 answer i write long running script in matlab, e.g. tic; d = rand(5000); [a,b,c] = svd(d); toc; it seems running forever. becasue press f5 in editor window. cannot press c-break stop in matlab console. i want know how stop script. current use task manager kill matlab, silly. thanks. matlab says this- m-files run long time, or call built-ins or mex-files run long time, ctrl+c not stop execution. typically, happens on microsoft windows platforms rather unix[1] platforms. if experience problem, can matlab break execution including drawnow, pause, or getframe function in m-file, example, within large loop. note ctrl+c might less responsive if started matlab -nodesktop option. so don't think option exist. happens many matlab functions complex. either have wait or don't use the...

Identifying a PHP problem that doesn't prints a ERROR and the code isn't yours -

i've make website works , don't know right now. can run in virtual machine ubuntu, on company's server in debian, on wamp... can't working in server client. i think problem gets. form can't modify sended get, using next url: http://domain.com/sgap/dades_proj_edit.php?idedit=2011854&id=&projectname=afsdfasdf&comptitle=asasfdafsdafs&codarea=eciv&grauimp=1&codtipus=2&codsubtipus=6&subtipusdef=fdsaafasfddfs&codpais=8&clientid=2&promotor=asdfa&entfin=fsdafadsfds&impcontract=2&initdate=21%2f01%2f2011&findate=30%2f01%2f2011&uteflag=false&utepartic=&utepercent=0&descprelim=fdsadasdadfsadfs&codprojstatus=1&statusstamp=25%2f01%2f2011&cruserid=&action=update firefox shows blanc page no error. i've tried force show errors error_reporting(e_all) , ini_set("error_reporting", e_all) show if happens wait page showed 0 errors. i supposed $_get error , tried put on to...

c# - How to force an asp.net control to reload the postback data? -

what best practice force postback data , viewstate data re-loaded on code behind? the reason ask is, have 1 gridview generated dynamically , when structure generated postback data loaded , want forse asp.net reload postback data once have gridview structure generated. how can achieve this? thanks i don't think possibe, it's not necessary anyway. need build gridview structure @ earlier page event (eg oninit ).

ajax - need guidance for this asp.net mvc scenario -

i developing small asp.net mvc base application online test/exam. have scenario like, when user ask load test, getting list of question objects list in index action of controller. requirement user should not able see questions @ time, rather 1 one question should appear. have kept estimated time each question, showing sum of time of question @ right top corner user can see time limit. timer reduces each second. confuse how keep run timer commonly questions. , how can render 1 one question rather ones. since there no postback in asp.net mvc ,the implementation scenario quite difficult. please guide edited: * can ? * [httpget] public actionresult index(int? testid) { int id = convert.toint32(testid); list<question> questionlist;// = new list<question>(); questionlist = questionmanager.getquestionsbytestid(id); if (questionlist != null) { foreach (question q in questionlist) { return redirecttoaction("loadnextqu...

c++ - Reducing time complexity -

int main() { int n ; std::cin >> n; // or scanf ("%d", &n); int temp; if( n ==1 ) temp = 1; // if n 1 number power of 2 temp = 1 if( n % 2 != 0 && n!= 1) temp =0; // if n odd can't power of 2 else { (;n && n%2 == 0; n /= 2); if(n > 0 && n!= 1) temp = 0; // if loop breaks out because of second condition else temp = 1; } std::cout << temp; // or printf ("%d", temp); } the above code checks whether number power of two. worst case runtime complexity o(n). how optimize code reducing time complexity? try if( n && (n & (n-1)) == 0) temp = 1; check whether number power of 2 or not. for example : n = 16 ; 1 0 0 0 0 (n) & 0 1 1 1 1 (n - 1) _________ 0 0 0 0 0 (yes) a number power of 2 has 1 bit set. n & (n - 1) unsets rightmost set bit . running time o(1) ;-) as @gman noticed n needs unsigned integer. bitwise operation o...

xcode - How to use Mailcore framework in my IOS project? -

i have download mailcore iphone https://bitbucket.org/mronge/mailcore/downloads .i have try build shows error no architectures compile (only_active_arch=yes, active arch=armv6, valid_archs=i386) so can't add mailcore framework ios project .please me find solution from getting started documentation on project: iphone use mailcore has included iphone target, requires additional compiled binaries (openssl , cyrusssl). unable provide these, company remail offering binaries , compiled copy of mailcore iphone. contact remail more information: mailcore@remail.com it seems you'd need before building against iphone target.

iphone - After updating XCode i got error -

this type of error occur when install sdk 3.2.5 ios 4.2 , run older project... older project run in previous version of xcode... code sign error: identity 'iphone developer' doesn't match valid certificate/private key pair in default keychain go project on left(groups & files column), right click on , select info. go build tab , code signing. under code signing identity, make sure select correct development profile.

c++ - Libtorrent library -

i using boost application when tried building using visual studio 9.0 1>link : fatal error lnk1104: cannot open file 'libtorrent.lib' how make libtorrent.lib . having trouble in ....if 1 having solution please me. the .lib not included in project. make sure linking in; configuration properties -> linker -> input -> additional dependencies another altnerative copy .lib project folder don't, it's bound create problems later on. sometimes .lib not shipped library, need compile yourself. readme tell this. if case, ship .sln file can open , compile .lib file reference in main application, wrote above

xaml - WPF: Using culture specific separators in StringFormat -

is there way use culture specific characters in wpf-stringformat? i'm trying format date show month , year separated culture specific ... uuh.. separator. here code: binding="{binding startdate.value, stringformat={}{0:mm.yyyy}, converter={staticresource startenddatetimeconverter}" what use replacement dot? i found solution. instead of '.' should have been using '/'-symbol separate months years.

Connecting the C++ class with the LUA table -

i trying connect 3d engine lua (5.1) parser. example, have lua class of vec3 , have c++ class of vec3. want them work eachother. this (part) of c++ class: class vec3 { public: vec3() {} vec3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} vec3 operator+(const vec3 &b) { return vec3(x + b.x, y + b.y, z + b.z); } float dot(const vec3 &b) { return x * b.x + y * b.y + z * b.z; } float x, y, z; } this (limited) lua version: vec3 = {}; vec3.__index = vec3; local mt = {} mt.__call = function(class_tbl, ...) local obj = {} setmetatable(obj, vec3); vec3.init(obj, ...); return obj; end vec3.init = function(obj, x, y, z) obj.x, obj.y, obj.z = x, y, z; end setmetatable(vec3, mt); function vec3:__tostring() return "(" .. self.x .. ", " .. self.y .. ", " .. self.z .. ")"; end function vec3:__add(b) return vec3(self.x + b.x, self.y + b.y, self.z + b.z)...

asp.net - Slow initial loading of Telerik.Web.UI.WebResource.axd under load -

we're using telerik.radscriptmanager dynamicly register resources depending on controls on page. these combined , served single .axd .js files. works fine long there no "heavy" load on page. under load inital loading of telerik.web.ui.webresource.axd takes 10s, reloading page afterwards instant (~10ms). file around 200kb in size , in firebug see browser "waiting" request. happens per user/browser, isn't cached globally on server. server cpus aren't stressed @ (<10%), bottleneck? takes long? hints investigate further? thx update: narrowed down radscriptmanager enablescriptcombine feature. disabling , there no performance impact anymore. have 20 more requests... idea how speed up? idea generate/combine script radscriptmanager , saving next page won't change.

Applescript to parse flickr url? Change size and add page link -

what mean, if have in clipboard instance: "http://farm6.static.flickr.com/5290/5377008438_8e3658d75f_m.jpg" can use applescript change "http://farm6.static.flickr.com/5290/5377008438_8e3658d75f_b.jpg" (changing "m" "b") ? this handy because right click/copy photo url thumbnails page without having drill down. yes, it's few clicks thumbnails page large size, can save nice. also, copy out photo id can link main photo page? ex: copy "5377008438" , paste main link "http://www.flickr.com/photos/dbooster/5377008438" i applescript because comes mind, call text expander work. manipulating url can done this: set baseurl "http://farm6.static.flickr.com/5290/5377008438_8e3658d75f_m.jpg" set modurl (characters 1 through -6 of baseurl text) & "b.jpg" set filename last item of (tokens of baseurl between "/") set photoid first item of (tokens of filename between "_...

android - Transparent 9patch image: line showing through -

Image
i got transparant 9patch image has 9patch lines showing trough. this output: obviously don't want horizontal lines visible. this how created 9patch: this final image used in application: afaik 9patch correct. need change in order horizontal lines disappear? the unwanted lines come fixed (non-stretched) parts of ninepatch overlapping. happening because drawing @ pixel height smaller sum of heights of fixed sections. as @kcoppock said above , curiously retracted, left hand edge should solid black vertically stretchable.

java - Create VolatileImage always return null -

i creating volatile image in following class, hitting nullpointerexception every time. reason why createvolatileimage() returning null (from javadoc) graphicsenvironment.isheadless() true. import java.awt.graphics; import java.awt.graphics2d; import java.awt.renderinghints; import java.awt.image.volatileimage; import javax.swing.jpanel; public class tube extends jpanel { private volatileimage image; private int width, height; public tube() { super(true); } public tube(int width, int height) { this.width = width; this.height = height; createimage(); } @override protected void paintcomponent(graphics g) { super.paintcomponent(g); if(image == null) createimage(); if(image.validate(getgraphicsconfiguration()) == volatileimage.image_incompatible) createimage(); graphics2d g2 = (graphics2d) g; g2.setrenderinghint(renderinghints.key_antialiasing, ...

saving the image on click of button in android -

i developing android application involves camera user clicks on click button, automatically image saved in sd card.. have googled it,, can tell me how pursue it....thanks in advance tushar have at 1) this link 2) this discussion ..

Android, Java & 2d Drawing -

been trying draw onto android view outside ondraw(canvas canvas) method. @overrides public void ondraw(canvas canvas) { c = canvas; canvas.drawline(0, 50, 100, 50, paint); invalidate(); } i want keep above displayed, while drawing character onto screen - depending on xposition , yposition. public void drawplayer(int x, int y){ c.drawcircle(x, y, 5, paint); } i'm pretty new 2d graphics in java & android. thanks in advance you need follow pattern this: private boolean isplayervisible = false; private int playerposx; private int playerposy; @overrides public void ondraw(canvas canvas) { c = canvas; canvas.drawline(0, 50, 100, 50, paint); if (isplayervisible) { paint paint= new paint(); paint.setcolor(0xffffffff); paint.setstrokewidth(1); c.drawcircle(playerposx, playerposy, 5, paint); } } private void setplayerspos(int x, int y) { playerposx = x; playerposy = y; isplayervisible...

Mysql: what to do when memory tables reach max_heap_table_size? -

i'm using mysql memory table way cache data rows read several times. chose alternative because i'm not able use xcache or memcache in solution. after reading mysql manual , forum topic have concluded error raised when table reaches maximum memory size. want know if there way catch error in order truncate table , free memory. don't want raise limit of memory can used, need way free memory automatically table can continue working. thanks. if you're out of memory, engine raise error 1114 following error message: the table 'table_name' full you should catch error on client side , delete data table.

iphone - how can i get object from tag? -

i have 1 view .in view have 2 buttons . i know tag of button . want change image of button. how can change image tag? uibutton *button = (uibutton *)[myview viewwithtag:mytag]; [button setimage:... forstate:...];

php - Zend Frameworks - separation of content return type? -

i develop set of custom ajax/rss/etc functions, both abstract, , ones used in controllers. thinking of separating these methods based on return type. i have controller enormous if don't break down logic. i thinking maybe module - modules/admin/analyticscontroller modules/ajaxapi/analyticscontroller modules/rssapi/analyticscontroller any advice appreciated! have considered using or overriding or creating own context switcher. can read more here http://framework.zend.com/manual/en/zend.controller.actionhelpers.html this has features need without needing create new controllers each action.

javascript - uncaught exception error "Illegal operation on WrappedNative prototype object" -

is there idea why following javascript/jquery code might produce error message: uncaught exception: [exception... "illegal operation on wrappednative prototype object"] ? code: function deletereceipt(id){ var $delconfdialog = $('<div id="dialog-confirm"></div') .html('are sure want delete receipt?') .dialog({ autoopen: true, title: 'delete confirmation', buttons: { "delete": function(){ $.post('receipt.py',{'cm':'delete','receiptid': obj},function(){ $('#receiptrow'+id).remove(); }); $(this).dialog('close'); }, "cancel" :f...

visual studio 2010 - Counter question -

i'm using visual studio 2010. have problem related code. problem have 2 pcs. have counter software, timer code on first pc. main problem is, when counter software stopped on first pc, counter on other computer should stop (without sql connection) thanks in advance. you implement service on second box accept "stop" request first box. use... a wcf service (tcp/ip, iis hosted etc) a web service (iis hosted) then call service first box, counterservice.stopcounter(); tutorial on writing wcf service: http://blah.winsmarts.com/2008-4-writing_the_wcf_hello_world_app.aspx

Issues with case and collation when my SQL Server database is set to Latin1_General_100_CI_AI -

my sql server 2008 database set latin1_general_100_ci_ai collation, yet when query database using management studio still accent sensitive. missing? also, folowwing message when joining 2 tables on nvarchar. tables both on same collation too. cannot resolve collation conflict between "latin1_general_100_ci_ai" , "latin1_general_ci_as" in equal operation. any gratly appreciated. try casting 1 of fields other field's collation: select * as_table join ai_table on ai_field = as_field collate latin1_general_100_ci_ai or select * ai_table join as_table on as_field = ai_field collate latin1_general_100_ci_as note casting field makes predicate unsargable against index on field.

error handling - What is the best way to define an autoloader function in PHP that can show which line caused it to be called when it can't find a class? -

atm have simple autoloader converts underscores front slashes , sticks on .php @ end. naturally requires add "app dir" include path. the problem appears when attempt use class cannot found. in case php emit measly warnings , errors point autoloader function source. what easiest way find out line in file caused autoloader attempt load missing class? add this: if (!file_exists($class.'.php')) { echo '<pre>'; debug_print_backtrace(); echo '</pre>'; } or more detailed: if (!file_exists($class.'.php')) { // pseudo code! echo '<pre>'; $debug = debug_backtrace(); echo 'line: '.$debug['line']; echo '</pre>'; }

asp.net mvc - Derive Model from Another Model -

in asp.net mvc 3 project, i'd have base class model object has properties use in of other models in application (or @ least of them). way, views use these derived models have base class model properties. the base class model properties set in, base class controller, , somehow need populate derived models same data. suggestions on how best 'er done? or should looking creating own defaultmodelbinder somehow? i'm little confused options here. if couldn't tell. :) sample code base model public class elkmodel { public bool isadministrator { get; set; } } derived model public class usermodel : elkmodel { [hiddeninput] public int user_id { get; set; } // other properties specific model } so in base controller private basemodel basemodel; protected override void onactionexecuting(actionexecutingcontext filtercontext) { basemodel = new basemodel(); basemodel.myproperty = "test"; base.onactionexecuting(filtercont...

c# - What's the easiest way to use infiniband from .NET? -

i've got 2 computers mellanox connectx vpi mt26428 infiniband cards running windows 7 drivers installed. easiest way start doing message passing (e.g. via mpi) .net? if using mpi, configure mpi use ib message passing. write mpi program , execute it. if mpi configured properly, preferentially use ib. can use verbs api use ib directly. verbs analogous tcp.

Is it possible to turn off ssl at the controller level of an ASP.Net MVC application? -

is there way maybe via action filter turn off ssl specific methods? example...if somehow hits index method , has ssl on...can redirect method again , turn off? global.asax.cs protected void application_beginrequest(){ if (context.request.issecureconnection) response.redirect(context.request.url.tostring().replace("https:", "http:")); } you add same code action filter: public class sslfilter : actionfilterattribute { public override void onactionexecuting(actionexecutingcontext filtercontext){ if (filtercontext.httpcontext.request.issecureconnection){ var url = filtercontext.httpcontext.request.url.tostring().replace("https:", "http:"); filtercontext.result = new redirectresult(url); } } }

html - Using Image Map within a div with CSS rules -

i have created div image i'm using image map. <div id="image"> <img src="image.png" usemap="imagemap"> </div> css: #image { float: right; } but when use css image map, doesn't work. problem? here decent tutorial on image maps hope can explain process little better.

utilities - See the header position of a BIG file -

sometimes, got big file, don't know file type. need use tool peek first bytes of file find out file type. but file big normal text editor, have wait long time! p.s. need tools, not code. the tools on reasonable *nix box are: file : knows lot of magic headers , detects type of file. head : reads first several lines or bytes of file. tail : reads last several bytes or lines of file; files have metainfo @ end.

wpf - Writing out FlowDocument xaml with namespace using XmlWriter -

i've got collection of data needs converted .xaml file can later loaded flowdocument flowdocumentreader. don't directly instantiate paragraphs, runs, rather generate xaml create document later. what i've tried: i iterate through data, creating xelements paragraphs, runs, inlineuicontainers, etc. , build flowdocument structure fine , call: xmlwriter writer = xmlwriter.create("output.xaml"); flowdocelem.writeto(writer); writer.close(); in consuming app, this: flowdocument = xamlreader.load(xamlfile) flowdocument; flowdocumentreader.document = flowdocument; xamlfile.close(); but loading fails because doesn't know flowdocument is. flowdocument element looks so: <flowdocument name="testdoc"> (there's no namespace there shed light flowdocument when read in.) if hand edit .xaml , modify element be: <flowdocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" name="testdoc"> ...

canvas - How to generate simple 3D images in JavaScript -

Image
i generate simplified version of following static image in pure javascript. should work 2010 vintage browsers, can't wait firefox 4 , webgl. i not need fancy textures - task visualise how stack boxes. btw: current image generated pov-ray overkill job - , not run in browser ;-) as don't need fancy textures i'd recommend vintage support stack images mentioned earlier. made example you: http://jsfiddle.net/andersand/5rsex/ the simple function illustrate, , drawing of segmented box. of course may need figure out box placement, orientation, , on if business goal. that approach boxes of various height (z axis). if boxes vary in width (x and/or y) you'd need create more images suit needs.

wpf - How does VirtualizingStackPanel decide when to unload (dispose?) of virtualized controls? -

i'm working itemscontrol using virtualizingstackpanel in controltemplate. i've got virtualization working, extent. i've put debugging statements in loaded , unloaded event handlers controls in datatemplate items, don't unloaded after controls go out of view. there way force behaviour ? you might have luck setting virtualizationmode recycled. there comments in source code virtualizingstackpanel.cs indicate recycled mode cleans renderers (instead of doing in background): // // delayed cleanup used when virtualizationmode standard (not recycling) , panel scrolling , item-based // chooses defer virtualizing items until there enough available. cleans them using background priority dispatcher // work item // note, can find full source virtualizingstackpanel here: http://referencesource.microsoft.com/netframework.aspx

iphone - NSDictionary variable not being passed to other methods -

i have method takes nsdictionary viewcontroller , assigns global nsdictionary (carddictionary) variable in requestmodel class. carddictionary declared property (nonatomic, retain) , synthesized. works ok (as verified nslog). here is: -(void)findindexforcardpage:(nsdictionary*)dictionary { //parse here , send global dictionary self.carddictionary = dictionary; nslog(@"%@",carddictionary); } now when try access variable in method, still in requestmodel class, null: -(nsdictionary*)parsedictionaryforcardpage { //parse dictionary here data needed on card page nslog(@"%@",carddictionary); return carddictionary; } this method called viewcontroller class, , carddictionary null. how can make carddictionary retain data previous method? tried taking out self self.cartdictionary...no luck. else should know? if saying carddictionary global variable, , self.carddictionary - accessing instance variable. and in -(nsdictionary*)parsedictionaryforcard...

security - Why can't a user create tables in a database (they own) with a script? SP permission issue perhaps? -

i granted user permission create databases. able create database, own, getting errors when running script create tables. don't have lot of information @ point (sorry!), can't diagnose myself, perhaps more experienced in database permissions help. i'm assuming using built-in stored procedures , it's kind of permission issue. assumed if can create/own database, can whatever want it, there must don't have access to. any advise? need grant them permissions beyond "create database"? there common/standard set of stored procedures should have access to? need access "master" database? "owning" database @ server level different being "db_owner" in database after creating database, run this create user foo login foo exec sp_addrolemember 'db_owner', 'foo' see create user more info edit: relying on owner dbo mapping create database unreliable: set permissions explicitly or use sp_changedb...

asp.net - RadcomboBoxes cascading with Load on demand with WCF -

is possible use load on demand wcf service cascading radcombobox? please let me know if there examples. didn't see demo on telerik website. thank you.. i think may combine following examples: load on demand: https://demos.telerik.com/aspnet-ajax/combobox/examples/loadondemand/wcf/defaultcs.aspx related combo boxes: https://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx overview: http://www.telerik.com/help/aspnet-ajax/combo_loadondemandoverview.html

php - How to get nested Selects in a where_in clause in CodeIgniter's datamapper? -

i have mysql query i've gotten work in phpmyadmin/mysql workbench. select * (`medfacts`) join `categories_medfacts` on `categories_medfacts`.`medfact_id` = `medfacts`.`id` title in ( select medfacts.title medfacts join `categories_medfacts` on `categories_medfacts`.`medfact_id` = `medfacts`.`id` categories_medfacts.category_id = 2 ) or title in ( select medfacts.title medfacts join `categories_medfacts` on `categories_medfacts`.`medfact_id` = `medfacts`.`id` categories_medfacts.category_id = 3 ) (the query gets medfacts listed in join table categories_medfacts given category ids.) i need transfer codeigniter project in way allows program add many having clauses needed. have far generates query right. function list_by_category($cat, $module) { /* list of medfacts entries have category. * */ $this->db->join('categories_medfacts', 'categories_medfacts.medfact_id = medfacts.id'); ...

ruby - How do I send a variable between Capistrano and Rails? -

i have rails app deployed capistrano , in our acceptance environment want set page title include branch deployed. the branch set on deploy via capistrano , i'd migrate info cap rails somehow. obviously can cap write branch name out file , read in rails, i'm hoping there's better solution. i've tried couple experiments setting default_environment hasn't seemed work i'm assuming because environment variables present in shells capistrano creates. any suggestions? obviously can cap write branch name out file , read in rails that's best way, imo

asp.net - Problem with ValidationMessageFor -

hi, i have placed following code on page : <%: html.validationsummary("form not correct", new { @class = "errlist" })%> then on each property have somthing : <%: html.validationmessagefor(model => model.modelviewad.title, "*", new { @class = "val" })%> the problem open page each validationmessagefor show * , validationsummary show "form not correct" when form has not yet been validated? summary list shown first when form has been validated. i need both validationmessagefor , validationsummary shown when form has ben validated. what missing? edit1: properties have dataannotations. edit2: this how first part of view looks like <div id="adregistrationform"> <% html.enableclientvalidation(); %> <h1>registrera din annons</h1> <%: html.validationmessagefor(model => model.modelviewad, "*", new { @class = "val...

html - Targeting frames from within a frameset -

i have following frame structure: <frameset rows="25%,75%"> <frame src="banner.htm" bordercolor ="red" noresize="noresize"/> <frameset cols="25%,75%"> <frame name="list" src="packagelist.htm" bordercolor="red" noresize="noresize"/> <frame id="details" bordercolor="red" noresize="noresize"/> </frameset> </frameset> i have html page named kolkata_culture.htm , have tag id culture in frame named list . now want load page kolkata_culture.htm frame having id details in response event of clicking tag id culture frame named list , load frame frameset. how can job through vbscript? you want use javascript this, because works in browsers (vbscript works in ie). you can load frames dynamically javascript (in example, frame id "details" pointed new url): </frameset> ...

c++ - Issues with Qt VS plugin -

for reason can't track down, 1 of our solutions contains projects based on qt plugin breaking down. we have multiple developers working on same projects. qt options has versions setting , using same name path different on our different machines. seems work ok of time because property sheet plugin sets seems perform magic on qt4vspropertysheet.props file qtdir reset local machine. unfortunately, reasons can't figure out, doesn't this. member of team added several projects separate solution. of them have qtdir setting changed in property sheet local machine, others not. version of vs 2010, version of plugin 1.1.7. have qtdir set environment variable on local machine. doesn't seem solve problem. so far it's 1 solution. first showed problem release build of 1 project in solution on build server. logged build server , built project hand once , fixed issue. there's crap load of projects build on machines. any ideas wtf going on here? more in...

javascript - Can window.location change from https to http -

i have store receipt window in https. want use window.location change location https http. i have code this. var currenthost = window.location.host; window.location.href = "http://" + currenthost + "/store/closestorewindow?gotouri=" + url it goes url expect, still https. it's security thing blocking change in protocol. should work? opps. think may have discovered filter in app causing redirect https. window.location works fine. sorry that. server might forced use https. if case cannot change client side javascript. if code passes required url , response https case. ivo stoykov

iphone - Updating a cell in UITableViewController after changes in a DetailViewController -

i have simple setup: rootviewcontroller (which uitableviewcontroller). each cell in shows stats different person. can tap on of these cells push on detailviewcontroller (uiviewcontroller), , modify stats (which stored in model object). after user done modifying stats person, click button, causing popviewcontrolleranimated called. my question is: what's best way know in rootviewcontroller stats player have been changed, , updated cell accordingly? have record in rootviewcontroller cell tapped, , call appropriate setneedsdisplay after detailviewcontroller completes? , if so, method should from? viewwillappear? or there nicer way? seems it'd common task, , i'm missing obvious. this depends on how model designed , whether or not you're using core data. the basic principle observe properties of model objects might change in detail views. when changes in detail controller, somehow mark table cell dirty. then, when table view becomes visible again, changed c...

jquery mobile, using controls only? -

i interested in using jquery mobile controls, way can use using "page" tag. using page lot of auto injection html plus links etc goes through ajax button. not interested in sort of auto ui. how can use jquery mobile controls(buttons, links, lists etc) without making whole page jquery mobile page? from the jquery mobile alpha 2 release notes : global configuration jquery mobile has number of ways override initial configuration of number of aspects of framework (such disabled ajax-style links or forms). can allow sculpt jquery mobile work in situations more-specialized , don’t fit complete design methodology of framework (giving ability use couple widgets rather framework whole, example). so, can work jquery mobile à la carte disabling bits don't want. example, disabled ajaxical navigation , forms: $(document).live("mobileinit", function() { $.mobile.ajaxlinksenabled = false; $.mobile.ajaxformsenabled = false; }); n.b...

wordpress - JQuery slideup/slidedown triggering when hidden element animates -

i'm using jquery on wordpress page animate hidden element on mouseenter event. hidden element text block slides down when mouse enters div containing thumbnail of image. have animation working when hidden element slides down triggers mouseleave function slidesup elemnet giving undesirable yo yo effect. know how tell jquery ignore element slides down mouseleave function isn't called unless mouse leaves element has thumbnail. result can seen here: http://jeremypiller.com/wordpress any appreciated. here's css (i'm manipulating wordpress generated classes): .wp-caption { position:relative; width:150px; height:150px; color:#000; text-align:center; } .wp-caption img { position:absolute; width:150px; left:0px; top:0px; } .wp-caption p.wp-caption-text { font-size: 1em; line-height: 17px; width:150px; background-color:#fff; disp...

In Java, how can I redirect System.out to null then back to stdout again? -

i've tried temporarily redirect system.out /dev/null using following code doesn't work. system.out.println("this should go stdout"); printstream original = system.out; system.setout(new printstream(new fileoutputstream("/dev/null"))); system.out.println("this should go /dev/null"); system.setout(original); system.out.println("this should go stdout"); // not getting printed!!! anyone have ideas? man, not good, because java cross-platform , '/dev/null' unix specific (apparently there alternative on windows, read comments). best option create custom outputstream disable output. try { system.out.println("this should go stdout"); printstream original = system.out; system.setout(new printstream(new outputstream() { public void write(int b) { //do nothing } })); system.out.println("this should go /dev/null, doesn't bec...

sockets - Broadcast listener using Java? -

i have dp(data processor, java code) running in network , few c clients. client needs communicate dp data exchange. client need discover dp using broadcast discovery. client broadcast message dp listen , response availability. i'm not sure how add listener in java broadcast messages, tried using datagramsocket asks port number? dp should listen broadcast message received on port. unless clients using icmp, need port too. in normal tcp/ip stack broadcast , multicast done udp (yes, that's datagramsocket in java-speak), need port number. pick port like, of make flexible , provide configuration option both server , clients. there other options of course dns srv records , multicast dns/bonjour , custom ip protocols, etc. harder deal with.

Why is the ASP.NET ListItem class sealed? -

i'm curious. why asp.net listitem class need sealed? back read interview 1 of creators of bcl, think scottgu. iirc said similar "for classes, regretted made them sealed, , other classes regretted did not make them sealed". so assumption design desicion may not transparent bcl users. on other hand, 100k+ user knows more internals it.

double - Dealing with small numbers and accuracy -

i have program deal lot of small numbers (towards lower end of double limits). during execution of application, of these numbers progressively smaller meaning "estimation" less accurate. my solution @ moment scaling them before calculations , scaling them down again? ...but it's got me thinking, gaining more "accuracy" doing this? thoughts? are numbers really in region between 10^-308 (smallest normalized double) , 10^-324 (smallest representable double, denormalized i.e. losing precision)? if so, scaling them indeed gain accuracy working around limits of exponent range of double type. i have wonder though: kind of application deals numbers extremely small? know of no physical discipline needs that.

css - @font-face embedding in iOS 3.0 - 4.1 -

here example of css (which works in ios 4.2) doesn't work in earlier verisons of ios <4.1) /**** css3 font embedding ****/ @font-face { font-family: 'chevinlight'; src: url('./uploads/fonts/chevilig-webfont.eot'); src: url('./uploads/fonts/chevilig-webfont.ttf') format('truetype'), url('./uploads/fonts/chevilig-webfont.svg') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'chevinbold'; src: url('./uploads/fonts/chevibol-webfont.eot'); src: url('./uploads/fonts/chevibol-webfont.ttf') format('truetype'), url('./uploads/fonts/chevibol-webfont.svg') format('svg'); font-weight: normal; font-style: normal; } body { height: 100%; font-family: helvetica, arial, sans-serif; background: #009933; padding: 0 10px 0 10px; } /****** elements *****/ h1, h2 { text-transform: uppercase; color: #ffffff; } h1 { font-family: 'chevinbold', helvetica, ...

WPF Application initialization and finalization -

i preparing write wpf client application uses ice (internet communication engine) middleware. ice requires proper initialization , finalization. examples show how accomplish in usual console application - easy because need try-finally block , stuff in it. what wpf? how can sure code called no-matter-what happens finalize app? have @ application.exit event also, see how detect when application terminates?

Getting to grips with regex in Perl -

i'm trying write regular expression match line: dd month year @ hh:mm example: 21 may 2009 @ 19:09 so have: [0-30-9] day [0-20-90-90-9] year [0-90-9:0-90-9] time i don't understand how put these form 1 single regex. want do if($string =~ /myregex/) { } but can't form entire thing. don't know how write regex month, has match 1 of 12 months of year. i perl noob (this first day) , regex noob, appreciated! well, parts have aren't quite correct. instead of [0-30-9] think mean [0-3][0-9] , , other numbers. however, suffices little looser , use \d equivalent [0-9] . you string parts 1 after other: /\d\d (month) \d\d\d\d @ \d\d:\d\d/ which can written more succinctly as: /\d\d (month) \d{4} @ \d\d:\d\d/ or if need more strict in formulation: /[0-3]\d (month) [0-2]\d{3} @ \d\d:\d\d/ i've left month bit last, since more complicated bit. again can loose or strict. loosely: /[0-3]\d [a-za-z]+ [0-2]\d{3} @ \d\d:\d\d/ for s...

Deferred execution in VB.NET? -

private sub loaddata(of t)(byval query objectquery(of t), byref result ienumerable(of t)) if connection.state = connectionstate.open result = query.toarray else addhandler connection.statechange, sub(sender object, e statechangeeventargs) loaddata(query, result) end sub end if end sub in above code trying recurse loaddata function when connection unavailable, want defer loading when becomes available. the problem above code leads compiler error, since a byref param cannot used in lambda expressions . any idea of how right way? you cannot use byref parameter in lambda because pointing location on stack no longer exists once lambda execuetes. have use more "permanent" storage location. can pass in object property of ienumerable(of t) can set in order assign result. a better option pass in delegate ( action<ienumerable<t>> ) accepts result , performs whatever action caller requires result. here's exam...

Bodysnatcher "OpenId Provider" attack question -

okay here's bodysnatcher openid provider attack scenario. bob's google claimed identifier following, ttps://www.google.com/accounts/o8/id?id=aatawkqvytybnnuhprhn36f8mlvfijvzg8tene jane has how found bob's "current" claimed identifier. she goes off , creates here own openid provider, www.jane.com/accounts/o8/id, such when asked return bob's claimed identifier. she goes badly coded site, www.bcs.com, uses open id , bob has account at. she tells www.bcs.com use openid provider www.jane.com/accounts/o8/id. now part don't know , know if it's possible/realistic... www.jane.com/id how gets www.bcs.com believe claimed identifier "string" (i.e. value site see) ttps://www.google.com/accounts/o8/id?id=aatawkqvytybnnuhprhn36f8mlvfijvzg8tene. is possible, how, though host www.jane.com? we're working implement openid , don't want "badly coded site". we're using thirdparty .net library gives claimed identifier we'r...

Constrains of mobile web application on Android -

i want develop application on android can load web service show on mobile. @ time,design phase coming don't know, how can design because on website not complete yet. so, want know constrains make can design application. thank ka :) i think link can : [http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html][1]

eclipse - I try to add simple java project to Deployment Assembly and it disappear -

hi stackoverflower, use eclipse helios , problem. i have main project name main . dynamic web project. have util project name util . simple java project. i open deployment assembly main project. click add -> project -> choose util project-> finish in screen show new project in table source : util | deploy path : /web-inf/lib/util.jar anything good, click ok. when go deployment assembly again util project disappear. , sure when deploy, util project doesn't become jar file library. thanks suggestion. to echo comments above, took notice of bug 318068 "aggregate deployment assembly fixes helios sr1 ", includes a lot bug fixes regarding feature. the op diewland reports: it works! update eclipse , ok. so eclipse3.6.1 recommended "deployment assembly" operations.

python - How to use SequenceMatcher to find similarity between two strings? -

import difflib a='abcd' b='ab123' seq=difflib.sequencematcher(a=a.lower(),b=b.lower()) seq=difflib.sequencematcher(a,b) d=seq.ratio()*100 print d i used above code obtained output 0.0. how can valid answer? you forgot first parameter sequencematcher. >>> import difflib >>> >>> a='abcd' >>> b='ab123' >>> seq=difflib.sequencematcher(none, a,b) >>> d=seq.ratio()*100 >>> print d 44.4444444444 http://docs.python.org/library/difflib.html

opengl - Using a buffer for selectioning objects: accuracy problems -

Image
in each frame (as in frames per second) render, make smaller version of objects user can select (and selection-obstructing objects). in buffer render each object in different color. when user has mousex , mousey, buffer color corresponds position, , find corresponding objects. can't work fbo render buffer texture, , rescale texture orthogonally screen, , use glreadpixels read "hot area" around mouse cursor.. know, not efficient performance ok now. now have problem buffer "colored objects" has accuracy problems. of course disable lighting , frame shaders, somehow still artifacts. need clean sheets of color without variances. note here put color information in unsigned byte in gl_red. (assumiong maximally have 255 selectable objects). are these caused rescaling texture? (i replace looking scaled coordinates int small texture.), or need disable other flag colors want. can technique used reliably? it looks you're using gl_linear gl_texture_...

objective c - Ipad ModalView rotation problem -

i created uisplitview, after splitview load in landscape mode, display modalview using presentmodalview, problem modalview in portrait mode, can't find solution that. uideviceorientation orientation = [[uidevice currentdevice] orientation]; it gives me landscape orientation using uideviceorientation orientation = [[uiapplication sharedapplication] statusbarorientation] gives me portrait. (not working under 4.2) thanks, i'm using nstimer , loas function , work, thats bit tricky solution found right now. [nstimer scheduledtimerwithtimeinterval:0.1 target:self selector:@selector(loadingmodal:) userinfo:nil repeats:no];

c - Multiple threads and CPU cache -

i implementing image filtering operation in c using multiple threads , making optimized possible. have 1 question though: if memory accessed thread-0, , concurrently if same memory accessed thread-1, cache ? question stems possibility these 2 threads running 2 different cores of cpu. way of putting is: cores share same common cache memory ? suppose have memory layout following int output[100]; assume there 2 cpu cores , hence spawn 2 threads work concurrently. 1 scheme divide memory 2 chunks, 0-49 , 50-99 , let each thread work on each chunk. way let thread-0 work on indices, 0 2 4 , on.. while other thread work on odd indices 1 3 5 .... later technique easier implement (specially 3d data) not sure if use cache efficiently way. in general bad idea share overlapping memory regions if 1 thread processes 0,2,4... , other processes 1,3,5... although architectures may support this, architectures not, , can not specify on machines code run on. os free assign code core like...

Change app name in django, now user can't see app in the admin backend? -

i'm using coltrane blog. changed class meta: app_label = 'blog' now entries in under blog instead of coltrane. great want. however have created user privileges add, edit , delete entries coltrane app. assigned privileges under users in admin backend. now when user signs in can't see blog? if take away app_label user sees blog coltrane. if assign superuser status user can see app. is not possible changes app_label , still have user see app? if user staff user, , not superuser, need make sure user has privileges model. i try going user's record , looking @ list of privileges. may need add privileges specific newly named app.

Drupal 6: how to make CCK default values translatable? -

in multilanguage drupal 6 website need make cck field default values translatable, i.e. hello - in english version bonjour - in french one i cannot find text translation table, neither these values in variable table can use multilingual variables. do know how have different default values in different languages? when define cck field, can enter php code snippet override default value of field . enter following there : return array(0 => array('value' => t('hello'))); now access node add page cck field non-english version gets added translatable strings. now you're able translate using "translate interface" menu (it might take visit "create" page of cck type first though). doesn't require modules in fact, basic d6 (and works in d5 , d7 well).

Open iTunes from iPhone app -

i need open itunes app store application. used following link. error is: your request not completed my code below: nsstring *referrallink = @"http://itunes.apple.com/us/album/esperanza/id321585893"; nsurl *itunesurl = [nsurl urlwithstring:referrallink]; nsurlrequest *referralrequest = [nsurlrequest requestwithurl:itunesurl]; nsurlconnection *referralconnection = [[nsurlconnection alloc] initwithrequest:referralrequest delegate:self startimmediately:yes]; [referralconnection release]; [[uiapplication sharedapplication] openurl:itunesurl]; nsurl *url = [nsurl urlwithstring:@"itms-apps://itunes.apple.com/us/album/esperanza/id321585893"]; [[uiapplication sharedapplication] openurl:url]; not http://

actionscript 3 - Manipulate data object in a itemrenderer - Adobe Flex 4 -

i have simple itemrenderer following code: <?xml version="1.0" encoding="utf-8"?> <s:itemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autodrawbackground="true" width="90" height="90"> <s:vgroup horizontalalign="center"> <mx:image source="{data.photo}" tooltip="{data.name}" /> </s:vgroup> </s:itemrenderer> i manipulate data object before it's binded image attributes (source , tooltip). this, modified code in way: <?xml version="1.0" encoding="utf-8"?> <s:itemrenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autodrawbackground="true" width="90" height="90" initia...

AutoComplete word suggestion horizontally in android -

i need auto complete word suggestion.when click "th"on autocomplete edit text box,it display "the","there","those"...like on vertical list view.i need display results(the,there,those..)on horizontal way.how this? my code is: public class autocompletedemo extends activity implements textwatcher { textview selection; autocompletetextview edit; string[] items={"lorem", "ipsum", "dolor", "sit", "amet", "consectetuer", "adipiscing", "elit", "morbi", "vel", "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", "vel", "erat", "placerat", "ante", "porttitor", "sodales", "pellentesque", "augue", "purus"}; @override public void oncreate(bundle icicle) { super.oncreate(icicle); setcontentview(r.layou...

javascript - Valums Ajax file Upload handle the up. file? -

yes using this, valums ajax fileupload: http://valums.com/ajax-upload/ with these settings: function createuploader(){ var uploader = new qq.fileuploader({ element: document.getelementbyid('file-uploader-demo1'), action: 'photo.php?mode=upload', debug: true }); } not on photo.php?mode=upload, tried handle file being uploaded, if(isset($_files['qqfile'])){ $filename = $_files['qqfile']['name']; $imagesizeinfo = getimagesize($filename); } it doesnt execute this, no $_files isset.. ? have forgotten add in script settings? , tried remove if statement, says getimagesize error needs parameter cannot empty. valums upload script ( latest version ) sends file information ajax (xhr stream) when using firefox, chrome or safari). ie6/7/8/9 not support , falls iframe support sets $_files array. if want use super global $_files array can use older version of valums script , perfo...

linux - improving my backup bash script -

hello keep log files under /opt/project/logs/ , want daily copy these /opt/bkp compressing them. for have written , works well: #!/bin/bash getdate(){ date --date="$1 days ago" "+%y_%m_%d" } rm -rf "/opt/bkp/logs/myapp_log_"$(getdate 365).gz ; /bin/cat /opt/project/logs/myapp.log | gzip > /opt/bkp/logs/myapp_log_`date +%y_%m_%d`.gz ; echo "" > /opt/project/logs/myapp.log ; however not functional or general, have several applications saving files names ie app1.log app2.log under same /opt/project/logs/ folder. how can make "function" script reads each file under /opt/project/logs/ directory , taking backup of each file ends .log extension? you use logrotate(8) tool came distro. :) manpage has example looks close need: /var/log/news/* { monthly rotate 2 olddir /var/log/news/old missingok postrotate kill -hup `cat /var/run/inn.pid` endscript ...

validation - Rails ActiveRecord: validate single attribute -

if there way can validate single attribute in rails? something like: ac_object.valid?(attribute_name) i'm gonna use ajax validation of particular model fields. moving these validations javascript makes code ugly. you can implement own method in model. this def valid_attribute?(attribute_name) self.valid? self.errors[attribute_name].blank? end or add activerecord::base

javascript - how to make as a label from a part of my form which is resizeable and movable -

i want make part of created form label after clicking button "create" , should resizable , movable later... please tel me code either in html or javascript or jquery. if understood, want click on button , create label (like popup) can resizable , movable. you can use jquery plugins that. example: http://jqueryui.com/demos/dialog

ASP.NET MVC 3 Custom HTML Helpers- Best Practices/Uses -

new mvc , have been running through tutorials on asp.net website. they include example of custom html helper truncate long text displayed in table. just wondering other solutions people have come using html helpers , if there best practices or things avoid when creating/using them. as example, considering writing custom helper format dates need display in various places, concerned there may more elegant solution(i.e. dataannotations in models) any thoughts? edit: another potential use thought of...string concatenation. custom helper take in userid input , return users full name... result form of (title) (first) (middle) (last) depending on of fields available. thought, have not tried yet. well in case of formatting displayformat attribute nice solution: [displayformat(dataformatstring = "{0:yyyy-mm-dd}")] public datetime date { get; set; } and simply: @html.displayfor(x => x.date) as far truncating string concerned custom html helper solu...

entity relationship model - In the discussion of Database Design, what is the difference between many-to-one and one-to-many cardinality ratio? -

i not talking nhibernate. i talking er model. in discussion of database design, difference between many-to-one , one-to-many cardinality ratio? please give me 2 separate examples. no difference @ all. it's 2 different ways of describing same concept.

c++ - Permutations of multiple ranges of numbers -

i need generate permutations multiple ranges of numbers in array. using namespace std; int generatepermutations(vector<int> &myvector, vector<vector<int> > &swappable) { int = 0, s = 0; (s = 0; s < swappable.size(); s++) { { (i = 0; < myvector.size(); i++) { printf("%i ", myvector[i]); } printf("\n"); swappable.pop_back(); generatepermutations(myvector, swappable); } while (next_permutation(myvector.begin()+swappable[s][0], myvector.begin()+swappable[s][1])); } } int main() { vector<int> myarray; myarray.resize(6); myarray[0] = 0; myarray[1] = 1; myarray[2] = 2; myarray[3] = 3; myarray[4] = 4; myarray[5] = 5; // swappable positions (0 - first, 1 - last) vector<vector<int> > swappable; swappable.resize(2); swappable[0].resize(2); swappable[...

java - createStatement method in jdbc -

i have learned connection interface , can define method definition in interface. how work: .... statement stmt = con.createstatement(); .... how method create statement object , return it? because concrete implementation of connection interface been returned when called getconnection() . interface definies method signatures. concrete implementation contains method implementations. connection connection = drivermanager.getconnection(url, username, password); system.out.println(connection.getclass().getname()); // that's name of concrete implementation. it's jdbc driver contains concrete implementations. jdbc api enables write java code independent of specific database server used. whenever switch of db, have switch jdbc driver (and possibly change sql statements whenever contain db-server specific sql language, not java code).

c# - How to know which page has called the Usercontrol -

i have usercontrol(.ascx) page used 10 pages display in common. in control should know aspx page using(or calling). how possible? thank in advance! you can check request.url or (page)httpcontext.current.handler .

mercurial - Convert multiple hg repositories to single git repository with multiple branches -

i switching git mercurial , have been using hg-fast-export successfully. have tricky situation. have project using separate hg repositories per-branch , want convert these single git repository 'proper' branches, keeping hg changesets if possible. so current structure looks - each folder hg repository: project-v1.0 project-v2.0 project-v3.0 i want end single git repository called 'project' contains 3 branches, v1.0, v2.0 , v3.0. is possible? when hg repositories clones 1 base repo, can use hggit extension export them 1 git repo. branches live in directories b1/, b2/ , b3/, need to cd b1; mkdir ../gb1 && git init --bare ../gb1 && hg push ../gb1; cd .. cd b2; mkdir ../gb1 && git init --bare ../gb2 && hg push ../gb2; cd .. cd b3; mkdir ../gb1 && git init --bare ../gb3 && hg push ../gb3; cd .. # have 1 git repo each hg branch cd gb1 git remote add gb2 ../gb2 git remote add gb3 ../gb3 git fetch --all...