Posts

Showing posts from February, 2015

doctrine2 - Doctrine swap out table at runtime -

typically when implement entity using doctrine map table explicitly: <?php /** * @entity * @table(name="message") */ class message { //... } or reply on doctrine implicitly map class name table...i have several tables identical in schema not wish re-create class each time...there fore @ runtime (dynamically) change table name accordingly. where start or overriding implement odd requirement??? surprisingly (to me), solution simple. have classmetadata of entity , change name of table maps to: /** @var entitymanager $em */ $class = $em->getclassmetadata('message'); $class->setprimarytable(['name' => 'message_23']); you need careful , not change table name after have loaded entities of type message , changed them. it's big chance either produce sql errors on saving (because of table constraints, example), if lucky or modify wrong row (from new table). i suggest following workflow: set desired table name;

java - How can a JSR 330 dependency injector verify dependencies at build time? -

i looking @ jsr 330 ( javax.inject ) javadoc , confused following sentence: moreover, injector can verify dependencies have been satisfied @ build time . how possible?* implementations support this? *i guessing there must code generation involved, how code know being compiled in order generate code necessary statically verify dependencies met? spring framework support jsr-330 , can configured weaving @ compile time using aspectj compiler, means classes modified @ byte-code introduce dependency injection during compile phase. fault spring performs weaving @ runtime. see does spring aop compile time weaving or load time weaving?

Modifying my javaScript regex to accept forward slashes -

i took regex evaluating urls works nicely want use evaluate facebook accounts. example www.facebook.com/myname. how regex doesn't forward slash after .com. .directive('validatetheurl', function() { // hey chaps new ng 1.3 way custom validtae stuff..... var required_patterns = [/^(?:(ftp|http|https)?:\/\/)?(?:[\w-]+\.)+([a-z]|[a-z]|[0-9]){2,6}$/]; return { require: 'ngmodel', link: function ($scope, element, attrs, ngmodel) { ngmodel.$validators.theurl = function (value) { var status = true; angular.foreach(required_patterns, function (pattern) { status = status && pattern.test(value); console.log(status); console.log(value); }); return status; }; } } }) does know how update

jQuery.Mobile Date Picker - disable past dates -

i use jquery.mobile.datapicker.js, after select date in first input, in second have disable past dates written in first input. every solution proposed not able jquery.mobile.datapicker. admit being inexperienced in jquery , can ? data partenza <input name="data_partenza" id="data_partenza" value="<%=date()%>" data-role="date" type="text" style="position: relative; z-index: 100000;"> second input data partenza <input name="data_partenza" id="data_partenza" value="<%=date()%>" data-role="date" type="text" style="position: relative; z-index: 100000;"> data ritorno <input name="data_ritorno" id="data_ritorno" value="<%=date()%>" data-role="date" type="text" style="position: relative; z-index: 100000;">

email - How to send mail using Simple Java Mail framework? -

i use simple java mail framework sending mail. read documentation there - simplejavamail.org . my code: email email = new email(); email.setfromaddress("someone1", "someone1@aol.com"); email.setsubject("newsletter"); email.addrecipient("someone2", "someone2@aol.com", message.recipienttype.to); email.settext("some text"); email.settexthtml("there html"); new mailer("smtp.aol.com", 587, "testjavasimplemail@gmail.com", "hunter2", transportstrategy.smtp_tls).sendmail(email); but have error: июн 25, 2015 6:30:47 pm org.codemonkey.simplejavamail.mailer sendmail severe: null javax.mail.authenticationfailedexception @ javax.mail.service.connect(service.java:319) @ javax.mail.service.connect(service.java:169) @ javax.mail.service.connect(service.java:118) @ org.codemonkey.simplejavamail.mailer.sendmail(mailer.java:242)

javascript - Use .scss filename to determine gulp's output path -

let's have following directory structure: project │ ├destination │ ├abc │ │ └style.css │ ├def │ │ └style.css │ └ghi │ └style.css │ ├scss │ ├abc.scss │ ├def.scss │ └ghi.scss │ ├gulpfile.js ... is there way, using gulp, accept name of scss file being watched, , use means determine output path? so, when saving ghi.scss , result destination/ghi/style.css ? i've tried using gulp-filenames dependency, experience gulp limited. my current gulp file follows: var gulp = require('gulp'); var filenames = require("gulp-filenames"); var sass = require('gulp-sass'); var concat = require('gulp-concat'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); gulp.task('sass', function() { return gulp.src('scss/*.scss') .pipe(sass()) .pipe(gulp.dest('css')); }); gulp.task('watch', function() { gulp.watch('scss/*.scss', ['sass']); }); gul

python - how to convert pytable to pandas dataframe -

i trying use shape function pandas test if dataframe has been chunked 500000 rows each. can't due dataframe pytable , when use shape gives me 'attributeerror: 'tableiterator' object has no attribute 'shape''. is there anyway convert pytable pandas dataframe? or there way check if iteration opened? want see if pytable pointing next object means there multiple chunks of 500000 rows returned. the following code testing: def test_get_dataframe(workspace): = workspace.get_df('testing_df',true) the get_df: def get_df, df_name, chunk_mode=false, chunksize=500000): return self._proj.get_dbhdf5().get_df(self._id, df_name, chunk_mode=chunk_mode, chunksize=chunksize) """ when chunk mode true, return iterator chunks of dataframe """

Using MATLAB to save a montage of many images as one large image file at full resolution -

i trying save montage of many (~500, 2mb each) images using matlab function imwrite, keep getting error: error using imwrite>validatesizes (line 632) images must contain fewer 2^32 - 1 bytes of data. error in imwrite (line 463) validatesizes(data); here code working with: close clear clc tic file = 'imageregistrations.txt'; info = importdata(file); imagenames = info.textdata(:,1); xoffset = info.data(:,1); yoffset = info.data(:,2); = 1:length(imagenames); imagenames{i,1} = imread(imagenames{i,1}); imagenames{i,1} = flipud(imagenames{i,1}); end imagenames = flipud(imagenames); i=1:length(imagenames) diffx(i) = xoffset(length(imagenames),1) - xoffset(i,1); end diffx = (diffx)'; diffx = flipud(diffx); j=1:length(imagenames) diffy(j) = yoffset(length(imagenames),1) - yoffset(j,1); end diffy = (diffy)'; diffy = flipud(diffy); matrix = zeros(max(diffy)+abs(min(diffy))+(2*1004),max(diffx)+abs(min(diffx))+(2*1002)); %matrix(1:size(imagenames{1,1},1),1:siz

c# - TextRange.Save 'rich text format' not supported -

i have private assembly added ssrs 2005 report. can run assembly in test platform when try run report breaks. opening run-time debugger break on line: textrange.save(rtfmemorystream, dataformats.rtf); with exception 'rich text format' data format not supported the assembly built framework 3.5

branch - Layout for personal branches in TFS -

recently migrate svn tfs , have next layout: $ project main project branch branch1 branch2 now want add folder personal branches , try choose layout this. think about: $ project main project branch branch1 branch2 private smith, john my-personal-branch doe, john huge-refactoring (folder 'private' on same level 'branch' subfolders each user) i fear layout can has drawbacks, don't see because poor expirience in tfs. i appreciate suggestions/examples.

mysql - JOIN nested subquery returning NULL while updating calculated value -

i'm trying work around "you can't specify target table update in clause" mysql error, means i've got nested subquery (temp table). note, i'm trying select work before move on actual update . what i've got ledger table i'm trying find associated row's calculated unit total using active_units (what row started with) , each additional adjustment in active units (there 1 payment row , multiple adjustment rows in same table associated commission id , schedule number). these grouped month_num . if it's active_units = 18 , there 3 adjustment rows, 1 active_units_chg = -2 , should end 18 + -2 = 16 . when this: select active_units , active_units_chg , active_units_total , crm_commission_payments.active_units + ( select sum(active_units_chg) crm_commission_payments cp cp.crm_commissions_item_id = crm_commission_payments.crm_commissions_item_id , cp.schedule_a_no = crm_commission_payments.schedule_a_no , cp.month_num

asp.net - Custom ValidationAttribute to check invalid DateTime -

i want write custom validator web api project check whether input date valid. please find below validator wrote. validator: public sealed class datevalidationattribute : validationattribute { public string datestring { get; set; } public datevalidationattribute(string datestring) { datestring = datestring; } public override string formaterrormessage(string name) { return string.format(errormessagestring, name, datestring); } protected override validationresult isvalid(object value, validationcontext validationcontext) { var property = validationcontext.objecttype.getproperty(datestring); datetime dateobject; if (property != null && !datetime.tryparse(value.tostring(), out dateobject)) { return new validationresult( formaterrormessage(validationcontext.displayname) ); } return null; } } model: public class testmodel {

SQL Server : autoincrement fields separately -

i have table 2 columns, none of columns unique. need auto increment column number separately each user. user | number 1 | 1 2 | 1 1 | 2 3 | 1 the idea come search last number used , manually increment one. there more efficient way? instead of number field, can create auto increment field in table (i call id ), , desired number via query: first adding id: alter table table_name add id int not null identity(1,1) you not need number field anymore: alter table table_name drop column number the query number (you can use create view): select user, row_number() over(partition user order id) number table_name

typesafe activator - How to configure akkacluster using SSL support -

i looking cluster setup using akka play framework projects. want know how can support plugable ssl transport support. looking @ http://doc.akka.io/docs/akka/snapshot/scala/remoting.html , tired configuration. here sample configuration: akka { loglevel = error actor.provider = "akka.cluster.clusteractorrefprovider" remote { enabled-transports = ["akka.remote.netty.tcp"] enabled-transports = [akka.remote.netty.ssl] netty.ssl.tcp { hostname = "127.0.0.1" enable-ssl = true } netty.ssl.security { key-store = "mykeystore" trust-store = "mytruststore" key-store-password = "changeme" key-password = "changeme" trust-store-password = "changeme" protocol = "tlsv1" random-number-generator = "aes128countersecurerng" enabled-algorithms = [tls_rsa_with_aes_128_cbc_sha] } } cluster {

java - Type declaration based on type parameters in inner classes -

does java shadow type parameters? finding hard test myself because java generics not reified @ run time. for example, given code: public class nestedgeneric<t> { private innergeneric<t> innergenericinstance; private static class innergeneric<t> { public t innergenericfield; } nestedgeneric() { innergenericinstance = new innergeneric<t>(); } } both below statements compile fine: nestedgeneric<integer> test1 = new nestedgeneric<integer>(); nestedgeneric.innergeneric<string> test2 = new nestedgeneric.innergeneric<string>(); when nestedgeneric passed type parameter , constructor called, t ? going same type parameter passed nestedgeneric ? in other words, can outer classes type parameters passed inner classes generic type declarations? in other words, suppose question is, can outer classes type parameters passed inner classes generic type declarations? no. there no relationsh

security - How to avoid putting a password in declarative html/angularjs directive? -

i have custom angular directive takes password value declarative html , uses connect third party service. there way can more readily secure username , password looking @ html can't see username , password in plain text? there way "encode" html markup directive? best practice securing passwords in situation? not password user of application know, password used application connect third party tool. there's no way in client-side application. if encrypt access credentials, portion of code still have decrypt them, meaning user can invoke code manually , grab values. in fact, depending on how application connects 3rd party service, user may not need @ all. decrypted values show in browser's network inspector.

java - Efficient way to get all map values whose keys match a criterion -

i have following map map<indexderivedkey, collection<data<d>>> indexeddata in indexable data structure. indexderivedkey conforms index , index consists of keys , corresponding values. keys used extract values elements in indexable data structure. for example there's index, consists of keys firstname , lastname , use index extract values objects, possess these attributes, operation yields indexderivedkey per object. that indexderivedkey contains mapping above keys respective values , used store objects in map indexeddata , mentioned before. map value collection type, since possible several objects equal (with respect index). question how can extract objects firstname = "john" , hereby ignoring value of lastname . can iterate on keys , check value of firstname in o(n) . but since indexderivedkey {firstname = "john"} subset of other keys firstname = "john" , e.g. {firstname = "john", lastname = "smit

objective c - How to remove duplicate files generated through cocoa pods in IOS -

Image
i using cocoa pods integrate multiple third party files project. i have integrate below pod project xcodeproj 'myapp' workspace 'myapp' source 'https://github.com/cocoapods/specs.git' target :"myapp", :exclusive => true platform :ios, '7.0' pod 'afnetworking', '2.0.2' pod 'twiliosdk', '~>1.2.2' pod 'socketrocket', '0.3.1-beta2' pod 'apprtc' end when run pod install. duplicates shown below.. when build app getting error ld: warning: directory not found option '-l/users/anand/documents/ project/myapp_backups/myapp_june/myapp_webrtc/pods/build/debug- iphoneos' duplicate symbol _md5_update in: /users/anand/documents/project/myapp_backups/myapp_june/ myapp_webrtc/pods/apprtc/lib/libwebrtc.a(nss_static.md5.o) /users/anand/documents/project/myapp_backups/myapp_june/ myapp_webrtc/pods/twiliosdk/libraries/libcrypto.a(md5_dgst.o) duplic

php - Fatal error on session_start() -

i have function track user session time. function sessiontracker(){ ini_set('session.cookie_lifetime', 86400); ini_set('session.gc_maxlifetime', 86400); $sid = session_id(); if ($sid != '') { //echo "session exists!"; } else { //echo "no current session exists! starting..."; session_start(); } if(!isset($_session['username'])) { header("location:login.php"); exit(); } but i'm getting "maximum execution time of 30 seconds exceeded" when hits session_start(); line. there better function or how fix this? don't time, line. function sessionreup() { $time = $_server['request_time']; //for 30 minute timeout, specified in seconds $timeout_duration = 1800; /* here user’s last_activity timestamp. if it’s set , indicates our $timeout_duration has passed, blow away previous $_session data ,

apache - Why is my subdomain occasionally not accessible? -

i own following domain name: joynr.co i've configured subdomain: promoter.joynr.co but sometimes, it's not working, dns error. if still propagating. it's been week :/ where should start looking ? my apache confd files ? .htaccess ? or configurations @ aws ? it's hosted aws, , domain name registered @ godaddy. i've followed threat configurer aws/go daddy also, i've configured confd when accessing promoter.joynr.co browse different folder/website when going joynr.co (in /var/www ). .htaccess empty many thanks any appreciated :) thanks you have have promoter ns records within joynr.co domain, in order eponymous subdomain able recursively resolved. apparently in route 53 old-fashioned way - take ns records see in promoter.joynr.co domain , copy&paste them parent domain, cf. http://github.com/toddm92/aws/wiki/route-53-subdomains (moved comments , condensed.)

angularjs - Reading data from firebase in angularfire -

i have app need store artists , details in database.now want retrieve artists , render of details in front end.how that. secondly, if artist rating in input field using ng-model, how store value in particular artist update details. database structure is: { "artists": { "atif":{ "name":"atif", "rating":8 }, "himesh":{ "name":"himesh", "rating":5 } } } and angular.js (function() { var app = angular.module("myapp", ["firebase"]); app.controller("maincontroller", function($scope, $firebaseobject,$firebasearray) { var ref = new firebase("https://gigstart.firebaseio.com/"); var artists=ref.child("artists"); // download data local object $scope.data = $firebaseobject(ref); // putting console.log here won't work, see below ref.on(&quo

compilation - How do I compile VASP 5.3.5 on Cray XC? -

i need compile vasp 5.3.5 on cray xc mpp machine. system has gnu, intel , cray compiling environments available. there choice of intel mkl or cray libsci blas, lapack, scalapck. which best compiler use, best numerical library use , makefile options use? tests on archer ( http://www.archer.ac.uk ) have shown using intel compiler intel mkl , fftw produce best performance , stable build of vasp 5.3.5 on cray xc30 system. full compilation instructions can found at: http://www.archer.ac.uk/documentation/software/vasp/compiling_5-3-5-phase2.php briefly, procedure is: module swap prgenv-cray prgenv-intel module load fftw module load cray-pe-hugepages2m modify library makefile have following options: cpp = gcc -e -p -c $*.f >$*.f fc=ftn cflags = -o3 fflags = -o3 -unroll -ip -no-prec-div -xavx free = -free build library (assuming makefile called "makefile.cray_xc_intel.lib"): cd vasp.5.lib make -f makefile.cray_xc_intel.lib move main source c

javascript - Saving a file on Windows Phone 8.1 (mobile IE) -

i'm developing web application 1 may save configuration data json file on computer. approach works fine on desktop browsers (ie11, chrome, ff) , on tested android device. in mobile ie on wp8.1 there happens nothing , on ios devices file shown rather downloaded. here code: var savetofile = function () { var = document.createelement("a"), blob = new blob([getuserconfigs()/*get json somewhere*/], {type:"application/json"}), fname = "fileabc"; //check ms ie fileapi if (window.navigator.mssaveblob) { a.onclick = function(e) { e.stoppropagation(); window.navigator.mssaveblob(blob, fname); }; //otherwise use html5 standard } else { a.setattribute("href", window.url.createobjecturl(blob)); a.setattribute("download", fname); a.onclick = function (e) { e.stoppropagation(); }; } document.body.app

php - Laravel 5 Custom ServiceProvider not found -

Image
i'm making laravel serviceprovider package. package https://github.com/sumocoders/teamleader i following error fatalerrorexception in providerrepository.php line 150: class 'notflip\teamleader\teamleaderserviceprovider' not found i have no clue i'm doing wrong, here's folder structure composer.json in package "autoload": { "psr-4": { "notflip\\teamleader": "src/" } } teamleaderserviceprovider <?php namespace teamleader\laravel; use illuminate\support\serviceprovider; class teamleaderserviceprovider extends serviceprovider { /** * register bindings in container. * * @return void */ public function publishes() { $this->publishes([ __dir__.'/config/config.php' => config_path('teamleader.php'), ]); } public function register() { $this->app->bind('teamleader\laravel', func

php - symfony input without name -

i'm trying implement payment system in website symfony. i have add form, takes creditcard number. don't want number coming server. need form in no name attribute specified. server cannot take value , read value directly javascript. does know how form without name? if do: $form = $this->createformbuilder() ->add('creditnum', 'text') ->getform(); this automatically creates name attribute. you think creating 2 separate forms, 1 form order form, , 1 form contains credit card field(s). way can still handle payment processing via javascript, , when user submits main order form, credit card field not part of it, , won't submitted server. you'd have use javascript (or tricky css) display 2 forms nicely, might create credit card field javascript outside of form itself, , position looks it's part of form.

javascript - Convert system date into est time zone and compare two dates -

in application getting json have date string. have requirement comparing date current date , time in est timezone format. input date tue jun 23 2015 11:57:00 , current date should in same format in est time zone i have compare both of those. you can server time , compare yours function converttoservertimezone(){ //est var offset = -5.0 var clientdate = new date(); var yourinputdate = new date("tue jun 23 2015 11:57:00"); var utc = clientdate.gettime() + (clientdate.gettimezoneoffset() * 60000); var serverdate = new date(utc + (3600000*offset)); var dateformated = serverdate.toisostring().substr(0,10); var dateformatedyourdate = yourinputdate.toisostring().substr(0,10); if(dateformated > dateformatedyourdate){ //here compare string values } }

javascript - Drag rotate interaction in OpenLayers 3 on Linux -

i'd use openlayers 3 rotation interaction on browser running under linux. allows map rotate dragging whilst pressing alt , ctrl. works fine on windows, not in redhat 6u2 , other distributions alt key reserved x-windows drag window behaviour. firstly customized dragrotate ol.events.condition.shiftkeyonly , worked, conflicted zoom-box functionality, i.e. draws blue zoom box whilst rotating. var map = new ol.map({ layers: [ new ol.layer.tile({ source: new ol.source.osm() })], target: 'map', view: new ol.view({ center: [-25860000, 4130000], zoom: 10 }), interactions: ol.interaction.defaults().extend([new ol.interaction.dragrotate({ condition: ol.events.condition.shiftkeyonly })]) }); i'd retain shift-drag zoom box , use other key/combination, maybe 'r+shift'? i've tried customize condition. see jsfiddle var customcondition = function(mapbrowserevent) { return false; // todo }; var m

Retry to establish a JMS connection while ActiveMQ broker is not available -

here scenario. have few activemq (jboss-amq) producers , consumers installed services. in server restart, best practice of handling such situation producer or consumer service starts before activemq broker service. in case producer/client cannot establish connection , starts hang on after broker service starts. here's code snippet of connection creation: try { connection = connectionfactory.createconnection(); connection.start(); logger.info(started_connection_with_the_destination + destinationname); session = createsession(); destination = session.createqueue(destinationname); logger.info(created_queue_in_destination + destinationname); if (isimageprocagent) { consumer = createconsumer(); logger.info(consumer_has_been_initialized); } else { producer = session.createproducer(destination); logger.info(producer_has_bee

r - How to write multi-level (bullet) lists in a table using rmarkdown and pandoc -

i looking create table in pdf document using rmarkdown , knitr , pander . able create simple bullet list require level in list. in table shown below, require "rave reviews" bullet sub-bullet of "offers workshops..." bullet. multibullet http://i59.tinypic.com/jtmk43.png the issue i'm having pertains line of code below in mytable dataframe in description column. although attempt create 4 spaces required sub-bullet using \x20 [1], spaces not appear - , hence no sub-bullets (although no error shown). tried obvious way of adding in 4 spaces in code no avail. attempted set r options include strip.white = false , has not proven helpful (see below). --- title: "xxx" author: "xxx" output: pdf_document: fig_height: 4 fig_width: 10 highlight: tango word_document: default geometry: margin=3cm --- ```{r global_options, include=false, echo=false} require(knitr) opts_chunk$set(fig.width=8, fig.height=4, fig.path='figs/

php - Select one value of one colum of an array obtained with pdo -

i have following code : $foo = $bdd->prepare($qry); $foo->execute(); $result = $foo->fetchall(); in $qry , have select join between tables beatles b et status s (on columns status_id ), such result following : code : b.id b.firstname b.lastname b.status_id s.status_id s.status 0 john lennon 0 0 mort 1 paul mccartney 1 1 vivant 2 ringo starr 1 1 vivant 3 george harrison 0 0 mort (the first line columns' names in tables, isn't inside result of query) i want select in php s.status of ringo starr, instance. how can ? thanks if want retrieve value of status ringo starr, need values of other fields within page, (assuming array has come indexed id), access $result[2]['status'] . otherwise, change select statement select values of id ,

android - Step detection using Google Activity Recognition Api -

i develop step counter application, support android 4.3 (api level 18) onwards. firstly, saw accelerometer way making own consequences time taking process. secondly, saw google "activity recognition api", gives activity user performing gives type of activity, doesn't count steps during walking/running/bicycling , not performing well. some folks use api introduced in kitkat version app supports api 18 onwards. is there solution? at time activity recognition not count steps. merely indicates user doing known activity. http://developer.android.com/about/versions/android-4.4.html#userinput

postgresql - Python subprocess hangs with psql command -

i running following piece of python code (runs command in shell , grabs output or reports error) import sys import subprocess def check_output(args, communicate=none, quiet=false, **kwargs): stream in ["stdout", "stderr"]: kwargs.setdefault(stream, subprocess.pipe) proc = subprocess.popen(args, **kwargs) try: out, err = proc.communicate() finally: f in (proc.stdout, proc.stderr): if f not none: f.close() proc.wait() if kwargs["stderr"] != subprocess.pipe: err = "" if proc.returncode != 0: raise exception(args, proc.returncode, err) else: if not quiet: sys.stderr.write(err) sys.stderr.flush() return out with following arguments: env = dict( pghost='{pg_host}', pgport='{pg_port}', pgdatabase='{pg_dbname}', pguser='{pg_user}', p

ruby on rails - how to sort joined tables? -

help please write orm-request. tables: users: id: integer name: varchar posts: id: integer title: varchar user_id: integer views: integer models: user: class user < activerecord::base has_many :posts, dependent: :destroy end posts: class post < activerecord::base belongs_to :user end controller: def popular_diary @users = user.joins(:posts).group_by(:user_id).order('sum(posts.views)') end html: <% @users.each |user| %> <div class="row"> <%= link_to user_posts_url(user.id) %> <div><%= user.name %></div> <% end %> </div> <% end %> i need users hatched in order. order ('sum (posts.views) the problem screen displays following error message: wrong number of arguments (0 1) it's group , not group_by def popular_diary @users = user.joins(:posts).group(:user_id).order('sum(posts.views)') end

codeigniter - Select query with Date of Today not working -

i'm trying select table documents date today's date. i'm using codeigniter. shows these documents there isn't hour. mean in database date is: 2015-06-25 00:00:00. doesn't display these documents there hour - example : 2015-06-25 08:34:00. how display documents date current date , no matter hour. <?php $date = new datetime("now"); $curr_date = $date->format('y-m-d '); $this->db->select('*'); $this->db->from('documents'); $this->db->where('date', $curr_date); $query = $this->db->get(); return $query->result(); try this <?php $date = new datetime("now"); $curr_date = $date->format('y-m-d '); $this->db->select('*'); $this->db->from('documents'); $this->db->where('date(date)',$curr_date);//use date function $query = $this->db->get(); return $query->result(); my

soa - Refactoring God objects in WCF services -

we came across god object in our system. system consists of public service exposed our clients, middle office service , back office service . the flow following: user registers transaction in public service , manager middle office service checks transaction , approves or declines transaction , manager back office service finalizes or declines transaction. i'am using word transaction , in reality different types of operations crud on entity1 , crud on entiny2 ... not crud operations many other operations approve/send/decline entity1 , make entity1 parent/child of entity2 etc etc... now wcf service contracts separated according parts of system. have 3 service contracts: publicservice.cs middleofficeservice.cs backofficeservice.cs and huge amount of operation contracts in each: public interface ibackofficeservice { [operationcontract] void addentity1(entity1 item); [operationcontract] void deleteentity1(entity1 item); .... [operationc

arrays - Group by on a complex object in AngularJS -

i've array contains assignments of employees on tasks, looks this: $scope.assignments = [ { employee: { id:"1", firstname:"john", lastname:"rambo" }, task: { name:"kill everyone", project:"destruction" }, date: { day:"01/01", year:"1985" } }, { employee: { id:"2", firstname:"luke", lastname:"skywalker" }, task: { name:"find daddy", project:"star wars" }, date: { day:"65/45", year:"1000000" } }, { employee: { id:"1", firstname:"john", lastname:"rambo" }, task: { name:"save world", project:"destruction" }, date: { day:"02/01", year:"1985" } } ]; i group employe

r - Split Date into Year and Month in data.table -

given, set.seed(1234) library(data.table) dt <- data.table(date=c(201405, 201406, 201501, 201503), x = rnorm(4, 0, 1)) return, date x 1: 201405 -1.2070657 2: 201406 0.2774292 3: 201501 1.0844412 4: 201503 -2.3456977 i want split date year , month follows: year month x 1: 2014 5 -1.2070657 2: 2014 6 0.2774292 3: 2015 1 1.0844412 4: 2015 3 -2.3456977 how can this? converting comment answer, use substr combined assignment reference semantics. can wrap as.integer if prefer not return string dt[, `:=`(year = substr(date, 1l, 4l), month = substr(date, 5l, 6l))]

how to split command line arguments equally in C -

i writing c program using command line arguments. when ever give string in command line space splits sub files , for ex- sample output $ ./cmdline 4646 313 256 96664 commandline args count=5 exe name=./cmdline split_part1=4646 split_part2=313 split_part3=256 split_part4=96664 i want same output without giving space in between string. how do,each sub part should split equal number of strings . please help. #include <stdio.h> int main (int argc, char *argv[] ) { int i=0; printf("\n commandline args count=%d", argc); printf("\n exe name=%s", argv[0]); (i=1; i< argc; i++) { printf("\n"); printf("\n split_part%d=%s", i, argv[i]); } printf("\n"); return 0; } following comments, simple algorithm achieve want looks like ( for fixed token size of 5 , can modified per requirement later ) check if argc ==2 . calculate string length of argv[1] , store it. take variable used index

How mainBundle() return on object in swift or objective-c? -

i reading book related ios development. , facing problem when reading line let bundle = nsbundle.mainbundle() . book told this call returns bundle object represents our application. i know, in swift object created let objname = classname() . please tell how let bundle = nsbundle.mainbundle() create object? this call not create (instanciate) new object. calls mainbundle class method on nsbundle class, returns singleton, main bundle of app. similar calls (in obj-c, translatable in swift easily): [uiapplication sharedapplication] [nsnotificationcenter defautcenter]

web services - Use single certificate in WS Security -

Image
i'm working in ws-security configurations in soap ui. in signature, have option called "use single certificate signing" tried checking , unchecking it, request same. don't find differences. when should use option? i tried search on google, couldn't find answer. pardon me if understanding wrong. after little search op seems found answer. this checks adds specific <wsse:binarysecuritytoken> in <wsse:security> headers, specifying certificate (in soapui specific case specifying certificate used perform signature). from oasis spec can see definition of element: 3.1 token types this profile defines syntax of, , processing rules for, 3 types of binary security token using uri values specified in table 2 (note uri fragments relative uri specification). 3.1.1 x509v3 token type the type of end-entity authenticated certificate used in manner matter of policy outside scope of specification. in document there sample

swift - The Position of SpriteNode in SpriteKit -

Image
i getting start spritekit, , in project. wanna create grids falling sky , form grids map follow: i created physics world gravity -9.8 and grid, each of them created following constructor , add scene: class numbertile:skspritenode{ convenience init(xpos:cgfloat, ypos:cgfloat){ var tilecolorarray:nsarray = ["#996666","#a65959","#b34d4d","#bf4040","#cc3333","#d92626","#e61919"] //get random color array var fillcolor:uicolor = uicolor(rgba: tilecolorarray.objectatindex(int(arc4random_uniform(uint32(tilecolorarray.count)))) as! string) var size:cgsize = cgsize(width: 38, height: 38); self.init(color:fillcolor, size:size) self.position = cgpointmake(xpos, ypos) self.anchorpoint = cgpointmake(0,0) self.physicsbody = skphysicsbody( rectangleofsize: cgsize(width: 38,height: 40), center: cgpointmake((cgfloat)(38/2),(cg

c# - Skipping header when reading CSV -

i want able skip header when reading , writing csv here code have far try { using (streamwriter sw = new streamwriter(writefilename))// streamwriter used write text file using (streamreader sr = new streamreader(readfilename)) // streamreader used read text file { //writing headings file heading = "ni number,surname,forename,employee,employer(gross),contribution status,contribution status date"; sw.writeline(heading); while ((txtline = sr.readline()) != null) // reads 1 line variable txtline { //spiliting file columns if there in it. //oldcolumns = txtline.split(','); oldcolumns = regex.split(txtline, ","); //spliting old columns[0] there space , putting in names array. //names = regex.split(oldcolumns[0],",");

java - Spring MVC form submit: view to controller pass not put form attribute -

i have portlet able display form , allow pass controller in object set user. , works well. want app able set additional attribute jsp not coming input of forms. the model public class person { string firstname; string middlename; string attributesetstatically; // setters , getters public void setattributesetstatically(string attributefromjsp) { system.out.println("call setattributesetstatically "+attributefromjsp); this.attributesetstatically=attributefromjsp; } } the controller @controller(value = "myfirstspringmvcportlet") @requestmapping("view") public class myfirstspringmvcportlet { @rendermapping public modelandview handlerenderrequest() { modelandview modelandview = new modelandview("welcome"); modelandview.addobject("person", new person()); modelandview.addobject("msg", "hello spring mvc"); return modelandview

node.js - Repeat function when finished with Javascript? -

is possible repeat function when has finished. example: have datatable following input data: name | birthday | checked test1 20.3.2000 null test1 20.3.2001 null test1 20.3.2002 null now want function take first line checked == null write table , mark checked = true after first call be name | birthday | checked test1 20.3.2000 true test1 20.3.2001 null test1 20.3.2002 null after second call name | birthday | checked test1 20.3.2000 true test1 20.3.2001 true test1 20.3.2002 null after third call name | birthday | checked test1 20.3.2000 true test1 20.3.2001 true test1 20.3.2002 true data in table may manipulated while call method count(*) on checked while not work line may added inbetween. the basic question ist. how can call function repeadetly, not given interval after previous call has completed? following code settimeout(function, 1000); was working in case. not have wait function f

c# - EntityFramework. Remove all rows then add new. Async -

i'm running csv import sql db via asp.net mvc app. i'm iterating rows in csv, creating equivalent entity each , adding each 1 current context. if there @ least 1 row add want remove existing rows table being written to, commit new entities. my question whether it's safe call executesqlcommandasync , not await result before call await db.savechangesasync(); so: db.database.executesqlcommandasync("delete tblname"); await db.savechangesasync(); or should await delete call before make save changes call? in case may make calls non async versions? i'm not awaiting , appears working expected on local (practically no latency) i.e. existing data being removed , new data added. concern whether there else should consider when solution deployed , web server , sql server aren't on same box. as per msdn : by default, delete statement acquires exclusive (x) lock on table modifies, , holds lock until transaction completes. this means sa

java - issue with hibernate "session is closed" -

i can't save rows file excel in database, because error : exception in thread "main" org.hibernate.sessionexception: session closed! my code : annotationconfiguration conf = new annotationconfiguration(); conf.addannotatedclass(etudiant.class); conf.configure("hibernate.cfg.xml"); new schemaexport(conf).create(true, true); sessionfactory factory = conf.buildsessionfactory(); session session = factory.getcurrentsession(); for(int i=3;i<tab.length;i++){ session.begintransaction(); etudiant.setnom(tab[i]); i++; etudiant.setprenom(tab[i]); i++; etudiant.setage(tab[i]); session.save(etudiant); session.gettransaction().commit(); } anyone have idea plz ? you fulling first level cache. clearing , flushing cache periodically should considered when doing bulk insert. committing in each iteration slow down insertion. you have this.. 13.1. batc

Android : MapView in a CollapsingToolbarLayout -

i'm trying put map view (or fragment containing map)inside collapsingtoolbarlayout . want have parallax effect on when recyclerview scrolls. unfortunately, isn't showing @ all! not grey grid! collapsing animation working though. i've search everywhere, able find imageview , no other component. here questions : is possible put else imageview in collapsingtoolbarlayout ? (the documentation talking child views thought possible) if so, fragment allowed well? then doing wrong?? here xml : <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:map="http://schemas.android.com/tools" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+i

Build android app via maven android plugin apk installation error -

i trying build android app via maven android plugin. have used multi-dex=true in pom file. tried using forcejumbo=true. googled on it. didn't find satisfactory answer. getting error while installing apk file. when install cmd gives error : failure [install_failed_dexopt] when tried install email on device gives error : e/dex2oat(11177): failed open dex file descriptor zip file '/data/app/com.xx.yyy-1/base.apk': failed open dex file '/data/app/com.xx.yyy-1/base.apk' memory: unrecognized magic number in /data/app/com.xx.yyy-1/base.apk: p k how fix this? why used multi dex : i getting error: trouble writing output: many method references: 72545; max 65536. [info] may try using --multi-dex option. used multi dex <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <version>4.1.1.4</version>