Posts

Showing posts from January, 2013

internet explorer - Importing/scraping an website into excel -

i trying scrape data database, , have pretty set. in ie tab has me logged in database, , paste query link there through vba. how extract data returns ie tab , put excel cell or array. this code have opening query: sub import() dim row integer dim strtargetfile string dim wb workbook dim test string dim ie object call fill_array_cultivar row = 3 4 sheets.add.name = cultivar_array(row, 1) strtargetfile = "https://www3.wipo.int/pluto/user/jsp/select.jsp?fl=app_date%2cden_info%2cden_final&hl=false&json.nl=map&wt=json&type=upov&start=0&qi=3-nncxq6etevv184o9nnd5yg%3d%3d&q=cc%3ait%20and%20latin_name%3a(zea%20mays)%20and%20den_info%3a" & trim(cultivar_array(row, 1)) & "&facet=false" set ie = getie("https://www3.wipo.int" & "*") if not ie nothing ie.navigate (strtargetfile) else msgbox "ie not found!" end if next row end sub and appropriate fu...

ubuntu - There are problems and -y was used without --force-yes -

created directory 1) mkdir -p /root/dists/archives/ downloaded debians required installing few packages python-stdeb devscripts in /root/dists/archives/ 2) cd /root/dists/archives/ 3) dpkg-scanpackages . /dev/null | gzip -9c > packages.gz 4) added below entry in /etc/apt/sources.list deb file:/root/dists/archives/ ./ 5) apt-get update ign file: ./ inrelease ign file: ./ release.gpg ign file: ./ release ign file: ./ translation-en_us ign file: ./ translation-en reading package lists... done 6) when try install following packages python-stdeb devscripts. throwing below error apt-get install -y python-stdeb devscripts e: there problems , -y used without --force-yes create file in /etc/apt/apt.conf.d # cat /etc/apt/apt.conf.d/02allow-unsigned apt::get::allowunauthenticated 1; # apt-get update

Gradle build error in Android Studio -

i getting following error while building android project in android studio 1.2.2 (fresh instalation) error:(76, 0) not find property 'unittestvariants' on com.android.build.gradle.internal.dsl.testoptions_decorated@261be0aa. gradle version 2.4 android build gradle version 1.2.3 android-apt version 1.4 android sdk version 19. this triggered android apt plugin using unittestvariants property in 1.5 version available in android gradle plugin version 1.3 onwards (cf. bug report ). so either use android apt plugin version 1.4 , or android gradle plugin version 1.3 (see instructions below). note gradle version doesn't matter far bug concerned , use 2.4 2.2.1 . use android gradle plugin >= 1.3 make sure projects buildscript block references jcenter() (the beta versions aren't on maven) replace instances of 'com.android.tools.build:gradle:1.2.3' 'com.android.tools.build:gradle:1.3.0-beta4' re-sync gradle project wi...

.net - Automapper fails using a Generic Method - Event though the Generic Type is not used -

i trying make generic method map properties on similar classes. the following works: private shared sub createvaccessmap() each prop in gettype(workrecordheader).getproperties() mapper.createmap(of vaccess, workrecordheader)().formember(prop.name, sub(m) m.mapfrom(function(s) s.getfieldvalue(prop.name))) next mapper.createmap(of vaccess, workrecordheader)().formember(function(dest) dest.id, sub(opt) opt.ignore()) end sub but when add generic identifier fails ( argument types not match ) though not using generic type: private shared sub createvaccessmap(of t)() 'note change here each prop in gettype(workrecordheader).getproperties() ' following line fails on every property... mapper.createmap(of vaccess, workrecordheader)().formember(prop.name, sub(m) m.mapfrom(function(s) s.getfieldvalue(prop.name))) next mapper.createmap(of vaccess, work...

jQuery UI draggable not sticking to grid after scroll -

i'm using jquery ui's draggable functionality using set grid option. grid set use [x: 130, y: 110] constraints, , container grid height overflows own parent, allowing me scroll. when have draggable element, , start dragging it, , scroll bit down in container (while still hanging on draggable element), element no longer sticks grid. i have made barebone example shows error: you can see error in action in jsfiddle here - try start dragging, , scroll in container. if not enough of explanation; see gif of error here (it should stay in top left corner of grids). i have tried changing grid [x: 100, y: 100] , makes work in chrome , opera because scroll 100 pixels on each scroll, not firefox , ie since use soft-scroll. have tried "hacking" way through it, , moving element center of nearest grid when dragging done via jquery ui's droppable , did not seem usable solution. is there way ensure draggable element continue stick grid if scroll down while dragging ...

Pass variable to html frame -

i have django app having views.py //some code render(request, 'showmain.html',{"info": info}) and showmain.html <html> <frameset rows = "70%,*"> <frame src="showinfo.html"> </frameset> </html> i want pass data in info showinfo.html. how can done?

google tag manager - GTM V2 DataLayer button click tracking -

on webpage have 3 button ( ,average, bad). want track how many times particular button click. want use custom dimension , custom metric track in below format button name no.of time button click 5 average 10 bad 5 i have created custom dimension, datalayer variable (in gtm v2), custom metric. not able write datalayer code (datalayer creation & datalayer push method) code track counts how many time particular button clicked not developer or coder . can please me code of datalayer can paste/code on webpage click value button passed custom metric have created. datalayer name have created in gtm v2 bottonclicktotrack. need define event same. you don't need insert datalayer accomplish you're asking. can, believe there easier way. 1) set 3 triggers, 1 each button. make each button fire when respective button clicked 2) set 3 tags, 1 each button. make each tag send event ga account following information. category : button ...

