Posts

Showing posts from June, 2012

ajax - Node js - Creating persistent private chat rooms -

i've been reading bout node js lately, , chat capabilities seem nice. however, chat examples i've seen broadcast chat server fixed url (like meeting room). possible use node js in part create chat client more gchat? - chat window popped on current page , persists through multiple pages. has seen example of yet? if not, suggestions other technologies use purpose (i know that's been answered in other questions)? thanks. i'll give pseudo implementation relying on jquery , now abstract away tedious io , tedious dom manipulation solution. // server var nowjs = require('now'); var = nowjs.initialize(httpserver); everyone.now.joinroom = function(room) { nowjs.getgroup(room).adduser(this.user.clientid); } everyone.now.leaveroom = function(room) { nowjs.getgroup(room).removeuser(this.user.clientid); } everyone.now.messageroom = function(room, message) { nowjs.getgroup(room).now.message(message); } // client var currroom = "...

mercurial - Hg sub-repository dependencies -

Image
there have been couple of questions hg sub-repo dependencies in past ( here , here ) accepted answers don't seem address problem me. a project of mine has 4 dependencies: a, b, c, d. d dependent on a, b , c; , b , c dependent on a: i want use hg sub-repositories store them can track version of each rely on. because, while using a,b,c , d in project, other projects require , b . therefore b , c must track version of need independently of d. @ same time, in application versions of b , c referenced given version of d must use same version of referenced given version of d (otherwise fall on @ runtime). want allow them reference each other siblings in same directory - i.e. d's .hgsub following, , b , c's first line. ..\a = https:(central kiln repo)\a ..\b = https:(central kiln repo)\b ..\c = https:(central kiln repo)\c however doesn't seem work: can see why (it'd easy give people enough rope hang with) shame think neatest solution dependencies. i've re...

javascript - Cookie is set twice; how to remove the duplicate? -

so have website uses cookie remember current layout state across visits. working great until added facebook 'like' button site generates links allow users share ui state (a little confusing not relevant problem). the problem when visit site via 1 of these facebook links second copy of layout cookie seems created (as in, see 2 cookies same name , different values). wouldn't terrible except value of duplicate cookie appears stuck, coupled fact when user returns site browser remembers stuck value instead of set value (so it's kind of there's "good" cookie can still work with, , "bad" 1 cannot, , browser likes remember "bad" cookie instead of "good" cookie). breaks layout tracking/remembering functionality. so there 2 questions here: how stop happening/why happening in first place? how fix things users have stuck cookie (i know pick new name cookie, i'd rather finding way unstick stuck cookie)? if use chrom...

asp.net - Ajax update panel - how to set max updating time? -

that isn't usual webapplication, user can load long process inside updatepanel. and wait looking on loading via updateprocessing stuff. the trouble because update panel aborts loading after time , totally breaking web application. how can calm down ajax control ? offtopic : ajax trouble when didn't fixed the trouble combobox on script manager, set asyncpostbacktimeout. value should in seconds. example: asyncpostbacktimeout = "600" http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.asyncpostbacktimeout.aspx

ios - calling a method with parameters -

i`m using mapkit framework , want ask : + (nsuinteger)zoomlevelformaprect:(mkmaprect)mrect withmapviewsizeinpixels:(cgsize)viewsizeinpixels { nsuinteger zoomlevel = maximum_zoom; // maximum_zoom 20 mapkit mkzoomscale zoomscale = mrect.size.width / viewsizeinpixels.width; //mkzoomscale cgfloat typedef double zoomexponent = log2(zoomscale); zoomlevel = (nsuinteger)(maximum_zoom - ceil(zoomexponent)); return zoomlevel; } this method..how can know value of mrect , viewsizeinpixels parameters able call it?? thx in advance :) the map view's current mkmaprect visiblemaprect property , view size in frame.size (since mkmapview subclass of uiview) method called using like: nsuinteger zoomlevel = [utilityclass zoomlevelformaprect:mapview.visiblemaprect withmapviewsizeinpixels:mapview.frame.size]; utilityclass whatever class method in , replace mapview whatever map view named. by way, mapkit ...

shell - Bash global variables not changed when functions is evaled -

i want call function "b" , pass funcion name (a1, a2, etc), called it. , in function, name passed, initialize several variables, can't read them "b" function. function a1 { echo "func 1" result1="a1" return 0 } function a2 { echo "func 2" anotherresult="a2" #..some other initialization return 0 } #... function b { output=`$1` # $1 - function name echo output=$output echo result1=$result1 # <--- error! result1 empty! } b "a1" # main script runs function b , passes other function name your function b not call a1. note output=$($1) not expect, because whatever running inside $(...) executed in different process, , when process terminate, value set not accessible longer. so: function b { output=\`$1\` # <-- not call $1 print output=`$1` # <-- ( $($1) better style ) - call whatever # inside $1, in process ...

Run PHP file from within vim -

is possibly run php file within vim? im trying here having shortcut whenever need run file i'm editing skip exiting vim , calling php interpreter manually yes! it's possible want. both running php within vim, , creating shortcut. matthew weier o'phinney writes: probably useful thing i've done php developer add mappings run current file through (a) php interpreter (using ctrl-m), , (b) php interpreter's linter (using ctrl-l). vim productivity tips php developers example: :autocmd filetype php noremap <c-m> :w!<cr>:!/usr/bin/php %<cr> or (this doesn't check filetype beware) :map <c-m> :w!<cr>:!/usr/bin/php %<cr> joe 'zonker' brockmeier writes: vim allows execute command directly editor, without needing drop shell, using bang (!) followed command run. instance, if you're editing file in vim , want find out how many words in file, run :! wc % vim tips: ...

c - How to intercept SSH stdin and stdout? (not the password) -

i realize question asked frequently, people want intercept password-asking phase of ssh. not want. i'm after post-login text. i want write wrapper ssh, acts intermediary between ssh , terminal. want configuration: (typing on keyboard / stdin) ----> (wrapper) ----> (ssh client) and same output coming ssh: (ssh client) -----> (wrapper) -----> stdout i seem able attain effect want stdout doing standard trick found online (simplified code): pipe(fd) if (!fork()) { close(fd[read_side]); close(stdout_fileno); // close stdout ( fd #1 ) dup(fd[write_side]); // duplicate writing side of pipe ( lowest # free pipe, 1 ) close(stderr_fileno); dup(fd[write_side]); execv(argv[1], argv + 1); // run ssh } else { close(fd[write_side]); output = fdopen(fd[read_side], "r"); while ( (c = fgetc(output)) != eof) { printf("%c", c); fflush(stdout); } } like said, think works. however, can't seem opposite. can't close(s...

jquery - CSS Display/Hide Methods -

i fixed issue still puzzled on why having trouble. when trying hide div tried use code: <div id = mydiv></div> function myfunction(){ $('#mydiv').css("display", "none"); } that code not work when trying hide div, will function myfunction(){ $('#mydiv').hide(); } i wanted know difference between each of these methods, , why 1 work while other did not. this problem <div id = mydiv></div> you have this <div id="mydiv"></div> since both .hide() , .css() add "display: none" element, above code thing think of. use "" attributes.

c# - File.Copy method -

is posiible following code doesn't throw exception , doesn't copy files? void copy2(string from, string to) { lock (_thislock) { if (file.exists(from)) { file.copy(from, to, true); return; } logger.write("file not exists"); } } customer says application doesn't crash , doesn't copy file, , doesn't write log. logger's type microsoft.practices.enterpriselibrary.logging.logger . sure, if file doesn't exist - (!file.exists) - file.copy call won't reached. logger.write not count exception. if, update suggests, there nothing in logs, double check logger.write function. implemented correctly? there exception being thrown , handled within method? more file.copy failing without throwing exception.

asp.net mvc - after render Event on MVC. Possible? -

Image
hy. i know there no server controls , server-side events, but...: my app email box , unread items bold displayed. ok... bold items unread (isread==false) . want update item (isread=true) without click.. before page rendered. how should it? there way in asp.net mvc or have jquery? . what best way call method after "view" rendered? . tks, guys! generally once action has done it's thing, , you've made view, there's no going code (so speak). there 2 ways approach problem. you create copy of list of messages pass view , change original have isread=true . preferred way of solving problem , code along lines of: var viewmessages = m in messages select new message { // fields want copy go here } viewmessages.tolist(); //this creates list query // update isread property foreach( var m in messages ){ m.isread = true; } you have 2 collectio...

javascript - Changing href attribute doesn't work in jQuery Mobile -

i change href using jquery mobile, tried code examples like: $("a[href='http://www.google.com/']").attr('href', 'http://www.live.com/'); <li><a data-ajax="false" href="http://www.google.com" >navigate</a></li> and $("#address").append("href", "http://cupcream.com"); <li><a data-ajax="false" id="address" href="http://www.google.com" >navigate</a></li> but nothing happens. what can wrong, aren't bug in jquery mobile? you need add "a" element attribute rel="external" or data-ajax="false" , in order links not managed via ajax. official documentation here . also @ jquery mobile history on data-ajax=false

iphone - NSManagedObject hierarchy import and export -

i'm on run make nsmangedobjectclass profile im-/exportable. try this way exporting works correctly if write relationships in nsarrays because nsset doesn't have writetofile implemented. - (void) exportprofile:(profile *)profile topath:(nsstring *)path{ //profile nsmutabledictionary *profiledict = [[self.selectedprofile dictionarywithvaluesforkeys:[[[self.selectedprofile entity] attributesbyname] allkeys]] mutablecopy]; nsmutablearray *views = [nsmutablearray array]; //views (view *view in selectedprofile.views) { nsmutabledictionary *viewdict = [[view dictionarywithvaluesforkeys:[[[view entity] attributesbyname] allkeys]] mutablecopy]; nsmutablearray *controls = [nsmutablearray array]; //much more for-loops [viewdict setobject:controls forkey:@"controls"]; [views addobject:viewdict]; } [profiledict setobject:views forkey:@"views"]; if([profiledict writetofile:[path stringbystandardizingpath] atomically:yes]) nslog(@...

android delay using handler -

i want display couple of images , add delay between each image. did , have no errors in code reason app crashes. bitmap bitmap = bitmapfactory.decodefile(imagein); imageview myimageview = (imageview)findviewbyid(r.id.imageview); myimageview.setimagebitmap(bitmap); // 2 lines used make handler handler handlertimer = new handler(); handlertimer.postdelayed((runnable) this, 20000); you don't class hosts snippet posted, think handlertimer.postdelayed((runnable) this, 20000); unlikely right. try adding anonymous runnable object such as handlertimer.postdelayed(new runnable(){ public void run() { // }}, 20000); another thing, logcat output invaluable getting clues causing crash. http://developer.android.com/guide/developing/tools/logcat.html

mobile - List of NFC (Near-Field Communication) Capable Phones -

i wondering if knew of list of nfc capable phones. believe iphones , nexus phone capable of nfc. there more @ current time? more specifically, droid2 have nfc capabilities? thanks in advance :d try list, updated daily. it's close definitive you'll find: http://www.nfcworld.com/nfc-phones-list/ (disclosure: maintain list)

objective c - Accessing all photos in iphone photo library? -

is possible photos in array or iphone photo library ? uiimagepickercontroller allows choose 1 picture @ time. call alassetslibrary 's -enumerategroupswithtypes:usingblock:failureblock: enumerate 1 or more assets groups , enumerate assets (photos) in each groups -[alassetgroup enumerateassetsusingblock:] . documentation has details.

interface - polymorphism in java -

is interfaces in java, kind of polymorphism? no. interfaces in java construct polymorphism ( subtype polymorphism ) working in java, not "kind" of polymorphism. in polymorphism happens when 2 objects respond same message ( method call ) in different way ( hence poly -> many, morphism -> way or shape : polymorphism -> many ways). in java able send same message 2 different objects have either inherit same parent, or implement same interface.

parsing - how to upload xml and then parse it using java -

i wondering if tell me how upload xml file using java. have jsp page , trying parse text-boxes on jsp page can loaded correctly. pretty import feature. know how parse xml file, i'm not sure how go uploading can parse it. thanks! apache commons fileupload component can integrate file uploaded. then, say, know do.

perl - shell script set time limit and notify -

possible duplicate: bash: terminate on timeout/file overflow while executing command i have shell script backup o/s image. want set time limit , notify me. if shell script runs longer 2 hours, needs send e-mail out. best way implement logic? you can use ps command check how time process running.

Is there a Microsoft SQL Server binding? -

could give me orientation on use of version of sql server? i'm working version 2003 @ moment. there c library freetds allows natively talk microsoft sql server , sybase databases. in order use in vala need create "vapi file" (probably writing manually) containing class , method declarations in vala syntax

c++ - Generic list deleting non pointers -

i have generic list template template<class t> class genericlist { //the data storeed in chained list, not important. struct c_list { t data; c_list* next; ...constructor... }; public: bool isdelete; genericlist() : isdelete(false) {...} void add(t d) { c_list* tmp = new c_list(d, first->next); //this not important again... } ~genericlist() { c_list* tmp = first; c_list* tmp2; while(tmp->next!=null) { if (isdelete) { delete tmp->data; } //important part tmp2=tmp->next; delete tmp; tmp=tmp2; } } }; the important part isdelete this sample code i need because want store data this: genericlist<int> list; list.add(22);list.add(33); and also genericlist<string*> list; list.add(new string("asd")); list.add(new string("watta")); the problem if store <int> compiler said cannot delete non...

php - Can I set a POST variable before redirecting to a new page? -

possible duplicate: how post page using php header() function? for example, need redirect user different page upon error, want post value page well. you cannot post , redirect in same time. redirect means setting several http headers. however, there several solutions needs. one store data $_session , retrieve there, answered above. another way put form aside php, in separate file , include if have errors in data posted, have variables in current post without need redirect user (and set error message in form too). you can think use ajax make post , result you'll redirection using javascript. or, if there aren't many variables/values want pass may use when doing redirection. i'm sure other alternatives exists too.

ruby - How do I grab this value from Nokogiri? -

say have: <div class="amt" id="displayfare-1_69-61-0" style=""> <div class="per">per person</div> <div class="per" id="showtotalsubindex-1_69-61-0" style="">total $334</div> $293 </div> i want grab $334 . have "total $" id showtotalsubindex... dynamic can't use that. you can use nokogiri xpath expression iterate on div nodes , scan string 'total $' prefix this require 'rubygems' require 'nokogiri' doc = nokogiri::xml.parse( open( "test.xml" )) doc.xpath("//div/text()").each{ |t| tmp = t.to_str.strip puts tmp[7..-1] if tmp.index('total $') == 0 }

vb.net - Importing B.exe into A.exe an then run B.exe from A.exe -

i using visual basic 2008 , have question it? i have a.exe , b.exe ( a.exe vbapp , , b.exe executable file ). possible include b.exe a.exe , running a.exe ? by, example, importing b.exe vbproject , running without extracting it. the question bit vague, can along lines, in several different ways. first, can compile separate exe (i'll call exea) vb project (call exeb). when user runs exeb, extracts resource containing exea, saves file (likely temp folder or someplace write rights) , shells exea. another possibility compile external functionality dll, call dlla, compile dll vb project (call exeb). when user runs exeb, extracts resource containing dlla, storing memory stream, uses assembly.load load dll memory stream (instead of file), , @ point can create objects dll, , use normal. in both these cases though, it's better compile second exe or dll , include both in msi installation project. more details in question might narrow down other possible ...

Rendering HTML-Content in Atom Feed with Rails atom_feed helper -

i've got problems (fairly undocumented) atom_feed helper. i'ld love this: for blogpost in @blogposts feed.entry(blogpost) |entry| entry.title(blogpost.title) entry.content(render :partial => '...', :object => blogpost), :type => 'html') end end but doesn't seem work , have no idea how render html instead of inline text! let's make example: entry.content (<div style=" ... "> + article.body + </div> + <div style=" ... "> + <img src=" + article.img.url + ..... ) writing , styling content directly in index.atom.builder annoying. isn't there way render html-partial in context? could me. thanks allot pascalturbo i did , put findings post, see here: http://www.communityguides.eu/articles/14 a simple version this, there more in link: app/views/articles/index.atom.builder atom_feed |feed| feed.title "title" feed.updated @articles.first.create...

iphone - Is there a way to move my imageview with the move of the slider thumb? -

i want move imageview user slide thumb of uislider , image view should have value of slider. 1 have idea this?? here's code snippets: -(void)addsliderx:frame andminimumvalue:(int)min andmaximumvalue:(int)max andslidervalue:(int)value{ cgrect frame1 = cgrectfromstring(frame); statslider = [[uislider alloc]initwithframe:frame1]; [statslider setminimumtrackimage:[[uiimage imagenamed:@"greenslider.png"] stretchableimagewithleftcapwidth:10.0 topcapheight:10.0] forstate:uicontrolstatenormal]; [statslider setthumbimage:[uiimage imagenamed:@"sliderbar_greenthumb.png"] forstate:uicontrolstatenormal]; [statslider setminimumvalue:min]; [statslider setmaximumvalue:max]; statslider.continuous = yes; [statslider addtarget:self action:@selector(valuechanged:) forcontrolevents:uicontroleventvaluechanged]; [statslider addtarget:self action:@selector(sliderchanged:) forcontrolevents:uicontroleventtouchupinside]; //bubbleviewcontro...

c# - Groupby list within the list using LINQ -

i have 2 classes: class customer { public string name { get; set; } public string zipcode { get; set; } public list<order> orderlist { get; set; } } class order { public string ordernumber { get; set; } } using linq, want list of orders group zipcode. if zipcode "12121" has 10 customers , each has 2 orders should return me 1 zipcode list of 20 orders. i trying not able figure out whats wrong var orders = br.custorderlist .select(r => new { r.zipcode, r.name, r.orderlist }) .groupby(x => new { x.zipcode, x.orderlist}); any please? this should want: var orders = br.custorderlist .groupby(x => x.zipcode) .select(g => new { zipcode = g.key, orders = g.selectmany(x => x.orderlist) });

php - Getting list of products by category in Magento using SOAP-based API -

i need products belonging specific category in magento using web services api. tried method: $product_filter = array( 'category_ids' => array('eq' => '41') ); $product_templates = $magento_client -> call($magento_session, 'product.list'); but returns error. can assume it's because category_ids array, won't ever equal 1 specific value. i did research , found method called category.assignedproducts , tried: $product_templates = $magento_client -> call($magento_session, 'catalog_category.assignedproducts', array('41')); but returned 'access denied' error. went , looked @ sandbox of magneto , saw 'assigned products' has 3 options: 'remove', 'update', 'assign', , know admin system i'm linking has set access 'read-only'. i'm guessing we'd have check off 'assign' in list, give me more access want give. i retrieve of data...

xcode - get UIButton inside an UIScrollView absolute screen location -

it may dum question, can't find answer ... i have uiscrollview , inside number of uibuttons. when press button, want know screen location of button. if use button.frame gives me position inside uiscrollview, normal. how can find x , y relative screen of button pressed? thanks in advance. your objection right- instead, use - (cgpoint)convertpoint:(cgpoint)point toview:(uiview *)view from uiview, like [button.superview convertpoint:button.frame.origin toview:nil]; not tested, believe should work. see iphone - position of uiview within entire uiwindow

ssl - Restricting access to downlad URL's using public/private key / certificates -

how restrict access url's on site , allow client applications access these urls. putting in rest api request url , thinking use public/private key sort of aws s3 does. understanding still need need ssl certificate secure data during transfer. does seem right approach? unsure on how go generating keys on server side. coding in both rails , php. i going use query request authentication secure download urls. http://docs.amazonwebservices.com/awssimplequeueservice/latest/sqsdeveloperguide/index.html?query_queryauth.html

PHP and Regex if word found -

i'm looking perform strip of characters if word found in string, if word numbers matched regex perform strip actual numbers 0-9 or preg replace them nothing, btw numbers wrapped in "". best way put these 2 functions together? example if data man, numbers fun! "123abc" return man, numbers fun! "abc" if numbers isn't present ignored. i feel of answers here overcomplicated. maybe it's me, should need: if (stripos($str, 'numbers') !== false) { $str = preg_replace('/\d/', '', $str); } edit: if want numbers inside quotation marks, might able regex, i'd way: if (stripos($str, 'numbers') !== false) { $arr = explode('"', $str); ($i = 1; $i < count($arr); $i += 2) { $arr[$i] = preg_replace('/\d/', '', $arr[$i]); } $str = implode('"', $arr); }

Variable concatenated mysql query string runs fine in phpMyAdmin but not PHP in script -

updated 14/04/2011 still in trouble. reduced code simplest form. use if function check isset() checkbox, works fine. if checkbox checked concatenates string made of 2 parts. simple. if (isset($_post[testtype1])) { $filterquery .= "(testtype1 = '1'"; } $filterquery .= ") "; } when use mysql_fetch_assoc , echo info in $rows works. when view page source in google chrome says: invalid query: have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 1 ; if echo $filterquery displays correctly , when copy echoed string code mysql returns correct results: select * fdatav1 join ddatav1 on ddatav1.id = fdatav1.id (testtype1 = '1') i have tried casting $filterquery string well. no success. updated 12/04/2011 i still have problem, wasn't typo. see code below: $query = "select * fdatav1 join ddatav1 on ddatav1.id = fdatav1.id ";` $ortrigger = "";` func...

core audio - Can MPMoviePlayerController have volume programatically adjusted? -

i have mpmoveplayercontroller , custom slider (which not quite slider, has same purpose). considering "slider" can return float value need, how can change volume of played movie? so far i'v tried hacking mpvolumeview programmatically set value, w/o success. turns out [[mpmusicplayercontroller applicationmusicplayer] setvolume:<insert float here>]; works sound in app, mpmovieplayercontroller, if it's using main audio session. o, works on device, not simulator. more info here: http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/mpmusicplayercontroller_classreference/reference/reference.html

visual studio 2008 - Mobile application icon showin in low res instead of hi res -

we developed application windows mobile 6.5 devices has icon created icofx based on hi res .png. has icons 256x256 alpha transparency down lowest resolution , color depth possible. think covered possible combinations of resolutions , color depths (as some other windows icons did). when see .exe in windows seems use extremely low resolution , color depth large icon view on, doesn't make difference. on windows mobile device looks more or less not enough. we deploy app using .cab file. does know going on? as remember, png image used start screen icon . you need multiple images put inside single ico file exe icon. ico file need compiled resource inside exe.

javascript - How do I fade in a div by id if cookie=1? -

i have page few tabs. looking way if select tab 5 , cookie = 1 show tab6 otherwise show tab5. the code tabs is: jquery(".tabs a").click(function () { stringref = jquery(this).attr("href").split('#')[1]; jquery('.tab_content:not(#' + stringref + ')').hide(); jquery('.tab_content#' + stringref).fadein(); return false; }); i want tab number 5, if clicked , cookie=1 show tab6. code shows div5 or div6 if cookie 1 or null is: alreadyclosed = $.cookie(statecookiename); if (alreadyclosed != 1) { $div5.show(); $div6.hide(); } else { $div5.hide(); $div6.show(); } how add them together? assume should way say: if tab1.click , cookie = 1 show $div1 else tab1.click , cookie = null show $div2 the body looks like: <!-- buttons --> <ul id="boxes" class="tabs"> <li><a href="#div5">div 5</a></li> <li><a href="#div6"...

cocoa touch - reloadTable does nothing -

i have strange problem. have tableview , button switch modal view. after dismissing modal view, tableview shall reloaded. for testing made button calls [tableview reloaddata]. nothing happens... , there new data displayed. any tips nice ! my header: @interface mainviewcontroller : uiviewcontroller uitableviewdelegate,uitableviewdatasource,uipopovercontrollerdelegate> { uitableview *_tableview; uipopovercontroller *popovercontroller; } @property(nonatomic, retain) iboutlet uitableview *tableview; my m file: @synthesize tableview = _tableview; -(void) reload: (id) sender { [_tableview reloaddata]; nslog(@"reloaddata"); } well, solved problem. in modal view save data coredata. read data in init function of tableviewcontroller!! have readdata function included in viewwillappear , works great. [tableview reloaddata] had no new data display.

PHP Session not written after Output(echo or print_r on external ajax Call) -

i´m having serious trouble debugging particular problem , hope has clue i´m doing wrong. i have custom cms system working uses paragraphs building blocks updated using ajax(prototypejs) calls , functions parse html chunks in given order, clean them , save data in associative arrays in session variable. users log in, session created , can check session without problem in every page need it. system works directly on definitive websites, user can see updates on realtime , browse site normal user do, editing. so, nothing new here. here weird thing. enduser site on edit mode(admin user logged in): path "/" after logged status verified, function processes editable content , saves associative array session, starts javascript objects editing every paragraph. data saved, can use external script check if it´s there after php script ends.if load new page(new content), session gets updated new data) admin user modifies paragraph using inplaceeditor , html chunk send via ajax ...

Can I have a circular redirect in Grails? -

i'm trying redirect circularly in grails (no infinite redirect loop) , keep getting error: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.cannotredirectexception: cannot issue redirect(..) here. response has been committed either redirect or directly writing response. i trying redirect action on controller redirect back. wondering why grails not allowing this. //initial action , final redirect location def showstuff = { if (flash.neatstuff){ return render("found neat stuff") } else if (params.email) { return redirect(action:'getneatstuff',params:[email:params.email, emailonly:true]) } return render("unable find stuff, use param") } def getneatstuff = { flash.neatstuff = new date() if (params.emailonly){ redirect(action:'showstuff') } redirect(action:'someotherplace') } ok, had total brain fart....

PHP/MySQL Navigation Menu -

i'm trying create function hierarchical navigational menu bar. i want able have this... <ul id="navigation"> <li><a href="#">menu item 1</a></li> <li><a href="#">menu item 2</a></li> <ul> <li><a href="#">sub menu item 1</a></li> <li><a href="#">sub menu item 1</a></li> </ul> <li><a href="#">menu item 3</a></li> <li><a href="#">menu item 4</a></li> </ul> i'm using function, it's not working i'd to. it's showing main parent links, not child links. function build_navbar($pid,$sub=0) { global $db; $query = $db->simple_select("navbar", "*", "pid='".$pid."'", array("order_by" => "disporder")); $menu_build = "<...

Sql Server - Insufficient result space to convert uniqueidentifier value to char -

i getting below error when run sql query while copying data 1 table another, msg 8170, level 16, state 2, line 2 insufficient result space convert uniqueidentifier value char. my sql query is, insert dbo.cust_info ( uid, first_name, last_name ) select newid(), first_name, last_name dbo.tmp_cust_info my create table scripts are, create table [dbo].[cust_info]( [uid] [varchar](32) not null, [first_name] [varchar](100) null, [last_name] [varchar](100) null) create table [dbo].[tmp_cust_info]( [first_name] [varchar](100) null, [last_name] [varchar](100) null) i sure there problem newid() , if take out , replace string working. i appreciate help. in advance. a guid needs 36 characters (because of dashes). provide 32 character column. not enough, hence error.

html - Absolute Block Nested in Relative Block Appears Lower in IE8 -

ugh. really, hate cross-browser compatibility... i'm working on wordpress site client create popup box appears below item i'm hovering on (using custom shortcode). have top set 16px, , works fine in firefox. however, in ie8, appears lot further down. if set top "0", still appears below containing blog, instead of @ top of it. i have related issue, in font size in ie8 2 pixels smaller. there <sup></sup> tag before this, well, removing doesn't change much--the font size still smaller in ie8. here page: http://www.medicalmarcom.com/services/ every question mark along left side has popup appears when hovering on (kinda tooltip). need make work in ff, ie, safari, , chrome. 1 doesn't work in ie. thankfully, didn't mention ie6, i'm not worrying unless singles out. here html: <span class="questions"><sup>( <div class="popup_content"><span class="popup">?</span> <div cla...

Including a lightbox slideshow on a Drupal Views Page -

i'm creating page consists of pieces of equipment. each equipment has 2-5 images uploaded. i'm making listing of of these , display follows: title 1 overview slider of image thumbnails -- click see full sized image --- title 2 overview slider of image thumbnails -- click see full sized image etc. i assumed lightbox/views/imagecache/cck make easy, have not been able pull off. i'm having trouble coming right search terms. seems easy. help. create cck field in equipment called ( field_equip_images) . in number of values in settings, select 'unlimited' in view filter type equipment. select fields title, overview , images( field_equip_images ). in settings of images(field_equip_images) format @ bottom select lightbox2: thumbnail->full_sized_image

How would you design such a DSL in Ruby? -

i've read ruby great domain specific languages. in past few months i've been creating browser game, rpg type. @ point, want users able take , finish quests. quests killing x amount of mobs, killing raid boss, maybe gathering items , such. the whole process sounds intriguing , prone errors. thinking idea create dsl matter. way describe quests in simple language. don't have experience that. do think idea ? , if so, have advice/tutorials suggest ? if you're designing dsl, need take time thinking domain you're trying map language to. dsls removing repetitive boilerplate otherwise have write every task, focus on that. quests examples, common things see needing between quests? obviously, lot depend on how quests implemented "behind scenes" well. i can imagine quest looking though: qwest "retrieve grail" given_by :pope description "some hethan dragon took cup, go back!" condition "slay dragon" dragon...

java - What are the pros and cons of using webworks versus J2ME and vice versa in blackberry development? -

i have written basic applications using j2me , felt getting things done in terms of ui/ux night mare blackberry os 5. started playing around webworks , found better , faster keep getting told better stick j2me. 1 better choice? 1 limited in features other? rim support long term future? this decision made each application. how know html, javascript, , css? how device integration need? how graphics intensive application be? html et al have lower learning curve j2me , rim apis. missing of more functionality integrates deep phones abilities. have distinct advantage in find missing in webworks libraries, can write javascript extension in java. webworks limited blackberry platform, html, javascript, , css practically universal . it's simple turn application work in web browser. take out javascript calls blackberry.* apis (or wrap use in blocks if (blackberry) { ), , redirect in xmlhttprequest proxied through on local server. i'm doing way playbook app i'm worki...

c++ - sqrt() pow() fabs() do not work -

i trying compile program using functions sqrt pow , fabs. have math.h included reason errors like: error c2668: 'fabs' : ambiguous call overloaded function same rest of functions have included: #include "stdafx.h" #include "math.h" i tried including still same errors. know why not being recognized? file .cpp not .c mfc project. thanks it's because functions overloaded several types: float, double , long double. thus, if pass in integer, compiler doesn't 1 choose. easy fix pass double (or multiply pass in 1.0), should fix problem. int value = rand(); int result1 = (int)fabs(value*1.0); printf("%d, %d\n", result1, result1); otherwise: int value = rand(); int result1 = (int)fabs((double)value); printf("%d, %d\n", result1, result1);

c++ - Templates and dependency injection -

i have class template resourcemanager , intended used this: resourcemanager<image>* rm = resourcemanager<image>::instance(); image* img = rm->acquire("picture.jpg"); rm->release(img); i'd use dependency injection (pass resourcemanager parameter functions supposed use instead of having used globally), given it's template don't know how this. have suggestions? my game @ beginning of development , have 4 resource types ( image , font , animation , sound ) making single resourcemanager (i.e. not template) acquire function each type of resource not option. edit: clarifications. what i'm looking not how dependency injection one type of resourcemanager, of them @ once. my gamestate objects need load resources when initialized/opened; through resourcemanagers . however, gamestates may need load number of types of resources: animations, fonts, images, sounds, etc — that's lot of function parameters each kind of resou...

Force.com email service -

i have created email service in force.com.can me out of how use thta in apex classes.say,i wanna send mail when user registration successful?? many thanks, sandhya krishnan i assume want send email directly apex code, either in trigger or page controller ... ? if so, page can started: http://www.forcetree.com/2009/07/sending-email-from-your-apex-class.html clearly don't want hard-code email template classes, make sure read @ least through part shows how template dynamically. should enough on way.

Select all empty tables in SQL Server -

is possible list sql server of tables in data base not have records in them? on sql server 2005 , up, can use this: ;with tablerows ( select sum(row_count) [rowcount], object_name(object_id) tablename sys.dm_db_partition_stats index_id = 0 or index_id = 1 group object_id ) select * tablerows [rowcount] = 0 the inner select in cte (common table expression) calculates number of rows each table , groups them table ( object_id ), , outer select cte grabs rows (tables) have total number of rows equal zero.

c# - Why stored procedure result is zero? -

work on c# vs 2008. have stored procedure in sql server 2005. using linq-to-sql execute stored procedure, result zero. when run query in sql server it's work fine exec spgetinvoicebydate '03/01/2011 00:00:00 am','03/31/2011 11:59:59 pm' above syntax works fine. here sql server stored procedure create procedure [spgetinvoicebydate] @beginning_date datetime, @ending_date datetime begin select * #temp1 ( select convert(varchar, manifestport.startdate, 1)+'-'+case dbo.manifestport.enddate when '1800-01-01 00:00:00.000' 'n/a' else convert(varchar, manifestport.enddate, 1) end [date], manifest.vesselname, manifest.voyageno, dischargeport.portname , manifestport.terminal, count(seal.containerno) totalcontainers, 0 totalhours, 0 totalfee manifestport inner join manifest on manifestport.manifestno = manifest.manifestno inner join dischargeport on manifestport.portcode = dischargeport.portcode inner join seal on manif...

ajax - Detect Enter key is pressed with jquery -

i have text field showing value. want when user writes new value in text field , presses enter, ajax function triggered pagination operation. have text field this: <input type="text" id="page" name="page" value="<?php echo($this->pn);?> /> and when user writes new value , presses enter, want following ajax function triggered: update_ajax2({rpp:<?php echo($this->rpp);?>,pn:document.page.paged.value,filter:'<?php echo($this->filter);?>',orderby:'<?php echo($this->orderby);?>'}); i tried using keypress event detect if(e.which===13) doesn't solve problem. can guide me? <input type="text" id="txt"/> $('#txt').keydown(function (e){ if(e.keycode == 13){ alert('you pressed enter ^_^'); } }) on jsfiddle .

asp.net - Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server.? -

i have problem datagridvew i trying export data db excel fie it's small page there data grid view , button export : <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" datakeynames="sid" datasourceid="sqldatasource1" enablemodelvalidation="true"> <columns> <asp:boundfield datafield="sid" headertext="sid" insertvisible="false" readonly="true" sortexpression="sid" /> <asp:boundfield datafield="g1q1" headertext="g1q1" sortexpression="g1q1" /> <asp:boundfield datafield="g1q2" headertext="g1q2" sortexpression="g1q2...

select - How do I make an option tag selected by its value attribute in jQuery? -

<select id="cars" name="cars"> <option value="1">volvo</option> <option value="2">ferrari</option> <option value="3">mercedes</option> </select> i want make option value 2 (ferrari) selected. i'm kinda new jquery. tried following without success: var modelid = 2; jquery( "#cars" ).val( jquery( "#cars option[value=" + modelid + "]" ).val() ); set value using val function. $("#cars").val('2'); try out example .