Posts

Showing posts from April, 2011

python - How to display an icon in a menu item? -

Image
i know how create plain text menu item: item = gtk.menuitem('text') but how can display icon? like this: simply use imagemenuitem instead of menuitem . here's example: http://zetcode.com/tutorials/pygtktutorial/menus/

codeigniter - MVC confusion passing data from view to model via controller -

if view served controller ok pass data generated in view via post , pass straight model or need go through controller served view , call model controller? in codeigniter views data controller, demultiplexes / validates parameters , retrieves appropriate data model(s). it's important that: views output. views not coupled models directly, define html/xml/json/css (either pages, logical parts of pages, or other fragments of output data apis , resources). means not call models views in ci. controllers proxies. controllers , models not produce output. controllers take , post requests , make calls needed view print result, checking parameters , multiplexing multiple model calls of appropriate data. models , put data. models should return data in agnostic format: either data objects of model, or more generic (but consistent) hashes of data. cleaner returned model data, less coupling find between views , models (and more able reuse model pieces). in codeigniter

jpa - Hibernate Problem ( javax.persistence.PersistenceException: org.hibernate.PersistentObjectException) -

here problem description. i have 2 objects "a" , "b"."a" has onetoone(cascadetype= cascadetype.all) relationship object "c".even "b" has onetoone(cascadetype = cascadetype.all) relationship "c". now need persist object "a".and after persist object "a" ,i need persist object "b".i can persist object "a" ,but when persist "b" exception javax.persistence.persistenceexception: org.hibernate.persistentobjectexception the reason object "c" persisted when "a" persisted.and when "b" being persisted tries persist "c" again.thats why persistenceexception. i tried merge object c before persist object "b".even same exception. please provide me work around. also let me know if 1 needs further info. here full stack trace caused by: javax.persistence.persistenceexception: org.hibernate.persistentobjectexception: deta

Ruby on Rails - Render JSON for multiple models -

i trying render results more 1 model in json. following code in controller renders first result set: def calculate_quote @moulding = moulding.find(params[:id]) @material_costs = materialcost.all respond_to |format| format.json { render :json => @moulding } format.json { render :json => @material_costs } end end any appreciated, thanks. one way create hash objects want render, , pass render method. so: respond_to |format| format.json { render :json => {:moulding => @moulding, :material_costs => @material_costs }} end if models aren't associated through active record, that's best solution. if association exist, can pass :include argument render call, so: respond_to |format| format.json { render :json => @moulding.to_json(:include => [:material_costs])} end note wouldn't have retrieve @material_costs variable in section above if take approach, rails au

Can Static (FBML) Facebook fanpage access user's UID & Profile pic? -

i know uids , profile pics can accessed via facebook app can same done on static fbml pages? want able submit form uid information , able post fan's profile pic on fan page out using facebook application. possible? thank in advance. no not. access information must use application.

.net - Where to do SharePoint development? -

i'm trying use microsoft.sharepoint assembly development i'm doing. i've been getting errors and, i've seen, looks need sharepoint development on sharepoint server. needless say, pain (and seems little odd). is there way around this? tried install wss on development machine installer works windows server 2003 or 2008. i'd rather not install moss on local machine. you do need have sharepoint installed on machine want use server-side microsoft.sharepoint.dll on. it's possible install sharepoint 2010 on windows 7 machine , there are, however, pretty compelling reasons not so . sharepoint 2007 isn't real option (there hacks , running under windows vista/7, aren't supported , not functioning). the common scenario developing against sharepoint development on virtual machine. has added benefit of allowing snap shot environment should wreck something, can roll instead of needing start scratch. i've had success using vm-ware workstatio

sql - Historical Data and modified objects -

my application receives object trees jms topic, , must persist objects have changed historical purposes. if, example, receives object tree objects a, b, c (which exist in database according ids) in hierarchical order (a contains b contains c), object c has changed, object stored in database, creating new entry historical purposes . what solution best approach? technologies (hibernate, jpa) can me achieving this? here 2 fundamentally different approaches started. insert object tree temporary in table in database, , run stored procedure historical analysis. pull out matching object tree database , determine in code. the typical depth of tree, whether jms objects result in change, rate @ receive objects, difficulty of how detect change, whether same objects sent repeated or not, things affect best design choice. after that, should worry technology go with.

visual c++ - C++ std::string Parameter is <Bad Ptr> -

