Posts

Showing posts from February, 2011

cocoa touch - Best method to create complex custom interface for IOS -

i'd understand best solution draw custom interface ios application. know it's not easy answer question directly code, think great generic answers... understand in direction have go! i use example ipad rss reader : http://www.youtube.com/watch?v=hkfzgf5kmyw 1) how create example "slide page" effect shown in video @ 00:38 2) @ 01:00 user move single element of view (maybe table cell ?) how implement effect ? 3) @ 01:53 user pinch preview item , single element explodes in multiple items. in opinion, effect created core graphics ? how implement ? thank answers! hope question useful other people too. imho done using gesturerecognizer , coreanimation, these wwdc session videos helpful session 120 - simplifying touch event handling gesture recognizers session 121 - advanced gesture recognition session 424 - core animation in practice, part 1 session 425 - core animation in practice, part 2

How can I call a PHP function stored as a string from within another PHP function? -

i find myself in situation need call php function stored string php function. <?php $phpcodestring = "<?php echo 'hello world!' ?>"; echo $phpcodestring; ?> how can hello world render screen above structure? back few steps - why need that? 99.9% of time there better way eval() . or use create_function() internally uses eval() isn't better, when not defining function body directly string literal can sure there , there nothing potentially dangerous.

mysql - Rails One-One Relationship- Foreign Key Location -

i have 2 models, address , country. address contains basic address info (line1,line2,city,etc.) , has 1 one relationship country. the countries table read-only, don't want change. i have forms creating country_id column in "addresses" table, it's looking address_id in country table. how tell rails use country_id in addresses table lookup country? here models like: class address < activerecord::base belongs_to :consultant has_one :country accepts_nested_attributes_for :country end class country < activerecord::base belongs_to :address end thanks! from belongs_to documentation: this method should used if class contains foreign key. so code should be: class address < activerecord::base has_to :consultant belongs_to :country accepts_nested_attributes_for :country end class country < activerecord::base has_one :address end

python - Unable to install and build PyAudio -

i've build , installed portaudio using tarball: 'pa_stable_v19_20071207.tar.gz' after step, when i'm trying install pyaudio via tarball url: http://people.csail.mit.edu/hubert/pyaudio/packages/pyaudio-0.2.4.tar.gz i'm getting following error. might going wrong in case? enter code here root@carmack:~/desktop/pyaudio-0.2.4# python setup.py install running install running build running build_py running build_ext building '_portaudio' extension gcc -pthread -fno-strict-aliasing -dndebug -g -fwrapv -o2 -wall -wstrict-prototypes -fpic -i/usr/include/python2.6 -c src/_portaudiomodule.c -o build/temp.linux-i686-2.6 /src/_portaudiomodule.o -fno-strict-aliasing src/_portaudiomodule.c:30:20: error: python.h: no such file or directory in file included src/_portaudiomodule.c:32: src/_portaudiomodule.h:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token src/_portaudiomodule.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’

windows - findstr - how to find user and display entire line? -

i have file contains multiple lines of data, e.g: dfscmd /map "\server\path\area\testuser" "\new_server\path\testuser" "dfslink home drive: test, user" dfscmd /map "\server\path\area\testuser1" "\new_server\path\testuser1" "" i using findstr find username (e.g testuser) , entire line of query - so, if findstr fins line entitled testuser should display entire line of user: finds: testuser should display: \new_server\path\testuser1 any idea how can this? can find user name no idea how output entire line? thanks, try findstr /c:searchstring fileyouaresearching.txt

django-cms and jQuery -

i've got django site running quite happily django-cms want include of own fancy javascript using jquery. i'm rather new django, problems might stem this. django-cms uses jquery itself, , if add jquery header - things break rathter unsurprisingly. how add own jquery without affecting django-cms? at moment javascript files stored in media root i've defined in projects settings.py and, mentioned, reference them in header. as read this, seems silly question, i'm still perplexed. edit::some code i have media root defined: media_root = os.path.join(project_path, 'media') and in base template header includes <script src="/media/javascript/jquery.js" type="text/javascript"></script> <script src="/media/javascript/application.js" type="text/javascript"></script> javascript in application.js works, when django-cms stuff breaks. example, trying add plugin placeholder results in: uncaugh

java - Deleting an item from array -

