Posts

Showing posts from August, 2014

php - Count input value of a textbox -

php - Count input value of a textbox - i want count number of inputed value in textbox illustration value of textbox 1234567 count of value 7 want know whether inputed value less or greater or equal 7 how able in php thanks i assume mean number of characters in input. can utilize native php function strlen http://php.net/manual/en/function.strlen.php: if( strlen( $_post['input_name'] >= 7 ){ // since equal or greater 7 } else { // less 7 } php

asp.net web api - Character 'E' in OData v4's function string parameter is causing 404 error -

asp.net web api - Character 'E' in OData v4's function string parameter is causing 404 error - i'm having weird problem when i'm writing odata function. function takes string parameter, , returns collection of dtos. function works fine long string parameter doesn't contain character 'e'. i'm wondering if bug in urlroutingmodule or something? the method declaration is: [enablequery] [odataroute("getmaintaininglogbyidnumber(idnumber={idnumber})")] public ienumerable<maintaininglogdto> getmaintaininglogbyidnumber([fromodatauri]string idnumber) and code register function in edm model is: modelbuilder .function("getmaintaininglogbyidnumber") .returnscollectionfromentityset<maintaininglogdto>("maintaininglog") .parameter<string>("idnumber"); if phone call function with http://hostname/odata/getmaintaininglogbyidnumber(idnumber='0001100110124221929') the function ret

What is the purpose of using "PUT" method in a form with PHP? -

What is the purpose of using "PUT" method in a form with PHP? - i wanted know, why form method put used? what exact purpose ? what real time scenario in can utilize ? is more safe or post ? if take @ page 55 of rfc 2616 (“hypertext transfer protocol – http/1.1”), section 9.6 (“put”) , you’ll see set for: the set method requests enclosed entity stored under supplied request-uri. there’s handy paragraph explain difference between post , put: the fundamental difference between post , set requests reflected in different meaning of request-uri. uri in post request identifies resource handle enclosed entity. resource might data-accepting process, gateway other protocol, or separate entity accepts annotations. in contrast, uri in set request identifies entity enclosed request – user agent knows uri intended , server must not effort apply request other resource. when should utilize set , when should utilize post? use set w

c# - MongoDB very slow read performance on server -

c# - MongoDB very slow read performance on server - basically, have windows service performs batch job. i have 2 collections related, customeraccounts , events. events collection logs actions customers performed on site, containing timestamp, name of event, page occurred on , username. the service runs through each business relationship , works out journey phase , risk of business relationship closure based on events have in events collection , set of user-defined rules. there 3,500 accounts , around 100,000 events in database @ present. service takes on 1 min run on development pc, takes seemingly forever on server (i've estimated takes 2.5 hours based on modifying service performs job on single client account. my machine core i7 16gb of ram, server intel xeon e5-2609 (64bit, win 2008 r2) 24gb of ram. set database on much older server (32bit, windows 2003) , service took 2 minutes run. so, know on dev machine takes on minute, , on older server hardware takes

css - Dynamic width with multiple elements -

css - Dynamic width with multiple elements - i'm trying find pure css way have 1 or more elements inline , have them adjust width fill container e.g. 1 element [------] 2 elements [---***] 3 elements [--**..] is achievable through pure css? use display: table on parent, , display: table-cell on children. can add together many inner div's wish. this: html <div class="container"> <div class="inner">1</div> <div class="inner">2</div> <div class="inner">3</div> </div> css: .container { display: table; width: 500px; height: 300px; outline: 1px solid red; } .inner { display: table-cell; outline: 1px solid blue; } here's fiddle: http://jsfiddle.net/w8p2nj9z/ css width elements

php - Running thousands of MySQL queries, crashing server -

php - Running thousands of MySQL queries, crashing server - i'm running stock update on our company website, , query follows; $count = count($stock); for($i = 0; $i < $count; $i++) { if(strtolower($stock[$i]['stockloc']) == 'retail') { if($stock[$i]['avail'] < 0) { $stock[$i]['avail'] = 0; } mysql_query("update `xcart_products` set `avail` = ".$stock[$i]['avail']." `productid` in (select `productid` `xcart_extra_field_values` `productid` = ".$stock[$i]['productid']." , `fieldid` = 5 , lower(value) = 'retail')"); } } eessentially runs in loop , iterates through thousands of products, updating stock levels. runs fine 4 minutes, things start la

creating a formula string in VBA using part formula and part hard coded string -

