Posts

Showing posts from July, 2015

ios - iOS4: how do I use video file as an OpenGL texture? -

i'm trying display contents of video file (let's without audio now) onto uv mapped 3d object in opengl. i've done fair bit in opengl have no idea begin in video file handling, , of examples out there seems getting video frames cameras, not i'm after. at moment feel if can individual frames of video cgimageref i'd set, i'm wondering how this? perhaps there better ways this? should start , what's straight forward file format video playback on ios? .mov? apologies; typing on iphone i'll little brief. create avurlasset url of video - can local file url if like. quicktime can fine, mov or m4v in h.264 best source. query asset tracks of type avmediatypevideo. should 1 unless source video has multiple camera angles of that, taking objectatindex:0 should give avassettrack want. use create avassetreadertrackoutput. want specify kcvpixelformattype_32bgra. create avassetreader using asset; attach asset reader track output output. , call start...

templates - Componentheading and contentpagetitle joomla -

if have problem componentheading , contentpagetitle. i got sectionblog articles. title of page componentheading. title of articles (intro) contentpagetitle. if click on title of article, can see entire article. title of page title of article (contentpagetitle), , good. the problem is, title needs same layout componentheading. if this, titles of articles layout in sectionblog how can make sure got 2 different styles, or contentpagetitle changes in componentheading while looking @ full article? i don't uderstand i'm saying go http://csm.infowebpreview.be/nl/realisaties , , click on first title 'realisatie'. full article opens , title 'realisatie' should underlined now. or correct: if article article on page title should layout thanks you can being more specific css selector - this 1 apply of titles, make 1 one main heading underline - h2.contentheadingrealisaties{border-bottom: 1px solid #333} then use single out article titles in ...

html - jquery LI's anchor hover problem [JSFiddle inside] -

please see jsfiddle pretty clear idea of problem - http://jsfiddle.net/peyyz/ the above sort of want. when hover on li.parent , ul.child menu fades in, fine. want sub menu remain open, unless user selects li.parent . tried messing mouseleave ,but don't think that's i'm after. the logic need is: if user hovers on li class parent , show it's ul.child if user moves mouse somewhere else isn't li.parent , ul.child should remain open. if user moves li.parent , li.parent ul.child should open, , open 1 should disappear. thanks in advance like this? http://jsfiddle.net/nzfz6/ had edit css part too.

algorithm - Big O Question - Algorithmic Analysis II -

i doing question asks find complexity of nested loop simplified using big o notation. the question is: for <- 1 n j <- 1 n k <- 1 (i+j) unit cost operation i have prove above using sum of series notation. kind of grasping concept , have given crack. want know whether doing correctly or not. here answer: **assume sum(x=i, y) capital sigma notation x lower bound , y upper bound. => sum(i=1, n) sum(j=1, n) sum(k=1, i+j) 1 => sum(i=1, n) sum(j=1, n) (i+j) => sum(i = 1, n) n*i => n * sum (i = 1, n) i subbing in rule sum of arithmetic series gives: => n*n/2(n+1) => (n^3 + n^2) / 2 using big oh rule -> max(f(x), g(x)): => max(n^3/2, n^2/2) => o(n^3) i know answer correct not sure if calculations prior are.... with small correction: sum(i=1, n) sum(j=1, n) sum(k=1, i+j) 1 = sum(i=1, n) sum(j=1, n) (i+j) = [ sum(i=1, n) sum(j=1, n) ] + [ sum(i=1, n) sum(j=1, n) j ] = sum(i = 1, n) n*i + ...

python - How can I retrieving a timestamp from a dictionary and converting it to datetime object? -

i have dictionary of timestamps in form 2011-03-01 17:52:49.728883 , ids. how can retrieve latest timestamp , represent in python datetime object? the point able use latest date of timestamp instead of currnt date in above code. latest = datetime.now() the structure of dictionary not entirely clear question, i'll assume keys strings containing timestamps 1 in question. if d dictionary: datetime.strptime(max(d.keys()),'%y-%m-%d %h:%m:%s.%f') the above code uses fact lexicographical ordering of datetime strings sorts timestamps in chronological order. if you'd rather not rely on that, use: max(map(lambda dt:datetime.strptime(dt,'%y-%m-%d %h:%m:%s.%f'),d.keys()))

sql - One row with 2 same name columns -

i wish have resultset 2 columns of data coming same column. select cust,date,data cust_a1 ai_code between '17' , '19'; this return multiple rows 1234567 | 04-04-2011 | special offer 1234567 | 04-04-2011 | cheep offer 1345678 | 04-04-2011 | friday offer 1345678 | 04-04-2011 | special offer i shape this: 1234567 | 04-04-2011 | special offer | cheep offer 1345678 | 04-04-2011 | special offer | friday offer how can done? this known pivot

datetime - Binning Dates in R -

