Posts

Showing posts from September, 2012

security - API Keys vs HTTP Authentication vs OAuth in a RESTful API -

i'm working on building restful api 1 of applications maintain. we're looking build various things require more controlled access , security. while researching how go securing api, found few different opinions on form use. i've seen resources http-auth way go, while others prefer api keys, , others (including questions found here on so) swear oauth. then, of course, ones prefer, say, api keys, oauth designed applications getting access on behalf of user (as understand it, such signing non-facebook site using facebook account), , not user directly accessing resources on site they've signed (such official twitter client accessing twitter servers). however, recommendations oauth seem basic of authentication needs. my question, then, - assuming it's done on https, of practical differences between three? when should 1 considered on others? it depends on needs. need: identity – claims making api request? authentication – are? authorization – allowed

layout - laying out formitems in flex -

for reason code not having desired effect of having labels left of textinput fields*(like in normal scenarios forms). labels appearing above textinput fields. make of them read only. advice appreciated basically have text sitting above textbox instead of alongside left. here code: <mx:vbox width="100%" height="100%"> <mx:hbox> <mx:formitem textalign="left" <mx:label text="test" textalign="left" fontsize="14" fontweight="bold"/> <mx:textinput enabled="true" textalign="right"/> </mx:formitem> use label field of formitem. <mx:formitem textalign="left" label="test" fontsize="14" fontweight="bold"/> <mx:textinput enabled="true" textalign="right"> </mx:formitem> if want read-only, can put editable="true|false" in texti

php - Put mysql data into html table with edit buttons -

i'm attempting make ticket system out smaller company. i've made submission form saves mysql database. can save data table , pull date html table. i've been searching day, however, figure out how put in cell allow me click button, link, or whatever change row completed. have field in database it, don't know how cell table or how link understand row i'm talking about. i've been searching google awhile , getting how make html table mysql data or how insert mysql table. you'll need 3 things: update statement , field in row want update, , unique way of identifying row (entry) want update. you'll want create link similar to: <a href='/path/to/update.php?id=myuniqueidentifier'>complete</a> and on php page you'll want use $_get['id'] passed (make sure use msyql_real_escape_string() ) update row , set completed flag whatever want.

compression - Trying to figure out a basic pattern finding algorithm -

long story short, have data need find patterns in. data (each character represents immutable chunk): dabababacdacdacdab i want able break data following kinds of chunks: d (repeated 1x) ab (repeated 3x) (1x) cda (3x) b (1x) i'm familiar basic run length encoding, don't know how when length of "thing" may variable (in example, cda 3 chunks of data, d 1 chunk). making sense? appreciated. the main difficulty here "greediness" of algorithm , ambiguity can produce. given example, rule tell program not represent string as: d x 1 ababab x 1 <<<<<----- here's problem cda x 1 b x 1 or worse yet: d x 1 abababcdab x 1 you see mean. you need establish set of rules algo follow, , code kinda write itself. t gain insight on this, might try looking @ of regular expression parsing code in grep.c, although may more advanced need. as start, consider algorithm that: 1. limits how far ahead scan (i.e. set maximum substring

jquery / jquery ui : $ is undefined -

i have file think jquery ui. mentions jquery in code condensed, it's hard tell. i included both jquery1.6.2.js , custom.js. (confirmed both loading properly) there sliding image panel works fine when both included, although message: $ undefined own code (not custom.js) i read somewhere problem might need not include jquery, seems disable image slider. $ function seems work fine if remove custom.js, of course slide doesn't work. any ideas? make sure include jquery then jqueryui before plugins.

configuration - Why does a nested ASP.NET 4.0 web.config occasionally cease to inherit? -

given web application following structure: main site (/) web.config (root; appsetting="rootsetting") applications (/applications) app1 (/applications/app1) web.config (app1; appsetting="app1setting") inside application, of time can obtain both "rootsetting" , "app1setting" via webconfigurationmanager.appsettings[] , webconfigurationmanager.connectionstrings[] static indexers. however, time time, appears app1's web.config not loaded. when occurs, can "rootsetting" "app1setting" returns null. i running under windows server 2008 r2 / iis7.5 / managedpipelinemode=classic. consider using settings file, describing in answer this question . may simplify trying accomplish.

Android Vertical scrolling for ListView inside Horizontal scrollView -

i have custom arrayadapter listview inside horizontal scrollview.the horizontal scrolling works fine vertical scrolling had hacks. want know if idea since listview optimized vertical scrolling.? there way scroll without hack ? the hack capture touchevent scrollview(parent class) , propagate touchevent listview. scrollview.setontouchlistener(new ontouchlistener(){ @override public boolean ontouch(view arg0, motionevent arg1) { lv.setsmoothscrollbarenabled(true); lv.dispatchtouchevent(arg1); } }); this causes scrolling happen , things work. want know if there more things need take in account. thanks your horizontal scroll view in parent class, touch event recognized scroll view , not list view. if want list view scroll, way did correct.

c# - Shell extension - on the explorer window -

i'm creating shell extension in c# using microsoft source code registering , unregistering shell context menu handler. the registration looks that: public static void registershellextcontextmenuhandler(guid clsid, string filetype, string friendlyname) { if (clsid == guid.empty) { throw new argumentexception("clsid must not empty"); } if (string.isnullorempty(filetype)) { throw new argumentexception("filetype must not null or empty"); } // if filetype starts '.', try read default value of // hkcr\<file type> key contains progid file type // linked. if (filetype.startswith(".")) { using (registrykey key = registry.classesroot.opensubkey(filetype)) { if (key != null) { // if key exists , default value not empty, use

