Posts

Showing posts from September, 2012

jquery - Play sound when receiving a web chat message -

how can add simple sound when message arrives in web chat session jquery? i noticed on chat @ http://chat.stackoverflow.com , want emulate in own software. jplayer allows this, , avoid flash (with html5 <audio> tag). edit: drachenstern noted in comments, chat uses jplayer. code chat page: <div id="jplayer" style="position: absolute; top: 0px; left: 0px;"> <embed name="jqjp_flash_0" id="jqjp_flash_0" src= "http://or.sstatic.net/chat/jplayer.swf" width="0" height="0" bgcolor="#ffffff" quality="high" flashvars="id=jplayer&amp;fid=jqjp_flash_0&amp;vol=80" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage= "http://www.macromedia.com/go/getflashplayer" /> <div id="jqjp_force_0" style="text-indent: -9999px;"> 0.7310569109395146 </div> </...

java - Issue to call setMessage() on ProgressDialog -

i'm having issue creating progressdialog in oncreatedialog() method. code follows: dialog dialog; switch(id){ case connecting: dialog = new progressdialog(this); dialog.setmessage("connecting").settitle(""); return dialog; eclipse throws me error setmessage wouldn't valid method of type progressdialog, though expect there since documentation api8 (which use) says so. afaik instantiation should possible since progressdialog ihnerits dialog right? can me @ this? it's weird. you need change code to: dialog dialog; switch(id){ case connecting: dialog = new progressdialog(this); ((progressdialog)dialog).setmessage("connecting"); dialog.settitle(""); return dialog; alliteratively, can change dialog type progresssdialog if returning progresssdialog, doubt it.

c++ - Adding All Array Elements Together -

i wanted know how add of elements of float array , make sum float average;. have use loop or there way add element 0 1 2 3, etc.? you may use loop, or can use std::accumulate . #include <iostream> #include <numeric> int main() { float arr[17] = { 1, 2, 3, }; //sum array const float sum = std::accumulate(arr, arr+17, 0.0 ); std::cout << "sum: " << sum << "\n"; std::cout << "average: " << sum/17 << "\n"; }

iphone - Draw a 3x3 grid in Cocoa-Touch -

i plan on making main menu application contains 9 square boxes in 3x3 grid fashion. i appreciate if give me ideas on how create , if applicable tutorials/source code on how create effect. i recommend aqgridview . see examples, included.

mysql select statement result limit -

i have query: select id, name categories parent_id in ( select id categories top_main_place > 0 ) it selects child info (outer select) of parent nodes (inner select) the problem is: don't need have child nodes data, maximum 6 child nodes data per parent id how can reach result? btw, sorry poor english you should order outer query parent_id, give each row row number (resetting row number whenever parent_id changes) , filter out row row number greater 6, check out this question example , sql code.

graphics - DirectX10 Skydomes -

i'm trying implement skydome in directx10 having real problems trying find tutorial online how go this. looked through 4 pages of results got looking "directx10 skydomes" in search function. does here know of site/books/tutorials etc can me in production of creating semi-decent looking skydome? sdks directx, ogre3d , possibly scenix include demos sky-boxes , sky-domes. conceptually they're simple (use large inward facing hemisphere or box , move model camera (eye) position never move relative it). quick google yielded tutorial in ogre3d wiki goes more detail concept http://ogre3d.org/tikiwiki/tiki-index.php?page=basic+tutorial+3#sky steps are: 1. create large hemisphere model (flip normals have face inwards). 2. map "fish-eye" sky texture 3. load , render in directx non-lit shader (so no shading applied... sky texture).

c# - How do I progressively render a header before content in ASP.NET master pages? -

i have large slow asp.net site uses master pages. i've identified user have better experience if can see header , navigation while rest of page being generated/processed/loaded database. i've done simple tests , can response.write() followed response.flush() in page_load(), , iis use chunked encoding , send output browser while rest of page renders. i want same thing, send master page header , navigation. any pointers on how achieve this? using asp.net 4 , iis 7.5 edit if can give pointers on how change site use ajax without having change every page , link, i'd appreciate it. thanks! i suggest use control caching. asp.net provides native caching of pages , controls. see these links know more. asp.net caching: techniques , best practices http://msdn.microsoft.com/en-us/library/aa478965.aspx asp.net caching http://msdn.microsoft.com/en-us/library/xsbfdd8c(v=vs.100).aspx control caching as have mentioned, appears use page-caching. try u...

Returning a file to View/Download in ASP.NET MVC -

i'm encountering problem sending files stored in database user in asp.net mvc. want view listing 2 links, 1 view file , let mimetype sent browser determine how should handled, , other force download. if choose view file called somerandomfile.bak , browser doesn't have associated program open files of type, have no problem defaulting download behavior. however, if choose view file called somerandomfile.pdf or somerandomfile.jpg want file open. want keep download link off side can force download prompt regardless of file type. make sense? i have tried filestreamresult , works files, it's constructor doesn't accept filename default, unknown files assigned file name based on url (which not know extension give based on content type). if force file name specifying it, lose ability browser open file directly , download prompt. has else encountered this. these examples of i've tried far. //gives me download prompt. return file(document.data, document.content...

