Posts

Showing posts from January, 2014

Is it possible to create a custom table component in Adobe CQ5 where some of the cells (like the headers) are fixed? -

is possible create custom table component in of cells (i.e. header cells) fixed user has input data structured table? instance, want put same table on multiple pages have same header cells body cells under each heading populated varying content. each page have table product there header cell titled "description", header cell titled "price", , header cell titled "number sold", cell information each of these categories different based on product. component consist of table headings, , user have go in , add information product predetermined cells. many things possible cq5, , asking can done. although i'd have input component set through dialog rather having client mess text components inside cells. choice kinda depends on requirements. shouldn't hard make such component.

wordpress - Show product thumbnail on woocommerce New Order email -

i have wordpress/woocommerce site running , i'd edit email admins receive when new order received show thumbnail of product. copied template theme directory ( /themes/mytheme/woocommerce/emails/admin-new-order.php ) <?php echo $order->email_order_items_table( true, false, true, true, array( 150, 150 ) ); ?> and code woocommerce/classes/class-wc-order.php /** * output items display in html emails. * * @access public * @param bool $show_download_links (default: false) * @param bool $show_sku (default: false) * @param bool $show_purchase_note (default: false) * @param bool $show_image (default: false) * @param array $image_size (default: array( 32, 32 ) * @param bool plain text * @return string */ public function email_order_items_table( $show_download_links = false, $show_sku = false, $show_purchase_note = false, $show_image = false, $image_size = array( 32, 32), $plain_text = false ) { ob_start(); $template = $plain_text ? 'ema

oledb - Database loading progress in C# -

