Posts

Showing posts from September, 2013

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...

java - How to draw a rectangle in android when a user moves finger? -

i want draw rectangle. first corner should point user first touches screen. when user moves finger, should draw rectangle. here's a link shows video want do. don't understand , maybe can me. want draw rectangle on white background not on image. my code : package com.example.androiddrawing; import java.util.arraylist; import java.util.list; import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.path; import android.graphics.point; import android.util.attributeset; import android.view.motionevent; import android.view.view; public class canvasview extends view { private canvas canvas; private paint paint = new paint(); private paint paint2 = new paint(); private paint paint3 = new paint(); private path path = new path(); private point point = new point(); private static list<path> lines = new arraylist<path>(); private static list...

javascript - Canvas - Path looks like zoomed in -

i created bezier path on canvas. although canvas wide enough path not fit it. looks if path zoomed in. wrong? jsfiddle js var canvas, context; init(); function init() { canvas = document.getelementbyid("mycanvas"); context = canvas.getcontext("2d"); context.fillstyle = 'rgb(245,245,245)'; context.fillrect( 0, 0, 420, 256 ); context.beginpath(); context.moveto(10, 70); context.beziercurveto(160, 50, 240, 50, 400, 50); context.linewidth=4; context.stroke(); } you need declare width , height attributes on canvas element. right have canvas of default size, scaled css, that's why looks zoomed. <canvas width="440" height="256" ></canvas>

Get Height of LinearLayout or RelativeLayout in Android programmatically -

i need length of linearlayout or relativelayout programmatically in android if have linearlayout follows <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" > i need increase height of layout located in mid of screen taking screen height , increase or decrease height taking calculations on basis of screen height. there way of calculating height of layout height set wrap_content. tried height layout parameters gives me value of -1 or -2 not height in pixels or density pixels. try following: mylayoutref.post(new runnable() { int height = mylayoutref.getheight; }); this runnable runs after layout has been drawn , laid out on screen, height returns real height , not 0

TypeError: can't convert nil into String with DateTime ruby -

i have method returns date utc format datetime.strptime(json_doc["assetfields"]["originalairdate"], "%y-%m-%d").iso8601 but return error above if json_doc["assetfields"]["originalairdate"] nil . i need use .try() method in ruby not throw exception. i not sure how can achieved datetime. please help. maybe setting default date when nil works you: default_date = "2014-01-01" datetime.strptime(json_doc["assetfields"]["originalairdate"] || default_date, "%y-%m-%d").iso8601

Creating listener of a CustomDialog out of the class in Android -

i trying create listener of button of customdialog extends dialogfragment class , want locate listener of custom buttons out of customdialog fragment class .however when try call view of customdialog fragment getting null exception. create new instance of customdialog fragment in somewhere else , say customdialog.getview().findviewbyid(r.id.custombutton); but getting null. public class customdialog extends dialogfragment { public final int res_none = -1; private textviewcustomfont dialogtitle, view2, dialogbodybottom, dialogbodytop; private edittextcustomfont dialogedittext; private buttoncustomfont dialogleftbutton; private buttoncustomfont dialogrightbutton; private typeface gothambold, gothammedium, gothamultra; private static int title1, bodytop1, bodybottom1, edittexthint1, leftbutton1, rightbutton1; onsubmitlistener mlistener; private dialog dialog; interface onsubmitlistener { void setonsubmitlistener(string arg); } public static customdi...

javascript - Show div instead with .hover or .mouseover ASP.NET -

i have image , on mouse hover want add description box or smthing that. $(document).ready(function(){ $(".desc").hover(function(){ $(this).show(".abc"); }); }); </script> .desc div picture is, .abc div description is. .abc on page load has hidden help ? edit :: i solve way $('.desc').on({ mouseover: function() { $(this).find('span').fadein(200); }, mouseout: function() { $(this).find('span').stop().fadeout(200); }, }) where span < span class="d-none"> <asp:label id="label1" runat="server" text='<%# eval("description") %>' /> </span> and span css display:none; thank again helping me you need select div want show. done following line $(".abc").show(); . code below should work. $(document).ready(f...

python 3.x - Ideas about how to create a splash screen using PyGObject? -

any ideas how create splash screen application using python3 , pygobject ? example : gimp's slpash screen. in case, used time.sleep(...) , makes application start slowly. i'm wondering if should thread slpash screen gui. i've searched in websites , didn't find solution. answers. , sorry bad english. create window will content open it force show set timeout close said window @ later time proceed initialisation there examples out there, e.g. http://code.activestate.com/recipes/577919-splash-screen-gtk/

spring mvc - Infinispan not using specified JGroups configuration file and throwing Exception -

i'm relatively new using jgroups , infinispan , have 2 part question: configuration file infinispan.xml: <jgroups> <stack-file name="configurationfile" path="cache/default-jgroups-tcp.xml"/> </jgroups> <threads /> <cache-container default-cache="dist" shutdown-hook="register"> <jmx duplicate-domains="true"/> <distributed-cache name="distcache" owners="2" mode="async" /> </cache-container> default-jgroups-tcp.xml located in src/main/resource/cache folder. contents of default-jgroups-tcp.xml copied pre-configured jgroups files provided infinispan-core.jar. when running infinispan see: info jgroupstransport - ispn000088: unable use jgroups configuration mechanisms provided in properties {stackfilepath-configurationfile=cache/default-jgroups-tcp.xml, stack-configurationfile=configurationfile}. using default jgroups configuration! ...

c++ - Direct3D9: after enabling mipmaps my texture coordinates seem to be wrong -

Image
i have texture contains symbols , characters use put strings , icons on final render target. produce string example, render every character single quad appropriate texture coordinates. my problem starts when try use mipmaps texture containing symbols. without mipmaps, works intended. after changing createtexture() call generate mip levels , adding d3dusage_autogenmipmap usage parameter, garbled output this: the texture created this: createtexture(width, height, 0, d3dusage_dynamic | d3dusage_autogenmipmap, d3dfmt_a8r8g8b8, d3dpool_default, &m_texture, nullptr); i use following texture filtering when rendering: setsamplerstate(0, d3dsamp_minfilter, d3dtexf_linear); setsamplerstate(0, d3dsamp_magfilter, d3dtexf_linear); setsamplerstate(0, d3dsamp_mipfilter, d3dtexf_linear); everything rendered still part of texture texture coordinates seem wrong somehow. tried debugging issue pix there render target looks intended. (i believe, pix uses software rendering while gpu...

c++ - Accessing the variables of a parent widget via a button -

i'm trying implement default button. button should access strings of parent widget dialog box button found on. pasted relevant parts of code below. want able place strings corresponding lineedit's when default values clicked. example pulse_string goes ui->pulse_freq , nr_pulsestring goes ui->nr_pulses etc. #include "settings.h" #include "ui_settings.h" #include <qlineedit> #include <qslider> #include <qspinbox> int pulse_freq = 25000; int nr_pulses = 10; int samp_freq = 150000; int nr_samples = 2000; int gain = 32; int accumulate = 1; int acq_start = 0; settings::settings(qwidget *parent) : qdialog(parent), ui(new ui::settings) { qstring pulse_string, nr_pulsestring, sampfreq_string, nr_samplestring, gain_string; qstring accumulate_string, acq_string; } settings::~settings() { delete ui; } void settings::on_default_values_clicked() { ui->pulse_freq->settext("25000"); ui->nr_p...

javascript - Making pie charts using d3.js? -

i using mysql , php backend. there example illustrate use of d3.js php , mysql. this how draw pie chart static data . can extract script in .js file , use dynamic data. <html> <head> <title> pie chart </title> <script type="text/javascript" src='d3.v3.min.js' charset='utf-8' ></script> </head> <body> <script type="text/javascript"> var metadata = { 'x' : 'name' , 'y' : 'percent' }; var data = [ {label : 'name1', value : 25}, {label : 'name2', value : 20}, {label : 'name3', value : 40}, {label : 'name4', value : 15} ]; var width = 1100 , height = 650 , radius = 250 , color = ["#c5aaf5","#fb7374","#a3cbf1","#79bfa1...

spring jms - Is it possible for DefaultMessageListenerContainer to create n number of JMS sessions each from a different JMS connections -

i have set defaultmessagelistenercontainer implementation of javax.jms.messagelistener wired it. i use mqqueueconnectionfactory wired cachingconnectionfactory. have set cacheconsumers true @ defaultmessagelistenercontainer , have set sessioncachesize equivalent number of concurrentconsumers. i see , when concurrentconsumers set 10 , ten jms sessions created single jms connection. there way create jms sessions 10 different jms connections? please advise. not when using caching connection factory, subclass of singleconnectionfactory ; use vendor connection factory directly if want separate connections. why want/need separate connections anyway? it not necessary use ccf listener container because sessions long-lived, and, in case, caching consumers can cause issues if use variable concurrency. see this answer more detailed explanation.

java - Unable to print the lines -

i using java program print line entered in text field using printer showing null pointer exception my code in public int print(graphics graphics,pageformat pf,int pageindex) method is public int print(graphics graphics,pageformat pf,pageindex pageindex) { if(pageindex>0) return no_such_page; string s=tf.gettext(); graphics2d g=(graphics2d)graphics; g.translate(pageindex.getimageablex(),pageindex.getimageabley()); g.drawstring(s,50,20); return page_exists; } my printer job method is // have implemented printable interface b.addactionlistener(new actionlistener() { public void actionperformed(actionevent ae) { printer pr=new printer(); //printer class name printerjob pj=printerjob.getprinterjob(); pj.setprintable(pr); if(pj.printdialog==true) { try { pj.print(); } catch(exception e) { system.out.print(e); } } } }); ...

c# - Chaining to clean up CompareTo -

every time need write compareto method in c#, hate fact can't chain tests , results in javascript: function int compareto(a, b) { return a.value1 - b.value1 || a.value2 - b.value2 || a.value3 - b.value3; } instead in c# looks like: int compareto(object obj) { var other = obj myclass; if (other == null) return 0; int result = value1 - other.value1; if (result != 0) return result; result = value2 - other.value2; if (result != 0) return result; return value3 - other.value3; } is there way write above 'cleaner'? doesn't have one-liner in javascript, should more readable , less error-prone. using generic extension method nullablecompareto can make use of ?? operator refactor compareto method to: int compareto(object obj) { var other = obj myclass; if (other == null) return 0; return value1.nullablecompareto(other.value1) ?? value2.nullablecompareto(other.value2) ...

Maple: command to simplify fraction -

why doesn't maple simplify fraction -sqrt(5)*(5+sqrt(5))/120 to (-1-sqrt(5))/24 ? are there commands this? a suitable command radnormal . ee:=-sqrt(5)*(5+sqrt(5))/120; 1 (1/2) / (1/2)\ ee := - --- 5 \5 + 5 / 120 radnormal( ee ); 1 1 (1/2) - -- - -- 5 24 24 there few others can form (at least particular example). expand( ee ); 1 1 (1/2) - -- - -- 5 24 24 evala(normal( ee )); 1 1 (1/2) - -- - -- 5 24 24 note distribution of factor 1/24 done here maple automatic simplification (and difficult disable or awkward avoid). notice how delayed evaluation ...

mysql - use multiple between clause for same column -

i want use multiple between clause same clause. i tried following query not working select id test (id between 11123745 , 11182111) , (id between 11182962 , 11182968) , (id between 11183172 , 11183176) my query returning nothing , how can make query work? it not physically possible meet conditions under circumstances. need use or.

java - Making 2D array not have a fixed number of indexes -

i have 2d array [[1, 0, 0], [2, 0, 0], [3, 4, 5,], [6, 7, 0], null, [0, 0, 0]] . i want turn dynamic array, meaning want [[1], [2], [3, 4, 5], [6, 7], null, []] . below code trying out. can't seem it. suggestions? public static int[][] getnonfixedarray(string string) { string[] split = string.split("\\|", -1); int[][] result = new int[split.length][3]; (int = 0; < split.length; i++) { int[] array = getnonfixedarray(split[i]); if (array != null) { (int j = 0; j < array.length; j++) { result[i][j] = array[j]; if (result[i][j] == 0) { result[i][j] = integer.parseint(" "); } } } else { result[i] = null; } } return result; } when go through inner arrays (the second loop), trying replace element value '0' integer.parseint(" "); . give exception anyway. might collect ...

string - JavaScript variables with " -

i programming jsp page button on click, sends variable javascript funcion. onclick="agregar('${c.id_question}','${d.text}');" the problem ${d.text} contains " character. , mixed html " , function not executed. what can do?

html - Delete data from table made with php echo? -

i have html table made php code, like: while($row = mysqli_fetch_array($sql)){ echo "<tr>\n"; echo "<td>".$row['name']; echo "<a href = "delete.php" "...>delete</a> " and want delete value link is; so.. know how delete data sql tables , stuff, question how store $row['name'] variable delete (with delete.php file). if intent delete row, fetch id not name: in loop: echo "<a href='delete.php?id=".$row['id']."'>delete</a>"; then in delete.php : <?php if(isset($_get['id'])) { $id = $_get['id']; $con = new mysqli('localhost', 'username', 'password', 'database_name'); $sql = 'delete table_name id = ?'; $delete = $con->prepare($sql); $delete->bind_param('i', $id); $delete->execute(); if($delete->affected_rows > 0) ...

c++ - Is my code creating a deep or shallow copy of my object? -

i have code takes stack made of external pointer , internal pointers linked lists, can't tell if it's making deep or shallow copy though. if don't have enough information i'm sorry, think need tell though. thank you! void stackclass::operator =(const stackclass& orig) { //stack = nullptr; node* temp = orig.stack; if (!orig.isempty()) { while (temp != null) { stack = orig.stack; // sets thew new stack equal old stack's value temp = temp->next; } // end while loop } // end if else { stack = nullptr; // sets empty list because there's no values } // end else } in case it's copying pointer i.e shallow copy in effect. deep copy means rather copying pointer explicitly allocate memory new pointer , store contents of passed in pointer code happens missing...

javascript - Changing the Color of a Cesium Geometry Instance in Dart -

i trying update color of cesium geometry instance. have code working in javascript when convert dart, no longer works. result when try change color black circle if translucent (in perinstancecolorappearance) set false, , nothing if translucent set true. believe has dart conversion unable determine problem is. this correctly working javascript code: var primitive; <script> document.getelementbyid("test").onclick = function() {myfunction()}; function myfunction() { var attributes = primitive.getgeometryinstanceattributes('circle'); attributes.color = cesium.colorgeometryinstanceattribute.tovalue(cesium.color.fromrandom({alpha : 1.0})); } </script> <script> var viewer = new cesium.viewer('cesiumcontainer'); var scene = viewer.scene; var circleinstance = new cesium.geometryinstance({ geometry : new cesium.circlegeometry({ center : cesium.cartesian3.fromdegrees(-95.0, 43.0)...

actionscript 3 - Making an animation follow a path in a appointed time -

i make image go through path. far have found tutorials teach how this. wish same image go through path in given time such 2 minutes. my intention make path image goes point b in 2 minutes , b c in 3 minutes. someone have indication / me? thanks in advanced, check out greensock tweenmax. https://greensock.com/tweenmax-as the thing you're looking called bezier (scroll down plugin explorer) after importing library can animate display object that: import com.greensock.*; import com.greensock.easing.*; tweenmax.to(mc, 2*60, {bezier:{autorotate:true, values:[{x:201, y:314}, {x:190, y:234}, {x:313, y:317}]}, ease:bounce.easeout});

multithreading - Java: Asynchronous concurrent writes to disk -

i have function in main thread write data disk. don't want main thread stuck (high latency of disk i/o) , creating new thread write overkill. have decided use executorservice . executorservice executorservice = executors.newfixedthreadpool(3); future future = executorservice.submit(new callable<boolean>() { public boolean call() throws exception { logger.log(level.info, "writing data disk"); return writetodisk(); } }); writetodisk function write disk is nice way do? refer better approach if any? update: data size greater 100 mb. disk bandwidth 40 mbps, write operation take couple of seconds. don't want calling function stuck has other jobs, so, looking way schedule disk i/o asynchronous execution of calling thread. i need delegate task , forget it! there 2 approaches aware of, spin thread (or use pool of threads have) or memory map file , let os manage it. both approaches, memory mapping file can as 10x faster ...

measurement protocol - Redirect of my web page what about tracking code in google analytics -

i have put tracking code of google analytics in website example.com so tracking code ga('create', 'ua-xxxxxxxxx', 'example.com'); after redirect website home.com so have change tracking code ga('create', 'ua-xxxxxxxxx', 'home.com'); my google analytics account refers ga('create', 'ua-xxxxxxxxx', 'auto'); what should put?

Questions about scala.concurrent.Blocking -

i believe following true. corrections , clarifications welcome: i/o bound tasks can tie threads , idle them extended periods of time. global threadpool has special provision detecting , handling specially marked code within future s block. code contained within blocking {} block within future backed forkjoin threadpool monitored idleness, , threads allocated necessary. enclosing code within blocking {} not executed future backed suitably configured forkjoin threadpool has no effect. blocking method has following signature: def blocking[t](body: &rarr; t): t blocking invocations seem designed aware of each other , co-operative, via 1 or more blockcontext references of no concern average scala programmer. questions it seem that f0 behave identically f1 , f2 when global executioncontext not backing these future s. alternatively, given code shows global in scope, f1 , f2 might behave differently because f1 might spin more threads when rpc1 , rpc2 bloc...

objective c - Getting error while creating PFAnonymousUser using Parse iOS SDK -

in ios application using parse sdk. i creating parse anonymous user using code [pfanonymousutils loginwithblock:^(pfuser *user, nserror *error) { if (error) { nslog(@"anonymous login failed."); } else { nslog(@"anonymous user logged in."); } }]; i able create anonymous user previously. getting error below in console. , not creating pfuser +[bftask taskfromexecutor:withblock:]: unrecognized selector sent class 0x3ee868 please me in issue. thanks in advance. i had same problem , solved follows: download latest facebook sdk , replace old frameworks in project. copy bolts.framework in frameworks folder (don't know why don't import in xcode project) compile & run , shouldn't have problem.

html - Why does adding a border on my picture will decrease it's size? -

are there ways add border onto image without decreasing size of image? <li class="profile-active"> <a href="profile"> <img src="http://placepic.me/profiles/80-80" width="40" height="40" class="img-circle"></a> </li> <style> .profile-acive{ border: 10px solid #5693f9; } </style> this css of circle // perfect circle .img-circle { border-radius: 50%; // set radius in percents } first of should set both border , border-radius on img element .img-circle { border-radius: 100%; border: 10px solid #5693f9; } this default should work fine, , border not cause picture descrease in size fiddle that being said, if somewhere in code have changed default value box-sizing border-box, like so: fiddle ...then you'll have manually override here on image box-sizing:content-box; make sure border not cause picture descrease in size. so: fiddle nb: ...

Like Pattern in SQL Server -

display details of stores, have bike in name.?? i able match substring using %bike% how match , retrieve data having bike anywhere in name ? i suspect problem query may default collation using. can use lower() : where lower(field_name) '%bike%'

javascript - Canvas line edges not smooth. How to fix this? -

Image
i searching radial progress bar. found in stackoverflow using canvas. circle not smooth edges. how fix blurry image. jsfiddle : http://jsfiddle.net/fd3k7prh/ image: it seems ok on screen. long don't scale canvas inside e.g. css should not blurred. please make sure whether have zoom enabled in browser (e.g. holding ctrl+mouse scroll) , browser displaying 100% image. as canvas displaying vector image, should not blurred in normal zoom. however, zooming in make blurry, because needs overscaled.

xcode - Remove println() for release version iOS Swift -

i globally ignore println() calls in swift code if not in debug build. can't find robust step step instructions , appreciate guidance. there way globally, or need surround every println() #if debug/#endif statements? the simplest way put own global function in front of swift's println : func println(object: any) { swift.println(object) } when it's time stop logging, comment out body of function: func println(object: any) { // swift.println(object) } or can make automatic using conditional: func println(object: any) { #if debug swift.println(object) #endif } edit in swift 2.0 println changed print . unfortunately has variadic first parameter; cool, means can't override because swift has no "splat" operator can't pass variadic in code (it can created literally). can make reduced version works if, case, printing 1 value: func print(items: any..., separator: string = " ", terminator: string = ...

How to apply bold for string in html format in iOS? -

i want print text in bold using string prints in compose mail app messagebody = [nsstring stringwithformat:@"<b>background information</b>"]; what use nsattributedstring. nsstring *boldfontname = [[uifont boldsystemfontofsize:12] fontname]; nsstring *yourstring = ...; nsrange boldedrange = nsmakerange(22, 4); nsmutableattributedstring *attrstring = [[nsmutableattributedstring alloc] initwithstring:yourstring]; [attrstring beginediting]; [attrstring addattribute:kctfontattributename value:boldfontname range:boldedrange]; [attrstring endediting]; //draw attrstring here... or use code not want bother fonts (as not every variation of font contains "bold"), here way this: nsmutableattributedstring *attrstring = [[nsmutableattributedstring alloc] initwithstring:"approximate distance: 120m away"]; [attrstring beginediting]; [attrstring applyfonttraits:nsboldfontmask ...

ios - How to create a "framework" group and move frameworks therein -

i have added bunch of frameworks app: selected project, clicked "build phases," clicked "link binary libraries," , "+" button add them project. they automatically added top level of hierarchy. i created "framework" folder, , moved them therein simple drag n' drop. then turned red. according following post, "the red text indicates actual files not @ path project has them." frameworks 'red' in xcode how adjust path, and/or correctly create "framework" group within project? if move framework files within xcode "yellow colored" groups, not update actual file location, should not break anything. see why there blue folders in xcode project? if move files outside of xcode, in finder, folder, xcode lose references , frameworks in case turn red.

How to kill a background process in linux -

i doing rpc connection between 2 computers. have started process ./server & in 1 computer (linux) , forgot kill. when try establish connection again, says rpc: port mapper failure - rpc: timed out. because old process still running in background. how kill it? first process id of job $ pgrep wget then kill it.. $ kill<pid>

Puppet array of hashes not being built properly -

hello trying build array of hashes following code: $stddirectoryvalue = { path => '/', options => ['indexes','followsymlinks',], index_options => ['fancyindexing', 'foldersfirst', 'namewidth=*', 'suppressdescription', 'suppresssize'], allow_override => ['none'], order => 'allow,deny', allow => 'from all' } # setting of website virtual hosts... apache::vhost { 'eds_tracker_test.eng.qpass.net': servername => 'eds_tracker_test.eng.qpass.net', port => '80', serveraliases => ['eds_tracker_test'], docroot => '/var/www/webapps/eds_tracker', error_log_file => 'logs/eds-tracker-error_log', directories => [ $stddirectoryvalue, index_ignore => ['faq', 'phpmyfaq-2.6.17'], ], } ...

javascript - about validate.js use function -

"data[researchcase][sender_mail]": { required: function() { return $("#customer_info").val() =="2"; }, email: function() { return $("#customer_info").val() =="2"; } } messages: { "data[researchcase][sender_mail]": { required: "must input mail", email:"not right email" } } when customer_info = 1. required validate not work,but email validate work。 try wirte email:function(){retrun false} or email:function(){retrun 0} also not work try delete required validate, email work. wrong? hoho, know why in validate.js email check not have parameters old code email: function(value, element) { return this.optional(element) || /^(((....)))\.?$/i.test(value); }, the new code email: function(value, element, param)...

ASP.NET MVC password validation with hash -

so want add custom hash password, got stuck because own validation my model: public class ms_user { [required(errormessage = "please input login email")] [datatype(datatype.emailaddress)] public object user_id { get; set; } [required(errormessage = "please input password")] // validation @ least 1 uppercase & 1 number, password lenght must greater 6 , lower 12, no special character [regularexpression(@"^(?=.*\d)(?=.*[a-z])[a-za-z0-9](.{6,12})$", errormessage = "error, wrong password format")] public object password { get; set; } } sample: password inputed : admin123 // pass validation hashedpassword output: l92vi3c2af7oftgy7jqyjkr8isyxef8pioqvmzjrn6rnrct6w6uudzv0yrcoudppxnc69gj2j4igxzwh1wrz9c19abn4uwksqx8d0txa+0ivxjavzoksaewpqm56gy/l:9kzqeh3nb9apjy81v/fvfu // after hashed password, my project pass password validation, on db.savechanges(); return error, because password validation is there solu...

r - building classification tree having categorical variables using rpart -

i have data set 14 features , few of them below, sex , marital status categorical variables. height,sex,maritalstatus,age,edu,hometype sex 1. male 2. female marital status 1. married 2. living together, not married 3. divorced or separated 4. widowed 5. single, never married now using rpart library r build classification tree using following rfit = rpart(hometype ~., data = trainingdata, method = "class", cp = 0.0001) this gives me decision tree not consider sex , marital status factors. i thinking of using as.factor : sex = as.factor(trainingdata$sex) ms = as.factor(trainingdata$maritalstatus) but not sure how pass information rpart. since data argument in rpart() takes in "trainingdata" data frame. take values in data frame. little new r , appreciate someone's on this. you make changes trainingdata data frame directly, run rpart() . trainingdata$sex = as.factor(tr...

vba - Macro doesn't work after 32367 lines in 2010 excel -

i have 90,000+ lines of data consolidate. code works fine 25k lines or so. when there more data, stops @ 32267 line , says object error. i have referred few of stackoverflow reviews on same model. answers in them didn't concern. my code sub macro_consolidator() dim spendsheet worksheet dim outputsheet worksheet dim long dim spendlastrow long dim outputlastrow long dim spendid string dim outputidrow variant dim ctsheet worksheet dim sh worksheet, flg boolean application.screenupdating = false set spendsheet = thisworkbook.sheets("sheet1") each sh in worksheets if sh.name "output" flg = true: exit next if flg = false dim ws worksheet set ws = thisworkbook.sheets.add(after:=thisworkbook.sheets(thisworkbook.sheets.count)) ws.name = "output" set outputsheet = thisworkbook.sheets("output") set spendsheet = thisworkbook.sheets("sheet1") spendlastrow = spendsheet.usedrange.rows.count outputlastrow = outputsheet.use...