Posts

Showing posts from June, 2012

Android - VideoView ignore LayoutParams in HDMI mode -

Android - VideoView ignore LayoutParams in HDMI mode - here part of code: requestwindowfeature(window.feature_no_title); setcontentview(r.layout.board); relativelayout lview = (relativelayout) findviewbyid(r.id.relativelayoutmain); videoview mvideoview = new videoview(this); mvideoview.setvideouri(uri.parse(path)); mvideoview.start(); mvideoview.setbackgroundcolor(color.blue); linearlayout.layoutparams layoutparams = new linearlayout.layoutparams(30, 30); mvideoview.setlayoutparams(layoutparams); lview.addview(mvideoview); when launch app on tablet works fine. have video playing in left top corner , scaled 30x30. but when connect tablet via hdmi tv , launch app have 30x30 rectangle in left top part of screen. video plaing outside rectangle @ center of screen size: 500x400 or smth this. i have tried create xml layout videoview within setting parameters , in hdmi mode videoview ignore settings , play film @ center of screen. any thought ? android not have ...

html - Can we set style to title tag in header -

html - Can we set style to title tag in header - can set style title tag in header in html head following. tried did not work.. <title style="font-style:italic;"> title</title> you can apply css <title> element, not though style attribute (since "all elements base, basefont, head, html, meta, param, script, style, title"). i'm not aware of browser apply css rendering of title in browser tabs or title bars though. you can, however, like: head { display: block; } title { display: block; font-size: 200%; font-weight: bold; } html css title

search - String Ranking Algorithm in mySQL like Quicksilver -

search - String Ranking Algorithm in mySQL like Quicksilver - string ranking algorithm in mysql quicksilver scoring algorithms php port javascript port mysql port (oh no link) that's issue maintain reading example usage: score("hello world","axl") //=> 0.0 score("hello world","ow") //=> 0.6 score("hello world","hello world") //=> 1.0 ok question lies here. awesome these are, , give thanks create possible! love mysql way of doing this. database aren't area of expertise if wanted in mysql, how it? , should i, there improve way?. my thinking on such. real life example: i have 14000+ records in database. table of "icd9" medical codes has medical code , description. table: icd9_codes fields: code code_text i'm doing jquery ajax phone call php function. $query = $this->db->query("select code, code_text codes match (code,code_text) against ('"...

android - How can I reach one activity's Intent from an another? -

android - How can I reach one activity's Intent from an another? - if create illustration an intent = new intent(); bundle b = new bundle(); b.putstring("number", spinner.getselecteditem); i.putextras(b); so if want reach intent activity, how can this? in android: how variables/data 1 screen another?... in oncreate in sec activity string calling: getintent().getstringextra("number"); android android-intent

spring - Does the transactionManager close the statement atuomatically? -

spring - Does the transactionManager close the statement atuomatically? - now using spring transactionmanager manager db transaction. since utilize connection pool hold connections, connection not closed. wonder if opended statement closed automatically after transaction failed , rollback? we using c3p in our project maintain connection pool. have configuration in close connection after transaction completes. <prop key="connection.release_mode">after_transaction</prop> so transaction manager using? spring aop

how can i know when a self-tracking entity has been changed? -

how can i know when a self-tracking entity has been changed? - i have been working entity framework + self-tracking entities, , came out problem: is there way determine when entity has been changed?? for example: if have entity user 2 fields: name , password, can know if user instance has been changed making: <user>.changetracker.state != objectstate.unchanged; my problem when user has person, , person has field email. want if email field changed, corresponding user changed too. i have been trying methods such as: <user>.starttrackingall(); not work navigation properties (or maybe doing wrong). help can found here. remember self tracking entities autogenerated via t4 templates, clases can't modified. first when wanting know if entity in so-called object graph has changed can recurse through entities contained in trackable collections or one-to-one navigation properties of root entity (user in case). way can know if person within root entity h...

c++ - Is div function useful (stdlib.h)? -

