Posts

Showing posts from March, 2012

sql server - Azure Mobile Service concurrency handling in SQL? -

i implementing azure mobile service , have set of objects can accessed multiple users, potentially @ same time. problem can't find lot of information on how handle potential concurrency issues might result this. i know "azure tables" implements e-tag check. there out-of-the-box solution azure mobile services 1 sql ? if not, approach should going here. should implement e-tag check hand? include guid of object generated every time object saved , checked when saving. should relatively safe way it? for conflicts between multiple clients, need add detection/resolution mechanism. use "timestamp" (typically sequentially incremented version number) in table schema , check in update script. fail update if timestamp used client reading older current timestamp. if want use etags via http headers, use custom apis. looking enabling crud scripts set headers not available today. separately, looking offline scenarios well. (prog manager, windows azure mobil

java - Problems building latest axis2 with maven -

i checked out latest version of axis2 http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/ , installed newest maven. after execution of mvn install got following. please me, doing wrong? [info] scanning projects... [warning] [warning] problems encountered while building effective model org.apache.axis2:axis2-transport-http:bundle:1.7.0-snapshot [warning] 'dependencies.dependency.(groupid:artifactid:type:classifier)' must unique: org.apache.httpcomponents:httpclient:jar -> duplicate declaration of version (?) @ line 116, column 21 [warning] [warning] highly recommended fix these problems because threaten stability of build. [warning] [warning] reason, future maven versions might no longer support building such malformed projects. [warning] [info] ------------------------------------------------------------------------ [info] reactor build order: [info] [info] apache axis2 - parent [info] apache axis2 - resource bundle [info] apache axis2 - kernel [info] a

Accessing an array across files in C -

i'm trying access array across files, this; int option[number_of_options]; ... addition(&option[0], num1, num2); ... printf("%d", option[0]); thats first(main) file and second this; void addition(int * option, unsigned number1, unsigned number2) { int total = number1 + number2; ... *option ++; } something that. dont worry addition method. the problem printf method allways prints 0, if *option ++; never executed/read. how fix this? by way, warning in "*option++;" file saying: warning: value computed not used. how solve problem? thank you! this: *option++; doesn't think does. means is: *(option++); which first applies increment operator option pointer , dereferences afterwards. effect is: option++; *option; // statement no effect, hence warning. you need instead: (*option)++;

javascript - Using flash plugin with inline ckeditor -

i using inline ckeditor version 4.0.2 , trying embed flash object(ooyala video) using flash plugin. after adding url see image "flash" instead of video. also, after saving code still see same image instead of video. here code of flash image <img class="cke_flash" data-cke-realelement="the real element code" data-cke-real-node-type="1" alt="flash animation" title="flash animation" align="absmiddle" src="http://localhost:3000/javascripts/lib/ckeditor_4.0.2/plugins/fakeobjects/images/spacer.gif?t=d26d" data-cke-real-element-type="flash" data-cke-resizable="true"> how can see actual video instead of image? you cannot see flash video in editor on purpose. replaced dummy image secure editor's contents , make sure clicking (or other interaction) embedded object doesn't break editor. flash can go fullscreen, load lots of data, make noise or else that, speaking, u

java - Get simple JSON Parameter from a JSON request in JAX-RS -

the client/browser makes json request rest resource (the content-type of request application/json , corresponding rest method @consumes("application/json") annotated). @path("/process-something") @post @produces("application/json") @consumes("application/json") @handledefaultexceptions public aresponse processsomething(list<long>) { } the json body consists of simple types, list<long> or string . is there simple possibility json parameters injected annotating somehow, similar @formparam in case of application/x-www-form-urlencoded request? other easier solutions decoding json string jackson's objectmapper or jettison's jsonobject . you may create java class reflects data model of json object , annotate jaxb's @xmlrootelement. can map attributes custom json key name @xmlelement annotations, e.g.: @xmlrootelement public class myjsonoject{ @xmlelement(name="json-key-name") public

java - Set a default value to a rich:select component which has enableManualInput set to true? -

