Posts

Showing posts from July, 2015

php - MySql Trigger for Updating PostCount -

i have 3 datatables: comment, blog , user. don't know triggers in mysql, possible sum counts of every row in comment , blog when new row inserted or deleted? e.g. blog has 3 entries , comment has 5 entries. when delete 1 comment now, should update record 'post' in user 7 counting entries in blog , comment username. comment table rows: id | cdate | edate | author | email |status | content | url | bid | level blog table rows: id | cid | author | cdate | title | teaser | content | url user table rows: id | username | email | pass | posts example trigger comments update event can write slimier triggers other events change highlighted values drop trigger if exists comment_delete; delimiter $$ create trigger comment_delete after delete on comment each row begin update user set posts=posts-1 id=new.author; end$$

access exchange mailbox from pop3 client other than outlook -

i want access exchange mailbox using pop client thunderbird, everytime log in, error logon failure: unknown user name or bad password. checked pop settings on ecp , enabled, made sure exchange pop service , running , plaintextlogin enabled. kindly appreciated i found solution issue, exchange not support unsecured connection, solve issue need set connection security "ssl/tls" , authentication method "standard password" though enabled plaintextlogin hth

ruby on rails - How can i get the value of primary_value in activerecord has_many definition? -

# == schema information # # table name: books # id :integer # owner_id :integer # table name: users # id :integer # name :string # table name: shared_books_records # user_id :integer # book_id :integer books id: 1, owner_id: 1 # jack id: 2, owner_id: 2 # tom id: 3, owner_id: 1 # jack users id: 1, name: "jack" id: 2, name: "tom" jack has 2 books , tom has 1 book. shared_books_records user_id: 1, book_id: 2 so jack borrowed tom's book. jack should have 3 books. class user def all_books join_sql = <<-sql.squish! left outer join shared_books_records on shared_books_records.user_id = books.assignee_id sql condition = <<-sql.squish! books.owner_id = :user_id or shared_books_records.user_id = user_id sql book.joins(join_sql).where(condition, user_id: id) end end i think it's not good, activerecord association better. want redefine it. ha

php - how to get city inside a especific country with Faker extension -

i'm working fzaninotto/faker extension in laravel 5 populate database, thing have table countries , table cities so, call $faker->country how can city inside country? don't want example bogotá belongs eeuu thank you! you'd make generator , add provider ( a list of them can found here ) country: $faker = new faker\generator(); $faker->addprovider(new faker\provider\en_au\address($faker)); $faker->state; // give australian states if specific need isn't covered available providers, may need create custom provider.

javascript - HTML to PDF with CSS included -

i'm searching way convert page pdf document using jspdf, cannot convert css styling. it's text , no graphics. this code i'm using @ moment var specialelementhandlers = { '#ignorepdf': function (element,renderer) { return true; } }; var doc = new jspdf(); doc.fromhtml($('#page-with-images').get(0), 20, 20, {'width': 500, 'elementhandlers': specialelementhandlers,}); doc.save("test.pdf"); but result not want, because there no styling included. how fix problem? try this. var pdf = new jspdf('p', 'pt', 'a4'); pdf.addhtml($("#content"), function() { var output = pdf.output("datauristring"); alert(output); //pdf.output("datauri"); //this output pdf in new window }); div { width: 100%; background-color: lightblue; padding: 15px; border: 2px solid black; } p { background-color: lime

machine learning - Someone can explain to me the design of a Convolutional NN with tensorflow (hand written digits)? (input img : 28 x 28 | output : 10 (n_classes)) -

