Posts

Showing posts from August, 2010

Lotus Notes: RichText Item -

okay, here's deal. using c# domino api. have rich text data want insert lotus notes rich text field. notesdocument.replaceitemvalue inserts text no formatting. notesdocument.createrichtextitem gives me notesrichtextitem object can use manually creating richtext (methods addnewline() addpagebreak() etc). not have kind of parse method formatted rich text data, need. want users put whatever want in there - using aforementioned methods useless me. the notesrichtextitem.values object throws error when try add rich text formatted string. so now, do? guess i'm pretty screwed here, hoping genius come solution. appreciated. thanks guys! ps - inserting notes rich text data or html data fine. either 1 long displays proper rich text in document , not unformatted string. well, found answer - it's not pretty, works! did was use dxl exporter grab xml edit (adding rich text) , then delete original document use dxl importer import edited document voila! :-...

c# - Invalid Column Name though it's there! -

i'm trying print out tables db have entityid column equals dataclassid column here code public void getroottables_checksp() { string connect = "data source= euadevs06\\ss2008;initial catalog=tacops_4_0_0_4_test;integrated security=sspi; persist security info=false;trusted_connection=yes"; sqldatareader roottables_list = null; sqlconnection conn = new sqlconnection(connect); conn.open(); sqlcommand s_cmd = new sqlcommand("select * sys.tables entityid = dataclassid", conn); roottables_list = s_cmd.executereader(); while (roottables_list.read()) { string test = roottables_list[0].tostring(); console.writeline("root tables {0}", test); } roottables_list.close(); conn.close(); } but keeps saying these columns invalid though when printed out columns in db "syscolumns" there... can tell me why i'm getting such e...

shell - Check if file exists and whether it contains a specific string -

i want check if file2.sh exists , if specific word, poet part of file. use grep create variable used_var . #!/bin/ksh file_name=/home/file2.sh used_var=`grep "poet" $file_name` how can check if used_var has value? instead of storing output of grep in variable , checking whether variable empty, can this: if grep -q "poet" $file_name echo "poet found in $file_name" fi ============ here commonly used tests: -d file file exists , directory -e file file exists -f file file exists , regular file -h file file exists , symbolic link (same -l) -r file file exists , readable -s file file exists , has size greater 0 -w file file exists , writable -x file file exists , executable -z string length of string 0 example: if [ -e "$file_name" ] && [ ! -z "$used_var" ] ...

jQuery Validator Plugin - update custom error messages -

i'm using jquery validator plugin on form. form widget, space constraints tight. reason, don't want show normal error messages after each form field doesn't validate. rather, each form field, have label, , inside labels of required fields, have <em> text '(required)' in it. if user tries submit without filling out fields, add .css('color', '#f00') <em> s of empty fields, highlight fields need filled out. works great, far. now need know is, event use set <em> black if user enters data associated required field? i change <em> s red this, currently: errorplacement: function(error, element) { jquery(element).prev().children('em').css('color', '#f00'); } maybe @ using highlight/unhighlight options -- these seem designed sort of thing you're interested in. plugin calls highlight when invalid condition triggers, automatically calls unhighlight when user corrects invalid input. ...

Google app engine Youtube API -

we have small youtubeapi mashup app hosted on google app engine. last friday; have been getting yt:quota - too_many_recent_calls error youtube though call once in hour. suspected google app engine; , hosted our war hosting provider & rock solid & not getting youtube quota limit errors (too_many_recent_calls). unable understand why getting error when host on google app engine . there problems google app engine last few days? any appreciated thanks, -satish have followed these guidelines: http://code.google.com/apis/youtube/faq.html#quota if not, requests might not seen separate other youtube api requests originating on appengine.

How to create unique temporary tables in MySQL procedures? -

i creating temporary table in procedure, got error "table exists". then tried create random name avoid collision don't know enough how execute sql strings set @tbname = concat('temp', random_id); prepare stmt1 'create temporary table ? (`fieldname` float not null);'; execute stmt1 using @tbname; deallocate prepare stmt1; the code above doesn't works. why? how correct it? mysql> set @table_name := 'mytable'; query ok, 0 rows affected (0.02 sec) mysql> set @sql_text:=concat('create table ',@table_name,'(id int unsigned)'); query ok, 0 rows affected (0.00 sec) from http://rpbouman.blogspot.com/2005/11/mysql-5-prepared-statement-syntax-and.html

How to safely sanitize input from TinyMCE in ruby? -

i added tinymce small cms built in rails. i've been using redcloth before style user generated articles. since started using tinymce, allow users embed video (from youtube ex) blog posts. i'm using follow helper in views: sanitize(text, :tags => %w(a object p param h1 h2 h3 h4 h5 h6 br hr ul li img), :attributes => %w(href name src type value width height data) ) is safe? or should not allow tags? if so, tags can allow? how can test make sure? this still in staging. thanks deb you allowed use tags want using valid_elements configuration option , check out default setting can expand. may have @ custom_elements option.

spring - <mvc:resources> type not resolved -

i trying build mvc-showcase example available here link . but getting below error: cvc-complex-type.2.4.c: matching wildcard strict, no declaration can found element 'resources'. source code of servlet-context.xml <?xml version="1.0" encoding="utf-8"?> <beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemalocation=" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- dispatcherservlet context: defines servlet's request-processing infrastructure --> <!-- enables spring mvc @controller programming model --> <annotation-driven conversion-service...