javascript - TooltipDialog inside DropDownButton not working for custom widget -

used example https://dojotoolkit.org/reference-guide/1.10/dijit/form/dropdownbutton.html <div data-dojo-type="dijit/form/dropdownbutton"> <span>register</span> <div data-dojo-type="dijit/tooltipdialog"> <label for="name">name:</label> <input data-dojo-type="dijit/form/textbox" id="name" name="name"><br> <label for="hobby">hobby:</label> <input data-dojo-type="dijit/form/textbox" id="hobby" name="hobby"><br> <button data-dojo-type="dijit/form/button" type="submit">save</button> </div> </div> and put custom widget. on click error occurs: uncaught typeerror: cannot read property 'on' of null error occurs custom widget. using code snipped on other pages works fine. the answer custom widget overwriting startup() function without...

mysql - Active record do not send created at and updated at -

we have table columns: created_at datetime not null default current_timestamp, updated_at datetime not null default current_timestamp on update current_timestamp, when updating active record insert query contains created_at , updated_at columns. even after setting config.active_record.record_timestamps = false active record sending created_at , updated_at null. is there way not send these columns @ want handle @ mysql level. as far mysql concerned, updated_on columns should per below auto update- updated_at timestamp not null default current_timestamp on update current_timestamp

java - Log4j, how to put log file into dynamic directory location -

can show me how can put log file log4j in project location? want put log file src/main/resources every time. don't want care me location on disk of project, sample: if have project in d:/project , after change location project in c:/project want put log file on every time on src/main/resources out change line log4j.appender.file.file=c:\\project with this log4j.appender.file.file=d:\\project have idea? thx in advance :) you can write logic determine if application being run in c:\... or d:\... retrieving current directory , set system variable "logpath" below system.setproperty("logpath", mypath); // mypath either c:\... or d:\... based on logic then use property in log4j.properties log4j.appender.file.file=${logpath}src\main\resources\myapplicationlog.log note : need make sure system variable set before log4j initialized.

config nginx to run php in sub folder -

i'm installing limesurvey on server. due nginx used proxy golang server on machine, have keep php running in sub folder. the root dirctory of limesurvey on disk /limesurvey. so have nginx config below: location /limesurvey { alias /limesurvey; } location ~ /limesurvey/.*\.php$ { alias /limesurvey; fastcgi_pass 127.0.0.1:9000; fastcgi_param script_filename /$fastcgi_script_name; include fastcgi_params; } location / { proxy_pass http://127.0.0.1:8080; } but when visit http://example.com/limesurvey/index.php , shows: opendir(/limesurvey/limesurvey/tmp/assets/1086beef): failed open dir: no such file or directory what want archive is: http://example.com/limesurvey/ * goes local file system (/limesurvey/*) all other query goes 127.0.0.1:8080 how can config nginx fix issue? location ~ /limesurvey/.*\.php(.*)$ { access_log /1.logs; root /lms/; fastcgi_pass 127.0.0.1:9000; fastcgi_param script_filename /lms$fastcgi_s...

onmouseover - Three.js difference between mouseclick and mousemove -

i trying intersect plane geometry, 3600px x 3600px. this works fine, while used in onmousemove- function, copying , pasting code, onclick- function give result every 10-20 clicks, while click noticed. var intersects = raycaster.intersectobjects( intersectables ); if ( intersects.length > 0 ) { var intersect = intersects[ 0 ]; console.log( intersects[ 0 ].point.x ); } once clicked point, on plane geometry, responses on raycast, can click several times , responds again. of plane-geometry not, when clicked charmingly, while overmoused. is there difference, between mousemove , onclick not aware ?

android - Activity lifecycle issue -

after executing following code when kill application, both toasts appear on screen.now problem facing when comment out toast in onstop method, toast in ondestroy method doesn't show up. reason this? @override public void onstop() { toast.maketext(getapplicationcontext(),"onstop",toast.length_long).show(); super.onstop(); } @override public void ondestroy() { toast.maketext(getapplicationcontext(),"ondestroy",toast.length_long).show(); super.ondestroy(); } you can check logcat error. run app , watch closing responses on logcat.

wcf - Is client certificate necessary in trusted peoples store when using TransportWithMessageCredential -

i have wcf service securitymode set transportwithmessagecredential. this working fine when client x509 certificate installed in trusted people store on server side. removing client certificate store causes messagesecurityexception on client side. from windows event log boils down securitytokenvalidationexception: id4257 validation failed token handler. cert not in trusted people store. cert chain building failed the certificate used has trust chain cannot verified is expected behavior or there wrong client x509 certificate? i assuming chain trust established long signing ca of client x509 present on server. no : override service securitytokenhandler build x509chain own policy , incoming client certificate verify chain @ will

mapreduce - How can I persist cached tables in memory after the program ends (Apache Spark)? -

i'm new apache spark , have simple question dataframe caching. when cached dataframe in memory using df.cache() in python, found data removed after program terminates. can keep cached data in memory can access data next run without doing df.cache() again? the cache used cache() tied current spark context; purpose prevent having recalculate intermediate results in current application multiple times. if context gets closed, cache gone. nor can share cache between different running spark contexts. to able reuse data in different context, have save file system. if prefer results in memory (or have chance of being in memory when try reload them) can @ using tachyon .

testing - How to fail SSAS cube process -