class arrayapp{ public static void main(final string[] args){ long[] arr; // reference array arr = new long[100]; // make array int nelems = 0; // number of items int j; // loop counter long searchkey; // key of item search // -------------------------------------------------------------- arr[0] = 77; // insert 10 items arr[1] = 99; arr[2] = 44; arr[3] = 55; arr[4] = 22; arr[5] = 88; arr[6] = 11; arr[7] = 00; arr[8] = 66; arr[9] = 33; nelems = 10; // 10 items in array // -------------------------------------------------------------- for(j = 0; j < nelems; j++){ system.out.print(arr[j] + " "); } system.out.println(""); // -------------------------------------------------------------- searchkey = 66; // find item key 66 for(j = 0; j < nelems; j++){

tree - How to create an iterator wrapper for DAG structure in Java? -

i want have iterator on data structure. don't know data structure is, mayebe dag (directed acyclic graph), maybe linked list. want wrap iterator , don't think @ particular data structure. i know how visit dag recursive-like visitor, can't figure out simple , clean structure implementing iterator methods next() , hasnext() . inside iterator i've created current node instance , iterate for-loop on children , parent. 'already-visited' flag needed. dagelement has these more attributes: dagelement parent boolean alreadyvisited i don't think clean solution. any advice? the quick-and-dirty method converting recursive heuristic iterative 1 use (lifo) stack or (lilo) queue hold "roads not taken" - paths found not yet taken. in case, iterator have stack or queue instance variable. like: class dagiterator<t> extends iterator<t> { private stack<dagnode<t>> nodes; private dagiterato

visual studio - StyleCop no longer shows "Show Help" context sensitive menu -

Image
i used able click on stylecop warning , select "show menu" show me more info warning. can suggest why not seeing now? d:\users\username\documents\visual studio 2010\templates\projecttemplates\visual c# some warnings provide description, others may not. maybe documentation incomplete or authors figure warnings don't need additional clarification?

objective c - Add MKAnnotation in UIView, not in MKMapView -

it's possibile add mkannotation in uiview . i don't have ( and don't want ) mkmapview , want annotation callout in uiview. how can add point ( with callout ) on screen? something like: mkannotationposition newpos; newpos.center.x = 200; newpos.center.y = 250; to positioning annotation in uiview. thanks, alberto. used: http://github.com/edanuff/monotouchcalloutview

ASP.net Update pannel and trigger -

my page contains drop down list, buttons, datagridview , these have events . add these events under <trigger> <updatepannel> ? if i'm not wrongly understanding question, there's no need of registering child update panel control's events. you need register triggers such controls should provoke partial or full postback outside update panel (there're other situations you'll need reasons inner ones). i hope helpful :)

javascript - How to allow user to enter elements in an HTML table -

i want allow user enter list of persons in web application, , submit them 1 batch. each row looks this: <tr> <td> <input name="person.fname"> </td> <td> <input name="person.lname"> </td> <td> <input name="person.birthdate"> </td> </tr> the form starts out single row of blank inputs, , want fresh row added list whenever user fills in of fields -- i.e. list grows on demand. likewise, want row disappear whenever user clears fields in it. what easiest, robust , maintainable way implement this? finally, how submit table of values server? preferred way name each field server can create list of person entities based on entered values? if familiar jquery, can use .change handler catch them changing field. test see if it's last row , if there data in it. if have taken out of row, remove it. jquery has great ways this, it's dependent on how want write it

sql server - SQL - update, delete, insert - Whatif scenerio -

i reading article other day showed how run sql update, insert, or deletes whatif type scenario. don't remember parameter talked , can't find article. not sure if dreaming. anyway, know if there parameter in sql2008 lets try insert, update, or delete without committing it? log or show have updated. remove parameter , run if behaves expect. i don't know of sql2008 specific feature sql service supports transactions can this: start transaction ("begin transaction" in tsql) the rest of insert/update/delete/what-ever code (optional) select statements , such if needed output result of above actions, if default output step 2 (things "x rows affected") not enough rollback transaction ("rollback transaction" in tsql) (optional) repeat testing code show how things without code in step 2 having run for example: begin transaction -- make changes delete people name 'x%' delete people name 'd%' exec some_proc_tha

Using ASP.NET MVC 2 credentials to log into other services -

here scenario - 1/ have asp.net mvc application running on server, uses windows authentication. 2/ there different web application (written in java) somewhere else uses windows authentication. in controller of mvc application need grab information other web app. how can connect "foreign" application using credentials of user accessing controller? any appreciated. impersonation doesn't leave aspnet process. means cannot delegate credentials , access remote resource using them. either swap forms authentication uses cookies or need kerberos .

how to "link" two drop-down lists with php, javascript, mysql? -

i want create form 2 drop-down lists (country , town), filled options 2 mysql tables. , second list (towns) populated options depending on value of selected option on first list (country). i know how load options php , mysql countries list , can link second list populated options javascript. there conditionals in script updates values of second list. need mysql query second list. how can start second query when page loaded? you've got 2 general ways of going this. first, include of values page possibly javascript array, first list changed, re-adds appropriate values second drop-down. if use method, every item (from both tables/lists) loaded on every request. if total number of items relatively small (say <100) best approach. the other option issue ajax request after first dropdown selected. request contain id/value of dropdown, , return items valid value. method means need 1 query on initial page load (the values first dropdown) requires create javascript

c# - WPF: Setting Focus To A Control Inside a ItemsControl -

i have itemscontrol bound datasource , generates several containers. using code ensure 1 of containers visible @ given time. containers use templateselector content of each container different (which rules out finding control name). i set keyboard focus first control in visible container. have added event handler isvisiblechanged event each container when access visualtree there no children. any ideas? you can set focus on child element after child element has become visible. 1 option find child element want focus, add handler isvisiblechanged . in handler, focus object , remove handler. private void stackpanel1_isvisiblechanged(object sender, dependencypropertychangedeventargs e) { if (stackpanel1.isvisible) { uielement elm = stackpanel1.children[0]; frameworkelement fwe = (frameworkelement)elm; fwe.isvisiblechanged += new dependencypropertychangedeventhandler(fwe_isvisiblechanged); } } void fwe_isvisiblechanged(object

gcc - Where is the source code for isnan? -

because of layers of standards, include files c++ rats nest. trying figure out __isnan calls, , couldn't find anywhere actual definition. so compiled -s see assembly, , if write: #include <ieee754.h> void f(double x) { if (__isinf(x) ... if (__isnan(x)) ... } both of these routines called. see actual definition, , possibly refactor things inline, since should bit comparison, albeit 1 hard achieve when value in floating point register. anyway, whether or not it's idea, question stands: source code __isnan(x) ? glibc has versions of code in sysdeps folder each of systems supports. 1 you’re looking in sysdeps/ieee754/dbl-64/s_isnan.c . found git grep __isnan . (while c++ headers include code templates, functions c library not, , have inside glibc or whichever.)

xcode - How to define end in objective C -

osstatus setupbuffers(bg_fileinfo *infileinfo) { int numbufferstoqueue = knumberbuffers; uint32 maxpacketsize; uint32 size = sizeof(maxpacketsize); // need calculate how many packets read @ time, , how big buffer need // base on size of packets in file , approximate duration each buffer // first check see max size of packet - if bigger // our allocation default size, needs become larger osstatus result = audiofilegetproperty(infileinfo->mafid, kaudiofilepropertypacketsizeupperbound, &size, &maxpacketsize); assertnoerror("error getting packet upper bound size", end); bool isformatvbr = (infileinfo->mfileformat.mbytesperpacket == 0 || infileinfo- >mfileformat.mframesperpacket == 0); calculatebytesfortime(infileinfo->mfileformat, maxpacketsize, 0.5/*seconds*/, &mbufferbytesize, &mnumpacketstoread); // if file smaller capacity of buffer queues, load @ once if ((mbufferbytesize * numbufferstoqueue) > infileinfo->mfiledatasize) in

WPF Flowdocument - Prevent line break before % sign -

i've got flowdocument generating document client, , it's getting line break don't like. there way mark section of text should avoid line breaks? this: <paragraph>here paragraph there should <span nolinebreak=true>no line break</span> in part.</paragraph> obviously, span doesn't have nolinebreak property, i'm wondering if there's equivilant functionality available, or if can me started on way of implementing spanwithnolinebreak class or runwithnolinebreak class? update actually, 1 issue i'm having percent sign, there isn't space: <paragraph>when print , &#x00bd;% want one-half , '%' symbols not line break between them.</paragraph> the & #x00bd; unicode ½ symbol. i'm getting line wrap between 1/2 , % though there's no space between them. the unicode character "word joiner" ( u+2060 ) intended purpose. "does not produce space prohibits line break on either

multithreading - Lightweight portable C++ threading -

does know lightweight portable c++ threading library, can work on windows, linux , mac os x? specifically in case, simulator after each time passes exports simulated data. run 1 thread (simulate) once in while start thread (export). condition be: if export thread started wait until finishes, before starting new one. thanks what tinythread++ ? need portable threads c++ app? c++0x unavailable target compiler(s)? boost large? then need tinythread++! tinythread++ implements compatible subset of c++0x thread management classes.

listview - How can I change the width of a column in a list view is SharePoint? -

i have sharepoint 2007 , have list view has text field that, when shown quite few other fields, 1 word narrow. is there way expand column without access css or other web programming languages? if can't use css, javascript, sharepoint designer, or deploy c# code server.. can't change width of column.

javascript - Using jquery's .queue to queue functions -

when remove parameter 'ajax' from .queue() function, ajax calls queued. problem is, jquery docs .queue() function default 'fx' queue. unfortunately, using queue (for effects) , want use queue custom functions. unfortunately, code inside .queue() function never gets called. have example of code below (just small snippet). getting little complicated if have further questions feel free comment. $(document).ready(function(event) { var target = event.target; var ajaxify = new ajaxify(); $.each(ajaxify.functions, function(index, value){ if ($(target).hasclass(value)) { console.log('this in console, , else in code'); $('#main').queue('customfunctions', function (next) { var self = this; ajaxify[value](target, event, next, self); }); } }); $('#main').dequeue('customfunctions'); }); function ajaxify() { this.functions = [ 

In Java, How to draw multi-line text with auto-resizing font that must fit into a bounds -

using textlayout , linemeasurer (the way draw multiline center-aligned text in java), how 1 go this? use jtextpane. can set paragraph attributes "centered" , every line centered within text pane. after create text pane can like: simpleattributeset center = new simpleattributeset(); styleconstants.setalignment(center, styleconstants.align_center); doc.setparagraphattributes(0, doc.getlength(), center, false);

log4j.xml path problem -

i trying log4j working using xml configuration. have log4j.xml added classpath while running getting : log4j:warn no appenders found logger (test.dateformatter). log4j:warn please initialize log4j system properly. if place log4j.properties instead seems pick configuration. ideas it's have log4j.xml in classpath has provide correct configuration. maybe post content of log4j.xml file can (maybe typo in logger configuration?). you should have @ log4j manual. section "default initialization procedure" describes how log4j try find initialization file.

Get list of data-* attributes using javascript / jQuery -

given arbitrary html element 0 or more data-* attributes, how can 1 retrieve list of key-value pairs data. e.g. given this: <div id='prod' data-id='10' data-cat='toy' data-cid='42'>blah</div> i able programmatically retrieve this: { "id":10, "cat":"toy", "cid":42 } using jquery (v1.4.3), accessing individual bits of data using $.data() simple if keys known in advance, not obvious how 1 can arbitrary sets of data. i'm looking 'simple' jquery solution if 1 exists, not mind lower level approach otherwise. had go @ trying to parse $('#prod').attributes lack of javascript-fu letting me down. update customdata need. however, including jquery plugin fraction of functionality seemed overkill. eyeballing source helped me fix own code (and improved javascript-fu). here's solution came with: function getdataattributes(node) { var d = {}, re_dataatt

osx - Should i release objects that i get from dictionary on Mac? -

ie: boolref = (cfbooleanref)cfdictionarygetvalue(descriptiondictionary, kdadiskdescriptionmediaremovablekey); if (boolref) { cfrelease(boolref); // need code? } first read memory management programming guide core foundation . answer no, because of create rule. cfdictionarygetvalue() not include words "create" or "copy." note cfrelease() in case not unneeded, incorrect , lead over-release crash.

ruby on rails - Requiring a gem inside a gem's rake task -

i'm using jeweler create gem rails 3. gem contains rake task , 1 of things wiping db, i'm using 'database_cleaner'. i'm specifying gem dependency inside gem's gemfile gem 'database_cleaner' and in rakefile jeweler::tasks.new |gem| ... gem.add_dependency 'database_cleaner' end then inside lib i've created files my_gem.rb , tasks.rake. follows, my_gem.rb: module mygem class railtie < rails::railtie rake_tasks load 'tasks.rake' end end end and tasks.rake: task :my_task databasecleaner.strategy = :truncation databasecleaner.clean end i installed gem (sudo rake install), created empty rails project , added gem dependency in rails' gemspec ( gem 'my_gem' ). when try run rake my_task error uninitialized constant databasecleaner . i've tried adding require 'database_cleaner' inside task, raises error no such file load -- database_cleaner , gem 'database_cleane

C++ Friend Classes -

just trying make sure have understood friends one class { friend class b; int valueone; int valuetwo; public: int getvalueone(){ return valueone; } } class b { public: friendlydata; int getvaluetwo(){ return friendlydata.valuetwo; } } main() { b myobject; myobject.friendlydata.getvalueone(); // ok? myobject.getvaluetwo(); // ok? } in reference code about, if ignore lack of initialising, 2 functions in main ok right? , besides doing funky stuff, should no other way data these classes... out side of these class, b.a has no accessible data, member function. yes 2 identified calls in main ok. involve access of 3 members: b::a , b::getvaluetwo , a::getvalueone . of have public accessibility , expose no privae types. hence they're usable anywhere including main .

Looking for a couple of good Blogging applications in Rails or PHP -

i have blogging application developed in ruby on rails, or alternative in php (i prefer rails actually, php work well). i know couple, simplelog, threw couple of errors first time tried run it, , once fixed them, didn't pretty much. in rails mephisto used blogging engine has ready-to-use plug-ins , advance feature built-in caching system faster loading. http://www.mephistoblog.com/ if looking light weight small team oriented, can turn radiant cms blog have nice , user friendly futures. http://radiantcms.org/ and fav typo comes theming & plugins support easier customization( seo futures ) http://blog.typosphere.org/ i tried , tested above apps easy insatll, configure , short learning curve

Application Development With Old facebook APIs -

i want develop facebook applications , have bought books amazon. books contents old facebook apis. (2008-2009). can develop applications old api? or have use new version? you can still use old api's, can imagine discouraged. read more in facebook developer documentation . edit given name, assume know bit of php. started go http://www.facebook.com/developers , create new application. facebook presents following tutorial, think should able follow: step 1: download facebook's php library extract archive directory on hosting server can host , run php code: $ curl -l http://github.com/facebook/php-sdk/tarball/master | tar xvz $ mv facebook-php-sdk-* facebook-php-sdk $ cp facebook-php-sdk/examples/example.php index.php step 2: replace ids in index.php have own app information it should when you're done: <?php // awesome facebook application // // name: yourappname // require_once 'facebook-php-sdk/src/facebook.php'; //

c# - MVC 2 and the reportviewer with SSRS 2005 - white page, no error -

i having issue reportviewer nothing visible, not control. if add other content, shows, reportviewer not. using 9.0.0.0 version of control ssrs 2005 inside mvc 2.0 application. have built , deployed report server. have confirmed looking on report server , running there. my app mvc 2.0 i have added regular webforms page root of website. put in form, runat=server, , enabled viewstate i have added .aspx routing exception my code behind set every example can find my webconfig configured (maybe issue is) i set manual test forcing correct values in , same blank page. i have reference 9.0.0.0 versions of microsoft.reportviewer.webforms , microsoft.reportviewer.common , can see web.config matches references. the page appears white - no control visible. no errors thrown. remembered it, there should @ least blank reportviewer control on page, there isn't there @ all. a few other oddities - if remove parameter setting, no error occurrs. added code send in credentials,

vim script "input()" function that doesn't require user to hit enter -

i have user call function , have function request user input not want user have type 'enter' after typing letter required "input()" function. instance, user should able type single letter commands 'h','j','k','l' , each letter typed loop around function until user typed 'x' exit. if use "input()" user have type 'h <enter> ','j <enter> '... any suggestions on how might able this? if more clarification needed please let me know. update got working: function! s:getchar() let c = getchar() if c =~ '^\d\+$' let c = nr2char(c) endif return c endfunction " interactively change window size function! interactivewindow() let char = "s" while char =~ '^\w$' echo "(interactivewindow) type: h,j,k,l resize or auto resize" let char = s:getchar() if char == "h" | call setwindowsize( "incr" ,-5 ,0 ) | endi

javascript - Targeting an iframe element using colorbox -

i have link displaying contents in colorbox plugin via iframe method , target specific elements inside iframe. can't seem figure out. below at...any appreciated. $(".thickbox").colorbox({iframe:true,width:450, height:570, title: 'form title', oncomplete: function() { $("#cboxloadedcontent iframe").contents().find("a.login").css("display","none"); } }); i use firebug , set breakpoints can browse through dom , find path you're looking for. break $("#cboxloadedcontent iframe")... line multiple lines, set breakpoints on each make sure know it's going wrong , debug there.

xcode - Linking Dylibs in Kexts? -

i've written kext os x implements usb-based framebuffer using (iokit) libusb , jpeglib. both of dylibs, , reason won't link in xcode, , os won't resolve dependencies when attempts load kext. the background of whole thing samsung makes lcd picture frame can act second monitor; problem it's not displaylink or other known protocol -- windows-only driver spits out custom header , each frame encoded jpeg , sent device. implementation os x, used libusb since it's framebuffer device , needs loaded @ startup -- wanted deal more driving display hot-plug detection , iokit's usb device requirements. thanks help! guys awesome. i'm afraid kexts aren't strictly dynamically linked (they're loaded @ runtime, structure static) , barring heroic custom linker/loader effort won't dylib load kernel space. as far know, point of libusb write usb drivers in user space. it's therefore not clear me why you're building kext (which run in kernel

c# - Using InvokeRequired when not a Form -

i have event handler, want handled in original thread object created, doesn't block. forms, it's easy use invokerequired force original thread. how do if class not form? thanks, pm this not going easy. first, have create kind message receiving loop on thread in question. need implement isynchronizeinvoke in such manner posts message containing delegate execute queue target thread can pick , extract delegate , execute it. producer-consumer pattern useful setting up. important thing take away cannot marshal delegate onto thread. target thread has specially designed work. works in ui threads because application.run gets message loop going control.invoke method uses.

.net 4.0 - Problem with HttpHandlers in a asp.net 4 integrated mode hosted at arvixe.com -

i'd know if has experienced issues httphandlers @ arvixe hosting provider. i have set web site running in asp.net 4 integrated mode, httphandlers set correctly web.config , work in windows 7 iis7 pc. on hosting space httphandlers don't seem work. maybe has custom httphandlers working in .net 4 on arvixe? if so, can know how set them? thanks i had same problem , found needed add handler registration system.webserver. this: <handlers> <add name=".jpg" path="*.jpg" verb="get" type="imagehandler.httpimagehandler" resourcetype="unspecified" precondition="integratedmode" /> </handlers> hope (if not late ;-)).

python: how to create persistent in-memory structure for debugging -

[python 3.1] my program takes long time run because of pickle.load method on huge data structure. makes debugging annoying , time-consuming: every time make small change, need wait few minutes see if regression tests passed. i replace pickle in-memory data structure. i thought of starting python program in 1 process, , connecting another; afraid inter-process communication overhead huge. perhaps run python function interpreter load structure in memory. modify rest of program, can run many times (without exiting interpreter in between). seems work, i'm not sure if suffer overhead or other problems. you can use mmap open view on same file in multiple processes, access @ speed of memory once file loaded.

debugging - How do I keep the "Elements" (DOM) tree open in the Webkit Inspector? -

in webkit inspector, can go elements panel , unfold dom elements can see i'm interested in. so far, when find i'm looking for, change code, , reload page, dom tree in elements panel folded up. is there way either, a) inspector remember , try open dom tree was, or b) keep dom tree unfolded default? i had same question. i'm using chrome on win xp can tell solution found chrome, imagine process similar other webkit browsers. i navigated chrome application data folder: c:\documents , settings\[username]\local settings\application data\google\chrome\application[newest version]\resources\inspector obviously fill in [username] , [newest version] folders have on computer. closed browser. i opened devtools.js in notepad++ , started hunting. turns out webkit inspector adds css property of "expanded" on tags when click on little arrow. on line 1484 there boolean default value. changed this.expanded=false this.expanded=true fired chrome , badda-b

javascript - Scripting error in jQuery/AJAX code snippet? -

this should simple question, answer has eluded me time now. seem have error in code, either scripting typo, or error in logic. kindly clarify problem? here's code: function getquestion() { $.ajax({ type: "get", url: "questions.xml", datatype: "xml", success: function(xml) { x = 0; x = $(xml).find('question').length; var questionid = $.random(x); $(xml).find('question').each(function(){ if(this.id == questionid) { var text = $(this).find('body').text(); $('#questionbody')[0].innerhtml = text; } }); //close each } //close success });//close ajax }; //close function getquestion it's meant read in xml file, search specific item random id, , plug contents of body &l

How to find substring from string without using indexof method in C#? -

i want find position of substring in string if present without using string method including indexof. tried times failed. tell me how in c#? can use .length operator. sorry.. thought fun exercise me, so... spoiler class program { static void main(string[] args) { string str = "abcdefg"; string substr = "cde"; int index = indexof(str, substr); console.writeline(index); console.readline(); } private static int indexof(string str, string substr) { bool match; (int = 0; < str.length - substr.length + 1; ++i) { match = true; (int j = 0; j < substr.length; ++j) { if (str[i + j] != substr[j]) { match = false; break; } } if (match) return i; } return -1; } }

asp.net - Setting text after a bind - radtextbox -

when insert new record in grid: <telerik:radtextbox id="txtredemptionbeforemessage" text='<%#bind("redemptionbeforemessage") %>' runat="server" /> i want able to: protected void radgrid1_itemcreated(object sender, griditemeventargs e) { if (e.item grideditformitem && e.item.isineditmode) { if (e.item.ownertableview.isiteminserted) { //fill in defaults messages required radtextbox radtextbox = (radtextbox)item.findcontrol("txtredemptionbeforemessage"); radtextbox.text = "default redemption before message"; this works when there no text ='<%#bind("redemptionbeforemessage") %> problem: how default message work - suspect need @ event after bind. the bind in there because same form code used edit. already answered question in thread - setting text after bind - radtextbox

sqlite - SQL query help!! I'm trying to select the row that DOESN'T start with a number -

i have 10,001 rows in table, , of rows except 1 start number. need find 1 row doesn't start number, or doesn't contain number. so have: select col1 table1 col1 not '?%' is close? need find row doesn't have number... thanks!! update: using sqlite database use: select col1 table1 substr(col1, 1, 1) not between 0 , 9 reference: core functions (incl substr) like

c++ - Is it safe to delete a NULL pointer? -

is safe delete null pointer? and coding style? delete performs check anyway, checking on side adds overhead , looks uglier. very practice setting pointer null after delete (helps avoiding double deletion , other similar memory corruption problems). i'd love if delete default setting parameter null in #define my_delete(x) {delete x; x = null;} (i know r , l values, wouldn't nice?)

c# - Create multiple threads and wait all of them to complete -

how create multiple threads , wait of them complete? it depends version of .net framework using. .net 4.0 makes thread management whole lot easier using tasks: class program { static void main(string[] args) { task task1 = task.factory.startnew(() => dostuff()); task task2 = task.factory.startnew(() => dostuff()); task task3 = task.factory.startnew(() => dostuff()); task.waitall(task1, task2, task3); console.writeline("all threads complete"); } static void dostuff() { //do stuff here } } in previous versions of .net use backgroundworker object, use threadpool.queueuserworkitem() , or create threads manually , use thread.join() wait them complete: static void main(string[] args) { thread t1 = new thread(dostuff); t1.start(); thread t2 = new thread(dostuff); t2.start(); thread t3 = new thread(dostuff); t3.start(); t1.join(); t2.join(

How to set request-specific data to SNMP agent using net-snmp? -

i want snmp agent response differently depending on source requester, cannot find way magic convey data make distinguishable snmp agent. what have tried setting netsnmp_session structure , netsnmp_pdu structure. because they're 2 parameters of snmp_send . data field tried facilitate myvoid , callback_magic. but unfortunately on snmp agent, data received 0, not have set on snmp client. sorry answer myselv's question. finally found following trick circumvent issue: insert known snmp object(such ifnumber) after target snmp object identify specific snmp query. the handler function in agent should check variable next current variable see whether it's known snmp object ifnumber. if yes query comes you, using net-snmp api form variable list of query. client code: oid dest_oid[ max_oid_len ] = {0}; size_t dest_oid_len = count_of(dest_oid); get_node(g_snmp_name_ifnumber, dest_oid, &dest_oid_len ); snmp_add_null_var(pdu, dest_oid, dest_o

automatic or Inline spell check in TexnicCenter for latex files -

i started using texniccenter after using winshell several years. spell check in texniccenter has invoked manually tedious. there way enable inline or automatic spell check in texnicceneter? i found how it. in menu tools->options->spelling, check box "check spelling while typing"

.net - Safety critical app - Database row validation -

this perhaps little bit vague, i'm hoping in amongst people on there have ran type of issue before. background our application c# / .net service controls train orders. use linq-to-sql store state of rail network , train orders in sql server 2005 database. have safety requirement cots software cannot "trusted" per se. requirement risk has been captured as: "sql server or operating system modifies static or dynamic data." our mandate: "data stored in database shall validated such on read can confirmed data access code has not changed since last commit." question love find "automagic" way of fulfilling requirement. failing that, way satisfy condition without having create columns in every table of database store computed hashes in (that have validate against when reading.) maybe md5 checksum saved in either same or different table main data. checksum generated c# application if did update using raw sql checksum off.

c++ - How Can I bring my application to the Top of windows -

if have 2 applications running simultaneously , app1.exe , app2.exe , want bring app2.exe when button in app1.exe pressed. use findwindow retrieve window-handle of app2.exe window , use bringwindowtotop on handle. you can find (vb) example here: http://support.microsoft.com/kb/186431

c# - fetch user details from log.nsf -

hi question : in log.nsf , there entries database accessed in last week. not able find these values resides fetching these values c# , using domino.dll reference. kindly me out fetch number of hits of database user in week. can check database active , how being accessed users. thanks in advance ankit i think use wrong approach. create form 2 fields - user name , access count , view sorted user name. each time in database open script search in view document current user , update counter (+1). if no document found - create current user, set counter 1 , save. if need dates, can either add date field document , not use counter, create document every time database has been opened , create view categorized date see usage. number of documents per day show usage. can add category per user if like. think using log.nsf purpose not approach.

sql - Return column name where Join condition is null -

i have 2 tables: employee , person structure employee: id, personid, designation, isactive person:id, name, contact employee's personid column references person's id , can null i need return employee's name , join criteria select emp.salary, emp.designation, emp.isactive, p.name employee emp join person p on p.id = emp.personid or (p.id null , emp.id null) this incorrect requirement is: if emp.personid = null, return p.name = null else return p.name = person's name table any pointers on this? you need outer join select emp.salary, emp.designation, emp.isactive, p.name employee emp left join person p on p.id = emp.personid when use inner join (or join) select rows matching join critiria, in example never nave null person name because if employee not assiciated person, record not selected. if use outer join (left/right join), record main table (1st left , 2nd right) selected. hope helps.

c# 4.0 - Need a way to get the version # used by the msi installer at run time in c#, without knowing the location of the msi file used to install -

i'm developing scheme automatically update program central point. assist me in need way version # of msi file used install progarm @ runtime, can compare installed version latest version on server (already solved part) , decide whether or not update. clear, have way of opening msi files using msi.dll , getting version # out. problem 1 of bootstrapping. if user installs program first time, how can program know find msi file (on client)? the solution can simple msi creating text file version # in when runs. i'd avoid querying registry if can. if can't figure out i'm going have take special care keep version #'s same in gui project , msi installer, , thought annoys me. any thoughts? i assume want productversion property of msi. you can using com. add com reference "microsoft windows installer object library" c# project. then try following program: namespace testcs { using system; using windowsinstaller; internal class t

ASP.Net: How to log login-trys correctly? -

i have login in admin page. now want log every login-try in database. normaly have log-table adminid in foreign key of adminuser-table. now, of course, when try login username doesn't exist, haven't id , foraign-key uses crash in write-attamp. now whats correct way log login-try when username isn't correct , haven't correct id? 1) add second log-table such things or 2) remove foraign key in first log-table why not have adminid field nullable field? way, distinguish between successful , unsuccessful login attempts.

Special HTML Characters -

Image
ok, want have characters below in html page. seems easy, except can't find html encoding them. note: without having sized elements, plain ol' text fine ^_^. cheers. you can see have unicode number of selected character - @ bottom of picture ("u+266a: eighth note"). simply use last portion in unicode character entity: &#x266a; - ♪ if page utf-8, can paste in.

computer vision - Assessing the quality of an image with respect to compression? -

i have images using computer vision task. task sensitive image quality. i'd remove images below threshold, unsure if there method/heuristic automatically detect images heavily compressed via jpeg. have idea? image quality assessment rapidly developing research field. don't mention being able access original (uncompressed) images, interested in no reference image quality assessment. pretty hard problem, here points started: since mention jpeg, there 2 major degradation features manifest in jpeg-compressed images: blocking , blurring no-reference image quality assessment metrics typically 2 features blocking easy pick up, appears on macroblock boundaries. macroblocks fixed size -- 8x8 or 16x16 depending on image encoded with blurring bit more difficult. occurs because higher frequencies in image have been attenuated (removed). can break image blocks, dct (discrete cosine transform) each block , @ high-frequency components of dct result. if high-frequ

javascript - Looking for charts library that supports linked events -

i looking library allows me create charts " annotated time lines " e.g. used on google finance. can't use google api because relies on flash , chart should not work on common browsers usable mobile devices ipad. don't need of features of google's solution, displaying linked event flags in chart essential requirement , ability arbitrarily zoom , pan chart nice, latter feature not must on mobile devices , older browsers. a serverside solution transparently generates plain image charts if flash (or other client features canvas-elements) not available on client ok, have asp.net mvc 2 running on serverside. an open source solution great, commercial library or component option. suggestions? what http://highcharts.com , api complete

Excel::VBA - How to reset the 'OnXXX' macros for worksheets -

i have old workbook (made years ago) few worksheets in it. when open workbook, excel complains messages 'cannot find activateworksheet', 'cannot find deactivateworksheet'. there no event handlers in code. want avoid getting these messages excel not find how reset them. checked onsheetactivate, onsheetdeactivate etc properties see if macro assigned found them empty. is there other place can check , remove these handlers? it might related addins - have necessary addins installed?

c++ - Is using #pragma warning push/pop the right way to temporarily alter warning level? -

once in while it's difficult write c++ code wouldn't emit warnings @ all. having warnings enabled idea. necessary disable warnings around specific construct , have them enables in other pieces of code. i've seen 2 ways of doing far. the first 1 use #pragma warning( push ) , #pragma warning( pop ) : #pragma warning( push ) #pragma warning( disable: thatwarning ) //code thatwarning here #pragma warning( pop ) the second use #pragma warning( default ) : #pragma warning( disable: thatwarning ) //code thatwarning here #pragma warning( default: thatwarning ) the problem see in second variant discards original warning level - warning might have been off before or warning level might have been altered. using default discard alterations. the first approach looks clean. there problems it? there better ways achieve same? the first method best way it, imo. know of no problems it. simply bear in mind #pragma compiler specific don't expect work

merge asp.net mvc with existing asp.net app -

i have merged , asp.net 4.0 app asp.net mvc 3 app. everything works, except gravy right clicking on controllers folder , getting: add >> add controller same views, etc, etc. any pointers? open corresponding .csproj file using favorite text editor (not visual studio) , add following: <propertygroup> ... <projecttypeguids>{f85e285d-a4e0-4152-9332-ab1d724d3325};some other guids not important</projecttypeguids> ... </propertygroup> notice {f85e285d-a4e0-4152-9332-ab1d724d3325} guid. indicates it's asp.net mvc 2 project , should visual studio menus. if asp.net mvc 3 rc project guid {e53f8fea-eae0-44a6-8774-ffd645390401} .