Posts

Showing posts from September, 2015

jsf - p:dataExporter throws java.lang.NoClassDefFoundError: com/lowagie/text/phrase -

i tried use data exporter control of primefaces 3.2. following code: <p:commandlink value="export" ajax="false"> <p:dataexporter type="xls" target="dtable" filename="myfile" /> </p:commandlink> <p:datatable id="dtable" ........../> when click on export link, following error: java.lang.noclassdeffounderror: com/lowagie/text/phrase i downloaded itext jar 5.2.1 , included in application, still same error. how solve it? try itext 2.1.7 not 5.2.1. http://olex.openlogic.com/packages/itext/2.1.7 i think there licence conflicts. primefaces uses 2.1.7 for excel export need apache poi. try 3.7: http://archive.apache.org/dist/poi/release/bin/ edit (you need poi-3.7*.jar , poi-ooxml-3.7*.jar )

Why won't my image display in my Java Applet? -

when use following code: public void paint(graphics g){ //displays version number , name. g.setfont(new font("courier", font.plain, 10)); g.drawstring("dcoder " + execute.execute.version, 2, 10); //displays logo in center. g.drawimage(logo, centeralign(logo.getwidth(null)), 50, this); } private int width(){ //gets , returns width of applet. int width = getsize().width; return width; } private int height(){ //gets , returns height of applet. int height = getsize().height; return height; } private int centeralign(int obwidth){ int align = (width()-obwidth)/2; return align; } in java applet, image not display until call repaint() (by resizing applet viewer window)? why won't image display? an asynchronous loaded image has handled thus. logo.getwidth(this); // indicate asynchronous imageobserver ... @override public boolean imageupdate(image img, int infoflags, ...

parsing - In perl, how to loop through file, parse line and then compare all values of the line? -

i'm new perl , trying figure out how parse lines within tab-delimited file , compare values parsed lines value , print line. for example: want print out lines have numbers greater 3. a 2.4 6.9 3.1 b 10.2 3.4 7.6 c 1.9 2.6 2.3 i output b 10.2 3.4 7.6 because b line numbers greater 3 thanks in advance use text::csv cpan module parse tab-separated file array of arrays loop on records. each record check if fields 1,2, , 3 bigger threshold value. 3 fields, use simple "if", large # of fields, use grep if fields bigger, print record stdout

java - stack overflow exception on xml transformation -

i getting following java stackoverflow error on xml transformation in weblogic server 10g hosted in sun solaris . happens particular xml tranformation , rest xml transformation works fine. xsl file used not big. i using transformation api available in rt.jar getting error xalan apache package( com.sun.org.apache.xalan.internal.xsltc.dom.simpleresulttreeimpl ) havent packaged in application. another interesting thing didnt exception when run application in weblogic 10g server hosted in windows machine, in sun solaris. can let me know why error. can let me know jar file causing exception ? weblogic have xalan.jar ? if can try upgrade jar file , see if working ? caused by: java.lang.stackoverflowerror @ com.sun.org.apache.xalan.internal.xsltc.dom.simpleresulttreeimpl.characters(simpleresulttreeimpl.java) @ com.sun.org.apache.xalan.internal.xsltc.dom.simpleresulttreeimpl.copy(simpleresulttreeimpl.java:438) @ com.sun.org.apache.xalan.internal.xsltc.runt...

java - JavaFX 2.1 and threads? -or- Ending a JavaFX application gracefully? -

i wanted simple way play mp3 file java application. after research found newest versions of java 7 se packaged javafx, thought try. question not playing mp3 files, getting javafx work in well-behaved way. so, in first experiment javafx, used code suggested in post stackoverflow ( see here ) , created, essentially, following test program: import javafx.application.application; import javafx.stage.stage; import javafx.scene.media.media; import javafx.scene.media.mediaplayer; public class progtest extends application { /*---------------------------------------------------------*\ function: main() \*---------------------------------------------------------*/ public static void main(string args[]) { launch(args); } /* end: main() */ /*---------------------------------------------------------*\ function: start() \*---------------------------------------------------------*/ @override public void start(stage stage) ...

c# - Connection string hidden somewhere? -

i have 2 databases on 1 machine has 2 different sites running on iis. lets call them site1 & site2 , db1 & db2. second site , bd copys of first one. site2 connects db2 , seems work nice when took offline db1 stoped working wierd since data created using site2 in db2. in fact of site works except 1 method we use entity framework access database , when trace code looks ok, somehow doesn't work. in our auto-generated code entity framework traced connectiong string , outcome correct initial catalog=db2; but in next line have code return ((iobjectcontextadapter) this).objectcontext.executefunction<t_reference_data>( "getreferencedata", groupnameparameter); and inner exception says: database 'db1' cannot opened because offline. all other methods seem use correct database except one. can't figure out db1 configured or hardcoded the problem (as usual) stupid hell. of guys defined db on stored procedures. when...

AttributeError: ZipFile instance has no attribute 'open' in python 2.4 -

storefile(ftpcon, file, archive.open('nonvol/'+file)) gives me attributeerror: zipfile instance has no attribute open but when change .open .read (since open() not available in 2.4) get: attributeerror: str object has no attribute read in: ftpcon.storbinary('stor ' + filename.strip(), file)

osx lion - Objective-C Library - cannot form weak reference to instance of class -

i'm working xmpp library objective-c, , i'm using "desktop" example code. it logs in fine; however, when open new chat, or sends me message, crashes. this seems goes wrong: xmppstream[11678:1b03] recv: 2012-06-05 15:03:59:379 xmppstream[11678:1b03] recv: 2012-06-05 15:03:59:382 xmppstream[11678:403] rostercontroller: xmpprosterdidchange: 2012-06-05 15:03:59:387 xmppstream[11678:403] rostercontroller: xmpprosterdidchange: 2012-06-05 15:04:01:900 xmppstream[11678:403] tableview:shouldedittablecolumn:"jid" row:0 2012-06-05 15:04:01:900 xmppstream[11678:403] user: objc[11678]: cannot form weak reference instance (0x7fcd4a498930) of class chatcontroller and objc[11998]: cannot form weak reference instance (0x7f853bd17c70) of class chatcontroller (lldb) (lldb) what "cannot form weak reference instance....of class chatcontroller" mean? guys know how can fix it? used older version of code snow leopard , worked, lion screwing me up! th...

design patterns - Initialization class for other classes - C++ -

i initialize 2 classes(say class aregister, class bregister) registers values(a,b). want initialize these 2 classes super(?) class( class registerall). ex: registerall class initialize aregister , bregister. using module need not create objects of aregister , bregister individually, instead can create object of registerall. i these registrations in constructor. needs done create objects of registerall class , registrations happens automatically. we not use exceptions in our project. if there error in registration not possible know. should have separate member function registration or let constructor registration. i newbie oo design. feel wrong design, helpful if can point right approach. the best way using crtp (curiously recurring template pattern), derived classes aregister , bregister pass template arguments base class registerall. this: class registerall { public: template<class derivedtype> derivedtype *createtype() { registerall ...

c# - Get Stream basing on WebViewBrush in Windows 8 Metro App -

using webviewbrush can render web page content (it's screen shot) e.g. rectangle element. how convert screen shot (brush) stream can save on disk or send on network? not sure if it'll work maybe can try writeablebitmapex: http://writeablebitmapex.codeplex.com/ ?

android - Some confusion on the method instantiateItem(ViewGroup container, int position) of PagerAdapter -

public object instantiateitem(viewgroup container, int position) { imageview view = new imageview(); container.addview(view); return view; } i read example code of pageradapter, , write addview method. above simple code, , know 'return view' used return view display, container.addview(view) do? adding view container makes appear on-screen. object returned instantiateitem key/identifier; happens using actual view purpose tends convenient if aren't using fragment manage view page. (see source fragmentpageradapter example.) the pageradapter method isviewfromobject helps pager know view belongs key. if you're returning view key object, can implement method trivially as: public boolean isviewfromobject(view view, object object) { return view == object; }

sql - What is the use of """...""" in python instead of "..." or '...', especially in MySQLdb cursor.execute -

is there difference if use """..""" in sql of cusror.execute. if there slight difference please tell it's used split query on many lines format nicely: db.query(""" select * employee, department employee.departmentid = department.departmentid; """) also using """...""" around string allows not escape " , ' inside string.

Ruby on rails File Upload -

today have little problem containing file upload. first infos: rubyversion: 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] railsversion: rails 3.1.1 needed code: form <%= form_for @label, :html => { :multipart => true } |f| %> <% if @label.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@label.errors.count, "error") %> prohibited label being saved:</h2> <ul> <% @label.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :file %><br /> <%= f.file_fie...

.net - getting label text in gridview -

i want cell value gridview,but empty string returned .i implemented code in selectedindexchanged event of radiobuttonlist .i iterate through gridview , access cell code .but problem stll remaining.i used 3 itemtemplate ,each has 1 elemnt each element own coulmn .aspx <asp:gridview id="gridview2" runat="server" autogeneratecolumns="false" > <columns> <asp:templatefield> <itemtemplate> <asp:label id="label2" runat="server" text='<%# eval("qno") %>'> </asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield> <itemtemplate> <asp:label id="label3" runat="server" text='<%# eval("description") %>'> </itemtemplate> </asp:tem...

vb.net - refactoring a field into a property -

i learning vb.net new job , have mixed feelings on public fields. see many arguments them hurting encapsulation. in python, common practice keep things simple , use fields when enough. if want add logic later, refactor them property without breaking client code. in codebase working see huge classes containing dozen of properties like: private __getdescriptionmode boolean <defaultvalue(false)> _ public property getdescriptionmode() boolean getdescriptionmode = __getdescriptionmode end set(byval value boolean) __getdescriptionmode = value end set end property that's 10 lines of code little value inside. can barely see 3 of them in visual studio window. have 2 questions: is there valid reason not define fields , refactor them properties when needed? are oop principle important sacrifice readability? (i can @ fewer things, have parse property make sure are'nt doing special, etc) edit clarify first question: have chance of bre...

c++ - Initialize std::array with a range (pair of iterators) -

how can initialize std::array range (as defined pair of iterators)? something this: vector<t> v; ... // know v has n elements (e.g. called v.resize(n)) // want initialized elements array<t, n> a(???); // put here? i thought array have constructor taking pair of iterators, array<t, n> a(v.begin(), v.end()) , appears have no constructors @ all! i know can copy vector array, i'd rather initialize array vector contents directly, without default-constructing first. how can i? with random access iterators, , assuming size @ compile-time, can use pack of indices so: template <std::size_t... indices> struct indices { using next = indices<indices..., sizeof...(indices)>; }; template <std::size_t n> struct build_indices { using type = typename build_indices<n-1>::type::next; }; template <> struct build_indices<0> { using type = indices<>; }; template <std::size_t n> using buildindices = ...

objective c - Passing NSIndexPath to New View? -

i having real troubles passing nsindexpath new view. how app works: i have uibarbuttonitem in nab br, tap , popover view, shows bunch of stuff. need nsindexpath main view, popover view. i have property nsindexpath in popover view class , popover transition connected in storyboard. then have code pass index path across views: -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"statspopover"]) { statsviewcontroller *statsvc = [segue destinationviewcontroller]; statsvc.selectedindex = stageselectiontable.indexpathforselectedrow; } } however, while gets called, index path isn't sent between views. index path on popover default, 0,0 row , section. hope can help, thanks. you know debugging/logging method running, if statement triggered, , stageselectiontable.indexpathforselectedrow has value expect. doing kind of diagnosis puts on right path solving issue. keep @ ...