i'm using visual studio 2010. i have class following constructor: cvideoannotation::cvideoannotation(std::string aport, dword abaudrate) i create instance of cvideoannotation follows: cvideoannotation cvideoannotation("com3", cbr_9600); 'cbr_9600' macro resolves 9600. down in constructor, abaudrate 9600 expected. however, aport not passed properly. when hover cursor on it, intellisense gives value of <bad ptr> . does have thoughts on why string not pass properly? thanks, dave as update original question, i'm adding assembly code constructor call , population of locals once inside constructor. cvideoannotation cvideoannotation("com3", cbr_9600); 0041177d push 2580h 00411782 sub esp,20h 00411785 mov ecx,esp 00411787 mov dword ptr [ebp-174h],esp 0041178d push offset string "com3" (4198c8h) 00411792 call std::basic_string<char,std::char_traits<ch

Why is jQuery's email validation regex so simple? -

we know regex validate emails quite complicated . however, jquery's validation plugin has shorter regex (contributed scott gonzalez ) , spanning few lines: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]) +(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+)*)| ((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21| [\x23-\x5b]|[\x5d-\x7e]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f] |[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)? (\x22)))@((([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|\d| [\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])* ([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.)+(([a-z]| [\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]) ([a-z]|\d|-|\.|_|~|[

java - Create a matrix using JTextFields or JTextAreas -

