Posts

Showing posts from April, 2011

ios - Create file but no groups and targets? -

Image
hello add files group. when want add file group, file created outside of whole project , when want optimize adding file there no group or targets available. ideas why ? it caused xcode 6.3.1 @ el capitan system ...

c++ - const pointer to const pointer to const data -

this question has answer here: easy rule read complicated const declarations? 2 answers i got lot of const here. need know ones needed. i need use pointer pointer pointer const , data pointed const. following make sense? const int a=5; const int* const pi=&a; const int* const * const ppi=π // 3 const here? correct? well compiles without warning, , make sense me, ppi const *ppi const , **ppi const i need use ppi , want const possible, programming micro controller , want data go flash. know there are ways force data go flash i'd prefer linker automatically. yes, ok, since want const-ness possible. however, going affect future use of these data. not sure if make linker put data in flash memory, read question: arm c++ - how put const members in flash memory? .

c# - LINQ to Entities does not recognize the method? -

var tmp = productdbset.where(x => x.lastupdate >= datetime.minvalue && x.lastupdate.value.tostring("mm/yyyy") == curmonth).select(x => x.id); while run above code, got error message: linq entities not recognize method 'system.string tostring(system.string)' method, , method cannot translated store expression. also tried, var tmp = productdbset.where(x => x.lastupdate >= datetime.minvalue && x.lastupdate.value.tostring("mm/yyyy") == curmonth).tolist().select(x => x.id); but same, how can solve that? as error message telling you, tostring method of datetime isn't supported. since you're trying determine if month , year of date match given value, can compare actual month , year, rather trying string containing month , year compare with. x.lastupdate.value.year == yeartocomparewith && x.lastupdate.value.month = monthtocomparewith

c# - MVC 5 UserManager.FindAsync throwing error when deployed on azure -

i have asp.net mvc 5 website connects remote sql database. the website works fine when it's running visual studio iis express. however, when deploy website on azurewebsites , attach debugger on login function, see usermanager.findasync function redirects me general error view page. this usermanager checks if user exists: var user = await usermanager.findasync(model.username, model.password); and web.config connection string: <add name="defaultconnection" connectionstring="data source=87.87.87.87,1433;initial catalog=dbname;integrated security=false; user id=username; password=password" providername="system.data.sqlclient" /> this website works when it's deployed elsewhere well. the problem occurs when it's deployed on azurewebsites.

user interface - Javafx concurrency and gui-update -

what i'm trying following: want fade in overlay screen before doing background work , fade overlay screen out when task finishes. anyhow, java performs background task requestservice.dorequest , afterwards fades screen in , out. current order like: task fade in fade out while should be: fade in task fade out i think tried every possible configuration of threads, tasks, service, etc.. so how 1 correctly update gui try achieve? controller.java : public void dorequest(request r) { task<float> t = new task<float>() { @override protected float call() throws exception { try { updateprogress(.5f, 1); requestservice.dorequest(r); } catch(exception e) { badge.setvisible(true); badge.settext(e.getmessage()); } { updateprogress(0f, 1); } return null; } }; overlay.opacitypropert...

javascript - Detect Country then show message? -