actionscript 3 - Having dynamic name's in array AS3 -

i'm having issues as3. i'm trying items put in array have dynamic name (ex. lines[k]) when want call on them later can call them number instead of calling them @ time i've found tutorials dynamic array names on website i'm unsure how fit them in code because keep getting error's. at moment code: var numpoints:number = 0; // number of points placed. // no dragging work until 7 points placed. // set max & min stage coordinates points can dragged, , make point diameters settable. var xmax:number = 700; var xmin:number = 5; var ymax:number = 500; var ymin:number = 5; var o = 0; var circlewidth:number = 5; // boolean variables indicate dragging happening appropriate point follows mouse // on mouse_move event. var isdragging1:boolean = false; var isdragging2:boolean = false; var isdragging3:boolean = false; var isdragging4:boolean = false; var isdragging5:boolean = false; var isdragging6:boolean = false; var isdr...

c++ - Reposition graphics items on window resize -

ok, have randomly placed graphics items on graphics scene. open window , display these items. when resize window, want items stay same size reposition proportionally window size. how did subclassed graphics view , when there resize event, sent resize object graphicsscene object. able this: double scalex = double(event->size().width())/double(event->oldsize().width()); double scaley = double(event->size().height())/double(event->oldsize().height()); then used these values this: derivedpointitem->setpos( derivedpointitem->pos().x() * scalex, derivedpointitem->pos().y() * scaley ); this works ok, it's not quite right if resize window small or large. think problem graphicsscene rect , graphics view rect not same or something. furthermore, have background resizes window size: void roiwindow::drawbackground( qpainter* painter, const qrectf& rect ) { this->setscenerect(0,0,rect.width(),rect.height()); painter->...

