Posts

Showing posts from 2013

php - How to use parameters -

lets have url: /people/1/friends both people , friend objects, 1 person can have many friends friendcontroller looks this class friendcontroller extends controller { public function indexaction() { $em = $this->getdoctrine()->getmanager(); $entities = $em->getrepository('epiforumbundle:friend')->findall(); return $this->render('epiforumbundle:friend:index.html.twig', array( 'entities' => $entities, )); } } this index action works can see returns every friend in database. friends 'people_id' == 1. how can select wanted friends? in other words, how can parameter tells specific person? update routes friend: pattern: / defaults: { _controller: "epiforumbundle:friend:index" } first, name param in indexaction - symfony simple contoller second, use findby() method on repository: public function indexaction($peopleid) { $em = $this->getdoctrin

c# - Have to click away twice from Calendar in WPF -

edit 2: thank feedback. solved problem adding selecteddateschanged event: mouse.capture(null); when select date in calendar, want click "go" button. however, need click "go" button twice: once de-focus calendar, , again press it. mouse leave event not trigger on calendar if item selected inside of it, , keyboard.clearfocus() not de-focus either. please, how can rid of calendar's focus whenever select date? thank you! edit: clicking "go" button next merely example; if want select textbox , have selected date, have click twice enter textbox. main issue that, once calendar interacted with, must clicked out of once before interacting other elements. i solved problem adding selecteddateschanged event: mouse.capture(null);

ios - Save a NSArray to iCloud and retrieve it -

i have app saves nsmutablearray file in documents directory on ipad. saved [residentdata writetofile:filepath atomically:no]; and read in by; residentdata = [[nsmutablearray alloc] initwithcontentsoffile:filepath]; i need write file icloud, data needs available across several devices. have tried following create file in icloud; nsdata *myfiledata = [nskeyedarchiver archiveddatawithrootobject:residentdata]; [filemanager createfileatpath:[icloudurl path] contents:myfiledata attributes:nil]; which indeed create file in correct place. struggling though understand how read file nsmutablearray (residentdata). have tried; residentdata = [nskeyedunarchiver unarchiveobjectwithdata:myfiledata]; but doesn't decode array correctly. please can show me error of ways - suspect fundamental misunderstanding on part of nsdata blame, pointers welcome. it clicked, approach wrong. don't need use of above. once have done the; [filemanager setubiquitous:yes itematurl:c

ajax - Backbone.js: is it possiblie to secure server data from crawling? -

i new front end web development , have basic questions regarding security issues regarding backbonejs (probably ajax in general). i working on mobile apps while now, , of them build api handles requests , provides data application in json format. when using app, can add security access data using api secret keys , such. way can make sure whoever asking data allowed json data application and, theoretically, wouldn't able make lots of requests api in order download raw data own purpose. server (api) runs on nodejs mongodb db server. the problem mobile app working, need make web interface alternative users interact application. have seen examples of backbone.js , impression have 1 use it, server must openly provide data in json format. if this, able make requests , data endpoint. believe because of way ajax works. so, if wanted serve data html, not raw json data, still possible use backbone.js? thinking like: browser makes request web server web server gets data api api vali

android - Why will my cursor only iterate 1 column at a time through my SQLite database even if I am selecting 2 columns? -

i have set query , cursor. problem cursor seems moving 1 column @ time. table set first column description string, second column grade value , third column weight value. this query: string[] columns = {calc_db.column_grade_value, calc_db.column_weight_value}; cursor cursor = openclass.getbd().query(calc_db.table_name, columns, null, null, null, null, null); i trying retrieve grade , weight value can put them in list. cursor.movetofirst(); while (cursor.movetonext()){ double dbgrade = cursor.getdouble(cursor.getcolumnindex(calc_db.column_grade_value)); //cursor.movetonext(); double dbweight = cursor.getdouble(cursor.getcolumnindex(calc_db.column_weight_value)); gradeweightlist.add(dbgrade); gradeweightlist.add(dbweight); my problem cursor going through 1 column @ time each loop iteration. going through 3 columns though selecting second 2 (grade , weight). example: if input : description, 0.7,

ruby - error when compiling compass / bootstrap-sass -

i'm running ruby 2.0.0x64 on windows i do gem update --system gem install compass gem install breakpoint gem install bootstrap-sass and create project : compass create -r bootstrap-sass --using bootstrap and put require 'breakpoint' in config.rb , compile once, it's when compile other time , got error: errno::enoent on line ["146"] of c: no such file or directory - c:/users/flairon/desktop/test/bootstrap/.sass-cache/75fcaf1b4852ceb732871195e41567cc2a 7d8997/c%058%092ruby200-x64%092lib%092ruby%092gems%0922.0.0%092gems%092bootstrap-sass-3.2.0.1%092assets%092stylesheets%092bootstrap%092_component-anim ations.scssc20140817-3940-158dqg2 run --trace see full backtrace so use --trace , got this: errno::enoent on line ["146"] of c: no such file or directory - c:/users/flairon/desktop/test/bootstrap/.sass-cache/75fcaf1b4852ceb732871195e41567cc2a 7d8997/c%058%092ruby200-x64%092lib%092ruby%092gems%0922.0.0%092gems%092bootstrap-sass-3.2

jquery - Replace img attribute -

i have following img tag part of larger html page. first image tag in document. change first image (white.png) data-original attribute. <img width="676" height="450" src="http://somewebsite/white.png" data-original="http://somewebsite/shutterstock_197488871-676x450.jpg" class="lazy attachment-post-thumbnail wp-post-image" alt="(shutterstock*)" /> here html <div style="font-size: 12pt; color: #ccc; margin-top: 5px; margin-bottom: 5px;"><span id="author">natural news</span> | <span>sat, 16 aug 2014 13:06:21 pm</span> </div> <img width="676" height="450" src="http://somewebsiteimages/white.png" data-original="http://somewebsite/shutterstock_197488871-676x450.jpg" class="lazy attachment-post-thumbnail wp-post-image" alt="(shutterstock*)" /> <noscript> <img width=&q

asp.net mvc - why kendo mvc combobox send (0 - null) value when using strong type view and every kendo control? -

i'm trying use mvc kendo ui have problem when using typed view, when submit form kendo control send null or 0 value controller !! anothe html helper control send correct value . set code example of work combobox . model: public class sys_branches { public int id { get; set; } [required] [foreignkey("companyid")] public sys_companies sys_companies { get; set; } public int companyid { get; set; } public string code { get; set; } [required(errormessage = "name required")] public string namea { get; set; } [required(errormessage = "name required")] public string namee { get; set; } } view: @model mvc_erp.models.sys_branches @{ viewbag.title = "branches"; } <div class="col-xs-12 col-sm-2"> @html.label("company") </div> <div class="col-xs-12 col-sm-10" style

php - MySQL rows with multiple ids as conditions -

i have table meant assignments. these assignments have multiple requirements (things users need have in order allowed take assignment). have these requirements id's requirements table. i want users assignments meet requirements for. have set of ids user has in php, , need query assignments ask ids that user has, or less. i thought create json array requirements , put in column in assignments table. create json array requirements user has, , use in query. but found out wouldn't work. for example, have ["6","9","11"] requirements , 6 7 9 11 12 user has. the requirements themself fit ones user has (using %"6"% etc), not other way around. so question is, how can search in assignments table, somehow supplying ids user has, , rows meet ids user has, or less. i make table requirements, instead of column, each requirement row, don't know how search in 1 query well. you should create associative tables. can read more

javascript - Generate equivalent Java class from JS with Rhino -

i have working rhino project, several javascript , java files working together. now, compile js java .class files. should create equivalent java class. 1 of js files this. load ('org/me/somejsclass.js'); importclass(packages.org.me.somejavaclass); function fruit(n, arr) { this.name = n; this.foo = function(bar) {...}; } according the answer here , can if first have java interface/abstract class extend from, don't want every js file. there solution without extending, java classes. if not, can java class generated me?

ruby on rails - get an error message "-bash: __rvm_clean_path: command not found" -

just after tried develop rails project (version: 4.0.8), start receive message. even when start new terminal tag, display on first line. along it, has message rvm used gemfile selecting ruby, fine - heroku too, can ignore these warnings 'rvm rvmrc warning ignore "blablabla directory"'. ignore warning files run 'rvm rvmrc warning ignore allgemfiles'. why happen , how solve it? please! the rvm used gemfile ... message nothing worry about. if irks you, read -- should contain instructions getting rid of it. the other message : -bash: __rvm_clean_path: command not found interesting. thing is, __rvm_clean_path function has been removed rvm source code long back. try updating rvm version running rvm head see if fixes it. if not, respond here output of following command: rvm --version also share content of following files in home directory: .bashrc .bash_profile .profile

php - Re-populate checkbox if it fails in validation in an edit form in Codeigniter -

i works on data-edit form in codeigintier. , problem re-populate checkbox it works if add form (that means need not concern value in database): <?= set_checkbox('is_default', '1'); ?> checkbox the problem is, in edit form: i can't repopulate checkbox <?php if ($customer_group[0]['is_default'] == "1") echo "checked"; set_checkbox('is_default', '1'); ?> the checkbox check have not check in edit => fail validate in form, helping i have set validation rule in controller, code in add form working , how handle case edit form? set_checkbox takes third argument set default state, have this echo set_checkbox('is_default', 1, $customer_group[0]['is_default'] == "1");

Use Chrome Extension to Modify Google Search Result Page -

i wanna make chrome extension modify google search result page. know can use content script because has ability this. unfortunately fails. wrote code $('h3.r').append('<b>a</b>') or else related dom operations failed. if wrote alert('aa') or document.body.style.backgroundcolor='green' , works. why? way, want have debug when open development tools can not find extension content script. can see other extensions' content scripts. did add jquery content_scripts in manifest? if use jquery, must write manifest.json this: "content_scripts":[ { "matches":["http://www.google.com/*"], "js":["jquery-1.9.1.min.js", "contentscripts.js"] } ] ok, after read page source of google search result page think know problem is: google loads search result ajax, so, when change query words , search again, page does not refresh, th

java - ECONNREFUSED (Connection refused) android connect to webservice -

i getting connection refused error when trying connect webservice using soapui. when tried using 127.0.0.1 in url, error econnrefused when tried 10.0.2.2, error connection timed out. please can help. thanks. here code on main activity. private static final string soap_action = "http://tempuri.org/getsmsoutgoing"; private static final string insert_incoming_sms = "savesmsincoming"; private static final string get_outgoing_sms = "getsmsoutgoing"; private static final string namespace = "http://tempuri.org/"; private static final string url = "http://127.0.0.1:62499/wssmsandroid.asmx?wsdl"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); thread thread = new thread(new runnable() { @override public void run() { try { getoutgoingsms(); } catch (exception e) { log.d(&quo

bluetooth - SoftwareSerial issues. Only when on power jack -

my code: #include <softwareserial.h> softwareserial bluetooth(2,3); // output int redpin = 6; // red led, int grnpin = 11; // green led, int blupin = 5; // blue led, // color arrays int black[3] = { 0, 0, 0 }; int white[3] = { 100, 100, 100 }; int red[3] = { 100, 0, 0 }; int green[3] = { 0, 100, 0 }; int blue[3] = { 0, 0, 100 }; int yellow[3] = { 40, 95, 0 }; int dimwhite[3] = { 30, 30, 30 }; // etc. // set initial color int redval = black[0]; int grnval = black[1]; int bluval = black[2]; int wait = 10; // 10ms internal crossfade delay; increase slower fades int hold = 0; // optional hold when color complete, before next crossfade int r = 0; int g = 0; int b = 0; char mode = '\0'; // initialize color variables int prevr = redval; int prevg = grnval; int prevb = bluval; // set led outputs void setup() { pinmode(redpin, output); // sets pins output pinmode(grnpin, output); pinmode(blupin, output); serial.begin(9600); delay(

javascript - Disable touch on an iframe but keep clicking ability -

i have iframe blocking layer below , dose not let scroll touch in phone , tablet devices. there way disable touch on iframe using it's class name or class name of div holding it? use css pointer-events disable touch events on element: iframe { pointer-events: none; } https://developer.mozilla.org/en-us/docs/web/css/pointer-events jsfiddle example: http://jsfiddle.net/moogs/eyync6mp/2/

java - Return the List<myObj> returned by ResponseEntity<List> -

my rest client uses resttemplate obtain list of objects. responseentitiy<list> res = resttemplate.postforentity(geturl(), mydto, list.class); now want use list returned , return list calling class. in case of string, tostring used, work around lists? first off, if know type of elements in list, may want use parameterizedtypereference class so. responseentity<list<myobj>> res = resttemplate.postforentity(geturl(), mydto, new parameterizedtypereference<list<myobj>>() {}); then if want return list can do: return res.getbody(); and if care list, can do: // postforentity returns responseentity, postforobject returns body directly. return resttemplate.postforobject(geturl(), mydto, new parameterizedtypereference<list<myobj>>() {});

flask - no python27.dll to copy into Scripts directory -

i have installed python2.7.3 in d:\python27\python ,and mkdir in g:\microblog, downloaded virtualenv.py in g:\microblog,when cd g:microblog, want install flask in g:\microblog web http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world g:\microblog>d:\python27\python virtualenv.py flask overwriting flask\lib\orig-prefix.txt new content new python executable in flask\scripts\python.exe traceback (most recent call last): file "g:\microblog\flask\lib\site.py", line 67, in <module> import os file "g:\microblog\flask\lib\os.py", line 397 yield walk(new_path, topdown, onerror, followlinks) ^ syntaxerror: invalid syntax error: executable flask\scripts\python.exe not functioning error: thinks sys.prefix u'g:\\microblog' (should u'g:\\microblog\\flas k') error: virtualenv not compatible system or executable note: windows users have reported error when installed python "only user"

c# - NullReferenceException was Unhandled (for a class) -

this question has answer here: what nullreferenceexception, , how fix it? 29 answers i've been trying fix class null problem little bit. don't understand it. class null reason. make loadcontent null too. additional information says: object reference not set instance of object. characterinfo chara;//chara class null chara.loadcontent(content);// error pointing //this behind chara.loadcontent(content); texture = content.load<texture2d>("art/blueanvil"); healthbar = content.load<texture2d>("art/healthbar"); started happening after add loadcontent constructor, class, , started using chara.loadcontent(content); please me expand knowledge in c# can remember how fix this. you need instantiate object: characterinfo chara = new characterinfo(); at point, you're declaring variable, you're not assigning actual

javascript - gulp tasks could be combined to be faster? -

i have gulp file wrote , i'm new @ this. it's working have more tasks think need. can me string javascript tasks 1 task? i need 4 separate js files uglified when i'm done. relevant code snippet gulpfile.js: var gulp = require('gulp') uglify = require('gulp-uglify'), rename = require('gulp-rename'), concat = require('gulp-concat'), notify = require('gulp-notify'), cache = require('gulp-cache'), del = require('del'); gulp.task('clean', function(cb) { del(['css/*', 'js/min/*'], cb) }); gulp.task('featuretest', function() { return gulp.src('js/feature-test.js') .pipe(rename({suffix: '.min'})) .pipe(uglify()) .pipe(gulp.dest('js/min')) }); // file: '/js/excanvas.min.js' loaded via lte ie8 conditional statement gulp.task('excanv

android - Listener for DatePickerDialog +/- button -

i'm using datepickerdialog in android app. as everyone, knows dialog has 3 edittext s: 1) day 2) month 3) year. , there + , - buttons 3 move front , of selected field. need know if there exists listener "+" , "-" buttons in dialog? this because, in app, don't want user select previous dates before current date using dialog. if "-" button clicked, should check whether date in dialog less current date. need listener "-" button of dialog. also i'm developing app platforms starting froyo kitkat. have heard there setmindate() datepicker . available honeycomb. try overriding ondatechnaged() function, here example: datepickerdialog mdatepickerdialog = new datepickerdialog(this, mdatesetlistener,myear, mmonth, mday){ @override public void ondatechanged(datepicker view, int year, int monthofyear, int dayofmonth){ // function call when user click on '+' or '-&

I want to get numeric data from string. How to do that in python? -

i want numeric data string. how in python??? for e.g. string "data23/45 data" extract 23 , 45 i'm sure there hundreds of ways, 1 way use regular expression split string digit groups, , list comprehension convert values integers; >>> import re >>> = "data23/45 data" >>> [int(x) x in re.split('[^\d]+', a) if x] [23, 45] re.split('[^\d]+', a) split on non digits, leaves digit groups in result. outer list comprehension convert non empty values in result integers. of course, if want digit groups still strings, can use simpler; >>> [x x in re.split('[^\d]+', a) if x] ['23', '45']

c++ - Method returning container for use in range-based for loop -

i have class contains standard container want return in method, (just example): class intarray { public: intarray(const vector<int>& vals) : vals(vals) {} const vector<int>& getvalues() const { return vals; } vector<int>& getvalues() { return vals; } private: vector<int> vals; }; i returned vector reference avoid making copy of (i rather not want rely on rvo). don't want using outputiterators, because want keep short c++11 range-based loops so: for (int val : arr.getvalues()) { // } but want change type of member variable list<int> , have change method's return type, too, might lead incompatibilities. don't want implement begin() , end() methods because there might more 1 such container per class. what preferred way of doing this? you create typedef , refer in function signatures: class intarray { public: typedef std::vector<int> vec; intarray(const vec& vals) : va

c++ - Trying double precision math in openCL doesn't compile -

i trying double precision math operations in opencl kernel. have cl_khr_fp64 enabled , can simple +-*/ operations in double, when try use built in math functions (for example, exp ) code fails compile. if switch float works. i read on khronos site math functions overloaded support double if enable cl_khr_fp64, did. ( http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/mathfunctions.html ) i working on new macpro d700 gpu , read of math functions overloaded include double ( http://developer.amd.com/knowledge-base/ ) exponential on list of included functions. also, when send code cpu instead of gpu fails well. here's code of kernel. it's extension of hello world! example on apple developers site. if switch u float works or if replace exp(u) u (as in first part of conditional) works. toy problem i'm trying work before start implementing real code, have working before move one. i've tried double_exp, expd, , native_exp. lead code compiling runtime e

c++ - Can I overload 'operator new' with a different return type? -

here's situation: want overload "operator new" instead of allocating object in random space in memory, gets allocated in pre-defined memory buffer. want able save buffer file , load in future, want use handles instead of pointers. want, ideally, "operator new" return handle can use go straight object's place in it's buffer. possible in c++(11)? if not, best alternatives? afaik cannot change return type of new operator. scenario try following approach: define handle (or handle<t> , if need handles more 1 type) class, internally stores index allocation area (i.e. handle has 1 single member variable index ). handle class need internally somehow have access allocation subsystem, i.e. need know actual storage area (buffer) located. define constructor handle taking pointer (returned new implementation) argument , computing index (e.g. subtracting beginning of storage area) also define dereferencing operator ( operator * ) han

java - how to save a dynamic string? -

in app current time , convert string. as see string changed every time open activity want save time string in static string if went activity show user. this code far: time = new time(); now.settonow(); string str = now.tostring().substring(0, 15); textview.settext(str); actually have listview has items. time string in listview.onitemclicklistener , want whenever item created save time , when users clicked on show time in second activity. example if user created item in listview in 2 days ago, when clicks on item show 2 days ago date , time: this code more details: first activity: list.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { time = new time(); now.settonow(); string timedate = now.tostring().substring(0, 15); intent intent = new intent(albums.this, albumpage.class);

java - How to display 10000 digits in Eclipse console? -

Image
stringbuilder sb = new stringbuilder(); for(int =0; i<8000; i++){ sb.append("5"); } biginteger bi = new biginteger(sb.tostring()); system.out.println(bi); i'm unable display such huge number on console(using eclipse). also, getting timeout huge numbers. kindly in displaying huge numbers on console. in preferences of eclipse, go window > preferences > run/debug > console uncheck option "limit console output" that allows print unlimited lines. if want limit lines ...use option "console buffer size"

How do I restrict special characters except underscore, hyphen and dot in email field in PHP? -

this question has answer here: how validate email address in php 8 answers this code. function emailfield($email) { return filter_var($email, filter_validate_email); } and if(emailfield($_post['email'])=='') { echo "invalid email"; } else { echo "valid"; } this allows special characters. want allow underscore, hyphen , dot only. how avoid? use regex this: /^[\w\.]+@/ then should check if domain exists. php: $regex = "/^[\w\.]+@/"; $email = emailfield($_post['email']); $domain = preg_replace($regex, '', $email); //get domain of email address removing local-part //using checkdnsrr checking if domain registred if($email == '' && preg_match($regex, $email) && checkdnsrr($domain)){ echo "valid"; } see also: http://php.net/manual

ios - NSOuputStream sends Old Value - Objective C -

i have created code used sockets send/receive value. did all. first time works well. face problem whenever send new value @ second time, old value passed. like, first time send 0 value socket, log file on socket side receive "0" in log file , received data sever, working well. when send value "2" socket, server socket receiving previous value "0" in log file. cant send new value. my code appdelegate.h @property (strong) nsinputstream *inputstream; @property (strong) nsoutputstream *outputstream; - (void) applicationddifinishlaunching....{ [self initnetworkcommunication:@"192.168.1.38"]; } appdelegate.m - (void) initnetworkcommunication:(nsstring *) getip { nslog(@"getip = %@",getip); cfstringref acfstring = (__bridge cfstringref)getip; cfreadstreamref readstream; cfwritestreamref writestream; cfstreamcreatepairwithsockettohost(null, acfstring, 1500, &readstream, &writestream); cfreadstreamsetproperty(readstream,

xml parsing - Perl XML::Simple parser decoding inconsistency -

i have encountered "inconsistency" (for me) while parsing xml: use 5.14.2; use strict; use warnings; use xml::simple; use data::dumper; $xml; {local $/; $xml = <data>;} $xmlparsed = xmlin($xml, keyattr => {phone => 'type', tankstelle => 'id'}, forcearray => [ 'phone' ], contentkey => '-content', ); dumper($$xmlparsed{'tankstelle'}); __data__ <?xml version="1.0"?> <tankstellen> <tankstelle> <id>63</id> <phone type="main">0911 731586</phone> <phone type="fax">0911 7592228</phone> <number/> </tankstelle> <tankstelle> <id>64</id> <phone type="main">0911 732011</phone> <phone type="fax"></phone> <number>6

jsf 2 - How to specify the type of wrapper for JSF custom component? -

Image
i need create custom component selectoneradio, should not has wrapper <table> but, <ul>, <li> example. how can specify type of wrapper, ul, table or else, when creating jsf custom components? there seems conceptual misunderstanding. there's no such thing "wrapper" in context. html generated renderer associated uicomponent . if you'd change generated html representation, supply own custom renderer . that said, it's advisable learn jsf decent book basic concepts right beginning on. creating custom components covered in such book. see also: how override h:selectoneradio renderer? renderer class in jsf-impl? how determine renderer of built-in component

ios - How to hide MasterViewController in UISplitViewController for iPad -

i working uisplitviewcontroller ,where need hide masterviewcontroller 1st detailviewcontroller . means,when app launches,the masterviewcontroller must hidden without clicking on uibutton . tried using uisplitviewcontroller inside uiviewcontrollers .but nothing happened. after tried develop overall app within uisplitviewcontroller . here code tried hide masterviewcontroller masterviewcontroller = [splitviewcontroller.viewcontrollers objectatindex:0]; detailvc = [splitviewcontroller.viewcontrollers objectatindex:1]; [master.view setframe:cgrectmake(0, 0, 0, 0)]; detail.view.frame = splitviewcontroller.view.bounds; i have spent 1 week doing this,but nothing worked.please provide solution.it great pleasure. update : ok done hiding master view controller.but when set delegate detail view controller,it hides master view controller view controllers. here appdelegate's code adding uisplitviewcontroller . self.splitviewcontroller =

css - LESS add class with pseudo selector -

i use less , here example: .arrow{ color: red; } .arrow:before{ content: ">"; } .button{ background: blue; .arrow; &:before{ border: 1px solid; } } and css after parsing: .button{ background: blue; color: red; } .button:before{ border: 1px solid; // here no content: ">" !!! } how add :before styles .arrow class button? you can use extend option below. applies properties of arrow class button class also. all keyword means child classes extended. less: .button{ background: blue; &:extend(.arrow all); &:before{ border: 1px solid; } } compiled css: .arrow, .button { color: red; } .arrow:before, .button:before { content: ">"; }

mysql - find the number of occurrences from two columns -

question example : source | target apple | dog dog | cat door | cat dog | apple cat | dog result : apple dog 2 dog cat 2 door cat 1 here question, example: i trying count apple , dog occurrence source , target. count 2, is; apple dog , dog cat . in same way; dog cat , cat dog , occur 2 times. how can mysql ? the data large, simple example. assuming source , target joined id as: select firstvalue, secondvalue, count(*) mycount (select sourcetable.value firstvalue, targettable.value secondvalue sourcetable inner join targettable on sourcetable.idvalue = targettable.idvalue union select targettable.value firstvalue, sourcetable.value secondvalue targettable inner join sourcetable on targettable.idvalue = sourcetable.idvalue) group firstvalue, secondvalue reading question again i'm unsure if these 2 columns in same table. if query can simplified to: select first

javascript - A simple jQuery/AJAX query -

okay, didn't jquery while , feel doing banal mistake, can't seem find it. i'd put html file, using ajax,to index.php when document ready without preloading website. so, button in .php file: <button class="dropposts">post comment..</button> and jquery: $(document).ready(function() { $('.dropposts').on('click', function() { $.ajax({ url: 'comment_form.html', datatype: 'html', success: function(response) { $('.comment-form').html(response); } }); }): }): this extremely simple; file in root site folder, in comment_form.html specific. now, when click button nothing happens. why? missing basic? there syntax error in code, used : instead of ; $(document).ready(function() { $('.dropposts').on('click', function() { $.ajax({ url: 'comment_form.html', datatype: 'html',

vb.net - HTTP Web request 500 Internal Server error? -

am making call webservice soapexception error responds "the remote server returned error: (500) internal server error" when use wireshark or fiddler status error,status code , status description of error not "the remote server returned error: (500) internal server error". how can these error information directly vb2010 sub readsoap() dim webrequest httpwebrequest 'dim reader streamreader dim response httpwebresponse = nothing dim result string dim data string = "" dim url string = "" dim xdoc new xmldocument result = "" textbox1.text = "" dim xml string = "" xml = "<soapenv:envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:v1=""http://xmlns.bb.com/request/v1"" xmlns:v3=""http://xmlns.bb.com/requestheader/v3"" xmlns:v2=""http://xmlns.bb.com/parametertype/v2&quo

Run JUnit from makefile (java.lang.NoClassDefFoundError) -

i've got junit project want add in toolchain. toolchain using makefile. makefile not in prject directory. tryied put "test" rules in makefile following : projpath=testjunit/test/ package=com/project/package/name/ lib=$(projpath)lib/ src=$(projpath)src/$(package) bin=$(projpath)bin/$(package) --------- acces lib.jar , .class used during test ------ classpath=.:$(lib)junit.jar:$(lib)opal-library.jar:$(src):$(bin) --------- name of test in order of wanted excecution ------------- javasrc= test1\ test2\ test3\ test: java -classpath $(junitpath) org.junit.runner.junitcore $(javasrc) when try launch 'make test' i've got following message: junit version 4.11 exception in thread "main" java.lang.noclassdeffounderror: test1 (wrong name: com/project/name/test1) i try possible launch java command in project directory nothing work. .class , .java respectivly in bin , src directorys. ok guys fond p

extjs4 - alternative to fitColumns() in Ext JS 4 -

i trying dynamically fit columns in grid. there in ext js 4 resizes each column fit grid method fitcolumns() in ext js 3.4? thanks if 1 of grid columns has flex:1 columns resized fit grid width.

html - change icon of a List with a Click with CSS -

i have navlist tabmenu this: <ul> <li><a href="#1"><span></span></a></li> <li><a href="#2"><span></span></a></li> <li><a href="#3"><span></span></a></li> <li><a href="#4"><span></span></a></li> </ul> now in css take background-img empty span, have icon in menu. how can change icon when click on link? a:active click. need a:target. possible? thanks lot! there no way 'permanently' mark elements active/give them specific class using pure css. an option using javascript/jquery follows: <ul class="tab-menu"> <li><a href="#1"><span></span></a></li> <li><a href="#2"><span></span></a></li> <li><a href="#3"><span></span

php - Unable to pass data to email template in Laravel -

i trying send email users data retrieved database. data stored json file. however, unable pass data emaill template. app/controllers/emailcontroller <?php class emailcontroller extends basecontroller { public function sendmail() { //example of json format $users_json = '[{"id":1,"first_name":"my","last_name":"name","email":"my_name@gmail.com"}, {"id":2,"first_name":"your","last_name":"name","email":"your_name@gmail.com"}]'; $users = json_decode($users_json, true); foreach($users $user) { mail::send('message', $user, function($message) use ($user) { $message->to($user['email'], $user['first_name']) ->subject('laravel email test 1'); });

c - Deleting in a linked list having many occurences of a value -

i using piece of code delete specific value linked list when create linked list having many occurrences of value. , if try delete value goes in infinite loop. but when create linked list distinct values works fine. should do? my code, struct link** delete(int value, struct link** head) { struct link* temp=*head; struct link* q; if(head==null) { printf("error"); } else{ while(temp->data!=value){ q=temp; temp=temp->next; } q->next=temp->next; temp->next=null; free(temp); return head; } } your algorithm has numerous problems. including, not limited to... dereference temp without checking null. undefined behavior if you're @ end of list , temp falls null. there no return value if initial list pointer null. dereferencing head before checking null. and others, but... use head pointer-to-pointer advantage walk list address-o

css3 - Responsive CSS triangle with percents width -

the code below create arrow right below <a> element: jsfiddle .btn { position: relative; display: inline-block; width: 100px; height: 50px; text-align: center; color: white; background: gray; line-height: 50px; text-decoration: none; } .btn:after { content: ""; position: absolute; bottom: -10px; left: 0; width: 0; height: 0; border-width: 10px 50px 0 50px; border-style: solid; border-color: gray transparent transparent transparent; } <a href="#" class="btn">hello!</a> the problem have indicate link width arrow of proper size because cannot indicate border width in pixels. how make responsive triangle percent based? you use skewed , rotated pseudo element create responsive triangle under link : demo (resize result window see how reacts) the triangle maintains it's aspect ratio padding-bottom property.

MongoDb agregation vs client side data manipulation -

i need load set of data mongodb. let's assume, need have items list based on condition, need know items children count, need include embedded documents have "moderated = true" , count subdocuments "moderated == false" without including them. since have document embedded document, can retrieve set of data db , manipulate on client side "for". , can use db.item.aggregate to create response data need , response have exact needed structure. the question better approach in terms of reducing load on mongodb: aggregation mongodb? create needed data on client side? this strange question. really, if care reducing load on mongodb, it's better send data need , computation on client. defeats of purpose of using mongodb. real question is, why prioritizing reducing load on mongodb? presumably aggregation not main load on server , don't want impact core operations aggregation? in case, solution add hidden secondary replica set (you ru

c# - EF select performance - Task.FromResult vs ToListAsync -

i trying figure out best way select data via entity framework async await. in following code have 2 options. the first uses task.fromresult. second option tries use async await keywords optimize code. 1. public task<ienumerable<designexample>> executeasync(getallexamplesquery query) { var designexamples = _copydatadb.designexamples.orderby(de => de.order).select(designexample.mapfromentity); return task.fromresult(designexamples); } 2. public async task<ienumerable<designexample>> executeasync(getallexamplesquery query) { var designexamples = await _copydatadb.designexamples.orderby(de => de.order).tolistasync(); return designexamples.select(designexample.mapfromentity); } does second option increase overall performance in relation first? the second option await call database, give me benefits in scenario? these methods 2 different things. your former executes call dbcontext synchronously , wraps result in

php - Efficient way to use PHPExcel_Reader_IReadFilter -

all code samples i've found in documentation , bundled examples suggest in order use phpexcel_reader_ireadfilter interface in phpexcel have start file processing scratch on every iteration: $objreader = phpexcel_iofactory::createreader($inputfiletype); $chunksize = 2048; $chunkfilter = new chunkreadfilter(); $objreader->setreadfilter($chunkfilter); ($startrow = 2; $startrow <= 65536; $startrow += $chunksize) { $chunkfilter->setrows($startrow,$chunksize); $objphpexcel = $objreader->load($inputfilename); // <-------- :-? } i don't need fancy processing. want grab data store somewhere else. there short-cut can take? then don't read file using read filter.... 1 option people limited memory need work large files, or need read subset of cells spreadsheet. you're not obliged use read filters, can load whole file if have sufficient memory. another option if you're limited in memory use cell caching; or set readdataonly if do