Posts

Showing posts from February, 2014

how to copy files from once location to another without using shutil in python -

i tried shutil python debugger throwing error..can know why this?? , there other way?? path = "c:\\program files (x86)" if os.path.exists(path): src= "c:\\program files (x86)\\abc\\xyz\\quicktest\\scripts\\routertester900\\diagnostic\\routertester900systemtest" else: src= "c:\\program files\\abc\\xyz\\quicktest\\scripts\\routertester900\\diagnostic\\routertester900systemtest" dest = "c:\\sanity_automation\\" shutil.copy(src,dest) update: getting error : traceback (most recent call last): file "c:\sanity_automation\work_project\copy.py", line 15, in <module> shutil.copy(src, dest) file "c:\sanity_automation\python272\lib\shutil.py", line 116, in copy copyfile(src, dst) file "c:\sanity_automation\python272\lib\shutil.py", line 81, in copyfile open(src, 'rb') fsrc: ioerror: [errno 13] permission denied: 'c:\\program files (x86)\\agilent\\n2x\\quicktest\\scripts\\

C# Tetris game slow performance -

i'm programming tetris clone c# school project. using microsoft visual studio 2012. game implemented 2 dimensional array of blocks(list of lists of blocks) , every block has own texture (bmp image). drawing whole array onto picturebox control , problem starts. when updating image on picturebox (moving/rotating active shape) game lags. tried draw on panel control instead result same. have rough idea might cause lag don't know how rid of it. this draw method of game "grid": public void draw(graphics g) { brush brush; font font = new system.drawing.font( "arial", 5); (int = 0; < width; i++) (int j = 0; j < height; j++) { brush = new texturebrush(blocks[i][j].texture); if (blocks[i][j].occupied==true) g.fillrectangle(brush, * 20, j * 20, * 20 + blocks[i][j].texture.width, j * 20 + blocks[i][j].texture.height); } } this draw method of active tetromino: public void draw(graphics g) { b

forms - JavaScript - Incrementing a value attribute -

i have problem can't head around (pretty new javascript). need know how increment variables in html document.createelement event (if that's right terminology). i need increment 'value' attribute every time "add row" button clicked , vise versa "delete row" button. so far have: html <div id='ctrl_container'> <form action='$thisuri' method='post' id='spa' name='date2'> <input type="button" value="add row" onclick="addrow('datatable')" /> <input type="button" value="delete row" onclick="deleterow('datatable')" /> <table id="datatable" border='0' cellspacing='0' cellpadding='0' > <tr> <th> select </th> <th> id </th> <th> question </th> </tr> <tbody> <

c# - Generic class accepts primitive type and string -