i'm trying started cnn designs, found piece of code try infer design (f.maps size, strides ....). what i've understoud have : input --> conv5-32 --> maxpool --> conv5-5 --> maxpool --> fc1 --> outputs. what i'm not getting right input of fc1, why it's 7 7 ? could please me ? (i'm beginner) import tensorflow tf tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('/tmp/data/', one_hot=true) #parameters learning_rate = 0.001 training_iters = 200000 batch_size = 28 display_step = 10 #network parameters n_input = 784 n_output = 10 dropout = 0.75 #tf grath input x = tf.placeholder(tf.float32, [none,n_input]) y = tf.placeholder(tf.float32, [none, n_output]) keep_prob = tf.placeholder(tf.float32) # create wrappers simplicity def conv2d(x, w, b, strides=1): # conv2d wrapper, bias , relu activation x = tf.nn.conv2d(x, w, strides=[1, strides, strides, 1], padding='same') x

jquery - How to stop my javascript countdown by clicking a button? -

i have start button countdown, want stop when click stop button. my html code: <div> <span id="timer">25:00</span> </div> start stop my js code: $('#starttimerbutton').click(function starter() { function starttimer(duration, display) { var timer = duration, minutes, seconds; setinterval(function () { minutes = parseint(timer / 60, 10); seconds = parseint(timer % 60, 10); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; display.text(minutes + ":" + seconds); if (--timer < 0) { timer = duration; } }, 1000); } jquery(function ($) { var fiveminutes = 60 * 25,

c++ - Finding duplicates in JSON file after parsing with Boost -

how can find duplicates in json file after parsing out code below? want count number of duplicates in data duplicate have first name, last name, , email address match. the json file rather huge, won't copy , paste here. here snippet of it: [ { "firstname":"cletus", "lastname":"defosses", "emailaddress":"ea4ad81f-4111-4d8d-8738-ecf857bba992.defosses@somedomain.org" }, { "firstname":"sherron", "lastname":"siverd", "emailaddress":"51c985c5-381d-4d0e-b5ee-83005f39ce17.siverd@somedomain.org" }, { "firstname":"garry", "lastname":"eirls", "emailaddress":"cc43c2da-d12c-467f-9318-beb3379f6509.eirls@somedomain.org" }] this main.cpp file: #include <iostream> #include <string> #include "customer.h" #include "boost\property

android - Edittext : custom error popup -

how can custom layout of popup seterror in edittext edittextposition.seterror(getresources().getstring(r.string.txt_err_adresse_site),mdrawable ); i override seterror() method custom icon @override public void seterror(charsequence error, drawable icon) { super.seterror(error, icon); } thanks public class myedittext extends edittext { public myedittext(context context, attributeset attrs) { super(context, attrs); } @override public void seterror(charsequence error, drawable icon) { // setcompounddrawables(null, null, icon, null); } }

python - Select rows containing certain values from pandas dataframe -

i have pandas dataframe entries strings: b c 1 apple banana pear 2 pear pear apple 3 banana pear pear 4 apple apple pear etc. want select rows contain string, say, 'banana'. don't know column appear in each time. of course, can write loop , iterate on rows. there easier or faster way this? with numpy, vectorized search many strings wish, - def select_rows(df,search_strings): unq,ids = np.unique(df,return_inverse=true) unqids = np.searchsorted(unq,search_strings) return df[((ids.reshape(df.shape) == unqids[:,none,none]).any(-1)).all(0)] sample run - in [393]: df out[393]: b c 0 apple banana pear 1 pear pear apple 2 banana pear pear 3 apple apple pear in [394]: select_rows(df,['apple','banana']) out[394]: b c 0 apple banana pear in [395]: select_rows(df,['apple','pear']) out[395]: b c 0 apple banana p

Feedback form design using InfoPath Designer -

i designing feedback form internal organisation purpose. requirement quiet simple. fetch data database; send form through email; on "submit" click response has go same database. i able fetch data database. couldn't publish form through email. also, need know how send response database on clicking "submit" button.

Foreign Keys referencing same table exception when upgrading from EF Core RC2 to V1 -

hopefully simple 1 have upgraded release version of ef core , can no longer run code against db. i have 2 tables, client table , language table. client has 2 references language table, 1 language , other language @ home. language has public icollection<client> clients { get; set; } and client has public language language { get; set; } private int? _languageid; public int? languageid { { if (_languageid != 0) return _languageid; if (language != null) return language.languageid; return null; } set { _languageid = value; } } public language languageathome { get; set; } private int? _languageathomeid; public int? languageathomeid { { if (_languageathomeid != 0) return _languageathomeid; if (languageathome != null) return languageathome.languageid; return null; } set { _languageathomeid = value; } } in onmodelcreating have following 2 lines

php - Convert file to array and explode with comma -

Image
i convert rpt file array. file divided commas. of course that's easy part. second thing need convert multidimensional array, easy got stuck in it. need make each line of file next row . i'm looking in head don't know how solve it. hope you'll me! $contents = file($path); foreach($contents &$row){ $row = explode(",",$row); } file() reads file array, 1 line 1 array element.

Installing SSL wildcard certificate on IBM HTTP Server -

i'm running 2 ibm http servers (7.0) on different machines, , i'm updating ssl certificates both. certificate wildcard certificate. i have updated certificate server generated update request from, , seems there. my problem occurs when trying re-use certificate on second server. have read several sites state need export certificate first server (using ikeyman), copy second server. create new kdb file, , import certificate. i've done this, , when looking @ contents of new kdb file seems complete (it has certificates required - root, intermediate, etc). however when try use files (the kdb , corresponding sth file) in server configuration, fails - server starts certificate not installed. anyone know i'm doing incorrectly? as discussed in comments, sslservercert directive value must match label of certificate used in .kdb file. using key management utility (ikeyman) utility labels can inspected in personal certificates section.

How to print a sqlite table content with genie programming language -

based on previous questions here managed create dataset, print recipes listed , trying pick 1 of recipes list , show title, instructions , ingredients. instructions mapped recipes via pkid column , ingredients mapped recipes through recipeid column. when open database on sqlite database browser can access information inside tables dropdown list, suppose proper name them tables within database. i not being able "filter" pkid , recipeid, after picking 1 recipe, appropriate content shown. this code in python of trying in genie: def printsinglerecipe(self,which): sql = 'select * recipes pkid = %s' % str(which) print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' x in cursor.execute(sql): recipeid =x[0] print "title: " + x[1] print "serves: " + x[2] print "source: " + x[3] print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' sql = 'select * ingredient

matlab - Angle calculation in a Delaunay graph -

Image
i have plotted delaunay graph in matlab one:- i want calculate angles in graph. have x , y values points in disordered form, , don't know how sort points because x , y values close points on same row. one way that: x = randn(1,4)*10; y = randn(1,4)*10; %calculate triangulation tri = delaunay(x,y); %plot graph triplot(tri,x,y) hold on plot(x,y,'ro') text(x,y,strsplit(num2str(1:length(x)))) % determine each angle = 1:size(tri,1) per = perms(tri(i,:)); [~, ind] = unique(per(:,2)); %avoid calculate 2 time same angle. per = per(ind,:); %the 3 * 3 points create angle of each triangle j = 1:3 p_1 = per(j,1); p1 = [x(p_1),y(p_1)]; p_2 = per(j,2); p2 = [x(p_2),y(p_2)]; p_3 = per(j,3); p3 = [x(p_3),y(p_3)]; ang = rad2deg(atan2(abs(det([p3-p2;p1-p2])),dot(p3-p2,p1-p2))); %p2 point in middle fprintf('node %d %d %d angle %f\n',p_1, p_2, p_3, ang) end end

ruby on rails - Networking issue using Hashicorp Otto on Ubuntu running on vmware? -

i running following: ubuntu 15.05 ("wily") virtual box 5.0.8 vagrant 1.7.4 otto 0.1.2 all seems have installed fine after followed how install hashicorp's otto tutorial. however, each time run otto dev internet connection seems go down (meaning little notify box in right top corner tells me connection has been established , i'm connected vboxnet0 , tells me ethernet connection disconnected) , following error: pc@pc:~/development/my-rails-app$ otto dev ==> creating local development environment vagrant if doesn't exist... raw vagrant output begin streaming in below. otto not create output. mirrored directly vagrant while development environment being created. bringing machine 'default' 'virtualbox' provider... ==> default: checking if box 'hashicorp/precise64' date... ==> default: clearing set forwarded ports... ==> default: clearing set network interfaces...

Array of IO in Xilinx constraints file [VHDL Spartan-6] -

i'm learning program both vhdl , attempt implement on fpga (xilinx spartan-6 evaluation board). far have looked @ "getting started" guide here useless - shows me how great potential of fpga if know you're doing (which dont). i've watched youtube video make led blink through original vhdl code, constraint file , programming through impact/jtag. so i've taken further , made button turns led on when held down has worked, of vector of led's turn on when press button, have declare pin locations each index, below; net "led(0)" loc = "d17"; net "led(1)" loc = "ab4"; net "led(2)" loc = "d21"; net "led(3)" loc = "w15"; net "clk" loc = "k21"; net "button" loc = "f3"; how declare entire array of led(0) led(3) in 1 line? there must way given how large std_logic_vector can be. as follow question, if knows of resources, tutorials, video

css - How to vertical center floated div with anchor and image -

i want center images inside div floated. i've tried vertical-align:middle; wasn't success. guess that's because it's floated. i've created jfiddle problem: https://jsfiddle.net/au0h6u0g/ you may use vertical-align on img , line-height , example: .top { height: 150px; background-color: blue; } .container { float: right; line-height: 150px; } img { vertical-align: middle; } <div class="top"> <div class="container"> <a href="#"> <img src="http://lorempixel.com/400/200/" alt="smiley face" height="50" width="140"> </a> </div> </div> https://jsfiddle.net/au0h6u0g/4/

ruby on rails - Avoiding multiple API Calls in Rspec tests -

i trying test "scan" method have. within scan method, make api call (among other things). how can test method without triggering unneeded api calls? one approach stub out call api: allow(thing).to receive(:action).and_return(response) another approach allow api call go through, intercept , return mock response using vcr . "record" request , "play back". vcr handy when need handle the entire response in test subject. run test against real api 1 time, subsequent tests can use vcr "cassette". otoh slower stubbing call, if need mock status , not entire response. tl:dr, stub if can, don't hesitate use vcr when saves work.

d3.js - LinePlusBarChart with date interval outside domain -

Image
i'm using angular-nvd3's lineplusbarchart display data, pretty this: http://plnkr.co/edit/mrkvm1ihrvrn9jdbfwif?p=preview in example above x-axis domain based on date values of data. how can date interval of x-axis changed in lineplusbarchart start @ year 2000 , continue until year 2015, if there no data available between 2000 , 2004? update: ordinary linechart, setting chart.xdomain = [mindate, maxdate] works fine. chart showing data , chart x-axis starting on 2000 , ends on 2015. using chart.lines.xdomain = [mindate, maxdate] , chart.bars.xdomain = [mindate, maxdate] in lineplusbarchart data of chart showing, x-axis isn't reflecting changed min , max dates. here image showing error: the chart options this: chart: { type: 'lineplusbarchart', height: 300, margin: { top: 30, right: 75, bottom: 50, left: 75 }, bars: {

javascript - Iframe src attribute change with parameter -

i’m trying change src attribute of <iframe> depending if iframe src has /?foo or not. i had solution: <script> jquery(document).ready(function($) { $('iframe[src*="?foo"]').each(function() { $('#frame').attr('src', "http://www.example.com/page2"); }); }); </script> <iframe id="frame" src=„www.example.com/page1/?foo"></iframe> but problem have no access page, iframe emded can't write code <head> of site. i have access both pages www.example.com/page1 , www.example.com/page2 i don’t know how need change code manipulate src .. not sure if possible, when have no access page iframe as seen in how retrieve parameters javascript? can use following code , call function parsesecond("foo") foo parameter on page1. can find more information on question page. function parsesecond(val) { var result = "not found&qu

Node placement in family tree visualization with Dot/Graphviz -

Image
i'm trying generate family tree visualizations database using dot/graphviz. first results promising, there 1 layout issue haven't been able fix yet. when use code listed below, produce i'm totally happy this. try add node between families f4/m4/m5 , f2/m2, can done uncommenting 2 lines in code below, give me male2 placed far away female2 , between female4 , male4. families f2/m2 , f4/m4/m5 torn apart. tried increase weight family connections (value 100) in order make sure families f2/m2 , f4/m4/m5 placed together, doesn't work. changing order of nodes or connections did not far. best solution be, if family f4/m4/m5 placed on left, malex in center , family f2/m2 on right. does have suggestion? prefer not change order in nodes , connections defined in code, because done script , kind of predefined database structure. graph test { rankdir = bt; splines = ortho; center = true; { rank = same; nodefemale1 [label = female1]; nodemale1 [label = male1]; connectio

java - nullpointer exception in aspectJ example -

i trying implement 1 of suggestion given our stackoverflow member here logging entry, exit , exceptions methods in java using aspects . since different question in itself, posting here again. i have tried search looks different versions have different ways of doing , unable figure out example online. have tried following simple example since new aspect oriented programming , couldn't figure out how implement. example throwing npe. please me understand doing wrong. ==== exception exception in thread "main" java.lang.nullpointerexception @ aoplogging.simplecall.call(simplecall.java:13) @ aoplogging.app.main(app.java:18) exactly @ simpleservice.simplecall(); applicationcontext: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http

php - libxml fails to parse correctly -

for reason , libxml fails text correctly page. want text "in last few days ..." main text of article, libxml exits saying couldn't find end tag of start tag. code: [niko@dev1 tmp]$ cat domtest2.php <?php $url="http://www.journaldev.com/253/65-html5-tutorials-examples-and-resources-for-web-developers"; $ch=curl_init(); curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_returntransfer,1); $htmltext=curl_exec($ch); $dom=new domdocument; $result=$dom->loadhtml($htmltext); $full_text=$dom->textcontent; echo $full_text; ?> [niko@dev1 tmp]$ code output: [niko@dev1 tmp]$ php -f domtest2.php php warning: domdocument::loadhtml(): htmlparsestarttag: misplaced <head> tag in entity, line: 57 in /tmp/domtest2.php on line 10 php stack trace: php 1. {main}() /tmp/domtest2.php:0 php 2. domdocument->loadhtml() /tmp/domtest2.php:10 php warning: domdocument::loadhtml(): tag header invalid in entit

python - Creating a Regex That Applies to multiple lengths of strings and characters -

play [[b2 c3# d3 d3# ]] play [[a1 a1# b1 d1# e1 f1 f1# g1 a2 b2 f2# g2 c3 c3# d3 d3# ]] i need create regex (with ultimate purpose of removing "play" , "[[]]" lines of text file. insides of brackets vary each line, how create regex match pattern return group within brackets each line? any appreciated, i'm kind of noob this. since know start , end strings , lengths, slice part need: >>> s = "play [[a1 a1# b1 d1# e1 f1 f1# g1 a2 b2 f2# g2 c3 c3# d3 d3# ]]" >>> s[7:-3] 'a1 a1# b1 d1# e1 f1 f1# g1 a2 b2 f2# g2 c3 c3# d3 d3#'

html - Structued data in a menu -

how add url item props in menu after first li element. cant seem google pick next item props after first menu list. <li itemtype="http://schema.org/localbusiness" id="main"> <a> home</a> <ul id=" subnav" =""=""> <li> <a itemprop="url" href="">item 1</a> </li> <li><a itemprop="url" href="">item 2</a> </li> <li><a itemprop="url" href="">item 3</a> </li> </ul> </li> <li id="two"> <a>hello</a> <ul id="subnav1"> <li><a href="">menu 2</a> </li> <li><a itemprop="url" href=""> item 4 not being picked up</a> </li> </ul> </li>

web services - Cannot get WSDL in JBoss 7. Same code works in Jboss 6 -

i porting ws application jboss6/java 6 jboss7/java7 combination. when query wsdl browser, exceptions (see below jboss console log) in jboss 7 (using 7.1.1.final version) query works in jboss 6. 10:28:59,175 info [stdout] (ajp--0.0.0.0-9991-3) 10:28:59,175 info [e.filter]: bslprocesslog|ajp--0.0.0.0-9991-3|dofilter|environment = uat| 10:28:59,178 error [org.apache.catalina.core.containerbase.[jboss.web].[default-host].[/myservice].[myservice]] (ajp--0.0.0.0-9991-3) servlet.service() servlet oasservice threw exception: javax.servlet.servletexception: cannot obtain destination for: //myservice/service/oas @ org.jboss.wsf.stack.cxf.requesthandlerimpl.finddestination(requesthandlerimpl.java:164) @ org.jboss.wsf.stack.cxf.requesthandlerimpl.handlehttprequest(requesthandlerimpl.java:81) @ org.jboss.wsf.stack.cxf.transport.servlethelper.callrequesthandler(servlethelper.java:169) @ org.jboss.wsf.stack.cxf.cxfservletext.invoke(cxfservletext.java:87)

javascript - Pass id param from Datatable to controller -

i want pass id param of clicked row button of datatable controller (by url or ajax, or something). i'm using url call method on controller , works, don't know how can passed id (in code **************) of column. datatable in js is: var t_festivos = <?php echo json_encode($t_festivos); ?>; if ( t_festivos !== null){ var table = $('#t_festivos').datatable( { language: { "url": "<?=trad($this,'idioma_datatables');?>" }, data: t_festivos, paging: true, ordering: true, pagelength: 10, columndefs: [ { "targets": 0, "visible": false }, { "targets": -1, "data": null, "defaultcontent": "<center><a class='bt

python - Multiindex print 2nd level index labels on right side of a table -

taking example http://pandas.pydata.org/pandas-docs/stable/advanced.html in [10]: arrays = [np.array(['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux']), ....: np.array(['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two'])] ....: in [11]: s = pd.series(np.random.randn(8), index=arrays) in [13]: df = pd.dataframe(np.random.randn(8, 4), index=arrays) in [14]: df out[14]: 0 1 2 3 bar 1 -0.424972 0.567020 0.276232 -1.087401 2 -0.673690 0.113648 -1.478427 0.524988 baz 1 0.404705 0.577046 -1.715002 -1.039268 2 -0.370647 -1.157892 -1.344312 0.844885 foo 1 1.075770 -0.109050 1.643563 -1.469388 2 0.357021 -0.674600 -1.776904 -0.968914 qux 1 -1.294524 0.413738 0.276662 -0.472035 2 -0.013960 -0.362543 -0.006154 -0.923061 how move second index print display after las

ios - SWIFT 2 - UICollectionView - slow scrolling -

i have setup uicollectionview in project data json file. works however, scrolling slow , when view scrolling coming cell, few moments shows content of cell before. i have tried using dispatch_async still slow , jumpy. any idea doing wrong? override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let videocell = collectionview.dequeuereusablecellwithreuseidentifier("videocell", forindexpath: indexpath) uicollectionviewcell let communityviewcontroller = storyboard?.instantiateviewcontrollerwithidentifier("community_id") videocell.frame.size.width = (communityviewcontroller?.view.frame.size.width)! videocell.center.x = (communityviewcontroller?.view.center.x)! videocell.layer.bordercolor = uicolor.lightgraycolor().cgcolor videocell.layer.borderwidth = 2 let fileurl = nsurl(string:self.uservideosinfo[indexpath.row][2])

php - Reset Doctrine 2 ID -

i'm doing integration testing , can't directly set id entity. need is, somehow tell doctrine reset id 1. when call flush ids 20, 21, 22,23. i have tried deleting table, reseting identity or thread nothing helps. my code: public function testfindingallorderedbydefault() { /** @var $bundles bundle[] */ $bundles = $this->repository->findall(); $this->assertcount(2, $bundles); $this->assertsame(1, $bundles[0]->getid()); $this->assertsame(2, $bundles[1]->getid()); } protected function preparedatabase(entitymanager $entitymanager, connection $connection) { $connection->executequery('truncate bundle cascade'); $entitymanager->persist( (new bundle()) ->setprice(1200) ->setpricevat(5000) ->setdiscount(1000) ->setcurrency('czk') ); $entitymanager->persist( (new bundle()) ->setprice(1300) ->

java - Difference btn mContext.get().getApplicationContext() and getActivity() -

why in fragment getactivity() works mcontext.getapplicationcontext() not? mdobpickerdialog = new datepickerdialog(getactivity(), new ondatesetlistener() { public void ondateset(datepicker view, int year, int monthofyear, int dayofmonth) { calendar newdate = calendar.getinstance(); newdate.set(year, monthofyear, dayofmonth); mdobedittext.settext(mdateformatter.format(newdate.gettime())); } },newcalendar.get(calendar.year), newcalendar.get(calendar.month), newcalendar.get(calendar.day_of_month)); my mcontext declared , initialized as: private context mcontext; public displayprofilefragment(context context) { super(); mcontext = context; } getactivity() returns activity fragment associated with. http://developer.android.com/reference/android/app/fragment.html#getactivity() getapplicationcontext() returns global application context. http://developer.android.com/re

javascript - Webstorm Projects and Node - What to Share and Why -

i've got idea folder in webstorm project. node app. need share , why folder in source control? settings should share , why? also, how retain preferences project project? find if create new project (which opening webstorm opening folder of code cloned down repo), have reset stuff js version, , bunch of other stuff in preferences. 1) need add source folder source control. 2) easiest way share webstorm code style setting using .editorconfig plugin , adding file source control: https://www.jetbrains.com/webstorm/help/configuring-code-style.html#d649738e184

java - Maven shade plugin isn't placing dependency class files into jar -

my maven project uses external library dependency, com.sk89q.intake:intake , i'm trying package jar via maven-shade-plugin . when building project, resulting jar not contain of class files of com.sk89q.intake:intake . during build process, message, build continues on , succeeds: [info] --- maven-shade-plugin:2.4.2:shade (default) @ eventmanagerplugin [info] no artifact matching filter com.sk89q.intake:intake why happening? i'm able download, access, , use dependency in project, there shouldn't wrong naming of artifact. pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>deletethis.eventmanager</groupid> <artifactid>eventmanagerplugin</artifactid> <version>1.0.0-beta1&l

php - Joomla insert not working without database prefix -

i'm trying add vale db in joomla $db = jfactory::getdbo(); $query = $db->getquery(true); // not working $query = "insert `#__devprofile` (`name`) values ('bnar')"; $db->setquery($query); echo "execute"; $db->execute(); but when put db prefix in front of insert statement works expected this $query = "insert `hhygd_devprofile` (`name`) values ('bar')"; what missing here? thanks in advance * update * the issue reinstalled joomla ago, wrong database prefix set in configuration.php , works charm * * you have magic quotes gpc off in joomla. requirement joomla installation. can change code better joomla format $db = jfactory::getdbo(); $query = $db->getquery(true); $columns = array('name'); $values = array($db->quote('bnar')); $query ->insert($db->quotename('#__devprofile')) ->columns($db->quotename($columns)) ->values

javascript - Nodeclise , Enide does not execute the cluster code on debug mode -

i using eclipse enide build nodejs application. able run right , web services running.but while debugging choose debug > node application . see no error, console shows debugger running on port 5858 , 5859 (its cluster). same web service endpoint gives error connection refused. on debugging see cluster code never executed , break never hit. const throng = require('throng'); var http_servers = []; throng({ workers: process.env.web_concurrency || 1, lifetime: infinity },mainservercode); function mainservercode() { // require('newrelic'); var express = require('express'); // code never hit .... what reason , check it. thanks

java - are `Matchers.hasItem` and `Matchers.contains` the same? -

i saw post about difference between: matchers.hasitem(..) assert.assertthat(items, matchers.hasitem(matchers.hastostring("c"))); states and matchers.contains but still don't difference. both 1 predicate satisfaction. no? they same, matchers.hasitem said will stop matching item found then matchers.contains the examined iterable must yield 1 item the difference first 1 checks whether there @ least 1 item (may 2 or more), second 1 checks there 1 item (only one, no more).

java - Getting exceptions on inserting into couchdb -

i'm trying insert data couchdb landed these exceptions here logs. starting jetty on port 8888 [warn] exception while dispatching incoming rpc call com.google.gwt.user.server.rpc.unexpectedexception: service method 'public abstract java.lang.string org.rz.client.greetingservice.rr() throws java.lang.illegalargumentexception' threw unexpected exception: net.sf.json.jsonexception: jsonobject["error"] not jsonobject. at com.google.gwt.user.server.rpc.rpc.encoderesponseforfailure(rpc.java:415) at com.google.gwt.user.server.rpc.rpc.invokeandencoderesponse(rpc.java:605) at com.google.gwt.user.server.rpc.remoteserviceservlet.processcall(remoteserviceservlet.java:333) at com.google.gwt.user.server.rpc.remoteserviceservlet.processcall(remoteserviceservlet.java:303) at com.google.gwt.user.server.rpc.remoteserviceservlet.processpost(remoteserviceservlet.java:373) at com.google.gwt.user.server.rpc.abstractremoteserviceservlet.dopost(abstractremoteser