Posts

Showing posts from March, 2014

Google chrome frame - how does it work? -

i'm looking chrome frame , i'm wondering how works.... http://scriptsrc.net shows it's javascript can embedded on page.... http://code.google.com/chrome/chromeframe/ shows install file... js prompt installation or something? the javascript detect , enable if it's there. (scriptsrc giving link file, on google cdn.) end user have one-time install of it, it's plug-in (like flash or java). quoting this page in google documentation: in internet explorer, check() determines if chrome frame installed. if not, user prompted install it.

Detecting if the browser window is moved with JavaScript? -

this demo... , curious, can detect if window has been moved? if move firefox/chrome/ie around monitor? doubt it, wanted see since can check resize , focus/blurred windows. i can think of (heavy) work-around, check if window.screenx , window.screeny have changed every x milliseconds var oldx = window.screenx, oldy = window.screeny; var interval = setinterval(function(){ if(oldx != window.screenx || oldy != window.screeny){ console.log('moved!'); } else { console.log('not moved!'); } oldx = window.screenx; oldy = window.screeny; }, 500); though not recommend -- might slow , i'm not sure if screenx , screeny supported browsers

Trying to solve 2 equations with 2 unknowns symbolically using MATLAB -

trying solve 2 equations 2 unknown using matlab , not liking input. where c 3.06 + 2.57j, , v 12: eq1 = 'c = a/10j' eq2 = '(6b)/50 + b/10j = a/10j + a/10' trying solve , b. suggestions of how put these in? matlab screwed up, syntax is sol = solve(eq1,x1,eq2,x2,..); it make more sense make solve({eq1,eq2,..},{x1,x2,..}) no, have write out arguments 1 one. anyway trick eq1, eq2, .. symbolic expressions must evaluated zero. instead of c = a/10j needs eq1=sym('c-a/10j') so try this: eq1 = sym('c - a/(10*i)'); % must evaluate 0 eq2 = sym('(6*b)/50 + b/(10*i) -( a/(10*i) + a/10)'); %must evaluate 0 sol = solve(eq1,'a',eq2,'b'); = subs(sol.a,'c',3.06+2.57j) b = subs(sol.b,'c',3.06+2.57j) produces a= -25.7000 +30.6000i , b=-20.6639 +29.6967i . note symbolic functions not understand 10j . needs 10*i . notatation 6b missing operator , needs 6*b . good luck! since problem linear

iphone - how do I create a bundle and put files on it at run time -

my app generates 3 files every time user saves project. able build bundle @ run time, , save files bundle , save app's directory. if user wants move project desktop matter of dragging 1 bundle (= directory looks file, mac os x apps , pages files)... i googled around , found nothing. how do @ run time? thanks. bundles folder hierarchies conforming specific structure – see bundle programming guide . can use nsfilemanager create folders in question, nspropertylistserialization create info.plist , etc.

python - String Matching with regular expressions -

i trying write regular expression in python takes string , checks if: the last character vowel. the last 2 characters not same. this came with: [aeiou]$ can me point number 2: last 2 characters not same. example, expresso valid , expressoo not valid. it might easier without regular expression. e.g if s[-2]!=s[-1] , s[-1] in 'aeiou'

Android: Start activity via link in TextView -

this question has answer here: handle textview link click in android app 13 answers i have textview fill html , linkify then. of links in html in special format , meant links other activities in project, not normal url links. possible intercept clicks on such links in textview , custom action in case link in special format? thanks. a question how manage link click has been post , should answer question. here link : handle textview link click in android app

.net - How to set multiple field for HyperLinkColumn in a DataGrid using DataNavigateUrlField -

i trying create datagrid hyperlinkcolumn uses 2 fields url. using vb, vs 2005, .net 2 i getting exception: "a field or property name 'primkey,iscommercial' not found on selected data source." i not sure why, have check following. the fields spelt correctly. the fields in datasource. the fields work simple bound columns. here example of trying do. <asp:hyperlinkcolumn sortexpression="logno" datanavigateurlfield="primkey, iscommercial" datanavigateurlformatstring="../clarifications.aspx?primkey={0}&iscommercial={1}" datatextfield="logno" headertext="logno" itemstyle-wrap="false"></asp:hyperlinkcolumn> i ended solving templatecolumn. example: <asp:templatecolumn headertext="logno" sortexpression="logno"> <itemtemplate> <a href="../clarifications.aspx?primkey=<%# container.dataitem("primkey").tostring() &

python - Multi-language website - unique URLs required for different languages (to prevent caching)? -

i have developed appengine/python/django application works in spanish, , in process of internationalizing multi-language support. dating website, in people can browse other profiles , send messages. viewing profile in different languages result in of text (menus etc) being displayed in whichever language selected, user-generated content (ie. user profile or message) displayed in original language in written. my question is: necessary (or idea) use unique urls same page being displayed in different languages or ok overload same url given page being displayed in different languages. in particular, worried if use same url multiple languages, pages might cached (either google, or other proxy might not aware of), result in incorrect language being displayed user. does know if legitimate concern, or if worrying not happen? in principle, can use content-language , vary response headers , accept-language request header control how caches behave , prevent them serving wrong

php - Catching Post data from Jquery Ajax From Submission -

so sending form data using jquery's ajax functionality. seems work okay how ever not able catch data posts. i trying use $string = $_post['name'] catch result on page sends no luck. the jquery- $(function() { $('.error').hide(); $(".button").click(function() { // validate , process form here $('.error').hide(); var name = $("input#name").val(); if (name == "") { $("label#name_error").show(); $("input#name").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("label#email_error").show(); $("input#email").focus(); return false; } var phone = $("input#phone").val(); if (phone == "") { $("label#phone_error").show(); $("input#phone").focus(); re

javascript - jscrollpane content is shown 3 times -

using jscrollpane content duplicated 3 times. see mean go to: http://www.facesoflyme.com/view_pets/profile/pet_webpage.php?pet_id=1676 , view scrolling content under "casey's lyme disease journey" here same page without using jscrollpanel. notice content shown 1 time. use url below view page works pet_webpage_11302010.php?pet_id=1676 if can figure out how fix appreciated. it seems you're adding content there 3 times: <script type="text/javascript" id="sourcecode"> $(function() { // initialise scrollpanes $('.scroll-pane').jscrollpane(); // add content #pane2 var pane2api = $('#pane2').data('jsp'); var originalcontent = pane2api.getcontentpane().html(); pane2api.getcontentpane().html(originalcontent + originalcontent + originalcontent); // reinitialise #pane2 scrollpane pane2api.reinitialise(); }); </script> this line: pane2api.getcontentpane().html(originalcontent + originalcontent + ori

Pass width and height as parameters to CSS selector -

i've few .containers css selectors wraps around input boxes have same attributes except width , height. possible pass width , height when define class="container" ? maybe i'm not understanding correctly, want send width , height of container class elements class later on inherit width , height? not pure css. it's called cascading style sheets, because can't go in reverse, if makes sense. it's easy javascript, though. in jquery, example, do: $(document).ready(function() { var width = $('.container:first').css('width'); var height = $('.container:first').css('height'); $('.container').css({'width': width, 'height': height}); });

sharepoint 2010 - Promote InfoPath fields to columns in the form Library using feature -

i understand can using infopath designer.however , need deploy infopath form using feature ,once feature activated ,the infopath form shown contenttype.my questions how can promote infopath fields columns in form library using code in feature deployment? still can property promotion using infopath designer , deploy form using steps mentioned in article. property promotion deploying infopath using feature

c# - How to solve Memory leakage in windows multiple threading application -

actually working on real-time application multiple threads. while running application memory 65 mb , if open child mdi form memory increases 85mb if close child window memory still remains @ 85mb. i have used dispose , i've tried gc.collect(), none of these solve problems, little bit confused regarding issue. can please guide me regarding this? thanks in advance. you need memory profiler. there bunch of options: redgates's ants memory profiler scitech's .net memory profiler clr profiler (pre .net 4.0) and more. many cost money (except clr profiler) have trial versions. after start app (with profiler attached), need take snapshots of memory before leak , after , compare them see staying around. it's hard problem might in case, since there many things causing problem.

oracle - How to manage security in OWB -

i have problem manage security in owb, first: possible create user repository (but not repository owner) refering specified repository example: have repository called 'project' , have repository owner 'owb_owner' possible create user when login 'project' second: want user can run specific mapping in owb (not mapping), repository owner give priveleges run mapping user hope u can me solve problem, thank much yes, it's possible , that's how should done. owb multi-user development environment. you create repository "repository owner" , add other development users repository. from "design center"; go "globals navigator" --> security --> users. can see existing users. to add new users; right-click "users" , select "new user". you can add existing db users owb users or add entirely new user. in latter case, new db user created. to control permission on mapping; select mapping;

iphone - CCSpriteFrame warning..AnchorPoint won't work as expected.Regenerate the .plist? -

Image
i have 3 simple images of hen trying animate(hen walking) using tutorial ray wenderlich http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d but getting warning again , again , no sprite shows on screen original width/height not found on ccspriteframe. anchorpoint won't work expected. regenerate .plist tried resizing , untrimming erro persists...i cannot figure out problem?? heres code [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"hentry.plist"]; ccspritebatchnode *spritesheet = [ccspritebatchnode batchnodewithfile:@"hentry.png"]; [self addchild:spritesheet]; // load frames of our animation nsmutablearray *walkanimframes = [nsmutablearray array]; for(int = 2; <= 3; ++i) { [walkanimframes addobject:[[ccspriteframecache sharedspriteframecache] spriteframebyname:[nsstring stringwithformat:@"%d.png", i]]]; } ccanimation *walkanim = [ccanimati

java - Out of memory issue in Internet Explorer -

one of web applications uses auto-refresh after every 5 mins when run in internet explorer gives out of memory @ line xxxx error , has restarted. my application makes ajax call every 5 minutes new data , replace existing contents new one. iam clearing refrences existing data becomes garbage collection elgible , doesnt lead memory leaks still error. any good..... if outofmemory on server side have memory growth. sorry. :( i'd suggest use 1 of popular java profilers locate source of problem. alternative way try simplify application can. luck. sure can find problem using profiler quickly.

rendering - In Rails 3, how can I render a partial template to a variable in my model, while also passing local variables into the template? -

i'm doing email templating in rails seems common use case rendering templates variables in model. how can go in rails 3? model should know nothing presentation. try setting variable , rendering partial inside email template instead.

java - problem with precision and recall measuring in lucene -

i need calculate precision , recall value in lucene , use source code that public class precisionrecall { public static void main(string[] args) throws throwable { file topicsfile = new file("c:/users/raden/documents/lucene/lucenehibernate/lia/lia2e/src/lia/benchmark/topics.txt"); file qrelsfile = new file("c:/users/raden/documents/lucene/lucenehibernate/lia/lia2e/src/lia/benchmark/qrels.txt"); directory dir = fsdirectory.open(new file("c:/users/raden/documents/myindex")); searcher searcher = new indexsearcher(dir, true); string docnamefield = "filename"; printwriter logger = new printwriter(system.out, true); trectopicsreader qreader = new trectopicsreader(); //#1 qualityquery qqs[] = qreader.readqueries( //#1 new bufferedreader(new filereader(topicsfile))); //#1 judge judge = new trecjudge(new bufferedreader( //#2 new filereader(qrelsfile))); //#2 judge.validatedata(qqs, logger);

return value - Understanding the MSDN _beginthreadex function example -

there's function on _beginthreadex msdn page : unsigned __stdcall secondthreadfunc( void* parguments ) { printf( "in second thread...\n" ); while ( counter < 1000000 ) counter++; _endthreadex( 0 ); return 0; } i know can value returned _endthreadex function getexitcodethread , how value returned return ? another question: doesn't _endthreadex end thread, why did put return 0 after that? return 0 there make compiler happy. _endthreadex not return.

How to make backslash based URL with .htaccess? -

my site in php. want convert following.. domain.com/download.php?type=wallpaper&id=123456&name=windows-7 to this.. domain.com/download/wallpaper/123456/windows-7.html i want people make second link work in page. when 1 open second link open page have in first link. idea? thanks. you can use mod_rewrite so: rewriteengine on rewriterule ^download/([^/]+)/([^/]+)/([^/]+)\.html$ download.php?type=$1&id=$2&name=$3

c - How to send and receive an array of character pointers char *argv[] from server to client in linux socket programming -

i have char * array char *options[n] ; // n = 2 example . options[0] = "how to"; options[1] = "send"; how send "options" server client , using 1 function call send. since prototype of send int send(int sockfd, const void *msg, int len, int flags); , receive int recv(int sockfd, void *buf, int len, int flags); not sure how cast "options" such send , receive can take place in 1 function call. you have send actual character strings. pointers memory addresses on machine , accesable/meanaingful inside program. even if client , server on same machine os block attempt access client programs memory.

oracleforms - Oracle Forms 10g/11g : web or desktop-based? -

i've used oracle forms 6i. oracle forms 10g , 11g web-based only? or still have runtime environment desktop? begining oracle forms 9i, web based. source: forms upgrade reference

.net - System.ArgumentNullException in ResourceManager.GetString internals -

my code: system.resources.resourcemanager resourcemanager = getresourcemanager(); string str = resourcemanager.getstring("delete", new cultureinfo(1033)); in current project compiled under .net 2.0 works excepted. variable str contains resource string lcid 1033 - delete , ok. we upgrading .net 4.0, recompiled project under target framework .net 4.0. compiled .net 4.0 assemblies, throws exception system.argumentnullexception message value cannot null. .stack trace: @ system.threading.monitor.enter(object obj) @ system.resources.resourcemanager.internalgetresourceset(cultureinfo requestedculture, boolean createifnotexists, boolean tryparents, stackcrawlmark& stackmark) @ system.resources.resourcemanager.internalgetresourceset(cultureinfo culture, boolean createifnotexists, boolean tryparents) @ system.resources.resourcemanager.getstring(string name, cultureinfo culture) interesting here stacktrace, points internal framework method in resourcemana

SQL Server backup collation issue -

i given sql server 2005 backup collation set : sql_latin1_general_cp1_ci_ai when select data looks data saved in different collation , example : user : "micha³" - should "michaÅ‚" , on i've tried converting tables , database 1 of polish collation, tried select collate still looks same. have had similar issue , knows going on ? collation (sorting order) implies character encoding (mapping characters bytes) - did try using unicode (utf-8, utf-16)? in pinch, latin-2 (a.k.a. iso-8859-2, central european single-byte charset) may you're looking for. in other words, latin-1 single-byte character encoding western-european languages, can't store characters central-european (or other) languages. see this longer explanation of charsets, collations, , other headaches .

java - How can I create a variable that will contained an unknown number of objects? -

i have procedure recursively generates objects. procedure takes "last" object , generate "new" one, "new" object considered "last" 1 , on until "new" object cannot generated. i need save generated object. thought use array problem not know in advance how many objects generated (so, cannot specify length of array when declare it). is there way in java have arrays without fixed length? or may should use not array else? go arraylist list<yourclass> list = new arraylist<yourclass>(); list.add(obj1); list.add(obj2); list.add(obj3); . . .

java - add property for a object dynamicly -

hi: in our application,we have retrive data database,for example,the table have columes:id,name,age,address,email. then of these propertis according client. if client need id, name, id name, if client need id, name, age, id, name, age. now want create class wrap these properties. not know field requested. string[] requestpro={"name","id"}; //this field specified client map<string, object> map=new hashmap<string, object>(); entity en=entity.newinstance(); for(string p:requestpro){ map.put(p, beanutils.getproperty(en, p)); } here can replace map class? if understand right, want dynamically add properties class, or rather: specific instance of class. the former possible e.g. in groovy, there metaclass object every class, can assign behavior @ runtime, latter possible in javascript, can assign behavior both object's prototype , object itself. neither of versions possible in java, using map or similar structure thing in java.

heroku rails 3 application fails to start -

after i've deployed rails 3 app on heroku, fails start. error log starts with: /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-0.9.26/lib/bundler/definition.rb:25:in from_lock': changed gemfile after locking. please relock using bundle lock` (bundler::gemfilechanged) i'm using bundler 1.0.7 on development machine, looks heroku's version old. have workaround? do this: bundle lock bundle install bundle check <-- optional, check if worked fine. bundle pack bundle lock it should work fine.

objective c - Plug-in architecture, access to code in application? -

for project doing, want mac application accept plug-ins. whole idea of adding bundles application extend it's functionality. only came across small question, can't find answer to: i need include json parser in application, functionality. possible plug-in bundle use same parser? or every plug-in uses json parser, need include parser themselves? what best way separate bundles? on os x there 2 types of loadable things, dylib , plugin . (these 2 terms have specialized technical meaning in context of mach-o, binary format os x uses.) a loaded dylib can't refer libraries in executable, while loaded plugin can. side effect, dylib can loaded executable, plugin can loaded executable specify when make plugin. so want make plugin . there template in xcode that. don't forget specify target executable in linker flag, can set somewhere in inspector. for more, read code loading programming topics .

math - Concave and Convex Polygon -

Image
how can identify , remove 4 red points drawn in image those 4 points make polygon concave polygon that’s why want remove it. my goal convert concave polygon convex removing kind of point identifying , removing points. is there way identify , remove these kind of points? thanks use convex hull algorithm (such the graham scan ), , remove points not part of resulting convex hull. in example, convex hull consist of p1, p2, p3, p5, p7, p8, p9, p11, p12, p13, p14, p15, p16, p18, precisely points except red ones. note removing points inner angle greater 180 not result in convex polygon. take polygon example:

c# - Can you make sense of this C pointer code? -

i have snippet of c code uses pointers in confusing way. // first point specific location within array.. double* h = &h[9*i]; int line1 = 2*n*i; int line2 = line1+6; // ..and access elements using pointer, somehow.. v[line1+0]=h[0]*h[1]; v[line1+1]=h[0]*h[4] + h[3]*h[1]; what's happening here? how write equivalent in c#? you don't write equivalent in c# because don't have pointers there (except invoking unsafe code) - element c# array, need array ref , index, , index array. you can, of course, same c array. convert c pointer-arithmetic c array-indexing: int h_index = 9 * i; int line1 = 2 * n * i; int line2 = line1 + 6; v[line1 + 0] = h[h_index] * h[h_index + 1]; v[line1 + 1] = h[h_index] * h[h_index + 4] + h[h_index + 3] * h[h_index + 1]; and have can used pretty verbatim in c#.

qtnetwork - Problem in developing FTPClient using Qt -

i trying implement ftpclient in using qt network . how can handle exceptional cases during downloading network cable unplugged , not internet connection gone etc.. ? how can ftpclient can come know such event , there such kind of notification available ? i have tried use signals done(bool) , ommandfinished ( int id, bool error ) m not getting sort of signal. you seem use qftp, obsolete. should use qnetworkreply (and qnetworkaccessmanager), has finished() , error() signals: qnetworkreply documentation .

google app engine GQL, How to do pagination with datetime with millisecond accuracy -

hi have issue on querying subsecond accuracy queries gql.. wondering if had similar issues or workarounds. the context problem i'm loading batches of many objects google data store @ once. thousands of objects added within single second. on retrieval, run pagination issue when i'd page based on datetime of when they're added. (the last added time ideal paging allows users data don't have.) since batches of entities added in within sub second quantum. paging problematic if need start paging batch of entities inserted in same second. seems app engine 1 box solution can't handle subsecond queries if try pass in datetime objects has fractions. i.e. have following query pass in datetime object fractions of second. locally i'm running python 2.6. test = gqlquery("select * table lastupdated > :1", minimumtime) if minimumtime 10:00:00.0500, result set still contain records lastupdated @ 10:00:00.0100, 10:00:00.0200 etc.. i'm th

how to force english keyboard in android EditText -

i know how force numbers, texts etc.. there flag or ime options me force edittext accept language english in case db fields can accept english characters ? of course can check , notify users on bad input that's not user friendly... implementing own filter on edittext might possible i'm not sure force keyboard layout in language need. any idea ? you should filter input anyways. forcing english keyboard doesn't force user use english letters. user can still long press character or have non-english hardware keyboard. you listen text change events , reject characters not accepted db @ point.

uiview - iphone - subview rotation problem -

i have uiview root , uiview subview i don't allow root rotated, write in root class - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return no;} but allow root's subview (a) rotated, in class, write - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return yes;} but seems both root , subview can't rotate. how should allow rotated root not? thanks views don't answer shouldautorotatetointerfaceorientation, view controllers do. if view controller says rotate view , child views rotate. if view controller says won't rotate view won't rotate , neither children. there 2 possible approaches solving problem, depending on want do: if non-rotating view behind rotates, remove view controller , add main application window behind view controller upon viewwillappear: , remove again on viewdiddisappear: if non-rotating , rotating views need intermingled in mo

soapui - Changing assertions in SOAP UI for different server -

i have tests prepared 1 servers, each test case has own assertion this: declare namespace ns1='http://test.server.001'; //ns1:response[1]/ns1:errorcode[1]/text() expected: 1 it fine when i'm working test.server.001. need run tests of test.server.002, i'm getting assertion failed because of different namespace. is there quick way changes assertions cases, don't want change manually. thanks! if have assertion tied each request (as opposed storing assertion in variable), there isn't quick way change them all. the fastest way have found open xml file in text editor , find/replace all.

iphone - Custom Color in UIAlertView -

hi using below code give custom color uialertview.i using s.d.k. 3.2.3 , color changing desired color.but today updated s.d.k. using 4.2.1 , run code on s.d.k. worked.but when checked again color of alertview didn't change ,but color provided image,moved backward of alertview.i don't know why happening. there wrong doesn't work ios 4.2. let me know how in ios 4.2 code working 3.2.3 sdk. code is uialertview *forgotpassalert= [[uialertview alloc]initwithtitle:@"status" message:@"an email has sent account containing user name , password " delegate:self cancelbuttontitle:@"ok" otherbuttontitles:@"cancel",nil]; cgaffinetransform moveup = cgaffinetransformmaketranslation(0.0, -120.0); [forgotpassalert settransform: moveup]; [forgotpassalert show]; #pragma mark (alertview custom color) uiimage *theimage = [uiimage imagenamed:@"untitled-1.png"]; theimage = [theimage stre

c++ - help with make file -

i have make file this....... of files in main directory , others in tests directory.. vpath = tests objects = main.o script.o factory.o serve.o enter.o\ login.o notify.o check.o script : $(objects) g++ $(objects) -lcurl -o script main.o : script.h script.o : enter.h login.h factory.h factory.o : check.h notify.h serve.h check.o : serve.o : check.h notify.o : enter.o : check.h login.o : check.h .phony : clean clean : -rm *.o script i want make save object files directory cpp file comes from.. i.e. if script.cpp inside tests folder, want script.o tobe inside tests folder.. saves file inside main folder.. thanks in advance.. edit 1: need add files lateron tests folder.. there way make makefile recognise new files have been added , compile them also? instead of hard-coding list of files build, can use wildcard find source files. can use substitution convert list of object files. provide generic rule building .c .o , should set. files_to_

.net - Faster way to convert byte array to int -

is there faster way bitconverter.toint32 convert byte array int value? if remember correctly, implementation uses unsafe code (treating byte* int*), hard beat, other alternative shifting. however, lots of work in area, unlikely genuine bottleneck irrelevant. i/o main issue, typically. getbytes(int), however, is more expensive (in high volume) due array / heap allocation.

PHP include vs include_once (speed) -

possible duplicate: why require_once bad use? i've read somewhere include_once , require_once statements in php slower non-once counterparts. significant slowdown? has there been testing or studies of this, , has changed in recent versions of php? the speed increase minimal , comes reference check conducted prevent code duplication. 'once' appendage preventative measure against same code being executed/included twice..this performing check comes @ minor speed cost. if there ever instance using _once why case, code built in efficient way? better remove need rely on _once , produce better code (easier said done!). see: http://forums.digitalpoint.com/showthread.php?t=1693837 http://www.phpbb.com/community/viewtopic.php?f=71&t=565933 http://www.sitepoint.com/forums/showthread.php?t=269085 http://www.quora.com/what-is-the-difference-between-functions-include-and-include_once-in-php

image manipulation - CodeIgniter Upload and Resize Problem -

i have spent days trying make work based on examples in documentation missing or stupid! i have cms application users upload image display in fixed layout. not want limit file size of uploaded image rather "process" after arrives. the image needs 615px wide of images uploaded directly digital cameras 2500x2000 , bigger critical. i pieced code manual , image being uploaded folder within cms app. however, image not being resized. if ever re-size, plan present image user cropping using jcrop (the final image has 615x275 , has cropped height after resizing) , use codeigniter ftp image site's amenities folder using original name. i appreciate in matter! here's code: function do_feature_upload() { $imagename = $this->uri->segment(3); //echo $imagename; // file going placed $config['upload_path'] = "./uploads/".$_session['dbpropnumber']; $config['allowed_types'] = 'jpg|jp

jsf - Are filters or phase listers a good way to do security in Java EE 6? -

i've been doing lately , find better xml hell(spring security) or glassfish security(because don't need have groups or set tables way). ok way secure java ee applications? thanks! a homegrown filter doable when written, it's less maintainable/reuseable because it's tight coupled webapplication in question. java ee container managed security , spring security offers api same , reuseable every webapplication. may end easier developers/maintainers working on multiple different projects , wanted implement/maintain same. while relatively easy implement, homegrown filter violates dry . by way, wouldn't recommend using phaselistener since hooks on jsf requests only, not on other requests static css/js/html files , "plain" jsp files.

iphone - How to simulate the behavior of a UITabBarViewController? -

i want duplicate controller same functionality without using it, because tab bar controllers not customizable @ (fixed size, toggleable state tabs, etc...). i want customized "tab bar" contains whichever view want. , need push view controllers leaving customized tab bar fixed in position. i´ve seen lots off apps this, , wondering if using different uiwindow objects (one custom tab bar , other 1 content) best approach. any advice or guidance on this? thanks in advance. definitely not uiwindows - in iphone app there should ever 1 uiwindow. i'd make uiviewcontroller subclass had new navigation bar ui @ top , uiview underneath it. view used contain views of controllers going push in it. view have clipstobounds set yes make sure other controllers views don't overlap navigation bar etc. it have array hold list of controllers inside it. your controller implement pushviewcontroller:animated: methods etc allow add other view controllers stack - add n

c# - Understanding when/how events are sent -

i have code this: // create event handler delegate symbolreader.readnotify += new eventhandler(symbolreader_readnotify); when barcode scanned on handheld device symbolreader_readnotify called. this simplified version of method: /// <summary> /// event fires when symbol scanner has performed scan. /// </summary> private void symbolreader_readnotify(object sender, eventargs e) { readerdata readerdata = symbolreader.getnextreaderdata(); // if successful scan (as opposed failed one) if (readerdata.result == results.success) { // setup next scan (because may need scanner // in onbarcodescan event below start(); // handle of window user on when scan sent. intptr handle = coredll.gettopwindow(); // if have barcode scanner method window call delegate now. if (_scandelegates.containskey(handle)) { action<barcodescannereventargs> scandelegate; // method call

c - How does free() know how much memory to free? -

possible duplicate: c programming : how free know how free? in snippet void main() { void *p = malloc(300); printf("%d",sizeof(*p)); free(p); } how free know memory supposed release void pointer? i figure, if there internal table/function, should available find out sizes of kind of objects, whereas output of printf 1 malloc , free own hidden accounting can correct thing. the reason sizeof() not use accounting information sizeof() compile time operator, , malloc/free information not available until runtime.

android - Unable to create Database for content providers -

my application has database has exposed global search. have sqlite database raw file. trying copy database file databases directory in project throws filenotfoundexception. guessing permissions issue. my application similar searchable dictionary problem since have around 2000 records, taking around 15-30 seconds populate database. have way tell user data loading. decided use sqlite database can copy databases directory of project in oncreate method of databasehelper class.[extends sqliteopenhelper]. now use same method copy actual application database , works fine. may because running in same process. how can copy database databases dir or need copy to? thank you. i don't believe possible.

Wordpress Admin: Adding css styles to Rich text editor drop down -

hey know how add own custom css classes wordpress admin rich text editor drop downs? when editing post see drop downs format selected text paragraph, address or h3 tag. proper way add option "highlight" change selected text from: selected text to: <span class="highlight">selected text</span> thanks! if you're using wp3, try using following function in theme's functions.php file: http://codex.wordpress.org/function_reference/add_editor_style more detailed instructions: http://wordpress.org/support/topic/how-to-use-new-add_editor_style-function related question: how use new add_editor_style() function in wordpress?

jquery - IE8 hover issue, making page disappear -

i've got weird problem ie8, every other browser displays fine, no matter ie8 won't play nice. i've got grid of divs, each .gridcell div contains amongst other elements hidden div i'd reveal on hover. so far, i've tried applying class .gridcell div on hover javascript , using css set preview div display block using .hover class. works in every browser besides ie8, when hovering makes whole page disappear until move mouse again. i've tried various attempts using jquery animate hidden div on hover, work, again in every browser, yet in ie8 on hover whole page jumps top on hover no matter version try. i've put rough test case here . in scrappy demo, there z-index issues, these can ignored in proper version they're sorted, illustrate problem. scroll down second row using jquery, , in ie8 page jump top on hover. i'm sure i'm missing simple here, more @ more frustrated get! thanks in advance. well, worked out causing problem.

coldfusion - Friendly Url in format 'mydomain.com/username' without Mod Rewrite? -

i know if there's easier way other mod rewrite (using fusebox framework or directly in coldfusion) convert url follows: from: http://www.somedomain.com/salmahayek or http://localhost/someapp/salmahayek to: http://www.somedomain.com/index.cfm?action=profile.view&name=salmahayek or http://localhost/someapp/index.cfm?action=profile.view&name=salmahayek my app existing fusebox 5.5 application. i need add url above not static, i.e. "salmahayek" name. any appreciated thanks you potentially use "classic" way of doing (not sure if fusebox interfere), using 404 handler, should trick: set 404 hander on server, e.g. in .htaccess: errordocument 404 /404handler.cfm set 404handler.cfm wrap around framework, e.g.: <cfset variables.checksok = false> <!--- checks - example ---> <cfif cgi.redirect_url eq 'salmahayek'> <cfset variables.checksok = true> </cfif> <cfif v

asp.net - Usercontrol int property bind to a null value from database -

i have build usercontrol in asp.net, , there property following. works fine when bound value integer. however, if bound field return null database, return invalid cast error. change nullable int not desirable because changes how programmer work control's property in code-behind. just wonder how these things should implemented? thanks, [defaultvalue(0)] public int fixedlo { { if (viewstate["fixedlo"] != null) return convert.toint32(viewstate["fixedlo"]); else return 0; } set { if (value == null) viewstate["fixedlo"] = 0; else viewstate["fixedlo"] = value; } } would checking dbnull trick? [defaultvalue(0)] public int fixedlo { { if (viewstate["fixedlo"] != null) return convert.toint32(viewstate["fixedlo"]); else return 0; } set { if

authentication - Play framework: How to require login for some actions, but not all -

adding @with(secure.class) controller blocks unauthenticated access. there way enabled actions, or except actions after it's enabled on controller? you can't secure module. niels said secure module more example solution. can build own security system @before annotation. here example: public class admin extends controller { @before(unless={"login", "authenticate", "logout", "othermethod"}) void checkaccess() { // check cookie } public void login() { render(); } public void authenticate(string email, string password) { // check params , set value in cookie } public void logout() { // delete cookie } i recommend read source code of secure module.

optimization - Optimising a PHP If/Else statement -

i'm attempting optimise following php if/else statement. rewrite code make use case , switch , or should leave is, or what? code: if(empty($_get['id'])){ include('pages/home.php'); }elseif ($_get['id'] === '13') { include('pages/servicestatus.php'); }elseif(!empty($_get['id'])){ $rawdata = fetch_article($db->real_escape_string($_get['id'])); if(!$rawdata){ $title = ""; $meta['keywords'] = ""; $meta['description'] = ""; }else{ $title = stripslashes($rawdata['title']); $meta['keywords'] = stripslashes($rawdata['htmlkeywords']); $meta['description'] = stripslashes($rawdata['htmldesc']); $subs = stripslashes($rawdata['subs']); $pagecontent = "<article>" . stripslashes($rawdata['content']) . "</article>";

architecture - Opinions on Server Side vs Client Side Web Framework -

i'm curious community's opinions on server side frameworks (like django , ror) versus client side frameworks (like sproutcore , extjs). i know a bit of false dichotomy since there no reason why 1 cannot use both server , client side framework. in practical terms can huge headache. just example: cultivating expertise in 2 different languages, 2 different apis, , 2 different framework syntaxes achieve single goal terribly inefficient. the strategy feels right me pick 1 client or server side framework primary, , supplement necessary lightweight on other side. example, use ror on server primary supplemented on client jquery. or use extjs on client primary supplemented php on server. right i'm not sure side of fence fall on , interested in community's opinions , experiences. its false dichotomy. solve different subproblems of goal. apparently though, microsoft asp.net stuff pretty @ integrating client-side server side (i have never used myself howeve

unique - PHP: Function to group array of objects by value -

i working multi-dimensional array. how can remove duplicates value? in following array, [0], [2] , [5] have same [id]. there function remove duplicate arrays based on particular value? in case, remove array [2] , array [5], have same [id] array [0]. thank information may have. array ( [0] => stdclass object ( [d] => 2010-10-18 03:30:04 [id] => 9 ) [1] => stdclass object ( [d] => 2010-10-18 03:30:20 [id] => 4 ) [2] => stdclass object ( [d] => 2010-11-03 16:46:34 [id] => 9 ) [3] => stdclass object ( [d] => 2010-11-02 03:19:14 [id] => 1 ) [4] => stdclass object ( [d] => 2010-05-12 04:57:34 [id] => 2 ) [5] => stdclass object ( [d] => 2010-05-10 05:24:15 [id] =>

java - ObjectChoiceField not dropping down -

i'm trying create objectchoicefield passing in string array. creates drop down box , shows first value doesn't drop down when click on it. no errors. testing on 9500 os 5.0. ocf = new objectchoicefield("", getprofessions("specialty_nurse.xml")); proflabel = new labelfield("please choose profession"); add(new labelfield("")); add(proflabel); add(new separatorfield()); choicelistener mychoicelistener = new choicelistener(); ocf.setchangelistener(mychoicelistener); add(ocf); solved. navigationclick() method being overridden had check click on objectchoicefield. post code if needs it. thanks!

How to get facebook total likes for a facebook application? -

i know can total fan count facebook page via facebook graph api. cannot seem able total likes (or fan count) of facebook application. take example, graph.facebook.com/castleage, notice fan count missing...any clues on how so? thanks. try luck this: $data = array(); try { $data = $facebook->api(array( 'query' => 'select uid page_fan page_id=' . $fanpageid, 'method' => 'fql.query' )); } catch(exception $e) { print_r($e); } $fancount = count($data); print_r($fancount);

c# - Passing an object to a method and then calling an extenstion method on that object -

i working on method yesterday , ran strange, here dumbed down version of code: problem orderby applied in bar.populatelist method not persisting. class foo { list myobjects; public void populatemyobjects() { //items added list orderby not persisting. bar.populatelist(myobjects); } } class bar { public static int populatelist(list thelist) { foreach(var in webserbicecall) { thelist.add(var); } // orderby call sorts 'thelist' in context of method. // when return method thelist has been populated ordering has // reverted order items added list. thelist.orderby(obj => obj.id); return thelist.count; } } now if update code , add ref keyword per below works: e.g. public static int populatelist(ref list thelist) , bar.populatelist(ref myobjects); can enlighten me? thought objects passed ref? fact orderby extension method? thanks, cian the problem he

ruby on rails - delayed_job stops running after some time in production -

in production, our delayed_job process dying reason. i'm not sure if it's crashing or being killed operating system or what. don't see errors in delayed_job.log file. what can troubleshoot this? thinking of installing monit monitor it, tell me precisely when dies. won't tell me why died. is there way make more chatty log file, can tell why might dying? any other suggestions? i've come across 2 causes of delayed_job failing silently. first actual segfaults when people using libxml in forked processes (this popped on mailing list time back). the second issue 1.1.0 version of daemons delayed_job relies on has problem ( https://github.com/collectiveidea/delayed_job/issues#issue/81 ), can worked around using 1.0.10 own gemfile has in it. logging there logging in delayed_job if worker dying without printing error it's because it's not throwing exception (e.g. segfault) or external killing process. monitoring i use bluepill monitor d

Dynamic jQuery Selectors, variable problem -

i'm trying make list of questions hidden answers shows upon click. code hides divs, when click on anchors, last box toggled. in case, every anchor toggles 5th box, , not own. for(var i=1; i<6; i++){ var x = i+""; $("#box"+ x).hide(); $("#feature"+x).click(function(){ $("#box"+x).toggle(400); }); } my basic html looks this, 5 pairs: <p><a id="feature1" href="#">1. absent message</a></p> <div id="box1">stuff here 1</div> <p><a id="feature2" href="#">2. alarm setting</a></p> <div id="box2">stuff here 2</div> if wrote out functions without using loop , string concatenation, functions want them to. can point me in right direction? doing wrong string manipulation? your problem x shared between all copies of loop, in end it's 5 , , $("#box"+x) $("#

android - intent filter pathPrefix with question mark -

i want set intent filter handle urls like: http://mysite.com/?action=delete&id=30492 i've tried setting intent-filter follows: <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" android:host="mysite.com" android:pathprefix="/?action="/> </intent-filter> however, doesn't work, , app not recognized being able handle url. know it's because i'm doing wrong pathprefix because when remove pathprefix works. know it's related having question mark in there because if remove question mark url , pathprefix , works. do need escape question mark in way? tried escaping slash ( android:pathprefix="/\?action=" ) doesn't work either. how can intent filter work? the query string

ocunit - How to assert a UILabel.text property is equal to an instance of NSString in objective-c -

i'm new objective-c , i'm finding don't know how correctly assert text property on given label equal raw string value. i'm not sure if need cast label nsstring or if need modify assert statement directly. @interface moretest : sentestcase { magiczztestingviewcontroller* controller; } - (void) testobj; @end @implementation moretest - (void) setup { controller = [[magiczztestingviewcontroller alloc] init]; } - (void) teardown { [controller release]; } - (void) testobj { controller.domagic; stassertequals(@"hehe", controller.label.text, @"should hehe, %d instead", valtxt); } @end the implementation of domagic method below @interface magiczztestingviewcontroller : uiviewcontroller { iboutlet uilabel *label; } @property (nonatomic, retain) uilabel *label; - (void) domagic; @end @implementation magiczztestingviewcontroller @synthesize label; - (void) domagic { label.text = @"hehe"; } - (void)dealloc { [lab

Jqgrid does not initiate server side call -

sorry posting question. :( have spent entire day , need pair of eyes code. os: windows frameworks: jquery (latest version), jqgrid (latest version), spring (latest version) db: postgresql tool: springsource tools suite when type below url, xml data server. http://localhost:8080/myapp/deliveryjqgriddata but below jqgrid call not call above url. dont error on spring tc server. alert message "enteredjqgrid". code below stored in deliveryjqgrid.jsp. same accessed through localhost:8080/myapp/deliveryjqgrid. have scrambled column names given below. <script type="text/javascript"> $(function(){ alert("enteredjqgrid"); $("#deliveryjqgrid").jqgrid({ url:'deliveryjqgriddata', datatype: 'xml', mtype: 'get', colnames:['1col','2col', '3col','4col','5col','6col'], colmodel :

tdd - Want to add rspec to my rails 3 app, what do I need to do? -

i updated gemfile with: group :development, :test gem 'rspec' gem 'webrat' gem 'rspec-rails' end and ran bundle install. now have homecontroller, manually created this: /spec/controllers/home_controller_spec.rb i don't have page started test off with: require 'spec_helper' describe homecontroller describe "get 'about'" "should successful" 'about' response.should be_success end end end now did: rspec spec/ do need update other files rspec work, don't understand error message. update i changed if it, i'm getting: file load -- spec_helper (loaderror) /users/someuser/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /users/someuser/dev/rscs/example.com/spec/controllers/home_controller_spec.rb:1 /users/someuser/.rvm/gems/ruby-1.8.7-p302@rails3/gems/rspec-core-2.2.1/lib/rspec/core/con

java - Designing how much to abstract a setter/modifier -

my application receives xml messages update it's data objects. xml message contains details on how data modified. xml looks like: <data> <stuff> .... </stuff> <stuff> .... </stuff> <objs> <obj attr1=... attr2=... /> <obj attr1=... attr2=... /> </objs> </data> how should update fields of objects? create modify(string xml) method. parse message, extract <stuff> data, reconstruct following <obj attr1=... /> string , pass modify(). create modify(namednodemap xml) method. parse message, extract <stuff> data, keep results of parsing (document object), find relevant node , pass modify(). create modify(string attr1, string attr2, ...) method. parse xml, extract fields, pass modify(). bad idea, because if need more attributes, need change method signature, , breaks depend on modify() method. create setters every field. parse xml, set fields individually. run whole getter ,

database - Hibernate Insert Query in Java -

can tell me how perform insert query hibernate , end postgresql using following implementation not working session session = gileadhibernateutil.getsessionfactory().opensession(); session.begintransaction(); user a= new user(); a.setid(67); a.setfirstname("noor"); a.setlastname("asd"); a.setmobilenumber("2435"); a.settelephonenumber("dfg"); session.save(a); session.gettransaction().commit(); as matt ball suggested, try using entitymanager.persist(java.lang.object entity) ( see here ) instead. or try using persist without entitymanager ( see discussion ).

uitableview - Problem with table view in iPhone when adding image to it -

i have following code create cell , add image it uiimageview* myimage =[[uiimageview alloc]initwithframe:cgrectmake(100,10,40,40)]; [myimage setimage:[uiimage imagenamed:[imagearray objectatindex:indexpath.row]]]; [myimage setbackgroundcolor:[uicolor clearcolor]]; [cell addsubview:myimage]; [myimage release]; cell.textlabel.text=[dataarray objectatindex:indexpath.row]; return cell; i using table many purposes , therefore refreshing again , again.... therefore next age overlaps last 1 due problem occurs , both of these images visible(i using transparent background each image).... other problem occurs when need no image..here unable remove last image ... please help as might aware when reuse cell 'dequeuereusablecellwithidentifier', returns existing cell instance if present, means if cell exist data exists i.e. image, need clear old image before updating cell new data if new data doesn't have image show old image, guess got point... ok

php - Is the W3C or any standards body working on a single standard for Entity Attribute ORM definitions? -

there literally dozens of xml, yaml, json, , nested array based (that whole convention on configuration thang) standards describing : database tables, classes, maps between tables , classes, constraints, user interface descriptions, maps between entities , user interfaces, rules user interfaces, etc. every major language has system , competing standards. [http://en.wikipedia.org/wiki/list_of_object-relational_mapping_software] some "patterns" active-record getting implemented in php, python, ruby, java etc. there no single consensus xml or nested array thingy de-dur. mean while in redmond, microsoft crafting xml standards for, well, , entity framework have yet orm standard. entity framework + wpf (windows presentation foundation) + wcf (windows communication foundation) + wf (windows workflow foundation) + linq (language-integrated query) = ??? i recall mozilla's xul nifty thing, did not include orm. seems microsoft creating massive set of standards, in xm

asp.net - Browsing to .ASHX files on Windows Phone 7 -

we have whole bunch of wml pages served out using ashx files , we've had no problems them. however, has got windows 7 phone , when browse 1 of these pages get: can't download file! windows phone doesn't support .ashx files is there iis configuration need make work? the phone doesn't care extension. sounds it's problem mobile data provider. you might want check out: http://social.answers.microsoft.com/forums/en-us/windowsphone7/thread/5b96aa40-f5f6-4123-8854-f666c822c4a6 in particular pay attention to: "actually - resolved now. contatcted mobile data provide , knew issue - lifted website restriction setting had defaulted to. in ordre now." (sic)

header - Putting an icon at the right end of a WPF expander control -

hi attempting put green tick icon @ right end of wpf expander control when checkbox set. code is: <expander x:name="imageexpander"> <expander.header> <grid width="450"> <grid.columndefinitions> <columndefinition width="*" /> <columndefinition width="auto" /> </grid.columndefinitions> <label padding="0">my header text</label> <image grid.column="1" margin="0" source="c:\...\greentick.png" width="18" /> </grid> </expander.header> </expander> i used grid put icon in top right corner of expander. puts header text in usual spot next twiddle expanding expander. puts icon 450 pixels further along near right end of expander. i hoping have not hard coded no matter how wide expander grows icon stays