Posts

Showing posts from May, 2011

symfony - How to use Repository custom functions in a FormType -

the problem i'm facing have create selectbox in form holds parent entities (category entity). managed with: $builder->add('parent', 'entity', array( 'class' => 'kprcentarzdravljabundle:category', 'query_builder' => function($repository) use ($param, $catid) { return $repository->createquerybuilder('p') ->where('p.id != :id , p.parent = :parent') ->setparameters(array('id' => $param, 'parent' => $catid));}, 'property' => 'name', 'required' => false, 'attr' => array('data-placeholder' => '--izaberite opciju--'), )); as u can see pass 2 arguments first current category.id(a category cant own

sql - Return cursor results from anonymous block -

i have following select want change anonymous block (need use anonymous block doing within java , not have access created stored functionality) in order remove use of literal bind variable: select il.lat_num, il.lngtd_num item_location il il.item_id = 294341; i have 2 anonymous blocks created unable find how return values created in both: 1) declare itemid number; latitude number; longitude number; begin itemid := 294341; select il.lat_num, il.lngtd_num, latitude, longitude, item_location il il.item_id = itemid ; end; 2) declare type t_ref_cursor ref cursor; c_cursor t_ref_cursor; itemid number; latitude item_location.lat_num%type; longitude item_location.lngtd_num%type; begin itemid := 294341; open c_cursor select il.lat_num, il.lngtd_num, item_location il il.item_id = itemid

c# - Resending email in SendCompleted Event -

