Posts

Showing posts from March, 2010

ASP.NET Autoloading user controls without web.config -

hi i've got autoloading in asp.net 2.0 (but if it's impossible please show me higher version). in aspx files i've got normal tags <aaa:bbb id="ccc" runat="server" /> i've in web.config added controls system.web->pages->controls-> <add src="zzz" tagname = "bbb" tagprefix="aaa" /> i not add lines web.config cause i've got lots , lots of user controls specific projects , it's getting messy. what like? autoloader :) maybe fine tuning of web.config? know web.config parsed classes manage it. can write classes, write web.config file...increasing it's size :( to knowledge, there no auto loader asp.net template controls. eg: sharepoint has lots of template based controls (ascx), , each 1 has registered individually. you don't have register every control in web.config though, can register them on page uses them. http://msdn.microsoft.com/en-us/library/c76dd5k1.aspx ...

Select day(monday) in SQL Server -

i have field dd-mm-yy hh:mm:ss tt i want select name of day i tried datepart() , day() both gave me 1 31. what want monday, tuesday , on.. how achieve that? select datepart(weekday, getdate()) or select datename(weekday, getdate())

iphone - Convert NSString to NSInteger? -

i want convert string data nsinteger . if string human readable representation of number, can this: nsinteger myint = [mystring intvalue];

http - modify the post data of a request in firefox extension -

i trying trap http request, change of post parameters , send modified request. tried using setdata method of upload stream modify request, same original request sent. i have following code execute on "http-on-modify-request" : //rewind request read post body channel= subject.queryinterface(components.interfaces.nsihttpchannel); channel=channel.queryinterface(components.interfaces.nsiuploadchannel); channel = channel.uploadstream; channel.queryinterface(components.interfaces.nsiseekablestream) .seek(components.interfaces.nsiseekablestream.ns_seek_set, 0); var stream = components.classes["@mozilla.org/binaryinputstream;1"] .createinstance(components.interfaces.nsibinaryinputstream); stream.setinputstream(channel); var postbytes = stream.readbytearray(stream.available()); poststr = string.fromcharcode.apply(null, postbytes); //change poststr poststr=poststr.replace(....); stringstream.setdata(poststr, poststr....

wpf - LinearAxis without decimal numbers -

Image
i want avoid decimal numbers in axis, how can ? xaml: <charting:chart verticalalignment="stretch" horizontalcontentalignment="stretch"> <charting:chart.axes> <charting:linearaxis orientation="y" minimum="0" title="" location="left" /> </charting:chart.axes> <charting:chart.series> <charting:columnseries itemssource="{binding persons}" dependentvaluebinding="{binding count}" independentvaluebinding="{binding category}"> </charting:columnseries> </charting:chart.series> </charting:chart> in case you're still struggling on this, or if else interested: solution baalazamon wrote. it's {0:0.##} display 2 decimal digits if exists (that's ".##" means)...

Upload to website from python -

Image
i need program (python) upload files (large reports) services (rapidshare, megaupload or easyshare) , grab url site gives me (to them forward user) what's easiest way ( think selenium, maybe it's overkill) ? what's fastest ( can mechanize? ) ? how it? thanx in advance. i attack selenium , beeing heavy, think easy aspect of worth it. i need (upload file service) hand while on firefox plugin seleniumide recording it. them, export python , have code. seleniumide: selenium bit slow, simplicity showed worth (imho).

mysql - date and time query in php -

i'm trying select records has same month current month. $date=date('y-m-d'); $month=substr($date,5,2); $res=mysql_query("select date reports"); while($row=mysql_fetch_assoc($res)){ $months=substr($row['date'],5,2); } how can it? you sql let handle this $query = "select date reports month(date) = ".date("m"); in case want of month this year query this: $query = "select date reports year(date) = ".date("y")." month(date) = ".date("m");

c# 4.0 - c# preloading modules in splashscreen -

i developing software 3 modules in it. want splashscreen created in project, want preload modules before shows first form. although project not big, still experience want add splashscreen in current project preloading ability. i adobe photoshop splashscreen does. any tutorials/suggestions/videos welcome keeping in mind not c# pro coder , dont know functions. thanks i not know how photoshop splashscreen works. however, preload assembly, enough call typeof(anytypefromnonloadedassembly). hope, helps.

SQL Server triggers and sqlalchemy interference problem. Help needed -