creating a formula string in VBA using part formula and part hard coded string - dim cell_range range set cell_range = worksheets("beans").range("t11") dim x integer x = 0 dim current_range range set current_range = cell_range dim actual_test_range string actual_test_range = current_range.offset(0, x).address current_range.offset(0, x).formula = "=if(" & current_range.offset(0, x).address & "= "apples",1,0)" x = x + 1 loop until x = 60 the thought if cell in current range = "apples" homecoming 1 else homecoming 0 i cannot work vba won't take "apples" located , don't know how build string formula out of variables , hard coded strings. please help. thanks. you need double quotes when used within quoted string (i.e. formula) looks might circular reference in inserting formula cell references itself. current_range.offset(0, x).formula = "=if(" & cu

performance - What is the cost of access to a configuration property? -

performance - What is the cost of access to a configuration property? - i'm developing scala app scan folders in interval of 10 minutes. within class, i've created 12 global variable , it's kinda unusual because variables used 1 time on exception point. i wondering cost of use: configuration.getstring("value") every time instead create global variable like: private lazy val inputpath = configuration.getstring("main.directory") in terms of performance, better? phone call when it's necessary or create lazy global variable? thank in advance. configuration.getstring("value") cheap. config read , parsed 1 time @ startup , values stored in java map . calling getstring boils downwards lookup in hashmap . of course of study more expensive shared variable still of constant complexity o(1). should fine when phone call getstring couple of times every 10 minutes. the implementation im referring can found in s

python - Mouse interaction issues on QSlider with QLabel overlay -