i have make program has able show matrix in form of jtextfields or jtextareas, user can write in them(a number of matrix each jtextfield). problem have no idea how create custom jpanel size , quantity of jtextfields user specifies(a different each time). have googled question, no avail. take @ gridlayout . pretty simple put grid couple params (row , col count). paraphrase javadoc: public static void main (string[] args) { jpanel panel = new jpanel(); panel.setlayout(new gridlayout(3,2)); panel.add(new jtextfield("1")); panel.add(new jtextfield("2")); panel.add(new jtextfield("3")); panel.add(new jtextfield("4")); panel.add(new jtextfield("5")); panel.add(new jtextfield("6")); would result in 3 row 2 col grid of jtextfields edit: here more, in class named demo : public class demo { public static void main(final string[

php - Using Zend_Dom as a screen scraper -

how? more point... this: $url = 'http://php.net/manual/en/class.domelement.php'; $client = new zend_http_client($url); $response = $client->request(); $html = $response->getbody(); $dom = new zend_dom_query($html); $result = $dom->query('div.note'); zend_debug::dump($result); gives me this: object(zend_dom_query_result)#867 (7) { ["_count":protected] => null ["_cssquery":protected] => string(8) "div.note" ["_document":protected] => object(domdocument)#79 (0) { } ["_nodelist":protected] => object(domnodelist)#864 (0) { } ["_position":protected] => int(0) ["_xpath":protected] => null ["_xpathquery":protected] => string(33) "//div[contains(@class, ' note ')]" } and cannot life of me figure out how this. i want extract various parts of retrieved data (that being div class "note" , of elements inside it.

jquery the parent dialog textbox is locked after open dialog again -

i open modal dialog twice, textbox locked in first dialog(parent dialog) after second dialog closed why? how resolve problem? new user,so can't post image answer appreciated, thank you html: <xmp> <input id="btndlg" type="button" value="open dialog" /> <div id="dlg1"><%=html.textbox("txtname","can not edit") %><input id="btnshowdlg" type="button" value="dialog again" /></div> <div id="dlg2"><div>the second dialog</div><%=html.textbox("txtname2") %></div> </xmp> jquery: $("#dlg1").dialog({ autoopen: false, height: 350, width: 300, title: "the first dialog!", bgiframe: true, modal: true, resizable: false, buttons: { 'cancel

maven - Unable to resolve package references in Eclipse -

we have small maven-based java project , created eclipse project using mvn eclipse:eclipse command. even after importing project , resolving library references, source code shows import references unresolved. i have tried re-starting, cleaning , importing project but nothing seems work. all library references pointing m2_repo . problem here ?

java - How to activate ENSIME editor for Emacs in MacBook -

iam new emacs ... installed emacs macbook , installed ensime plugin, cant follow steps provided in ensime site, can me citing wiki or blogs has step step information follow quick start instructions on link , should setting ensime up.

linux - find -exec a shell function? -

is there way find execute function define in shell? example: dosomething () { echo "doing $1" } find . -exec dosomething {} \; the result of is: find: dosomething: no such file or directory is there way find 's -exec see dosomething ? since shell knows how run shell functions, have run shell run function. need mark function export export -f , otherwise subshell won't inherit them: export -f dosomething find . -exec bash -c 'dosomething "$0"' {} \;

git - Why does msysgit sometimes try to open the (non-existent) file "$@"? -

i'm using msysgit on windows, , occasionally, when should open editor allow me edit commit message or something, tries open file called $@ instead. file doesn't exist, notepad++ says "the file '$@' doesn't exist; create it?" my .git/config looks like: [core] editor = c:/program\\ files/notepad++/notepad++.exe i had same problem too. have tried write string in different ways. i've found right variant. [core] editor = 'c:/program\\ files/notepad++/notepad++.exe' -multiinst -notabbar -nosession -noplugin the single quotes must presented. don't know why or how, works (in case). may explain reason of such behavior. hope comment helpfull.

java - how to switch if and else statements to try and catch -

so made program have change if , else statements try , catch. appreciated :) here code: import java.awt.*; import java.applet.*; import java.awt.event.*; import java.util.*; public class showindex extends applet implements actionlistener { int [] number =new int[100]; random r= new random(); label indexlabel = new label(" index:"); textfield indexfield = new textfield(10); label valuelabel = new label("value:"); textfield valuefield = new textfield(10); button showbutton = new button ("show element"); public void init() { int i; for(i=0;i<100;i++) number[i]=r.nextint(1000)+1; // random number between 1 , 1000 add(indexlabel); add(indexfield); add(valuelabel); add(valuefield); add(showbutton); showbutton.addactionlistener(this); valuefield.seteditable(false); } public void actionperformed(actionevent e) { string input

eclipse - Shortcut for changing package name declaration in java -

we have simple java project in eclipse , have migrated package name existing source code. there shortcut changing package name declarations while inside code editor select package name, , use refactor -> rename ( shift+alt+r ) open rename package dialog

Send parameters using php file_get_content function -

dear all, how send parameters using php file_get_content function. $id='123'; $name='blah'; $response=file_get_contents('http://localhost/abc/abc.php?id=$id&name=$name'); echo $response; i need send $id , name value abc.php page.here value passing does not working .also chk ?id="$id"&name="$name" value.it's not working. straite parameter works .say- $response=file_get_contents('http://localhost/abc/abc.php?id=123&name=blah'); now kind heart can me send 2 parameters $id , $name abc.php? thanks riad single quotes inhibit variable substitution. $response=file_get_contents("http://localhost/abc/abc.php?id=$id&name=$name"); don't forget url-encode parameters though.

weblogic 10.x - Log4j on weblogic10 only logs to console -

i'm trying print log messages file. @ point, logs console not ideal future support. my log4j.properties file looks this: log4j.rootcategory=debug, stdout, logfile log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d %p [%c] - <%m>%n log4j.appender.logfile=org.apache.log4j.rollingfileappender log4j.appender.logfile.file:/apps/wlserver10/bpdomain/servers/hrserver/logs/hrserver.log log4j.appender.logfile.maxfilesize=4mb log4j.appender.logfile.maxbackupindex=10 log4j.appender.logfile.append=true log4j.appender.logfile.layout=org.apache.log4j.patternlayout log4j.appender.logfile.layout.conversionpattern=%d %p [%c] - %m%n this works fine on local weblogic instance, when try deploy server doesn't write log file. can please me find why? in advance yols is missing = after file instead of : ? log4j.appender.logfile.file:/apps/wlserver10/bpdo

php - facebook graph api determine if user likes url -

i want display different message if user logged in facebook , likes current page. understand: fb.event.subscribe('edge.create', function(response) { // }); which fire when user likes page, when reload page how determine current page? thanks! i'm pretty sure cant want (in context). take @ page : http://fbrell.com/fb.api/does-like you'll see need user approve permission view likes. it's huge security risk allow see 'likes' of user - current page. think can spoof current page , pretend page. but... what recommend set cookie own benefit (in javascript) when user 'likes' page. assuming you're getting large percentage of 'likes' page can safely correlate presence of cookie 'like'. i've seen security exceptions doing this, seems work (at least in chrome).

I can't detect \n character in XMl parsing [android] -

i try parse xml file dom method ( eventelement.getattribute("string") ) couldn't detect warp (e.g "\n") when open in browser , open source (ctrl+u) see warps. when use string.split("\n") string.split(system.getproperty("line.separator")) ; string.split(" "); all of them dosen't work thank help you shoud search not "\n" system.getproperty("line.separator"); .

Google Analytic UA-xxx question -

there many way create new account in google analytic create new ua-xxx number or make new 1 under existing ua-xxx-y (y) y increment number 1,2,3,4....and on two questions : have come close 50 limit, maybe doing new account under created way trick system have more 50. but second question. there difference or drawback make 2 different site under same ua-xxx number last digit different... eh, in fact it's new number.. no ? you google analytic pro out there please me, forum unanswered or useless in advance i know...do generate new ua-1234-1 new site or using generate ua-1234 anothe digit ens fine ua-1234-6 the connection between ua-123-1 , ua-123-2 they're organized under same menu, , permissions managed in same way. if 2 sites have nothing each other, , run against limit ua-123-50 (if limit), there's no drawback in beginning move new sites ua-124-1. as general organizational rule, grouping of ua-123 organizational, not technological, since ga sends dat

python - How to get started with Big Data Analysis -

i've been long time user of r , have started working python. using conventional rdbms systems data warehousing, , r/python number-crunching, feel need hands dirty big data analysis. i'd know how started big data crunching. - how start simple map/reduce , use of hadoop how can leverage skills in r , python started big data analysis. using python disco project example. using rhipe package , finding toy datasets , problem areas. finding right information allow me decide if need move nosql rdbms type databases all in all, i'd know how start small , gradually build skills , know-how in big data analysis. thank suggestions , recommendations. apologize generic nature of query, i'm looking gain more perspective regarding topic. harsh using python disco project example. good. play that. using rhipe package , finding toy datasets , problem areas. fine. play that, too. don't sweat finding "big" datasets. small datasets

MYSQL - Trouble with left join -

i'm looking bug in java swing (it isn't code) dynamically generates query. sorry big query, i've report here: select b.codicecommercialeriferimento "comm. rif.", b.partitaiva "partitaiva", b.flgbustecartotecnica "tipo prodotto", b.classemerceologica "cl.merc.", periodo0.v periodo0, periodo3.v periodo3, periodo4.v periodo4 ( select distinct if (codicecommrif null, '', descrizionecommrif) codicecommercialeriferimento, commercialeriferimento, trim(concat(bolle.codicecliente, ' - ', anagraficaclientipi.ragionesociale1)) codiceclientepi, trim(concat(anagraficaclientipi.partitaiva, ' - ', anagraficaclientipi.ragionesociale1)) partitaiva, bolle.flgbustecartotecnica, if(descrizioneclm null, '', descrizioneclm) classemerceologica bolle

Version control system for distributed developers team -

distributed developer team requires version control system allows internet access , nicely integrated visual studio. please, share experience. system choose? given you're in microsoft world , given looking @ dvcs due distributed team, between git , mercurial, i'd go mercurial has bit nicer support microsoft. the downside integration studio not there (there third party options, none have worked with). on flip side, tfs can (semi) work remote, not strong if you're doing internet access vs. being on vpn, etc. (and vpn can slow... once had deal tfs server on different continent). although not suprised if ms comes out dvcs due popularity down road.

c - XMS allocation in 16-bit DOS -

please forgive attempts @ necromancy, need write code 16-bit dos (!). have verify piece of software executes correctly when built 16-bit platform, , discovered our xp workstations can run 16-bit dos apps, makes possible use existing batch test system. in case, software consists of 1 library , 1 database. smaller databases (up ~150kb) can either defined static global array or read file buffer allocated halloc() , confident library , test tool built correctly. however, have larger databases test, ~1.8mb. large allocate normally, wrote small support library allocate xms memory. this, can allocate, use (i.e. write , read data) , free 16mb of data in small toy program. however, when using xms facilities in "real" application, following error: the ntvdm cpu has encountered illegal instruction. cs:0000 ip:00ba op:0f 04 10 0e 51 googling on error gave little relevant results, type of error seems blamed on miscellaneous malware. the code base strict c90, compiler used do

.net - Is it possible to return the result of a HttpWebRequest POST method via IObservable interface -

i'm trying in single method return result of httpwebrequest post method via reactive interface iobservable. i've managed method using code below: var request = (httpwebrequest)webrequestcreator.clienthttp.create(url); request.method = method; request.accept = gethttptype(); request.cookiecontainer = new cookiecontainer(); return observable.fromasyncpattern(request.begingetresponse, ar => processresponse(method, ar, request))() .select(r => r); but unsure how chain async observer of writing request stream reading of response stream required http post operation. how connect following variables obs1 & obs2 can return obs2? var request = (httpwebrequest)webrequestcreator.clienthttp.create(url); var type = gethttptype(); request.method = method; request.accept = type; request.contenttype = type; request.cookiecontainer = new cookiecontainer(); var data = serialize(requestresource); var obs1 = observable.fromasyncpattern(request.b

c# - adding controls to a panel , positioning the from left to right -

i added user-controls added in html-positioning way: want them position automatically left right , when there no more room on 'row' , continue the bottom 'row' , left relative-position-floated-left divs in html. excuse bad explanation.. sounds want use flowlayoutpanel . describing (i think). documentation says represents panel dynamically lays out contents horizontally or vertically .

firefox - SVG 'def' tag not functioning with JS events -

all, am having bit of issue javascript events associated svg 'defs' tag in firefox 3.6 & firefox 4.0b. i have image on svg canvas enclosed in 'defs' tags. have event attached cursor cursor gives co-ordinates mouse rolls on image. seems working in chrome, safari & opera not in firefox browsers. in firefox, there no error shown, co-ordinates donot appear cursor movement. any advice , suggestions? edit: erik, reply. apologies error, did mean 'defs' tag. here code: var cur= svgdoc.getelementbyid("backdrop1") cur.setattribute("stroke-width","1" ) zain.setattribute("stroke","black") zain.setattribute("fill","purple") zain.setattribute("stroke","black") zain.setattribute("opacity","0.3") zain.setattribute("pointer-events","all") cur.onmousemove=f

Erlang register process -

i try spawn new process , register it: -module(db). -export([start/0]). start() -> register( db , spawn( db, abs, [-100])). but when try in erlang shell: 1> db:start(). i see: true (emacs@myhost)2> =error report==== 1-dec-2010::17:42:27 === error in process <0.112.0> on node 'emacs@myhost' exit value: {undef,[{db,abs,[-100]}]} what's wrong? thank you. this fails because db:abs/1 not defined.

php - How to get the real URL after file_get_contents if redirection happens? -

i'm using file_get_contents() grab content site, , amazingly works if url pass argument redirects url. the problem need know new url, there way that? you might make request curl instead of file_get_contents() . something should work... $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, true); curl_setopt($ch, curlopt_followlocation, false); curl_setopt($ch, curlopt_returntransfer, true); $a = curl_exec($ch); if(preg_match('#location: (.*)#', $a, $r)) $l = trim($r[1]); source

python's trackback error - using pymssql -

am trying execute below code using python 2.5.2. script establishing connection , creating table, failing below error. the script import pymssql conn = pymssql.connect(host='10.103.8.75', user='mo', password='the_password', database='sr_wf_model') cur = conn.cursor() cur.execute('create table persons(id int, name varchar(100))') cur.executemany("insert persons values(%d, %s)", \ [ (1, 'john doe'), (2, 'jane doe') ]) conn.commit() cur.execute("select * persons salesrep='%s'", 'john doe') row = cur.fetchone() while row: print "id=%d, name=%s" % (row[0], row[1]) row = cur.fetchone() cur.execute("select * persons salesrep 'j%'") conn.close() the error traceback (most recent call last): file "connect_to_mssql.py", line 9, in <module> cur.execute("select * persons salesrep='%s'", 'john doe') file &

php - zend framework using mysql_real_escape_string in 2 tier server -

in 1 of application i'm using zend framework. web/application server, database server physically different. i'm using mysql_real_escape_string security giving first parameter. , gives me warning "link_identifier not found or no database connection identifier". when created connection identifier instance , provided stared working. question why not identifying on own. by default, methods in zend_db_adapter escape input. mysql_real_escape_string superfluous

html - control image size -

i had re-sized image suitable in page javascript when print page , images appear in bigger size , tried control size of images in css , not affected : @media print { img { width: 544px; height: 450px; } } any 1 can ? try changing code include !important attribute. @media print { img { width: 544px !important; height: 450px !important; } } and check see if force-overriding inline css. !important attributte supposed ignore inline attributes in experience doesn't seem work across browsers. can change sizes be: width: 5.67in !important; height: 4.69in !important; assuming flat-panel monitor. can find converter here

Move folder in all git branches -

we have central repo 20 branches, use layout like: /.gitignore /file1.txt /file2.txt now should changed to /.gitignore /projectfolder/file1.txt /projectfolder/file2.txt in branches . how approach in git? change in branches? merge master , rename there? there magical command batch rename in branches? use scripting provided system , apply commands branches in for cycle. something in bash : for in $branches; git checkout $i .... git commit -m "moved files" done

joomla - Managed/shared web hosting with PHP 5.3 + -

does know of hosting providers running php 5.3 + ?? need our custom joomla sites. a quick google search "shared hosting php 5.3" gives http://servergrove.com/index.php

C# memory leak? -

i testing appfabric cache performance. this, local machine , hitting cache host on lan. cache host running on windows server 2008 , except bare essentials has nothing installed on it. has 8 gigs of ram. vmware virtual server, as hit cache host, can see memory being used increases. fishy going on somewhere. total primary data bytes being used 1.5 gigs. object size 1,744 bytes (using ants profiler).the total object count 2,521,451. have disabled eviction. but, interesting, server hits throttled state, can see server's ram being used @ 7.72 gigs, apart distributed cache using 1.8 gigs there no other application thats using such high quantity of ram. i using visual studio 2010 , , inserting , reading objects in parallel the question wanted ask : where memory going? server in throttled state says using 7.72 gigs of alloted memory whereas in task manager, can see barely 3 gigs being used (if add running process's memory) gagan, if you're still having issue, c

java - For what types variables must never be static? -

in 1 library in heavy use in our project there restriction variables of classes must never static. (it ulc ). far understood because of need serialize of them. , problem rule, is not strict , may cause of bugs hard debug. we going write module checkstyle detect static variables of such types (detected customizable regexp probably). , need know how necessary check other developers. so question is: general circumstances when variables of types must never static? first, proper object oriented design should inform decision make method/field static. second, in web application, requests handled on separate threads, have careful how use static methods/fields. if static method maintains state across invocations(by using static field keep count, example), can run threading issues. happens because 1 request might invoke static method, , stopped in middle of execution thread invokes method. if first invocation modified common resource, did not finish, second invocation migh

css - Style attribute of HTML fieldSet Tag is Not Working -

my html these <html> <body> <fieldset id="sourcename" style="width: 350px; height: 80px; overflow: auto;"> data..... </fieldset> </body> </html> the above code working fine in ie , opera when run same code in mozilla firefox style attribute of fieldset not working on mozilla should use. simple qustion how give scrollbar fieldset in mozilla. ff doesn't seem handle fieldset overflow in standard way. workaround, use nested div: <fieldset id="sourcename" style="width: 350px; height: 80px;"> <div style="width: 350px; height: 80px; overflow: auto;"> data..... </div> </fieldset>

c# - PhluffyFotos does not work on Azure SDK 1.3 -

i have tried phluffyfotos example on azure sdk 1.2 , works perfect. today have installed on (clen) computer azure sdk 1.3 , have want try phluffyfotos on not work. have problem part: if (!roles.getallroles().contains("administrator")) { roles.createrole("administrator"); } it seems somehow not load custom roleprovider (tablestorageroleprovider). have idea be? i following error: "the role manager feature has not been enabled.", because of following exception "'system.web.security.roles.applicationname' threw exception of type 'system.configuration.provider.providerexception'". can test example , see problem? http://phluffyfotos.codeplex.com/ firsty have "setconfigurationsettingpublisher" problem example, but have resole it . edit: i have deeper , sure there problem role provider. somehow roles class not read config file. have idea why? i have exact same probl

winforms - Visual Studio 2008 "Document Outline" stopped working for the main form in my project -

i'm big fan of rather obscure "document outline" window in vs 2008 (it's buried in view -> other windows menu). it's way know view of containment heirarchy complicated winform has lot of nested controls. some months ago, stopped working complicated form in winforms project. displays "there no items show selected document", no matter select in designer. no clue broke - form contains mix of common ms controls , third party controls (mainly devexpress). several splitcontainers, document outline had no problem these. anybody else seen this, , suggestions on how fix it? after poking around, solved problem myself. i started deleting controls form, see happen. turns out 3rd party grid i'm using caused problem - when reconfigured it, problem went away. (looks bug in control, i've reported vendor). interesting...misbehaving controls can break vs ide, not apps.

Setting maximum CPU usage per process in Windows -

is there way set maximum cpu usage process in windows 7? you check out "cpu rate limits in windows server 2008 r2 , windows 7" - http://technet.microsoft.com/en-us/library/ff384148%28ws.10%29.aspx but aware of warning in http://blogs.iis.net/thomad/archive/2010/02/15/put-the-brakes-on-your-application-pools-cpu-rate-limits-in-windows-7.aspx . says: now here comes drawback. cpu rate limit feature has bug. kernel holding on handle quota object , never lets go of it. means once set cpu rate limit particular percentage can't change percentage without rebooting machine. working on fixing - not sure when we'll have fix though. have no idea if bug fixed.

regex - PHP -Multibyte regular expression to remove all but chinese characters...please help -

i trying take utf-8 string looks like: &q| 艝隭)r墢lq28}徫廵g'y鑽妽踒f and strip out except chinese characters hex 4e00-9fa5 , keep characters in string. have tried taking line leaves valid characters: preg_replace('/[^\x20-\x7e]/', '', $str); to this: preg_replace('/[^\x4e00-\x9fa5]/u', '', $str); but outputs nothing....am missing something? not regular expressions you close! preg_replace('/[^\x{4e00}-\x{9fa5}]/u', '', $str);

javascript - Interacting with Separate Frames -

i setting html page frameset has 2 frames. initiate action on 1 frame modify in other frame. example, clicking button on frame 1 change innerhtml of element id on frame 2. how go doing this? thanks you can trigger following javascript upon event in frame 1: window.parent.frame2.document.getelementbyid('element_id').innerhtml = 'new content'; assuming frame 2 element has name of "frame2" , element want modify has id of "element_id".

How to build a mix-in architecture framework in C#? -

i have concept framework of controls build. makes idea different not intend take "one size fits all" approach or "one control rule them all" approach. as example, telerik makes nice grid control, componentone, xceed, etc.. however, gigantic controls hundreds or thousands of methods , properties, complex object model hiearchies, etc... these grids way overkill need, still have take on herculean task of learning entire grid simple. my concept more of "mix-in" aproach. create simple control, , build features can "add-in" control la carte. example, have simple grid, , want add grid "sections" headers , footers each. ok, where's problem? traditional way of doing via multiple inheritance, c# not support. if did support it, i'm still of opinion mi adds more problems solves. so i'm soliciting opinions on how approach problem. mef potential solution? edit: something occurs me possible use expression trees build

sql server 2005 - long running database mail -

i've got redgate's sql monitor 2 running against 2005 production server, , keep getting alerts database mail having long running query. i've got alerts set flag after minute , mark red after 2 minutes, , routinely popping red. i need know if need into, or if normal behaviour , can set alert ignore this. red-gate bug april 2009 (!). workaround/exclusion here and first hit on world's favourite search engine

ruby on rails - PGError: ERROR: syntax error at or near E'String' -

i have ruby on rails condition works in mysql not in postgres :conditions => ["a between ? , ? , b between ? , ? , c between ? , ? , ddd ?",@amin,@amax,@bmin,@bmax,@cmin,@cmax,params[:input].to_s] generates error: activerecord::statementinvalid (pgerror: error: syntax error @ or near "e'word'" line 1: ...c between -100 , 100 , ddd e'word') i know works without last comparison. eg. :conditions => ["a between ? , ? , b between ? , ? , c between ? , ?",@amin,@amax,@bmin,@bmax,@cmin,@cmax] ddd of type :string whereas a,b , c :decimal. after doing research on postgresql seems e' strings escaped strings - doesn't me can't seem correct it. don't work postgresql apologize in advance if obvious. i'm using heroku hosting can't change postgresql settings. anyway, i'd prefer understand problem , how fix it. cheers, stu try changing ddd ? into ddd = ?

counter - How do I use Android's CountDownTimer? -

how use android's countdowntimer? i want have following scenario: boolean 3_s_passed = false; // setup counter change 3_s_passed=true when finishes counter.start(); while(true){ if(3_s_passed || user_is_done) break; // stuff may set user_is_done true } so either 3 seconds passed or user finishes , i'm out of loop. while-loop code run before counter finishes? understanding of countdowntimer correct? thanks help you use handler this. make runnable task complete after 3 seconds or when user task. post 3 seconds , remove callbacks if user whatever. code same below shows how use handler isn't looping allow user make action you'll have figure out on own :) runnable action = new runnable(){ public void run(){ //... } }; mhandler.postdelayed(action, 3000); if(userdone){ mhandler.removecallbacks(action); mhandler.post(action); }

jpa - Illegal access to loading collection (hibernate.LazyInitializationException) -

i using jpa hibernate persistence provider. i have 1 many mapping, used @onetomany(mappedby = "msearchpreference", cascade = cascadetype.all, fetch=fetchtype.eager) i can see 1 many sql statements on console, eventhough getting exception illegal access loading collection (hibernate.lazyinitializationexception) org.hibernate.lazyinitializationexception: illegal access loading collection @ org.hibernate.collection.abstractpersistentcollection.initialize(abstractpersistentcollection.java:341) @ org.hibernate.collection.abstractpersistentcollection.read(abstractpersistentcollection.java:86) @ org.hibernate.collection.abstractpersistentcollection.readelementexistence(abstractpersistentcollection.java:142) @ org.hibernate.collection.persistentset.add(persistentset.java:187) can me out other arrangements need do? this means hibernate session has been closed when trying access new entities. 2 options solve issue are: review model graph , set

android - Showing ProgressDialog while a Service is being started -

i'm having serious problems when showing progressdialog while service getting ready... service takes time ready it's bit heavy, want show progressdialog meanwhile it's started. the thing shows progressdialog right before next activity starts... don't find is... package org.pfc; import android.app.activity; import android.app.progressdialog; import android.content.broadcastreceiver; import android.content.componentname; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.content.serviceconnection; import android.os.bundle; import android.os.ibinder; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; public class connectactivity extends activity { // fields------------------------------------------------------------------ protected localservice msmeppservice; private progressdialog progressdialog;

algorithm - Optimal physical orderings of nodes -

first, read this: tpt paper wondering other options might exist arranging nodes boost performance. post-parent order in byte array, tpt's, more k-order b-tree; i'm wondering options known @ moment? a bit more on problem: have extremely fast way of finding elements within sparse set, given concept of adjacency given pointer. wondering how best take advantage of in storing patricia trie. you can make assumptions whether trie random-access, read only, write-seldom, or add-only. please note them if do, i've used tpt , gains pretty significant i'm willing consider constraints. update i guess in senses little unclear. i'm looking here ways of arranging things in memory optimize 1 performance metric or another. tpts, through tricks, use node order optimize disk reads , space-per-node. i'm curious about: total deletion, structure removed memory entirely. inserts, particularly in densely populated structures. deletes, again, particularly in dense

wix - how can i use a Feature name like a inner text condition in a <UI> </UI> frame? -

i want use feature state inner text in publish element. this code: <feature id="complete" title="app" display="expand" level="1" allowadvertise='no' installdefault='local'> ... </feature> <ui> ... <publish dialog="customizedlg" control="next" event="newdialog" value="verifyreadydlg"> ¿¿¿????</publish> ... </ui> i want replace ¿¿¿¿???? "(&complete = 3)" you need escape xml . something &amp;complete=3

php - Keyword Extractor for Query Strings -

i've found few keyword extractors query strings, seem outdated (use deprecated code or don't work). does know of php query string extractor. or how build function takes "host" "amazon.com" , names of multiple query parameters , returns values of parameters? for instance, http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3daps&field-keywords=a+tale+of+two+cities&x=0&y=0 if provided "amazon.com" , "field-keywords" how can array: ['a','tale','of','two','cities'] ? thanks in advance!! clarification jose's answer covers example amazon doesn't seem work other url: http://www.bing.com/search?q=christmas+around+the+world&form=qblh&qs=pn&sk=hs1pn4&pq=&sp=6&sc=8-0 http://search.yahoo.com/search;_ylt=anqn0c997qr5siycyt.h2ycbvzx4?p=golf&toggle=1&cop=mss&ei=utf-8&fr=yfp-t-701 you (i) write one. function getvaluef

html - Printing Labels using CSS with Floated List -

i'm trying re-make existing asp.net page generates labels. original uses hideous tables-within tables-within tables force layout, , our order quantity has increased it's got point it's spitting out 65k lines of html assuming doesn't time out first. i've replaced unordered list list of lables, each list item floated, , on-screen layout perfect. print, it's 4 labels per page, 1 in each corner. however, @ least in ie-land, go print preview , goes being vertical list. any thoughts? make sure using float:... in css of li class fix :) let me know if helps

python - 'bytesize' in PySerial module -

i want send messages through serial port using pyserial. 1 of parameters serial constructor 'bytesize'. have been trying serial.sevenbits , serial.eightbits , haven't noticed difference. documentation bit vague , new both python , serial communication. set maximum value byte can hold or signed bytes? can clear why i'd use 7 bits on 8? have been searching haven't found answer. thank you this refers number of data bits in each transmitted character. wikipedia : data bits the number of data bits in each character can 5 (for baudot code), 6 (rarely used), 7 (for true ascii), 8 (for kind of data, matches size of byte), or 9 (rarely used). 8 data bits universally used in newer applications. 5 or 7 bits make sense older equipment such teleprinters. most serial communications designs send data bits within each byte lsb (least significant bit) first. standard referred "little endian". possible, used, &quo

How can i copy a file from my iPaq via my Delphi application -

i own hp ipaq hx2100. use collect data application made purpose. i want copy database in ipaq pc via delphi application installed on pc. how? thank you. you can use delphi translation of rapi.h made scott crossen. find more info @ http://www.pocketpcfaq.com/developer/faq/rapi.html used explore device , copy files from/to ipaq

Security Plugin from Grails? -

i try find simple security plugin grails . and first of all, want ask you: plugin can recommend? i not need super powerful plugin. must , small application. thanks. i recommend spring security . easy configure, , flexible. can handle simple login, annotated access controls on methods, various complicated login schemes. it have complicated api, there plenty of documentation, , can sure others using it. if want simple login, easy set up. more info here . per @robbbert suggestion, here alternative -- shiro plugin. cannot speak reliability/community/expandibility.

language agnostic - Associative cache simulation - Dealing with a Faulty Scheme -

while working on simulating associative cache (in mips assembly), couple of questions came mind based on information read online; according notes university of maryland finding slot: @ most, 1 slot should match. if there more 1 slot matches, have faulty fully-associative cache scheme. should never have more 1 copy of cache line in slot of fully-associative cache. it's hard maintain multiple copies, , doesn't make sense. slots used other cache lines. does mean should check time whole tag list in order check second match? after if don't, never "realize" fault cache, yet, checking every single time seems quite inefficient. in case check, , somehow manage find second match, meaning faulty cache scheme, shall then? although best answer fix implementation, yet im interested on how handle during execution if situation should arise. if more 1 valid slot matches address, means when previous search same address executed, either v