i need have kind of 'versioning' critical tables, , tried implement in rather simple way: create table [dbo].[address] ( [id] bigint identity(1, 1) not null, [post_code] bigint null, ... ) create table [dbo].[address_history] ( [id] bigint not null, [id_revision] bigint not null, [post_code] bigint null, ... constraint [pk_address_history] primary key clustered ([id], [id_revision]), constraint [fk_address_history_address]... constraint [fk_address_history_revision]... ) create table [dbo].[revision] ( [id] bigint identity(1, 1) not null, [id_revision_operation] bigint null, [id_document_info] bigint null, [description] varchar(255) collate cyrillic_general_ci_as null, [date_revision] datetime null, ... ) and bunch of triggers on insert/update/delete each table, intended store it's changes. my application based on pyqt + sqlalchemy, , when try insert entity, stored in versioned table, sqlalchemy fires error: the target table 'heri...

php - PHPExcel reader -- help required -

i m using phpexcel read data excel sheet , store in mysql table, till m able upload .xls .xlsx file , after uploading xls got below table structure of data name start_date end_date city 1 11/25/2011 3:30:00 pm 11/29/2011 4:40:00 jaipur 2 10/22/2011 5:30:00 pm 10/25/2011 6:30:00 kota 3 3/10/2011 2:30:00 pm 3/11/2011 12:30:00 bikaner chandigarh now have problems, please suggest me optimized method how sheet name ( bcoz in 1 excel there 7 sheets ) for store these data db, below code snippet $inputfilename = "test.xls"; $inputfiletype = phpexcel_iofactory::identify($inputfilename); $objreader = phpexcel_iofactory::createreader($inputfiletype); $objreader->setreaddataonly(true); /** load $inputfilename phpexcel object **/ $objphpexcel = $objreader->load($inputfilename); $total_sheets=$objphpexcel->getsheetcount(); // here 4 $allsheetname=$objphpexce...

Java - multiple signature using generic? -

public interface factory<t> { t create(); } public interface factory<t,p> { t create(p... data); } is there way define interface can use name factory both type, or have use factorywithparam ? is there reason can't join 2 interfaces one? public interface factory<t,p> { t create(); t create(p... data); } but if can't there's no way can have 2 different interfaces same name in same package. can put them in different packages i'd advise against it, confuse hell out of whoever maintain code.

php - problem in many to many relationship -

i have 2 tables jewelry(j_id,j_name,description) , style(style_id,style_name,image) each table has many many relationship other table, 1 jewelry product can have multiple styles , there more product of same style, relationship many many. now question how can relate these tables i.e want insert single record in jewelry table , there should multiple styles 1 jewelry product. on jewelry html page want put style in multiple select dropdown list populated dynamically style table , if user want select 2 style same product, can. i recommend 4 tables, 3 jewellery , style , fourth 1 orders. jewellery : jid (pkey),jname,description style: sid (pkey), sname, description product : pid (pkey), sid(fkey), jid(fkey) - 1 product defines unique combination of style , kewellery order : oid(pkey), pid(fkey), other details(name, address etc.) for each jewellery, recover associated styles using product table , populate fields on html page. each order, store product id, uniquely...

c++ - "integer constant is too large for ‘long’ type" when finding largest prime factor -

i working on solving euler project 3: description: prime factors of 13195 5, 7, 13 , 29. largest prime factor of number 600851475143 ? this code generate answer. need integer type hold 600851475143 . when compile on gcc on mac get: integer constant large ‘long’ type". i expect long long hold number. tried making unsigned. why doesn't code hold small number , can make work? #include <iostream> #include <vector> using namespace std; static bool isprimefactor(int numtotest,int testnum,vector<int> factors) { if(numtotest%testnum==0) // factor? { // see if prime factor for(unsigned int i=0; < factors.size(); i++) { if(testnum%factors[i]==0) // see if factor { //is divisble 1 have return false; } } return true; } return false; } int main() { unsigned long long numtotest=600851475143; uns...

mysql - Join table query -

if join 2 tables in query looks: select m1.id reg, m1.name name, f.registered status phone f inner join members m1 on m1.id=f.user_id m1.status='1' , f.registered='1' and want add 10 user id's in array m1.id in (014,01284,014829,075090) should listed in result of query. want avoid third table in query because know users table need. the point end result contains detail's of users members table id's listed in phone table , array. what best way this? seems bit trivial, maybe not need, this? select m1.id reg, m1.name name, f.registered status phone f inner join members m1 on m1.id=f.user_id (m1.status='1' , f.registered='1') or (m1.id in (014,01284,014829,075090) )

Need to apply automatically an XSLT to an XML in Microsoft Word -

i've got xml file linked xslt file. output of xslt formal html. actually, when i'm opening xml word, "pop-up" ask me xsl want apply, default see xml data. once i've selected xsl, html page rendered. my question quite simple one, how can apply automatically xsl ?

jquery menu in a silverlight web application -

i'm trying implement jquery menu in silverlight web application. since i'm newbie, give me step step guide on how this? i'd thankful help.. you can't use jquery or javascript code inside silverlight application. can host silverlight application in web page has jquery menu. silverlight application can interact javascript in page hosted. can define entry points in silverlight application , call them through javascript.

