Posts

Showing posts from September, 2013

php - How insert data to database using opencart? -

i begginer open cart, , try build sub menu in panel admin, file name item.php, trying insert database (head_text_field,title_text_field , max) & (table show_product), try follow insert data database codeigniter , still error, error call undefined method db::insert() model\item\item.php edit part 1: when remove code in model: return $this->db->insert('show_product', $data); and change code : $this->db->query("insert into" . db_prefix . "show_product set head_text = '" . $this->db->escape($data['head_text_field']) . "', title_text = '" . $this->db->escape($data['title_text_field']) . "', max_item = '" . $this->db->escape($data['max']) . "'"); it's work in database still empty ??? this controller in (controller/item/item.php) class controlleritemitem extends controller { //controller/item/item.php private $error = array(); publ

Google Directions Service API 3 Return Wrong Result to Map -

am using google direction service find map 2 address stated below var start = "2115 first avenue se unit 1306, cottage grove place, cedar rapids, ia, 52402"; //set source/ origin var end = "6126 rockwell dr. apt 128, keystone place, cedar rapids, ia, 52402"; on select via google maps direction directly works fine link : https://www.google.co.in/maps/dir/keystone+place-blair's+ferry,+6126+rockwell+drive+northeast,+cedar+rapids,+ia+52402,+united+states/cottage+grove+place,+2115+1st+avenue+southeast,+cedar+rapids,+ia+52402,+united+states/@42.0179234,-91.6739759,13z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x87e4f0459aacb105:0x63c416fc0edc61d6!2m2!1d-91.6475339!2d42.039779!1m5!1m1!1s0x87e4f0d795c1b96b:0xa1ccbbf6400b01aa!2m2!1d-91.6362972!2d41.9959428?hl=en it not working same while using direction service. find below example http://jsfiddle.net/mrhq4/291/ (credits author :shreerang patwardhan) it works fine when remove address2 source , destination

JMeter does not execute the Javascript found in HTML pages? Confused -

jmeter user manual says: jmeter not browser. jmeter not execute javascript found in html pages. i wanted know exact meaning of statement. most perhaps every webpage have javascripts included. taking example of testing single page (say home page), , usual page have number of js, css, images. during recording, recorded embedded resources. far knowledge, before running test in jmeter, have following 3 options 1. take top level request (homepage.html) without selecting embedded resources check-box 2. take top level request (homepage.html) along selecting embedded resources check-box 3. keep top level request along other components recorded which among 3 best option check page load time (i assuming 1st option, tries replicate close browser) and otherwise, if jmeter not execute javascript, how getting response of js file? jmeter won't execute javascript , won't render page, download .js file , record , replay ajax call driven javascript. so suggest going opti

itext - xfa worker is throwing Java Script event evaluation failed -