javascript - jQuery tablesorter sort by column id instead of column number -

i have html table i'm sorting jquery tablesorter. have external link sorts table name using javascript. within javascript function though, have sort column 0 instead of saying sort name column. how can modify have below don't have remember name column 0 in javascript? $('document').ready(function(){ $('table#classes_table').tablesorter(); $("#sort-link").click(function() { //how can sort "name" instead of having remember name column 0 var sorting = [[0,0] $("table").trigger("sorton",[sorting]); return false; }); }); <a href="#" id="sort-link">sort name</a><br><br> <table class="tablesorter" id="classes_table"> <thead> <tr> <th>name</th> <th>school</th> <th>students</th> </tr> </thead> <tbody>

How to select unique rows followed by row with highest value in MySQL? -

i have mysql database table containing information places. i'm trying fetch unique categories followed place highest rating, results returned server not seems accurate. in database in 1 category can few records scored 100 mysql select 1 have score 95 example. here query: select category, score, title places active = '1' group category order score desc is possible in single query? update i have rewrote query suggested use mysql function max() returned results still wrong here example of new query select category, max(score) maxscore, title, score realscore places active = '1' group category order score desc select category , max(score) maxscore places active = '1' group category if want other fields too, besides category , (maximum) score , can use subquery: select p.category , p.score , p.title , p.otherfield , ... places p join ( select category , max(score) maxscore pla

Check if filename contains Umlauts in php -

is there way, check in php if filename has umlauts? there's quick way this: $s = 'äëüïö'; if (preg_match('/&[a-za-z]uml;/', htmlentities($s, ent_compat, 'utf-8'))) { echo 'filename contains umlaut'; }

java - Which JAR files to add in order to get going in Spring Framework 3.0.5? -

the tutorials said needed import spring.jar , commons-logging.jar files in order going. using spring 2.5.6. the 3.0.5 version i'm using doesn't contain spring.jar file. referred instead? much depends on parts of spring need. spring contains lot of modules in , not bundled anymore. maven repository lists released spring artifacts. ones start spring- , navigate inside see if released in 3.0.5 . if don't - don't need them. , files named pom.xml inside directories may give idea on external libraries need.

java - Generate a report with multiple tables -

Image
i'm new jasperserver , ireport, i've been managing. did reach block today , here problem: i'm trying display multiple tables (maybe 50+) each table can have same data in first column. row column entire different row row. mean following: value1 x1 y1 z1 value1 x2 y2 z2 value1 x3 y3 z3 value2 x1 y1 z1 value2 x2 y2 z2 value2 x3 y3 z3 this can have first column similar same value. i'm trying change each first column has own table so: value1 table ------------ x1 y1 z1 x2 y2 z2 x3 y3 z3 value2 table ------------ x1 y1 z1 x2 y2 z2 x3 y3 z3 edit to expand on original question, data i'm retrieving via sql stored in 1 table. i'm trying break table simple formatting. i've linked picture ease understanding. link picture is possible in ireport? it's bit hard understand want, i'm going guess... select * table1 union select * table2; union all differs union in all rows returned in order selected. compar

Can not figure out jquery error -

i can't figure out error in this. see it? $('.ask').jconfirmaction( { question : "are sure want delete selected row?", yesanswer : "yes", cancelanswer : "no", onyes: function( evt ) { contentpages( evt.target ); } } ); $('.ask2').jconfirmaction( {   question : "are sure want delete selected rows?",   questionclass: "question2", onyes: function( evt ){   contentpages( evt.target ); }   } ); function contentpages(whatsthis) { var contentpageid = $(whatsthis).parents('td').find('img').attr('id'); var datastring = 'contentpageid=' + contentpageid + '&deletecontentpage=true'; $.ajax({ type: "post", url: "processes/contentpages.php", data: datastring, }); $(whatsthis).parents("tr").eq(0).hide(); } you have comma here: data: datastring, });

git - What do all the changes to .xuserstate and .xcscheme files represent? -

whenever check in changes os x app xcode 4 projects git, lot of lines of files these changed practically every commit .../userinterfacestate.xcuserstate | 3927 ++++++++++++++++++++ .../test.xcuserdatad/xcschemes/deployment.xcscheme | 72 + .../test.xcuserdatad/xcschemes/hush.xcscheme | 76 + .../xcschemes/xcschememanagement.plist is stuff necessary put under version control? changes *.xcuserstate clutter output of git log -p much. here post describes can safely put in ignore files. looks can safely ignore of them. here few others posts: post 2 post 3 post 4

asp.net - How to easily redirect if not authenticated in MVC 3? -

i brand new asp.net, , i'm trying find way redirect unauthenticated user page on site logon page. prefer not put following code in every http function if there option. if (!request.isauthenticated) { return redirecttoaction("logon", "account"); } mark controller [authorize] attribute http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.aspx see web.config, default should have forms authentication turned on authentication mode="forms" http://msdn.microsoft.com/en-us/library/eeyk640h.aspx also @ question asp.net mvc authorization in case if want have custom authorize behavior here customizing authorization in asp.net mvc

How to create popup window to create new record in rails 3 -

we have requirement web page displays records joining few tables. have "add button" - upon clicking button, have display popup window, user enter necessary details. popup have 2 buttons save , cancel. clicking save button, should validate fields , if validations passed, save record database else display error messages in alert boxes. clicking cancel button close popup window. how create popup upon clicking add button? you need separate things server-side (rails, controllers, actions) , client-side (popups, javascript, sending requests). your client-side actions (javascript code) should think rails application some server, returns some responses some requests. javascript's point of view not important whether server running rails or smalltalk. the basic workflow popup may be: 1) open new window - requires client-side activity of javascript. use window.open function, or (i humbly consider method better one) create new <div> , style css

Android C2DM working if the task is killed -

if server tries send cloud message device, task killed somehow (such advanced task killer), message shown? yes. should using broadcastreceiver registered in manifest receive c2dm message broadcasts meant application when hit device. messages sent on connection maintained google services and, thus, independent of whether app running.

sql - Get DateTime with time as 23:59:59 -

i'm trying statement specifies datetime field between start , end of previous month. to this, need specify first day of previous month has time of 00:00:00 , last day of previous month has time of 23:59:59. this second condition giving me headache.. can me out? cheers mssql 2008 try: select dateadd(ms, -3, '2011-07-20') this last 23:59:59 today. why 3 milliseconds?, because microsoft sql server datetime columns have @ 3 millisecond resolution (something not going change). subtract 3 milliseconds

javascript - Setting Width For Dojo Button -

note: related this question . i trying create dojo button programmatically this: var btnok = new dijit.form.button({ label: "ok", showlabel: true, style: "height: 20px; width: 50px;" }); now though specify width, while displaying button width set minimum (i.e text + margin). reason explained in answer dojo overrides css style button ( class="dijitbuttonnode" ). further (in same answer) width set overriding styles same class. is possible same (i.e set width) without css workaround ? finally, worked out. set width have set width using dojo.style function dojo.create("button",{id: "btnok",type: "button"},dojo.body()); var btnok = new dijit.form.button({ label: "ok", showlabel: true, style: "height: 20px;" }, "btnok"); dojo.style("btnok","width","40

sql - Why are tables created with default schema dbo although I specified a different schema? -

if run sql script in sql server 2005 ssms (version 9.00.4035.00) like create table xxx.mytable the table created dbo.mytable although schema xxx exist! no error message! the user i'm using run script permissions (tested windows user , sql user server role sysadmin) what's wrong? you have 2 tables now xxx.mytable dbo.mytable to check: select schema_name(schema_id), name, create_date, modify_date sys.objects name = 'mytable' don't rely on ssms object explorer: needs refreshed (right click on tables node, refresh). or wrong database, wrong server etc. we use schemas , never had problems edit: check databases exec sp_msforeachdb ' use ? select schema_name(schema_id), name, create_date, modify_date sys.objects name = ''mytable'' '

objective c - Play continuos music throughout the app -

im trying find way make background music play throughout whole app, changes classes time, know how play sound file, making play through whole app when switching nibs different thing, know how it? thought putting in app delegate, doesn't run during whole app? correct me on if im wrong. hehe. thanks! using delegate should work. can try using singleton class this.

asp.net - DropDownList and Update Panel -

i develop address control, contains 2 dropdownlists (for cities , countries) , several textboxes. second dropdownlist datasource depends on first dropdownlist datasource. <fieldset> <legend><%=title%></legend> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <div> <label for="<%=ddlcountry.clientid %>">country</label> <asp:dropdownlist runat="server" id="ddlcountry" datatextfield="name" datavaluefield="id" datasource="<%#facade.addresses.getcountries() %>" autopostback="true" onselectedindexchanged="ddlcountry_selectedindexchanged" /> </div> <div> <label for="<%=ddlcity.clientid %>">city</label> <asp:d

c# - Retrieving VARCHAR(MAX) -

how can retrieve column of datatype varchar(max) sql server database in c#? i don't think sqldatareader helps retrieve it. any clue? thanks it's string field .... grab other string..... // define query string query = "select yourfield dbo.yourtable id = 1"; using(sqlconnection conn = new sqlconnection("......")) using(sqlcommand cmd = new sqlcommand(query, conn)) { conn.open(); using(sqldatareader rdr = cmd.executereader()) { if(rdr.read()) { string fieldvalue = rdr.getstring(0); } } conn.close(); } there's nothing special varchar(max) type - it's text field, , can hold 2 gb of text - .net string . don't need special, streaming or - read column string!

asp.net mvc - Security problems with autologin and FormsAuthenticationTicket -

im using autologin on mvc 3 website. how best handle problem: a user signs in @ own computer (and gets 30 day cookie) same user signs in @ friends computer (and gets 30 day cookie) its possible autologin in @ both computers. user realizes , changes password friend still able autologin computer until cookie expires. how best handle this? i of course set @ date on user when password changed , check against date in cookie. or missing something? i know you're saying, think you're implying association between "remember me" function , "password change" function in practice, isn't there. auth token when authenticating not tied value of password (i.e. when using membership provider), after all, you're logically keeping identity authenticated across sessions , in regard, works fine. to honest, sounds more of user behaviour problem technology problem. in use case, consciously asking browser allow them remain authenticated long per

ios - NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused" -

i have strange problem sending more 1 file on ftp server via wifi network in specific environment. use own, self-made ftp client (made on sockets). when test transfer sending files on server 's1' in environment 'e1' ok. when test transfer sending files server 's2' in 'e1' ok also. when person sending files server 's1' in 'e2' ok, too. but when person sending files server 's2' in 'e2' transfer broken after sending 1 file (!) , error appears: error domain=nsposixerrordomain code=61 "the operation couldn’t completed. connection refused" update : , 1 more important thing: person can send same files success 's2' in 'e2' via other device (nokia symbian). i have no idea what's going on. you? 's1' - ftp server in location 'e1' - environment: ios device, wifi network w1, firewall f1, 's2' - ftp server in other country 'e2' - environment in othe

javascript - How to get the MouseEvent coordinates for an element that has CSS3 Transform? -

i want detect where mouseevent has occurred, in coordinates relative clicked element . why? because want add absolutely positioned child element @ clicked location. i know how detect when no css3 transformations exist (see description below). however, when add css3 transform, algorithm breaks, , don't know how fix it. i'm not using javascript library, , want understand how things work in plain javascript. so, please, don't answer "just use jquery". by way, want solution works mouseevents, not "click". not matters, because believe mouse events share same properties, same solution should work of them. background information according dom level 2 specification , mouseevent has few properties related getting event coordinates: screenx , screeny return screen coordinates (the origin top-left corner of user's monitor) clientx , clienty return coordinates relative document viewport. thus, in order find position of mouseevent r

javascript - Need whole body tag mouseover function -

i need whole body mouseover function. when enter other page, of content append particular div. my code is: $('body').mouseover(function() { $('#text').append('<div>new content</div>'); }); the body not have full potential height if contents fit in lower height. you use $('html').mouseover instead: http://jsfiddle.net/mpdd7/ .

java - performance tuning weblogic -

we have unstable system runs on weblogic 10.3 portal , somehow for while keep limiting number of users can handle 100 or 200. is there way can set ? self-tuning-thread-pool-size-max still available in 10.3 ? (don't find documentation related 10.3 regarding this) thank ! you should describe behavior want. work manager max threads constraint of 100 not limit application 100 users, limit servicing 100 concurrent requests @ same time. http://blogs.oracle.com/jamesbayer/entry/weblogic_server_work_manager_demo if want limit 100 users, consider setting max in-memory sessions if you're using sessions. can set in weblogic.xml deployment descriptor or in wls console in configuration->general section of deployment. http://download.oracle.com/docs/cd/e21764_01/web.1111/e13712/weblogic_xml.htm#i1071981

jsf - SelectOneRadio with Ajax event does not trigger -

there site developed. want use <h:selectoneradio> <f:ajax> change content of form in page. searched many sites not find. when radio button selected form redisplayed. how can ? codes : <h:selectoneradio value="#{guest.rdselected}"> <f:selectitems value="#{guest.uyruk}" /> <p:ajax render="lbltcpasaport txtname txtsurname" event="click" listener="#{guest.changetcpasaportfields}" /> </h:selectoneradio> <h:outputtext id="lbltcpasaport" value="#{guest.nameoflbltcpasaport}" /> <h:inputtext id="tcno" value="#{guest.tcno}"> <f:ajax event="blur" render="lblerrormessage txtname txtsurname" listener="#{guest.getnamesurname}" /> </h:inputtext> ad <h:inputtext id="txtname" value="#{guest.name}" disabled="#{guest.isnamesurnamedisabled}"> <

javascript - Is a Youtube buffer finish event possible -

is possible detect finish of youtube buffering through javascript? here http://code.google.com/intl/de-de/apis/youtube/js_api_reference.html lot of methods no 1 has event says "finished buffering". var ytplayer; function onyoutubeplayerready(playerid) { ytplayer = document.getelementbyid("myytplayer"); checkbuffer(); } function checkbuffer(){ if(ytplayer.getvideobytesloaded() == ytplayer.getvideobytestotal()){ alert('buffer complete!'); }else{ var t = settimeout(function(){ editor.split(); },1000); } }

HTTP Error 403.1 with WCF service on IIS -

i have added wcf rest endpoint webhttpbinding our existing asp.net server hosted on iis 6. when make request such http://{server}/cmis.svc/object/{object_id}, object returned server. when make delete request same url , iis returns 403.1 error (forbidden: execute access denied). tried setting write permission on home directory tab of website didn't help. can see url, cmis.svc @ root of website. any guesses might going wrong? thanks. use request filtering on site allow delete verb

binary - How to parse out information of WMV file in C# -

i want information of asf file bitrate, metadata, language...i have read asf specification , know asf file has parts : header object, data object, index object. @ frist, think asf file's binary file , try solve class , function in c# : filestream, binaryreader : string path = @"e:\khoaluantn\streaming video server\video\encoder_ad.wmv"; filestream filer = file.openread(path); binaryreader br = new binaryreader(filer); byte [] file = br.readbytes(100); then, try convert string : textbox1.text = encoding.ascii.getstring ( file ); but doesn't display expect. displays nonsensical string: 0&?u?f? ??. please show me how convert information in asf file string. you can check out asfmojo on codeplex. offers simple api extract of information interested in: sample code using (asffile asffile = new asffile(samplefilename)) { //get bitrate uint asfbitrate = asffile.packetconfiguration.asfbitrate; console.

Wordpress Disable Plugin on Specific Pages/Posts -

does know effective method disabling plugin (that active) on specific page? there plugins not needed in pages of website , have lot of css , javascript files slowing loading speed of website , might conflict other files. i know can mess plugin's code etc. it's not effective. any ideas? thanks in advance! try "plugin organizer" wordpress plugin jeff sterup. have enable "selective plugin loading" under it's settings (make sure follow directions given enabling it) then in post/page editor there box below compose window tickboxes disable whichever particular plugin page took me 20+ google , wordpress plugins repository searches find simple solution. hope works too!

Connect to redis through C# redis client slow ! -

may know benchmark c# redis ? try connect redis through tcp/ip 456 bytes data. benchmark below: hset - 600 writes/seconds, loop 10000 times 600 reads/seconds, loop 10000 times it normal? suspect tcp/ip transfer rate slow because slow transfer rate 156 kbps. had set tcp receive window size speed still same. tried using ubuntu benchmark redis through tcp/ip. transfer rate can 3 mbps. hset - >10k per seconds. the problem latency - while redis can handle many thousands of operations per second, single synchronous connection spend of it's time waiting network. test loop like: client network server send 1ms process (0.01 ms) 1ms result received so operation takes total time of 2.01ms, both client , server idle of that. means can make use of parallelism - split loop across 100 threads there no waiting on network , can 100 results in same 2m

python - Unknown specifier in URL when using Django-Tagging -

hi getting following error; error @ / unknown specifier: ?p[ this urls file looks like; urlpatterns = patterns('mainpage.views', (r'^$', 'index'), (r'^post/(?p<id>\d+)/$', 'post'), (r'^projects/$', 'projects'), (r'^about/$', 'about'), (r'^tags/$', 'tags'), (r'^tag/(?p[-_a-za-z0-9]+)/$', 'with_tag'), (r'^tag/(?p[-_a-za-z0-9]+)/page/(?pd+)/$', 'with_tag'), (r'^comments/$', include('django.contrib.comments.urls')) the 2 urls view name of with_tag offending urls. following this tutorial ; to tagging working on site. using django-tagging 1.3.1 , python 2.7. can tell me doing wrong urls.py file please? copying tutorial book there must different in set compared set used in tutorial? this not related django-tagging, it's regex syntax error. ?p indicates named group, , requires name after it: ?p<f

Nhibernate transaction issue when moving to mysql from mssql -

i using nhibernate mssql (2008) , worked great. had web app bound session per request , wrapped every unit of work within transaction. transactions injected via aop , custom attribute, required attribute wrapped in transaction either ended commit or rollback. again clarify working fine in mssql , using nhibernate profiler can see transactions occurring expected. now have added support mysql (5.1) (as 1 environment uses mysql db), have setup tables innodb , table structures identical, bit baffled why following error: row updated or deleted transaction (or unsaved-value mapping incorrect): [somerandomentity#1]could not synchronize database state session checking on nhibernate profiler, beginning transaction, firing update call bombing out error, whereas should committing @ point. if helps sql being fired in update (names changed): update some_table set some_column_1 = 1230697028 /* ?p0 */, some_column_2 = '2011-07-21t10:58:59.00' /* ?p1 */ some_column_3

javascript - "Object has no method 'getBounds'" error in OpenLayers -

i'm using code draw point on map: function addpointtomap(pmap){ var coordinates = new array(); // style point var style_blue = openlayers.util.extend({}, openlayers.feature.vector.style['default']); style_blue.strokecolor = "blue"; style_blue.fillcolor = "blue"; // make point coordinates.push(new openlayers.geometry.point(33, 33)); var pointfeature = new openlayers.feature.vector(coordinates, null, style_blue); // layer var pointslayer = new openlayers.layer.vector("points layer"); pointslayer.addfeatures([pointfeature]); pmap.addlayer(pointslayer); } i'm getting error console: uncaught typeerror: object point(33, 33) has no method 'getbounds' what doing wrong? for sake of completeness, received similar error while adding polygon (not point) raw wkt data. error there no bounds occur because object of wrong type. when call addfeatures , expects arra

iphone - View is not adjusting itself after hiding Tabbar -

Image
i have uitabbar having 5 tabs now want hide uitabbar when taps on feed tab. want show full screen there. able hide tabbar uiview of feed screen not adjusting , can see white space @ place of uitabbar. set frame of view after hiding uitabbar not working. how can object of uitabbarcontroller in uiviewcontroller classes added on uitabbar can call delegate methods of uitabbarcontroller. instance, how can have object of uitabbarcontroller in feed class.please help! if not clear please let me know. thanks- try add self.hidesbottombarwhenpushed = yes; inside of -(id)initwithcoder:(nscoder *)adecoder; of feed class implementation so: -(id)initwithcoder:(nscoder *)adecoder{ self = [super initwithcoder:adecoder]; if(self){ self.hidesbottombarwhenpushed = yes; //more of initialization code... } return self; } it should in -(id)initwithcoder:(nscoder *)adecoder; , not -(id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundle

Delphi run console application from form application -

how run console application standard delphi form application, run hidden? want write commands in console application form application. how can things? and personal request people have newest version of indy10. have trouble compile the console application , if possible of compile me , give me link download. please, nice if me favor. :) to run console app , hide console window, call createprocess passing create_no_window in creation flags parameter.

objective c - Newbie question -multiple parameters -

i trying implement private method takes nsmutabledictionary , player object parameters. private method, place exists in ".m" file. it declared as -(void) incrementscore: (nsmutabledictionary*) scoreboard forplayer: ( player* ) player { and call follows : [ self incrementscore:deucescore forplayer:p]; however,it won't compile - may not response message -incrementscore:forplayer i'm not sure error lies - need declare method in ".h" file, or elsewhere in ".m" file, or have got syntax wrong? the compiler needs find declaration method somewhere before use it. done in 3 way: declare method in (public) @interface class in .h file . declare method in class extension (a semi-private @interface , @ top of .m files). define method somewhere in @implementation before first use of it.

soap - Retrieving data from WSDL webservice in PHP -

i'll start out saying have no idea ever trying do. php skills -beginner- , experience webservices null. i have wsdl url http://example.com/ws/3.1/nne?wsdl . call searchtargetgroup method php script, can loop through answer , save data database. anywho, have no idea how create call php. :-( i've looked @ nusoap php , built in soapclient, without luck. think problem i'm trying call complex method without understanding frog i'm messing around with. so used soapui retrieve definition file , creating request, works , i'm getting info want. problem is, have no clue how should make php file creating exact same request soapui (and thereby getting correct answer). the xml request soapui generates me looks this: <soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nne="http://example.com/ws/nne&q

flash - How to use loaderInfo? -

i want make loading bar @ first need have loading info per enter frame. how seem not working. teach me how it? var maploader : loader = new loader( ); var maploaderinfoload:number; var maploaderinfototal:number; public function engine() { addeventlistener( event.enter_frame, onenterframe,false,0,true ); maploader.load( new urlrequest( "mapcontrol.swf" ) ); maploader.contentloaderinfo.addeventlistener(event.complete, completehandler ); } private function onenterframe( evt:event ):void {maploaderinfoload = maploader.loaderinfo.bytesloaded; maploaderinfototal = maploader.loaderinfo.bytestotal; trace(maploaderinfoload); trace(maploaderinfototal);} public function completehandler ( eventobj : event ) : void { stage.addchild( maploader.content ); } the bytestotal of loader's loaderinfo return 0 until loader has fired it's first progress event. there reason why want use e

algorithm - Frequency determination from sparsely sampled data -

i'm observing sinusoidally-varying source, i.e. f(x) = sin (bx + d) + c, , want determine amplitude a, offset c , period/frequency b - shift d unimportant. measurements sparse, each source measured typically between 6 , 12 times, , observations @ (effectively) random times, intervals between observations between quarter , ten times period (just stress, spacing of observations not constant each source). in each source offset c typically quite large compared measurement error, while amplitudes vary - @ 1 extreme on order of measurement error, while @ other extreme twenty times error. outlines problem, if not, please ask , i'll clarify. thinking naively problem, average of measurements estimate of offset c, while half range between minimum , maximum value of measured f(x) reasonable estimate of amplitude, number of measurements increase prospects of having observed maximum offset mean improve. however, if amplitude small seems me there little chance of accurately determining

c# - What is the best way to implement a Must Set Property for a Base class? -

i have simple basic question c# , inheritance. in below example, i'm showing 2 ways of setting must set properties (captiondisplaytext , firstname): public abstract class baseclass { private string _firstname; protected baseclass(string captiondisplaytext) { this.captiondisplaytext = captiondisplaytext; this._firstname = this.getfirstname(); } protected string captiondisplaytext { get; private set; } protected abstract string getfirstname(); } public class derivedclass : baseclass { protected derivedclass():base(string.empty) { } protected override string getfirstname() { return string.empty; } } approach 1, captiondisplaytext, introduces property , sets in constructor whereas approach 2 introduces abstract method overridden in derived class. i know approach2 bad if method virtual rather abstract here it's abstract means executed before constructor of base class , fine. i'm having 10-15 pr

mysql - Which method for storing creation date, update, creator ... should I use -

i designing database site heavily datadriven forums , chat , other community features. my question this: have identified information store @ least of tables. creation date, last update, creator , others. which best way store these, in dedicated table or fields in each respective table? why better solution better? can opinion of best solution change if have 50 tables or 100 tables? 100 000 records vs 4 million? are there other aspects? creation date , last update date best stored columns in same table respective data. doing that, can use timestamp data type updated automatically when respective rows change. the null timestamp on row_created column default timestamp when row created. in row_updated , timestamp updated automatically every time row modified in way. not need modify them in application code. create table test.table ( row_created timestamp null, row_updated timestamp default current_timestamp on update current_timestamp ) the creator user

StructureMap: how to correctly set up default dependencies -

an approach we've taken include structuremap registry in each of our assemblies set's default dependencies. we use scanner this: cfg.scan(scanner => { scanner.thecallingassembly(); scanner.assembly("assembly1"); scanner.assembly("assembly2"); scanner.assembly("assembly3"); scanner.lookforregistries(); }); the idea can override default dependencies main application. the question is, should register these overrides? i.e. before scan?, after scan? furthermore, order of assemblies specified in scan expression, effect order in dependencies registered. in example above, registries contained in main application (thecallingassembly) overrided in "assembly3"? many thanks ben registries in thecallingassembly overridden register in assembly1, 2 etc. so if register isomeinterface in of assemblies, 1 in assembly3 default. ones registere

php - How can I handle a huge XML file using SimpleXML but to prevent memory and performance problems? -

i trying avoid xmlreader app build has huge xml file. simplexml easy write , wondering if there way handle (memory , performance issues) in quite busy server. do, echo data xml search form. ok, if want without xmlreader, here's do. use fopen open , read n number of bytes of file. fix ending : (that's tough part it's doable) closing left unclosed , if needed backtracking if happen in middle of text. when xml chunk valid can parse simplexml. process chunk or save in separate xml file , create chunk ...until have of them. obviously if xml complex might little painful. summary : creating own custom/dirt-cheap xml parser/fixer can split huge xml file multiple smaller files.

routing - Consolidate CakePHP routes -

is there way consolidate following rules 1 rule? router::connect('/manufacturer/:manufacturer/:friendly0', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/:friendly2', array('controller'=>'categories', 'action'=>'view'), array('pass'=>array('manufacturer', 'friendly0', 'friendly1', 'friendly2'))); router::connect('/manufacturer/:manufacturer/:friendly0/:friendly1/:friendly2/:friendly3', array('controller'=>'catego

How to update the whole list when just one element is modified outside in a class in c#? -

class foo { public list<object> mylist; public int num; public string name; public bool isit; public foo() { mylist = new list<object>(); mylist.add(num); mylist.add(name); mylist.add(isit); } } class program { static void main(string[] args) { foo = new foo(); my.isit = true; my.mylist[0] = 5; my.mylist[1] = "hello"; console.writeline("" + my.mylist[2]); => returns false instead of true console.readline(); } } assuming list have item @ index 2: private bool _isit; public list<object> mylist; public bool isit{ get{return _isit;} set{ _isit = value; mylist[2] = value; } }

PHP Contact Form not working with Outlook email addresses -

i have contact form on html page. form data sent php page sends info email address. works addresses *@gmail, *@hotmail.com person needs receive has outlook set-up website.com address , doesn't work. there setting need somewhere? here php code: <?php $emailfrom = "myname@website.com"; $emailto = "receiver@website.com"; $subject = "website contact form"; $name = trim(stripslashes($_post['name'])); $location = trim(stripslashes($_post['location'])); $phone = trim(stripslashes($_post['phone'])); $email = trim(stripslashes($_post['email'])); $comments = trim(stripslashes($_post['comments'])); // prepare email body text $body = ""; $body .= "name: "; $body .= $name; $body .= "\n"; $body .= "location: "; $body .= $location; $body .= "\n"; $body .= "phone: "; $body .= $phone; $body .= "\n"; $body .= "email: "; $body .= $em

paypal integration for android and iOS, possible? -

in our apps, (versions both os), want allow user pay subscription. app being developed in titanium ios, , native android. can integrate paypal payments them?? posible? or solutions redirect web-app (in safari mobile) make payment, , redirect app?? dont know if can implement "native" experience, using titanium+addons , paypal mobile sdk api. if have experience, please show me light.... yes,paypal integration possible in android iphone.

c++ - Optimizing composite std::functions -

is possible optimize series of "glued together" std::function s and/or there implementation attempts this? what mean expressed mathematically: want make std::function function of function: f(x,y,z) = x^2 * y^3 * z^4 g(x,y,z) = f(x,y,z) / (x*y^2) is there way stl/compiler implementor optimize away parts of arithmetic calling function object of g , created function object of f ? this kind of symbolic simplification of functions, because std::function , have spotted on machine level. due being optimization, takes time, , isn't free (in clock cycles and/or memory), isn't allowed standard? leans close language typically ran through vm. (i'm thinking llvm more java here, runtime optimizations). edit: in order make discussion "more useful", here's short code snippet (i understand lambda not std::function , lambda can stored in std::function , assuming auto below means std::function<t> appropriate t express meant above): auto f =

visual studio 2008 - Msbuild question -

i have several long running custom build tasks. looks visual studio, however, runs msbuild tasks on ui thread, causing ide hang. i did little bit of searching on google, , best find bugs reports response "oh yeah, that's problem, we'll maybe fix later". http://connect.microsoft.com/visualstudio/feedback/details/670873/visual-studio-ui-freezes-during-long-msbuild-task http://social.msdn.microsoft.com/forums/en-us/msbuild/thread/3289eb7d-7989-4350-8c43-02bf9913edbd/ . so, decided fix custom tasks by: detecting when running inside of visual studio. running tasks on background thread if are adding "msgwaitformultiplehandles / custom message pump" ui thread keep ui responsive while things run. this seems work. can run builds without ide freezing. in case, brought few questions: is safe do? visual studio massive thing. run re-entrancy problems if this? re-entrancy problems cause world end, or can away ignoring them. i detect visual studio

sapi - how to create a grammar containing the text to train -

i've read blog of eric how train sapi recognizer, , followed pseudocode. don't know how create grammar containing text train. have correct transcript of audio, don't know how connect correct transcript file grammar. need create xml file? tell me interface name? thank much. read transcript file string, , use ispgrammarbuilder::addwordtransition define simple grammar containing string. process audio wavefile, , should recognition event.

asp.net - What do I return from a POST action called from an external site? -

i have payment controller, exposes httppost action method called notify . action posted when external payment service sends me immediate payment notification (ipn), , it's sole purpose update data based on data receive in ipn. never returns view, should action method return? i'm sure payment service wants http 200 or in response ipn post. you return empty result : return new emptyresult();

php - How to embed stylesheets with Assetic based on a value in the session -

i want embed different stylesheet files assetic in twig template of symfony2 project. used stylesheet depends on theme setting of user. i used {% stylesheets '@cuteflowcorebundle/resources/public/css/application.css' '@cuteflowcorebundle/resources/public/css/theme/'~app.session.get('cuteflow_theme')~'/application.css' %} <link rel="stylesheet" href="{{ asset_url }}" type="text/css" media="all" /> {% endstylesheets %} but throws error: unexpected token "operator" of value "~" in "corebundle::layout.html.twig" i tried following too. didn't either. {% set theme = '@cuteflowcorebundle/resources/public/css/theme/'~app.session.get('cuteflow_theme')~'/application.css' %} {% stylesheets '@cuteflowcorebundle/resources/public/css/application.css' theme %} <link rel="stylesheet" href=&

C++ - pointer value -

in learning opencv book: . . cvcapture *capture = cvcreatefilecapture(argv[1]); iplimage* frame; while(1) { frame = cvqueryframe(capture); . . } here, can see *frame pointer. but, when write following frame = cvqueryframe(capture); , not assigning address pointer. values frame hold in case? thanks. frame pointer object of type iplimage . presumably, cvqueryframe() function allocates iplimage object , returns address of object. statement frame = cvqueryframe(capture); assigns value of returned pointer frame . if indeed function allocating new object you'll required free memory later calling operator delete or function void cvdestroyframe( iplimage * ); also statement make @ end of question (" *frame pointer") not accurate - frame pointer; *frame means you're de-referencing pointer makes type iplimage .

Use Ruby in PHP programs -

i saw lot of interesting libraries in ruby don't exist php or equivalents, want know if there library interpreter or can use ruby code inside php programs call methods , pass variables. thx there no way know of to, say, write php wrapper ruby class. you can, however, write standalone ruby script , call system command.

Python File Creation Date & Rename - Request for Critique -

scenario: when photograph object, take multiple images, several angles. multiplied number of objects "shoot", can generate large number of images. problem: camera generates images identified as, 'dscn100001', 'dscn100002", etc. cryptic. i put script prompt directory specification (windows), "prefix". script reads file's creation date , time, , rename file accordingly. prefix added front of file name. so, 'dscn100002.jpg' can become "fatmonkey 20110721 17:51:02". time detail important me chronology. the script follows. please tell me whether pythonic, whether or not poorly written and, of course, whether there cleaner - more efficient way of doing this. thank you. import os import datetime target = raw_input('enter full directory path: ') prefix = raw_input('enter prefix: ') os.chdir(target) allfiles = os.listdir(target) filename in allfiles: t = os.path.getmtime(filena

Does Oracle have a means to show query execution plans like Sybase 'showplan'? -

i sybase dba/performance optimizer , asked performance of sql queries on oracle , see problems , why slow. there showplan similar sybase? need number of physical i/o's , logical i/o's, table scans , indexes query or stored procedure uses. i used use embarcadero , don't have anymore. explain plan and/or autotrace oracle equivalent give possible execution plan oracle use if execute query. in sqlplus this.. sql> set autotrace traceonly; sql> select * scott.emp; 14 rows selected. execution plan ---------------------------------------------------------- plan hash value: 3956160932 -------------------------------------------------------------------------- | id | operation | name | rows | bytes | cost (%cpu)| time | -------------------------------------------------------------------------- | 0 | select statement | | 14 | 518 | 3 (0)| 00:00:01 | | 1 | table access full| emp | 14 | 518 | 3 (0)| 00:00:01 |

sql - PHP: output count() -

how work count() $sql = $connect->prepare("select count() discos_events e inner join discos_events_guests eg on (e.id = eg.eid) inner join users u on (eg.uid = u.id) e.did =:id"); $sql->bindvalue(":id", $cid); $sql->execute(); ...then what? echo $sql["count"]; ? output count? you need alias name count() column: $sql = $connect->prepare("select count() num_events discos_events e inner join discos_events_guests eg on (e.id = eg.eid) inner join users u on (eg.uid = u.id) e.did =:id"); $sql->bindvalue(":id", $cid); // fetch results , access alias $sql->execute(); $result = $sql->fetch(); echo $result['num_events'];

What would cause the Entity Framework to save an unloaded (but lazy loadable) reference over existing data? -

i'm running interesting bug in asp.net mvc 3 application using entity framework 4.1 code first. have 3 classes/tables joined in sequence. there's invitation has reference project has reference company . when load company , save fine. same projects. when invitation gets edited , saved, wipes out fields in company. they're blank! when edit project, need show info company, i'm explicitly loading .include(x => x.company) . when edit invitation though, don't need company haven't bothered including it. i'd think if object wasn't ever loaded, there shouldn't reason ef flag edited, right? update : after debugging via commenting out lines of code i've narrowed down some. the actual object being cleared contact object that's referenced company. , wasn't being cleared new contact created in constructor (so wouldn't null new companies.) so guess changes question: is there way have referenced property set default value

c# - Aborting a thread (Backgroundworker).. need an advice -

public void replaygame() { if (class2.replayison) { if (!backgroundworker1.isbusy) { backgroundworker1.runworkerasync(); } } } i wan cancel/stop backgroundwoker1 function ends.. backgroundworker event runs few seconds , stops..when stops want end!!.. how can achieve task/? without getting invalid operation exceptions getting now update: public void replaygame() { if (class2.replayison) { replay = serializemeh.givebackdictionary(); backgroundworker1.workersupportscancellation = true; backgroundworker1.runworkerasync(); } } private void backgroundworker1_dowork(object sender, doworkeventargs e) { int[] makeselfmoves = new int[4]; if (!backgroundworker1.cancellationpending) { lock (replay) { foreach (keyvaluepair&