Posts

Showing posts from March, 2013

javascript - change input box into hyperlink -

i have code google map marker thing. im around couple of days. have code in map_process.php $mname = filter_var($_post["name"], filter_sanitize_string); $maddress = filter_var($_post["address"], filter_sanitize_string); $mtype = filter_var($_post["type"], filter_sanitize_string); $results = $mysqli->query("insert markers (name, address, lat, lng, type) values ('$mname','$maddress',$mlat, $mlng, '$mtype')"); if (!$results) { header('http/1.1 500 error: not create marker!'); exit(); } $output = '<h1 class="marker-heading">'.$mname.'</h1><p>'.$maddress.'</p><p>'.$mtype.'</p>'; exit($output); } and want change text inserted in input box clickable link. can me? i trying this <html> <head> <title>links</title> <script type="text/javascript"> function

c# - Null Value Found. You must specify a NullValueAttribute -

i'm using filehelpers library import , process spreadsheet. i'm having problem couple of properties of entity. added [fieldnullvalue(null)] attribute both properties had no effect. still same error. did miss something? [fieldtrim(trimmode.both)] [fieldconverter(typeof(customdatetimeconverter))] [fieldnullvalue(null)] private datetime? _estduedate; [fieldoptional()] [fieldnullvalue(null)] private int? _id; update: went ahead , set default values in attribute [fieldnullvalue(typeof(datetime), "2000-1-1] when send service call write database checked field , set null if it's default date not optimal solution it's not overhead. can deal default value id being 0 indicates service it's new record anyway

google app engine - Objectify - ofy() in method defined outside of transaction -

a basic transaction looks this: import static com.googlecode.objectify.objectifyservice.ofy; import com.googlecode.objectify.work; // if don't need return value, can use voidwork thing th = ofy().transact(new work<thing>() { public thing run() { thing thing = ofy().load().key(thingkey).now(); thing.modify(); ofy().save().entity(thing); } }); when ofy().load() , other ofy() methods called within transaction have benefits of transaction, such being atomic. however, using util method contains ofy() method escape transaction? following. // if don't need return value, can use voidwork thing th = ofy().transact(new work<thing>() { public thing run() { util.modify(thingkey); } }); where util defined somewhere so. public class util { public static modify(thingkey) { thing thing = ofy().load().key(thingkey).now(); thing.modify(); ofy().save().entity(thing); } } the 2 ca

Is there a do-while loop in bash? -

this question has answer here: emulating do-while loop in bash 3 answers is there do - while loop in bash? i know how program while loop in bash: while [[ condition ]]; body done is there similar construct, do - while loop, body executed @ least once irrespective of while condition? while loops flexible enough serve do-while loops: while body condition true; done for example, ask input , loop until it's integer, can use: while echo "enter number: " read n [[ -z $n || $n == *[^0-9]* ]] true; done this better normal do-while loops, because can have commands executed after first iteration: replace true echo "please enter valid number" .

windows - win7 express js: 'express' is not recognized in cmd -

i have node.js installed , running fine on windows 7 computer. run > npm install -g express > npm install -g express-generator > npm install -g express-generator@3 and install successfully. when go new folder , try: > express myproject i get: 'express' not recognized internal or external command, operable program or batch file i see 'express', 'express.cmd', , 'node_modules' directory 'express' , 'express-generator' folders in c:\users\me\appdata\roaming\npm directory i added npm directory path in case missed. i tried solutions find: 'express' not recognized command (windows) https://groups.google.com/forum/#!topic/express-js/cr92_lc_puk what else can try express working? check have path express folder in path. remember need reopen cmd apply changes in environment variables modifying them not modify variables of working processes, afaik. if changing system-wide environment variables, ma

html - Override device-width -

i'm working on website , i'm trying make mobile friendly including <meta name="viewport" content="width=device-width"> in html. unfortunately have element needs larger device width. going use media queries hard code values element on different screen sizes seems not able override elements width. this element width want override: <div id="menu_bar"> currently way can override elements width doing: <div id="menu_bar" style=" width: 1024px;"> however if do: <style> #menu_bar {width : 1024px;} </style> <div id="menu_bar"> it not work. adding !important not work. need able second way because need use media queries. just reference have menu bar ruby on rails partial because on every page of website. any idea how override width of menu bar can use media queries? any appreciated. try going http://atmedia.info/ -- scan device (refresh rescan in portra

algorithm - Using Insertion Sort return in sorted order the k smallest elements of an array -

i'm prepping software developer job interviews , reviewing algorithm questions. can't figure out how modify insertion sort algorithm returns in sorted order k smallest elements of array of size n . insertion sort algorithm for = 1 n j = while j > 0 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1 adding loop end of algorithm first k elements doesn't count. with normal insertion sort, loop start end, , each item moved until it's in place. insertion sort, still loop start end, if item you're on >= kth item, leave it; if less, move position k , move until it's in place. for = 1 k j = while j > 1 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1 first k items sorted. for = k + 1 n if a[i] < a[k] swap a[i] , a[k] j = k while j > 1 , a[j-1] > a[j] swap a[j] , a[j-1] j = j - 1

rest - Using the HAL vocab with JSON-LD -

i wondering, there way use hal concepts json-ld? i have current jsonld document: { "@context": { "hal": "http://stateless.co/hal#", "schema": "http://schema.org", "_links": { "@id": "hal:link", "@container": "@index" } }, "@type": ["schema:person", "hal:resource"], "name": "jon snow", "_links": { "self": { "href": "/users/123" } } } but not sure how define href has @type of @id , , on... is there way define hal vocab based on rdf(s) , import somehow in @context of jsonld documents, or should else? (i trying describe hyperlinks various properties, link relation, http method, accepted media type, language, iri template, input fields, etc... @id type not enough me describe links.)

r - How can you tell if a pipe operator is the last (or first) in a chain? -

i have been playing creating own pipes, using awesome pipe_with() function in magittr . looking track number of pipes in current chain (so pipe can behave differently depending on position in chain). thought had answer example magrittr github page: # create own pipe side-effects. in example # create pipe "logging" function traces # left-hand sides of chain. first, logger: lhs_trace <- local({ count <- 0 function(x) { count <<- count + 1 cl <- match.call() cat(sprintf("%d: lhs = %s\n", count, deparse(cl[[2]]))) } }) # attach new pipe `%l>%` <- pipe_with(lhs_trace) # try out. 1:10 %l>% sin %l>% cos %l>% abs 1: lhs = 1:10 2: lhs = 1:10 %l>% sin 3: lhs = 1:10 %l>% sin %l>% cos [1] 0.6663667 0.6143003 0.9900591 0.7270351 0.5744009 0.9612168 0.7918362 0.5492263 0.9162743 0.8556344 the number on left hand side pipe number. however, when run same chain again, numbers don't restart @ 1: > 1:10 %

awk, declare array embracing FNR and field, output -

i declare array of number of lines, means line 10 line 78, example. other number, example. sample gives me range of lines on stdout sets "1" in between lines. can tell me how rid of "1"? sample follows should go stdout , embraces named lines. awk ' myarr["range-one"]=nr~/^2$/ , nr~/^8$/; {print myarr["range-one"]};' /home/$user/uplog.txt; that giving me output: 0 12:33:49 3:57, 2 users, load average: 0,61, 0,37, 0,22 21.06.2014 1 12:42:02 4:06, 2 users, load average: 0,14, 0,18, 0,19 21.06.2014 1 12:42:29 4:06, 2 users, load average: 0,09, 0,17, 0,19 21.06.2014 1 12:43:09 4:07, 2 users, load average: 0,09, 0,16, 0,19 21.06.2014 1 second question: how set in array 1 field of fnr or line? when way there comes field wanted awk ' nr~/^1$/ , nr~/^7$/ {print $3, $11; next} ; ' /home/$user/uplog.txt; but need array, thats why i'm asking. hints? in advance. what example script does awk ' myarr["ra

javascript - Mongoose/MongoDB - updating a sub document is not working -

i finding sub document so: var incidentid = "someid1" var alerteeid = "someid2" incident.findoneq({ _id: someid1, 'alertees._id': someid2 }, {'alertees.$': 1}) .then(function(incident) { var alertee = incident.alertees[0]; alertee.responded_at = date.now() return alertee.parent().saveq().then(function(alertee) { console.log(alertee) }) }) it correctly finds alertee. when update, fails save alertee. this occurs if position of alertee in array not first. first alertee in array of alertees, able found , updated. what doing wrong? your syntax here not "strictly" mongoose syntax, not sure if implementing other layer on top of this. but want .findoneandupdate() specified in mongoose documentation. whole update in 1 call, , call this: incident.findoneandupdate( { "_id": someid1, "alertees._id": someid2 }, { "alertees.$.responded_at": date.now() }, function(err,incide

java - Is it possible to prioritize non-JavaFX threads over the JavaFX thread? -

i have javafx application i'm receiving information hardware with, using: platform.runlater(new runnable() { @override public void run() { } }); the problem being, sometimes, if not always, want prioritize data collection accuracy. there alternative runlater perhaps halts javafx thread temporarily? or possible have application javafx thread sub-thread? halting javafx thread, result in freezing ui ! i hope not looking ! if want prioritize data collection part, run on different worker thread( task ), which run parallel javafx thread , , once data collection completed, use runlater update ui !

ruby on rails - How can I have Grape return error messages in CSV format? -

i have rails app , have implemented api using grape gem. now, created custom error formatter (csvformatter) return error response in csv format. and, have in application's v2.rb file: error_formatter :csv, api::base::errors::csvformatter when hit url this: http://example.com/api/v2/datasets/code/data.csv?&trim_start=06/01/99&trim_end=2014-05/28&sort_order=desc it shows error in console , means custom error formatter working properly: error trim_start invalid trim_end invalid but, need download error message in csv file. after looking @ grape's documentation, found way of setting content-type , tried this: rack = rack::response.new(as_csv , 422, { "content-type" => "text/csv" }).finish rack[2].body[0] but, not working expected. edit: looks there no clean way of doing using grape without forcefully overriding status code according answer of simon. but, 1 may not wish may result other issues in applicatio

javascript - Change selected item from inside onchange event -

in following select box: var sval=1; function foo(v) { sval=number(v); } ... <select name="sval" onchange=" if (confirm('...?')) foo(this.value); else $(this).val(sval);"> <option value="1">1 <option value="2">2 <option value="3">3 the idea confirm selected item change. if not confirmed change old value. if confirm returns true, working expected if confirm returns false, select gets value 1, regardles of sval why changing selected item not work inside onchange handler? edit: following code based on ejay_francisco's answer proper job: http://jsfiddle.net/4wcqh/33/ var vals = 1; $("#svalue").change(function() { if (confirm('...?')) vals=number(this.value); else $(this).val(vals); }); but not clear reason inline code $(this).val(sval) resets select 1 i've modified code , how i've done it working fiddle

javascript - responsive pie chart with fusioncharts -

Image
i want make fusionchart pie chart responsive, follow guide here : http://docs.fusioncharts.com/charts/contents/firstchart/changesize.html follow instructions in 'dynamic resize feature of charts' section. but when page loaded, chart flatten out (no height). when resize browser, chart size sucessfully responsive, small pie chart why chart flatten when page first load? (i have resize browser first see chart). , why small chart? here's code <body style="height:100%;"> <div class="container-fluid"> <div class="row-fluid"> <div class="col-md-12"> <div id="chartcontainer" style="height:100%;"> fusioncharts xt load here! </div> </div> </div> </div> <script type="text/javascript"> fusioncharts.ready(function(){ var mychart = new fusioncharts({ "t

jsf 2 - Alternative to f:verbatim in JSF 2.1 -

alternative f:verbatim in jsf 2.1 rendering purpose needed. in application using ui:fragment rendered instead of f:verbatim not working in jsf 2.1. here providing code <f:verbatim rendered="#{not empty focusfield}"> <script type="text/javascript"> $(document).ready(function(){ // if class not set, $("#menucontainer > ul:first:not(.sf-menu)").addclass("sf-menu"); $("ul.sf-menu").supersubs({ minwidth: 12, // minimum width of sub-menus in em units maxwidth: 27, // maximum width of sub-menus in em units extrawidth: 1 // width can ensure lines don't turn on // due slight rounding differences , font-family }).superfish({ delay: 300 }); }); </script> </f:verbatim> <ui:component>

string - Parsing xml data into nested list bash -

i'm working on plex geeklet, , have string of added tv shows. show_data=$(curl --silent "http://localhost:32400/library/sections/3/recentlyadded?x-plex-container-start=0&x-plex-container-size=10") this example of data: <?xml version="1.0" encoding="utf-8"?> <mediacontainer size="10" totalsize="50" allowsync="1" art="/:/resources/show-fanart.jpg" identifier="com.plexapp.plugins.library" librarysectionid="3" librarysectiontitle="tv shows" librarysectionuuid="600cd0c5-fd4b-460a-846b-e4bad1ecdf4a" mediatagprefix="/system/bundle/media/flags/" mediatagversion="1402960845" mixedparents="1" nocache="1" offset="0" thumb="/:/resources/show.png" title1="tv shows" title2="recently added" viewgroup="episode" viewmode="65592"> <video ratingkey="588" k

Spring Boot with Spring HATEOAS Maven conflicts -

it seems when add dependency spring-hateoas <groupid>org.springframework.hateoas</groupid> <artifactid>spring-hateoas</artifactid> <version>0.13.0.release</version> the class below no longer available on classpath org.springframework.web.bind.annotation.restcontroller; i have tried exclude various dependencies spring-hateoas app no longer runs. has had luck running spring-hateoas within spring boot. absolutely no problem whatsoever. @restcontroller annotation still available , shouldn't need exclusion. in case helps, i'm using version 1.0.2 of spring boot: <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.0.2.release</version> </parent> spring-boot-starter-web provides @restcontroller : <dependency> <groupid>org.springframework.boot</groupid> <artifa

c# - How do I grab the last string from a index by detecting the comma? -

how grab last string index detecting comma? example: string = a,b,c,d or = ab, cd, ef, gh (the string of can dynamic) how last string i?? (i need answer c# , using low consume performance ways possible) result: = ad, cd, ef b = gh you can use string.substring along string.lastindexof method (char) index of last comma string last = str.substring(str.lastindexof(',')+1)

dictionary - Plotting barchart on States map in R -

Image
following usa states example data state.x77 dataset in r: mydf = structure(list(usa_state = structure(1:5, .label = c("alabama", "alaska", "arizona", "arkansas", "california"), class = "factor"), life.exp = c(69.05, 69.31, 70.55, 70.66, 71.71), hs.grad = c(41.3, 66.7, 58.1, 39.9, 62.6)), .names = c("usa_state", "life.exp", "hs.grad"), class = "data.frame", row.names = c(na, -5l)) > mydf usa_state life.exp hs.grad 1 alabama 69.05 41.3 2 alaska 69.31 66.7 3 arizona 70.55 58.1 4 arkansas 70.66 39.9 5 california 71.71 62.6 > i want plot on usa states map. can plot map using following code: all_states <- map_data("state") ggplot() + geom_polygon( data=all_states, aes(x=long, y=lat, group = group),colour="gray", fill="white" ) but not able plot barcharts on map. help. i drew

asp.net mvc - Setup OWIN dynamically (by domain) -

we trying setup white label on our project uses owin(includes fb, google, live logins). there way setup api credential dynamically, if changes domain settings change. i think owin loads earlier mvc? there way can load on global.asax(request)? public partial class startup { public void configuration(iappbuilder app) { configureauth(app); } } update: in other words single application host many domains , sub domains(white labeling). i have been googling on same things today. found nice owin sample @ http://aspnet.codeplex.com/sourcecontrol/latest#samples/katana/branchingpipelines/branchingpipelines.sln explained branching capabilities of owin. if understand sample correctly, should able configure different owin stacks depending on request parameters such host header, cookie, path or whatever using app.map() or app.mapwhen() methods. let's have 2 different dns domains representing 2 customers different login configs, can initialize owin use d

c - Store int to and retrieve from char array -

what i'm gonna store 2 integers char array, , them array. here's code: #include <stdio.h> #define int_width 4 #define buffer_size 10 int main(int argc, char * argv[]) { char buffer[buffer_size] = {0}; int input1 = 0, input2 = 0; int output1 = 0, output2 = 0; printf("int size: %d\n", sizeof(int)); printf("please input 2 integers\n"); scanf("%d", &input1); scanf("%d", &input2); printf("the input integers : %d %d\n", input1, input2); snprintf(buffer, buffer_size, "%d", input1); snprintf(buffer + int_width, buffer_size - int_width, "%d", input2); printf("buffer:\n"); (int = 0; < buffer_size; ++i) { printf("0x%02x ", buffer[i]); } printf("\n"); sscanf(buffer, "%d", &output1); sscanf(buffer + int_width, "%d", &output2); printf("the output

signature - Program has stopped working Event Name: CLR20r3 -

when run program in other computers except mine,it shows following error: problem signature: problem event name: clr20r3 problem signature 01: testmyproject.exe problem signature 02: 1.0.0.0 problem signature 03: 53ab6aaa problem signature 04: system.windows.forms problem signature 05: 4.0.30319.33440 problem signature 06: 52004310 problem signature 07: c2a problem signature 08: 11 problem signature 09: pszqoadhx1u5zahbhohghldgiy4qixhx os version: 6.3.9600.2.0.0.256.48 locale id: 1033 additional information 1: 8096 additional information 2: 809605f83e81c70b2a1fc717aae361c3 additional information 3: ab09 additional information 4: ab09016fe7e82c5c86ab5527a84309dd read our privacy statement online: http://go.microsoft.com/fwlink/?linkid=280262 if online privacy statement not available, please read our privacy statement offline: c:\windows\system32\en-us\erofflps.txt i've have same problem. try copy, exe file, others referenc

c# - How to deal with multiple NServiceBus instances -

first let me give context. i'm working on project company a. company part of bigger organisation z. both companies have own nservicebus solutions sql server transport , persistence. need somehow make possible both companies able talk each other via nsb - how do that? one solution proposed intermediate database messages -> z stored. 2 handlers: first receive message a's nsb , store in db second read db , place z nsb other solution more have relay handler receives messages , z.bus.send(message_from_a) you can use gateway send messages on http. what kind of interaction want achieve? take @ introduction gateway and he gateway , multi-site distribution

mysql - Insert Query for HTML string in SQL -

i have sql database table name question. i want insert value questiontitle html string. insert query insert question (questiontype,questionid,questiontitle) values ("mrq", "qnb5t6tkdms", "<p><span style="font-family: comic sans ms,sans-serif; font-size: small;">what original concentration of acid?</span></p>") when try execute query in sql gives error . how can work html string. you have error in using " inside third inserted value insert question (questiontype,questionid,questiontitle) values ('mrq', 'qnb5t6tkdms', '<p><span style="font-family: comic sans ms,sans-serif; font-size: small;"> original concentration of acid?</span></p>' ); you can use escape slashes

java - Is the default serialized form appropriate in this case -

in effective java second edition, bad example of use of default serialized form given class: // awful candidate default serialized form public final class stringlist implements serializable { private int size = 0; private entry head = null; private static class entry implements serializable { string data; entry next; entry previous; } ... // remainder omitted } the reason given "the default serialized form painstakingly mirror every entry in linked list , links between entries, in both directions." , goes on should serialize class array of strings. in java ee 6 tutorial example - the order application . in it, there's class part uses default serialized form , looks this: public class part implements java.io.serializable { private static final long serialversionuid = -3082087016342644227l; private date revisiondate; private list<part> parts; private part bompart; private serializable drawing

libreadline undefined symbol: PC in bash when using | bc -l -

i connecting ssh machine execute bash script, problematic part following: fkeypar "ex1.fef[1]" tstarti #### fkeypar external command values assign subsequent variables t0i="$(expr $(pget fkeypar value) - 11544)" fkeypar "ex1lc.fits[2]" telapse lengthini=`pget fkeypar value` fkeypar "ex7lc.fits[2]" tstop lengthfin=`pget fkeypar value` fkeypar "ex1lc.fits[2]" tstart ijd=`pget fkeypar value` i=$(echo "($ijd - $t0i) / $period + 1" | bc -l | sed 's/\..*//') ifin=$(echo "($lengthfin - $ijd)/$period + 1" | bc -l | sed 's/\..*//') echo "($ijd - $t0i) / $period + 1" | bc ((n=$i; n<=$ifin; n++)) ... this returns following errors: bc: symbol lookup error: /science/heasoft-6.14/x86_64-unknown-linux-gnu-libc2.9/lib/libreadline.so.6: undefined symbol: pc bc: symbol lookup error: /science/heasoft-6.14/x86_64-unknown-linux-gnu-libc2.

c# - Differences Nullable values: .Value or not? -

this question has answer here: which preferred: nullable<>.hasvalue or nullable<> != null? 6 answers c# hasvalue vs !=null [duplicate] 1 answer i'm kinda new nullable. have datetime in c# want null, assign value in try-catch, , after check whether it's null or not. code: datetime? dt = null; try { dt = datetime.parseexact(stringdate, "yyyy-mm-dd hh:mm:ss", cultureinfo.invariantculture); } catch(formatexception) { console.writeline("the given string not valid , not converter datetime"); } // check if datetime not null // if it's not null, datetime so, question: which of 2 should use, why should use it, , differences between both: if(dt != null) { dosomethingwithdatetime(dt); } or: if(dt.hasvalue) { dosomet

javascript - why define multiple module with same name in angularjs -

i new @ angularjs. looking application code. <html> ..... <script src="/my/app.main.js"></script> <script src="/my/app.messages.js"></script> <script src="/my/app.misc.js"></script> <script src="/my/app.properties.js"></script> and in these javascript filse icluding angularjs modules same name. main.js file (function () { 'use strict'; var app = angular.module('ngcookservice'); app.run([..... function (....) { }]); })(); messages.js file (function () { "use strict"; var app = angular.module('ngcookservice'); app.config(['$stateprovider', function ($stateprovider) { ................ }]); })(); all of these js files include ngcookservice module. , modules defined in self-invoking functions. how system works? earlier defined modules overriding? or new defined app

go - Usage of the `import` statement -

can explain me how import statement works ? for example have type user in myapp/app/models package: package models type user struct { // exportod fields } i have type users in myapp/app/controllers package: package controllers import ( _ "myapp/app/models" "github.com/revel/revel" ) type users struct { *revel.controller } func (c users) handlesubmit(user *user) revel.result { // code here } this gives me following error: undefined: user i tried change imports following code: import ( . "advorts/app/models" "github.com/revel/revel" ) but error: undefined: "myapp/app/controllers".user which don't understand either. so, difference between import . "something" , import "something" ? how import model in case ? each package has set of types, functions, variables, etc. let's call them entities . each entity can either exported (its na

ios - How to store a block definition that returns something, in a local variable -

this seems little strange me when block not returns anything, can capture in variable before passing consumer metod. add return value block typedef , start getting waring scenario 1 : block not returns //declaration typedef void (^myconfigureblock)(myfeedcell *cell, nsindexpath *indexpath); //usage myconfigureblock block = ^(myfeedcell *cell, nsindexpath *indexpath){ [cell setactiondelegate:self]; return nil; }; myfeedsource *fds = [[myfeedsource alloc]initwithtableview:self.tableview configurationblock:block]; [fds seterrormessage:@"no feeds yet. alive?"]; self.feeddatasource = fds; every thing works perfect in above piece of code unless go ahead , do: problem here typedef myfeedcell* (^myconfigureblock)(myfeedcell *cell, nsindexpath *indexpath); now how can re-write following statements there no error. , why not works usual return type? myconfigureblock block = ^(myfeedcell *cell, nsinde

c# - Select items from List A where the property is not in List B -

i have list<broadcast> , broadcast object has property called guid . need find broadcast objects in list guid property not item in list<guid> . i've found solution except(); it's not working me. broadcasts.where(x => x.guid).except(readbroadcasts); what doing wrong? here way can : list<guid> excludeguid = ..... // init guids want exclude list<broadcast> result = broadcasts.where(x => !excludeguid.contains(x.guid)).tolist() ;

c# - How to fill a list of objects that contain a list of string from view to controller in asp.net viewModels -

i using asp.net mvc5 store list of questions contain: the questions itself the correct answer list of wrong answers. i not sure codes needed accommodate needs in view pass required data form list<question>jobquestions in jobpostviewmodel. these codes have done : public class jobpostviewmodel { public class question { public string thequestion { get; set; } public string rightanswer { get; set; } public list<string> wronganswers { get; set; } } public list<question>jobquestions { get; set; } } i have tried many ways such as: <div class="form-group"> <div class="col-md-10"> @html.textboxfor(model => model.jobquestions.firstordefault().thequestion, new { @class = "form-control", }) @html.textboxfor(model => model.jobquestions.firstordefault().rightanswer, new { @class = "form-control", }) @html.textboxfor(model =>

javascript - Check if path exists else display error -

i have js function creates url appropriate pdf file based on option user has chosen. i have of function sorted out i'd know how check if path pdf file exists in case users version hasn't got pdf's downloaded. for i'll need alert(); example see needs done here's current code function pdfselected(selected) { keynumberstr = keynumber.tostring(); pdfdisplay = "pdf/key" + keynumberstr + selected + ".pdf"; if (selected === "summary" || registered) { //insert code check file existence window.location.href = pdfdisplay; } else { window.alert("this option available registered users"); } } i've added comment need check whether file exists or not. if exists, go straight pdf. else display alert tell user file missing. hope can little help, thank in advance , sorry simple question (noob @ js , don't know how incorporate other answers cater problem)

Suitable replacement for SQL_Latin1_General_CP1_CI_AS (SQL Server 2012 ) -

i'm looking replacement latin1_general_ci_as need differentate between ß , ss , found sql_latin1_general_cp1_ci_as. problem collation though is merely legacy collation , should avoided if possible. now question is there collation provides same functionalities legacy one? edit: info here need have collation case insensitive run troubles else statements. additionally i'm using c#'s entity framework gather data need avoid possibilities result in special statements (such using convert in statement) try this select * convert(varbinary,word)=convert(varbinary,'search') or select * convert(varbinary,upper(word))= convert(varbinary,upper('search')) or select * convert(varbinary,lower(word))= convert(varbinary,lower('search'))

c++ - Windows 8 tablet does not display TabTip (on-screen keyboard) on top of Qt OpenGL application -

i have full screen qt opengl application needs display virtual keyboard (tabtip.exe) when input textboxes entered. problem i'm facing virtual keyboard appears behind application when keyboard invoked. have tried many different things , found way can make appear in front, if window not fullscreen (e.g. making 1 pixel less full screen in width and/or height). if have tablet in portrait mode still displays keyboard in full screen. now i'm trying figure out if driver issue, qt issue, opengl issue or general windows issue. any suggestions? update: i have investigated bit further , think see what's going on. windows 8, upon detecting monitor rotation set zero, , has opengl window matches desktop resolution , covers whole screen, kicks legacy mode blocks windows 8 themed animations running (including virtual keyboard). have suggestions on how can stop windows doing this? dwmenablecomposition has been removed in windows 8.

php - YiinfiniteScroller pagination repeated rows -

i using yii yiinfinitescroller. there 260 records. have displayed 12 records per page. loads first 12 records correctly. when scroll page, loads same 12 records (duplicate) , repeats continuously when scrolling 12 records repeated every time here code view page <?php $this->widget('ext.yiinfinite-scroll.yiinfinitescroller', array( 'contentselector' => '#load_addcont', 'itemselector' => 'ul.wlist', 'loadingtext' => 'loading next 12 rows...', 'donetext' => 'loading finish.', 'pages' => $pages, )); ?> here code controller site $pages = new cpagination($row_count); $pages->setpagesize(12); $pages->applylimit($criteria); $wineries = wineries::model()->findall($criteria);

java - Delegate action without redirect in Play 1.2.x -

given play controller mycontroller action myaction , possible call action without triggering redirect? let's have controller: public class mycontroller2 extends controller { public static void myaction2() throws exception { mycontroller.myaction(); //this cause redirect. } } is possible call myaction without triggering redirect. note using play 1.2.x , not play 2.x. you can call myaction , not have redirect. change access level of myaction except public . however, not able route myaction directly more. if still need myaction routable in it's own right, suggest moving common functionality separate method/class , calling method myaction2 , myaction , so: public class application extends controller { public static void myaction() { commonactionstuff("myaction"); } public static void myaction2() { commonactionstuff("myaction2"); } protected static void commonactionstuff(string wh