Posts

Showing posts from September, 2012

java - Why Spring AOP is not weaving external jars at runtime? -

i have java application build upon spring 3. project has jar dependency. this dependency contains @org.aspectj.lang.annotation.aspect class (lets say, com.aspectprovider.aspects.myaspect ). there's @before advice weave method classes implements interface foo . like: @before("execution(* com.project.foo.save(..))") the foo interface can inside "project" or in jar. doesn't matter example. my project contains classes implements foo . classes want weaved, of course. my spring application context configuration file ( applicationcontext.xml ) contains line: <aop:aspectj-autoproxy /> i declare aspect bean, , inject properties: <bean id="myaspect" class="com.aspectprovider.aspects.myaspect" factory-method="aspectof" > <property name="someproperty" value="somevalue" /> </bean> trough logging can see myaspect instantiated , properties injected. method save not inter

testing - Android test application directly on device -

is there way compile apk , test directly in usb-attached device ? emulator way slow fluid development. using eclipse, make sure project debuggable, software phone installed on computer. set phone accept unknown recourses. first connect phone, start eclipse (sometimes other way round results in phone not being found) if try run application eclipse should prompt asking witch device use. click phone , presto!

jquery - edit text of custom <ul> array -

i new jquery , have question updating data within page. i have unordered list allow user manipulate. while ul starts 1 list item, allow user add objects array. have goal have user click object ul, pulls read textarea, , textarea allow user input custom string , have targeted list item's ( text() ) become custom string. now, i'm not confused how pull .text() , , pretty sure can put custom string user creates chosen list item's text attribute... the problem i'm having example: the page starts out 1 single (blank) object in array. click "add object" , original array changed hold 2 objects or 3, etc. objects added array not "appearing" jquery script. first object transfer text textarea when clicked. same goes if initialize array with, 3 objects... 3 active. i can show snippets of code if help. or if have questions, please ask , we'll go there, thanks. my testing url: http://whoneedsstandards.com/subdomains/travis/jquery.htm ... mayb

osx - Is it possible to install files on reboot on Mac? -

i'm working on mac software requires browser closed in order install. instead of asking user shutdown browser during install process, prefer complete install after user's next reboot. is there supported method installing these files after reboot? if not, there workarounds achieve same goal ( launchd, launchctl )?

c# - ClickOnce Install button leads to text -

i added new webhost posted clickonce project. in ie9 have problem if press install leads page of text instead of either downloading or installing application. not happen on our old host. setting need on new host make work? the problem haven't got mime type .application files set "application/x-ms-application" on server. see this msdn article details.

php - Problems with Codeigniter HMVC subfolders -

i have encountered issue using subfolders codeigniter + hmvc. /system/application/modules/welcome/controllers/staff/welcome.php to access have access via http://www.app.com/welcome/staff/welcome unfortunately doesn't fit rest of url structure. how can remove first welcome url url http://www.app.com/staff/welcome i have tried adding route within module: /system/application/modules/welcome/config/routes.php like: $route['staff/welcome'] = "welcome/staff/welcome"; but unfortunately no luck. adding route real codeigniter route file works feel adding code external of modules modules work misses point of adopting modularisation. i hope able help. thanks, tim this line in routes.php correct: $route['staff/welcome'] = "welcome/staff/welcome"; you can try play order of routing rules, , put rule default controller ($route['default_controller'] = "home";) @ end. have project 4 modules , works fine

python - 'The Scope Was bad or missing' error trying to use AuthSub with google health? -

i'm trying use authsub request token google health. says scope bad or missing. i've double checked, , scope looks me. i've tried replacing scope calendar, , don't error. here's code snippet next = 'http://localhost:8080/auth' # h9 scope development #scope = 'https://www.google.com/health/feeds/' scope = 'https://www.google.com/calendar/feeds/' #scope = 'https://www.google.com/h9/feeds/' url_format = 'https://www.google.com/accounts/authsubrequest?next=%s&scope=%s&secure=%d&session=%d' auth_sub_url = url_format % (next, scope, 0, 1) #auth_sub_url = service.generateauthsuburl(next, scope, secure = secure, session = session) self.response.out.write('<a href="%s">authorize access google health account</a>' % auth_sub_url) i'm not familiar google health, did googling , need register site first: https://services.google.com/fb/forms/googhealthdevelopers/ it takes week

.htaccess - redirect multiple domains to another domain except 1 directory using htaccess -

i trying redirect multiple domains single domain (which working fine) want 1 directory not redirect or change main domain url. here .htaccess code works fine until here this 1 working rewritecond %{http_host} ^http(s)?://(www.)?domain.com$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.net$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.org$ [or] rewritecond %{http_host} ^domain.info$ [or] rewritecond %{http_host} !^www.domain.info rewriterule (.*) http://www.domain.info/$1 [r=301,l] but when try stop redirect of 1 specific directory by full code rewritecond %{http_host} ^http(s)?://(www.)?domain.com$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.net$ [or] rewritecond %{http_host} ^http(s)?://(www.)?domain.org$ [or] rewritecond %{http_host} ^domain.info$ [or] rewritecond %{http_host} !^www.domain.info [or] rewritecond %{request_uri} !^/no_redi

java - annotation mapping bidirectional OneToMany/ManyToOne not fetching? -