c# - adding text to legend from code behind -

how can add text legend code behind assuming you're talking html legend tag , using c# in asp.net site. can give id , runat="server" can access code behind name , change text property. <form id="form1" runat="server"> <fieldset> <legend id="mylegend" runat="server">personalia:</legend> name: <input type="text" size="30" /><br /> email: <input type="text" size="30" /><br /> date of birth: <input type="text" size="10" /> </fieldset> </form> then in code behind: mylegend.innertext = "foo";

c# - WCF Service Error accessing DB -

i have wcf service running under iis 7.0. app pool identity set user account lets call "mydomain\myacc." have given "mydomain\myacc" login permissions sql 2005 server, , 2 dbs uses on server. when try invoke 1 of wcf methods following in logs: "login failed user 'mydomain\myacc'..." have tried removing , re-adding user on sql server. i tried accessing dbs management studio running "mydomain\myacc" , worked. what missing? finally figured out, using linq sql , last guy checked code in commented out code used pass in connection string web.config file. using connection string dbml file instead. connection string pointing db user account did not have access to.

Xcode SVN can't add JSON directory to repository -

i have added json-framework (stig b - google code) classes folder (just json directory per option 1 instructions). i had subversion set working fine, until added directory. if modify existing files in repository, marked m , can commit those, cannot commit json directory or of files within it. i added separate jsoncontroller class in classes, , cannot commit either. is there need subversion recursively add directories? have tried commit entire project, commit happens, without json directory or new controller. the add repository option not present either directory, or controller. thanks. did right-click on folder , choose 'add repository'? have .svnignore file in project directory may excluding json folder?

silverlight - How to prevent 'Specified' properties being generated in WCF clients? -

i have 2 .net 3.5 wcf services build vs2008. i have 2 wcf clients in silverlight consume these services. clients generated 'add service reference'. using silverlight 4. one of proxies generated specified properties each property. 'message-in' class service method : // properties generated each of these fields private long customerprofileidfield; private bool customerprofileidfieldspecified; private bool testenvfield; private bool testenvfieldspecified; now other service (still silverlight client) not generate specified properties. now don't care 'tenets of soa'. want rid of these damn properties because in context of i'm doing absolutely hate them. there has difference between 2 services - don't want have rip them apart find out difference. a similar question before had answer ' you cant it ' - not true because have - don't know did differently. edit: in situation regener...

controls - How can I prevent Firefox from opening the gridview header sort postback link in a new tab on Ctrl Click -