How do I make Bash' tab complete automatically cycle through options OSX -

currently when i'm in home folder , want cd documents type cd d , hit tab , bash shows me list of folders match d . what want occur when press tab , bash autocompletes first option matches i've put in , each time press tab cycles through next option. is there way this? thought sure copy of bash on old ubuntu box had feature. yes! found answer question @ following link @ macworld put following in .bashrc or .bash_login bind '"\t":menu-complete'

node.js - Express.js + Less: How to configure properly -

i tried modules 'less' , 'less-middleware'. tried different code-snipplets have found in tutorials. there no documentation available. can please explain how configue express.js , less, less getting precompiled properly?! use following questions guideline: shall use either 'less' module or 'less-middleware' module? official/supported way? superior? how should directory-structure in /public like? (any specific folders need? 'styles'/'less'/'css'? or yourself?) how configure express app regarding directory-structure (from question 2). (static files , compiler options or less-middleware, directories important here) how reference precompiled stylesheet html? (with .less or .css? reference type? directory-path?) would nice if answer :-) this solution work express 2.x. i have found solution, helps someone: 1. less or less-middleware i using less because have read official port. not sure difference si...

html - jquery .each works only on the first element -

i'm having trouble understanding jqueries .each. have following code: $('#testdiv').each(function(index, domele){ $(this).text(index); }); and following html <div id="p18"> <div class="inner"> <span>...</span> <p class="right">...</p> <div id="testdiv"></div> </div> </div> <div id="p19"> <div class="inner"> <span>...</span> <p class="right">...</p> <div id="testdiv"></div> </div> </div> <div id="p20"> <div class="inner"> <span>...</span> <p class="right">...</p> <div id="testdiv"></div> </div> </div> when script runs works first testdiv, correctly sets text 0, other...