javascript - Working with livevalidation.js -

i using livevalidation.js (http://livevalidation.com/) validate form. this works having trouble getting need do. i have 2 fields "how many children" , "age of children" basically, need check presence of answer in "age of children" if "how many children" filled out. if have not filled out "how many children", not matter if "age of children" filled out. i know how check presence, don't know how check if other field filled out. any appreciated. if( numofchildren.presence( 'children here', { failuremessage: "supply come childrens!" } ) == true && ageofchildren.presence( 'children have ages', { failuremessage: "no children!" } ) == true){ //do work }

Usage of _ in scala lambda functions -

can please explain me why can do: a.mapvalues(_.size) instead of a.mapvalues(x => x.size) but can't do a.groupby(_) instead of a.groupby(x => x) it isn't easy see here: a.groupby(_) but it's easier see in this: a.mkstring("<", _, ">") i'm partially applying method/function. i'm applying parameters (the first , last), , leaving second parameter unapplied, i'm getting new function this: x => a.mkstring("<", x, ">") the first example special case sole parameter partially applied. when use underscore on expression, however, stands positional parameters in anonymous function. a.mapvalues(_.size) a.mapvalues(x => x.size) it easy confused, because both result in anonymous function. in fact, there's third underscore used convert method method value (which anonymous function), such as: a.groupby _

javascript - In Safari and I think also IE7 and 8 Math.random() is NOT random? -

http://koreanwordgame.com/ this page first loads 4 words options divs via ajax , randomizes correct answer following function, passing div containing elements randomized argument: var random = function(r){ r.children().sort(function(a,b){ var temp = parseint( math.random()*10 ); return( temp%2 ); }).appendto(r); }; random($("#option")); <div id="option"> <div class="option" id="option1" style="background-color: rgb(229, 232, 238); ">light</div> <div class="option" id="option4" style="background-color: rgb(183, 190, 204); ">pot</div> <div class="option" id="option2" style="background-color: rgb(183, 190, 204); ">garlic press</div> <div class="option" id="option3" style="background-color: rgb(183, 190, 204); ">habitant</div> </div> the problem i...

Printing lines in python -

how can print lines in python this print " text here text here text here line here" i trying cgi, dont have use print each line have print thanks use triple quoted strings print( """ can print multi-line """)

vbscript - Keep Windows Script in same Command Window -

i have following script following on virtuozzo hardware node. : running ves : prompt veid : established connections on port 3389 specified veid : prompt ip block : create ip security policy block specified ip : reset terminal sessions so works way want except can't figure out how have occur in single cmd prompt rather spawning new command prompts. if remove cmd /k exec commands nothing displayed. missing simple? set oshell = createobject ("wscript.shell") getrunningvelistcmd = "cmd /k echo 'list running ves' & vzlist -a | find ""running""" getrunningvelist = oshell.run (getrunningvelistcmd,1,false) strveid = inputbox("enter veid","enter veid") whosethebrutecmd = "cmd /k echo 'whose brute' & vzctl exec "&strveid & " netstat -ano | find "":3389""" whosethebrute = oshell.run (whosethebrutecmd,1,false) strip = inputbox("enter ip address...

iphone - 3D Door Open Animation between two UIViewControllers -

this has been asked before, there no sample code found on stackoverflow , no proper solutions far i'm aware. have solution, looks crap. i'd grateful input , modifications more realistic 3d door open / book cover animation. aim have animation between uiviewcontrollers effect if opening door or book cover. viewcontroller 2 static , in background. above place viewcontroller 1 covers viewcontroller 2. animation open viewcontroller 1 (like hardcover book) , reveal viewcontroller 2 (your first page say, or whatever behind door). first thing note can't uinavigationcontroller difficult overwrite custom animations. proper tutorial on how set our 2 viewcontrollers can found here: viewcontroller animations so once setup, here custom animation looks crap. looks if squeezing door / cover of book left. there no 3d feel it, i'm afraid. suggestions of how make better welcome: -(void)opendoorto:(uiviewcontroller *)acontroller duration:(float)aduration { [acontroller vi...

multithreading - multi threaded FastCGI App -

i want write fastcgi app should handle multiple simultaneous requests using threads. had @ threaded.c sample comes sdk: #define thread_count 20 static int counts[thread_count]; static void *doit(void *a) { int rc, i, thread_id = (int)a; pid_t pid = getpid(); fcgx_request request; char *server_name; fcgx_initrequest(&request, 0, 0); (;;) { static pthread_mutex_t accept_mutex = pthread_mutex_initializer; static pthread_mutex_t counts_mutex = pthread_mutex_initializer; /* platforms require accept() serialization, don't.. */ pthread_mutex_lock(&accept_mutex); rc = fcgx_accept_r(&request); pthread_mutex_unlock(&accept_mutex); if (rc < 0) break; server_name = fcgx_getparam("server_name", request.envp); fcgx_fprintf(request.out,… … fcgx_finish_r(&request); } return null; } int main(void) { int i; ...

Node.JS WebSocket and Socket -

i want mix 2 streams of ordinary socket , websocket. received socket messages should broadcasted on websocket connected users. i have part of code: var net = require('net'); var io = require('socket.io').listen(13673, 'localhost'); net.createserver(function (stream) { stream.setencoding('utf8'); stream.on('data', function (data) { // here should ws broadcast console.log(data); }); }).listen(24768); io.sockets.on('connection', function (socket) { socket.on('message', function (text) { var message = { 'type': 'message', 'received': new date(), 'text': text }; socket.broadcast.json.send([message]); socket.json.send([message]); }); }); so, apart works fine, want listen normal socket time , process received messages websocket. put 1 other doesn't work. try keeping array of connected websocket clients, , when receive tcp socket ...

objective c - Does detachNewThreadSelector work any different than NSThread performSelectorInBackground or NSThread alloc/init then [thread start] -

does detachnewthreadselector work different performselectorinbackground ? in project use lot of this: [self performselectorinbackground:@selector(startimagedownloads:) withobject:[nsnumber numberwithint:datatype]]; but doing different: [nsthread detachnewthreadselector:@selector(startimagedownloads:) totarget:self withobject:[nsnumber numberwithint:datatype]]; and also, besides being able access thread object imgdlthread , alloc/init'ing thread start ing work different first 2: nsthread *imgdlthread = [[nsthread alloc] initwithtarget:self selector:@selector(startimagedownloads:) object:[nsnumber numberwithint:datatype]]; [imgdlthread start]; thanks! edit: just realized there's several answers on difference (or lack of) between performselectorinbackground , detachnewthreadselector , guess question is: is allocating , initializing nsthread calling [thread start] different first 2? the difference between third method , first 2 memory managemen...

css - Auto expanding side column -

Image
i building webpage , has div tag called content has css property of min-height: 200px; want put in div tag height of 100%, however, not work. want automatically grow looks nice when content gets larger. unsure how this. any appreciated, want xhtml strict , css3 compatible. trying this: -they gray side bar, wanted do, added in paint, rest have done css3. i understood issue height: 100% here how using css: here is: <html> <head> <style type="text/css"> body{ background-color: #cbf; } #wrap { border-radius: 20px; margin: 10px auto; overflow: hidden; width: 900px; } #head { text-align: center; background-color: red; height: 100px; overflow: hidden; } #main { float: left; background-color: gray; min-height: 200px; } #sidebar { width:200px; float: left; background-color: gray; ...

c# - What data retrieval method is good if I don't know schema of database? -

i retrieving tables, , make sql. want can handle take, skip. differences between databases. skip/take/similar mapper functions... if don't know schema can't have model map to, really. ultimately, then, suspect you're looking @ more general tools sql , datatable (storing data unknown schema 1 of few uses have datatable). won't have skip/take, databases have sql way of doing (for example, row-number in sql server).

windows phone 7 appstore? -

i new windows mobile.is microsoft's http://marketplace.windowsphone.com/ enough applications windows phone 7 os?i have heard windows phone 7 os differed windows mobile 6.5 os.can download apps both same app store?the application developed previous versions run in windows mobile phone 7? the development , software wp7 separate wm6.5 , earlier: "back end code" can considered equivalent - wp7 uses version of compact framework but wp7 more closed/controlled/managed environment. and ui layers wp7 different wm6 - wp7 silverlight , xna, wm6 "winforms" for getting started on wp7 see - http://create.msdn.com while both wm6 , wp7 app stores both managed through http://create.msdn.com marketplaces separate entities - apps 6 cannot used on 7, , apps on 7 cannot used on 6...

feeds - Integrating Ads in my Android application -

i integrate text advertisements in android application. i know how can listen feeds , display on textview. please help. you can use of ads networks. provide own api, need integrate them: smaato.com mobclix.com admob.com and can google others.

sql - MySQL - Update siblings with same key -

couldn't find solution yet... although newbie question, haven't been able overcome... hope can give hand. i have mysql table has: blockquote col1 col2 row1 null row2 a1 row3 null row4 b null row5 b b1 etc > blockquote how construct sql update update col2, values on col2 replace null, ie, c2r1 , c2r3 gets a1, , c2r4 gets b1 ? you can calculate required values follows: create temporary table yourtemptable select yourtable.col1, t1.col2 yourtable join ( select col1, max(col2) col2 yourtable group col1 ) t1 on yourtable.col1 = t1.col1 you can either drop/truncate original table , recreate using these values, or if can't drop table can instead perform multi-table update .

Django, adding excluded properties to the submitted modelform -

i've modelform , excluded 2 fields, create_date , created_by fields. "not null" error when using save() method because created_by empty. i've tried add user id form before save() method this: form.cleaned_data['created_by'] = 1 , form.cleaned_data['created_by_id'] = 1 . none of works. can explain me how can 'add' additional stuff submitted modelform save? class location(models.model): name = models.charfield(max_length = 100) created_by = models.foreignkey(user) create_date = models.datetimefield(auto_now=true) class locationform(forms.modelform): class meta: model = location exclude = ('created_by', 'create_date', ) since have excluded fields created_by , create_date in form, trying assign them through form.cleaned_data not make sense. here can do: if have view, can use form.save(commit=false) , set value of created_by def my_view(request): if request.metho...

event handling - jquery div overlay flickers on hover -

i'm using cycle plugin , i'm trying add overlay on top of slides "want see more" my overlay working i'm getting event propagation issue. hover , overlay div flickers in , out. can overlay stop flickering when hover can't disappear when hover out. stays was. can clarify i'm doing wrong? here's jquery: var portfolioslider = $('.portfolio-slider'); var portfolioimage = $('.portfolio-slider img'); portfolioslider.cycle({ fx: "fade", delay: 1000, timeout: 10000, pager: ".slider-nav div", pagerevent: "click", activepagerclass: "activeslide" }); portfolioslider.hover(function() { $(".overlay").css('cursor','pointer').fadein('fast',function() { }) }, function() { $(".overlay").css('cursor','pointer').fadeout('fast',function() { }) }); here's html: <div class="slider-...

playframework - Recursive blocks in Scala Play Framework templates -

i'm writing template blog post, has threaded comments. natural way of writing template threaded comments use recursive way constructing html. this: @showcomment(comment: models.comment) = { <div class="comment"> <div class="comment-metadata"> <span class="comment-author">by @comment.author,</span> <span class="comment-date"> @comment.postedat.format("dd mmm yy") </span> </div> <div class="comment-content"> <div class="about">detail: </div> @html(comment.content.replace("\n", "<br>")) </div> <a href="@action(controllers.application.replycomment(comment.id()))">reply</a> @comments filter { c => c.parent_id == comment.id } map { c => @showcomment(c) ...

ios - how to give an action for a button which should have different action for landscape and portrait? -

in project , have uibutton on view. when click on button smallview should load in main view landscape frame different , portrait frame different. suggestions helpful requirement you can orientation of device @ time calling: [[uidevice currentdevice] orientation]; in code can check , setup desired frame.

android - Native code - how to get function call stack (backtrace) programmatically -

i have c++ codebase running on android, , want have crash reports sent users. i'm using acra library works fine java code, when crashes in native code, don't enough information. i'd receive stack trace of native function calls. know crash info printed logcat after process ends, , can configure acra read/send logcat. i've setup code detect native crash using signal handlers , calling java reporting acra. works fine. however there's bad timing approach - acra reads logs while crashing process still alive, , android (don't know part) writes crash report logcat after crashed process ends. don't receive stack traces when using acra. so i'm looking way programatically read current stack trace c++ code, , feed info acra (or maybe other crash reporting tool) myself. all need kind of report written logcat: 10-10 08:29:13.868: info/debug(1121): #00 pc 0003fc7c /data/data/com.ex.lib/libapp.so 10-10 08:29:13.891: info/debug(1121): ...

Drupal 7: dynamic elements/tokens (logged in user's name) in basic page -

i'm looking simple , clean way create basic page shows this: hello $user, id: $userid $user , $userid should show respective values. want achieve drupal 7 without having to: enable php filter hack drupal core files (like http://drupal.org/node/1073886 do) use unstable modules (if possible) create new modules/code (if possible) thanks help! you creating view using views module: set logged in user argument. then can add user name , user id fields select not display them. add global text can insert user id , user name values in text using placeholders.

objective c - Programmatically mute the iPhone ringer -

possible duplicate: is possible programmatically mute iphone? is possible programmatically mute iphone ringer in way apple won't reject app? no. if not concerned apple's approval, can with avsystemcontroller

android - why is my gps getting "hung up?" -

i trying implement gps location listener stay on , continuously update in background. realize bad practice doing testing purposes. right have location listener gets called getgps(). can killed killgps(). it works when im walking around , click gps button takes latitude , longitude location parameter gpsactivity.getgps(); loc_listener = gpsactivity.loc_listener; locationmanager = (locationmanager) getsystemservice(location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider, 0, 0, loc_listener); location=locationmanager.getlastknownlocation(locationmanager.gps_provider); however in background, i'm still @ apartment though i've been out 3hours! why location listener not updating though turns on find new location every 10 mins? thanks package com.cellphone; import android.app.activity; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import a...

php - Load a Div from another page into another pages Div -

i'm trying this: load content of div on page but doesnt work me. , i'm not sure why. what im wanting is, have mobile site im working with, , want pull story content data thats on main sites div, , place on mobile sites content div way dont have edit anything. whatever gets published on main gets reflected on mobile. any ideas best way accomplish this? there way include in php or html takes targeted divs content , not else? if i'm reading correctly, need: $('#result').load('ajax/test.html #container'); this load page ajax/test.html, grab content of element id "container" , load current pages' element id "result". more info can found @ http://api.jquery.com/load/ edit : working code based on test files: <html> <head> <script src="http://code.jquery.com/jquery-git.js"></script> <script> $(document).ready(function(){ $('#resu...

how to test develop facebook app with google app engine on local machine -

is possible develop facebook using google app engine locally, without having upload application every time change it? i assume getting api error 191 when try access facebook api dev appserver? api error code: 191 api error description: specified url not owned application error message: redirect_uri not owned application. if developing on localhost, can set 'site domain' field in facebook app settings (appname).appspot.com , edit hosts file on system. in environment entered: 127.0.0.1 devlocal.(appname).appspot.com as long browser's url matches *.(appname).appspot.com , work.

Android access to front camera on HTC Thunderbolt -

i need access front camera on htc thunderbolt within application (as standard camera object). can developers point me in right direction? htc has released jar accessing front camera on evo, doesn't work when compile against that. can specify camera.open(0) or camera.open(1) front or camera? http://developer.android.com/reference/android/hardware/camera.html#open(int )

sql - How can I get the best Hierarchical Query performance in oracle -

i have table reply of structure following: id name parent_id ... 1 reply1 0 2 reply2 1 3 reply3 2 4 reply4 3 5 reply5 4 this table constructed on hierarchical relationship(sort of parent->child), how can sub replies according id of 1 replies ? want use 1 sql accomplish best performance. because volume of replies huge , 1 tree have more 1000 rows. i tried use start , connect by, came little poor performance. appendix: my rusty sql: select * reply start (parent_id=0 , id=?) connect prior id=parent_id both id , parent_id being indexed, "connect by" statement seems expensive, , causes high cpu utilization on database side if multple "connect by" sql runs @ same time. example: 30 threads: takes 30 minuts on executing single query without actual explain plan can guess. i think index on parent_id not helping here since "trees" start root 0. make index composite -- ie: (parent_id, id...

android - Rendering a button over SurfaceView -

i've been looking on google on how this, i've gathered it's not easy 123 because surface view draw above it, solution people have said use xml layout , make layout , add surface view child , button child that. i'm lost on i'd love see code on how (i prefer looking @ examples , trial , error learning). my xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <framelayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <button android:id="@+id/menu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="menu" /> <android.game.gameview android:layout_width="fill_parent" andr...

makefile - Android.mk vs Application.mk -

i'm little fuzzy use of android.mk & application.mk i've tried reading application-mk.html & android-mk.html in documentation comes ndk , still confused purpose of two makefiles. i'll grateful me understand this. each module requires 1 , 1 android.mk. if ever have 1 module in native application, application.mk redundant (however there few things can controlled application.mk if veer default behavior). however, if have many modules, ergo many android.mk files in project, application.mk can useful providing application-wide settings apply modules.

string - Printing Out Characters in Ada -

i have these declared: subtype num_char natural range 1 .. definitions.page_width + 1; subtype number_of_rows definitions.number_of_rows; type chars array (number_of_rows, num_char) of character; the_chars : chars; what best way print out screen using ada.text_io.put_line()? assuming want use ada.text_io , not put_line specifically, , assuming number_of_rows meant integer range num_char , be for r in the_chars'range (1) loop c in the_chars'range (2) loop ada.text_io.put (the_chars (r, c)); end loop; ada.text_io.new_line; end loop;

Javascript Uncaught SyntaxError: Unexpected identifier error in Chrome debugger -

i adapting xmlhttprequest this tutorial : var request = new xmlhttprequest(); request.open('get', 'http://www.mozilla.org/', true); request.onreadystatechange = function (aevt) { if (request.readystate == 4) { if (request.status == 200) console.log(request.responsetext) else console.log('error', request.statustext); } }; request.send(null); my code is: var xhr = new xmlhttprequest(); xhr.open("post", "http://ting-1.appspot.com/submithandlertest", true); xhr.onreadystatechange = function (aevt) { if (xhr.readystate == 4) { if (xhr.status == 200) console.log("request 200-ok"); chrome.browseraction.setbadgetext ( { text: "done" } ); else console.log("connection error"); chrome.browseraction.setbadgetext ( { text: "err" } ); settimeout(function () { chrome.browseraction.setbadgetext(...

linux - How to test a cron job? -

i'm using ubuntu linux 10.0.4. want run script every 6 hours, every day. when issue sudo crontab -e , see: # m h dom mon dow command * 00,06,12,18 * * * /opt/scripts/selenium/run_nis_inf_tests.sh however, i'm not seeing expected outcome script, , i'm not sure if running. there way test, short of waiting until specified time, script running properly. or, how can view errors script generating? - dave you can update mailto variable email address, , cron should email stdout , stderr output. check syslog file /var/log/messages see if script being executed cron. -tony

.net - ASP.NET Application variable vs reading from ConfigurationSettings.AppSettings -

there similar question posted @ application variable vs web.config variable , mine different , i'm not convinced answer there. so, if define application variable in global.asax this: public class global : system.web.httpapplication { public static readonly string x = configurationsettings.appsettings["xsltexternal"]; // rest of code here } shouldn't read operation string y = global.x; be faster than string y = configurationsettings.appsettings["xsltexternal"]; because of avoiding hashtable lookup (presuming that's how asp.net stores web.config settings)? application uses tons of config settings , checks throughout page cycle i'm hoping take advantage of every single ms can save. thoughts anybody? ps: initial simple-test-page ants profiler test shows read time dropping 0.017 ms .002 ms. i yes, faster, try keep global class clean possible. in implementations put configuration items on separate class static c...

Octave while/for statement -- what's wrong in a code? -

this octave code k= 1:10 while ( p < 1 ) ceil(log2(k)) + 1/(1-(1-p)^k) %function p = p + sens; k endwhile; endfor k and here output: ans = 10.000 k = 1 ans = 5.0000 k = 1 ans = 3.3333 k = 1 ans = 2.5000 k = 1 ans = 2 k = 1 ans = 1.6667 k = 1 ans = 1.4286 k = 1 ans = 1.2500 k = 1 ans = 1.1111 k = 1 ans = 1 k = 1 k = 10 so, can see -- in inner while statement value of k fixed 1. supposed vary value between 1 , 10. why not working? have no idea why inner while statement proceed once. answer: there should p= initial_value after for k= ... [even if find answer question yourself, should put in answer , accept it, question "officially" solved. have commented don't have enough reputation here] answer: there should p= initial_value after for k=... is, this: for k= 1:10 p=somevalue; while ( p < 1 ) ...

drupal - How activate Privatemsg Module to all users? -

i enabled privatemsg module in drupal 6. enable module users, join in website. registered users cannot see "write new message , messages" link. why privatemsg not active in users section ? go http://yoursite.com/admin/user/permissions , set permissions want privatemsg module authenticated user role (or whatever role you're trying enable for).

javascript - Finding a div in my SharePoint 2010 Web Part -

i have web part dynamically inserts div tags written in vs2010 using c#. want implement mouseover events these div's. when web part deployed onto sp2010, javascript not able find these div's when search them control id have specified. when checked page source, found tags ct100_m_g_ prefixed control id have specified. how can guess these ids? the ctlxxx stuff automatically prepended control's id asp.net, generate client id. if want set deterministic client id, can set clientid property instead of id property. see http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx

jquery - JsTree .get_checked function doesn't work... help....? -

i'm using jstree , checkbox plugin, couldn't managed pick nodes selected (checked), read in jstree documentation event .get_checked, not know how implement it, neither place put it, if within function data loaded or not, don't understand when event works, ie not know if event executed each time node checked or have array filled every time node chcked... please me ... truth i'm lost , not know how that. here's jscript code, load of data fine, get_checked function doesn't work... $(function () { $("#demo2") .jstree({ plugins: ["themes", "json_data", "checkbox", "crrm"], "json_data": { "ajax": { "type": "post", "url": "/ubicacion/arbol/", "data": function (n) { return { id: n.attr ? n.attr("id") ...

logging - How Can I Detect Changes To A Text File During The Execution Of A Python Script? -

i working temperamental web app i'm not going name. runs problems time time, , when does, writes stack traces , error messages exception.log file. want know these problems in timely manner, i've got python script scans log regularly (hooray cron). if size of exception.log greater zero, script dumps contents of file email me, moves them exception_archive.log . current tactic read in file, send email , write exception archive if necessary, , if both of steps successful, just target = open(target_log, 'w') target.close() to zorch original log. however, since can't predict when system write exception.log , there @ least 1 point in script lose data - system write log after i've read existing data , decided overwrite file. also, have learned painful experience if exception.log not exist, temperamental web app not recreate - it'll drop exception data on floor. naïve solution of "rename , re-create log file" pushes problem down layer. the core ...

php - How can I have MySQL and JS add numerous users into a html div and be able to delete them? -

Image
the program below lets user click on name in drop down list , once user clicks name ajax uses php script grab user info mysql db , displays under drop down... however info 1 person can displayed @ once...how can let user add many people want clicking names in drop down? dont want users have been chosen show in list want user able delete people have chosen , deleted user should appear in drop down list...there picture of how works, trying when user clicks name adds person's name , info div, when choose person adds person div well. people in div should not show in drop down list unless deleted.. html part <html> <head> <script type="text/javascript"> function showuser(str) { if (str=="") { document.getelementbyid("txthint").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject(...

Facebook APIs: Anyway to see when a page was created? -

has facebook ever provided way ascertain when page created either through graph api, legacy api, or fql? can't seem find it. no, creation date of page isn't exposed anywhere in api

java - Custom class loader for loading dll in applet -

to address .dll file loading/unloading issue applets. loading, following this tutorial , .dll files using custom class loader : 1- class loader (copied tutorial ) public class customclassloader extends classloader { private static final string class_name = customclassloader.class.getname(); private map<string, class<?>> classes; public customclassloader() { super(customclassloader.class.getclassloader()); classes = new hashmap<string, class<?>>(); } public string tostring() { return customclassloader.class.getname(); } @override public class<?> findclass(string name) throws classnotfoundexception { if (classes.containskey(name)) { return classes.get(name); } string path = name.replace('.', file.separatorchar) + ".class"; byte[] b = null; try { b = loadclassdata(path); } catch (ioexception e) { ...

java - Is performance of "Math.abs()" better than expression with "if"? -

i have expression: double getabs(double value){ return value> 0 ? value: value== 0 ? null : -value; } or better: double getabs(double value){ return math.abs(value); } i understand there differences nan. method math.abs(double) - have unboxing. in case performance better? the "performance" in code jvm need unbox double double . math.abs(double) uses ternary if statement follows: public static double abs(double a) { return (a <= 0.0d) ? 0.0d - : a; } so, if statement no performance worry @ all.

c++ - std::string to LPOLESTR -

i have array of strings this: using std::string; string myarray[] = { string("abc"), string("foo"), string("muh") }; now want use function: hresult init(t* begin, t* end, iunknown* punk, ccomenumflags flags = atlflagnocopy ); t in case lpolestr. need convert array of std::string lpolestr respectively need lpolestr* begin , end of array. how done? thx in advance atl has set of macros string conversions. in case, can use: lpolestr olestr = a2ole(std_str.c_str()); note olestr wchar_t*, if you're using std::wstring (or wide char string literals) don't need macro: lpolestr olestr = std_wstr.c_str();

python - Print D-Bus introspection tree -

how can print out tree of available information on d-bus? *bus name * interface *method *signature * interface *method *signature *method *signature *bus name * interface *method *signature you can use dbus debugging tools dfeet see exposed on dbus in nice structured fashion.

javascript - getting the Width of an element without padding in Internet Explorer -

i want fit images on site size of containing element, have this: if (userhasmicrositephoto) { var width = $('micrositephotodiv').getcomputedsize().width; $('micrositephoto').src = "flash/userimage.ashx?type=micrositephoto&id=" + userid + "&width=" + width; } my handler file userimage.ashx returns image given id, scaled width given parameter. this works fine in firefox, chrome & co, doesn't work in internet explorer - image returned large. think because .getcomputedsize().width reports width includes size of padding (but on border or margin) in internet explorer, returns usable area in other browsers. result, width given internet explorer large. i can't find other fields accessable for .getcomputedsize() allows me find 'actual' width in internet explorer. tried using .getcomputedstyle() padding subtract total width, returns string, , styling micrositephotodiv element padding: 0.75em , doesn't wor...

AspectJ - pointcut with dynamic value -

is possible doing this? private static final string package = system.getproperty("packageprefix", "org.company_name"); @around("execution(* "+package+"..*.*(..)) && @annotation(validate)") unfortunately, no. not possible since compiler/weaver must know woven @ compile time. using compile time weaving, pointcuts may not change across restarts of application.

java - Dilemma with overloaded method selection -

public void testfunc(object o) { system.out.println("testfunc-object"); } public void testfunc(string s) { system.out.println("testfunc-string"); } both of these methods in test class. if invoke following method main method of test class, method invoked? test t = new test(); t.testfunc(null); in particular scenario, testfunc(string) called, why? appreciate help. testfunc(string s) gets invoked because runtime choose variant of testfunc specific argument. testfunc(string s) more specific testfunc(object o) because string subtype of object . peruse section 15.12.2.5 of jls explicit details.

PHP GD Library, rendering an image - saving the image or not (what is the most effective solution)? -

i have php script renders image image using php gd library. need know effective solution (what best way): 1.render image "on fly" this: <img src="createimage.php=id=1" /> or: 2.render/create image while uploading first image, , store in database? <img src="$image" /> please post link source if have :) it faster render/create image while uploading first image, , store not in database (!!!), but in filesystem !!! refrain using blobs purpose, unnecessary overhead. moreover, files easier backup huge database full of blobs. so second possibility right, use filesystem. i'd call technique "caching".

flash - Overwrite BlazeDS / FlexDataservice endpoint -

i'm using build in flex dataservice connect blazeds server. flex using *.fml file within model folder connection details, within file can find following: <annotation name="serviceconfig"> <item name="default_entity_package">valueobjects</item> <item name="contextroot">/mywebapp</item> <item name="rooturl">http://192.168.178.21:8080/mywebapp</item> <item name="linked_file"></item> <item name="absolute_endpoint">http://192.168.178.21:8080/mywebapp/messagebroker/amf</item> </annotation> the _super_database class created flex dataservice uses configuration setup remote object communications. i'm looking way overwrite settings within database class extends _super_database class. can assist? if want define channels , other remoteobject information @ run-time without specifying services-config file @ compile time; can use link ...

kinect - OpenNI RedistMaker - Build Fail on Mac OS -

i follow openni installation guide in readme here https://github.com/openni/openni . have installed libtool , libusb also. however, when run ./redistmaker under platform/linux-x86/createredist, got such error message: primesense openni redist * 2011-10-12 23:18:46 * ********************************* taking version... version 1.3.3.6 building openni... in file included ../../../../source/openni/ xndump.cpp:25: ../../../../include/xndump.h:167: warning: ‘warning’ attribute directive ignored ../../../../include/xndump.h:168: warning: ‘warning’ attribute directive ignored ../../../../include/xndump.h: 169: warning: ‘warning’ attribute directive ignored ../../../../ include/xndump.h:170: warning: ‘warning’ attribute directive ignored ../../../../include/xndump.h:171: warning: ‘warning’ attribute directive ignored ../../../../include/xndump.h:172: warning: ‘warning’ attribute directive ignored in file included ../../../../source/ openni/xndump.cpp:25: ../../../../include/x...

tree - ANTLR syntax error unexpected token: + -

hi have small problem in antlr tree grammar. using antlrworks 1.4. in parser grammar have rule this: declaration : 'variable' identifier ( ',' identifier)* ':' type ';' -> ^('variable' identifier type)+ so wanted 1 tree per each identifier. and in tree grammar left rewrite rules: declaration : ^('variable' identifier type)+ but when check grammar got syntax error unexpected token +. , + sign @ end of declaration rule in tree grammar. doing wrong? parser grammar works fine , builds ast tree expected. generated lexer , parser c# , test input. when parsing source: variable a, b, c : int; you're trying construct ast looks like: variable variable variable / | \ b c / | \ int int int but since 'variable' , type same token, see no need create duplicate nodes. why not do: declaration : 'variable' ide...

iphone - Method from a category throws an exception after upgrade to Xcode 4.2/iOS 5 -

i have category extends nsmutablearray shuffle method. category declared , implemented in .h file, included .pch file. worked fine on ios 3.xx , 4.xx. installed xcode 4.2 yesterday. recompiled app base sdk set 5.0 , deployment target 3.2 throws -[__nsarraym shuffle]: unrecognized selector sent instance ... i tried iphone 5.0 simulator, ipad 5.0 simulator, iphone 4g ios 5 - no difference. now, if move declaration/implementation .m class sends shuffle message implemented app runs fine. original .h imported - if copy code original .h .m compiler complains duplicate declaration. the upgrade xcode 4.2 caused compiler change gcc apple llvm. , llvm not implementation in .pch. extracting implementation .m file, importing original .h directly, compiling gcc solve problem.

internet explorer 8 - My Facebook Connect .php webpage works on Chrome, Firefox, IE9 but not on IE8. It shows up as a blank white screen -

i have app developed works in chrome, internet explorer 9, , mozilla no luck in internet explorer 8. without going through facebook, blank screen in internet explorer. strange if view page source, can see of source. in fb still same white screen. i using ie8. finding goes p3p policy. every site says place policy cookies can pass , session run. this link found. yes, these have been implemented. including honk hack fb uses on own site bypass ie 3rd party cookie security issue. yes, have done changed privacy settings no luck. does know what's wrong this? code looks this: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html id="facebook" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- start init facebook app --> <div id="fb-root"></div> <script src="http://connect.facebook.net/...

heap - Using arrow -> and dot . operators together in C -

i under impression possible access data sub-node of linked list or similar structure using arrow , dot operators so: typedef struct a{ int num; struct *left; struct *right; }tree; tree *sample; ... if(sample->left.num > sample->right.num) //do but when try implement this, using -> , . access data sub node error "request member num in not structure or union". use -> pointers; use . objects. in specific case want if (sample->left->num > sample->right->num) because of sample , sample->left , , sample->right pointers. if convert of pointers in pointed object; use . instead struct copyright; copyright = *(sample->right); // if (sample->left->num > copyright.num) if (*(sample->left).num > copyright.num)