Posts

Showing posts from May, 2010

performance - Export large amount of data in JAVA EE Application -

i working on search based java ee application, simple search engine there, 1 page allows user search content , pagination move next set of result.now want provide functionality exporting data in text file problem when there large data exported consumes 100mb of jvm memory. java ee experts please advice ? i had here not helpful me you saving whole data in kind of collection , serializing text file. - have noticed - might work small amounts of data application on knees when amount of data large. in case not way of doing because never how data query return. you should stream results of query output, i.e. write each query result write aftre fetching it, no need temporarly saving it. might use implementation of outputstream. if sending file servlet might want write directly outputstream of servlet after setting right content type.

JAVA ERROR .need suggestion in form of comments or codes if possible pls, -

as newbie.i have tried code..pls suggeesst problem.. getting error.pls me solve problem.. import java.util.scanner; import java.io.*; package calculator; public class calc { public static void main(string[] args) { } private int valuea; private int valueb; private string operator; private char operatora; public int getvaluea() { return valuea; } public int getvalueb() { return valueb; } { scanner keyboard = new scanner(system.in); system.out.println("enter problem."); { valuea = keyboard.nextint(); valueb = keyboard.nextint(); operator = keyboard.next(); operatora = operator.charat(0); int add = valuea + valueb; int minus = valuea - valueb; int multiply = valuea * valueb; int divide = valuea / v...

Android "Unknown Source" Setting error for API > 17 -

i have confusing problem, if make change in anywhere, @ "global.getint" part (last line), there error "call requires api level 17 (current min 4): android.provider.settings.global#getint" after making project-> clean, red error disappearing itself. error comes why? public void buton2(view view) throws settingnotfoundexception{ boolean isnonplayappallowed = false; { if (build.version.sdk_int < 5) { isnonplayappallowed = settings.system.getint(getcontentresolver(), settings.system.install_non_market_apps) == 1; } else if (build.version.sdk_int < 17) { isnonplayappallowed = settings.secure.getint(getcontentresolver(), settings.secure.install_non_market_apps) == 1; } else { isnonplayappallowed = settings.global.getint(getcontentresolver(), settings.global.install_non_market_apps) == 1; } thanks! call requires api level 17 (current min 4): android.pr...

c# - Pass a method as a parameter to another method -

i having method called loaddata gets data database , fills datagridview . i using stopwatch measure how long method takes finish it's job below : private void btnloaddata_click(object sender, eventargs e) { var sw = new system.diagnostics.stopwatch(); sw.start(); loaddata (); sw.stop(); showtakentime(sw.elapsedmilliseconds); } i want can following : private void measuretime(method m) { var sw = new system.diagnostics.stopwatch(); sw.start(); m.invoke(); sw.stop(); showtakentime(sw.elapsedmilliseconds); } so can pass loaddata method , rest me. measuretime(loaddata()); how can that? for method without parameters , returning void, can use action : private void measuretime(action m) { var sw = new system.diagnostics.stopwatch(); sw.start(); m(); sw.stop(); showtakentime(sw.elapsedmilliseconds); } if have parameters or return type, use func

html - How to insert text exactly after progressbar -

i have jquery progress bar, need insert text after progress bar. text comes under progress bar. please let me know how solve this. have tried using: <div id="progressbar" style="width:150px;height:25px;"></div><div>lesson 2</div> you can use display:inline-block html: <div id="progressbar" style="width:150px;height:25px;"></div> <div id="text">lesson2</div> css: #progressbar{ background-color:red; display: inline-block; } #text{ display: inline-block; } demo

SQL - not exists -

i couldnt find clear answer questions, should simple one. trying computers dont have word installed. query seems giving me wrong data. ideas? thanks! select distinct name dbo.vcomputer v name not in ( select name dbo.vcomputer (dbo.vcomputer.installedsoftware n'%word%'))) try this with not exists select name dbo.vcomputer v not exists ( select name dbo.vcomputer s s.installedsoftware n'%word%' ) with not in select name dbo.vcomputer v name not in (select name dbo.vcomputer s s.installedsoftware n'%word%' );

python 2.7 - matplotlib detect object upon mouse event -

is there way detect matplotlib object mouse focused on ? piece of code illustrates want self.canvas.mpl_connect("motion_notify_event", self.on_focus) def on_focus(self, event): # mouse position in figure figpos = (event.x,event.y) # mouse position in axes if focusing on axes axespos = event.xdata, event.ydata # axes instance if mouse focusing on axes axes = event.inaxes # object (any matplotlib object, text, box, ...) mouse focused on obj = event.?????? thanks try axes.hitlist : import matplotlib.pyplot plt fig = plt.figure() ax = fig.add_subplot(111) ax.plot(range(10),range(10)) def on_focus(event): print ax.hitlist(event) fig.canvas.mpl_connect("motion_notify_event", on_focus) plt.show() but if want highlight can use built-in: fig.canvas.mpl_connect("motion_notify_event",fig.canvas.onhilite)

d3.js - dc.js with node.js server side -

i want rendering dccharts on server node.js. have example d3.js , node.js. code doesnt work. im beginner node.js, yoe have idea ? the code d3.js node.js: example and here try dc.js , node.js: var d3 = require('d3') , dc = require('dc') , jsdom = require('jsdom') , fs = require('fs') , htmlstub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>' jsdom.env({ features : { queryselector : true } , html : htmlstub , done : function(errors, window) { // callback function pre-renders dataviz inside html document, export result static file var el = window.document.queryselector('#dataviz-container') , body = window.document.queryselector('body') var data = [ {date: "12/27/2012", http_404: 2, http_200: 190, http_302: 100}, {date: "12/28/2012", http_40...

c++ - Hide a folder from a QFileSystemModel -

i know how hide specific folder in treeview qfilesystemmodel . i know can filter folders show files using setfilter don't know how filter folder. i want display folders except one. know name of folder can choose name. does know how hide/remove folder list please? the filters can use wildcards, wildcards optional. you're free use filters filter out non-wildcard name. qstringlist filters; filters << "*.badext" << "foldername"; model->setnamefilters(filters); if want tighter control on - example, filter out folder given name, , not file given name, need implement qsortfilterproxymodel .

unit testing - Failing in Code coverage Test with a simple class constructor -

Image
i have class: public class sourceserverprovider : isourceserverprovider { private readonly isourceserver _sourceserver; public sourceserverprovider() :this(new sourceserver()) { } public sourceserverprovider(isourceserver sourceserver) { _sourceserver = sourceserver; } } ms code coverage test complaints block: public sourceserverprovider() :this(new sourceserver()) { } i don't know how write unit test above block. please advise.. i tested followig code: public class sourceserverprovider : isourceserverprovider { private readonly isourceserver _sourceserver; public sourceserverprovider() : this(new sourceserver()) { } public sourceserverprovider(isourceserver sourceserver) { _sourceserver = sourceserver; } } public interface isourceserver { } public class sourceserver : isourceserver { } public interface isourceserverprovider { } and wrote test ...

javascript - AJAX request not working on remote host -

i've got ajax request pulls data form , posts api. weird thing works fine on localhost fails silently when upload remote server. , mean silently: response code blank, there's nothing in logs. i've checked on firefox , chrome. jquery loaded, function firing properly. code below: function send() { console.log("preparing"); var beacon = { beaconid: $("#beaconid").val(), name:$("#beaconname").val(), campaignid:$("#campaignid").val(), clientid:$("#clientid").val() } console.log("payload:"); console.log(beacon); $.ajax({ type: 'post', url: '../beaconapi/index.php/createbeacon', data: json.stringify(beacon), contenttype: "application/json; charset=utf-8", traditional: true, success: function (response) { console.log("done:"); console.log(response); ...

charts - web2py-how to convert a list object to a 2D array or render it in google.visualization.arrayToDataTable -

i can't iterate through list object ardata = [] has, ['yesterday', 42, 49], ['today', 50, 67], ['tommorro', 57, 63]...] display chart. <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('string','day'); data.addcolumn('number','positive'); data.addcolumn('number','negative'); data.addrows([{{=ardata}}] );... </script> i tried this function drawchart() { var data = google.visualization.arraytodatatable( {{for row in ardata:}} {{ardata[i]}} {{pass}} ); and var data = google.visualization.arraytodatatable({{=arda...

Python read Linux memory process error (/proc/$pid/mem) -

i have following code tested on linux distros (debian, linux mint...) , working, under centos error run root: #!/usr/bin/env python import re maps_file = open("/proc/18396/maps", 'r') mem_file = open("/proc/18396/mem", 'r', 0) line in maps_file.readlines(): # each mapped region m = re.match(r'([0-9a-fa-f]+)-([0-9a-fa-f]+) ([-r])', line) if m.group(3) == 'r': # if readable region start = int(m.group(1), 16) end = int(m.group(2), 16) mem_file.seek(start) # seek region start chunk = mem_file.read(end - start) # read region contents print chunk, # dump contents standard output maps_file.close() mem_file.close() the script reads process' memory , dumps readable region. under centos 5.4 x64 following error: traceback (most recent call last): file "./mem.py", line 11, in ? chunk = mem_file.read(end - start) # read region contents ioerror: [errno 3] no such pr...

linux - I have directories named pack1 - pack255. What command could I use to remove pack1-55? -

something >rm pack*{1,2,3,4,??} , remove last 5 in list format? new this, still getting grips syntax! try this: $ echo rm -rf pack{1..55} rm -rf pack1 pack2 pack3 pack4... if works, can remove echo : $ rm -rf pack{1..55} if doesn't, may have set braceexpand : $ set -o braceexpand then try again. don't forget, if you're removing directories, need -r recurse parameter of rm command.

Trying to find networking metrics with R -

i have created directed network in r. have find average degree, think have, diameter , maximum/minimum clustering. diameter longest of shortest distances between 2 nodes. if makes sense anyone, please point me in right direction. have have coded below far. library(igraph) ghw <- graph.formula(1-+4:5:9:12:14, 2-+11:16:17, 3-+4:5:7, 4-+1:3:6:7:8, 5-+1:3:6:7, 6-+4:5:8, 7-+3:4:5:8:13, 8-+4:6:7, 9-+10:12:14:15, 10-+9:12:14, 11-+2:16:17, 12-+1:9:10:14, 13-+7:15:18, 14-+1:9:10:12, 15-+13:16:18, 16-+2:11:15:17:18, 17-+2:11:16:18, 18-+13:15:16:17) plot(ghw) get.adjacency(ghw) total number of directed edges numdeg <- ecount(ghw) average number of edges per node avgdeg <- numdeg / 18 how looking @ documentation? diameter(ghw) i not sure mean maximum/minimum clustering, maybe this: range(transitivity(ghw, type="local")) btw. average nu...

c# - How to Create the Left Join by using the group by data -

Image
i have 3 table 1 " allowance " ," balance " , " timeoffrequests " in these 3 table common columns employeeid , timeofftypeid , need requested hours of 1 leave type grouping thier timeofftypeid , employeeid table " timeoffrequests " , , got " timeoffhours ". wrote code like var query = (from tr in timeoffrequests tr.employeeid == 9 group tr new { tr.employeeid, tr.timeofftypeid } res select new { employeeid = res.key.employeeid, timeofftypeid = res.key.timeofftypeid, totalhours = res.sum(x => x.timeoffhours) }).asenumerable(); now need join these results first table , have employees, , timeofftypes userallowance , corresponding timeoffhours grouped table. getting left joined query wrote below. var requestresult = (from ua in userallowances join ub in userbalances on ua.employeei...

osx - Enable mouse scroll in Emacs running in the terminal -

when try scroll when have emacs running inside terminal whole terminal scrolls instead of buffer in emacs. is possible change this? i'm using emacs 24.3.1 on osx 10.9.1 i've tried m-x xterm-mouse-mode and having (require 'mouse) (xterm-mouse-mode t) (mouse-wheel-mode t) in .emacs file, neither works. this 1 specific apple's default terminal app. can: install simbl , mouseterm use iterm2

xml parsing - java.net.MalformedURLException: no protocol with javax.xml.stream.XMLStreamException while using JAXB -

i using jaxb unmarshal xml document. while parsing xml throwing malformedurlexception wrapped xmlstreamexception. understand while creating xmlstreamreader object throwing exception. suggestions please? the code snippet using: xmlinputfactory xif = xmlinputfactory.newfactory(); xmlresolver resolver = new xmlresolver(); //to capture systemid, base uri etc. xif.setxmlresolver(resolver); //throws malformedurlexception while processing below line xmlstreamreader xsr = xif.createxmlstreamreader(new streamsource(filetoprocess)); jaxbcontext jaxbcontext = jaxbcontext.newinstance(mypackage.myclassname.class); here exception trace: class javax.xml.stream.xmlstreamexception javax.xml.stream.xmlstreamexception: java.net.malformedurlexception: no protocol: [xml_filepath/xml_file_name] filetoprocess string contains absolute path, /home/project/input/myproject.xml run time jdk 1.7. signature/protocol missing? thanks, bhaskar ...

javascript - How can I create a directive that adds ng-class and ng-disabled on the target element based on a condition? -

i have following code: app.directive "ngdisableonvar", ($compile) -> restrict: "a" terminal: true priority: 1000 replace:false scope: {} compile: compile = (element, attrs) -> cattr = attrs["ngdisableonvar"] element.attr("ng-class", "{'disabled': !#{cattr}}") element.attr("ng-disabled", "!#{cattr}") element.removeattr("ng-disable-on-var") pre: prelink = (scope, ielement, iattrs, controller) -> post: postlink = (scope, ielement, iattrs, controller) -> $compile(ielement)(scope) i tried base code on answer given here . basically, i'd have following: <input ngdisableonvar="somescopevariable> and have replaced following: <input ng-class="{'disabled': !somescopevariable}" ng-disabled="!somescopevariable"> something wrong, cause though have them applied element, they're disabled, thou...

html - How do I make my navigation bar remain on top of page while scrolling? -

here html code <div id="header" class="grid_12"> <h6>dchost - brought <a href="http://www.dt.co.uk" target="_blank"> dataconnectivity.co.uk </a></h6> <ul> <li>home</li> <li>hosting</li> <li>domain names</li> <li>lates news</li> <li>about us</li> <li>contact us</li> </ul> </div> <!-- ends header grid 12 --> css #header { color: #848484; height: 70px; width: 100%; font-size: small; font-style: oblique; text-align: center; background: #333333;} #header h6 { max-height: 3px; font-size: 10px; text-align:left; } #header li { font-weight: 800; color: #ffffff; font-style: normal; display: inline} i nav bar remain fixed on top of page. however, every time change position fixed, bar disappe...

angularjs - Animating adding/removing items with ng-repeat -

i want slide-up/slide-down items in <ul> added , removed. i've followed angular docs here , , trying use simple js-hook based (rather css-hook based) solution, uses angular animation: app.animation('.slide', function () { return { enter: function (element, done) { console.log('enter'); element.slidedown(200, done); }, move: function(element, done) { console.log('move'); element.slideup(200, done); }, leave: function(element, done) { console.log('leave'); element.slideup(200, done); } }; }); but, doesn't work on slide up, on slide down. i've recreated plunkr here: http://plnkr.co/edit/9x0apgxkbqmbkbqmmy6z?p=preview any ideas? slidedown works hidden item , slideup opposite of it. so before slidedown have hide first element.hide().slidedown(200, done); check updated plunker

How to explicitly write a Selenium WebDriver screenshot to a directory in python -

i working on win7 pycharm3. have functional test 'y1.py' have exported selenium ide. contains: class y1(unittest.testcase): def setup(self): self.driver = webdriver.firefox() self.driver.implicitly_wait(30) self.base_url = "https://www.yahoo.com/" self.verificationerrors = [] self.accept_next_alert = true def test_y1(self): driver = self.driver driver.get(self.base_url) driver.find_element_by_link_text("weather").click() driver.get_screenshot_as_file('foo.png') def teardown(self): self.driver.quit() self.assertequal([], self.verificationerrors) if __name__ == "__main__": unittest.main() when run script pycharm manage.py tool realized screenshots being saved pycharm 3.0.1\jre\jre\bin" also, reason specifying path explicitly not work : (driver.get_screenshot_as_file('c/foo1.png') ). i've tried var...

javascript - AngularJS: How to debug the 'App Already Bootstrapped with this Element' error -

in angularjs app i'm getting follwing error when loading site: uncaught error: [ng:btstrpd] app bootstrapped element '<html lang="en" ng-app="app" class="ng-scope">' i have ng-app set once (in html element in _layout.cshtml (asp.net mvc)) , don't use angular.bootstrap issue mentioned here should not apply. how can debug issue (using f12, firebug, chrome...)? use following process: download unminified angular source switch script tag reference unminified angular source or setup sourcemap minified code unminified set breakpoint within angular.bootstrap method definition use call stack trace source(s) on call(s) references use source map - firefox developer tools | mdn f12 devtools guide: debugger | source maps - microsoft edge development map preprocessed code source code  |  web  |  google developers chromium issue 611328 - failed parse sourcemap evanw/node-source-map-support: adds source map suppo...

Have Swagger to substitute servicestack meta -

i wondering if it's possible have swagger serve pages @ place of ss metadata page... i'm asking since ss metadata quite usefull when you've lot of services as far i've seen can remove feature on ss configuration, disable httphandler don't know how go further thanks so remove metadatafeature in apphost configure method: setconfig(new hostconfig { enablefeatures = feature.all.remove(feature.metadata) }); then create simple metadata service, redirects swagger. [route("/metadata/{cmds*}", "get")] public class redirecttoswaggerrequest : ireturnvoid { public string cmds { get; set; } } [restrict(visiblelocalhostonly = true)] public class metadataservice : service { public void get(redirecttoswaggerrequest request) { base.response.redirect("/swagger-ui"); } } note: {cmds*} in route above catch requests /metadata , /metadata/something & /metadata/somethingelse etc. then when requ...

java - Intellij IDEA - IvyCache does not recognize dependencies -

intellij ultimate - 12.1 jdk 1.7.0_10 (sun/oracle) ivyidea - 1.0.8 they seem latest version of plugins/ides. when import new project eclipse, idea not recognize libraries (eclipse nicely detected , added these libraries classpath). i added ivyidea facet , supplied ivy.xml, ivy-settings.xml , build.properties did tools -> resolve modules prints me following (when enable ivyidea logging @ info level) --------------------------------------------------------------------- | | modules || artifacts | | conf | number| search|dwnlded|evicted|| number|dwnlded| --------------------------------------------------------------------- | runtime | 55 | 49 | 0 | 8 || 157 | 0 | | war-runtime | 47 | 41 | 0 | 7 || 140 | 0 | | build-war | 47 | 41 | 0 | 7 || 140 | 0 | | build-main | 47 | 41 | 0 | 7 || 140 | 0 | | build-tests-unit | ...

python - How to uninstall manually openerp module -

i have installed module on openerp v7 uninstall. using interface fails, error during uninstall process. is there 'manual' way uninstall module ? sufficient remove module folder under addons/ or there other things do, make in cleanest way ? here error when try uninstall module through interface: client traceback (most recent call last): file "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725- py2.7.egg/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, **self.params) file "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725- py2.7.egg/openerp/addons/web/controllers/main.py", line 1132, in call_button action = self._call_kw(req, model, method, args, {}) file "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20131016_232725- py2.7.egg/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(mode...

How to access (edit and read) a shared with me google doc using javascript -

i have been assigned task in inner form updating shared doc (whose owner friend) on google drive using javascript. but clueless on this, know might have use google app scripts, can use google app scripts this? options , how can use app script javascript? thank , apologies if question sounded lame... you have 2 options. need choose between them, research understand each one. 2 options mutually exclusive, once choose one, should ignore other, otherwise you'll confuse :-) use google apps script. server-side javascript , decribed here https://developers.google.com/apps-script/ , google drive aspect described here https://developers.google.com/apps-script/reference/drive/ use drive sdk. since said javascript, using client-side javascript. top level doc https://developers.google.com/drive/ , plus need understand oauth https://developers.google.com/accounts/docs/oauth2useragent remember, doing research, make sure reading option 1 or option 2.

android - What's the easiest way to prevent the substitution of UI components with the system-wide ones? -

i designed application run on pretty, nice , clean holo theme (the google default), , when installed on brother's device, had unpleasant surprise of finding out standard ui components (spinner, progress bars, horizontal progress bars, etc...) overridden kind of factory pre-installed components. now, components when applied on system-wide ui, suck in app. my brother's phone kind of chinese clone of s4, guess same happen other non-google devices. the solution comes mind create, every component don't want overridden, custom one, copying xml android source code. don't know how that, seems lot of trouble compared want reach. what's simplest way run app holo components in every device? edit in regard answers had in app have minsdkversion set 11. theme set in manifest @ application tag , "apptheme", that's configured in file <resources> <!-- base application theme. --> <style name="apptheme" parent="@s...

google maps api 3 - geoxml3 kml polygon tooltip on mouseover instead of click -

i need working example or solution hovering kml polygon , showing info balloon - instead of doing on click. doable? for example, on map, instead of showing info balloon on click, doing on mouse over: http://www.geocodezip.com/geoxml3_test/geoxml3_test_polygon.html obs.: kml file has additional info inside placemark => extendeddata (if helps in way). tks :) here example uses infobubble "tooltip" (only handles polygons): <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>geoxml3 example polygon mouseover text</title> <style> html{height:100%;} body{height:100%;margin:0px;font-family: helvetica,arial;} </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"...

sql server 2008 - Create a single Query By Form for multiple tables -

i want create query form access database has linked tables sql server database. database has 30 tables , want create single form query data tables. unable figure out how started. in form design, @ property sheet , make sure "form" selected in dropdown. - @ "data" tab, , "record source" area. click in there , click "..." button. should able choose multiple tables , define joins, , use form values part of criteria.

ios - MPMoviePlayerController in UIView -

Image
i creating ios ipad application that, among other things, utilizes mpmovieplayercontroller on 1 of screens, underneath view, named "commandmessageview." here relevant parts of .h file: @interface movieviewcontroller : uiviewcontroller @property (strong, nonatomic) mpmovieplayercontroller *movieplayer; @property (strong, nonatomic) iboutlet uiview *movieview; @property (strong, nonatomic) iboutlet uiview *commandmessageview; and relevant parts of .m file: @implementation movieviewcontroller @synthesize movieview; @synthesize movieplayer; @synthesize commandmessageview; - (void)viewdidload { [super viewdidload]; // video setup nsurl *currentvideourl = [nsurl urlwithstring: self.currentvideo]; movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:currentvideourl]; movieplayer.controlstyle = mpmoviecontrolstylenone; movieplayer.scalingmode = mpmoviescalingmodeaspectfit; [movieplayer.view setframe: movieview.bounds]...

sql server - SQL: Use a predefined list in the where clause -

here example of trying do: def famlist = selection.getunique('family_code') ... “””... , testedwaferpass.family_code in $famlist “””... famlist list of objects ‘selection’ change every run, list changing. i want return columns sql search row found in list have created. i realize supposed like: in ('foo','bar') but no matter do, list not that. have turn list string? ('\${famlist.join("', '")}') ive tried above, idk. wasn’t working me. thought throw in there. love suggestions. thanks. i willing bet there groovier way implement shown below - works. here's important part of sample script. namelist original contains string names. need quote each entry in list, string [ , ] tostring result. tried passing prepared statement need dynamically create string ? each element in list. quick-hack doesn't use prepared statement. def namelist = ['reports', 'customer', '...

php - why do I get preg_replace() error when submitting a post form in Laravel? -

i have built simple application laravel 4. have scaffolding setup adding posts seems working fine. have setup stapler , image uploading package. when setup use single image uploads pretty , works charm. looked @ docs here it states can multiple uploads went doing explained in docs. here coded pages: post.php model: <?php class post extends eloquent { use codesleeve\stapler\stapler; protected $guarded = array(); // user has many profile pictures. public function galleryimages(){ return $this->hasmany('galleryimage'); } public static $rules = array( 'title' => 'required', 'body' => 'required' ); public function __construct(array $attributes = array()) { $this->hasattachedfile('picture', [ 'styles' => [ 'thumbnail' => '100x100', 'large' => '300x300' ], // ...

sql server - Bulk insert when using IDENTITY -

this table structure. create table emp (empid int identity(101, 1), empname varchar(20), salary decimal(10,2), created_date datetime default(getdate()) ); now have records 'ramesh',10000 'arun',20000 in .txt file. i need bulk insert records table. please guide me write bulk insert query. basically, first need staging table has structure exactly matches .txt file: create table emp_staging (empname varchar(20), salary decimal(10,2) ); then, bulk insert data .txt file staging table , check: bulk insert dbo.emp_staging 'd:\temp\emps.txt' ( fieldterminator =',', rowterminator ='\n' ); select * dbo.emp_staging once that's done - can insert data staging table actual table using insert .. select ... : insert dbo.emp ( empname, salary ) select empname, salary dbo.emp_staging select * dbo.emp

ios - UICollisionBehavior memory leak -

i've run believe bug uicollisionbehavior in uikit . adding them array of uiviews leads memory leak. put simple demo project creates 10 animations of group of views falling gravity applied, , collision enclosing view's bounds. (code below.) leaks template in instruments reports 9 64-byte leak each run. - (void)doanimation { self.animatebutton.enabled = no; cgfloat left = 12.0f; nsmutablearray *items = [nsmutablearray new]; // set array of views , add them superview while (left < self.view.bounds.size.width - 12.0f) { uiview *view = [[uiview alloc] initwithframe:cgrectmake(left, 70, 32, 32)]; left += 34.0f; [self.view addsubview:view]; view.backgroundcolor = [uicolor graycolor]; [items addobject:view]; } // create gravitybehavior , initialize views array uigravitybehavior *gravity = [[uigravitybehavior alloc] initwithitems:items]; [self.animator addbehavior:gravity]; // create collision...

html - Edit external stylesheet with jquery -

i trying create web design template , edit stylesheet based on radio button selection using query. please see attached fiddle http://jsfiddle.net/2mkjv/1/ what i'm trying achieve is, if select blue, find external stylesheet , class .container , change background blue. if manually edit stylesheet after, changes saved, possible? it's basic html: <div class="container"> <input type="radio" name="colours" value="female" checked> red <input type="radio" name="colours" value="female">blue </div> & css * { padding:0; margin:0; } html, body { width:100%; height:100%; } .container { width:100%; height:100%; background:red; } simple answer: can't jquery alone. longer answer: jquery extension of javascript, nature, run on client side in browser. thus, can't directly change files stored on server. can, however, use jquery's ajax feature access server...

c++ - Is it possible to get notified when the screensaver starts or stops under linux -

i want notified when screensaver (probably xscreensaver) starts or stops. there solution gtk, glib, gio or other library me under linux? take @ activechanged signal in org.freedesktop.screensaver d-bus interface. it's supported current gnome , kde @ least (if want support older gnome releases may have keep eye on org.gnome.screensaver well). unfortunately spec seems have disappeared -- or ever in email form. take d-feet or see available api (it's not complex).

jquery - Showing loading gif only till certain amount of images are loaded -

i have site fullscreen background carousel , loading gif on window load. problem depending on site, have 10 40 images in carousel, means loading gif spinning way long time. i'm thinking idea display loading gif till first 5 images loaded. that, plus 10 seconds every image shown, gives enough time other images load. the problem don't know how approach solution. thoughts? here's jquery: <script type="text/javascript"> var image = new image(); image.src = 'img/loading.gif'; //<![cdata[ $(window).load(function() { // makes sure whole site loaded $('#status').fadeout(); // first fade out loading animation $('#preloader').delay(350).fadeout('slow', function(){ $( "#carousel-example-generic" ).attr('data-ride', "carousel"); }); // fade out white div covers website. $('body').delay(350).css({'overflow':'visible'}); }); //]]> </script...

oracle - Number of rows affected by SQL statement using Aqua Data Studio -

Image
i running 30 separate merge statements may or may not update records in 30 tables (1 table per merge statement). how can see how many rows each individual merge statement affected, using aqua data studio? i've been trying use sql%rowcount, haven't figured out yet. enable text results in query window. go file options results > text results , enable options suite needs. 1. display 'records affected' count. 2. display total number of affected records.

mysql - java.util.MissingResourceException: Can't find bundle for base name com.sun.org.apache.xerces.internal.impl.msg.SAXMessages, locale en_US -

i'm receiving following exception while trying deploy java app tomcat7 using java7, hibernate, mysql. java.util.missingresourceexception: can't find bundle base name com.sun.org.apache.xerces.internal.impl.msg.saxmessages, locale en_us i've spent lot of time surfing around web looking answer, have yet come one. know error means or how correct it? could shed light application looks like? if jsp - may find answer here: can’t find bundle base name xxx, locale en_us

html - adding a class to an anchor based on specific text in that anchor jquery -

new jquery , appreciate help. my markup looks this: <dl> <dt>colors</dt> <dd><a>red</a></dd> <dd><a>green</a></dd> <dd><a>blue</a></dd> </dl> let's wanted add specific class anchor text "green". how go that? thanks the :contains selector return partial matches green match green , lightgreen or darkgreen , of times choice use .filter() $('dl a').filter(function(){ return $.trim($(this).text()) == 'green' }).addclass('newclass')

c# - recreate existing cs file with changes made in .xsd -

i tried using 'xsd/dataset.xsd/classess' command in developer tool vs2012 not generate cs file . did add 3 columns dataset.xsd using designer , trying updated cs file auto generated code. encountered invalid command line arugument: 'dataset.xsd/classes' in developer tool. ![command tool result][1] building project generate classes after you've made changes in .xsd file. or believe command xsd c:\<path>\dataset.xsd /classes

c# - wp8 Application object -

i new windows phone programming , building wp8 application , access "app" object module eg: modulea = 'public partial class app : application' object lives moduleb = 'dothis.xaml' page lives i have in modulea: public partial class app : application { // .. application stuff stripped out brevity private void application_launching(object sender, launchingeventargs e) { // refresh value of istrial property when application launched determineistrial(); string uristring = "/moduleb;component/dothis.xaml"; navigationservice.navigate(new uri(uristring, urikind.relative)); } #region trial public static bool istrial { get; // setting istrial property outside not allowed private set; } private void determineistrial() { #if trial // set true if trial enabled (debug_trial configuration active) istrial = true; #else var license = new microsoft.phone.marketplace.licenseinformation(); istrial = license.istrial();...

html - I want only about half of my bubble to highlight on hover. Can only seem to highlight the whole bubble -

<div id="specials"> <h2><a href="/hot-deals/">we have hot deals unbelievable prices!</a> | <a href="/pre-owned/">we have pre-owned boats!</a></h2> <style> #specials { width:695px; float:left; padding: 0 10px; height:38px; margin:7px auto 10px 13px; background:#bad6e3; border:2px solid #005c8a; -webkit-border-radius: 12px; -moz-border-radius: 12px; border-radius: 12px; -webkit-box-shadow: 0px 0px 4px #dbdbdb; /* saf3-4, ios 4.0.2 - 4.2, android 2.3+ */ -moz-box-shadow: 0px 0px 4px #dbdbdb; /* ff3.5 - 3.6 */ box-shadow: 0px 0px 4px #dbdbdb; /* opera 10.5, ie9, ff4+, chrome 6+, ios 5 */ } #specials:hover { width:695px; float:left; padding:0 10px; height:40px; margin:...

loops - Removing sublists in a list by comparing them with an alist in Common Lisp -

this complicated, , i'm hoping there's simpler way it. i'm comparing freshly generated list of "suggested connections" social networking site against "blocked suggestions" list. first list looks this: ((12 :mutuals 8 :ranking 8)(43 :mutuals 2 :mutual-groups (2) :ranking 4) ... ) the first value user id, , plist in cdr of each sublist "reasons" why person suggested. the second list looks like: ((12 . 2) (3 . 4) (43 . 3) ...) the car user id , cdr ranking had when "blocked" user's suggestions. i want find way, each sublist in first list, compare against list of blocked suggestions. there 3 possible outcomes: there no corresponding entry => leave suggestion in list. there corresponding entry , ranking field 5 or more higher => leave suggestion in list , remove blocked suggestion index. there corresponding entry ranking same or within 5 => remove suggestion list of suggestions. my current code uses ...

c# - where clause in LINQ to Entites DataBind -

i'm trying add clause existing linq databind nothing works. clause want add checks if in table refauthsigner column isactive == 1. here's existing query: // populates authorized signer dropdownlist using (dbpsrentities10 myentities = new dbpsrentities10()) { var allsigners = refauthsigner in myentities.refauthsigners <--- clause somewhere around here?? select new { refauthsignerid = refauthsigner.refauthsignerid, refauthsignername = refauthsigner.refauthsignerfirst + " " + refauthsigner.refauthsignerlast }; ddlauthsigners.datasource = allsigners; ddlauthsigners.datavaluefield = "refauthsignerid"; ddlauthsigners.datatextfield = "refauthsignername"; ddlauthsigners.databind(); } i want add clause like: ...

angularjs - Angular order Object by properties -

i have angular app consumes json api endpoint. json data arrives so: tasks: $scope.tasks = [ {id:23, title:'foo'}, {id:448, title:'bar'} ] but sake of accessing data within angular map th objects like: $scope.tasks = { 23:{id: 23, title:'foo'}, 448:{id:23, title:'foo'} } this allows me pull out task instances , modify task instances using id only. the consequence of have lost easy orderby methods of angular, though ng-repeat continues function expected. so, question is, if want order list title or -title , how can achieved? there in angular accomplish or should roll own filter? edit so in template want this: <div ng-repeat="task in tasks | orderby:'-title'"> <span>{{ task.title }}</span> </div> so orderby filter works if code in first format doesn't work if code mapped in second format. why not write method pull out task based on given id, rather re-format respon...

ios - NSDate returns a negative NSTimeInterval -

i have following code: - (void)pointsstarteddisplaying { static dispatch_once_t oncetoken; dispatch_once(&oncetoken, ^{ dispatch_async(dispatch_get_main_queue(), ^{ self.timestarteddisplayingpoint = [nsdate date]; self.stopbutton.enabled = yes; [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(updateelapsedtime:) userinfo:nil repeats:yes]; }); }); } - (void)updateelapsedtime:(nstimer *)timer { nstimeinterval elapsedtimedisplayingpoints = [self.timestarteddisplayingpoint timeintervalsincedate:[nsdate date]]; self.elapsedtimevaluelabel.text = [nsstring stringwithformat:@"%f seconds", elapsedtimedisplayingpoints]; } however, value of elapsedtimedisplayingpoints accurate, except negative each time. why return -3, -4, -5, etc? if receiver earlier anotherdate, return value negative . case example. can use fabs() positive value.