Posts

Showing posts from January, 2012

android - Use of Classes in Cocos2d-x to create an "Enemy" to extend Layer -

pretty new cocos2dx , c++ objective-c background. i'm making game can have between 1-10 enemies on screen @ time. each enemy has 1 sprite body , 2 stats (health & damage). in past objective-c i've been able define class.h/class.mm file , fill many variables want (health, speed, height, weight, color, etc), i'm having trouble figuring out how in cocos2dx. here simplified project isolates problem i'm having. i'm sure it's straight forward i'm having trouble looking solution //-----enemy.h #include "cocos2d.h" using_ns_cc; class enemy : public cocos2d::layer{ public: virtual bool init(); create_func(enemy); void sethealth(int val); private: int myhealth; sprite *body; sprite *weapon; }; //-----enemy.cpp #include "enemy.h" using_ns_cc; bool enemy::init() { if ( !layer::init() ) return false; return true; } void sethealth(int newhealth) { //myhealth = newhealth; } //-----hellow

java - containsValue vs contains method of Hashtable -

whats difference between containsvalue , contains method of hashtable http://docs.oracle.com/javase/7/docs/api/java/util/hashtable.html there isn't one. emphasis mine. returns true if hashtable maps 1 or more keys value. note this method identical in functionality contains (which predates map interface). so can use either one, perfer containsvalue() because bit more self-explanatory, that's me. the reason there 2 different methods same thing because hashtable implements map<k, v> interface. don't know if you've used interfaces yet, classes implement interface required have methods defined in interface . so, because map has definition boolean containsvalue(object value); classes implement (like hashtable ) has have method. that's why containsvalue() exists. then why have have contains() ? well, that's because contains() existed before map interface existed (see documentation snippet above). contains() came first, that

Merging 2 SQL Server Databases Structures -

Image
my system started life single winforms application single database using entity framework. down line, database branched off encompass new system extended new tables. main employee table renamed person, , associated fk references renamed term person in columns. the existing system has since changed in terms of database structure new tables added. something like: now want bring 2 databases in line, keeping person table on employee. need bring 2 entity frameworks together. need tips , pointers on how this. luckily new system still in uat not live. have base population scripts this. i use nhydrate maintain both entity frameworks - db first. database side of things can cope with. however, unsure of best way bring entity frameworks in line. there tools have used sync databases such red gate's sql compare. vs2013 has nice sql schema compare. i have couple thoughts on different ways this: thought 1 manually add changes through ef database designer generate

ios - Inserting Subview Below UICollectionView -

when add subview below uicollectionview, subview shows above uicollectionview cells. here subview insertion code: [self.collectionview insertsubview:self.garmentview atindex:0]; not sure if i'm not following best practice or otherwise missing obvious. assistance appreciated. ** edit ** might worth noting happens in landscape, when rightmost cell zoomed in. i think self.garmentview.layer.zposition = -1 [self.collectionview insertsubview:self.garmentview atindex:0]; will solve problem. guess can happen collection view cells gets added lower index garmentview. see question more thorough discussion subview positions.

elasticsearch exclude results with value -

how can perform search excluding results field has specific value? i have database of reddit comments , want find bitcoin mentions, exclude bitcoin subreddit. curl -s -xget 'http://localhost:9200/_search?pretty=true&size=100' -d ' { "filtered": { "query" : { "match": { "body": "bitcoin" } }, "filter": { "not": { "term": { "subreddit": "bitcoin" } } } } }' the error long post here. https://gist.github.com/kylelk/feca416156712eebad3e it silly error, you have include filtered query inside query . here modification post _search { "query": { "filtered": { "query": { "match": { "body": "bitcoin"

javascript - validate login & redirect to success page using jquery validate plugin -

