Posts

Showing posts from February, 2010

ios - tableView tag wrong after moveRowAtIndexPath method -

i have view 7 tableviews representing 7 days of week. each tableview initialized tag 0 6. made longpressure recognizer in cells access right tableview: - (ibaction)longpress:(uigesturerecognizer *)sender { self.clickedpoint = [sender locationinview:self.view]; // down subview user clicked uiview *clickedsubview = [self.view hittest:self.clickedpoint withevent:nil]; if( [clickedsubview.superview iskindofclass:[customcell class]] ) { // selected tableview uitableview *selectedtableview = (uitableview*)clickedsubview.superview.superview; nslog(@"selected tag: %d", selectedtableview.tag); } } when press cell tags shown correctly. problem when move row inside of tableview. when moverowatindexpath: in tableview , longpress, tag of tableview made moverow gets tag of last longpress of tableview. example: i moverow in table tag 2. longpress table tag 5. go longpress table of tag 2 time log tag = 5 (the 1 before). if longpres

css - Menu color change onclick -

i have menu similar ones in stackoverflow.com using dnn. how change color of selected menu? i have managed change color while hovering (using css), having trouble this. can achieve effect of changing color of clicked item using css? the (anchor) tag has :active state on click. try using trigger.

if statement - PHP check phone prefixes -

the code kinda big want avoid posting here. http://codepad.org/arzh7ya9 trying load bunch of numbers array. these numbers have prefixes whereever local, mobile or shared. $this->callarr contains numbers such 46703920293:402 or 4629304921:94 (number:duration of call). can see 4670 1 prefix , 46 another. may seem confusing @ first later local call , first mobile call. what doing: each number in callarr, first explode seperate number , duration. remove country code in case 46 grab first 2 numbers. 46703920293 magically turn 70 indicating mobile number. each number go through pricelist array $this->pricearr. pricearr have following structure number:price:type:oa. example: 4670:0.65:mobile:0.15 pricelist contain prefix. oa = opening costs call. on line 27 check if length of $number (which pricelist prefix) == 2. if it's 46 number local. if it's not remove 46(country code). issue @ line 41. can find mobile matches, free cost , shared. have issues grabbing lo

mysql - Get total number of rows from subquery? -

i have query like select row1, row2 ( select b.row21, count(b.row21) hits table2 b b.row22 = 'foo' or b.row22 = 'bar' group b.row21 having hits = 2 ) b inner join table1 on (b.row21 = a.row1) row2 = 123 limit 10 now clearly, result limited first additional where , limit . so how retrieve amount of rows returned subquery without needing execute seperately? you can in mysql using variables: select row1, row2, @rn numrows ( select b.row21, count(b.row21) hits, @rn := @rn + 1 table2 b cross join (select @rn := 0) const b.row22 = 'foo' or b.row22 = 'bar' group b.row21 having hits = 2 ) b inner join table1 on (b.row21 = a.row1) row2 = 123 limit 10; you run risk mysql could rewrite query in different way, might avoid generation of rows. sql compilers smart enough this. don't think mysql smart.

jquery - how to get a javascript date from a week number? -

how can date of first day of week week number , year, in javascript (or jquery)? example : week 30 , year 2013 thanks in advance ! var d = new date(year, 0, 1); var days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; d.setdate(d.getdate() + (week * 7)); console.log(days[d.getday()]); try this

Multiple Addresses for a FHIR resource Practitioner -

in resource definition of practitioner ( http://hl7.org/implement/standards/fhir/practitioner.htm ), 1 address can set. these problem managing physicians national identifier (rpps in france). physician can have several addresses, can work in public hospital , private organization in same time, instance. physicians have more 10 active addresses. how deal ? thanks in advance. if want have single resource, can use extensions send additional address repetitions (or other element need or don't have enough repetitions in core resource). premise allowing 1 reptition in "core" resource majority of systems support one, didn't want try forcing multiple repetitions. extensions, you're in no way limited cardinality indicated. in near future (though after publication of first dstu), we'll go through resources , identify elements maxoccurs=1 theoretically possible have more 1 , define standard extensions sending repetitions (just encounters common use

types - Is it possible to combine two or more different highstock charts into one? -

i combine 2 chart types one. instance have @ top candlestick ( http://www.highcharts.com/stock/demo/candlestick-and-volume ) , underneath column range ( http://www.highcharts.com/stock/demo/columnrange )? yes possible, take @ example: http://www.highcharts.com/stock/demo/candlestick-and-volume

c# - find and set the location of indicator in textBox -

i have program textbox when spacial input, need edit text. so did that, indicator returned beginning of text, not mmi. i wondering if there way edit text without changing indicator position, or there way set indicator position in textbox ? i've tried edit text in several ways, lead indicator getting start of text. i couldn't find way influence location of indicator i'm guessing that's impossible, might wrong. please help. try setting selection. set cursor 5th position, select nothing: textbox1.select(5, 0); just make sure last thing happens before returning control user. perhaps accompanied call focus if necessary. in case, you'd need keep track of position should be...prior added/modified text? after it? replace 5 number.

C# WPF Binding to DataBase -

Image
hei all. if not clear please tell i have datagrid , treeview. have loaded data base entity data model , tables. 1 of these tables "relation" should show datagrid. (relation table) column depend of other tables system,model,function , device. in data grid should 4 columns contain names of these system,model,function , device. (the picture 1 should be) problem in how show. datasource don't work well... see picture 2. <grid datacontext="{staticresource relationsviewsource}"> <datagrid autogeneratecolumns="true" name="gridinventory" horizontalcontentalignment="right" margin="255,12,12,128" itemssource="{binding}" /> <stackpanel height="391" horizontalalignment="left" margin="10,10,0,0" name="stackpanel1" verticalalignment="top" width="239" datacontext="{staticresource systemsviewsource}" > &

Many-to-Many class relationship in UML diagram -

Image
what relationship of many-to-many in uml? example : if one-to-one relationship call composition one-to-many relationship call aggregation association? or? no. there (almost) no link between cardinality of association , aggregation kind (none, composite, aggregation). each association end has lower bound (minimum cardinality) upper bound (maximum cardinality) , aggregation kind. combinations impossible can have "one-to-one" association or without composition. edit : add examples all these associations valid. example association between myclass3 , myclass4 one-to-one , composite (end3). while, association between myclass11 , myclass12 ont-to-many , composite (end11). association between myclass , myclass2 *one-to-one" not composite. you can make copy of model here

Positioning an image a certain distance away from the side in android -

does know how position 2 android image @ point away side in android. have 3 images. 1 of them in center. other 2 meant located same distance either side of image. problem on smaller screen sizes 2 images appear @ different distances away central image. believe down natural scale of android layout. difficult move image small distance fix problem. have suggestions? create 3 imageview side side layout_weight="1" , width of "0dp" in linearlayout make them same width use padding/marging want , fit.

symfony - Gedmo multiple database connections not listening correctly -

when trying create entity @gedmo\timestampable(on="create") annotation, getting "sqlstate[23000]: integrity constraint violation: 1048 column 'created' cannot null" it doesn't work gedmo\slug. it works when using default entity manager, not when using master or creation. in config.yml have following configuration: stof_doctrine_extensions: default_locale: en translation_fallback: true orm: default: timestampable: true sluggable: true master: timestampable: true sluggable: true creation: timestampable: true sluggable: true in services.yml have following: gedmo.listener.timestampable: class: gedmo\timestampable\timestampablelistener tags: - { name: doctrine.event_subscriber, connection: default } - { name: doctrine.event_subscriber, connection: creation } - { name: doctrine.event_subscriber, connection:

How to reset filter programmatically on listview for Kendo Mobile? -

i have configured listview enable filtering. in event, how can reset filter? this have: $("#listview").kendomobilelistview({ datasource: datasource, template: $("#listview-template").text(), filterable: { field: "productname", operator: "startswith" } }); in function, how can reset filter listview shows again (in case typed search)? $("#listview").data("kendomobilelistview")...?? do: $("#listview").data("kendomobilelistview").datasource.filter({});

java - How to extract joda DateTime belonging to specific time range? -

suppose have collection of datetimes , how can filter datetime objects have time between 10h00m , 12h30m? for example: new datetime(2013,1,1,10,0) - right, new datetime(2013,1,1,16,0) - not. parameters month, year, day not significant. ideas? you can take advantage of joda's localtime class here : localtime lowerbound = new localtime(10, 0); localtime upperbound = new localtime(12, 30); list<datetime> filtered = new arraylist<>(); (datetime datetime : originals) { localtime localtime = new localtime(datetime); if (lowerbound.isbefore(localtime) && upperbound.isafter(localtime)) { filtered.add(datetime); } } you may need tweak inclusive or exclusive, localtime comparable , , on top of that, has friendly compare methods readability.

c++ - How to check if a point is inside a quad in perspective projection? -

i want test if given point in world on quad/plane? quad/plane can translated/rotated/scaled values still should able detect if given point on it. need location point should have been, if quad not applied rotation/scale/translation. for example, consider quad @ 0, 0, 0 size 100x100, rotated @ angle of 45 degrees along z axis. if mouse location in world @ ( x, y, 0, ), need know if point falls on quad in current transformation? if yes, need know if no transformations applied quad, point have been on it? code sample of great help a ray-casting approach simplest: use gluunproject() world-space direction of ray cast scene. ray's origin camera position. put ray object space transforming inverse of rectangle's transform. note need transform both ray's origin point , direction vector. compute intersection point between ray , xy plane standard ray-plane intersection test. check intersection point's x , y values within rectangle's bounds, if that's d

json - cakephp updated data with escaping quotes -

by using cakephp framework, have usual array structure follows; $myusualarray = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); when serialized using json_encode built in php function , update corresponding field using savefield function when check db, values follows; value in db; "{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}" during field update read id of current table , apply savefield function. using: cakephp 2.x any suggestions? the problem slashes in json. way handle using beforesave , afterfind callback methods in model encoding / decoding. in beforesave json_encode($array) . in afterfind preg_replace() clean slashes , json_decode() . handled cleanly in model , never have worry anywhere else.

c# - How to filter *.abc from *.abcd files when using OpenFileDialog? -

i have created openfiledialog object, called openfiledialog. when calling openfiledialog.showdialog want able select files having extension ".abc" , not ".abcd" . using property: this.openfiledialog.filter = "*.abc"; does not work. ".abcd" files can selected. here full code: var openfiledialog = getopenfiledialog("abc", "*.abc", "anything (*.abc)|*.abc", "select abc file import..."); if (openfiledialog.showdialog() == dialogresult.ok) { dojob(); } where getopenfiledialog is: private openfiledialog getopenfiledialog(string defaultext, string filename, string filter, string title) { return new openfiledialog { defaultext = defaultext, filename = filename, filter = filter, titl

.net - Should access to controls be limited to the MainWindow class in WPF? -

in other programming languages (namely java), have created window in 1 class, , had different classes return tabs add window, when parts of window needed updated, objects didn't have passed 1 main class update controls. however i'm new .net , see if create mainwindow.xaml , controls available in class. design, or there way access controls in class? is better design functions return information needed update controls, or access controls in classes information needed present? you shouldn't, in fact, putting code in code-behind bad practice. in fact, popular way program wpf using mvvm pattern , variant of mvc. in mvvm pattern view contains xaml or limited amount of code perform ui operations can't done using wpf's triggers , animations. the data view provided viewmodel class through data binding. data binding provided framework , passes data , forth without view or viewmodel ever knowing other. changes viewmodel's properties passed view fra

opencl - How to timer the NVIDIA SDK examples? -

i tried timer oclvectoradd example. use clgetprofilinginfo, gpu timer record time spent on kernel execution. time caculated in milliseconds. output weird. code , output below: cl_ulong start,end; cl_event event_ker_x; cierr1 = clenqueuendrangekernel(cqcommandqueue, ckkernel, 1, null, &szglobalworksize, &szlocalworksize, 0, null, &event_ker_x); shrlog("clenqueuendrangekernel (vectoradd)...\n"); if (cierr1 != cl_success) { shrlog("error in clenqueuendrangekernel, line %u in file %s !!!\n\n", __line__, __file__); cleanup(argc, argv, exit_failure); } clgeteventprofilinginfo(event_ker_x, cl_profiling_command_start, sizeof(cl_ulong), &start, null); clgeteventprofilinginfo(event_ker_x, cl_profiling_command_end, sizeof(cl_ulong), &end, null); float ker_x_time= (end-start) * 1.0e-6f; shrlog("kernel execution time : %f\n", ker_x_time); clenqueuendrangekernel (vectoradd)... kernel execution time : 18446744027136.000000 clenqueuer

python - Creating a list from a file -

i'm creating horoscope have file different qualities , 4-5 sentences different statements regarding each quality. qaulities separated blank line. want save them list called qualities, qualities[0] contains sentences regaring first quality, qualities[1] contains sentences regarding second , on. my code: class horoscope: def __init__(self, filename): self.qualities = list() file = open(filename, 'ru') = 0 line in file: row= line.strip().split('/') if len(row) >= 2: self.qualities[0+i] = row else: += 1 file.close() filename= 'horoscope.txt' horoscope= horoscope(filename) print(horoscope.qualities) unfortunally, printed "[ ]"... know why? thanks! i'm surprised self.qualities[i] did not raise indexerror. suggests len(row) never >= 2 . however, if were, should use append instead: class horoscope: def __i

javascript - Scripting in Livecycle ES2 -

i have form has several groups named "transtype", within these groups text field , group of 3 radio buttons. each radio button group has values of yes, no , resolved. have 1 radio button group @ top that, when clicked, corresponding buttons on page selected, e.g. click "no" on top group, , "no" fields below selected. using action builder make happen, seems tedious , have each value. below script stands now: form1.#subform[0].transtype[0].markall::change - (javascript, client) if (this.rawvalue == "1") { this.resolvenode("transtype[1].exeerror").rawvalue = "no"; this.resolvenode("transtype[2].newenrol").rawvalue = "no"; this.resolvenode("transtype[3].enrolreq").rawvalue = "no"; this.resolvenode("transtype[4].immpinchange").rawvalue = "no"; this.resolvenode("transtype[5].pinchange").rawvalue = "no"; this.resolvenode("t

java - Changed table values for mysql but cloudbees still uses old values -

i got error in logs when uploaded app cloudbees [[31merror[0m] play - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'desc varchar(255), kind varchar(255), ' @ line 4 [error:1064, sqlstate:42000] after googling , browsing questions on figured problem desc keyword in mysql , not in h2, changed desc description , re-deployed app. exact same error desc again. have execute evolution scripts manually overwrite values or something? you need run migrations - firstly undo migration made change, , re apply - play specific feature, nothing cloudbees.

ios - NSThread Programming issues -

i learning ios threading programming... encountered issue: here comes code, please kindly have look: int main(int argc, const char * argv[]) { @autoreleasepool { nsthread *t1 = [[nsthread alloc]initwithtarget:[mythread class] selector:@selector(mymethod:) object:nil]; [t1 start]; } return 0; } #import "mythread.h" @implementation mythread + (void)mymethod:(id)param { @autoreleasepool { nslog(@"called..."); } } @end however, when ran program, though there no error, no message printed on console. seems mymethod not executed. wonder if give me suggestions. has driven me crazy. many in advance. the main thread of application exiting before other thread has chance process anything. it work if add in simple sleep(1000) statement anywhere before return 0 statement in main method.

Get array from php, and get its index in jquery using ajax -

i wonder if can access array through jquery index this: output_string['color'][1] i actually, build array of elements (it works): php $arreglo = array( 'color' => $skin['color'], 'textu' => $skin['imagentextura'], 'header' => $skin['imagen'], 'sombra' => $skin['imagensombra'], 'tooltip' => $skin['tooltipcolor'] ); echo json_encode($arreglo); and if want file, array this: $.ajax({ url: 'ajax.php', type:'post', datatype : 'json', data: { 'datastring': result }, beforesend: function(){ $("#loader").show(); }, success: function(output_string){ alert(output_string['color']); } }); the problem that, time, more 1 loop loaded, need access this:

r - How to convet an S4 class objects slots into vectors or matrix? -

i have s4 class object rocr package. has several slots containing data related among each other (i.e. "x.values", "y.values", , "alpha.values"). i merge them in matrix accessing slots make calculations (youden indices, etc.) i've tried things (according limited knowledge of r) test<-cbind(perf@x.values,perf@y.values,perf@alpha.values) and other formulas such changing class of object directly... but worked. any welcomed thanks if know slot names (use getclass if don't), can pull them out @ operator. don't know rocr assuming have slot names right, can do x <- perf@x.values y <- perf@y.values <- perf@alpha.values and examine them other r object. cbind isn't working because dimensions of objects don't match.

ios - When I display the UIImagePickerController in a UIPopupviewController, it crashes -

Image
i have in uipopupviewcontroller call ios camera, can take more 2 pictures sometime after first call crash. -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage *image=[info objectforkey:uiimagepickercontrolleroriginalimage]; uiimagewritetosavedphotosalbum (image, nil, nil , nil); [self dismissviewcontrolleranimated:no completion:nil]; } -(ibaction)takephoto:(id)sender { if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) { uiimagepickercontroller *imagepicker=[[uiimagepickercontroller alloc]init]; imagepicker.delegate=self; imagepicker.sourcetype=uiimagepickercontrollersourcetypecamera; imagepicker.allowsediting=no; [self presentmodalviewcontroller:imagepicker animated:no]; } }

What do we mean by metadata partitions in terms of distributed storage services? -

i read term lot in case of distributed storage systems ex: this paper metadata relatively of small size compared data, , summary information of data. in system, there many pieces of data, , there many pieces of metadata, because each piece of data has own metadata.in gfs(google file system), metadata stored in master node, in way, query efficient, there may problem of single failure , master may bottleneck of system. address these problems, people propose splitting metadata , store them in several nodes, means, instead of storing metadata in single node, may split metadata , store them several nodes. example, suppose there 4 pieces of metadata in system, namely m1, m2, m3 , m4. in gfs, these 4 pieces of metadata stored in master node, while metadata partition, can store m1, m2 in node a, , store m3, m4 in node b, overlap allowed, , overlapped purpose of high availability. hope helps!

html - how do icon maps (or chart) work? -

Image
i found similar while inside websites source code icons gathered in 1 chart .. realized later refer each icon separately when needed. found article image mapping in w3schools gift me main idea still need how works can have more information how done ? articles or learn more thank everyone they're called 'css sprites', chris coyier wrote pretty authoritative article on subject http://css-tricks.com/css-sprites/

c# - Assert.AreEqual fails on a class derived from List<> that overrides Equals() -

i've been having troubles nunit. have class inherits list , overrides equals() (so 2 instances can considered equal when contain same elements in different order). when using assert.areequal, fails, using assert.true , calling equals manually works : [test] public void equals() { var dieset1 = new dieset {new die(1), new die(2)}; var dieset2 = new dieset {new die(2), new die(1)}; assert.true(dieset1.equals(dieset2)); //ok assert.areequal(dieset1, dieset2); //fails exception } here exception detail : nunit.framework.assertionexception unhandled user code hresult=-2146233088 message= expected , actual both 2 elements values differ @ index [0] expected: was: source=nunit.framework stacktrace: @ nunit.framework.assert.that(object actual, iresolveconstraint expression, string message, object[] args) @ nunit.framework.assert.areequal(object expected, object actual) @ dicelibtest.diesettest.equals() in c:

jquery - Detect HTTP 301 status code from JavaScript -

i need detect client side if requested file (with xmlhttprequest) had 301 response. reason of doing because need request other files related file user has been redirected , not related first 1 requested. way detect response status code using javascript or jquery? thanks. jquery ajax callback function gives out lot of info $.ajax({ url: "test.php", type: "get", data: {}, datatype:"json", success: function(resp, textstatus, xhr) { //status of request console.log(xhr.status); }, complete: function(xhr, textstatus) { console.log(xhr.status); } });

css - Fixed header initially overlays main content -

i have fixed header div #header position: fixed; on page overlays main content div #main before starting scroll . 1 solution move #main below #header add margin-top #main . however, template responsive , header have different heights on different devices. there way add css #main sit 20px below #header independent on how high #header is? why not use z-index overlay header , padding-top:20px #main.

Why is the stack address lower than that of heap in Visual C++? -

as know, stack address higher heap addresses in process address space . when wrote program verify in vs2010, got trouble. the stack has address lower heap , lower of data segment. program shown follows: #include "stdafx.h" #include "malloc.h" static int g_a=123; int g_b=123; int main() { static int a=123; int b=123; float c[10]={0}; int *p1=(int*)malloc(sizeof(int)); int *p2=(int *)malloc(5*sizeof(int)); } here address according vs2010: &g_a 0x01097038 &g_b 0x0109703c &a 0x01097040 &b 0x002af7a8 c 0x002af778 p1 0x00571500 p2 0x00571540 obviously, pointer p1 , points array on heap, has bigger address &b, on stack. that's why? ps:sorry absence of picture due poor reputation, or describe question more clearly. "as know, stack address higher heap addresses in process address space." your assumption here false. stack , heap both allocated process's

computer vision - How to use Mori's superpixels Matlab code on Windows -

how use mori's superpixels matlab code ( http://www.cs.sfu.ca/~mori/research/superpixels/ ) on windows? i ran mex , downloaded segbench.readme file in segbench says (1) image , segmentation reading routines in dataset directory work, make sure edit dataset/bsdsroot.m point local copy of bsds dataset. (2) run 'gmake install' directory build everything. should put lib/matlab directory in matlab path. (3) read benchmark/readme file. for 1st step, changed path in bsdsroot.m c:\users\rajan\desktop\superpixels have file want segment. for 2nd step ran command gmake install in terminal , got c:\users\rajan\desktop\superpixels\segbench>gmake install gmake[1]: entering directory `c:/users/rajan/desktop/superpixels/segbench/util' gnumakefile-library:26: * mexsuffix not defined. stop. gmake[1]: leaving directory `c:/users/rajan/desktop/superpixels/segbench/util' slightly adapted explanation given on website . run mex on each .c file in

haskell - What "Contraint is no smaller than the instance head" means and how to solve it -

i write like: {-# language flexiblecontexts,flexibleinstances #-} import data.bytestring.char8 (bytestring,pack) import data.foldable (foldable) class (show a) => rows rrepr :: -> [bytestring] rrepr = (:[]) . pack . show instance (foldable f,show (f a)) => rows (f a) rrepr = const [] meaning f a instantiate rows if f instantiate foldable , f a instantiate show . when run ghc get: constraint no smaller instance head in constraint: show (f a) (use -xundecidableinstances permit this) in instance declaration `rows (f a)' i have 2 questions: what "smaller" means in error , problem? what right way define want without using undecidableinstances ? let's play compiler: have type (f a) we'd see if valid satisfier of rows constraint. so, need dispatch proof (f a) satisfies show (f a) well. isn't problem unless writes an instance rows (f a) => show (f a) ... in case i'm began. encoding infinite loop

html - posting to .php downloads instead of showing up -

ok i'm new php.here i'm trying do. here index.html <html> <body> <form action="welcome.php" method="post"> name: <input type="text" name="fname"> age: <input type="text" name="age"> <input type="submit"> </form> </body> </html> i'm posting welcome.php <html> <body> welcome <?php echo $_post["fname"]; ?>!<br> <?php echo $_post["age"]; ?> years old. </body> </html> but instead of showing page, downloads welcome.php make sure server has php installed. if have php installed, try restarting server.

jQuery/PHP .ajax() request not processing -

i'm trying insert user database using jquery , php. php file has been tested seperately , works fine, javascript variables before ajax request work fine well. any appreciated! ajax.js $(document).ready(function(){ $("#add-user-btn").click(function() { var email = $("#email").val(); var name = $("#name").val(); var password = $("#password").val(); var pass = hex_sha512(password); var random_number = math.floor((math.random()*1000)+1); var salt = hex_sha512(random_number); var p = hex_sha512(pass+random_number); var action = "adduser"; $(function () { $.ajax({ url: '../actions.php', type: 'post', data: { action:action, email:email, name:name, password:p, salt:salt, authorization:authorization }, datatype: 'json', success: function(data) { $(".close-

java ee - Deploy a J2ee web application (jboss server) on the web? -

so i've been searching on how can deploy or host web application j2ee free, web app developed ejbs , jboss server , the ec2 expensive + don't have international visa card complete registrations , , gea not support ejbs ! any suggestions please ? try jelastic . instead of jboss find glassfish , both same in terms of functionality want. long remain java ee specs , create ear file fine app server. jelastic has 14 days trial period multiple hosts in different geo locations. try out web console awesome , can have load balancing features added. moved platform , great. surya

loops - How do I perform a duplicate check in code? -

this might no-brainer some, i'm trying check if there duplicate values in code. to clearer, creating 5 variable integers randomizes number once created. let's they're named i1 , i2 , i3 , i4 , i5 . i want run loop check on each other make sure don't have possible duplicates. if do, i'll re-random second integer that's being checked. (e.g if (i1 == i4) { i4.rand(); } ) that's make sure i1 doesn't need re-checked against checked values or being stuck in long loop until different number found. this i'm thinking if entire if else statement : if (i1 == i2) , if (i1 == i3) , if (i1 == i4) , if (i1 == i5) , if (i2 == i3) , if (i2 == i4) , if (i2 == i5) , if (i3 == i4) , if (i3 == i5) , if (i4 == i5) i know can "manually" creating lots of if / else statements, there better way it? isn't feasible if increase integer limit 20 , have if / else way through 20 value checks. know there is, can't remember. search on google turnin

pyqt - Conflict between two linux shared objects defining the same function name -

my problem deals python, qt, pyqt , other stuff, question how linux's ld.so works. the question if program loads 2 different shared libraries both have same entry point name (i.e. both define function same name , signature) how can tell version calling? my problem i have third party, proprietary linux application written in c++ (though original language irrelevant) , it's linked dynamically qt3.3. application embeds python interpreter can used write scripts it. you can use application's embedded python instead of original 1 using command such as: /path/to/the/program/python and shows following: python 2.7.1 (r271:86832, sep 16 2011, 18:16:32) [gcc 4.1.2 20080704 (red hat 4.1.2-46)] on linux2 type "help", "copyright", "credits" or "license" more information. >>> using gcc 4.1.2 have built , installed pyqt4 sources, against qt4 libraries system has. believe build successful because can run small pyqt4 ap

javascript - How is this selector working in Jquery when it doesnt even exist yet? -

i found tutorial online me understand drag , drop feature of jquery card mapping little game following link ... http://www.elated.com/res/file/articles/development/javascript/jquery/drag-and-drop-with-jquery-your-essential-guide/card-game.html on line 37 , why $('<div>' + numbers[i] + '</div>') selected when doesn't exist yet , far i'm concerned , select things in jquery when exist in document .. don't quite understand selector , can please elaborate on what's going on selector ? on line 48 ... ui built in word in jquery .. when ui.draggable ? ui refer ? thanks ! <!doctype html> <html lang="en"> <head> <title>a jquery drag-and-drop number cards game</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <script type="text/javascript" s

html - How to apply font anti-alias effects in CSS? -

this question has answer here: forcing anti-aliasing using css: myth? 17 answers how can apply photoshop-like font anti-aliasing such crisp, sharp, strong, smooth in css? are these supported browsers? here go sir :-) 1 .myelement{ -webkit-font-smoothing: antialiased; } 2 .myelement{ -webkit-text-shadow: rgba(0,0,0,.01) 0 0 1px; } update: (see duke) .myelement{ text-shadow: rgba(0,0,0,.01) 0 0 1px; }

c# - Get value from expression in linq extension method -

i searched whole internet , tried many things, not able value expression. cool if me... bye markus public static class linqextension { public static iqueryable<t> getfilteredbystatuslist<t>(this iqueryable<t> source, expression<func<t, int>> expression) { // can compile expression. // in posts have found, have call compiled method, method needs t object. // have no idea how acces value of t. func<t, int> method = expression.compile(); //edit // here need int value pass in service method like: // service.getstatusbyid("int value expression"); //edit end return source; } } -- edit have query , in query have call method needs dynamic value current query item. method exists , work after query loop through query , call method on every item in loop. think not fast solution. so call method inside query , why try implement extension meth

c# - WCF Configuration Reference -

where definitive .net wcf configuration reference documentation? i need documentation lists every configuration option, helpful descriptions of each setting means. this documentation should out lot. windows communication foundation configuration schema it lists possible configuration settings windows communication foundation (wcf). the visualization of configuration settings allows unique perspective. @ end of article, there few links if follow bring expanded discussion , documentation. if want reference of settings found in schema, there article on msdn expanding on - search it.

html - jquery move text like movie credits -

does know jquery plugin or css3 technique easy way move text elements, 10 h1's inside div top bottom of div? so <div class="container"> <h1>content</h1> <h1>content</h1> <h1>content</h1> <h1>content</h1> <h1>content</h1> <h1>content</h1> ... </div> i want h1's slide continuously , div area filled h1's sliding downwards movie credits. i tried jquery cycle plugin cant second slide(h1) start before first 1 finishes animation. here code: $('.container').cycle({ fx: 'scrolldown', sync: 1, timeout: 1000, speed: 6000, continuous: 1, cleartypenobg: true }); also tried this: $('.container').cycle({ fx: 'custom', sync: 1, cssbefore: { top: 0, display: 'block' }, animin: { top: 0 }, animout: { top: 332

How can I use a text file from the internet in my C program? -

i'm working on project, , made c program reads date, time, , wave height .txt file stored on computer, converts date , time gps time use @ scientific research institution, , outputs gps time , wave height screen. however, text file working stored @ http://www.ndbc.noaa.gov/data/realtime2/spll1.txt . there way have c program open text file web address rather local hard drive? fyi: access file on computer used fopen , interact data contained used combination of fgets , fscanf. it more involved web-resource read file disk, can absolutely it, example using library such libcurl . an alternative strategy make components , tie them bash or other scripting. c program example read standard input, , make bash script this: curl http://www.ndbc.noaa.gov/data/realtime2/spll1.txt | ./the_program this way, keep core c program simpler.

iOS is there a limit to duration of touchesbegan? -

i'd several things in app after user has touched - longer touch, better - there limit? ios 'force' touchesended after long? there's no limit. constraint more user experience 1 (at point might long press become annoying).

returning values from python functions -

first off apologies if has been asked before. i'm newcomer coding, you'll see. i've simplified i'm trying achieve below. in essence, pass 2 variables either functions below (fun1 or fun2 initiated first). once either val1 or val2 has reached 0, return alternate value. in example below, val2 reach 0 , fun1 initiated first. i wondering if there's way return value blah? understand below example creating ridiculous loop between 2 functions, i've no idea how accomplish i'm after, without extensive if statements , singular function. any appreciated. def fun1(val1, val2): val2 -= 1 if val2 > 0: print "val2: ", val2 fun2(val1, val2) else: print "val2 ended" return val1 def fun2(val1, val2): val1 -= 1 if val1 > 0: print "val1: ", val1 fun1(val1, val2) else: print "val1 ended

SQL Server : how to insert Identity in existing table -

i creating table: create table emp6 (eno int constraint prkey primary key, ename varchar(15)) after creation of table, want add identity eno column. can add identity , can remove identity it? no, cannot add or remove identity existing column. if forgot make eno column identity , must drop table , re-create correct settings.

On c# the mousehover on a picturebox appear to do nothing.Do i need some kind of eventhandler? -

i trying create mousehover event picturebox, have had no luck far: private void picturebox1_mousehover(object sender, eventargs e) { picturebox1.image = argyrocinema.properties.resources.ktz00h07; label1.text = "hover"; } private void picturebox1_click(object sender, eventargs e) { picturebox1.image = argyrocinema.properties.resources.ktz00h07; } private void picturebox1_mouseleave(object sender, eventargs e) { picturebox1.image = argyrocinema.properties.resources.ktz00h07; } what going on here? mouseclick works correctly, maybe have add on form1.designer.cs ? ok had add line on constructor: this.picturebox1.mousehover += new system.eventhandler(this.picturebox1_mousehover); although use mouseenter, faster

VIM global multiple line search and replace maintaining indent -

i trying perform multiple line search , replace while retaining indent, leading space, in code working with. below text sample approximates situation. problem i'm having preserving white space. i'm hoping non-plugin, plain jane vim solution via :%s/ ...... vim 7.2 on windows 7 autoindent on expandtab on starting with: apples, banannas, cherries, plums peas, green beans, corn, squash apples, banannas, cherries, plums i add "pears,", without double quotes , following "cherries," line in list. desired outcome is: apples, banannas, cherries, pears, plums peas, green beans, corn, squash apples, banannas, cherries, pears, plums trying :%s/cherries,/&\rpears,/g yields ... apples, banannas, cherries, pears, plums peas, green beans, corn, squash apples,

How to override a Spring @Autowire annotation and set a field to null? -

i spring neophyte working on large spring-based project has extensive coupling between spring beans. trying write integration tests exercise subsets of total application functionality. so, i'd override of autowiring. example, suppose have class public class mydataserviceimpl implements mydataservice { @qualifier("notneededformydataservicetest") @autowired private notneededformydataservicetest notneededformydataservicetest; //... } and context file with: <bean id="mydataservice" class="mydataserviceimpl"> </bean> in test, have no need use notneededformydataservicetest field. there way can override @autowired annotation , set notneededformydataservicetest null, perhaps in xml file? don't want modify of java classes, want avoid (problematic) configuration of notneededformydataservicetest . i tried doing: <bean id="mydataservice" class="mydataserviceimpl"> <

ssis - How long does it take for SSISDB to record package execution status? -

i running series of ssis packages using dtexec in powershell. packages reside in ssisdb. i have no trouble running package, running problems determining actual result status once package has completed. when package run ssisdb, dtexec appears return 0 return code when package fails (e.g. file not found during task validation). i have tried query ssisdb (catalog.executions) check status once dtexec has completed (or think has completed). can status 2 ("running"). occurs when add 5-10 second wait. i suspect code using run dtexec may culprit. function using: function run_pkg ($dtexecargs) { $rc = -1 # run dtexec $pinfo = new-object system.diagnostics.processstartinfo $pinfo.filename = "c:\program files\microsoft sql server\110\dts\binn\dtexec.exe" write-host "starting... " $dtexecargs # next few lines required make sure process waits # package execution finish $pinfo.redirectstandardoutput = $true $pinfo.useshel

java - Share Variable between specific threads -

i facing problem in java wherein program makes n independent threads (of classa ) , each thread of classa makes m dependent threads ( classb ). in total have m.n threads (of classb ). want share variable between m threads (of classb ) created specific thread of classa . can't use static because m.n threads share same variable want m threads created specific thread of classa share these. there implementation can follow same? thanks. you can pass shared variable b using constructor class b extends thread { final private object shared; b(object obj) { shared = obj; } } now have a pass same object each b creates

linux - How to make VIM receive and display the output of a program it is running? -

when run interactive program using vim, example with: :!node server.js :!python my_app.py the messages displayed program via console.log , print etc., shown on vim when program's process terminates, in single chunk. different running them directly on terminal, messages shown in real time. how fix behavior?

php - How to make a regex to recognise a specific pattern of words -

i'm poor in regex, reason left no choice use it. i'm trying extract list of "port number" , respective "ip address" webpage's table. , because dynamic webpage using ajax , php stuff generate dynamic content, table elements doesn't have id or class or unique things. had eliminates /t, /r , /n using str_replace , whole content contains words , spaces. here example of port , ip addr: port - fa0/0, gi1/0/2.100, ethernet01, gigaether-01 (contains upper , lower case, dot, dash, slash , numbers, , shouldn't more 16 characters, no spaces) ip adrr - 123.123.123.123, 1.1.12.12, 123.12.1.1 (no difference common ip addr) but fortunately, "port" , "ip address" followed either port image or ip image., like ...<img border='0' src='images/port.png' width='18' heigh='18'>fa0/0</td>... or ...<img border='0' src='images/ip.png' width='18' heigh='18'&g

image - How to place top level frames within another java -

how can place imagewindow ( http://rsb.info.nih.gov/ij/developer/api/ij/gui/imagewindow.html ) top level container, within jframe? im trying set several imagewindows (each own images, .tiff files) in organized manner within frame. if make 10 of them, loose windows , can moved around individually. want group these images in 1 collective frame can see them side side how can place imagewindow (http://rsb.info.nih.gov/ij/developer/api/ij/gui/imagewindow.html) top level container, within jframe? i don't think possible add top level container (imagewindow extends frame) in top level container (jframe). for trying looks me imagej might not suitable choice. i used dcm4che image display app wrote. i had looked imagej2 @ 1 long time ago , @ time couldn't work @ time switched dcm4che. imaej2 have better decoupling of data , graphics better suited needs.

linux - Pass a full bash script line to another bash function to execute -

in bash code below, variable echo_all global , set either 'yes' or 'no' based on input parsing of options. --- begin of ~/scripts/util/util-optout.sh --- ######################################## # @param $@ # @return return value $@ # @brief wrapper function allow # optional output of # command w/wo args ####################################### optout() { if [ ${echo_all} = 'no' ]; "$@" 1>/dev/null 2>&1 return $? else "$@" return $? fi } --- end of file --- in bash file source above util-optout.sh file , use optout() function allow conditional output.. allow conditional redirection of commands output /dev/null make scripts silent. for example in other build script have source ~/scripts/util/util-optout.sh optout pushd ${zlib_dir} optout rm -vf config.cache optout cc=${build_tool_cc} ./configure ${zlib_configure_opt} --prefix=${curr_dir}/${instal

javascript - How to not use the `new` operator in JS API? -

so came across this article mr. baranovskiy says people shouldn't have use new operator use api. have created this basic example lets create instances of colorbox line of code var box = new colorbox(node, options); how implement have in example without using new operator? js: var colorbox = function(node, options) { this.setsize = function(){ node.style.width = options.width + 'px'; node.style.height = options.height + 'px'; } this.setcolor = function(color){ node.style.backgroundcolor = color || options.color; } this.setsize(); this.setcolor(); } var node = document.getelementbyid('thing1'); var options = { color: 'red', width: 200, height: 200 } var box = new colorbox(node, options); settimeout(function(){ box.setcolor('blue'); }, 2000); first, don't agree article - think new reasonable way of writing code, , makes clear you're creating ins

java - Multiple problems in this code - Type: Missmatch -

so have written java code supposed tell user color if combining 2 other (from list) random selected colors. mind new java (have programmed in python before). code: package listofwords; public class testlistwords { public static void main (string[] args) { string [] colors = {"red","green","gray","black","blue","yellow"}; int colorslength = colors.length; int rand1 = (int) (math.random() * colorslength); int rand2 = (int) (math.random() * colorslength); while(rand1==rand2){ int rand2 = (int) (math.random() * colorslength); } string phrase1 = colors[rand1]; string phrase2 = colors[rand2]; while(phrase1 = "green"){ if (phrase2 = "red") { system.out.print("combining" + " " + phrase1 + " " + "with" + " " + phrase2 + " " + "will give co

android - Transparent bitmap is black -

i have 2 overlapping imageviews. want 1 stay unchanged while other 1 transparent. drawing canvas transparent one, can not transparent bitmap. how can rectify this? when set color closer transparent color (by diminishing alpha channel) using bitmap.erasecolor(color) , becomes closer , closer black. when set bm.erasecolor(color.transparent) appears black. imageview contains bitmap has transparent background, can show outside of black bitmap (which supposed transparent). bm.add(decodesampledbitmapfromresource( getintent().getextras().getstring("filepath"), iv.getheight(), iv.getwidth()).copy( bitmap.config.argb_8888, true)); scalebitmap(); originalimage.setimagebitmap(bm.get(n).copy( bitmap.config.argb_8888, false)); bm.get(n).erasecolor(color.transparent); iv.setimagebitmap(bm.get(n)); here related part of layout code: <relativelayout android:id="@+id/myimages" android:layout_width="fill_parent&q

css3 - footer stuck in middle of page div not filling remain screen -

so i'm updating local circus website , footer not want stay @ bottom of page. don't want fixed bottom of screen rather when scroll bottom of content that's footer should be. i'm trying use div fill remaining space right of buttons semi opaque black background. site should http://sdrv.ms/18njjnw instead looks http://sdrv.ms/17pkpdr . thank in advance. <body> <div id="body"> <a href="index.html" ><img id="logo" src="images/logo.png" alt="circus logo" /></a> <div id="buttons" > <div class="opa"><a class="buttons" href="circus.html"> circus </a></div> <div id="currentpage" class="opa"> <a class="buttons" href="tickets.html"> tickets </a></div> <div class="opa"><a class="buttons" href="performers.html"> performer