playframework - Scala: Read some data of an Enumerator[T] and return the remaining Enumerator[T] -

i using asynchronous i/o library of playframework uses iteratees , enumerators. have iterator[t] data sink (for simplification it's iterator[byte] stores content file). iterator[byte] passed function handles writing. but before writing want add statistical information @ file begin (for simplification it's 1 byte), transfer iterator following way before passing write function: def write(value: byte, output: iteratee[byte]): iteratee[byte] = iteratee.flatten(output.feed(input.el(value))) when read stored file disk, enumerator[byte] it. @ first want read , remove additional data , want pass rest of enumerator[byte] function handles reading. need transform enumerator: def read(input: enumerator[byte]): (byte, enumerator[byte]) = { val firstenumeratorentry = ... val remainingenumerator = ... (firstenumeratorentry, remainingenumerator) } but have no idea, how this. how can read bytes enumerator , remaining enumerator? replacing iteratee[byte] outputstream...

jni - Defining sem_t in android ndk -

i porting code libs in c++. note android include library has semaphore.h. i include files when compiling gives me error: 'sem_t' not name type. for example in linux define semaphore like: sem_t id; then call: sem_init(&id, 0, initialcount); in application.mk using: app_stl := gnustl_static thanks in advance. try compile -lz -lm -llog -lc -l$(call host-path, $(local_path))/$(target_arch_abi) or add following line android.mk : local_ldlibs += -lz -lm -llog -lc -l$(call host-path, $(local_path))/$(target_arch_abi) it works me

