Posts

Showing posts from July, 2012

osx - shc on Mac showing 'Killed: 9' error -

i'm using shc on mac os, generate stripped binary of bash scripts, distribution. issue is, when execute stripped binary (with .x ext) shows error killed: 9 . even when make , make test (as shown here ), strips dummy match script , generates match.x, when executed, gives same killed: 9 error. any appreciated. got working. had do shc -t -f test.sh i trying without -t

Python XML parsing from website -

i trying parse website. stuck. provide xml below. coming webiste. have 2 questions. best way read xml website, , having trouble digging xml rate need. the figure need base:obs_value 0.12 what have far: from xml.dom import minidom import urllib document = ('http://www.newyorkfed.org/markets/omo/dmm/fftoxml.cfm?type=daily''r') web = urllib.urlopen(document) get_web = web.read() xmldoc = minidom.parsestring(document) ff_dataset = xmldoc.getelementsbytagname('ff:dataset')[0] ff_series = ff_dataset.getelementsbytagname('ff:series')[0] line in ff_series: price = line.getelementsbytagname('base:obs_value')[0].firstchild.data print(price) xml code webiste: -<header> <id>ffd</id> <test>false</test> <name xml:lang="en">federal funds daily averages</name> <prepared>2013-05-08</prepared> <sender id="frbny"> <name xml:lang="en">federa

mbeans - EJB Lookup inside SAR -

my ear contains ejb file , sar file. cannot lookup on deployed ejb bean inside of mbean contained in sar file. i getting namenotfoundexception. how can lookup in ejb2x home interface inside mbean service (deployed via sar file on ear)???? i have solved issue below: 1) mbean not locate que ejb in jndi tree because not referenced in mbean declaration dependency. so, did this: <mbean code="app.schedulermanager" name="company:service=schedulermanager"> <depends>jboss.j2ee:module=my-ejb-jar.jar,service=ejbmodule</depends> </mbean> 2) declared in meta-inf/jboss.xml of ejb jar dependency can found: <jmx-name>jboss.j2ee:module=my-ejb-jar.jar,service=ejbmodule</jmx-name>

javascript - IE generates spurious mouse click event for absolute-positioned div when dragging child element -

