Posts

Showing posts from January, 2014

java - Hibernate AttributeOverride is not working -

i have child class overrides getter (because adds different behavior) of super class. using @attributeoverride it's throws error org.hibernate.mappingexception: duplicate property mapping of name found in com.hbmap.domain.product too. i not sure if doing wrong. product: @entity @table(name = "product") @access(accesstype.property) @attributeoverride(name = "name", column = @column(name = "name") ) public class product extends properties { private long id; @id @column(name = "id") @generatedvalue(strategy = generationtype.auto) public long getid() { return id; } public void setid(long id) { this.id = id; } @override public string getname() { // different superclass return super.getname(); } } properties (super class): @mappedsuperclass @access(accesstype.property) public class properties { private string name; @column(name="name") public string getname() { return nam

javascript - Prevent method from returning 'undefined' -

i'm new callbacks , trying working. don't want getcustomeriddescription returning popover until post has returned data, error on 'callback(supplierid)' line @ bottom says 'callback not function' how write callback nothing gets returned getcustomeriddescription until have post data? here code scope.showcustomeridlist = function(value) { $('#{0}'.format(value)).popover({ html: true, container: 'body', content: function() { return scope.getcustomeriddescription(value); }, title: function() { return 'customer id - description'; } }).popover('show'); }; scope.getcustomeriddescription = function(supplierid, callback) { var model = {}; model.clientid = scope.contextclientid; model.supplierid = supplierid; $.post(scope.enumcontrollers.getcustomeridsforsupplier, model, function(response) { if (response.error == false) { var ids = json.parse(response.i

angularjs - Firebase (angular) facebook authWithRedirect not working correcting -

i have login facebook button using angularfire (ionic app) , using $authwithoauthredirect redirect facebook authentication page app. it works if have $onauth method inside of function calls facebook redirect authentication, if it's outside of function doesn't work. have form authenticating email , password , if $onauth inside facebook authentication method email , password login won't work correctly. here's controller that's using auth service initializing firebaseauth: /**** * login page controller * uses angularfires oauth facebook login ****/ angular.module('starter') //inject auth service loginservice.js .controller('logincontroller', ['$scope', '$state', 'auth', function($scope, $state, auth) { //userlogin scope variables: error, authdata $scope.userlogin = { error: null }; //login email password $scope.loginuser = function() { auth.$authwithpassword({ email: $scope.userlogin.email

c# - translate my code to a batch file for me -

i need write batch file run automatically @ particular time of day , got many solutions forums working fine in case need write sql query quite complex state c# code need run , need in sql query my c# code looking as: public void mark_absent() { int userid = 0, last_rec = last_record(); bool isapproved; cmd = new sqlcommand("select top(1) userid,isapproved tbluser ", conn); conn.open(); dr = cmd.executereader(); if (dr.read()) { userid = convert.toint32(dr["userid"].tostring()); isapproved = convert.toboolean(dr["isapproved"].tostring()); dr.close(); conn.close(); } else { dr.close(); conn.close(); } (int = userid; <= last_rec; i++) { cmd = new sqlcommand("select us

c++ - snprintf segmentation fault -

i trying understand char pointers in c. doing declaring char* pointer main , passing reference in function , modifying there. now, want print value of char in main, gives me segmentation fault. if print value in called function prints fine. also, when try snprintf on char pointer within main, again segmentation fault not in called function. i searched , try understand chars , pointers not able debug this. below code comments: #include<stdio.h> int main(void) { char *a; int ret; /* below line gives segmentation fault. */ // snprintf(a,10,"%s","hello"); /* below line prints '(null)'.ok */ printf("before function call: %s\n",a); ret = func(&a); /* below line prints count of characters returned func .ok */ printf("characters written : %d\n",ret); /* below line gives segmentation fault. */ printf("after function call: %s\n",a); return 1; } int func(char *b) {

git - Teamcity how to recreate foulder structure -

Image
i need hint of how recreate current folder structure on teamcity (and if it's possible or not). project folder - machine_app_1 - //repo1 - machine_app_2 - //repo2 - common_code - //repo3 - ...various common files... so, have folder 3 repositories inside , sparse files inside it. need recreate structure since machine_app code needs common code build (and builder between "various common files", need them too). should use artifacts? , should place them? or should edit checkout folder? should put files directly.. where? i'm bit confused of way of working of teamcity , cannot make work. i've tried creating shell script reorders files it's mess way, because foulder structure not easy , keep having lot of locking problems. thanks :) as trying place source code files in correct folder structure rather compiled binaries correct answer use checkout rules vcs checkout roots rather artifacts. to achieve attach vcs root each of 3 repositories bui

rest - Moodle api list all cohorts -

im looking cohorts, can info if have id want cohorts names , ids. please let me know if theres way this. in advance $functionname = 'core_cohort_get_cohorts'; $cohortids = array( '1' ); $data_string = http_build_query(array('cohortids' => $cohortids)); $utoken = 'mytoken'; $adduser = 'yoururl/webservice/rest/server.php? wstoken='.$utoken.'&wsfunction='.$functionname.'&moodlewsrestformat=json'; $ch = curl_init(); curl_setopt($ch, curlopt_url,$adduser); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($ch, curlopt_returntransfer, true); $server_output = curl_exec ($ch); curl_close ($ch); echo '<pre>'; print_r(json_decode($server_output)); echo '</pre>'; you add more method core_cohort cohort following: in cohort/externallib.php, add more method: public static function get_all_cohorts(){ global $db; $c

Cassandra Connection Refuse -

i have cluster's casssandra can't login jmx on 7199. know must have enabled remove access. it? when connect through jconsole refuses connect. thank help cassandra jmx listens localhost security reasons. if wish open remote connections, read https://wiki.apache.org/cassandra/jmxsecurity details on how properly. configurations setting jmx in conf/cassandra-env.sh .

ActionBarActivity cannot be resolved on android studio 1.2.1.1 -

im unable extend actionbaractivity i've tried these possible solutions : import actionbar import android.support.v7.app.actionbar; changed app theme light material light tried changing app theme on manifest file theme.appcompat.light installed repository , library directory in sdk manager. ive updated . error the class actionbaractivity depreciated. use appcompatactivity instead. click here further info.

javascript - ReactJS and Flux handleButtonClick -

i want implement button rerenders on click, button, instead whole view rerenders , think way im thinking components i have structure this <app> <allemployees> <employeebutton/> <allemployees> </app> where on employee button click assign employee boss, employee owned etc. on button click send post request api , updates api. end fine, when comes front-end flux logic want make button rerendered on click. for example have api gives me employees , stores listen change in array allemployees [ ]. if employee owned want button red, , 'remove user', if isn't blue , should 'assign user'. can't work without rerendering table in front end(which allemployees array populated table). want front end able tell if user owned employee on page load well. my approach when action dispatched , api completed, dispatch data, , check if employees owned, checking if users in data belong current logged users "owns : []" array, if s

sql server - Insert date string to datetime2 in TSQL insert -

i need insert date string datetime2 in queue table in microsoft sql server. db structure: create table "queue" ( id int primary key not null, teamid varchar(550) , status varchar(50) , msg varchar(50) , time datetime2, error varchar(10) , ); insert queue values(2,'c33','ok','foundid',convert('tue sep 09 12:18:52 2014' datetime2),'ok'); the value 'tue sep 09 12:18:52 2014' should converted datetime2 format 2014-09-09 12:18:52.000000 , should inserted. i tried cast , covert fails. as pointed out syntax convert little off. syntax should below: select convert(datetime,'sep 09 12:18:52 2014')

javascript - Search for word and highlight with jquery -

i have written javascript file in jquery provides search function. trying figure out how highlight word aswell. bellow code. filter.js: (function ($) { // custom css expression case-insensitive contains() jquery.expr[":"].contains = jquery.expr.createpseudo(function(arg) { return function( elem ) { return jquery(elem).text().touppercase().indexof(arg.touppercase()) >= 0; }; }); function listfilter(header, list, title) { // header element, list unordered list, title element // create , add filter form header // create button collapse/expand title var form = $("<form>").attr({"class":"filterform","action":"#"}), button = $("<input>").attr({"class":"rest", "type":"submit", "value":"collapse all", "id":"switch"}), input = $("<input>").attr({"class":"

java - Animations not smooth on new devices -

i'm trying write simple animation of setting 1 imageview alpha 0 1 , other 1 0: alphaanimation animationoutside = new alphaanimation(1,0); alphaanimation animationinside = new alphaanimation(0,1); animationoutside.setduration(1000); animationinside.setduration(1000); animationinside.setfillafter(true); animationoutside.setfillafter(true); oldcharacter.startanimation(animationoutside); newcharacter.startanimation(animationinside); this looks great on samsung galaxy 1 reason on nexus 5 animation looks bad , looks it's missing lot of frames. i tried add android:hardwareaccelerated="true" any suggestions? thanks! i believe because of difference of manufacturer. animation (you can include audio , video) hardware dependent. normally, animation may not work "properly" on devices.

Table in Access Is Now Read Only -

Image
i'm restructuring database customer, in end have set column allow duplicates in "items" table , front end database saying data read only. starting simplest explanation. cell locked? access>your form>design view>form properties second simplest, switch combo box @ top of picture "form". check if of these field off.

HTML putting clickable image inside ordered list -

i got dank photo of fedora , want clicked on go youtube video, click box left border. html: <div id="left_background" > <ul> <a href="https://youtu.be/t99j7bw9ewo?t=64"> <img id = "fedora" src ="https://img.4plebs.org/boards/pol/image/1385/75/1385757943224.jpg" style = "width: 230px";/> </a> </ul> </div> css: #left_background { background-color: black; height:100%; width: 250px; float: left; overflow: visible; right: auto !important; position: fixed ; left: -20px; max-width: 250px; z-index: -10; } edit: formatting fixed have tried floating 'a' in css covers whole of image?

swift - how to retain the value of the last iteration on a sequence in for-in -

var index: int=0 index in 1...3{ print(index) } print(index)//prints 0 if run code, last print gives 0, means index inside for-in not same outside. seems force declares new constant. looking similar way retain last value in sequence i know can var index_out: int=0 index in 1...3{ print(index) index_out = index } print(index_out) if you're gonna loop through , want know end index use amount of times looped through it: let n = 3 index in 1...n{ print(index) } print(n) or array: let array = [int](count: 10, repeatedvalue: 2) index in 0..<array.count { print(index) } print(array.count)

c - Identifying global variable assignments -

is there way locate functions assign specific global variable ? for example, in 1 .c file globals : int x; i know functions variable x being assigned in: void temp(void) { x = 1; } here x assigned in function temp .

javascript - Search engine crawler behavior regarding DOM ready state, page loaded state and script execution state -

i have website heavy jquery action. in order create less chaotic page load hide() content container on initial page load , show() when page has loaded: $(window).load(function() { //show content... this sequence right now, works in browser human eyes: hide content on initial page load. wait until page has loaded. show content. do jquery action. but wonder how works crawlers. crawler wait "page->loaded" , "scripts->finished"? if not, crawl result may become messy.. first, hidden content down-weighted in ranking, content might not perform you'd like. want make absolutely sure search engines see finished, not-hidden-any-more content. you can @ (google) "see" using fetch , render google in search console (former webmaster tools); read more feature in our post titled rendering pages fetch google . if rendered image looks right, you're go.

permissions - php 5.5 can read and write but wont execute -

so have executable i'm trying run on desktop. gave proper permissions user read write , execute. php can write file , read file, wont execute .exe. here's found in research safe_mode set on in case have configure safe_mode_exec_dir the parent directory blocking php executing .exe the path incorrect in php 5.5 there no safe_mode, looked in php.ini sure. if can read , write directory have correct path, , wouldn't blocking php accessing either. weird thing got work before in same directory setting had have gotten changed somewhere. there other common problems why php can read , write not execute .exe? line of code i'm using is: exec("c:\users\myname\desktop\folder\myexecutablename.exe");

how to use python scripts or (.py files) in mininet? -

i new mininet , python. want execute python script in mininet, don't know how can run python scripts in mininet , store .py files in order call mininet. any idea please? here how it. copy , paste bellow code or download file: simple_pkt_topo.py . __author__ = 'ehsan' mininet.node import cpulimitedhost mininet.topo import topo mininet.net import mininet mininet.log import setloglevel, info mininet.node import remotecontroller mininet.cli import cli """ instructions run topo: 1. go directory fil is. 2. run: sudo -e python simple_pkt_topo.py.py topo has 4 switches , 4 hosts. connected in star shape. """ class simplepktswitch(topo): """simple topology example.""" def __init__(self, **opts): """create custom topo.""" # initialize topology # uses constructor topo cloass super(simplepktswitch, self).__init__(**opts)

Python Selenium return HTML location -

i have simple html table consisting of tr/td. need return exact table row , table column number of exact record. solution should able handle number of rows/columns. find item use: webdriver.find_element_by_xpath("//*[contains(text(), '8')]") now need return it's location, far i've been looking attributes value_of_css_property / getcssvalue etc. i'm new selenium, appreciated. if need locate row containing td element containing specific text: element = webdriver.find_element_by_xpath("//tr[contains(td, '8')]") or, if need locate specific cell ( td element): element = webdriver.find_element_by_xpath("//td[contains(., '8')]") then, can location : print(element.location) this give coordinates of element on page. if need row , column number of cell containing desired text: table = webdriver.find_element_by_id("mytable") rows = table.find_elements_by_tag_name("tr") ro

image - make a SpriteNode "jump" sprite kit iOS -

i programming small game. i've made character moving tilting phone. i'd character ( image spritenode ) jump, when touch screen. still want him move left , right when tilt phone while jumping. best way it? thinking making physicsworld , give him mass , activate gravity. but how let him jump once when touch screen? i'd happy answers. thanks. the question is: do need physics ? it depends on want game physic makes game more realistic, need? does ground has slopes? is there caves or several floors? can pass through floors while jumping up? ( doodle jump style ) your character have velocity associated, vector x , y speed. velocity applied each frame of game loop. simulate gravity, remove small amount of y velocity, begin fall down progressively, faster , faster. if want make character jump, apply relatively high amount of y velocity. you may want subclass sknode add velocity property, can know , apply position in game loop, think apply existin

ios - How to detect same types of nodes touching each other consecutively (SpriteKit) -

actually rather algorithm , implementation problem. i have array of nodes, these nodes have 3 types. distinctive speciality color. i want detect if couple of same nodes touching consecutively create joint or it. for example lets assume have bunch of balls in array can 3 colors red, blue, green. want find joints has 5 elements. i tried recursive way of iterating through array. works doesn't. think way i'm doing has flaws. - (void) findadjacentnode:(ballspritenode*) currentnode from:(nsmutablearray*)currentnodes{ (ballspritenode *node in currentnodes) { float distance = [self getdistancebetween:node.position and:currentnode.position]; if ( distance - (node.size.width/2 + currentnode.size.width/2 ) <= 0 && [node.currentcolor isequal:((ballspritenode*)currentnode).currentcolor] && ![node isequal:currentnode] && ![samecolornodes containsobject:node]) { [samecolornod

css - HTML image link has a small blue tic mark below it -

i have tag image inside of , reason tag looks extends below image , causing little blue tic mark on bottom right side. i've tried setting border none , few other css solutions nothing seems working. appreciate can give. here link test page. header_test . there couple of options. first of which, reason why see border because a tag overflowing space between images... can eliminate spaces so: <a href="http://hornethq.lynchburg.edu/"><img class="announcement" src="../resources/images/headers/20150723announcement.png"></a> <a href="http://hornethq.lynchburg.edu/"><img class="announcement" src="../resources/images/headers/20150723announcement.png"></a> <a href="http://hornethq.lynchburg.edu/"><img class="announcement" src="../resources/images/headers/20150723announcement.png"></a> alternatively, change css a tags to: a { dis

ruby on rails - RSpec: How to test methods that use Parallel (PG::ConnectionBad error) -

in app have several builder classes responsible taking data received external api request , building/saving resources database. i'm dealing large amount of data , have implemented parallel gem speed using multiple processes. however, i'm finding test method uses parallel fails same error: activerecord::statementinvalid: pg::connectionbad: pqconsumeinput() server closed connection unexpectedly means server terminated abnormally before or while processing request. here example of code being tested: class airportbuilder < resource def build_from_collection parallel.each(object_producer, in_processes: 24) |params| instance = airport.find_or_initialize_by(fsid: params[:fs]) build!(instance, params) end end end i've done searching on results in google have using multiple threads/processes make test suite run faster, different problem. any ideas on how can test without causing pg error? realize may need stub out not quite sure

c++ - Thread safe operator<< -

i have quite complicated problem logger class. singleton pattern logging class. thread created taking out items queue , logging them. works fine , error occurs segmentation fault. happening more before decided put mutex on whole method chain. mutex dont understand why segmentation fault occuring. class got quite complicated because of operator<< usage. problem operator template run many times, many items passed using << . because of other threads can cut in between templete calls. the general usage looks this: 1. instance method called (creating or pointing instance pointer (singleton). mutex locked @ moment. 2. called methods called, example operator<< template. 3. finishing method called, placing log in queue , unlocking mutex. i have edited code , tried take fata gathering out of singleton class proxy class. main.c: #include <iostream> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "clogger.h" #i

Why we can't assign to static parametrized array VBA? -

why can't assign values range static array : sub test() 'error occours dim a(1 10) double 'also don't work : 'dim a(1 10, t 1) double = range("a1:a10") end sub because array has been allocated, regardless of how many dimensions use. dim x(1 10, 1 1) variant '// you've allocated array x = range("a1:a10").value '// can't allocate allocated array you can declare array of type variant without allocating , use instead: dim x() variant '// array not allocated x = range("a1:a10") '// x = array sized 1 10, 1 1 assigning range directly array in way return type variant/variant , receiving array must of type variant also. you create udf you, kind of defies point of assigning directly range: sub so() dim variant = rangetoarray(range("a1:a10")) end sub function rangetoarray(rng range) variant redim x(1 rng.rows.count, 1 rng.columns.count) variant dim

How to parallelize an azure worker role? -

i have got worker role running in azure. this worker processes queue in there large number of integers. each integer have processings quite long (from 1 second 10 minutes according integer). as quite time consuming, these processings in parallel. unfortunately, parallelization seems not efficient when test queue of 400 integers. here implementation : public class workerrole : roleentrypoint { private readonly cancellationtokensource cancellationtokensource = new cancellationtokensource(); private readonly manualresetevent runcompleteevent = new manualresetevent(false); private readonly manager _manager = manager.instance; private static readonly logmanager logger = logmanager.instance; public override void run() { logger.info("worker running"); try { this.runasync(this.cancellationtokensource.token).wait(); } catch (exception e) { logger.erro

dynamics crm 2011 - CRM Unmanaged Sln Deployment Behaviour -

Image
sofar know deploying unmanaged solution should wipe & replace included forms, isn’t behaviour i’m seeing , i’ve been suspicious of msdn docs time now. i’ve attached form xml, ripped directly (unmanaged) solution defines 10 fields in "product interest" section. after import can see in customisations section 13 fields remain, yet seems of form changes have been applied (e.g. change of checkbox radio button field display) , schema changes have applied (new fields, mappings, translations, etc..) the import log file indicate imported , overwritten have maybe-relevant tid-bits share you. customisations owned 3 different publishers import not performed in root business unit 100% of existing customisations on unmanaged layer i performing customisations manually, i’d understand behaviour though can tell changes won’t have applied , plan how can work around issue in future. though in instance i'm working crm 2011 ur18 client system, i'd know if behaviour incon

Reactivate PayPal profile after status expired -

we implementing recurring payment profile in asp.net. using merchant account payment process. please advice resolve below mentioned scenario: we have perform recurring payment process monthly , per 6 months. have started recurring payment 6 month package. below parameters recurring payment listed: billing cycle :- 6 billing period :- month billing frequency :- 1. so per above parameter recurring payment done on: 1st payment : 23-07-2015 2nd payment : 23-08-2015 3rd payment : 23-09-2015 4th payment : 23-10-2015 5th payment : 23-11-2015 6th payment : 23-12-2015 after 6 month payment, want continue recurring payment 6 month package. issue that, after 6 month payment, total billing cycle 0 , profile status become expired. can't renew package next 6 month. , cannot reactivate profile status expired. when trying update profile after 6 month payment, response paypal "profile not active". as have update profile active instead of "expired", have tried mu

php - How to catch exception in controller in Laravel? -

in controller need test custom database connection , if it's bad return error. problem catch block doesn't work... exception message globally defined in app/start/global.php . try { db::connection('test'); } catch (exception $e) { dd('error'); } laravel handles exceptions, no need try/catch. can write custom exception inside \app\exceptions , customise contents of app\exceptions\handler.php format response of individual exception meet needs.

java - ClassNotFoundException: javax.speech.EngineModeDesc -

the following code i'm writing implement text speech in java using freetts , mbrola. i have added jars of freetts classpath. import java.applet.*; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.speech.central; import javax.speech.enginelist; import javax.speech.enginecreate; import javax.speech.synthesis.synthesizermodedesc; import javax.speech.synthesis.synthesizer; import javax.speech.synthesis.voice; import com.sun.speech.freetts.jsapi.freettsenginecentral; import java.util.locale; import java.awt.event; public class voisedemo extends applet implements actionlistener { public synthesizer synth; private static voice kevinhq; textfield t1; public void init() { button b1 = new button("press me"); add(b1); b1.addactionlistener(this); t1 = new textfield(50); add(t1); } public void start() { } public void actionperformed(actionevent e) { // synthesizer.speakplaintext(“hello, world!”, nul

php - Failing prepared statement. Not getting string -

i getting following error line of code... warning: mysqli::query() expects parameter 1 string, object given for if ($result2 = $con->query($stmt2)) { and cannot figure out? connections correct, prepared statement above it. have tried moving stuff on page , read because mixing mysqli , mqsql, how doing sql? what causing error? try { $cid = $_get['cid']; $tid = $_get['tid']; $userid = ( isset( $_session['user'] ) ? $_session['user'] : "" ); echo $cid . "<br>"; echo $tid; //prepare if ($stmt = $con->prepare("select * forum_topics `category_id`=? , `id`=? limit 1")) { $stmt->bind_param("ii", $cid, $tid); $stmt->execute(); $stmt->bind_result($topic_id, $category_id, $topic_title, $topic_creator, $topic_last_user, $topic_date, $topic_reply_date, $topic_views); //var_dump($stmt); if (!$stmt) { throw new exception($con->error); } }

django - Jquery File upload: How to set Multiple File Upload Widgets? -

i'm using jquery file upload plugin django backend. worked until tried integrate multiple file upload widgets on same page . first problem first, i'm not sure i'm supposed change inspite of doc. here original main.js file mentioned in page. i'm not jquery expert , can't understand here precisely need change. i'd happy see example of main.js rewritten should be. second problem the whole purpose of having multiple widgets on 1 page me, display different elements. that's why, in backend, upload/view/ url became upload/view/(?p<pk>\d+)/ . for example, if in 1 page want displays 2 photos albums containing many photos, expect page call upload/view/1 , upload/view/2 the backend part works since calling there urls return correct json answer. but ajax part, don't know do. in main.js file, can see should changed, don't know how it: $.ajax({ // uncomment following send cross-domain cookies: //x