How will I include a Java jar file when compiling a Java class and running the Java file from the command console? -

i have small java file interacting postgresql database, i've downloaded drivers , in file import org.postgresql.driver . in command console type javac myfilename.java ; compiles run java myfilename , throws error saying can not find org.postgresql.driver files. so how import jar when run file or when compile file not sure when import should take place? compile: javac -cp ".:postresql.jar" -d . myfilename.java run: java -cp ".:postresql.jar" myfilename

java - Parameterized test with ClasspathSuite -

i need run test multiple times in succession (4 times, 1 each browser testing webdriver). understand use case parameterized tests. however, utilizing classpathsuite , seems cannot specify multiple @runwith annotations. is there way can test run multiple times , send sort of parameter (like 0 - 3 4 runs need) test? i faced this, classpathsuite handles fine. trick use these annotations in little dummy project finds & launches tests (across other projects): @runwith(classpathsuite.class) @suitetypes(run_with_classes) then test requiring specific runner uses runner directly, such @runwith(parameterized.class) see section "running other runwith-suites" here: https://github.com/takari/takari-cpsuite due wide range of tests, opted use options: @suitetypes({run_with_classes, test_classes, junit38_test_classes}) (the default appears test_classes.)

java - Encrypted data length is very large with RSA -

i want encrypted data have same length original text, because must respect constraint of length. using bouncycastle . here's code generate keys pair: keypairgenerator keygen = keypairgenerator.getinstance("rsa"); keygen.initialize(512); keypair keypair = keygen.genkeypair(); publickey pub = keypair.getpublic(); byte[] pubs = pub.getencoded(); and here's code encrypt: cipher cipher = cipher.getinstance("rsa/ecb/pkcs1padding"); publickey pk = keyfactory.getinstance("rsa").generatepublic(new x509encodedkeyspec(pubs)); cipher.init(cipher.encrypt_mode, pk); byte[] cipherbytes = cipher.dofinal(plainarray); the encoded data large, can make small original data ? nothing, @ least not regarding rsa. rsa requires amount of padding secure, , data seen random data compression method, cannot compress either. of course, should not directly encrypt data directly using rsa, should encrypt random session/data key instead. then, have encrypte...

sfml - gui library for smfl when using c# -

there exists cegui , nice gui library, useable sfml. issue there c# bindings sfml not cegui available -as seems... is there other gui library out there, working sfml, use in c#? i'd avoid jump c++ reason there no gui library available... thanks i can't vouch it, stummbled across 1 in search gui library use sfml .net bindings: gwen-dotnet

scripting - PHP preg_match meaning and issue -

currently have code: <?php if (isset($_get['id'])) { $itemid = $_get['id']; $search = "$itemid"; $query = ucwords($search); $string = file_get_contents('http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php'); if($itemid=="") { echo "please fill out form."; } else { $string = explode('<br>',$string); foreach($string $row) { preg_match('/^(\d+)\s=\s(\d+)\s=\s(\d+)\s=\s(\d+)/', trim($row), $matches); if(strstr($matches[1], $query)) { echo "<a href='http://clubpenguincheatsnow.com/tools/newitemdatabase/info.php?id=$matches[2]'>"; echo $matches[1]; echo "</a><br>"; } } if($matches[1]=="") { echo "item not exist!"; } } } else { echo "item not exist!"; } ?> what want know section mean? preg_match('/^(\d+)\s=\s(\d+)\s=\s(\d+)\s=\s(\d+)/', trim($row), $matches); /^(\d+)\s=\s(\d+)\s=\s(\d+)\s=\s(\d+)/ part wonde...

html - Access grand child elements from the DOM in jquery? -

how go accessing grand child elements within in ul structure such jquery: <ul> <li>sample</li> <li>sample</li> <li>sample</li> <li> <ul> <li>need access li</li> </ul> </li> <li>sample</li> </ul> should simple $('ul li ul li')

database - How to create a table in Java? -

