Posts

Showing posts from March, 2012

javascript to external .js file -

can't figure out proper syntax place javascript code .js file. <script type='text/javascript' src='http://hostedusa3.whoson.com:8080/include.js?domain=www.yourdomain.com'></script> <script type='text/javascript' > if(typeof swotrackpage=='function')swotrackpage(); </script> if want inline code inside separate file, have move contents of second script tag .js file. then, set src attribute second <script> reference new file's url (relative or absolute).

javascript - Disable option values in one select dropdown depending on value selected in another -

i have form 2 select dropdowns. first opening times , second closing times. when user selects opening time closing time cannot earlier this. my jquery instead disables second drop down values instead of times earlier can seen here: jsfiddle . $('#open').change(function(){ if($('#close').val()<$('#open').val()){ $('#close').prop('disabled', true); }; }) how can behaviour want? try (here updated jsfiddle ): $('#open').change(function(){ var = $(this); $('#close option').each(function() { if($(this).val() < that.val()) { $(this).prop('disabled',true); } else { $(this).prop('disabled',false); } }); }); it works on chrome 36, not on firefox (haven't tested browsers besides two). since behavior unreliable, might try dynamically adding options second select element b

How to fix the need to use sudo before starting Meteor? -

i have no clue why seem need use 'sudo mrt' everytime start meteor. need use sudo when installing mrt packages otherwise permission denied errors. i inspected folder on mac , seems have full read & write permission. i tried command sudo chown -rv [username] [directory] and still no luck, need keep using sudo meteor. how can take full ownership of folder , not have use sudo anymore when doing meteor? i guess installed meteorite local node module (this create node_modules directory in folder typed install command). you need install mrt globally using command : sudo npm install -g meteorite this install mrt users on system , won't need sudo run mrt. you can try reset ownership of meteor folder (i had issue 1 time). sudo chown -r $user:$user ~/.meteor if you're out of luck, try uninstall both mrt , meteor start scratch , detect procedurally problem is.

SQL database tag request -

i have photo table looks this: id title rating photopath 1 myself 7.0 /photopath1.jpg 2 cat 8.0 /photopath2.jpg 3 dog 6.0 /photopath3.jpg 4 girlfriend 5.0 /photopath4.jpg and tag table: id tag_name photo_id 1 selfie 1 2 sun 1 3 nature 2 4 relax 2 5 loyal 3 6 journal 3 7 selfie 4 8 sun 4 9 problems 4 and want call photos have tags "selfie" , "sun". how do that? select p.* photo p join (select p.id photo p join tag t on p.id = t.photo_id t.tag_name in ('selfie', 'sun') group p.id having count(*) = 2) x on p.id = x.id fiddle: http://sqlfiddle.com/#!2/5c95c2/2/0 output: | id | title | rating | photograph | |----|------------|--------|------------------| | 1 | myself | 7 | /photograph1.jpg | | 4 | girlfriend | 5 | /photograph4.

html - Open a different page for a download link -

hi have link on portfolio website downloads .exe file people can check out of work. the link <a href="downloads/project.exe">download here!</a> the problem have want open link. when person presses "download here!" download .exe , open html page have. any idea's on how this? thanks in advance <a href="javascript:opennew()">link</a> <script type="text/javascript"> function opennew(){ console.log("lets begin"); window.open("http://www.facebook.com"); window.location.href = "http://www.google.com"; } </script>

python 3.4 - Antlr4 Python3 target visitor not usable? -

i try follow antlr4 reference book , python3 target, got stuck in calculator example. on antlr4 docs says the python implementation of antlr close possible java one, shouldn't find difficult adapt examples python but don't yet. the java code visitor has .visit method , in python don't have method. think it's because in java visit method had parameter overloads of tokens. in python have visitprog() , visitassign() , visitid() etc. can't write value = self.visit(ctx.expr()) because don't know visit call? or missing instruction somewhere? the python2/3 targets not yet have visitor implemented. tried implement myself, , pull request send antlr guy see if did correctly. follow pull request here: https://github.com/antlr/antlr4-python3/pull/6

xcode - How to get NSTextFieldCell StringValue from NSTableView in cocoa -

i'm developing nstableview (cell based) app based in xcode5 , want each nstextfieldcell's cell determining row's height code far - (cgfloat)tableview:(nstableview *)tableview heightofrow:(nsinteger)row{ if (tableview == _tableview) { nstablecolumn *column = [_tableview tablecolumnwithidentifier:@"consecutivo"]; nstextfieldcell *cell = [column datacellforrow:row]; nsinteger occurences = [functions findoccurencesoftext:@"\n" inwholetext:cell.stringvalue]; if (occurences > 0) { return occurences * 17; } else { return 17; } } else { return 17; } } but cant string's cell value even if put nslog(@"text: %@", cell.stringvalue); all is text: any i'll appreciate

php - Prevent submit button from duplicate in form -

i'm generating form questions stored in database. don't understand how can prevent submit button duplicate every row (question)? want 1 submit button in end of form. // generate questions $query = "select * questions"; $result = @mysqli_query($con, $query); if ($result) { while($row = mysqli_fetch_array($result, mysqli_assoc)) { $body = $row['question_body']; $question_id = $row['question_id']; echo ' <tr> <form action="insert.php" method="post"> <td><input type="hidden" name="question_id" value="'.$question_id.'">'.$question_id, $body.'</td> <td><input type="radio" name="answer_value" value="1"></td> <td><input type="radio" name="answer_value" value="2"></td>

Testing JSON posts in Golang -

i trying test route created handle posting json data. i wondering how write test route. i have post data in map[string]interface{} , creating new request so: mcpostbody := map[string]interface{}{ "question_text": "is test post mutliquestion?", } body, err = json.marshal(mcpostbody) req, err = http.newrequest("post", "/questions/", bytes.newreader(body)) however, t.log(req.postformvalue("question_text")) logs blank line don't think setting body correctly. how can create post request json data payload in go? because that's body of request, access reading req.body , example : func main() { mcpostbody := map[string]interface{}{ "question_text": "is test post mutliquestion?", } body, _ := json.marshal(mcpostbody) req, err := http.newrequest("post", "/questions/", bytes.newreader(body)) var m map[string]interface{} err = json.newdeco

django - Pinterest API board paging -

can (educated) guess how paging works unreleased pinterest api ? for example, link: https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/ returns first 50 pins of specific board. contains 101 pins. how retrieve page 2 , 3 ? since api not public, can't maybe happens know or can guess. thanks edit: i've tried: https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/page/2/ https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?page=2 https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?p=2 https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?offset=2 pinterest based on django uses rest framework. ideas? even if using framework (like drf) have million ways set query structure. if wanted reverse-engineer non-published api still open either use wireshark or fiddler2. start using website , see sort of requests being made, figure out request pattern , build own api against ad-hoc api. option watching n

post - Send random value with curl to server -

let's have html form looks this: <form method="post" action="anmeldung.fcgi" onsubmit="return chkform()"> <input type=text name="person"> <input type=hidden name="id" value="1234"> <!-- value generated --> <input type=submit name="press" value="ok"> </form> the value id generated mechanism not known , every time visite site other value. let's script, collects data checks if id correct , rest of code called. is there way curl send data correct id server? can read out page , send server anyway? think have use same "instance" of html file or this? it sounds multi-step process, scripted easily. first, use curl url of form, so: curl http://hostname/path/to/form.html then, parse content returned above request, pull value stuffed in hidden id field. then, use curl post anmeldung.fcgi, setting form inputs posted, so: curl

I need help getting JavaFX to work in Eclipse -

i downloaded java sdk again (like says here: http://www.oracle.com/technetwork/java/javafx/downloads/index.html ) javafx isn't showing when right click on project. (if matters using scala plugin on eclipse) i went here: http://www.eclipse.org/efxclipse/install.html got stuck @ step 4/5 tells me 'the installation cannot completed requested" then says: cannot complete install because 1 or more required items not found. software being installed: e(fx)clipse - ide - kepler 0.9.0.201401250805 (org.eclipse.fx.ide.all.kepler.feature.feature.group 0.9.0.201401250805) missing requirement: e(fx)clipse - ide - fxgraph 0.9.0.201401250805 (org.eclipse.fx.ide.fxgraph.feature.feature.group 0.9.0.201401250805) requires 'org.eclipse.xtext.sdk.feature.group 2.5.0' not found cannot satisfy dependency: from: e(fx)clipse - ide - kepler 0.9.0.201401250805 (org.eclipse.fx.ide.all.kepler.feature.feature.group 0.9.0.201401250805) to: org.eclipse.fx.ide.fxgraph.feature.featu

javascript - Make Tablesorter work on Blogger -

i've run problem trying run jquery plugin tablesorter on blogspot blog. tried example on tablesorter page see if work @ all. wrote following general html of blog right before closing tag: <script src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'/> <script src='https://github.com/christianbach/tablesorter/blob/master/jquery.tablesorter.js' type='text/javascript'/> i added css directly blogs css well. , @ least seems working (apart background image arrows in it, seems more tied actual script rest of css, might indicator of script not working...) then started page , kind of copy , pasted following it. <script type="text/javascript">$(document).ready(function(){$("#mytable").tablesorter();});</script><br /> <table class="tablesorter" id="mytable"><thead> <tr> <th>last name</th><th>first name</th><th>email</t

c# - Use LINQ XML with a namespace -

i trying find nodes in xml document this: <?xml version="1.0"?> <trainingcenterdatabase xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://www.garmin.com/xmlschemas/trainingcenterdatabase/v2"> <activities> <activity sport="cyclingtransport"> <id>2014-07-08t15:28:14z</id> </activity> </activities> </trainingcenterdatabase> i aim extract node value 'id' code this: xdocument doc = xdocument.load(filepath); list<string> urllist = doc.root.descendants("id") .select(x => (string)x) .tolist(); console.writeline(urllist.count); however count 0, expect 1. after debugging , editing xml noticed if change trainingcenterdatabase node , remove attributes this: <trainingcenterdatabase> then result count of 1 expected.

Change Checkbox Label in Bootstrap Based on Screen Size -

i using bootstrap 3.2.0, , have checkbox label: show hidden posts . on small screens (xs) label show hidden save screen space. can within bootstrap? need use javascript? wrap word posts in hidden-xs show hidden <span class="hidden-xs">posts</span>

using nltk regex example in scikit-learn CountVectorizer -

i trying use example nltk book regex pattern inside countvectorizer scikit-learn. see examples simple regex not this: pattern = r''' (?x) # set flag allow verbose regexps ([a-z]\.)+ # abbreviations (e.g. u.s.a.) | \w+(-\w+)* # words optional internal hyphens | \$?\d+(\.\d+)?%? # currency & percentages | \.\.\. # ellipses ''' text = 'i love n.y.c. 100% of traffic-ridden streets...' vectorizer = countvectorizer(stop_words='english',token_pattern=pattern) analyze = vectorizer.build_analyzer() analyze(text) this produces: [(u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u''), (u'', u'', u

Side bar navigation that shows in desktop and pushes on mobile -

i have been trying create vertical left sidebar navigation shows when window size desktop size , collapses when users resizes window, shows hamburger icon, , when user clicks icon pushes navigation out. trying find solution everywhere. admin dashboard building. please help. thank in advance.

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

cryptography - How to use crypto.createSign with a DiffieHellman private key in node.js? -

i'm trying use dh private key sign message node crypto lib. i'm running error can't seem fix :{ var crypto = require("crypto"); var bob = crypto.getdiffiehellman("modp17"); bob.generatekeys(); var sign = crypto.createsign("rsa-sha256"); sign.write("hello world"); var message = sign.sign(bob.getprivatekey()); error 140735140705040:error:0906d06c:pem routines:pem_read_bio:no start line:../deps/openssl/openssl/crypto/pem/pem_lib.c:703:expecting: private key error: signfinal error @ sign.sign (crypto.js:398:27) @ repl:1:18 @ replserver.self.eval (repl.js:110:21) @ repl.js:249:20 @ replserver.self.eval (repl.js:122:7) @ interface.<anonymous> (repl.js:239:12) @ interface.emit (events.js:95:17) @ interface._online (readline.js:202:10) @ interface._line (readline.js:531:8) @ interface._ttywrite (readline.js:760:14) the private key getprivatekey() not in pem format, what si

javascript - How to disable sorting on column in jQuery.tablesorter? -

i try find way how disable sorting on column. use jquery plugin tablesorter . , default if click on header cell sort column data, need if don't need use sorting on 1 or 2 column in 4 columns table. thanks in advance. you must pass appropriate parameters @ initialization, example: { ... headers: { 0: { sorter: false} } } for more information, check manual at: http://tablesorter.com/docs/

javascript - Display the data in <div> into popup using JQuery -

<script type="text/javascript"> $(document).ready(function() { $("#popup_div").dialog({ autoopen: false }); $("#btn_click").click(function() { $("#popup_div").dialog("open"); //$("#popup_div").toggle("100", $("#popup_div").dialog("close")); }); }); </script> i wrote function display data in popup , popup close. need popup stays sometime after clicking close button close. try this, $("#btn_click").click(function () { $("#popup_div").dialog("open"); }); // code close dialog, let btnclose id of button in popup_div $("#popup_div").on('click','#btnclose',function(){ $("#popup_div").dialog("close"); }); demo

Hibernate - Commit one item at a time within a list (ignoring the failed ones) -

how can commit 1 item @ time in hibernate. have arraylist of items. need save of them db.. in case records fail due "being dirty".. m ok ignore , move on other ones. tried committing records in loop below session.begintran.. loop { try { session.update(item) session.commit() } catch(exception e) { //log & ignore } } this gave me "nested tran not possible" error.. moved begintran inside loop.. m observing is.. if first record fails, each commit tries update same record again though {item} object gets next 1 list, within loop loop { try { session.begintran session.update(item) //eventhough item object gets loaded within loop.. every time commit executed, trying save first failed record again. session.commit() } catch(exception e) { //log & ignore } } hibernate exceptions not recoverable. leave session in inconsistent state, making further usage unreliable. exception thr

java - What is LinkedHashMap and what is it used for? -

when going through example code has listviews came linkedhashmap . linkedhashmap , can use , how? went through several articles did not understand fully. necessary when creating listview . connection between listviews , linkedhashmaps? thank you. for simplicity, let understand difference between hashmap , linkedhashmap . hashmap : gives output in random orders means there no proper sequence how have inserted values. whereas linkedhashmap : gives output in sequential order. let see small example: hashmap // suppose have written program . . // use hashmap hashmap map = new hashmap(); // create object map.put(1,"rohit"); // insert values map.put(2,"rahul"); map.put(3,"ajay"); system.out.println("map=" +map); //print output using concatenation //so output may in order can output may as: map={3=ajay,2=rahul,1=rohit} but not case in linkedhashmap replace "hashmap&

sql server - Incorrect syntax near '?' -

i getting exception incorrect syntax near '?' . query passing 1 parameter activity_report_id select a.activity_report_id,report_start,report_end , voyage_ref,voy_status,vsl_name,charterer_name,cp_date , appr_days_gross,appr_days_offhire , appr_days_net,appr_revenue,appr_expense,appr_tce_gross , appr_tce_gross_daily,appr_exp_daily_pool_fees,comm_pcnt , appr_comm_amt,appr_tce_net,voy_start_date,voy_end_date , appr_tce_net_daily,report_start,report_end,net_pool_tce , daily_net_pool_tce,gross_pool_tce,daily_gross_pool_tce pa_ref_activity_report_dtls inner join pa_ref_activity_report_summary b on a.activity_report_id=b.activity_report_id a.pool_id=1 , a.activity_report_id=? , caller_type='activity_report'

authentication - Add Federation(SSO) protocol plugin to my website for Single Sign On -

i have openam identity management , website needs credentials loggin in. want federate website google. web site doesn't support federation protocol. how can this? there module or plugin each protocol deploy in site? should change source code ? you should potentially set federation between google , openam, , use policy agent or openig protect application. even though both agents , openig tries make integration transparent possible, may necessary modify application (for example ensure app reads user name out of http request header/cookie/etc, , possibly other modifications interact application's authorization framework).

go - What is the difference between new and make? -

new not initialize memory, zeros it. returns pointer newly allocated 0 value. make creates slices, maps, , channels only, , returns them initialized. what "initialized" mean in context? other differences there between new , make? as mentioned in making slices, maps , channels : the built-in function make takes type t , must slice, map or channel type , optionally followed type-specific list of expressions. it returns value of type t (not *t ). memory initialized described in section on initial values . for instance, slice type make([]t, length, capacity) produces same slice allocating array , slicing it, these 2 expressions equivalent: make([]int, 50, 100) new([100]int)[0:50] so here, make creates slice, , initialize content depending on 0 value if type used (here int , ' 0 ') you can see more need of keeping new , make separate in go: why make() or new()? dave cheney wrote article: " go has both make , new func

c++ - an optimal select function for vector extensions? -

opencl has select function , usable all-vector arguments. both clang , gcc support vector types well, gcc supports ternary operator supporting vectors , none of them has opencl-like select function yet. i've tried implement replacement, results non-optimal, both gcc , clang producing conditional jumps. however, gcc pretty job ternary operator, serves drop-in replacement. optimal solution select -like function exist (particularly under clang) , it? here non-optimal ideas: template <typename u, typename v> inline v select(u const s, v const a, v const b) noexcept { // loop gives horrible results /* constexpr u zero{}; // clang return (-(s != zero) * a) - ((s == zero) * b); */ return v{ s[0] ? a[0] : b[0], s[1] ? a[1] : b[1], s[2] ? a[2] : b[2], s[3] ? a[3] : b[3] }; // 4-component vectors only, 1 generalize indices trick /* return s ? : b; // gcc */ } this compiles semi-good code under both gcc , clang: template <typename u, type

java - Implement clearing prefilled fields/ check if answer is correct -

i want change followingmethod thelastname field not pre filled , checks in private boolean isinputvalid if entered value equal thelastname field. @ moment field pre filled , checks if field empty or not. how should code looks 2 changes? package ch.makery.address.view; import javafx.fxml.fxml; import javafx.scene.control.textfield; import javafx.stage.stage; import org.controlsfx.dialog.dialogs; import ch.makery.address.model.person; /** * dialog train word. * * */ public class englishtraindialogcontroller { @fxml private textfield firstnamefield; @fxml private textfield lastnamefield; @fxml private stage dialogstage; private person person; private boolean okclicked = false; /** * initializes controller class. method automatically called * after fxml file has been loaded. */ @fxml private void initialize() { } /** * sets stage of dialog. * * @param dialogstage */ public voi

android - Add fragment and update actionbar title -

i know question refreshing actionbar title has been answered. problem quiet different. i use fragments add method , not replace method reasons. previous fragment not destroy , when back, previous fragment aren't not recreating. this configuration : fragment title "fraga" > fragment b title "fragb" when go fragment fragment b actionbar title should "fraga" stay "fragb". problem add method fragment not recreating , didn't find event refresh it. the simple solution found : 1- fragb.onresume : save previous action bar title 2- fragb.ondestroyview : restore previous actionbar title with solution, result ok, found solution not clean. there better way refresh actionbartitle using add method fragments ? you can override onbackpressed of activity , each time pressed name of fragment backstack know fragment current at. sample: @override public void onbackpressed() { super.onbackpressed(); int

php - Symfony2 Dependency Injection Service Scoping Performance -

from purely performance perspective, there difference between request , container scoping services? the reason ask because writing few services end gathering definitions of tagged services via compiler pass. holder service doesn't contain definition (as require proxymanager , lazy services), service id. however if definition retrieved holder, can lead errors if 1 of tagged services holds dependant on request scoped service. the simple solution request scope holder, efficient?

objective c - iOS display message on lockscreen -

one of our clients asked functionality: "permanently display message (or image) on iphone lockscreen". our initial ideas were: changing device lockscreen image: couldn't find solution doing this. couldn't find private api it. playing audio in background , display album artwork. has few problems: we cannot hide volume , track buttons display notification: the notification go away after user skips lockscreen any ideea how can accomplish request. please note app not intended distributed via appstore. internal app only. should work on non-jailbreak devices through . app enterprise distribuited. kind regards, artwork if it's not intended app store, use artwork thing. since don't need comply ios guidelines, warn users lockscreen buttons won't work if try using them. link , one should help. using ios 7 background fetch can manage messages display, long app has been opened once. know if app opened, can send ping server saving

ExtJs 5 Sencha-Charts adding listener -

hi having hard time figure out what's wrong on sencha-chart bug or syntax error. start have application uses new sencha-charts of extjs 5. after adjusted came ff codes working problem when add listener it, listener event not working. please can me on this.: items: [{ cls: 'chartclass', xtype: 'chart', flex: 1, interactions: [{ type: 'panzoom', zoomonpangesture: false, axes: { left: { maxzoom: 1 } } }], bind: '{chartstore}', minheight: 350, animation: true, style: 'background: #fff', insetpadding: '40px 40px 20px 30px', width: '100%', height: 500, insetpadding: 40, interactions: 'itemhighlight', axes: [{ type: 'numeric', position: 'left', fields: ['utilcost'], fontsize: 12

ios - Custom text field autocorrection -

is possible customize autocorrection of keyboard when entering text text field? in app, have text field rather long technical terms have entered. if provide additional dictionary frequent terms, incredibly users. i've searched documentation of current ios version , had peek @ new ios 8 documentation. quicktype seems similar i'm looking for. configurable? i hope it's doable without creating custom keyboard. don't think that's way go. no, @ moment of writing not possible add or alter autocompletion or autocorrect library apple uses in combination it's keyboards. apple doesn't allow "tampering" it's autocompletion/correction , reason since context aware , self learning. alternatives can consider: 1. create own keyboard own "quick type" probably not best option, since don't want alter keyboard autocompletion. 2. add kind of autocompletion in app there autocomplete libraries htautocompletetextfield , there

windows - Passing install parameters to MSI installer with Puppet -

programs installed pc running windows 7. in past have installed program this: msiexec /qn /i "c:\installer.msi" i automate installation puppet. package {'program': ensure => '3.1', source => '\\server\installer.msi', install_options => [ '/qn', '/i'], } however there parameters not accept installer. either puppet gives error of "invalid command line arguments" or parameters wont applied. i have tried using different syntaxes: parameters inside same quotes, different order of parameters, 1 parameter @ time... nothing has worked. what correct way of passing them? this because puppet windows package provider passes arguments /i , /qn. msiexec fails if pass /i twice. try running without install options.

upload both form and file using ajax in jquery validation plugin in php -

these form <form action="<?php echo base_url();?> candidate/ajaxadd" name="candidate_form" method="post" id="candidate_form" enctype="multipart/form-data"> these ajax function in jquery validation plugin submithandler: function(form) { var formdata = new formdata($(this)[0]); $.ajax({ url: form.action, type: form.method, data: formdata, async: false, complete: dispaly_candidate, success: function(response) { alert(response); if(response == "false"){ alert("please enter fields"); } }, cache: false, contenttype: false, processdata: false }); i don't understand question but: submithandler = function(fo

android - java.lang.IllegalStateException: get field slot from row 0 col 25 failed -

i trying create android app using greendao, erp kind of project practically not possible post code here, going share related code querybuilder<partycommunication> partycommquerybuilder = partycommunicationdao.querybuilder(); partycommquerybuilder = partycommquerybuilder.where( partycommunicationdao.properties.commtype.eq("alert"), partycommunicationdao.properties.referencecategory.eq("low stock")); list<partycommunication> listofpartycomm = partycommquerybuilder.list(); partycommunication daopartycommunication = listitr.next(); long reference_entity_key = daopartycommunication.getreferenceentitykey(); product product = daosessionuni.getproductdao().load(reference_entity_key); productdetail productdetail = new productdetail(product); integer inventoryqoh= productdetail.getinventoryqoh(); i getting exception in line product product = daosessionuni.getproductdao().load(reference_entity_key); w

PHP while loop multiple conditions returning no data? -

i have php page returning data mysql table. decided add feature allow user set number of results want displayed, in case there thousands of records example. here php code displays data: while ($row = mysql_fetch_array($result) && ($row <= $noofresults)) { echo '<p class="display-date">' . $row['date'] . '</p><p class="display">' . $row['id'] . ' - ' . base64_decode( $row['packetdata']) . '</p>'; echo '<hr align="center" width="100%" />'; echo $noofresults; } i hoping display data point user has selected. if user selects 10 results, $noofresults set 10, , fetch first 10 results database. displaying "-" , $noofresults variable (which desired @ point). syntax wrong or not correct method of going such problem? thanks, got working limit, didn't think that. can explain why downvoted, trying learn, write bett

laravel - A many to many relationship -

i've read docs on relationships , have few questions. i have user , role table. relationship many many. user has many roles , role can belong many users. have set pivot table , have used belongstomany in each model. surely user hasmany roles , role belongstomany users. but when use hasmany, queries not work expected. wording thing , both should belongstomany? i wanted know defining relationship on each model - need or can defined on users? the hasmany relationship defining 1 many relationships , why break queries. i can see why thinking along lines of user having many roles, english user belongs many roles , role belongs many users. you don't need define relationship on both models if going query 1 model , it's relationship. can definitively never need query relationship on roles?

system verilog - in UVM RAL, a reg defined as no reset value, but set/update a '0' data on it won't trigger bus transaction -

in ral file, have like: class ral_reg_aaa_0 extends uvm_reg; rand uvm_reg_field r2y; constraint r2y_default { } function new(string name = "aaa_0"); super.new(name, 32,build_coverage(uvm_no_coverage)); endfunction: new virtual function void build(); this.r2y = uvm_reg_field::type_id::create("r2y",,get_full_name()); this.r2y.configure(this, 12, 4, "rw", 0, 12'h0, 0, 1, 1); endfunction: build `uvm_object_utils(ral_reg_aaa_0) endclass : ral_reg_aaa_0 you can find r2y set has_reset = 0 , in real rtl, it's 'x' value default if use set/update mechanism write reg, if write data 0 , equal reset value in r2y (even has_reset = 0 ), seems ral treat m_mirror == m_desired there won't bus transaction reg access. like env.regmodel.aaa_0.r2y.set(0); env.regmodel.aaa_0.update(status,uvm_frontdoor); does make sense? thought no matter value set these kind of regs, there should bus transaction happening. ps: mirrored , desired

php - javascript or htaccess rewrite url -

recently walked through many .htaccess rewrite url(user-friendly url) tutorials.that write url following. domain.com/product/item1 i want know there way type of stuff javascript? may not possible following kind of stuff may possible javascript domain.com/index.php/my-product example webbsite: http://10deals.in/index.php/beauty-spas i tried google stuff failed.plz link tutorial or explain this. any appreciated... you can't. your url try load file path, since js runs it's loaded, client-side. then, redirect bit pointless.

bash - ffmpeg capture current frame and overwrite the image output file -

i trying extract image file rtsp stream url every second (could every 1 min also) , overwrite image file. my below code works outputs multiple image jpg files: img1.jpg, img2.jpg, img3.jpg... ffmpeg -i rtsp://ip_address/live.sdp -f image2 -r 1 img%01d.jpg how use ffmpeg or perhaps bash scripts in linux overwrite same image file while continuously extract image @ not high frequecy, 1 min or 10 sec? following command line should work you. ffmpeg -i rtsp://ip_address/live.sdp -f image2 -updatefirst 1 img.jpg

entity framework - how to pass linq query in datatable -

i want collect rows , pass datatable. linq query: var queryall = in db.tblmake select ; datatable dt = new datatable(); how can pass queryall datatable dt? if try : ienumerable<datarow> queryall = in db.tblmake.asenumerable() select all; comes error: cannot implicitely convert type 'system.collection.generic.ienumerable<workshop2s.models.tblmake>' 'system.collection.generic.ienumerable<system.data.datarow>'

ejabberd - Can't add dependecy to Mongooseim[erlang] -

hello writing module mongooseim(ejabberd fork) chat, want external library github. added rebar config. {jsx, ".*", {git, "git://github.com/talentdeficit/jsx", {branch, "master"}}} it downloading /deps directory while when run project have following error: call undefined function jsx:encode i find directory /ebin directory copying (/dev/lib/ebin) , copy ebin directory jsx there. function accessible. impossible manually each time, how can make rebar? thank you. update: build make dev rel: the following happens: devrel: $(devnodes) $(devnodes): rebar deps compile deps_dev @echo "building $@" (cd rel && ../rebar generate -f target_dir=../dev/mongooseim_$@ overlay_vars=./reltool_vars/$@_vars.config) cp apps/ejabberd/src/*.erl `ls -dt dev/mongooseim_$@/lib/ejabberd-2.1.8*/ebin/ | head -1` ifeq ($(shell uname), linux) cp -r `dirname $(shell readlink -f $(shell erl))`/../lib/tools-* dev/mongooseim_$@/lib/ els

mod dav svn apache custom log -

are there additional details svn repo or file can logged when creating custom apache log, besides {svn-repos-name} , {svn-action} mod dav svn , apache? logformat "%{%y-%m-%d %t}t %u@%h %>s repo:%{svn-repos-name}e %{svn-action}e (%b bytes in %t sec)" svn_log customlog /var/log/httpd/subversion_log svn_log env=svn-action update: i confirm target dir recorded in log file no changes code above. tested on root repo folder, no folder recorded on log. i confirm file logged no changes code above, when opened tortoise svn -> repo browser, text editor notepad++. if file opened example internet explorer, get-file action not recorded in logfile. the question still stands info only: there additional params can added logformat line ? thank in advance. there svn-repos environment variable, holds full filesystem path repo (as opposed svn-repos-name , holds basename). see section on apache logging in svn documentation details. in addition svn-action , svn

cocoa touch - Dynamically sizing text with kerning to occupy the full width of a UILabel -

Image
i have layout uilabel placed above fixed width view, shown below grey rectangle. the text needs match width of fixed grey view. i achieved setting adjustsfontsizetofitwidth property on uilabel yes , settings font size large, , setting minimumscalefactor suitable small. this worked fine until… i had add kerning said text. added kerning applying @{nskernattributename: @1.40} attributed string , passed attributed string uilabel ’s attributedtext property. unfortunately seems stump automatic scaling, results in text being kerned end of string truncated. though label scaled text down without taking kerning account. how can given string with kerning rendered width of choosing (i.e. grey view's width)?

java - Formatting errors - issues with code formation -

Image
i have experienced various minor errors forming code, , having difficulty resolving them. in particular, have following line underline following message query.findinbackground(new findcallback<parseobject>() { method findinbackground(findcallback<parseuser>) in type parsequery<parseuser> not applicable arguments (new findcallback<parseobject>(){}) as errors closing statements. and below complete code any appreciated. in advance update: updated code public class fragment1 extends fragment { public interface constants { string log = "com.dooba.beta"; } private string currentuserid; private arrayadapter<string> namesarrayadapter; private arraylist<string> names; private arraylist<string> age; private arraylist<string> headline; private arraylist<string> activityname; private arraylist<images> alprofilepicture; private listview userslistvie