i have , uk website. if user uk, , on website, show message on page redirect correct site. how can this? you can ip in geo database, such geolite ( http://dev.maxmind.com/geoip/legacy/geolite ), figure out user located. geolite databases can downloaded app. create small server endpoint make ip lookups in database. using javascript can then: grab ip of current user look location in geolite database through server endpoint if in uk on site (or vice versa) -> display message , optionally redirect user correct website of course server-side, , automatically redirect user if that's preferred approach.

Compare average - SPARQL -

there dataset of users ranking movies. need find users similar taste user1. similar taste defined follows: consider average rank genre user1 avgr1 , same genre user2 avgr2 , user1 , user2 have similar taste abs(avgr1-avgr2)<1 . far able names, genre , absolute value between averages, filtering comparison not working. select ?p ?p1 ?genre (abs (avg(?rating)-avg(?ratingp1)) ?rdiff) where{ ?p movies:hasrated ?rate. ?p1 foaf:knows ?p. ?rate movies:ratedmovie ?mov. ?rate movies:hasrating ?rating. ?mov movies:hasgenre ?genre. ?p1 movies:hasrated ?ratep1. ?ratep1 movies:ratedmovie ?movp1. ?ratep1 movies:hasrating ?ratingp1. ?movp1 movies:hasgenre ?genre. filter (xsd:float(?rdiff)<1.0 && ?p=movies:user1) } group ?p ?p1 ?genre it's hard answer these kinds of questions without sample data work with. here's sample data has 2 users have similar rankings on comedy, different rankings on romance: @prefix : <urn:ex:> :a :ranks [ :genre :comedy ; :...

python - How to remove strings that contain letters from a list? -

i have list containing strings both letters, characters , and numbers: list = ['hello', '2u:', '-224.3', '45.1', 'sa 2'] i want keep numbers in list , convert them float values. how can that? want list this: list = ['-224.3'. '45.1'] the list created, when serial.readline() arduino, gives me string comprised of commands , data points. looked this: 'hello,2u:,-224.3,45.1,sa 2' i did list.split(delimiter=',') , wanted have data points future calculations. probably best way see whether string can cast float try cast it. res = [] x in lst: try: res.append(float(x)) except valueerror: pass afterwards, res [-224.3, 45.1] you could make list comprehension, [float(x) x in lst if is_float(x)] , need function is_float same thing: try cast float , return true, otherwise return false. if need once, loop shorter.

javascript - How can I display student fee in another div upon the courses selected using JQuery? -

i building student registration system. want new applicant see fee have pay upon type of courses selected in html select input field. wrote similar code not working me. please help. jquery code: <script> $(document).ready(function(e) { if($("#coursestype").val()=="database technology"){ $("#fee").html(" ghs 1,1200"); } }); </script> html code: <label>ipmc courses :</label> <select id="coursestype" name="coursestype"> <option value="software engineering">software engineering</option> <option value="database technology">database tech</option> <option value="graphic web design" selected="selected">graphic web design</option> <option value="computing">computing</option> <option value="business i.t">business i.t</option>...

HTML loop PHP without messing with this " over ' -

i have php code html loop if($contenido_index === 1 || $contenido_index === "1") { echo " <div class='portcontrol'> <div class='info_container cssemigrey'> <a href='". $contenido_link."'><h2 class='naranja'>". $contenido_titulo."</h2></a> </div> <div class='wrapimg'> <a href='". $contenido_link."'><img alt='image de ". $contenido_titulo."' src='". $contenido_imagen."'></a> </div> </div> ";} i dont want change example href=" " href=' ' is there other way write can paste normal html code i'm going use loop. just figure out joomla template... <?php if($contenido_index === 1 || $conteni...

SoapUI XPath assertion - wildcard string with Excel dataSource -

Image
i want use assertion "expected result" uses both form of "contains" function or wildcard , gets text test against excel datasource. soapui 'contains' function has no way use datasource i've found, , cannot figure out how use xpath function contains datasource. can please explain how works? -- i've been asked more detail. in soapui, if add assertion , choose request/response source, have choice of assertions. 1 of them "xpath match". can use designate specific field in response, in case, value want test. having chosen "xpath expression" in top half of "xpath match configuration", can choose excel datasource content lower half "expected result". have used test error code against error code excel spreadsheet. what don't know how determine, in assertion, error message returned contains value in excel. figure special goes "expected result" in "xpath match configuration" box...

questions for dynamic binding and signature method in java ab -

matching method signature , binding method implementation 2 sepearate issue ,what's wrong follows code? container c5 = new jbutton(); object c6 = new jbutton(); c5.add(c6); //----it wrong,why? for me , c5 reference variable contain reference object of jbutton,and jbutton extends class component,so should right why ? java single-dispatch language. means method signature analysis done @ compile time, not run time. the type of c6 object . (yes, assign jbutton , declared type of variable still object .) when java looks @ c5 (a container ) , methods, doesn't see add() method takes object. flags error.

ruby - Rails ActionMailer receive method does nothing -

i'm following rails official doc action mailer receive method , testing rails runner 'usermailer.receive(stdin.read)' command nothing happens . class usermailer < actionmailer::base add_template_helper emailhelper default from: "xx@xxx.xxx" def user_created(params) @user = user.find params[0] @creator = user.find params[1] if @user && @creator mail(to: @user.email, subject: "......").deliver else logger.info "......" end end def receive(email) puts yaml::dump email end end here's detail rails app rails@4.1.6 actionmailer@4.1.5 the usermailer sends emails can not receive them. ideas? i think want refer action mailer basics guide: http://guides.rubyonrails.org/action_mailer_basics.html#receiving-emails i'm interpreting suggestion mean: configure mail server/process "pipe into" rails runner script... account stdin.read; contents of mail mes...

model view controller - ServiceStack selfhosting disable caching for memory -

using selfhosting standard servicestack mvc application every request cached in memory. changing js file have no conscience until restart server. there way around problem developing purposes? every request not cached in memory, when you're self-hosting it's running binary dlls , static files copied /bin folder. you can change config.webhostphysicalpath change servicestack serve files solution folder instead, e.g: setconfig(new hostconfig { #if debug debugmode = true, webhostphysicalpath = path.getfullpath(path.combine("~".mapserverpath(), "..", "..")), #endif });

javascript - Accessing JSON objects from objects without titles in JQuery -

i receiving json file ajax call: [ { "linkname": "annual training", "hits": 1 }, { "linkname": "in focus newsletter", "hits": 1 }, { "linkname": "nita (secured)", "hits": 1 }, { "linkname": "your current events", "hits": 1 }, ] here ajax call: $(document).ready(function(e) { $.ajax({ method: "get", url: url, }).done(function(api) { console.log(api); var obj = json.parse(api), totres = object.keys(obj).length; $.each(obj.children, function (index, value) { alert(value); }); }).fail(function( jqxhr, textstatus ) { alert('service catalog: error loading '+jqxhr+' data. request fail caused by: '+textstatus); }); }); i need able extract data json ...

visual studio 2012 - Specifying results filename for vstest.console.exe -

may silly question, know how specify output filename of vstest.console.exe run? command line follows: vstest.console.exe [assembly] /logger:trx at end of run, following comes in console: resultsfile: somepath\testresults\{username}_{workstation} {timestamp}.trx i tried using .runsettings file specify output location, seems control output directory, not output file. have not found else seem control it. i want parse trx file , generate report out of (this works, if can't specify output path of trx file, won't know pick in scripts!) i have missing here... nope, you're not missing anything. trx logger doesn't support parameters (unlike tfs publisher logger). the logger assembly located in "c:\program files (x86)\microsoft visual studio 11.0\common7\ide\commonextensions\microsoft\testwindow\extensions\microsoft.visualstudio.testplatform.extensions.trxlogger.dll" . if check out in favorite .net decompiler, you'll see method trxlogg...

java - How to change a file reader to a directory scanner? -

answer system.out.print("enter name of directory:"); file a= new file((new bufferedreader(new inputstreamreader(system.in))) .readline()); file[] b=a.listfiles(); for(int i=1;i < b.length;i++){ fn=b[i].getpath(); } problem system.out.print("enter name of file: "); fn = (new bufferedreader(new inputstreamreader(system.in))) .readline(); i have tried file[] file array=new file(system.in).listfiles(); for(file f: filearray) // loop through files { if(f.getname().endswith(".fasta")){ fn = (new bufferedreader(new inputstreamreader(filearray)).readline()); // read files }}` but receive error of constructor file(inputstream) undefined i want change fn directory. how iterate through directory keeping buffered reader , inputstreamreader? i can see want read content file... the following classes used writing/reading data files. fileoutputstream , fileinputstream ; as can see, fileouputstream used in writing data ...

c# - Retrieve metadata from a database with EntityFramework -

i'd retrieve metadata given database entityframework. i've tried use code : var objectcontext = ((iobjectcontextadapter)context).objectcontext; var meta = objectcontext.getmetadataworkspace().getentitycontainer(objectcontext.defaultcontainername, dataspace.cspace); var sets = meta.baseentitysets; but sets empty because pocos have created first. i'd retrieve metadata in order create pocos without using designer tool.

javascript - IE Form Attribute -

i have problem internet explorer. have use attribute form, problem doesn't work on internet explorer (compatibility problem). how on jquery? <button type="submit" id="cancelform" name="cancel" onclick="bcancel=true" form="myform"/> i've tryed code $("#cancelform").click(function() { bcancel = true; $("#myform").submit(); }); i trying emulate form attribute , bcancel functionality. when press cancel button, submits form, when checks bcancel variable, returns other value.

apache - Block "cloner" servers rendering content from our server -

i have website of mine (freeofficefinder.com) being cloned (see here: thelawyerserviceratings.org) there on 25 websites cloning our website. obviously hurting our seo ranking due "duplicate content". there add apache config file ensure our website rendered @ domain freeofficefinder.com. , other domains blocked? as can see, web server configured serve same virtual host requested server name. example: # telnet freeofficefinder.com 80 trying 78.109.169.208... connected freeofficefinder.com. escape character '^]'. / http/1.1 host: blablabla.com http/1.1 200 ok date: wed, 10 jun 2015 15:54:24 gmt server: apache/2.4.12 (ubuntu) x-powered-by: php/5.5.9-1ubuntu4.9 set-cookie: device_view=full set-cookie: phpsessid=qbe8aar8b58ckr9nvlqbnsdgd2; expires=wed, 10-jun-2015 16:54:30 gmt; max-age=3600; path=/ cache-control: max-age=0, public, s-maxage=604800 x-content-digest: en7c017d952f04b31ac9f09a61d0ed6561fd153e3549cdf743cbb277e2db847bab content-length: 1710...

javascript - Execute code when scroll but each .5s -

i have situation when use mousewheel, dont want happend instantly, wait 50ms after can increment again. var = 0; function dosomething() { += 1; console.log(i); } need waiting time till can use mousewheel again. can show or explain solution? http://jsbin.com/lisozuyami/1/edit?html,js,console,output you can try timeouts (look @ example). or can use throttling/debouncing plugins this one var = 0; function dosomething() { += 1; console.log(i); } var actiontimer = null; function delayedhandling(){ cleartimeout(actiontimer); actiontimer = settimeout(function() { dosomething(); }, 50); } $(window).on('dommousescroll', function(e) { if (e.originalevent.detail > 0) { delayedhandling(); } }) .on('mousewheel', function(e) { if (e.originalevent.wheeldelta < 0) { delayedhandling(); } });

twitter json formatting in php -

i new php . created account in twitter api , manage data twitter in json format , extract text , created_at fields json having no luck after 3 days , final resort place. my code till time: $tweets = $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=verizon"); $encode =json_encode($tweets); $decode = json_decode($encode,true); foreach($decode $tweet) { echo "{$tweet->text} {$tweet->created_at}\n"; } var_dump result: 1 => object(stdclass)[34] public 'metadata' => object(stdclass)[35] ... public 'created_at' => string 'wed jun 10 15:54:11 +0000 2015' (length=30) public 'id' => float 6.0866345858697e+17 public 'id_str' => string '608663458586968064' (length=18) public 'text' => string 'rt @fortunemagazine: .@elonmusk wants build comcast of outer space http://t.co/wuuanftznc http://t.co/3cs0zmd6ea...

How do I show tasks from only one project in a solution in Visual Studio 2013? -

i have solution in vs2013 has multiple projects, 1 of code library don't contribute pull repo. i'm looking way show "//todo" comments in task list project i'm working on. as stands, task list inundated //todos other people working on. workaround name of personal todos //job, being able view 1 project's //jobs @ time big plus , prevent me needing invent new comment names each project have in solution. vs2103 doesn't contain functionally , people requested feature in msdn vs blog. you can extend vs2013 resharper has nice todo explorer. have here: http://www.jetbrains.com/resharper/webhelp80/reference__windows__to-do_explorer.html you can group todos namespaces or projects example... let me know if supports question.

ruby - Padrino + FactoryGirl not performing Lazy Loading -

i'm developing thesis on padrino, using active record orm , factorygirl mocking framework. i'm facing strange behavior. i've 2 models: user , rate. - user has 'has_many :rates' association; - rate has 'belongs_to :user' association; - 'rates' table has integer attribute named 'user_id' (not created 'references' on migration, directly 'integer'). my association working well, after performing reload on parent object. here snippets related issue: https://bitbucket.org/snippets/cuscos/mbdak if start 'padrino console' , create user manually, current behavior: $ user = factorygirl.create(:user_with_rates) $ user.rates.length # received '0', expected '1' $ user.rates.all.length # received '1', ok $ user.reload! $ user.rates.length # i'm receiving '1' correctly it seems activerecord isn't performing lazy loading reason. does know why happening?...

.net - VC++/CLI: How to prevent an unmanaged object from being destroyed when it goes out of scope? -

i have third-party unmanaged c++ library has 2 classes, let's call them classa , classb . classa has method, let's call gettheb() , returns instance of classb - not return pointer instance, instance itself. i wrote managed wrapper classa in turn has method gettheb() returns managed wrapper wrapping classb . the original classb object third-party library has handed on managed wrapper via pointer, like: thirdparty::classb db = delegateforclassa -> gettheb(); managedclassb^ mb = gcnew managedclassb(&db); however, when wrapped gettheb() of classa wrapper finishes , scope ends, managedclassb instance contains dangling reference third-party classb , destructor of latter 1 called, leading funny results when accessing methods of classb . in other question, told somehow store original classb object, don't know how. so, how keep third-party classb instance alive? you can either change gettheb return heap-allocated classb, or have managedcla...

sql server - Copy SQL column from one to another maintaining ID -

i looking copy sql long binary data "photo" column "id_photo_c" column. both columns in separate tables. got query show need, unfortunately cannot copy & paste outputs "results pane" of mssql. i cannot copy entire table 1 another, new database has more rows (including duplicates). http://i.imgur.com/tmrpmh2.png here code: select [grouptables].[dbo].[visitorsadvanced].[recordnumber], [ grouptables].[dbo].[visitorsadvanced].[photo], [sugarcrm].[dbo].[contacts_cstm].[xxx_id_number_c], [sugarcrm].[dbo].[contacts_cstm].[id_photo_c] [grouptables].[dbo].[visitorsadvanced], sugarcrm].[dbo].[contacts_cstm] [grouptables].[dbo].[visitorsadvanced].[recordnumber] = [sugarcrm].[dbo].[contacts_cstm].[xxx_id_number_c]; it seems such simple task (would take 2 clicks in excel) - can't seem work. this isn't duplicate question. i've seen similar questions on here, none of describe how copy data 1 column another. thank you. ...

bash - What is the difference between "echo" and "echo -n"? -

the manual page on terminal echo -n following: -n not print trailing newline character. may achieved appending `\c' end of string, done ibcs2 compatible systems. note option effect of `\c' implementation-defined in ieee std 1003.1-2001 (``posix.1'') amended cor. 1-2002. applications aiming maximum portability encouraged use printf(1) suppress newline character. shells may provide builtin echo command similar or iden- tical utility. notably, builtin echo in sh(1) not accept -n option. consult builtin(1) manual page. when try generate md5 hash by: echo "password" | md5 it returns 286755fad04869ca523320acce0dc6a4 when do echo -n "password" it returns value online md5 generators return: 5f4dcc3b5aa765d61d8327deb882cf99 what difference option -n do? don't understand entry in terminal. when echo "password" | md5 , echo adds newline string hashed, i.e. passw...

php - How To Pass A Twig Output String Into the urlFor() Function -

i pass id of category parameter using urlfor(). {% category in categories %} <br> <p><a href="{{urlfor('showtopic.post', {"cat_id": "{{category.id}}"})}}">{{category.category_title}}<a><br>{{category.category_description}}</p> <br> <br> {% endfor %} this not work. passes in {{category.id}} instead of actual id category. have id each category in database. if try use {{category.category_title}}, know works because output title, same thing. help try <a href="{{urlfor('showtopic.post', {"cat_id": category.id})}}">{{category.category_title}}<a> you don't need surround category.id {{ , }} because in print mode

Microsoft Word -> PDF image quality -

our line of business application uses word document template, fills in pertinent information , converts pdf, returns user. that works fine except 1 thing. use image of our company's logo on lead page , in footer. in 1 resolution (e.g. 100%), looks fine. @ higher resolutions (e.g. 250%), has several noticeable jaggies; diagonals have noticeable ragged edges. tweaking image, we're able make @ higher zoom value, looks terrible @ lower zoom values. currently, we're using png, we've tried jpg , doesn't improve jaggy problem. in fact, looks worse @ higher resolution because of jpg compression. think vector image solve problem (and have logo in vector format), haven't found vector formats word supports. i don't have code show, since don't image in code: take document , plug in our values, none of touch logo (the template contains image). we using word 2013 (32-bit) on windows 8.1 (though of our developers use windows 7). use .net pdfdocument class g...

css - jquery chosen select field is displayed wrong -

Image
i'm trying use jquery-chosen plugin on simple select code <select class="chosen-select"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> turn on in js file $(document).ready(function() { $(".chosen-select").chosen({no_results_text: "oops, nothing found!", allow_single_deselect: true}) }); and select field looks different fields on jquery-chosen site examples: what doing wrong? not adding css field? looks referencing css file script, needs css link: <link rel="stylesheet" href="[path file]chosen.css" /> or <link rel="stylesheet" href="[path file]chosen.min.css" /> point reference css or min.css file is. based on comment might <link rel="stylesheet" href="/static/chosen.css" />

r - Using lapply with Dates and the minus function -

i have vector of dates , vector of number-of-days. dates <- seq(sys.date(), sys.date()+10, by='day') number.of.days <- 1:4 i need list entry each number-of-days, each entry in list dates vector minus corresponding number-of-days, ie., list(dates-1, dates-2, dates-3, dates-4) the defintion of - ( function (e1, e2) .primitive("-") ) indicates first , second arguments e1 , e2 , respectively. following should work. lapply(number.of.days, `-`, e1=dates) but raises error. error in -.date (x[[i]], ...) : can subtract "date" objects furthermore, following does work: lapply(number.of.days, function(e1, e2) e1 - e2, e1=dates) is feature or bug? you can use: lapply(number.of.days, `-.date`, e1=dates) part of problem - primitive doesn't argument matching. notice how these same: > `-`(e1=5, e2=3) [1] 2 > `-`(e2=5, e1=3) [1] 2 from r language definition : this subsection applies closures not primitive...

How to calculate number of foreign keys in second table with a condition and display it with rows from first table - PHP - MySQL? -

i have 2 tables tablea , tableb below; tablea +--------+-------+-------+-------+------+ | fa | fb | fc | fd | fe | +--------+-------+-------+-------+------+ | col1 | f11 | f12 | f13 | x1 | +--------+-------+-------+-------+------+ | col2 | f21 | f22 | f23 | x2 | +--------+-------+-------+-------+------+ | col3 | f31 | f32 | f33 | x3 | +--------+-------+-------+-------+------+ | col4 | f41 | f42 | f43 | x4 | +--------+-------+-------+-------+------+ tableb +--------+-------+-------+------+------+ | tbba | tbbb | tbbc | tbbd | tbbe | +--------+-------+-------+------+------+ | cola | fa1 | fa2 | 0 | x1 | +--------+-------+-------+------+------+ | colb | fb1 | fb2 | 0 | x1 | +--------+-------+-------+------+------+ | colc | fc1 | fc2 | 1 | x1 | +--------+-------+-------+------+------+ | cold | fd1 | fd2 | 1 | x2 | +--------+-------+-------+------+------+ | cole | fe1 | ...

javascript - How to tell if child Node.js Process was from fork() or not? -

i have small application executed fork or directly developer, , configured differently depending on how started. i know pass in arguments to signal fork, curious if there way tell if somehow know in child process if came fork() . looked around in process didn't find telling. it's bit of hack, can check if process.send exists in application. when started using fork() exist. if (process.send === undefined) { console.log('started directly'); } else { console.log('started fork()'); } personally, set environment variable in parent , check in child: // parent.js child_process.fork('./child', { env : { fork : 1 } }); // child.js if (process.env.fork) { console.log('started fork()'); }

Need Clarification on Using OOP and DRY Method in Python -

i'm trying keep code clean applying oop , dry method; however, found myself stuck following questions. 1) since checkremote , backup method dependent on sshlogin method, there way write object initialized? 2) if there isn't better way, write procedure phonebook class execute in following manner (1 - checklocal, 2 - sshlogin, 3 - checkremote, 4 - backup)? in main? class phonebook: def __init__ (self, name, phone_number, birthdate, location): self.name = name self.phone_number = phone_number self.birthdate = birthdate self.location = location self.ssh = none def checklocal (self): # check local phonebook existing names pass def sshlogin (self): # ssh remote server def checkremote (self): # check remote phonebook existing names pass def backup (self): # backup remote phonebook in case, want use context manager , with keyword. since using pho...

javascript - Get changes in JQuery Ajax request -

my apologies if seems dumb, how implement function when ajax data changed last request? window.setinterval(function(){ $.get("feed", function(data){ if (data.changed) { $('#feed').html(data); } }); }, 500); something cache data , compare after each request? var data; window.setinterval(function(){ $.get("feed", function(newdata){ if (data !== newdata) { data = newdata; $('#feed').html(data); } }); }, 500); also, 500ms regular checking requests, i'd advise changing 5000ms or something.

php - add hidden input field to woocommerce checkout to pass data to payment gateway -

i have store running woocommerce , client needs pass variable payment gateway (worldpay) included in payment confirmation email sent form gateway client. worldpay need add form: <input type="hidden" value="myvalue" name="m_myname" /> after lot of research figured out how create array of skus each product in cart. have created function grab each product sku , add array. outputs array replace "myvalue" in above. my question need put < input >? have added woocommerce > checkout > review-order.php, doesn't seem work. shows in front-end doesn't passed worldpay. or need add existing action? found this seems talking similar issue – but then, need inject output of action, in template? thanks advice.

javascript - What is better way to send associative array through map/reduce at MongoDB? -

here functions: map : function () { // initialize key // initialize index (0..65536) // initialize value var arr = []; arr[index] = { val: value, count: 1 }; emit(key, { arr: arr }); } reduce : function (key, values) { var result = { arr: [] }; (var = 0; < values.length; i++) { values[i].arr.foreach(function (item, i) { if (result.arr.hasownproperty(i)) { result.arr[i].val += item.val; result.arr[i].count += item.count ; } else { result.arr[i] = item; } }); } as can see, i'm trying send associative array map reduce . when try enumerate values of array values[i].arr.foreach listing 0..max_index. so, every reduce have enumerate lot of undefined elements. when try enumerate values of array ( arr ) @ map expected result (only defined elements). actually, don't sure associative array best solution task. can't find faster way find element id. could please answer questions: why dif...

javascript - jQuery UI Slider - Change background color ONLY between handlers/sliders/markers -

i using jquery ui slider. have multiple hanldes range set false. there way color range between 2 handles/sliders/markers whatever want call them? have not found solution yet. this code/initialization using. var initialvalues = [180, 435, 1080, 1320], updatevalue = function (ui) { var hours = math.floor(ui.value / 60); var minutes = ui.value - (hours * 60); if (hours.length == 1) hours = '0' + hours; if (minutes.length == 1) minutes = '0' + minutes; if (minutes == 0) minutes = '00'; if (hours >= 12) { if (hours == 12) { hours = hours; minutes = minutes + " pm"; } else { hours = hours - 12; minutes = minutes + " pm"; } } else { hours = hours; minutes = minutes + " am"; } if (hours == 0) { hours = 12; minutes = minutes; } //console.log(ui.handle) $(ui.handle).attr(...

c# - data binding property of a other control to a style while animating it -

i'm trying implement tab style radio button. style contains textblock child of grid changes it's color when checked , grid child of border element. i'm trying bind grid's background when in checked state button end's bieng transparent ...

scala - upickle gives a ScalaReflectionException when writing a case class -

i have simple case class: object margin { def apply(top: int, right: int, bottom: int, left: int): margin = { margin(some(top), some(right), some(bottom), some(left)) } } case class margin(top: option[int], right: option[int], bottom: option[int], left: option[int]) when calling upickle.write on instance of above class, following exception: scala.scalareflectionexception: value apply encapsulates multiple overloaded alternatives , cannot treated method. consider invoking `<offending symbol>.asterm.alternatives` , manually picking required method what error message mean , how fix it? the above error message result of margin class having multiple overloaded apply methods. first 1 case class constructor, , other in companion object. upickle not know apply method use , throws exception. known limitation . one workaround rename apply method in companion object. write custom pickler . here clumsy version of custom pickler solved problem: ...

c - When fputs is used directly for writing character array in a file, a different format of text is stored -

when used fputs() directly store character array in file, stored in file: Èlwìþ( why that? #include <stdio.h> int main() { file *p; p=fopen("pa.txt","w+"); char name[100]; printf("enter string :"); fputs(name,p); fclose(p); getchar(); return 0; } when take input in name using scanf() or gets() , correct text stored when directly use fputs() used stored in unusual format. why happen? when take input in name using scanf() or gets() correct text stored when directly fputs() used stored in unusual format. why happens ? you haven't read data stdin before writing out using fputs . use: fgets(name, sizeof(name), stdin); and then: fputs(name, p);

prolog - Evaluate a number in (a few) natural language -

assume list, each element can be: a) number 1,2,...9 b) number 10, 100, 10000, ... (numbers of form 10^(2^n) n>=0). it need (as simple possible) rule evaluates list 1 integer number. examples of evaluation are: [1] => 1 [2] => 2 [10 1] => 11 [2 10 1] => 21 [2 100 1 10 4] => 214 [2 10 1 100 4] => 2104 [2 10 1 100 10000] => 21000000 in other words, numbers 10, 100, ... equivalent of tenths, hundreds, million, ... in english , rule evaluate usual in english , other languages: 10, 100 "multiplies" values before them, numbers after them added. (i know definition not exact one, finding definition part of problem. not hesitate requests more examples if necessary). note than, in same way in natural language, number 0 not necessary. even, initial languages, not present in grammar. addendum the major difficulty in problem expression [2 10000 3 10] can not taken (2*10000+3)*10, 2*10000+3*10. example [2 10 1 10000 3 10] (2*10+1)*10000+3*10. ...

python - Looping playback of a list of Gst.Sample with GstApp.AppSrc -

i'm trying write simple music player using gstreamer. want play arbitrary music file abs_file_path , store samples other purposes , later loop on these indefinitely, once original end of stream reached. now playing music works fine until short after last sample of track played. of time there's silence, there 1 or 2 audible samples indicating, track started playing again. same holds terminal output. shows, few samples after looping started, need-data signal sent more before. i've used fakesink dumping data, seemed work fine. data looped, intended. so happens here? why don't samples play second (third, fourth, ...) time? i've run out of ideas. following added minimal example of i'm doing without ui, same problem: import itertools, signal signal.signal(signal.sigint, signal.sig_dfl) gi.repository import gst, gstapp, gtk gst.init(none) # read samples gst.appsink playbin playbin = gst.elementfactory.make("playbin") playbin.props.uri = ...

R: Plot Density Graph for data in tables with respect to Labels in tables -

i got data in table form in r: v1 v2 1 19 -1539 2 7 -1507 3 3 -1446 4 7 -1427 5 8 -1401 6 2 -422 7 22 4178 8 5 4277 9 10 4303 10 18 4431 ....200 million more lines go i plot density plot value in second column respect label in first column (i.e. each label has on density curve on same graph). don't know how. suggestion? if understood question correctly, end density heatmap in end. (considering there 200 million observations total , v1 has considerable range of variation) for try ggplot , stat_binhex : df <- read.table(text="v1 v2 1 19 -1539 2 7 -1507 3 3 -1446 4 7 -1427 5 8 -1401 6 2 -422 7 22 4178 8 5 4277 9 10 4303 10 18 4431") library(ggplot2) ggplot(data=df,aes(v1,v2)) + stat_binhex() + scale_fill_gradient(low="red", high="steelblue") + scale_y_continuous() + theme_bw() stat_binhex should work large data , has several param...

override - django rest framework - adding to views.obtain_auth_token -

i have implemented token authentication django rest framework , can post username , password /api-token-auth/ , token. url(r'^api-token-auth/', token_views.obtain_auth_token) in addition token, want user object related returned token. how can override/add view , return actual user object? you can find relevant view here: https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/authtoken/views.py#l21 assuming you've created sort of user serializer already, can take user instance there , shove userserializer. add response, below. ... user_serializer = userserializer(user) return response({'token': token.key, 'user': user_serializer.data})

sql server 2008 - Crystal Report page split up and encrypting the generated document in C# -

i generating payslip report employees in crystal report tool (c# coding), based on , employee id's, report gets generated. i have save report in pdf format based on employee wise (separate pdf document every employees - split up), in define path , automatically (through programming), , have encrypt generated documents (password protected). i suggest solution far ideal, since in hurry, may help. to "separate pdf": generate 1 report 1 employee @ time; or generate them , use tool split pdf. about encryption, don't know if pdf format or adobe reader has ready support it, zip files password. believe can done programatically or, @ least, batch commands.

jquery - Get index of li in multiple parents -

i have loop through elements in each li. i'm trying find index of each el relative group-fields div. have array of el's inside each li tag. for (var = 0; < arr.length; i++) { var el = arr[i]; var li = el.closest('li'); console.log( "li index =", li.index() ); } the above giving me index relative each parent index of each li inside col-1 , index of each li inside of col-2. want know index of each element in relation top element group-fields. loose html example: <div class="group-fields"> <div class="col-1"> <ul> <li> <input>el</input> </li> <li> <input>el</input> </li> <li> <div>el</div> </li> </ul> </div> <div class="col-2"> <ul> <li> <div>el</div> </li> ...

Anyone successfully used jonnyw's "php phantomjs" with laravel, in a ubuntu envirement? -

anyone sucessfully used jonnyw's "php phantomjs" laravel, in ubuntu envirement? i not know if doing wrong, questioning if possible not possible use laravel in linux... i time : "error when executing phantomjs procedure "default" - file not exist or not executable: bin/phantomjs" but tried lot of ways , many ways, still didn't make work...(i "almost" "sure", file in right place , path right ), , bin folder 777 in permissions... :p in advance. yep, it's pain. most of time it's because have use full path phantomjs executable. also, make sure phantomjs installed on server too, like, work if run phantomjs command in terminal?

amazon web services - I want to parse the Total monthly payment value to a cell in Excel spreadsheet -

i working on analytical problem information amazon ec2 calculator needed. i have spreadsheet perform criteria analysis , each iteration need specific cost of services provided aws. my solution invokes, in user form, aws simple calculator, allowing user specify type of services use aws, pressing button, placed on same user form value of total monthly payment must parsed cell in main workbook. operation should repeated each of test scenarios. please, vba capture value website , parse cell within workbook appreciated. thanks, morph. p.s. here code use: private ie object, obj object private row integer, cell integer, table integer private elemcollection object private sub userform_initialize() set ie = createobject("internetexplorer.application") ie me.webbrowser1.navigate "http://calculator.s3.amazonaws.com/index.html" thisworkbook.sheets("sheet3").range("a1:z1000").clearcontents end end sub private sub bm_importdata_clic...

c# - how to use class of other project in a solution (internal)? -

this question has answer here: how use class 1 c# project c# project 8 answers environment : in c#, have solution many project. added *.csproj files. problem : in project, can use classes of other files through namespace. however, there way use namespace , classes of project in same solution? in visual studio should have "references" area in solution explorer. right click , click "add reference..." here, it's matter of locating other code on machine. edit: here additional information on dlls, in case helps you.

java - Else statement executing -

this question has answer here: java: substring index range 10 answers i new java programming , doing practice code via website, clarity on below given: string str = "jason"; str.substring(4,5); result = "n" question: method substring parameters (begin_index, end_index) . there no index of 5 variable str . java automatically -1 when comes length method of string? the substring() method "inclusive exclusive". this means in jason, when provided (4, 5) parameters, it's inclusive of index 4 (n), exclusive of index 5. index 5 doesn't exist, it's exclusive it's okay. note .length not 0 indexed. if try .length you'll 5. string character positions 0 indexed. jason indexed have 0 on j , 4 on n, though length 5.

tr - Removing carriage return and tab escape sequences from string in Bash -

assume have string: your name is\nbobby\tblahck\r\r how can remove characters "\n, \t, \r". string literally looks that, not contain tabs or new lines. characters. when try echo "your name is\nbobby\tblahck\r\r" | tr -d '\t' tr assumes trying remove tabs, doesn't work , prints examtly same string. ideas how remove them? have same problem sed. thanks $ echo "your name is\nbobby\tblahck\r\r" | sed -e 's,\\t|\\r|\\n,,g' name isbobbyblahck or $ echo "your name is\nbobby\tblahck\r\r" | sed -e 's,\\[trn],,g' name isbobbyblahck -e on os x; replace -r otherwise.

how to fix the 'Unknown provider: $compileProvider' error in angular-meteor app -

i'm building angular-meteor app, main angular module named "collector" when load app, see following error in browser console: error: [$injector:modulerr] failed instantiate module collector due to: loneleeandroo_ngmeteor.js:111 [$injector:modulerr] failed instantiate module angular-meteor due to: [$injector:modulerr] failed instantiate module angular-meteor.template due to: [$injector:unpr] unknown provider: $compileprovider http://errors.angularjs.org/1.2.14/$injector/unpr?p0=%24compileprovider minerr/<@http://localhost:3000/packages/loneleeandroo_ngmeteor.js?34ad21c0b396f189ccb67fbd89ea5ed4108d0168:111:5 createinjector/providercache.$injector<@http://localhost:3000/packages/loneleeandroo_ngmeteor.js?34ad21c0b396f189ccb67fbd89ea5ed4108d0168:3631:13 getservice@http://localhost:3000/packages/loneleeandroo_ngmeteor.js?34ad21c0b396f189ccb67fbd89ea5ed4108d0168:3758:11 loadmodules/<@http://localhost:3000/packages/loneleeandroo_ngmeteor.js?34ad21c0b396f189ccb...