i want create sort of table in java. tried using hashmap: public map<string, double> namesandprices = new hashmap<string, double>(); this doesn't work when want add string so: public map<string, double, string> namesandprices = new hashmap<string, double, string>(); what class can use create sort of table in java can values , not. use objects, rather trying put unstructured data collections. your map should map<string, product> , product objects containing name, price, , other properties of products. btw, told in your previous question , , accepted answer.

c++ - Compiler errors when using a Boost::Thread with parameters -

i appreciate here. trying call function asynchronously boost::thread, getting errors. real code. in main: vector<std::string> = ...; vector<std::string> b = ...; vector<boost::thread> threads; threads.push_back(boost::thread(do_work, an_integer, a[i], b.begin(), b.end())); // later join()... elsewhere: void do_work(int i, std::string a_string, vector<string>::iterator begin, vector<string>::iterator end) { // stuff } i quite new stuff, being more used c#. anyway, these errors getting: error c2664: 'void (int,std::string,std::_vector_iterator<_myvec>,std::_vector_iterator<_myvec>)' : cannot convert parameter 1 'std::_vector_iterator<_myvec>' 'int' error c2664: 'void (int,std::string,std::_vector_iterator<_myvec>,std::_vector_iterator<_myvec>)' : cannot convert parameter 3 'std::basic_string<_elem,_traits,_ax>' 'std::_vector_iterator<_myvec>' err...

java - How to find value of innerattributes in mongodb? -

i new mongodb.and want values of time in json like: { "_id" : { "$oid" : "4ceb753a70fdf877ef5113ca"}, "loginrequest" : { "time" : "11-06-2012 11:59:33", "innerattr4" : "innervalue4"} } { "_id" : { "$oid" : "4ceb753a70fdf877ef5113cb"}, "loginrequest" : { "time" : "11-06-2012 12:34:05", "innerattr4" : "innervalue4"} } after searching found use dot notation. dot notation not working me in java. can tell me how this? i used dot notation in manner. returns null. string selectedcollection = "user01"; //will contain selected username dbcollection coll = db.getcollection(selectedcollection); arraylist<string> result = new arraylist<string>(); //dbobject obj = coll.findone("loginrequest.time"); basicdbobject query = new basicdbobject(); basicdbob...

ios - Using the AVURLAsset to play a Remote Video File -

i want use avurlasset play video file on server not local file. have read avurlasset cant used directly remote files . read link of stack overflow avurlasset cannot load remote file this link has method use avurlasset play remote files not able understand fully. observer not being called. can please me? don't want use avplayer play video reasons. grabbing frames avasset , rendering them textures in opengl need avurlasset only. here code at -(void) startplayer { nsurl *url=[nsurl fileurlwithpath:@"http://gamooz.com/wildlife.mp4"]; pitem = [avplayeritem playeritemwithurl:url]; player = [avplayer playerwithplayeritem:pitem]; [player play]; pitem addobserver:self forkeypath:@"status" options:0 context:nil]; } -(void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change: (nsdictionary *)change context:(void *)context { nslog(@"heyy"); if ([keypath isequaltostring:@"status...

c# - Program Hangs while executing -

i having problem program executes , hangs somewhere during execution. want know causes this. for (long = maxnumber; > 2; i--) { isprime = true; (long g = 2; g < i; g++) { long temp = % g; if (temp == 0) { isprime = false; break; } } if (isprime == true) { largestprimefactor = i; break; } } if tried correctly, code trying find largest prime between 0 , maxnumber. use sieve of eratosthenes finding prime numbers between 0 , square root of maxnumber. then, can iterate maxnumber 0 number indivisible of prime numbers you've found. edit : tried this var sqrtmax = (int)math.sqrt(maxnumber); var primecandidates = enumerable.range(2, sqrtmax-1) .todictionary(number => number, iscomposite => false); foreach (var number in primecandidates.keys.toarray()) ...

android - Values in sharedpreferences are not cleared -