in jsfiddle below, click link 'click show menu' display absolute-positioned div jscrollpane attached. start dragging scrollbar thumb allow mouse wander little right of scrollbar, , release mouse. in ie (versions 8,9,10) click event generated on document, triggers our code hide menu. in other browsers i've tested (firefox, chrome, safari) no such click event generated on document , menu remains displayed (as desired). in our web app, want clicks outside menu (i.e., reach document) hide menu. however, don't want menu hidden side-effect of drag initiated within scrollpane itself. is there simple workaround avoid issue? can jscrollpane updated somehow avoid problem? $(document).ready(function () { $('.scroll-pane').jscrollpane(); $('#menu').click(function () { console.info('menu clicked'); var api = $('.scroll-pane').show().data('jsp'); api.reinitialise(); return false; });

php - MySQL search multiple words in loop -

$keywords=array("test","tset"); $matches = implode(',', $keywords); $sql = "select * `reg` title in '%$matches%' group p_title"; $data = mysql_query($sql); while($info=mysql_fetch_array($data)) { print " {$info['title']}<br /> "; } i want write query $sql = "select * `reg` title in '%test%' group p_title"; $sql = "select * `reg` title in '%tset%' group p_title"; ........ how can search each keyword in 1 query ? "select * reg title in '%test%' or title in '%tset%' group p_title"

Coldfusion FileUpload function from cfc file not working -

i trying upload file using function cfc file. can code work when call <cffile action="upload"> on same page. however, wanted learn how call function in cfc file. believe there problem arguments i'm passing attributes of <cffile> tag, i'm not sure. here html form: <form action="confirm.cfm" method="post" enctype="multipart/form-data"> first name: <input type="text" name="fname" size="25" /> <br /> last name: <input type="text" name="lname" size="30" /> <br /> upload attachment file here: <input type="file" name="fileupload" id="fileupload" size="30" onchange="passfilename()" /> <br /> <input type="hidden" name="filename" id="filename" /> <b

java - Force an IllegalArgumentException -

one of past exam paper questions requires me modify method in such way illegalargumentexception occurs. the method involves withdrawing money bank account balance here method this. public void withdraw( double ammount ) { this.balance -= ammount; } how can modify method make exception occur? i've never seen exception before. an exception can thrown throw : throw new illegalargumentexception("amount must positive."); you should write rest of method yourself.

selenium - Reading from login.xls file and append results in same file? -

workbook workbook = workbook.getworkbook(new file("c:\\users\\tsss-pc1\\desktop\\login.xls")); sheet sheet = workbook.getsheet(0); string uname = sheet.getcell(0, 0).getcontents(); d.findelement(by.id("inputemail")).sendkeys(uname); string pwd = sheet.getcell(1, 0).getcontents(); d.findelement(by.id("inputpassword")).sendkeys(pwd); d.findelement(by.xpath("//div[3]/div/button")).click(); this code reading user name , password login.xls, want append results in third column in same file. writablecell label = new label(2,0, "pass"); writablesheet sheet1 = null; sheet1.addcell(label); i tryed code, it's not working me.. can 1 tell me, how this... writableworkbook workbook = workbook.createworkbook(new file("d://output6.xls")); writablesheet sheet = workbook.createsheet("first sheet", 0); label label = new label

sql server - How to group by column having spelling mistakes -

while working legacy data, want group data on column ignoring spelling mistakes. think soundex() job achieve desired result. here tried: select soundex(area) master group soundex(area) order soundex(area) but (obviously) soundex returned 4-character code in result rows this, loosing actual strings: a131 a200 a236 how include @ least 1 occurrence group query result instead of 4-character code. select soundex(area) snd_area, min(area) area_example_1, max(area) area_example_2 master group soundex(area) order area_example_1 ; in mysql select group_concat(distinct area) list_area versions, , don't know in sql-server, min , max give 2 examples of areas, , wanted discard diffs anyway.

Casting not working well in C -

programming c using xcode, here's f #include <stdio.h> int multiply (int x, int y) { return x * y; } int main() { float result = (float) multiply (0.2, 0.5); printf("the result %f", result); } i don't right value, 0.0000 !! did casting don't know whats wrong. your program multiplies 0 0 . multiply takes 2 int parameters, 0.2 , 0.5 implicitly converted int before making call. truncates both 0 . your typecast doesn't anything in program, since return value of multiply (which int ) implicitly converted during assignment result anyway. you need change definition of multiply (or add floating-point version , call that) if want program work correctly.

ios - AVPlayer interruptions handling -

i need handle avplayer interruptions incoming calls , headphones unplugging. so i'm trying use following code: viewcontroller.h @interface viewcontroller : uiviewcontroller <uiwebviewdelegate, avaudiosessiondelegate> viewcontroller.m - (void)viewdidload { [[avaudiosession sharedinstance] setcategory:avaudiosessioncategoryplayback error:nil]; [[avaudiosession sharedinstance] setactive:yes error:nil]; [[avaudiosession sharedinstance] setdelegate:self]; } - (void)begininterruption { } - (void)endinterruption { } - (void)endinterruptionwithflags:(nsuinteger)flags { } begininterruption , endinterruptionwithflags: called when incoming call received, not when headphones unplugged. i can use callback instead of delegate don't want duplicate code.

c# - Selenium - DOM not refreshing after javascript has loaded element -

i looking following element: <input id="login_input" value="" class="input_long " type="text" name="login" tabindex="1"> this element being loaded javascript after initial page loaded. code obtaining element: iwebdriver _drv = new chromedriver(); _drv.navigate().gotourl("http://mysite.com"); system.threading.thread.sleep(2000); { try { _drv.findelement(by.id("login_input")).sendkeys("555567756756"); } catch (exception e) { console.writeline(e.message); } } while (true); the error gives me saying a first chance exception of type 'openqa.selenium.nosuchelementexception' occurred in webdriver.dll , when element visible on site. what can obtain element? update: changed code little bit: iwebdriver _drv = new chromedriver(); _drv.url = "http://mysite.com"; //_drv.navigate().gotourl("http://mysite.com"); { tr

android - Bitmap coordinates after canvas.scale -

i need @ getting correct coordinates when touching canvas. i have image 1240x1756 the user can scroll around on bitmap. bitmap attached canvas. translating canvas. canvas.translate() the user can place new bitmap , move anywhere around on canvas. 256x256. up until point have no problem calculating touch coordinates @ scale factor of 1.0. take screen touch coords , add offset of image , check see if 256x256 moveable bitmap intersects touch coords. however issue getting correct coordinates after canvas has been scaled. 0.1-1.0 minimum , maximum scaling values. can point me in right direction working algorithm? you should able multiply pixel offset 1/scale factor.

facebook - How to provide accurate prices with new Payment system -

according new payment documentation available here if want dynamic pricing need set script fb call saying "user wants buy x items , wants pay in currency cc" , our script should return price in currency. documentation not clear our testing showed fb expects return price of 1 item rounded 2 decimals. if fb asks script "tell me price of 14 tokens in usd" , want 14 tokens cost 2usd need return round(2/14, 2) 0.14 , fb multiply 0.14 14 , show user needs pay 1.96$. so how supposed make fb show user needs pay 2 dollars 14 tokens? now managed access new payment flow (as fb made "breking change announcement"), can tell how managed around similar problem. situation: offering number of products user individually generated @ runtime, similar problem: 1 of products might example contain amount of ingame currency fixed price. @ time user might additional amount of currency free, resulting in product containing +x ingame currency, for same price .

Jquery mobile style not getting applied during ajax -

am trying load section of page using ajax in jquery mobile , append dom. styles of jquery mobile not getting applied.checked , found out there should .trigger('create') method should called. but, adding empty space. am doing below thing. $.ajax({ url : pagename, datatype : "html", success : function(data) { $("#score").html(data); $("#score").trigger("create"); } }); is there wrong in this. please help. it not seem work. below structure after listview inserted dom <div id="newssection"> <ul data-role="listview"> <li class="load" data-icon="false"> <a id="newslink" rel="external" href="newsdetail.html"> <div class="ui-grid-a">abc</div> </a> </li> <li class="load" data-icon="false"> <a id="newslink" rel="external" href=

superclass - What is the proper way to lazy initialize an abstract property in Objective-C -

in super class: @property (strong, nonatomic) foo *foo; in sub class: - (foo *) foo { if(!super.foo) super.foo = [[foo alloc] init]; return super.foo; } does make sense? idea have abstract properties? strictly speaking, there no "abstract class" or "abstract property" in objective-c, see example thread creating abstract class in objective-c overview. your approach not optimal, because requires superclass implements foo , setfoo: , contradicts idea of "abstractness". a better solution define "dynamic property" in superclass: @interface superclass : nsobject @property (strong, nonatomic) foo *foo; @end @implementation superclass @dynamic foo; @end and explicitly synthesize in subclass: @interface subclass : superclass @end @implementation subclass @synthesize foo = _foo; @end now can access foo on subclass object, on superclass object cause runtime exception. for lazy initialization, can use usual

java - sybase jdbc connection issue -

i beginner in sybase. trying make simple jdbc connection sybase server. using below code. i have jcon3.jar in classpath too. try { class.forname("com.sybase.jdbc3.jdbc.sybdatasource"); system.out.println("before connection"); connection conn = drivermanager.getconnection("jdbc:sybase:tds:localhost:1326/db","butt","clear"); system.out.println("after connection"); } catch (exception e) { e.printstacktrace(); } i not able achieve expect. below error getting. inside try before connection java.sql.sqlexception: jz00l: login failed. examine sqlwarnings chained exception reason(s). @ com.sybase.jdbc3.jdbc.errormessage.raiseerror(unknown source) @ com.sybase.jdbc3.tds.tds.for(unknown source) @ com.sybase.jdbc3.tds.tds.a(unknown source) @ com.sybase.jdbc3.tds.tds.login(unknown source) @ com.sybase.jdbc3.jdbc.sybconnection.a(unknown source) @ com.sybase

Android App exits unexpectedly -

i having weird issue app. spontaneously exits... log shows clean exit, no exceptions, callbacks called in order. event log mark finish reason of activities "app_request" there no touches or key pressed around exit code not have exit feature in it this not happen @ specific place, pretty sporadic the apk instrumented when happens it if os decided close app cleanly have clue how happens?

php - All javascript resources are failing to load after moving a MojoMotor site to a new server -

i moved mojomotor site new host , site broke. know has database access because if change database config options bogus, gives me connection error. changing back, error goes away. i tried removing .htaccess file in case causing problem. had no effect. i don't understand mojomotor , i'm not finding in documentation help. (oddly enough, because codeigniter documentation wonderful) the page loads, riddled resource errors. here's what's failing load according inspector: /javascript/load/jquery /javascript/load_parse/login /javascript/load/ui /javascript/mojo/index what missing? note: errors shown these failed resources 404 resource not found error i tried removing .htaccess file in case causing problem. had no effect. instead of removing it, check if it's working. is project same path in previous server? if in root folder, , it's in subfolder, problem. has new server right apache settings, overwriting rules via .htaccess? there c

create a mysql query with using php arrays -

i have , arrray below $titles=array("dr.","ms.","mr."); after foreach loop, create query below select * `table` title = 'dr.' or title = 'ms.' or title = 'mr.' ) group sentences output start mr. ms. mr. dr. i want put dr. first ms. mr. in order inside of array() as long input sanitized, can use implode prepare statement. $stmt = 'select * `table` '; $stmt .= "where title = '" . implode("' or title = '", $titles) . "'"; result select * `table` title = 'dr.' or title = 'ms.' or title = 'mr.' see demo you can alternatively use in : $stmt = 'select * `table` '; $stmt .= "where title in ('" . implode("', '", $titles) . "')"; result select * `table` title in ('dr.', 'ms.', 'mr.') you need fix group by ; you're not using correctly. if

read file in php until a specified string is found -

i have file wish read in php , split smaller files. the file base64encoded each section delimited in file (unecoded) tilde followed original filename of base64 encoded data followed tilde. as silly example, file : nbaynnbba~file1.txt~nbaynnbbanbaynnbbanbaynnbbanbaynnbba~file2.txt~ i don't want use file_get_contents files huge , don't want hit memory limited. can think of way of doing without having use fgetc char @ time ? there no line breaks in file way - 1 continous block.

laravel - How would you make a wizard system with PHP? -

i need create wizard system 1 of projects , how handle right now. /* pseudo functions */ function wizard_start() { //fill table default values, set isvisible column 0 } function wizard_step_1() { //update necessary columns (e.g name, sirname) } function wizard_step_2() { //update necessary columns (e.g date, type) } ... function wizard_final() { //do last touches , update isvisible 1 appear on website } i keep our current step in session. like; isset($_session['step2_completed']) $this->wizard_step_3(); isset($_session['step3_completed']) $this->wizard_step_4(); ... responses made via xmlhttprequest , expects data in json format. if json returns true, javascript loads next piece of wizard. (usually html forms different tasks.) i'm wondering if there better , more good-practice wizard alternatives. example, don't know if keeping current step in session or bad practice way. basically, how design such task yo

c++ - Are static members inherited? -

i have static member variable in class , class b derives class a. class { public: a() { = 3; } static int a; }; int a::a = 0; class b : public { public: b() { = 4; } }; void main() { obja; cout << "before:" << a::a; b obj; cout << endl << "after:" << a::a; } as per are static fields inherited? when derived type object made creates base type. have following questions: how instead of a::a can access obja.a ? static variables shouldn't accessible through objects of class. if derived class new static variable made (specific class b ) why not necessary initialize static variable class b ? why output of following shown as: before:3 after:4 when expected show 3 before , after? the access static variable inherited. note static members private access not accessible, protected keyword for.

xml - XPath 2 / XSLT : Find sibling nodes of a set with matching values of child node -

i couldn't find question in particular answered anywhere, , i've been struggling it. i'd able select xpath nodes in set child node value exists node in set same child node value a, , pair them together. for example, have xml document lists movies, 'imdb'. nodes here follow pattern: <movie> <title>pirates of carribbean: @ world's end</title> <year>2007</year> <directors> <director>gore verbinski</director> </directors> <actors> <actor>johnny depp</actor> ...... </actors> </movie> in example i'd find movies feature johnny depp have come out in same year movie of same. in output i'm sorting years - so, every year has more 2 movies johnny depp, want output year along movies. my xslt for-each select far looks this: <xsl:for-each select="/imdb/movie[contains(actors/actor/text(), 'johnny depp')][year = following-sibling::mov

vba - Excel: simple macro to paste as text returns error 1004: Could not run the paste method of worksheet class -

when try copy text application cell in excel 2010 (win 7 64bits) using macro: activesheet.pastespecial format:="text", link:=false, displayasicon:=false i error: error 1004 not run paste method of worksheet class looks line works fine else , similar questions on here none of answers works me any idea? thanks format parameter .pastespecial method seems sensitive application national/language settings. if run english version of excel call method way (as in question): activesheet.pastespecial format:="text", link:=false, displayasicon:=false i'm running polish version of excel , line above gives me error 1004. changing 'text' polish 'tekst' solve problem: activesheet.pastespecial format:="tekst", link:=false, displayasicon:=false if of doesn't know how solve similar problem best option record (with macro recorder) simple paste special operation.

powercli - PowerShell Object Count -

i'm using vmware powercli query datastores have amount of freespace. query come nothing, one, or more one. feel there's got easier way check if it's 1 or more one. $ds = get-datastore | {$_.freesapcegb -gt 50} | sort-object freespacegb -descending i know check if results this if ($ds) i know check if there's more one if ($ds.count) if there more one, want use 1 freespace use first one $ds[0] but if there one, $ds[0] not work , have use $ds, makes duplicate coding. i know can limit results | select -first 1 but without limiting results there easier way this? this should it: $ds = @(get-datastore | {$_.freesapcegb -gt 50} | sort-object freespacegb -descending) then should able use $ds[0] long $ds.count greater 0.

jsf - p:selectOneRadio converter causing stack heap memory issues -

really odd one... i have converter works when use p:selectonemenu, when switch p:selectoneradio, major crash java heap space errors. stacktrace seems of no use, java.lang.outofmemeoryerror. this works: <p:selectonemenu id="regions" value="#{admsbean.selectedregion}"> <f:selectitem itemlabel="global" itemvalue="#{null}" /> <f:selectitems value="#{admsbean.adminregions}" var="adminregion" itemlabel="# {adminregion.regionname}" itemvalue="#{adminregion}" /> <f:converter id="adminregionconverter" converterid="regionconverter" /> <p:ajax listener="#{admsbean.regionselect}" update="unassignedtasks"></p:ajax> </p:selectonemenu> this crashes , burns: <p:selectoneradio id="regions" value="#{admsbean.selectedregion}"> <f:selectit

Jquery UI checkbox as button change text value -

i using jquery ui , trying change text on checkboxes (they buttons). reason unable text change on each change event using toggle method. here html coming out in ie 8 <div data-hands-jqui-type='buttonset' data-hands-jqui-props='{"buttonwidth":0,"disabled":false,"handsoncreate":null}' class='editor-field ui-widget'> <label for="isclosedsunday">open</label> <input data-hands-jqui-props="{}" data-hands-jqui-type="checkfield" data-hands-onchange="vendor.isclosedselected" data-val="true" data-val-required="the open field required." id="isclosedsunday" name="isclosedsunday" type="checkbox" value="true" /> <input name="isclosedsunday" type="hidden" value="false" /> </div> to me looks label need change, couldn't figure out how it. no

javascript - How can I real time parse content in a textarea as the user types like how stackoverflow does it? -

when adding post @ stackoverflow, enter text on edit window, , appears modified in display window. instance... if type **some text , see **some text ( **some text ) if type **some text* , see * some text ( *<em>some text</em> ) if type **some text** , see some text ( <strong>some text</strong> ) how this? there jquery solution? this syntax writing in comments called markdown. there few javascript markdown parsers. https://code.google.com/p/pagedown/ example

java - Allowing final fields to take default values -

i writing parser binary file format. have created classes represent deserialized structures reading, in use final variables hold extracted data. class myobject { final int my_x; final int my_y; final int my_z; } the bump running presence of fields depends on flags being set. example: myobject(inputstream is) { my_x = in.read(); if (my_x == 1) { my_y = in.read(); if (my_y == 1) { my_z = in.read(); } } } however, gives me error because my_y , my_z may not initialized. these conditionals can 5-6 levels deep, , don't want track fields may not read @ each level of branch tree. complication that, based on flags, there may subobjects handle same pattern top-level structures. class myobject { final int my_x; final subobject my_subobject; myobject(inputstream is) { my_x = is.read(); if (my_x == 1) my_subobject = new subobject(is); } class subobject { final i

sql server - Table Design - Wide Table vs. Columns as Properties -

i'm part of team architecting operational data store (ods) database, using sql server 2012, used of our analysts predictive modeling. ods contain manufacturing production data single product make. we have hundreds of tables in ods. however, have single core table contain critical information (lifecycle info) each item manufactured (tens of millions each year). our product manufactured in manufacturing plant , spends 2.5 hours moving through various processes along production line. want store various, individual, pieces of manufacturing , post manufacturing information in core table. example piece of data might time product entered particular oven. we have decision make on how architect table. can create wide table (many columns) or narrow table columns rows (as property values). have never designed , worked table structure narrow , columns treated rows in table. i'd feedback on pros , cons of wide table vs. narrow table. following might useful in helping discussion:

php - Null response from salesforce soap api create call -

i have inherited php salesforce api code working. basic task sync information between salesforce , website. i have cron job pulls necessary salesforce, , inserts site expected. goes , updates custom field in sf indicate id in site table. however, opposite not working. have loop builds bunch of custom objects site's table, when sends on sf in $response = $client->create($array_objects, 'custom_object_name__c') the response null. no error message, nothing. does have ideas how can debug, or why happen? i've checked permissions, logged in user has full permissions on object. thank you! the php sdk using following foreach syntax: foreach($sobjects &$sobject){ ... $sobject = xx; } this not updating original array object, nothing being sent salesforce. created new array , assigned new objects new array, , works. i hope helps else.

wordpress - Woocommerce: disable payment method with cost on delivery -

Image
i have problem when select cost on delivery shipment method: paypal button doesn't disappear, user pay twice , undesirable behaviour. i've attached image clarify problem because i'm searching web don't find solution. thanks a way how through jquery. put inside of document following <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> then find file checkout page setup , enter following: $(document).ready(function() { if ($('input[name=your_radio_name]:checked').val() == "the value when element should hidden") { $('#id_of_the_element_that_should_be_hidden').hide(); }); });

sql server 2008 - Foreign key or link between part of column selection -

i have 3 tables in following setup create table [dbo].[codevariable] ( [id] [int] null, [code] [nchar](10) null, [variable] [int] null ) on [primary] create table [dbo].[proxy] ( [id] [int] null, [description] [nvarchar](50) null, [status] [bit] null, [added] [datetime] null ) on [primary] create table [dbo].[wall] ( [id] [int] null, [description] [nvarchar](50) null ) on [primary] following values in tables table wall 1 basic wall 2 medium wall 3 advanced wall table proxy 1 small proxy true 2013-05-08 00:00:00.000 2 medium proxy false 2013-05-08 00:00:00.000 table codevariable 1 proxy 1 2 proxy 2 3 wall 1 4 wall 2 5 wall 3 owke issue facing, if want insert lets new line in proxy. have id 3, need make sure id 3 exists in codevariable under code proxy! without foreign key there no check if code exists in code variable. i ha

javascript - Ajax response from a servlet is printing twice -

i facing problem while appending content of div using ajax.the response servlet printing twice. here code both pages. demo.jsp <html> <head> <script> function run() { var content = document.getelementbyid("output"); var xhr = new xmlhttprequest(); xhr.onreadystatechange = function() { content.innerhtml += xhr.responsetext; } xhr.open("post", "demo", true); xhr.send(null); } </script> </head> <body> <input type="submit" value="add content" onclick="run();"/> <div id="output">this static text.</span><br> </div> </body> demoservlet import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servl

xpages - Concatenating parameters -

i'm trying concatenate string in expression language access property of object , failing so. within xpage in lotus notes, want programatically select field want bind control on current xpage. the result achieve follows. #{podoc[advertisingdatestart];} i have variable named fieldname supply "advertisingdate" , want append "start" field , "end" end date field. tried several variations not work, such as: #{podoc[fieldname{'start'}];} note work if passed in "advertisingdatestart" , used #{podoc[fieldname];} the goal able place start date field , end date field while dynamically binding based on configuration documents. is, adding fields xpage using configuration documents , repeats instead of changing design. here 1 of ways tried create ending date field: <xp:inputtext id="inputtext5" style="padding-top:2px;text-align:left"> <xp:this.rendered><![cdata[#{javascript:rowdata.ge

jquery - Fancybox loading video in new tab with certain videos -

i have site (krelltech.com) has featured video on home page. previous link using ( http://krelltech.com/index2 ) opening in fancybox. put new video (i have no control on site hosting new video), , opening video in new tab. thoughts or suggestions? the issue have fancybox media works specific media-streaming services, per in documentation : youtube vimeo metacafe dailymotion twitvid twitpic instagram google maps for other servers (where don't have control) best bet open fancybox using iframe type mode. try adding new class new videos like <a class="btn newvideo" role="button" href="http://anotherserver.com/anothervideourl"... and write specific custom script them like $(".newvideo").fancybox({ type: 'iframe', width: 520, height: 320, fittoview: false, scrolling: "no", autosize : false, iframe: { preload: false } }); see jsfiddle

jquery - Can't get javascript text effect to work properly with delay -

i'm trying make random text effect kinda 1 @ end of movie war games (matthew broderick). idea have individual letters change randomly when ever user hovers on 1 of letters in word. after short time letter end being "decoded" meaning end on right letter or number. have built basic effect part struggling setting timer. want create small delay between hover-out event , actual display of decoded character. when add settimeout however. script breaks , seems stack timers. i'm not sure i'm doing wrong. below code i've got far.. great. function setdecodedchar(object){ var decodedmessage = "hello world"; var index = object.attr('class').substring(4); console.log(index); object.html(decodedmessage[index]); } function changechar(object){ var randomchar = getrandomchar(); object.html(randomchar); } function getrandomchar(){ var char = ""; var possible = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr

python - XML Library Suggestions -

i don't know if right place ask question, here goes… i have xml file want read. far, have been using lxml.etree.elementtree . however, find need functionality allows me travel child node, parent node in xml. this seems not possible lxml.etree.elementtree . there xml parsing library allow me this? in case matters, i'm on python 2.7.3 thank you xml.etree.elementtree.element s not keep track of parent elements, lxml.etree._element s do: parent = elt.getparent() for example, import lxml.etree et # import xml.etree.elementtree et text = '''\ <root> <foo> <bar/> <bar/> </foo> </root>''' root = et.fromstring(text) elt in root.findall('foo/bar'): parent = elt.getparent() print(parent) yields <element foo @ 0xb7415c34> <element foo @ 0xb7415c34>

javascript - Ember, observers trigger in a strange order -

here's controller eventtimezonecontroller . content property set event model. app.challengetimezonecontroller = ember.objectcontroller.extend timezones: [{value: "", label: ""}, {...}] timezonedidchange: (-> console.log "in controller", @get("timezone") ).observes("timezone") # tried "content.timezone" and event model: app.event = app.challenge = ds.model.extend(ember.validations, timezone: ds.attr('string') timezonedidchange: (-> console.log "in model", @get("timezone") ).observes("timezone") ) and then, have timezoneselect view app.timezoneselect = ember.select.extend valuebinding: "controller.timezone" contentbinding: "controller.timezones" optionvaluepath: "content.value", optionlabelpath: "content.label" now here's problem : when select new value in select drop

r - Possible bug: setting colnames of an xts object in the last line of a function -

i have r function follows form: creatextsfromfile <- function(file) { data <- read.table(file, sep = ",") data <- xts(data[, 1], order.by = data[, 1], unique = false) # manipulate data colnames(data) <- c("a", "b", "c") } however, calling function returns character[3]: data <- creatextsfromfile("file.txt") str(test) chr [1:2] "a" "b" however, after removing final line in function, same call returns xts. strange thing moving final line other line in function returns xts. has come across before? did search on https://bugs.r-project.org/bugzilla3/ didn't find anything. this not bug. help("function") tells happening. says, "if end of function reached without calling return, value of last evaluated expression returned." so need return data object: creatextsfromfile <- function(file) { data <- read.table(file, sep = ",&q

Moving a working Rails app, cannot load schema -

this question seems relevant error below, not know how create troublesome 'categories' table manually. spell out how answerer proposes? .../current$ bundle exec rake rails_env=production db:schema:load rake aborted! pgerror: error: relation "categories" not exist line 5: a.attrelid = '"categories"'::regclass ^ : select a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod pg_attribute left join pg_attrdef d on a.attrelid = d.adrelid , a.attnum = d.adnum a.attrelid = '"categories"'::regclass , a.attnum > 0 , not a.attisdropped order a.attnum try rake db:migrate . maybe schema not updated.

rails jbuilder - just an array of strings -

i have controller returns array of activerecord objects , jbuilder view generate json (all standard stuff). works great if want example array of hashes. so example have: json.array!(@list) |l| json.( l, :field ) end which returns [ { "field": "one" }, { "field": "two" }, { "field": "three" } ] however, want array of strings; such json is [ "one", "two", "three" ] whats should jbuilder file be? a bit late work: json.array! @list but consider use in block create json pair: json.data json.array! @list end # => { "data" : [ "item1", "item2", "item3" ] }

c return value through parameters -

so, i'm puzzled issue on hour. background: i have implementation of kernel threads in xv6 want test. the threads communicate return values via field ret_val. each thread saves return value in the other thread's ret_val (because can technically de-allocated after returning value). i have 2 parts in code not work i'd expect. *notes: field proc->ret_val of type void** field proc->has_waiting of type struct proc * part 1 (this part stores return value in process's struct): // store value in waiting thread's ret_val. (*proc->has_waiting->ret_val) = (void*)ret_val; cprintf("(t_exit)process %d taking return value %s\n", proc->pid, (char *)ret_val); cprintf("(t_exit)process %d has return value %d -> %s\n", proc->has_waiting->pid, proc->pid, (char *)(*proc->has_waiting->ret_val)); this ^ part's job store value in process's ret_val (inside "has_waiting" field, pointer

Some assistance with ASP.NET form creation... -

i have list of forms in source control. contentrequest.aspx contentrequest.aspx.cs default.aspx default.aspx.vb i have use of these forms create additional forms, using 1 of above forms template of sorts. i'm not sure how that. can provide me guidance? -kt you can create copy of whole aspx form want duplicate. in vs, right click on project(website) in solution explorer -> add -> new -> web form. name newname . copy default.aspx newname.aspx , same aspx.cs files. then have change source code of newname.aspx file on first line: codefile="default.aspx.cs" inherits="_default" -> codefile="newname.aspx.cs" inherits="_newname" and in newname.aspx.cs file: class _default : page -> class _newname : page

jquery - PHP Redactor WYSIWYG no post value -

i'm getting weird problem wysiwyg editor redactor not posting values server. here how i'm implementing it: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> <link rel="stylesheet" href="/assets/shared/javascripts/redactor/redactor.css" /> <script src="/assets/shared/javascripts/redactor/redactor.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#redactor_content').redactor({ imageupload: '/upload/image/<?=$_get['id']?>/', imagegetjson: '/upload/index/<?=$_get['id']?>/' }); }); </script> <textarea name="content" id="redactor_content"></textarea> and i'm trying retrieve post value using $_post['content'] . i thought might older version of jquery library if use demo scripts works fine jquery 1.7.2. i

android - How to bookmark HTML File loaded using WebView from assets? -

i have on 1000 html pages loaded on webview. below demo of code , want option can bookmark page if user clicks on specific button (perhaps bookmark icon in webview). let's if page 45 loaded on screen , user bookmarks it, want page added in listview user can jump specific page. public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); webview webview = (webview) findviewbyid(r.id.webview1); webview.loadurl("file:///android_asset/1.html"); } } ok create database holds list of strings. when user clicks button current url , add database. use adapter populate listview database. problem there? refer call java function javascript on android webview if need favourite button part of html content (though think bad idea)

bash - Running a command in multiple directories -

i running command in 1 of many subdirectories: ls *.rst -c1 -t | awk 'nr>1' | xargs rm essentially, lists files end .rst , sort them based on time created , want created file. delete rest of *.rst files. i have 200 directories need execute command in. have tried using find command pass location of directories command have not been successful. of these directories contain files inputs.in. have tried: find . -name inputs.in | xargs ls *.rst -c1 -t | awk 'nr>1' | xargs rm but believe since input ls *.rst bit full path including file name, has not been working. i'm sure it's quick fix , comments appreciated. run command parent directory. thanks! some ugly way: find . -name inputs.in | xargs dirname | \ xargs -i{} -n 1 find {} -name '*.rst' | xargs ls -c1 -t | \ awk 'nr>1' | xargs rm ls wildcard fail because globbing happens before find executed.

controller - Grails custom URL mapping for user nicknames -

i have custom url name requirement. each user have custom page , must @ root of domain for example: http:www.bemdireto.com.br/eduardo this conflict default controller's mapping. the application exists, cannot change controllers url. we have came following code "/$controller/$action?/$id?"{ controller = { def log = logger.getlogger('br.com.fisgo.urlmappings') log.trace "verifying if broker hot site or controller" def uri = delegate.getcurrentrequest().getrequesturi() log.info "acessando uri: ${uri}" urlmappingutil.handlebrokerhotsitecontroller(uri, {owner -> params.owner = owner }) } action = { def uri = delegate.getcurrentrequest().getrequesturi() urlmappingutil.handlebrokerhotsiteaction(uri) } } the method urlmappingutil.handlebrokerhotsitecontroller tell controller , nickname apart. the problem is: method being executed 7 times e

javascript - how to add spray paint tool for html5 canvas? -

currently have made pencil tool work , changed pencil colour, add spray paint tool lets draw onto canvas , change spray paint colour. this part of javascript spray paint tool have tried implementing, can't manage make work. //spray paint tool tools.spray = function () { var tool = this; this.started = false; this.mousedown = function (ev) { if (!tool.started) { return; } var len = 5 + ( math.random() * 5 | 0 ); for( var = 0; < len; ++i ) { context.beginpath(); context.strokestyle = currentcolor; context.arc( mousex + math.cos( math.random() * math.pi * 2 ) * radius * math.random(), mousey + math.sin( math.random() * math.pi * 2 ) * radius * math.random(), 1, 0, math.pi * 2, false ); context.fill(); } }, 33); } you can see full code here . if can appreciated. http://jsbin.com/urubev/9/edit in html had javascript code in option values. need change

javascript - How do you update HTML5 canvas from angular? -

i have little canvas draws cross , input box control angle of rotation. <input type='text' ng-model='angle'> <canvas id="mylitlecanvas" width="200" height="200"></canvas> <script> var canvas = document.getelementbyid('mylitlecanvas'); var context = canvas.getcontext('2d'); context.save(); context.translate(100, 100); context.rotate({{angle}} * math.pi / 180.0); // <---- problem context.translate(-100, -100); context.beginpath(); context.moveto(100, 0); context.lineto(100, 200); context.moveto(0, 100); context.lineto(200, 100); context.stroke(); </script> then have simple controller bound angle function mapctrl($scope) { $scope.angle = 45; } buti can't seem access angle or redraw canvas when value in text box changes. possible? there no token replacement in javascript blocks. r

html - Is border-radius of 1px more performant than border-radius of 10px? -

basically i'm wondering if rendering performance difference microsoft, linkedin , others refer between 0px , 1px or between 1px infinity px. have @ this article , stops short of answering question if there difference between higher , lower border-radius pixel values. describe how things tested (which tools , methods used), , provide test pages modify little , use test yourself.

c# - Popup control on Datagrid -

i'm having 2 issues here. have datagrid populated items. want happen display popup control under datagrid selected row. here's have: <grid> <datagrid canuserreordercolumns="false" canusersortcolumns="false" headersvisibility="none" autogeneratecolumns="false" verticalalignment="stretch" itemssource="{binding itemcollection}" selecteditem="{binding selecteditem}"> <datagrid.columns> <datagridtextcolumn width="*" binding="{binding path=key}" /> <datagridtextcolumn width="*" binding="{binding path=value}" /> </datagrid.columns> </datagrid> <popup popupanimation="scroll" placement="bottom" allowstransparency="true" isopen="{binding popupvisible}&quo

c# - Entry is throwing errors -

this question has answer here: error message: cannot convert type 'string' 'string[]' 4 answers i have this: static void main(string[] arg) and: main("month"); but reason, gives error: the best overloaded method match 'numbers.program.main(string[])' has invalid arguments and argument 1: cannot convert 'string' 'string[]' how fix these? the other answers correct (the compiler not let pass string argument method expecting string array), alternative approach change method signature of main method so: static void main(params string[] arg) the params keyword allows arguments passed in separately instead of array. thus, following calls equivalent: main("month"); main(new string[] {"month"}); incidentally -- while legal, not common call main method (your prog

pointers - How to make an iterator to a read-only object writable (in C++) -

i've created unordered_set of own type of struct . have iterator set , increment member ( count ) of struct iterator points to. however, compiler complains following message: main.cpp:61:18: error: increment of member ‘sentimentword::count’ in read-only object how can fix this? here's code: #include <fstream> #include <iostream> #include <cstdlib> #include <string> #include <unordered_set> using namespace std; struct sentimentword { string word; int count; }; //hash function , equality definition - needed used unordered_set type sentimentword struct sentimentwordhash { size_t operator () (const sentimentword &sw) const; }; bool operator == (sentimentword const &lhs, sentimentword const &rhs); int main(int argc, char **argv){ ifstream fin; int totalwords = 0; unordered_set<sentimentword, sentimentwordhash> positivewords; unordered_set<sentimentword, sentimentwordhash> negativewor

android - Convert device name to model name -

as know, android devices have device names maguro or crespo. there data source projection device name -> model name (e.g. maguro -> samsung galaxy nexus, crespo -> samsung nexus s)? check out android.os.build specifically, you're interested in this: public static final string manufacturer manufacturer of product/hardware. public static final string model end-user-visible name end product.

php - Ajax POST Requests return int instead of string -

i have following js code: var datastring = "action=validateusername"+ "&username="+usernameregi+ "&lang="+lang; $.ajax({ type: "post", url: "function.php", data: datastring, cache: false, success: function(result) { var expl=result.split("|"); if(expl[0]=="1") alert("1"); else if(expl[0]=="99") alert("99"); } }); this function.php if($_post["action"]=="validateusername") { $username=$_post["username"]; $lang=$_post["lang"]; $sqlselect = "select * user username='".$username."'"; $sqlquery = mysql_query($sqlselect); $rowcount = mysql_num_rows($sqlquery); if($rowcount>0) { if($lang=="bm") echo "99|my msga."; else echo "99|my msg