<rich:select id="midisabled" enablemanualinput="false" value="bar"> <f:selectitem itemlabel="foo" itemvalue="foo" /> <f:selectitem itemlabel="bar" itemvalue="bar" /> </rich:select> <rich:select id="mienabled" enablemanualinput="true" value="bar"> <f:selectitem itemlabel="foo" itemvalue="foo" /> <f:selectitem itemlabel="bar" itemvalue="bar" /> </rich:select> both rich:select s have "bar" value selected default, midisabled 's dropdownlist has 2 available values "foo" , "bar" expected, while mienabled 's have "bar" : "foo" disappeared ... any other way set default value rich:select component has enablemanualinput set true ? richfaces 4.1.0 jsf 2.1.21 jdk 6u20 x32 but default value being set, isn'

arrays - Python -- Algorithm efficiency and stability -

i have done 2 algorithms , want check 1 of them more 'efficient' , uses less memory. first 1 creates numpy array , modifies array. second 1 creates python empty array , pushes values array. who's better? first program: f = open('/users/marcortiz/documents/vlex/pylearn2/mlearning/classify/files/models/model_training.txt') lines = f.readlines() f.close() zeros = np.zeros((60343,4917)) l in lines: row = l.split(",") element in row: zeros[lines.index(l), row.index(element)] = element x = zeros[1,:] y = zeros[:,0] one_hot = np.ones((counter, 2)) the second one: f = open('/users/marcortiz/documents/vlex/pylearn2/mlearning/classify/files/models/model_training.txt') lines = f.readlines() f.close() x = [] y = [] l in lines: row = l.split(",") x.append([float(elem) elem in row

