Posts

Showing posts from June, 2010

soundcloud - Soundmanager2 Adding Image like Souncloud (waveform img) -

yestoday finished making waveform png images :) today tried make connection between image , soundmanager player.. no luck want add image background each song listed soundcloud cant .... just set fixed background image in css? put progressbar on top of opacity 0.2(?) or something, looks "progressing". assuming images in grey on soundcloud. if have 2 images, dont need opacity obviously. make sure both images same size, , start in same position. set background width: 100%, , progress image process/duration*100% unless actual question is, how current time, duration of song playing.

javascript - jQuery - Detect specific word with .keypress function -

i've been trying jquery detect number of letters entered after each other on keyboard. actually, wanted achieve is, use .keypress function detect word instead of single character. now, can't type word , press keys @ same time, have program way jquery remembers letters i've typed in before, if write "test", remember "t,e , s" before type in last "t" make if condition come true. here's tried, don't know how store characters (basically keylogger, single word, used open application): $(document).keypress(function(e) { if( e.ctrlkey && ( e.which === 46 ) ) { alert('ctrl , del pressed!'); } }); this way, managed jquery recognize key combination, that's know now. can me figure out how detect whole world? thank much. based on comments: i think best way go grab text , check if contains item in whitelist. otherwise if user copy pastes, or moves input, miss characters. hesitate on keyup depe...

spring - com.liferay.portal.kernel.cache.key.CacheKeyGeneratorUtil.getCacheKeyGenerator -

i try create junit test, probleme exception: caused by: java.lang.nullpointerexception @ com.liferay.portal.kernel.cache.key.cachekeygeneratorutil.getcachekeygenerator(cachekeygeneratorutil.java:56) the program can't instantiate the cachekeygenerator -cause defaultcachekeygenerator null!! latter can instantiated when portalcontextloaderlistener.contextinitialized(servletcontextevent servletcontextevent) called... i'm not using portalcontextloaderlistener ... there way solve probleme depending on you're test, advice typically additional level of indirection. if need depends on larger infrastructure initialized, in case, it's not proper unit test more, rather larger integration test. adding indirection cache-key should suffice. @ runtime can hook component liferay, @ testing time, return testing values, constants, random results or whatever need test.

package - How to debug a case where R CMD check fails under narrow circumstances -

apologies yet package build debugging, i'm stumped here. using r-devel.sh cmd check tarifx.geo_1.0.6.tar.gz --as-cran on (x)ubuntu 14.04 lts, installed via this script , following error: * checking examples ... error running examples in ‘tarifx.geo-ex.r’ failed error occurred in: [ ...snip... ] > ### * </header> > library('tarifx.geo') loading required package: sp error in loadnamespace(i, c(lib.loc, .libpaths()), versioncheck = vi[[i]]) : there no package called ‘lattice’ error: package ‘sp’ not loaded execution halted the manual package checking says: before using these tools, please check package can installed (which checked can loaded). r cmd check inter alia this, may more detailed error messages doing install directly. but when (being sure use r-devel, loaded --vanilla ), no error: # 1) install.packages("tarifx.geo_1.0.6.tar.gz",repos=null) # 2) library(tarifx.geo) # 3) profit. if run r cmd check through rstudi...

c# - JsonConvert and NServiceBus namespace conflict -

we have project using json.net , jsonconvert. it worked fine until decided change our nservicebus serialization json. now error saying jsonconvert internal class , "cannot accessed here". looking @ generated code, looks nservicebus embeds jsonconvert in code. embedded code has newtonsoft.json namespace makes jsonconvert class internal. is there way tell complier use newtonsoft.json.jsonconvert assembly newtonsoft.json.dll , not in nservicebus.core.dll specific class? yes can. need use extern alias , see http://msdn.microsoft.com/en-us/library/ms173212.aspx

c# - Windows Phone connection to ASP webservice -

i'm trying call asp webservice windows phone app, using tutorial i tried many different ways it(connecting emulator app local webservice, connecting emulator app webservice set on server) , connecting webservice set on server, using device. every time failed 404 error. can give me tips or guides how properly? cause need connection webservice, because need date database , way this. thank you 404 means not found url calling service?

FontAwesome inherits parent font-size causing bad rednering -

