Posts

Showing posts from 2013

javascript - Creating a pulldown on website using values from php variable? -

i creating form user can add more fields form if need them data. i using javascript function triggered action button creates row of textboxes , 1 pull down field. however in row need pull down options "yes , no", have them in php array variable called $success this have try , create pull down not working. ta[n]=document.createelement('option'); ta[n].value = <?php echo $success; ?>; ta[n].name='success'+n; could me out time :) this bulk of current code if(inp[c].value=='add') { inp[c].onclick=function() { ta[n]=document.createelement('input'); ta[n].setattribute('rows',1); ta[n].setattribute('cols',20); ta[n].name='time'+n; document.getelementbyid('txtara').appendchild(ta[n]) ta[n]=document.createelement('input'); ta[n].setattribute('rows',1); ta[n].setattribute(...

html - Drop Down Menu That Opens All Drop Downs at Once -

is there navigational drop down menu out there when hover on 1 item, every drop down comes down? know might bit busy, project essential. can use jquery, css or whatever, long works. if give of menus class can select them jquery. assuming display:none; other show/hide attribute work same way. issue when move mouse away 1 go away. $("#specialdropdown").live('mouseover',function(){ $('.dropdown').css('display', 'block'); }); $(".drowdown").live('mouseout', function(){ $('.dropdown').css('display','none'); }); the issue when move mouse away 1 go away. solve suggest having button shows them all. $("#specialdropdown").live('click', function(){ if($(this).hasclass('activebutton') { $(this).removeclass('activebutton'); $('.dropdown').css('display', 'none'...

vim - What is a vimrc function to determine if a buffer has been modified? -

i have tabline function stole/modified somewhere, filename have asterisk before if has been modified since last time written disk (ie if :up perform action). for example tabline when open vim -p file*.txt file1.txt file2.txt file3.txt then after change file1.txt , don't save it: *file1.txt file2.txt file3.txt my tabline function: if exists("+showtabline") function mytabline() let s = '' let t = tabpagenr() let = 1 while <= tabpagenr('$') let buflist = tabpagebuflist(i) let winnr = tabpagewinnr(i) let s .= ' %*' let s .= (i == t ? '%#tablinesel#' : '%#tabline#') let file = bufname(buflist[winnr - 1]) let file = fnamemodify(file, ':p:t') if file == '' let file = '[no name]' endif let s .= file let = + 1 endwhile let s .= '%t%#tablinefill#%=' ...

sql server - how can I test an MDX function? -

2 part question.. part 1 : these where clauses give me correct data: where { [time].[month].&[2011-06-01t00:00:00] } or { strtomember("[time].[month].&[2011-06-01t00:00:00]") } but returns nulls: where { strtomember("[time].[month].&[" + format(now(), "yyyy-mm-") + "01t00:00:00]") } i tried yyyymm format. trying use current month.. etc.. part 2 (more important) : how can verify format function returns? how can in mdx query analyzer: select format(now(), "yyyymm") i need execute function w/out selecting store.. there way test these functions? update figured out part 1 strtomember("[time].[month].&[" + format(now(), "yyyy-mm") + "-01t00:00:00]") it mm vs mm.. easy catch if able test output of function is.. using calculated measure: with member xx format(now(), "yyyy-mm") select xx on 0 [yourcubename]

c++ - gcc exception specification of default destructor -

class { public: virtual ~a() { } }; class b : virtual public { public: ~b() throw() {} }; class c : public b { }; int main(int argc, char * argv []) { return 0; } that code gives following error: error: looser throw specifier ‘virtual c::~c()’ error: overriding ‘virtual b::~b() throw ()’ on debian testing ( gcc (debian 4.6.0-10) 4.6.1 20110526 (prerelease) ) compiles without errors on previous gcc versions ( 4.5 on debian system again). how exception specification affect virtual destructor overriding? according answer compiler supposed create default constructor matching throw declaration of base class. not happens on new gcc. has changed, correct compiler behavior , there easy solution problem other manually adding empty destructors in derived classes ( compiler flag example). i presume in real code either ~a() or ~b() declared virtual? (the error message complaining virtual destructor, in code written none of destructors virtu...

php - Virtuemart - Tie in API function on checkout -

what trying once user checks out, buy's $25 worth of points; need send message api user made purchases worth $25 dollars. i found file, checkout.thankyou.tpl.php , confirmation message given after goes well. going tie in api function. my question how amount user purchased? page mentioned above, need access total amount user spent. stored in global variable? still accessible? appreciate ideas may have. on last step of checkout ps_checkout->add() called add shopping cart items database, same function sends notification email , clears cart session. is: use system plugin onafterinitialise looks option/task triggers last checkout step recalculate cart total $_session, need initialise virtuemart session, have @ virtuemart.php store result temporarily in different $_session variable same plugin, check loading of thank page , check variable in session. trigger api.

How can I get my Android Gallery to fit within my Relative Layout? -

i'm stuck on landscape layout. implementing gallery, , fit relative layout's height, , wrap content via width. tried scaletype centerinside, messing different types of layout_height/width. here's relevant part of xml looks (i apologize lack of formatting): <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:padding="10dip" android:orientation="vertical"> <relativelayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent"> <gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery" android:layout_width="wrap_content" android:layout_height="fill_parent" ...

hibernate - bidirectional many-to-many association using a Map instead of a Set -

i'm having bear of time , suggestions appreciated. i have bi-directional many-to-many association mapping between 2 entities (flashcard , tag) successfully represented java.util.set . i'd change collection type java.util.map . here's excerpt of working mappings using set <class name="flashcard" table="flashcard"> <id name="flashcardid" type="int" column="flashcard_id"> <meta attribute="scope-set">public</meta> <generator class="native" /> </id> <property name="question" type="string"> <meta attribute="use-in-tostring">true</meta> <column name="question" not-null="true" unique="true" /> </property> <set name="tags" table="flashcard_tag"> <meta attribute="field-description...

streaming - Stream with FFMpeg with a Decklink card on Windows -

i trying capture ffmpeg output decklink studio card on windows, how done? possible? sure. need use decklink sdk .

Connect to SQL Server database -

i'm trying connect sql server database @ discount asp.net hosting sql server management studio. here`s connection string working fine. parts of should use in management studio connect remote db? data source=tcp:sql2k803.discountasp.net;initial catalog=sql2008_709539; user id=sql2008_709539_user;password=password; i'm filling fields in following way: server name: tcp:sql2k803.discountasp.net login: sql2008_709539_user password: password authentication type sql server. database : sql2008_709539 login : sql2008_709539_user password : password host : sql2k803.discountasp.net please note also: some hosting companies denies access default may have request access ip address sometime unable connect using host name, used ip address connect via management studio (such problem appear due firewall, proxy, etc) added: see whether you've enabled remote tcp/ip connections

Any value in JavaScript/HTML Decoupling? if so how? -

lately i've been writing more , more javascript websites i've been creating. , can't think i'm doing wrong, or there has better way. i have clean separation of concerns on server side, on client side, find myself having entire sections of javascript dependent on specific element id's , class names, etc. example, on 1 page, has lot of form fields, may have section of code looks like: $(document).ready(function() { $("#buttonid1").button(); $("#grid").somegridfunction(); $(".data-fields").datepicker(); $(".submit-links").click(function() { this.closest("form").submit(); }); }); what i'd prefer way html elements request obtain functionality. like: <input type="text" data-make="datepicker" /> but flawed, because customization of require more , more attributes on html element detail specifics. had similar setup done knockoutjs , wasn't happy html requi...

c++ - Template error with dependent names -

in following code, compile error don't have if remove templates : template<int dim> class myclass { public : enum mode {aa,bb}; myclass(){}; }; template<int dim> class myclass2 { myclass2(){}; void myfunc(myclass::mode m); }; template<int dim> void myclass2<dim>::myfunc(myclass<dim>::mode m) { } test.cpp(19) : warning c4346: 'myclass::mode' : dependent name not type prefix 'typename' indicate type test.cpp(19) : error c2146: syntax error : missing ')' before identifier 'm' if remove like: template<int dim> void myclass2<dim>::myfunc(myclass::mode m) i : test.cpp(19) : error c2955: 'myclass' : use of class template requires template argument list and if put definition of myfunc directly in declaration of class (which avoid), works. what should , why happen? thanks i believe have 2 problems in code. first in declaration in mycla...

iphone - Core Data sectionNameKeyPath Custom String -

when sorting table of objects core data, i'd set custom string section heading includes attribute. example, i'd section name display "4 stars", instead of 4. i've fiddle it, seems grumpy if try set string sectionnamekeypath other entity attribute , entity attribute. here's works attribute only, , 1 of few attempts customize string breaks commented out. nssortdescriptor *ratingdescriptor = [[nssortdescriptor alloc] initwithkey:@"starrating" ascending:no]; sortdescriptors = [nsarray arraywithobjects:ratingdescriptor, namedescriptor, nil]; [ratingdescriptor release], ratingdescriptor = nil; // nsstring *starsectionheading = [nsstring stringwithformat:@"%d stars", @"starrating"]; // sectionkeypath = starsectionheading; sectionkeypath = @"starrating"; set sectionnamekeypath "starrating" modify output in table view. frc sort things , tidy things in sections have change display header s...

Best way to encrypt/decrypt a file uploaded via PHP for this purpose? -

i'm in process of prototyping file upload system service needs basic form of encryption files uploaded users. of files uploaded uploaded same directory in users can download , upload files freely, authorized users able delete files uploads. with in mind, need know best way encrypt these files (via crypt() or similar) storage in non-public-accessible directory purpose. considered using base 64 encode functions built php this, seemed if able write php script on server base 64 decrypt files stored on server, thereby rendering encryption protection useless. in summary, need know best way implement (i.e. functions or classes use) meets following criteria: the function needs reversible in way users logged in via php's $_session variables can decrypt files encrypted. encryption needs affect file types, whether images, text, binaries, documents, , decrypting files must yield file identical file encrypted (i.e. header intact). i may worried more necessary, make easy u...

Apache access logs for django app with mod-wsgi -

i try serve django application apache-mod_wsgi in local computer os windows 7. i have placed django.wsgi file proper place , change httpd.conf such wsgiscriptalias / c:\djangoprojects\tryserver\apache\django.wsgi . however, when try reach http://127.0.0.1 , encountered you don't have permission access / on server. message. i have looked @ access.log , have found these 2 lines 127.0.0.1 - - [30/jun/2011:22:36:50 +0300] "get / http/1.1" 403 202 127.0.0.1 - - [30/jun/2011:22:37:50 +0300] "\x16\x03" 302 222 what meaning of these logs , how can resolve them ? thanks adding these lines httpd.conf resolved problem. <directory c:/djangoprojects/tryserver/apache> order deny,allow allow </directory>

php - Print all logged-in users in SESSION? -

i have session supports 80 users, want print usernames , refresh page every 60 seconds or so. know how refresh page <?php print_r($_session['username']); ?> printing username associated personal session. unfortunately sessions variables don't work that. for track each session, 1 method log each login/connection mysql table time stamp attached it. then on tracking page, have delete inactive users, select rest: ie mysql_query("delete sessions time < " . time() - 60); $result = mysql_query("select * sessions"); while ($row = mysql_fetch_assoc($result)) { echo $row['username'] . "<br />"; } then toss in <meta http-equiv="refresh" content="60"> refresh page ever minute.

javascript - Regex to return single attribute from string -

using javascript, can please me pattern match in string: div style="display: none" key="abc\jones" displaytext="tom jones" my goal extract value key, in case: abc\jones so, between key=" and " thanks help!! something like: / key="([^"]*)"/ should match the tailing " completeness matches key="..." , not key="... as how working, normal characters them selves, [^"] defines match group of characters not " ( ^ being not ). match after key=" until collides " . ( ) capture matched values later recall.

c# - Detecting KeyStrokes -

hi considering adding functionality app allows user highlight piece of text on given page pdf or browser or word or not. right keystroke send down application running in bottom right hand corner has text box. i wondering (seeing placement student , not yet graduated) how hard , need research? thanks time. assuming windows, take @ win32 api. here's example: http://www.c-sharpcorner.com/uploadfile/shrijeetnair/win32api12062005005528am/win32api.aspx

xaml - For WPF, Is it overkill to use a setter to set the itemtemplate property? -

when searched internet find out how set itemtemplate listbox, found example used style setter in window.resources this. so, have couple of options, can either create datatemplate in window.resources, or, create style setter. overkill set style instead of datatemplate? method should use? thank you. you can't 1 or other better, depends. implicit datatemplates nice way globally (even if part of visual tree) how type should look. while using itemtemplate allows indicate how should in given itemscontrol (i.e. listbox, combobox, etc.). you can use combination of both of them, allows have "default" look, customize per control or control type. even itemtemplate, can set globally listboxes, or 1 listbox instance. again, 1 method better, not. depends on trying do.

jquery - javascript - set var equal to data returned from a function -

var ipaddress="unknown"; $.getjson('http://jsonip.appspot.com/?callback=?', function(data){ ipaddress=data.ip;}); document.getelementbyid('callbackform').elements["callback_form.ipaddress"].value = ipaddress; this javascript code sets var ipaddress equal 'unknown', executes jquery function sets value of ipaddress user's ip. attempt set form element equal value of ipaddress. this not working. form element being set 'unknown'. i'm not sure if scoping problem? advice appreciated. what's happening callback executing asynchronously. $.getjson call tells browser "go off , data url; when it's ready, call function i've provided". function doesn't execute right away. you can either move more logic callback (i.e. inline ipaddress var , assign form element in callback), or switch more full-featured jquery.ajax method , pass async:false in option set. of course, in cases you'll ...

java - Stanford cs106a - Breakout exersize -

i'm trying learn java following cs106a course online. i've arrived @ breakout exersize , i'm having trouble bugs i haven't finished want solves these issues first before go further. problem 1: when ball collides bricks don't seem removed canvas. brick removed on second time collides. there 1 row (of yellow bricks) doesn't respond @ ball collisions. problem 2: my paddle can moved dragging mouse. problem is. bricks can moved paddle. i know has piece of code gobj = getelementat(lastx, lasty); if remove altogether bricks aren't moveable anymore. good. i'm still able move paddle no matter click , drag. can give me hint can correct mistakes? here's code below. thanks /* * file: breakout.java * ------------------- * file implement game of breakout. */ import acm.graphics.*; import acm.program.*; import acm.util.*; import java.applet.*; import java.awt.*; import java.awt.event.*; import org.omg.corba.public_member; pub...

Read php file with content-type xml -

i have php file set header header ("content-type: text/xml"); . when try read file simplexml_load_file() returns `false. if set extension xml, file read correctly. i use php 5.1.6. version > 5.3 works fine. bug in version 5.1.6. problem? thanks try file , load string: $str = file_get_contents($file); $xml = simplexml_load_string($str);

Resource Not Found Exception in pyglet -

i'm using python 2.6.6 , pyglet 1.1.4. in "erosion" folder, have "erosion.py" , folder named "images." inside images, there .png images. 1 image named "guard.png." in "erosion.py" there segment goes so: pyglet.resource.path = ['images'] pyglet.resource.reindex() self.image = pyglet.resource.image('%s%s' % (character, '.png')) when run this, given file "c:\python26\lib\site-packages\pyglet\resource.py", line 394, in file raise resourcenotfoundexception(name) resourcenotfoundexception: resource "guard.png" not found on path. ensure filename has correct captialisation. i have tried changing path ['./images'] , ['../images']. i've tried removing path , reindex call , putting erosion.py , guard.png in same folder. this able load resources: pyglet.resource.path = ['c:\\users\\myname\\downloads\\temp'] pyglet.resource.reindex() pic = pyglet...

google app engine - Using images uploaded to the blobstore using Django-nonrel and file-transfer application -

Image
i building blog site in google app engine, using django-nonrel , need way store , display images in blog posts etc. the idea have upload application upload images specific articles etc, , use absolute or relative url imd src. i using django-filetransfers upload images ( http://www.allbuttonspressed.com/projects/django-filetransfers ). questions are: 1) using google app engine , django-nonrel host blog? if how , storing images? using gae blobstore use overkill? 2) image url using download path set in flie-transfers application. eg. correct? seems bit weird not reference using .png extension or anything. might way reference images blobstore? still learning rope django , google app engine appreciated. thanks can, i have had similar experience in using blobstore django-nonrel. for first question, blobstore not overkill , think in fact way can upload image without updating whole project , republishing it. gae not let write directory because of server's hig...

c++ - read objects from file -

i have code: #include <fstream> #include <iostream> using namespace std; class student { public: char fullname[40]; char completeaddress[120]; char gender; double age; bool livesinasingleparenthome; }; int main() { student one; strcpy(one.fullname, "ernestine waller"); strcpy(one.completeaddress, "824 larson drv, silver spring, md 20910"); one.gender = 'f'; one.age = 16.50; one.livesinasingleparenthome = true; ofstream ofs("fifthgrade.ros", ios::binary); ofs.write((char *)&one, sizeof(one)); student three; strcpy(three.fullname, "three waller"); strcpy(three.completeaddress, "three 824 larson drv, silver spring, md 20910"); three.gender = 'm'; three.age = 17; three.livesinasingleparenthome = true; //ofstream ofs("fifthgrade.ros", ios::binary); ofs.write((char *)&three, sizeof(three));*/ ...

c# - What is the difference between zlib's gzip compression and the compression used by .NET's GZipStream? -

having odd problem - 1 of app suites has read/write gzip-compressed files used on both windows , linux, , finding files generate using zlib on linux 2-3 times larger generate using gzipstream on windows. read on either platform, know compression correct regardless of platform created file. thing is, files transferred across network @ various times, , file size concern. my question is: has else encountered this is there documented difference between two? know gzipstream not provide way specify compression level can zlib, using maximum compression on zlib side. shouldn't see relatively same file size, assuming gzipstream written use maximum compression well? and answer .... linux version never compressing data begin with. took lot of debugging find bug caused it, after correcting it, sizes comparable on both platforms.

c# - ConfigureAutomapper to map contents of collection-property, but use destination collection object -

i have class class { public a() { collectionprop = new list<b>(); } public icollection<b> collectionprop {get; private set;} } lets want map -> a, cloning mechanism, dont want automapper attempt create collectionprop, should use collectionprop exists in destination object (created constructor), clone 'b' objects new instance of a. how do this.. far have: mapper.createmap<a, a>() .formember(dest => dest.collectionprop, opt => opt.mapfrom(e => e.collectionprop)); which appears use collectionprop newly created object, not filling elements. what missing? thanks this 1 worked me mapper.createmap<a, a>() .convertusing((s) => { var d = new a(); d.collectionprop.addrange(s.collectionprop); return d; }); ok. 1 clones bs mapper.createmap<b,b>(); mapper.createmap<a, a>() ...

ios - Objective C: UITableView Scrolling becomes Laggy -

Image
i have uitableview becomes laggy when during scrolling. code snippet follows: in "cell setupcell" have few customized items added cell contentview 1 x uiimageview 3 x uilabels 3 x buttons (subclass of uicontrol) my initial testing seems point buttons causing lag. have checks in button class i not sure cause lag these checks seemed simple , basic operations. has advise on causes such lags? edit: add more code i want add scrolling smooth when first started app, became laggy , slow after scrolled table , down multiple times. code follows: if (cell == nil) { cell = [[[customcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:placeholdercellidentifier] autorelease]; //add button uicustombutton *likebutton = [[uicustombutton alloc]init]; likebutton.tag = 7; //add comment button uicustombutton *commentbutton = [[uicustombutton alloc]init]; commentbutton.tag = 8; //add answer button uicustombutton *ans...

Web Services in C and C++ -

i want host web services in existing c/c++ application. best solution? i solution similar jax-ws java. revolving around soap requests. any personal experience available solutions? as far understand popular free solution gsoap http://gsoap2.sourceforge.net/

asp.net - Ontext Changed event not firing for TextBox -

i have textbox beside have search button. on click of search button, pops page user selects value , value automatically populated in textbox beside search button. now, based on value automatically populated in textbox, there other dynamic controls populated on page. i using textbox.textchanged event , calling method populates other dynamic controls. however, ontextbox_changed event firing when press tab key or enter key textbox want fire once text populated. below aspx <asp:textbox id="txtgl1" runat="server" text="" autopostback="true" enabled="true" enableviewstate="true" ontextchanged="txtgl1_textchanged"> </asp:textbox> protected void txtglaccount_textchanged(object sender, eventargs e) { createcontrols(); } text change event works only. the textchanged event raised when content of text box changes between posts server. more details on msdn . if want on type need...

c# - How can an ObservableCollection fire a Replace action? -

in documentation of event args of notifycollectionchangedeventargs, there action called replace (in addition add, remove, move, etc.). when can fired? can't see replace method in observablecollection here example: observablecollection<string> mycollection = new observablecollection<string>; mycollection.add("one"); mycollection.add("two"); mycollection.add("three"); mycollection.add("four"); mycollection.add("five"); mycollection[4] = "six"; // replace (i.e. set)

cin - why does this C++ code print a after every line? -

#include <iostream> using namespace std; int main() { (;;) { char ch ; if (cin.fail()) break; cin.read((char*)&ch, sizeof(unsigned char)); cout<<hex<<(unsigned int)(unsigned char)ch<<endl; cin.clear(); } } why code print a after every line? used char standard input. added : trying read unformatted input read . the a see hex value of '\n' character @ end of line of input. if don't want see character, wrap output line in if statement checks character , doesn't bother output when it's seen: if (ch != '\n') { cout<<hex<<(unsigned int)(unsigned char)ch<<endl; }

php - Finding and changing the value of a single "href" value using Simple Html DOM Library -

i need in parsing href attribute of single anchore tag , changing value in php file using "simple html dom" library. below html code:- <li id="toggle"> <a id="open" class="open" href="#" style="display: block; "></a></li> now want specific href value , change page say, logout.php depending upon if user logged in or not. , here php code: <?php include 'simple_html_dom.php'; session_start(); $html = new simple_html_dom(); $html->load_file('index1.php'); if(!isset($_session['username'])){ $ret = $html->find('li[id=hello]'); $ret = "hello guest"; $tog = $html->find('li[id=toggle]'); $tog = "log in | register"; }else{ $user = $_session['username']; $ret = "hello " . $user; $tog = "log out"; $hrf = $html->fi...

windows phone 7 - Whats going on with this byte array? -

i have byte array: 00 01 00 00 00 12 81 00 00 01 00 c8 00 00 00 00 00 08 5c 9f 4f a5 09 45 d4 ce it read via streamreader using utf8 encoding // note can't change code, many component dependent on it. using (streamreader streamreader = new streamreader(responsestream, encoding.utf8, false)) { string streamdata = streamreader.readtoend(); if (requestdata.callback != null) { requestdata.callback(response, streamdata); } } when function runs following returned me (i converted byte array) 00 01 00 00 00 12 ef bf bd 00 00 01 00 ef bf bd 00 00 00 00 00 08 5c ef bf bd 4f ef bf bd 09 45 ef bf bd somehow need take whats returned me , right encoding , right byte array, i've tried alot. please aware, i'm working wp7 limited api. hopefully guys can help. thanks! update help... if following code, it's right, thing wrong 5th last byte gets split out. byte[] writebuf1 = system.text.encoding.utf8.getbytes(data); ...

iphone - Xcode 4 crashes when we run a project at the same time on two machines with Git -

Image
we have 2 developers working on same project. project integrated git. when 1 developer working on project , other developer tries run project, xcode 4 crashes shown. what wrong , how rectify it? thanks! i think has happened project.pbxproj file has gone merge conflict stuff embedded in it. open in text editor , lines like: >>>>>>> if see that, means need clean file. there's no way git doing across systems while both developers working, issue checked in... another issue if project file changed developer, , pulls changes project open, have re-open project see of targets meant used in project. have not seen cause crash though.

ycsb - Why does MongoDB perform better with multi-threaded client compared to a single threaded client? -

we benchmarked oracle 10g , mongodb ycsb ( https://github.com/brianfrankcooper/ycsb/wiki ), when tried increase number of threads 1,000,000 datasets, oracle's performance remained constant after 4 threads mongodb kept on performing better , better till 8 threads , after reads better, writes , updates (operations/sec) remained constant. we ran benchmark on 2 cpu xeon quad core (total 8 cores) + 8 gb ram on lan. what observed mongodb performed better multi-threaded client comparing single-threaded client, question is: when mongodb can perform better more load why can't same less load (say couple of threads) utilizing multiple cores? it logically simple process request on single core. have code receives request, , deals it. it not simple process single request on 2 cores, because doing requires break request components, farm out work, synchronize answers, , build single response. , if work, while can reduce wallclock time (how time clock on wall sees pass), ...

function - Out of the two sql queries below , suggest which one is better one. Single query with join or two simple queries? -

assuming result of first query in a) (envelopecontrolnumber,partnerid,docfileid) = (000000400, 31,35) a) select envelopecontrolnumber, partnerid, docfileid envelopeheader envelopeid ='lt01env1107010000050'; select count(*) envelopeheader envelopecontrolnumber = '000000400' , partnerid= 31 , docfileid<>35 ; or b) select count(*) envelopeheader join envelopeheader b on a.envelopecontrolnumber = b.envelopecontrolnumber , a.partnerid= b.partnerid , a.envelopeid = 'lt01env1107010000050' , b.docfileid <> a.docfileid; i using above query in sql function. tried queries in pgadmin(postgres), shows 16ms a) , b). when tried queries b) separately on pgadmin. still shows 16 ms separately each 1 - making 32ms b) - wrong because when run both queries in 1 go b), shows 16 ms. please suggest 1 better. using postgres database. the time displayed includes time...

ant - How to use .project to build ear with ANT4Eclipse? -

i using ant4eclipse build ear package. can please let me know how proceed it. <ear destfile="${deploy}/pto-web-ear.ear"> <ant4eclipse:jdtprojectfileset workspacedirectory="/data/temp/ant/psfbuild" projectname="pto-web-ear"/> </ear> i using above thing. but leads me following error: /data/temp/ant/psfbuild/pto-web-ear/ant4eclipsebuild.xml:59: org.ant4eclipse.lib.core.exception.ant4eclipseexception: precondition has been violated: hasrole(projectroleclass) on project 'pto-web-ear'has true role 'interface org.ant4eclipse.lib.jdt.model.project.javaprojectrole'! @ org.ant4eclipse.lib.core.assure.asserttrue(assure.java:264) @ org.ant4eclipse.lib.platform.internal.model.resource.eclipseprojectimpl.getrole(eclipseprojectimpl.java:424) @ org.ant4eclipse.ant.jdt.jdtprojectfileset.docomputefileset(jdtprojectfileset.java:193) @ org.ant4e...

ios - UITableView custom accessory button image disappears when tapped -

i have uitableview custom accessory button created this: in cellforrowatindexpath method following: ... uibutton *myaccessorybutton =[[[uibutton alloc] init] autorelease]; myaccessorybutton =[self makeaccessorybutton: @"arrow2.png"]; [cell setaccessoryview:myaccessorybutton]; return cell; and function makeaccessorybutton defined follows: - (uibutton *) makeaccessorybutton: (nsstring *) imagename { uibutton *myaccessorybutton = [[uibutton buttonwithtype:uibuttontypecustom] autorelease]; cgrect frame = cgrectmake(0, 0, 24, 24); myaccessorybutton.frame = frame; [myaccessorybutton setbackgroundcolor:[uicolor clearcolor]]; [myaccessorybutton setimage:[uiimage imagenamed:imagename] forstate: uicontrolstatenormal]; [myaccessorybutton addtarget: self action: @selector(accessorybuttontapped:withevent:) forcontrolevents: uicontroleventtouchupinside]; //myaccessorybutton.userinteractionenabled = yes; return ( myaccessorybutton ...

order - SQL Server Result Set Paging -

what best way retrieve huge result set small window of results? i have read previous questions on topic, this one , this one , this one , of them seem address problem using row_number() , which, mentioned, may have impacts on performance. there other, good-perfomant way achieve same result without using either row_count() or primary key ranges (which it's not option)?

c++ - Can ofstream be used for printing on a printer -

can ofstream used write on printer? eg: string nameofprinter = "xyz"; ofstream onprinter(nameofprinter); onprinter << "printing.... "; if above output printer (on paper) ? if not, why won't output? please suggest way print using printer. i targeting windows platform (32bit) if happen have printer associated lpt1 , printer support formfeeds. #include <iostream> #include <fstream> using namespace std; int main () { ofstream printer ("lpt1"); if(!printer) { return 1; } printer.puts("test test test\n"); printer.putc('\f'); printer.close(); return 0; } lpt1 file name in windows. known reserved filename. not possible have more 1 file name lpt1. , file managed windows. see reserved filenames

How do I access an JSON array with boost::property_tree? -

{ "menu": { "foo": true, "bar": "true", "value": 102.3e+06, "popup": [ {"value": "new", "onclick": "createnewdoc()"}, {"value": "open", "onclick": "opendoc()"}, ] } } how can value of onclick? iterate through children of menu.popup node , extract onclick values: void print_onclick_values(const ptree& node) { boost_foreach(const ptree::value_type& child, node.get_child("menu.popup")) { std::cout << "onclick: " << child.second.get<std::string>("onclick") << "\n"; } } the function prints: onclick: createnewdoc() onclick: opendoc() n.b. delete trailing comma example: {"value": "open...

c - Avoiding Memory Allocation related errors -

i have complex c code me , while executing it, chanced upon following errors: glibc: corrupted double-linked list glibc: malloc() memory corruption munmap_chunk() invalid pointer i realized 1) associated freeing freed memory. still trying figure out reasons 2) , 3). well, thing did searches , got general opinion must debug "valgrind" detect memory corruption related problems. ok, coming point,when searched forum, have dug code posted at: what best way free memory after returning error? and piece of code had solved problems: int func(void **mem1, void **mem2) { *mem1 = null; *mem2 = null; *mem1 = malloc(size); if(!*mem1) goto err; *mem2 = malloc(size); if(!*mem2) goto err; return 0; err: if(*mem1) free(*mem1); if(*mem2) free(*mem2); *mem1 = *mem2 = null; return 1; } well solved issue line: eg: char *ptr = null; ptr = (char *)malloc(size); assign , use ptr free(ptr); ...

c# - How do I get a DataGrid Cell to stop the user entering an incorrect value? -

i have followed article how to: implement validation datagrid control though not prevent user leaving cell, wish leave cell focussed. consider cell bound integer value, trying enter alpha character not allow focus removed cell. my grid follows: <datagrid headersvisibility="column" autogeneratecolumns="false" canuseraddrows="false" canuserdeleterows="false" canuserresizerows="false" itemssource="{binding selectedlines}"> <datagrid.rowvalidationrules> <exceptionvalidationrule /> </datagrid.rowvalidationrules> <datagrid.columns> <datagridtextcolumn isreadonly="true" header="name" binding="{binding name}"/> <datagridtextcolumn isreadonly="false" header="qty" binding="{binding quantity, validatesonexceptions=true}...

ruby on rails - Ancestry gem: return only last child in threads -

the ancestry gem has lot of methods navigate tree structure. can model.roots show root elements etc. how opposite? - return newest child each tree structure. i thought adding column model (latest/boolean) , logic after save filters etc. feels bit clumsy. :/ best regards. asbjørn morell maybe can hack class#inherited hook, updating attribute of parent model on creation of new subclass: http://www.ruby-doc.org/core/classes/class.html#m000177

When should I define my Android app as not movable to SD card (installLocation=internalOnly)? -

in cases should forbid users move app sd card (by setting installlocation internalonly )? i'm asking know few apps, please don't ask app. want know in general app. the requirements quite described in documentation . primarily, if you're running in background must execute @ times, service, or if provide widgets, can run external storage. user unmount external storage, process in these things run terminated.

agile - git log since yesterday for working days only -

for daily standups output commits refresher of working on. i have following alias: standup = log --graph --pretty=format:'%cred%h%creset -%c(yellow)%d%creset %s %cgreen(%cr) %c(green)<%an>%creset' --abbrev-commit --date=relative --committer='me' --all --since='yesterday' however not work monday morning due weekend. does know how use git log --since set of working days such mon - fri, or tue - sat? assuming posix-y shell, in case bash: function yesterworkday() { if [[ "1" == "$(date +%u)" ]] echo "last friday" else echo "yesterday" fi } git log --since="$(yesterworkday)" again credits go authors of git making insanely easy by accepting "last friday" valid date specification begin with! ps . make git alias, need include bash shell in alias, i'll edit sample in minute edit putting logic directly git alias proves difficult (with...

c# - How to select with omitting a specific child using XPath? -

i have following html: <div id="main-body"> <div id="answerform"> // ... few children here want <form id=mwanser"> </form> </div> </div> i want in main-body, except in form tag... (and don't want form tag too).... i tried xpath lot didn't succeed. i'm working c# , htmlagilitypack, maybe there's way navigate child , delete instead? first option me must xpath too. with xpath if select node obtain node , every descendant in it. can select children directly unwanted node. taking sample test , can write: "/*/*/*[not(self::form)]"

backbone.js save with coffeescript -

i have following method on backbone view defined in coffeescript: saveobservation: => self = @ observation = new observation(parentuid: _questionuid, status: "n/a", text: "change element") observation.save { success: -> alert('test') error: -> alert('failed') } observation extended backbone.model class observation extends backbone.model url: -> "/auditactiontracking/" the save reaches server neither success nor error handlers have defined in save getting called after ajax call has completed. can see doing wrong? backbone.model.save takes 2 parameters , first list of properties you're changing, , second callback configuration. so, if you're not changing other properties during save, can pass empty object: observation.save {}, success: (model, response) -> alert('test') error: (model, response) -...

c++ - std::basic_string specialization -

i need override length function std::basic_string because it's not correct custom char type on specific platform. current declaration for, let's say, customstring typedef stl::basic_string<customchar, stl::char_traits<customchar>, stl::allocator<customchar> > customstring; i need have class behaves customstring, length function changed. you need specialise std::char_traits structure , override static size_t length(const char_type* s); function that. then don’t need specify template parameters when instantiating basic_string . following definition should enough: typedef std::basic_string<customchar> customstring;

How to use java annotations to modify source code before final compilation? -

i've read apt tool page 1 can create annotationprocessors generate new derived files (source files, class files, deployment descriptors, etc.) . looking example so. my need encode annotated strings @ compile time, reading class file not allow reading static strings: base code: string message = (@obfuscated "a string should not readable in class file"); should reworked as: string message = new obfuscatedstring(new long[] {0x86dd4dbb5166c13dl, 0x4c79b1cdc313ae09l, 0x1a353051daf6463bl}).tostring(); based on static obfuscatedstring.obfuscate(string) method of truelicense framework , processor can generate code replace annotated string. indeed, method generates string "new obfuscatedstring([numeric_code]).tostring()". @ runtime tostring() method of obfuscatedstring able return string encoded in numeric code. any idea on how write process() method of annotationprocessor edit annotated code? thanks in advance, you have string message = o...

objective c - Core Data: How to merge inserts/updates/deletes between two NSManagedObjectContext's while maintaining the merge as an undoable step? -

i have document-based core data application (running on mac os x 10.5 , above) i'm trying use 2 nsmanagedobjectcontext 's on main thread. i'd merge changes made in secondary context main (primary) context. in addition, want changes merged in secondary context undoable , cause document marked "dirty". guess question similar " undoing core data insertions performed off main thread " but, atm, i'm not using different threads. i've been observing nsmanagedobjectcontextdidsavenotification (which gets sent second context when calling -[self.secondarycontext save:] ) this: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(mocdidsave:) name:nsmanagedobjectcontextdidsavenotification object:self.secondarycontext]; in -mocdidsave: method called observer tried use -[nsmanagedobjectcontext mergech...

jquery - jscript ui steps calculation and logic problems -

i'm trying create vps style slider selector using jquery ui i'm not able find correct "max" , "step" numbers, need 6 steps, starting 0, have used: range: "min", min: 0, max: 6, step: 1, value: 0, but not working have expected. selector cursor working odd when click on it, know is max , step value because using example did find max:576 , step 56.8 working fine have rule in ui docs min-max value have divisible step value. thanks in advance! well, dont know, if correctly understand you. if jast want slider snap increments , value between 0 , 6 should so: $('your-slider-selector').slider({ value:0, min: 0, max: 6, step: 1}); and thats all!

user interface - Relocating ".fig" files when creating a GUI using Matlab GUIDE -

Image
i've developed gui build scripts, , in process of deploying it. script deployed number of different machines @ various points, need use standard format of directories team use. the gui consists of ".fig" file contains visual definition of ui, , m-script defines functionality. need locate these 2 in "fig/" , "m/" folders respectively, can't figure out how to. first searched include statement of kind in m-script, when run on own, error message in command window states ".fig" file can't found, there doesn't seem reference ".fig" file anywhere, assume it's inferred both files have same name different extension. i fear matlab's gui system requires both ".m" , ".fig" files in same location, inelegant solution i'd rather not go if can avoid it. the next thing i'm going try call script copies fig file other directory same location m-script, when executed, deletes copy once script exi...

api - WP7's background agent - how to run longer & how to communicate with? -

i'm trying implement socket listener in windows phone 7.1, should process incoming data , make actions based on (constantly, without interrupting). far i've found this , info described there confused lot, these questions: is there ability background agent run constantly, without interrupting system (or acceptable amount of running time, more 10 minutes)? is there api communicate running agent, android's aidl ? ps. cannot use push notifications. no, background agents cannot run constantly. if need code execute should keep app running, maybe enable running under lock screen if appropriate. no, cannot connect agent. agents not services.

c# - how do i disable Caching in Entity Framework from Config file -

i running problems huge objects occupy memory , reference not being released. used .net memory profiler find out root object , references entity framework class. is there way can disable caching of queried objects in entity framework without chanign code? in config file may be? you should have using statements dispose objectcontext. ef keeps object graph of queried objects. think use objectcontext.detach(entity); detach entities objectcontext.

c - Why does fgets return a bad string? -

i don't know how else put it, know i'm doing wrong. char *temp2= "/shares/mjim"; char ourlist[1024]; fgets(ourlist, 1024, modified) sprintf(sysstring, "grep -c %s %s", ourlist, temp2); now fgets job, when try form string sprintf grep -c lanuncher.ini , rest missing. here kicker, if reverse order this: sprintf(sysstring, "grep -c %s %s", temp2, ourlist); the result want, , invalid search grep: grep -c /shares/mjim lanucher.ini also if this: sprintf(sysstring, "grep -c %s %s", temp2, temp2); it creates expected string ( grep -c /shares/mjim /shares/mjim ). know going on? well input simple text file single column list: launcher.ini bits.exe etc.... the garbage in case unusually short string mentioned. when print out ourlist has returns launcher.ini. fgets includes trailing '\n' . want remove before building sysstring ... fgets(ourlist, sizeof ourlist, modified); size_t ourlistlen = strlen(ourlis...