i struggle dates , times in r, hoping basic task. here dataset: > str(temp.df) 'data.frame': 74602 obs. of 2 variables: $ time : posixct, format: "2011-04-09 03:53:20" "2011-04-09 03:53:15" "2011-04-09 03:53:07" "2011-04-09 03:52:39" ... $ value: num 1 1 1 1 1 1 1 1 1 1 ... > head(temp.df$time, n=10) [1] "2011-04-09 03:53:20 edt" "2011-04-09 03:53:15 edt" "2011-04-09 03:53:07 edt" "2011-04-09 03:52:39 edt" [5] "2011-04-09 03:52:29 edt" "2011-04-09 03:51:56 edt" "2011-04-09 03:51:54 edt" "2011-04-09 03:51:46 edt" [9] "2011-04-09 03:51:44 edt" "2011-04-09 03:51:26 edt" and convenience... > dput(head(temp.df$time, n=10)) structure(c(1302335600, 1302335595, 1302335587, 1302335559, 1302335549, 1302335516, 1302335514, 1302335506, 1302335504, 1302335486), class = c("posixct", "posixt"), tzone = ...

qt4 - QTextCursor insertText not working -

i'm trying make table in qt using qtexttable. first row working fine when set background , text second row applying formating inserttext function doesn't seem work me. i've tried inserthtml nothing seems work me on row2. qtexttableformat channelbankformat; channelbankformat.setalignment(qt::alignhcenter); //channelbankformat.setheight(8); channelbankformat.setcolumnwidthconstraints(constraints); channelbankformat.setborder(0); channelbank->clear(); qtextcursor cursor = channelbank->textcursor(); cursor.begineditblock(); qtexttable *table = cursor.inserttable(2, 5, channelbankformat); qtextcharformat headerformat = cursor.charformat(); headerformat.setfontweight(qfont::bold); headerformat.setfontpointsize(8); qtextcharformat dataformat = cursor.charformat(); dataformat.setfontpointsize(12); qtextblockformat centeralignment; centeralignment.setalignment(qt::aligncenter); (int cellnumber = 1; cellnumber <= 5; ++cellnumber) { qtexttablecell cell ...

php - Why does active record pattern not work with rich domain models? -

i'm reading architectural patterns chapter of poeaa, , fowler says "as domain logic gets more complicated , begin moving toward rich domain model (116), simple approach of active record (160) starts break down. one-to-one match of domain classes tables starts fail factor domain logic smaller classes. relational databases don't handle inheritance, becomes difficult use strategies [gang of four] , other neat oo patterns. domain logic gets feisty, want able test without having talk database time." i didn't understand this. "one 1 match of domain classes tables", mean classes there no associations or single table inheritance hierarchy? and why factoring domain logic smaller classes cause pattern fail? what he's trying more complex domain models more "data table". these more complex models fowler talking models data different tables, views or maybe other sources. the active record pattern not suitable purpose, , datamapper p...

java - I need to get a List of generic lazy loaders that will instantiate instances of their inferred type -

sorry cryptic title, difficult explain. general rule need lazy loader give me n instances of bound wildcard type. i'm calling lazy loader storage unit. import java.util.arraylist; import java.util.list; public class storageunit<t extends myinterface> implements storable<t> { private int count; public storageunit(int count) { this.count = count; } private list<t> storables = new arraylist<t>(); public list<t> getinstances(class<t> c) { try { if (storables.size() == 0) { (int = 0; < count; i++) { storables.add(c.newinstance()); } } else { return storables; } }catch (illegalaccessexception illegalaccessexception) { illegalaccessexception.printstacktrace(); } catch (instantiationexception instantiationexception) { instantiationexception.printstacktrace(); ...

javascript - blockui overlay not covering whole page? -

Image
i using blockui "wait ... loading" pop up. working fine, has 1 small issue: overlay covering captured screen, not scroll window. if scroll right, width not covered (but height covered fully). i have width has problem. <script language="javascript" type="text/javascript"> $(document).ready(function () { jquery('#myalert').click(function () { jquery.blockui({ message: '<center> <img src="/_layouts/1033/styles/ajax-loaderbar.gif" alt="loading.." /> <br /> <font size="2" face="arial" > <b> please wait... </b></font></center><br /> <font size="2" face="arial" ><b>while load information.</b></font>'}); }); }); </script> the blocking element should immediate child of body tag. should nested this...

java - Case-insensitive URLs with JAX-RS -

is there easy way provide case-insensitive urls in jax-rs web service? goal of produce web service "lenient acceptor." 1 i imagine it's possible filter .to[lower|upper]case() s incoming urls. unfortunately, implementation demands programmer discipline/consistency in making sure all hard-coded url strings in application strictly [lower|upper]case. also, don't yet know jax-rs analog servlet filter. if matters, i'm using jersey jax-rs implementation. 1 as in, "be lenient in accept, , strict in produce" (can't recall source) the answer no, since uris according rfc 3986 case sensitive: 6.2.2.1. case normalization for uris, hexadecimal digits within percent-encoding triplet (e.g., "%3a" versus "%3a") case-insensitive , therefore should normalized use uppercase letters digits a-f. when uri uses components of generic syntax, component syntax equivalence rules apply; namely, scheme...

asp.net - Machine Authentication Scheme C# -

i'm trying implement authentication scheme allows sever application validate client machine sent information valid machine. thinking of implementing similar this: keep in database list of every machine has access allowed, when machine added systems, server application generates identifier , certificate public , private key, certificate , identifier installed on client. when client machine requests server machine, has give identifier encrypted private key. if server can decrypt given identifier, machine authorized make request. i don't know if theoretically , in practice valid scheme. asp.net application using c#. you may want use x509 client certificates on https connection. built purpose in mind , open standard: for highly secure web applications, such internet banking sites, may want implement more secure solution user authentication user name , password combination. can use client-side digital certificates verify identity of user. in addition, can map c...