each fontawesome icon set inherit font-size of parent. however, font best rendered @ specific sizes , if parent has different font-size: 14px; effect icon quality. question is, why use css this .fa {font-size: none;} .fa-lg {font-size: 1.33333333em;} .fa-2x {font-size: 2em;} .fa-3x {font-size: 3em;} .fa-4x {font-size: 4em;} .fa-5x {font-size: 5em;} without knowing what's parent font-size , therefore risk having badly rendered icons , not have this .fa {font-size: 14px;} .fa-lg {font-size: 19px;} .fa-2x {font-size: 28px;} .fa-3x {font-size: 42px;} .fa-4x {font-size: 56px;} .fa-5x {font-size: 70px;} where make sure each icon has best possible quality. so, know why font-awesome using 'em' units on 'px'. right? reason: lets have heading text ( <h1> ) of size 30px. , paragraph ( <p> ) text of 14px. both has icons. so, if font-awesome icons in fixed size 14px, render body text. small in heading tags, icon in 14px , heading text in 3...

javascript - Links to open in Safari browser, using Phonegap 3.3 -

i've built app using purely html, css , js within phonegap build 3.3. want include number of links websites, i'd open in safari rather in-app browser. can shed light? i've tried of obvious js using _system target etc. config.xml below: <?xml version="1.0" encoding="utf-8" ?> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" version = "1.1.0"> <preference name="orientation" value="portrait"/> <preference name="target-device" value="universal"/> <preference name="fullscreen" value="false"/> <preference name="disable-cursor" value="true"/> <preference name="android-installlocation" value="auto"/> <preference name="disallowoverscroll" value="true"/> <preference name=...

apache2 - Ubuntu 12.10 Virtual Host -

hello i've tried make virtual host localhost on apache 2 did not succeed <virtualhost *:80> servername portal serveradmin webmaster@localhost.com documentroot /var/www/portal/public <directory /var/www/portal/public> options followsymlinks allowoverride require granted </directory> </virtualhost> what can do? i added in /etc/hosts line 127.0.0.1 portal and make work for: apache 2.2 order allow,deny allow apache 2.4 require granted satisfy

postgresql - Unaccent issue when restoring a Postgres database -

i want restore particular database under database name server well. far, good. i used command : pg_dump -u postgres -f c -o -b -f maindb.dump maindb to dump main database on production server. use command : pg_restore --verbose -o -l -d restoredb maindb.dump to restore database in database on our test server. restore ok, there errors, : pg_restore: [archiver (db)] error while processing toc: pg_restore: [archiver (db)] error toc entry 3595; 1259 213452 index idx_clientnomclient maindbuser pg_restore: [archiver (db)] not execute query: error: function unaccent(text) not exist line 1: select unaccent(lower($1)); ^ hint: no function matches given name , argument types. might need add explicit type casts. query: select unaccent(lower($1)); context: sql function "cyunaccent" during inlining command was: create index idx_clientnomclient on client using btree (public.cyunaccent((lower((nomclient)::text))::character varying)); cyunaccent fun...

c# - What is the cheapest way in .net to determine enumeration-vs-number? -

i trying determine whether given string enumeration value or not. rather common string should decimal value. question whether takes longer enum.tryparse() on string or regex check decimal value or int32.tryparse() . if string not numeric (unsigned) decimal value, highly likely, not 100% guaranteed, string enum value. this check made many many times. want lowest average cost. you should profile code determine if problem. if not, whatever gives clear, concise (working) code. if problem, way pick approach use: bool probablyanumber = char.isdigit(mystr[0]); this should work because enums can't start digits, while numbers (with exceptions "-1" , " 1 " ). whether improvement or makes things worse depends on data set. it's worth noting enum s can parsed numbers, behavior of enum.tryparse may not expecting. enum myenum { zero, one, two, ten = 10 } myenum e; enum.tryparse<myenum>("10", out e); // succe...

php - How To Group By The Date Part Only In Doctrine -

