Posts

Showing posts from March, 2011

c# - HtmlHelper extension alter the value of the property passed in -

i have html helper display phone numbers text boxes in friendly way. usage: html.phonenumberfor(m => m.phonenumber) i want take number "1111111111" , output "(111)111-1111". have tried updating viewdata of html helper grabbing property expression in html helper extension method, doesn't seem work. so, know how can update value of property in expression object? here code doesn't work: public static mvchtmlstring phonenumberfor<tmodel>(this htmlhelper<tmodel> helper, expression<func<tmodel, string>> expression, object htmlattributes) { var value = modelmetadata.fromlambdaexpression(expression, helper.viewdata).model string; if (!string.isnullorempty(value) && value.length == 10) { value = string.format("({0}){1}-{2}", value.substring(0, 3), value.substring(3, 3), value.substring(6)); var fieldname = helper.viewcontext.viewdata.templatein

jquery - Nivo Slider dose not load the Ajax response from PHP file -

i'm trying import images html using php, nivoslider not loaded that. looked cause of problem. printing alert message of response , right. here html , ajax query: <div id="workcontent" class="pcontent" style="display:none;"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoslider"> </div> </div> <script> $(document).ready(function() { var wl = $('#worklist div'); wl.on('click', function(){ var name = $(this).attr('id'); console.log(name); $.ajax({ url: 'read.php', type: 'post', data: { data : name } }).done(function (response) { $('#slider').prepe

swing - Java GUI adding a JList to class in another file -

i'm trying call jlist have in 1 class , add no avail, it's telling me static , non static functions i've got arraylist called finallist in 1 class, filled values, , has been checked printing list out. then have class in different file called cupboard, want put items jlist there. finallist.add(si); is items being added, si array items, , finallist new array in cupboard class file, have public cupboard() { cupboardcontent = new jlist(shoppinglist.finallist.toarray()); } where cupboardcontent new jlist want items go. thanks if has idea. i'm sure it's straightforward, , i'm being quite stupid! it'd seem when combining normal processes gui, i'm fairy new working gui i'm struggling make connections! //edit right, first bit of code adding items array absolutely fine, need work out how call in new class. currently, have public class kitchencupboard extends jpanel //implements actionlistener { private jlist cupboa

ember.js - Ember Router transitionTo nested route with params -

app.router.map(function() { this.resource('documents', { path: '/documents' }, function() { this.route('edit', { path: ':document_id/edit' }); }); this.resource('documentsfiltered', { path: '/documents/:type_id' }, function() { this.route('edit', { path: ':document_id/edit' }); this.route('new'); }); }); and controller subview event transitions filtered document app.documentscontroller = ember.arraycontroller.extend({ subview: function(context) { ember.run.next(this, function() { //window.location.hash = '#/documents/'+context.id; return this.transitionto('documentsfiltered', context); }); }, }); my problem code works fine when hash of page changed. but when run above code not w/ location.hash bit , w/ ember native transitionto cryptic uncaught typeerror: object [object object] has no method 'slice' any

php - fine-uploader implementation -

i have html file: <html> <head> <meta charset="utf-8"> <title>fine uploader demo</title> <link href="fineuploader-3.4.1.css" rel="stylesheet"> </head> <body> <div id="fine-uploader"></div> <script src="jquery-1.7.2.min.js"></script> <script src="jquery.fineuploader-3.4.1.js"></script> <script> function createuploader() { var uploader = new qq.fineuploader({ // pass html element here element: document.getelementbyid('fine-uploader'), // or, if using jquery // element: $('#fine-uploader')[0], // use relevant server script url here // if it's different default “/server/upload” request: { endpoint: 'qqfileuploader' } }); } window.onload = createuploader

c# - Autofac & WinForms Integration Issue -

i have simple winforms poc utilizing autofac , mvp pattern. in poc, opening child form parent form via autofac's resolve method. i'm having issues how child form stays open. in display() method of child form, if call showdialog() child form remains open until close it. if call show() , child form flashes , instantly closes - not good. i've done numerous searches integrating autofac winforms application, i've not found examples on autofac/winforms integration. my questions are: what proper way display non-modal child form approach? is there better way utilize autofac in winforms application approach? how determine there no memory leaks , autofac cleaning model/view/presenter objects child form? only relevant code shown below. thanks, kyle public class mainpresenter : imainpresenter { ilifetimescope container = null; iview view = null; public mainpresenter(ilifetimescope container, imainview view) { this.container = con

.net - Looping file names -

i trying loop through files in folder , list ones contain text in filename. example, while moving new file test.pdf in folder x, if there file named test.pdf in folder new file should renamed test1.pdf , on. in order first trying find count of existing files contain word test in names. this code have far: for each foundfile string in my.computer.filesystem.getfiles(varfolderpath, fileio.searchoption.searchtoplevelonly, varfilename & "*") if foundfile.contains(varfilename) response.write(foundfile & "</br>") end if next the value of variable varfilename being passed test.pdf . currently, have test.pdf , test1.pdf , test2.pdf in folder, reason, code, instead of listing 3 files, shows me test.pdf in response. if change for each loop to: for each filename string in directory.getfiles(varfolderpath, varfilename & "*") then st

Too much recursion in JavaScript -

i have javascript opens new page: $(document).ready(function () { //$('a[id$="lnkhidden"]').trigger("click"); // not sure if necessary $('table[id$="datatable"]').find("tbody").on("click", "tr", function () { $(this).find('a[id$="lnkhidden"]').trigger("click"); }); }); this button called js script: <h:commandlink id="lnkhidden" action="#{bean.pageredirect}" style="text-decoration:none; color:white; display:none"> </h:commandlink> after click on table row error message: too recursion [break on error] ...,c=l.length;c--;)(f=l[c])&&(v[d[c]]=!(y[d[c]]=f));if(i){if(o||e){if(o){for(l=‌​[],... can me fix this? you can cut infinite loop changes original code add second argument trigger. call becomes .trigger("click", [ true ]) name arguments in event handler : function(event, sim

asp.net mvc 4 - disconnect client from server side signalr -

i'm using signalr 1 mvc4 c# web application form authentication. have code in layout page in javascript : $(documnet).ready(function(){ connect hub code ... }) i want disconnect user form hub , start connect again after login , validate ok. want server side inside account controller , method : public actionresult logon(loginmodel model, string returnurl) { if (modelstate.isvalid) { if (system.web.security.membership.validateuser(model.username, model.password)) { formsauthentication.setauthcookie(model.username, false); ....here , disconnect hub ....to make user reconnect } the reason want because signalr throws error if user changed authenticated after login , connection remains . error is: the connection id in incorrect format. you cannot stop , start signalr connections server. need call $.connection.hub.stop(); //on client before user attempts log on , call $.connection.hub.sta

Azure - Need futher explanation regarding edge case -

i think billing... while ms don't answer thought posting suposed issue here. my question "i added instance role @ 1:10 , deleted @ 1:20. billed 1 hour. if start instance @ 1:30 , stop @ 1:40 billed hour?" you might think wont influence bill much, due misconfigured auto-scale think scenario above might have happened 50 times in last thirty days... i believe that's you'll see. you're being billed minimum of 1 clock-hour each of instances. note: believe there's 5-minute "grace" window, looks you're going beyond that. having said that: if it's happened 50 times, you're seeing @ 50 compute-hours beyond expected be, right? if that's case, @ least caught early, when it's cost $5.00 (assuming small instance single core).

apache - mod rewrite of query strings -

say wanted http://domain.com/product/?id=123 become http://domain.com/product/foo , how do in .htaccess ? tried this, didn't work: rewritecond %{query_string} ^id=123$ [nc] rewriterule ^/product$ /product/foo [nc,l,r=301] suggestions? note: not need capture value of id parameter not use in new url. update 1: rewriteengine on rewritebase /fisher rewritecond %{query_string} ^id=123 [nc] rewriterule ^product/$ /product/foo [nc,l,r=301] showing rewriteengine , rewritebase remove $ in rewritecond remove / in rewriterule when go http://localhost/fisher/product/?id=123 , nothing happens. url remains same. http://localhost/fisher/product/?id=123 taking above url request example, may try in .htacces file @ /fisher directory: options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_uri} ^/fisher/product/? [nc] rewritecond %{query_string} id=123 [nc] rewritecond %{request_uri} !/foo [n

Debugging my c program, number guessing game -

i need debugging program , don't know wrong. using putty , vi editor run program. code: #include <stdio.h> #include <time.h> #include <stdlib.h> #include <malloc.h> int main(void) { int playernumber = 0; int number = 0; int playerinput = 0; int guess = 0; char input; char str[6] = {0}; int playera = 0; int playerb = 0; int passa = 3; int passb = 3; int = 0; int playerturn = 0; srand(time(null)); playernumber = 1 + rand() % 2; /* random number generated */ printf("\nplayer %d goes fist\n", playernumber); printf("player number?\n"); while (playernumber != playerinput) { scanf("%d", &playerinput); if (playernumber != playerinput) printf("you have wait turn.\nplayer number?\n"); playernumber = playera; if (playera = 1) playerb = 2; else playerb = 1; srand(time(null)); numb

ios - UITableView swipe gesture requires near perfect accuracy -

i'm working on custom swipe event uitableview uses custom uitableviewcell subclass. included uigesturerecognizerdelegate in header, , have in viewdidload: uiswipegesturerecognizer *swipeleft = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(didswipe:)]; swipeleft.direction = uiswipegesturerecognizerdirectionleft; swipeleft.numberoftouchesrequired = 1; [self.tableview addgesturerecognizer:swipeleft]; my swipeleft method looks so: -(void)didswipe:(uiswipegesturerecognizer *)recognizer { if (recognizer.state == uigesturerecognizerstateended) { cgpoint swipelocation = [recognizer locationinview:self.tableview]; nsindexpath *swipedindexpath = [self.tableview indexpathforrowatpoint:swipelocation]; nsdictionary *clip = [self.clips objectatindex:swipedindexpath.row]; nslog(@"swiped!"); } } it's sort of working, swipe has incredibly precise. impossibly precise. i got working using uipangestur

ios - XIB popover display -

i seem having trouble making popover xib display when app loaded. here have in viewdidload.i sorry, new looking tutorials , ran problem app crashes. error log "terminating app due uncaught exception 'nsexception', reason: 'could not load nib in bundle:" "(loaded)' name 'search'' viewcontroller* viewcontroller2 = [[viewcontroller alloc] initwithnibname:@"search" bundle:nil]; self.popovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:viewcontroller2]; _popovercontroller.popovercontentsize = cgsizemake(350,100); look @ this . it says nib 'search' not exist in builded app. either xib not named "search.xib" or xib not included project. can check looking .app-directory on phone or simulator.

php - Display recent posts based on post size using IF STATEMENT -

i have sidebar in wordpress shows recent posts. php code simply: $recent_posts = wp_get_recent_posts(array("numberposts"=>5)); i include if statement say: "if wordpress post more 100 words, display 10 recent posts, else display 5" i work out relevant numbers etc. once know how achieved. you can use global $post inspect length of post_content , set $numberposts accordingly. global $post; $numberposts = 1; // default number of posts if ( !empty($post) ){ $len = strlen( $post->post_content ); // change $numberposts based on length of $post->post_content if ( $len < 300 ){ $numberposts = 8; } elseif ( $len < 500 ){ $numberposts = 5; } elseif ( $len < 800 ){ $numberposts = 3; } else { $numberposts = 1; } } $recent_posts = wp_get_recent_posts(array("numberposts"=>$numberposts));

vb.net - Importing data from a text file -

ok, i'm doing total overhaul. got months working properly! said, should modifying try understand better. tried add 2 more list boxes test. program testing milestones (years old - 10 years old through 100). edited code don't know line check change testing month year? new list box added displays same information month test, versus i'm trying accomplish. example: john doe 4/9/2003 show in '10' milestone. private sub lbmonth_selectedindexchanged(byval sender object, byval e eventargs) handles lbmonth.selectedindexchanged if lbmonth.selectedindex < 0 return lbperson.items.clear() dim index integer = lbmonth.selectedindex each ele in birthdays(index + 1) lbperson.items.add(ele) next end sub private sub lbmilestone_selectedindexchanged(byval sender object, byval e eventargs) handles lbmilestone.selectedindexchanged if lbmilestone.selectedindex < 0 return lbperson2.items.clear() dim index integer = lbmilestone.selectedi

CSV to XML with modifications (XSLT?) -

i've been searching forums answer problem, without luck. i'm hoping can me. have simple csv file need convert xml (that part's easy), need modify contains sub elements. example: what have: <unit> <unitid>k000009107</unitid> <datelastmodified>2003-06-23</datelastmodified> <family>sapotaceae</family> <genus>pouteria</genus> <species>ferrugineo-tomentos</species> <identifier>smith, j</identifier> <startmonth>05</startmonth> <startyear>1997</startyear> <typestatus>type</typestatus> </unit> what need: <unit> <unitid>k000009107</unitid> <datelastmodified>2003-06-23</datelastmodified> <identification storedundername="true"> <family>sapotaceae</family> <genus>pouteria</genus> &

html - display buttons on the same line at opposite sides of the page -

i have left , right buttons want display navigation buttons @ top , bottom of content on page this: <div style="float: right;"> <button class="right">right button</button> </div> <div> <button class="left">left button</button> </div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. vivamus sagittis faucibus feugiat. suspendisse felis tortor, sodales quis scelerisque a, malesuada lobortis erat. etiam vel lectus vitae nulla imperdiet dapibus. curabitur accumsan pretium viverra. vivamus sit amet gravida ante. aenean elit lorem, aliquet porta sollicitudin non, elementum aliquam massa. ut magna arcu, malesuada lacinia rutrum ornare, accumsan sed eros.</p> <div style="float: right;"> <button class="right">right button</button> </div> <div> <button class="left">left button</b

jQuery Mobile Multiple Dialog Boxes in One Dialog -

i have searched , have not found example of doing this. want able have dialog box open jqm , have there step step process takes place inside of 1 dialog box. figuring require multiple dialog boxes loading 1 dialog box , don't know if possible. using backbone jqm , want able load underscore templates in dialog box each step of way. figuring 4-5 steps in dialog box. is possible? thank you. here example, using .show() , .hide() . trick here create several divs, , show/hide them. working demo markup <div data-role="dialog" id="dialog"> <div data-role="header" data-theme="d"> <h1>dialog</h1> </div> <!-- first page --> <div data-role="content" id="page1"> <h3>page 1</h3> <p>text #page1</p> <div class="ui-grid-a"> <div class="ui-block-a"> <a href="#" data-role="button"

java.lang.RuntimeException: exception while registering MBean, com.scale7.cassandra.pelops.pool:type=PooledNode-my_keyspace-localhost -

i working on project in need insert data cassandra database. using pelops client . i have multithreaded code insert cassandra database using pelops client . , using executorservice that. in program, each thread work on range, like thread1 work on 1 20 thread2 work on 21 40 ... ... below code have using insert cassandra database- private static int noofthreads = 5; private static int nooftasks = 100; private static int startrange = 1; public static void main(string[] args) { log.info("loading data in cassandra database..!!"); executorservice service = executors.newfixedthreadpool(noofthreads); try { // queue tasks (int = 0, nextid = startrange; < noofthreads; i++, nextid += nooftasks) { service.submit(new cassandratask(nextid, nooftasks)); } service.shutdown(); service.awaittermination(long.max_value, timeunit.days); } catch (interruptedexcep

nginx extensionless php url without if statement -

i use config: root /www/mysite/static location / { try_files $uri @php; } location @php { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param script_filename /www/mysite/controller$fastcgi_script_name.php; } this first check if /www/mysite/static has file. if can't find file, run fastcgi on "file.php". now if go www.mysite.com/asdf, try run fastcgi /www/mysite/controller/asdf.php, doesn't exist. i read if statement evil, should instead? finally figured out: location /info { root /usr/share/nginx/www; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_param script_filename /usr/share/nginx/www/info.php; } actually makes sense i've bothered read documentation...

python - tkinter canvas in grid has extra space -

Image
i have canvas inside frame , i've said canvas should 250x250. reason being created bigger, space on right , bottom. here's code... ideas? from tkinter import * tkinter import ttk player import player0 alpha = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') class gui(frame): def __init__(self, master): frame.__init__(self, master) self.boardsize = 250 self.sqsize = self.boardsize//5 master.title("canvas space") self.initialdraw() self.grid(row=0,column=0) def initialdraw(self): mainframe = ttk.frame(self, padding=(5,5,5,5)) mainframe.grid(column=0, row=0, sticky=(n, s, e, w)) self.board = canvas(mainframe, width=self

c++ - How to loop hex in Javascript? -

in c, output expect. in javascript, output not expect. in javascript, hex loops in decimal not in hexadecimal. c: #include<stdio.h> int main(){ for(int i=0x1000;i<=0x109f;i++){ printf("%x\n",i); } return 0; } javascript: <script type="text/javascript"> for(var i=0x1000;i<=0x109f;i++){ document.write(i+"<br>"); } </script> you can use tostring method: document.write(i.tostring(16)+"<br>"); //base 16 (hex)

java - DateType column metadata column in Cassandra database -

i working cassandra database. have created below column family create column family user comparator = 'utf8type' , default_validation_class = 'utf8type' , column_metadata = [ {column_name : account, validation_class : 'utf8type'} {column_name : lmd, validation_class : 'datetype'} ]; now trying insert cassandra database using pelops client mutator.writecolumns(column_family, string.valueof(userid), mutator.newcolumnlist( mutator.newcolumn("account", "hello"), mutator.newcolumn("lmd", string.valueof(new date().gettime())) )); in case, created lmd datetype in column family not sure how add datetype through code. adding string need make sure compatible datetype . can me this? well, have created column family using cli. try using these set user['somekey'

c++ - inheritance doesn't work as it should when using templates -

this question has answer here: template inheritance c++ 3 answers i having issue inheritance. created example show more or less issue. thing if publicly derive class publicly derives class must have access protected members in original class way. doesn't seem case when i'm using templates. in fact, example below complains on line 'n++;' saying 'n' not declared in scope. however, if without templates. code compiles fine. going on? #include<iostream> template<typename t> class base{ protected: t n; public: t getn(); base(); }; template<typename t> t base<t>::getn(){ return n; } template<typename t> base<t>::base(){ n = 8; } template<typename t> class daddy: public base<t>{ protected: public: }; template<typename t> class granny: public daddy<t>{

"ERROR: Problems trying to get index of users!" on moodle-drupal services syncing error on Drupal 7.x + Moodle 2.x -

i using instructions https://github.com/cannod/moodle-drupalservices/wiki/installation-drupal-side integrate drupal sign-in moodle installation. have completed steps , ran "tests" indicating drupal service set correctly. i.e., able log in drupal using "remote" user , valid json response service endpoint. however, after completing "moodle side" instructions, tried manually run database sync file command line per instructions , received following output: remoteapi object ( [gateway] => mysitesurl.com [endpoint] => /drupalservice [status] => 1 [session] => sesscc2ded1dd0a5... //this part okay [sessid] => vtlmsjtbinva... //this part okay ) error: problems trying index of users! i looked @ code, , [status] of 1 seems indicate log in successful, can't imagine issue is. found couple of other people on site saying had same problem, replied own post along lines of "i figured out!" , not posting answer. any

javascript - string in dictionary to dictionary -

i having string in form of dictionary in following way: var str1= '{ "t1" : "1"},{ "t1" : "2"}, { "t2" : "3"},{ "t2" : "4"}, { "t2" : "5"}, { "t3" : "6"}, { "t3" : "7"},{ "t3" : "8"},{ "t2" : "9"}, { "t2" : "10"}, { "t1" : "11"}, { "t1" : "12"}'; plz give idea how convert such behave tree structure. i.e. t1 search till next t1 in loop , append t1 , value in current iterated term , similar t2 , on.. example str2. str2='{ "t1" : "1"} ,{ "t1" : "2", "t2" : "3"},{ "t1" :"2", "t2" : "4"}, { "t1" : "2", "t2" : "5", "t3" : "6"}, { "t1" : "2", "t2" : &

Trying to find an IDE that support Groovy for Linux -

as title states i'm having hard time finding ide supports groovy linux, can't stand programming without color coding anymore. use intellij . has comprehensive groovy support, runs on linux , awesome ide.

Getting special characters out of a MySQL database with PHP -

this question has answer here: utf-8 way through 14 answers i have table includes special characters such ™. this character can entered , viewed using phpmyadmin , other software, when use select statement in php output browser, diamond question mark in it. the table type myisam. encoding utf-8 unicode. collation utf8_unicode_ci. the first line of html head is <meta http-equiv="content-type" content="text/html; charset=utf-8"> i tried using htmlentities() function on string before outputting it. no luck. i tried adding php before output (no difference): header('content-type: text/html; charset=utf-8'); lastly tried adding right below initial mysql connection (this resulted in additional odd characters being displayed): $db_charset = mysql_set_charset('utf8',$db); what have missed? below code works

c++ - What is going on in this? -

i reading through someone's code, , calling functions this. "this" in block pointer virtual method table, , using offsets call function in said table. hack thing in case wondering. __asm { mov edi, lea ecx, [edi + 0x4] mov edx, dword ptr ds:[ecx] call [edx + 0x24] } he has simpler bits of code call "this" + offset, confused on going on in one. can post vtable dump ida if @ all. looks multiple inheritance. in such cases, there separate vtables each inherited class interface. so, 2nd , 3rd instructions calculate start of vtable specified inherited class interface. call obvious, 24 magic number, known offset function called in inherited class.

C/C++: Passing a string read to a loop inside a program in C -

i working in program should read user inputted string , use string inside loop basic calculation. general problem use of string inside loop and, despite fact later have more, need test bolzano's theorem (in particular find possible intervals roots) inputted expression. started working function reads input char char , switch controls calculate infix expression. however, know if there way that: { /*already stored doubles: a, b, precision.*/ printf("enter expression want calculate"); scanf("%s", expression); /*user input: (3*i)+(i*i)-3*/ while( <= b ){ fa = (3*i)+(i*i)-3; /*how insert string here*/ fb = (3*(i+precision))+((i+precision)*(i+precision))-3; if( fa*fb < 0 ) printf("there @ least 1 root in interval: [ %g, %g ].", a, a+precision); /*and goes on...*/ } supposing user not input invalid expression use in loop (such i^7) or implemented controls convert expressions (something rea

database schema and foreign key -

Image
i couldn't figure out. i'm not @ database design. can explain me? answers 1) relationship “assigned to” between blob , thing 1:m 1 blob can have 0 or many things. in database theory foreign key goes many side. therefore blob can have 2 columns. 2) a) no fk – same explanations in question 1 b) parta , partb – same explanation in question 1 , since thing has composite key (entity needs more 1 attribute identify tuples uniquely) both underlined column names has given notes 1) er diagram uses crow notation 2) end product of er diagram relational schema diagram relationships appear in relational schema foreign keys.

android - How to access string present in string.xml -

i want build alertdialog string present in string.xml r.string.string1 returning int. please tell me way string prestent in string.xml here code.. public static void showalert(string alertmessage) { final alertdialog.builder builder = new alertdialog.builder(null); builder.setmessage(alertmessage); final alertdialog alert = builder.create(); alert.show(); } showalert(r.string.string1); use getresources().getstring getting string value strings.xml as: string str=getresources().getstring(r.string.internetnotavailable); showalert(str); and passing null alertdialog.builder creating alertdialog. please pass current activity context instead of null creating alertdialog as: alertdialog.builder builder = new alertdialog.builder(your_current_activity.this);

ruby on rails - JBuilder loop that produces hash -

i need loop produces hash, not array of objects. have this: json.service_issues @service.issues |issue| json.set! issue.id, issue.name end that results: service_issues: [ { 3: "not delivered" }, { 6: "broken item" }, { 1: "bad color" }, { 41: "delivery problem" } ] i need this: service_issues: { 3: "not delivered", 6: "broken item", 1: "bad color", 41: "delivery problem" } is possible without converting ar result hash manually? jbuilder dev here. short answer: yes. it's possible without converting array of models hash. json.service_issues @service.issues.each{ |issue| json.set! issue.id, issue.name } end but it'd easier prepare hash before-hand. json.service_issues hash[@service.issues.map{ |issue| [ issue.id, issue.name ] }]

getting this error while enhancing using Datanucleus. any idea -

i trying enhance class (class generated during run time annotations). , getting error. dn says null pointer. idea? 22:03:36,816 (pool-7-thread-1) debug [datanucleus.metadata] - registering class "test.testclass" not having metadata. 22:03:36,817 (pool-7-thread-1) error [datanucleus.enhancer] - error thrown enhancing asmclassenhancer java.lang.nullpointerexception @ org.datanucleus.enhancer.jdo.jdomethodadapter.visitfieldinsn(jdomethodadapter.java:103) @ org.datanucleus.asm.classreader.readcode(classreader.java:1333) @ org.datanucleus.asm.classreader.readmethod(classreader.java:953) @ org.datanucleus.asm.classreader.accept(classreader.java:684) @ org.datanucleus.asm.classreader.accept(classreader.java:521) @ org.datanucleus.enhancer.jdo.jdoclassenhancer.enhance(jdoclassenhancer.java:427) @ org.datanucleus.enhancer.datanucleusenhancer.enhanceclass(datanucleusenhancer.java:927) @ org.datanucleus.enhancer.datanucleusenhancer.enhance(datanucl

backbone.js - How to remove an item from a collection and collection view by not re-rendering the whole list? Is it possible? -

hi i'm bit new backbone.js is there way remove item (and item) collection , not have refresh list. instead remove item view , collection , no refresh/re-rendering happens view collection. or possible? here's snippet of code: var datemodel = backbone.model.extend({ defaults: function() { return { index: '', valuefrom: '', valueto: '', status: '', showtext: '', text: '' } }, }); var datelist = backbone.collection.extend({ model: datemodel }); var datelist = new datelist(); var dateview = backbone.view.extend({ model: new datemodel(), ... }); var datelistview = backbone.view.extend({ model: datelist, el: $('#date-list-container'), initialize: function() { this.listento(this.model, 'add', this.render); this.listento(this.model, 'remove', this.render); this.lis

file io - WriteFile thread safety -

is writefile thread safe? mean,can write same file multiple threads simultaneously without synchronization? msdn says nothing thread safety of writefile. yes thread safe own i.e prevent system crashing, win api maintain internal locking when writing files , lock byte-range locks. more can read file locking

forms - pass multidimensional javascript array to another page -

i have multidimensional array [0]string [1]-->[0]string,[1]string,[2]string [2]string [3]string [4]-->[0]string,[1]string,[2]string[3]string,[4]string,[5] info (i hope makes sense) where [1] , [4] arrays access info myarray[4][5]. the length of nested arrays ([1] , [4]) can varry. i use method store, calculate, , distribute data across pretty complicated form. not data thats storred in array makes input field not sent next page when form's post method called. i access array same way on next page on first. thoughts: method 1: i figure load data hidden fields, post everything, values on second page , load themm array require on hundred hidden fields. method 2: i suppose use .join() concatenate whole array 1 string, load 1 input, post , , use .split(",") break up. if im not sure how handel multidimensional asspect of still able access info myarray[4][5] on page 2. i accessing arrary javascript, values make inputs on page 1 accesse

python - Writing a proper Apache virtual host script, for a Django app using WSGI -

i have here virtual host script django app i'll deploy real world. right seems working fine; however, i'd know if there's wrong script, or things should improved. things note : the wsgi.py file 1 django automatically produces. it's in same directory app's source code. the static files served apache /srv/www/foobar/static/ directory <virtualhost *:80> servername foobar.com serveralias www.foobar.com serveradmin contact@foobar.com wsgidaemonprocess foobar.com processes=2 threads=20 inactivity-timeout=600 maximum-requests=10000 wsgiprocessgroup foobar.com wsgiscriptalias / /home/some_user/foobar_django_app/foobar/wsgi.py documentroot "/srv/www/foobar/" alias "/static/" "/srv/www/foobar/static/" </virtualhost> consider setting: wsgiapplicationgroup %{global} wsgirestrictembedded on watch: http://lanyrd.com/2013/pycon/scdyzk/#link-qhyk read: http://blog.dscp

How to avoid pushing duplicate values into a Perl array -

i need add unique elements in array inputs contain several duplicate values. how avoid pushing duplicate values perl array? you need use hash this: my %hash; $hash{$key} = $value; # can use 1 $value ... this automatically overwrite duplicate keys. when need print it, use: foreach $key (keys %hash) { # $key } if need sort keys, use foreach $key (sort keys %hash) ...

php - rsyslog performance optimization -

what should done setup rsyslog best performance? we can allow items lost on server crash or lost. we going save logs mysql db. we able handle @ least 100 log writes per second latency 0.001 - 0.005 second. we writing logs php application. thank help. we went through similar exercise using mongodb database, i'll document did , hope helps you. it our first time using rsyslog, took bit of effort find right documentation , piece together. in end, our test drivers (we're using soapui) able 1000 tps through php web service uses rsyslog write summary record of transaction. we found following articles got started: http://www.rsyslog.com/doc/rsyslog_high_database_rate.html http://www.rsyslog.com/tag/mongodb/ the overview you'll enable rsyslog's queue infrastructure writing incoming messages disk when daemon's memory queue full. in our case, enabled $actionqueuesaveonshutdown, sounds don't need. you'll configure rsyslog ruleset par

javascript - How can I call Servlet from d3.json() -

i using d3 charting nodes , links between them. bringing data, used json name link.json , called like- d3.json("linked.json", function(error, graph) {} it works properly.but data of json not dynamic. make dynamic must call servlet in place of calling json.i can't this.. please me.... a url url. replace linked.json url servlet want call (making sure servlet returns suitably formatted json response).

java - glassfish response not getting in gzip compressed -

Image
i working on java netbeans ide , glassfish 3.1.2 have created in rest services using jaxrs. when request client made ,i need send json data in compressed format.to have enabled compression in glassfish shown following picture but response got server not compressed using gzip. receiving normal json data. should overcome issue this solution gf 3.1.2.2. responses http requests in version 1.0 not compressed. must send requests in http 1.1 gzipped responses glassfish server. more over, must add header "accept-encoding: gzip" in http requests.

c# - Windows Phone generating Tile - cant seem to make it transparent -

i generating tile within application , when displayed background image using basis fro the tile has lost transparency (and therefore not picking theme color. the background image has icon on , transparent - when use standard tile (i.e. not generate image ) thens fine , transparency good.. but when use background image , add own container on not transparent background showing black. the relevant code follows: // [...] var container = new grid(); if (iswide) { container = createcontainerwide(tileinfo); } else { container = createcontainermedium(tileinfo); } // add background container.background = new imagebrush { imagesource = background, opacity = opacity }; // force container render container.arrange(new rect(0, 0, width, height)); // write image disk , return filename return writeshelltileuielementtodisk(container, basefilename); } static string writeshelltileuieleme

javascript - Is there a good web application for manipulating pdf files? -

is there web application manipulating pdf files? example, drag , drop images , save future reference, remove dropped images anytime etc. want integrate existing web application also. edit: these links have came across while searching. might useful searching same.:) pdfescape crocodoc a.nnotate.com(a.nnotate.com) groupdocs annotation(groupdocs.com/apps/annotation) mozilla has pdf.js renders pdf files using html5. same script used in built-in pdf reader of recent firefox browsers. it's experimental, hack code , whatever want it.

JSF + JBOSS 6.0 + Linux + java.lang.IllegalArgumentException: null source -

we using jboss 6.1.0 in our local windows development environment using faces version 2.1.19. application use works fine. however, when promote our code testing environment linux jboss 6.0 server uses faces version "2.0.2.final-redhat-1", getting error "java.lang.illegalargumentexception: null source". complete stack trace pasted below. server not provide more information , finding hard debug. advice/help on great. the issue appears when click button on page in turn makes ajax call. 16:37:44,298 info [stdout] (http-/10.23.212.109:8080-2) auth filter -- procesiisng .. /vcp-web/jsf/calendar/calresult.xhtml 16:37:44,299 info [stdout] (http-/10.23.212.109:8080-2) leaving phase >> restore_view 1 16:37:44,301 info [stdout] (http-/10.23.212.109:8080-2) entering phase >> restore_view 1 16:37:44,301 error [appl] (http-/10.23.212.109:8080-2) @@@ defaultexceptionhandler.handle() >> uncaught exception java.lang.illegalargumentexception: null sou