c++ - Is div function useful (stdlib.h)? - there function called div in c,c++ (stdlib.h) div_t div(int numer, int denom); typedef struct _div_t { int quot; int rem; } div_t; but c,c++ have / , % operators. my question is: "when there / , % operators, div function useful?" the div() function returns construction contains quotient , remainder of partition of first parameter (the numerator) sec (the denominator). there 4 variants: div_t div(int, int) ldiv_t ldiv(long, long) lldiv_t lldiv(long long, long long) imaxdiv_t imaxdiv(intmax_t, intmax_t (intmax_t represents biggest integer type available on system) the div_t construction looks this: typedef struct { int quot; /* quotient. */ int rem; /* remainder. */ } div_t; the implementation utilize / , % operators, it's not complicated or necessary function, part of c standard (as defined [iso 9899:201x][1]). see implementation in gnu libc: /...

opengl - glBindAttribLocation index 0 -

opengl - glBindAttribLocation index 0 - when seek bind attribute index of 0, shader programme fails @ linking , info infolog gives is: vertex shader(s) failed link, fragment shader(s) linked. according the opengl docs this command makes possible vertex shaders utilize descriptive names attribute variables rather generic variables numbered 0 gl_max_vertex_attribs -1. so binding attribute index 0 should work. though not important, curious why cannot bind attribute index 0. suggestions welcome. quoting op commentary, because saved me: i found problem(this causing other problems): in vertex shader had switched using gl_vertex using own attribute, "vertex", @ 1 place in shader had forgotten alter variable name, , since gl_vertex uses 0 index... opengl

django - How do i display inlines with DetailView? -

django - How do i display inlines with DetailView? - i have project model. model has days inlines. how display them using detailview? my views.py looks this: class projectdetailview(detailview): queryset = project.objects.all() slug_field = 'slug' template_name = 'projects/detail_project.html' how pull through day inlines this? i've tried: def get_context_data(self, **kwargs): context = super(projectdetailview, self).get_context_data(**kwargs) project = project.objects.filter(slug=self.slug_field) context['days'] = day.objects.filter(project=project) homecoming context but doesn't work. seems pointless i'm using generic view doing get_object_or_404 anyway pull days out. how do properly? there's no such thing inline model. there inline forms, forms model has foreignkey relationship parent model - don't seem talking forms. in case, there's no need in code. can refer related ...

c++ - Add a scrollbar on Ncurses or make it like "more" -

c++ - Add a scrollbar on Ncurses or make it like "more" - basically writing client programme receives response , logs server, client able send request server different information. used curses , output looks pretty good. looks vi, output @ top , user on client end come in command @ bottom. thing not able scroll back.. boss told me create "more command in linux" , want stick solution , add together scroll bar on side output window... thinking server sends logs randomly , it's impossible (or hard) create more... if maintain list or array of lines in client , inquire ncurses paint range of lines sliding window, can slide window , downwards in response ^f ^b ^u ^d ^y ^e commands, repaints screen different indexes. i skip trying draw scrollbar though: out of place on linux system. not mc has scrollbars. show content summary in bottom line, similar vim 's top , bot , all , n% when :set ruler turned on, that'll sense @ home. c++ ...

tfs2010 - How do I find how much space TFS is using -

tfs2010 - How do I find how much space TFS is using - i'm tring find out how much space tfs using. there simple check free space command on tfs? also there way poll tfs amount of hard drive space left , see when big changes or big amount of files have been added , whom given week or day? i'm tring find out how much space tfs using. there simple check free space command on tfs? projects not partitioned in database in such way can figure out. of course of study if want see how much space collections using can take @ db size. here article read gives rough estimate of space used files, work items etcetera. also there way poll tfs amount of hard drive space left , see when big changes or big amount of files have been added , whom given week or day? tfs doesn't command amount of hdd space have left on drive. can in code check doing like: using system.io.driveinfo var drive = new driveinfo("drive_letter"); long free...

c++ - Deallocating Dynamic 2D Array with Template -

c++ - Deallocating Dynamic 2D Array with Template - i having error in c++ application having problem debugging. have looked online, , appear doing of allocation/deallocation right way. here code: template <typename t> class matrix { private: int _rows; int _cols; t** _matrix; public: matrix(int r, int c); ~matrix(); t getvalue(int r, int c); }; template <typename t> matrix<t>::matrix(int r, int c) { _rows = r; _cols = c; _matrix = new t*[_rows]; for(int = 0; < _rows; i++) _matrix[i] = new t[_cols]; for(int = 0; < _rows; i++) for(int j = 0; j < _cols; j++) _matrix[i][j] = null; } template <typename t> matrix<t>::~matrix() { for(int = 0; < _rows; i++) delete [] _matrix[i]; delete [] _matrix; } template <typename t> t matrix<t>::getvalue(int r, int c) { if(r < 0 || r >= _rows || c < 0 || c > _cols) { throw -1; homecoming nu...

javascript - Json AJAX not working , problem in Response? -

javascript - Json AJAX not working , problem in Response? - i have servlet application takes user input html form , extracts required info backend , makes graphs/charts , shows them user. problem seeing if user selects first alternative dropdown, works fine, info extracted backend - can see in ajax response in firebug , parsed json , maps created. info received backend (what see in ajax response): {"responsestr":"[47.636597,-122.189495,0,1,47.643647,-122.212038,0,26,47.505288,-122.339112,0,1,47.622741,-122.314592,0,60,47.541612,-122.129318,0,1,47.568435,-122.161237,0,166,47.682308,-122.196004,0,2,47.666673,-122.284099,0,1,47.612953,-122.316700,0,2,47.600605,-122.322286,0,30,47.589557,-122.315608,0,27,47.636351,-122.327213,0,1,47.630270,-122.177084,2,0,47.630432,-122.140126,17,0,47.621644,-122.132080,1,3,47.630808,-122.153539,86,75,47.622367,-122.337023,495,3466,47.630886,-122.306255,1423,45,47.720287,-122.090885,255,82,47.702376,-122.093340,47,4,47.676897,...

java - JSP can't find stylesheets, images -

java - JSP can't find stylesheets, images - possible duplicate: jsp can't find stylesheet tomcat7, spring framework3, jstl 1.2. hierarchy: web-inf/jsp web-inf/styles i link stylesheet in jsp file, located in web-inf/jsp: doesn't work! when open application there no styles, , writter tomcat: apache tomcat/7.0.14 - error study http status 404 - type status study message description requested resource () not available. apache tomcat/7.0.14 so set styles folder out of web-inf , still doesn't work! also, images don't work, images folder not in web-inf , path corect... problem? in spring set resources in folder outside of web-inf. this: web.xml <!-- processes application requests --> <servlet> <servlet-name>appservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>co...

What is a simple way to parse this specific xml using php? -

What is a simple way to parse this specific xml using php? - whay way ( native way works in both php 4 , 5 ) extract value xml string <root> <node1> <![cdata[the-text]]> </node1> </root> i wish extract the-text content. you can utilize simple xml 3rd parameter parse cdata text: look there: http://www.vijayjoshi.org/2009/09/22/quick-php-tip-how-to-parse-cdata-sections-using-simplexml/ php xml dom

Consuming WCF Services from SSIS -

Consuming WCF Services from SSIS - i planning consume wcf service ssis package, info , dump table. planning write wcf consumption part in script component part of info command flow task, best way things? any advice appreciated totally new ssis regards, dinesh here link shows how configure ssis bundle access web service using wcf . hope gives idea. wcf ssis

flash - How can I re-order the children of my container in AS3 -

flash - How can I re-order the children of my container in AS3 - i have little problem in managing children container. fact has lot of children , y coordinates random. is there anyway can order them y coordinates lower in front end , higher in back? is that can 2 "for"? thank help ^^ //the number of elements in our component var count:int = numelements; var elements:array = []; //load elements of component array (var i:int=0; i<count; i++) { elements[i] = getelementat(i); } //sort array elements based on 'y' property elements.sorton("y", array.numeric); //re-add element component //in order of sorted array created. //when add together element using 'addelement' //be added @ top of component's displaylist //and automatically removed original position. (i=0; i<count; i++) { addelement(elements[i]); } this spark components. can exact same thing mx components using getchildat() , addchild() instead of get...

Copy/Paste Items from listbox to any doc (Excel, Word, .txt) -- VB.NET -

Copy/Paste Items from listbox to any doc (Excel, Word, .txt) -- VB.NET - i'm unable copy/paste items listbox document (excel, word, .txt). need select multiple items in listbox. searched there seem multiple vague answers around there. can guide me? thanks! all need allow selectionmode multisimple or multiextended can utilize selecteditems collection re-create clipboard in keydown event of listbox simply set listbox1.selectionmode = selectionmode.multisimple in form.load event and utilize code (note: listbox named listbox1 ) private sub listbox1_keydown(byval sender object, byval e system.windows.forms.keyeventargs) handles listbox1.keydown if e.control andalso e.keycode = keys.c dim copy_buffer new system.text.stringbuilder each item object in listbox1.selecteditems copy_buffer.appendline(item.tostring) next if copy_buffer.length > 0 clipboard.settext(copy_buffer.tostring) end if...

terminology - What is the difference between a W3C Working Draft and an Editor's Draft? -

terminology - What is the difference between a W3C Working Draft and an Editor's Draft? - i'm reading xmlhttprequest level 2 specification (w3c working draft 07 september 2010) after noticed browsers implementing features described editor's draft has eliminated many things. which difference between working draft , editor's draft? a working draft document has been officially published grouping developing it, means members of grouping have agreed in state worth sharing wider audience (generally feedback purposes — not mean participants agree in document). an editor's draft document beingness worked on person in charge of writing (the editor). you can think of more or less in software terms: wd dot release, or @ to the lowest degree tag, while ed absolute freshest version latest commit. deciding whether 1 should @ wd or ed depends largely on civilization of grouping working on specification. in case webapps group, improve @ ed since far more...

C++ Constructor -

C++ Constructor - possible duplicate: what weird colon-member syntax in constructor? if define class shown below in c++: class myclass { public: myclass (unsigned int param) : param_ (param) { } unsigned int param () const { homecoming param_; } private: unsigned int param_; }; what constructor definition: myclass (unsigned int param) : param_ (param) means , benefit code? myclass (unsigned int param) : param_ (param) this build called member initializer list in c++. it initializes fellow member param_ value param . what difference between initializing , assignment within constructor? & advantage? there difference between initializing fellow member using initializer list , assigning value within constructor body. when initialize fields via initializer list constructors called once. if utilize assignment fields first initialized default constructors , reassigned (via assignment operator) actual values. as see there ad...

python - Using variable length argument lists and named parameters together -

python - Using variable length argument lists and named parameters together - i need help figuring out pythons *args , **kwargs . it's simple haven't entire wrapped head around them. here's 1 of scenarios that's bewildering me. i have 2 functions mainfunc , wrapperfunc (which wrapper function main function). looks this. def mainfunc(fname=none, lname=none): print 'firstname: ' + fname print 'lastname: ' + lname def wrapperfunc(uname, *args): print uname mainfunc(*args) i can phone call wrapperfunc this: wrapperfunc('j.doe', 'john', 'doe') in method, 3 parameters positional. since j.doe comes uname , other 2 params can accessed *args ..but possible pass of params wrapperfunc dict can still access uname within wrapperfunc straight , pass remaining positional parameters mainfunc . next snippet: params = {'uname':'j.doe'} wrapperfunc(**params, 'john', 'do...

.net - Is there a standard way to use attributes to modify how WCF operations behave? -

.net - Is there a standard way to use attributes to modify how WCF operations behave? - i'm working on funky code right now, , i've been wondering whether or not can utilize attributes modify how wcf operation behaves, maybe create perform additional checking or create skip logic. for example, if had next request envelope: [messagecontract] public class userrequest { [messagebodymember] public string sessionkey { get; set; } [messagebodymember] public usermodel user { get; set; } } and next service operations: [forcesession] void adduser ( userrequest request ) { } void edituser ( userrequest request ) { } we have automatic functionality on adduser operation checks request's session key exists in current httpcontext . maybe equivalent of checking httpcontext.current.session[request.sessionkey] != null , end either rejects phone call (sends empty response envelope) or processes it. of course, add together checking code @ star...

Sorting XML with XSLT - entire XML-schema is not known -

Sorting XML with XSLT - entire XML-schema is not known - i wondering whether xslt makes possible sort xml file if don't know entire xml-schema. for illustration sort next xml file. sort /catalog/cd elements /catalog/cd/title <catalog attrib1="value1"> <dvd2> <title>the godfather2</title> </dvd2> <cd> <title>hide heart</title> <artist>bonnie tyler</artist> <country>uk</country> <company>cbs records</company> <price>9.90</price> <year>1988</year> </cd> <cd attrib4="value4"> <title>empire burlesque</title> <artist>bob dylan</artist> <country>usa</country> <company>columbia</company> <price> <catalog> <cd><title>e</title></cd> <cd><title>i</title></cd>...

perl regex grouping overload -

perl regex grouping overload - i using next perl regex lines $myalbum =~ s/[-_'&’]/ /g; $myalbum =~ s/[,’.]//g; $myalbum =~ m/([a-z0-9\$]+) +([a-z0-9\$]+) +([a-z0-9\$]+) +([a-z0-9\$]+) +([a-z0-9\$]+)/i; to match next strings "30_seconds_to_mars_-_30_seconds_to_mars" "30_seconds_to_mars_-_a_beautiful_lie" "311_-_311" "311_-_from_chaos" "311_-_grassroots" "311_-_sound_system" what experiencing strings less 5 matching groups (ex. 311_-_311), attempting print $1 $2 $3 prints nil @ all. strings more 5 matches print. how resolve this? it looks want words in separate groups. me, seems you're abusing regexes when run substitutions , split. do: $myalbum =~ s/[-_'&’]/ /g; $myalbum =~ s/[,’.]//g; @myalbum_list = split(/\s/, $myalbum); #print out whatever want/ test length, etc... print "$myalbum_list[0] $myalbum_list[1] $myalbum_list[2]"; regex perl

pointers - Basic casting question (C#) -

pointers - Basic casting question (C#) - suppose have byte[] array, wondering doing when create pointer array , cast int. when dereference said int pointer, larger number in case bellow: (code may have errors) byte[] bytes = new byte[100]; bytes[0] = 1; bytes[1] = 2; bytes[2] = 3; bytes[3] = 4; fixed (byte* pmem = &bytes[0]) { debug.writeline("{0:x16}", (int)pmem); byte* pmemplus1 = pmem + 1; debug.writeline("{0:x8}", *pmemplus1); byte* pmemplus2 = pmem + 2; debug.writeline("{0:x16}", *pmemplus2); int* parraybase = (int*) pmem; debug.writeline("{0:x8}", *parraybase); int* parraybaseplus1 = parraybase+1; debug.writeline("{0:x8}", *parraybaseplus1; } right expected, pmem, pmemplus1 , pmemplus2 dereference 1,2 , 3. (int)pmem take value of pointer (memory address). when cast int pointer though, parraybase gives 4030201 , parraybaseplus1 gives num...

android - How can i play a video selected from the sd card? -

android - How can i play a video selected from the sd card? - public class videodemo extends activity { private videoview video; private mediacontroller ctlr; file clip=new file(environment.getexternalstoragedirectory(); { if (clip.exists()) { video=(videoview)findviewbyid(r.id.videogrdview); video.setvideopath(clip.getabsolutepath()); ctlr=new mediacontroller(this); ctlr.setmediaplayer(video); video.setmediacontroller(ctlr); video.requestfocus(); video.start(); } }}; } } so i've got videogrdview of videos on sd card display in separate activity, need know how click video grid , have play through media player. help appreciated. public class menus extends activity { //set constants mediastore query, , show videos private final static uri media_external_content_uri = mediastore.vi...

c# - How should interface implementations handle unexpected internal exceptions of types callers might expect? -

c# - How should interface implementations handle unexpected internal exceptions of types callers might expect? - if class implements interface, how should handle situations eitherin execution of method or property, internal error occurs of type caller might reasonably expecting handle, caller perhaps should not. example, idictionary.add internally yields argumentexception under circumstances imply dictionary corrupt, not imply bad rest of system? or imply corrupted beyond dictionary? caller may expecting grab , handle fact duplicate key exists in dictionary, since in cases exception may vexing (e.g. same code may used dictionary that's not accessed other threads , concurrentdictionary is, , semantics workable if effort add together duplicate record caused clean failure). letting argumentexception percolate lead caller believe dictionary in same state if add together never occurred, dangerous, throwing other exception type seem confusing. in execution of method or prope...

python - is "common" module in Standard Library? -

python - is "common" module in Standard Library? - i got script program. programme uses python scripting. anyway, script has line from mutual import struct is part of python's standard library? because python seems missing it. maybe deprecated? script didn't include else 1 python file, guessed it's not module made script creator. i suggest check common.py file , add together pythonpath. if using sort of unix/bsd seek "locate common.py" , check if has struct somewhere. hope helps python struct module

HTTP 400 on IIS 6.0 -

HTTP 400 on IIS 6.0 - i'm trying create http request xml service , i'm getting 400 errors iis server. this request works: t 192.168.0.10:52584 -> 193.189.144.141:80 [ap] 50 4f 53 54 20 2f 73 63 72 69 70 74 73 2f 58 4d post /scripts/xm 4c 5f 49 6e 74 65 72 66 61 63 65 2e 64 6c 6c 20 l_interface.dll 48 54 54 50 2f 31 2e 30 0d 0a http/1.0.. ### t 192.168.0.10:52584 -> 193.189.144.141:80 [ap] 48 6f 73 74 3a 20 77 77 77 31 2e 67 6e 74 2e 6c host: www1.gnt.l 74 0d 0a 43 6f 6e 74 65 6e 74 2d 74 79 70 65 3a t..content-type: 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 application/x-w 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 ww-form-urlencod 65 64 0d 0a 43 6f 6e 74 65 6e 74 2d 6c 65 6e 67 ed..content-leng 74 68 3a 20 37 33 0d 0a 43 6f 6e 6e 65 63 74 69 th: 73..connecti 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 0d 0a 4d 66 63 on: close....mfc 49 53 41 50 49 43 6f 6...

javac - Incompatible types in "For Statement" during java recomplile -

javac - Incompatible types in "For Statement" during java recomplile - all, 1st off not java programmer - have learned know in past 2 days trying recomplile class file. have reviewed every post here has 'incompatible types' still can't resolve issue. have java file no class file , receive next error when seek recompile it. error: source\idm\sap\configdatatm.java:153: incompatible types found : java.lang.object required: idm.sap.configdatatm /* 177 */ (configdatatm x : xlist) { source: /* */ public boolean add(configdatatm element) /* */ { /* 161 */ homecoming this.rootdata.add(element); } /* 162 */ public boolean addsysfile(string filename) { homecoming add(new configdatatm (filename, "sys", true)); } /* 163 */ public boolean addpasswdfile(string filename) { homecoming add(new configdatatm(filename, "pass", true)); } /* 164 */ public boolean addvpnfile(string filename) { homecoming a...

php - Passing bizRule parameters to RBAC via accessRules? -

php - Passing bizRule parameters to RBAC via accessRules? - from research don't think possible want create sure. possible pass parameters rbac bizrule via accessrules. right need check if post owner (along other checks) before allowing them edit/delete post. need compare owner_id in bizrule verify yii::app()->user->id == param['owner_id'] don't think can pass param using accessrules? or can i? you can't it. different actions requiring different bizrules. inefficient load info these prior possible action execution. php yii rbac

Grouping lines and other elements in Google Maps (JavaScript V3 API) -

Grouping lines and other elements in Google Maps (JavaScript V3 API) - i new google maps, have missed basic. want grouping several lines, way points, locations .. logically together, can switch them on / off @ once. thought layer or overlay, still confused difference. on playground found traffic overlay example doing want do. kind of overlay right me? , how draw line particular overlay? a similar question google maps marker grouping doing categories on marker , more or less iterating through them switch them on/off - there no easier way? i could, of course, maintain elements (lines, markers) of grouping in array , array represent logical group. right way? var path = waypointstolatlngpath(mywaypoints); // generate path waypoint var line = new google.maps.polyline({ path: path, strokecolor: '#ff0000', strokeopacity: 1.0, strokeweight: 1 }); line.setmap(map); as said in google maps api v3: how remove markers? , in comment above, v3 right ...

python - Why CherryPy session does not require a secret key? -

python - Why CherryPy session does not require a secret key? - i noticed cherrypy session not require secret key configuration. on contrary, pylons session does: http://docs.pylonsproject.org/projects/pylons_framework/dev/sessions.html i'm concerned security issues if i'm using session remember user authentication. any 1 can explain why cherrypy session not need secret key? or there suggestion how should create secure utilize session remember user login? there 2 different ways of maintaining session state: on server or on client. with server-side approach, maintain session info in files, database, or in memory on server , assign id it. session id sent client , stored in cookie (although can embedded in urls). each request, client's session id read , used web application load session info wherever it's stored on server. way, client never has access of session info , can't tamper it, downside have protect against session hijacking through u...

android - Layout positioning problem with Custom SlidingDrawer -

android - Layout positioning problem with Custom SlidingDrawer - hi i've been trying create work quite while , sense stuck, found component on web wich pretty nice, allows me top bottom sliding, default sample pretty easy bar goes on top , goes down: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <button android:id="@+id/button_open" android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/open" android:layout_centerinparent="true" android:visibility="gone" /> <textview android:layout_height="wrap_content" android:textappearance="?android:attr/t...

jquery - Question about JavaScript variable scope -

jquery - Question about JavaScript variable scope - can tell me why alert empty? var pending_dates = []; $.getjson('/ajax/event-json-output.php', function(data) { $.each(data, function(key, val) { pending_dates.push({'event_date' : val.event_date}); }); }); alert(pending_dates); i can't head around this. not declaring pending_dates global variable, accessible within each loop? how 1 solve this? please note json output working well. if declare pending dates within getjson function (and alert within function), works, need store info in array outside of getjson function. thanks contributions. edit thanks comments code working: pending_dates = []; $.getjson('/ajax/event-json-output.php', function(data) { $.each(data, function(key, val) { pending_dates.push({'event_date' : val.event_date}); }); }).success(function() { alert(pending_dates); }) thanks lot contributions! ...

java - eclipse: remote debugging a tomcat server behind a firewall -

java - eclipse: remote debugging a tomcat server behind a firewall - after starting tomcat jpda on, while @ company can remote debug bunch of web applications in eclipse. number of reasons in need of developing , remote debugging same webapps outside company firewall, , can access server via ssh on port 22. i tunneled needed ports (svn, nexus, tomcat itself, server or via server) localhost , services work fine, cannot start eclipse debugger in way; i'm getting "connection timed out while waiting packet xxx" or "connection refused" sec time seek on. checking nmap on server, reports port open before first connection attempt, , becomes closed after that. no interesting output log in catalina.out the command utilize start tunnel is: ssh -l 8000:localhost:8000 user@mycompany.com iptables temporarily stopped both on server , in local machine testing. am missing something? need forwards other port localhost? or in way involved name resolution? ed...

read eval print loop - Node.js REPL continuation lines -

read eval print loop - Node.js REPL continuation lines - when working node.js repl, there way quit continuation line node beingness on zealous with? for example: $ node > {- -} ... and pretty much can type gives continuation line. ctrl+d quits whole repl. obviously don't want go around typing {- -} time, find type erroneous when i'm using repl experiment. have quit repl, , loose bits in memory. you can type: .break type .help for more repl options... .clear command may useful because breaks , clears local context, in case want save problem of exiting , restarting repl. node.js read-eval-print-loop

If you're saving Java Exception information in the DB, what parts of the Exception should you save to help figure out the problem without redundancy? -

If you're saving Java Exception information in the DB, what parts of the Exception should you save to help figure out the problem without redundancy? - which parts of java.lang.exception object need saved in database give best chance of recreating problem led exception beingness thrown? and parts, if saved together, create redundant information? for example, if save result of calling exception.getmessage() , , save exception.getcause().getmessage() , end duplicate information? and, if save exception.getmessage , redundant save output exception.printstacktrace() ? my strategy save timestamp , stack trace of exception. that of import thing needed seek diagnose problem provoked exception. java exception-handling

Easiest way to produce guitar chords in linux and/or python -

Easiest way to produce guitar chords in linux and/or python - what i'm trying accomplish playing guitar chord python application. know (or can calculate) frequencies in chord if needed. i'm thinking if low level leg work of producing multiple sine waves @ right frequencies wont sound right due envelope needing right also, else wont sound guitar more of hum. tantilisingly, linux sox command play can produce pretty convincing individual note with: play -n synth 0 pluck e3 so i'm asking is, a) possible shoehorn play command whole chord (ideally differing start times simulate plectrum string stroke) -- i've not been able maybe theres bash fairydust that'll fork process or such sounds right. if possible i'd settle calling out bash command code (i dont reinventing wheel). b) (even better) there way in python of achieving (a guitar chord sound) ? i've seen few accessable python midi librarys frankly midi isn't fit sound want, far can tell. ...

asp.net - Bind null value to a dropdown list -

asp.net - Bind null value to a dropdown list - i using items sharepoint list binded dropdown list. however, want first value in dropdown empty. cannot insert null value in sharepoint list item. please allow me know how can programmatically. below code using bind list dropdownlist if (fldname.contains("xxxxxx")) { ddllist.datasource = data.getcode(); ddllist.datatextfield = "title"; ddllist.datavaluefield = "alphabetic_x0020_code"; ddllist.databind(); ddllist.selectedvalue = string.empty; ddllist.width = 120; } there has this. 0 position want new item - first in case. can after databinding. ddllist.items.insert(0 , string.empty); asp.net sharepoint

MongoDb: After inserting a UUID with ruby, c# can't convert it to GUID -

MongoDb: After inserting a UUID with ruby, c# can't convert it to GUID - i attempting insert object mongodb using ruby , retrieve using c# , norm driver. all seemed progressing until wanted utilize guid within c# object. i used next code set uuid in ruby before inserting mongo (as suggested blog post http://blog.mikeobrien.net/2010/08/working-with-guids-in-mongodb-with-ruby.html): bson::binary.new("d7b73eed91c549bfaa9ea3973aa97c7b", bson::binary::subtype_uuid) when retrieving object in c# exception "byte array guid must 16 bytes long." thrown. using administrative shell inspected contents of object. guid property had been set bindata(3,"zddinznlzwq5mwm1ndlizmfhowvhmzk3m2fhotdjn2i=") however if inserted same guid using c# guid property set to bindata(3,"7t6318wrv0mqnqoxoql8ew==") any ideas i'm doing wrong? i think blog illustration wrong. looks me want guid hexstring, ie starting "\xd7" (one...

javascript - Question regarding static class under namespace -

javascript - Question regarding static class under namespace - i have namespacein javascript code "mynamespace". creating static javascript class "mychildstaticclass" in it. using modular pattern. below code: if (typeof mynamespace == 'undefined' || !mynamespace) { var mynamespace = {}; } var mynamespace = (function(mynamespace) { mynamespace.mychildstaticclass = (function() { var myobject; myobject = { x:function(str) { alert(str); } }; homecoming myobject; })(); homecoming mynamespace; } (mynamespace || {})); the above code used like: mynamespace.mychildstaticclass.x('test'); and output of above alert box message test. have question way of creating static class , calling methods above? there other ways write in proficient manner? you same functionality doing: var mynamespace = {}; ...

objective c - How to add an image to UIBarButtonItem? -

objective c - How to add an image to UIBarButtonItem? - i created custom button , applied uibarbuttonitem. there no error nil shown on navigation bar:( code- //create custom button uiimage *image = [uiimage imagenamed:@"testbutton.png"]; uibutton *mycustombutton = [uibutton buttonwithtype:uibuttontypecustom]; mycustombutton.bounds = cgrectmake( 0, 0, image.size.width, image.size.height ); [mycustombutton setimage:image forstate:uicontrolstatenormal]; [mycustombutton addtarget:nil action:@selector(goback:) forcontrolevents:uicontroleventtouchupinside]; uibarbuttonitem *button = [[uibarbuttonitem alloc] initwithcustomview:mycustombutton]; self.navigationitem.leftbarbuttonitem = button; self.navigationcontroller.navigationbar.barstyle = uibarstyledefault; [button release]; [mycustombutton release]; [image release]; [navid release]; anybody can prepare code? :) from the docs: initwithimage:style:tar...

php - Break Row to Carriage Return preg_replace -

php - Break Row to Carriage Return preg_replace - i trying utilize preg_replace convert <br> or <br /> carriage homecoming (&#13;) . problem seems either doesn't find <br> 's or doesn't recognize hex code i'm trying pass in. here relevant php: preg_replace('`<br(?: /)?>(\x{13}/u)`', '$1', $content); other information: strings passing in have &quot; don't think interfere preg_replace() . here couple links have helped me far: http://www.webmasterworld.com/forum21/10973.htm (use carriage homecoming instead of \n in tooltips) http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php#58409 (use \x{13} instead of &#13 ) hmmm, seem have preg_replace formatted little strange. not sure why doing backreferences that? simple this, first variable should regex. 2nd should replacement, , 3rd should subject: preg_replace('%<br.*?>%', '&#13;', $content); i think wo...

git - find a branching off point for repo-less code -

git - find a branching off point for repo-less code - i have rails plugin copied git repo script/plugin install @ point. later, local patches added it. want maintain code separate branch in fork of original plugin's own repo. given git repo , code tree, what's way find commit closest new code, e.g. minimizing total amount of diff lines? if can recover timestamp when cloned repo, commit closest , branch there. otherwise, going have hairy time. you asking minimum edit distance between code , git repo, np-hard problem, , bad 1 in case since need tree diffs , edit distance of each git blob (that is, code files , other objects). you seek find needle in haystack help of git-tree-diff, first cloning repo of plugin, making branch, committing changes on top of it. tree-diff allow assess difference, you'd have repeat every commit, , hell. instead, take current code, above can 1 huge diff master's head of plugin repo, seek split changes many atomic commits...

osx - Using Imagemajick in java using OS X -

osx - Using Imagemajick in java using OS X - i have imagemajick installed in os x using macports. when run convert command command line (bash) able convert film jpg. when run via java process builder no such output. gives. next java code utilize execute command. private void run(string[] args) { seek { processbuilder pb = new processbuilder(args); process p = pb.start(); p.waitfor(); inputstream = p.getinputstream(); inputstreamreader isr = new inputstreamreader(is); bufferedreader br = new bufferedreader(isr); string line; while ((line = br.readline()) != null) { system.out.println(line); } = p.geterrorstream(); isr = new inputstreamreader(is); br = new bufferedreader(isr); while ((line = br....

javascript - How do I hide certain elements on my page, based on referral traffic? -

javascript - How do I hide certain elements on my page, based on referral traffic? - more specifically, how hide ads? pose question after reading this: coding horror entry in it, states as courtesy, turn off ads digg, reddit, , other popular referring urls. audience doesn't appreciate ads, , they're to the lowest degree click them anyway. i agree says. how do this? i'd utilize php this, javascript code hide ads create you're hiding ads , gaining revenue them (google smart, they'll find doing that). with php, however, can modify page before reaches user, eliminating problem. basically, conditionally check browser came from: <?php $sites = array("reddit.com", "digg.com"); if (!in_array(parse_url($_server['http_referer'], php_url_host), $sites)) : ?> <div>your ads</div> <?php else:?> <div>hello reddit person</div> <?php endif; ?> you'll have crea...

How to make Perl fall back to just execute without debugging when it fails to connect to remote host? -

How to make Perl fall back to just execute without debugging when it fails to connect to remote host? - [root@ test]$ perldb_opts=remoteport=localhost:1111 perl -d typeglob unable connect remote host: localhost:1111 compilation failed in require. @ typeglob line 0 main::begin() called @ /usr/lib/perl5/5.8.8/perl5db.pl line 0 eval {...} called @ /usr/lib/perl5/5.8.8/perl5db.pl line 0 begin failed--compilation aborted. @ typeglob line 0 as see,when fails connect,the programe fails , exits.how can create run if -d not specified in that case? i don't understand task trying perform here. not sure why you're invoking perl debugger here? i'm wondering if there's homecoming code cli command? if so, maybe can write shell script execute perl first way , if returns failure code, alter cli execute without -d switch. so, in other words, there may perl way want there many ways skin cat... perl remote-debugging

How to add/rename configurations in Visual Studio (C++) Project Wizard? -

How to add/rename configurations in Visual Studio (C++) Project Wizard? - i want generate c++ projects visual studio (2005/8/10) have more configurations other default "debug" , "release". example, might want additionally generate "debug dll" , "release dll", or rename them those. i've generated custom project wizard, , tried adding/renaming configuration names in .vcproj file (found in custom wizard project files), in default.js file (found in custom wizard project files), , in using custom common.js file (installed visual studio). none of if works. added configurations ignored. renamed configurations cause project generation fail. am asking impossible? if so, know whether it's possible manipulate .vcproj "on way out" in post wizard step? thanks in anticipation go solution properties. click "configuration manager..." under "active solution configuration" pull-down, click "<new...

asp.net mvc 2 - is it possible to check the filesize of a file before uploading it? -

asp.net mvc 2 - is it possible to check the filesize of a file before uploading it? - i trying upload file webserver in asp.net mvc 2 webapplication. works when file size less 102mb. this setting in web.config: <configuration> <system.web> <httpruntime maxrequestlength="102400" /> </system.web> can check before upload file filesize wont throw error when reaches on limit? you may checkout following blog post. can check file size on client using of file upload plugins out there (uploadify, plupload, ...). asp.net-mvc-2 c#-4.0

performance - What does the 'optimise' scala compiler flag do? -

performance - What does the 'optimise' scala compiler flag do? - i've tried using scalac -optimise version 2.7.7. @ time never got performance improvements, compilation took longer. is situation improve in scala 2.9.0 ? optimisations covered flag ? strange, there similar question on scala-user group: rex kerr answered @ time (may): i have never found case production code sped using -optimise , @ to the lowest degree when using sun jvm. grant in cases happen, seems apply similar optimizations jvm already. perhaps if there limits on optimization depth, using -optimise remove few layers , allow jvm few more. don't bother testing more, given how many cases (dozens) i've tried runtime hasn't changed measurably. i expect have impact on vms more conservative (e.g. jrockit) or less sophisticated (e.g. dalvik). ismael juma added: the scala distribution compiled -optimise, indeed it's not on unless argument...

iphone - Why is the initial size of UIScrollView still 320 on iPad? -

iphone - Why is the initial size of UIScrollView still 320 on iPad? - we have xib designed iphone. porting app ipad. we using paged portion of uiscrollview. have autoresizing masks set width , height. on initial load ipad frame width 320, of course of study makes ui bad. what's odd if rotate device, "picks" new size based on ipad screen width. right point forward. do need initialize frame width? did check box said "targeted ipad" when create xib? if not, have manually edit xib (or recreate again) you need 2 different xibs same controller. instantiate them this. myscrollviewcontroller *controller; if(ui_user_interface_idiom() == uiuserinterfaceidiomphone) { // iphone related code controller = [[myscrollviewcontroller alloc] initwithnibname:@"myscrollviewcontroller" bundle:nil]; } else { // ipad related code cont...

java - Replace factory-based object creation with CDI mechanism -

java - Replace factory-based object creation with CDI mechanism - i wanted introduce cdi (weld) our project , having problem objects manually constructed. so have classes implementing ireport interface, have field should injected. null @ runtime because of classes beingness generated reportfactory in class reportcontroller . private map<string,object> generatereport(reportinfo ri, ...) { // input validation ireport study = reportcontrollerfactory.getreportinstance( ri.getclassname() ); // ... } i aware can utilize @produces annotation custom annotation in reportcontrollerfactory , how utilize @inject variable can created, after validation done, inside method? , how submit parameter ri.getclassname() ? object ri not known when reportcontroller constructed. thank much! kind regards, sebastian edit @ jul 08, 2011 (10:00): reportfactory class: public static ireport getreportinstance( string classname ) throws reportexception { ireport stu...