sml - building a lexical analyser using ml-lex -

i need create new instance of lexer tied standard input stream. however, when type in val lexer = makelexer( fn n => inputline( stdin ) ); i error don't understand: stdin:1.5-11.13 error: operator , operand don't agree [tycon mismatch] operator domain: int -> string operand: int -> string option in expression: ( makelexer function name present in source code) inputline returns string option , , guess string expected. what want either have makelexer take string option , so: fun makelexer none = <whatever want when stream empty> | makelexer (some s) = <the normal body makelexer, working on string s> or change line to: val lexer = makelexer( fn n => valof ( inputline( stdin ) ) ); valof takes option type , unpacks it. note that, since inputline returns none when stream empty, it's better idea use first approach, rather second.

c# - How to detect superscript with ItextSharp? -

hy i using itextsharp parse pdf file text output. want know if can catch if pdf contains subscript or superscript, knows how make difference between normal character , superscript in pdf using itextsharp, or other library ? thanks disclaimer: don't have evidence but... i expect super/subscript identical normal text. it's same font, smaller. if happens on same line other text, super/sub scripts raised , lowered - won't able detect explicit meta-tag in layout-oriented format such pdf. in other words, i'd guess need identify super/subscripts heuristics: finding text that's smaller , vertically displaced compared other text on "same" line. whether that's easy or not depends on pdf creator , details of itextsharp, since identifying "line" not straightforward.

oop - Access a method's local variables in Python -

was going through python tutorial , have asked related question here (code previous example , @emmanuel) code: import math, time class primefactor: def __init__(self): pass def isprime(self,number): start=time.clock() fnum = [1,] print "reticulating splines..." last = int(math.ceil(math.sqrt(number))) p in range(2, last + 1): if (number % p) == 0: fnum.append(p) fnum.append(number / p) # remove duplicates, sort list fnum = list(set(fnum)) fnum.sort() end=time.clock() if len(fnum) > 1: return number, "is not prime because of these factors", fnum ,"time taken", end-start else: return true, "time taken", end-start print "prime or factor calculator v3 using sqrt(n)" print # num =int(raw_input("enter number: ")) eg=primefactor() print eg.isprime(n...

How to send html table data to the server (java/j2ee) -

i creating web application using java/j2ee on windows using netbeans/glassfish , sqlite database. i creating table using jsp. table has 3 columns , have many rows user wants.the user fills data in cells , submits . data needs send server processing. see servlets can read data html forms through methods, don't see way read data cells in table. how do ? also need implement paging using "previous" , "next" buttons first page takes 20 rows(say) ,and on , till user finishes. want know if should send table data page page server, or can store data temporarily in client till user finishes , send pages server. think not idea burden client ,if user enters huge number of rows. this first web application, please redirect me place explains these, in case 1 exists. have done considerable search though. although can use of lots available web framework i'd recommend else. said first web app, expected relatively simple. so, can stand without framework. sh...

Jquery Templates: One parent container, many children? -

using jquery templates, want create list. want 1 parent <ul /> element many <li /> elements, resulting in: <ul> <li>one</li> <li>two</li> </ul> my data similar this: var data = [ { val: 'one' }, { val: 'two' } ] currently, child <li /> template looks this: <script id="child-tmpl" type="text/x-jquery-tmpl"> <li> ${val} </li> </script> to result want, i'm doing this: $('<ul></ul>').append($("#answer-tmpl").tmpl(data)); but half-embraces spirit of jquery templates. don't want string version of markup (as above). rather, have idea on parent <ul /> jquery template might like? instead of giving tmpl array, give object has array field: $("#answer-tmpl").tmpl({ data: data }); then can modify template this: <script id="answer-tmpl" type="text/x-jq...

c++ - How Recursion Works Inside a For Loop -

i new recursion , trying understand code snippet. i'm studying exam, , "reviewer" found standford' cis education library (from binary trees nick parlante). i understand concept, when we're recursing inside loop, blows! please me. thank you. counttrees() solution (c/c++) /* key values 1...numkeys, how many structurally unique binary search trees possible store keys. strategy: consider each value root. recursively find size of left , right subtrees. */ int counttrees(int numkeys) { if (numkeys <=1) { return(1); } // there 1 value @ root, whatever remains // on left , right each forming own subtrees. // iterate through values root... int sum = 0; int left, right, root; (root=1; root<=numkeys; root++) { left = counttrees(root - 1); right = counttrees(numkeys - root); // number of possible trees root == left*right sum += left*right; } return(sum); } im...

php - Best practices for URL with space and special characters -

