Posts

php - Cannot edit the file -

<?php $filename = "changelog.txt"; $newdata = $_post['newd']; if ($newdata != '') { $fw = fopen($filename, 'w') or die('could not open file! error 1'); $fb = fwrite($fw,stripslashes($newdata)) or die('could not write file'); fclose($fw); } $fh = fopen($filename, "r") or die("could not open file!"); $data = fread($fh, filesize($filename)) or die("could not read file! error 2"); fclose($fh); echo "<form action='$_server[php_self]' method= 'post' > <textarea name='newd' cols='100%' rows='50'> $data </textarea> <input type='submit' value='change'> </form>"; ?> so found code google add file editor, shows file editor, when add new line , click change, says "could not open file...

c# - implementing ISerializable for version control -

consider following pod type of class: public class price { public decimal offerprice { get; set; } } objects class retrieved server let's decorate serializable [serializable] public class price { public decimal offerprice { get; set; } } now there's 2 clients on different machines retrieving these objects. wont send prices. copy of price's assembly. now class expanded bonusprice. [serializable] public class price { public decimal offerprice { get; set; } public decimal bonusprice { get; set; } } the new assembly deployed server, 1 of clients not other. older versioned client crash when (de)serializing price objects. the client old version not need bonusprice field nice keeps working when there's version difference. therefore i'm thinking of implementing iserializable beginning first , second version like: // version 1.0 [serializable] public class price : iserializable { protected price(serializationinfo info, streamingcontext context)...

user interface - ClearCase Linux GUI error comparing/checkin-out/describe/ -

we have clearcase server (version 7.0.1.1-ifix02) installed on linux server "srv1" (vobs, views , license). development environment on linux server "srv2". on server clearcase installed (7.0.1). access views through clearcase gui installed on development server. we can access gui without problem , action files , directories on current path we've started gui. after moving other directory in file browser of gui, cannot checkouts, comparison, describe, ... windows appear "transcript": /bin/sh: ./grpxxxxx: no existe el fichero o el directorio where xxxxx 5 digits number different on each action. the fact is, when using clearcase gui on clearcase server "srv1", don't have such problem. the simplest way debug situation revert command line. if have clearcase 7.x, use cleartool . ( clearcase 8.x, use rcleartool ): cd /path/to/your/view/.../yourfolder cleartool ls that should give current state of folder , elements, se...

qt - Setting height of QMenu items -

is possible style qmenu:item set custom height? i need popup menu, i've been seeing seems it's not possible maybe knows sure. have tried use qss ? works fine me: qmenu::item { height: 42px; margin: 0px; } you can use pmenu->setstylesheet("qmenu::item { height: 42px; margin: 0px; }"); . note: make sure use :: , not : reference item.

Get certain files from a directory using glob() - PHP -

basically want files directory using glob() . file format this: 052013.www.test1.com.txt 052014.www.test1.com.txt 062014.www.test1.com.txt 072014.www.test1.com.txt 082014.m.test1.com.txt 092014.test1.com.txt and file of curent year (i.e $_session['year'] ) , has www or m in it, here's function : function get_files(){ $dir = document_root; $hostname = host; $files = array(); $scan = glob($dir."{*".$_session['year'].".m.,*".$_session['year'].".www.}".$hostname.".txt", glob_brace | glob_nocheck ); foreach ( $scan $file ) { $files[] = $file; } return $files; } the issue here when doesn't found file has example www returns : array ( [0] => /var/www/stats/082014.m.test1.com.txt [1] => /var/www/stats/*2014.www.test1.com.txt ) what's mistake i'm making in function here? appreciated. glob_nocheck - return search pattern if no files matchi...

webgl - Must render buffer texture dimensions be power-of-two? -

does texture use webgl render buffer storage need have dimensions power-of-two? background info i'm chasing framebuffer_incomplete_attachment reported client on setup: windows 7 enterprise 32-bit firefox version: 33 video card: intel q45/q43 express chipset driver version 8.13.10.2413 and far i'm @ loss why it's happening, guessing might npot textures. here's render buffer implementation, not have power-of-two-texture yet: scenejs._webgl.renderbuffer = function (cfg) { /** * true buffer allocated , ready go * @type {boolean} */ this.allocated = false; this.canvas = cfg.canvas; this.gl = cfg.canvas.gl; this.buf = null; this.bound = false; }; /** * called after webgl context restored. */ scenejs._webgl.renderbuffer.prototype.webglrestored = function (_gl) { this.gl = _gl; this.buf = null; }; /** * binds buffer */ scenejs._webgl.renderbuffer.prototype.bind = function () { ...

java - How to test a method that calls different methods inside? -

i have method unit test called addsong(song,userid) in service class.i calling 3 methods inside dao class.i using easy mock mock dao class . in setup first mock methods calling in addsong(song,userid) , , calling service.addsong(song,userid) method fot test. but getting following error: java.lang.illegalstateexception: missing behavior definition preceding method call: musicplayerdao.addsong(song) usage is: expect(a.foo()).andxxx() @ org.easymock.internal.mockinvocationhandler.invoke(mockinvocationhandler.java:42) @ org.easymock.internal.objectmethodsfilter.invoke(objectmethodsfilter.java:94) @ org.easymock.internal.classproxyfactory$mockmethodinterceptor.intercept(classproxyfactory.java:97) @ service.musicplayerdao$$enhancerbycglib$$45bc3ca1.addsong() @ service.musicplayerserviceimpl.addsong(musicplayerserviceimpl.java:43) @ addsongtest.addsongs(addsongtest.java:90) here code: private void addsongsetup() throws sqlexception{ this.album = new...