i developing app in need manage users session i.e when user logs in first time must see login page , once authenticated redirected home screen , tht time value set in sharedpreferences. on home screen when user clicks on logout button values in shsredpreferences must cleared , next time user opens app must directed login page.unless , until user clicks logout must not shown login page. able store values in sharedpreferences not able delete them. here code loginpage.java package com.sess.eg; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.preference.preferencemanager; import android.view.view; import android.widget.button; import android.widget.edittext; public class loginpage extends activity { /** called when activity first created. */ edittext acc,user,pin; button login; stringbuilder builder = new stringbuilder(); string username; s...

c# - asp:hyperLink NavigateURL and Eval functions -

what correct syntax add eval() function navigateurl attribute of asp:hyperlink? i trying achieve below: navigateurl="http://home/?<%# eval("u_id") %>" the link should "http://home? + value of u_id" syntax isn't right know. whats correct spelling? try this navigateurl='http://home/?<%# eval("u_id") %>' or navigateurl='<%# "http://home/?" + (string)eval("u_id") %>'

How to automatically change keyboard layout on switch to vim normal-mode? -

sometimes use vim write non-us text, , when wanna use command in normal mode, need change layout us. it's possible automatically? ps. can mapping this , in case command looks :ц instead :w - not pretty , typo-risk. update i don't want use keymap option, because prefer switch languages capslock. i've try write autocmd insertleave event, failed... update 2 probably know, why following not work? function setuslayout() !setxkbmap us,ru endfunction autocmd insertleave * call setuslayout() :help langmap is provide info need.

C# Destructor not calling after out of scope -

i have problem destructor after going out of scope(it calling after time , need make action on form, example change radio button), maybe there's mistake in code. take look: namespace windowsformsapplication2 { public partial class form1 : form { public form1() { initializecomponent(); eventlogger.print += delegate(string output) { if (!textbox1.isdisposed) this.invoke(new methodinvoker(() => textbox1.appendtext(output + environment.newline)), null); }; } private void button1_click(object sender, eventargs e) { testclass test = new testclass(); } } public static class eventlogger { public delegate void eventhandler(string output); public static event eventhandler print; public static void addlog(string textevent) { print(textevent); } } public class testclass { public testclass() ...

perl - Setting up mod_perl on OSX Lion Apache server -

i new both perl , apache servers. i'm trying basic hello world going cgi script. here code hello world cgi file: #!/usr/bin/perl print "content-type: text/html\n\n"; print "<h1>hello world</h1>\n"; when execute cgi script on command line, ./hello.cgi, works, when open hello.cgi in browser, displays text of cgi file. when @ error_log in /var/log/apache2/error_log can see mod_perl running: apache/2.2.21 (unix) dav/2 mod_perl/2.0.5 perl/v5.12.3 configured -- resuming normal operations but when run following perl program, appears don't have "mod_perl" env variable: if (exists $env{"mod_perl"}) { print "yay!\n"; } else{ print"mod_perl not working\n"; } by way, hello.cgi file , perl script above located in /users/myusername/sites/ could me configure mod_perl can view hello.cgi in browser? i've been reading mod_perl documentation , searching forums many, many hours no avail. in ad...

jquery - JqueryMobile Popup menu is not working -

i trying build dummy page understand jquerymobile not able implement "menu" [click on menu button on page] working on link below: http://jquerymobile.com/branches/popup-widget/docs/pages/popup/index.html how can implement? using jquerymobile 1.1.0 version. any code sample appreciated. you using beta feature not yet released, check make sure using jquery 1.7.1 or later ( http://jquerymobile.com/test/js/jquery.js ) jqm 1.2.0 ( http://jquerymobile.com/test/js/jquery.mobile.js ) jqm 1.2.0 css ( http://jquerymobile.com/test/css/themes/default/jquery.mobile.css ) live example: http://jsfiddle.net/wsz5b/1/ docs: http://jquerymobile.com/test/docs/pages/popup/index.html related: popups in jquery mobile not working intended, please advice

jQuery syntax for multiple delegated events -

the jquery docs @ http://api.jquery.com/on/ mention benefits of delegated-events using following syntax (which attaches event handler 1 element): $('#mytable').on('click', 'tr.hoverable', function(){ // blah }); but can't find reference proper syntax attaching multiple events @ once delegated-events. there shortcut following, tr.hoverable delegated event? $('#mytable tr.hoverable').on({ mouseenter: function(){ // blah }, mouseleave: function(){ // blah }, click: function(){ // blah } }); or solution ... $('#mytable').on('click', 'tr.hoverable', function(){ // blah }).on('mouseenter', 'tr.hoverable', function(){ // blah }).on('mouseleave', 'tr.hoverable', function(){ // blah }); ? $('#mytable').on({ mouseenter: function(){ // blah }, mouseleave: function(){ // blah }, ...

web scraping - How can a webpage be made such that they can not be scraped by bots? -

this question has developed off answer here . my question therefore steps can 1 take wend off standard scrapers? in addition previous mentions of robots.txt , robots meta tag , , using more javascript, 1 of sure methods know of put restricted content behind user login. limit purpose-built bots. add strong captcha (like recaptcha ) user login , purpose-built bots blocked too. if site looking verify identity of client (ie: including whether it's bot), that's user-logins for. :) user login's can disabled if strange activity detected.

javascript - Turn off firefox's smooth scrolling? -

firefox's new smooth scrolling feature causes scroll callback trigger @ each step in animation. demo in ff , chrome see difference is there way have only fires 1 event when page has finished scrolling make page scroll abruptly in chrome try this: function throttle( fn, timeout ) { var tid = 0; return function() { cleartimeout( tid ); var args = [].slice.call( arguments ), ctx = this; tid = settimeout( function() { fn.apply( ctx, args ); }, timeout ); }; } $(window).on("scroll", throttle( function() { $('div').eq(0).append('scroll happened'); }, 100)); it fire scroll once no scroll has happened in 100 milliseconds. http://jsfiddle.net/nlghs/1/

linux - How to prioritize write() over mmap updates (or delay mmap page cache flush) -

i'm running specialized db daemon on debian-64 64g of ram , lots of disk space. uses on-disk hashtable (mmaped) , writes actual data file regular write() calls. when doing lot of updates, big part of mmap gets dirty , page cache tries flush disk, producing lots of random writes in turn slows down performance of regular (sequential) writes data file. if possible delay page cache flush of mmaped area performance improve (i assume), since several (or all) changes dirty page written @ once instead of once every update (worst case, in reality of course aggregates lot of changes anyway). so question: possible delay page cache flush memory-mapped area? or possible prioritze regular write? or have other ideas? madvise , posix_fadvise don't seem make difference... you play tuneables in /proc/sys/vm . example, increase value in dirty_writeback_centisecs make pdflush wake less often, increase dirty_expire_centiseconds data allowed stay dirty longer until must written ou...

c - gtk+ menus mouse wheel speed -

i working on grandchild of file-browser-applet in c. my problem can't find solution speed scrolling mousewheel in menu. in case every mousewheel click moves 1/2 entry, want 5 entries. the code: eintrag->menu = gtk_menu_new() ; gtk_signal_connect(gtk_object (eintrag->menu),"scroll-event",(gtksignalfunc) scroll_test,null) ; if ( (n = scandir(parent->full_name,&dir_list,0,alphasort)) > 0 ) { ( = 0 ; < n ; i++ ) { eintrag->item = gtk_image_menu_item_new_with_label(eintrag->filename) ; ,,,, } } ------------------------------------------------------------------------------------ gboolean scroll_test(gtkwidget *widget,gdkeventscroll *event,void *nix) { g_print("scroll %s %d %d \n",name,event->send_event,event->direction ; return false ; } the code simple gtk menu "scroll.event" attached. the first try emit aditional scroll-event within ...

asp.net - HTTP Error 500.19 - Internal Server Error -

i got problem after deploying web package iis: http error 500.19 - internal server error requested page cannot accessed because related configuration data page invalid. this configuration section cannot used @ path. happens when section locked @ parent level. locking either default (overridemodedefault="deny"), or set explicitly location tag overridemode="deny" or legacy allowoverride="false". config source: 119: </modules> 120: <handlers> 121: <remove name="webservicehandlerfactory-integrated" /> how can solve issue? see scenario 7 on page troubleshooting http 500.19 errors in iis 7 , looks pretty identical error message. one of key points think following: this indicates asp.net either not installed or has corrupted/incomplete installation because installation of asp.net unlocks section. hence if case, 1 should install asp.net feature server manager (under web server...