Posts

Showing posts from January, 2014

itunes - Portrait or Landscape on iPad when submitting apps -

portrait or landscape on ipad when submitting apps? requirement or can use either? as answered here , it's not required use both, highly recommended. edit realized might asking screenshots, whether should portrait or landscape. far know, either. i've submitted ipad apps have both portrait , landscape screenshots.

ruby on rails - Is it possible to use Hirb in the Heroku Console? -

i have app deployed on heroku. can access remote heroku console local computer via command: heroku console i have hirb gem installed in app putting hirb in gemfile, able cannot of hirb formatting show up. in heroku console, can run: hirb.enable and in return, get => true but when run user.all don't table in return, old unformatted records. there anyway hirb working on heroku console? there workaround described in github issue @ https://github.com/cldwalker/hirb/issuesearch?state=closed&q=heroku#issue/37

c# - creating a new row in ListView and then writing to COM port delayed ListView loadtime, solution? -

the listview renders row item quite fast @ normal state. when call function write com port (pole display) . load time of list view increases , slows down whole process. i've first called function add item listview. list view uses addrange method add items. vfd function called open com port first , initialize port write port. here full sample code: //function add new row item in listview private void listfunction(int id) { listviewitem checkitem = listview1.finditemwithtext(getproduct(id)); if (checkitem != null) { //messagebox.show("it exist"); int itemvalue = int.parse(checkitem.subitems[2].text) + 1; checkitem.subitems[2].text = itemvalue.tostring(); int ttlamt = getprice(id) * int.parse(checkitem.subitems[2].text); string totalamount = ttlamt.tostring(); checkitem.subitems[4].text = totalamount; } else { // if doesnot exist int ttlamt = get...

c++ - Template function overload not called as expected -