how create generic type accepts type of integer, long , string. i know can restrict type single class or implementing interface below code public class mygenericclass<t> t:integer{ } or handle int,long not string public class mygenericclass<t> t:struct is possible create generic accepts type of integer, long , string? you potentially not have constraints in class declaration, type-checking in static constructor: public class mygenericclass<t> { static mygenericclass() // called once each type of t { if(typeof(t) != typeof(string) && typeof(t) != typeof(int) && typeof(t) != typeof(long)) throw new exception("invalid type specified"); } // eo ctor } // eo class mygenericclass<t> edit: as matthew watson points out above, real answer "you can't , shouldn't". if interviewer believes that incorrect, don't want work there anyway ;)

vba - Rendering simple html code in Powerpoint text box -

i have string of html code , want display in powerpoint text box formatted per html code using vba. any suggestion on how that? i inserted spaces in code below make visible code: < div> < font face=arial color=black>&nbsp;</font><font face=arial size=2 color=black><strong>heading < /strong>< /font>< /div> < div> & nbsp;< /div> < div>< font face=arial size=2 color=black>text sample< /font>< /div>

xml - XPath to select nodes with certain name or attribute value -

i want remove footer section html source. consider following cases, <div id="footer">blabla</div> or <div class="footer">blabla</div> or <footer>blablabla</footer> how can match above cases using xpath? i come this: //*[contains(lower-case(@*),'footer')] | //footer

ms office - Get the ChartSpace from a ChartReference -

i try modify powerpoint slide, contains 2 charts. goal find chart , modify data. i got graphicframe contains chart, , got relative id of chartspace element want modify. how actucal chartspace element? public void test() { //// getting slidepart var slidepart = prespart.getpartbyid(relid) slidepart; //// getting shape contains damned chart var graphicframe = getgraphicframefromslide(slidepart, ppchart, ppslide); //// chartreference drawcharts.chartreference child = graphicframe.graphic.graphicdata.getfirstchild<drawcharts.chartreference>(); var chartid = child.id; //// returns extendedsomething, no chart reference :( var chartdata = presdoc.getpartbyid(chartid) ; } christian, if still looking answer: able find 1 question. think may useful too. refer post " finding graph part within rich text control openxml sdk ". good luck!

jquery - Jqgrid scroll issue with bindkeys -

i'm using jqgrid 4.4.1 the issue when grid has more data (more page) vertical scroll bar displays, , when scroll down , select last record grid scrolls , selected record goes down(below screen viewport) couldnt see selected record. $("#mygrid").jqgrid('bindkeys'); if remove scrollingrows not scrolling down when press down key select bottom records (so need true). $("#mygrid").jqgrid('bindkeys', {'scrollingrows':false}); help me on have bindkeys feature without record selection issue in grid. i found fix issue latest version of jqgrid(v 4.5.0). in version 4.4.1 line 2516: .append($('<div style="'+(ismsie && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this)) in version 4.5.0 line 2731: .append($('<div style="position:relative;'+(ismsie && $.jgrid.msieve

linux - Bash: Get pid of a process using a different user -

i have script in bash start java program , want pid of program after executes. pid saved in text file. right have this: if [ "$user" == "root" ] su $app_user -c "nohup java $java_opts >> $log_out 2>> $log_err &" su $app_user -c "echo $! > $pid_path/$cat.pid" else nohup java $java_opts >> $log_out 2>> $log_err & echo $! > "$pid_path/$cat.pid" fi i tried doesn't work neither. if [ "$user" == "root" ] su $app_user -c "(nohup java $java_opts >> $log_out 2>> $log_err &); (echo $! > $pid_path/$cat.pid)" else nohup java $java_opts >> $log_out 2>> $log_err & echo $! > "$pid_path/$cat.pid" fi when run app_user works great, when run root java program starts pid file created empty. try su $app_user -c "nohup java $java_opts >> $log_out 2>> $log_err & ech

c# - State machines everywhere? -

after learning state machines, want place in every class of code. that's great pleasure me declaratively (or "fluently") construct machine, handle events , sure logic violation throw exception. can please critisize me on practice? or, may be, install stateless package habitually each project (like do)? any examples of state machines overusing? whilst design-patterns practice, should cutting code solve particular problem potentially use design-pattern solve problem in tried-and-tested manner. we not write code "let's use design-pattern" perspective because single design-pattern not one-size fits solution! do not write code around state machine idiom. make many simple tasks over-complicated , difficult maintain.

c# - How can I extract a list of Tuple from a specific table with Entity Framework / LINQ? -

i need extract list of couple 'id'/'name' large table in c# .net entity framework. i try request : list<tuple<int, string>> list = (from res in db.resource select new tuple<int, string>(res.resource_id, res.name)).tolist(); but unfortunately i've got error : only parameterless constructors , initializers supported in linq entities. i don't undestand how can extract list of tuple framework , feel bit lost error. can me understand , resolve problem ? best regards, alex you can middle-step selecting anonymous type: db.resource.select(x => new { x.resource_id, x.name }).asenumerable().select(x => tuple.create(x.resource_id, x.name)).tolist(); creating tuple not supported operation in linq entities, have select anonymous type, equivalent to: select [resource].[resource_id], [resource].[name] then move linq objects asenumerable , tuple.

rabbitmq - Should I use AMQP RPC or AMQP + REST -

i idea of setting service such rabbitmq handle larger jobs , have n workers scale , process requests. question lies in if should handle 'quick' actions user performs in ui, such saving small changes in form, through queue. when read amqp rpc sounds work kind of task, smart thing such use case? making more complicated should , should use rest + amqp depending on task? there's alternative message queueing more lightweight amqp (rabbitmq) because of brokerless architecture - zeromq. works ipc in mind can use interaction of ui , controller. performance issues must investigated further though.

html - Opening question mark only shown on some linux environment -

i'm developing html page , it's in spanish, need use "¿" (opening question mark) , have on linux environment. i'm editing html docs on windows while using virtualbox ubuntu server deploy it. problem when use vm, question mark shown, while when try on actual linux os isn't. on header have: < meta http-equiv="content-type" content="text/html; charset=utf-8"> and on body have: < p class="question">¿cuántos grupos diferentes de < code>< var>num_taken< /var>< /code> < var>thing< /var> puede llevar en su bolso?< /p> i thought utf-8 solved problem, idea? thanks! how escaping "special char" html representation. in case: &iquest; according utf-8 problem: did save file utf-8 encoded. special characters destroyed if save files wrong encoding.

javascript - jQuery - hide elements after specific text -

i want hide elements after specific text / last word of first div <div class="top">here text</div> <table class="middle"> ... </table> <div class="bottom">...</div> hide table(middle) , div(bottom) depending on word "text" first div try http://jsfiddle.net/enqym/1/ txtword = $('.top').text().split('text')[1] if(txtword){ alert("div show"); }else{ alert("div hide"); }

java - Thread Runnable - stop and resume -

hello i'm new in android(java), , have problem use of thread i define e new thread timed (every 5 seconds) inside class of android project. "mcontinuethread" variable used cicle every 5 seconds r = new runnable() { public void run() { while (mcontinuethread) { try { thread.sleep(millisec_before_reload); mhandler.sendemptymessage(get_tracking); } catch (exception e) { } } } }; t = new thread(r); in class there method starttrack() starts thread public void starttrack() { mcontinuethread=true; if (!mthreadisstarted) { mthreadisstarted=true; t.start(); } else { } } and there method logout stop thread, using "mcontinuethread" variable: public void logout() { //stop thread mcontinuethread=false; .... } if in class logout() method executed thread stopped, if starttrack() method ca

java - Issue with JAXB XMLAdapter marshalling -

i have requirement generate xml file below format using jaxb2 , has both fixed , variable xml content. what constraint? the content of variable xml part should 1 of 5 different xml schema ( planned have jaxb2.0 implemented 5 different java classes generate it) need embedded in fixed xml content. xml format: <user_info> <header> //fixed xml part <msg_id>..</msg_id> <type>...</type> </header> <user_type> // variable xml content // (usertype : admin, reviewer, auditer, enduser, reporter) ........ </user_type> </user_info> what tried ? i have created jaxb annotated java classes above xml metadata . variable xml part, used common parent class ( baseusertype ) extended 5 different classes <user_type> . , tried override marshall(..) operation using @xmljavatypeadapter . (as below) jaxb annotated class: @xmlrootelement(name="user_info") p

python - How does Flask knows which decorated function to call? -

so i'm going through basic flask tutorial, , looking @ code there's snippet: @app.teardown_appcontext def close_db_connection(exception): """closes database again @ end of request.""" top = _app_ctx_stack.top if hasattr(top, 'sqlite_db'): top.sqlite_db.close() now, i've read in manual, function "app.teardown_appcontext" called whenever 1 of callbacks has unexpected behavior. decorating function allows add functionality original function. or @ least that's understand decorators. but, if this: @app.teardown_appcontext def stack_overflow_rocks(exception): """closes database again @ end of request.""" top = _app_ctx_stack.top if hasattr(top, 'sqlite_db'): top.sqlite_db.close() it still works. how flask manages this? my guess when run "flaskr.py" file main code, associates whatever decorated function code call when necessary.

php - Load->view a file based on SQL field -

i'm trying load file (a website header) depending on preference set user, stored in mysql db field. this code loads header when placed on page: <?php $this->load->view('header');?> users have option select/deselect header in preferences. show header term 'show' saved cell in database , 'hide' hide. i have been working code: <?php if(($boarddetails->showheader)):show ?> <?php $this->load->view('header');?> <?php endif ?> where 'showheader' database field name , 'show' content within it. keep getting errors conflicting php code in same file: unexpected end etc. when trim them make viewable header loaded regardless of content of users field. 'show' , 'hide' both display header. does have simpler way of selecting option working current code? your should try this: <?php if(($boarddetails->showheader)=="show"){ $this-&

Error "Comparison method violates its general contract!" when installing any Eclipse plugin -

( i've read this question , answer doesn't solve problem, don't mark 1 duplicate ) i have fresh installation of eclipse ( eclipse php developers / helios release / build id: 20100617-1415 on windows 7 x86 ) can't install plugin or addition. neither official plugins repository, nor user-provided urls. installation, of tiny plugins takes "years" (starting @ 10-20 minutes, ending on over hour) though i'm on quite fast internet connection (around 2 mb/s), strange itself. , ends same error message: an error occurred while collecting items installed session context was:(profile=epp.package.php, phase=org.eclipse.equinox.internal.p2.engine.phases.collect, operand=, action=). comparison method violates general contract! comparison method violates general contract! error message same, mentioning epp.package.php , no matter, plugin i'm trying install. assume, eclipse-related, not plugin-related problem. i did reasearch on stackexchange (many simila

php - Return PDO data -

hi guys have program built using mysql_* , trying convert pdo security , depreciative reasons so have load of mysql_* functions setup like return select_from_where('users', '*', "username = '$username' , password = '$pass'", "limit 1"); which have converted pdo return $conn -> query("select * users username = '$username' , password = '$pass' limit 1"); however program not feed right result, i'm not sure if returning data my question is, have set pdo response variable can use, or possible have return values can use in program using similar method above? i have included global $conn each function query i'm sure connecting should, not feeding result intended.. does have quick fix issue program done , pending release :d thanks in advance luke ** edit line * $sql = ("select * users username = '$username' , password = '$pass' limit 1"); $stm = $con

pyramid - dynamicly fill table using zpt and ajax as update -

i'm creating webproject in pyramid i'd update table every few secondes. decided use ajax, i'm stuck on something. on client side i'm using following code: function update() { var variable = 'variable '; $.ajax({ type: "post", url: "/diagnose_voorstel_get_data/${dosierid}", datatype: "text", data: variable , success: function (msg) { alert(json.stringify(msg)); }, error: function(){ alert(msg + 'error'); } }); } pyramid side: @view_config(route_name='diagnose_voorstel_get_data', xhr=true, renderer='string') def diagnose_voorstel_get_data(request): dosierid = request.matchdict['dosierid'] dosieridsplit = dosierid.split diagnoses = dbsession.query(diagnose).filter(and_(diagnose.code_arg == str(dosieridsplit[0]), diagnose.year_r

Bootstrap and wysihtml5 updating textarea -

i'm using : wysihtml5 bootstrap-wysihtml5.js i have textarea called booking_cancellationcomments_cancellationpolicy , making wysihtml5 textarea using code: $('#booking_cancellationcomments_cancellationpolicy').wysihtml5(options); i'm trying update later using: $('#booking_cancellationcomments_cancellationpolicy').val(data.booking.cancellationcomments.cancellationpolicy); but textarea isn't updating. i've looked @ lots of answers on stack overflow , not show how update textarea using initialisation method i've used. any appreciated. try this: $('#booking_cancellationcomments_cancellationpolicy').data("wysihtml5").editor.setvalue(data.booking.cancellationcomments.cancellationpolicy);

d3.js - Trying to import data from CSV file in D3.I am getting an error as "Unexpected End of Input" -

trying import data csv file in d3.i getting error "unexpected end of input". d3.csv("path/to/instance.csv", function (error, data) { data.foreach(function (d) { d.state = parsedate(d.state); d.success = +d.success; }); edit: adding csv file. date,price jan 2000,1394.46 feb 2000,1366.42 mar 2000,1498.58 apr 2000,1452.43 may 2000,1420.6 jun 2000,1454.6 jul 2000,1430.83 aug 2000,1517.68 sep 2000,1436.51 oct 2000,1429.4 nov 2000,1314.95 perhaps lack of 2nd decimal place?

c# 4.0 - Select Items in Listbox -

i have 2 listboxes , corresponding data stored in sql server. able load data of listbox1 sql server. not able populate corresponding data of selected item listbox 2 listbox 1. when click on items in listbox 1 no data displayed in listbox2. private void form2_load(object sender, eventargs e) { sqlconnection cs = new sqlconnection(@"data source=.\sqlexpress;initial catalog=details;user id=sa;password=p@ssw0rd"); sqlcommand cmd = new sqlcommand(); cmd.connection = cs; cmd.commandtype = commandtype.text; cmd.commandtext = "select memo new"; dataset objds = new dataset(); sqldataadapter da = new sqldataadapter(); da.selectcommand = cmd; // cs.open(); da.fill(objds); //cs.close(); listmemo.valuemember = "memo"; listmemo.displaymember = "memo"; listmemo.datasource = objds.tables[0]; } private void

events - What does this line of C# code actually do? -

i'm trying understand block of code in application i've come across bit of c# don't understand. in code below, code after "controller.progress +=" line do? i've not seen syntax before , don't know constructs called, can't google find out syntax means or does. instance, values s , p? placeholders? private void backgroundworker_dowork(object sender, doworkeventargs e) { using (var controller = new applicationdevicecontroller(e.argument simpledevicemodel)) { controller.progress += (s, p) => { (sender backgroundworker).reportprogress(p.percent); }; string html = controller.getandconvertlog(); e.result = html; } } it looks it's attaching function event, don't understand syntax (or s , p are) , there's no useful intellsense on code. it's lambda expression being assigned event handler. s , p variables passed function. you're defining nameless function, receives 2 p

Powershell - Syntax error - pasting string from a function into "-Filter" -

here code: try build filter string in function , in , get-adobject command, syntax error position 1 function build-filter ([string]$searchname) { $searchname = '"' + $searchname + '"' $searchname = "{name -like " + $searchname + "}" return [string]$searchname } $searchname = "user1" $filter = build-filter $searchname get-adobject -filter $filter this error message, unfortunatelly in german get-adobject : fehler beim analysieren der abfrage: "{name -like "user1"}" fehlermeldung: "syntax error" folgender position: "1". in zeile:12 zeichen:1 + get-adobject -filter $filter + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : parsererror: (:) [get-adobject], adfilterparsingexception + fullyqualifiederrorid : activedirectorycmdlet:microsoft.activedirectory.management.adfilterparsingex ception,microsoft.activedirectory.management.commands.getadobject

c# - A number validation issue. .5 is not a number but 0.5 is? -

this model gets validated. public class estimateitem { public string itemname { get; set; } public string displayname { get; set; } public string description { get; set; } public string notes { get; set; } [datatype(datatype.currency)] //[displayformat(applyformatineditmode = true, dataformatstring = "{0:n2}")] public decimal perunitcost { get; set; } public string perunitdescription { get; set; } [displayformat(applyformatineditmode = true, dataformatstring = "{0:n0}")] [min(1, errormessage = "cannot zero")] public int units { get; set; } public string unitsdescription { get; set; } public bool isenabled { get; set; } public bool isbasedonhomesquarefootage { get; set; } [datatype(datatype.currency)] //[displayformat(applyformatineditmode = true, dataformatstring = "{0:c2}")] public decimal cost { get; set; } public list<estimateitemoption> options { get; s

java - resizing an image without compromising the aspect ratio -

i use following codes resize image problem don't maintain original aspect ratio, there way can resize image without compromising aspect ratio. bufferedimage img1 = new bufferedimage(800, 600, bufferedimage.type_int_rgb); img1.creategraphics() .drawimage( imageio.read( new file("/home/rvkydmpo/webapps/root/images/profilepicture/" + filename)).getscaledinstance(800, 600, image.scale_smooth), 0, 0, null); imageio.write(img1, "jpg", new file("/home/rvkydmpo/webapps/root/images/profilepicture/" +filename)); you might want read the docs of getscaledinstance() : image java.awt.image.getscaledinstance(int width, int height, int hints) creates scaled version of image. new image object returned render image @ specified width , heig

python - File I/O has caused a "[Conflict]" -

i wrote small program supposed run continuously analyzing data. let run in background on computer. couple of times now, have come computer notice program had stopped running. eventually, noticed in same directory .csv file use store data in ("data.csv"), there named file "data[conflict].csv", suspect has program mysteriously crashing. i tried googling "python '[conflict]'" in addition several other similar phrases, have been unable find regarding this. in code did attempt read or write file name, know functionality must somewhere part of python's standard libraries. unfortunately, in order debug error, sort of need know might produce sort of output. (alternatively, stare @ program hours on end waiting crash see if revealing occurs, have better things time.) idea might causing behavior? for it's worth, without going details of data i'm analyzing, "data.csv": when program starts, open data buffer, verify integrity (

.net - Invoking C++/CLI code from C# -

i have pretty stupid problem: apparently knowledge of .net platform , how c# , c++/cli communicate low, maybe it's don't know lifehacks or need-to-knows of msvs. i want call c++/cli code c# (an algorithm written native c++ , want wrap it). c++/cli compiles, add reference c++/cli project c# console app project. still doesn`t see it. i've been digging dumb problem half day now. please, help! and if know theory material cover such gaps in understanding, i'd sincerely - appreciate it. i've read hogenson , used c++/cli glue @ work, have had problems understanding how linker works. that's solution structure - 1 test.hxx: #pragma once #pragma managed namespace test { class test { public: static int run(); }; } test.cxx: #pragma unmanaged #include <iostream> #pragma managed #using <system.dll> #include "test.hxx" namespace test { int test::run() { return 42; } } program.cs: using system

java - How can I use put method to insert data to my MySQL databse using restful webservice -

Image
i use this tutorrial , created table (id ,username) prints; , want insert data using restful web service what should put in content text box ? this paints class /* * change template, choose tools | templates * , open template in editor. */ package entities; import java.io.serializable; import javax.persistence.basic; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.id; import javax.persistence.namedqueries; import javax.persistence.namedquery; import javax.persistence.table; import javax.validation.constraints.notnull; import javax.validation.constraints.size; import javax.xml.bind.annotation.xmlrootelement; /** * * @author subhi */ @entity @table(name = "prints") @xmlrootelement(name = "prints") @namedqueries({ @namedquery(name = "prints.findall", query = "select p prints p"), @namedquery(name = "prints.findbyid", query = "select p prints p p.i

php - Twig Sprintf Gettext -

my question refers twig extension: https://github.com/deceze/twig-extensions/blob/master/doc/gettext.rst if use example: <p>{{ _n('one day without accident.', '%d days without accident.', n)|format(n) }}</p> so how can parse variables twig? i mean %d in example it first time need use sprintf. the %d stands number. format filter replace these parameters given filter. placeholders (usually %s or %d ) replaced correspondending parameters. first placeholder value form first argument , second second argument ect. for more information, see php reference: http://php.net/sprintf

Checking the Internet Connection iOS App -

in splash screen subscribe uiapplicationdidbecomeactivenotification. - (void)viewdidload { [super viewdidload]; // register notifications [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(checkinternetconnection:) name:uiapplicationdidbecomeactivenotification object:nil]; } -(void) checkinternetconnection:(nsnotification *) notification { internetstatus = [[reachability reachabilityforinternetconnection] currentreachabilitystatus]; if(internetstatus == notreachable) { [apphelper showalert:@"error" message:@"error downloading data. please check network connection , try again." cancelbuttontitle:nil otherbuttontitles:@[@"ok"]]; return; } [self viewdidappear:yes]; } - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; if(!(internetstatus == notreachable)) { appdelegate *applicationdelegate = (appdelegate*)[[uiapplication sharedapplicat

jquery - How can I export a JavaScript-modified stylesheet? -

i'm working on web app i'm making customisable possible. app has customisation page consists of toolbar , iframe linking dummy preview file. modifications made using toolbar reflected within iframe user able see they're changing. example, there font size input field can used adjust preview page's font-size . it works this: <input type="number" id="txtfontsize" value="16" /> $('#sidebar').on('input', '#txtfontsize', function() { var previewframe = window.frames['preview'].document, $body = $('body', previewframe) ; $body.css({fontsize:25}) }); at bottom of toolbar there save button. i'm needing export javascript-modified stylesheet can store changes particular user. method used saving irrelevant @ point; question this: how can export default stylesheet along javascript-modified styles? before asks: format can simple string if easiest. otherwise ther

build - Classes from C++ Primer going into Cyclic Dependency -

i following book - c++ primer learning c++. i'm in middle of chapter introducing classes, , i'm stuck in resolving header files include of 2 classes taken example there. here 2 classes, , header files: screencls.h: #ifndef screencls_h #define screencls_h #include <iostream> #include "windowmanager.h" using namespace std; class screencls { friend void windowmanager::clear(screenindex); public: typedef string::size_type pos; screencls() { } screencls(pos height, pos width, char c): height(height), width(width), contents(height * width, c) { } screencls &set(char); screencls &set(pos, pos, char); char get() const { return contents[cursor]; } // implicitly inline private: pos cursor; pos height; pos width; string contents; }; #endif // screencls_h screencls.cpp: #include "screencls.h" char screencls::get(pos r, pos c) const { pos row = r * width; return contents[row + c];

How to change the way PHP writes errors in the error log file? -

i have been working on website on year now, , anxious put out there people use. has gotten quite large - want out of control - , on top of self taught amateur programmer. so want sure, errors php produces logged in file, can access file , track errors down. currently settings following: <?php error_reporting(e_all); ini_set('display_errors', '0'); ini_set('log_errors', 1); ini_set('error_log', 'errors.log'); ?> works pretty far, error.log file contain stuff this: [14-may-2013 00:16:26] php notice: undefined variable: nonexistentvariable in /home/www/dir/index.php on line 14[14-may-2013 00:16:28] php notice: undefined variable: nonexistentvariable in /home/www/dir/index.php on line 14 great, errors logged. but have problem: they in 1 line, no breaks. makes hard read. how each error in new line? i see there timestamp. awesome! how can add things user's ip address, or other custom things? again, questions: ho

jQuery UI modal dialog background doesn't darken bottom of page background when scrollbars are present -

i have jquery ui modal dialog on http://www.citizenshipworks.org/ appears when click on go button right of 'enter mobile number receive text alerts'. (you may leave text input field blank). the issue if viewport has scrollbars , aren't @ top of page, background darkens portion visible if @ top of page. seems happen on browsers. in advance! just set css position fixed .ui-widget-overlay : .ui-widget-overlay{position:fixed}

hosting - How can I access MAMP Pro sites through Adobe Edge Inspect without using my IP address? -

Image
when develop website typically use edge inspect in parallel computer's browser testing. every website, create new host in mamp pro, , create new directory on computer point mamp pro , put website files in. way, go http://test.example/ , can access developing site. the problem comes in adobe edge inspect cannot access locally created hosts. have found if point localhost , in mamp pro, directory of site working on, can use computer's ip address have results mirrored on mobile device. biggest problem have make database changes (magento, wordpress, etc.) every time ip address changes (which can happen due moving laptop around , connecting internet in variety of ways). using localhost (my computer's ip) eliminates 1 of benefits of mamp pro. the way (based off of andy howells suggestion over here ) use alias in mamp pro go test.example.[my.ip.address]. xip.io . after must change url opening phpmyadmin mamp pro , changing url values site (again, typically magento, or wor

json load is not correct (python) -

this question has answer here: what 'u' symbol mean in front of string values? [duplicate] 2 answers when save json ok in file , when load loaded object not correct. file=open("hello", "w") a={'name':'jason', 'age':73, 'grade':{ 'computers':97, 'physics':95, 'math':89} } json.dump(a, file) as said in file it's ok when load can see problem. file: " {"age": 73, "grade": {"computers": 97, "physics": 95, "math": 89}, "name": "jason"} " now load: b=json.load(file) print b output: {u"age": 73, u"grade": {u"computers": 97, u"physics": 95, u"math": 89}, u"name": u"jason"} you can notice before every string there u .

java - Unknown character / word -

sentences : test skills 1, ... 2, ... 3, .... specify skills 1, ..2, ...3, .... check skills 1, ..2, ...3, .... .. restofsentence="your skills"+ ? ; string test = "test" + restofsentence string specify = "specify" + restofsentence string check = "check" + restofsentence how can define restofsentence variable, "?" must define number 'test = "test skills 6" ', 'test = "test skills 36" ' must pair without using loop because dont know last number you can use string.format() method that. string format = "%1$s skill %2$d"; string test = string.format(format, "test", 4);

javascript - How to connect jquery tooltip with asp.net textbox -

this question has answer here: qtip2 jquery asp.net textbox 2 answers i tried connect jquery plugin tooltip asp.net textbox, failure result. here code: <script type="text/javascript" src="../chosen/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="../chosen/jquery.qtip-1.0.0-rc3.js"></script> <script> $(function () { //shorthand $(document).ready(function(){...}); $('textbox').qtip({ content: 'short hand notation' }) }); </script> <asp:textbox cssclass="textbox" id="textbox" name="textbox" runat="server"/> error: qtip not function there can show me how connect elegant jquery tooltip plugin standard textbox asp.net? regards you can try out: for safer s

sql server - How can I enforce this relationship? (Formerley: Is there a name for this type of database structure?) -

update 05/15/2013 understanding of problem has changed such "title" doesn't match anymore. should close , start new post? (what proper way handle edit in stackoverflow community?). with following basic table structure, how can enforce relationship user can member of group , if user , group both related same tenant ? entities: tenants : id name user id fktenantid name groups id fktenantid name usersingroup fkuserid fkgroupid for example: i add 2 tenants : id: name 1: tenanta 2: tenantb i add 1 group each tenant : id: tenantid: name 1: 1: groupa 2: 2: groupb i add 1 user tenanta having id of 1: id: tenantid: username 1: 1: usera how can restrict can not add usera groupb. if create table usersingroups columns fkuserid, fkgroupid, can't think of way constrain record 1:2 considered invalid. thanks! steve with further research found post answers mine. composite foreign key multiple relate

Making a static lib target with variable dependencies with CMake -

so have static library can have bunch of settings turned on, depending on compiling configuration. have these settings pushed out import file: cmake_minimum_required (version 2.8) message(status "***making foo***") add_definitions(-dfoo) include_directories("$env{foo_root}/includes") link_directories("$env{foo_root}/libraries") called with cmake_minimum_required (version 2.8) project(a) if (foo) import(cmakelist.foo.txt) add_library(a static a.cpp) because library static, appears have populate these settings other project in chain exports them...is there way library own linking other static libraries, or way around make library shared? edit: should add i'm building part of subdirs project

performance - WPF editable combobox slow typing -

i have wpf combobox : <combobox x:name="customercombobox" iseditable="true" itemssource="{binding relations.view}" displaymemberpath="model.sname" /> if click in editable combo while binding in place (mvvm) give focus, , press , hold key, assume combo filled key rather quickly, isn't. if remove displaymemberpath , same, have expected behavior. of course need binding. the performance penalty shows when combo has lot of elements mine has 6000. i cannot understand performance penalty coming from. there way bypass problem ? below code solves issues creating specialised combobox caches binding results. created looking @ orginal source code of combobox , itemscontrol using .net reflector. using system; using system.collections.generic; using system.linq; using system.text; using system.windows; using system.windows.controls; using system.windows.data; using system.windows.documents; using system.windows.i

xml - ACORD standard to define a custom node? -

i have been working acord xml standard while success. have requirement gather piece of data custom company. (acord doesn’t have place it.) for example, if have following xml: <insurancesvcrq> <rquid> 00000000-0000-0000-0000-000000000000</rquid> <commlpkgpolicyaddrq> <rquid> 00000000-0000-0000-0000-000000000000</rquid> <itemidinfo> <systemid> 00000000-0000-0000-0000-000000000000</systemid> </itemidinfo> <transactionrequestdt>2013-05-13t00:00:00-04:00</transactionrequestdt> <curcd>usd</curcd> <broadlobcd>c</broadlobcd> <insuredorprincipal> <itemidinfo> <systemid> 00000000-0000-0000-0000-000000000000</systemid> </itemidinfo> <generalpartyinfo> <nameinfo> <commlname /> <taxidentity> <stateprovcd>oh</stateprovcd> </taxidentity> </n

awt - java use methods automatically? -

in oracle site found class load image. tried run things don't understand how methods paint , getpreferredsize launched without been call. this class: loadimageapp can kindly explain it? those methods override methods in base class. the awt base classes call methods arrange , render ui

c# - How to resize PDF Document to fit a Bitmap -

Image
( using pdf sharp ) i have few bitmaps , each bitmap create new pdf page. problem pdf page not have enough height contain entire bitmap, i'm losing portion of bitmap. what best way resize pdf page entire bitmap fit 1 pdf page? public static pdfdocument getpdf(list<bitmap> pages, bool makefit = false) { using (var doc = new pdfdocument()) { (byte = 0; < pages.count(); i++) { pdfpage opage = new pdfpage(); doc.pages.add(opage); using (var xgr = xgraphics.frompdfpage(opage)) { using (var bm = pages[i]) { using (var img = ximage.fromgdiplusimage(bm)) { xgr.drawimage(img, 0, 0); } } } } return doc; } } i did try set size @ location xgr.drawimage(

ios - Jenkins - Xcode build works codesign fails -

below build script (not using xcodebuild plugin). build step works have created separate keychain required certs , private keys, , visible in keychain access keychain commands don't fail in script security list-keychains shows these valid keychains it's acting unlock command doesn't succeed. when try run codesign command line via codesign -f -s "iphone developer: mycert" -v sample.app/ --keychain /users/shared/jenkins/library/keychains/jenkinsci.keychain i cssm_signdata returned: 000186ad sample.app/: unknown error -2070=fffffffffffff7ea although i'm not sure i'm emulating command line since can @ best sudo -u jenkins bash xcodebuild only_active_arch="no" code_sign_identity="" code_signing_required="no" -scheme "myschemename" configuration_build_dir="`pwd`" security list-keychains -s /users/shared/jenkins/library/keychains/jenkinsci.keychain + security default-keychain -d user -s