i working on application loads ole database datagridview. although database file locally stored, takes time application load databse, "loading" cursor. want more: want create progress bar show while db loading , hide when db loaded. i searched on google, not find looking for. can do? (i working in visual studio, keep in mind whole code dataset automatically written ide) you looking backgroundworker used in conjunction progressbar put both on form , use following code: public partial class form1 : form { public form1() { initializecomponent(); shown += new eventhandler(form1_shown); // report progress background worker need set property backgroundworker1.workerreportsprogress = true; // event raised on worker thread when worker starts backgroundworker1.dowork += new doworkeventhandler(backgroundworker1_dowork); // event raised when call reportprogress backgroundworker1.progresschanged += new progresschangedeventhandler(backgr

android - Application crashing while video playing on youtube in weview -

i developed application in loading youtube channel in webview , working fine expected. able play videos in small screen full screen mode. but issue if putting application in background while video playing in full screen mode , and bringing on foreground application crashing. have seen crash log not showing code not getting reason behind crash. showing nullpointerexception came mystery. logcat : 08-09 14:21:33.480: e/androidruntime(10157): fatal exception: main 08-09 14:21:33.480: e/androidruntime(10157): java.lang.nullpointerexception 08-09 14:21:33.480: e/androidruntime(10157): @ android.webkit.html5videofullscreen.prepareforfullscreen(html5videofullscreen.java:187) 08-09 14:21:33.480: e/androidruntime(10157): @ android.webkit.html5videofullscreen.access$600(html5videofullscreen.java:24) 08-09 14:21:33.480: e/androidruntime(10157): @ android.webkit.html5videofullscreen$2.surfacecreated(html5videofullscreen.java:124) 08-09 14:21:33.480: e/androidruntime(10157):

java - Is there a way with concurrency, that a same Object.equals(Object) returns false? -

that's pestered mind 1 of days, looking concrete answer. (please, bear me, not looking make beautiful code. au contraire, i'm lookng problem code smell) imagine have stateful object comming class foo public class foo { public int attribute = 0; // hashcode implemented :p @override public boolean equals(object o) { if (o instanceof foo) { foo = (foo) o; return this.attribute == that.attribute; } return false; } } and have workers on foo public class doombringer implements runnable { private final foo foo; public doombringer(foo foo) { this.foo = foo; } @override public void run() { this.foo.attribute++; } } and 1 prints result of #equals object passed parameter constructor. public class selfequalitytestprinter implements runnable { private final foo foo; public selfequalitytestprinter(foo foo) { this.foo = foo; } @ov

uipangesturerecognizer - iOS OCMock: How to test panning -

i new ocmock , needed getting started. have uiscrollview upon panning triggers event handler stuff. i'd test this. here's how make object id gesturemock = [ocmockobject partialmockforobject:[uipangesturerecognizer new]]; now how set panning specifications? after initializing panning, how "invoke" pan? if testing code responds uipangesturerecognizer , write test around target method of gesture recognizer. // if have this... uipangesturerecognizer *pgr = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(didpan:)]; [self.scrollview addgesturerecognizer:pgr]; // this... - (void)didpan:(uipangesturerecognizer *)pgr { switch (pgr.state): { case uigesturerecognizerstateended: [self dosomething]; break; default: } } // id gesturemock = [ocmockobject mockforclass:[uipangesturerecognizer class]]; [[[gesturemock stub] andreturn:uipangesturerecognizerstateended] state]; id objectunderte

c# - Get list of temporary internet files -

var path = environment.getfolderpath(environment.specialfolder.internetcache); var dinfo = new directoryinfo(path); foreach (fileinfo f in dinfo.getfiles()) { console.writeline(f.tostring()); } this prints out 1 file titled "desktop.ini". know temporary internet files virtual folder. how can iterate through files in virtual folder? what accessing code top level folder. iterate through files need take account sub folders in temporary internet files. static void main(string[] args) { var path = environment.getfolderpath(environment.specialfolder.internetcache); var dinfo = new directoryinfo(path); dostuff(dinfo); console.readline(); } static void dostuff(directoryinfo directory) { foreach (var file in directory.getfiles()) { console.writeline(file.fullname); } foreach (var subdirectory in directory.getdirectories()) {

symfony 2- fill up the form in controller -

i have form , fill 1 field (fromid) in controller (i used setfromid method), receives error. there code: public function newaction() { $entity = new privatemessage(); $user = $this->container->get('security.context')->gettoken()->getuser(); $entity->setfromid($user); $form = $this->createform(new privatemessagetype(), $entity); $form->setdata($entity); return $this->render('acmestorebundle:privatemessage:new.html.twig', array( 'entity' => $entity, 'form' => $form->createview(), )); } do missed something? @edit: forgot add it's working when field fromid avaliable in form. don't want let user change it. and part of privatemessage entity: class privatemessage {/** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /*

angularjs - Angular filter does not work -

i ran problem angular js project started angular-seed project. here's code snip: search: <input ng-model="searchtext" placeholder="type in full text search"> <p ng-controller="myctrl1"> search: <input ng-model="searchtext"> showing {{searchtext}}. <ol> <li ng-repeat="phone in phones | filter:searchtext"> {{phone.name}} ha {{phone.snippet}}</li> </ol> </p> the first search box works! second not! don't errors indicate wrong. when remove ng-controller="myctrl1" markup, both search boxes work! tutorial, angular-phonecat, , angular-seed projects little different. seed project uses kind of code assign controller view. // declare app level module depends on filters, , services angular.module('myapp', ['myapp.filters', 'myapp.services', 'myapp.directives', 'myapp.controllers']). config(['$routeprovider',

android populate spinner from html form values (select tag) -

hi i'm looking @ best/simplest way populate spinner values select section of html page. spinner values must same ones present in html select section. i'm looking in simplest way possible. thought of following ideas: read values html page (for example using lxml) add values spinner (directly or if not possible after saving values in database) does know simplest way (for both read part , population part)? there android object/class allowing directly link values html page spinner? many in help! ben i used jsoup in asynctask value , text of options , put them in text/value treemap (sorted hashmap) so: class theatergetter extends asynctask<context, void, document> { private context context; @override protected document doinbackground(context... contexts) { context = contexts[0]; document doc = null; try { doc = jsoup.connect("http://landmarkcinemas.com").timeout(10000).get(); } catch

osx - How do I clear the screen in C? -

this question has answer here: clearing output of terminal program linux c/c++ 7 answers clear screen in c , c++ on unix-based system? 6 answers i want clear text on screen. have tried using: #include <stdlib.h> sys(clr); thanks in advance! i'm using os x 10.6.8. sorry confusion! the best way clear screen call shell via system(const char *command) in stdlib.h: system("clear"); //*nix or system("cls"); //windows then again, it's idea minimize reliance on functions call system/environment, can cause kinds of undefined behavior.

R: Matching hours by dates -

i new in r , i've been stuck on matching hour date awhile now. have date frame has column date , column hour. looks following date hour june1 0 june1 1 june1 2 june1 0 june1 1 june2 0 june2 1 i want able match same hour date. hours numbered 0-23. example, want hour 1 in june 1 matched , hour 2 in june 1 matched (and on). it's simple solution, can't figure out ): appreciate help! you can use ddply plyr package that: install.packages("plyr") library(plyr) ddply(mydata,.(date,hour),transform,mean.value=mean(value) note: assuming want match find out mean/median/sum etc of column called value . also, date need formatted as.date() before using above function.

html - Easy way to re-order asp:GridView? -

i wondering if there built in way re-organize elements of gridview, user can instance sort them id number or date. preferably in behind code. you can use gridview's sort method .

imacros - create a batch file to open firefox, then run a macro (wait for it to finish) then run another macro -

i trying to: (1) load firefox (2) run iopus imacro (.iim) - wait finish, (3) run next macro. so far have tried start /wait - call , many other suggestions find on internet , have far (which runs flawlessly - long there 1 macro file (.iim) play): @echo on echo echo have 5 sec close window prevent macro running... timeout 5 echo start firefox , wait 10 seconds... start /b "" "c:\program files (x86)\mozilla firefox\firefox.exe" timeout 10 echo running macro (in 2nd tab)... "c:\program files (x86)\mozilla firefox\firefox.exe" imacros://run/?m="mymacro1.iim" rem macro execution completed echo finished! when try add more files run, this: @echo on echo echo have 5 sec close window prevent macro running... timeout 5 echo start firefox , wait 10 seconds... start /b "" "c:\program files (x86)\mozilla firefox\firefox.exe" timeout 10 echo running macro (in 2nd tab)... "c:\program files (x86)\mozilla firefox\firefox.exe&q

php - Using ReCaptcha with jQuery Validate, giving correct response but gives error -

i'm using jquery validate registration form website recaptcha @ bottom. here script check form errors (edited relevant parts): $(document).ready(function() { jquery.validator.addmethod("checkcaptcha", function() { var phpquery = $.ajax({url:"verify.php", type: "post", async: false, data:{recaptcha_challenge_field:recaptcha.get_challenge(),recaptcha_response_field:recaptcha.get_response()}, success:function(resp) { if (resp == 'false') { console.dir(resp); return false; } else { console.dir(resp); return true; } } }); },""); $('#regform').validate({ rules:{ recaptcha_response_field:{required:true,checkcaptcha:true} }, messages:{ recaptcha_response_field:{checkcaptcha:"your captcha response incorrect. please try again."} } }); }); what happens when enter correct recaptcha r

grails: what's the equivalent of php's $_POST and $_GET -

i'm dealing example php scrip uses $_post , $_get . can tell me, what's grail's equivalent of php's $_post , $_get ? grails store info sent in request in map called params . http://grails.org/doc/latest/ref/controllers/params.html the type of map grailsparametermap, can check here methods available.

html - Display 3-column layout with variable-height content in fixed height box? -

Image
this not usual 3-column layout question :-) so imagine classified ads section in newspaper (remember those?)... have design have fixed-size box on screen (say, 600x200), divided in 3 columns, tweets displayed in each column. tweets start fill first column , keep stacking in first column until come tweet no longer fits, bumped next column.. etc. here's mockup of i'm after (i had erase name on each tweet idea): it's tricky since goal fit many tweets possible box don't know how tall each tweet be... 1 word, 140 characters using caps take lot of space. enclosing box same size , can't change. need kind of smart "flow" knows when move next column , fill in available space. there way in css/html? using css, columns appear best way. demo html each tweet pair of <strong> usernames, , <p> tweet bodies. change these whatever like, make sure change css match. <div class="threecol"> <strong>@someone<

Blocking request in Chrome -

i'm trying block requests in chrome app. i created javascript listener validation: chrome.webrequest.onbeforerequest.addlistener( { urls: ["*://site.com/test/*"] }, ["blocking"] ); but requests not blocking. did miss in code? my manifest: "background": { "scripts": ["listener.js"], "persistent": true }, "permissions": ["tabs", "http://*/*"], "manifest_version": 2, it looks misunderstood meaning of "blocking" here. https://developer.chrome.com/extensions/webrequest.html#subscription if optional opt_extrainfospec array contains string 'blocking' (only allowed specific events), callback function handled synchronously. means request blocked until callback function returns. in case, callback can return blockingresponse determines further life cycle of request. to block request (cancel

java - Android - End TextWatcher when user enters '.' -

i have textwatcher set , working (nearly) want it. however, textwatcher stop user enters '.'. solution have found far crashes app if user entirely deletes text. important entire textwatcher ends @ moment user enters '.'. i have tried placing textwatcher within loop, doesn't seem work. private textwatcher userenterlistener = new textwatcher() { @override public void aftertextchanged(editable s) { // todo auto-generated method stub } @override public void beforetextchanged(charsequence s, int start, int count, int after) { if(after==0) { showntext = "please try again"; } else if(after==1) { showntext = "a"; } else if(after==2) { showntext = "an"; } else if(after==3) { showntext = "and"; } else if(after==4) { showntext = "andr";

iphone - value get released from variable when value is float number -

i facing such strange issue right now, trying implement calculator in project demo. place want implement arc enable , project arc disable working in demo working perfect in project when try operation on float values application crashes says exc_bad_access(code 1.... below code _currentvalue , _previousvalue in .h file @property (retain,nonatomic) nsnumber* currentvalue; @property (retain,nonatomic) nsnumber* previousvalue; in .m file there 2 methods face problem - (nsstring *)calculatevaluetostring:(nsstring *)valuestring fortype:(enum state)type{ _currentvalue = [numberformatterformal numberfromstring:valuestring]; nslog(@"%@",_currentvalue); //whatever number input prints here [self calculatevalue]; // method called state = type; if (state != equal){ _previousvalue = _currentvalue; nslog(@"%@",_previousvalue); // print _currentvalue = @0 ; } nslog(@"_previousvalue%@",_p

ffmpeg animated gif is blotchy -

i generating animated gif mp4 ... due (i think) color reduction (gif requires -pix_fmt rgb24) result ... blotchy? running image through oil paint (or maybe "posterize") special effect filter. think quality better, don't know tweak. not sure ... ooking @ color palette of resulting gif in image editor not appear have attempted create color palette specific clip, instead attempting generic palette ... wastes lot of pixmap space. is, if interpreting correctly. any tips on preserving original video image instead of getting "posterized" animated gif? to better looking gifs, can use generated palettes. palettegen filter generate png palette use paletteuse filter. ffmpeg -i input.mkv -vf palettegen palette.png ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif

solaris simple bash script -

i'm trying execute simple script in solaris. want sort(numeric) filenames of files in source directory , copy file 1 one directory. and, want print message after copying every 100 files. #!/bin/bash count=0 in `ls | sort -n` cp $i ../target count = $((count+1)) if[ $count%100 -eq 0 ] echo $count files copied sleep 1 fi done this not working. tried different things after searching in net. errors these - syntax error @ line 8: '(' unexpected. syntax error @ line 10: 'then' unexpected. syntax error @ line 13: 'fi' unexpected etc. what problem script? bash version - gnu bash, version 3.00.16(1)-release (sparc-sun-solaris2.10) count=$((count+1)) if [ `echo $count % 100 | bc` -eq 0 ] make these corrections. edit: please try count=`expr $count + 1`

performance - Website Load time - Is India based server responsible -

my website has traffic india decided go india based vps because told reduce load time. although costly based server signed it. facing issue whenever check load time pingdom or gtmetrix give me more 12 secs when visit office or home pc takes less time. do think pingdom , gtmetrix giving wrong time because isp use test based. there way can find out load time pc using internet connection/isp. can download , install , uses internet connection perform load test? my server ip 103.14.96.209 , domain muthootfinance.com also if ping using cmd command ping time 32secs if ping using online services pingdom ping time comes more 300 secs. please me out. it looks response times faster when pinging indian machine (see here &vaction=ping&ping=start">http://cloudmonitor.ca.com/en/ping.php?vtt=1380725309&varghost=103.14.96.209&vhost=&vaction=ping&ping=start)

Determine where PHP is exiting using code, not debugger -

i cannot figure out application exiting. i'd rather not bother debugger, , adding declare(ticks=1); each file pain (i'm not in mood dealing sed). similar question has been asked, not these constraints. how can figure out code exiting? clarification: while question similar fastest way determine php script exits , i'd find solution works without debugger. know how debugger, don't have access such tools. you don't need add declare(ticks) files. 1 entry point enough: <?php function my_tick() { echo 'tick'; } register_tick_function('my_tick'); declare (ticks=1) { include("lib.php"); echo "1"; test(); } and lib.php: <?php echo "2"; function test(){ echo "3"; } and looking code-based solution assume sources provide single entry point.

c++ - Eigen MatrixBase template function -

i don't know how fix following code: template <class derived, class otherderived> void forw_sub(const matrixbase<derived>& l, const matrixbase<derived>& b, matrixbase<otherderived> const & x) { typedef typename derived::scalar scalar; matrixbase<otherderived>& x_ = const_cast< matrixbase<otherderived>& >(x); for(int i=0; < l.rows(); i++) { scalar s = b(i); for(int j=0; j < i; j++) { s -= l(i,j)*x_(j); } x_(i) = s/l(i,i); } } which when called: matrixxd l = matrix3d::identity(); vectorxd b = vector3d::ones(); vectorxd x = vector3d::zero(); forw_sub(l,b,x); generates error: /home/vision/workspace/sci-comp/test/test_leq.cpp: in member function ‘virtual void leq_forw_sub_test::testbody()’: /home/vision/workspace/sci-comp/test/test_leq.cpp:15:16: error: no matching function call ‘forw_sub(eigen::matrixxd&, eigen::vectorxd&

Python vs Javascript DateTime -

i'm trying convert javascript api call python. working javascript code works fine, generating timestamp this: var curdate = new date(); var gmtstring = curdate.togmtstring(); var utc = date.parse(gmtstring) / 1000; this result (this number of seconds since epoch) subsequently hashed , used in api call, relevant section. if can let me know correct way convert appreciated. here's details on different results different methods: javascript(valid api result) var curdate = new date(2013, 7, 10); var gmtstring = curdate.togmtstring(); var utc = date.parse(gmtstring) / 1000; result: 1376089200 python (invalid api result) from datetime import datetime import calendar d = datetime(2013, 8, 10) calendar.timegm(d.utctimetuple()) result: 1376092800 i'm missing something, can enlighten me on this? update i had made mistake in examples, javascript uses 0 based dates , python's dates 1-based. jonathon kindly explained difference in values different due p

linux - How to permanently chmod 777 for PHP -

before start killing me how should not chmod 777, rather different what's in many other topics. the situation have directory not accessible web ( /var/lib/folder/ ) want php able access can read, write , execute directory. a simple solution chmod (as root), 777 folder, here comes problem. user, john, writes directory. know, files john write entitles him owner, , such php not owner. somehow, files john write become 755 instead of 777 (and result php cannot access). is there way either: make john write directory in 777 or make directory such files john write become accessible php. you don't need chmod. set acl on directory: setfacl -r -d -m u:php:rwx /var/lib/folder/ this gives user php rwx rights new files (-d = default). you can change acl existing files in folder with: setfacl -r -m u:php:rwx /var/lib/folder/

c++ - Threshoding image between certain range -

how threshold image between range? have done doesn't work. for (int i=0;i<s.size().height;i++) { for(int j=0;j<s.size().width;j++) { int k=int (s.at<uchar>(j,i)); if (k>6 && k<10) k=255; else k=0; s.at<uchar>(j,i)=k; } } you uchar value, , convert integer. try : uchar k= s.at<uchar>(j,i); if (k>6 && k<10) { k=255; }else { k=0; } s.at<uchar>(j,i)=k; i think may work.

android - Qt/C++: interrupt QProcess arbitrarily with button (simulate ^c) -

so need make qt application (with gui) executes "adb logcat" command (it's log keeps being generated until ^c pressed). need gui button make process stop , pass output text browser. code use qprocess output: qprocess process; process.start("adb logcat"); process.waitforfinished(-1); qbytearray logcatout = process.readallstandardoutput(); ui->devicesoutput->settext(logcatout); thank you process.waitforfinished(-1); would prevent program of being executed further, till process "adb" has finished. gui frozen. you should define qprocess process class variable. use qprocess *process; instead of creating on stack. (best practice qobject derivates) declare slot handles clicked-signal of button. call process->terminate() in slot.

date - How to convert yyyy-mm-dd hh:mi:ss into mm-dd-yyyy hh:mi:ss in Oracle? -

i have varchar column , want convert yyyy-mm-dd hh:mi:ss mm-dd-yyyy hh:mi:ss , cast date. how can done? to convert string date: to_date (the_string, 'yyyy-mm-dd hh:mi:ss') if want formatted string in format mm-dd-yyyy hh:mi:ss: to_char (to_date (the_string, 'yyyy-mm-dd hh:mi:ss'), 'mm-dd-yyyy hh:mi:ss')

Jenkins SSHD connection -

having trouble finding information on using jenkins sshd, there's rsa key (publickey?) supplied x-instance-identity header when browsing top page. trouble is, it's not clear how use this. i've tried obvious, , added ~/.ssh/id_rsa_jenkins , attempted connect, after first setting sshd port in jenkins config 8822 ssh -i ~/.ssh/id_rsa_jenkins -p 8822 jenkins_server (and alternatively) ssh -i ~/.ssh/id_rsa_jenkins -p 8822 user@jenkins_server however, both of these connection attempts, i'm challenged passphrase, don't have (attempting use user login fails.) does have ideas? managed figure out, jenkins top page (when logged in) > people > user > configure then find ssh public keys , paste rsa/dsa public key in here , save, , can log in.

Most memory efficient way to re format a JSON array in Java -

say have json array similar following: [ { "title": "this title", "year": 2013, "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, "thumbsdown": 256 } }, { "title": "this title", "year": 2013, "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, "thumbsdown": 256 } } ] and required output json array this: [ { "title": "this title", "images": { "image": "http://........jpg", }, "ratings": { "thumbsup": 1053, } }, { "title": "this title", "images": { "image

doctrine2 - Doctrine 2: how do you use a subquery column (in the SELECT clause) -

i'm trying simple select query subquery in select clause , have not found way it. i've tried both dql , querybuilder, neither work. code follows, please don't use join, simplified example illustrate problem, have legitimate use cases subqueries. // querybuilder $query = $qb->select(array('a', '(select at.addresstypename e:addresstype @ at.addresstypeid = a.addresstypeid ) addresstypename')) ->from('e:address', 'a') ->where('a.addressid = :addressid') ->setparameter('addressid', 1); // dql $dql = "select a, (select at.addresstypename e:addresstype @ at.addresstypeid = a.addresstypeid ) addresstypename e:address a.addressid = :addressid"; $query = $em->creat

python - How can I get a loop to ignore non-letter elements in a list? -

i have string contains letters , punctuation. i'm trying replace letters in string other letters. function have developed works strings contain letters. if numbers included produces logic error , if punctuation included produces run-time error. there anyway can function ignore punctuation , leave while operating on letters? #create string variable, abjumbler generates alphabet shifted x units right #abshifter converts string using 1 type textobject = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." smalltext = 'abcde' alphabet = list(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','

Insert SQL with variables and variable is not changing in loop (vb.net, postgresql)? -

i'm working on app insert data csv postgresql database. populate datagrid, loop through datagrid , insert record table (yes know code pretty verbose, want way right testing purposes). seems work perfectly; when running code , debugging, variables change during loop, but, on insert database, inserts data first row each new insert , not new variable value. thoughts? suggestions? here's full code:`me.btnpoupulatedata.enabled = true dim objconn new system.data.odbc.odbcconnection dim objcmd new system.data.odbc.odbccommand dim dtadapter new system.data.odbc.odbcdataadapter dim ds new dataset dim strconnstring string dim strsql string 'these required fields table product_template 'catc null vals exceptions dim str_mes_type string = "fixed" dim i_uom_id integer = 1 dim i_uom_po_id integer = 1 dim strtype string = "product" dim str_procure_method string = "make_to_

vb.net - Data type to be used to store 10 digit mobile number? -

in current vb.net (visual studio 2010) project dealing sql server ce data base. storing mobile numbers, using nvarchar data type mobile_no field. while testing have entered 1234567890 in field mobile_no successfully.. but @ time of retrieval getting error : expression evaluation caused overflow. [name of function (if known)=] so should store mobile numbers in sql ce data base ? edit : code insert : dim sqlquery string dim enumber string enumber = 1234567890 insqertsql = "insert tbl_cust(c_id,mobile_no) values(@cid, @phno)" dim cmd new sqlcecommand(insqertsql, con) cmd.parameters.add("@cid", c_id) cmd.parameters.add("@phno", enumber) cmd.executenonquery() query retrieval : sqlquery = "select * tbl_cust ephone =" & txt_number.text the problem in string concatenation in retrieve query. sqlquery = "select * tbl_cust ephone =" &

android - AsyncTask starts again on tab change with SherlockFragments -

i have mainactivity extends sherlockfragmentactivity , 2 tabs sherlockfragment. these 2 tabs have listview populated asynctask. works fine whenever switch tab tab, asynctask triggers again , want start once. here mainactivity: public class mainactivity extends sherlockfragmentactivity { private fragmenttabhost mtabhost; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mtabhost = (fragmenttabhost) findviewbyid(android.r.id.tabhost); mtabhost.setup(this, getsupportfragmentmanager(), r.id.tabcontent); mtabhost.addtab(mtabhost.newtabspec("tab1").setindicator("tab1"),tab1.class, null); mtabhost.addtab(mtabhost.newtabspec("tab2").setindicator("tab2"),tab2.class, null); } and here tab1: public class tab1 extends sherlockfragment { @override public view oncreateview(layoutinflater

asp.net mvc - Orchard CMS 1.7 Custom Theme images not loading -

i had started creating new theme while using v1.6.1. things not going custom module creation decided start scratch. time using source v1.7 i copied custom theme folder, pasted themes folder of new 1.7 project , ran site. see theme in dashboard set current theme. now when view site none of images loading. style sheets loading, though none of images - either style sheet or views - loading. my images in mytheme/content/images - understand how 1.6.1 required things laid out. my content folder has web.config images folder. it's same config used in 1.6.1 i'm wondering if has changed. in 1 of theme views have following code - worked in 1.6.1: <img src="@url.content(html.themepath(workcontext.currenttheme,"/content/images/phonebullet.png"))" alt="t:" /> if output front-end get: ~/themes/performanceabrasives/content/images/phonebullet.png this tells me things appear in correct place - though i'm wondering if web.config out

.net - Compute trajectory using unit of measure -

i learning f# , trying use first time concept of unit of measure. have following questions: the last let (variable y in getposition function gives me following error: "the unit of measure ''u ^ 2 m/second' not match unit of measure 'm'". there wrong in formula or usage os unit of measure? i using unit of measures defined in microsoft.fsharp.data.unitsystems.si. there way not specify use shorter version of name? (e.g. unitnames.second vs second). i have use function cos , sin. these 2 functions expect float, not float. use languageprimitives.floatwithmeasure convert float unit of measure. way that? makes code verbose. thanks! open system open microsoft.fsharp.data.unitsystems.si module generalballistictrajectory = [<measure>] type radian let gravitationalacceleration : float<unitnames.metre/unitnames.second^2> = 9.80665<unitnames.metre/unitnames.second^2> let getposition (angle: float<radian>) (velocity:

c++ - set_difference and set_intersection simultaneously -

i'm wondering if there facility in standard library simultaneously compute set intersection , set difference between 2 sorted ranges. signature along lines of: template <class input1, class input2, class output1, class output2, class output3> output3 decompose_sets (input1 first1, input1 last1, input2 first2, input2 last2, output1 result1, output2 result2, output3 result3 ); such after call decompose sets , result1 contains elements in [first1,last1) not in [first2,last2) , result2 contains elements in [first2,last2) not in [first1,last1) , , result3 contains element common in [first1,last1) , [first2,last2) . the example implementations of set_difference , set_intersection cplusplus.com seem can me create efficient implementation performs 1 scan instead of three. if it's in standard library, though, i'd hate reinvent wheel. example, request: given 2 sets a={0, 1,

php - Where should I put my defaults? -

i'm working on web application uses php it's code,and mysql it's storage engine. when working on data model, realized have small issue handling of 'default' data. i designed mysql schema include defaults, made sense @ time because manipulating data 'by hand' -- it's year later got around adding control panel let others change data. the issue becomes how handle 'default' values needed objects. technically, leaving things 'null' default, wasn't 1 particularly concerned me before now. if use mysql defaults, when insert new value have turn around , query 'real' data out of database. if, on other hand, set defaults in php, start violating dry having defaults in 2 places. , if ever 'quick' fix , changes them in 1 place, wind pretty 'interesting' bugs debug. @ same time, can't remove defaults mysql, because part of data schema, , need left in it. i'm willing bet i'm either overlooking some

Need to open text file, print random word with over 5 characters python -

import random dictionary = open('word_list.txt', 'r') line in dictionary: in range(0, len(line)): if >= 5: word = random.choice(line) dictionary.close() this code doesnt seem work me here link file if helps http://vlm1.uta.edu/~athitsos/courses/cse1310_summer2013/assignments/assignment8/word_list.txt import random open('word_list.txt', 'r') f: words = [word.rstrip() word in f if len(word) > 5] print random.choice(words) as @ashwini-chaudhary correctly pointed out, word on each step of iteration has newline \n @ end - that's why need use rstrip() .

node.js - res.sendfile() doesn't serve javascripts well -

i want use static file serve without rendering engine. i've tried use: res.sendfile('public/index.html'); on '/' route, , express middleware static files on route: app.use(express.static(path.join(__dirname, 'public'))); but seems of javascripts client asks downloaded index.html file information. how can make successful download of css/js static files ? update: here route "res.sendfile ..." : app.get('/*', index); i want of requests server on route index.html , of js&css assosiciated with. i guess might you... in app.js file... app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); app.use("/styles", express.static(__dirname + '/public/stylesheets')); app.use("/scripts", express.static(__dirname + '/public/javascripts')); app.use("/images", express.static(__dirname + '/public/images')); // development if ('

ruby - How do I give my instance variable a getter? -

i have instance variable want set value if it's nil when requested. correct, or cause problems? class attr_accessor :var def initialize @var end def var if @var == nil #something determines value var end @var end end class attr_writer :var def initialize @var end def var @var ||= 12 end end foo = something.new foo.var # => 12 foo.var = 15 foo.var # => 15

c# - Pausing an Application Procedure -

i have following code: mediaplayer.movenext(); slidetransition slidetransition = new slidetransition { mode = slidetransitionmode.sliderightfadeout }; itransition transition = slidetransition.gettransition(textblocksong); transition.completed += delegate { transition.stop(); }; transition.begin(); //would pause here. slidetransition slidetransition2 = new slidetransition { mode = slidetransitionmode.sliderightfadein }; itransition transition2 = slidetransition2.gettransition(textblocksong); transition2.completed += delegate { transition2.stop(); }; transition2.begin(); however first transition doesn't chance run second part kicks in immediately. how can add pause/delay inbetween 2 transitions, doesn't halt app (like thread.sleep() ) waits until proceeding code called? i'm not familiar yet, can try put transition storyboards. storyboard have completed event. edit: what this? slidetransition slidetransition = new slidetransition { mod

Android multi stroke gesture not working -

i modified existing app,gesturebuilder,to accept multiple strokes.hence accept letter a,d, f , on. created simple app recognises if letter correct or not.my problem is: 1.i have recorded multi stroke letter in file called gesture gesturebuilder. 2.my application not accept multi stroke gesture.but have set fadeoffset 1000 , gesturestroketype multiple.i not know why happening.the moment enter next xtroke write capital previous stroke dissapears.i cant write multi stroke letters/symbols. code: xml file: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddi

How to display a common html\javascript suffix with tabs -

please excuse not great title. don't html dev , i'm hacking , learning bits go. i'm trying create form multiple views using javascript , html. my goal allow data entered in multiple modes. example, suppose they're entering data products in warehouse page 1 deals warehouse info , page 2 deals product info. i'm doing jquery tabs. i use jquery tabs http://jqueryui.com/tabs/ each tab <div id="tabs-1"> <iframe src="enterdbinfo.shtml" width=100% height=1610> </iframe></div> <div id="tabs-2"> <iframe src="enterproducts.shtml" width=100% height=1610> </iframe></div> when user clicks on specific product on enterdbinfo.shtml, show product details view. problem show same product details view in enterproducts.shtml. done shared html document included using ssi in both docs. when enterdbinfo.shtml , enterproducts.shtml viewed sepa