i have class called schedulerservice, , in have sendmail function that's called when email needs sent @ time. when call sendmail function, pass in object holds information send email , email from. now, i've added sendcompleted handler can possibly resend email, in case happens causes not to. have code sends mail: var recipients = emailto.split(',').tolist(); if (string.isnullorempty(emailfrom)) emailfrom = recipients[0]; using (mailmessage message = new mailmessage()) { message.from = new mailaddress(emailfrom); recipients.foreach(a => message.to.add(new mailaddress(a))); message.attachments.add(new attachment(locationofresults)); message.subject = string.format("{0:mm-dd-yyyy} results task: {1}.", datetime.now, description); message.body = "attached results file specified task: " + description; smtpclient.sendcompleted += new sendcompletedeventhandler(sendcompletedca

Bash - multiple test [[expressions]] in linux -

i asked question yesterday trying make sure date formatted correctly. more targeted i've tried write test myself , it's not acting have expected to. (i'm new linux, happens fair amount) i need date inputted yyyymmdd. think start of if statment should checking [[ check if $tdate 0 string or if date not yyyymmdd ]]. when run code date there $lastcob (yesterday, last close of business), when input date (or don't change date), " invalid date. please enter correct format ." response, meaning test doesn't believe format correct, though it's entered yyyymmdd want be. tdate=$(lastcob) tdateokay=0 until [[ $tdateokay -eq 1 ]] ; echo "$tdate" echo "$tdateokay" read -p "please enter date search. use format: date (yyyymmdd): " -e -i "$tdate" tdate if [[ -z "$tdate" || "$(date --date=$tdate + '%y%m%d' 2>&1 )" != $tdate ]] ; echo &

c# - How to get Generated Html form HtmlGenericControl -

i have template html page, , need add contents dynamically in asp.net. need make many instences of template page, depending in data. its obvious creating large html using strings dirty way. choosed generate html using htmlgenericcontrol. , made it. i cant generated html string it . its simple add these controls in asp.net pages , rendered, need html. if not possible, there other structrued way of generating html...??? trick told @bartdude worked charm... for other peoples, solution goes in way... // create generic controls htmlgenericcontrol maindiv = new htmlgenericcontrol("div"); // setting required attributes , properties // adding more generic controls // finally, html when ready stringbuilder generatedhtml = new stringbuilder(); using (var htmlstringwriter = new stringwriter(generatedhtml)) { using(var htmltextwriter = new htmltextwriter(htmlstringwriter)) { maindiv.rendercontrol(htmltextwriter); output = generatedhtml.tostr

Identical strings in PHP and Java are not equal -

i'm experiencing strange problem, when send string php java (android). the whole story rather simple: java application sends keyword php script. php script looks in db , sends json encoded array (as string) java application. i can see string in textview field in android , looks this: [{"name":"berlin"}] but java not accept valid json string (unlike online json validators), because keeps throwing exception: "a jsonarray text must start '[' @ character 1". when compare strings identical string hardcoded in java using "equal()" turns out, aren't equal. , more disturbing: java returns length of json string 20, not 19. why be? there no unusual characters umlauts. 20th character? i'm suspecting encoding problem, i'm pretty sure (php file, java file) utf-8 encoded. (before asks: can provide code, don't know part relevant.) try int ascii_code = jsonstring.codepointat(0) and see get

android - Twitter alternate for facebook feed dialog for mobile web app? -

i have integrated facebook in mobile web app using feed dialog sharing, following below tutorial direct url example. https://developers.facebook.com/docs/reference/dialogs/feed/ now, trying same twitter. there alternate direct url example of facebook? thanks, easwar for twitter need have accesstoken , getting accesstoknen refer -> twitteroauthview you need add twitter4j jar in build path.

Entity Framework Code First: How can I determine the foreign key property used for a navigation property at runtime? -

i have entity framework code first dbcontext following entities configured. in example class bar child of class foo. public class foo { public guid id { get; set; } public virtual icollection<bar> bars { get; set; } } public class bar { public guid id { get; set; } public guid fooid { get; set; } public virtual foo foo { get; set; } } now know internally, entity framework understands relationship between foo , bar defined foreign key bar.fooid. i'd somehow extract relationship @ runtime using expressions. i'd implement method behaves follows: var context = new foobardbcontext(); var bar = context.set<bar>().first(); // want method return bar.fooid when passed expression b => b.foo object result = myservice.getforeignkeyvalue(bar, b => b.foo); now in simplistic example know bar.fooid , done. point i'm writing class believe getforeignkeyvalue method specified above cleanest interface user. is possible query dbcontext c

arrays - Parsing an input separated by delimiter in PHP -

i developing php application online code judge. same, taking input passing on java server calculating output , again matching generated output desired output. works single input or output. i want extend such multiple inputs can parsed java server , output obtained matched respective desired output. $input = str_replace("\n", '$_n_$', treat($fields['input'])); //$fields has result of sql query fwrite($socket, $input."\n"); // write input socket as of have input : input 1 2 3 4 5 output(in case sum) 15 this input matched expected output have already now want is, if input : 1 2 3 4 5 # 1 3 5 7 # 1 2 6 7 i want @ once 1 input passed jave server ,then , on. inputs can separated delimiter in case have used #. how proceed it? should use associative arrays?

ios - Position text in a textfield -

i position text in textfield more specifically. my current code: uitextfield * textfieldindustry = [[uitextfield alloc] initwithframe:cgrectmake(10, 10, 465, 68)]; textfieldindustry.font = [uifont systemfontofsize:17.0]; textfieldindustry.placeholder = @"tap to.."; textfieldindustry.textalignment = nstextalignmentcenter; this code: textfieldindustry.textalignment = nstextalignmentcenter; centers text not want it. how position using example x & y? you cannot set position of text implicitly in uitextfield without subclassing it. you can use uitextview instead, , should use same approach it: uitextview *textview; uiedgeinsets insets = uiedgeinsetsmake(top, left, bottom, right); [textview setcontentinset:insets]; you can use this approach subclassing uitextfield.

mysql - IBM Worklight database connection -

i have installed worklight server , db2 database, , try migrate application has mysql database not working. there workaround? have use adapter interface db2 , mysql? a database requires connector driver in order interface it. had used ibm installation manager install worklight db2 database (available ibm worklight customers, one?), require supply such driver, assume - since did not provide information on environment setup - using development edition (eclipse + worklight studio plug-in). in case need edit worklight.properties file (can found in eclipse under yourproject\server\conf). change database type db2 (ucomment it) , supply required information based on environment. the db2 connector can download through page . correct version installation of db2. place driver in lib folder (can found in eclipse under yourproject\server). if in fact using liberty or websphere, see troubleshooting section installation instructions db2 , more .

jsf 2 - how can I fix Value is not valid when selectOneMenu items are changed? -

being newbie @ jsf, i've ran situation don't understand how solve. have page 2 selectonemenu objects (financialcolumn, linesofbusiness) depending on values of 2 other selectonemenu objects (year, businesstype). contents of financialcolumn & linesofbusiness can different depending on year or businesstype selected (all components requestscoped beans). <h:outputtext value="data year:" /> <h:selectonemenu id="year" value="#{yearoptions.year}" > <f:selectitems value="#{yearoptions.options}" /> <f:ajax execute="@this businesstype" render="financialcolumn linesofbusiness" /> </h:selectonemenu> <h:outputtext value="business type:" /> <h:selectonemenu id="businesstype" value="#{bustypeoptions.buslistkey}" > <f:selectitems value="#{bustypeoptions.options}" /> <f:ajax execute="@this year" render="

java - Two independent classes that communicate using an Interface -

is possible have 2 independent class communicate implementing interface, , if so, how? i think using interfaces little extreme here i'm assuming simplification of larger problem public interface someinterface { public void givestring(string string); public string getstring(); } public class class1 implements someinterface{ string string; public class1(string string) { this.string = string; } //some code @override public void givestring(string string) { //do whatever string this.string=string; } @override public string getstring() { return string; } } public class class2 implements someinterface{ string string; public class2(string string) { this.string = string; } //some code @override public void givestring(string string) { //do whatever string this.string=string; } @override public string getstring() {

plugins - Properties View Extension - PropertyContributor and PropertySource are different? -

i extending properties view implementing separate plug-in, defining tabbed property contributor/tabs/sections in manifest. the property contributor active workbench part. have managed simple section in different tab (kind of hello world), when active workbench part chosen. next thing fill these sections informations property source. property source need use isn't in plug-in project of contributor. know these are, plug-in project of property source not extending (supporting) tabbed properties view. thing clicking/choosing property sources basic list view of properties. so, first question is: possible? work define workbench part propertycontributor , in same time use properties of property sources in propertysections other plug-in project workbench part? as in below link, use same contributor (contributorid) extensions; propertycontributor, propertytabs , propertysections. *link: http://www.eclipse.org/articles/article-tabbed-properties/tabbed_properties_view.html and s

php - Break time into multiple times -

let's have array multiple instance of class: class booking { public $status; public $start_time; public $end_time; } array[0] $status = true $start_time = 13:30 $end_time = 14:00 array[1] $status = true $start_time = 14:30 $end_time = 17:30 array[2] $status = true $start_time = 20:30 $end_time = 21:30 array[3] $status = true $start_time = 22:00 $end_time = 23:30 how elaborate function given time, 12:00 , 23:00 generate array, multiple instances of same class, although this: array[0] $status = false $start_time = 12:00 $end_time = 13:30 array[1] $status = true $start_time = 13:30 $end_time = 14:00 array[2] $status = false $start_time = 14:00 $end_time = 14:30 array[3] $status = true $start_time = 14:30 $end_time = 17:30 array[4] $status = false $start_time = 17:30 $end_time = 20:30 array[5] $status = true $start_time = 20:30 $end_time = 21:30 array[6] $status = false $start_time = 21:30 $end_time = 22:00 array[7] $s

asp.net mvc - Can I write an inline if with HTML content? -

i want write like: @( checkcondition ? "<span class='label'>right!</span>" : "") but showing source code instead html, there easy way this? thank you! you can use @html.raw(mystring) method this: @( checkcondition ? html.raw("<span class='label'>right!</span>") : html.raw(""))

racket - Scheme's "expected a procedure that can be applied to arguments" -

i use drracket. have problem code: (define (qweqwe n) ( (cond [(< n 10) #t] [(>= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))] [else #f] ) ) ) (define ( rty file1 file2 ) (define out (open-output-file file2 #:mode 'text #:exists 'replace)) (define in (open-input-file file1)) (define (printtofile q) (begin (write q out) (display '#\newline out) )) (define (next) (define n (read in)) (cond [(equal? n eof) #t] [else (begin ((if (qweqwe n) (printtofile n) #f)) ) (next)] ) ) (next) (close-input-port in) (close-output-port out)) but when start ( rty "in.txt" "out.txt" ) have error @ ((if (qweqwe n) (printtofile n) #f)) : application: not

java - Eclipse Junit run configuration that takes the current selected test class as an arg? -

instead of creating identical debug configuraitons test cases, able save few arguments common across junit tests, right click on specific test, run single run config. ie i single debug configuration can take argument current selected test case instead of requiring me manually specify every time in junit run configuration. options in dialog appear either specify single test class or run tests in project. result, eclipse littered dozens of run configurations test cases. instead of specifying specific test class, i'd specify variable ${container_loc} or ${resource_loc} class run in this question . there variable in eclipse specifies current selected java class place in test class field in dialog? a specific example useful when running lucene unit tests. there's lots of arguments can specify customize tests, of -ea required. everytime want test specific test case in lucene in eclipse, have manually setup these variables in eclipse debug config dialog :-/. have lo

php - Smarty - Too many conditions inside {IF} {/IF} -

i've got following problem - need use condition {if} {/if} many variables, whole site goes blank when put code: {if $product.id_category_default == 6 || $product.id_category_default == 9 || $product.id_category_default == 10 || $product.id_category_default == 11 || $product.id_category_default == 12 || $product.id_category_default == 13 || $product.id_category_default == 14 || $product.id_category_default == 8 || $product.id_category_default == 60 || $product.id_category_default == 35 || $product.id_category_default == 36 || $product.id_category_default == 37 || $product.id_category_default == 38 || $product.id_category_default == 39 || $product.id_category_default == 40 || $product.id_category_default == 41 || $product.id_category_default == 93 || $product.id_category_default == 31 || $product.id_category_default == 32 || $product.id_category_default == 33 || $product.id_category_default == 34 || $product.id_category_default == 94 || $product.id_category_default == 53 || $pr

jquery - Javascript: Combine function argument with string to reference var -

i have vars this: var cardholder = $("#cardholder"); var cardholderinfo = $("#cardholder-info"); and function (which doesn't work) looks this: function validaterequired(field){ //if it's not valid if(field.val().length < 1){ field.addclass("field_error"); fieldinfo.text("(required)"); fieldinfo.addclass("error"); return false; } //if it's valid else{ field.removeclass("field_error"); fieldinfo.text(""); fieldinfo.removeclass("error"); return true; } } which access like: cardholder.keyup(validaterequired(cardholder)); i've looked everywhere can't find need , i'm not sure should searching for. i can use field value access straight cardholder var. want use field value reference cardholderinfo can manipulate element in function. you call function this, passing second

Highcharts: Change the Legend TItle on drilldown -

i'm trying have legend title change when drill-down next level of data. currently, i'm using click event call function removes existing series , adds new ones, followed chart.redraw(). is possible set legend title using .attr in same function? i've seen few examples use change y-axis or chart title, can't working legend title. function redrawlegend(legendtitle) { chart.legend.attr({ text: legendtitle }); }; 'legendtitle' in case variable have stored drill-down data. use: chart.legend.title.attr({ text: 'aaa' }); example: http://jsfiddle.net/ag6wq/

qt - How to force QAbstractItemView recalculate items sizeHints -

Image
i have qlistview , qtabwidget inside qsplitter. qlistview using custom model , custom delegates. in delegate reimplemented paint , sizehint methods. when resize view - height of elements doesn't recalculated. how can fix it? sample images: in google found possible emit layoutchanged model, want current view updated, because content of model doesn't change. delegate code: void chatitemdelegate::paint( qpainter *painter, const qstyleoptionviewitem& option, const qmodelindex& index ) const { painter->save(); chatitem *item = static_cast< chatitem * >( index.internalpointer() ); qtextdocument doc; doc.sethtml( item->htmltext() ); doc.settextwidth( option.rect.width() ); qrect clip( 0, 0, option.rect.width(), option.rect.height() ); painter->translate( option.rect.topleft() ); qcolor bgcolor = index.row() % 2 ? qcolor( 255, 0, 0, 40 ) : qcolor( 0, 255, 0, 40 ); painter->fillrect( clip, bgcolor ); doc.dr

Model Validation in ASP.NET MVC -

i not getting validation messages? idea how resolve? please take @ view, model, , controller code below. attached js files maybe im missing files? @model mvcapplication1.models.assesment <link href="../../content/site.css" rel="stylesheet" type="text/css" /> <script src="../../scripts/jquery.validate.min.js" type="text/javascript"></script> <script src="../../scripts/jquery.validate.min.js" type="text/javascript"></script> @using (html.beginform()) { @html.textboxfor(m => m.name) @html.validationmessagefor(m=>m.name,"*hello") } <input type="submit" value="submit" /> using system; using system.collections.generic; using system.componentmodel; using system.web.mvc; using system.componentmodel.dataannotations; namespace mvcapplication1.models { public class assesment { [required] public string name { get; se

mysql - Multiple column ORDERing in ZF? -

i got code $select ->from(array("e" => "embarcacoes")) ->join(array("i" => "imagens"), 'e.id = i.barcoid') ->where("e.tipo = '{$this->view->tipoembarcacao}'") ->group("i.barcoid") ->limitpage($paginaatual, $porpagina) ->order('e.prioridade desc'); it works well, if change ->order('prioridade desc'); line ->order('id desc'); still works well, if try: ->order('prioridade desc, id desc'); or ->order(array('prioridade desc','id desc')); it doesnt work. correct syntax make multiple orderign in zend framework? thanks. got solution, i have use this ->order(array('e.prioridade desc','e.id desc')); oh christ, such beginner mistake.

llvm dumping control flow graph to file inside a pass -

i want build control flow graph diagram in llvm in 1 of passes. use following show cfg block->getparent()->viewcfg(); //block basic block the problem pops windows. want dump cfg @ particular program point, dot file (or jpg if possible), not show in window. how can same? using llvm 3.1. note: modifying cfg in pass, before program point. hence cannot use opt -view-cfg . update: thanks mishr, able draw graph this writegraph(file, (const llvm::function*) &fun, true, "test"); //i have tired false the cfg shown. nodes blank. how can show contents of node take @ this, read comment before viewcfg() function. http://llvm.org/docs/doxygen/html/cfgprinter_8cpp_source.html the viewcfg() function intended printing cfg in new window. dump cfg in file have use cfgprinter pass can invoked handle dot-cfg .

php - How can I run a long background process in Zend Framework -

i'm trying run background process when user sends form action, , tell him process started , in ten minutes data updated. have troubles. in action looks this: public function actualizarlineasaction() { $this->view->titulo = $this->_helper->x->lang("actualizar el número de líneas de todos los clientes"); if($this->getrequest()->ispost()) { if($this->_getparam('start')) { $descriptorspec = array( array('pipe', 'r'), array('file', 'myfile.txt', 'a'), array('pipe', 'w'), ); $proc = proc_open("php ".application_path."/../scripts/update_clientes_lineas.php > ".application_path."/../scripts/update_lines.log", $descriptorspec, $pipes); proc_close($proc); $this->view

vb.net - 'Sub Main' was not found. Service management console application error? -

there possibly few things wrong below. haven't had chance test/debug code yet can't run it. stating no main method has been found. there is? i've changed shared etc. it's obvious? it's flagging - 'sub main' not found in 'consoleapplication1.module1' error. also main method wasn't separate class, trying stuff. i'm importing reference - system.processes. created vb.form realised didn't want form part , recreated console app (which possibly problem lies it's 1 of first console apps i've done). code planned act on service dying. report , try , manage restart (not finished, ideas welcome). imports system imports system.management imports system.serviceprocess imports system.diagnostics imports system.threading imports system.io module module1 public class control public sub main() 'public sub main(byval sargs() string) dim restart new rest restart.starttime = datetime.now()

loops - PHP looping over object manipulate output based on object length -

i have php object looping over, know 2 things definate object, never need loop more 12 times (1-12) , have loop @ least once. my problem comes when object longer 6 items, if longer 6 items need split results 2 <ol> , live of me cannot figure out nice way this? here attempt, <?php $count = 1; ?> <?php if(is_object($active_projects)) : ?> <div class="col_1"> <?php if($count < 2) : ?> <strong>active projects</strong> <a href="/projects" class="view">view all</a> <?php endif; ?> <ol <?php echo ($count > 1 ? " class='no-header'" : ""); ?>> <?php foreach($active_projects $project) : ?> <li><a href=""><?php echo $project->project_name; ?></a></li> <?php $count ++; ?

asp.net mvc - Bad idea to manually edit a scaffolded view? -

i scaffolded new mvc controller, along corresponding view , repository ienumerable collection of poco class. in resulting view table list every entry in collection of class. however, table contains column every property in class, , want display subset of them in view. is bad idea if manually edit view remove don't want display in generated html? i'm not clear on whether scaffolding features part of asp.net mvc (version 3 , later) designed generate basic functionality web application, giving freedom want results afterwards, or if it's considered best practice leave generated results alone , find way want accomplish. know can customize own scaffolding templates, seems lot of work such simple change. thanks! it's ok edit scaffolded view. feature that's there build basics, never suffice. so can edit want. keep in mind though if edit model, have manipulate view manually, that's normal think.

Call a javascript function from popup page - chrome extension -

i'm trying build google chrome extension according parameters given in form - on popup page, manipulate url. what way call javascript function , pass paramaters. pop up.html: <button onclick="callit()">try it</button> this js: function callit(){ chrome.tabs.getselected(null, function (tab) { var theurl = tab.url; var newurl=theurl+'?asd=yes' chrome.tabs.update(tab.id, {url: newurl}); }); } on debugger get: refused execute inline event handler because violates following content security policy directive: "script-src 'self' chrome-extension-resource:". so how should implement it? docs google content security policy http://developer.chrome.com/extensions/contentsecuritypolicy.html#jsexecution inline javascript not executed. restriction bans both inline blocks , inline event handlers (e.g. <button onclick="..."> ). changes between version 1 , 2 http://developer.chrome.com/extensi

Magento 1.6.2.0 — en_GB translate.csv isn't translating -

i'm trying alter occurrences of shipping & handling in magento site shipping & handling (incl.tax). i had search around , found needed create new translate.csv file , put in folder: /app/design/frontend/package/theme/locale/en_gb/ so, created translate.csv file following inside: "shipping & handling";"shipping & handling (incl.tax)" "shipping &amp; handling";"shipping &amp; handling (incl.tax)" and uploaded /app/design/frontend/package/theme/locale/en_gb/ i cleared magento cache , refreshed translation doesn't work, know problem is? thanks have specified english (great britain) in locale options setting in admin area? if no, need go system -> configuration, choose needed store view , find locale options section under general tab. next, locale drop-down, select right 1 (the first comes language, second – country, example, canadian english english (canada)). also need use comma (,) s

Replicate elements of a list in an array in R -

i new forum , r, beforehand apologies if question not clear or don't folllow 'unwritten rules' of forum. i doing simulation study in r loop running function several times. write results of function in list, each time loop runs function. these lists combine in array, dim(x,x,number of simulations). not sure whether right way do, looking way store x (number of simulations)-lists results in handy way in 1 variable (so can use variable var[i] <- function.. in loop). i hope clear mean. think example code makes more clear looking for: thaks lot hints/suggestions/answers of kind! #these e.g. variables output function. <- matrix(na, 2,1) b <- matrix(na,2,1) beta <- matrix(na,2,1) bp <- array(na,c(2,2,2)) #i save these variables in list (this done in function self) results <- list(a = a, b = b, beta = beta, bp = bp) #now, create array save list each time run #function in loop. tried this, did not succeed: results2 <- array(results, c(1,1,10)) re

java - How to ignore enum fields in Jackson JSON-to-Object mapping? -

i have json object like: {"name":"john", "grade":"a"} or {"name":"mike", "grade":"b"} or {"name":"simon", "grade":"c"} etc i trying map above json to: @jsonignoreproperties(ignoreunknown = true) public class employee{ @jsonignoreproperties(ignoreunknown = true) public enum grade{ a, b, c } grade grade; string name; public grade getgrade() { return grade; } public void setgrade(grade grade) { this.grade = grade; } public string getname() { return name; } public void setname(string name) { this.name = name; } } the above mapping works fine in future there more "grade" types let d,e etc breaks existing mapping , throws following exception 05-08 09:56:28.130: w/system.err(21309): org.codehaus.jackson.map.jsonmappingexception: can not construct instance of employee string value &#

objective c - Json Zero considered as NSNumber and greater as NSstring -

when value of json entry 0 xcode considers nsnumber , , when greater nsstring . problem when using if check value, app crashes in cases. check if json value 0, how should resolve this? json: ( { likescount = 0; // nsnumber } ) ( { likescount = 1; // nsstring } ) you can use integervalue property, exists on both nsnumber , nsstring .

haskell - HUnit testing with file dependent tests -

i have lexer, , wish test against set of known test cases. these held in subdirectory ./test_src/ , , each has extension testname .txt what i'd paths relevant test cases: gettestfiles :: io [filepath] find (extension ==? ".txt") "/path/to/test_src/" and create hunit testlist containing hunit testcases each assertion created via function along lines of testmylexer :: io filepath -> assertion something along lines of mytest :: [io filepath] -> test mytest = testlist $ fmap testcase $ fmap testmylexer where seem failng in approach seems first require follwoing function, , mapping on result: unabletodothis :: io [filepath] -> [io filepath] i've strong suspicion approach i'm following impossible, seems require escaping io monad, i'm asking is: is approach viable, if missing? if not, how go solving problem? must pretty common avoid hard coding in test cases usually if wrapped io a values in arguments you'

Google Maps v3 Shapes -

i trying take string has shape option information , create shape on google map application. the string made splitting array built local text document. the string appears as: circle{center: new google.maps.latlng(38.041872419557094, -87.6046371459961),radius:5197.017394363823,fillcolor: '#000000',strokeweight: 1,strokecolor: '#000000',map:map}; the function have take such string , make shape appears as: function loaddrawings(evt) { var f = evt.target.files[0]; if (!f) { alert("failed load file"); } else if (!f.type.match('text.*')) { alert(f.name + " not valid text file."); } else { var r = new filereader(); r.onload = function (e) { var contents = e.target.result; var drawings = []; var drawing; var drawingtype; var shape; var shapeoptions; drawings = contents.split

can I use www as a cname for cloudfront domain if my domain already redirects to www -

i'm trying use cloudfront on whole web site, want use domain name instead of cloudfront one. currently (before cloudfront) request domain example.com redirected code www.example.com. on dns cname www.example.com has value of example.com. now have configure cloudfront , have domain (example1234.cludfront.com). do thing need is, change value of cname www.example.com example1234.cludfront.com? , using cludfront domain? thanks yes, although might need configure web server on cloudfront side know new name show correct website clients if server using vhosts. i've never used cloudfront, specifically, don't know details setup. edit: although re-read question wonder if might have misread want do. i think current dns record like: www.example.com. 3600 in cname example.com. which means when browser asks www.example.com find ip ip of example.com if instead configure dns example.com cname record like www.example.com. 3600 in cname examp

r - adf.test returning p > 0.99 with xts, but returning p < 0.01 with coredata(xts) -

here output: library(tseries) # adf.test function adf.test(data) augmented dickey-fuller test data: data dickey-fuller = 11.1451, lag order = 16, p-value = 0.99 alternative hypothesis: stationary warning message: in adf.test(spread.princomp) : p-value greater printed p-value adf.test(coredata(data)) augmented dickey-fuller test data: coredata(data) dickey-fuller = -4.031, lag order = 16, p-value = 0.01 alternative hypothesis: stationary warning message: in adf.test(coredata(spread.princomp)) : p-value smaller printed p-value the underlying data numeric vector. people seem successful @ applying adf.test xts, i'm not sure i'm doing wrong. please let me know other information can provide. ?adf.test says x (the first argument) should numeric vector or time series. "time series", means ts classed object, not any time-series class object. should convert xts object ts object before calling adf.test . for example: library(tseries) library

ruby - How to subscribe to the PubSubHubbub github? -

i'm attempting write basic client listens events (enterprise) github, , makes api calls accordingly. the problem have can't manage pubsubhubbub client configured. thought client/authentication i'm using, can't basic call the docs working! in attempt work out i'm doing wrong, i'm making curl request normal github account: curl -u "joepym" -i \ https://api.github.com/hub \ -f "hub.mode=subscribe" \ -f "hub.topic=http://github.com/joepym/faraday/events/push" \ -f "hub.callback=*callbackurl*" and i'm getting back http/1.1 100 continue http/1.1 422 unprocessable entity server: github.com date: wed, 08 may 2013 18:13:24 gmt content-type: application/json; charset=utf-8 connection: keep-alive status: 422 unprocessable entity x-ratelimit-limit: 5000 x-ratelimit-remaining: 4989 x-github-media-type: github.beta x-content-type-options: nosniff content-length: 38 { "message": "invalid event: n

My Excel file of CSV data from Google Apps Script doesn't mirror my Google Spreadsheet -

Image
i'm trying write script passes information google spreadsheet, compiles csv file , emails file. my problem: csv file on excel file looks different of google spreadsheet (dead link). this excel file looks like, pasted google spreadsheet. the code using below: function myfunction() { //get active sheet, last row data has been entered, define range , use range values (called data) var sheet = spreadsheetapp.getactivesheet(); var lastrow=sheet.getlastrow(); var range = sheet.getrange(1,1,lastrow,91); var data = range.getvalues(); //define string called csv var csv = ""; //run loop through data , join values separated comma (var = 0; < data.length; ++i) { csv += data[i].join(",") + "\r\n"; } var csvfiles = [{filename:"example.csv", content:csv}]; mailapp.sendemail(session.getuser().getemail(), "new journey information", "", {attachments: csvfiles}); } you need ensure indivi

Send data from Android to Webservice to be inserted in my database -

i'm trying send few variables(or data) registration webservice android throught "httppost" method. here's code. httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://mywebsitename.com/webservice/register.php"); try { list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(4); namevaluepairs.add(new basicnamevaluepair("fname", et3.gettext().tostring())); namevaluepairs.add(new basicnamevaluepair("lname", et4.gettext().tostring())); namevaluepairs.add(new basicnamevaluepair("userid", et5.gettext().tostring())); namevaluepairs.add(new basicnamevaluepair("pass", et6.gettext().tostring())); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpclient.execute(httppost); } catch (clientprotocolexception e) { // todo auto-generated catch block } catch (ioexception e) { // todo auto-generated c

regex - regular expressions on URL -

i need little assistants poor regex chops. trying grab 41398 url. number variable http://www.website.com/beta/flips/index/41398_1363874140/friend/756 i figured out how grab / after index. var url = document.url; var myregexp = /index(.*)/; var match = myregexp.exec(url); this leaves me /41398_1363874140/friend/756.... is there solution regex grab number between / , _ ? i tried var url = document.url; var myregexp = \/(.*?)\_; var match = myregexp.exec(url); and of course '/' issue. if know there underscore can use: var url = document.url; var myregexp = /\d+_/; var match = myregexp.exec(url);

SharePoint 2013 and ASP.NET WebApi -

i use asp.net webapi inside sharepoint 2013 farm solution. i know not supported out-of-the-box, found signalr can run means of simple httpmodule , wondering whether similar appoach used. thanks in advance, rich update june 2013 made working reworking http module shown in mentioned post: config.routes.maphttproute( name: "defaultapi", routetemplate: "kms2013/api/{controller}/{action}", defaults: new { } ); config.includeerrordetailpolicy = includeerrordetailpolicy.always; config.services.replace(typeof(iassembliesresolver), new spassemblyresolver()); hostingenvironment.registervirtualpathprovider(new webapivirtualpathprovider()); spassemblyresolver public class spassemblyresolver : iassembliesresolver { public icollection<assembly> getassemblies() { return new list<assembly> { assembly.getexecutingassembly() }; } } webapivirtualpathprovider same signalr

canvas - jQuery AwesomeCloud tag links -

i using jquery plugin awesomecloud generate nice looking tag clouds. https://github.com/indyarmy/jquery.awesomecloud.plugin so have tagcloud full of words, based on movie genre's. here demo page: http://indyarmy.com/awesomecloud/ i want make word's clickable, go search page, search movies have genre in them. the canvas generated dynamically, using php generate html this. <span id="genre" data-weight="3">action</span> as awesomecloud plugin script runs, converts spans display:none, , generates canvas. since clicking upon dynamically generated canvas, not able far, generate click event, , therefore current word value. any suggestions or tips? thank kindly time. you can use fork: https://github.com/fguimara/jquery.awesomecloud.plugin they've added functionality. you have change this: <span data-weight="18">google</span> for this: <span data-weight="18"><a href=&q

java - Weblogic 12c deployment error -

i'm using ant script build application. application working under 9.2 bea.lib=c:/bea92/weblogic92/server/lib - ant code - working when change 12c lib folder bea.lib=c:/bea12c/wlserver_12.1/server/lib , it's giving me error: [javac] bad class file: c:\bea12c\wlserver_12.1\server\lib\..\..\..\modules\features\..\javax.servlet_2.0.0.0_3-0.jar(javax/servlet/http/httpservletrequest.class) [javac] class file has wrong version 50.0, should 49.0 [javac] please remove or make sure appears in correct subdirectory of classpath. [javac] import javax.servlet.http.httpservletrequest; [javac] it seems using library has been compiled java 6 have javac lower 1.6. suggest upgrade compiler 1.6 .

php - Need some guidance regarding a licensing script (BoxBilling) -

i'm pretty new boxbilling licensing , fair, not providing support! i have code check license working correctly however, if license invalid, shows word "array" , if valid, shows nothing @ all. i need know how can set different message rather "array" if license invalid , how can kill page (via die() or similar). thanks in advance guys! <?php include("config.php"); include("opendb.php"); function getlicensedetails($key) { $systeminfo = mysql_query("select * `systeminfo`"); $systeminfo = mysql_fetch_array($systeminfo); $url = 'http://clients.pbtechsupport.com/index.php/api/guest/servicelicense/check'; $params = array(); $params['license'] = $systeminfo[licensekey]; $params['host'] = 'localhost'; $params['path'] = dirname(__file__); $params['version'] = '1.0'; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_verbose, 0); c

python - Why doesn't Selenium's response have a sessionId? -

i'm trying run selenium's firefox webdriver , getting error below. can see response not have sessionid - offending line self.session_id = response['sessionid'] - don't know why. i've run in following ways , same error: cygwin, running nosetests cygwin directly windows, running nosetests windows directly ---------------------------------------------------------------------- traceback (most recent call last): file "c:\dev\tools\cygwin\home\207013288\dev\projects\scorpion\test\unit\test_ approve_workflows.py", line 27, in test_login 'password', userid='207013288', test=true) file "c:\dev\tools\cygwin\home\207013288\dev\projects\scorpion\src\workflows.p y", line 20, in login browser = webdriver.firefox() file "c:\dev\sdks\python33\lib\site-packages\selenium-2.32.0-py3.3.egg\seleniu m\webdriver\firefox\webdriver.py", line 62, in __init__ desire

php - How to debug UPDATE execution in mysqli driver -

i've looked on lot of posts, still can't figure why simple update failing affect database: $con = mysqli_connect("localhost", "username", "password", "database"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $quantityarray = array(); foreach ($_post $key => $value) { $quantityarray[$key] = $value; } foreach ($quantityarray $key => $value) { $value = mysqli_real_escape_string($con, $value); } foreach ($quantityarray $key => $value) { $query = "update inventory set quantity = $value uniqueid = $key"; echo "<br /><br / >" . $query . "<br /><br / >"; $result = mysqli_query($con, $query); echo "<br /><br / >" . $result . "<br /><br / >"; } when script called, $_post array of unique ids keys , quantities values (both of integer

python - Tornado and WTForms -

i using wtforms first time. using wtforms validate post requests in tornado below forms forms.py class userform(form): user = textfield('user', [validators.length(min=23, max=23)]) in tonado handler have def post(self): form = userform(self.request.body) the error message is: formdata should multidict-type wrapper supports 'getlist' method" how make work? wtforms-tornado 0.0.1 wtforms extensions tornado. pip install wtforms-tornado wtforms-tornado

c# - textbox ontextchanged event is firing in update panel but throws error on client side -

i have 2 div on page. when first time page load shows first div has 2 radio button. if select second button postback , hides first div , shows second div. has textbox , dropdown inside update panel. insert text textbox , hit tab fire ontextchanged event. adding option inside dropdown. throws error on client side. error : "microsoft jscript runtime error: sys.webforms.pagerequestmanagerparsererrorexception: message received server not parsed." not sure here. here aspx page. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org /tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div id="divpanel1" runat="server"> <asp:label id="label1" runat="serv