Create Error with custom text that prevents compiling in VB.NET (#error in C#) -

Image
you can add preprocessor directive cause error @ compile time in c# this: #error cause divide 0 how can same this in vb.net? or is there way create error provides custom helpful information in errorlist. tldr: i want in vb.net: here 1 way can achieve want. not perfect. meet criteria of: prevents compiling puts custom text in error list window you first need declare variable custom text want displayed underscores in between each word. (yes underscores annoying necessary) dim this_is_as_useful_a_description_as_your_gonna_get string this creates unused variable. in conjunction ide's ability treat warnings errors give close looking for: you can turn on treat warnings errors going project properties , compile tab. so:

asp.net web api - Filter Child Property OData and ASPNET WebApi -

i'm facing problem. i've googled lot , searched in here too, couldn't find answer problem. i have aspnet web api returns json . also, add microsoft.data.odata nuget allow odata queries. it's working fine simple cases, now, need apply filter in child collection. sample: {"total":1,"products":[{"id":20289,"brandid":5,"categoryid":1,"price":12.0,"name":"carolina herrera","description":"ch","productcode":"asd2334","picture":null,"contentpackaging":"liquid","brandname":"carolina herrera","brandpicture":null,"generic":true}, {"id":20290,"brandid":5,"categoryid":1,"price":25.0,"name":"carolina herrera 2","description":"ch 2","productcode":"asd999","picture":null,"

SQL Server NULL Values with an Insert statement -

i have query not doing want, not sure how solve this: declare @roommap table (id int identity(1,1), sourceroom int,--> sourceroomid sourcesiteid int, targetroom int, -->demoroomid targetsiteid int ) insert @roommap (sourceroom, sourcesiteid) select tblcontrols_rooms.id, @origsiteid tblcontrols_rooms siteid = @origsiteid insert @roommap (targetroom, targetsiteid) select tblcontrols_rooms.id, @newsiteid tblcontrols_rooms siteid = @newsiteid insert demoroommap (demoroomid, sourceroomid) select targetroom, sourceroom @roommap this demoroommap table when run it: targetroom sourceroom 332 2 333 3 334 4 335 5 336 6 337 9 338 10 the result when run above query: targetroom sourceroom null 1942 null 1943 null 1944 null 1945 null 1946 2025 null 2026 null 2027 null 2028 null as can see, there null values not want insert! how can rid of them? you can rid of them inserting value them.

Python/Mako: Script Tag not showing up from Sub Template when Loaded into Main Template via Ajax Call -

Image
i have 3 level template. want load dynamically load script tag sub template main template. template setup: a base page headers/scripts 2nd level template contains new script tag , loads widget 3rd level template contains widget all i'm trying when 3rd level template loaded, load specific javascript file, don't have heavy filled head tag on base template javascript files may not used. base template (in head tag): <script type="text/javascript" src="/assets/scripts/jquery-1.9.1.js"></script> ${next.javascriptincludes()} <script type="text/javascript" src="/assets/scripts/modules/basemodule.js"></script> 2nd template (where script tag is) ##conditional determine if template should inherit base page ##it shouldn't inherit base page if being inserted page using ajax <%! def inherit(context): if context.get('ispage'): return "base_dashboard.mak" else:

web services - JAXWS / JAXB doesn't bind attributes of references Object from seperate jar -

This summary is not available. Please click here to view the post.

Add android metadata tag in theme apk and read the value -

add android metadata tag in theme apk , read value, saw this , application apk works fine have theme apk doesn't has application tag , tried adding metadata under manifest tag not working. can 1 me in adding how metadata or custom tag in manifest , retrive value in android application using packagemanager the manifest of theme apk below <?xml version="1.0" encoding="utf-8"?> <manifest android:hascode="false" android:versioncode="2" android:versionname="1.0" android:installlocation="internalonly" package="com.template.theme.y" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html"> <theme pluto:wallpaperimage="@drawable/wallpaper" pluto:ringtonefilename="media/audio/ringtones/standard.mp3" pluto:preview="@drawable/preview" pluto:stylename="@string/style_appearance_name"

vb6 - connecting to a computer in LAN and send cmd commands -

i need connect computer in lan , open cmd in remote computer , send command (for example ping www.google.com - other commands..) i thought open server on remote computer , client in computer , every time send command string server side, , send command cmd (i know it's easy c++) is there way this? there way in vb6 open cmd in remote computer , send command? the reason write here because client side written in vb6 client not written, put in program written in vb6 thank you you might able use wmi. copy on batch file, script or executable , use wmi execute remotely. you can use win32_process.create described here: creating processes remotely

How to import android project properly into Eclipse? -

i tried many answers there non solved problem. i have android project (lets name t ) created using eclipse workspace folder. i did following: i copied t place backup. then, deleted eclipse -> r-click on t delete . when checked workspace, removed expected. then. i copied backup workspace. i tried open on eclipse, no success. file -> import -> android -> existing android code workspace -> next -> browse (to project folder in workspace itself) -> finish (last step). after last step, dialog box disappeared (as expected) without warning message. t not added (became visible) package explorer of eclipse!!. i checked workspace folder, project t wanted open still there how fix? try leaving project folder outside of workspace during import. when re-import project, check "copy project files workspace" box. in experience, manually copying projects (or out of) workspace can troublesome.

php - SELECT command denied to user cannot connect to database -

i have uploaded website add on domain, given user "tomzino1_user1" correct privileges , added user correct database. php based website written on dreamweaver when attempt access site (theboatshedmusic.com) comes error message: select command denied user 'tomzino1_user1'@'localhost' table 'main_table' the hosting company's support service checked tables responding correctly , user had been given correct privileges , added config file correctly. suggested there problem scripts working fine mamp testing database. the config file reads as: <?php # filename="connection_php_mysql.htm" # type="mysql" # http="true" $hostname_boatshed = "localhost"; $database_boatshed = "tomzino1_boatshed_test"; $username_boatshed = "tomzino_user1"; $password_boatshed = "********"; $boatshed = mysql_pconnect($hostname_boatshed, $username_boatshed, $password_boatshed) or trigger_error(mysq

c++ - C++Builder program does not run (but if I delete file.close() line it does!) -

i'm developing first game application since winter, , meet 1 strange problem. using embarcadero c++ builder xe app compiled , ran, today fails start, still compiled successfully! press "run" usual, see console output "success elapsed time etc" , - nothing. app's window not appear. i figured out problem in code: ifstream file; file.open(filewithtextureprop, ios::binary); int length; char * buffer; // length of file: file.seekg (0, ios::end); length = file.tellg(); file.seekg (0, ios::beg); // allocate memory: buffer = new char [length+1]; buffer[length] = '\0'; // read data block: file.read (buffer,length); xml_document<> doc; doc.parse<0>(buffer); /* xml parsing here, if delete or comment - nothing changes */ delete[] buffer; file.close(); // note: if comment line - program starts (!) what doing wrong?

android - Jquery Mobile: loading spinner going crazy on second start-up -

in (android) phonegap app, i've added code below show loading-spinner while logging in on facebook. @ first start-up, works beautifuly. however, when press back-button , launch app again, spinner out of control: spins way fast , short pauzes. also, spinner appears not in center of screen, higher (it looks it's centered text follows afterwards). anyone familiar issue , knows how fix it? function devicereadylistener() { $.mobile.loading( 'show' ); console.log("device ready"); try { fb.init({ appid:"xxx", nativeinterface:cdv.fb, usecacheddialogs:false }); navigator.splashscreen.hide(); getloginstatus(); document.addeventlistener("offline", onoffline, false); } catch (e) { alert(e); } }

vim - Why leaving insert mode moves cursor position to left -

this question has answer here: cursor positioning when entering insert mode 6 answers when in insert mode in vim: foo b[a]r where [] denotes cursor position and go normal mode, cursor going 1 position left: foo [b]ar is there advantage of this? your initial "state" wrong, in insert mode: bar[] in insert mode, cursor between characters while on character in normal mode. when leave insert mode, cursor has on character: character be? 1 on left of insert mode cursor or 1 on right? how vim supposed decide side one? one hint command used enter insert mode: leaving insert mode after i leave cursor on left side , a leave on right side. but, point of having cursor on character that's on right of last character typed? anyway, insert mode inserting text exclusively . i<esc> or a<esc> make no sense , serve no practical

fullCalendar how to set the events programatically -

i'm having problem setting calendar event grammatically. i have page user can select client display event using drop down. request events via ajax call. , looks good. i'm having problem setting events in fullcalendar. this code set events: success: function(resp){ var r = resp.output; console.dir(r); jquery('#student').html(r.studentname); jquery('#calendar').fullcalendar( 'removeevents' ); // <= works jquery('#calendar').fullcalendar( 'events', r.events ); // <= doesn't } this dump of ajax response: events "[{ id: 1, title: 'acupuncture', start: new date(2013, 5, 29, 10, 00), end: new date(2013, 5, 29, 10, 30), allday: false } , { id: 2, title: 'acupuncture', start: new date(2013, 6, 30, 10, 00), end: new date(

java - Calling one service from another service in android -

my main app starts 2 services input-service , save-service. input-service generating input able show in main app , both services starting successfully. facing problem in calling 1 service another. means how can send data of input-service save-service. there example shows communication between 2 services. or can me regarding this. why not use broadcastreceivers ? register them in oncreate , de-register in ondestroy , send data through intents ...

How to avoid including duplicate records in group summaries in Crystal Reports -

Image
i have report groups record company, customer, invoice, date... have duplicated records. want sum total , not include duplicate records. use running total, , ongroup change invoice. works grand total in report footer still want subtotal in case 15006.26 + 39772.26 + 21140.00 + 4571.92. i tried use whileprintingrecords , declare currencyvar=0 , recalculate total this whileprintingrecords; currencyvar amt; if previous ({brptarageupssequence;1.invoice})<>{brptarageupssequence;1.invoice} currencyvar amt:= amt + {brptarageupssequence;1.ageamount} else if onfirstrecord currencyvar amt:= {brptarageupssequence;1.ageamount} but o , not know problem you need 2 running totals: 1 grand total , 1 group level. since sounds you've got 1 grand totals working, need duplicate 1 , make 1 small change work @ group level. in new running total settings, change "reset" field "none" "on change of group" , select group level want work at

c# - Trying to search ListView for subitems matching a string -

i'm having trouble scanning through listview locate subitem matching given string. here's code: private void datetimepicker1_valuechanged(object sender, eventargs e) { string date = datepicker.value.toshortdatestring(); int count = program.booker.listview.items.count; (int = 0; < count; i++) { listviewitem lvi = program.booker.listview.items[i]; if (lvi.subitems.equals(date)) { messagebox.show("found!", "alert"); program.booker.listview.multiselect = true; program.booker.listview.items[i].selected = true; } else { messagebox.show("nothing found " + date, "alert"); } } } the listview located on booker form, , i'm accessing filter class. i'd search entire listview items matching date string. thanks! you can use findite

What does # mean in Lua? -

i have seen character '#' being added front of variables lot in lua, wondering does? have found example of being used here. -- sort ais in currentlevel table.sort(level.ais, function(a,b) return a.y < b.y end) local curaiindex = 1 local maxaiindex = #level.ais = 1,#currentlevel+maxaiindex if level.ais[curaiindex].y+sprites.monster:getheight() < currentlevel[i].lowery table.insert(currentlevel, i, level.ais[curaiindex]) curaiindex = curaiindex + 1 if curaiindex > maxaiindex break end end end apologies if has been asked, i've searched around on internet lot haven't seem have found answer. in advance! that length operator : the length operator denoted unary operator #. length of string number of bytes (that is, usual meaning of string length when each character 1 byte). the length of table t defined integer index n such t[n] not nil , t[n+1] nil; moreover, if t[1] nil, n can zero. regu

javascript - Phonegap 3.0 Angular.js unable to use InAppBrowser -

i'm working on project based on phonegap 3.0 , angular.js. try use inappbrowser following controller : function accueilctrl($scope,$window) { $scope.openurl = function() { var ref = $window.open('http://www.google.fr', '_blank', 'location=yes'); }; } i call function, in view, : <a ng-click="openurl()">open page</a> i followed insctructions, , used cli version of phonegap 3.0 : phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git phonegap build ios but when launch app, either in simulator, or on real device, window not show nav bars @ all, it's full screen. replacing "_blank" "_system" doesn't change anything, safari not launch. do think bug in phonegap or angular, or missing something? how can debug or trace find what's wrong? thx

c - Single list printing error -

this how program doesn't print full list node's data entered last.i couldn't understand problem in linking or not : basic structure of node struct node { int data; struct node *link; }; defining header start of link list : struct node *header; functions insert , print : void insertfront_sl(); void print_sl(); the main function : void main() { clrscr(); header=(struct node *)malloc(sizeof(struct node)); header->link=null; header->data=null; insertfront_sl(); insertfront_sl(); insertfront_sl(); insertfront_sl(); print_sl(); getch(); } void insertfront_sl(){ struct node *temp; int x; temp=(struct node *)malloc(sizeof(struct node)); if(temp==null) { printf("\nmem0ry insufficient .."); } else { printf("\ngot new node \nnow insert data node : "); scanf("%d",&x); temp->

Android Worklight App UI Performance Bad vs. Browsers -

in our project using jquery mobile 1.3.1, wl 5.0.6 , knockout 2.2.1. the ui performance of compiled, bundled , installed worklight app in pretty every aspect - slide transitions, page transitions, button click responsiveness, etc. - quite bad on high-end android galaxy 3, galaxy 4 , lg optimus g phones. when tested applications straight consumer version tomcat worklight server using /worklight/apps/services/preview/app/android/1.0/default/app.html performance in browsers on android phones - built-in, chrome, firefox, opera great. comparable ios, better in cases. of course have load times of web resources server, once loaded fast! we looked solutions , found proposal of: <application android:hardwareaccelerated="true" ...> ... since should default android api version 14 not expect real performance increases. are there suggestions how worklight app same performance app in android browsers? known , on our radar... please see ishai's answer in

sql - Class 'Category' not found in C:\xampp\htdocs\tg\system\core\Loader.php on line 303 -

i have xampp folder in c drive can use mysql , admin , can function related db .. have problem in running folder i.e, tg data website present in. when try run website gives me error: fatal error: class 'category' not found in c:\xampp\htdocs\tg\system\core\loader.php on line 303 what can reduce this? have on short open tag , again try open local host tg can not open it. did update base_url() in codeigniter/config/config.php ? look for $config['base_url'] = 'http://localhost/your_codeigniter_directory/'; and change $config['base_url'] = 'http://www.yourdomain.com/your_codeigniter_directory/'; your error shows application still in xampp no?

python unable to import module -

i have program set using packages followed: -base ---init.py ---base_class.py -test ---init.py ---test.py when import statment from base.base_class import baseclass in test.py error when running base.base_class import baseclass importerror: no module named base.base_class i can't figure out why can't import module. at top of test.py add import sys sys.path.append("..") base not folder on path...once change should work or put test.py in same folder base. or move base somewhere on path

Does websocket not work with IWebBrowser2::Navigate? -

i writing small html websocket application. html page works fine @ ie window if same page tried open using iwebbrowser2::navigate throws error "websocket undefined" in standard java script error message box. following sample javascript code: function myfunction() { ws = new websocket("ws://" + "127.0.0.1"+ "8070" +"/" + "nscomstring"); } could please let me whether websocket implemented inside navigate method? regards, anand choubey the iwebbrowser2 control default runs in compatibility mode, see this article on ieblog details on how circumvent behavior.

OCaml: type incompatibilities between sets -

i'm having troubles type incompatibilities in ocaml. first, have file setbuilder.ml define functor creates order sets, functor s creates sets, , functor sm creates module containing useful functions work sets: module (m: sig type t end) = struct type t = m.t let compare = pervasives.compare end module s (p: sig type t end): set.s type elt = p.t = set.make (so (p)) module sm (m: sig type t end): sig type t = m.t module s: set.s type elt = t type set = s.t ... end = struct module s = s (m) ... end (in such situation i'm used combining such 3 modules 1 recursive module, appears ocaml doesn't let create recursive modules when parameter excepted (i.e., when it's functor)). then in different file, called module_u.ml, define module u function foo important: module u (m: sig type t end): sig module s : set.s type elt = m.t type elt = m.t type eltset = s.t val foo: eltset -> eltset -> bool end = struct module s = s (m)

Styling indent with HTML or CSS like in Ms Word -

i need a., b. style inner indent instead of 2.2.1., 2.2.2. . found original css code html ordered list indent keep original numbering my code: <style> ol { counter-reset: item } li { display: block } li:before { content: counters(item, ".") ". "; counter-increment: item } </style> <ol> <li>one</li> <li> 2 <ol> <li>two one</li> <li> 2 two <ol type="a"> <li>two 2 a</li> <li>two 2 b</li> </ol> </li> <li>two three</li> </ol> </li> <li>three</li> </ol> what i'm getting: 1. 1 2. 2 2.1. 2 1 2.2. 2 two 2.2.1. 2 two 2.2.2. 2 two b 2.3. 2 3 3. 3 what need: 1. 1 2. 2 2.1. 2 1 2.2. 2 two

java - dependency injection in a servlet 3.0 web app? -

i'm trying write servlet 3.0 web app, learn basic servlet handling. use spring. now have servlet access dao queries database. now, best way instantiate dao , use it? best guess have private property in servlet , create instance of dao when servlet created. but, servlet created multiple times? is there similar springs dependency injection available in servlet 3.0? ejb 3 dependency injection extremely simple use. single annotation, @ejb, causes injection of declared bean. injection of somedao bean servlet 3.0 looks this: @webservlet(name="messenger", urlpatterns={"/messenger"}) public class messenger extends httpservlet { @ejb somedao somedao; } the injected somedao bean interface or no-interface view bean. long there 1 implementation of interface, injected without ceremony.

windows - Bypassing ZwTerminateProcess hooks -

i'm writing program terminate given process. link code : link i expect terminate process, bypassing hooks. security softwares can still block terminating (i've tested sandboxie , processguard far)? i can't understand how can that. program rewrites functions , expect remove hooks way. how can bypass hooks? miss in code? p.s : program crashes in third zwterminateprocess call. can this, please? thanks in advance. sometimes, av , sandboxing software end modifying function pointer tables in kernel. short of writing driver, there no easy way around that, because functionality may disabled system-wide (what av's do) or particular application (what sandboxes do). if able open handle process, can still lot of things. maybe try killing indirectly. try write directly process' memory , overwrite garbage (or calls exitprocess).

How to write a very long sum in a fitness function for global optimisation in Matlab -

i struggling writing parametrised fitness function global optimisation toolbox in matlab. approach: [x fvall,exitflag,output]=ga(fitnessfcn,nvars,a,b,aeq,beq,lb,ub) i have fitness function call with fitnessfcn=@fitnesstest; hence, function stated in separate file. problem: issue optimisation simple super long sum like cost=f1*x1+f2x2+...fnxn n should parameterised (384 @ moment). in matlab files, objective function short , neat like y = 100 * (x(1)^2 - x(2)) ^2 + (1 - x(1))^2; i have tried several approaches "writing" objective function intelligently, then, cannot call function correctly: if write fitness function manually (for fi=1) function y = simple_fitness(x) y = x(1)+ x(2)+ x(3)+ x(4)+ x(5)+ x(6)+ x(7)+ x(8); the global optimisation works but if use automated approach: n = 8; %# number of function handles parameters = 1:1:n; store = cell(2,3); i=1:n store{1,i} = sprintf('x(%i)',parameters(i)); store{2,i} = '+';

delphi - Close Metro Application -

i created metro app using vcl metropolis ui application on file-new menu. i surprised close app with: procedure tsplitform.closebuttonclick(sender: tobject); { closebuttonclick. } begin application.terminate; end; rather usual: procedure tsplitform.close1click(sender: tobject); { close1click. } begin close; end; i see application.terminate posts postquitmessage(0); is there difference between close , terminate... , necessary close metro app application.terminate? as no 1 else has offered answer here... a metropolitan ui application uses tsplitform = class(tform) , tdetailform = class(tform) , tform forms.tform . there's nothing different it, question whether in metropolitan ui changes things. a @ 2 generated forms in vcl metropolitan ui split screen application shows nothing unusual in way of components used, there's nothing affects behavior except actual code generated. (they're usual tpanel , tgridpanel , tgesturemanager , , other standard

html - How to center absolute div horizontally using CSS? -

i've div , want centered horizontally - although i'm giving margin:0 auto; it's not centered... .container { position: absolute; top: 15px; z-index: 2; width:40%; max-width: 960px; min-width: 600px; height: 60px; overflow: hidden; background: #fff; margin:0 auto; } you need set left:0; right:0; . this specifies how far offset margin edges sides of window. http://www.w3.org/tr/css2/visuren.html#position-props http://jsfiddle.net/ss6dk/ css .container { position: absolute; top: 15px; z-index: 2; width:40%; max-width: 960px; min-width: 600px; height: 60px; overflow: hidden; background: #fff; margin: 0 auto; left: 0; right: 0; } note: must define width or answer not work . means answer not useful elements dynamic widths.

logcat - Read logs from all apps on android from within an app for android 4.2+ -

i believe there have been changes ways apps can read logs in android post 4.2. wanted know if can read logs including system logs logcat within app current versions of android? if yes need permission or not? unless rooted cannot since jelly bean. see android bug report , related discussion . quote: the change third party applications can no longer read logs permission, every app can read logs containing lines they have written, without needing permission. keep in mind access logs has never been part of sdk, , still not part of sdk. if relying on then, after change, run risk of breaking in future. (and partly why got lost documentation, not part of sdk, there isn't place document it, in fact documenting kind-of make part of sdk don't want. :p) also really hope developers don't take license further abuse system logs , spew increasing amounts of stuff app. log noise has been continual problem on android (not third party

ID of object with all of its variables in hibernate -

with class, want class's id value of of attributes. implicitly means need row these values existing in database. how in hibernate? public class weatherstate { private string weathertype; private double temperature; } when persistent attributes should directly attributes of weatherstate, @idclass way go (persistence annotations imported javax.persistence package): @entity @idclass(weatherstateid.class) public class weatherstate { @id private string weathertype; @id private double temperature; //getters, setters } public class weatherstateid implements serializable { private string weathertype; private double temperature; //getters, setters, equals, hashcode } other options use @embeddedid : @entity public class weatherstate { @embeddedid private weatherstateid weatherstateid; public weatherstateid getweatherstateid() { return weatherstateid; } public void setweatherstateid(weatherstateid weatherstateid)

xslt - how to get the hidden control value in xsl variable -

i new xslt. problem have hidden control in 1 xslt file. <input type="hidden" name="org" id="oid" value="5"/> i select value in xsl variable in xslt file. <xsl:variable name="v1" select="//input[@type = 'hidden' , @id = 'oid']/@value"/> should select value input xml document stylesheet processes. after edit question looks different however; have 'a hidden control in 1 xslt file', , want select in different xslt file. if 1 xslt processes other input path remains same if there literal result element <input type="hidden" name="org" id="oid" value="5"/> in first xslt document.

java - @Autowired results in NullPointerException -

i have facelets/ jsf managed beans/ hibernate application. right trying implement di beans via annotations. have 2 of them: loginbean, registrationbean (each responsible appropriate page). problem whenever try autowire property inside registrationbean, end npe. if place same class fields loginbean - autowired no problem! below managedbeans, applicationcontext.xml (db settings ok, won't post db.properties) , class, trying autowire, stacktrace. with best regards. nazar applicationcontext.xml: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xs