python - Mouse interaction issues on QSlider with QLabel overlay - i pretty new qt/pyside , trying figure out way overlay qlabel onto qslider without loosing mouse events interactivity. using qstackedlayout unable trigger them correctly label on top, , doesn't behave when under (the slider doesn't interpolate, jumps min max). from pyside import qtcore, qtgui class customslider(qtgui.qwidget): def __init__(self, minval=0.0, maxval=1.0, default=0.0): super(customslider, self).__init__() self.slider = qtgui.qslider() self.slider.setrange(0.0, 1.0) self.slider.setorientation(qtcore.qt.horizontal) self.slider.setstylesheet(""" qslider::groove:horizontal { background: black; height: 40px; } qslider::sub-page:horizontal { background: grey; height: 40px; } qslider::add-page:horizontal {

Java Swing actionPerformed -

Java Swing actionPerformed - hi there i'm working in project had create cui game , convert gui, i'm in process of adding functionality buttons interact game having trouble. this method i'm attempting access. it's in class called pet. public double feedpet() { if(this.hunger < max_hunger) { this.hunger += food; if(this.hunger > max_hunger) { this.hunger = max_hunger; } system.out.println(this.petname + " enjoyed meal!"); system.out.println("hunger increased " + nutrient + " total of " + this.hunger); spacing(); } else { system.out.println(this.petname + " full!"); spacing(); } homecoming this.hunger; } this class trying access method. public gamepanel(petworld petworld, pet pet, game game) { initcomponents(); gencomponents(pet); } private void gencomponents(final pet pet) { this.setsiz

My Settings Automatically get reset in vb.net -

My Settings Automatically get reset in vb.net - i have developed many project in vb.net 2010 , in project have used settings , worked properly. in new project there 20 setting in settings.... , every time start software automatically reset original value..... 20 of them...... can't find problem in coding part tryed testing creating semple setting , 1 button alter setting value. when re start software it's bach original value ...... plz give suggestions same...... vb.net

php - Mysql return empty rows if multi where condition with empty value -

php - Mysql return empty rows if multi where condition with empty value - i have created table in name of folders table contain name,folderid,parentfolderid when write query homecoming empty rows example 1 : query : select * folders_tbl parentresourceid='' result : expected but have add together status in fail homecoming expected rows example 2 : (issue) query : select * folders_tbl parentresourceid = '' , serviceid =1 , userid =1 result : returned empty result set table construction folderid bigint(20) serviceid int(11) userid bigint(20) foldername varchar(200) resourceid varchar(500) parentresourceid varchar createddate datetime modifieddate datetime shared int(11) istrashed int(11) isdeleted int(11) note : write query in phpmyadmin web ui it seems have records contains null value. if use parentresourceid null in condition php mysql database

joomla1.5 - Joomla Site is hacked? -

joomla1.5 - Joomla Site is hacked? - my joomla site hacked someone.the hacker alter content of files , replace content. find , deleted 1 time again , 1 time again doing this.i changed ftp , cpanel details.but no use.how prevent this.please help me one thanks in advance for moment, @ to the lowest degree update 1.5.26 , after install patch. remove unneeded extensions , seek create sure rest of extensions up-to-date much possible. you can strengthen site's security advanced .htaccess rules , security extensions admin tools akeeba. read also: joomla security checklist http://joomla.stackexchange.com/questions/2305/what-to-do-if-my-joomla-website-got-hacked also, google search results page nowadays links useful , of import information. joomla joomla1.5

How to check whether a Hashtable is null in Java -

How to check whether a Hashtable is null in Java - given next java codes: hashtable<string,integer> hs = new hashtable<string,integer>(); if(hs==null){ system.out.println("this table blank"); } a new hashtable created no pairs. why there no output console? way, how check whether hashtable null? the hashtable isn't null when it's empty; object still there. utilize isempty() method instead. if (hs.isempty()){ java hashtable

vim - Handle exclamation mark after command definition as :wq -

vim - Handle exclamation mark after command definition as :wq - i'm looking way create handle ! after command :wq! . in order create own function quitting and/or writing files. tried of course, didn't works : command! -nargs=0 sq :call <sid>saveandquit(0, 0) command! -nargs=0 swq :call <sid>saveandquit(1, 0) command! -nargs=0 sq! :call <sid>saveandquit(0, 1) command! -nargs=0 swq! :call <sid>saveandquit(1, 1) with function function! <sid>saveandquit( write, forcefulness ) . there way handle ! ? yes, should utilize -bang attribute, pass function, , handle ! in function. :h bang e.g. command ... -bang xyz phone call function('foo', <bang>0) your function: func function (argstr, bang).. "here check a:bang decide should done. vim

php - MySQL select only using first word of variable -

php - MySQL select only using first word of variable - i using php , mysql. have select query not working. code is: $bookquery = "select * my_books book_title = '$book' or book_title_short = '$book' or book_title_long = '$book' or book_id = '$book'"; the code searches several title types , returns desired reference of time, except when name of book starts numeral. though rare, of book titles in form "2 book". in such cases, query looks @ "2", assumes "book_id" , returns sec entry in database, instead of entry "2 book". "3 book" returns 3rd entry , forth. confused why select acting way, more importantly, not know how prepare it. if have column in table numeric info type ( int , maybe), search strategy going work strangely values of $book start numbers. have discovered this. the next look returns true in sql. it's not intuitive, it's true. 99 = '99

asp.net mvc - Can't get facebook login to work on MVC5. It's always returning NULL on GetExternalLoginInfoAsync() -

asp.net mvc - Can't get facebook login to work on MVC5. It's always returning NULL on GetExternalLoginInfoAsync() - i've been scratching head , googling night nil seems working me. when trying login mvc5 app using facebook maintain on getting null reference error in authenticationmanager.getexternallogininfoasync(). logging in using google works perfectly. here's setup: site running on iis express (also tried local iis). already tried both http , https articles saying fb requires ssl. i'm sticking https://localhost:44302/ @ moment (note: google works fine either way). note: using default setup/templates in mvc5, didn't alter - except appid , appsecret fb of course. can throw in solutions pls. thanks. replace var logininfo = await authenticationmanager.getexternallogininfoasync(); by code: var result = await authenticationmanager.authenticateasync(defaultauthenticationtypes.externalcookie); if (result == null || result.identity == nu

Android Intent didn't start automatically -

Android Intent didn't start automatically - i'm creating application android implement baseadapter gridview , tabfragment create sweepable application. problem when click object in grid, intent doesn't start automatically. must swipe screen other fragment, fragment before start intent. did know problem? sample code gridadapter @override public view getview(final int position, view convertview, viewgroup parent){ final pdfviewer pdf = new pdfviewer(); if (convertview == null){ imageview = new imagebutton(_activity); } else { imageview = (imagebutton) convertview; } bitmap image = decodefile(_imgpaths.get(position), imagewidth, imageheight); imageview.setscaletype(imageview.scaletype.center_crop); imageview.setlayoutparams(new gridview.layoutparams(imagewidth, imageheight)); imageview.setimagebitmap(image); imageview.setonclicklistener(new onimageclicklistener(position)); homecoming imageview; } class onimagecli

insert - C: Enqueue() - Inserting at the end of a linked list, returning head of list -

insert - C: Enqueue() - Inserting at the end of a linked list, returning head of list - i'm new programming. trying write function receives head of list + info inserted -- , passes new head of list. i've done lot adding element head of list, reason can't wrap head around slight difference. #include <assert.h> #include <stdio.h> #include <stdlib.h> typedef struct node_{ int data; struct node_ *next; } queue; int main(void){ queue* queue = null; queue = enqueue(queue, 1); assert(queue->next == null); assert(queue->data == 1); queue = enqueue(queue, 2); assert(queue->data == 1); assert(queue->next != null); assert(queue->next->data == 2); free(queue->next); free(queue); homecoming 0; } queue *enqueue(queue *queue, int data){ queue *new_node, *p; new_node = malloc(sizeof(queue)); new_node->data = data; new_node->next = null; p = queue; while(p

javascript - how do I delete multiple histories in web app? -

javascript - how do I delete multiple histories in web app? - i'd remove multiple browser history @ once. suppose app has blog-writing task takes multiple steps/screens/browser history finish. when user completes blog-writing task, want delete whole writing-related browser histories because when clicks button, don't want him see editing screen again. conceptually, i'm wondering if there's way grouping multiple browser histories task (blog writing task), kill histories related task. then doesn't matter how many steps take perform task, can drop task when needed. can done in web environment? javascript jquery backbone.js web browser-history

html - ionic nav-bar covers and hides everything at the top -

html - ionic nav-bar covers and hides everything at the top - helllo, ran problem header or nav-bar hides underneath should force down. here photo of how looks like: http://i.stack.imgur.com/rr4nj.png as can see there "tekstas" list item hidden underneath nav-bar. here code: <ion-view hide-back-button="false" has-navbar="true" title="menu"> <ion-side-menus> <ion-side-menu-content> content! <button ng-click="toggleleft()"> toggle left side menu </button> </ion-side-menu-content> <ion-side-menu side="left"> <ul class="list"> <li class="item"> tekstas</li> <li class="item"> tekstas1</li> <li class="item"> tekstas2</li> </ul> <

android - /storage/emulated/0 obtained from getExternalCacheDir() generates "no such file or directory" error -

android - /storage/emulated/0 obtained from getExternalCacheDir() generates "no such file or directory" error - running on nexus 4, when phone call getexternalcachedir().getabsolutepath() path /storage/emulated/0/android/data/com.example.myapp/cache . problem that, stated in different places, /storage/emulated/0 generate "no such file or directory" error. what expect /storage/emulated/legacy , correctly querying external_storage environment variable commands system.getenv("external_storage") . i utilize if statement check , right path in case point different getenv , want understand why getexternalcachedir() returns invalid path, or if function has been deprecated somehow. additional notes: on xperia u running cm11 works fine; targetting nexus 4 adb get ls /storage/emulated/0 /storage/emulated/0: no such file or directory i've proper access permissions, since if call, example, echo "hi!" >> /storage/emulated/l

php - Split a number into 4 specified parts thats togetter the same number -

php - Split a number into 4 specified parts thats togetter the same number - need split number illustration 5000 4 parts in array $total = 5000; array should like: array ( [0] => 500 [1] => 250 [2] => 250 [3] => 4000 ) so if user enters 600 illustration need array this: array ( [0] => 500 [1] => 100 [2] => 0 [3] => 0 ) this got, im sure there improve way. when come in 600 illustration 2 undefined offsets $total_spidex = 5000; $price_total = array(); for($i=1; $i<=$total_spidex; $i++) { if($i <= 500) { $price_total[1][] = $i; } elseif($i >500 && $i <= 750) { $price_total[2][] = $i; } elseif($i >750 && $i <= 1000) { $price_total[3][] = $i; } elseif

c++ - Issue with ItkVtkGlue -

c++ - Issue with ItkVtkGlue - i'm trying run example: http://www.itk.org/wiki/itk/examples/io/imagefilereader but, next when "configure" in cmake: cmake error @ cmakelists.txt:11 (find_package): not providing "finditkvtkglue.cmake" in cmake_module_path project has asked cmake find bundle configuration file provided "itkvtkglue", cmake did not find one. not find bundle configuration file provided "itkvtkglue" of next names: itkvtkglueconfig.cmake itkvtkglue-config.cmake add together installation prefix of "itkvtkglue" cmake_prefix_path or set "itkvtkglue_dir" directory containing 1 of above files. if "itkvtkglue" provides separate development bundle or sdk, sure has been installed. it seems need "itkvtkglue"? can download it? and, should combine program? vtkglue module within itk , default not built. need enable module cmake when build itk . also, before this, need downloa

C descriptor for double on Linux -

C descriptor for double on Linux - what descriptor double in c? when utilize printf("%d",x) and x double variable says warning %d expects int argument, while x double . printf("%f", x); when x double variable. double

java - JDBC determine active transaction -

java - JDBC determine active transaction - is way determine jdbc i'm in not committed active transaction? want sure transaction committed or rollbacked before connection.close(). there's no standard jdbc method want. if want create sure transactions committed / rollbacked before connection.close(), can this: connection conn = null; seek { conn = ...; conn.setautocommit(false); // stuff // commit if successful conn.commit(); } grab (someexception e) { // log exceptions } { if (conn != null) { /* rollback before closing connection * if there's caught/uncaught exception, transaction rolled * if successful / commit successful, rollback have no effect */ seek { conn.rollback(); } grab (sqlexception e) {} seek { conn.close(); } grab (sqlexception e) {} } } this improve rolling if there's exception (in grab bl

mysql - Possible positions and executing order about aggregation functions in select statement in sql? -

mysql - Possible positions and executing order about aggregation functions in select statement in sql? - where can set aggregation functions in 1 sql query (in select clause, in having clause or others ). , what's executing order of aggregation functions in logical processing order of select statement? the post "order of execution of query" there doesn't cover functions' executing order. 1) can set subquery after ,from , middle of sql statement. //after select * orders order_id in (select oreder_id orderconfirmed) // after select * (select * table) //middle of sql statement select id,(select id table1) form table2 2) can set aggregation function in both select clause , having clause. //in select select count(employee) employees grouping employee_dept //in having select count(employee) employees grouping employee_dept having(max(salary)>2000) 3) order of execution of sql statement 1)from 2)where 3)gro

c# - How to force a HTTP error in ASP.NET? -

c# - How to force a HTTP error in ASP.NET? - ide: visual studio 2013 ultimate language: c# asp.net webpage (aspx) problem: hi! have assignment school , making website using asp.net (c#) , need have 3 custom errors added. know how forcefulness 404 error (page not found) , 500 error (error in code behind of page) need 3rd 1 , don't know ones can force. in navigation menu have href "404page.aspx" 1 doesn't exist in solution 404 error. in menu have href "500error.aspx" , there have wrong code in code behind ("500error.aspx.cs") 500 error. web.config file: <customerrors mode="on" defaultredirect="error.aspx"> <error statuscode="404" redirect="error.aspx?error=404"/> <error statuscode="500" redirect="error.aspx?error=500"/> <error statuscode="x" redirect="error.aspx?error=x"/> </customerrors> error.aspx.cs (code behind error

ios - Using self and self properties inside a block in non-arc environment -

ios - Using self and self properties inside a block in non-arc environment - i have been using blocks , familiar memory management when using self within blocks in non-arc environment but have 2 specific questions: 1) understand can utilize __block avoid retain cycle retained block in turn using self can create, below: __block myclass *blockself = self; self.myblock = ^{ blockself.someproperty = abc; [blockself somemethod]; }; this avoid retain cycle sure doing have created scope self released , deallocated else. when happen self gone , blockself pointing garbage value. there can conditions when block executed after self deallocated, block crash trying utilize deallocated instance. how can avoid condition? how check if blockself valid when block executes or stop block executing when self deallocated. 2) on similar lines suppose utilize block below: __block myclass *blockself = self; self.myblock = ^{ [blockself somemethod:blockself.s

c# - How do I get accurate Exception stack in WCF Task-based Operation -

c# - How do I get accurate Exception stack in WCF Task-based Operation - i'm using wcf ierrorhandler interface trap , log errors on server side of wcf service. however, stacktrace of exception passed handleerror , providefault messed up: at system.servicemodel.dispatcher.taskmethodinvoker.invokeend(object instance, object[]& outputs, iasyncresult result) @ system.servicemodel.dispatcher.dispatchoperationruntime.invokeend(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage7(messagerpc& rpc) ....lots more i'm not surprised see random dispatcher methods in stack trace, assumed see own method @ top of stack. i've determined happens on operations like [operationcontract] public task<int> myoperation() { throw new applicationexception("test"); } services have proper stack trace me log: [operationcontract] public int mysyncoperation() { throw new applicationexcep

html5 - Setting getChannelData causing socket.io to crash in web audio -

html5 - Setting getChannelData causing socket.io to crash in web audio - i'm having issue whenever transcode sound file , send sound buffer client via socket.io played web sound connection dies perform source.buffer.getchanneldata(0).set(audio); i'm assuming isn't socket.io problem , i'm seeing socket.io issue result of real problem. in client i'm piping sound file stdin of ffmpeg , listening stderr of ffmpeg determine when it's safe send buffer. client receiving buffer , doing until line stated above. here sample test code reproduce issue. server side: var express = require('express'); var http = require('http'); var spawn = require('child_process').spawn; var app = express(); var webserver = http.createserver(app); var io = require('socket.io').listen(webserver, {log: false}); app.use(express.static(__dirname + '/public')); app.get('/', function(req, res){ res.send( &qu

html - How to switch between JavaScript? -

html - How to switch between JavaScript? - i have html website has basic html structure. <!doctype html> <html> <meta charset="utf-8"> <head> <title>cool site bro</title> </head> <body> <script type="text/javascript"> . . . script contents . . . draw elements pages, functions, etc. </script> </body> </html> which uses javascript draw elements on page create simple graph. with divs or other html objects know can take advantage of css property display , utilize javascript or jquery alter display block none or vice versa. there similar script tags hide contents of 1 , show another, sense page refresh , javascript required. what best way switch between 2 scripts on event clicking button? you don't need hide whole <script> tag. need create part of code inactive. way achive set part of javascript code within function.

dynamically loaded .net assembly does not work in C# -

dynamically loaded .net assembly does not work in C# - i need run .wav file in windows app using only mediaplayer class , need load assemblies require mediaplayer class @ runtime. need utilize presentationframework.dll,windowsbase.dll , presentationcore.dll. object creation of mediaplayer when trying invoke mediaplayer constructor.. fails. below code : assembly assembly = assembly.loadfrom("presentationcore.dll"); type type = assembly.gettype("system.windows.media.mediaplayer"); object instanceofmytype = activator.createinstance(type); type.invokemember("mediaplayer", bindingflags.declaredonly | bindingflags.public | bindingflags.nonpublic | bindingflags.instance | bindingflags.setproperty, null, instanceofmytype,null); type.invokemember("open", bindingflags.invokemethod | bindingflags.instance | bindingflags.public, null, instanceofmytype, new object[] { new uri("c:\\mymusic\\song1.wav") });

struts2 - struts 2 jquery grid plugin change only one column header style -

struts2 - struts 2 jquery grid plugin change only one column header style - is possible alter style of 1 column heard in grid ?! the sjg:gridcolumn has cssclass property, setting css applied rows under column, not column header. at jqgrid - possible alter background color of html header text in javascript? got code as: in html page. if want create changes 1 column can utilize setlabel method: $("#mygrid").jqgrid('setlabel','price', '', {'background':'red'}); or $("#mygrid").jqgrid('setlabel','price', '', 'mycolorclass'); but not create work. finally, columns headers have unique id, utilize below: document.getelementbyid("gridtable_samplecolumn").style.backgroundcolor = "#ff0000"; well think there improve way. looking thing this: <sjg:gridcolumn name="samplecolumn" cssclass="makethissmall&q

hibernate - where to place Transactional Spring annotation , in which layer? -

hibernate - where to place Transactional Spring annotation , in which layer? - i have uncertainty in placing spring annotation, in layer? these 2 cases: case : placing @transactional in dao layer case : placing @transactional in service layer? i using spring only, not springmvc. you want services @transactional . if daos transactional, , phone call different daos in each service, have multiple tansaction, not want. create service calls @transactional , , dao calls within methods participate in transaction method. refer link more details spring hibernate spring-mvc transactional

java - AspectJ Maven Plugin cannot compile my project -

java - AspectJ Maven Plugin cannot compile my project - i seek utilize aspectj maven plugin compile project aspectj compiler , seek bundle classes "war" file. unfortunately, doesn't work next configuration (pom.xml): <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.17</version> <configuration> <skiptests>true</skiptests> </configuration> </plugin> <plugin> <groupid>com.liferay.maven.plugins</groupid> <artifactid>liferay-maven-plugin</artifactid> <version>${liferay.maven.plugin.version}</version> <executions> <execution> <phase>generate-sources</phase&g

how to solve first order partial differential equation in matlab -

how to solve first order partial differential equation in matlab - i have first order partial differential equation: n0(t) + dn[n(d,t)r(d)/dy = dn(d,t)/dt with intitial condition: t= 0, n(d,0) = 0 and boundary condition: d=0, n(0,t)=0 if know how solve, can please help me? try ode45 also: 1) avoid variables d : have operator bring confusion 2) create sure have ode , not pde (what dy , boundary condition stands for?) matlab

c# - How to set custom name of ICollection property in automatically generated POCO entity, using Entity Framework -

c# - How to set custom name of ICollection property in automatically generated POCO entity, using Entity Framework - let’s there 2 tables in database: user int userid string name task int taskid string description int taskcreatorid int taskassigneeid and 2 foreign keys defined between task , user: taskcreatorid – userid , taskassigneeid - userid i have database, , utilize "database first" approach. using code generation in entity framework, 2 poco classes automatically created: user.cs public int userid public string name public icollection<task> tasks public icollection<task> tasks1 task.cs public int taskid public string description public int taskcreatorid public int taskassigneeid public user user public user user1 in order have meaningful entities, have change: public icollection<task> tasks --> public icollection<task> createdtasks public icollection<task> tasks1 --> public icollection<tas

python - Values of variables inside a for-loop -

python - Values of variables inside a for-loop - i have array a defined outside for-loop. b variable assigned equal a within loop. alter values of b within loop alters a . why/how happen? >>> import numpy np >>> = np.asarray(range(10)) >>> in range(5,7): b = #assign b equal b[b<i]=0 #alter b b[b>=i]=1 print output: [0 0 0 0 0 1 1 1 1 1] #unexpected!! [0 0 0 0 0 0 0 0 0 0] why a altered when don't explicitly so? because when b = a reference gets copied. both a , b point same object. if want create re-create of a need example: import re-create ... b = copy.deepcopy(a) python python-2.7 numpy

jquery - How to get request header from ajax -

jquery - How to get request header from ajax - i using ajax. here. can response header. var geturl = $.ajax({ type: urltype, url: url, data:data, beforesend:function(xhr){console.log(xhr)}, success: function(data) { $('.response').show(); $('#resdata').val(data); $('#resheader').val(geturl.getallresponseheaders()); // console.log(geturl.header) }, error: function(jqxhr, textstatus, errorthrown) { }, complete: function (xmlhttprequest, textstatus) { console.log(xmlhttprequest) } }); in this, didn't set headers. default, pass request header shown in network tab. i have request header in beforesend, success & complete. how can req header ajax this req header can in network tab

php - Magento: hide attributes from certain categories -

php - Magento: hide attributes from certain categories - i want hide attributes in category page categories, instance 21 , 24. tried or statement guess it's not in right position ignores both: <?php $category = mage::getmodel('catalog/layer')->getcurrentcategory(); if(($category->getid()!=21) || ($category->getid()!=24)) { ?> <strong>capacity:</strong> <?php echo $_product->getcapacity(); ?> <br> <strong>graduations:</strong> <?php echo $_product->getgraduations(); }?> can point me in right direction if(($category->getid()!=21) || ($category->getid()!=24)) { let's see happens here: if id 21 "if-clause" not pass first look (false) - id != 24 passes sec 1 (true). since "||" in php not "exclusive or" passes whole if (false or true = true) , attributes p

tsql - What is a batch process in SQL Server 2012? -

tsql - What is a batch process in SQL Server 2012? - i looking though tests t-sql querying sql server 2012, , encountered 1 asked object should used when developing batch process homecoming result set based, based on parameters, can perform bring together table. one of incorrect answers question "inline user-defined function". surprised me, seem meet requirements - therefore, assume must misunderstanding meant "batch process". so, batch process mean in context of sql server 2012? tsql sql-server-2012

matlab - insert the content of a text file into a variable -

matlab - insert the content of a text file into a variable - i want load text file whit ascii characters , set content varialbe in matlab, code tried : f =fopen('tp.txt') the result 1, increments each time excute code line. however, when seek : f =load('tp.txt') i error : ??? error using ==> load number of columns on line 1 of ascii file d:\cours\tp\tp.txt must same previous lines. error in ==> tpti @ 3 f =load('tp.txt') my goal count occurance of each charachter calculate propabilites , entropies. any idea? try this: %// import file contents string str = importdata('tp.txt'); %// each line cell str = [str{:}]; %// concat lines single string %// remove spaces. maybe want remove other characters well: punctuation... str = regexprep(str, '\s', ''); %// count frequency of each character: freq = histc(double(str), 0:255); %// convert characters ascii codes , count matlab

c# - At which point is ServiceLocator created? -

c# - At which point is ServiceLocator created? - i developing application using prism library 4.5. i experiencing problem model uses microsoft.practices.servicelocator in it's constructor. works fine except when seek load specific model during startup, more exactly in prisms bootstrapper. servicelocator null @ point, i'm wondering @ point servicelocator beeing created. you haven't specified bootstrapper using, order unity bootstrapper is: createlogger createmodulecatalog configuremodulecatalog createcontainer configurecontainer configureservicelocator configureregionadaptermappings configuredefaultregionbehaviors registerframeworkexceptiontypes createshell initializeshell initializemodules c# .net prism service-locator

c# - Failed on building working RegEx Expression -

c# - Failed on building working RegEx Expression - i'm working on little searching tool, searchs defined words in every (text-based) file in selected filepath. therefore used build working regex string makes possible , does. furthermore, added function user can add together strings list, wich should excluded searched word (e.g. searchstring: "result", exlusion:":=", "result:=" in .dfm files should ignored). my current regex string : @"(?:(result)(?!:=|;))" this solution works simple, if there's ":=" or ";" @ end of "result". should allowed other words can stand for- , afterwards "result" till end of line. can help me? :) many in advance :) if understand correctly, you're looking negative lookbehind (?<!) (?<!@|&)result(?!:=|;) demo c# regex

osx - Steps to Get Value from NSComboBox -

osx - Steps to Get Value from NSComboBox - im new cocoa applications(mac application) , im trying selected value nscombobox , don't how proceed, please help me on this, improve if steps provided. in advance use objectvalueofselecteditem , if that's nil user has entered text not list, utilize stringvalue method of nscontrol ancestor: nsstring *str = [_combobox objectvalueofselecteditem]; if (!str) str = [_combobox stringvalue]; osx cocoa

from one file making multiple copies of a file with different names by using python -

from one file making multiple copies of a file with different names by using python - i want create 10 copies of file named "as-1.txt" , want names of copied file "as-2.txt" , "as-3.txt" , on. shutil .copyfile() not working in iterative status loops import subprocess in range(2,10): subprocess.call(['cp', 'as-1.txt', 'as-%d.txt' % i]) python python-2.7 python-3.x

javascript - Unable to sign out using gapi.auth.signOut -

javascript - Unable to sign out using gapi.auth.signOut - i integrating google social login in web app (angularjs). not able sign out user. below simplified approach - scenario 1. first time user - i have own button, when clicked loads page 'x'. page redirects user google login and/or app permission approval page. x returns user site. passed info logged in through google , have sign in through gapi can sign out later. sign in can implemented in 2 ways - gapi.auth.authorize() immediate: true or gapi.auth.signin() 'immediate': true i have tried both. neither works. sec has additional disadvantage browser shows popup has been blocked. then there sign out button, calls gapi.auth.signout() , loads page 'y'. page y returns site, , scenario 2 triggered (read below), loads signed in page :( scenario 2. returning user, in same browser. using below code, first check if there google acess_token, can effort login through google. gapi.auth.a

java - Bean not autowiring -

java - Bean not autowiring - i have application-context.cml: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-autowire="bytype"> <context:annotation-config /> <tx:annotation-driven /> <bean class="app.bl.facade.impl.dishfacadeimpl" /> and attempting autowire it: @autowired private dishfacade

php - How can I get this in the title -

php - How can I get this in the title - i trying link go in same block title. when @ page.php or index.php, not see the_title anywhere. see following: <div class="post-content"> <?php the_content(); ?> <?php wp_link_pages(); ?> </div> if view page see share button above content (share icon text "share event"). <div class="share-button"><div> but trying next title. can tell me php file contains code can add together it? the page http://isaevent.com/event/new-year-kick-off/ the site using events calendar plugin. can create custom templates create changes. here's how: http://tri.be/support/documentation/events-calendar-themers-guide/ it tells how alter plugin files, wouldn't recommend because you'll lose changes if update plugin. php wordpress

subprocess - Python: How to pass ARGV parameters to another script? -

subprocess - Python: How to pass ARGV parameters to another script? - i need create wrapper script gets parameters shell , passes of them are, script. in perl, do: system("/path/to/subprocess", @argv); is there way same thing in python? call subprocess.call sys.argv minus first element, name of python script. import subprocess import sys subprocess.call(["/path/to/subprocess"] + sys.argv[1:]) example date subprocess: $ python3 s.py tue oct 21 09:25:00 cest 2014 $ python3 s.py -r tue, 21 oct 2014 09:25:01 +0200 python subprocess argv

ios - Why does my UITableView's formatting go completely awry when I return from a view controller I segued to? -

ios - Why does my UITableView's formatting go completely awry when I return from a view controller I segued to? - i have uitableview custom cell, has few labels in dynamically decide height of cell. when tap on 1 cell , segue new view controller, upon returning formatting cells messed up, , can't figure out causing it. here cells like: and have pretty basic constraints set on them. top label pinned top , left margins, , must >= 20 right. other labels aligned left of first label, vertical spacing set between of them. middle label has right spacing constraint margin, , bottom labels aligned baseline of first , have horizontal spacing between of them. when segue table view looks however: i can't figure out causing layout differently when left. if scroll around seems "reset" them should be, on initial load they're messed up. can attach project if desired, there's not much outside of storyboard. cellforrowatindexpath: override func tab

php - Symfony2 + Doctrine2 not updating in my database -

php - Symfony2 + Doctrine2 not updating in my database - i have api in symfony2, in adding , deleting items not issue, however, updating doesn't throw me errors relevent row in database not updated! my controller method: /* * @route("/complete/uid/{storeuid}", * name = "media_complete" * ) * * @method({"get"}) * * @param string $storeuid - uid store has completed downloading * * @return response */ public function downloadcompleteaction($storeuid) { $response = $this->getnewjsonresponse(); $em = $this->getdoctrine()->getmanager(); $repo = $em->getrepository("simplysmartuhdprobundle:machine"); seek { //get machine db $machine = $repo->findoneby(array( "uid" => $storeuid )); //set download completed $machine->setstatus(machine::status_download_complete); $em->persist($machine);