i trying make gridview control in asp.net multi sort based on if user pressed ctrl key when trying sort clicking on column name. problem when using firefox, if click on column name ctrl key pressed, browser tries open "javascript:__dopostback('ctl00$contentpla..." link in new tab. ie , chrome both don't unless link real link. is there way can prevent firefox opening link in new tab , still cause page postback normally? thanks. you need capture event of ctrl key being pushed down, using document.onkeydown. in event handler, check if 'ctrl' (key code 17) pressed, follows: function document_keydown(e) { var keyid = (window.event) ? event.keycode : e.keycode; if (keyid == 17) { ctrldown = true; } } here, i'm setting 'ctrldown' variable true. for onkeyup event, can exact opposite: function document_keyup(e) { var keyid = (window.event) ? event.keycode : e.keycode; if (keyid == 17) { ...

Usage-Metrics for ASP.NET Web Services -

is there way collect usage metrics of asp.net web service google analytics collect usage metrics of web site. without implementing own database tables or code. i don't need collect huge amount of information collected google analytics, simple information, number of calls , distribution on time. if no external tool can used, how process request web service extract information request location, request source, , other information collected. if you're hosting service in iis web server (which persume do), can check iis web server application log, requests written file. open *.log file , copy contents excel, , use excel pivot/group/filter/sort data present count (the number of requests) web service in meanigful manner.

c# - Order IList with field name in argument -

i have simple piece of code public actionresult listtogrid(string field, string direction) { _model.mylist = _repo.list(); } to sort, can : _model.mylist = _employeeservice.list().orderby(x => x.firstname).tolist<employee>(); but i'd use "as field" name receive (field) in argument , direction received too. thanks, you use reflection, rather slow. efficient declare delegate use in sort, , assign function depending on string: func<employee,string> order; switch (field) { case "firstname": order = x => x.fristname; case "lastname": order = x => x.lastname; } for direction think it's best use separate codes: var list = _employeeservice.list(); ienumerable<employee> sorted; if (direction == "ascending") { sorted = list.orderby(order); } else { sorted = list.orderbydescending(order); } _model.list = sorted.tolist<employee>();

php - zend framework: wait for query to finish before starting another -

in web app i've created in zend framework, i'm creating new database every new client registers. query of course rather heavy , time consuming since need create database, create 10 tables , put data in tables. we using 1 large sql file read in , exec(). after queries, mysql connection in zf, need insert new record in 1 of tables have been created in previous step. this fails: when first query isn't finished yet , try insert data in on of tables being created, error "table xxxx doesn't exist". all happens in fraction of second, cannot find way "wait" first large query have finished. putting sleep(2) command before second statement solved problem, that's not way want play. also, cannot use transaction since using create database , other statements cannot used transactions. one database per client can of worms want eliminate before gets out of hand. use single database client_id field in each table indicate client record bel...

silverlight - How to keep relative position in a listbox when new items are added -

i have databound listbox, , when add new items top of list, scrollviewer maintains position, items looking @ pushed further down out of view. has found way maintain relative viewpoint items added? you vertical offset of scrollviewer's scrollbar, add items, restore offset?

Ruby on Rails 3: link_to create new nested resource? -

i trying make link create new nested resource in rails 3 application, can't figure out. syntax link new nested resource solution: make sure have resources nested in routes file. resources :books resources :chapters end then in view script can call this: <%= link_to 'new chapter', new_book_chapter_path(@book) %> the rails guide on routing quite helpful. note: if message couldn't find book without id , problem isn't link, it's code in controller. def new @book = book.find(params[:book_id]) #instead of :id @chapter = @book.chapter.new respond_with(@chapter) end make changes in routes as map.resources :books |book| book.resources :chapters end and use this link_to new_book_chapter_path(@book) you can use link understand concept better nested routes

java - Use of servletcontext? -

i created 1 web application want store past logged user name list comparing new users going login. how using servletcontext ? or there other way? in jsf, application scoped managed beans stored in servletcontext. so, create , declare application scoped managed bean , put list in there. however, there better ways particular functional requirement yet unclear in question. @ least, implementing httpsessionlistener or httpsessionbindinglistener better idea since logins coupled httpsession . here several examples: how invalidate session when user logs in twice? how check who's online?

java - how to stop a thread in a threadpool -

i'm writing application spawns multiple concurrent tasks. i'm using thread pool implement that. it may happen event occurs renders computations being done in tasks invalid. in case, stop running tasks, , start new ones. my problem: how stop running tasks? solution implemented store reference task thread , call interrupt() on thread. in demo code: public class task implements runnable { private string name; private thread runthread; public task(string name) { super(); this.name = name; } @override public void run() { runthread = thread.currentthread(); system.out.println("starting thread " + name); while (true) { try { thread.sleep(4000); system.out.println("hello thread " + name); } catch (interruptedexception e) { // we've been interrupted: no more messages. return; } }...

javascript - Jquery selector help -

i have following: <form id="my_form"> <input type="checkbox" name="a" value="a"> check <img src="..." /> </form> to handle check , uncheck events (and works): $('#my_form :checkbox).click(function() { if($(this).is(':checked')) { //... } //... }); my question is: inside of click function, how can select <img> tag right beside checkbox? can without specifying id image? ..by "select" mean need able hide() , show() it. thanks you can use .next() since it's next ( immediate next, important) sibling element, this: $('#my_form :checkbox').click(function() { if(this.checked) { var img = $(this).next('img'); } }); i think you're after easiest done .toggle(bool) , this: $('#my_form :checkbox').change(function() { $(this).next('img').toggle(this.checked); }); this show <img> when che...

java - How to override a method which is used in the parent constructor? -

i'm having design problem don't know how overcome in java. want override method called parent constructor. here simple example of problem: public class parent { public parent(){ a(); } public void a() { // code return; } } public class child extends parent { public child() { super(); } public void a() { super.a(); // more code return; } } i know child class wont initialized until parent constructed therefore childs a() method wont called. correct design overcome problem? the child override called - child constructor won't have executed yet, unless it's designed invoked on partially initialized object, have problem. best approach not call virtual methods in contructors . is problem. in control of both classes? can redesign avoid problem in first place?

html5 - HTML 5 Video stretch -

can make video "stretch" width & height of video element? apparentlyby default, video gets scaled & fitted inside video element, proportionally. thanks from the spec <video> : video content should rendered inside element's playback area such video content shown centered in playback area @ largest possible size fits within it, video content's aspect ratio being preserved. thus, if aspect ratio of playback area not match aspect ratio of video, video shown letterboxed or pillarboxed. areas of element's playback area not contain video represent nothing. there no provisions stretching video instead of letterboxing it. because stretching gives bad user experience, , of time not intended. images stretched fit default, , because of that, see lots of images badly distorted online, due simple mistake in specifying height , width. you can achieve stretched effect using css 3 transforms , though aren't standardized or implemented in ...

c - What type-conversions are happening? -

#include "stdio.h" int main() { int x = -13701; unsigned int y = 3; signed short z = x / y; printf("z = %d\n", z); return 0; } i expect answer -4567. getting "z = 17278". why promotion of these numbers result in 17278? i executed in code pad . the hidden type conversions are: signed short z = (signed short) (((unsigned int) x) / y); when mix signed , unsigned types unsigned ones win. x converted unsigned int , divided 3, , result down-converted (signed) short . 32-bit integers: (unsigned) -13701 == (unsigned) 0xffffca7b // bit pattern (unsigned) 0xffffca7b == (unsigned) 4294953595 // re-interpret unsigned (unsigned) 4294953595 / 3 == (unsigned) 1431651198 // divide 3 (unsigned) 1431651198 == (unsigned) 0x5555437e // bit pattern of result (short) 0x5555437e == (short) 0x437e // strip high 16 bits (short) 0x437e == (short) 17278 // re-interpret short by way, si...

c# - zlib.h versus zlib.net -

i have made compression in c/c++ (no under clr) using library zlib.h, , works great. functions use deflate() , inflate(). file compressed c application, want decompress zlib.net application, using c#, not manage working. when trying decompress it, error of magic number, number used specific application in header. know how through problem, or if can give me example of inflate()/deflate() functionality in .net more info on how have done compression, similar 1 in link http://www.zlib.net/zlib_how.html also, can 1 advice me of lib perform compression in both c++ , .net, many in advance... there's discussion on here: zlib-compatible compression streams? i think boost may work zlib add header information: http://www.boost.org/doc/libs/1_36_0/libs/iostreams/doc/classes/gzip.html

CDN: "Origin pull" service providers? -

does know of inexpensive "origin pull" cdn service providers. the provider i've found provides simplecdn , akamai . akamai crazy expensive , simplecdn seems change business model daily, i'm concerned using them. we use pantherexpress in "pull mode" (not sure else, really) , it's great. competitively priced. they're owned cdnetworks; haven't talked sales people @ don't know how changed. limelight better priced expected when getting quotes; had stupid "oh, little more feature , feature" pricing pe gave me simple price including features. when evaluating edgecast missing of features needed, think they've caught now. we use 10-20mbit/sec on cdn give ballpark.

Java OSI Transport Layer -

i'm working on project need communicate device using transport layer. network connection osi/clns on ip. i wrong, don't believe can use sockets type of connection. i'm looking examples on how create application can communicate on transport layer (either in java or c++). thanks, rob osi-stack open source implementation here can find open source (for linux) implementation of complete osi stack. there application example there...

graph - Facebook fan page tab views -

i looking way capture facebook fan page tab views metrics, can specify date range you have create application tab , have facebook insights app give lot of statistics page views , users. do have application tab ? can view insights @ : http://www.facebook.com/insights/?sk=ao_your-application-id where replace your-application-id real value. please comment on can understand situation little bit more ?

code formatting - eclipse: changing the # of spaces to indent/unindent -

how adjust # of spaces added/removed eclipse when hit tab or shift+tab, given filetype? working on restructuredtext files (.rst) , want 2 spaces instead of 4. from window menu, choose preferences. navigate down general: editors: text editors: displayed tab width. you may want check out code style other types of editors, because decide whether use tabs or spaces, , size of tab stops. hint: in top left of preferences dialog, can type "tab" says "type filter text", , show settings related tabs.

c# - WebDav: How to set Exchange 2003 appointment category? -

i using independentsoft's webdav api create calendar appointment. set category of appointment. in outlook, set category indicated here: outlook image http://www.freeimagehosting.net/uploads/b51648a90c.gif how assign category using webdav api? most other fields properties of appointment object: appointment appt = new appointment(); appt.body = "body"; appt.meetingstatus = meetingstatus.tentative; and on. have not been able find property corresponds category. i have discovered answer this. the property keywords. it's string array. so, set category, this: appt.keywords = new string[] { "categoryname" }; i assume can add multiple categories in same way: appt.keywords = new string[] { "categoryname1", "categoryname2" };

.net - Validate Uri using a ConfigurationValidator or other validator -

in custom configuration section of config file want have properties or elements define new scheme, host , port service endpoint, not define path. these should allowed https://newhost/ or http://newhost:800 , not newhost:800 , http://newhost/path/to/service . what best option implement? it feels there should overload of uri.parse, uriparser make easy. there urivalidator have missed? or regex going best option (so can disallow path)? note isn't specific configurationvalidator general validator can reused useful. there getleftpart method of uri class here. getleftpart method the getleftpart method takes enumeration uripartial system enumeration, 1 of ( uripartial.authority ) return: the scheme , authority segments of uri. this removes extraneous path information may in original string, , return zero-length string if uri supplied not contain valid scheme (i.e. http or https etc. parts of uri) and/or authority (i.e. in example, newhost part of uri)...

html - Equivalent of HTMLLoader class for an AS3 only project? -

i'm building as3 web application , want able include external html content within flash 'window'. in air there flash.html.htmlloader class makes possible. can point example of being done in flash opposed air application? for loading html content, recommend bulkloader . to display html, use textfield htmltext. please, aware tags supported.

installation - Faceted Project Eclipse environment -

even if have checked post , try solution on it, problem still there. java compiler level not match version of installed java project facet. project-name unknown faceted project problem (java version mismatch) eclipse gives solution. click right mouse on problem, in problems view, choose "quick fix", , run version running before.

jquery - Integrating Galleria with SmoothDivScroll plugin -

i have been working on integration of smoothscrolldiv galleria.. - scroll thumbnails. demo of code here: http://test.kinkylemon.nl/sym/galleria/demo3.htm i have problem when browser window resized, smoothscrolldiv no longer correctly bound dom ...or ! - stops working. also similar bug in ie6 @ page load (with empty cache). so question a. need use bind() or live() somehow? $(function($) { $('ul#gallery').galleria({ history : false, // activates history object bookmarking, back-button etc. clicknext : true, // helper making image clickable insert : '#galleriacontentbox', // containing selector our main image onimage : function(image,caption,thumb) { // let's add image effects demonstration purposes // fade in image & caption if(! ($.browser.mozilla && navigator.appversion.indexof("win")!=-1) ) { // ff/win fades large images terribly slow ...

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -

i'm trying build tablelayoutpanel on winform , want behave plain old html table. one requirement table needs built programmatically. have far: foreach (var rowlinq in resultlinq) { richtextbox rt = new richtextbox(); rt.borderstyle = borderstyle.none; rt.text = rowlinq.result.resultname; rt.dock = dockstyle.fill; tablelayoutpanel.rowcount++; tablelayoutpanel.rowstyles.add(new rowstyle(system.windows.forms.sizetype.autosize)); tablelayoutpanel.controls.add(rt1, 0, tablelayoutpanel5.rowcount - 1); } so builds row each row in linq result. works pretty except 1 thing: height doesn't adjust @ , fixed. need height grow , shrink depending on height of text inside each cell. i need 1 big time, stack-o set autosize property true.

gcc - iPhone -mthumb-interlinking -

os figured out how use -mthumb , -mno-thumb compiler flag , more or less understand it's doing. but -mthumb-interlinking flag doing? when needed, , set whole project if set 'compile thumb' in project settings? thanks info! open terminal , type man gcc do mean -mthumb-interwork ? -mthumb-interwork generate code supports calling between arm , thumb instruction sets. without option 2 instruction sets cannot reliably used inside 1 program. default -mno-thumb-interwork, since larger code generated when -mthumb-interwork specified. if related build configuration, should able set separately each configuration "such release or debug". why want change these settings? know using thumb instructions save memory save enough matter in case?

raw input - Printing results in reverse order from raw_input in python -

when using raw_input in loop, until character typed (say 'a' ), how can print inputs before that, in reverse order, without storing inputs in data structure? using string simple: def foo(): x = raw_input("enter character: ") string = "" while not (str(x) == "a"): string = str(x) + "\n" + string x = raw_input("enter character: ") print string.strip() but how same without string? this not practical approach, since asked it: def getchar(): char = raw_input("enter character: ") if char != 'a': getchar() print char getchar() of course means i'm using "hidden" data structures, local namespace , call stack.

c# - Why one-to-many does not work as expected in NHibernate? -

i have simple situation , don't have clue why isn't working. this schema: **[item]** id (pk) symbol **[item_version]** id (pk) item_id (fk->item) symbol these mappings: item.hbm.xml <class name="core.model.entities.item, core.model" table="item" lazy="false"> <id name="id" column="id" type="long"> <generator class="native" /> </id> <property name="symbol" column="symbol"/> <bag name="itemversions" lazy="false" table="item_version" inverse="true" cascade="save-update"> <key column="item_id" /> <one-to-many class="core.model.entities.itemversion, core.model"/> </bag> </class> *item_version.hbm.xml* <class name="core.model.entities.itemversion, core.model" table="item_version"...

c# - Computational Geometry open source lib -

does know open source c# dll computational geometry. there isn't out there, unfortunately -- .net world seems suffer paucity of open-source math libraries. best readily available commercial alternative ceometric's g# , neither free nor open-source.

iphone - how to retrieve magnetic value from CLHeading -

i'm trying clheading compass value, - (void)locationmanager:(cllocationmanager *)manager didupdateheading:(clheading *)newheading { if (curheading != nil) [curheading release]; curheading = newheading; nslog(@"%@",curheading); [curheading retain]; } the above give result - magneticheading 89.00 trueheading +103.27 accuracy 5.00 x +1.375 y +41.875 z +37.438 @ 2010-01-18 10:18:37 +0800 but need magneticheading value, i alter code : a) newheading.magneticheading -> got result null b) newheading.trueheading -> program received signal: “exc_bad_access”. can help, trying other possible way compass value. magneticheading , trueheading both of type cllocationdirection, double. if want nslog() double, have use "%f", or "%.9f", not "%@", objects.

jquery - Javascript: clearTimeout seems to only suspend, not reset or clear? -

i new js , trying modify javascriptkit jquery-based megamenu system delay showing menu until mouse has been hovering on anchor object specified time. the problem facing right seems cleartimeout called on mouseout suspends settimeout, rather canceling, clearing, resetting it. at point showing alert after settimeout call. have timeout interval set 2000 testing. as example, since have set 2 seconds delay right now, if mouse on object 4 times 1/2 second, 5th time mouse on object test alert box appears instantly. i thought cleartimeout supposed destroy timed event. why appear pause countdown? teststuff:function(){ if(jkmegamenu.toggletest==1) { jkmegamenu.executetimedcommand() jkmegamenu.toggletest=0 } else { //jkmegamenu.executetimedcommandcancel() cleartimeout(jkmegamenu.teststuff); } }, executetimedcommand:function(){ if(jkmegamenu.toggletest==1) { alert('abcde') ...

c# - Breakpoint that breaks when data changes in a managed language -

i have class list property seems lose element under circumstances. cannot find out when happens. so i'd set visual studio breakpoint pause program moment value changes. conditional breakpoint not work in scenario, since have no idea removing breakpoint. to put way, want program stop moment mylist.count evaluates new number. any ideas on how this? this not possible in c# or of other .net languages due clr limitations. visual studio native code debugger supports data breakpoints ( link ) c++ code not supported managed code. try break on or intercept add , remove method calls on collection suggested in other answer question.

COM Exception (code 0x800A03EC) thrown when programmatically changing page breaks in VB.Net -

i attempting use vb.net excel com interop programmatically change location of first horizontal page break on excel spreadsheet being generated program. code follows: dim range excel.range xlactualws.activate() xlactualws.pagesetup.printarea = "$a$1:$k$68" range = xlactualws.range("a68", "a68") xlactualws.hpagebreaks(1).location = range system.runtime.interopservices.marshal.releasecomobject(range) on line setting hpagebreaks, com exception code 0x800a03ec thrown, , can't find thing related searching. have idea i'm missing here? based onthe code looks either location of page break cannot set or there 0 page breaks , hence you're accessing invalid index. quick way test out following check count property on xlactualws.hpagebreaks , see how many available remove set of location property , see if error dissapears additionally should remove releasecomobject call. that's difficult api correct , c...

is the file pointed by stdin file descriptor the same file for different processes? -

i have question in mind. convention, unix associates file descriptor 0, 1, 2 stdin, stdout, stderr on every process. file, e.g. pointed stdin, shared different processes? if shared, when open 2 shells type inputs these 2 shells, how os doing manage shared file? overview the descriptor table per-process, it's possible every process in system have different file open in every descriptor table slot but in practice it's bit more complex. if 2 processes open file independently, each have separate access file, own read , write pointers, , interact if both write same file. but when process fork(2)'s, parent , child's descriptors point same file table entry, , share single position in file. enables unix processes share access input stream without needing aware of situation. three tables access files chained through 3 important tables in unix. descriptor table per-process , points file table . think of file table open file table . there third table, calle...

javascript - how to pass to fetch new records only with ajax/json -

i have db containing small news , web app displaying these. update page every 60s jquery.ajax or jquery.getjson request . my question how should pass last id received server next ajax request got newer news? store (on dom, global var, or hidden field, ...)? yes, need pass argument identifies point search new records. typically handled having server return sequential id or timestamp each ajax response, such subsequent request append argument. you can store value in various ways, since these typically single-page applications not reloaded, simple javascript variable sufficient. use closures in following example, instead of using global variable: function fetchdata(last_update_id) { $.ajax({ url: 'fetch_data.php?last_update=' + last_update_id, method: 'get', datatype: 'json', success: function(data) { // last_update_id server response. last_update_id = data.last_update_id; // proce...

asp.net - How can a .NET code know whether it is running within a web server application? -

i have library code, should aware whether executed in context of web server or standalone application server. the obvious comes mind check name of application configuration file , if web.config - web server, otherwise - standalone application server. another way "temporary asp.net files" in path of shadow folder. but dislike both of these, since seem hacky , fragile. there robust way want? thanks. p.s. one may define dedicated app config setting - iswebserver, dislike more. edit: while looking solution problem, think solved 1 - details here trying solve problem, found solution one. there private method system.configuration.settingspropertyvalue.ishostedinaspnet , need. being private method, not want call (though using reflection), implementation trivial: private bool ishostedinaspnet() { return (appdomain.currentdomain.getdata(".appdomain") != null); } (according reflector) looks there special key in app domain data - ".ap...

c# - How to programmatically retrieve all of a web service's web methods' signatures? -

i'm trying build c# application displays , invokes of specific web service's methods (the web service written .asmx file). can go directly asmx file , methods names returned html, i'm sure there more elegant way (this way doesn't reveals web methods' signatures well, names..). so how can programmatically ask service it's methods? thanks. get wsdl of web-service discover available methods on web-service. http://server/your-webservice.asmx?wsdl

.net - Serialize all properties of class to XML -

i have load of classes , need generate xml schema these classes. the easiest way can think create classes, serialize xml , run xsd on xml. however, if don't set properties of class, no xml node created , therefore xsd doesn't pick up. is there way me tell xml serializer serialize properties of class, rather ones have values set? hopeful, more expecting! duncan xsd.exe can generate schemas assembly. specify /type switch.

Drupal: How to build a categorized menu tree -

i need build custom menu structure based on taxonomy terms. problem first level should taxonomy-term. nested items must node. each node can have one term. , terms without nodes associated should not appear in menu. how that? suggestions me? example menu: term-1 node-1 node-2 node-3 term-2 node-1 node-2 ... thank you. edit need photgrapher website. each term global categorie portraits , or artists . categories wrapper galleries. based on example menu above possible structure this: series (term) bodies (node:type->gallery associated term:series) classic cars (node:type->gallery associated term:series) surroundings (node:type->gallery associated term:series) i suggest doing view. want create view lists nodes, , set view group taxonomy term. so, create new view (admin/build/views/add) view type: node - name view, , proceed next page. filters node: published - yes node: type - gallery [optional] taxonomy: vocab...

asp.net - jQuery $.get refreshing page instead of providing data -

i have written code using jquery use ajax data webform, , works fine. i'm copying code project, won't work properly. when class member clicked, give me productid have concatenated onto input id, never alerts data $.get. test page (/products/ajax/default.aspx) have set returns text "testing...". installed web development helper in ie, , shows request getting test page , status 200 correct return text. however, jquery refreshes calling page before ever show me data i'm asking for. below code snippets page. please let me know if there other code blocks need see. thank you! <script type="text/javascript"> $(document).ready(function() { $(".addtocart_a").click(function() { var sprodidfileid = $(this).attr("id"); var aprodidfileid = sprodidfileid.split("_"); var sprodid = aprodidfileid[5]; // *** alert shows fine -- prodid: 7 ...

ruby on rails - How can I check if a value is a number? -

i want check if returned value form text field number i.e.: 12 , 12.5 or 12.75. there simple way check this, if value pulled param ? just regexp it, it's trivial, , not worth thinking beyond that: v =~ /\a[-+]?[0-9]*\.?[0-9]+\z/ (fixed per justin's comment)

jquery - Manipulating elements after AJAX load() -

i trying manipulate elements after load them using .load(). have loading correctly, can't seem target elements within of loaded elements. seems easy, can put finger on it. i using callback after elements load, dom seems not aware of existence? function load_page(){ $('#page_name').load("/page-name/ .page", null, load_complete()); } function load_complete() { $('#page_name .book_img').addclass('hello'); } ok, @ now. have added... $('#wrapper').ajaxcomplete(function() { $('#page_name .book_img').addclass('hello'); } which works. there must difference between .autocomplete , callback packaged .load() function. don't because called every time ajax event finished loading, me little further down road. anybody have better? [edit] i tried... $('#wrapper').ajaxcomplete(function() { $('#page_name .book_img').addclass('hello'); } which kind of nice since waits till aj...

c# - Accessing a property inside a property -

i curently have set below public class proptsclass { public class classa { public list<classb> pcb { get; set; } } public class classb { public list<classc> pcc { get; set; } } public class classc { public string _someproperty { get; set; } } } what want databind object classa listview 1 of columns being databound classc._someproperty . when try databind <%#eval("namespace.proptsclass.classa.pcb.pcc._someproperty") %> error: "databinding: namespace proptsclass.classa + classb' not contain property name '_someproperty'". can tell me doing wrong , correct way of doing it. secondly there better way can achieve same in code behind instead of asp.net. in advance databind on listviews , gridviews "shallow" search property/field names bind columns. also, not "flatten" list of lists have in structure. if want bind multilevel object model, n...

java - Unable to initialize log4j -

i'm trying initialize log4j-1.2.8 application creating listener class implemented applicationlifecyclelistener of weblogic 9.2. when deploy application, i'm getting following exceptions: java.lang.noclassdeffounderror: org/apache/log4j/spi/repositoryselector @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:620) @ java.security.secureclassloader.defineclass(secureclassloader.java:124) @ weblogic.utils.classloaders.genericclassloader.defineclass(genericclassloader.java:338) @ weblogic.utils.classloaders.genericclassloader.findlocalclass(genericclassloader.java:291) @ weblogic.utils.classloaders.genericclassloader.findclass(genericclassloader.java:259) @ java.lang.classloader.loadclass(classloader.java:306) @ java.lang.classloader.loadclass(classloader.java:251) @ weblogic.utils.classloaders.genericclassloader.loadclass(genericclassloader.java:158) @ java.lang.classloader.loadclassinternal(classloader.java:319) @ myapp....

c++ - Volume to physical drive -

querydosdevice(l"e:", devicename, max_path); (e: sd card) devicename "\device\harddiskvolume3" how "convert" "\\.\physicaldrive1" volumes made of 1 or more partitions, reside on disks. so, e: doesn't map single disk in system (think software raid). the way map volumes physicaldrive names in win32 first open volume , send ioctl_volume_get_volume_disk_extents. give structure has 1 disk_extent entry every partition volume spans: typedef struct _volume_disk_extents { dword numberofdiskextents; disk_extent extents[anysize_array]; } volume_disk_extents, *pvolume_disk_extents; the extents have disk number in them: typedef struct _disk_extent { dword disknumber; large_integer startingoffset; large_integer extentlength; } disk_extent, *pdisk_extent; the disknumber goes phsyicaldrivex link, can sprintf number "\\.\physicaldrive%d" -scott

android - Button not working after TranslateAnimation ends -

im tring simulate slideup animation.the idea slideup , slidedown tablelayout id searchform when pressing button can use space list. managed slideup searchform , button , list seems visible after cant click button, here's code responsible slideup animatio: translateanimation slide = new translateanimation(0, 0, 0, -findviewbyid(r.id.searchform).getheight()); slide.setduration(500); slide.setfillafter(true); findviewbyid(r.id.searchform).startanimation(slide); findviewbyid(r.id.listbut).startanimation(slide); adaptersearch.add(new notificationentry("","444/2010","teste","etapa de teste2","2010")); here's xml has view elements: <tablelayout android:id="@+id/search" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:stretchcolumns="1"> <tablelayout android:id="@+id/searchfor...

ajax - jQuery. Different performance on local and through the internet -

i use jquery 1.4 ajax, mvc on server side. works fast on local computer. tables data compiled , sent html documents (i’m testing system large tables, on 100kb). when download same page through internet, works 5-10 times slower or pending. i checked forefox debugger. ajax sent query , received data (i can see received response correct data). inserts data in dom slowly, following instruction works particularly slowly: $("#oldtable").replacewith( newtable ); , empty() works extremely in ie6,8 (3 sec on local machine , 1 min through internet). delete data dom 1 object , insert whole table. there no errors in inserted html code. please recommend how make work faster? should use library, such prototype. can’t understand following: javascript executed on client’s side, data uploaded. computer same. why execution time differ much? thank you, igor many issues here: 1) fast inserting , emptying data, jquery slower straight javascript functions .innerhtml. thoug...

jQuery submit is not catching submit event after ajax loading of content -

i load content popup jquery ajax load function , use submit function in load functions callback function, reason event not fired @ all. (i use jquery jquery-1.3.2.min.js) $('.popup-container').load(url, function(){ /** stuff here */ $("form").submit(function() { alert("form submitted!"); return false; }); }); update as of jquery 1.7, .live() method is deprecated . removed in jquery 1.9. use .on() attach event handlers. users of older versions of jquery should use .delegate() in preference .live() . original answer you can fix using jquery method live() . using live() submit() has been added jquery 1.4 should update. here video tutorial on using live() submit() . when using live function code should this: $("form").live('submit' , function() { alert("form submitted!"); return false; }); $('.popup-container').load(url);

Floating point inaccuracy examples -

how explain floating point inaccuracy fresh programmers , laymen still think computers infinitely wise , accurate? have favourite example or anecdote seems idea across better precise, dry, explanation? how taught in computer science classes? there 2 major pitfalls people stumble in floating-point numbers. the problem of scale. each fp number has exponent determines overall “scale” of number can represent either small values or larges ones, though number of digits can devote limited. adding 2 numbers of different scale result in smaller 1 being “eaten” since there no way fit larger scale. ps> $a = 1; $b = 0.0000000000000000000000001 ps> write-host a=$a b=$b a=1 b=1e-25 ps> $a + $b 1 as analogy case picture large swimming pool , teaspoon of water. both of different sizes, individually can grasp how are. pouring teaspoon swimming pool, however, leave still swimming pool full of water. (if people learning have trouble exponential notation, 1 can use values ...

codeigniter - Url Rewrite with Special Characters - Seo Advice Needed -

i'm using code igniter build simple website, 1 thing code igniter its pretty easy rewrite rules. anyway, ain't problem. but lets consider situation, in website webpage itens, if name spelled correctly name special characters ( á à é è .... used in non english languages) , spaces. lets take @ url (localhost test) http://localhost:88/ensino/frota de veículos this url rewrite rule relays user class ensino , function frota_de_veiculos same if go to: http://localhost:88/ensino/frota_de_veiculos however if enable source view firefox, source view title display url way: http://localhost:88/ensino/frota%20de%20ve%c3%adculos now question simple url search engines consider in crawl through website? i ask because once saw website url rewrite using special characters , spaces, , in google search display weird urls one: http://localhost:88/ensino/frota%20de%20ve%c3%adculos note: keep in mind navigation bar pinpoints http://localhost:88/ensino/frota de veículos . ...

regex - Removing whitespace-characters, except inside quotation marks in PHP? -

i need remove whitespace string, quotations should stay were. here's example: string parse: hola hola "pepsi cola" yay output: holahola"pepsi cola"yay any idea? i'm sure can done regex, solution okay. we match strings or quotations with [^\s"]+|"[^"]*" so need preg_match_all , concatenate result. example : $str = 'hola hola "pepsi cola" yay'; preg_match_all('/[^\s"]+|"[^"]*"/', $str, $matches); echo implode('', $matches[0]); // holahola"pepsi cola"yay

Starting Dev with PHP on Windows -

i have written web apps jsp in past. now, i'm getting started php. have question , friend of mine .net developer pointed me site. i downloaded , installed php here . now, i'm trying windows azure php sdks setup. reason app needs hosted in azure. after downloaded sdk, looked in install.txt file. file states need add library directory php include_path. problem is, not see environment variable named "include_path" in settings. should 1 have been created? php include_path environment variable? can me out please? thank you! include_path configuration setting set in php.ini file. run php script containing <?php phpinfo(); ?> to find out php.ini being used - can confusing sometimes. the ini file contain setting, can change. you need restart web server after changes. i don't know how php , azure work together. if ini method doesn't apply here, here php manual section on ways change php config settings other php.ini.

css/javascript visibility visible/hidden is very slow on Blackberry -

document.getelementbyid("spinner2").style.visibility="visible" visibility visible/hidden slow on blackberry (os4.6). screen seems redrawing makes unusable in ajax application. the goal put visible feedback user while ajax request completes. can suggest alternatives? if change layout you'll redraw. if single redraw slow you're layout heavy mobile application guess.

javascript - Best way to filter a list-view in asp.net MVC -

i have list of data coming database , displaying in table, works how want. what do, add dropdownlist page "filters" data in table, based on value of selected item in dropdonwlist. for example, dropdown has these values assigned me assigned others and list of data, has "assignedto" field. when value in dropdown changes, update list of data. in webforms, use updatepanel , dropdownlist autopostback=true, how can same effect in mvc? you use javascript/jquery bind onchange/onclick event, , there postback: $(function() { $("#myelement").click(function(){ $("#secondelement").load('<%= url.action("source") %>?selected=' + $(this).val()); }); } there're jquery plugins similar things, example http://dev.chayachronicles.com/jquery/cascade/index.html (not best one, first found).

c# - Why the shortcut created by my MSI install start the setup process again each time? -

i created msi installer our c# application via vs 2008. installed it. created shortcut me on desktop. clicked shortcut, setup process running again , @ end our application launched. not yesterday before added custom action create database. didn't recreate shortcut in installer. why this? msi comes auto-repair feature checks whether components installed msi still present when launch application using shortcut. in case, 1 (or more) components have been removed installer launched again repair installation. to prevent auto-repair running either make sure no file, registry setting or other installed component removed or don't set key path components. prevent msi checking specific components from other questions seems msi has been created visual studio setup , deployment project. unfortunately, there no option modify key path within visual studio. have following options: modify msi manually using orca (this not option because manual step) write script...

How to see all elements of current symbol in Flash CS5 -

i'm dealing multiple hard find/small/transparent elements within nested movieclips in flash cs5. there no outline window can element through tree format vs having around on stage? closest thing i've found movie explorer window, doesn't go deeper scene level? symbols own timelines? you select , use 'distribute layers' clicking on each layer select element. it makes little easier select things.