i'm struggling understand appreciated... i have following mapping: @entity @table(name = "parent") public class parententity { ... @id @column(name = "parent_id") private long id; ... @onetomany(mappedby = "parent", fetch = fetchtype.eager) private list<childentity> children; ... } @entity @table(name = "child") public class childentity { ... @id @column(name = "child_id") private long id; ... @manytoone(fetch = fetchtype.eager) @notfound(action = notfoundaction.ignore) @joincolumn(name = "parent_id") private parententity parent; ... } in db have: parent ------ parent_id: 1 child ------ child_id: 1, parent_id: 1 however ((parent) session.get(parent.class, 1)).getchildren() returns null. can see have missing? thanks, p. edit it seems more-so session state in collection not populated in context of same session, collection populated in next sess

c# - Iqueryable as a subquery to filter another iqueryable -

i have many many relationship (sites, categories, categoriesxsite) , 2 iqueryable defined variables this: iqueryable<site> sitesquery = s in db.sites s.name.contains(siteword) select s iqueryable<sitecategorie> categoriesquery = c in db.sitecategories c.parent.id == 1 select c; i want able apply filter categories iqueryable based on sites iqueryable way can have categories filters plus filter of categories has sites containing filter, thing this: from c in categoriesquery c.sites == sitesquery select c i've made similar question before when didn't need filter categories ( here ) thanks lot, you'll want either from c in categoriesquery c.sites.any(s => sitesquery.contains(s)) select c or from c in categoriesquery c.sites.all(s => sitesquery.contains(s)) select c depending on use case.

bash - Why can't I assign random values in a loop? -

i want implement following: for (( i=1; i<=sim_users; i++)) value[$i] = $random done why dosen't work? you want value[$i]=$random you can't put space before or after equals sign.

sts springsourcetoolsuite - Small exclamation icon over my STS project icon -

i working on struts project using spring source toolsuite ide. when there complier errors or something, red x mark or yellow exclamation mark appear on icon project. but after made sure there no complier errors, got exclamation mark in project icon. project building , running , getting proper output. why there? how can find out complaining about? click window -> show view -> problems , you'll see list of errors/warnings , can take there.

c++ - Code giving SEG FAULT only when the class is being derived! -

unable find out bug in below code had written[not purpose though]. #include &lt iostream &gt #include &lt cstdlib &gt using namespace std; class base{ public: base(){cout &lt&lt "base class constructor" &lt&lt endl;} void funv() {}; ~base(){cout &lt&lt "base class destructor" &lt&lt endl;} ; }; class derived:public base{ public: char *ch; derived():ch(new char[6]()){} ~derived(){ cout &lt&lt "before" &lt&lt endl; delete [] ch; ch = null; cout &lt&lt "after" &lt&lt endl; } }; int main(){ derived * ptr = new derived; //memcpy(ptr -> ch,"ar\0",4); // works when class derived derved base , when not derived base ptr -> ch = const_cast &lt char* &gt("ar0"); // works when class der

c# - socket.BeginReceive() renders printer unresponsive -

i've been developing application automatically prints pdf files on specific network printers upon arrival , monitoring @pjl ustatus job messages. however, whenever begin application , code hits socket.beginreceive() , printer unable receive print jobs workstation means callback never called. however, if close application or socket, printer begins working again. am missing anything? blocking/non-blocking or synchronous or asynchronous sockets? public class socketdata { public socket socket; public byte[] databuffer = new byte[1024]; } public void start() { // start thread checks printer status thread = new thread(new threadstart(connectandlisten)); thread.priority = threadpriority.lowest; thread.start(); // start file listener listener = new filesystemwatcher(this.watchpath); listener.created += new filesystemeventhandler(listener_created); listener.enableraisingevents = true; } public void connectandlisten() { ipendpoint =

java - How to call additional method in enums? -