i using itext flatten pdf , till it's working fine. production purpose have used log4j log application's error , info. while going down log file seeing error coming itext xfaworker (although flattening procedure working fine). i noticed xfaworker using slf4j internal logging. can me solve error, here attaching whole log. xfa form element: xfa[0].form[0].form2_dtls[0] event 'initialize' org.mozilla.javascript.ecmaerror: typeerror: cannot call method "indexof" of undefined (js#612) @ org.mozilla.javascript.scriptruntime.constructerror(scriptruntime.java:3687) @ org.mozilla.javascript.scriptruntime.constructerror(scriptruntime.java:3665) @ org.mozilla.javascript.scriptruntime.typeerror(scriptruntime.java:3693) @ org.mozilla.javascript.scriptruntime.typeerror2(scriptruntime.java:3712) @ org.mozilla.javascript.scriptruntime.undefcallerror(scriptruntime.java:3731) @ org.mozilla.javascript.scriptruntime.getpropfunctionandthish

bitbucket - In Git when pushing the master branch, commits from the development branch are pushed too. Is this supposed to happen? I am using Gitflow -

when started working git based workflow on gitflow model: http://nvie.com/posts/a-successful-git-branching-model/ . thought main idea keep commits appropriate branches; example main branch have commits had been merged in development branch ... ie tags ... 0.1. 0.2. 1.0 in graphic. don't understand how git works or how workflow meant operate that's thought, since graphic on page shows these few commits on master branch, not development ones well. i push repo bitbucket , went while working in development branch, when finished development; , and pushed master branch found master branch in bitbucket contains of commits made on development branch, whereas thought contain last commit ( 1 merged in). can explain why this, , whether intended behaviour, , if not can workflow working in line model above. use smartgit. your branching model seems require specifying --no-ff on every merge, forcing bookkeeping entries empty merges -- example in graphic you'd merge hotfixe

java - JTextField input fails to update output in TextView in MVC -

Image
i'm studying advanced java , trying write program utilizes mvc design pattern. program needs draw string can modified user's input in jtextfield . user can adjust color , font size of text through jcombobox , jspinner respectively. here have far: public class mvcdemo extends japplet { private jbutton jbtncontroller = new jbutton("show controller"); private jbutton jbtnview = new jbutton("show view"); private textmodel model = new textmodel(); //constructor public mvcdemo(){ //set layout , add buttons setlayout(new flowlayout()); add(jbtncontroller); add(jbtnview); jbtncontroller.addactionlistener(new actionlistener(){ @override public void actionperformed(actionevent e){ jframe frame = new jframe("controllor"); textcontroller controller = new textcontroller(); controller.setmodel(model); frame.add(controller); frame.setsize(200,

mysql - Delete between tables -

is possible delete between tables? something like... delete bd between table1 , table 10 vehicle 761 delete bd.table_1 id_vehicle=761 delete bd.table_10 id_vehicle=761 you can either write stored procedure (look @ mysql dynamic query in stored procedure ) or change table structure either vehicle ids related via foreign key constraint (then can cascading deletes, see http://www.mysqltutorial.org/mysql-on-delete-cascade ), or use 1 big table store everything, partition date, if content reaches size, makes sense.

javascript - Drop a marker where clicked and display the co-ordinates and address -

i'm noob who's written js code google maps , facing problems. what i'm trying achieve:- when page loads, picks location. when click on map, drops marker. when click somewhere else, drops same marker on different location now. gets co-ords of place , displays in text box. conversely, add location in address bar , if present, drops marker location , gets co-ords. problems facing: the map drops new marker everytime click on map. doesn't co-ords of location. does not search address. my limitations: noob cannot figure out code search address bar. please point me in right direction. here's code function initmap() { var map = new google.maps.map(document.getelementbyid('map'), { zoom: 8, center: {lat: 40.731, lng: -73.997} }); google.maps.event.addlistener(map, 'click', function(e) { placemarker(e.latlng, map); }); function placemarker(latlng, map) { var marker = new google.maps.marke

c# - Can't call GameCenter in my Unity game for iOS -

i'm trying integrate game center unity 5 project , facings troubles. seems authentification ok when game starts on ios device, notification appears, leaderboard button not work, nothing happens when tap gc button. assigned initiation of "showleaderboard()" gc button. please, take @ script use below. hope find resolution issue. thank in advance. using unityengine; using unityengine.socialplatforms; using unityengine.socialplatforms.gamecenter; using system.collections; public class gamecenter : monobehaviour { public string leaderboardid = "mygameleaderboard"; void start () { authenticatetogamecenter(); } private bool isauthenticatedtogamecenter; public static void authenticatetogamecenter() { #if unity_iphone social.localuser.authenticate(success => { if (success) { debug.log("authentication successful"); } else { debug.log("authentication failed"

android - Gradle: how to add an .aar its sources for androidJavadocsRelease generation? -

i have aar (awesome-lib-extensions) file build extension of aar (awesome-lib) file. have included awesome-lib compile dependency. seems work: can extend it, write unit tests awesome-lib-extensions, work. the problem have following: cannot add awesome-lib classpath generating javadocs! how do this? have following code: libraryvariants.all { variant -> task("generate${variant.name.capitalize()}javadoc", type: javadoc) { // title = '' // description = '' source = variant.javacompile.source //todo: add classpath here javadoc! classpath = files(variant.javacompile.classpath.files, project.android.getbootclasspath()) options { links "http://docs.oracle.com/javase/7/docs/api/" linksoffline "http://d.android.com/reference","${android.sdkdirectory}/docs/reference" } exclude '**/buildconfig.java' exclude '**/r.java'

arrays - Kth maximum sum of a contiguous subarray of +ve integers in O(nlogS) -

i reading this editorial , got confused statement: if array elements non-negative, can use binary search find answer in o(n log s) time, s maximum sum of subarray." can explain above statement. assume have array sum , @ index ith store sum of element 0 ith , so, if element non-negative, sum[0] <= sum[1] <= sum[2] ... <= sum[i] ... <= sum[n - 1] we notice that, sum of sub array (i, j) of array a sum[j] - sum[i - 1] so, given number x, can calculate rank of number sum of sub array of follow: int rank = 0; for(int = 0; < n; i++){ int index = minimum index sum[i] - sum[index] >= x; //as sum[0] <= sum[1] <=... , can use binary search find index rank += index; } finally, find number kth number, can use binary search in range o s , use above algorithm calculate rank, s maximum sum of subarray. int start = 0; int end = s; while(start <= end){ int mid = (start + end) >> 1; int rank = calrank(mid , su

mysql - Trying to optimize graph query on massive table -

i'm trying find way query huge table graph statistics. here's how i'm forming graph data. day on x-axis , amount y-axis. select date_format(earning_created, '%c/%e/%y') day, count(earning_link_id) amount earnings earning_link_id = 1093 group date(earning_created) took 21.8s....earnings has 550,000 rows. i'm in process of setting read replica server, brute force, not elegant query approach. i wonder how can optimize type of query, can graph data quickly? as suggested in comments, table may lacking of index. the obvious earning_link_id it's column used in where condition. as side note when have performance issues on requests and/or want optimize them, use explain , explain extended . show how mysql scans table answer query. if table has no index filtered columns ( where condition ) scan rows costly; whereas index on earning_link_id mysql don't need scan whole table find affected rows ( for query ).

entity relationship - Maximum number of tuples in this relation R , ER model? -

Image
answer given : 1000 i don't understand side it's many-one relation , side it's one-one relation. there many er diagramming conventions, , haven't explained or given reference yours. included expressing cardinalities, , in particular cardinalities n-ary relationships n > 2. googling text of question: diagram appears in (different) question in this solution says of diagram: (i) unique pair (a,b) there can unique value of c in relationship set r , and (ii) unique pair (a,c) there can unique value of b in r . so seems arrow indicates target entity appears once a given appearance of combination of others in relationship set. there's @ 1 c per (a,b) pair; every {a,b} pair unique in set. there @ 10*100 entities. there's @ 1 b per (a,c) pair; every {a,c} pair unique in set. there @ 10*1000 entities. from both those, know there @ 1000 entities. there 10*100 entities, since each possible (a,b) pair appear in set each different c

WILDFLY - Loading jar dynamically java.lang.ClassNotFoundException -

i have ear deployed in wildfly , i'm loading jar source code: file file = new file("c:\\xxxx\\xxxx\\processtest.jar"); string lcstr = "com.package.test.testprocess"; urlclassloader cl = urlclassloader.newinstance(new url[]{file.tourl()}); class<?> loadedclass; try { loadedclass = cl.loadclass(lcstr); iprocess data = (iprocess)loadedclass.newinstance(); data.start(); } catch (exception e) { e.printstacktrace(); } the testprocess class implements iprocess loaded in jar ear. when run server code , class being casted receive: java.lang.noclassdeffounderror: com/package/test/process/iprocess if added interface in jar i'm loading problem castexception because com/package/test/process/iprocess loaded wildfly different of loaded jar. i need receive iprocess (casting object), because solution call directly method mehtod.invoke it's not solution problem. thanks in advanced. with tip works perfectly: ur

php - Using Captcha with Symfony2 (2.8) -

i installed captcha bundle using following instruction : add "gregwar/captcha-bundle": "1.0.0" require section in composer.json run windows powershell in root , call php composer.phar update console outputs warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0 loading composer repositories package information updating dependencies (including require-dev) nothing install or update generating autoload files incenteev\parameterhandler\scripthandler::buildparameters updating "app/config/parameters.yml" file sensio\bundle\distributionbundle\composer\scripthandler::buildbootstrap warning: php startup: unable load dynamic library 'c:\xampp\php\ext\php_yaml.dll' - nie mo┐na odnalečŠ okreťlonego modu│u. in unknown on line 0 sensio\bundle\distributionbundle\composer\scripthandler::clearcache warning: php startup

javascript - AngularJS filter with nested objects -

here i'm trying create list menu items food court. want filter out list based on search input box. angularjs default filter not applying filter on each of value present in list. example results populated i'm able filter out based on item name(like keywords idly, dosa) , price, not foodcourt name, vendor name(i.e kamath) , foodtype (i.e breakfast,lunch,dinner). html: <div ng-app="fcapp" ng-controller="fccontroller"> <div class="control"> <input type="search" ng-model="txtsearch" placeholder="search here"/> </div> <div id="menu"> <div ng-repeat="foodcourt in fcmenu" > <div ng-repeat="vendor in foodcourt.foodcourtdetails"> <div ng-repeat="foodtype in vendor.vendordetails"> <div class="fooditem" ng-repeat="fooddetails in foodtype.food

Get Last Date of Given Month and Year in c# -

i want c# code getting last date of week given month , year. suppose given month 1 , year 2016 method should return me --01/02/2016 --01/09/2016 --01/16/2016 --01/23/2016 --01/30/2016 --02/06/2016 public static datetime getlastdateofweek(int yr, int mnth, int week) { datetime dt = new datetime(yr, mnth, 1); datetime newdate = new datetime(); if (dt.dayofweek == dayofweek.monday) { newdate = dt.adddays(((week - 1) * 7) + 5); } else { newdate = dt.adddays((8 - (int)dt.dayofweek) % 7 + ((week - 2) * 7) + 5); } return newdate; }

c# - System.Data.Sqlite 1.0.99 guid comparison doesn't work -

i using system.data.sqlite 1.0.99 c#, can call db ef. faced problem when selecting firstordefault guid return null (but row such guid exists in database): var user = context.users.firstordefault(x => x.id == userid); //returns null //or var user = context.users.where(x => x.id == userid).toarray(); //returns empty array found information known issue , fixed in 1.0.95, broken again in 1.0.97 , next 2 solutions: solution 1: set binaryguid property on connection string true: data source=...;binaryguid=true; solution 2: set next environment variable (before make connection): environment.setenvironmentvariable("appendmanifesttoken_sqliteprovidermanifest", ";binaryguid=true;"); solution 2 works, because (from sqlite site): appendmanifesttoken_sqliteprovidermanifest - if environment variable set [to anything], used system.data.sqlite.linq.sqliteprovidermanifest class (and system.data.sqlite.ef6.sqliteprovidermanifest class) modify future p

matlab - How to code a vectorized expression that depends on other vectorized expression? -

if example have 3 expressions: a , b , c follows: a(i+1) = a(i) + c(i).k b(i+1) = b(i) + a(i).h c(i+1) = a(i) + b(i) where k , h constants , m , n desired size of c . i previous obtained value, i+1 next value. now, if use for loop, can code as: a(1)= 2; b(1)= 5; c(1)= 3; i=1:10 a(i+1) = a(i) + c(i)*2; b(i+1) = b(i) + a(i)*3; c(i+1) = a(i) + b(i); end and works fine. want code in vector form , in without having use loop. problem not know how around dependency of: a on previous value , previous c value b on previous values , previous c value of a c on previous values of a , b here's matrix-based way obtain n -th value of [a;b;c] vector. wouldn't call vectorization, speed things considerably you: [a,b,c] = deal(zeros(11,1)); a(1)= 2; b(1)= 5; c(1)= 3; %% // original method k=1:10 a(k+1) = a(k) + c(k)*2; b(k+1) = b(k) + a(k)*3; c(k+1) = a(k) + b(k); end %% // matrix method: %// [ ] [1 0 2][ ] %// | b | = |3 1

Is model packet reusable in swagger-ui2.1.4 -

i using swagger-ui api documentation,thing working fine, doubtful models have used in methods, did have make different model every method? using same model 2 or 3 different properties. there way restrict properties in swagger-ui not show in specific method , show same property in next method, or have make separate copy every method? dummy code not allowing me post.

asp.net - How to split columns in itextsharp? -

Image
i have 200 columns.i want set 50 columns in 1 page,total 4 page.i used doc.newpage() but not affect in page?how can split 200 column 50 in 4 pages.now looks like there different ways this. the first way explained in answer question what's easy print "first right, down"? in tabletemplate example, write full table pdftemplate bigger single page: pdfptable table = new pdfptable(15); table.settotalwidth(1500); pdfpcell cell; (int r = 'a'; r <= 'z'; r++) { (int c = 1; c <= 15; c++) { cell = new pdfpcell(); cell.setfixedheight(50); cell.addelement(new paragraph(string.valueof((char) r) + string.valueof(c))); table.addcell(cell); } } pdfcontentbyte canvas = writer.getdirectcontent(); pdftemplate tabletemplate = canvas.createtemplate(1500, 1300); table.writeselectedrows(0, -1, 0, 1300, tabletemplate); once table completed, can distribute tabletemplate object on different pages: for (in

mysql - Use SUM of colum values condition in select query with another condition -

i have table called stock.it have columns named item_id , 'qty' , 'branch_id' . need select item ids sum of 'qty' column grater 0 , branch_id equal 4. i have try query need view item_id column . prints total column too. select `item_id`, sum(`qty`) total `stock` group `item_id` having total > 0 , branch_id = 4 help please. try query group clause , having select b.item_id ( select item_id, sum(qty) total stock branch_id = 4 group item_id having total > 0 ) b or query: select item_id stock branch_id = 4 group item_id having sum(qty) > 0

android - Messaging approach for mobile consumers -

i have thousands of mobile devices in system. connected central server. need have mechanism update them based on event specific devices following (notify topic). let's have chats on server , mobile user can follow chat , want efficiently recieve notifications of new messages in chat. primary mobile platform android. i'm thinking use messaging using topic (per chat): kafka or rabbitmq. please give advice mobile consumers. honestly, recommendation don't try build yourself. there ton of pitfalls going run - more before hit scale. need worry things handling network connection drops, synchronization, data payloads, rich message handling - list goes on. btw, previous company building app , had on 500 engineers tried build - , failed miserably. know because we've built - it's called magnet message. check out we've got @ http://developer.magnet.com . created concept of channels precisely you're talking , ways reliably deliver messages. let

scala - How to parse a byte stream into `HttpRequest` objects with akka-http? -

from documentation : "there's no public api provided parse (or render to) strings or byte arrays". how can use private api parse network stream httprequest objects? also, should input-byte-stream be? unordered packets (ethernet , up) unordered tcp packets ordered tcp payloads (http raw requests, in order) (this guess) note: my byte stream contain http requests, not responses i'm getting byte stream pcap file, not live http client. (which why i'm asking how need parse before sending akka-http) if think it's bad idea, please explain, big too. i suspect involves using http().serverlayer. i'm not sure. link : related question in akka google group thanks! this possible, fiddly. have done this, can't post full code here, it's private. the relevant akka code in httprequestparser most of code package-private, you'll need write helper class of own in akka.http package access it. the code this: package akka.htt

.net - Run application after database is deploy -

i have database project in visual studio 2013. after deployment of database objects triggered several sql scripts insert, or update records in tables. after total deployment, including post-deployment scripts needed run custom console application sends e-mails according list server administrators information successful or unsuccessful deployment. is possible in database project?

nspredicate - How do I filter NSMetadataQuery -

Image
i trying create nsmetadataquery predicate. @ point may want gather videos icloud may have @ point images. don't want else, search videos or search images. not both @ same time. i have created code: cfstringref whattofilter = kuttypeimage; if (self.filtertype == kkindvideo) { whattofilter = kuttypevideo; } nspredicate *predtype = [nspredicate predicatewithformat:@"(%k == %@)", nsmetadataitemcontenttypekey, whattofilter]; nsmetadataquery *newquery = [[nsmetadataquery alloc] init]; [newquery setsearchscopes:@[nsmetadataqueryubiquitousdocumentsscope]]; newquery.predicate = predtype; as add predicate newquery gives me 0 results. what correct syntax query? don't tell me predicate not working nsmetadataquery , because sort not working either. the best way create correct nsmetadataquery predicate use finder's query expression editor, so: then save smart folder , get info on resulting folder: the relevant spotlight query syntax is, i