php - CLI0145E db2_fetch_array -

i'm working db2 in php , i'm getting following error while executing @$row = db2_fetch_array( $res ); [ibm][cli driver] cli0145e fetch type out of range. sqlstate=hy106 sqlcode=-99999 i found here possible explanation, doesn't make sense me because i'm not specifying row number. does can give explanations? thanks! i believe have misunderstood suggestion contained in page referenced . not referring db2_fetch_array() function, db2_connect() function. set cursor option db2_scrollable , pass constant fourth parameter of database connection function: db2_connect('database', 'username', 'password', db2_scrollable); if not correct solution, maybe displaying error because result contains 0 rows? idea check make sure @ least 1 row returned before calling db2_fetch_array() (or related function): if (db2_num_rows($res) > 0){ @$row = db2_fetch_array( $res ); }

date format - mysql DATE_FORMAT using select * -

generally when make small select this select id,date_format(updated,'%m %e, %y %l:%i %p'),title tablename; and give me date format like. now have instance have select don't want specify every column because know want them all. need format dates way did in previous example. is there way format updated column , other feilds , still keep there order ? i tried this select *,date_format(updated,'%m %e, %y %l:%i %p') updated tablename but doesn't seem doing anyhting i did not tested try this select t.*,date_format(updated,'%m %e, %y %l:%i %p') updated tablename t;

timezone - Should time zone be a user preference in a web-app? -

i'm working on web-app must handle communicating time of particular events people across many time zones. there not seem reliable way time zone client machine in web app. realize can offset, offset not timezone. (among other things, not consider dst future dates). is common, or suggested provide timezone user preference, render times in users time zone. yes. store timestamps in utc, convert user's timezone. should able come list of timezones include not offset utc, whether or not use dst (and, matter, when switch to/from dst). edit: specifically, you're looking tz database . provide pretty need.

css - Rounded corner div in IE(6/7) -

here's code rounded div. works fine except ie(6/7), in ie(8/9) it's pretty good, , other browsers seem nice on rounded div. described later after code. html code: <div id="tweets"> <div id="tweets_text"> <div id="tweets_text_top"> <div id="tweets_top_left"> </div><!--#tweets_text_left--> <div id="tweets_top_right"> </div><!--#tweets_text_right--> </div><!--#tweets_text_top--> <div id="tweets_text_middle"> text here.... </div><!--#tweets_middle--> <div id="tweets_text_bottom"> <div id="tweets_bottom_left"> </div><!--#tweets_text_left--> <div id="t...

maven - How to traverse up the directory structure and kick off mvn build in vimscript? -

i'm new vim user looking little script allow me call mvn build. currently map follows map <f3> :! mvn build<cr> but because tries build in current working directory (currently java development i'm deep in package under src usually) how might go directory structure mvn build command works correctly? thank in advance the vimscript function finddir() can used find src directory. syntax used in second argument ( path ) has augmentations basic path specification , 1 of ability specify upward search using ; : let src_dir = finddir('src', ';') this find src directory if it's above current directory. to build in directory, can run exec '!cd' shellescape(src_dir) '&& mvn build' i don't think work under windows. in case, think you'd want change directory temporarily using vim's cd command, run command, , change using :cd - . you can combine commands function function! runmavenins...

php - Regex for getting URL-compatible directory? -

i have internal link system on site, , use detect text after markup: '/__il__(.+)/' the problem picks characters "<", meaning if uses line break, result this: http://www.[sitename].org/[user's url] <br/> what better regex expression that? thanks. try instructing regular expression include characters character begins html tag: '/__il__([^<]+)/'

c - What is the length of an array? -

what length mean in sentence: "each array passed function along “length” of array." does mean size of array? in c, because have pointer array, doesn't mean know length (how many entries has). somehow must know avoid array indexing errors. there small number of ways this: agree on array length. code knows arrays have length, e.g., 17. considered bad practice, people arrays problem-domain specific such translation matrices 3d graphics, tend have 4 rows. document array length constant declaration or macro definition, , use symbol control loops accessing array. implicitly associate well-known variable containing runtime array size array. program consults variable when needs know array size. pass pointer array, , length known by caller callee. callee knows length, , can in turn pass whoever callee calls. package array , length in struct, , pass pointer struct. callee can consult struct determine array size. this discussion little confusing c lan...

c# - How do I fix a corrupted build manager in vs2010? -

i have c# project in vs2010 has several build options (debug, release, debug x86, debug got new hat, etc), because people have gone bit overboard in adding projects. i want revert of 4 basic build types: debug x86 release x86 debug x64 release x64 i remove project, save sln project apparently no longer in solution, , add back, apparently settings project have been saved. there way remove these extraneous projects entirely build manager , start scratch short of creating new sln file? the impetus fixing problem 1 of projects in solution won't allow x64 build made. if try create x64 build project, build manager states x64 build exists, when though not. build manager isn't allowing me remove build modes, add them, doesn't let me add x64, i'm needing. quickest way manually edit .proj files in notepad, removing <propertygroup condition=" '$(configuration)|$(platform)' == 'newhat|x64' ">...</propertygroup> ...

c# - XSLT Compare Date to a Date portion of DateTime -