enum enum1 { big(8), huge(10) { public string getname() { return "huge"; } public string getcontry() { return "india"; }//additional method }, overwhelming(16) { public string getname() { return "overwhelming"; } }; private int ounces; public int getounes() { return ounces; } public string getname() { return "ponds"; } enum1(int ounces1) { ounces = ounces1; } } class enumasinnerclass { enum1 enuminnerclass; public static void main(string[] args) { enumasinnerclass big = new enumasinnerclass(); big.enuminnerclass = enum1.big; enumasinnerclass on = new enumasinnerclass(); over.enuminnerclass = enum1.overwhelming; enumasinnerclass huge = new enumasinnerclass(); huge.enuminnerclass = enum1

Connect / node.js - creating a simple server -

i'm trying connect / node.js work nicely , simply. have following (in coffeescript) connect = require('connect') io = require('socket.io') server = connect.createserver( connect.favicon() , connect.logger() , connect.static(__dirname + '/public') ).listen(8000) socket = io.listen(server) socket.on 'connection', (socket) -> socket.send({ hello: 'world' }) but keep getting following error: typeerror: cannot call method 'listeners' of undefined it seems server not being initialized in time socket start listening.. compare with: io = require ("socket.io") http = require('http') server = http.createserver() server.listen(8000) socket = io.listen(server) socket.on 'connection', (socket) -> socket.send({ hello: 'world' }) which work... probably because .listen() returns else. should work if rewrite code this: connect = require('connect') io = re

iphone - Do tagged images occupy memory/locations? -

i wondering if tagged images can occupy memory/locations (i'm not sure call them call them memory/locations)... the code below used find matches , removes them view when 3 or more in row/column. thing though seems if statements works once. once have been used stop finding matches. is there way of "releasing" occupied if statements or there way of doing this? for( int y=0; y<height-2; y++ ){ for( int x=0; x<width-2; x++ ){ //don't match empty squares if(grid[x][y] == nil){ continue; nslog(@"continue"); } if(x >= 2 && x <= width -2 && y >= 2 && y <= height - 2) { //check right if(grid[x+1][y].tag == grid[x][y].tag && grid[x+2][y].tag == grid[x][y].tag) { nslog(@"to right"); grid[x][y].alpha = 0; grid[x+1][y].alpha = 0; grid[x+2][y].alpha = 0; nslog(@"match right grid[x][y]

iphone - Problem with NSHTTPCookie -

i want make login application. first screen login form 2 text fields , 1 button. when pres button invoke 1 method invoke method: - (int)login { // add data post request nshttpurlresponse * response; nsstring *myrequeststring = [[nsstring alloc] initwithformat:@"userdata='%@'&passdata='%@'", username.text, password.text]; nserror * error; nsdata *myrequestdata = [nsdata datawithbytes: [myrequeststring utf8string] length: [myrequeststring length]]; nsmutableurlrequest *request; request = [[[nsmutableurlrequest alloc] initwithurl:[nsurl urlwithstring:@"http://server.com/login.php"] cachepolicy:nsurlrequestreloadignoringcachedata timeoutinterval:60] autorelease]; [request sethttpmethod: @"post"]; [request sethttpbody: myrequestdata]; [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfield:@"conte

uiinterfaceorientation - iphone for Orientation -

possible duplicate: how force screen orientation in specific view controllers? hello i want set orientation in 1 particular view how can that. andbody have example that. used -(void)onuideviceorientationdidchangenotification:(nsnotification*)notification{ uiviewcontroller *tvc = self.navigationcontroller.topviewcontroller; uideviceorientation orientation = [[ uidevice currentdevice ] orientation ]; tabbarcontroller.view.hidden = yes; // switch if need (seem multiple notifications on device) if( orientation != [[ uiapplication sharedapplication ] statusbarorientation ] ){ if( [ tvc shouldautorotatetointerfaceorientation: orientation ] ){ [ self rotateinterfacetoorientation: orientation ]; } } } but done whole application , want done in 1 screen please reply thank you on particula view controller put - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // ret

android - Eclipse: java.lang.RuntimeException: Application “org.eclipse.ui.ide.workbench” could not be found in the registry -

iam using helios eclipse (eclipse-sdk-3.6.1-win32). update helps > check of updates have updated checking all. (most of them plugin related android) after completion of updates, asked me restart eclipse. after that, when ever start eclipse shows error. shows following dialog an error has occurred. see log file d:\eclipse-sdk-3.6.1-win32\eclipse\configuration\11003434.log. that log !session 2011-05-11 12:06:34.453 ----------------------------------------------- eclipse.buildid=m20110210-1200 java.version=1.6.0_24 java.vendor=sun microsystems inc. bootloader constants: os=win32, arch=x86, ws=win32, nl=en_us command-line arguments: -os win32 -ws win32 -arch x86 !entry org.eclipse.osgi 2 0 2011-05-11 12:06:36.593 !message 1 or more bundles not resolved because following root constraints not resolved: !subentry 1 org.eclipse.osgi 2 0 2011-05-11 12:06:36.593 !entry org.eclipse.osgi 4 0 2011-05-11 12:06:36.687 !message application error !stack 1 java.lang.runtimeexception:

c# - Crystal reports does not identify System.DateTime -

i coding in c# , use crystal reports in application. have use custom query (handwritten) report use dataset.xsd . in dataset have datetime field, made type of datetime field system.datetime . in report m using parameter check date, crystal reports not identify datetime field in dataset datetime . i have set parameter value type datetime too. is there solution this?

objective c - iOS: [self.fetchedResultsController performFetch:&error]; makes my app to crash -

i have uitableviewcontroller, , want feed content of core data model. however, when fetch content app crashes. init method (i pass nsmanagedobjectcontext it). - (id)initinmanagedobjectcontext:(nsmanagedobjectcontext *)context { self = [super initwithstyle:uitableviewstyleplain]; if (self) { nsfetchrequest *request = [[nsfetchrequest alloc] init]; request.entity = [nsentitydescription entityforname:@"document" inmanagedobjectcontext:context]; request.predicate = nil; request.sortdescriptors = [nsarray arraywithobject:[nssortdescriptor sortdescriptorwithkey:@"iddoc" ascending:yes]]; /* nserror *error = nil; nsmanagedobject *retrieveddocument = [[context executefetchrequest:request error:&error] lastobject]; nslog(@"retrieveddocument %@", retrieveddocument); */ nsfetc

subquery - Very Slow MYSQL Sub Query -

guys, im more of mssql guy im working on mysql right now. iv written simple query, subquery , cant understand life of me why slow. this query: select max(timestamp), user, status checkin room_id = 'room name' , timestamp > date_sub(now() ,interval 4005 second) group user runs in 0.0034 seconds yet relatively similiar query nested, takes on 6 seconds .. select user, status checkin timestamp in (select max(timestamp) checkin room_id = 'room name' , timestamp > date_sub(now() ,interval 4005 second) group user) can please help? im stuck. the table "checkin" has 900 rows in it. room_id column indexed. cheers edit guys .. heres result of explain dependent subquery checkin ref room_id room_id 202 const 1104 using where; using temporary; using filesort look using having clause achieve same results. mysql notoriously bad @ sub-query optimization, try this: select max(timestamp) ts, user, status checkin r

objective c - How to get data directly from the mic’s ADC? -

is there way data microphone port’s analog-to-digital-converter directly? or @ least @ lower level doing coreaudio? there not. coreaudio lowest level available. should able 6ms buffer mic. try doing on android.

iphone - In UIPinchGestureRecognizer get number of fingures involed in triggering the gesture? -

in uipinchgesturerecognizer how number of fingures involed in triggering gesture? from uipinchgesturerecognizer class reference: uipinchgesturerecognizer concrete subclass of uigesturerecognizer looks pinching gestures involving 2 touches two touches. update @omz said numberoftouches method, inherited uigesturerecognizer . in uipinchgessturerecognizer return 2 or 1 (when user finishing gesture , take 1 finger screen). update 2 this gesture triggering 2 fingers said in documentation.

c# - Set DNS to 'Obtain automatically' programmatically -

using c# on .net, how set dns servers 'obtain automatically'? can set ip addresses desired values this. managementclass mclass = new managementclass("win32_networkadapterconfiguration"); managementobjectcollection mobjcol = mclass.getinstances(); foreach (managementobject mobj in mobjcol) { if ((bool)mobj["ipenabled"]) { managementbaseobject mbodns = mobj.getmethodparameters("setdnsserversearchorder"); if (mbodns != null) { //assume x.x.x.x , x.x.x.x ips. string[] sips = { "x.x.x.x", "x.x.x.x" }; mbodns["dnsserversearchorder"] = sips; mobj.invokemethod("setdnsserversearchorder", mbodns, null); } } } i've tried setting both ips null, sips = { null, null }; , ends not changing settings @ all. try setting dnsserversearchorder null instead of using array of null strings. managementclass mclass = new managementclass("win32_networ

c# - Quicksort of 3D array based on another 1D array -

i have 3d array containg values , want sort based on values listed in 1d array. example, the 3d array has values of: 1 2 3 4 5 6 7 8 9 and 1d array has values of: 20 11 12 so if considered 3d array related 1d array (rows related each other), result want in 3d array is: 4 5 6 7 8 9 1 2 3 i have searched quicksort algorithm, couldn't find want. you can implement "argument quicksort" returns indices sort array quite easily. here implementation in c++: #include <algorithm> template <class indexcontainer, class datacontainer> void arg_qsort(indexcontainer& indices, const datacontainer& data, int left, int right) { int = left; int j = right; int pivot = left + (right - left) / 2; while (i <= j) { while (data[indices[i]] < data[indices[pivot]]) ++i; while (data[indices[j]] > data[indices[pivot]]) --j; if (i <= j) { std::swap(i

ios - how i may know if UIPickerView is spinning now or not -

help me please. how may know if uipickerview spinning or not? in uipickerviewdelegate dont find similar methods. thanks. well... sorry late. as far know, think can check if uipickerview spinning or not @ 1 of these 2 methods of uipickerviewdelegate: – pickerview:titleforrow:forcomponent: – pickerview:viewforrow:forcomponent:reusingview: these methods called when uipickerview needs change views/labels shows. happens whenever spin enough make new row appear. unfortunately, if uipickerview has few rows or if doesn't spin enough can miss movement...

plone - User-friendly error pages from Varnish -

we using varnish @ front of plone. in case plone goes down or serves internal error we'd show user-friendly static html page css styling + images. ("the server being updated page") how configure varnish this? you can customize synthetic page being served on vlc_error. default.vcl configuration file shows how this, serving famous "guru meditation" error page (ahh, wonderful amiga days). an example customization: sub vcl_error { set obj.http.content-type = "text/html; charset=utf-8"; synthetic {" <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <title>sorry, server under maintainance - website"</title> <style src="css/style.css"></style> </head>

java - Using File API methods on files located in my server -

i've created little app browse file system create , display tree (jtree) . want same files present on server . have apache tomcat server . want : file dir = new file(new uri("file://localhost:8084/myapp/dir")); file[] files = dir.listfiles(); (file f : files) { system.out.println(f.getabsolutepath()); this exemple want use java file api . i getting error when put code in servlet : 11 mai 2011 10:02:15 org.apache.catalina.core.standardwrappervalve invoke "servlet.service()" pour la servlet tests généré une exception java.lang.illegalargumentexception: uri has authority component @ java.io.file.<init>(file.java:385) i dont know means. i've tried file dir = new file("dir") ; , file dir = new file("web/dir") , file dir = new file(new uri(http://localhost:8084/myapp/dir )); but dir not found . dont , going mad (hum..sorry) . when type http://localhost:8084/myapp/dir on web browser content of

Parial Write for sockets in LINUX -

we have server-client communication in our application. sockets used communication. using af_inet sockets sock_stream(tcp/ip). these sockets in non blocking mode (o_nonblock). application written in c++ on unix. in our system server write socket , client read it. had written code handle partial writes. if partial happens, try 30 more times write entire data. our server try write 2464 bytes socket. in cases not write entire data. server try writing 30 more times transfer entire data. of times entire data written within 30 tries. times after 30 reties sever wil not able write entire data. here throw eagain error. problem happens in client side when tries read partially written data. consider server tried write 2464 bytes. after repeated 30 attempts write 1080 bytes. server raise eagain @ point. client try read 2464 bytes. read command return 2464 , hence read ok. data received corrupted 1 (partially written data only). client crashes. can 1 please advise on following, 1)

fsm - Encoding state machines in VHDL -

i'm looking creating system in vhdl filters image after receiving through ftdi usb-to-serial device. part of this, believe i've identified states cpld should in, have never created complex state machine in vhdl before, i'm questioning whether methods sound. currently, basic outline state machine thus: begin process(clk, reset, usb_rxfn, usb_txen) begin case state when idle => when negotiating => when receiving => when filtering => when transmitting => when others => -- should never happen go idle end process; my problem here every state machine tutorial i've been able find changes state on every rising edge (or similar, once per clock) , device should sit in idle lot , transition negotiating when usb_rxfn goes low, stay in negotiating until that's done, stay in receiving until entire image has been transferred etc... is there fundamentally flawed

C# Generic method and dynamic type problem -

this question has answer here: calling generic method dynamic type [duplicate] 5 answers i have generic method declared follow : public void duplicate<entitytype>() { ... } so, use need : myobject.duplicate<int>() but here, i'd pass type variable, doesn't work, here how try : type mytype = anobject.gettype(); myobject.duplicate<mytype>(); if can me ? thank in advance. you have use reflection, basically: methodinfo method = typeof(...).getmethod("duplicate"); methodinfo generic = method.makegenericmethod(mytype); generic.invoke(myobject, null);

javascript - insert text into textarea when option selected -

i need help. i'm trying insert text textarea-element when url contains 'number' , option value='option2' of selectbox selected. var contenttoinsert = 'text'; if (location.href.indexof("/number")) { if (value of selectbox == 'option2') { $("textarea").append(contenttoinsert); } } how check when option selected? text insert shouldn't shown when option selected. mean need on event-handler onchange. have got idea? jquery .change() event exists : description: bind event handler "change" javascript event, or trigger event on element. thy : http://jsfiddle.net/j4rkt/

ruby on rails - How to do pagination with cancan? -

i'm looking pagination cancan it's not obvious how integrate gems such will_paginate. ideally cancan's load_resource delegate will_paginate , add conditions. example in cancan i've declared guest users can :read, post, :published => true and handled automatically load_resource. i'd have will_paginate page through these results. any ideas. regards brad this simple kaminari https://github.com/amatsuda/kaminari in postscontroller do before_filter :load_by_pagination, :only => :index def load_by_pagination @posts = post.accessible_by(current_ability).order("published_date desc").page params[:page] end note kaminari works new rails3 activerelation framework it's possible chain methods build scope. , cancan activerelation friendly both chain together.

c++ - assignment in pthreads application -

i have linux multithread application in c++. in application in class app offer variable status : class app { ... typedef enum { asstop=0, asstart, asrestart, aswork, asclose } tappstatus; tappstatus status; ... } all threads check status calling getstatus() function. inline tappstatus app::getstatus(){ return status }; other functions of application can assign different values status variable calling setstatus() function , not use mutexes. void app::setstatus( tappstatus astatus ){ status=astatus }; edit: threads use status in switch operator: switch ( app::getstatus() ){ case asstop: ... case asstart: ... }; is assignment in case, atomic operation? is correct code? thanks. there no portable way implement synchronized variables in c99 or c++03 , pthread library not provide 1 either. can: use c++0x <atomic> header (or c1x <stdatomic.h> ). gcc support c++ if given -std=c++0x or -std=gnu++0x option since version 4.4. use linux-s

Can we paste lines into visual studio "without carriage return"? -

lets have these lines in editor int = 10; print(a,b); string b = "hello"; so is.. shift 3rd line 2nd position similar int = 10; string b = "hello"; print(a,b); i use ctrl+x or shift + del cut line clipboard. on pasting line @ 2nd position int = 10; string b = "hello"; print(a,b); the blank line @ 3rd line. there way paste without 3rd blank line. or matter easier way move , cut , paste lines. ? shift + alt + t swaps current line line below it. you'd put caret (or cursor) on second line, use keyboard shortcut swap third line.

Google Analytics: can I combine trackEvent and trackPageView into a single call? -

i combining google analytics' _trackevent , _trackpageview single call, following: var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-20822178-2']); _gaq.push(['_setcustomvar', 1, 'my custom page view variable', 'my value']); _gaq.push(['_trackevent', 'my category', 'my action']); _gaq.push(['_trackpageview']); [...ga snippet insertion...] this generates 2 __utm.gif requests google. okay except request _trackevent information contains customvar info, leads me believe google counts pageview on both requests. don't want double count page requests... google smart enough throw away pageview info sent _trackevent call? thanks! it won't double count page views double counting custom var. if don't want that, reorder pushes, make trackpageview come first, custom var, event

How to migrate a .change function from jQuery to plain Javascript -

i'm not js expert think i'm trying pretty simple (at least in jquery) i've got 3 select <select id="faq" class="onchance_fill">...</select> <select id="pages" class="onchance_fill">...</select> <select id="faq" class="onchance_fill">...</select> and input (it's tinymce 1 in advlink plugin) <input type="text" onchange="selectbyvalue(this.form,'linklisthref',this.value);" value="" class="mcefocus" name="href" id="href" style="width: 260px;"> i want each time change value in 1 of 3 select, value of option, placed in input. in jquery, : $('.ajax_onchance_fill').change(function() { data = $('.ajax_onchance_fill').val(); $('#href').text(data); }); but can't use it. equivalent in plain javascript ? thanks i advice ke

python - How to open a CSV,read a particular header of column and get the highest value -

i beginner in python , want know how open csv,read particular header of column , highest value.the value should stored in variab regards, sid you can use csv -module reading file. highest value, have read entire file , and remember highest value seen far.

jpql - java.sql.SQLException: Fail to convert to internal representation -

i'm trying execute following query: string query = "select entity, entity.id site entity"; list resultlist = entitymanager.createquery(query).getresultlist(); and take exception: [...] caused by: java.sql.sqlexception: fail convert internal representation @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:112) @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:146) @ oracle.jdbc.driver.databaseerror.throwsqlexception(databaseerror.java:208) @ oracle.jdbc.driver.charcommonaccessor.getlong(charcommonaccessor.java:239) @ oracle.jdbc.driver.oracleresultsetimpl.getlong(oracleresultsetimpl.java:552) @ oracle.jdbc.driver.oracleresultset.getlong(oracleresultset.java:1575) @ org.jboss.resource.adapter.jdbc.wrappedresultset.getlong(wrappedresultset.java:724) @ org.hibernate.type.longtype.get(longtype.java:28) @ org.hibernate.type.nullabletype.nullsafeget(nullabletype.java:163) @ org.hibernat

java - Get specific value from Object in spring controller -

i have student class, studentdao class, studentdetails class , studentcontroller student class have following instances: private string studentid; private string studentname; private string studentgrade; studentdao gets these details db, studentdetails class returns list of these details in following method:- public list<student> getspecificstudentinfo(string studentid) { list<student> studentinfo=studentdao.getspecificstudentinfo(studentid); return studentinfo; } in controller use hashmap student details like public map<string, object> referencedata(httpservletrequest req)throws servletexception, ioexception { string studentid=req.getparameter("studentid"); map<string, object> studentrecord = new hashmap<string, object>(); studentrecord.put("students",studentdetails.getspecificstudentinfo(studentid)); return studentrecord; } i m able display these values in jsp using students.stud

iphone - NSMutable Array object compare -

i want compare mutablearray object condition below... array1 = 1,2,3,4; array2 = 2,1,4,3,6,7; compare 2 array object & if object in array not add otherwise add in array3. all array nsmutable array please help the easiest way using sets nsmutableset *set = [nsmutableset setwitharray:array1]; [set addobjectsfromarray:array2]; nsarray *array = [set allobjects]; array give merged third array without duplicates.

gridview - Grid view in Android -

hi want display table of data in mobile. in rows , columns trying achive below in getview method, created tablerow , added 3 textview , retruned tablerow. displays first textview added tablerow can me in new android. need dispaly thsi. colval11 colval12 colval13 colval21 colval22 colval23 go through below example: hope ..no main.xml <?xml version="1.0" encoding="utf-8"?> <gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnwidth="90dp" android:numcolumns="auto_fit" android:verticalspacing="10dp" android:horizontalspacing="10dp" android:stretchmode="columnwidth" android:gravity="center"/> //main activity package com.test2; import android.app.activity; import android.os.bundle; import android.

javascript ajax post words which contains & symbol and decode in php -

i m trying send ajax post contains '&'. search.php?region=middle%20east%20&%20africa&city=&language= but return 'middle east' in php side please me if using jquery: $.ajax({ url: 'search.php', type: 'post', data: { region: 'middle east & africa', city: '', language: '' }, success: function(result) { // ... } }); if not manually url encode value using encodeuricomponent function: var region = encodeuricomponent('middle east & africa'); // todo: send encoded value

c# - Have a managed application display a meaningful message box when no .NET is installed? -

having written small .net windows forms 2.0 application, try avoid shipping .net framework redistributable (~20 mb) keep size small. what can use nsis make installer checks installed .net , download on demand. now asked myself whether "poor man's" error checking built right .net executable itself? kind of having unmanaged part checks .net, , managed part application itself. is such thing possible? rather statisfied if configure single message text displayed when started without .net. no way. .net application .net application , launcher cannot execute .net code if no .net installed. can wrap .net application unmanaged code - write simple c++ application , embed .net application binary resource and, in main code, check registry, if registry there, save .net resource disk, create process, set parameters (like current folder, command line parameters if necessary) , launch process. if not - show message.

Need to pseudo code to help me understand oauth -

can please me understand how use oauth authentication allow users access secure sections of website? i looking psudo code. for example, when gets authenticated using facebook id, do need store fact have been authenticated, use session id created facebook in future , compare session id's stored in database? if yes, happens if facebook user removes application facebook account, latest decide use same id again login website again? session id still match 1 stored in database? if no, not store in database? when interaction between user , facebook finished, you'll given token should associate user , persist in database. you'll able use time (configured facebook) , should expect http unauthorized response. in case have present facebook page user can put username password again.

c++ - IVR Programming Library for C# -

i want write program responds calls. after welcome message must tell client to: press 1 enter account number, or 2 speak operator. if client presses 1 tell him or enter account number , after or enters account number number must saved in database. is possible in c#? if is, want ivr library c#. if not, need great ivr library c++. here link may want at.

how can i allow user to download an image in flex without making server call -

i have flex application showing chart. want give user functionality download chart image. how can it? this adobe cookbook entry can answer question. , yes, project should targeted flash player 10.

AT command - 3G connection to another cell -

i'm using sierra wireless modems (compass 880/888, usb 308) , i'm trying find @ command tell modem connect cell (to tower). reason want because when i'm in crowded place, cellular network down, want use next nearest cell. possible? i doubt there command this; handoff between cells controlled & initiated network. despite fact decision made based on data comes from phone @ protocol level (relative signal strengths of surrounding 16 cells) can't force far i'm aware - there never point in doing so: if cellular device drops off it's network everyting in power rectify situation - if there cell station in range belonging home network (or 1 can roam on) try attach automatically, if not keep on looking. if dropped due capacity problems the base station controller (the govenor of bunch of cell sites) should have tried spread load adjacent cells knows attached devices in range of, if thats fails bet saturated too, switching them of no use.

C++: Having trouble using map with a static variable in a class, I get undefined symbol -

this error get undefined symbols: "config::fmap", referenced from: register_function(unsigned int (*)(unsigned int))in config.o print_config() in shared.o ld: symbol(s) not found collect2: ld returned 1 exit status config.h #include <map> #include <boost/preprocessor/stringize.hpp> typedef unsigned int (*fptr_t)(unsigned int); typedef std::map<fptr_t, std::string> function_name_map_type; void register_hash_names(); void register_function(fptr_t funct_pointer); class config { public: static function_name_map_type fmap; }; config.cpp function_map_t fmap; void register_hash_names() { register_function(sha1); ... } void register_function(fptr_t funct_pointer) { (config::fmap)[funct_pointer] = boost_pp_stringize(funct_pointer); } shared.cpp error originates from: std::cout << "\t " << config::fmap[config::current_hash_function] << "\n"; the definition in .cpp

c# - Conditionally hide or show Aspx Menu Control Item -

how hide or show menu item based on backend condition? you can remove particular menu item follows: menuitem mnuitem = mnu.finditem(""); // find particular item mnu.items.remove(mnuitem);

string - How do I get a file's path in PHP? -

i have check using file_exists function... but, if use if (file_exists('http://horabola.com/imagens/dt_2845.jpg')) { //code } it doesn't work... i know , i'm sure file "dt_2845.jpg" exists in folder "imagens" .... now, how check that? how server's file path? try: if (file_exists($_server['document_root'].'/imagens/dt_2845.jpg')) { //code } good luck

php - Track how often comparison engines come to pick feeds -

i submit several feed urls search engines come pick @ different times of week. example of feed url looks mysite.com/feed.csv. want able track @ time of day did search engine fetch feeds through urls. just check server logs see when file pinged

java - Null pointer access: The variable "tipoEstablecimiento" can only be null at this location -

i've been searching in internet error no result. i'm lost it. can it? . . . tipoestablecimientohotel tipoestablecimiento = null; . . . . try{ tipoestablecimiento.setcodigo(""); <--- line error. }catch (exception e){ system.out.println(e.getmessage()); } . . . of course have imports need (i mean tipoestablecimiento), , marks line corresponding warning. thanks in advance. you didn't show enough code, i'd go error got. don't initialize variable between assigning null , calling setcodigo method you'll surely nullpointerexception (you cannot dereference null object). make sure instantiate before using calling constructor, like: tipoestablecimiento = new tipoestablecimientohotel();

Mysql how to do this query -

select u.username, count(t.tid) total tbl2 t join users u on t.userid = u.userid group t.userid the above query works fine , all, returns number of total task each user has atleast 1 task in tbl2 table. but want return users, if user doesn't have records associated him in second tbl2 table. want total show 0 users doesn't have records, how can accomplish this? the problem other answers given want select users have no associated records; using left join, users table on wrong (nullable) side of join. replace left join right join, syntax feels unintuitive me. the standard answer reverse order of tables while using left join: select u.username, count(t.tid) total users u left join tbl2 t on t.userid = u.userid group u.username note it's better practice (and, in dbmses, required) group on non-aggregated columns in select list, rather grouping on userid , selecting username.

google app engine - Retrieve the list of friends of specific user when i select that user in appengine -

i had 2 entities user , friends in app engine jdo in user had list of friends want when select table user retrieve entity friend list of friends associated user....how can perform in app engine ? relation between entities python described here (i guess pretty same java): http://code.google.com/appengine/articles/modeling.html it seems need many many relation. simplest way have list of db.key property in user model. can make sure whenever create new connection between friends, both lists of friends updated. alternatively define function searches db users have user's key in friends list, using gql query. imho seems less organised other method.

Django: Model Validation Error ManytoManyField -

i error while running syncdb can't seem figure out issue. please help. error: 1 or more models did not validate: store.business: reverse query name field 'logo' clashes field 'imagebank.business'. add related_name argument definition 'logo'. here models: class business(models.model): business_type = models.manytomanyfield(businesstype) business_service_type = models.manytomanyfield(servicetype) establishment_type = models.foreignkey(establishmenttype) logo = models.foreignkey(imagebank, related_name = '%(class)s_logocreated',) phone = phonenumberfield() address = models.foreignkey(address) website = models.urlfield() name = models.charfield(max_length=64) def __unicode__(self): return self.name class imagebank(models.model): business = models.foreignkey('business', related_name='%(class)s_business') image = models.imagefield(upload_to="images/bank") d

c++ - Syntax checking for Visual Studio 2008 -

is possible? instance, if type std::cout << "cool" without semicolon there vis studio plugins catch (the way eclipse does) or similar syntactical errors , show me error visually? you can try visualassistx , enables more sophisticated intellitype system standard vc.

java - Is SpannableString.setSpan() 2nd parm 0-based? -

my empirical experiment shows if setspan(o, start, end) start end of string, end string.length() - 1 , last character isn't covered. when changed end string.length() , entire string covered and... don't "out-of-bound" exception. unfortunately, there nothing in documentation regarding particular issue. can confirm observation? (or prove me wrong?) end exclusive. 0, 2 , example, 0 inclusive 2 exclusive 0 , 1 .

php - Change XML date from yyyymmdd to Month Day, Year -

i'm using php output data xml file, date, outputs "20101110." can use php change november 10, 2011? if so, how? here's page , code: $file = 'http://www.gostanford.com/data/xml/events/m-baskbl/2010/index.xml'; $xml = simplexml_load_file($file); foreach($xml $event_date){ if(!empty($event_date->event['vn']) && !empty($event_date->event['hn']) && !empty($event_date->event['vs']) && !empty($event_date->event['hs'])) { echo '<li>'; echo '<h3>', $event_date->event['vn'], ' vs ', $event_date->event['hn'], '</h3>'; echo '<p><strong>', $event_date->event['vs'], ' - ', $event_date->event['hs'], '</strong></p>'; echo '<p>', $event_date['date'],

java - Can Mockito stub a method without regard to the argument? -

i'm trying test legacy code, using mockito. i want stub foodao used in production follows: foo = foodao.getbar(new bazoo()); i can write: when(foodao.getbar(new bazoo())).thenreturn(myfoo); but obvious problem getbar() never called same bazoo object stubbed method for. (curse new operator!) i love if stub method in way returns myfoo regardless of argument. failing that, i'll listen other workaround suggestions, i'd avoid changing production code until there reasonable test coverage. when( foodao.getbar( any(bazoo.class) ) ).thenreturn(myfoo); or (to avoid null s): when( foodao.getbar( (bazoo)notnull() ) ).thenreturn(myfoo); don't forget import matchers (many others available): import static org.mockito.matchers.*;

How can I retain Vim undo history but disallow hiding modified buffers? -

similar this question , want keep undo history when change buffers. however, if use set hidden , vim no longer prompts me when switch buffer changes. how can retain unsaved buffer prompt retain undo history? you can use new persistent undo feature in vim 7.3. set undodir=~/.vim/undodir set undofile for details, see documentation at :help persistent-undo

php - How to control the content (text) to display in a $form->input? -

folks. i'm starting cakephp , after reviewing tutorial ( http://book.cakephp.org/view/1543/simple-acl-controlled-application ) , after having used "cake bake" command generate models, controllers , views , fine, when visit post's add view (views \ posts \ add.php), find instead of showing input text username, shows select usernames. this line in post's add view show select. echo $this->form->input('user_id'); postscontroller : function add() { // other code $users = $this->post->user->find('list'); $this->set(compact('users')); } although know how display username of logged-in user, don't know how control content show in $this->form->input() because if use variable not part of "post" model , it's shown , label input. have idea how solve this?? p.s. i've been trying find information on cookbook , haven't been able find specific situation :( if want

ruby on rails 3 - Devise sign-in not working in IE through an iframe -

i don't see error messages in log file, , there no message on screen. logging in rails 3 app served in iframe site results in being returned main site without user being logged in. it sounds rails app not recognizing cookie through iframe. has else run problem? go see error is? please note occurs in ie, version 8 (maybe occurs in 7 , 6, haven't tested yet). james correct, ie has security in place prevent iframes generating cookies. there's easy fix this, include following response header controller: response.headers['p3p'] = 'cp="non dsp cor cura ivaa ivda cona our nor sta"' source: http://adamyoung.net/ie-blocking-iframe-cookies

text - How to find android TextView number of characters per line? -

so have textview in android has width of whole length of screen , padding of dip 5. how can calculate number of characters fit single line on screen? guess in other words, i'm trying number of columns of textview? i considered manual calculation depending on textsize , width, 1) don't know correlation , 2) due padding in units of dip, different screens use different number of actual pixels pad. overall question: trying use solve: if given string how can manually edit string such when textview prints string character character, know when start word won't fit on 1 line on next. note: know textview automatically puts words won't fit onto next line, however, since i'm printing character character, typing animation, textview doesn't know word won't fit until prints out overflowing characters of word. been searching everywhere this... thanks! added solutions: one possible solution: public string measure2 (textview t, string s) { string u =

javascript - how to attach a show method? -

sorry if title little vague, im learning jquery , fade content div in , out on hover whilst displaying read more link when hovered , hiding when unhovered. can div fade , read more link display although @ moment read more link inheriting opacity of fade of .25, understand have add show method im not sure function or method have use. code here http://jsfiddle.net/kyllle/a4mps/ if explain me great love understand as possible. since read more inside widget div fade rest of widget's contents. instead, put outside within article : http://jsfiddle.net/a4mps/1/

graph - Mean Line in GNUPlot -

i'm trying average response time in graph of apache requests , response times. sample data: 11/may/2011:17:34:55 2 11/may/2011:17:34:56 38 11/may/2011:17:34:56 2 11/may/2011:17:34:56 493 11/may/2011:17:34:56 2 11/may/2011:17:34:57 281 the data graphed using this: plot "input.dat" using 1:2 what want line in center of average response time every x value. sample graph: http://i.min.us/jlcmby.png this blog post shows how analyze access log moving mean in gnuplot , preprocess data awk totals every second.

ruby on rails 3 - `accepts_nested_attributes_for`, but only modify the first child -

a brief background i'm making conventional forum learn/practice rails. user model has_many :topics has_many :posts topic model has_many :posts belongs_to :user post model belongs_to :user belongs_to :topic however, when user creating new topic, want them simultaneously create first post within topic (just forums work). additionally, when topic creator edits topic, edits first post. so, added accepts_nested_attributes_for :posts topic model. # topiccontroller def new @topic = current_user.topics.new @topic.posts.build end and here's nested form: # topics/_form <%= form_for [@topic] |topic| %> <%= topic.text_field :name %> <% topic.fields_for :posts |post| %> <%= post.text_area :content %> <% end %> <% end %> the question this code works. user create first post alongside creation of topic. however, other users create posts topic , @topic.posts expands, when topic creator edits topic, text ar