Posts

Showing posts from June, 2015

jQuery Validation Plugin query -

i have been trying add validation phone field accept 10 14 digits (other better uk phone validation methods welcome). i using jquery validation plugin. <form class="form" id="lg.callback.form" action="[[~[[*id]]]]" method="post"> <input type="hidden" name="nospam:blank" value=""/> <label for="name"> name: <span class="error">[[!+fi.error.name]]</span></label> <input id="name" type="text" name="name" value="[[!+fi.name]]" required /> <label for="phone"> phone: <span class="error">[[!+fi.error.phone]]</span></label> <input id="phone" type="text" name="phone" value="[[!+fi.phone]]" class="phone"/> <input type="submit" value="request call back"/> </form> ...

linux - JBoss 7.1.1.Final - accessing WS from remote address -

connecting ws remote host doesn't work while localhost works fine. i opened ports 8080 , 8443 found here: http://www.cyberciti.biz/faq/linux-unix-open-ports/ in standalone.xml added public interface http/https connectors and/or started jboss "-b 0.0.0.0" nothing helps. connection time outs. i'm using jboss 7.1.1.final.

javascript - On-Scroll animate script. It runs only once -

i want script run whenever user scrolls second div. second div in sense "content" div. first div header. on-scroll animate script. <!doctype html> <head> <script type="text/javascript"> $(document).ready(function(){ $('.content').scroll(function(){ if ($(this).scrolltop() > 100) { $(".header").animate({"height": "300px"},"slow"); } else { $(".header").animate({"height": "100px"},"fast"); } }); }); </script> <style> body{ margin:auto; overflow:hidden; background-color:#000; } .outer{ width:800px; border:thin solid; height:900px; background-color:#fff; margin:auto; } .wrapper{ width:800px; position:relative; z-index:100; height:900px; } .header{ width:800px; height:300px; border: thin solid #f00; background-color:#666; } .content{ width:800px; height:600px; overflo...

python - How to access a checkbox that's in a form in a Django template in view function in Django -

i have html file has form element. inside form have checkbox. how can access checkbox value when ticked inside views in django? when send post request can access data sent dictionary request.post. you should first read django forms documentation: https://docs.djangoproject.com/en/dev/topics/forms/

html - Dialog content does not get updated -

i have searched hours, , i've found stackoverflow questions related it, not find solution. have primefaces dialog displays content of log file. dialog shown when pressing button. problem once dialog displayed, content never updated. is, #{pvtrunner.pvtlog} method never called. how can make dialog call method every time displayed, not first time? <h:head> </h:head> <h:body> <p:dialog id="logdialog" header="pvt log" widgetvar="dlg" height="400" width="600" dynamic="true"> <h:outputtext id="logdialogcontnet" value="#{pvtrunner.pvtlog}" escape="false"/> </p:dialog> <h:form> <p:panelgrid id="mainpanelgrid" columns="1" styleclass="panelgridborder panelgridcenter"> .... <p:commandbutton id="showlog" value="show log" onclick="dlg.show()...

objective c - switch between multiple NSFetchedResultsController and animate it in the collectionView -

i'm trying change datasource (nsfetchedresultscontroller) of collectionview on fly. have var currentfetchesresultscontroller can change. after call reloaddata on collectionview. far good, cells not animated... i tried: [self.collectionview performbatchupdates:^{ [self.collectionview reloaddata]; } completion:^(bool finished) {}]; then following error: *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of sections. number of sections contained in collection view after update (4) must equal number of sections contained in collection view before update (1), plus or minus number of sections inserted or deleted (0 inserted, 0 deleted).' what's best way solve this? thanks in advance help. here discussed how update uicollectionview updated (not new) datasource without getting nsinternalinconsistencyexception. hope helps.

CSS DRY button states -

is there way this repeating same code? .button-hover { color: $button-hover-font-color; background-color: $button-hover-color; &:hover, &:focus, &:active, &:visited { color: $button-hover-font-color; background-color: $button-hover-color; } } yeah, try plain css syntax: .button-hover, .button-hover:hover, .button-hover:focus, .button-hover:active, .button-hover:visited { color: $button-hover-font-color; background-color: $button-hover-color; } or use mixin: (i know less syntax, guess it's similar whatever preprocessor using) .button-hover { color: @button-hover-font-color; background-color: @button-hover-color; &:hover, &:focus, &:active, &:visited { .button-hover(); } }

mysql - Sum query results -

i have query count of columns problem counting these counts results in new field select concat(u.firstname,' ',u.lastname) 'agent', count(case when pa.answer_text '%yes%' pa.answer_id end) yes, count(case when pa.answer_text '%no%' pa.answer_id end) no, count(case when l2u.lead_status_id in (4,5,8,39) l2u.lead_id end) pending, count(case when l2u.lead_status_id in (7,14,43) l2u.lead_id end) wrong_number, here problem .. correct syntax count(pending + wrong_number + yes + no) 'total' from user u, poll_votes pv, poll_answers pa, lead_to_user_original l2u u.user_id = pv.user_id , pv.answer_id = pa.answer_id , l2u.lead_id = pv.vote_lead_id , (pa.answer_client_one = '869' or pa.answer_client_two = '869') , pv.vote_date between '2013-07-01 00:00:01' , '2013-07-17 23:59:59' group u.user_id you can't access aliases in select clause in field in select. can "push" down sub-query, , this:...

ios - Xcode 4.6 how to connect Mysql database -

this question has answer here: what's best way connect iphone app (ios sdk) php/mysql backend 1 answer i'm sorry, beginner , not know do. :d please me couple of questions. i can't connected apps mysql server please help. how connect iphone apps mysql database? must in php on website? must do? must in xcode 4.6? thank effort. basically if want sql database in project right click on , choose new file there go core data , add data model file. can learn more core data here: http://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started

c - Create a DLL to share memory between two processes -

i need use dll's function similar linux shared memory. have little windows programming experience, think possible accomplish goal. want similar below: dll int x; void write(int temp) { x = temp } int read() { return x; } process 1: loaddll(); write(5); //int x = 5 process 2: loaddll(); printf(read()); //prints 5 since int x = 5 proccess 1 naturally example neglects race conditions , like, there simple way go this? i using microsoft visual studio 10 create dll. explain how write simple , build dll can loaded , called similar pseudo-code above? edit : shared memory segments , memory mapped files cannot used because processes creating in labview , lua not support above. do, however, support dlls why need "outdated" approach. by default, each process using dll has own instance of dlls global , static variables. see here .

javascript - How to bind data from two tables in PhoneJs? -

i have 2 tables: nom_articole { id(pk), denumire, nom_um_id(fk) } nom_um { id(pk), simbol, denumire } i want display: nom_articole.id nom_articole.denumire nom_um.simbol my html code: <div data-options="dxview : { name: 'nom_articoledetails', title: 'nom_articole' } " > <div data-options="dxcontent : { targetplaceholder: 'content' } " > <div data-bind="dxscrollview: { }"> <h2 data-bind="text: nom_articole.denumire"></h2> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">id</div> <div class="dx-field-value" data-bind="text: nom_articole.id"></div> </div> <div class="dx-field"> <div class="dx-field-label">denumire</div...

php - add product from one domain, to the cart of different domain(both are on same server) -

i have 2 domains abc.com , xyz.com both on same server, abc.com core php based shopping cart developed sell company product now abc.com main doamin , xyz.com has been created special marketing of specific product now,(what want) if clicks on product on xyz.com want redirect abc.com/cart.html( know redirection 1 domain another) show product selected user on xyz.com added cart. xyz.com has single page showing 3 products . the requirement both domains have store sessions @ same place. then have make client use same session id on both domains, that, pass session id in links , redirects go 1 domain another. <a href="http://xyz.com/cart.php?<?php echo sid ?>">cart</a>

c# - On closing browser tag delete particular data from sql database -

i using cookies, like... httpcookie id = new httpcookie("id"); id.value = "2" response.cookies.add(id); and using cookies in table unique cookies productid 1 2 1 2 2 3 3 2 4 4 1 1 5 1 2 6 2 1 now want process on browser close data stored in table having cookies value 2 in column(cookies) deleted. i mean after close of browser tag my table should seen as unique cookies productid 4 1 1 5 1 2 please me this might work. use javascript/jquery see if browser closing <script type="text/javascript"> $(function () { $(window).unload(function () { //run ajax webmethod call here }); }); </script> if above doesn't work in body <body onbeforeunload="closefunction();"> then create method called closefunction , run ajax webmethod the...

php - XPath getting text from all elements that match XPath query -

i having lot of difficulty constructing query return text elements below in 1 string (assume other elements on page contain text , not span or div elements) . note: because using php xpath engine, forced use solution xpath 1.0. html <div>hello</div> <div>world</div> <div>!!!</div> <span>this</span> <span>is</span> <span>cool</span> xpath normalize-space(//*/div | //*/span) desired output: hello world!!! cool i appreciate suggestions. many in advance! the normalize-space() xpath 1.0 function work on string - not on node-set. in example code have node-set it's first parameter: normalize-space(//*/div | //*/span) in such case, "string-value of node-set" string value of first node. not fitting needs. to best of knowledge not possible achieve you're looking single xpath 1.0 query alone . it's possible of php creating string you're looking registering php ...

ibm mobilefirst - Attaching cookie to WorkLight Adapter response header -

i developing mobile app using worklight 5.0.6 , attach secure cookie response returned adapter. we not using worklight authentication realm because not wish "bind" session specific wl server in clustered production environment. authenticate session calling sign-on adapter authenticates user details against end system. part of response sign-on adapter call create secure cookie (http only) containing authenticated information , attach response returned sign-on adapter. cookie should included in header subsequent adapter made application call server. regards, tom. i suggest trying create custom worklight authenticator communicates backend. documentation custom authenticator can found here: http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v600/08_04_custom_authenticator_and_login_module.pdf to answer question, here how approach without using custom authenticator: make adapter call authenticate client function authenticate(usernam...

vbscript - Jenkins not reading ERRORLEVEL -

i testing simple build process in jenkins; build section has execute windows batch command echo %errorlevel% cscript c:\users\user\documents\test.vbs echo %errorlevel% my test.vbs nothing except set errorlevel environment variable; tried using wscript.quit see if had effect on errorlevel dim wshell dim wsysenv set wshell = wscript.createobject("wscript.shell") set wsysenv = wshell.environment("system") wscript.echo "errorlevel=" & wsysenv( "errorlevel" ) wsysenv( "errorlevel" ) = 0 wscript.echo "errorlevel=" & wsysenv( "errorlevel" ) wsysenv( "errorlevel" ) = 2 wscript.echo "errorlevel=" & wsysenv( "errorlevel" ) wscript.quit 3 there no post build action console output follows: started user anonymous building in workspace c:\program files (x86)\jenkins\jobs\tads host-agent client\workspace [workspace] $ cmd /c call c:\users\user\appdata\local\temp\hudson4571...

html - How to get Full Path using JQUERY of a uploaded file when use <input type="file"> in all browser and why IE,Chrome gives "c:/fakepath/filname" return? -

this question has answer here: how resolve c:\fakepath? 8 answers jsf code link here here in code use <input type="file> , want full path after user browse file. html <input class="file_upfile" type="file" /> <input class="btn_showpath" type="button" value="show full path"/> <p class="p_upfilepath">full path display here<p> here use $('.classname').val(); function return filename.txt(e.g) in firefox , if use same code in ie , chrome return "c:/fakepath/myfilename.txt" jquery /* here <p> show file name, want full path of file "c:\something\folder\filename.txt" */ $('.btn_showpath').click(function(){ var getpath = $('.file_upfile').val(); $('.p_upfilepath').slideup(function(){ $(...

how to redirect system output to my gui app (qt, linux)? -

i need develop gui program wich run external bash script. script working 30-40 minutes , want see system output in application in real time. how can provide this? should use qtextstream? please give me examples. thanks. if launch script via qprocess, can output connecting readyread signal. it's matter of calling of read functions data , displaying on type of widget want, such qtextedit has append function adding text. something this: - // assuming qtextedit textedit has been created , in class // slot called updatetext() qprocess* proc = new qprocess; connect(proc, signal(readyread()), this, slot(updatetext())); proc->start("pathtoscript"); ... // updatetext in class stored pointer qprocess, proc void classname::updatetext() { qstring appendtext(proc->readall()); textedit.append(appendtext); } now, every time script produces text, updatetext function called , adding qtextedit object.

Local Interface to an external SOAP web service (C#) -

i want access methods of external class (web service) in parent method (the web service instantiated in child class) the scenario such : have mother class called convertcurrency takes in dollars , gives rupees. eg. int convertcurrency(int dollars); now there standard vendor out there in market provides software can host on server , create webservice. so, lets hosted @ 2 places : www.link-a.com/service.asmx , www.link-b.com/service.asmx. i have parent class : currencyconvertor, , has 2 subclasses : convertor-a , convertor-b. class currencyconvertor { protected object service; public convert(int dollars) { service.convertcurrency(dollars); } } class convertor-a : currencyconvertor { public convertor-a() { service = link-a.service; } } class convertor-b : currencyconvertor { public convertor-b() { service = link-b.service; } } // based on current response-time of 2 servers, decide // b faster , hence make d...

ruby - Need help to locate the text of element with class? -

i have file have got using command page.css("table.vc_result span a"), not able second , third span element of file: file <table border="0" bgcolor="#ffffff" onmouseout="resdef(this)" onmouseover="resemp(this)" class="vc_result"> <tbody> <tr> <td width="260" valign="top"> <table> <tbody> <tr> <td width="40%" valign="top"><span><a class="caddname" href="/usa/illinois/chicago/yellow+page+advertising+and+telephone+directory+publica/gateway-megatech_13478733"> gateway megatech</a></span><br> <span class="caddtext">p.o. box 99682, chicago il 60696</span></td> </tr> <tr> <td><span class="caddtext">cook county illinois</span>...

extjs - How to change alignment of toolbat Ext JS -

i have toolbar buttons. want buttons in toolbar aligned right. how can ? code items: [{ xtype: 'toolbar', dock: 'top', buttonalign: 'right', // 1 not wrok align: 'right', // 1 neither items: [{ text: 'foo1' }, { text: 'foo2' }, { text: 'foo3' }] }, { // other items }] add ext.toolbar.fill before other buttons: items: [ { xtype: 'tbfill' }, { text: 'foo1' }, { text: 'foo2' }, { text: 'foo3' } ] a shortcut use '->' : items: [ '->', { text: 'foo1' }, { text: 'foo2' }, { text: 'foo3' } ]

android - Find out whether the current activity will be task root eventually, after pending finishing activities have disappeared -

Image
if firstactivity root of task, , finishes , launches secondactivity , calling istaskroot() in secondactivity return false , because firstactivity 's finishing happens asynchronously , isn't done yet. waiting second , then calling istaskroot() returns true. public class firstactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); finish(); startactivity(new intent(this, secondactivity.class)); } } public class secondactivity extends activity { public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } @override protected void onresume() { super.onresume(); ((textview)findviewbyid(r.id.tv1)) .settext("istaskroot() in onresume(): " + istaskroot()); new handler().postdelayed(new runnable() { @override ...

sql - How can I find the next related (but slightly different) transaction in an Oracle table, possibly using LEAD? -

i have transaction table large number of events number of event types. i'm looking analysis on 2 related event types: transit-send , transit-receive. sample of table looks this: itemid | eventtype | transactiondate --------|-----------|----------------- 11111 | send | 2013-07-02 22222 | receive | 2013-07-02 33333 | receive | 2013-07-03 22222 | send | 2013-07-03 11111 | receive | 2013-07-04 55555 | send | 2013-07-05 22222 | receive | 2013-07-06 44444 | send | 2013-07-07 22222 | send | 2013-07-07 44444 | receive | 2013-07-08 55555 | receive | 2013-07-09 22222 | receive | 2013-07-10 33333 | send | 2013-07-11 what need find each pairing of send-receives, receive first following send: 11111 sent out on 7/2 , received on 7/4. 22222 sent on 7/3 , received on 7/6. however, 22222 received on 7/2 , 7/10. i tried using join quick results: select a.itemid, a.eventtype, a.transactiondate, b.eventtype, b.tra...

javascript - Pass "this" to a bootbox callback with Backbone -

i'm using backbone , bootbox. code inside view: confirm : function(result) { if (result === true) { var = this; this.model.set({completed: '1'}); // exception here this.model.save( null, { success: function (model, response) { backbone.history.navigate("index", true); }, error: function(model, response) { that.model.set({completed: '0'}); var responseobj = $.parsejson(response.responsetext); bootbox.alert(responseobj.message); } }); } }, completeprocess : function(event) { event.preventdefault(); this.model.set({completed: '1'}); bootbox.confirm("confirm?", this.confirm ); } i'm getting error: uncaught typeerror: cannot call method 'set' of undefine...

java - Calculate size of 1 minute PCM recording -

i want calculate how 1 minute of recording take. know samplerate, nr of channels , bit depth. from know, sample rate how many samples given second. bit depth how many bits in 1 sample. so, samplerate = 44100 bitdepth = 16 (2 bytes per sample) channels = 2 time = 60 sec my formula is: (44100 * (16 / 8)) * 60 = ~5 mb per minute. but i'm missing nr of channels, don't know how integrate in formula. know nr of channels when stereo recording, each frame composed 2 samples , when mono recording each frame composed 1 sample. please show me correct formula compute size of 1 minute recording. you need multiply number of channels size per minute (in bytes): samplerate * (bitdepth / 8) * channelcount * 60

angularjs - how to pass directive attribute to directive template? -

i'm have code: <div ng-repeat="param in item.parameters"> <rating param_item="{{param}}"></rating> </div> how can pass given attribute directive template? personally, creating child scope element directives: http://plnkr.co/edit/dz7fczat4kdrda869rwm?p=preview app.directive('rating', function() { return { restrict: 'e', scope: { paramitem: '@' }, link: function(scope, element, attr){ console.log(scope.paramitem); } } }); there couple other ways too, depending on how expect directive work.

symfony - GroupBy DAY using Doctrine2 -

i looking way group policies day. trying lot of examples how still there errors. can me this? here show 2 examples, others trying similar those. differences in used sql's functions ex(cast, substring, date...) first way trying is: $query = $this->getentitymanager() ->createquerybuilder(); $query->select('count(p), p.transactiondate') ->from('glpolicybundle:policy', 'p') ->andwhere('p.shop in (:shop_id)') ->setparameter('shop_id', $shop_list) ->andwhere($query->expr()->between('p.transactiondate', ':date_from', ':date_to')) ->setparameter('date_from', $date_from, \doctrine\dbal\types\type::datetime) ->setparameter('date_to', $date_to, \doctrine\dbal\types\type::datetime) -...

Does jQuery('#id').length always return 1? -

i having trouble figuring out why .length seems return 1 when counting elements having same id in page. know there should elements unique html id's in html document, in project working on, user may inadvertently add duplicates. so, normal behaviour jquery return 1 when counting elements id's? <div id="1">foo</div> <div id="1">foo</div> jquery(function(){ alert(jquery('#1').length); // returns 1 }); i have built example here: http://jsfiddle.net/esnzx/ thanks help returns 0 or 1. multiple elements same id not valid. it's not jquery or javascript restriction html one. check 7.5.2 element identifiers: id , class attributes official word that.

soap - ServiceStack WSDL creates empty portType element -

Image
i created soap1.2 web service servicestack. have client using axis2 platform create proxy class our service via wsdl; however, receiving error because porttype not contain methods (all of our operations appear under porttype name "isyncreply"). <wsdl:porttype name="ioneway"></wsdl:porttype> if manually edit wsdl , remove ioneway port type , things reference it, able add axis2 classes fine. is there way servicestack not output porttype async if there not operations defined asynchronous? edit: when trying add service reference using wcftestclient gives following error; however, appears add operations exist under i found answer... no, cannot turn off ioneway port binding in wsdl - appears this template used generate wsdl , port binding hard coded in template (see line 135-137).

What is the maximum string length I can store in GoInstant? -

rather deal lot of sub-keys i'd store large json structure. cause world end? a string can contain kind of data, long it's less 32 kb in length. which, reference, approximately 16 pages of text! the official docs have , more information keys: https://developers.goinstant.com/v1/javascript_api/key/index.html

Git list merged/unmerged tags -

with 3 primary development branches: patch minor major when create patch release tag patch branch: git tag -a my-project-1.2.3 -m "this 1.2.3 patch release of project" we want port changes forward. example, 1.3.0 minor development branch: git checkout minor git merge my-project-1.2.3 and 'very future' 2.0.0 major development branch: git checkout major git merge my-project-1.2.3 but... what happens if have performed merge on minor , , forgot merge major ? if branch, run: git branch --no-merged major which list branch. but, tags not included in list. how can determine whether tag has been merged branch, or list tags have not been merged specific branch? you other way around: git branch --contains **tag** lists branches tag merged.

python - django can't serialize non-model on post -

new django , trying send list of id's server update information. not want them model class, theres no need it. trying put them serializer make sure "clean". here code: view class: class update_cards(apiview): # seems necessary or throw error queryset = card.objects.all() def post(self, request, board_id, format=none): print request.data serializer = cardmoveserializer(data=request.data, many=true) #this throws error print serializer.data return response(serializer.data) serializer: class cardmoveserializer(serializers.serializer): card_id = serializers.integerfield() lane_id = serializers.integerfield() error get: [{u'lane_id': 21, u'card_id': 3}] #this show data coming across wire internal server error: /api/board/2/updatecards traceback (most recent call last): file "/library/python/2.7/site-packages/django/core/handlers/base.py", line 115, in get_response res...

php - How to send a string in a hyperlink to fill a field in a form? -

i need have value in text field auto filled pre-selected variable. can string sent through hyperlink , filled in html form "text" area? <form method="post" action='googler.php'> <label for="query">query</label><br/> <input name="query" type="text" size="60" maxlength="60" value="" /><br /><br /> in other words can "value" filled else if have used link page? nothing in url cause browser auto-populate field. any part of url (although query string parameter traditional) can used server side code set value attribute value when html generated. value="<?php echo htmlspecialchars($_get['foo']); ?>"

How to update SASS to alpha for use with COMPASS? -

i'm using compass (version 0.12.2) afaik automatically comes sass (version 2.9.2 media park) under ubuntu. in order being able use real source maps (since newer google chrome versions stopped supporting still current "debug_info" produced compass/sass in favour real source maps) i'd update sass version 3.3.0alpha can produce source maps. do gem install sass -v '>=3.3.0alpha' --pre , compass still work fine, or have wait updated version of compass comes 3.3 version of sass? any hint welcome. cheers, roman. yes, can install sass command line. then, run sass/compass sass --compass --sourcemap styles.scss:styles.css `

c# - Some clarity on LINQ/LAMBDA to retrieve data from an intersection table please? -

i have following entities: order -< orderitem >- product i need write linq retrieve order contains order items product id = 100. so started along line of: var order = order.where(r=>r.orderitems.productid == 100) ??? help required linq hugely appreciated. many thanks. var result = orders.where(o => o.orderitems.any(oi => oi.productid == 100));

java - How to view PDF data bytes using SWT Browser -

i have function returns byte array of pdf data, , want view in java swt application. not want use jars such icepdf, jpedal, etc. swt , java. one obvious solution write bytes file "c:/temp/file.pdf" , call browser.seturl("file://c:/temp/file.pdf"). want avoid using temp file if possible. i tried following, not work, because "settext" assumes mime type text/html. if swt provided settext(bytes,headers) method! any advice how this? public class mybrowser { static byte[] getpdfdata() { // details omitted } public static void main(string[] args) { shell shell = new shell(); shell.setlayout(new rowlayout(swt.vertical)); browser browser = new browser(shell, swt.border); browser.setlayoutdata(new rowdata(600, 300)); byte[] pdfdata = getpdfdata(); stringbuffer buffer = new stringbuffer(); buffer.append("content-type: application/pdf\n\n"); (int ...

c++ - Size of long vs int on x64 platform -

having read difference between long , int data types , long vs. int c/c++ - what's point? i'm trying generate outputs of sizeof(int) , sizeof(long) creating 32 bit exe , 64 bit exe. i'm using visual studio 2010 on windows 7 ultimate x64 sp1 , have selected x64 in configuration manager. pre-processor set win64. however, still sizeof(int) , sizeof(long) 4 bytes, no matter whether create 32 bit exe or 64 one. is there other compiler flag need set generate x64 exe (i cannot see generated exe in x64/debug folder of project)

rails slim very simple questions -

i'm new slim , there little things don't understand , don't find answers in documentation. linebreak - how can add @ end of line? example: <%= name %><br/> <%= address %><br/> how can combine pure html , ruby on same line? example: <p>new building <% if building.ownver %> <%= owner %><% end %></p> i know, must have missed there no real tutorial out there. btw, there no emulator convert erb slim? thanks. you can use converter html slim here's a link !

powershell - Encoding of the response of the Invoke-Webrequest -

when using cmdlet invokewebrequest against web non-english characters, see no way of defining encoding of response / page content. i use simple on http://colours.cz/ucinkujici/ , names of artists corrupted. can try simple line: invoke-webrequest http://colours.cz/ucinkujici is caused design of cmdlet? can specify encoding somwhere somehow? there workaround parsed response? it seems me correct :/ here 1 way content right, not dealing htmlwebresponseobject : invoke-webrequest http://colours.cz/ucinkujici -outfile .\colours.cz.txt $content = gc .\colours.cz.txt -encoding utf8 -raw this equally far: [net.httpwebrequest]$httpwebrequest = [net.webrequest]::create('http://colours.cz/ucinkujici/') [net.httpwebresponse]$httpwebresponse = $httpwebrequest.getresponse() $reader = new-object io.streamreader($httpwebresponse.getresponsestream()) $content = $reader.readtoend() $reader.close() should want such htmlwebresponseobject , here way e.g. stuff parsedhtm...

postgresql select minimum from a value pair of two columns -

i have table looks this: id | group | title | description | added | modified --------------------------------------------------- 1 | 1 | ... | ... | ... | ... 2 | 1 | ... | ... | ... | ... 3 | 2 | ... | ... | ... | ... 4 | 2 | ... | ... | ... | ... 5 | 3 | ... | ... | ... | ... now need select first row of every group value. think using distinct keyword kind of right direction here. using: select distinct group table; obviously return group values, not remaining fields: group ----- 1 2 3 does know how accomplish this? what i'm looking - in regard above example - kind of output: id | group | title | description | added | modified --------------------------------------------------- 1 | 1 | ... | ... | ... | ... 3 | 2 | ... | ... | ... | ... 5 | 3 | ... | ... | ... | ... thanks in advance!! select m...

html - having problems lining up a few objects on my form -

Image
i'm having problems getting buttons line up. here going: this i'd them do: here code: @using (html.beginform("logon2", "account", formmethod.post)) { <div> <fieldset> <legend>login</legend> <div class="editor-label"> @html.labelfor(m => m.username) </div> <div class="editor-field focus"> @html.textboxfor(m => m.username, new { @class = "generictextbox", onkeyup = "enablelogonbutton()" }) @html.validationmessagefor(m => m.username) </div> <div class="editor-label"> @html.labelfor(m => m.password) </div> <div class="editor-field"> @html.passwordfor(m => m.password, new { @class = "genericpasswordbox", onk...

libraries in Tomcat/lib not resolved when deploying using Eclipse -

i have following issue. have dao library using atomikos jta transaction manager. have web project includes dao library. , although tomcat lib folder includes required atomikos libraries, still need include atomikos dependency (maven) scope compile on library (such packaged along, or @ least eclipse knows has packaged along). if library not packaged along class not found exceptions when deploying under eclipse/sts. since atomikos libraries required development environments, don't want these libraries have scope compile (or runtime). how can change tomcat eclipse setup such can set atomikos dependencies scope provided in dao library. any suggestions?

Display sharepoint list data to dynamic html table using jQuery -

i having scenario need list data shown in dynamic html table using jquery display in site content editor webpart. please me out regards in advance... you can use sharepoint client context rest api data , display in table. add reference these 3 scripts: 1. /_layouts/15/sp.runtime.js 2./_layouts/15/sp.js 3. //ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js , use below example: <script type="text/javascript"> $(document).ready(function () { fngetdata(); }); function fngetdata() { context = new sp.clientcontext.get_current(); web = context.get_web(); var list = web.get_lists().getbytitle('users'); var myquery = new sp.camlquery(); myquery.set_viewxml("<view><query>" + "<where>" + "<isnotnull>" + "<fieldref name='title' />" + ...

php - How to echo an function -

i've been struggling echo output of function. tried this: echo 'myfunction('foo')'; .. won't work, due single quotes. suggestions? let's take function : function getstr() { return "hello"; } it return string, means, calling : echo getstr(); has same exact result calling : echo "hello"; which means, result of function can treated variable (except cant modify it), can whatever want result : $string = getstr() . ' - ' . getstr(); echo $string; // print "hello - hello";

HTML5 App on Windows 8 which cannot be closed -

i want create html5 application on windows 8 computer provides product information user in store. know if possible set windows 8 in such away, user cannot exit html5 app? this isn't possible on windows 8; released windows 8.1 has "kiosk mode", seems looking for. windows 8.1 kiosk mode locks systems single app : generally speaking, kiosk mode that’s intended use in corporate , shared computing settings — public information terminals. would, example, make excellent way lock point-of-sale terminal in “cash register” app , prevent would-be procrastinators tabbing out , surfing web.

python - How to check if an iterable can be traversed again? -

consider following code: def my_fun(an_iterable): val in an_iterable: do_work(val) if some_cond(val): do_some_other_work(an_iterable) break if an_iterable list / tuple , do_some_other_work whole list again. if an_iterable iterator or generator , receive rest of items in list. how differentiate between 2 cases? want do_some_other_work receive rest of items only. there's no general way tell whether can iterate on object repeatedly. file-like objects, in particular, screw checks. fortunately, don't need check this. if want make sure do_some_other_work gets rest of items, can explicitly request iterator: def my_fun(iterable): iterable = iter(iterable) # whatever.

Java - Spring - portlet API @Controller how to read ajax parameters -

i have following latest jquery v aajx call multiple parameters. in java code able first parameter value rest of them found null. $.ajax({ url : '<portlet:resourceurl id="entitledrequest"/>', data: '<c:out value="pfx= ${account.accountnumber}-${outletui.outlet}-${count}&acc=${account.accountnumber}" />', cache: false, success : function(result) { //targetelem.html(result); update ui } }); following java code first parameter not null after params null, have debug http request parameters present in request object clue whats wrong here ? controller("ajaxrequestcontroller") @requestmapping(value = "view") public class ajaxrequestcontroller implements portletconfigaware { @resourcemapping("entitledrequest") public void getserviceautocomplete(resourcerequest request, resourceresponse response) throws ioexception { string e...

opengl es 2.0 - Getting Black Color from Depth Buffer in Open GL ES 2.0 -

i'm working on simple 3d application opengl es 2.0, ios. what want wanna depth values of scene in depth buffer in fragment shader. so, created depth buffer 2d texture gluint texture; glgentextures(1, &texture); glbindtexture(gl_texture_2d, texture); glteximage2d(gl_texture_2d, 0, gl_depth_component, size.x, size.y, 0, gl_depth_component, gl_unsigned_int, null); self.dimension = ivvec3i_make(size.x, size.y, 0); self.bufferobjid = texture; and attached frame buffer depth attachment. glframebuffertexture2d(gl_framebuffer, gl_depth_attachment, gl_texture_2d, prd.bufferobjid,0); when render scene, depth buffer working correctly(depth test , depth write working perfectly). but, when assign depth buffer sampler in shader , render depth buffer screen using full screen quad plane, it's black. and, shader doesn't have problem because when assign normal texture sampler, renders texture correctly. this fragment shader. uniform sampler2d depthbuffer; void ma...

html - Remove duplicate elements from a drop down list using javascript -

this dropdown list box. want remove duplicate "apple" using javascript. <select id="fruits"> <option value="apple" >apple</option> <option value="orange">orange</option> <option value="mango">mango</option> <option value="apple" >apple</option> </select> this @dandavis answer reference, i'm adding as, know, public service. plus bit of formatting , couple of alternatives cover similar use cases. var fruits = document.getelementbyid("fruits"); [].slice.call(fruits.options) .map(function(a){ if(this[a.value]){ fruits.removechild(a); } else { this[a.value]=1; } },{}); if working select populated database (a pretty obvious use case) , values ids , innertext duplicates want remove. instead you'd want: [].slice.call(fruits.options) .map(function(a){ if(this[a.innertext]){ fruits.removechi...

javascript - webkitAudioContext event -

i used "ended" event execute javascript code on end of playback html5 audio. document.getelementbyid('audio').addeventlistener("ended",function() { // code }); however, needed low latency , decided use lowlag plugin ( http://lowlag.alienbill.com/ ), uses webkitaudiocontext webkit browsers. is possible detect when audio playback has finished webkitaudiocontext?

Infopath 2010 Form has to override previous form -

i new sharepoint . got job. there 2 infopath form form , form b. when user x logs system , make change form b , overrides form of same user. understanding of digging sharepoint taught me done workflow. can tell me how can done? right?

java - Convert pdf to byte[] and vice versa with pdfbox -

i've read documentation , examples i'm having hard time putting together. i'm trying take test pdf file , convert byte array take byte array , convert pdf file create pdf file onto disk. it doesn't much, i've got far: package javaapplication1; import java.io.bytearrayoutputstream; import java.io.ioexception; import org.apache.pdfbox.cos.cosstream; import org.apache.pdfbox.exceptions.cosvisitorexception; import org.apache.pdfbox.pdmodel.pddocument; public class javaapplication1 { private cosstream stream; public static void main(string[] args) { try { pddocument in = pddocument.load("c:\\users\\me\\desktop\\javaapplication1\\in\\test.pdf"); byte[] pdfbytes = tobytearray(in); pddocument out; } catch (exception e) { system.out.println(e); } } private static byte[] tobytearray(pddocument pddoc) throws ioexception, cosvisitorexception { bytearrayoutputst...

outlook - Replace images with media queries responsive emails -

i'm trying code responsive email, when user's resolution below 480px hide big images , replace them smaller background images. however, turns out background images not show in outlook on mobile nor on desktop. method of replacing big images smaller images in responsive emails? thanks! realistically design needs still "work" background images missing, if @ possible. outlook (by mean desktop application rather outlook.com, hotmail replacement) pretty worst email client when comes both supporting kinds of basic html/css features - campaign monitor css compatibility chart - , more modern stuff media queries - because outlook 2007, 2010 , 2013 version use microsoft word rendering engine… there is vml-based background image hack it's pretty horrible , not guaranteed work - wouldn't recommend. obviously need consider audience of email campaign, , unless have client demanding outlook support (though can try , explain situation) i've rather f...

java - Lucene Solr using complex filters -

i having problem specifying filters lucene/solr. every solution come breaks other solutions. let me start example. assume have following 5 documents: doc1 = [type:car, sold:false, owner:john] doc2 = [type:bike, productid:1, owner:brian] doc3 = [type:car, sold:true, owner:mike] doc4 = [type:bike, productid:2, owner:josh] doc5 = [type:car, sold:false, owner:john] so need construct following filter queries: give me documents of type:car has sold:false , if type different car, include in result. want docs 1, 2, 4, 5 document don't want doc3 because has sold:true. put more precisely: for each document d in solr/lucene if d.type == car { if d.sold == false, add result else ignore } else { add result } return result filter in documents of (type:car , sold:false) or (type:bike , productid:1). 1,2,5. get documents if type:car sold:false, otherwise me documents owners john, brian, josh. query should 1, 2, 4, 5. note: don't know types in documents. her...

android - Saving database to SDcard -

i'm trying save sqlite database sd card.i tried couple of things couldn't figure out , gave me errors,for example couldn't find table though creating database on sd card. ended deleting everything... what need add or change save sd card ? make clear,i'm not trying copy sd card,i'm trying save on sd card instead of internal storage. here's database far. public class backup_db extends sqliteopenhelper { private static final string db_name = "backup.db"; private static final int db_version_number = 1; private static final string db_table_name = "backup"; private static final string tag = "countriesdbadapter"; private final context mctx; private backup_db mdbhelper; public static final string key_rowid = "_id"; static final string db_column_1_name = "country_name"; static final string db_column_3_name = "country_price"; private static final string db_create_script = "create table " ...

MYSQL Php parsing error -

i unable figure out parsing error on piece of code. appreciated. echo "<li>"; echo "<a href=\"http://online.somewebsite.com/" . $info['path'] . >" . $info['value'] . "</a>"; echo "</li>"; echo '<li><a href="http://online.saomewebsite.com/' . $info['path'] .'">' . $info['value'] . '</a></li>';

javascript - How to dynamically change classes when DIV width changes? -

i know how change classes jquery when window size changed, need based on width of div , change dynamically when div's width changes. $(window).resize(function() { var wrapwidth = $('.info-wrap').width(); if (wrapwidth >= 500) { $('#partone').addclass('big'); $('#parttwo').addclass('big'); } else { $('#partone').removeclass('big'); $('#parttwo').removeclass('big'); } }); this works when window size changes. but, can use insead of $(window).resize width of div changes? i think you'll need use plugin jquery, such ben alman's plugin . i don't think there exists detects when div gets resize, window.

c# - How to get the object name of a changed checkbox-item? -

Image
i want .(name) -proterty of checkbox, has been changed? need little example shown on messagebox. little snippet: namespace checkboxes { public partial class form1 : form { public form1() { initializecomponent(); this.chkcar.name = "chkcar"; this.chkcar.text = "chkcar"; this.chkhouse.name = "chkhouse"; this.chkhouse.text = "chkhouse"; this.chksea.name = "chksea"; this.chksea.text = "chksea"; this.chkwood.name = "chkwood"; this.chkwood.text = "chkwood"; this.chkcar.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged); this.chkhouse.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedchanged); this.chksea.checkedchanged += new system.eventhandler(this.generalcheckboxitem_checkedch...

rest - Backbone model URL propertry is set but still getting error that it mut be specified -

i'm new backbone, , i've been successful model , view implementation. looking building restful back-end experiment aspect of backbone. so, i've created simple client test requests , responses. however, keep receiving error: a "url" property or function must specified seems me client problem, perhaps on server side. can explain why might getting error, of if setup wrong, why? var m_blog = backbone.model.extend({ defaults: { url:'/lib', title: null, date: null, content: null, keywords: null, } }); var = new m_blog({title:'t', date:'d', content:'c', keywords:'w'}); a.save({ success: function(model, response) { alert('success' + response.getresponseheader()); }, fail: function(model, response) { alert('fail' + response.getresponseheader()); } }); i've tried simple save call since, i'm not sure ye...