i'm modifying small web application. web application allow users enter / specify category themselves. noticed in database, there's plenty of category contain spaces , special characters, example cakes & cupcakes. on front-end, database shows user defined categories in form of url links , user can click on them further see what's in category. the front-end category links encoded using rawurlencode function , looks this. ./show.php?category=<?php echo rawurlencode($e['category']); ?> and on back-end, function get url , decode before it's being sent database querying. $category = rawurldecode(htmlspecialchars_decode($category)); it works fine seems 'last-minute' , 'unsophisticated'. as such i'm wondering, best practice in php url special characters , spaces? thank in advance. i prefer use "slug" method. "slugify" strings , use slug in url. http://sourcecookbook.com/en/recipes/8/funct...

Sencha Touch - Accessing Associated-Model Store JSON via Nested Looping -

i've been lurking on stack overflow quite time now, , have found quite number of helpful answers. many community! hope able contribute own helpful answers before long. in meantime, have issue can't figure out. using sencha touch create web-based phone app , i'm having trouble using nested loop iterate through json. can grab first level of data, not items nested within first level. there related extjs thread , decided create own since extjs , touch diverge in subtle yet important ways. anyway, here code show am: json (truncated - json php/mysql-generated, , there 3 sub levels "title", of can access. it's sub level "items" through can't iterate): { "lists": [ { "title": "groceries", "id": "1", "items": [ { "text": "contact solution - coupon", "listid": "1", ...

asynchronous - iPhone - Display smoothly 2 successive modal view controller -

i'm searching way able display 1 modal view controller after one, , make second appear while first disapearing. the problem dismiss call done inside first modalviewcontroller applies both , secondcontroller never shown. putting first dismiss before or after parent call not change anything. if first dismiss set wih animate= no, works fine. need animation. i planned way, problem dismiss call done inside first modalviewcontroller applies both , secondcontroller never shown. i don't understand why because each modal view has own navigationcontrollers, shouldn't collide. i tried way showing second modal view nstimer after 0.5 sec, it's not satisfying : second appears when first has disapeared. not smooth @ all... if set delay less 0.5 sec, second modal view never shows up. , using such timer make not seem way of coding. main.m - (void) entry { firstcontroller *nextwindow = [[firstcontroller alloc] initwithnibname:@"thenib" bundle:nil]; n...

Orienting a custom map in Android -

i need application navigate in museum, using map of museum , android's compass. app should user go pre-set positions on map. possible? should format of map? thanks jul you able phone orientation using gyroscope , compass, little harder locations. because indoors, chances not able fine location (gps) because phone not have line of sight gps satellite. mean phone have rely on course location (network) in terms of being accurate inside of building bit of stretch. i did project in university pretty accurately track location of person inside of building, not based on android os. if there multiple wifi hotspots in museum, wifi triangulation possible (i don't know if is). knowledge, way accurately implement project this. good luck!

php - How to block Chrome from auto-filling text boxes? -

i'm testing website on google chrome , saw browser auto-fills username , password text boxes, if never said that. don't want behavior. there way stop using php, css or javascript? you can specify autocomplete="off" on fields don't want auto-filled, honoring browser , isn't supported everywhere: <input type="text" name="something" autocomplete="off" />

javascript - Better form processing - multiple dates and selection issues -

i'm having bit of trouble, conceptually , programmatically form. the user can choose 1 or more (as many like) of specific dates within large amount of dates. don't want checkbox each date. i've looked @ datepickers (jquery, mootools) i've not found 1 a) allows weekdays, b) allows dates knocked off, c) allows selection of 1 or more, d) allows user fed price based on how many dates chose. need have data accessible through javascript, can feed "review" part of form before submission php/mysql database. i need not link tool that'll allow (if know of 1 of course), need know how implement in way , if can suggest 1 - maybe alternative way of processing form. apologies rather frank way of requesting help, stress levels rising rapidly this. thanks can give sounds (with specific functionality need), need author own jquery plugin/extention handle this. http://docs.jquery.com/plugins/authoring you might investigate take extend jquery ui datepi...

mongodb - Counting Documents in Mongo Cursor with C & BSON. -

i'm working on project , need count amount of documents (mongodb) in cursor bson , c. here code: bson_buffer_init(query_buf); bson_append_string(query_buf, "url", bson_iterator_string(it)); bson_from_buffer(query, query_buf); similar = mongo_find(conn, "testing.test", query, null, 0, 0, 0); while(mongo_cursor_next(similar)) { bson_iterator it2[1]; if(bson_find(it2, &similar->current, "url")) { printf("%s\n", bson_iterator_string(it2)); } } how alter in order count documents in each cursor (the above in loop, url different each pass)? have tried mongo_count method? according source, it's right here: https://github.com/mongodb/mongo-c-driver/blob/master/src/mongo.c#l385 note c drivers still considered alpha quality. if find bugs, please let mongodb team know: http://jira.mongodb.org/ ...