i new advance level of jquery scripting , here using jquery validation login page. if login page success has redirect success page code working fine below code when click submit button . <form id="form1" name="login" method="post" action="mainpage.html"> </form> here code $(function (){ $("#form1").validate({ // specify validation rules rules: { username: { required: true, email: true }, password: { required: true, minlength: 5 } }, // specify validation error messages messages: { username: "please enter valid email address", password: { required: "please provide password", minlength: "your password must @ least 5 characters long" }, submithandler: function (form) { // demo $('#username').

Meteor js use http.get to retrieve json data from a webpage -

is possible use http.get on client side retrieve json data , store string? i need json site https://blockchain.info/address/15cnko3ztmycba8goaysz6gwfy1vclgfji?format=json , store string later parsing. the above site address wallet chosen @ random. you can perform http.get on client. as per documentation it's available anywhere (client , server) however, example you've provided isn't on same domain app, , hasn't provided access-control-allow-origin headers permit cross-domain requests. so requests client fail. from wikipedia: the same origin policy prevents document or script loaded 1 origin getting or setting properties of document origin. policy dates way netscape navigator 2.0.

MySQL syntax error in Stored Procedure -

what wrong stored procedure below? it's telling me there syntax error on if statement? i'm pulling hair out trying figure out. works fine if remove "create table" statement, , works fine if remove "if end if" statement! create definer=`dbo514733022`@`%` procedure `si_proc1`(in `param1` int, in `param2` int) not deterministic reads sql data sql security definer create temporary table a(columna int); if 4 > 3 select * a; end if; you have change delimiter character apart standard ; since have multiple statements in procedure. mysql thinks, procedure finished after create temporary... statement, therefore syntax error. control structures if ... then or while not allowed in usual queries. do this: delimiter $$ create definer=`dbo514733022`@`%` procedure `si_proc1`(in `param1` int, in `param2` int) not deterministic reads sql data sql security definer create temporary table a(columna int); if 4 > 3 select * a; end

hibernate - QueryDSL generates cross join -

i looking offer content filtering results. (edited brevity) entities following: node: @entity @inheritance(strategy = inheritancetype.joined) public abstract class node { @id @generatedvalue public integer id; } scene: @entity public class scene extends node { @onetomany(mappedby = "scene", /*fetch = fetchtype.eager, */cascade = cascadetype.all) public list<source> sources; } source: @entity public class source extends node { @manytoone public scene scene; @enumerated(enumtype.ordinal) public sourcetype type; } what follows example of filter wish implement. given collection of sourcetypes wish select scenes such scene referred source of each 1 of types. achieve using querydsl following predicate: private predicate filterbysourcetype(collection<sourcetype> it) { booleanbuilder bb = new booleanbuilder(); (sourcetype st : it) bb.and(qscene.scene.sources.any().type.eq(st)); return bb.getv

c++ - Error building openCV - dumpOpenCLDevice() method error -

i have been trying build opencv on week using instructions @ http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html , http://miloq.blogspot.com/2012/12/install-opencv-ubuntu-linux.html every time 'make' step, error: in file included /home/sello/opencv-2.4.9/modules/nonfree/perf/perf_main.cpp:28:0: /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp: in function ‘void dumpopencldevice()’: /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:88:9: error: ‘platformsinfo’ not member of ‘cv::ocl’ /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:88:32: error: expected ‘;’ before ‘platforms’ /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:89:9: error: ‘getopenclplatforms’ not member of ‘cv::ocl’ /home/sello/opencv-2.4.9/modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp:89:37: error: ‘platforms’ not dec

magento - SQLSTATE[HY000]: General error: 2006 MySQL server has gone away - What to do? -

here , don't know do.... there has been error processing request sqlstate[hy000]: general error: 2006 mysql server has gone away trace: #0 /home/autobadges/public_html/stangcenter.com/lib/zend/db/statement.php(300): zend_db_statement_pdo->_execute(array) #1 /home/autobadges/public_html/stangcenter.com/lib/zend/db/adapter/abstract.php(479): zend_db_statement->execute(array) #2 /home/autobadges/public_html/stangcenter.com/lib/zend/db/adapter/pdo/abstract.php(238): zend_db_adapter_abstract->query('select `main_ta...', array) #3 /home/autobadges/public_html/stangcenter.com/lib/varien/db/adapter/pdo/mysql.php(333): zend_db_adapter_pdo_abstract->query('select `main_ta...', array) #4 /home/autobadges/public_html/stangcenter.com/lib/zend/db/adapter/abstract.php(734): varien_db_adapter_pdo_mysql->query(object(varien_db_select), array) #5 /home/autobadges/public_html/stangcenter.com/lib/varien/data/collection/db.php(783): zend_db_adapter_abstract->fe

php - problems on file upload breaking GIF images -

hello have added simple image resize breaking gif animations. me decipher here needs removed existing code allow image uploaded , animated in gif form...thank input. case 'addgift': if($adminlevel == 4) { if ($_files['uploadedfile']['tmp_name'] != "") { $image = new simpleimage(); $image->load($_files['uploadedfile']['tmp_name']); $width = $image->getwidth(); $height = $image->getheight(); if($width > 64) { $height = (64/$width)*$height; $width = 64; } if($height > 64) { $width = (64/$height)*$width; $height = 64; } $image->resize($width,$height); if(preg_match("/\.

php - How to add an Event Listener to a dynamically added field using Symfony Forms -

i using event listeners dynamically modify form. want add event listener field added dynamically. im not sure how accomplish this. public function buildform(formbuilderinterface $builder, array $options) { $builder->add('first_field','choice',array( 'choices'=>array('1'=>'first choice','2'=>'second choice') )); $builder->addeventlistener(formevents::pre_set_data, array($this, 'presetdata')); $builder->get('first_field')->addeventlistener(formevents::post_submit, array($this, 'postsubmit')); } public function presetdata(formevent $event) { $form = $event->getform(); $form->add('second_field','choice',array( 'choices'=>array('1'=>'first choice','2'=>'second choice') )); //some how add event listener field } public function postsubmit(formevent $event) { $for

c# - How to make X-Scroll in a gridView asp.net? -

Image
i'm trying add scroll bars in both x , y can add y-scroll. @ moment, gridview showing partial data, missing 3-4 columns need use x-scroll. i've tried "overflow-x: scroll;" doesn't work. my source code <div style= "overflow-x:scroll; overflow:scroll; max-height: 150px; width: 800px"> <asp:gridview id="gridviewupbus" runat="server" autogeneratecolumns="false" font-names="arial" font-size="small" horizontalalign="center"> <columns> <asp:boundfield datafield="subcatid" headertext="sub category id"> <itemstyle width="10%" /> </asp:boundfield>

parsing - Explain the syntax of reserved.get(t.value,'ID') in lex.py -

code taken ply.lex documentation: http://www.dabeaz.com/ply/ply.html#ply_nn6 reserved = { 'if' : 'if', 'then' : 'then', 'else' : 'else', 'while' : 'while', ... } tokens = ['lparen','rparen',...,'id'] + list(reserved.values()) def t_id(t): r'[a-za-z_][a-za-z_0-9]*' t.type = reserved.get(t.value,'id') # check reserved words return t for reserved words, need change token type . doing reserved.get() passing t.value understandable. should return entities in second column in reserved specification . but why passing id ? mean , purpose solve? the second parameter specifies value return should key not exist in dictionary. in case, if value of t.value not exist key in reserved dictionary, string 'id' returned instead. in other words, a.get(b, c) when a dict equivalent a[b] if b in else c (except presumably more efficient,

eclipse - Errors while importing an android application -

i have android application working fine in system. copied project system , trying install on different system. same project working fine on system doesn't build on new system. there no change in coding , sdks installed. style sheet file has following error style: error: error: no resource found matches given name: attr 'android:overscrollmode'. in other files getting import r can not resolved error. i have selected google api 2.2 android build target. minsdkversion set 8 in androidmaifest.xml there else need change in project settings? regards pankaj overscrollmode added api 9. change minsdkversion , fix problem. the errors regarding r caused error in xml files.

javascript - How to post UL appended messages to php -

i have site in appended messages submitted unordered list act messenger/chat system. problem, site active, messages appended dont appear on other users screens. meaning messages submit, local screen. need if message submitted, appears see. now i'm pretty sure because messages arent powered php, theyre not being uploaded server. theyre staying local. how upload these messages server? javascript? able working? my html is: <ul id="messagebox" ></ul> <div> <input type="text" id="typetextbox" maxlength="100" autocomplete="off" /> <button type="submit" id="submit" onblur="submit"> </button> </div> and javascript is: $(document).ready(function(){ $('#typetextbox').keypress(function (e){ if(e.keycode == 13 ) $('#submit').click(); }); $('#submit').click(function(){ var message = $('#typetex

Google Form : How to not allow duplicate answer in Grid? -

Image
here form tried do. have 5 classes , want know priority level of classes student.i don't want them select same level priority different classes not found type of question pattern in google form. i tried grid type,it allow 1 response per row, me.but allow same answer 1 column, don't want.example student can select class 1 , class 2 same priority 1. the answer expected student 1 priority 1 class , priority should different other class.is there anyway achieve in google form? you have 2 options solve issue. switch classes column heading , priority rows. click small arrow next advanced settings @ bottom of question in edit mode. click box next "limit 1 response per column." hope helps!

java - ActionListener for Buttons -

so have developed program class of mine use actionlistener events when button clicked. have program working when clicking button have click input buttons multiple times answer register , move next level of program. example1: alert button open's 2 3 "hey there's bug on you!" message dialogs. example2: yes/no prompts 3-4 times return yes/no answer txt. example3: color takes 3/4 clicks before returning input txt. (i think picture...) for life of me cannot find out why won't take 1 input , move on... the code of program review... thank in advanced. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class messageboxes{ private jbutton alert = new jbutton("alert"); private jbutton yesno = new jbutton("yes/no"); private jbutton color = new jbutton("color"); private jbutton vals = new jbutton("3 vals"); private jbutton input = new jbutton("input"); private jtextfield

sympy: trigonometric sum-product identities -

i have expression: sin(x)+sin(y) there well-known trig identity express product of sin , cos. is there way sympy apply identity? simplify , trigsimp nothing. trigsimp , aristocrates points out, reverse, because sin(x) + sin(y) simpler 2*sin((x + y)/2)*cos((x - y)/2) . trigsimp internally uses algorithm based on paper fu, et. al. , pattern matching on various trigonometric identities. if @ source code , identities written out in individual functions (the functions named after sections in fu's paper). looking @ list of simplifications @ top of file, 1 want tr9 - contract sums of sin-cos products testing out, looks works in [1]: sympy.simplify.fu import tr9 in [2]: tr9(sin(x) + sin(y)) out[2]: ⎛x y⎞ ⎛x y⎞ 2⋅sin⎜─ + ─⎟⋅cos⎜─ - ─⎟ ⎝2 2⎠ ⎝2 2⎠ we factor these out more user-friendly functions, now, fu.py file pretty documented, if function names not particularly memorable.

regex - How to check whether the string has a starting character is special characters : javascript -

how find if starting character of string has special characters ? the string can start alphanumeric should not start special characters. if string starts special characters including space should alert user input invalid. like this, testing whether first character of string in accepted range of [a-za-z0-9] : var s = "_whatever string_"; if(!/^[a-za-z0-9]/.test(s)) { alert ("invalid string"); }

qt - Show control and handle large rows for QTableView -

i implement chat application (like skype) using qtablewidget display chat messages, it’s slow when display many messages (because each message widget, if chat has 1000 messages, it’ll create 1000 widgets , add qtablewidget .. slow , cost memory :( ) i tend change on qtableview, have read docs , see qtableview display large message, it’s hard display control can interact. ex: need display text can select , button can click, v..v. using paint not enough, it’s … paint pixel, not real control , can’t select text or click button. i had search , try solution setindexwidget, way seem … qtablewidgets (because create 1000 buttons if have 1000 message well) is can suggest me instructions :( you i had implement sample qtable widgets can display control reuseable widgets (base on idea of modal-view-controller) it's not complete +_+ please check more details: https://github.com/tranquan/kjtableview

ios - Cant get array PFQuery objects from parse code block -

i dont know deal parse reason wont allow me save retrieved array mutable array created. works inside parse code block once outside, displays null. please? pfquery *query = [pfquery querywithclassname:@"comments"]; [query wherekey:@"flirtid" equalto:recipe.flirtid]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { comments = [[nsmutablearray alloc]initwitharray:objects]; // found objects (pfobject *object in objects) { } } else { // log details of failure nslog(@"error: %@ %@", error, [error userinfo]); } }]; nslog(@"%@",[comments objectatindex:0]); it's working should. should read on how blocks work. edit: try reading apple's documentation you're nslogging 'comments' before comments gets set. how work? see, query running in background, , take bit of

c++ - Accepting lambda as function parameter and extracting return type -

this question has answer here: how convert lambda std::function using templates 6 answers i need accept lambda function parameter , figure out return type. far, couldn't come workable. here example: template <typename t1, typename t2> t1 foo(t2 arg, std::function<t1(t2)> f) { return f(arg); } ... int n = foo(3, [](int a){ return + 2; }); <-- error! how can done? boost solution ok, too. you shouldn't pass std::function parameter. has overhead because uses type erasure store type of callable, such function pointers, functors, lambdas (which automatically generated functor), etc. instead, should template function type. can use trailing return type figure out return type of function: template <typename t, typename function> auto foo(t arg, function f) -> decltype(f(arg)) { return f(arg); }

oracle11g - sql to generate a column by manipulating previous row and previous column -

i have following in table c1 1 4 3 2 2 i need generate c2 as: c1 c2 1 1 4 5 3 8 2 10 2 12 the first row of c2 c1 row value. need add c1's 2nd row , c2's first row c2's second row.for third row of c2, c2= c1's third + c2's second , on... i need in sql. possible? i use oracle 11g. your algorithm simplify running total: create table c2 select c1 , sum(c1) on (order rowid) c2 c1; the order issue - can't order null . have used rowid given example doesn't order c1 . if doing running total, must decided running against!

css - Rectangle with two cut edges -

Image
i'm not sure specific name shape can called "half parallelogram" ? want make shape purely using css/css3 . help? or tutorial? you can using pseudo-elements below. approach cut out triangle shape left-bottom , top-right of box. method can used either solid color image inside shape long body background solid color. when body background non-solid color approach not work because border hack needs solid color background. the advantage of method can support cuts of different angles @ each side (like in question hypotenuse of triangular cut on either side not parallel each other). div { background: red; width: 200px; height: 100px; position: relative; } div:before { position: absolute; height: 0; width: 0; content: ' '; border: 20px solid white; border-color: transparent transparent white white; border-width: 20px 0px 0px 15px; left: 0; top: 80px; } div:after { position: absolute; height: 0; width

c# - culture name ne-NP not supported -

i have host application built in c#.net, asp.net , backend oracle. application hosted in 1 of server , running smoothly. have copied files , folder in server same configuration of running server. the version of iis 6.0 , machine has windows server 2003 running on it. when deploy application following error message while browsing. please me issue. culture name 'ne-np' not supported. parameter name: name description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.argumentexception: culture name 'ne-np' not supported. parameter name: name source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [argumentexception: culture name 'ne-np' not supported. parameter name: name] system.globalizat

hibernate - hql - LazyCollectionOption.FALSE on query -

i have field declaration on role class: @onetomany(mappedby = "role") private set<user> users; and query this: "select r role r left join fetch r.users u" the users elements size return 1 (incorrect result) should more one. when annotated users field @lazycollection(lazycollectionoption.false) , , removed fetch on query, returns collect result. any idea why cant't work using fetch on query? not want resort on @lazycollection(lazycollectionoption.false) expensive call everytime. update: initial workaround on dao iterate on return list , call getusers on each (using workaround, able retrieve correct count results well). public list<role> getroles(){ query query = session.createquery("select r role r left join fetch r.users u"); list<role> results = query.list(); (role item: results){ log.info("size {}", item.getusers().size()); } } will post more code snippet tomorrow overriden equal

php - Printing the repeated values -

how rid of repeated values ..... foreach($get_all $key => $value) { $v = 1; foreach($value $loc) { foreach($loc $l) { $new[] = $l['id']; } } $new = array_unique($new); $total = count($new); unset($new); if($v) { $v =0 ; $body .= "<tr><td>{$value[0][0]['location']}</td><td>{$total}</td></tr>"; continue; } } the above code gives ouptput: koramangala 63 koramangala 63 indiranagar 36 koramangala 63 indiranagar 36 mg road 16 koramangala 63 indiranagar 36 mg road 16 btm 35 but need : koramangala 63 indiranagar 36 mg road 16 btm 35 what have chage required output?/?? you can this $printed = array(); // initialize array store printed values foreach($get_all $key => $value) { $v = 1; foreach($value $l

css3 - Trying to make a CSS button that grows on hover, with text remaining the same size -

page buttons here: http://teamcherry.com.au/jam-games/ the effect i'm trying achieve links on page button expands when hovered, text remaining same size, , text staying in same position on screen (so button doesn't appear 'move' when changing size). after researching while, i've managed achieve desired effect using below css, changes padding margin on hover using css transition: a.btn { display: inline-block; background-color: #d11b34; color: #fff; text-decoration: none; font-size: 20px; padding: 10px; padding-right: 20px; padding-left: 20px; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; transition: 0.3s ease 0s; } a.btn:hover { background-color: #a61529; padding: 15px; padding-right: 25px; padding-left: 25px; margin: -5px; } this achieves effect, effect super jittery when animating in chrome (and possibly other browsers) , button seems quiver when hove

Java 8 - Streams Nested ForEach with different Collection -

i try understand new java 8 streams , tried days transfer nested foreach loops on collection in java 8 streams. is possible refactor following nested foreach loops including if-conditions in java-8-streams? if yes like. arraylist<classinq> inq = new arraylist<>(); treemap<string, salesquot> quotations = new treemap<>(); arraylist<classinq> tempinqandquot = new arraylist<>(); arraylist<salesquot> tempquotpos = new arraylist<>(); (classinq siminq : this.inq){ if (!siminq.isclosed() && !siminq.isdenied()){ (map.entry<string, salesquot> quot: quotations.entryset()){ salesquot sapquot = quot.getvalue(); if (sapquot.getinquirydocumentnumber().compareto(siminq.getsapinquirynumber()) == 0){ siminq.setsapquotationnumber(sapquot.getquotationdocumentnumber()); tempinqandq

ruby on rails - Redirect making a PATCH request instead of GET -

i'm making ajax patch request application.js file: $.ajax({ type: "patch", url: "/units/" + id, data: { 'var_1': var_1, 'var_2': var_2,}, success:function(){ alert("details saved successfully!!!"); }, datatype: "text" }); // stop normal form submission behaviour $("#add_form").submit(function(e){ return false; }); this request received controller, , attributes of object updated. try redirect index page particular id. units_controller.rb if @unit.update_attributes( ** data ** ) flash.notice = "successfully updated " redirect_to :controller => "/units", :action => "index", :id => params[:id] end my issue redirect_to call contains patch method request , therefore returns routing error. should request, per routes.rb file: resources :units, except: :show '/units/index' => 'units#index&#

asp.net - In asyncfileupload check content type -

in asyncfileupload want check zip , rar try following code protected void fileuploadcomplete(object sender, asyncfileuploadeventargs e) { string type = fileupload1.contenttype; } when upload zip or rar file in type variable when debug type "application/octet-stream". how can check zip or rar file. can check using javascript after how can upload on server if use javascript checking. try this: httppostedfile fileupload1 = context.request.files[0]; system.io.fileinfo fileupload1info = new system.io.fileinfo(up.filename); string ext = fileupload1info.extension; if(ext!='.zip' || ext!='.rar'){ //your logic }

outlook web app - 550 5.7.1 Client does not have permissions to send as this sender (office365) -

i m trying send email following configuration host: smtp.office365.com port: 587 user: "myemail@domain.com" pass: "mypassword" i m getting following exception : 550 5.7.1 client not have permissions send sender i have gone through many forums told me set send permission mailboxe m not able find such configuration in oulook web app...or need configure somewhere else , if where..???....i have used above configuration sending mails , have not done config outlook web app...what need change , configure in outlook web app .... beware error might occur when from email not match username . so, sure test value myemail@domain.com same on user , from . if works when both fields have same value , doesn't work when different user, means should contact company responsible email server , ask them create shared account , add sendas priviledges account.

c++ - Could not find a match for std::string::basic_string(std::istreambuf_iterator<char, std::char_traits<char>>, std::istreambuf_iterator<char, std:: -

the following innocuous function fails compile on solaris studio 12.3 #undef _rwstd_no_member_templates #include <fstream> #include <string> #define _rwstd_no_member_templates std::string fetchdata(const std::string& fname) { std::ifstream fin(fname.c_str()); std::string data; if (fin) { data = std::string((std::istreambuf_iterator<char>(fin)), std::istreambuf_iterator<char>()); } return data; } int main() { return 0; } which fails error message could not find match std::string::basic_string(std::istreambuf_iterator<char, std::char_traits<char>>, std::istreambuf_iterator<char, std::char_traits<char>>) needed in ootest::fetchdata(const std::string &) . now checked file std::string , found following #ifndef _rwstd_no_member_templates template <class _inputiterator> basic_string (_inputiterator, _inputiter

java - regular expression for key=(value) syntax -

Image
i writing java program regular expression struggling pretty new in regex. key_expression = "[a-za-z0-9]+"; value_expression = "[a-za-z0-9\\*\\+,%_\\-!@#\\$\\^=<>\\.\\?';:\\|~`&\\{\\}\\[\\]/ ]*"; chunk_expression = "(" + key_expression + ")\\((" + value_expression + ")\\)"; the target syntax key(value)+key(value)+key(value) . key alphanumeric , value allowed combination. this has been okay far. however, have problem '(' , ')' in value. if place '(' or ')' in value, value includes rest. e.g. number(abc(kk)123)+status(open) returns key:number , value:abc(kk)123)+status(open supposed 2 pairs of key-value. can guys suggest improve expression above? get matched group index 1 , 2 ([a-za-z0-9]+)\((.*?)\)(?=\+|$) here online demo the above regex pattern looks of )+ delimiter between keys , values. note: above regex pattern not work if value contains )+ example n

Django - Populate DateTime field from other DateTimeField set with auto_now -

i'm trying populate last_version_date modified field set auto_now . in save method, if new version created want save modified date record. simplified example : class poll(models.model): question = models.charfield(max_length=200) modified = models.datetimefield(auto_now=true) version = models.integerfield(blank=false, default=1) last_version_date = models.datetimefield(auto_now_add=true,blank=false) def save(self, keep_history=false, *args, **kwargs): if keep_history: self.last_version_date = self.modified self.version = self.version + 1 return super(poll, self).save(*args, **kwargs) usage >>> p = poll.objects.create(question = 'test1') >>> p.save() >>> p.modified datetime.datetime(2014, 8, 18, 6, 50, 41, 820000, tzinfo=<utc>) >>> p.last_version_date datetime.datetime(2014, 8, 18, 6, 50, 38, 381000, tzinfo=<utc>) >>> p.created datetime.dat

javascript - jquery pass 2 ajax result outside ajax -

i have simple working ajax result. jquery.ajax({ type: "post", url: my_url_query success:function(response){ } }).done(function(response) { //assuming response currchild1 12 res1 = response; window.$vars = { currchild1: res1 }; window.$vars = { currchild2: res2 }; //----> how $.getscript( "assets/js/main/request_add_staff.js"); }); is posible create ajax pass vars getscript anyway think im looking.. async:false kinda long code. but if have idea shorten this... do. jquery.ajax({ type: "post", url: "index.php/form_dashboard/get/senior/"+ dataid, success:function(response){ }, error:function (xhr, ajaxoptions, thrownerror){ alert(thrownerror); }, async:fals

c# - Import image from Enterprise Architect to ms Word -

working on enterprise architect add-in want import image enterprise architect ms word using c#. have solved saving diagram/image .pdf file , reading again using itextsharp. seems me hard way around problem , therefore think there must more simple way image enterprise architect ms word using c#. why don't insert image straight document? //create document generator ea.documentgenerator generator; //initialize document generator create empty document (with no ea template) generator = repository.createdocumentgenerator(); generator.newdocument(""); //insert image document generator.documentdiagram(diagram.diagramid, 0, "diagram image template"); //save documrnt generator.savedocument(@"path/of/word/document/with/extension", 0); the "diagram image template" template have define in ea following these easy steps: 1. click f8 2.go templates tab 3.click on new button on bottom 4.give new template name "diagram

Deploy ember-cli + rails app in heroku? -

has deployed ember-cli + rails app in heroku one? https://github.com/bostonember/website if yes, how did/do deploy? i know ember-cli produces necessary code in dist/ dir, should placed (copied) under rails' public/ directory not sure how , when given heroku not allow write access in filesystem. if has done that, let me know :) the reason chose ember-cli instead of ember-rails gem don't want dependent on rails' gem developer. think ember-cli option long can deploy efficiently in heroku :d dockyard worked through example of during boston ember meetup. here's video . they posted code online, important part being deploy task of rakefile : task :deploy sh 'git checkout production' sh 'git merge rails-served-html -m "merging master deployment"' sh 'rm -rf backend/public/assets' sh 'cd frontend && broccoli_env=production broccoli build ../backend/public/assets && cd ..' unless `git statu

c# - Strange behavior string.Trim method -

i want remove spaces(only ' ' , '\t' , '\r\n' should stay) string. have problem. example: if have string test = "902322\t\r\n900657\t\r\n10421\t\r\n"; string res = test.trim(); // res still "902322\t\r\n900657\t\r\n10421\t\r\n" res = test.trim('\t'); // res still "902322\t\r\n900657\t\r\n10421\t\r\n" but if have string test = "902322\t"; trim() work perfectly. why behavior? how can remove '\t ' string using trim() method? string.trim method deals whitespaces @ beginning , end of string so should use string.replace method string test = "902322\t\r\n900657\t\r\n10421\t\r\n"; string res = test.replace("\t", string.empty); // res "902322\r\n900657\r\n10421\r\n"

Touch Event for images and sprites in Starling -

i have class name "tiles". , have class name "tilesmanager" manage tiles. in tilesmanager 25 tiles generating pool. how can listen each tiles touch event? need learn row , line info of touched tiles? for(var i:int=0; i<25; i++) { row = % 5; line = math.floor(i / 5); var b:tiles = pool.getsprite() tiles; b.x = 20 + row * 100; b.y = 20 + line * 100; b.row = row; b.line=line; tiles.push(b); play.addchild(b); } // make sure import starling event not flash 1 // event carry current triggered target , data (tile) b.addeventlister(event.triggered, ontiletriggered);

mysql - SQL: How to display the same item by group and the same group of the dates -

i'm new sql , need help. want display result this. want make "a:0:{}" not displayed , have dates in acsending order becuase dates messed up. how display result this? result: a:1:{s:1:"s";s:2:"aa";} 2014-08-12 a:2:{s:1:"s";s:2:"aa";} 2014-08-19 a:1:{s:1:"s";s:2:"aa";} 2014-08-19 a:3:{s:1:"s";s:2:"aa";} 2014-08-20 sample sql data site varchar(255) null default null, created datetime null default null, column name site column name created a:0:{} 2014-08-18 a:0:{} 2014-08-18 a:0:{} 2014-08-18 a:0:{} 2014-08-18 a:1:{s:1:"s";s:2:"aa";} 2014-08-19 a:2:{s:1:"s";s:2:"aa";} 2014-08-20 a:1:{s:1:"s";s:2:"aa";}

php - Autoload with composer of classes inside a single file -

i'm trying use library uses namespaces has part of code auto-generated generate more 1 class in single file. we use composer , tried add namespace define in psr-4 this "name\space\preffix\": "folder/where/the/file/is" but there's 1 file contains classes inside autoload doesn't find classes as, imagine, searches file same name class trying load. there way make composer autoload aware of situation , use autoload classes ? you have 2 other options besides psr-4 (or psr-0): classmap - scan directories or files classes contained, , result put php array in file. requires dump autoloader whenever there change being made files being scanned. files - mentioned file(s) included whenever composer autoloader included. so either add file autogenerated classes scanned classmap autoloader, load file on first usage of of classes in there, or add files autoloading, included, no matter if classes being used or not. if considering performance,

How to put notifications for ios with cordova-phonegap -

my company building mobile app. know if setting notifications mailling system in app possible? facebook chat notifies when have new message on phone. moment answer seems 'no, in native'. true? there (plugins, ...) it? thanks. ok bad, i've found : http://cordova.apache.org/docs/fr/3.1.0/cordova_notification_notification.md.html the developpers said wasn't possible, here is, it's possible.

php - create a find function to get string between characters -

(first question posted stack) i'm trying create function that: searches string variable value when variable value found, remove before variable value and remove after following pre-determined string here code: <?php $user_id = '5'; $week_start = "2014-8-01 00:00:00"; $week_end = "2014-09-01 23:59:59"; //get row information $result_show_picks = mysql_query(" select id, uid, pick, date_submitted picks_recorded uid = '" . $user_id . "' , date_submitted > '" . $week_start . "' , date_submitted < '" . $week_end . "' limit 1 ", $connection); if (!$result_show_picks) { die("database query failed: " . mysql_error()); } while ($row_picks = mysql_fetch_array($result_show_picks)) { echo "id = " .

MongoDB count aggregate per month -

is there way total number of documents in mongodb database months (for example, can display chart showing evolution of number of users) in single request? or should request each month individually? i don't want see number of users created in month total (this month + previous months). each document in collection has field representing date created. total number of documents in mongodb database months, use range query query documents value created_on greater date representing start of month, , less date representing end. assume start date 'start' , end date 'end'. query be, db.users.count({created_on: {$gte: start, $lt: end}}); here nice explanation relevant topic. http://cookbook.mongodb.org/patterns/date_range/ refer answers in thread also. find objects between 2 dates mongodb

c - gcc: how to only trace specific functions calls -

options -pg , -mfentry , -finstrument-functions affects functions in .c file, how can insert trace call specific functions, not all? i checked gcc function attributes seems there's no counterparts -pg , -mfentry , -finstrument-functions can used decorate specific functions. no_instrument_function excludes functions want opposite, i.e., includes functions. you can backtraces in c . method you'll have add code function want trace. here's simple example : #include <execinfo.h> #include <stdio.h> #include <stdlib.h> /* obtain backtrace , print stdout. */ void print_trace (void) { void *array[10]; size_t size; char **strings; size_t i; size = backtrace (array, 10); strings = backtrace_symbols (array, size); printf ("obtained %zd stack frames.\n", size); (i = 0; < size; i++) printf ("%s\n", strings[i]); free (strings); } /* dummy function make backtrace more inter

php - Prestashop make the integer explode in smarty -

i doing small module in prestashop. in have taken database (ps_customer_module) this id image_id customer_name 1 2 john 2 23 simon 3 45 doe 4 9 rocky now fetching total database module $get_users = 'select * '._db_prefix_.'customer_module; $users = db::getinstance()->executes( $get_users ); here when doing print_r($users). getting result this array ( [0] => array ( [id] => 1 [image_id] => 2 [customer_name] => john ) [1] => array ( [id] => 2 [image_id] => 23 [customer_name] => simon ) [2] => array ( [id] => 3 [image_id] => 45 [customer_name] => doe ) [3] => array ( [id] => 4 [image_id] => 9 [customer_name] => rocky ) ) now have assigned array