in order test part of ssis process, want simulate part of ssas process failing. package runs several processing steps in olap , want sure run in case of partial failure. how can simulate this? since i'm assuming aren't doing testing in production environment, temporarily drop 1 of tables/views cube depends on.

javascript - window.open avoid pop-up blocker from function handler -

i using google analytics external link tracking code: var trackoutboundlink = function(url) { ga('send', 'event', 'outbound', 'click', url, {'hitcallback': function () { window.open ( url, "_blank" ); //document.location = url; } }); } which called from: <a target="_blank" onclick="trackoutboundlink('http://www.example.com'); return false;" href="http://www.example.com">full brochure</a> however, because window.open not called direct user interaction browser pop-up blocker engaged. how can achieve target new tab pop-up blocker not engaged? thanks i'd unobtrusively. so: <a target="_blank" href="http://www.example.com" rel="external">...</a> then js: /* find external links in document... */ var ext_links = document.queryselectorall('a[rel=...

ubuntu - Pocketsphinx acoustic model creating issue with sphinx_fe command -

now have trouble acoustic model building use ubuntu 14.04 on virtual box test run pocketsphinx , train acoustic model using sphinxtrain. need convert .wav files .mfc first , run "sphinxtrain run" command? did following steps, run " sphinxtrain run " command run sphinx_fe -i anuradha-eight.wav -o file.mfc -argfile etc/feat.params in order convert .wav .mfc both tries failed. output , log files can seen here do need convert .wav files .mfc first , run "sphinxtrain run" command? i no output , log files can seen here failed open /home/anuradha/desktop/workspace/sinhala/wav/chathuri/chathuri-amma.wav: no such file or directory log says file missing in path should placed at.

jquery - How to change/add css to dynamically generated checkbox class -

i have jquery accordion, when click on accordion header ajax call brings content. each of these contents has list of items checkboxes , submit button user can update database (via ajax call). when submit clicked want remove checkbox of checked items , style these specific items. can remove checkboxes can't seem add change css! of items checked. can ? html goes so html accordion header <h3>(dynamic id) div class row div class bootstrap checkbox class single-checkbox (dynamic id) <p> content </p> checkbox <input type="checkbox" class="single-checkbox" name="contentall[]" value="<?php echo $row2['bing'], '-', $row2['content_all']; ?>" /> jquery $('.submit').click(function() { $.ajax({ url: "heir3.php", type: "post", data: $('.single-checkbox:checked').serialize(), success: function(data) { ...

selenium - SauceLabs and BrowserStack sending unencrypted credentials -

noticed 2 of major selenium cloud providers use http basic auth , don't use https. i wonder why , security implications of decision. saucelabs this.driver = new remotewebdriver( new url("http://your_username:your_access_key@ondemand.saucelabs.com:80/wd/hub"), capabilities); browserstack public static final string url = "http://" + username + ":" + automate_key + "@hub.browserstack.com/wd/hub"; browserstack provides both https , http end point. use think right. examples, please have @ this doc . disclaimer: work @ browserstack.com

xml - XSLT - Add incrementing id attribute to the nodes -

i have xml this, <doc> <section>1<section> <section>1<section> <p>22</p> <p>22</p> <p>22</p> <footer></footer> <footer></footer> <footer></footer> </doc> what need id add new attribute <footer> nodes. output be <doc> <section>1<section> <section>1<section> <p>22</p> <p>22</p> <p>22</p> <footer id="number-1"></footer> <footer id="number-2"></footer> <footer id="number-3"></footer> </doc> i can add new attribute <footer > node problem i'm facing add incrementing ids in xslt. <xsl:template match="footer"> <xsl:copy> <xsl:attribute name="id"><xsl:value-of select="'number-'[position()]"/></xsl:attribu...

java - How to save an ArrayList<String> to a txt file in Android Storage? -

i have arraylist one: savedquestions = new arraylist<string>(); how save text file in android local storage when click button ? even though arraylist class serializable default have make figur class (and classes uses) serializable well. mean like: class figur implements serializable { // handle version of class private static final int serialversionuid = 1l; // code go here } and have serialize like: objectoutputstream fileout = new objectoutputstream(new fileoutputstream("file")); fileout.writeobject(list); fileout.close(); and deserialize: objectinputstream filein = new objectinputstream(new fileinputstream("file")); list = (arraylist) filein.readobject(); filein.close(); also note, when write file, want append previous items in file , not overwrite (errase) them. think either objectoutputstream() or writeobject() has optional argument in allow append instead of overwrite. example: writeobject(list, true) instead of...

android - Dropbox "Send Intent" does not contain Stream data -

Image
i trying receive content of "share intent" send dropbox. works in other apps have tested following code: if(intent.action_send.equals(getintent().getaction())) { filepath = getintent().getparcelableextra(intent.extra_stream); } however, when sharing dropbox on android, filepath null . i believe you'll need check extra_text well, which, when user uses share option, contain share link file. (as opposed when user "exports" file, in case local link file available in extra_stream .) note that, of jelly bean, can use clipdata .

What is the effect of deleting a branch in gerrit -

what achieve no longer used (feature) branches in gerrit blocked submission of new changes , patches. the gerrit documentation says how it, not effect (or did not see it). i try find out running few experiments, not give me full picture. can point me more documentation or tell me experience and/or insight codebase? possible effects be: no more pushes refs/for/deletedbranch allowed (certainly) branch removed underlying git repo (i guess not) not yet merged changes posted refs/for/deletedbranch disappear (hopefully not, there should guard against case) already submitted/merged changes , patchsets disappear listing of merged changes (hopefully not) what happen?

get unicode error when print in html flask -

getting unnicode error when print in html flask. here code. {% if(backpaths) %} {% n in backpaths:%} {% print '%s'%n %} </br> {% endfor %} {% endif %} i tried use n.decode('utf-8') didn't work , got same error backpaths set to: ['1\xe6\x9c\x89 --(hyper)--> quantifier={indefinite|\xe4\xb8\x8d\xe5\xae\x9a\xe6\x8c\x87} --(hypo)--> \xe6\x9c\x89 ', '2\xe6\x9c\x89 --(hyper)--> exist|\xe5\xad\x98\xe5\x9c\xa8 --(hypo)--> \xe6\x9c\x89 '] here traceback (most recent call last): file "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) file "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) file "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) file...

c - Compatibility of inline assembly - \n\t versus ; -

what correct way write inline assembly (except avoid it)? better use ; or \n\t ? (except microsoft compiler __asm) there not "correct" way multi-line assembly vs inline. whatever readable. exemple : gmp use differents asm code style same bswap function /* bswap available on i486 , , fast. combination rorw $8 / roll $16 / rorw $8 used in glibc plain i386 (and in linux kernel xchgb instead of rorw), not done here, because i386 means generic x86 , mixing word , dword operations cause partial register stalls on p6 chips. */ #if defined (__gnuc__) && ! defined (no_asm) \ && have_host_cpu_family_x86 && ! have_host_cpu_i386 \ && gmp_limb_bits == 32 #define bswap_limb(dst, src) \ { \ __asm__ ("bswap %0" : "=r" (dst) : "0" (src)); \ } while (0) #endif #if defined (__gnuc__) && ! defined (no_...

itextsharp - Error while generating PDF for Japanese language -

we facing below error (sometimes) itextsharp pdf creation in japanese language: exception: font 'heiseikakugo-w5' 'unijis-ucs2-h' not recognized. we have added reference itextasian dll. let know, if have solution on this.

c++ - OpenCV: In a matrix, how to assign same value to all elements in a row -

for following expressions in matlab, what opencv equivalent ? a(2,:)=3; from know, can in opencv follows: mat arepeated; repeat(value, 1, a.cols, arepeated); arepeated.copyto(a.row(1)); here value 1x1 mat value 3. there more efficient way wrote above? this post suggested std::fill examples show usage vector object. i'm not sure if can applied mat objects well, or there other function. can guide please on this? how about: a.row(1).setto(scalar(value));

PHP Add button malfunction -

i trying hard learn how create shop cart using php , seems me got stuck once more. time can not make "additional conditioning amount available in stock" work well. can me figure out wrong php code below? if (isset($_get['add'])) { $con = mysqli_connect("localhost", "noivaemd_etalhes", "password", "***") or die (mysqli_error()); $quantity = mysqli_query($con, "select id, quantity products id=".mysqli_real_escape_string($con, $_get['add'])); echo '<p>'.$quantity_row['quantity']; while($quantity_row = mysqli_fletch_assoc ($quantity)) { if ($quantity_row['quantity']!=$_session['cart_'.$_get['add']]) { $_session['cart_'.$_get['add']]+='1'; } } } many things. you using mysqli , nice step mysql , you're still injecting values query. note escape_string not here because did not put...

python - How to post data via form HTML? -

i want post data server via form. how can this? <div class="panel-body"> <form role="form" action="{% url 'login' %}" method="post"> {% csrf_token %} <div class="form-group"> <label for="sender-email" class="control-label">username:</label> <div class="input-icon"> <i class="icon-user fa"></i> <input id="sender-email" type="text" placeholder="username" class="form-control email"> </div> </div> <div class="form-group"> <label for="user-pass" class="control-label">password:</label> <div class="input-icon"> <i class="icon-lock fa"></i> <input type="password" c...

c# - How to call VSTEST.CONSOLE.EXE from batch file -

i have unit test class library. abc.dll now have execute .bat file: start %comspec% /k ""c:\program files\microsoft visual studio 12.0\vc\vcvarsall.bat"" x86 after have add dll ... vstest.console.exe c:/abc.dll /logger:trx how can achieve this? please guide me kindly

MatLab: get username in Parallel Computing -

i'm using matlab parallel computing toolbox on several computers in office: i've enstabilished cluster managed custom scheduler (the matlab's own kind: mjs). everything seems run smoothly long run scripts , functions have same path on every pc (e.g. c:\sample.m), unfortunately need access functions in dropbox folder of every computer (for example file c:\users\myusername\dropbox\sample.m). to solve problem, tried this: parfor j=1:100 myusername=getenv('username'); cd(['c:\users\',myusername,'\dropbox']) sample(1,2,3); end but code cd function set current folder in c:\users\system\dropbox , can't find sample.m in it. has way around problem? you have several options here. first, compute username outside parfor loop myusername = getenv('username'); parfor ... ... cd(['c:\users\', myusername, '\dropbox']); ... end if you're running more recent version of matlab, there a...

java - SonarQube Webb analyse jsp -

i want use sonarqube analyse jsp filesw among others. know possible via settings menu. settings->web , add .jsp file suffixes. now i'm wondering if possible config via pom.xml? <sonar.web.file.suffixes>.html,.xhtml,.rhtml,.shtml,.jsp</sonar.web.file.suffixes> doesn't seem have affect you can either add config in pom.xml under properties or add .jsp web setting in sonar server(general setting > web)

javascript - Jquery datepicker hidden field date value compare with textbox not working -

i working on jquery datepicker comparison date label , textbox. have converted label date date format ( "dd, mmmm, yyyy") , set value hidden field on code behind. pass hidden field value jquery <asp:hiddenfield id="hdfdate" runat="server" /> the logic should : date of txtshipmentdate can't earlier lbldatereceived the datepicker not working below code.need advice on issue code behind vb.net dim datereceived datetime = lbldatereceived.text dim format string = "dd, mmmm, yyyy" dim newdate = datereceived.tostring(format) hdfdate.value = newdate aspx <asp:textbox id="txtshipmentdate" runat="server" visible="false"></asp:textbox> <asp:label id="lbldatereceived" runat="server" text="label"></asp:label> <asp:hiddenfield id="hdfdate" runat="server" /> <link rel="stylesheet"href="http://code.j...

repository - Unable to access local Git repo after quitting during a rebase -

my virtual machine shutdown during git rebase , project directory has no sight of git repository @ all. when git status following: vagrant@localhost /var/www/crmpicco $ git status fatal: not git repository (or of parent directories): .git i tried re-initialising repo, had no effect: vagrant@localhost /var/www/crmpicco $ git init reinitialized existing git repository in /var/www/releases/20141013104615/.git/ vagrant@localhost /var/www/crmpicco $ git status fatal: not git repository (or of parent directories): .git inside .git directory have following: vagrant@localhost /var/www/crmpicco/.git $ ls -all total 92 drwxr-xr-x+ 9 vagrant vagrant 4096 jul 8 09:26 . drwxr-xr-x+ 18 vagrant vagrant 4096 jul 7 18:00 .. drwxr-xr-x+ 2 vagrant vagrant 6 oct 13 2014 branches -rw-rw-r--+ 1 vagrant vagrant 293 may 6 16:45 commit_editmsg -rw-rw-r--+ 1 vagrant vagrant 637 jul 8 09:26 config -rw-r--r--+ 1 vagrant vagrant 73 oct 13 2014 description -rw-rw-r--+ 1 vag...

scala - Writing to Oracle Database using Apache Spark 1.4.0 -

i trying write data our oracle database using spark 1.4.0 dataframe.write.jdbc() function. the symmetric read.jdbc() function reading data oracle database dataframe objects works well. while writing dataframe (i tried write same object got database setting cverwrite true) gives following exception: exception in thread "main" java.sql.sqlsyntaxerrorexception: ora-00902: ungültiger datentyp @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:450) @ oracle.jdbc.driver.t4cttioer.processerror(t4cttioer.java:399) @ oracle.jdbc.driver.t4c8oall.processerror(t4c8oall.java:1017) @ oracle.jdbc.driver.t4cttifun.receive(t4cttifun.java:655) @ oracle.jdbc.driver.t4cttifun.dorpc(t4cttifun.java:249) @ oracle.jdbc.driver.t4c8oall.dooall(t4c8oall.java:566) @ oracle.jdbc.driver.t4cpreparedstatement.dooall8(t4cpreparedstatement.java:215) @ oracle.jdbc.driver.t4cpreparedstatement.dooall8(t4cpreparedstatement.java:58) @ oracle.jdbc.driver.t4cpr...

php - Only get the first row while doing a leftjoin -

is possible limit result while doing leftjoin? (laravel 4.2) - querybuilder i've got following query laravel's querybuilder: db::table('part') ->leftjoin('model', 'model.model_id', '=', 'part.model_id') ->leftjoin('make', 'model.make_id', '=', 'make.make_id') ->leftjoin('photo', 'photo.part_id', '=', 'part.part_id') ->select( 'part.part_id', 'part.model_id', 'make.desc make_desc', 'model.desc model_desc', 'photo.local local_img', 'photo.cdn cdn_img') ->take(8)->get(); every part has more 4 photos, want first photo included in join. problem when use query, 8 part objects (results). 8 results not 8 parts, 2 parts. query creates 4 of same part objects, difference being photo (the jo...

c# - Why IEnumerable<T> method call the database without condition? -

this question has answer here: what effect of asenumerable() on linq entity? 3 answers returning ienumerable<t> vs. iqueryable<t> 15 answers i have these method in generic repository : public iqueryable<t> query() { return _dbset.asqueryable(); } public ienumerable<t> enum() { return _dbset.asenumerable(); } if call these method in service layer _repo.query().where(w => w.isactive == true); _repo.enum().where(w => w.isactive == true); the queryable method call tsql syntax in database, profiler below : select [extent1].[projectid] [projectid], [extent1].[name] [name], [extent1].[isactivity] [isactivity], [extent1].[isactive] [isactive] [dbo].[project] [extent1] 1 = [extent1].[isactive] which expected,...

css - How can i enable use of background elements when the dialog is appeared? -

i created dojo dialog using the example . work maps in background. problem when dialog appeared, background blocked , can't use map(the dialog no underlaying). there way enable using background when dialog appeard on background? you can little hack : require(["dijit/dialog", "dijit/dialogunderlay", "dojo/domready!"], function(dialog, dialogunderlay){ //just snippets right styling document.body.classname = "tundra"; mydialog = new dialog({ title: "my dialog", content: "test content.", style: "width: 300px" }); mydialog2 = new dialog({ title: "my dialog", content: "test content.", style: "width: 300px" }); showdialog2 = function () { mydialog2.show().then(function() { dialogunderlay.hide() //little hack avoid js error when closin...

regex - htaccess mod rewrite - rewrite rule -

i ask following: have example rule mod_rewrite: rewritecond %{request_filename} !-f rewritecond %{request_filename}.php -f rewriterule ^(.*)$ $1.php [nc,l] i want rewrite url www.x.cz/word www.x.cz/word.php this works, problem arise in case, if url example www.x.cz/word/xxx (shortly after slash other text string). there error 500. how solve problem? (i server return 404 or same referring url www.x.cz/word.php - if there not string). thank willingness. you can tweak regex this: rewritecond %{request_filename} !-f rewritecond %{request_filename}.php -f rewriterule ^([^./]+) $1.php [l] this rewrite both /word/xxx , /word/ /word.php

Calculate stock from two transaction tables to a third one in MySQL -

i have 2 tables, 1 incoming shipments , 1 outgoing. there lot of stock queries in various groupings , need fast, i'd create third table summing above 2 , run queries on that. possible using sql only? simplified example: table: incoming id productid amount_in ------------------------ 1 6 100 2 5 300 3 6 50 4 2 10 table: outgoing id productid amount_out ------------------------- 1 5 10 2 5 20 3 6 30 resulting table should contain remaining stock: table: stock productid amount --------------------- 2 10 5 270 -- 300-10-20 6 120 -- 100+50-30 i have grouped 2 tables using union all, preserve similar records, used insert select statement obtained table inserting product id , sum of amount, multiply amount_out -1 subtract in sum. insert stock select productid, sum(amount) from( select productid , amount_in amount incoming union ...

design patterns - best way to pass many arguments to a method in Java -

i have method makesomeobject(string a,string b,keyvalue...){} //method call obj.makesomeobject(stringa,stringb,new keyvalue(string1,string2),new keyvalue(string3,string4),new keyvalue(string4,string5)); how can refactor makesomeobject() method can elegantly pass multiple keyvalue pairs method call cleaner , easy read. you make builder obj , give more fluent way of constructing obj using static method in question. public class objbuilder { private string a; private string b; private list<keyvalue> keyvalues = new arraylist<>(); private objbuilder() {} public static objbuilder obj() { return new objbuilder(); } public objbuilder witha(string a) { this.a = a; return this; } public objbuilder withb(string b) { this.b = b; return this; } public objbuilder withkeyvalue(keyvalue keyvalue) { this.keyvalues.add(keyvalue); return this; } public obj bu...

php - learning how to read data from MYSQL -

i'm trying learn php , mysql, trying read data database following online , encounter error(s) here code <?php include 'includes/conn.php'; $query =sprintf("select * customer"); $result = mysql_query($query); if (!$result) { $message ='from see it's not connecting!'.mysql_error() ."\n"; $message .= 'everything' .$query; die($message); } while ($customer = mysql_fetch_assoc($result)) { echo $row['cust_id']; echo $row['fname']; echo $row['lname']; echo $row['gender']; echo $row['dob']; } mysql_free_result($result); ?> //this trying make connection database <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $db ='telmar_php'; $con = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($db); ?> replace $message ='from see it's ...

java - check the correctness of the excel date using poi -

i reading excel sheet using poi has date column. want check correctness of date example if date entered in excel 05/45/2015. no month has 45 days in it. wondering there built in method available. this didn't print invalid date if(dateutil.iscelldateformatted(cell)) { system.out.println("cell value-->"+cell.getdatecellvalue()); } else{ system.out.println("invalid date"); } this code converts date 06/45/2015 06/30/2015 simpledateformat sdf = new simpledateformat("mm/dd/yyyy"); string s = sdf.format(cell.getdatecellvalue()); system.out.println(s); i don't want such conversions. you can simpledateformat class //string date = "05/45/2015"; string date = dateformatter.formatcellvalue(cell); dateformat df = new simpledateformat("mm/dd/yyyy"); try { date d= df.parse(date); //if didnt exception date in correct format }catch (exception e) { //date not in correct format ...

git - libgit2sharp branch not found on freshly cloned repo -

libgit2sharp 0.21.0.176 c# on windows server 2008 i need obtain reference specific branch. on windows machine, fresh git clone local repo remote origin on github. next execute following libgit2sharp code : var localrepo = new repository({local-path},repositoryoptions); var remote = localrepo.network.remotes.add("origin", {remote-repo-uri); localrepo.network.fetch(remote, fetchoptions, signature, "performing fetch"); var branch = localrepo.branches[{branch-name}]; but branch not present in collection though exists on remote origin on github. similarly git, default branch (or 1 has been specified in cloneoptions.branchname ) created local head upon cloning. other branches fetched, remote tracking branches. two options: given remote named "origin", can access remote tracking branches through localrepo.branches["origin/{branch-name}"]; you create local branch , configure track remote counterpart. see branchfixture.cans...

hadoop - Spark 1.4 missing Kafka libraries -

i'm trying run python spark script works in spark 1.3.1. have downloaded spark 1.4 , tried running script keeps falling on saying spark streaming's kafka libraries not found in class path. try 1 of following. include kafka library , dependencies in spark-submit command $ bin/spark-submit --packages org.apache.spark:spark-streaming-kafka:1.4.0 ... download jar of artifact maven central http://search.maven.org/ , group id = org.apache.spark, artifact id = spark-streaming-kafka-assembly, version = 1.4.0. then, include jar in spark-submit command as $ bin/spark-submit --jars <spark-streaming-kafka-assembly.jar> ... i have explicitly referenced jars in submit command , added jars as /opt/spark/spark-1.4.0-bin-hadoop2.6/bin/spark-submit --jars spark-streaming_2.10-1.4.0.jar,spark-core_2.10-1.4.0.jar,spark-streaming-kafka-assembly_2.10-1.4.0.jar,kafka_2.10-0.8.2.1.jar,kafka-clients-0.8.2.1.jar,spark-streaming-kafka-assembly_2.10-1.4.0...

Apache tika() returning empty string for pdf. Java -

i trying content of documents using apache tika() function. able contents of .doc , .docx files, it's not working on .pdf files. didn't specified document type in code, don't know why it's not working .pdf files. here code:- in extractdocument function: int indexedchars = -1; metadata metadata = new metadata(); int experiance=0; string parsedcontent; parsedcontent = tika().parsetostring(new bytesstreaminput( base64.decode(document.getcontent().getbytes()), false), metadata, indexedchars); system.out.println("parsedcontent "+parsedcontent); here getting parsedcontent empty string. here function calling this. public document push(document document, string username,httpservletrequest req) { if (logger.isdebugenabled()) logger.debug("push({})", document.getcontent()); if (document == null) return null; system.out.println("document.getcontent() "+ document.getcontent())...

javascript - elevatezoom mouse position — the struggle is real -

i using elevatezoom project , need mouse position while picture zoomed in. tried lot of different ideas undefined or nan . can tell me why? look @ example: $('#zoompicture').elevatezoom({ scrollzoom : true, zoomwindowfadein: 250, zoomwindowfadeout: 500, responsive: true, easing: true, easingduration: 50, bordersize: 1, zoomwindowwidth: 400, zoomwindowheight: 400, }); $("#zoompicture").bind("click", function(e) { console.log(e.pagex); console.log(e.pagey); }); // -> undefined could please let me know if below code works you $(document).bind("click", "#zoompicture", function(e) { console.log(e.pagex); console.log(e.pagey); }); does link question: understanding event delegation

Copy values from one sheet to another - Excel VBA -

i'm trying paste values 1 sheet (like vlookup) based on column. both sheets have same header. pasting or typing value in 2nd column fetch relevant data 2nd sheet , paste in 1st sheet , below code doesn't seem work. for = 2 row if ws.cells(i, 2).text <> "" j = 2 row1 if instr(1, ws1.cells(j, 2).text, ws.cells(i, 2).text, vbtextcompare) > 0 k = 3 8 ws.cells(i, k).value = ws1.cells(j, k).value next k exit end if next j end if next

php - I can't open database in XAMPP -

this question has answer here: maximum execution time in phpmyadmin 11 answers whenever start xampp , start apache , sql , click on admin button on mysql make new database shows following error fatal error: maximum execution time of 30 seconds exceeded in c:\xampp\phpmyadmin\libraries\dbi\dbimysqli.class.php on line 290 try this, ini_set('max_execution_time', 120); otherwise goto php ini , maxexecutiontime , set 120 or whatever u need.

Drupal Internationalization: How to translate taxonomy term additional field? -

i have taxonomy vocabulary multilingual option: localize. terms common languages, name , description may localized. , i've added long text field terms of vocabulary additional description. when go translate tab of term can translate name , description. how translate additional fields of term? note : entity translation module enabled also, can't translate manually added fields of terms. way has submodules: entity translation menu , entity translation upgrade . there no entity translation taxonomy.

hikaricp - jOOQ Connection Pool Release Pattern with HikariDataSource -

is correct way release connection pool hikaridatasource ds = ...; final connection sqlconn = ds.getconnection(); final dslcontext ctx = dsl.using(sqlconn, sqldialect.derby); // jooq queries here ds.evictconnection(sqlconn); just want make sure right connections not re-cycled if not call evictconnection no, calling sqlconn.close() release connection pool. when hikaricp, or pool, returns connection getconnection() , returning proxy object intercepts close() call , returns connection pool instead of closing it. evictconnection() method used. method forcefully close connection database , evict connection pool.

html - Get Text from<p> using HttpAgilityPack -

i using code return text html "p" tag htmldocument doc = new htmldocument(); doc.loadhtml(content); string query = doc.documentnode.selectsinglenode("//p/text()").innertext; if (query.length >0) { query = query.substring(0, 60) + "..."; } > here problem if "p" tag contains tag not return text. ex. <p><img src="http://localhost:49171/images/myimages/80ef7d03-6a8b-49e2-a4da-fa9f5f1773dd.jpg" alt="" />thank choosing microsoft windows 8.1 pro. license agreement between , microsoft corporation (or, based on live, 1 of affiliates) </p> in code, query returns "images/myimages/80ef7d03-6a8b-49e2-a4da-fa9f5f1773dd.jpg", anybody please me retrive these lines "thank choosing microsoft windows 8.1 pro." instead of "images/myimages/80ef7d03-6a8b-49e2-a4da-fa9f5f1773dd.jpg". thanks in advance... since every...

math - Binary arithmetic - addition with overflow -

when need subtract 2 numbers (x-y), can take 2's complement of y , add x. let's our system represents integers using byte (8 bits). x = 7 = 00000111 y = 5 = 00000101 2's complement of 5 11111010 + 1 = 11111011 adding 2 = 00000111 11111011 __________ 100000010 there carryover. how 1 deal carryover? if using 8 bits, means have range of -128 127. 7 , -5 , sum not fall outside range. not overflow. that depends on trying do if computing simple/single +/- operations then overflow ignored when need handle overflow/underflow for example if need clamp result reason (usually safety of result range ...) carry flag of alu marks if overflow underflow occur. after set result max positive or negative value depending on inputs sign,magnitude , operation (+,-) . aome platforms have instructions automatically (saturated add,sub). another reason making bigint operations in case carry added +/-1 higher operation (sign depends on operation)... result...

aptana3 - Hiding JavaScript from displaying in old browsers -

i trying learn javascript book. first chapter of book says use following format support older browsers don't support js. simple, uses html comment tag hide script browsers don't support js. doubt here code works fine me in browsers showing error in aptana studio 3. understand error due aptana considering "<" relational operator how can resolve error? <script> <!-- //some js code on here... //--> </script> error(syntax error: unexpected token) coming @ : <!-- i'm aware not answer question directly, truth not need done. if browser not know how interpret javascript, browsers ignore code anyway. furthermore, adding <!-- // --> can dangerous following reasons, given matt kruse: within xhtml documents, source hidden browsers , rendered useless it not allowed within html comments, decrement operations in script invalid for more detailed explanation, recommend check out this documentation best prac...

Magento One Page Checkout Shipping Method Not Loading in Progress Bar -

i facing problem in magento progress bar. in using magento 1.9 on checkout page when user fill shipping & billing information after click continue user can see both shipping & billing in progress bar. when user select shipping method / payment method user unable see selected shipping & payment method on right progress bar. what did: i check checkout.xml , opcheckout.js i replace checkout.xml & opcheckout.js code fresh downloaded magento. flush cache indexing i test path of progress files in checkout.xml and under checkout/onepage/progress/shipping_method.phtml $this->getcheckout()->getstepdata('shipping_method', 'complete') above syntax return null code show shipping method not working in progress bar. if 1 has idea please ping me. thanks please install best firefox add-on, firebug. can see,track,manipulate ajax requests , response there. show response of ajax requests , can solute problem easily. cheers.!

Swift: How to pass a Parameter to a function which itself is also a Parameter? -

it's this: var = 0 button.addtarget(self, action:"showcontent", forcontrolevents: uicontrolevents.touchupinside) and function "showcontent" this: func showcontent(i: int) { //do sth. } i want pass variable function showcontent when button touched, how ? in target-action pattern, can't that. can either use "showcontent" , in case function be: func showcontent() { } … or can add colon ( "showcontent:" ) in case function be: func showcontent(sender : uibutton) { // sender } this helps enforce broader model / view / controller pattern making difficult views "smart". instead, model , controller objects should handle i . button displays it's told, , tells controller when it's tapped. you can read i , , respond it, in appropriate method. example: class viewcontroller : uiviewcontroller { var = 0 var button = uibutton(type: .system) var label = uilabel() override func vi...

fwrite - Write each 200 lines to new file in PHP -

my code: $file = "read_file.txt"; $file_path = "write.txt"; $count = 0; $counter = 1; $lines = file($file); foreach ($lines $line) { if($count == 200){ $file_path = "write_".$counter++."txt"; $count == 0; } $count++; $file_handle = fopen($file_path, "w"); $file_contents = $line; fwrite($file_handle, $file_contents); fclose($file_handle); } i want write every new 200 lines read file new files (in other words divide whole file 200lines/file) everytime 1 line new file can me out im doing wrong you opening new file each line overwrites last why getting 1 line per file. not way want to. instead, loop through , groups of 200 lines, , write. means 1001 line file have 6 writes, instead of 1001. way much faster other methods $count = 0; $counter = 1; $file_lines = ''; $lines = file("read_file.txt"); foreach ($lines $line) { $file_lines .= $line . "\n"; $count++; ...

Java - Using Recursion to Find Palindrome -

i designing util class takes string parameter , returns true if palindrome(ex: input: radar ---> output: true) , returns false if not. class, using linkedlist, don't know why there seems error. here stack trace: exception in thread "main" java.lang.indexoutofboundsexception: index: 4, size: 4 @ java.util.linkedlist.checkelementindex(linkedlist.java:555) @ java.util.linkedlist.remove(linkedlist.java:525) @ com.run.findpalindromes.findmain(findpalindromes.java:20) @ com.run.findpalindromes.findmain(findpalindromes.java:16) @ com.run.test.main(test.java:7) and here source code: public boolean findmain(string in){ if(times == 0){ search = new linkedlist(cc.convertstringtoarraylist(in)); times ++; findmain(null); } else { if(search.get(search.size()-1).equals(search.get(0))){ search.remove(0); search.remove(search.size()); findmain(null); } else { system.out.pr...

ruby - Stop a while loop when a specific term/word is detected in the string -

i know how create code in ruby stop while loop not matter written long gets string contains word "yes". this have far: while start!="yes" #make stops loop if ex:"yes, please!!!" inputed. #does stuff start=gets.chomp end thank much. i think work, btw until same while negative condition. input = gets.chomp.downcase until input.include? 'yes' # stuff input = gets.chomp.downcase end

java - IllegalAnnotationException when moving from Oracle 10g to Weblogic (10.3.6) -

we're moving web application oracle 10g oc4j weblogic 10.3.6 , we're stuck on following illegalannotationexception: org.springframework.beans.factory.beancreationexception: error creating bean name 'userservice': invocation of init method failed; nested exception javax.xml.ws.webserviceexception: org.apache.cxf.service.factory.serviceconstructionexception @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1420) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:291) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingleton...