Posts

Showing posts from March, 2010

php - How to get mod rewrite to change an url's symbol for display purposes? -

good day all, ive been wondering, google searching , goign greyer quicker thinking if possible mod rewrite change specific symbol grabs url else? i.e. if url www.website.com/foo-bar using rewriterule can hyphen become forward slash? <?php $foobar = "foo-bar"; ?> <a href="/<?php echo $foobar; ?>">foo-bar</a> .htacces code have.. rewriterule ^([^/]+)$ index.php?page=$1 [l] so mod rewrite make url display on addressbar www.website.com/foo/bar if possible? regards, dan. have @ this: http://forum.modrewrite.com/viewtopic.php?t=2799

c# - How to get unique key for any method invocation? -

i need generate 'hash' unique method invocation in project. example, have method string getsomestring(int someint) . so, need different hashes in cases: string getsomestring(1) -- key 1 string getsomestring(2) -- key 2 string getsomestring(3) -- key 3 how generate kind of hashes? upd: want log method execution unique hash each method invocation. this: public delegate t helperfactorymethod<t>(); public static logmethodexecution<t>(helperfactorymethod<t> factorymethod) t: class { string key = gethashstring(factorymethod); storetodatabase(key); ... } result example of gethashstring() must : list getsomeobjects(1, objecttype.simple) must 'listgetsomeobjects_1_objecttype.simple' or this. list getsomeobjects(2, objecttype.none) must 'listgetsomeobjects_2_objecttype.none' or this. you use hash function generete unique key parameter values. example: public string getsomestring(int someint) { md5cryptoservic...

scope - Python module visiable only in iPython -

i have used set pythonpath=%pythonpath%;dictionary_containing_modules make modules globaly visiable. i have script importing modules import my_module . when run script ipython shell ( run my_script.py ), no errors , script runs intended, when run script command promt (windows) python my_script.py error: importerror: no module named my_module i checked pwd use same working directory. remember can dynamically change system path within script, using sys.path or site module . maybe want add them script... or maybe want write bat or python launcher script sets pythonpath... or want edit windows environment variables (somewhere inside system properties win + break ).

visual studio 2008 - Where is the RemovePreviousVersions property in VS2008? -

can tell me exactly removepreviousversions property in setup project in visual studio 2008? feel i'm in twilight zone. select setupproject in solution explorer(view -> solution explorer) , open properties window (view -> properties window) , there it. :)

ios - AlertView to Pause Code -

this seems white elephant iphone. i've tried sorts, loops , can't make work. i have view loads table. i've moved object archiving , development purposes want have initial alertview asks if user wants use saved database or download fresh copy (void)showdbalert { uiactionsheet *alertdialogopen; alertdialogopen = [[uiactionsheet alloc] initwithtitle:@"downloaddb?" delegate:self cancelbuttontitle:@"use saved" destructivebuttontitle:@"download db" otherbuttontitles:nil]; [alertdialogopen showinview:self.view]; } i'm using actionsheet in instance. , have implemented protocol: @interface clubtableviewcontroller : uitableviewcontroller <uitableviewdelegate, uitableviewdatasource, uiactionsheetdelegate> based on run check button pressed: (void)actionsheet:(uiactionsheet *) actionsheet clickedbuttonatindex:(nsinte...

substring - Creating sub-directories using first 2 characters of a file name in a batch file -

i'm trying create batch file loop around list of jpgs/pngs in folder, , create sub-directories using first 2 characters of these image names. after creating sub-directories, move image correct sub folder. for example, abc.jpg , def.png create ab , de, , move abc.jpg ab , def.png de. the problem i'm having extracting first 2 characters , creating sub-directories. here relevant code have far: for %%a in (*.jpg,*.png) ( set _xx=%%a md %_xx:~0,2% ) [error / duplication handling, , file move has been removed clarity] echoing out variable _xx shows no value assigned it, echoing out %%a gives correct file name. running script creates 2 sub-directories called '2' , '~0' any suggestions? you need use setlocal enabledelayedexpansion at top of file, , instead of md %_xx:~0,2% use md !_xx:~0,2!

linux - How to write a path that include environment variables? -

i'm writing qt app runs in linux. need write file to: "$xdg_config_dirs/whatever"/ "$home/whatever" how resolve environment variables ## heading ##in code? using nothing plain library functions, use getenv() value of environment variables: const char *dirs = getenv("xdk_config_dirs"); this return null if variable not set in environment, make sure code handles case. you'll have "interpolation" of variable values rest of text yourself, in case. not sure if qt provides wrapper or more high-level can interpolation you, haven't worked qt.

Ways to implement data versioning in MongoDB -

can share thoughts how implement data versioning in mongodb. (i've asked similar question regarding cassandra . if have thoughts db better please share) suppose need version records in simple address book. (address book records stored flat json objects). expect history: will used infrequently will used @ once present in "time machine" fashion there won't more versions few hundred single record. history won't expire. i'm considering following approaches: create new object collection store history of records or changes records. store 1 object per version reference address book entry. such records looks follows: { '_id': 'new id', 'user': user_id, 'timestamp': timestamp, 'address_book_id': 'id of address book record' 'old_record': {'first_name': 'jon', 'last_name':'doe' ...} } this approach can modified store array of versions per document. seems sl...

postgresql - Ways to implement data versioning in PostreSQL -

can share thoughts how implement data versioning in postgresql. (i've asked similar question regarding cassandra , mongodb . if have thoughts db better please share) suppose need version records in simple address book. address book records stored in 1 table without relations simplicity. expect history: will used infrequently will used @ once present in "time machine" fashion there won't more versions few hundred single record. history won't expire. i'm considering following approaches: create new object table store history of records copy of schema of addressbook table , add timestamp , foreign key address book table. create kind of schema less table store changes address book records. such table consist of: addressbookid, timestamp, fieldname, value. way store changes records , wouldn't have keep history table , address book table in sync. create table store seralized (json) address book records or changes address book records. such t...

Communication between python client and java server -

my aim send message python socket java socket. did out on resource mentioned above. struggling make python client talk java server. because (end of line) in python different in java. say write python client: message 1: abcd message 2: efgh message 3: q (to quit) at java server: receive message 1:abcdefghq followed exception because python client had closed socket end. could please suggest solution consistent talk between java , python. reference used: http://www.prasannatech.net/2008/07/socket-programming-tutorial.html update : forgot add, working on tcp. my java code goes this:(server socket) string fromclient; serversocket server = new serversocket (5000); system.out.println ("tcpserver waiting client on port 5000"); while(true) { socket connected = server.accept(); system.out.println( " client"+" "+ connected.getinetaddress() +":"+connected.getport()+" connected "); bufferedreader infromclient = new...

How to close modal dialog in jquery -

i want close jquery dialog on click of button placed in dialog how should this? if using jquery ui dialog : $('#foo').dialog('close'); where foo id of dom element dialog has been attached to.

c++ - Qt - QProcess is not working -

i try launch internet explorer, use below code qprocess * process=new qprocess(this); qstring temp="c:\\program files\\internet\ explorer\\iexplore.exe"; process->startdetached(temp.tostdstring().c_str()); but doesn't work. try: qprocess * process=new qprocess(this); qstring temp="\"c:\\program files\\internet explorer\\iexplore.exe\""; process->startdetached(temp); you need use escaped quotes since path has space in it, or possibly escape spaces (you missed program\ files in code posted).

How do I see the how the JSON object is formatted? -

i have application sending me json object. want see how json data structure in javascript alert this. how can that? you can't develop in chrome/firefox ? @ changing this, coding 1 hand tied behind back. preferred method using chrome dev toolbar, here other ways. you can debug using browser based debugger, ie . you use json.stringifiy , alert output,the code here and there these viewers http://jsonviewer.stack.hu/ , jollydroll and can loop through different object properties : for(var propertyname in yourjson){ //will loop through different elements in json alert(yourjson[propertyname]); //will output valueof each element alert(propertyname); //will output name of each element }

email - PHP: generate file and RSA -

there 3 things need project. first of all, need php script generate text file. text file must contain string generated rsa key. what's best way generate hash using rsa keys on php? the second part need add icon file. file supposed used on mac, if icon worked windows , linux too. believe need set 1 icon mac , 1 windows , linux. how may set icon? the third thing must easiest one, need attach file , e-mail someone. how can without using temporary file? if it's not possible, how can using temporary file? thanks! create text file in php: http://www.tizag.com/phpt/filecreate.php rsa encryption in php: http://stevish.com/rsa-encryption-in-pure-php write text file in php: http://www.tizag.com/phpt/filewrite.php file icons: icon file has, best of knowledge, determined system/recipient reading file , system settings- cant manually set in php, though bow wider knowledge of community on one --if you've created text file, why not attach it? emailing via php ...

mysql - Social network - Privacy levels - database schema -

i creating user profiles , have few questions relating schema privacy levels: for profile details -> there multiple fields on facebook - birthday, gender, location, interests, relationships, user's full name etc. database point of view - how done? using mysql first thing can privacy levels work in mysql or need non relational db? then, assign privacy field level this: object table -> profile field 1, profile field 2,..... privacy lookup table -> friends = 1, friend of friend = 2, = 3, blocked list = 4,... user object table -> profile field 1 has privacy lookup 1 (which means field 2 set friends only)? the above works fixed list privacy level if have non list privacy levels example: want block person x, y & z , allow user named see it, there no fixed levels this, how represent @ schema level? this filed level privacy @ higher object level individual photos, individual videos, etc. general suggestions on db use / basic schema guide me on how design o...

What data type should I be using to represent Time (not dateTime) in an xsd/xml? -

i represent time in xsd. can current date + time. thanks these valid: xs:time xs:date xs:datetime pick whichever 1 appropriate you.

java - Hibernate Criteria - Novice Question II -

what best way add sql select part of criteria object? (i want add select myfunction distance can later order distance) cheers, rob from hibernate documentation : list results = session.createcriteria(cat.class) .setprojection( projections.projectionlist() .add( projections.rowcount(), "catcountbycolor" ) .add( projections.avg("weight"), "avgweight" ) .add( projections.max("weight"), "maxweight" ) .add( projections.groupproperty("color"), "color" ) ) .addorder( order.desc("catcountbycolor") ) .addorder( order.desc("avgweight") ) .list();

linux- windows cross c++ application -

i'm developing application has run on linux , windows. have object called obj want use in code , has different behavior on linux , windows. inherit aaa , called windowsobj windows object , linuxobj linux object. my question is: how use object in code? have write run both linux , windows? for swiching types use typedef like: typedef uint32_t dword; but have use objects? want write code: tr1::shared_ptr<windowsobj> windowsobj (new windowsobj(parameter)); tr1::shared_ptr<linuxobj> linuxobj (new linuxobj(parameter)); any idea? the same thing :) class _object { }; class windowsobject : public _object { }; class linuxobject public _object { }; #if defined(win32) typedef windowsobject object; #else typedef linuxobject object; #endif object myobject; edit: naturally, interface windowsobject , linuxobject expose must same. in example, _object abstract base-class defined interface, , linuxobject , windowsobject implement interface, hiding...

math - How to output a square wave on my soundcard -

i create digital (square) signal on sound card. works great if generate high frequencies. but, since can't output dc on sound card, lower frequencies resulting digital bits fade 0. this soundcards high pass square wave: http://www.electronics-tutorials.ws/filter/fil39.gif what's mathematical function of signal, that, when passed through high pass become square? ideally, solution demonstrated in gnuplot. the sound card cuts out low frequencies in waveform, need boost amount in pass it. a square wave contains many frequencies (see the section on fourier series here ). suspect easiest method of generating corrected square wave sum fourier series, boosting amplitudes of low frequency components compensate high-pass filter in sound card. in order work out how boost each low frequency component, first need measure response of high-pass filter in soundcard, outputting sine waves of various frequencies constant amplitude, , measuring each frequency ratio r(f) of...

Strange routing error in Rails 3.0.1 -

this irritates me right now, , i've been @ more hour. maybe 1 of has idea. i've defined following routes in routes.rb: resources :ads member post :preview_revision :revise end collection :search post :preview end end when run rake routes , preview_revision route shown correctly: preview_revision_ad post /ads/:id/preview_revision(.:format) {:action=>"preview_revision", :controller=>"ads"} however, when make post request /ads/145/preview_revision, following error: started post "/ads/145/preview_revision" 127.0.0.1 @ mon nov 15 17:45:51 +0100 2010 actioncontroller::routingerror (no route matches "/ads/145/preview_revision"): rendered /library/ruby/gems/1.8/gems/actionpack-3.0.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms) the id (145) exists, yes. the action , controller (action: preview_revision, controller: ads) exist well. all other...

javascript - jQuery / PHP - Lazy loading gallery keeps trying to fetch images even when they've all loaded -

i've got image gallery showing 1 image per row inside of div. don't want next image load until reaches edge of viewport (to save on server resources). images named sequentially in same folder (img/1.jpeg, img/2.jpeg, img/3.jpeg, ...). i'm using modified jquery plugin this, still keeps trying fetch next image after images in directory have been loaded. it's last if statement i'm having trouble here. how stop function running once last image in directory has loaded? <?php // count total number of images in directory $directory = "img/"; $totalimages = count(glob("" . $directory . "*.jpeg")); ?> <script type="text/javascript"> $('document').ready(function(){ scrollalert(); }); function scrollalert(){ var scrolltop=$('#scrollbox').attr('scrolltop'); var scrollheight=$('#scrollbox').attr('scrollheight'); var windowheight=$('#scrollbox').attr(...

c# - Handling write to disk requests from another program -

how can run program , able handle write disk requests program can't write without permission? possible c#? yes, can use our callbackfilter product track , control (modify or forbid) file operations performed or selected applications. callbackfilter provides .net api (as c++ , vcl apis). callbackfilter product of kind on market.

python - Problem when querying the database -

when do: channel = session.query(channel).options(eagerload("items")).filter(channel.title == title) i error: typeerror: 'bool' object not callable if rid of options(eagerload("items")) , it's working properly. any idea?? thanks in advance! sqlalchemy filtering works operator overloading on column objects. are, however, not referencing column object, value property of table. instead of channel.title == title which 'bool' object, need channel.c.title == title which yields slqalchemy specific object.

c - Invalidate or clip text -

i'm trying monitor mouse position on client area of window. example: wm_mousemove: { std::ostringstring oss; xpos = loword(lparam); ypos = hiword(lparam); oss << xpos << ", " << ypos; textout(hdc, 100, 100, oss.str().c_str(), oss.str().size()); } do need measure height, width of fonts area erase before drawing out new text? don't understand if need clipping redraw region or invalidate rect enough drawing text. every time draw text, use gettextextentpoint32 measure size of area written, , save somewhere. when try draw new, can pass rectangle based on value invalidaterect indicate desire erase, updatewindow make erasure happen immediately.

PHP: DATETIME help -

i know there's ample information datetimes on internet i'm having trouble using i've been seeing. i have calander control hooked text box. takes in form 15/11/2010 (british). use query datetime fields in sql server db in format 15/11/2010 00:00:00. after capture dates on postback pass values onto method attempts convert text time format. when query between 01/01/2010 , 01/07/2010 number of results. when change between 01/01/2010 , 30/10/2010 error. error invalid foreach (haven't caught error yet). i'm guessing formats? function getsupportticketsbysubissueanddate($subissueid, $from, $to){ $subissueid = $this->ms_escape_string($subissueid); $from = date("dd/mm/yy", strtotime($from)); $to = date("dd/mm/yy", strtotime($to)); $connection = new connections(); $conn = $connection->connecttowarehouse(); $atid = $_session['saveddata']['autotaskid']; $tsql = "select wh_task.task_id, wh_t...

asp.net mvc - Need advice on workflow of MVC project -

so new programming , working in c# , learning mvc. have undertaken first personal project put practice have been learning books/tutorials have been following. project typical store list products, has shopping cart, user account, admin site...etc. i have managed wire nhibernate mysql db, , posting records view. my question "where should start?". seems go lot of different directions, admin site manage site , products, getting products showing on site like, user accounts. advice of how "should" tackle each component? i leaning towards admin site since logically putting products in store comes before showing products on store. any advice appreciated. i concur @tod pick portion of website needed , build it. build model (include viewmodel), controller, , view. in case, chose start users. i created database , users table (no didn't use code first or ef) then created linq dbml file then created super simple repository talks linq clas...

C pointers, what am i doing wrong? -

i have no compilation errors, crashes on run-time, that's relevant code, first it's structs: #include <stdio.h> #include <string.h> #include <stdlib.h> struct gas_station *pgasstationhead = null; typedef struct gas_station { char *name; double octan95ss; double octan95fs; double octan98ss; double octan98fs; double gassoldtotal; double gassoldss; double gassoldfs; struct gas_station *pgasstationnext; struct client_list *pclienthead; } station; typedef struct client_list { char carid[10]; char gastype[3]; double gasamount; char servicetype[12]; struct client_list *pclientnext; } client; and after problematic area: void commandsswitch(file *input , file *output) { { int i; char *ptemp , *pfuncnum, *pcarid, *pstationname; ptemp = fgets(ptemp , 80 , input); if (ptemp[0] != '#') { pfuncnum = strtok(ptemp , ","); = (int)pfuncnum[0]; switch (i) { case 1: howmuchgasperstation(...

debugging - Understanding the output of electric fence and gdb -

when debugging program terminates segfault, electric fence, in conjunction gdb, returns this: "electricfence exiting: mprotect() failed: cannot allocate memory [thread 0xb0bd4b70 (lwp 5363) exited] program exited code 0377. i thought electric fence more helpful. mean? how can interpret piece of information? there doesn't seem stack left can at, or @ least bt won't return anything. any suggestion appreciated. thanks! you have run out of memory map areas. default known low when using debug allocators. can adjusted @ runtime via echo 128000 > /proc/sys/vm/max_map_count or adding line /etc/sysctl.conf , rebooting: vm.max_map_count = 128000 the max_map_count number defaults 65530 , can increased high max_int if necessary. for more information see: max_map_count side effects when increasing vm.max_map_count

.net - With a single Javascript for Entire Website set on Master Page, how to exe a JS function only for one(or 2) chlid page -

i working on .net website single javascript (so far). because have been told single js best performance etc. firstly, suggestions on js frameworks , cutting-edged articles? secondly, met problems when trying invoke js function child page. tried : 1.i want exe function after page_load (i.e. ispostback) $("#div_id").ready 2.exe function after page postback (a dropdownlist post in updatepanel) pgregmgr.add_beginrequest(beginhandler) function beginhandler() {$(".ddl_classname").change(function{.....}); } both not work. system won't recognized div or ddl. i'm not able set function in $(document).ready or .add_beginreqest() in 'master' js, cause errors on other pages. suggestions? or have move multiple js files? moreover, instead of writing inline javascript, i'm using $(document).ready(function{textchange}); function textchange(function { $(".textbox_class").change(.....)}); it works in chrome etc, not ie 7 (mb ie8 w...

php - Add to array consecutive numbers -

this first question so, hope right. in php (if can't, python or pseudo language okay), given array of n elements: old_array = [1, 2, 3, 5, 7, 8, 9, 20, 21, 23, 29] i need add new array consecutive numbers, if not consecutive number add value new array: new_array = [ [1,2,3], [5], [7,8,9] [20,21] [23], [29] ] here on so, found these related topics, can't work. creating list of lists consecutive numbers python finding n consecutive numbers in list find sum of consecutive whole numbers w/o using loop in javascript the code wasn't working on version history, removed because it's having formatting problems. thanks all, , juan, mistabell , axsuul providing correct answer. the best can came is: function subsequencearray($values) { $res = array(); $length = count($values); if (0 == $length) { return $res; } $last = 0; $res[$last] =...

asp.net - Creating Application/Virtual Directories in a site that POINT to that site to simulate multiple sites. Good idea? -

we need way say www.site.com/india www.site.com/asia www.site.com/usa etc... but want these requests point www.site.com , not have physically create files , directories every type of site... if create virtual directory (www.site.com/india) , point www.site.com... figure can @ url , set parameters/text/images accordingly fill out template... does make sense? or there issues web.configs ? or better way i encourage consider routing, demonstrated here: http://www.asp.net/mvc/tutorials/asp-net-mvc-routing-overview-cs the given sample, repeated here can (hopefully) see relevance, is: using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using system.web.routing; namespace mvcapplication1 { // note: instructions on enabling iis6 or iis7 classic mode, // visit http://go.microsoft.com/?linkid=9394801 public class mvcapplication : system.web.httpapplication { public static void registerroute...

linq to entities - Entity Framework - Issue returning Relationship Entity -

ok, must working hard because can't head around takes use entity framework correctly. here trying do: i have 2 tables: headertable , detailtable. detailtable have 1 many records each row in headertable. in edm set relationship between these 2 tables reflect this. since there relationship setup between these tables, thought quering records in headertable, able access detailtable collection created edm (i can see property when quering, it's null). here query (this silverlight app, using domaincontext on client): // mycontext instatiated class scope entityquery<project> query = _mycontext.getheadersquery(); _mycontext.load<project>(query); since these calls asynchronous, check values after callback has completed. when checking value of _mycontext.headertable have rows expected. however, detailstable property within _mycontext.headertable empty. foreach (var h in _mycontext.headertable) // has records { foreach (var d in h.det...

How do I use Spring Roo DBRE add-on in Roo 1.1.0 RELEASE? -

i've heard of roo dbre add-on , think great feature provided roo. couldn't find documentation on google roo dbre. how use feature? have checked jira ticket https://jira.springframework.org/browse/roo-1685 , said documentation created can find it? also when type database introspect --schema public --file schema.xml roo tells me command 'database introspect --schema public --file schema.xml' found not available (type 'help' enter learn command) what mean? need manually install add-on? i think missing 1 of create project or jpa set steps. first have create project , jpa set after edit generated datapase.properties , database introspect. hint command guide next step. roo> project com.***.***** created root/pom.xml created src_main_resources created src_main_resources/log4j.properties created spring_config_root created spring_config_root/applicationcontext.xml roo> hint roo requires installation of persistence configuration, example, jp...

python - Fixing an Or Statement With Variables -

how change below code python reads list inside 2 variables , perform action after without reeving error? code: bad = ['bad','terrible', 'dumb'] = ['good','happy','awesome'] talk = raw_input("type:") if (bad) in talk: print "i'm sorry hear :(" elif (good) in talk: print "that's good!" try this: bad = set(['bad','terrible', 'dumb']) = set(['good','happy','awesome']) talk = raw_input("type:") if bad & set(talk.lower().split()): print "i'm sorry hear :(" elif & set(talk.lower().split()): print "that's good!"

python - How do I log a user in using repoze.who? -

i have working repoze.who/what setup (on pylons app). want automatically log new users in after signup, without them having use login form. i've browsed repoze.who docs , source code and, maybe i'm missing it, can't find out how set logged-in user code, without new post request going through middleware. possible? i have been similar issue morning , found: must know right there's 2 versions of repoze.who (1 , 2): in v 1.x: rememberer = request.environ['repoze.who.plugins']['cookie'] identity = {'repoze.who.userid': user.username} response.headerlist = response.headerlist + \ rememberer.remember(request.environ, identity) in v 2.x (it's easier because provide , api): from repoze.who.api import get_api who_api = get_api(request.environ) creds = {} creds['login'] = yourusername creds['password'] = yourpassword authenticated, headers = who_api.login(creds) resources: v1: http://www.deanlee.cn/progra...

Is there a 'best' Java RAD - for al Android/Linux/Windows? -

what's cross-platform those, flexible, easy develop , debug, , offers cross-platform gui development? good support odbc database plus , support gis database major plus. as mentioned yann, there no cross-platform rad system cover both android , linux/windows java. android not java-based platform; android sdk converts java bytecode more optimized dalvik vm bytecode. reason, may find non-gui java code not "port" (i've run couple of such issues). there exist libraries attempt provide cross-platform access graphics layer such libgdx, none allow create "one-size fits all" gui code easily. in general, though, wouldn't want either - ui concepts different on small touch screen , large mouse-controlled desktop. from development point of view, development environment comfortably allows split project android project (for android stuff), desktop java project (for desktop specific code), , java library project common functionality (keeping in mind m...

asp.net - WIF cross-domain on one IIS site, dynamically setting of realm -

we have lot of domains running on 1 iis website/apppool. right in process of implementing sso windows identity foundation. in web.config realm has set with <wsfederation passiveredirectenabled="true" issuer="http://issuer.com" realm="http://realm.com" requirehttps="false" /> my problem realm dependent on domain user accessed website on did set in global action filter this var module = context.httpcontext.applicationinstance.modules["wsfederationauthenticationmodule"] wsfederationauthenticationmodule; module.realm = "http://" + siteinfo.domainname; my question is. when set realm this, set per user instance or application instance. scenario. user loads page , realm set domain.a.com. user b logged in on domain.b.com , presses login. since user loaded page before user b pressed login, user hit sts wrong realm set. what happen here? if not way set realm per user instance, there way it? i hav...

asp.net - On Key Down Restrict the user to enter Some Special Characters -

i want restrict user in toolbar search not allowing him/her using special characters ('/','>','<','|').please me out. $("#tblfundcomp").bind("keydown",function(e) { if(e.keycode >=48 && e.keycode <=57 ) { return false; } else { return true; } }); i have placed piece of code after before search function. not work if want allow special characters entered in input field of search toolbar can use dataevents of searchoptions defined using type:'keypress' or type:'keydown' . follows call jquery.bind , jquery.unbind corresponding input field. code fragment allows digits following searchoptions: { dataevents: [ { type: 'keypress', // keydown fn: function(e) { // console.log('keypress'); if(e.keycode >=48 && e.keycode <=57) { // allow digit...

publish subscribe - How to implement a light pub-sub service on App Engine? -

during google i/o 2009 "offline processing on app engine: ahead" presentation ( video , slides ), brett slatkin presents task queue service. he states pub-sub systems maximize transactions, decoupling: large numbers of small transactions per second one-to-many fan-out changing receivers guaranteed ordering, filtering, two-phase commit and emphasises our new api implements queueing, not pub-sub i'm interested in subset of functionalities: one-to-many fan-out changing selected/fixed internal receiver handlers guaranteed ordering , filtering, two-phase commit targeted goal ease publishing of notifications/messages between different modules of same web application. sample usage scenarios cases be: making payment module aware of receivals of bills. making user able track changes of particular domain object has decided follow/star. what correct way implement these on top of task queue service ? consider using clo...

asp.net - Is it possible to add multiple projects at once in Visual Studio 2008? -

i know can add more 1 project solution, have load of pre-developed projects want add , rather going add > existing project > navigate folder > click on project file i wondered if there easier way add lots of projects @ once. apart editing solution file directly, can't see way of doing this.

asp.net mvc 3 - what are the advantages of MVC3 over MVC2 -

i learning mvc2. working on first mvc2 project.as mvc3 beta launched , available download. please suggest me should use mvc3(beta) or continue mvc2 , second thing is, if move mvc3 major advantages it. project erp application. please suggest me should do. thanks i suggest take @ blog post scott gu : http://weblogs.asp.net/scottgu/archive/2010/11/09/announcing-the-asp-net-mvc-3-release-candidate.aspx to name advantages, can use razor view engine, depending on requirements, make view code nicer. believe that's case erp system. this not 100% mvc3 related, rc nuget installed it, if you're planning on using external libraries out, that's great way manage them. partial page output caching great feature systems share bits , pieces across different ui's. unobtrusive javascript , validation great new feature keep code's maintainability among other benefits. mvc3 has benefits dynamic aspects of .net 4, , helps keep view code cleaner. and end point...

encoding - Necessary to encode characters in HTML links? -

should encoding characters contained within url? example: <a href="http://google.com?topicid=1&pageid=1">some link using &</a> or <a href="http://google.com?topicid=1&amp;pageid=1">some link using &amp;</a> yes. in html (including xhtml , html5, far know), attribute values , tag content should encoded: authors should use "&amp;" in attribute values since character references allowed within cdata attribute values.

Writing to oracle logfile from unix shell script? -

i having oracle concurrent program calls unix shell script execute sql loader program. used inserting flat file legacy oracle base tables. my question here is, how capture custom messages, validation error messages etc in oracle log file of concurrent program. all in regards appreciated. it looks trying launch sql*loader oracle apps. simplest way use sql*loader type of executables, way output , log files right in concurrent requests window. if want write in log file , output file unix script, can find them in fnd_concurrent_requests table (column logfile_name , outfile_name ). should request_id passed parameter script. these files should in $xx_top\log , should called l{request_id}.req , o{request_id}.out (apps 11.5.10).

To test working of xml in iphone? -

hi can place both xml files , images xml file transports in xcode test working since don't have internet ? if can done , should path name xml coded in program , images typed in xml.? nsstring *stringtoxml = [[nsbundle mainbundle] pathforresource:@"thexmldoc" oftype:@"xml"]; nsurl *xmlurl = [nsurl fileurlwithpath:stringtoxml]; using can xml documents resource folder , use them. just substitute url in code variable xmlurl , should fine. same images, need make nsurl out of path resource.

jquery - Filter javascript object array by string array -

i have array of objects, this: var companies = [ { "name" : "company 1", "logo" : "/logo.gif" }, { "name" : "company 2", "logo" : "/logo2.gif" }, { "name" : "company 3", "logo" : "/logo3.gif" } ]; i want filter array values have name exists in array: var mycompanies = [ "company 1", "company 3" ]; in example, data returned be: var companies = [ { "name" : "company 1", "logo" : "/logo.gif" }, { "name" : "company 3", "logo" : "/logo3.gif" } ]; what's best way this? you can use $.grep() new, filtered array, this var result = $.grep(companies, function(e) { return $.inarray(e.name, mycompanies) != -1; }); you can test here . note performs better $.each() loop, ...

php - Auto refresh multiple divs with Jquery -

im creating dashboard large display @ work, have managed 1 div auto refreshing php request page, can't think of way of using function on div script without copying entire function , renaming it, seems dumb. this have far: <script type="text/javascript"> $(document).ready( function update() { $.get("response.php", function(data){ $("#ajaxtest").html(data); window.settimeout(update, 10000); }); }); </script> i did searching on stackoverflow , found nifty little extract, although single div use only... ( second example: auto refreshing div jquery ) $(document).ready( function update(el) { $.get("response.php", function(data){ el.html(data); window.settimeout(el, 10000); }); update($("#ajaxtest")); });

css - ValidationSummary style not displaying in IE 6 on Post asp.net -

i posting server check db see if hold reference number. if reference number not exist set 2 custom validators invalid , change validationsummary header text. problem background colour set in css class not display. font colour display correctly. when validation summary displayed using client side script styles displayed correctly. not sure why dont when there post back. css .form-box .form-error-box { background: #cd3300 url("../../../images/alert.gif") no-repeat 10px 10px; color: #ffffff; font-weight:bold; padding:10px; padding-left: 80px; min-height:55px; } code <asp:validationsummary id="vsummary" cssclass="form-error-box" displaymode="bulletlist" headertext="an error has occured" runat="server" backcolor="" forecolor="" /> this works in firefox , ie 8 on post not ie 6. unfortunatly have support ie 6 the solution found add height validationsummary div...

Downloadable jQuery documentation or e-book? -

can recommend donloadable version of latest jquery documentation (or e-book)? the answers this question on year old , don't apply latest version. there's browser located here: http://api.jquery.com/browser/ updated location: http://jqapi.com/ at bottom of page you'll see it's installable adobe air application, source available here .

c++ - Are there differences between explicit type conversion "operators" in case of basic types? -

simple thing: "convert" e.g. float double . there 3 ways known me: float v = 4.2f; double u = (double)v; double u = double(v); double u = static_cast<double>(v); double u(v); edit: thought fourth option! are these identical or there subtle differences? suggest use? note question related basic types int, char, float, ... not pointers, pods or classes. double u = (double)v; , double u = static_cast<double>(v); equivalent because both cases standard conversion used. double u = double(v); creates temporary double object (which can optimized away anyway) used initialize u . since temporaty created anyway, using 3 kinds of casts, yeah, it's same. from 3 static_cast should preferred. it's couple of characters more typing, in long run it's better because first of explicitly specify cast type , since casting suspicious, in vivid manner

Grails/Tomcat/MySQL stale connection error, even when using JNDI? -

i have couple of grails 1.3.3 application running on tomcat 6.0.18. i'm aware of database connection staleness issue when using default grails datasource (connection gets killed after period of inactivity), switched jndi provided tomcat. the first app deployed has never had stale database connection problems. deployed second app same server same jndi datasource configuration, , while first continues work fine, second app gets connection timeout error after 8 or hours of inactivity. (after error connection gets refreshed , works fine again) the datasources defined in tomcat's context.xml follows: <resource name="jdbc/firstds" auth="container" type="javax.sql.datasource" maxactive="100" maxidle="30" maxwait="10000" username="user1" password="password1" driverclassname="com.mysql.jdbc.driver" url="jdbc:mysql://localhost:3306/firstapp" /> ...

datetime - When will the java date collapse? -

afaik java stores dates in long variables milliseconds. consequently someday there no value (cause long has maximum) correspond time of instant. know when happen? it's easy enough find out: public class test { public static void main(string[] args) { system.out.println(new java.util.date(long.max_value)); } } gives output (on box): sun aug 17 07:12:55 gmt 292278994 you may need subtract bit long.max_value cope time zone overflowing range of long, give reasonable ballpark :)

Problems connecting to remote MySQL host with Rails -

i wanted connect remote mysql host (with rake db:create ), rails considers local. database.yml uses following config: defaults: &defaults encoding: unicode adapter: mysql username: <username> password: ************* port: 3306 host: <remote ip address> development: <<: *defaults database: <db name> test: &test <<: *defaults database: <db name> production: <<: *defaults database: <db name> and error when trying on database: error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) the config works long use local database (i.e. without host/port part). connecting remote mysql server works fine given details. any ideas on going wrong ? edit : problem occurs rake:db:create , other tasks work - error message badly misleading. you may need enable mysql server accept remote request (by binding host's ip address or address format ...

extjs - how to update my sencha app from Extjs2 to Extjs3? -

i'm trying update sencha app extjs2.0 extjs 3, i'm finding bit difficulty in it. actually developed application in extjs2 have use grid panel present in extjs3. so when include extjs3 in current html file whole app crashes please help.... <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>picker</title> <link rel="stylesheet" href="resources\css\sencha-touch.css" type="text/css"> <link rel="stylesheet" href="resources\css\ext-all-css.css" type="text/css"> <script type="text/javascript" src="ext-touch.js"></script> <script type="text/javascript" src="ext-all.js"></script> <script type="text/javascript" src="src\stocking.js"></script> <script type=...

java - Stringtemplate compare strings does not work -

can explain why not work ? stringtemplate query = new stringtemplate("hello " + "$if(param==\"val1\")$" + " works! " + "$endif$ " + "world"); query.setattribute("param", "val1"); system.out.println("result: "+query.tostring()); it throws eval tree parse error :0:0: unexpected end of subtree @ org.antlr.stringtemplate.language.actionevaluator.ifcondition(actionevaluator.java:815) @ org.antlr.stringtemplate.language.conditionalexpr.write(conditionalexpr.java:99) st doesn't allow computation in templates. make part of model.

model view controller - Question about Java EE 6 architecture -

Image
from picture above, conclude java ee 6 architecture 3 tier architecture. dont understand client tier? isn't ui code suppose client tier. jsf handle ui of application, shouldn't jsf @ client tier? java ee 6 utilizes 3-tiers architecture, , jsf mvc model, can tell me correct or not? 3-tiers architecture linear model, client input cant go directly data tier. must go through middle tier. have jsf mvc model. know controller facesservlet , view page itself. what model? a. cant database itself, since 3-tiers said must go through middle tier. model managed bean, served gate way database? or b. since jsf in middle tier, therefore model in fact database. the client tier runs in client machine. in case of (java ee) web application, that's webbrowser. runs html/css/js , communicates server side http. ui code (the jsf code) covered web tier in picture. generates , sends html/css/js client side. actually, whole jsf thing fits in web tier. jsf part in web...

user interface - Add audio recording feature to visual studio gui -

i working on gui in visual studio ultimate has couple of buttons , when user clicks on button should record says. need record , store audio (in background preferably) , run entirely through visual studio some element of control needed such choose record @ 16 bit etc.

operating system - Why semaphore? -

why use binary semaphores when same functionality can achieved simple variable ? because semaphore isn't simple variable, it's larger construct that. specifically, counting semaphore (which binary semaphore is, effectively, count of 1), there's added capability of blocking process/thread tries increment semaphore above maximum value. semaphores have additional facility state changed "atomically", means underlying memory surrounded logic ensure cpu caches , such flushed, , when value changed, it's changed "everyone". particularly important on modern multi-core processors. the semaphore appropriate use when trying guard shared resource on use. binary semaphore perfect resources can used 1 process/thread @ time.

eclipse - Trying to get the Hello Android tutorial to work on Mac OS X Leopard -

i'm on mac os x leopard , installed adt plugin eclipse galileo. followed steps on android developer sdk page started. sdk version 2.2 api 8 revision 2 , used hello world tutorial found here: http://developer.android.com/resources/tutorials/hello-world.html when first created android application, saw error in eclipse console: [2010-11-13 18:20:43 - helloandroid] error: unable open class file / users/mydirectory/documents/workspace/helloandroid/gen/com/example/ helloandroid/r.java: no such file or directory i commented out line fill in few lines tutorial: setcontentview(r.layout.main); when ran app, launched emulator saw vertical screen on left said "android" , phone buttons on right. did not see "hello, android" text tutorial. any ideas? run project clean force r.java generation. project -> clean... -> ok this should make sdk build project correctly. same problem happens me pretty new projects.

c++ - Creating an alias for an instantiated template -

i had number of signal processing filter classes identical apart few constants defining filter characteristic, decided change these template class maintainability , extensibility. there performance , memory management reasons preferring template on constructor arguments in case; embedded system. consequently have template class of form: template <int size, int scale_multiplier, int scale_shift> class cboxcarfilter { public: // allow access size @ runtime. static const int filter_size = size ; ... } which explicitly instantiate thus, example: template class cboxcarfilter<8, 1, 3> the problem when need access filter_size member requires: cboxcarfilter<8, 1, 3>::filter_size which rather makes access filter_size redundant since must repeated in arguments. solution problem this: // create alias filter #define cspecialistboxcarfilter cboxcarfilter<8, 1, 3> template class cspecialistboxcarfilter ; then can access filter_size thus: ...

date - How can I use a MySQL function in my PHP query code? -

i'm trying convert string "date" value submitted form actual date while doing insert query. thought use mysql function str_to_date, i'm getting error message. here's code; joomla site, jrequest::getvar calls joomla's way of getting submitted _post variables. $query = "insert jos_customers_addresses (customer_id,nickname,birthdate) values (" .$db->quote($useracctid)."," .$db->quote($nickname)."," .$db->quote(str_to_date(jrequest::getvar('birthdate'),'%m/%d/%y')) .")"; i've tried birthdate line without $db->quote, got same error. error message is: fatal error: call undefined function str_to_date() in /var/www/html/mysite.com/components/com_arrcard/models/checkoutpay.php on line 156 where line 156 line containing str_to_date call. ideas? put in query, not code. ."str_to_date(".$db->quote(jrequest::getvar('birthdate'))....

connection - how can i use a PASSWORD protected ACCESS database as a backend of my Vb.net project....? -

i has access database ...that password protected.... connecting in manner given follow .......(without password protection) cn = new oledbconnection("provider=microsoft.jet.oledb.4.0; data source=d:\my documents\db2.mdb") cn.open() ///codes....... cn.close() how can edit can use access password protected access database connectionstrings.com helpful when trying work out connection string should like.

opengl es - I'm confused about what must I do (android rendering engine) -

i'm developing android application opengl. i'm new android , opengl , english poor. yesterday earned -4 points because didn't explain correctly. i try explain problem: i have show more 1 3d object on screen, example cube , sphere. objects i'm going use more complex. now, can show 1 2d object following tutorial , don't know how show 3d object , neither more one. i use blender model 3d objects. want use these models application. i have found java loader wavefront obj format here . can export models format , import android application. someone told me using rendering engine. don't know rendering engine. but have restrictions: i'm using native c++ sdk uses opengl. if i'm going use java rendering engine need pass data (visible targets, projection , pose matrices, etc.) native java. use jni (java native interface). another thing consider native c++ sdk if needs create opengl context specific parameters, depending on device. you'll n...

To what does "ip filtering" refer in the context of user authentication? -

i'm looking @ set of requirements web site , lists, among other things: user authentication - cookies , ip filtering i understand ip filtering (forwarding or ignoring packets based on data such packet type, source ip address, etc.), how used authenticate users? the website has list of blacklisted/whitelisted ip addresses, , denies access on blacklist/not on whitelist. e.g. users need log gateway server ip whitelisted, , can access site there.

jquery - Problem with the datepicker format -

i have $("#xt1").datepicker({ dateformat: 'dd-m-yy' }); statement datepicker in jquery statement user can enter value date in text field statement $("#xt1").datepicker(); user cannot enter value in text field . how can format date , not allow user enter date @derby: add readonly="readonly" attribute #xt1 input , e.g.: <input type="text" name="xt1" id="xt1" readonly="readonly" />

sql - calculating the number of references of a key in different table -

i have below sql query: select g.name gname, count(u.id) nomembers, f.name client, p.name projectname, g.formed_date formeddate `groups` g join users u on u.group_id = g.id join users f on g.client_id = f.id join projects p on p.group_id = g.id what i'm trying accomplish this: single sql query name of current group, number of members within (all users in same different table, called users), name of project group working on , client group working. has done every group in groups table. when execute above query not return number of users within group, more (not of users in table though) , 1 row of results, although there supposed more. count going return 1 row whole selection. want use group after join statements. group g.name this give 1 row each different group name. return 1 result per group name client, projectname, , formeddate, if there multiple different possibilities within each group, may want group multiple columns more details...

Android: LinearView with fixed sized widgets left and right and a flexible one in the middle -

seems simple question, can't figure out how it. i have horizontal linearview of fixed size @ left, comes text should take mich space possible, on right should fixed-size object. now, problems right now: when text in middle long, object @ right gets pushed out of window. when text short, not sit @ right border of window, directly next text. how can it? code far (as can see, tried use layoutweight, didn't help...): <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/important" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginright="10dp" android:background="#0000...

.net - MSI Install Package -

i'm creating msi install package web app , projects targeted .net 3.5. (in visual studio 2010) also, have disabled prerequisite installs when generating msi package. however, when attempting install on machine without .net 4, asks me if wanted install .net framework. any ideas why? there must setting missing. update: i did warning, when building deployment package, this: warning: target version of .net framework in project not match .net framework launch condition version '.net framework 4 client profile'. update version of .net framework launch condition match target version of the.net framework in advanced compile options dialog box (vb) or application page (c#, f#). fixed it. apparently in installer project, make sure refresh dependencies , if view properties of "microsoft .net framework", make sure change 3.5. apparently, not change 3.5 you, you'll have explicitly set here.

c# - Autofac resolve IEnumerable<TComponent> for instantiated items only -

does autofac provide me way "active" instances of component? following works: public class viewmanager { public viewmanager(func<ienumerable<myview>> viewprovider, func<string, myview> viewfactory) { viewprovider = viewprovider; viewfactory = viewfactory; } public func<ienumerable<myview>> viewprovider { get; private set; } public func<string, myview> viewfactory { get; private set; } public myview getview(string viewid) { var existing = view in viewprovider() //this me active views (not available implementations) !view.isdisposed && view.id == viewid select view; return existing.firstordefault() ?? viewfactory(viewid); } } public class myview: idisposable { public myview(string id) { id = id; } public string id { get; private set; } public bool isdisposed { get; private...

facebook - How should i choose between client side SDK and server side API? -

i have rails web app want integrate facebook (create events, wall post...) how should choose between facebook javascript sdk , graph api ? when should use client side api , when server side graph api api, js sdk sdk. api way access data. can used js, server-side. sdk set of tools work something. so comparing api , sdk "little" out of logic. when need data on server side - perform api request server side, when need data on client side - perform api request client side. sorry of being "captain obvious".

text mining - Lucene Entity Extraction -

given finite dictionary of entity terms, i'm looking way entity extraction intelligent tagging using lucene. i've been able use lucene for: - searching complex phrases fuzzyness - highlighting results however, 'm not aware how to: -get accurate offsets of matched phrases -do entity-specific annotaions per match(not tags every single hit) i have tried using explain() method - gives terms in query got hit - not offsets of hit within original text. has faced similar problem , willing share potential solution? thank in advance help! for offset, see question: how offset of term in lucene? i don't quite understand second question. sounds me want data stored field though. data stored field: topdocs results = searcher.search(query, filter, num); foreach (scoredoc result in results.scoredocs) { document resultdoc = searcher.doc(result.doc); string valoffield = resultdoc.get("my field"); }