javascript - How do addEventListener and attachEvent works? Keydown and Keyup is not working properly -

i wrote code snippet "shift key" keydown , keyup events mozilla not working expect. code: <html> <head> <title>testing page</title> <script type="text/javascript"> var key_capslock = 0; var key_shift = 0; function print1(){ window.alert("shift status" + key_shift);} function print2(){ window.alert("shift status" + key_shift);} function keyset(evt){ evt.preventdefault(); if(evt.keycode == 16){ if(key_shift == 0 ){key_shift = 1; evt.stoppropagation();} else {key_shift = 0; evt.stoppropagation();} } print1(); return; } function keyrelease(evt){ evt.preventdefault(); if(evt.keycode == 16){ if(key_shift == 0 ){key_shift = 1; evt.stoppropagation();} else {key_shift = 0; evt.stoppropagation();} } print2(); return; } function init(){ document.body.setattribute("contenteditable", true); document.body.addeventlistener("keydown", keyset, false); document.body.adde...

wmi - How to extend volume using powershell? -

how extend volume using powershell (i prefer wmi on powershell remoting) on remote computer ? os win xp sp3. i ended somethin this: invoke-command -computername $compname -credential $compcred -scriptblock {"rescan","select volume 2","extend" | diskpart} i'm still looking better solution, if there one.

php - Adding documents to Sphinx index and modifying their attributes without full rebuild -

i have wordpress-based website uses sphinx search engine, usual cron job rebuilding sphinx index every n hours accessing site's mysql database. works fine except when post created or edited - in case, until time comes rebuild index, remains unindexed or indexed obsolete attributes. according sphinx php api documentation updating of indexed documents allowed , there apparently no way of adding new document index without rebuilding scratch or merging delta one. there no way remove document index well. besides, peeking updateattributes source code reveals numeric attributes allowed update (other types filtered out assertion). makes me think updating index on fly isn't welcomed sphinx developers. are there ways around solve problem , modify index not on schedule on demand particular documents? or bad practice sphinx, , using updated delta index merged main 1 acceptable solution if there single document update? thanks in advance. you can try sphinx real time in...

javascript - Can I put an HTML button inside the canvas? -

i want make buttons game i'm making real html buttons, need inside canvas. how go doing this? given canvas element has transparent content model , may contain fallback elements displayed in event canvas element unsupported. not displayed if canvas is supported. you can position html elements relative canvas' parent have buttons "hovering" on canvas. menu element appropriately semantic element render list of controls, depending on context: html: <div id="container"> <canvas id="viewport"> </canvas> <menu id="controls"> </menu> </div> css: #container { height: 400px; position: relative; width: 400px; } #viewport { height: 100%; width: 100%; } #controls { bottom: 0; left: 0; position: absolute; width: 100%; }

c++ - How can I do some code work just like a singleton? -

possible duplicate: c++ singleton design pattern. how can create 1 instance of class , share instance header , source files without using singleton? can provide simple example? you can this: class sample { /*** code **/ public: sample(); void dowork(); int getvalue(); /*** other functions ***/ }; sample & oneinstance() { static sample instance; return instance; } //use oneinstance everywhere oneinstance().dowork(); note sample not singleton, can use oneinstance() function if it's 1 , same instance of sample , use everywhere! you can use initialize global variables this: int g_somevalue= oneinstance().getvalue(); which cannot done global static instance of sample . because of this: static initialization order fiasco

c# - What is the best way to return multiple FaultExceptions from one WCF call? -

as question says banging head on best way return multiple faultexceptions 1 wcf call: the scenario following: clienta makes call clientb clientb makes many calls serverc of may return faultexceptions i return faultexceptions clienta , have not come across way it. i have tried serializing , de-serializing both faultexceptions , messagefault objects xmlserializer, datacontractserializer , netdatacontractserializer no avail. the elements care reason, code, , detail. last resort manually write code serialize reason , code, hoping avoid that. are there other ways this missing ? edit: judging responses have gotten think question not clear in pseudo code trying following: class clienta() { main() { clientb.operateonmanyvalues(array[] values) } } clientb() { operateonmanyvalues(array[] values) { foreach(val val in values) { try { serverc.operateononevalue(val) } ...

internationalization - Special charcters in Android using PhoneGap -

im using phonegap develop android application. problem characters ã â á ç shown ? (question mark) has idea solve problem? thanks you need use utf-8 character set on page. can tell browser adding this: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> ... <head> section of page.

html - Text is not completely being displayed inside a div? -

Image
you can see in picture (css, behavior , divs). the lower part of p letter , g letter hidden div. http://img573.imageshack.us/img573/3553/screenshot3m.png edit: style.css: /* structure */ .container { margin: 0 auto; overflow: hidden; width: 960px; } #header, #intro, #tagline, #content { background: url(images/bg.png) top center repeat; } #branding, .content, .content-block, .posts, #footer { margin-left: 10px !important; margin-right: 10px !important; } #intro h2, #content h2, #nav li { text-shadow: 0 1px 0 #fff; } /* header */ #header { } #header { color: #333 } #header a:hover { color: #28a } #branding { float: left; margin: 10px 0 10px; width: 940px; } #header h1, #lang { margin: 20px 0 12px; width: 280px; } #header h1 { float: left; width: 280px; } #nav { float: left; margin: 32px 0 10px; } #nav li { float: left; } #nav li { font-size: 14px; font-weight: 400; margin: 0 40px 0 0; ...

regex - Need help with mod_rewrite conditions -

probably simple thing i'm not sure do: have in htaccess file far rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?$ x.php?country=$1&province=$2&region=$3&xxx=zzz [skip=1] rewriterule ^([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?([^/]*)/?$ defaultgg.php?country=$1&province=$2&region=$3&category=$4&type=$5&prodid=$6 [l] and redirection well. need add part says redirect different page if of last 3 parameters set. tried l , skip options don't seem work skip later rules final rule (shown above) gets run. the idea if enters url http://dddd.com/ca/on/peel go defaultgg... shown. else if enters url http://dddd.com/ca/on/peel/veggies/tomatoes go page x listing tomatoes in city of peel. else -- if enters url http://dddd.com/ca/on/peel/veggies/any go page y listing veggies in city of peel. else -- if enters url http://dddd.com/ca/on/peel/veggies/prodid go page y lis...

osx - Can't import wx(Python) on Mac OS X -

it first time i'm using python on mac. installed python 2.7.1 python.org , wxpython2.8-osx-unicode-py2.7 (mac os x 10.6.6) i have no idea installed to, anyway, that's get: python 2.7.1 (r271:86882m, nov 30 2010, 10:35:34) [gcc 4.2.1 (apple inc. build 5664)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import wx traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/local/lib/wxpython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module> wx._core import * file "/usr/local/lib/wxpython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in <module> import _core_ importerror: dlopen(/usr/local/lib/wxpython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found. ...

Transform java objects to dynamic xml -

i'm working dynamic xml table format consisting of schema specifies column names , types, , values tag contains rows. simplified version of xsd below: <xs:complextype name="data"> <xs:sequence> <xs:element name="schema" type="schema"/> <xs:element name="values" type="values"/> </xs:sequence> </xs:complextype> <xs:complextype name="schema"> <xs:anyattribute/> </xs:complextype> <xs:complextype name="values"> <xs:anyattribute/> </xs:complextype> and example xml generated it: <data> <schema firstname="string" lastname="string" age="integer"> <values> <value firstname="a" lastname="b" age="23"/> <value firstname="c" lastname="d" age="63"/> … </valu...

c# - extract multiple query params with regex -

i've been thinking day , need helt solve it. i've got html below , wants extract values of query parameter matching "?imgurl=". can me out regex this? </script></div><div id=nr_container><div id=center_col><div id=tbbcc><div id=tbbc style="background:#ebeff9;margin-bottom:4px;padding:8px;display:none"></div></div><div id=res class=med role=main><div id=topstuff></div><!--a--><h2 class=hd>søgeresultater</h2><div id=ires><ol><script>google.isr.fillcanvas=function(i){var c=document.getelementbyid('cvs_'+i.id);try{c&&(c.getcontext('2d').drawimage(i,0,0,c.offsetwidth,c.offsetheight));}catch(e){c.style.display='none';i.style.display='block';}}</script><div id=rgsh_s></div><li><div id=rg><div id=rg_s><div id=rg_hp><a id=rg_hpl></a></div><div class=rg_h id=...

javascript - Link in clickable table cell issue -

i have clickable cell link inside it, following: <html><body> <table><tr><td onclick="alert('cell click event fired.');"> blah blah blah <a href="#" onclick="alert('link click event fired.'); return false;">here</a> </td></tr></table> </body></html> the problem when click on link both onclick events fire. how prevent happening? edit: a jquery solution acceptable if can give me example of how that. you need stop propagation of event. edit: since asked jquery, delete inline onclick attributes , assign handlers this: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $(function() { $('table td').click( dosomething ) .find('a').click( dosomethingelse ); functi...

preg match all - regex multiple parentheses -

$str = "<p>(a)(3) asdf (10) asdf</p>"; trying pull second set of parentheses using php preg_match_all very big doc i'm parsing, have this: preg_match_all("=(?:<p[^>]*>|<p[^>]*>note|<i>|</i>)\((.*)\)=siu", $str, $matches); pulling things fine: <p>(a) <p>note(a) <i>(a) </i>(a) all returning (a) i'd search time see this: <p>(a)(3) so need second paren , value returned (3) and not want other paren + value (a) or (10) how this? preg_match_all("=(?:<p[^>]*>(:?note)?|</?i>)\((.*)\)(?:\((.*)\))?=siu", $str, $matches);

Emulating a toggle button with JQuery and CSS -

i have number of elements same class this: <html> <head><title>example</title> <script type="text/javascript" src="jquery.js"> </head> <body> <ul> <li class="togglebutton">elem1</li> <li class="togglebutton">elem2</li> <li class="togglebutton selected">elem3</li> <li class="togglebutton">elem4</li> </ul> $(document).ready(function(){ }); </body> </html> the selected element has different color other elements. when user clicks on element, want element have selected class - , other elements should no longer have selected class. in other words, 1 element can selected @ time. i think have worked out logic, not sure how implement using jquery. basically approach be: (when item selected): select items using selector "ul > li.togglebutton" remove class 'selected' of items fe...

operating system - Can't understand Belady's anomaly -

so belady's anomaly states when using fifo page replacement policy, when adding more page space we'll have more page faults. my intuition says should less or @ most, same number of page faults add more page space. if think of fifo queue pipe, adding more page space making pipe bigger: ____ o____o size 4 ________ o________o size 8 so, why more page faults? intuition says longer pipe, you'd take bit longer start having page faults (so, infinite pipe you'd have no page faults) , you'd have many page faults , smaller pipe. what wrong reasoning? the reason when using fifo, increasing number of pages can increase fault rate in access patterns, because when have more pages, requested pages can remain @ bottom of fifo queue longer. consider third time "3" requested in wikipedia example here: http://en.wikipedia.org/wiki/belady%27s_anomaly page faults marked "f". 1: page requests 3 2 1 0 3 2 4 3 ...

Jquery preventDefault() misbehaves -

preventdefault() messes events can handle on 1 specific page. trying display static progress bar. inside header div i've got links other html documents , want them loaded , displayed. i using piece of jquery : $("#header a").click(function(e){ $('body').append('<div id="progress">loading...</div>'); e.preventdefault(); loadpage(e.target.href); e.stoppropagation(); $('#progress').remove(); }); the problem that, on page loaded after clicking link inside header div, no other click event works on page except ones in header. firebug doesn't catches clicks anymore outside header. thank you! stefan can try below code return false both .. .preventdefault , stoppropagation ("#header a").click(function(e){ $('body').append('<div id="progress">loading...</div>'); loadpage(e.target.href); $('#progress').remove(); re...

Error when deploying ASP.NET MVC 3 Razor web app to server -

i started using asp.net mvc 3 razor view engine. works great locally, when published site web server, gives me error: method not found: 'system.web.razor.generatorresults system.web.razor.razortemplateengine.generatecode(system.io.textreader, system.string, system.string, system.string)'. i installed asp.net mvc 3 on server , it's running under .net 4 app pool. ideas? my guess have preview version of mvc isntalled on server. make sure have mvc 3 rtm installed.

bitwise operators and error levels (php) -

i have created user error handler, , want make sure using bitwise operators correctly. here config settings set errors handled in way: // user error logging level (change production) define('lev_user_error_log_level', e_user_error | e_user_warning | e_user_notice); // user error display level (change production) define('lev_user_error_display_level', e_user_error); here how set user error handler: // set user error handler set_error_handler('user_error_handler', e_user_error | e_user_warning | e_user_notice); here error handler itself: // user error handler public static function user_error_handler($error_level, $message, $file_name, $line_number) { if (lev_user_error_log_level | lev_user_error_display_level == 0) return true; switch ($error_level) { case e_user_error: if (lev_user_error_log_level & e_user_error) { error_log('[' . date('y-m-d h:i:s') . ...

Error while adding Attribute in Magento 1.4.2 -

i have started working on fresh magento 1.4.2 installation. when try add new attribute following error: fatal error: call member function setispopup() on non-object in /var/www/projects/magento/app/code/core/mage/adminhtml/controllers/catalog/product/attributecontroller.php on line 117 i tried searching in google , found solution here: http://www.magentocommerce.com/boards/viewthread/214159/ but resolves add issue causes problem in modifying attribute. i know if better solution available issue. thanks please try reinstalling package "mage_all_latest" magento connect manager , make sure, have set folder-permissions right. ensure file magento/var/.htaccess, directories magento/app/etc, magento/var, , directories under magento/media writable web server. it sounds there problem while install, reinstall of latest packages maybe solves problem.

c# - DirectX Z order -

i have draw map managed directx. map arrived in mapinfo format (lines, polylines, regions/polygons). polygons triangulated (done glutesselator). the idea: gps coordinates converted x,y points (mercator projection) i use positioncolored vertexformat center of view [x,y] (can modify mouse move) camera positioned [x,y,z] z zoom (-100 default, can modify mouse wheel) camera target is: [x,y,0], camera up: [0,1,0] the layers of map positioned z (+1.0, 0.99, 0.98, 0.97...etc) i can do: draw lines , polylines draw 1 layer of polygons my problem is: when want draw layers see 1 of them. think there problem z ordering. should solve this? modify renderstate? best if draw in gdi (first in back, last in front). other question: how can coordinate of pixel under mouse cursor? (in gdi version of map because used own viewport rendering, directx everything) thanks! if map purely 2d, make sure z buffering turned off. once is, things display in order draw them in. ...

oracle10g - Oracle 10g import Error Quick Question -

if import fails errors thrown, mean there data imported successful while others imported though @ end of import, says import fails. if so, doesn't mean have duplicate objects if try import again ? thank you. depends on error , table . if error on 1 table other tables imported. answer willl depends

entity framework - Type arguments error in LINQ extension method -

i wrote linq extension join 2 tables public static ienumerable<objectdetail<tleft, string>> todetail<tleft, tright, tkey>(this ienumerable<tleft> left, ienumerable<tright> right, func<tleft, tkey> leftproperty, func<tright, tkey> rightproperty, func<tright, tkey> keyproperty, func<tright, tkey> valueproperty, string keyselector) { return (from l in left join r in right on leftproperty(l) equals rightproperty(r) 1 select new { l, 1 }).asenumerable().select(q => new objectdetail<tleft, string> { item = q.l, meta = q.one.where(m => keyselector.contains(keyproperty(m).tostring())).todictionary(m => keyproperty(m).tostring(), m => valueproperty(m).tostring()) }); } the com...

mailing list - mail reader that uses gzipped archives from http instead of an nntp server -

is there mail client can configured use gzipped archives of mailing lists directly mailing list hosted rather central nntp server ? nntp either not free, or slow in experience. i guess can open unzipped gz file text file in emacs. turn on rmail-mode. m-x undigestify-rmail-message , rmail ready go... need right download (wget or downloadthemall) , unzip script followed concatenating mail files... gzip -d *.gz ; cat *.txt > allinone.txt then can view in emacs above or move thunderbird local directory, easy viewing / searching.

xml - How to set attributes inside Android layout that is included in another layout? -

i have composite widget consists of imageview , textview object wrapped inside linearlayout. since used several times inside 1 of activities made separate layout , include multiple times inside main layout. understand can override view id included layout tag in main layout. question is, possible set things image source , textview string main layout in xml? sure, programmatically wondering if possible purely in xml... from documentation : you can include other layout attributes in <include> supported root element in included layout , override defined in root element. it sounds can override layout_* attributes. (one might tempted take @ source code see if else secretly supported, no-no in terms of forward compatibility.)

asp.net - Crystal Report Credentials Prompt after deployment -

i publishing crystal reports on remote server using following code. when try run crystal report page crystal report viewer prompt me database info. published crystal report created using development server. in crystal report using oledb ado connection myrepository _myrepository = new myrepository(); system.data.sqlclient.sqlconnection myconnection = new system.data.sqlclient.sqlconnection(); myconnection.connectionstring = configurationmanager.connectionstrings["myconnstr"].connectionstring; system.data.sqlclient.sqlcommand mycommand = new system.data.sqlclient.sqlcommand("dbo.spmysp"); mycommand.connection = myconnection; mycommand.parameters.add("@positionid", sqldbtype.int).value = (cmbpositions.selectedvalue == "" ? 0 : convert.toint32(cmbpositions.selectedvalue)); mycommand.commandtype = system.data.commandtype.storedprocedure; system.data.sqlclient.sqldataadapter myda = new system.data.sqlclient.sqldataadapter(); myda.sele...

c# - How to get a dimension (slice) from a multidimensional array -

i'm trying figure out how single dimension multidimensional array (for sake of argument, let's it's 2d), have multidimensional array: double[,] d = new double[,] { { 1, 2, 3, 4, 5 }, { 5, 4, 3, 2, 1 } }; if jagged array, call d[0] , give me array of {1, 2, 3, 4, 5} , there way can achieve same 2d array? no. of course write wrapper class represents slice, , has indexer internally - nothing inbuilt. other approach write method makes copy of slice , hands vector - depends whether want copy or not. using system; static class arraysliceext { public static arrayslice2d<t> slice<t>(this t[,] arr, int firstdimension) { return new arrayslice2d<t>(arr, firstdimension); } } class arrayslice2d<t> { private readonly t[,] arr; private readonly int firstdimension; private readonly int length; public int length { { return length; } } public arrayslice2d(t[,] arr, int firstdimension) { this.arr...