Posts

Showing posts from January, 2010

c# - task deadlock when invoking in worker threads -

i have windows form program (**vs 2010 .net 4 **) detecting recursively folders , sub folders of directory , optimizing files. tasking library , have progressbar shows progress of item , label near progressbar shows current file. have settext(string text) method , delegate (delegate void settextcallback(string text);) use purpose. when want show messagebox @ end of process think deadlock. when don't use task.wait(); in button6_click goes ok , ui won't hang. code: public partial class form1 : form { int maxfilecounter = 0; static int filecounter = 0; delegate void settextcallback(string text); delegate void setprogresscallback(int i); private void button6_click(object sender, eventargs e) { task task = task.factory.startnew(() => { editfiles(txtfilepath.text); }); task.wait(); messagebox.show("finished"); } private void editfiles(string directorypath) { try { //directoryinfo dirinfo = new directo

c# - How to pass multi parameters in webservice from radcombobox in asp.net? -

how pass multiple parameters in webmethod radcombobox? use radocombobox use webservice. want pass 2 parameters webmethod. how do it? <telerik:radcombobox id="radcmbaccountlist" runat="server" cssclass="radctrlcombo h4" enableloadondemand="true" enablevirtualscrolling="true" loadingmessage="در حال دریافت اطلاعات.." width="128px" minfilterlength="1" skin="webblue"> <webservicesettings method="getaccountlist" path="~/services/webservice.asmx" > </webservicesettings> </telerik:radcombobox> [webmethod] public radcomboboxdata getaccountlist(radcomboboxcontext context, int accountid) {} i want pass accountid webmethod. the radcomboboxcontext object dictionary. need pass in single parameter context , in web method can access key/value pairs. set keys client-side whatever need: <script type="text/javascrip

python - algebraic constraint to terminate ODE integration with scipy -

i'm using scipy 14.0 solve system of ordinary differential equations describing dynamics of gas bubble rising vertically (in z direction) in standing still fluid because of buoyancy forces. in particular, have equation expressing rising velocity u function of bubble radius r, i.e. u=dz/dt=f(r), , 1 expressing radius variation function of r , u, i.e. dr/dt=f(r,u). rest appearing in code below material properties. i'd implement account physical constraint on z which, obviously, limited liquid height h. consequently implemented sort of z<=h constraint in order stop integration in advance if needed: used set_solout in order so. situation code runs , gives results, set_solout not working @ (it seems z_constraint never called actually...). know why? there more clever idea, may in order interrupt when z=h (i.e. final value problem) ? right way/tool or should reformulate problem? thanks in advance emi from scipy.integrate import ode db0 = 0.001 # init bubble radius y0,

sql - Joining Multiple Tables - Oracle -

i'm studying multiple table joins week , have odd results being returned. here scenario... using correct tables, create query using traditional join operation list customer first , last name, book title, , order date (formatted mm/dd/yyyy alias of “order date”) customers have purchased books published 'printing us'. with database i'm querying against, correct tables query book_customer, books, book_order, , publisher. statement have written returns information need, returning 5900 records. don't see how can right. publisher, printing us, has 14 books listed in database , there 20 customer records, if every customer purchased every printing book, return 280 records total. yet can't figure out have wrong. statement listed below. select bc.firstname, bc.lastname, b.title, to_char(bo.orderdate, 'mm/dd/yyyy') "order date", p.publishername book_customer bc, books b, book_order bo, publisher p where(publishername = 'printing us');

iOS storyboard: few buttons and one segue -

Image
in app first screen content few button (it password screen) , user must press few buttons , go next screen. how can create 1 segue button same behavior? or, must create 1 ibaction , programmaticaly call push method? thanks

segmentation fault - Java fatal error SIGSEGV -

i getting error message java compiler don't understand. i've tested code on osx 10.6, 10.9, , ubuntu 14.04, both java 6 , 7. when run eclipse debugger or interpreter (using -xint option), runs fine. otherwise, following messages: java 1.6: invalid memory access of location 0x8 rip=0x1024e9660 java 1.7: # # fatal error has been detected java runtime environment: # # sigsegv (0xb) @ pc=0x000000010f7a8262, pid=20344, tid=18179 # # jre version: java(tm) se runtime environment (7.0_60-b19) (build 1.7.0_60-b19) # java vm: java hotspot(tm) 64-bit server vm (24.60-b09 mixed mode bsd-amd64 compressed oops) # problematic frame: # v [libjvm.dylib+0x3a8262] phaseidealloop::idom_no_update(node*) const+0x12 # # failed write core dump. core dumps have been disabled. enable core dumping, try "ulimit -c unlimited" before starting java again # # if submit bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # there's more error output java 7 (

PHP quiz code (radio buttons wont update global values) -

i making webpage ask 15 questions user. based off of answers these 15 questions webpage determine kind of element user bend (its reference avatar last airbender). i website first display description page ($currentpage = 0). when user clicks "next question" button $currentpage variable increase 1 , first question appear 4 radio buttons under possible answers. each answer corresponds element (air, earth, water, or fire). if user selects (one radio button only) score element increase 1. when user clicks "next question" button $currentpage variable increase 1 again , next question appear. @ end of 15 questions (total of 16 pages including description page) compare 4 score see value greatest determine element user bend. i have coded 1 question , description portions, can not seem increase $earthscore, $waterscore, $firescore, or $airscore 1 after selecting radio button corresponding answer , hitting next question. could guys please me out??? i dont have 10 re

Unreachable code in Java -

i don't "unreachable code" means ? here in last line of code double probabilityofwin = wins / (wins + loses); says unreachable code. import java.util.random; public class crapsgame { public static final int games = 9999; public static void main(string[] args) { random randomgenerator1 = new random(); random randomgenerator2 = new random(); random randomgenerator3 = new random(); random randomgenerator4 = new random(); int dice1 = randomgenerator1.nextint(6) + 1; int dice2 = randomgenerator2.nextint(6) + 1; int comeoutsum = dice1 + dice2; int point = 0; // comeout roll if (comeoutsum == 7 || comeoutsum == 12) system.out.println("wins"); else if ( comeoutsum == 2 || comeoutsum == 3 || comeoutsum == 12) system.out.println("loses"); else point = comeoutsum; int wins = 0; int loses = 0; while(games <= 9999) { dice1 = randomgenerator3.ne

ios - Not able to see tab bar controller -

i working on xcode 5 , have embedded tab bar controller master-detail application templates masterviewcontroller. reasons tab bar not visible. tab bar should visible in screens connecting navigation controller cannot seen. have coded lot of functionality in application using master-detail view controller , application requires functionality of building tab bar controller. have looked ways of resizing size of table view in masterviewcontroller tab bar visible. not sure of how resize it, normal table views table view not give markers resize it. have tried changing streching setting of table view , changing height. not help. please ideas around this. extremely thankful time. regards, sameeksha in storyboard builder, when selecting related uiviewcontroller, there few parameters used make preview, might accident turned off features. in storyboard, select 1 of view controllers, go attribute inspector (option + command + 4) , under simulated metrics set value of bottom

sass - Create square divs using susy-grid -

is possible have @include span(3 of 12) return in pixels instead of %? i'm trying create square elements, , want height of element equal width. .myelement { width: span(3 of 12) height: span(3 of 12) } of course causes height %, % of parent container, not equal width! ideas? not impossible @ — tricky (if want fluid square). // static width/height simple .square-a { @include span(2 static); height: span(2 static); } // fluid takes bit more work .square-b { @include span(2); height: 0; // %-padding relative parent width padding-top: span(2); position: relative; // inner element positioned fit space span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } } here's demo of both .

php - Images download using Goutte -

i have download images using cookie in request. make file_get_contents (with stream_context_create) or curl passing cookies. how make goutte? use goutte\client; $client = new client(); $response = $client->request('get', 'https://www.google.pl/images/srpr/logo11w.png'); i make request , what's next step? ok, figured out: $client->get('https://www.google.pl/images/srpr/logo11w.png', array('save_to' => __dir__.'/image.jpg')); with goutte 2: $client = new guzzlehttp\client([ 'base_url' => 'https://www.google.pl', 'defaults' => [ 'cookies' => true, ] ]); $response = $client->post('/login', [ 'body' => [ 'login' => $login, 'password' => $password ] ]); $response = $client->get('/images/srpr/logo11w.png'); $image = $response->getbody(); with goutte 1 after adding &quo

http - use AFNetworking upload file to my apache server -

i use afnetworking upload file apache . before config apache server this , upload code is: nsstring *remoteurl = @"http://192.168.8.101/example"; nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"uploadpic" oftype:@"jpg"]; nsmutableurlrequest *request = [[afhttprequestserializer serializer] multipartformrequestwithmethod:@"post" urlstring:remoteurl parameters:nil constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfileurl:[nsurl fileurlwithpath:filepath] name:@"file" filename:filepath.lastpathcomponent mimetype:@"image/jpeg" error:nil]; } error:nil]; afurlsessionmanager *manager = [[afurlsessionmanager alloc] initwithsessionconfiguration:[nsurlsessionconfiguration defaultsessionconfiguration]]; manager.responseserializer = [afhttpresponseserializer serializer]; nsprogress *progress = nil; nsurlsessionuploadtask *uploadtask = [manager uploadtaskwithstreamedrequ

cocoa touch - UITableViewCell as subview? -

i want reuse views , code is ok add uitableviewcell subview common view , not in uitableview? is idea? i don't think it's idea. uitableviewcell made serve cell , nothing else. uibutton made clickable button. might think "well button looks good, shouldn't reuse subview?". no, shouldn't that. button button, cell cell , on. if want reuse code should provide kind of custom uiview , let subview cell or want

nsmutablearray - How to create multidimensional array in swift? -

this question has answer here: multidimensional arrays in swift 7 answers i'm trying push array type object special index inside array in new swift lang apple. should = [ [...], [...], ...] , i've read in docs - nsmutablearray type assigned variable automatically if it's var , in playground throws me errors: var arr = []; arr[0] = []; // error: cannot assign result of expression arr.insert([], atindex:0) // error: 'nsarray' not have member named 'insert' var array2d: [[int]] = [[1,2,3,4],[5,6,7,8]]

javascript - Split an html document into multiple documents on form submit -

i want submit html text area , on submit want read file, find class selector , break down html multiple html files , save them in directory. any ideas on how achieved? for example let submit textarea , hit submit : <table class="yoda"> <tr> <td></td> </tr> </table> <table class="yoda"> <tr> <td></td> </tr> </table> on submit want grab each yoda , save in new html file in directory. thank in advance. not sure if need use php achieve or if need use javascript. you have 2 options submit html via submit php , use simpledom library or php native dom/xml methods parse , save individual snippets ( best method ) parse html on client (using jquery or native ) , submit json php (remember escape html strings). process json using php on server , save snippets.

rest - How to be RESTful in Ruby on Rails? -

i have decent amount of experience rails, i've been bit ad hoc development methods. i'm curious how restful in rails. here's example of app i'm working on now: i have few models, including user, pack, , product model. models each have controller associated them. if want create new page called 'dashboard', on user can create new records on pack model, see account information, how do in restful way? create new controller called dashboard? or add controller defines 'static pages'? what's best practice regarding pages aren't exclusive actions on 1 model? thank in advance! yes, want 1 controller per resource. in case resource combination of things since you've identified singular meta-resource (a "dashboard") makes sense. so, i'd create dashboardscontroller , have route like: resource :dashboard, only: :show then can use dashboard_url links dashboard. notes : singular resource in routes file important becaus

lisp - Get numbers for the lottery -

as part of learning lisp i'm trying write function helps me fill out lottery ticket. want function return a list of 6 numbers, where each number between 1 , 49, without duplicate numbers, and being list ordered in ascending way. so far, i'm done 4 of 5 requirements. current code: (defun lottery () (sort (loop repeat 6 collect (1+ (random 49))) #'<)) when run function such as: (lottery) ;; => (3 10 23 29 41 43) basically, everything's fine - except have same number twice within list. , here starts puzzling. problem i'm not sure on how solve in lisp way. there multiple options can think of: run remove-duplicates on result, use length check whether list has less 6 elements, , if so, run lottery second time, append first result, use subseq to first 6 elements, , repeat. works, not elegant, involves sorting & co. multiple times. start empty list, create single random number using (1+ (random 49)) , , call pushnew . call lottery

ios - angle does not produce correct heading vector -

in output vector, x , y values should negative when touchposition top right of player position. given coordinate system increases upwards , right, starting @ bottom left, can see errors in code might problem? double oppositelength = (touchposition.y - playerposition.y); double adjacentlength = (touchposition.x - playerposition.x); double hypotenuselength = (sqrt((oppositelength * oppositelength) + (adjacentlength * adjacentlength))); double angle = asin(oppositelength / hypotenuselength); double mass = 0.0000013; cgvector vector = cgvectormake(mass * cos(angle), mass * sin(angle)); here test output… (theta in radians): o: -119.500000, a: 87.500000, h: 148.109757, theta: -0.938773439 ...with vector…: {7.680115295514375e-07, -1.0488843175016773e-06} …when touchposition top right of player position.

How to correctly initialize an UnsafePointer in Swift? -

i'm trying use ctfontcreatepathforglyph(font: ctfont?, glyph: cgglyph, transform: cconstpointer<cgaffinetransform>) : let myfont = ctfontcreatewithname("helvetica", 12, nil) let myglyph = ctfontgetglyphwithname(myfont, "a") let mytransform = cgaffinetransformidentity but how correctly pass mytransform ctfontcreatepathforglyph ? i've tried creating mytransformpointer pass function so: var mytransformpointer: unsafepointer<cgaffinetransform> = unsafepointer().initialize(newvalue: mytransform) but error: playground execution failed: error: <repl>:20:76: error: '()' not convertible 'unsafepointer<cgaffinetransform>' var mytransformpointer: unsafepointer<cgaffinetransform> = unsafepointer().initialize(newvalue: mytransform) so tried explicitly naming type: var mytransformpointer: unsafepointer<cgaffinetransform> = unsafepointer<cgaffinetransform>().initialize(newvalue: mytransform)

use case - UML sequence diagram - Diagram without actors? -

i have scene want show exception case in sequence diagram. in case, sequence diagram pretty shows interactions between objects (classes) between actor , object. so, ok have sequence diagram without actors ? it absolutely ok. actors 1 of main elements in uc diagrams, not in sequence diagrams. sequence diagram without messages , lifelines - 1 hard imagine. these essence of sd. , actor merely can used there, if sequence interaction between border component , external object ( actor ). but if extremally important, needn't use every element of main set of elements of diagram. example, use case diagram contains many use cases , additional elements other diagrams can drawn without actors - better understanding. but if merely training use uml diagrams, draw sequence diagram actor or 2 - should learn how use them, too.

freeware - Free text editor with full column mode support -

if out there old enough remember ispf editor on ibm mainframes, know mean. rest of ... i looking free editor allows me edit particular columns of text file (preferably on series of contiguous lines). notpepad++, crimson editor (which seems longer in development, alas), , ultraedit (which not free, alas), claim column mode, ability copy/paste rectangular areas of text file. while nice, want able search/replace text , able restrict a range or of contiguous columns, preferably on range of contiguous lines. a poor example: tim likes beer toms likes beer bob not either beer or wine ann likes beer, , wine (and oxford comma ;-) and here is again, line & column numbers: 1 2 3 4 1234567890123456789012345678901234567890 1 tim likes beer 2 toms likes beer 3 bob not either beer or wine 4 ann likes beer, , wine if want change "beer" "fish" between columns 10 , 20, result (changes capitalized).

python - strip html tags from an xpath @attribute -

i'm trying extract text webpage using lxml , xpath - there 2 bits need the main text body: page = requests.get(url) pageopen = lxml.html.fromstring(page) body_one = pageopen.xpath('/html/body//div/div/div//div/p[@class="body"]/text()') which working fine the second body of text (which reveals after mouse click) have managed using pageopen.xpath('/html/body//div/div/div//div//span/@data-description') but text returned still has html junk in it. using /text() function on above statement returns empty list. i've spent hours reading lxml documentation greek me. how strip html tags xpath @attribute? but text returned still has html junk in it if mean string html, use technique understand extracting text html: descriptionhtml = pageopen.xpath('/html/body//div/div/div//div//span/@data-description') descriptionbody = lxml.html.fromstring(descriptionhtml) descriptiontext = descriptionbody.xpath('text()')

ios8 - Extension sample using Swift -

i have gone through new ios8 , read extension. 1 please me sample creating extension ? in advance this example adds 5 computed instance properties swift’s built-in double type, provide basic support working distance units: extension double { var km: double { return self * 1_000.0 } var m: double { return self } var cm: double { return self / 100.0 } var mm: double { return self / 1_000.0 } var ft: double { return self / 3.28084 } } let oneinch = 25.4.mm println("one inch \(oneinch) meters") // prints "one inch 0.0254 meters" let threefeet = 3.ft println("three feet \(threefeet) meters") // prints "three feet 0.914399970739201 meters excerpt from: apple inc. “the swift programming language.” ibooks. https://itun.es/ca/jeuh0.l

SQL server if verify backup integrity fails do something -

i have made sql server agent backup job 'verify backup integrity' checked. want call job within stored procedure using sp_start_job. if backup integrity fails want (rollback/show error message..something that). how go doing this? sp_start_job return error or return 1 or what? i figured out job not return 1, because job takes time complete , job failed part. found useful link wait job finish can catch error. http://www.interworks.com/blogs/bbickell/2010/01/15/how-execute-and-monitor-agent-job-using-t-sql-sql-server-20052008

html - PHP approach to creating article list -

i plan write function dynamically create article , news list, don't know proper approach. i have /articles , /news folders containing files article1.php , article2.php etc. these files contain variables $date (publishing date), $type (news/article), $h1, $h2 (title, subtitle), $short (short paraghaph display on list). i want create list of these files displaying on 1 page. html: <div> $content <!--here goes list of articles/news--> </div> would better to: 1. write while loop in articlelist.php : [pseudocode] $content = ""; while (get filename /articles) include filename $content .= (variables filename.php parsed html) display $content and second same loop newslist.php . (with approach e.g. sorting articles date difficult.) or maybe: 2. create articlearray.php , newsarray.php files storing data each article , news file in array in form key : value = $date : [$type, $h1, $h2, $sh

c# - The type or namespace name 'Http' does not exist in the namespace 'System.Net' -

i developing handset application in .net framework 3.5,which using api service call check email address website.i using below code perform that, using system.net.http; httpclient webclient = new httpclient(); webclient.querystring.add("email", email); stream stream = webclient.openread(brandendpoint); initially used webclient instead of httpclient , got error " the type or namespace name 'webclient' not found " google , fixed httpclient . after replacing webclient httpclient getting error " the type or namespace name 'http' not exist in namespace 'system.net ". need solve this. thanks httpclient available in .net 4.5 or 4.0 microsoft.net.http nuget package. isn't @ available .net 3.5. httpclient uses features tpl available in .net 4+. you'll have use either system.net.webclient or webrequest . if compilation errors, make sure you've added proper using statements. these 2 classes available

android - How to correctly add signature fields in a PDF/A document with iText -

i'm trying add n signature fields in pdf/a document itext api. these fields have been correctly added using addannotation of pdfstamper , document no longer pdf/a compliant. in pdf validation following error: the xmp property 'xmp:modifydate' not synchronized document information entry 'moddate' how can document conforms pdf/a standard? update : i'm using pdfastamper (itext-pdfa-5.5.1) , itextg (itextg-5.5.1) android. same validation error- some code here: string pdffilename = pdffile.getabsolutepath(); pdfreader pdf = new pdfreader(pdffilename); tempfile = new file(pdffilename.substring(0, pdffilename.lastindexof(file.separator)) + "/_pdfsignfieldtemp_" + pdffile.getname()); tempoutstream = new fileoutputstream(tempfile.getabsolutepath()); pdfstamper stp = new pdfstamper(pdf, tempoutstream); pdfformfield sig = pdfformfield.createsignature(stp.getwriter()); (...cut...) sig.setwidget(new rectangle(llx, lly, urx, ury), nu

nhibernate - Operand type clash: bigint is incompatible with time -

i using time datatype column in table in sql server.i working in wpf project using nhibernate in service layer database operations. generated domain class,dto classes using entity developer. time column changed timespan data type in domain dto classes. while saving data table getting error "operand type clash: bigint incompatible time". did face similar issue ? i figured out problem. had change in mapping .customtype("timespan") .customtype("timeastimespan")

delphi - how to change starting position of progressBar -

how can change starting position of progressbar setting part of progressbar empty example 0 -> 50, , start progress ( green color) 50. , there specific method that? the position of progress bar determined position property. so, supposing limits of progress bar 0 , 100 , , wish start @ middle, set position 50 . you tried change min , suspect don't understand min , max do. merely define scale position property. so, when position equal min , progress bar empty, when position equal max progress bar full. , values of position in between min , max specify partially complete progress. mathematically, proportion complete of progress bar given formula: (position-min) / (max-max) so, min , max allow define convenient scale specify proportion complete. instance, if progress naturally expressed percentage, might set min 0 , max 100 . alternatively, if measuring progress of file transfer might set min 0 , max total number of bytes transferred. in

eclipse - The import com.badlogic cannot be resolved in Java Project Libgdx Setup -

Image
i've tried setup libgdx start making games, followed tutorial https://www.youtube.com/watch?v=s9fs1pvtyuc&feature=youtu.be in conjunction libgdx grdale setup. error shows in java project says: the import com.badlogic cannot resolved i using eclipse java ide. believe have android sdk installed. think may setup think latest updates there , tried deleting '.m2'ccahe, not there more btw after deleted (not been replaced), didnt work. ideas? heres code java proect: import com.badlogic.gmx.game; public class gamemain extends game{ }//'com.badlogic 'gets error , 'game' the issue encountering eclipse project "creategame" not setup correctly. missing files needed use libgdx. possible solutions: use libgdx project setup tool , follow instructions here import project eclipse. (easy) add missing library files project (hard) also make sure game code going game-core project project used each platform targeting.

javascript - Fancybox: Different url for different popup -

i have page box avery box have popup (onclick). my issue need every popup have different url. the site in php(smarty) , boxes generate loop. someone know if possible define different url every popup generated? this code: <div class="container"> <div class="row"> <div class="row_content"> {assign var=index value=0} {foreach from=$case_studies key=myid item=data} <div class="news_column"> <div class="item_news"> <a title="<b>{$data.case_study_titolo|upper}</b>.<br> {$data.case_study_descrizione}" class="fancybox-effects-c" href="{$data.src_lb}"> <img alt="{$data.case_study_titolo} sviluppato per {$data.cliente_titolo} " src="{$data.src_home}"> <h1>{$data.case_study_titolo}</h1> <p>{$d

ios - concatenate values from two columns and compare it against one value in sqlite -

i using sqlite in 1 ios project among other columns there 2 columns. 1 has country code mobile dialing +880 , other column has rest of mobile number 1912353697. want join values these 2 columns , compare result value against +8801912353697 , if matches pull corresponding name value in table . right query. have tried select name contact_list (select mbldc || mbl contact_list) = "+8801617634317" ; not work . a appreciated. try: select name contact_list mbldc || mbl = "+8801617634317"; from sqlite documentation : the || operator "concatenate" - joins 2 strings of operands.

reporting services - Parameterized Group and Toggel Visibility in SSRS -

Image
i have report have 5 groups every group depend on upper group , display can toggled report item.like below image now have parameter user role if pass nm group has show. if pass rm start visibility rm. problem if pass rm headers showing not data becasue toggle visibility depend on nm not visible. please reply please don't waste time because toggle visibility can not set dynamically. please create different report different login.

php - Laravel 4 services.json failed to open stream -

Image
when access centos production server, got debug message: errorexception file_put_contents(/var/www/projectplanner/releases/20140610043651/app/storage/meta/services.json): failed open stream: permission denied i have checked many similar topics on matter no (like chmod 777, clear php artisan cache...) here ls -l of production server

python - Is there any difference in putting the logging statement in a module level vs in a class level? -

module1.py #!/usr/bin/env python import logging logger = logging.getlogger(__main__) class myclass() def __init__(self): logger.info('test') versus module2.py #!/usr/bin/env python import logging class myclass() def __init__(self): self.logger = logging.getlogger(__main__) self.logger.info('test') seems me module2.py give unpredictable outcome when imported other modules. i'm not sure though. logging.getlogger() returns singleton (per given name); there's no difference in storing module global or instance attribute. code referencing same object in both cases. quoting documentation : multiple calls getlogger() same name return reference same logger object. and logging.getlogger() function itself: all calls function given name return same logger instance. means logger instances never need passed between different parts of application.

hibernate - Key & value column name overrides when mapping java.util.Map with JPA annotations -

i looking @ different ways of annotating maps using hibernate 4.1.9 & jpa annotations. if want store map key attribute of entity value mark looks this @onetomany(mappedby = "deptbyid", targetentity = com.demo.impls.employee.class) @mapkey(name = "entityid") private map<long, employee> employeesbyid; note above mark not create join table map returned via query @ run-time, map dynamic , not have add element map in java them returned query. now want contents of map reflect application has added map rather performing dynamic query. there 4 varieties of map want store private map<string, string> map0; private map<string, entity> map1; private map<entity, string> map2; private map<entity, entity> map3; in these cases there no relationship between key & , value nor there relationship holding entity. have able specify name of join table column names key & value. i have tried following

how to use SQL group to filter rows with maximum date value -

i have following table create table test (`id` int, `value` varchar(20), `adate` varchar(20)) ; insert test (`id`, `value`, `adate`) values (1, 100, '2014-01-01'), (1, 200, '2014-01-02'), (1, 300, '2014-01-03'), (2, 200, '2014-01-01'), (2, 400, '2014-01-02'), (2, 30 , '2014-01-04'), (3, 800, '2014-01-01'), (3, 300, '2014-01-02'), (3, 60 , '2014-01-04') ; i want achieve result selects id having max value of date. ie id ,value ,adate 1, 300,'2014-01-03' 2, 30 ,'2014-01-04' 3, 60 ,'2014-01-04' how can achieve using group by ? have done follows not working. select id,value,adate test group id,value,adate having adate = max(adate) can query? if using dbms has analytical functions can use row_number: select id, value, adate ( select id, value, adate,

gradle custom task with package name -

i see when create custom task type in gradle, different package name 'org.gradle', cannot directly declare task in build file type name. need give qualified name of task if package 'foo.bar' then task blockc(type: testngblock) { testngxml = "tests/testng-lrga-blockc.xml" } doesnt' work. need write below: task blockc(type: foo.bar.testngblock) { testngxml = "tests/testng-lrga-blockc.xml" } is there way import in java, can specify gradle package names resolving type, can use former approach define task. yes. import in build.gradle works same in pure java class. import foo.bar.testngblock task blockc(type: testngblock) { testngxml = "tests/testng-lrga-blockc.xml" }

html - Responsive divs toruble -

i new responsive design , i'm taking first shot @ blog making company. using media queries change width % , float of divs going serve blog articles. of queries working great except one... @media screen , (min-width: 1196px) , (max-width: 1667px) { #blog1, #blog2, #blog3 ,#blog4, #blog5, #blog6, #blog7, #blog8, #blog9 ,#blog10, #blog11, #blog12, #blog13, #blog14, #blog15 ,#blog16, #blog17, #blog18, #blog19, #blog20, #blog21, #blog22, #blog23, #blog24, #blog25 ,#blog26, #blog27, #blog28, #blog29, #blog30, #blog31, #blog32, #blog33, #blog34, #blog35 ,#blog36, #blog37, #blog38, #blog39,#blog40, #blog41, #blog42, #blog43, #blog44, #blog45 ,#blog46, #blog47, #blog48, #blog49 { float:left; margin-left:2.5%; margin-right:2.5%; margin-top:2%; margin-bottom:2%; width:30%; } } i'm trying tell spread 3 blog posts across screen evenly. works when size of ipad (1024px-768px) , spreads 2 divs across screen evenly not work when ask same 3 divs. instead, pushes 3rd div ne

javascript - Issue creating side-by-side slideshows with jQuery -

i'm trying create site 2 slideshows. i've tweaked , re-tweaked js , jquery numerous times. 1 slideshow works , other cycles between 1 picture, other times both work out of sync, or fadein doesn't seem applied second slideshow, or in variations 1 slideshow stays frozen on initial image , remains static. anyway, created js fiddle (link @ bottom) , apparently code @ least free of typos. js below, rest on js fiddle. appreciated. $(document).ready(function () { $(".slider #1").fadein(1000); $(".slider #1").delay(2000).fadeout(1000); var sc = $(".slider img").size(); var count = 2; setinterval(function () { $(".slider #" + count).fadein(1000); $(".slider #" + count).delay(2000).fadeout(1000); if (count === sc) { count = 1; } else { count++; } }, 3500); $(".slidertwo #7").fadein(1000); $(".slidertwo #7"

OpenMP 4.0 task dependencies of a pointer (OmpSs style) -

i want specify #pragma omp task depend(...) clause on variable reference through pointer. possible in ompss , looks like: #pragma omp task in(*var1) out(*var2) basically want in openmp 4.0, following code: #pragma omp task depend(in: *var1) depend(out: *var2) produces following error : error: expected identifier before ‘*’ token #pragma omp task depend(in: *var1) depend(out: *var2) how can done in openmp 4.0? as per hristo iliev 's comment , correct workaround consider pointers arrays of size 1 : #pragma omp task depend(in: var1[:1]) depend(out: var2[:1]) the array section syntax arr[lower bound : length] allowed in depend pragmas sets lower bound 0 if omitted, , length array size if omitted (which not permitted pointer types).

c++ - PostActive visibility of class methods -

i have here abstract base class called base_class defined follows: class base_class { public: virtual ~base_class() = 0 {} virtual size_t area() const = 0; protected: base_class() {} }; one derived class it: template <typename t> class : public base_class { public: a(); ~a(); size_t area() const; void display(); (...) etc code }; and class still derived it: template <typename t> class b : public base_class { public: b(); ~b(); size_t area() const; void set(); (...) etc code }; than have instantiation , function call: base_class *p = new a<int>; p->display(); delete p; p = new b<float>; p->set(); (...) code as might have observed, pointer p won't "see" display , set methods. the question is: when using pointers of type base_class , there chance of letting derived object call derived methods defined in class points to? being

version control - Best practice: Want to partially pull commits with git -

i'm in charge of department webserver, has lot of small, one-page modules (most of them display dynamically-generated reports), , larger ones consist of 5-20 different html pages. of done in perl, few java helpers here , there. there 2 servers: production one, , dev server, , it's unlikely third ever added. department wants quick turnaround times, when comes in office asking "can produce report how many foos in bar on last 12 months", want web page in production after hour or 2. don't have complicated build-and-deploy process - generally, build page on dev server, test it, git commit , git push on dev server, , git pull on production. works everybody. now problem is, when work on bigger project, want use git changes, if don't want make them live yet. , @ same time, want able interrupt bigger project, small task, commit-push-pull small task, , omit big-project file pull. example, git commit -m "first attempt, not finished yet" bigproject/

Elasticsearch term filter not working? -

i'm trying following term filter { "query": { "term": { "name": "terry harvey" } } } and i'm getting 0 hits { took: 3 timed_out: false _shards: { total: 5 successful: 5 failed: 0 } hits: { total: 0 max_score: 0 hits: [ ] } } when used "match filter" instead "term filter", 48 hits. what doing wrong? =( thanks! term queries , filters not analyzed, meaning find exact matches. on other hand, match queries analyzed , name field being analyzed well. more info here .

version control - SVN load dump to exact folder -

have standard subversion layout 1 branch : repo_1 repo_root |-branches |-branch_one |-tags |-trunk and second repository, repo_2 repo_root |-branches |-tags |-trunk |-folder1 i want export repo_2/trunk/folder1 content repo_1/branches/branch_one/folder1 i'm making folder dump : svnrdump dump svn://mysvnserver/repo_2/trunk/folder1 > folder1.dump then loading repo_1 : svnadmin load repo_1 --parent-dir branches/branch_one < folder1.dump and getting following repo_1 structure : repo_root |-branches |-branch_one |-trunk |-folder1 |-tags |-trunk getting trunk folder don't need there. there way plug in "folder1" directly "branch_one" ? re-read carefully , fully filtering repository history in svn book, pay special attention on warnings you forgot, dump-file holds relative paths included in dump nodes inside file , --parent-dir change starting mount-point of mentioned in dump n

c# - Why is my ASP.NET site acting single threaded? -

i have asp.net site running in iis i've noticed seems run slow if 1 page slow, set test see if running if single thread (i.e. if 1 page request running, others must wait). created simple page (no master page, has default aspx code except added literal dump debug code into) code read current time, sleep 10 seconds, , exit, so: protected void page_load(object sender, eventargs e) { datetime = datetime.now; system.threading.thread.sleep(10000); literal1.text = now.toshortdatestring() + " " + now.toshorttimestring() + " " + now.second + ":" + now.millisecond; } i open page in 2 different tabs @ same time. timestamp on each tab 10 seconds apart, seems me mean second page request blocked , waits until first 1 completes before running. i tried commenting out http modules in web.config , disabling code in global.asax, still see issue. this sounds session state issue. access asp.net session state exclusive per sessio

django - Get an attribute's class from its name in Python? -

how can class attribute's type in python same way in java code? field f = classname.class.getdeclaredfield("attr_name"); class<?> ftype = f.gettype(); with c = classname() c.__dict__ i can attributes name , values, not types. more specifically, using django, if have 2 classes, poll , choice, defined follow class poll(models.model): question = models.charfield(max_length=200) pub_date = models.datetimefield('date published') class choice(models.model): poll = models.foreignkey(poll) choice_text = models.charfield(max_length=200) votes = models.integerfield(default=0) how can know if class has models.foreignkey attribute's type , other class points? i need output like: # attribute poll in class choice foreignkey type # , points poll model choice.poll -> poll to class name of related model, use rel.to : print choice.poll.field.rel.to.__name__ # prints 'poll' or, way: field = choice._met

prestashop 1.6 - Disable quick view in product list Prestashop1.6 -

what correct way disable quick view in product in prestashop 1.6 {if isset($quick_view) && $quick_view} <a class="quick-view" href="{$product.link|escape:'html':'utf-8'}" rel="{$product.link|escape:'html':'utf-8'}" title="{l s='quick view'}"> <span>{l s='quick view'}</span> </a> {/if} isset($quick_view) set? it in prestashop back-office -> modules -> modules -> theme configurator -> display quick view window on homepage , category pages

Why this drop downlist in jsp is not running ? ( dropdownlist using loop in jsp ) -

i want drop down list in don't want write down every option line line. in case option year. getting current year , trying make options of list year 1990 current year using loop. not wroking...do have write line line option codes ? have run code on jsp page. you can see jsp code here : <select name = "year_select"> <% int current_year = calendar.getinstance().get(calendar.year); for(int year = 1990; year<=current_year; year++) { %> <option> <% year %> </option> <% } %> </select> use javaserver pages standard tag library instead of scriptlet in 21st century more easy use , less error prone . sample code: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <jsp:usebean id="today" class="java.util.date"

actionscript 3 - 1000 to 1k, 1000000 to 1m etc. number abbreviation -

how can have 1000 convert 1k or 1200 1.2k? there's other solution other programming language can't figure out how make work as3. or there shorter way rather if number > 1000 make 1k? couldn't this var numink = bignumber/1000 + "k"; maybe throw in math.round or other checks avoid ridiculous numbers 3.3333333k

Yii: return a variable from model to form with Ajax -

how change model send varibale model form ajax? want can happen in model in ( public function comp_group ) connect form. want model return $maxid _form.php this _form.php <?php /* @var $this textcontroller */ /* @var $model text */ /* @var $form cactiveform */ ?> <div class="form"> <?php $form=$this->beginwidget('cactiveform', array( 'id'=>'text-form', // please note: when enable ajax validation, make sure corresponding // controller action handling ajax validation correctly. // there call performajaxvalidation() commented in generated controller code. // see class documentation of cactiveform details on this. 'enableajaxvalidation'=>true, 'focus'=>array($model,'group'), // 'clientoptions'=>array( // 'validateonchange'=>true, // default. validate when input changes // 'validateontype'=>'tru