i'm attempting make xml log file bit more readable via xslt. it has several events within log , times in datetime format , select events occurred on specific (single) date. here excerpt log.xml file: <event> <bag>168</bag> <action>check out</action> <time>2011-04-07t11:41:34.7219171-04:00</time> <user>jroderick</user> </event> <event> <bag>168</bag> <action>check in</action> <time>2011-04-07t11:41:38.7079901-04:00</time> <user>jroderick</user> </event> <event> <bag>1147</bag> <action>check in</action> <time>2011-04-07t14:27:14.0662271-04:00</time> <user>jholby</user> </event> in log.xsl have following table want generate: 1 row per event. <xsl:for-each select="log/event"> <xsl:if test="???"> ...

wolfram mathematica - How to abort evaluation of a sequence of inputs? -

by default pressing alt + . or calling abort[] within evaluation causes abort of evaluating input. when working in frontend send kernel sequence of inputs. example, if type following 3 expressions on separate lines in 1 cell , press shift + enter infinite evaluation: f := checkabort[pause[.1], abort[]] while[true, f] while[true, f] while[true, f] to stop infinite evaluation must press alt + . 3 times. how define function f in example above in such way pressing alt + . one time abort evaluation of full sequence of inputs without quitting kernel ? edit i think if frontend creates input queue mathkernel can cancel queue. sasha's suggestion use 4 cells valid, because that's frontend anyway, submitting several distinct evaluations kernel. if insist in using 1 cell, wrap in parens ( compoundexpression ), causes 4 lines treated 1 evaluation (note need ; too): ( f := checkabort[pause[.1], abort[]]; while[true, f]; while[true, f]; while[true...

ASP.NET w/ VB.NET - Winforms to Web - NullReferenceException Error on string split / string builder -

Image
background: have winform app registers user in database based on information provided, auto-generates random password , username, , e-mails user link take application based on marketing company selected. problem: when user clicks "send invitation" data inputted iton fields except bundles listbox in debug, nullreferenceexception error thrown highlighting line: dim mcshort string = trim(splitmc(0)) how fix issue here's screenshot of web app: here's code of send_button_click method off default.asx.vb: private sub send_button_click(byval sender system.object, byval e system.eventargs) handles send_button.click 'todo add code validate selections reaquired met. 'ccemail , additional message not required dim firstname string = txtfirstname.text dim lastname string = txtlastname.text dim ccemail string = txtccemail.text dim sb new stringbuilder sb.appendline("<?xml version=""1.0"" encodin...

Cost of memory [de]allocation and potential compiler optimizations (c++) -

is cost of memory [de]allocation defined? if cost depends upon specific compiler being used, there general way memory [de]allocation implemented such can reasonably assume cost? is compiler able optimize following code such call 'new' done once? char * arr = null; (size_t = 0; < 5000000000; ++i) { arr = new char[100000000] ... // process things here delete []arr; } the compiler not able perform optimization. @ lowest level, storage allocation boils down calls library functions such malloc (and, 1 layer deeper, os apis). compiler it's not safe assume individual malloc/free pairs can left out , storage reused because implementation should outside optimizer's scope. apart that, don't think job optimizer. that's you, programmer, can without special efforts. there no standardized cost memory allocation/deallocation. generally, allocation/deallocation times may vary (for example take longer if user-space heap implementation forced...

ruby - Rails how to order after an instance variable -

in konkurrancerstable have: rating_score => current score (integer) ratings => number of ratings led score (integer) in view want sort konkurrancers after rating. have math: rating_score/ratings ratings may not null because can not divide zero. <% @konkurrencer.find(:all, :order => '@rating asc', :limit => 5).each |vind| %> <%= link_to(image_tag(vind.banner2, :style => 'border:none; width:125px; height:125px;'), vind.tracking, :target => '_blank') %> <% end %> my controller: class publiccontroller < applicationcontroller helper_method :sort_column, :sort_direction def index @konkurrencer = konkurrancer end end my view: 15: <%= @konkurrencer.find(:all, :select => "rating_score/ratings rating", :order => 'rating asc', :limit => 5).each |da| %> 16: <%= da.banner2 %> 17: <% end %> and following error: activemodel::missingattributeerror in public#in...

cocoa - Objective-C & Compare two NSStrings -

i trying compare 2 nsstrings see if match app keeps crashing exc_bad_access , shows me assembly output , not location within code keeps crashing. here compare: nsstring *comparealarm = [lbltime stringvalue]; [lbltime setstringvalue:[self gettime]]; if ([salarmtime isequaltostring:comparealarm]) { nslog(@"alarm hit"); } [comparealarm release]; does see why fail? if comment out if statement crash stops. thanks in advanced. you aren't retaining comparealarm release it.

vb.net - WPF - Usercontrol as ListItemTemplate not filling listbox width -

just trying head round wpf. have usercontrol i'm using template items in listbox, no matter try usercontrol's width shrinking minimum size want fill available width. i've found similar query on here relating usercontrol not within listbox , solution proposed doesn't apply here. my usercontrol defined : <usercontrol x:class="ureportitem" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="60" d:designwidth="300"> <grid > <border cornerradius="3,3,3,3" borderbrush="#0074ba" borderthickness="1" background="#00d6f9" margin="0"> ...

java - Are there any open-source implementations of the Mercator Web Crawler -

marc najork , allan heydon have written excellent paper on java, scalable , extensible web crawler called mercator. here resources on mercator web crawler: mercator presentation (pdf) mercator introduction (pdf) mercator web crawler paper (pdf) first result in google query: "web crawling contents najork pdf" has seen implementations of crawler (preferably java)? update: i'm having trouble links, i'm going try better links referenced papers. think i've fixed them now. i've found couple of java crawlers supposed pretty close mercator: nutch multithreaded , distributed. heritrix multithreaded. other references welcome.

xamarin.ios - Secondary layout rotation problem -

i have app main view , 2 secondary views. designed in ib landscape layouts. have mainviewcontroller class returns true. views designed (i think) rotate , resize. if app starts in landscape orientation, secondary views show correctly if rotated portrait. but, if app starts in portrait, secondary layouts never rotate properly, cut off on bottom , run off right. any appreciated. thanks, rick i have experienced similar. not using interface builder @ in app , rotation , resizing logic manually. have noticed during app start viewcontrollers interfaceorientation 'unknown'. caused me same behavior. solved bu switching orientation recognition current viewcontroller main navigationbar of app. donno why control correctly set orientation. if mean 'secondary layouts' hidden if correct not rotated automatically because hidden. have manually.

NHibernate, SQL Server - enum to int mapping -

i have class has enum type indicating whether message type email or sms. enum type defined: public enum remindertype { email = 1, sms = 2 } the class utilizes type looks like: public class reminder : entitybase { public virtual string origin { get; set; } public virtual string recipient { get; set; } public virtual remindertype type { get; set; } public virtual business business { get; set; } public virtual datetime created { get; set; } public reminder() { created = datetime.utcnow; } } when try persist entity of type reminder database however, following error: system.data.sqlclient.sqlexception (0x80131904): conversion failed when converting nvarchar value 'email' data type int. the backing field of type int , i'm not sure why nhibernate trying map string representation default. i'm using fluent nhibernate, , relevant mapping code is: mappings.override<reminder>(map => { map.map(x => x...

php - Is it bad design to require my website to have a cron script running every minute or two? -

basically i'm designing alert system in php codeigniter. want alerts "scheduled" inserting database row , sent out in batches periodically. alerts sent out via email. the way can think achieve require cron script call cli-only controller every minute or checks scheduled alerts , sends them if finds anything. something telling me having cron script run poorly designed can't think of other way it. advice? making alerts asynchronous separating alert task rest of code desirable. i don't see problem cron script , ask why need often? setting threshold idea , still need check @ end of day or whenever make sure has fired anyway. you rather use whole overhead of controller (and rest of framework there) - maybe make lightweight cli php script

php - How could I insert date from mktime into MySQL? -

i want insert date in format m-d database. used code $date1=date("m-d",mktime(0,0,0,$month1 ,$day1,1)); the date inserted 0000-00-00 in mysql, , don't know why. i want compare date stored in mysql current month , day. how can done? mysql date must of form y-m-d . building date m-d form brings invalid date. if want compare month or day, can use mysql month , dayofmonth functions. example: $query = "select * table month(datecol) = {$month1} , dayofmonth(datecol) = {$day1}"

StarTeam -- How do I move files programmatically? -

any starteam users out there? i'm using starteam 2009, comes client tools, including command line tool, stcmd.exe. i'm reorganizing large java project containing thousands of .java files , resource files. know if there way using stcmd or other scripting tool move files 1 folder in starteam repository folder. of course can use starteam client interface drag , drop files, i'm hoping avoid that. any appreciated. thanks stcmd gives ability add, modify, , delete files , folders. doesn't provide mechanism sharing or moving. it may possible of moves using vcmutility, that's not designed , guess end being more of pain doing hand. the starteam sdk provide tools necessary moving , sharing. may worthwhile writing small utility you're looking for.

flash - What's the definition name for fonts loaded at runtime created with fontswf? -

i ran 'fontswf' utility embed ttf fonts swf , struggling load them @ runtime app. examples find online refer loading font via [embed] loading them flash.display.loader , gather, once loader.contentloaderinfo fires event.init need register font, so: public function handleloadercomplete( event:event ):void { var fontclass:class = event.target.applicationdomain.getdefinition( fontname ); font.registerfont( fontclass ); } the problem don't know pass in fontname. generating swf through: $ fontswf -a belshaw -o belshaw.swf belshaw.ttf but when try call getdefinition( 'belshaw' ), error saying 'variable belshaw not defined'. suggestions on how accomplish this? the alternative generate on swf files through templating .as file , compiling them, rather use built in tool fontswf if it's there. thanks ruy i on project had allow users dynamically upload own fonts. tried getting fontswf work , ran issue after issue , terrible documentati...

ruby - Javascript event loop/message pump for Google Sketchup plugin -

i'm working on plugin google sketchup written using ruby api. within api webdialog class 1 can use render html , move data between webdialog , ruby side of plugin code. i'm using class build ui plugin. data sent webdialog ruby side asynchronously. due subpar documentation not aware of , i'm ways plugin it's began create problems me. specifically: when multiple successive calls made webdialog ruby side, last call executed. so, need devise sort of "bridge" prevent calls webdialog ruby side getting lost -- is, think, "event loop" or "message pump" system. my problem haven't idea of how this. i'm hoping can provide me sort of resource lays out framework how such system should work -- sort of checks needed, sequence in they're performed, etc. know can terrifically complex task, need basic: basically, way of making javascript stop when send request ruby, not proceeding until data need back, , dealing potential errors may crop...

java joption and convert string to integer -

i not quite sure doing wrong code. i trying import joptionpane , convert string int error comes at **start = inputvalue.integer.parseint();** joptionpane pane = new joptionpane(); string inputvalue = joptionpane.showinputdialog("please input value"); start = inputvalue.integer.parseint(); try this: start = integer.parseint(inputvalue);

What is the most jquery-y way to get the numeric position of an element in a list? -

i want index of item in list similar this: <ul> <li>option 1</li> <li class="selected">option 2</li> <li>option 3</li> </ul> // doesn't work var selected = #('ul#options li').index('.selected'); // selected should == 1 i with var selected = -1; $('ul#options li').each(function(a, li){ if($(li).hasclass('selected')){ selected = $(li).parent().children().index(li); } }); // selected == 1 but seems there has cooler/more concise way accomplish this. edit: i came $('ul#options li').index($('ul#options li.selected')); which better. turns out .index() needs object not selector string. var selected = $('ul li.selected').index(); // 1 jsfiddle . the index 0 based, second item index of 1 . getting index in old versions of jquery convoluted, rather simple now. :)

c++ - Resource leak during object creation -

i have following code creation of node inside graph. i'm getting resource leak error when run static checking tool (coverity). appreciate if can point out how improve code: class node { public : explicit node(std::string& name) : m_name(name) { } void setlevel(int level) { m_level = level; } private : ... } class graph { public : void populategraph() { std::string nodename = getnodename(); /* error saying variable new not freed or pointed-to in function nc::node::node(const std::string...) */ node* nodeptr = new node(nodename); /* error saying variable nodeptr not freed or pointed-to in function nc::node::setlevel(int) */ nodeptr->setlevel(-1); if (m_name2nodemap.find(nodename) == m_name2nodemap.end()) m_name2nodemap[nodename] = nodeptr; nodeptr = null; } .... private : ...

mysql - The Correct Way To Load PHP's PDO Drivers? -

i start working pdo form database work , have ran problem, no pdo drivers loaded @ all. i unzip php package "c:\php" , edit apaches httpd.conf file load php module so: loadmodule php5_module "c:\php\php5apache2_2.dll" i edit php.ini file load mysql pdo driver module, uncommenting line: extension=php_pdo_mysql.dll now create page calls phpinfo(); function, when page rendered, section under pdo empty, nothing has been loaded. would know correct way configure apache , php mysql pdo driver loaded , useable? before enabling php_pdo_mysql.dll extension should enable main pdo extension extension=php_pdo.dll

Django: write data to mySQL server from command line -

i have django web interface users query, view results , can edit add or delete. data each time write server alot, want supply users command line can embedded inside script send data. before use mysql direct command line server not not allow that, user cannot access direct database. how can this? heard 1 using rest, it? , how like? if you're daring allow mysql command line in 1 of uis (i'm not). may better off allowing input of fixtures . i've done other ways well. in instances, have csv upload function, take formatted csv file, upload server, , pass off background task (via celery) , add/update records in db when valid data presented.

Clarification on How to access the Java+ Xml application in PHP based web portal -

i require clarification on 1 technical implementation check feasible or not. i have 1 vps server has java environment , have 1 more dedicated server doesnot have java environment have built php based web application, in vps environment planning implement xml based application using observer pattern java , dom parsers , make application available @ example 123.124.125.65/xml_works/sample,xml file now doubt that: 1)is possbile access application in dedicated server java environment not there. 2)if yes, possible access java + xml application in iframe in php based web portal. 1) no jvm = no java running on machine 2) common solution saw (and using) externalize java functionality want web service or servlet , package .war use web container such tomcat load war , use connector connect calls tomcat php server. so configuration use is, java war, tomcat web container, apache php server , mod_jk connector communication between servers. note mod_jk connector support...

iphone - Where is the Interface Builder in the MonoDevelop application? -

Image
i'm having play around monotouch for first time . in hello world tutorial noobs-like-me, say's following :- launch interface builder double-clicking on mainwindow.xib file. once interface builder starts up, should see surface (your window) , library contains various components. library should following screenshot. if not there, select library tools menu when try that, nothing happens. no new 'window' shows. if goto tools menu, there no option library. the solution type made c# iphone window-based project . can me please? interface builder part of ios sdk made available developers apple; not part of monotouch or monodevelop ide. if nothing happens when try open .xib file, ib may not installed on mac. to obtain it, go the ios dev center , download xcode 3.2.6 , ios sdk. make sure download xcode 3 , not xcode 4, ib separate application in version 3. quoting this answer of mine find xcode 3 download link: ... under xcode 4 + ios s...

Python: Find item in multidimensional list -

i have list of lists, snippet of below: x_attrib = [] self.x_attrib.append(["is_virtual", false, 'virtual', 'flag']) self.x_attrib.append(["x_pos", none, 'pos/x', 'attrib']) self.x_attrib.append(["y_pos", none, 'pos/y', 'attrib']) i want make functional returns index of item @ first position (i.e. want pass "x_pos" function, , have return 1 ). how can this? if understand correctly, need this: def find_it(key): index, sublist in enumerate(lists): if sublist[0] == key: return index having said code looks solving more general problem incorrectly. i.e. list bad idea. without better idea of doing cannot certain.

iphone - My viewcontroller (in the navcontroller) I load in my app delegate overlaps the tabbar -

i'm having trouble initializing viewcontroller when app loads in app delegate. viewcontroller loads okay, overlaps tabbar have @ bottom. need create viewcontroller , have load in app delegate? have tabbarcontroller set in mainwindow.xib, contains navigation controllers , inside viewcontrollers. here code... in didfinishlaunchingwithoptions have: sub = [[subgabviewcontroller alloc] initwithnibname:@"subgabviewcontroller" bundle:nil]; nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:sub]; [window addsubview:nav.view]; should like? sub = [[subgabviewcontroller alloc] initwithnibname:@"subgabviewcontroller" bundle:nil]; nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:sub]; [newviewcontroller.view addsubview:nav.view]; thanks! if you're trying use uitabbarcontroller, each tab has own root view controller (these can uinavigationcontroller objects). assuming have property self.tabbarcontroller (i think g...

delphi - Error when running program with VirtualShellTools from a service -

i create service in delphi. need service run program. in windows 7, use code execute program : procedure executeprocessasloggedonuser(filename: string); implementation function getshellprocessname: string; var reg: tregistry; begin reg := tregistry.create(key_read); try reg.rootkey := hkey_local_machine; reg.openkeyreadonly ('software\microsoft\windows nt\currentversion\winlogon'); result := reg.readstring('shell'); reg.free; end; end; function getshellprocesspid(const name: string): longword; var snapshot: thandle; process: tprocessentry32; b: boolean; begin result := 0; snapshot := createtoolhelp32snapshot(th32cs_snapprocess, 0); if snapshot <> invalid_handle_value try fillchar(process, sizeof(process), 0); process.dwsize := sizeof(process); b := process32first(snapshot, process); while b begin if comparetext(process.szexefile, name) = 0 begin result ...

Java thread doubt -

consider program: public class test { public static void main(string [] args){ runnable r = new runnable() { public void run() { system.out.print("foo"); } }; thread t = new thread(r) { public void run() { system.out.print("bar"); } }; t.start(); } } on running output is bar i know why so. my understanding: we instantiate anonymous inner class implements runnable overriding run method. , assign r. next pass runnable thread class constructor. create new anonymous inner class extends thread overriding run. so have 2 run methods , 2nd take preference on 1st. i'm confused please correct me if i'm wrong. also such crazy things used in real world java programming? (my prof says yes , thats keeps going :d). though pass runnable instance constructor, you're overriding run method in such way, doesn't ...

jquery - Security warning in IE when using jScrollpane -

i using jsrollpane (a jquery plugin) on page. use of source file plugin causing security warning in ie- "this webpage contains content not delivered using s secure https connection,which compromise security of entire webpage" i checked media resources fetched using http nut it's not there. my page https://login.salesforce.com/?ec=302&starturl=/visualforce/session%3furl%3dhttps%253a%252f%252faexp.ap1.visual.force.com%252fapex%252faexp__test_offer&un=ashok_bommali%40amex.cms&pw=infy@789 and source file using http://github.com/vitch/jscrollpane/raw/master/script/jquery.jscrollpane.min.js any on this? thanks, sushil the file linking not have https protocol. change does, is... https://github.com/vitch/jscrollpane/raw/master/script/jquery.jscrollpane.min.js alternatively, drop protocol , let browser figure out... //github.com/vitch/jscrollpane/raw/master/script/jquery.jscrollpane.min.js

javascript - Do I need to include css and js files in the lightbox page? -

do need load css , js files again in lightbox html code? css seems work fine. js functions not work in lightbox page. js files included in parent html page , triggered in same file. only jquery code have written in lightbox html code works in lightbox page. other js functions written in included js files not work. should use different methods trigger js functions included in parent page in lightbox page?? edit lightbox html code: <div id="lightbox-holder"> <div class="result"> <p>total amount</p> <h3>1000</h3> </div> <div class="equal-sign"> </div> <div class="left-stepper"> //stepper input <label class="steper-label">left stepper</label> <input type="text" id="spinner1" class="ui-stepper" value="0" /> </div> <div...

C2DM collapse_key implementation explanation needed -

hi cannot see explanation of implementation of collapse_key. think understand not how it! android cloud device messaging framework i have c2dm framework set , sending 4 types of messages many phones. string messages basic looks kind of this: type:name:uuid type:name:uuid:number type:uuid:id if phone off many of can piled waiting phone on-line. far can tell system works collapse_key me here? addencodedparameter(sb, "collapse_key", "no_ide_what_to_put_here"); you mentioned retrying same message 3 times , using same key value. doesn't have same message. if you've got message indicates current price of stock, instance, , care latest price, send different messages same key. when device comes online, gets latest price quote message. this may have been saying already, wanted make clear it's not "retrying sending same message".

c# - White UIAutomation click() stops working on different platform -

Image
i'm using white automate bdd testing of our c# wpf ui. my first couple of tests working on development machine (running windows 7). however, when try , run same code on build server (virtual machine running windows server 2003 r2) doesn't work correctly. in both cases tests run command line , tests using cuke4nuke framework. in case of server accessing server via remote desktop connection. the code looks like: var application = application.launch("whiteapp.exe"); var initializeoption = initializeoption.nocache; var windowcriteria = searchcriteria.bytext("whiteapp"); var window = application.getwindow(criteria, initializeoption); var criteria = searchcriteria.byautomationid("rightbutton"); var button = (button) window.get(criteria); button.click(); the problem buttons click event not fired when run on server. button can clicked (using mouse) if ui left open after white has finished executing. 1 interesting point after click method r...

performance - Collecting the Azure Diagnosis Log Remotely without the support of Storage Account -

Image
i have use case need diagnostics , performance data of azure web-role monitored remotely done without storage account. adding stuart's answer: diagnostic monitor set collect counters, logs, , diagnostics locally , aggregate them well-known azure storage tables, requires storage account. if wrote background process periodically poll local counters, push them instances pretty anywhere want: sql azure, sql server (on premise), web service, email, etc. however, stuart says, feels reinventing wheel. the diagnostic monitor aggregates counters across of instances, letting aggregate counter values across of web roles, instance, or letting drill down on specific instance easily. not sure why you'd want avoid storage account diagnostics. @ $0.15/gb, it's going have low cost overhead, if you're storing diagnostic data. plus, 3rd party monitoring tools (such azurewatch ) need pull counters storage account.

sql server 2005 - How to get the corresponding comma-separated text for a string of comma separated codes? -

i've table, there column called "locations" in type of varchar(max). carries string of comma-separated code, e.g. '1, 3, 4' . on other hand, i've table map these code locations, e.g. 1 -- british 2 -- new zealand 3 -- hong kong 4 -- taiwan my problem is, i'm making view map , replace content of column "locations" corresponding comma-separated text, e.g. '1, 3, 4' 'british, hong kong, taiwan' this urgent company project, please kindly advise. thank you! regards, william there might simpler solutions here 1 way. table structure create table locations(locationid int, location varchar(50)) create table othertable(id int, locations varchar(max)) test data insert locations values(1, 'location <1>') insert locations values(2, 'location <2>') insert locations values(3, 'location <3>') insert locations values(4, 'location <4>') insert locations values(5...

c# - Is it ok to unit-test an abstract class by instantiating it as a mock object? -

it has come attention can unit-test abstract class instantiating mock object. thereby mock abstract properties , methods, while being able test implemented ones. however, accustomed distinguish between class to test , injected dependencies to mock/stub . so, in stage of new enlightenment wonder if there pitfalls way of testing?? thoughts on this? regards, morten an abstract class, of value, should have concrete subclasses can instantiated. unit test those, , via them implicitly base class. if has no concrete subclasses, can't think of reason why should exist (as abstract class, is). in general, prefer use mocking set environment of class tested, not instantiate class itself. distinction - me - keeps test cases clearer, , ensures test real functionality of class. of course, can think of cases (with legacy code) when main issue able write unit tests somehow, anyhow, enable refactoring (as discussed in working legacy code ). temporary solution in such cases, ...

git - apparently same commits give different sha1, why? -

after re-write of subtree history repository script of mine, compared git filter-branch ... on same subtree. see initial commits have different sha1 although expected them identical (consequence of commits both histories have different sha1). doing git show --format=raw <commit-sha1> on both commits gives same output (except first line, commit <commit-sha1> , introducing result). object files different, binaries, can't figure out root cause. assuming git versions consistent each other, explain have 2 different sha1? thank you git's inputs commit hash include metadata such sha1 of tree, sha1 of parent, commiter's name, email , commit date, , author's name, email , commit date. when rewrote history, commiter commit date , tree (since did filter-branch ) have changed, hence difference in commit's sha1. for more information format of commit, can use git cat-file commit <sha> , or git objects section of git book .

jquery - Lof JSliderNews URL problem -

i'm trying install lof jslidernews on website , working well, pictures , titles swicthing fine urls don't. seems point latest post. i've been looking around quite while couldn't find solution. has encountered same problem? thanks help. lita dude. i've been cracking head off tru table trying figure out issue, , it's simple css mistake. check on style6.css (that came inside on .zip file) , check : .lof-main-item-desc{ z-index:100px; <<--- line it's wrong. position:absolute; bottom:0px; left:0px; width:100%; background:url(images/bg_trans.png); height:45px; padding:10px; } replace this: .lof-main-item-desc{ z-index:100; position:absolute; bottom:0px; left:0px; width:100%; background:url(images/bg_trans.png); height:45px; padding:10px; } (remove px on z-index) after 100 , that's is. cheers ck.

security - Is it possible to inject shell/python commands from a configuration file? -

say have meta data custom file format python app reads. csv variables can change file manipulated: var1,data1 var2,data2 var3,data3 so if user can manipulate meta data, have worry crafting malformed meta data file allow arbitrary code execution? thing can imagine if you made poor choice make var1 shell command execute os.sys(data1) in own code somewhere. also, if c have worry buffers being blown, don't think have worry python. if reading in data string possible somehow escape string "\n os.sys('rm -r /') , sql example totally wont work, there similar possible? if doing there (plain text, reading , parsing simple format), safe. indicate, python safe more mundane memory corruption errors c developers can create if not careful. sql injection scenario note not concern when reading in files in python. however , if concerned security, seems (interjection: you! programmer should lazy and paranoid), here things consider: validate input . make sure each ...

routes - rails in production mode doesn't render index.html -

i tried application in production mode , index.html file in public folder doesn't rendered, i'm getting actioncontroller::routingerror (no route matches "/"): error. the index.html file rendered in development , test environment. how be? solved putting rails real webserver apache, because rails in production mode never serve static content.