my situation following: i have template wrapper handles situation of values , object being nullable without having manually handle pointer or new . boils down this: struct null_t { // dummy }; static const null_t null; template<class t> class nullable { public: nullable() : _t(new t()) {} nullable(const nullable<t>& source) : _t(source == null ? 0 : new t(*source._t)) {} nullable(const null_t& null) : _t(0) {} nullable(const t& t) : _t(new t(t)) {} ~nullable() { delete _t; } /* comparison , assignment operators */ const t& operator*() const { assert(_t != 0); return *_t; } operator t&() { assert(_t != 0); return *_t; } operator const t&() const { assert(_t != 0); return *_t; } private: t* _t; }; now comparison operators can check against null_t dummy in order see whether set null before trying retrieve value or pass function requires value , ...

jquery doesn't call success method on $.ajax for rails standard REST DELETE answer -

may such problem not new, didn't find similar. have such jquery code: $.ajax({ url : ('/people/'+id), type : 'delete', datatype : 'json', success : function(e) { table.getitems(currentpage); } }); my rails controller looks this: def destroy @person = person.find(params[:id]) @person.destroy respond_to |format| format.html { redirect_to(people_url) } format.json { render :json => @person, :status => :ok } end end this working. but when use following (as generated standard), success callback doesn't called: def destroy @person = person.find(params[:id]) @person.destroy respond_to |format| format.html { redirect_to(people_url) } format.json { head :ok } end end tested under rails 3.0.3 , jquery 1.4.2 , firefox 3.6.13 . firebug says, query fired , returns 200 ok in both cases, item deleted in both cases too. in second case callback not called. is there...

regex needed to strip out domain name -

i need regexp strip out domain name part of url. example if had following url: http://www.website-2000.com the bit i'd want regex match 'website-2000' if explain each part of regex me understand great. thanks this 1 should work. there might faults it, none can think of right now. if want improve on it, feel free so. /http:\/\/(?:www\.)?([a-z0-9\-]+)(?:\.[a-z\.]+[\/]?).*/i http:\/\/ matches "http://" part (?:www\.)? non-capturing group matches 0 or 1 "www." ([a-z0-9\-]+) capturing group matches character ranges a-z, 0-9 in addition hyphen. wanted extract. (?:\.[a-z\.]+[\/]?) non-capturing group matches tld part (i.e. ".com", ".co.uk", etc) in addition 0 or 1 "/" .* matches rest of url http://rubular.com/r/roz13nswbq

SQL Server 2005 Express - Activty Monitor - Show details is empty, how can I tell what the SQL statement that started the process is? -

trying fix problem on our server - expensive query using lot of our cpu. when use activity monitor, can use show details process, , show sql running query. not though. i can see process now, how can tell query text responsible? can identify source if have sql, @ moment have nothing! try using following query. select top 20 qs.sql_handle, qs.execution_count, qs.total_worker_time total_cpu, total_cpu_inseconds = --converted microseconds qs.total_worker_time/1000000, average_cpu_inseconds = --converted microseconds (qs.total_worker_time/1000000) / qs.execution_count, qs.total_elapsed_time, total_elapsed_time_inseconds = --converted microseconds qs.total_elapsed_time/1000000, st.text, qp.query_plan sys.dm_exec_query_stats qs cross apply sys.dm_exec_sql_text(qs.sql_handle) st cross apply sys.dm_exec_query_plan (qs.plan_handle) qp order qs.total_worker_time desc then may suggest copy of awesome sp_whoi...

php - Setting date as "january" from mysql query -

this query : mysql_query(" select date(date1,'%j %f %y') nicedate table1 id='$id' ") this gives me mysql error, how 'nicedate' query 1 january 2011? select date_format(date1,'%d %m %y') date function return date part of date or datetime expression without formating you need date_format return formatted date string in format desired based on docs

javascript - How to cancel submit in IE8? -

i've been struggling make work quite time. have following code: $(document).ready(function (event) { $('form').submit(function (event) { ... }); }); i've found in of places, including on jquery site, prevent form being submitted: return false; it doesn't. next i've read related question , answers on site , tried them out. in chrome , firefox works: event.preventdefault(); in ie8 doesn't. i've read ie doesn't support , should use this: event.returnvalue = false; although several people confirm worked them (e.g. event.preventdefault() function not working in ie. help? ), doesn't me. i'm not sure why though. have form submit button, nothing special, but, if put piece of code, form still submitted: $(document).ready(function (event) { $('form').submit(function (event) { event.returnvalue = false; }); }); any ideas? one last thing: i've read should test first before calling preven...

MySql full join (union) and ordering on multiple date columns -

a rather complicated sql query might making more difficult should be: have 2 tables: news: newsid, datetime, newstext picture: pictureid, datetime, imgpath the 2 not related, joining date news/picture created on sql far: select * news n left outer join (select count(pictureid), datetime picture group date(datetime)) p on date(n.datetime) = date(p.datetime) union select * news n right outer join (select count(pictureid), datetime picture group date(datetime)) p on date(n.datetime) = date(p.datetime) i have use union simulate full outer join in mysql. results: newsid text datetime count() datetime 1 sometext 2011-01-16 1 2011-01-16 2 moo2 2011-01-19 null null 3 mooo3 2011-01-19 null null null null null 4 2011-01-14 the problem being end 2 date columns- 1 news , 1 pictures, means cannot order date , have in correct order! ideas? if means restructuring database! need date ...

Android, image loading and memory allocations -

i have app contains several custom views extend view. each custom view loads bunch of images (~20) , scales them down: mbmp[img1] = bitmapfactory.decodestream(context.getassets().open("img01.png")); mbmp[img2] = bitmapfactory.decodestream(context.getassets().open("img02.png")); mbmp[img3] = bitmapfactory.decodestream(context.getassets().open("img03.png")); ... mbmp[img20] = bitmapfactory.decodestream(context.getassets().open("img20.png")); this within try - catch block. this part not cause problem. however, once reach point of scaling images , call scale method uses createscaledbitmap: protected void scaleimages(float mwidth, float mheight) { float mxrat = mwidth/1024; float myrat = mheight/600; (int = 0; < mbmp.length; i++) { float oldx = mbmp[i].getwidth(); float oldy = mbmp[i].getheight(); double newx = (mxrat * oldx); double newy = (myr...

asp.net mvc - Previous ajax request changes the post URL for next form submit -

i making jquery ajax request in asp.net mvc page: $.ajax({ type: "post", url: "/home/go", data: dataobj, success: function (data) { // update html here } } }); this call within page, has form , other elements submit other url (lets "/home/do"). after ajax call returns, if click on other element form still submits url1 instead of url2 note tried adding "return false" statement click event handler ajax call made. did not help the ajax call made within jquery dialog: $('#mydialog').dialog({ buttons: [ { text: 'next', click: function () { handlenext(); return false; } } ], title: 'dialog-title' }); function handlenext() { $.ajax({ type: "post", url: ...

Page tables in Linux -

question 1 :- during booting process, linux creates page tables. however, when new process executed, has own page table. how these 2 tables different? question 2 :- on x86 arch, linux uses defined scheme (which includes page directory, page table entries , likewise) translate linear address physical address. suppose have linear address x in process address space when translated using page tables corresponds physical address y. there other process b has valid linear address x belonging own address space. if process b wants access x, x once again corresponds same physical address y? question 1: page tables aren't created @ boot. new page table created every time processes forked. new tables follow template set kernel @ boot, each independent data structure can change per-process. differ allow each process have own working memory can access. question 2: no, , behavior 1 of reasons paging used in first place.

iphone - Adding achievements mechanism - how do design - objective c -

so want add achievements game. there around 40 achievements can awarded while using app. (if while playing game, , while pressing menu buttons). i'm not sure how should implement it, i'll let know options thought of far : writing (achievements manager) class have addachievment() function. inside every function in app can grant achievement can allocate achievemnt object , call addachievment() object. don't approach first, have add lot's of achievments code many many parts of app. (and checking not add same achievement more once). one way improve maybe call addachievment() enum, , inside addachievment() implementation check each enum , allocate appropriate achievment object - however, function switch of 40 cases doesn't sound either. 2. every class can report achievements can write function per achievement return if achievement should granted. example class can report 2 achivments can write 2 functions : -(bool) shouldgranta1 -(bool) shouldgra...

LINQ Join and GroupJoin -

i have list of objects, objects may or may not have contact info: // join contact query = query.join( (new contactrepository(this.db)).list().where(x => x.ismaincontact), x => new { x.listitem.contentobject.loginid }, y => new { y.loginid }, (x, y) => new listitemextended<listitemfirm> { city = y.city, state = y.state, country = y.country }); this inner join on 'loginid'. need outter join if contact info not exists given loginid empty. please help thanks you should execute outer join manually: var contacts = (new contactrepository(this.db)).list(); query.select(item => { var foundcontact = contacts.firstordefault(contact => contact.id == item.id); return new listitemextended<listitemfirm>() { id = item.id, ...

c# - Trouble checking dynamic entity -

greetings, a old colleague of mine made code: public abstract class pagedviewmodelbase<t> : partnerviewmodelbase, ipagedcollectionview t : entity, ieditableobject, new() now want check type/value of t.. i've tried using " t model gives me error "'t' 'type parameter' used 'variable'". how can check if "t" of particular model ? you try following check typeof(t) == typeof(model)

ruby on rails - ActiveRecord query ordering -

suppose have following models: class car < activerecord::base belongs_to :seat ... end class seat < activerecord::base belongs_to :color ... end class color < activerecord::base attr_reader :name ... end if have list of cars, , want order cars color.name , how write order query? class car < activerecord::base belongs_to :seat ... def cars_order_by_color(car_ids) where(:id=>car_ids).order(?????) #how order color.name end end if use joins on query, can sort joined tables (either seats or colors ): car.joins(:seat => :color).order("colors.name")

3d modelling - 3D model format with multiple UV coords and custom attributes per vertex -

let's using custom glsl shader uses special interleaved array format made of 11 floats :position (3 floats), normal (3 floats),uvcoord-1 (2 floats), uvcoord-2 (2 floats),custom attribute (1 float). i need file format (preferably ascii) allows me export information (especially multiple uv coords multi-texturing) per vertex 3d modelling software (eg. blender, maya,etc) , import application. have searched on net, can't seem find format allows multiple(custom) data channels per vertex.am missing obvious? for example:i using .obj format , seems export position, normal , 1 texture exported. why not define own format? if you're looking ready use, have @ openctm http://openctm.sourceforge.net

Extending Django Admin Templates - altering change list -

a (not so) quick question extending django admin templates. i'm trying change result list (change list in django lingo) of specific model adding intermediary row between result rows (row1 , row2 classes) contains objects related object. i searched code haven't found way this. pointers appreciated. code too. ps: know should designing own interface, internal project , don't have time spare. also, django interface nice. thank in advance. step 1: overriding changelist view : you'll have override template opposed specifying 1 can add_view / change_view . first things first, override def changelist_view(self, request, extra_context=none): in modeladmin . remember call super(foo, self).changelist_view(request, extra_context) , return that. step 2: overriding templates : next, override app-specific changelist template @ templates/admin/my_app/my_model/change_list.html (or not.. can use global changelist override if you'd like). step 3: c...

Zend framework deployment -

hello wanted upload web project done zend framework on ftp server. have uploaded public_html/projects/myproject directory (i uploaded whole folder structure, directories: application, docs, library, obsolete, public, scripts, tests, zend). if type www.mydomain.com/projects/myproject see these folders. if want run project have type www.mydomain.com/projects/myproject/public i not surprised because it's expect, don't know how make folders other public inaccessible , run project after www.mydomain.com/projects/myproject... should achieve goal? greetings! you have put htaccess files in root, projects , myproject directories disallow access. don't know hand should deny then in apache config, might file named sites-enabled, there should need add directory config default host, e.g.: <virtualhost foobar:80> crap here more crap <directory /projects/myproject/public> options -indexes followsymlinks allowoverride ...

How to get Telephone Number In Android -

i want telephone number. used sample code.. telephonymanager tm = (telephonymanager)getsystemservice(telephony_service); string strphonenumber = tm.getline1number(); and used permission- read_phone_state. but returning null. you able number cdma device. public string returnnumber() { string number = null; string service = context.telephony_service; telephonymanager tel_manager = (telephonymanager) getsystemservice(service); int device_type = tel_manager.getphonetype(); switch (device_type) { case (telephonymanager.phone_type_cdma): number = tel_manager.getline1number(); break; default: //return else number = "no number"; break; } return number; }

vba - Excel: Is there an event to detect change in calculation mode (automatic/manual) -

i code run when user or macro changes calculation mode automatic manual or manual automatic. there event fires this? (the property application.calculation in excel interop.) using excel 2007 there no event fires changing calculation mode. closest can check @ each calculation event.

sharepoint - How to determine whether a user can modify personalizable property? -

i have web part property has personalizable attribute on it. there's button on web part changes property state. problem when there's user read permissions given him, property cannot updated, because sharepoint doesn't allow (btw, such users not allowed swith web part edit mode also). so question following: how determine whether user can modify personalizable property value (so can know when hide button)? know can iterate through permissions , read there, don't idea several reasons. sharepoint somehow knows if user allowed edit web part (switch edit mode) , wonder if there's property can tell if user allowed edit web part. thank you. the microsoft.sharepoint.webpartpages.webpart has permissions property that's type enum 3 values: allproperties, personalproperties, , none. try using that. if you're using .net webpart object can cast temporarily.

ruby on rails - Caching scheme for two sites that share DB -

let's assume have 2 sites around 1 db. first based on fatfreecrm , handles business logic, let's call site_1 , second 1 based on radiantcms , handles presentation logic. let's call site_2 of pages in radiantcms use models fatfreecrm (mostly show them, not modify). , fatfreecrm able add/remove/modify instances of models. the problem want these pages in radiantcms cached. can't expire cache directly fatfreecrm. what best cache strategy case? thank you. i suggest creating api on radiantcms allows expire cached pages. example: site_1.com/api/expire/sldfj2389283kd you call expire action fatfreecrm anytime want expire key or collection of keys, , perform actual cache expiration on radiantcms.

python - Django SYNCDB failes when adding super-user (Windows 7, mySQL, Django 1.2.4, mySQL 5.5) -

syncdb fails when creating super user django: v 1.2.4 python: 2.6 mysql server: 5.5 windows 7 extra: mysql-python v1.2.3 what steps reproduce problem? 1. install above programs 2. create project 3. run syncdb note: have installed mysql support utf 8. create mysite_db database using create dtabase mysite_db character set = utf8; what expected output? see instead? syncdb create required tables follows: c:\djangoprojects\mysite>python manage.py syncdb creating table auth_permission creating table auth_group_permissions creating table auth_group creating table auth_user_user_permissions creating table auth_user_groups creating table auth_user creating table auth_message creating table django_content_type creating table django_session creating table django_site installed django's auth system, means don't have superuse rs defined. create 1 now? (yes/no): i select 'yes' , following error: traceback (most recent call last): file "manage.py...

drawrect - Displaying text in multiple lines in Android -

i have graphical android project , primary trick providing user interface functionality use drawrect , drawtext draw rectangle label on screen. then, capture touch events , check see if occur in rectangle -- when do, voila, have button. it may not elegant method, seems working charm. however, not of labels on 1 line, , i'd write them on two. suppose write 2 separate lines , manually work out arranging text nicely spaced , centered, i'd avoid if possible. in android, there simple way split text label , write out in single step?? thanks, r. i don't think there easy way achieve this, have measure text , draw offset buttonwidth - textwidth / 2.

asp.net - Getting date into a label every time the date is changed -

i using datetimepicker trent richardson, can date time picker work, after date changed need put hidden asp.net control in update panel. so how can make everytime user changes date , time sent label. http://trentrichardson.com/examples/timepicker/ so since seems it's extension of jquery ui datepicker, use altfield option: http://jqueryui.com/demos/datepicker/#alt-field or onselect event yourself: http://jqueryui.com/demos/datepicker/#event-onselect

Pattern to share data between objects in C++ -

i have started migration of high energy physics algorithm written in fortran object oriented approach in c++. fortran code uses lot of global variables across lot of functions. i have simplified global variables set of input variables, , set of invariants (variables calculated once @ beginning of algorithm , used functions). also, have divided full algorithm 3 logical steps, represented 3 different classes. so, in simple way, have this: double calculatefactor(double x, double y, double z) { invariantstypea inva(); invariantstypeb invb(); // need x, y , z inva.calculatevalues(); invb.calculatevalues(); step1 s1(); step2 s2(); step3 s3(); // need x, y, z, inva , invb return s1.eval() + s2.eval() + s3.eval(); } my problem is: for doing calculations invariantstypex , stepx objects need input parameters (and these not three). the 3 objects s1 , s2 , s3 need data of inva , invb objects. all classes use several other classes ...

ios4 - cocoa icu document -

i want have syntax highlighting in uiwebview. have heard cocoa icu, there're no documents i've found googling. can give me information?? thank you i think turned regexkit, see link on http://site.icu-project.org/related stale. i wrote small wrapper couple parts of icu cocoa. basically, can call icu c (not c++) interfaces objective c. icu doesn't syntax hilighting, looking regex portion?

java - jersey (JSR-311), how to implement @POST in container pattern -

from netbeans, created new rest webservice (using jersey), using built-in wizards. in container resource class, created stub, @post @consumes("application/json") @produces("application/json") public response postjson(identity identity) { identities.addidentity(identity); return response.status(status.ok).entity(identity).build(); } how post this? understanding in need post name=val pairs. what's jersey expecting here? how post json using curl? here's tried, #!/bin/bash data="{ \"id\": \"$1\", \"vcard\": \"$2\", \"location\": { \"latitude\": \"$3\", \"longitude\": \"$4\" } }" echo "posting: $data" header='content-type:application/json' url='http://localhost:8080/contacthi-proximity-service/resources/is' curl --data-binary "${data}" -h "${header}" "${url}" when post this, , @ identity o...

Compare PDF Content With Ruby -

i in process of writing ruby script/app helps me compiling latex (at least) pdf. 1 feature want have should run pdflatex iteratively until pdf converges (as should, guess). the idea compare pdf generated in 1 iteration against 1 former iteration using fingerprints. in particular, use digest::md5.file(.) . the problem never converges. (the, hopefully) culprit pdf's timestamp set seconds @ least pdflatex . since runs of pdflatex take typically longer 1 second, result keeps changing. is, expect pdf's equal timestamp(s) after point. assumption might wrong; hints appreciated. what can this? basic ideas far: use library capable of doing job strip meta data away , hash pdf content overwrite timestamps fixed value before comparing do have more ideas or solutions? solutions should use free software runs on linux. such use ruby preferred, using external software acceptable. by way, not know how pdf encoded suspect merely comparing contained text won't work me si...

javascript - How can I detect shutdown of a cached iPhone app? -

i have iphone webapp uses cache manifest work offline , add webapp home screen. find way detect app exiting can housekeeping , save data. if running web page in safari, window.onunload me, event not happen when running home screen. i tested pagehide event using below code , found works detecting whether user navigated link or opened new tab when in safari. however, if in web app saved homescreen (like describe) pagehide event useless telling if web app closed. depending on need specifically, can work around limitation saving data localstorage , checking localstorage when app opens again. can perform work may need done before app starts again. function myloadhandler(evt) { if (evt.persisted) { alert('user returns page tab'); return; } alert('loading new page'); } function myunloadhandler(evt) { if (evt.persisted) { alert('user goes new tab'); return; } alert('user leaves page'); } if ("onpagehide...

.net - c# - How to get the value of the defaultDatabase? -

my web.config has line <dataconfiguration defaultdatabase="valueiwant"/> that lists name of default database connection string use. how can name within c#? sudo code: string info = getdefaultdatabase(); console.writeline(info); would print valueiwant . thanks if config value is custom configuration section, need section via configurationmanager.getsection(): mycustomconfigsection config = (myconstomconfigsection) configurationmanager.getsection( "mycustomconfigsectionname" ) ; and how desired value referenced entirely dependent on custom config section widget.

database - .NET: Converting from LINQ to SQL to Entity Framework -

to prototype project , running possible, used linq sql data persistence. now project more mature , i'm running concurrency limitations linq sql. since not true orm, nor meant enterprise use, i'd replace linq sql work entity framework persistence. what's involved in this? can of linq sql work retooled ef? going have start on ef scratch? start? helpful links or advice? many people doing same conversion. there template can use conversion here http://blogs.msdn.com/b/efdesign/archive/2009/08/13/linq-to-sql-to-entity-framework-conversion-template.aspx

c# - How to use .ToDictionary() extension method on DataRow -

i need dictionary<string,object> produced datarow. have working, doing way , not utilizing .todictionary() extension method. can please enlighten me on how accomplish successfully? here failed attempt: var datadictionary = datatable.select(acn + "=" + accountnumber).todictionary(key => key.table.columns); this returns keyvaluepair<datacolumncollection, datarow> , again, need dictionary<string,object> thanks again in advance! you need specifiy key want, might acn column in table: .todictionary(row => (string)row["acn"]); todictionary takes second delegate if want run transformation on values in returned dictionary. edit i'll leave original answer since explains general case. want take single row; use it's columns keys , column values the, well, values. how that. datarow row = datatable.select(acn + "=" + accountnumber).single(); // might want singleordefault var datadictionary = row.tab...

html - Multiple forms in one table, but Firefox is changing my mark up automagically? -

i'm trying make table has 1 webform per table row. problem is, when display page in firefox, closes off form tags immediately. not allowed have multiple forms in table? edit: running jquery plugin "uniform" disabled it, , same result. my code: <table callpadding="0" cellspacing="0"> <tr> <td>id</td> <td>name</td> <td>type</td> <td>clickable</td> <td>live</td> <td>save</td> </tr> <?php foreach($rows $row): ?> <tr> <form> <input type="hidden" name="table_bl" value="navigation" /> <input type="hidden" name="id_bl" value="<?php echo stickyrow($row['id'],''); ?>" /> <td><?php echo $row['id']; ?></td> <td><?php echo $row['page_name']; ?></td> <td><?php echo $row['page_type']; ?>...

iphone - UIPopoverController presented from a UIButton does not hide? -

i have uipopovercontroller presented button on uiviewcontroller when tap on part of view not popover not hiding? the buttons present popover created dynamically, you'll see referenced in code below: -(ibaction)showmodifiers:(id)sender{ [self.popovercontroller dismisspopoveranimated:yes]; uiview *thesuperview = self.view; cgpoint touchpointinsuperview = [sender locationinview:thesuperview]; uiview *touchedview = [thesuperview hittest:touchpointinsuperview withevent:nil]; currentpopovertag = [touchedview tag]; nslog(@"show modifiers %i %i", [touchedview tag], currentpopovertag); repziocoredataappdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; if (appdelegate.popovercontroller) [appdelegate.popovercontroller dismisspopoveranimated:yes]; self.modifierlistpopoverviewcontroller = nil; modifierlistcollection *collection = [self.modifierlists objectatindex:[touchedview tag]-100]; modifierl...

javascript - AJAX post method: Variables are not passed to target php -

i trying send 2 pieces of info php. 1-) tent = zuzu 2-) zart = gagi target php echoes send can check if it's working. javascript: function boka () { var mesparam = "tent=zuzu&zart=gagi"; if (window.xmlhttprequest){xmlhttp=new xmlhttprequest();} else {xmlhttp=new activexobject("microsoft.xmlhttp");} xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) {document.getelementbyid("response").innerhtml=xmlhttp.responsetext;} } xmlhttp.open("post","/mysite/oxifa/oxifat.php?tent=zuzu&zart=gagi",true); //xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); //xmlhttp.setrequestheader("content-length", mesparam.length); //xmlhttp.setrequestheader("connection", "close"); xmlhttp.send(mesparam); } this oxifat.php recieves request: <?php echo " sign1 <br>"; echo next($_post); e...

c# - How to return an implementation of an interface with interface as return type? -

i have interface: isearch<t> , have class implements interface: filesearch : isearch<filesearchresult> i have class filesearchargs : searchargs has method return search object: public override isearch<searchresult> getsearchobject () { return ((isearch<searchresult>)new filesearch()); } this overridden from: public virtual isearch<searchresult> getsearchobject () { return null; } the code build if provided cast (isearch), throws exception @ runtime unable cast error. additionally, previous iteration did not apply generics interface, , method signature of getsearchobject() follows: public override isearch getsearchobject() { return new filesearch();} i know 1 solution return base class "search" instead of implementation of interface, i'd prefer not this, , understand why cannot follow pattern had. any help, appreciated. i'm trying simplify going on, if clarification needed, please let me know! thanks in adv...

Design a window without a caption bar - QT Designer -

how can declare window without caption when use qt designer? if you're looking remove window title, easiest way set window flags in widget's constructor, smth this: mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent, qt::framelesswindowhint), //<-- remove title bar ui(new ui::mainwindow) { ui->setupui(this); ... or call qt::windowflags flags = qt::customizewindowhint; setwindowflags(flags); more details on window types here: enum qt::windowtype flags qt::windowflags hope helps, regards

Setup a SQL Server database that's only visible to certain users -

i'm setting laptop developer interviews ready coding tests. want create database each candidate, in advance of interview itself. preparation goes this: logon admin. create local windows user each candidate. create database on local default instance of sql server each candidate (with name in database name). such when logon windows each candidate, if open ssms can see own database in object explorer. i want way, because there isn't quite enough time in-between interviews backup/detach previous candidate's database , create next candidate's database (the machine slowish, logging off/on again etc takes time). is possible, , if so, how? many in advance. it appears there's option in sql server 2005+ accommodate needs here. sounds if requirement user doesn't see other databases in object explorer. how hide databases in sql server highlights view database permission. may useful in situation database x needs hidden users other windows us...

asp.net mvc 2 - How can I tell whether a controller action was requested by DNS or IP? -

on webdev server, i'm trying test whether controller's action requested through raw ip, or dns. i've tried looking @ controller's httprequest.url.hostnametype , seems resolve dns if enter local ip in browser. ideas? in advance. that information passed in host header of http request, should able access this: var requestedhost = request.headers["host"]; if request ip address, ip address string should returned. otherwise, whatever hostname used.

Facebook Graph API works in web browser, not in iOS SDK -

i tried in web browser: https://graph.facebook.com/<facebookid>/statuses?access_token=<my access token> and thought in ios sdk equivalent of query: nsstring* graphpath = [nsstring stringwithformat:@"%@/statuses",facebookid]; [_facebook requestwithgraphpath:graphpath anddelegate:self]; but returns empty json data... doing wrong in here? other queries seems fine me (e.g. @"me" , @"me/statuses" , @"me/friends" ) i think documented in http://developers.facebook.com/docs/reference/api/ more info: i have read_stream permission i figured out... need "friend_statuses" permission! did not know that! =)

html - Why did YouTube put a type= attribute in iframe for embedded video? -

when going youtube, gives embed code such as <iframe title="youtube video player" class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/qrvvzaq6i8a?rel=0"> </iframe> note the type="text/html" is not valid html. there's no such attribute iframe tag. could explain why google put that? guess it's practical reason, couldn't guess what. ps can embed code going here http://www.youtube.com/watch?v=qrvvzaq6i8a i guess mistake google itself. suspect mistake. not part of html4, , not part of html5. can safely ignore , remove it. on type attribute topic: type on object element conforming obsolete. has never been used browsers guess content of uri served.

c# - How to execute code that is in a string? -

possible duplicates: c# eval equivalent? c# execute string code say have this: string singlestatement = "system.datetime.now"; is there way take singlestatement , parse , run @ run time? so that: datetime currenttime = singlestatement.somecoolmethodtorunthetext(); would assign value of datetime.now currenttime . this possible using compiler services , reflection.emit() compile , assembly , load memory. have here. http://www.c-sharpcorner.com/uploadfile/puranindia/419/

c# - ScaffoldColumn in DBML classes? -

i've created dbml file, , dragged tables onto designer. on pages, editor form displays field primary key entities. is there way add scaffoldcolumn attribute primary key column table in dbml designer? yes, you'll loose ability have linq-to-sql auto generate classes. however mvc works lot better viewmodels, small dto classes contain view needs. using database , persistence classes in views considered bad form because tightly couples entire application together.

php - How do I change button name onselect? -

i want add name="question" selected radio button. (and remove if user selects other). how can it? <input type="radio" value="female" />female <input type="radio" value="male" />male thanks you need check out jquery http://api.jquery.com/attr/ http://api.jquery.com/css/ $("input[type='radio']").change( function() { $(this).css('display' 'hidden'); $(this).attr('name', 'question'); });

Python - Finding Max Value in the second column of a nested list -

so have list this alkaline_earth_values = [['beryllium', 4],['magnesium', 12],['calcium', 20],['strontium', 38],['barium', 56], ['radium', 88]] if use max(list) method, return answer strontium, correct if trying find max name, i'm trying return element integer highest. any appreciated. max(alkaline_earth_values, key=lambda x: x[1]) the reason works because key argument of max function specifies function called when max wants know value maximum element searched. max call function each element in sequence. , "lambda x: x[1]" creates small function takes in list , returns first (counting starts zero) element. so k = lambda x: x[1] is same saying def k(l): return l[1] but shorter , nice use in situations this.

ios - Retina Display Images on iPhone -

possible duplicate: how accommodate iphone 4 screen resolution? what best way include retina display images on iphone app. there issues iphone 3g or older iphone higher res images? include hi-res version of image named "image@2x.png" (where "image.png" normal resolution). when access image using [uiimage imagenamed:@"image.png"] , correct 1 chosen automatically. devices without retina display won't load hi-res version, there's no memory overhead.

CSS: HTML height:100% on one page only -

dumb question simple answer, think. i building site has different layout on 1 page rest. on 1 page, design requires liquid vertical layout, need following code: *{height:100%;} on other pages want default height. i tried add class html tag, works in html, not in css file. tried: *.myclass and html.myclass but doesn't seem work. i can't seem find info on online. possible add classes html tag? i using wordpress, can check see page i'm on , add myclass. i guess use @import different style sheet based on page i'm on, seems longwinded way of doing things. how can specify height:100% value of html tag on specific pages only? can point me in right direction? thanks, j perhaps .myclass, .myclass body {height: 100%} ? it indeed possible add class <html> tag. live demo ( see code )

vhdl - Why does Modelsim 10 not compile older code? -

i upgraded modelsim 10 , when recompiled code, 30 out of 37 compiled. wouldn't compile had common error no feasible entries infix operator "&" i included packages std_logic, change bits std_logics, , magically fixes problem on first recompiling (a rare sight me). question why did new compiler (if new) not accept bit & unsigned(n downto 0). kind of new standard force hdl coders use more abstraction? saw similar question solved problem, want know why compilation different. could new modelsim uses different default settings (e.g. -2008 instead of -87 )?

c# - Programmatically set printer to bypass the windows spooler -

is there way programmatically configure printer prints file (local file port) bypass spooler service , send data directly file ? i have looked @ prnadmin.dll (nothing relevant there) , wmi (nothing relevant). ideas ? , no, don't want stop print spooler service in windows (xp sp3), make printer bypass it. the printer_info_2 structure has parameter called printer_attribute_direct. can handle printer using openprinter, structure, change attribute (make sure bitwise , dont change of other existing attributes) , setprinter modified structure. refer link see how can use setprinter. http://support.microsoft.com/kb/140285 hope helps. if so, please vote +1 answer :)

php - Twitter API Fail -

i have following 2 files sendtweet.php <?php require_once('twitteroauth.php'); require_once('oauth.php'); session_start(); $consumer_key = '!!!'; $consumer_secret = '!!!'; $connection = new twitteroauth ($consumer_key, $consumer_secret); $request_token = $connection->getrequesttoken(); $_session ['oauth_token'] = $token = $request_token['oauth_token']; $_session ['oauth_token_secret'] = $request_token['oauth_token_secret']; switch ($connection->http_code) { case 200: $url = $connection->getauthorizeurl ($token); header ('location:'. $url); break; default: echo 'could not connect twitter. refresh page or try again later.'; } ?> and callback, followthru.php <?php require_once('twitteroauth.php'); require_once('oauth.php'); session_start(); $consumer_key = '!!!'; $consumer_secret = '!!!'; if (isset ($_request ['oauth_token'])...

c# - Show and Navigate the user to a different PanoramaItem -

i developing panorama application. in 1 of panorama item, have list of categories. on selecting 1 of list item, have display feeds under category in new panorama item. decided use panorama item item 4, set collapsed. , when user select category, make item 4 visible true , navigate user item 4. , change title of item category selected. is right way it? if so, how can navigate user item programmatic? i facing issue if change title, change not taking effect unless new page load? (i read msdn has stated in guidelines not advisable change title of panorama item)? my personal opinion panorama (and pivot ) control should not used display dynamic items in 1 item based on selection in item. take @ channel 9 video chad roberts , amy alberts discuss these 2 key controls. my suggestion navigate page on category selection , load feeds under category in target page. shawn wildermuth has blog post on page navigation if need in respect.

Calling Fancybox from Event Listener in Google Maps Instead of Default Infowindow -

i'm looking replace default google maps api infowindow fancybox overlay. version google maps api 3.0 goal replace default infowindow fancybox popup use case google map loaded in full screen (100% 100%) markers placed onto map user clicks on marker , shown fancybox popup overlays map user clicks on "x" in top right hand corner of fancybox close it i'm @ loss how best tackle this. easiest call fancybox using addlistener event handler, passing in marker parameter? if so, how of recommend doing this? for example: google.maps.event.addlistener(marker, 'click', function(){ // call fancybox, how? }); thank in advance, graham kennedy i've found best way go pass in content manually fancybox's href method. works charm me. function addmarker(data) { // build window contents var contentforbox = data; google.maps.event.addlistener(marker, 'click', function() { $.fancybox({ hre...

Use of Java's Collections.singletonList()? -

what use of collections.singletonlist() in java? (i understand returns list 1 element. why want have separate method that? how immutability play role here?) are there special useful use-cases method, rather being convenience method? the javadoc says this: "returns immutable list containing specified object. returned list serializable." you ask: why want have separate method that? as convenience ... save having write sequence of statements to: create empty list object add element it, and wrap immutable wrapper. are there special useful use-cases method, rather being convenience method? clearly, there use-cases convenient use singletonlist method. don't know how (objectively) distinguish between ordinary use-case , "specially useful" 1 ...

What is the proper way to sanitize user input when using a Ruby system call? -

i have ruby on rails application using x virtual framebuffer along program grab images web. have structured command shown below: xvfb-run --server-args=-screen 0 1024x768x24 /my/c++/app #{user_provided_url} what best way make call in rails maximum amount of safety user input? you don't need sanitize input in rails. if it's url , it's in string format has escaped characters passed url net::http call. said, write regular expression check url looks valid. following make sure url parse-able: uri = uri.parse(user_provided_url) you can query object it's relevant parts: uri.path uri.host uri.port

createfile - How to create empty folder in java? -

possible duplicate: how create folder? i tried use file class create empty file in directory "c:/temp/emptyfile". however, when that, shows me error : "already made folder temp". otherwise, won't create 1 me. so, how literally create folders java api? looks file use .mkdirs() method on file object: http://www.roseindia.net/java/beginners/java-create-directory.shtml // create directory; non-existent ancestor directories // automatically created success = (new file("../potentially/long/pathname/without/all/dirs")).mkdirs(); if (!success) { // directory creation failed }

qt - How to change text alignment in QTabWidget in C++? -

Image
this same question in: how change text alignment in qtabwidget? i tried port python code c++ doesn't seem work. here header file: #include <qtabbar> class horizontaltabwidget : public qtabbar { q_object public: explicit horizontaltabwidget(qwidget *parent = 0); protected: void paintevent(qpaintevent *); qsize sizehint() const; }; here source file: void horizontaltabwidget::paintevent(qpaintevent *) { for(int index = 0; index < count(); index++) { qpainter * painter = new qpainter(this); painter->begin(this); painter->setpen(qt::blue); painter->setfont(qfont("arial", 10)); qrect tabrect = tabrect(index); painter->drawtext(tabrect, qt::alignvcenter | qt::textdontclip, tabtext(index)); painter->end(); } } qsize horizontaltabwidget::sizehint() const { return qsize(130, 130); } i use creating newtabwidget class inherits qtabwidget. in constructor o...

c# - enumerate keys in in a System.Collections.Generic.Dictionary<string,string> -

Image
at debug time see keys in initparams collection - can't seem able list them. edit: as jon suggests below, might bug within silverlight debugger. reproduce, create new silverlight application within visual studio 2010 , edit code { public partial class mainpage : usercontrol { public mainpage() { initializecomponent(); var dictionary = new dictionary<string, string> {{"a", "1"}, {"b", "2"}, {"c", "3"}}; } } } assuming want keys, use keys property: foreach (string key in dict.keys) { ... } if want keys in easy-to-read manner in immediate window, use: string.join(";", dict.keys) or pre-.net 4: string.join(";", dict.keys.toarray()) ... or if you're using .net 2, this: string.join(";", new list<string>(dict.keys).toarray()) if want values @ same time, can iterate on keyvaluepair ...

excel vba - Is there a way to select several ranges with e.g. Application.InputBox in VBA? -

in vba, inputbox(type:=8) can select 1 range only. there way select several ranges, 2 or 3 ? dim t range set t = application.inputbox("select destination range:", type:=8) something like: dim t ranges set t = application.someotherinputbox() when start wish inputbox (or msgbox ) supported feature x, it's time create own dialog instead. create own user form features need , show instead. in case haven't done before, here's article sample code: custom vba message box

jsf 2 - jsf datatable row selection problem -

i have problem selecting rows in primefaces datatable. use dynamic columns, standard row selection mechanism not usable here, implement checkbox selection myself. to help, here's s simplified version of have in xhtml: <h:form> <p:datatable id="table" var="result" value="#{tablebean.results}"> <p:columns value="#{tablebean.columnnames}" var="column" columnindexvar="colindex"> <f:facet name="header"> #{column} </f:facet> <h:panelgroup rendered="#{colindex==0}"> <h:outputlabel>#{rowindex}</h:outputlabel> <h:selectbooleancheckbox value="#{tablebean.selectedrows[result[0]]}"/> </h:panelgroup> </p:columns> </p:datatable> <h:commandbutton value="submit"></h:commandbutton> </h:form> and here's hav...