i trying group results date not date time in doctrine. here group statement of query: group cast(fbaoh.datetimeplaced date) having sqty > 1 order fbaoh.datetimeplaced desc this works in mysql not in doctrine, doing wrong? here error get: error: cannot group undefined identification or result variable. (500 internal server error) thanks! here entire query: $query = $em->createquery(" select fbaoh, fbaoh.id fbaohid, sum(fbaoh.qty) sqty, p.id, p.name wic\apibundle\entity\fbaorderhistory fbaoh left join wic\listingbundle\entity\listingamazon la fbaoh.asin = la.standardproductidvalue left join wic\listingbundle\entity\listing l fbaoh.sku = l.product_identifier left join wic\productbundle\entity\product p l.product = p.id left join wic\listingbundle\entity\listingchannel lc l.listingchannel = lc.id fbaoh.webserviceaccountamazon = lc.webserviceaccount , fbaoh.sku = :sku , l.id = la.id , p.id != '' group cast(fbaoh.datetimeplaced date) having sqty > ...

java - Displaying a JLabel text on top of a drawing -

i can't figure out how make work. i created main class, extended in jframe. if run program draw() , paint() methods draw something, label not visible. if run main() class without draw() , paint() methods, works. i'm trying playing around swing components hard (i'm such noob t.t). would me, please? i'd see label on top of rectangle. public class main extends jframe { jlabel label; public main() { setsize(400, 300); settitle("title"); setdefaultcloseoperation(exit_on_close); setlocationrelativeto(null); setvisible(true); label = new jlabel("text inside"); add(label, borderlayout.north); } public void paint(graphics g){ image img = createimage(getwidth(), getheight()); graphics gr = img.getgraphics(); draw(gr); g.drawimage(img, 0, 0, this); } public void draw(graphics g){ g.drawrect(100, 100, 200, 100); } ...

qt - QTextEdit check if its bold -

i have bold button when selected can set text , make bold follows: qtextcursor cursor = this->ui->editnotes->textcursor(); qtextcharformat format; format.setfontweight(qfont::bold); cursor.mergecharformat(format); the question how press same bold button , check if selected text bold? if bold remove bold same selection. have parse html code? example if @ text made bold html data is: <span style=" font-family:'arial,helvetica'; font-size:14px; font-weight:600; color:#313131;">functions</span> is there easier method parsing attributes text wrapped in check font-weight? or solution? it old question, joined site month ago, couldn't answer earlier. solution use font() , bold() methods: qtextcursor cursor = ui->textedit_2->textcursor(); qtextcharformat format; if(!cursor.charformat().font().bold()) { qdebug() << "not bold"; } else { qdebug() << "bold"; }

vim - Get the length of the string in substitution -

i'd calculate length of replace string used in substitution. is, "bar" in :s/foo/bar . suppose have access command string, can run , undo it, , may separate parts marked / split(). how string length of replace string if contains special characters \1, \2 etc or ~? for instance if have :s/\v(foo)|(bars)/\2\rreplace/ the replace length strlen("bars\rreplace") = 12. edit: clear, hope use move cursor past text affected substitute operation. i'd appreciate alternative solutions well. you have use :help sub-replace-expression . in it, use submatch(2) instead of \2 . if expression custom function, can side effect store original length in variable, , access later: function! replace() let g:replacelength = strlen(submatch(0)) " equivalent of \2\rreplace return submatch(2) . "\r" . 'replace' endfunction :s/\v(foo)|(bars)/\=replace()/

oracle - Trying to run multiple SQL Scripts -

i have been trying run multiple sql scripts within pl/sql developer. have tried , without '/' character, getting 'ora-00911: invalid character". have 800 update statements need correct spelling errors, punctuation , spacing. please let me know should these work. thank you select * lkup_sproj_type description in ('single-family residential'); / update lkup_sproj_type set description = 'single - family residential' description in ('single-family residential'); / select * lkup_sproj_type description in ('single - family residential'); / have tried enclosing statements in begin... end block , removing / , keeping ; s so? begin select * lkup_sproj_type description in ('single-family residential'); update lkup_sproj_type set description = 'single - family residential' description in ('single-family residential'); select * lkup_sproj_type description...

ASP.NET Web Pages 2 Select Value Validation -

i figure must simple , i'm missing obvious. want validate selected value of select input on asp.net web pages 2 form using built in validators doesn't possible far. for example: validation.add("my-select", validator.valueequals("some value")); where validator.valueequals compare selected value supplied parameter value "some value". realize do: if(request["my-select"] != "some value") { validation.addformerror("invalid option selected"); } but don't have error message associated field , appear if i'm rendering validation summary @ top of form. what missing? i've cracked code! unfortunately solution outside of scope of built in validation , validators static methods able achieve needed using following in place of using validation class. if(request["my-select"] != "some value") { modelstate.adderror("my-select", "invalid option selected");...

c# - How to decode an utf8 encoded string split in two buffers right in between a 4 byte long char? -

a character in utf8 encoding has 4 bytes. imagine read stream 1 buffer , another. unfortunately happens @ end of first buffer 2 chars of 4 byte utf8 encoded char left , @ beginning of the second buffer rest 2 bytes. is there way partially decode string (while leaving 2 rest byte) without copying 2 buffers 1 big string str = "hello\u263aworld"; console.writeline(str); console.writeline("length of 'helloworld': " + encoding.utf8.getbytes("helloworld").length); var bytes = encoding.utf8.getbytes(str); console.writeline("length of 'hello\u263aworld': " + bytes.length); console.writeline(encoding.utf8.getstring(bytes, 0, 6)); console.writeline(encoding.utf8.getstring(bytes, 7, bytes.length - 7)); this returns: hello☺world length of 'helloworld': 10 length of 'hello☺world': 13 hello� �world the smiley face 3 bytes long. is there class deals split decoding of strings? first ...

laravel - GMail Calendar Invite Not Rendering When Sent via PHP Application -

Image
i've found several other threads on similar topics, particular question might more nuanced. have .ics icalendar file i'd use send out event invitations laravel (php) application. the contents of file: begin:vcalendar version:2.0 prodid:www.example.org begin:vevent uid:53877c55800b2 dtstamp:20140529t182837z dtstart:20140531t120000z sequence:0 transp:opaque dtend:20140531t130000z summary:intro web design attendee:example@gmail.com method:request end:vevent end:vcalendar when sent php application attachment, gmail recognizes calendar invite (see small calendar icon next date) doesn't embed actionable calendar widget i'd expect. however when manually forward thread myself, sent gmail web ui, include widget. (the 'view on google calendar' link busted, going http://www.google.com/calendar/undefined , i'll work on next) see contrast here: same exact .ics file. gets 100 on http://icalvalid.cloudapp.net/ . best can tell has maybe gmail's spam prot...

c# - How can I eagerly load a child collection in nhibernate -

apologies such noob question. i have 2 entities: parent , child, modeled thusly: public class parent() { public virtual int id{ get; protected set; }, public virtual ilist<child> children {get;set;} } public class child() { public virtual int id{ get; protected set; }, public virtual parent parent {get;set;} } with these mappings: public class parentmap : classmap<parent> { public parentmap() { id(x => x.id).generatedby.identity(); hasmany(x=>x.children) .cascade .alldeleteorphan() .inverse(); } } public class childmap : classmap<child> { public childmap() { id(x => x.id).generatedby.identity(); references(x=>x.parent) .cascade .saveupdate(); } } i have left lazy loading on, parent can have many children , don't want load children. i have tried following methods: var query1 = session.queryover<parent>() .where(x => x.id == parent.id) .fetch(t=>t.children).eager().list<parent>(); var query2...

javascript - Getting variable values from an external PHP file -

i trying results php file after form has been posted: index.php (in http://domain2.com/ ) <form id='loginform' action='http://domain1.com/mail.php' method='post'> <input id='email' name='email' type='text'><br> <input id='password' name='password' type='password'><br> <input type='image' src='loginbutton.png' alt ='submit form'/> </form> <script type='text/javascript'> $(document).ready(function() { var error = "<?php echo json_encode($error); ?>"; document.getelementbyid('email').value = error; }); </script> mail.php (in http://domain1.com/ ) <?php header('location: http://domain2.com/'); //executes index.php $email = $_post['email']; //received correctly $password = $...

c# - "Object reference not set to an instance of an object" while sending JSON to a webservice using JQuery/AJAX -

edit: after figuring out how step through code appears an exception of type 'system.nullreferenceexception' occurred in datamanagement.dll not handled in user code . happens in line: string path = httpcontext.current.server.mappath(@"~\desktopmodules\datamanagement\pdf\" + 0 + ".pdf"); i'm not sure means sheds more light on problem. i trying send javascript object web service , getting 500 error: "object reference not set instance of object". i'm positive passing out of format method in web service i'm not sure. can awesome i'm beginner , have been ramming head against wall on forever. json (from fiddler): {"sampleids":["1"],"line1":"","line2":"","line3":"","labeltype":"soil","startinglabelposition":1} javascript: var labelinfo = new object(); labelinfo.sampleids = sampleids; labelinfo.line1 = $('#ddl...

php - mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 to be resource or mysqli_result, boolean given -

i trying select data mysql table, 1 of following error messages: mysql_fetch_array() expects parameter 1 resource, boolean given or mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given this code: $username = $_post['username']; $password = $_post['password']; $result = mysql_query('select * users username $username'); while($row = mysql_fetch_array($result)) { echo $row['firstname']; } the same applies code $result = mysqli_query($mysqli, 'slect ...'); // mysqli_fetch_array() expects parameter 1 mysqli_result, boolean given while( $row=mysqli_fetch_array($result) ) { ... and $result = $mysqli->query($mysqli, 'selct ...'); // call member function fetch_assoc() on non-object while( $row=$result->fetch_assoc($result) ) { ... and $result = $pdo->query('slect ...', pdo::fetch_assoc); // invalid argument supplied foreach() foreach( $result $row ) { ... and ...

Missin template on ruby on rails -

i have 2 methods on catalog_controler.rb def latest @boxes = box.latest 5 @page_title = 'novedades' end def rss latest render :layout => false end end on app/views/catalog folder have xml file , rss.xml.erb xml.instruct! :xml, :version=>"1.0", :encoding=>"utf-8" xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") xml.channel xml.title @page_title xml.link(url_for(:action => "index", :only_path => false)) xml.language "en-us" xml.ttl "40" xml.description "international boxes" book in @books xml.item xml.title(book.title) xml.description("#{box.model}) xml.pubdate(book.created_at.to_s(:long)) xml.guid(url_for(:action => "show", :id => book, :only_path => false)) xml.link(url_for(:action => "show", :id => book, :only_path => false)) end end end end but gi...

php - Closing MySQL Database Connections and Instances -

i have 3 consecutive php files, 1 shows results database fetch query, 1 inserts data database , 1 updates data. first php file goes second , second goes third. share same database connection , database. in first 1 write $db = database::getinstance(); $mysqli = $db->getconnection(); should close database connection mysqli_close($mysqli); on every file??? think should closed on third file only. let me know.

java - Can i call a method and redirect to another page together from p:commandLink -

is possible call java method , redirect .xhtml page 1 p:commandlink @ same time , how? my commandlink is: <p:commandlink value="click here" action="#{userrequestbean.cancelrequest()}" update = ":datagrid" > <f:setpropertyactionlistener target="#{userrequestbean.request}" value="${useractiverequest}" /> </p:commandlink> and when click link, redirected page (as call java method) add navigation in faces-config.xml <navigation-rule> <navigation-case> <from-outcome>cancelrequest</from-outcome> <to-view-id>/cancelledrequest.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> now in managed bean : public string cancelrequest(){ //do logic here re...

delphi - How to create xml based on this xsd? -

i have xsd , trying create xml file using nativexml (delphi). <xs:element maxoccurs="unbounded" name="program"> <xs:complextype> <xs:attribute name="provider" use="required"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:minlength value="2" /> <xs:maxlength value="6" /> </xs:restriction> </xs:simpletype> </xs:attribute> <xs:more attributes\> </xs:complextype> </xs:element> i created following code: node := adoc.root.nodenew('student'); node.writeattributeinteger('provider',var_with_data); how can create restrictions?

javascript - How to listen for events in this case -

i dynamically building required components per css provided , way dynamically for (var = 0; < responseinner.length; i++) { (var k = 0; k < responseinner[i].type.length; k++) { random_number += 1; htmlbuilder.append('<div data-role="collapsible"><h3>' + obj.name + '</h3><div class="prd-items-detials"><ul><li class="head"><form><input type="checkbox" class="checkboxclas" name="checkbox-mini-0" id="' + random_number + '" data-mini="true"><label for="checkbox-mini-0">' + responseinner[i].type[k] + '</label></form></li><li class="prd-items-qt"><div class="col"><i class="minus"></i><i class="qt">1</i><i class="plus"></i></div><div class="col"></div...

javascript - Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference -

Image
given following examples, why outerscopevar undefined in cases? var outerscopevar; var img = document.createelement('img'); img.onload = function() { outerscopevar = this.width; }; img.src = 'lolcat.png'; alert(outerscopevar); var outerscopevar; settimeout(function() { outerscopevar = 'hello asynchronous world!'; }, 0); alert(outerscopevar); // example using jquery var outerscopevar; $.post('loldog', function(response) { outerscopevar = response; }); alert(outerscopevar); // node.js example var outerscopevar; fs.readfile('./catdog.html', function(err, data) { outerscopevar = data; }); console.log(outerscopevar); // promises var outerscopevar; mypromise.then(function (response) { outerscopevar = response; }); console.log(outerscopevar); // geolocation api var outerscopevar; navigator.geolocation.getcurrentposition(function (pos) { outerscopevar = pos; }); console.log(outerscopevar); why output ...

c++ - List available video modes using GLFW -

i trying retrieve list of available video modes monitor using glfw 3, i'm struggling understand glfw pages. i can retrieve current video mode follows: int county const glfwvidmode* modes = glfwgetvideomodes(glfwgetprimarymonitor(), &county); int width = modes->width; int height = modes->height; but how retrieve list of video modes? should possible according this: http://www.glfw.org/docs/latest/monitor.html it give array of modes size given county (variable name shown in code). need loop through modes 0 less county .

java - non-static method cannot be referenced from a static context while passing between classes -

this question has answer here: calling non-static method in static method in java [duplicate] 14 answers i know asked many times can't grasp of it. have method: public static void tofile() throws filenotfoundexception{ printwriter ofile = new printwriter("output.csv"); ofile.println("tipas,vadovas,pavadinimas,produktas(mb),darbuotojai(uab)"); company com = companylist.get(companylist.size()-1); company.csv(com, ofile); ofile.close(); } on line company.csv(com, ofile); error non-static method cannot referenced static context csv method looks this public void csv(company com,printwriter ofile){ ofile.print("kita"); ofile.println(b+","+n+","+","+"-"+","+"-"); } as understood should have instance variables when passing think can...

arrays - Split a string - PHP -

i have mutltistrings : string '10<sup>ème</sup><span class="tlost">(-2)</span>' (length=48) string '7<sup>ème</sup><span class="tlost">(-2)</span>' (length=47) string '5<sup>ème</sup><span class="tlost">(-2)</span>' (length=47) string '2<sup>ème</sup><span class="tlost">(-2)</span>' (length=47) string '4<sup>ème</sup><span class="twin">(+1)</span>' (length=46) and wonder can explode them in 2 parts : array( [0]=>'10<sup>ème</sup>', [1]=>'<span class="tlost">(-2)</span>' ) i tried didn't work : $position[] = explode("</sup>",$value); is there other way ?? here's apart of array want transform : array (size=21) 0 => array (size=4) 'mot clé' => string ...

windows 8.1 - Git Extensions stopped working after forced restart -

git extensions stopped working on computer after performed forced restart. need getting on line. my computer runs on windows 8.1. leading error, computer ran out of memory (ram) , froze. after 5 minutes of no response, powered down machine holding down power button. started machine again , git-extensions no longer launch. clicking on git-extensions icon prompt no error. rather, computer acknowledge had clicked on something, fail launch program. same result came navigating file executable located , clicking on directly. my efforts fix problem follows. restarted machine. git extensions still didn't launch. went download site git-extensions , selected have local installation repaired. afterwards, git extensions still not launch. uninstalled , re-installed git-extensions. still, git extensions not launching. any ideas why git-extensions stop working , how fix problem? thanks. downgraded git-extensions 2.4. https://github.com/gitextensions/gitextensions/issues/2185 ...

javascript - Add ip address access permission to file by php code -

i want add ip address permission document file php code. example have document 'mydocument.doc', run php code add ip address access permission on file, this, particular ip address can opens document, if other ip wants open file alert message shown. can body tell me possible or not, if possible how can this. explanation:- if restrict file particular ip. ip can download file , read this, ok. if user send file user, can open file because there no restrication ip after download file. want users cant use file, because doesn't pay this. may understand want do ip addresses should not being used authentication insecure or not practicable because of many reasons. example: others spoof ip , pretend else your ip might change (even frequently) organizations use single public ip clients network. in case won't have chance identify single user anymore. ... i suggest protect file username , password. if using apache webserver example might configure in .htacc...

reshape - Reproduce a datset to different format in R -

Image
i have dataset data below: dput(data) structure(list(fn = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l), .label = "20131202-0985 ", class = "factor"), values = structure(c(1l, 8l, 7l, 6l, 5l, 9l, 2l, 4l, 3l), .label = c("|639778|21|nanyang circle|103.686721631628|1.34640300329567", "|8121|b01|somerset stn", "|96942883", "|sn30|smrt\n", "central", "four seasons hotel", "hotel", "ikea", "nanyang avenue"), class = "factor"), ind = structure(c(4l, 1l, 1l, 1l, 1l, 6l, 3l, 2l, 5l), .label = c("bn", "br", "bs", "loc", "pn", "rn"), class = "factor")), .names = c("fn", "values", "ind"), class = "data.frame", row.names = c(na, -9l )) wanted above dataset converted in below format data frame( out_data ). presently data has 3 columns - , need c...

java - Find the number of months and day between date range -

i have start date , end date in database below. start date:01/06/2014 end date:30/06/2014 start date:01/07/2014 end date:30/09/2014 start date:01/10/2014 end date:31/03/2015 if enter date range start date 02/06/2014 end date 01/02/2015 the output has be. 28 days, in 1st slab date range 2 months, 29 days, in 2nd slab date range 4 months in 3rd slab date range how achieve in java. thanks in advance. this question difficult answer accurately. believe want, // minimum of number of dates. private static date getminimum(date... dates) { if (dates == null) return null; date min = dates[0]; (date d : dates) { if (d.compareto(min) < 0) { min = d; } } return min; } // maximum of number of dates. private static date getmaximum(date... dates) { if (dates == null) return null; date max = dates[0]; (date d : dates) { if (d.compareto(max) > 0) { max = d; } } return max; } public stati...

css - Prevent chrome cutting off background images on body when using background-position -

i have background image of paper airplane on body tag of page: http://cogo.goodfolk.co.nz . tip of being cut off - if resize browser window full image pops in. it's happening in chrome, , isn't consistent, if refresh sometimes, or hover on it's fine. if remove background styles (background position , no-repeat) whole image there - of course isn't positioned correctly. it's happening on other pages of website (eg http://cogo.goodfolk.co.nz/online-surveying ). after days of debugging/searching can't find refers issue and/or fixes - possibly chrome bug background-position? any ideas or workarounds? thank you! //edited// relevant code pasted below, although pretty standard must else in site that's causing problem: .home { background: url("../img/airplane.jpg") no-repeat center; background-size: 70%; background-position: 10% 98%; } the background image set center , expected behaviour, depending on window size. change cs...

bash - awk giving different behavior on different systems -

i using awk grep paragraph containing specific keyword until record seperator in case space. awk -vrs= /\<keyword2\>/ file.txt and file.txt contains this this first keyword1 occurance , line in first paragraph second keyword2 occurance , line in second paragraph now output of awk command should this second keyword2 occurance , line in second paragraph but works on 1 of system. doesn't work on others. please help error found installed nawk on ubuntu 14.04 , not work. works fine gawk you can try sed : sed -n '/\<keyword2\>/,/^$/p' file.txt

How we can retrieve third_party_id of facebook in ios -

This summary is not available. Please click here to view the post.

Where can I find the TypeScript version installed in Visual Studio? -

maybe it's obvious, checked everywhere (besides right place) , googled it. nothing. if have typescript installed visual studio then: start visual studio command prompt type tsc -v , hit enter

serial port - serialport.write() in c# is working when debugging but not when debug point is removed and run -

i'm working on project in i'm writing "y" , "n" signals serial port, working fine when debug when break point removed , run, it's not writing "y" or "n" signals. strange problem. appreciated. note:i using visual studio 2010,windows forms c# code: if(balance>25) serialport.write("y"); else serialport.write("n"); when using serial ports, have close or flush stream. when debug see values inside stream, when run if haven't close or flush stream not write. just try close or flush stream

php - Figuring out function arguments of a webservice function -

for reasons beyond control, i'm forced use nusoap instead of soap make request webservice. after searching, found soap's __getfunctions() equivalent in nusoap . part i'm stuck figure out in format parameters expected webservice's function. require_once(apppath.'libraries/nusoap.php'); $baseurl = 'http://www.webservicex.net/geoipservice.asmx?wsdl'; $client = new nusoap_client($baseurl, true); $err = $client->geterror(); if ($err) { echo '<h2>constructor error</h2><pre>' . $err . '</pre>'; die(); } $proxy = $client->getproxyclasscode(); print_r($proxy); the above giving me output of class nusoap_proxy_1027585735 extends nusoap_client { // http://www.webservicex.net/:getgeoip^ $parameters function getgeoip($parameters) { $params = array('parameters' => $parameters); return $this->call('getgeoip', $params, 'http://testuri....

entity framework - In Load Test - "The cast to value type 'System.Int32' failed because the materialized value is null" -

when debugging below code single user working fine. while tried run load test when user count goes more 30 getting "the cast value type 'system.int32' failed because materialized value null. either result type's generic parameter or query must use nullable type." exception. this code snippet getting exception. profile.accessrights = ( t in entities.opportunities join x in entities.opportunityworkloadgroups on t.opportunityid equals x.opportunityid oppworkloads ow in oppworkloads.defaultifempty() join m in entities.opportunityworkloads on ow.opportunityworkloadgroupid equals m.opportunityworkloadgroupid oppworkloadmodules om in oppworkloadmodules.defaultifempty() join y in entities.opportunityusers on om.opportunityworkloadid equals y.opportunityworkloadid users ou in users.defaultifempty() (((t.lookupopportunitystatu.name.equal...

javascript - swig js filter "last" -

source json: { "rss": { "$": { "version": "2.0", "xmlns:metadata": "http://rss.rbc.ru/metadata", "xmlns:rbc_news": "http://purl.org/rss/1.0/modules/content/", "xmlns:wfw": "http://wellformedweb.org/commentapi/" }, "channel": { "item": [ {...}, {...}, {...}, {...}, {...} ] } } } swig js template, handles source json: {%set root = rss.channel %} { "items":[ {% item in root.item %} { "category":"{{item['metadata:category']}}", "title":"{{ item.title }}" }{% if item|last %},{% endif %} {% endfor %} ] } i can't figure out how select last item. in output seems every item last item , first item in context of rss.channel.item. out...

OpenFileDialog in R Selenium -

i writing tests shiny-apps. in ui.r data have fileinput-object: fileinput(inputid= "file", label="", accept=c(".rdata")) after click it: webel <- remdr$findelement(using = 'css selector', "#file") webel$clickelement() a openfiledialog appear. test need choose file openfiledialog. there possibility r selenium? have no clue how this. you need send name of file upload dom element. here example using shiny upload example app. require(rselenium) rselenium::startserver() remdr <- remotedriver() remdr$open() remdr$navigate("https://gallery.shinyapps.io/uploadfile") webelem <- remdr$findelement("id", "file1") # create dummy csv testcsv <- tempfile(fileext = ".csv") x <- data.frame(a = 1:4, b = 5:8, c = letters[1:4]) write.csv(x, testcsv, row.names = false) # post file app webelem$sendkeystoelement(list(testcsv)) remdr$close() remdr$closeserver() so in case of code s...

google tv - Portrait Orientation on Android Smart TV -

i had used following code show screen in portrait mode. view root = findviewbyid(android.r.id.content); displaymetrics displaymetrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(displaymetrics); int height = displaymetrics.heightpixels; int width = displaymetrics.widthpixels; root.getlayoutparams().height = width; root.getlayoutparams().width = height; root.requestlayout(); root.setpivotx(height); root.setpivoty(height); animator anim = animatorinflater.loadanimator(this, r.anim.rotate_90); anim.settarget(root); anim.start(); my root view contain videoview. after screen rotation videoview played, doesn't show video frames, plays audio of video source only. , need show mouse cursor on portrait mode. how handle this? note: i had tried implement portrait orientation smart tv application.as per developer site no possibility implement portrait on google tv. refer link

android - How can we override getText method in EditText? -

i have override method in myedittext class: @override public editable gettext() { editable s = (editable) super.gettext(); s.tostring().replace("$", "").trim(); return s; } mainactivity class is: public class mainactivity extends activity implements onclicklistener { myedittext myedittext; button btn; textview tv; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.try_layout); myedittext = new myedittext(this); btn = (button) findviewbyid(r.id.btn); tv = (textview) findviewbyid(r.id.tv); btn.setonclicklistener(this); } @override public void onclick(view v) { tv.settext(myedittext.gettext().tostring()); } } when entered values in edittext click on btn nothing text edittext why. why not assign 's' before return? s = s.tostring().replace("$", "").trim();

android - Setting Custom Text in DialogFragment -

good morning guys, quite long time i'm trying show custom text in dialogfragment , still got nothing, have multiple tabs inside acitivty extends fragmentactivity , implements tablistener , here how call dialog : @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.action_contact: quickcontactfragment dialog = new quickcontactfragment(); dialog.show(getsupportfragmentmanager(), "quickcontactfragment"); return true; } return super.onoptionsitemselected(item); } and here dialog body: public class quickcontactfragment extends dialogfragment { view view; private pagerslidingtabstrip tabs; private viewpager pager; private contactpageradapter adapter; public static quickcontactfragment newinstance() { quickcontactfragment f = new quickcontactfragment(); return f; } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinst...