Posts

Showing posts from July, 2012

mysql - SQL Sum of different rows -

hi need in making query sum different materials in one. materialname quantity date ...................... 20 .... 1/1/2010 ...................... 10 .... 1/2/2010 b ...................... 30 .... 1/2/2010 c ...................... 20 .... 1/3/2010 for example want sum material , b. try this. add where clause filter a & b sum quantity per materialname select materialname, sum(quantity) sum_quantity tablename materialname in ( 'a', 'b' ) group materialname

vmware - Connect to teradata dabase from host running on virtual machine -

i have installed teradata express vmware (linux). able connect database using bteq , sql assistant located inside vm. need install informatica in host windows , access teradata database in linux vm. is possible? please me on how that? i running same in vmware , have done. install sqla on host , configure vm guest use bridged networking. in host machine open sqla , try connect hyperjcop1. should work , should connect guest td express instance. can install informatica , configure connection in other informatica instance. that needed do, hope helps out. if doesn't work described try adding entry hosts file on host machine rob paller mentions. if fails come , post errors or more detail have tried.

javascript - AngularJS: Set private service variable in callback -

i'm trying this: app.service('productsservice', ['$http', productsservice]); function productsservice($http){ return { getproducts: getproducts } var _products = []; function getproducts(){ $http.get('http://localhost:4000') .then(function(data){ _products = data; }); } } but @ then callback _products undefined variable. what correct way set _products value callback? you need set variable before return statement. app.service('productsservice', ['$http', productsservice]); function productsservice($http){ var _products = []; return { getproducts: getproducts } //var _products = []; never run function getproducts(){ $http.get('http://localhost:4000') .then(function(data){ _products = data; }); } }

css - .class + .class doesn't work -

i'm trying figure out how use .class + .class feature in css , cannot figure out how make work. i'm trying to when .reglink classes next each other adds margin of 50px between them. doing wrong? here's jsfiddle: http://jsfiddle.net/rtohocql/ html <a href="#" class="reglink">register</a> <a href="#" class="reglink">login</a> css .reglink + .reglink { margin-right: 50px; } because .reglink + .reglink selecting second a tag, so change margin-right margin-left .reglink + .reglink { margin-left: 50px; } jsfiddle http://jsfiddle.net/rtohocql/2/ about css + can read post http://www.w3.org/....

jquery - How to combine datatable search box and tableTools buttons in one row -

Image
i using datatable tabletools multiple rows selection (select/deselect all) using below example. http://datatables.net/release-datatables/extensions/tabletools/examples/select_multi.html i want combine search box , select/deselect buttons in 1 row only. select/deselect in 1 row , search box in down , consuming 2 rows, want optimize space in single row. this how looks currently: <div class="dttt_container" id="chuji1" ><a class="dttt_button dttt_button_text" id="tooltables_example_0" tabindex="0" aria-controls="example"><span>select all</span></a><a class="dttt_button dttt_button_text dttt_disabled" id="tooltables_example_1" tabindex="0" aria-controls="example"><span>deselect all</span></a></div> <div id="example_filter" class="datatables_filter"><label>search:<input type=&q

Exception java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable -

hi getting exception while working support lib. know lot of question , answer available in no 1 work me 11-27 11:58:15.470: e/androidruntime(19609): fatal exception: main 11-27 11:58:15.470: e/androidruntime(19609): java.lang.noclassdeffounderror: android.support.v7.appcompat.r$styleable 11-27 11:58:15.470: e/androidruntime(19609): @ android.support.v7.app.actionbaractivitydelegate.oncreate(actionbaractivitydelegate.java:147) 11-27 11:58:15.470: e/androidruntime(19609): @ android.support.v7.app.actionbaractivitydelegatebase.oncreate(actionbaractivitydelegatebase.java:138) 11-27 11:58:15.470: e/androidruntime(19609): @ android.support.v7.app.actionbaractivity.oncreate(actionbaractivity.java:123) 11-27 11:58:15.470: e/androidruntime(19609): @ com.devicemonitor.devicemonitoractivity.oncreate(devicemonitoractivity.java:29) 11-27 11:58:15.470: e/androidruntime(19609): @ android.app.activity.performcreate(activity.java:5104) 11-27 11:58:15.470: e/androidruntime(19609):

xml - Why is xmlns:android="http://schemas.android.com/apk/res/android" appearing grey and selector shown as an error suddenly? -

http://schemas.android.com/apk/res/android&quot; appearing grey , select error."> why so? happening when tried add new xml file in drawable.the xmlns:android="http://schemas.android.com/apk/res/android" appearing grey , select error. this error happening everywhere, xmlns uri not registered , etc. errors appearing, checked answers , suggestions didn't work i using appcompat 7 21.0.2, android studio release candidate 1. happening , can't go away http://i.stack.imgur.com/rmxc7.png

How to use a Poller with a timer to kick off SSIS package -

i have sequence container sequence of execute package jobs. want jobs execute every 10min. there way insert poller executes sequence container every 10min? a clean solution schedule task inside of sql server agent run every 10 minutes. if not have option, can add script task poll every x seconds, not ideal depending on scenario, may useful make-an-ssis-package-delay-or-wait-for-data

How to use checklistbox in angularjs or in bootstrap -

can suggest me how can display checkbox list in angularjs html: <div ng-app="app"> <div ng-controller="todoctrl"> <span ng-repeat="(checkboxname, checkboxvalue) in checkboxes"> {{ checkboxname }} <input type="checkbox" ng-model="checkboxvalue"/> </span> </div> </div> javascript: var app = angular.module('app', []); app.controller('todoctrl', function($scope) { $scope.checkboxes = { 'foo': true, 'bar': false, 'baz': true, 'baa': true } }); update: html: <div ng-app="app"> <div ng-controller="todoctrl"> <!--<span ng-repeat="(checkboxname, checkboxvalue) in checkboxes"> {{ checkboxname }} <input type="checkbox" ng-model="checkboxvalue&

hyperlink - How to expand or embed the contents of a URL in Microsoft Word? -

i need create word document includes information have on web page. ideally, want prevent duplicating information, put url of web page, , have word "expand" url actual text web page. if word file opened offline, reader sees contents of web page when word file created. if word file opened online, attempt update contents on web page. sure possible, think you'd need write , install vsto addin (or possibly macro) it.

.net - Telerik submenu in radmenu cutoff from screen -

Image
i have telerik rad menu on aspx page. menu bind dynamically starting right left. but if have 1 parent menu submenus start cutting off screen, problem no longer persists if have more 1 parent menu(in case telerik classes handle automatically). didn't use custom class on it. i have attached screenshots of error menu , expected menu. here rad menu code in aspx page: <telerik:radmenu runat="server" id="rdmnmainmenu" enableautoscroll="true" enablerootitemscroll="true" enableroundedcorners="true" enableshadows="true" enableoverlay="true" onitemcreated="rdmnmainmenu_itemcreated" skin="default" autoskinmode="false" onclientitemclicked="mnumain_clicked" onclientitemclosed="mnumain_closed" width="100%" onclientmouseout="mnumain_mouseout" onclientmouseover="mnumain_mouseover" clientkey="mnumain_app" >

hadoop - How to get spark job status from program? -

i aware hadoop rest api provides access job status via program. similarly there way spark job status in program? it not similar rest api, can track status of jobs inside application registering sparklistener sparkcontext.addsparklistener . goes this: sc.addsparklistener(new sparklistener { override def onstagecompleted(event: sparklistenerstagecompleted) = { if (event.stageinfo.stageid == mystage) { println(s"stage $mystage done.") } } })

Draw column chart using grouped data in Highcharts -

i want draw column chart represent below mentioned kind of data structure. marks-range -> count (0-20) -> 8 (20-40) -> 15 (40-60) -> 20 (60-80) -> 7 (80-100) -> 4 but values have set of marks. (10,15,45,80....) it true that, type of chart can drawn in hi-charts grouping data manually. problem is, once can't draw plot line x axis. wonder there way draw providing grouping method 'sum' data grouping option in hi-stock charts. can't use hi-stock chart since x values not related data or time. help appreciated.

java - Executing commands using expect4j -

i'm using code example , execute commands in tcl shell . if @ main function down page , way of executing commands : sshclient ssh = new sshclient("linux_host", "root", "password"); list<string> cmdstoexecute = new arraylist<string>(); cmdstoexecute.add("ls"); cmdstoexecute.add("pwd"); cmdstoexecute.add("mkdir testdir"); string outputlog = ssh.execute(cmdstoexecute); in program i'm doing : sshclient ssh = new sshclient("linux_host", "root", "password"); list<string> cmdstoexecute = new arraylist<string>(); cmdstoexecute.add("bpsh"); // open tcl shell cmdstoexecute.add("set bps [bps::connect ... ]"); // tcl shell commands string outputlog = ssh.execute(cmdstoexecute); now problem can't execute commands arraylist without exiting tcl shell . meaning if run code : sshclient ssh = new sshclient("linux_host"

amazon s3 - Set content-encoding to specific files via aws command -

i deploy static application aws command. copy files folder s3 bucket command : aws s3 sync c:\app s3://mybucket i want set content-encoding gzip js,jpg,and html files. succeed folder command : --content-encoding gzip how can specific files type ? this old, needed find way this: i'm not using cloudfront, , proxy using doesn't handle gzip... so: exclude files include individual file types needed set appropriate encoding/options below i'm adding access control , cache-control, , deleting files in s3 not present in local directory i've separated js/css of images, html not necessary. i did have lot of trouble not explicitly setting content-encoding/cache each individual --include, i've set below make clearer. the aws docs find don't mention of stuff aws s3 sync ./dist/ s3://{bucket} \ --exclude "*" \ --include "static/*.ico" --acl "public-read" --cache-control no-cache \ --include "static/*.png&quo

ruby on rails - Devise 'remember me' to prevent login between sessions? -

(i've seen other questions here , , i've followed documentation here , still doesn't work) currently users have sign in every time close browser. want them kept logged in indefinitely. i tried using devise 'remember me' function, doesn't seem work. i see cookie created, called 'remember_user_token', doesn't seem have effect on login. all config.remember_for settings disabled what doing wrong? class authenticationscontroller < applicationcontroller include devise::controllers::rememberable def create omniauth = request.env["omniauth.auth"] authentication = omniauth['uid'].present? ? authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) : nil ... respond @user end def respond(user) user.remember_me = true sign_in user, event: :authentication remember_me(user) end ... end

algorithm - Create a mark function from a normal law -

i'm working on android application , @ point, retrieve value contained between -100 , 100 follow normal law (i don't have parameters of law). i create function returns me mark on 20 avoid have marks between 8 , 12, "stretch" values around 0. for example, variation of 1 around 0 give me 0.5 point of difference in mark, , 1 point variation around 100 give me 0.01 point of difference in mark. is there algorithm/function/trick gave me possibility ? conditions or requirement ? there library available give me possibility ? (i search didn't found...) thank !

java - Write a function when given one integer x ; returns e with the following approximation -

![enter image description here][1]the question: write function name ʻ expʼ ,when given 1 integer x; returns following approximation. in function, should use previous 2 functions calculate factorial , power. this code; import java.util.scanner; public class ass7_q3 { public static int power(int x, int y) { int result = 1; for(int = 1; <= y; i++) { result = result * x; } return result; } public static int factorial(int n) { int fact = 1; for(int = 1; i<= n; i++) fact = fact * i; return fact; } public static int exp( int x) { int result; result = (power(x,x) / factorial(x) ); return result; } public static void main(string[] args) { scanner read = new scanner(system.in); int sum = 0; int x; x = read.nextint(); for(int i=0; i<=10; i++) { sum = sum + exp(x);

ggplot2 - R ggplot barplot separately for each year -

Image
i know how barplot data separately each year. i'd add excel-image, couldn't cause i'm new in forum. have following data in data frame: year 2009/10 2010/11 2011/12 2012/13 2013/14 v1 -221.85 0.00 0.00 -138.73 -191.10 v2 0.00 -223.16 -231.52 0.00 -126.85 v3 0.00 -1216.17 -1337.28 -1112.11 -863.98 v4 0.00 -520.87 -540.88 -174.85 -296.78 v5 0.00 -465.48 -805.63 -252.38 -178.92 v6 0.00 -496.25 0.00 0.00 -232.17 v7 0.00 0.00 0.00 -709.63 -759.41 please me - have tried different approaches without success. many in advance steff not sure if looking for.. dat <- structure(list(var = structure(1:7, .label = c("v1", "v2", "v3", "v4", "v5", "v6", "v7"), class = "factor"), `2009` = c(-221.85, 0, 0, 0, 0,

android - Google glass app freezes once the app is invoked after the device goes to sleep mode -

the app consists of low frequency card updates latitude longitude , speed, on tap takes activity in image displayed. on tap of image, image processed , voice output given user. app works fine. after device enters sleep mode , app invoked again, low frequency live card doesn't update , on tap, image project folder not displayed.later app freezes device. why app not killed os? running xe 20.3 here log 11-27 14:44:43.576: e/gmsclient(936): unable connect service: com.google.android.gms.droidguard.service.start 11-27 14:44:44.474: e/voicetriggers(829): unable build voice trigger service resolveinfo{41e6c980 com.glob3mobile.glasses/.g3mglassesdemoservice m=0x108000}; com.google.android.glass.app.voicetriggerbuildingexception: custom voice triggers not allowed com.glob3mobile.glasses 11-27 14:44:44.553: e/gcoreflp(1196): bound fusedproviderservice locationmanager 11-27 14:44:55.857: e/gcoreflp(1196): bound fusedproviderservice locationmanager 11-27 14:45:05.138: e/windowmanager(4

php - Cant call multidimensional array -

i trying create cart system ajax , multidimensional session array. array stores product id , quantity of id. trying display quantity of 1 of these stored id's right value not returned. here php code public function create() { session_start(); $product_id = $_get['data']; // check if cart has been created if(isset($_session['cart']) , $_session['cart'] != null) { // 1 or more items have been placed in cart }else{ // cart empty $_session['cart'] = array(); $_session['cart'][$product_id] = array('quantity' => 3); } // return quantity of stored product id return $_session['cart'][$product_id]['quantity']; } as can see number 3 should returned. instead value 1.

php - Constructor vs static instance -

i new php , had work existing code base. in library there class deals mysql database. however, start instantiate object static getinstance function: public static function get_instance() { if(null == self::$instance) { $c = __class__; self::$instance = new $c(); } return self::$instance; } i don't see advantage of static function in comparison usual constructor. how have deal login credentials? have make them static, too?

java - Searching a linklist -

hello have project have read in file of voters name, age , party. list 100 names in length. search through file counting party's , returning winning party. ideas.this have far. public searchlist search(string party){ searchlist link = firstlink; if(!isempty()){ while(link.party != party){ for(int = 0; i<party.length(); i++) { if (party.equals(party.get(i).getparty())) return party.get(i).tostring(); } return null; } } return null; }

login - Symfony using AdvancedUserInterface -

i trying implement login system symfony2. implementing advanceduserinterface user entity, , keep getting following error when try log in. appreciated. error: $user must instanceof userinterface, object implementing __tostring method, or primitive string. user entity: <?php namespace flc\userbundle\entity; use doctrine\orm\mapping orm; use symfony\component\security\core\user\advanceduserinterface; use serializable; /** * user * * @orm\table(name="users") * @orm\entity(repositoryclass="flc\userbundle\entity\userrepository") */ class user implements advanceduserinterface, serializable { /** * @var integer * * @orm\column(name="userid", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $userid; /** * @var string * * @orm\column(name="useremail", type="string", length=50) */ private $useremail; /** * @var string * * @orm\column(name="username", type=&q

c# - How to inject a mocked dbcontext in a service layer of a .net application? -

i writing unit tests , having following problem: i supposed write tests service layer. service layer consists of different kind of services, of implement servicebase class. main idea of service base expressed in following logic protected void getcontext(action<datacontext> action) { getcontext(action, datacontextoptions.default); } protected void getcontextautosave(action<datacontext> action) { getcontext(action, datacontextoptions.autosave); } private static void getcontext(action<datacontext> action, datacontextoptions options) { using (var context = new datacontext(options)) { action(context); } } so whenever interaction db needed, following logic applied in services: getcontext(datacontext => { perform logic on datacontext; }); the datacontext class implements base class has constructor setting dbcontext . how application interacts db. unit testing part have decided go moq , pleased capabilities. able fake dbco

stress testing - Regular expression to find input value in scala -

i'm getting response below while making request <!-- template name: form.autopost.template.html --> <html> <head> <title>submit form</title> </head> <body onload="javascript:document.forms[0].submit()"> <noscript> <p> <strong>note:</strong> since browser not support javascript, must press resume button once proceed. </p> </noscript> <form method="post" action="https://myurl/"> <input type="hidden" name="myvar" value="t1rlaqkby"/> <noscript><input type="submit" value="resume"/></noscript> </form> </body> </html> how can value of myvar name using scala. can suggest me regex this. i'm done code below not

Catching multiple events from guava eventbus -

i catch multiple events in case run method several arguments. there possibility achieve without writing own dispatcher glue events together? no, eventbus directly dispatches events listeners. has no knowledge of how various events relate each other, how glue them, when stop, etc. you can in listener subcribed various needed events, though, guess that's call "writing own dispatcher". has write @ point.

How to redirect user to home page with his ID after authentication using Node.js and Passport? -

i have started learning node.js go easy on me :p i'm using passport autenticate user. user needs redirected home page id url parameter after successful authentication, example: /home?id=325346546 here part of routes.js // process login form app.post('/', passport.authenticate('local-login', { successredirect : '/home?id='+req.user._id, //error because 'req' isn't declared failureredirect : '/', failureflash : true })); this idea, want pass id parameter url. i have tried putting a function(req, res) { } but didn't work. appreciated. thanks ben got working, anwser own question here complete code: // process login form app.post('/', function(req, res, next) { passport.authenticate('local-login', {failureflash:true}, function(err, user, info) { if (err) { return next(err); } if (!user) { return res.redirect('/'); }

android - change delete application confirmation dialogue box 's message -

i have created app tasks , want unistall after doing task have lunched intent uri packageuri = uri.parse("package:pckage_name"); intent uninstallintent = new intent(intent.action_delete, packageuri); startactivity(uninstallintent); but want change default message of dialog box. possible ?

jquery - Upload Images to cloudinary directly from browser -

i'm new cloudinary , want upload multiple images directly cloudinary browser my code is: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="css/jquery.fileupload-noscript.css" rel="stylesheet" /> <link href="css/jquery.fileupload-ui-noscript.css" rel="stylesheet" /> <link href="css/jquery.fileupload-ui.css" rel="stylesheet" /> <link href="css/jquery.fileupload.css" rel="stylesheet" /> <title></title> <script src='http://code.jquery.com/jquery-1.11.1.min.js' type='text/javascript'></script> <script src='js/jquery.ui.widget.js' type='text/javascript'></script> <script src='js/jquery.iframe-transport.js' type='text/javascript'></script> <script src='js/jquery.fileupload.js' type=

javascript - jQuery carousel making responsive -

i have carousel not responsive , need make responsive not sure current carousel ive found online ive been using. can maybe me responsive? going images - many in advance http://codepen.io/anon/pen/rnpyqq html: <div id="slider"> <a href="#" class="control_next">></a> <a href="#" class="control_prev"><</a> <ul> <li><img src="http://placehold.it/1130x775"></li> <li><img src="http://placehold.it/1130x775"></li> <li><img src="http://placehold.it/1130x775"></li> <li><img src="http://placehold.it/1130x775"></li> </ul> </div> js: jquery(document).ready(function ($) { setinterval(function () { moveright(); }, 3000); var slidecount = $('#slider ul li').length; var slidewidth = $('#slider ul li').width(

c# - Load partial view after main view -

i have several partial views have been added main view on mvc site. 1 of partial views takes long time load however, can take while retrieve data it. possible load main view , start loading partial views, if view still loading display rest in meantime, final 1 showing once has finished? on similar note, while partial view loading (or being refreshed) how can kind of "loading" screen show on view area user knows happening? thanks try below codes $.ajax( { url: '/controller/action', data: { id: '1' }, //input parameters action beforesend: function () { $('#div-result').show(); var img = '<img src="../../images/loading.ico" />'; $('#div-result').html(img); }, success: function (data) { // $('#div-result') -> div in main view

gcc - Compilation error: Undefined reference to -

i'm working on c program getting events udev. program has been compiled , tested on host running debian (with gcc 4.7.2-5). recently, switched ubuntu 12.04 lts (with gcc 4.6.3). same program fails compile , halts during linking phase. automounter_main.c:(.text+0xd4e): undefined reference `udev_new' automounter_main.c:(.text+0xe02): undefined reference `udev_device_new_from_devnum' automounter_main.c:(.text+0xeb0): undefined reference `udev_device_new_from_syspath' automounter_main.c:(.text+0xf63): undefined reference `udev_device_get_sysattr_list_entry' automounter_main.c:(.text+0xf77): undefined reference `udev_list_entry_get_name' automounter_main.c:(.text+0xf85): undefined reference `udev_device_get_sysattr_value' automounter_main.c:(.text+0x100a): undefined reference `udev_device_get_sysattr_value' automounter_main.c:(.text+0x1055): undefined reference `udev_device_get_sysattr_value' automounter_main.c:(.text+0x1078): undefined referenc

excel - Header in Print Preview is different from workbook name -

i have excel workbook (e.g. test.xls). when print this, header on document should name of document. however , different header when print workbook. pls advise. thanks! if want have dynamic value in header or footer of sheets or specific sheet : you need macro updating values or texts in macro use code : public sub updateheaderfooter() ' update header sections activesheet.pagesetup.leftheader = "left header value" activesheet.pagesetup.centerheader = "center header value" activesheet.pagesetup.rightheader = "right header value" ' update footer sections activesheet.pagesetup.leftfooter = "left footer value" activesheet.pagesetup.centerfooter = "center footer value" activesheet.pagesetup.rightfooter = "right footer value" end sub above code change header , footer of current sheet, other sheets use sheet variable specify sheet.

Neo4j: Expres path cypher query result in terms of nodes -

i have following node structure emp[e_id, e_name, e_bossid] . more have recursive query exploit database in recursive traversal on self relation e_bossid-[reports_to]->e_id match (e:employee) not (e)-[:reports_to]->() set e:root; match path = (b:root)<-[:reports_to*]-(e:employee) return path limit 1000; however result path. have result in form of nodes not path. tried use nodes(path) , gives me error: org.codehaus.jackson.map.jsonmappingexception: reference node not available (through reference chain: java.util.arraylist[0]->java.util.hashmap["rel"]->java.util.hashmap["nodes(path)"]->java.util.arraylist[0]->org.neo4j.rest.graphdb.entity.restnode["restapi"]->org.neo4j.rest.graphdb.restapifacade["direct"]->org.neo4j.rest.graphdb.executingrestapi["referencenode"]) when query without nodes(path) seems return paths. how should done on ground of cypher query? i'm not sure why want possi

objective c - When do the iOS autolayout interface constraints get executed? -

in view there seems delay between viewdidappear being called , constraints of interface elements being executed. i have uilabel size changes according content. if check constraints in viewdidappear , they're empty. if wait 500ms (for example) , check again, constraints there expect them be. same goes bounds of uilabel , no use , then, once constraints have kicked in, they're set expect. my code: - (void) viewdidappear:(bool)animated { [super viewdidappear:animated]; // constraints , bounds nslog(@"description constraints %@", [descriptionlabel constraints]); nslog(@"description bounds %@", nsstringfromcgrect([descriptionlabel bounds])); // wait bit, constraints double delayinseconds = 0.5; dispatch_time_t poptime = dispatch_time(dispatch_time_now, (int64_t)(delayinseconds * nsec_per_sec)); dispatch_after(poptime, dispatch_get_main_queue(), ^(void) { nslog(@"description constraints b %@", [descri

.net - Insert in VB List -

i have vb code below - dim vals new list(of string)(7) vals.insert (0 , "a") vals.insert (1 , "b") vals.insert (2 , "c") vals.insert (5 , "e") 'here receive error index must within bounds of list. 'parameter name: index in requirement have , need insert values @ specific indexes random insert. belive if set capacity of list should able insert values @ index withing capacity. any idea missing? the (7) in constructor specifying "initial capacity" of list, not initialising 8 elements. see msdn details i think best option either: 1 - if "array" size not change (or not change often) use array instead dim vals string() = new string(7) {} 'dim vals(7) string works not best practise vals(0) = "a" vals(3) = "d" 'etc. 2 - initialise items in same line constructor dim vals new list(of string)(enumerable.repeat("", 8)) vals(0) = "a&quo

java - CDI event propagation to ViewAccessScoped/ConversationScoped classes with REST Service -

i have database layer, can accessed jsf , rest . backing beans jsf viewaccessscoped . services rest requestscoped . when creating entity, both jsf or rest, event should raised notify possible clients (jsf, other clients listening e.g. jms events). problem occurs. when create entity using rest interface event raised expected. however weld raises contextnotactiveexception: org.jboss.weld.context.contextnotactiveexception: weld-001303 no active contexts scope type org.apache.myfaces.extensions.cdi.core.api.scope.conversation.viewaccessscoped i same problem when using conversationscoped annotation. problem occurs when using rest interface, i.e. whether or not have jsf page open. below find more detailed stack trace starting point event fired.it seems weld thinks there such bean, in end can't context. caused by: org.jboss.weld.context.contextnotactiveexception: weld-001303 no active contexts scope type org.apache.myfaces.extensions.cdi.core.api.scope.conversation.convers

objective c - iOS: change view from viewDidAppear -

i'm playing around view life cycles & having trouble changing view load of different view. in viewcontroller.h have: -(void)viewdidappear:(bool)animated{ uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; viewcontroller2 *viewcontroller = (viewcontroller2 *)[storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller2"]; [self presentviewcontroller:viewcontroller animated:yes completion:nil]; } however causes view between viewcontroller, , viewcontroller2 appearing animation (in loop). i used code in viewdidload neither of view's loaded (from reading cannot change view until viewwillappear) update: when using code in viewwillappear , whose view not in window hierarchy error thrown. how 1 change view view setup stage? update using above code, inside & out of gcd, in viewdidload , viewwillappear & viewdidappear either results in infinite loop of animated showing of viewcontrol

mysql - Foreach query insert in multiple rows PHP not working? -

i googled , tested can not below php script insert mysql database. when run query directly in mysql management tool insert works. want insert query multiple rows in table task_in . i tested database/table connection , ok, can please explain why php script not insert data in database table task_in ? php script: <?php if(isset($_post['tasks'])) { $tasks = $_post['tasks']; foreach ($tasks $task_list_id) { $sql = mysql_query("insert task_in (task_list_id, customer_id, user_id, created_at) values ('$task_list_id', '1', '1', now())"); print_r($task_list_id); } } ?> part of form: <td><input type="checkbox" name="tasks[][task_list_id]" value=<?php echo($key[0]);?>></td> <td><input type="checkbox" name="tasks[][task_list_id]" value=<?php echo($key[1]);?>></td> </tr> <td>nav.rep for<

substr - How can I extract a substring from a string in Oracle, starting from a specific character? -

i need extract substring string in oracle. for example, need extract string "dha-f-0046789" "ra_pvac000275994.from.ins012.to.dha-f-0046789.file.1.2.xml" . i not want use position of characters extract substring because substring i'd extract may @ different positions in string. text wish extract may @ beginning of string. sometimes substring wish extract may in format "f-dha-sds89" rather "dha-f-0046789" . select substr ( &param, instr(&param,'to.',1)+3, instr(substr(&param,instr(&param,'to.',1)+3),'.',1)-1 ) dual;

docker - Jboss 5.1 in Dockerfile - how to reach the server in a browser -

i have dockerfile looks this: from ubuntu:trusty run debian_frontend=noninteractive apt-get -yq upgrade # update latest run echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list run echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list run apt-key adv --keyserver keyserver.ubuntu.com --recv-keys c2518248eea14886 run apt-get update run apt-get upgrade -y # install basics # run apt-get install -y python-software-properties software-properties-common unzip run apt-get install -y unzip # install java, auto-accepting license # run add-apt-repository -y ppa:webupd8team/java # run apt-get update # run echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections # run apt-get install -y oracle-java6-installer run echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-se

class - Getting value from database field and check if the same as variable in PHP? -

i usergroup database, , check if 2 (which mean admin). have code setup: login.php <?php //process login form if submitted if(isset($_post['submited'])){ $username = trim($_post['username']); $password = trim($_post['password']); if($user->login($username,$password)){ //logged in return index page $_session['login'] = "$username"; header('location: index.php'); exit; } else { $message = '<p class="error">wrong username or password</p>'; } }//end if submit if(isset($message)) { echo $message; } ?> <div class="lockscreen-credentials"> <form class="form-signin" role="form" method="post" action=""> <input type="text"

Php and MysQL JOIN tree table -

i have 1 question join php section . i know question have in stackoverflow.com solution not helped me. i using code join 2 table: <?php $select_posts = "select users.uid,users.user_name,user_uploads.uid_fk,user_uploads.image_path users join user_uploads on users.uid = user_uploads.uid_fk user_name='$user_name' order rand() limit 0,4"; $run_posts = mysql_query($select_posts); while($row=mysql_fetch_array($run_posts)) { $image_path=$row['image_path']; $uid_fk = $row['uid_fk']; ?> this code work want add table here. other table name is: message table inside have: msg_id uid_fk comment_count like_count how can add third table here? can me! just join third table join keyword in query. select table_users.uid,table_users.user_name,table_user_uploads.uid_fk,table_user_uploads.image_path, table_message.msg_id table_users join table_user_uploads on table_users.uid = table_user_uploa

workflow - Getting rid of REMIND and LATER resolutions in Bugzilla -

today, our team once again stumbled upon old bugs being resolved later or remind, , it's high we'll forget them again. both of these non-resolutions tend out of sight when mixed resolved bugs. mozilla team agreed on removing them [1] installation , many other projects have followed since. using later , remind merely source of confusion. so decided disable [2] them: administration > field values > resolution for both values: unchecked property enabled bugs but they don't disappear user interface bugs. broken, have delete values instead? doing wrong? [1] discussion has held in 35839 – remind , later considered harmful bugzilla.mozilla.org [2] deleting them seemed not appropriate due existing bugs now (after having changed language german english asking here) tried again, , values aren't available more. suffered caching effect.

User with the highest amount per month for the last 12 months mysql -

i have table: create table `like` ( `id` int(10) not null auto_increment, `like` tinyint(1) not null default '0', `userid` int(10) not null, `dateline` int(10) not null, `to_userid` int(10) not null primary key (`id`), ) engine=innodb default charset=utf8; i have list last twelve months, showing to_userid highest sum of like, next month , year. edit: dateline stored unix time. can please?

javascript - Parse HTML string containing script tag and document.write -

i have below string. has nested document.write string statements. want add text contents of innermost script document. "document.write('<script>document.write(\"<script>document.write(\"hello world\");<\/script>\");<\/script>')" how can parse string hello world gets added in document. e.g. html output can below.(can in body or div, ok.) <body>hello world</body> p.s. there can number of nested document.write statements. need parse string can handle n level of nesting. well figured out now. var str = "document.write('<script>document.write(\"<script>document.write(\"hello world\");<\/script>\");<\/script>')"; var astr, scriptele = document.createelement('script'); astr = str.replace(/["']/g, '"'); astr = astr.replace(/"<script>document.write/g, ""); astr = ast

Railstutorial git branch edit: how do I "fill" the contents of README.md with the contents of Listing 1.13? -

working railtutorial.org on section "1.4.4 branch, edit, commit, merge", using cloud9's online ide, made new git branch instructed, , renamed readme.rdoc readme.md in shell. tutorial explains should "fill readme.md contents of listing 1.13" normally, navigate readme.md in file navigator, open file, replace contents of file contents of listing 1.13, press ctrl+s save, , continue. however, since new git, want make sure changes i'm making file made appropriate way. am supposed edit file way did (finding in navigator window, open, edit, save) or supposed change contents using unix shell? i not while making changes, , unix shell output concerned me because different railstutorial, below, specifically, deletions. my output: 2 files changed, 5 insertions(+), 28 deletions(-) create mode 100644 readme.md delete mode 100644 readme.rdoc railstutorial output: $ git commit -a -m "improve readme file" 2 files changed, 5 insertions(+), 243 de

sql - Data Type Money C# -

someone please me don't know why! when insert value example 3469,2 sql server database, 34692,0000 the column of type money , value type double // code public void updateligne_facture(string ref, int qte,string reffacture,float prixvente,int tva) { sqlconnection con = new sqlconnection(); con.connectionstring = @"data source=akram-pc\sqlexpress;initial catalog=mm_database;integrated security=true"; con.open(); double prix = qte * prixvente; double prix_ttc = prix * (1 + (tva/ 100d)); string requete = "update lc set lc.quantite='" + qte + "',lc.prix_ht='"+prix+"',lc.prix_ttc='"+prix_ttc+"' lignes_facture lc join mm_article art on lc.id_article=art.id join mm_facture f on lc.id_facture=f.id art.ar_ref='" + ref + "' , f.ref='" + reffacture + "'"; sqlcommand command = new sqlcommand(requete, con);

google app engine - Error with rendering webapp2 -

good personal day. have problem can not solve. it happens in app creating have 3 files: main, config , home.html the config file used grab user data , adds them dictionary. if user not exist in datastore, adds. #!/usr/bin/env python # -*- coding: utf-8 -*- google.appengine.api.app_identity import get_default_version_hostname google.appengine.ext import ndb url = get_default_version_hostname() # banco de dados para salvar os usuarios class usuarios(ndb.model): usuario = ndb.stringproperty() email = ndb.stringproperty() openid = ndb.stringproperty() date = ndb.datetimeproperty(auto_now_add=true) tipo = ndb.stringproperty() @classmethod def get_email(cls, email): return cls.query(cls.email == email) ########### funÇÃo que chama o login ######## def redir(): google.appengine.api import users user = users.get_current_user() if users.is_current_user_admin(): redir = 'http://' + url + '/admin' else:

c# - Embedded resource txt file is not updating -

i have project .txt file in folder. .txt file set embedded resource. i use code read it: var assembly = assembly.getexecutingassembly(); var manifestresources = assembly.getmanifestresourcenames(); string s = manifestresources.single(c => c.endswith("cats.txt")); which works great. however updated cats.txt , noticed project didn't update. i deleted cats.txt , found still working fine , reading file. i tried cleaning solution, rebuilding, , iisreset, seems insist file still there in assembly despite me removing it. any ideas? okay fixed restarting visual studio. have no idea how affected it. when inspected properties of 'assembly', codebase attribute pointing older copy of dll in different folder, somewhere else on hard disk, had open in visual studio window. i have no idea underlying mechanism caused happen, had correct version of solution open , debugging it. closing solution , opening again fixed it. chalk 1 bizarro caching b

ios - How to correctly propagate delete from main thread's NSManagedObjectContext to child context on a background thread? -

i'm trying figure out how solve following situation there's main thread nsmanagedobjectcontext nsmainqueueconcurrencytype . spawns several background threads giving them nsmanagedobjectid of object work on. background threads perform work (e.g. send object data server, receive response , update object accordingly). threads use child contexts nsconfinenmentconcurrencytype meanwhile user deletes object main thread's context (via ui). background contexts should notified , handle situation prevent 'cannot fulfil fault' exception on background context save. i thought main context (some custom object manages it) keep record of object ids deleted during background thread lifetime (or, more precisely, between creating background context , final save of background context). background context have perform deleteobject: on these objects before saves. , go smoothly. in order sure main context not manage delete object when background thread finished deleting o