Posts

Showing posts from July, 2011

css - Less - How to insert an @variable into property (as opposed to the value) -

in less.js, i'm able replace values variables no problems. @gutter: 20px; margin-left:e(%("-%d"), @gutter); when trying replace properties variables, errors. how perform following in less? @gutter: 20px; @direction: left; e(%("margin-%d"), @direction):e(%("-%d"), @gutter); thanks alvivi solution , research (you reward that). decided add following actual answer since real way set instead of looking @ .blah() pseudo code.. here's real strategy setting up: @gutter: 20px; @dir: left; @dirop: right; then create mixins enhance margin , padding so: .margin(left, @dist:@gutter) { margin-left:@dist; } .margin(right, @dist:@gutter) { margin-right:@dist; } .padding(left, @dist:@gutter) { padding-left:@dist; } .padding(right, @dist:@gutter) { padding-right:@dist; } .lr(left, @dist: 0) { left: @dist; } .lr(right, @dist: 0) { right: @dist; } .. can just #selector { .margin(@dir); } or #selector { ...

Create classic asp project in Visual Studio 2010 from scratch -

i have developed on asp.net on 2.0 , higher .net framework. trying create website in classic asp scratch using vs2010 , can't figure out how that. thanks create new folder open visual studio choose "file" -> "open web site" go created folder then right click -> add new item select "html file" rename file .asp create new web site or virtual directory in iis , point folder profit! (alternatively 8, can use new iis express supports asp classic)

phpmyadmin - Why won't MySQL let me remove attribute "on update CURRENT_TIMESTAMP"? -

i have table 2 timestamp fields. defined them name , type timestamp , yet reason mysql automatically set 1 of them default value , attribute on update current_timestamp . planning on having no default value in either of fields, 1 of fields called "date_updated" suppose set mentioned attribute field. unfortunately, it's field "date_created" set on update current_timestamp attribute, , no matter do, mysql won't let me remove it. i've tried editing "date_created" field , removing attribute. when clicking save, attribute back. have tried selecting both fields, removing attribute 1 of them , setting on other. gives me error #1293 - incorrect table definition; there can 1 timestamp column current_timestamp in default or on update clause , both attribute columns on values set on update current_timestamp result: error sql query: alter table `pages` change `date_created` `date_created` timestamp not null , change `date_updated` `date_...

Set CSS width to 100% + right border is missing? -

i set div's width 100% of window. when apply border div, right border cut off. have perform box model hack this? #textboxcontainer { width:100%; height:30%; position:fixed; z-index:99; bottom:0px; left:0px; background-color:#999; border: 4px solid #000; } <div id="textboxcontainer"></div> the easiest fix in case this: #textboxcontainer { height: 30%; position: fixed; z-index: 99; bottom: 0; left: 0; right: 0; background-color: #999; border: 4px solid #000; } live demo remove width: 100% . to make div fill screen, instead add right: 0 . it's viable give element both left , right (or top , bottom ), we're doing here.

ruby on rails - The line was indented 2 levels deeper than the previous line. HAML -

=image_tag('/images/public_stream_page/overlay_image.png', :onload=>"document.getelementbyid('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';") this haml code display image getting error the line indented 2 levels deeper previous line. how resolve it? you're not displaying code in correct way problem relates space indentation... line numbers help. should have this: - if stream.asset? =image_tag('/images/public_stream_page/overlay_image.png',:onload=>"document.getelementbyid('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';") with second line indented same number of spacing use in rest of templeate, while perhaps have 1 line (number in error not shown) 2 times more indented.

jquery ui - How to prevent use from putting non valid value in the autocomplete field? -

how prevent user inserting value not in source of autocomplete? var items= [ { "label": "account administration" }, { "label": "applications"}, { "label": "general information" }, { "label": "hardware" }, { "label": "network" }, { "label": "operating system" }, { "label": "remote connectivity" } ]; $(".autocomp").autocomplete({ source: items}); well while coming example figured out. $(".autocomp").blur( function(event){ s = this.value.touppercase(); var r = ""; for(var i=0;i<items.length; i++) { if(s===items[i].label.touppercase()){ r= items[i].label; break;} } this.value=r; }); http://jsfiddle.net/daelectric/bspn2/ but there better way of doing this?

c# - Lambda with nested classes -

Image
i have posted question while ago got partial answer issue, thought post more explanation hoping more accurate answer. have 2 classes: public class employee { public string name { get; set; } public list<cars> cars { get; set; } } public class car { public int carid { get; set; } public cartypes cartype { get; set; } public enum cartypes { van, smallcar } } i'm trying employees have vans allocated ignoring smallcars using lambda, tried line: list<employee> employeeswithvans = allemployees.where(emps => emps.car.any(cartype => cartype.cartype == car.cartypes.van)).tolist(); but gets employees if @ least 1 van allocated employee ( .any ) if try ( .all ) bring nothing not employees has van. any idea if can achieved using nested lambda? thanks. edit: employee mark = new employee(); mark.cars.add(new car() { cartype = car.cartypes.van, carid = 12 }); mark.cars.add(new car() { cartype = car.cartypes.van, ca...

jquery - Asp.net Masterpage and ContentPage JavaScript Function error -

i using masterpage upload_photo.aspx displays file upload page using colorbox. however, ever since added (code below) in masterpage colorbox doesn't display: <script type="text/javascript"> $(function () { $("#txtautocompletesearch").autocomplete("search.aspx?searchword="); }); function clear_textbox() { if (document.aspnetform.searchfield.value == " enter search here ") document.aspnetform.searchfield.value = ""; }; </script> below mastpage code: <%@ master language="vb" codefile="masterpage.master.vb" inherits="masterpage" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"...

c - Makefile for sql parser... writing dependencies -

i'm implementing sql parser in lex , yacc, in use symbol table kept in separate .h file (sql.h) , in header file have functions declarations. definitions of these functions kept in .c file (sql.c). have included sql.h in sql.c, refer symbols , functions sql.h in both lex file(1.l) , yacc file(1.y). the problem i'm not able write proper makefile this. i'm getting errors multiple declarations. include file , how write dependencies? please help. have searched solution i'm not getting it..... update: i compile code this: lex 1.l yacc -d 1.y gcc lex.yy.c y.tab.c sql.c -ll -ly i following errors after third command of gcc: in file included 1.l:5: sql.h:17: warning: ‘sql’ initialized , declared ‘extern’ sql.h:18: warning: ‘sql_sel’ initialized , declared ‘extern’ 1.l: in function ‘maketable’: 1.l:80: warning: assignment incompatible pointer type in file included 1.y:7: sql.h:17: warning: ‘sql’ initialized , declared ‘extern’ sql.h:18: warning: ‘sql_sel’ i...

c# - Add an item to combobox before binding data from the database -

i had combobox in windows forms form retrieves data database. did well, want add first item <-please select category-> before data database. how can that? , can put it? public category() { initializecomponent(); categoryparent(); } private void categoryparent() { using (sqlconnection con = getconnection()) { sqldataadapter da = new sqldataadapter("select category.category, category.id category", con); datatable dt = new datatable(); da.fill(dt); cbparent.datasource = dt; cbparent.displaymember = "category"; cbparent.valuemember = "id"; } } you either add default text text property of combobox (preferred): cbparent.text = "<-please select category->"; or, add value datatable directly: da.fill(dt); datarow row = dt.newrow(); row["category"] = "<-please select category->"; dt.rows.insertat(row, 0); cbparent.datasource = d...

Android Closing Activity Programmatically -

what equivalent operation within activity navigating away screen. when press button, activity goes out of view. how can called inside activity closes itself. what activity.finish() method (quoting) : call when activity done , should closed.

How do I run a vim script that alters the current buffer? -

i'm trying write beautify.vim script makes c-like code adhere standard can read. my file contains substitution commands begin %s/... however, when try run script file open, in manner :source beautify.vim , or :runtime beautify.vim , runs substitute commands state pattern wasn't found (patterns tested entering them manually , should work). is there way make vim run commands in context of current buffer? beautify.vim: " add spaces before open braces sil! :%s/\%>1c\s\@<!{/ {/g " beautify sil! :%s/for *( *\([^;]*\) *; *\([^;]*\) *; *\([^;]*\) *)/for (\1; \2; \3)/ " add spaces after commas sil! :%s/,\s\@!/, /g in tests first :s command should match (it matches when applied manually). i wrote similar beautifier script implemented in think more flexible way; plus, tried come mechanism avoid substituting stuff within strings. " {{{ regex silly beautifier (avoids strings, works ranges) function! foo_sillyregexbeautifier(start, end) ...

android - Application working in Nexus one but not in Htc hero -

i have developed application in android2.1 update1. application transfers audio microphone headphones. application working in htc nexus 1 not working in htc hero. problem? please me this. thanks in advance htc hero provides android os, v1.5 (cupcake). can't run upgrade version of application in lower versions.

c++ - location of variables on the stack w/o using (&) -

i'm trying determine way test location of variables on stack (without doing common sense way). int main() { int i,j; return 0; } there's no difference between stating int i; intj; , int i,j; can tell cout'ing addresses. goes on stack, j goes on stack. there anyway tell w/o using memory address operator (or pointers). this specific assignment. can comprehend reason why stack implemented way. can determine of how located (and yes it's compiler specific gcc simplicities sake). so yes meant doing things hard way here.. figure out , demonstrate why , how stacks implemented in particular manner i can add more code, more functions.. whatever.. point demonstrate ordering on stack without & so want find addresses of local variables without using c operator designed find address of variable. why? it's worth pointing out that, in modern compiler/processor combination, , j in example may not on stack if don't use ...

configuration - How to auto save vim session on quit and auto reload on start including split window state? -

i split vim screen in 3. 1 :vsplit , 1 :split. want these windows , files worked on saved when close vim. want these windows automatically load when start vim. i tried install gsessions (just added file plugin folder), nothing happend. new vim don't know how configuration works. you can per directory sessions vimrc: fu! savesess() execute 'call mkdir(%:p:h/.vim)' execute 'mksession! %:p:h/.vim/session.vim' endfunction fu! restoresess() execute 'so %:p:h/.vim/session.vim' if bufexists(1) l in range(1, bufnr('$')) if bufwinnr(l) == -1 exec 'sbuffer ' . l endif endfor endif endfunction autocmd vimleave * call savesess() autocmd vimenter * call restoresess() that litter directories .vim s, can modify that. also, change sbuffer badd if don't want new windows each file , add ssop-=buffers vimrc.

python - How to dynamically add members to class -

my question can illustrated code: def proceed(self, *args): myname = ??? func = getattr(otherobj, myname) result = func(*args) # result = ... process result .. return result class dispatch(object): def __init__(self, cond=1): index in range(1, cond): setattr(self, 'step%u' % (index,), new.instancemethod(proceed, self, dispatch) after instance of dispatch must have step1..stepn members, call corresponding methods in otherobj. how that? or more specifically: must inserted in proceed after 'myname =' ? not sure if works, try exploit closures: def make_proceed(name): def proceed(self, *args): func = getattr(otherobj, name) result = func(*args) # result = ... process result .. return result return proceed class dispatch(object): def __init__(self, cond=1): index in range(1, cond): name = 'step%u' % (index,) setattr(self, name, new.instancemethod(make_proceed(nam...

How to Turn Off Binary XML Views in Eclipse (Android) -

up until has been working fine in eclipse , when double clicked xml file pop , edit it. now happening when double click or click open drop down menu notice xml files have been converted binary , have right click , view binary xml , layout view no longer available. please let me know how change and/or how happened in first place. thanx what happens if try open with->android layout editor ?

Storing a session using cookies or http session variables for a scalable solution? -

i have 1 web app under login process stores userid in http session variable(after confirmation of course!). i'm not using session variables other 1 retrieve information user. don't know if 1 scalable solution me yet. server reserve memory this? better use cookies instead? if using multiple application servers (now or in future), believe http session variable dependent server user on (correct me if i'm wrong), in case, can find "sticky session" solution locks user particular server (e.g. ec2's load balancers offer this: http://aws.amazon.com/about-aws/whats-new/2010/04/08/support-for-session-stickiness-in-elastic-load-balancing/ ). i recommend using cookie (assuming logic above right), should make sure have sort of security measure on users can't change cookie , gain access user's account. example, hash string w/ secret key , user id check server-side confirm has not been tampered with.

Flex Air application: open window on right bottom corner -

i developing flex air application , want open in right bottom corner notification..how do this. thanks atul yadav go project directory in flex builder. lets app name test go test->src there should find test-app.xml in find data regarding width, height, x , y coordinates of window opened. change following lines there: <!-- whether user can resize window. optional. default true. --> <resizable>false</resizable> <!-- window's initial width in pixels. optional. --> <width>200</width> <!-- window's initial height in pixels. optional. --> <height>300</height> <!-- window's initial x position. optional. --> <x>800</x> <!-- window's initial y position. optional. --> <y>600</y> you might have change x,y values according screen. if want popup, should take @ popupmanager class adobe air.

c# - Run a Windows Service as a console app -

Image
i want debug windows service pops error message saying cannot start service command line or debugger. windows service must installed using installutil.exe , started server explorer, windows services administrative tools or net start command. i don't have idea error..... before windows service can run, has "installed" first using installutil. eg: c:\installutil -i c:\path\to\project\debug\service.exe then can open list of services start it. eg: right click 'my computer' click on 'manage' open 'services , applications' click on 'services' find service in list , right-click on it click on 'start' once has started, can go visual studio, click on 'debug', click on 'attach process'. another technique add line onstart() method in service: system.diagnostics.debugger.launch(); when that, it'll prompt pick instance of visual studio debug service in.

java - Is it possible to check progress of URLconnection.getInputStream()? -

i want check progress of downloading file urlconnection. possible or should use library? urlconnection function: public static string sendpostrequest(string httpurl, string data) throws unsupportedencodingexception, malformedurlexception, ioexception { url url = new url(httpurl); urlconnection conn = url.openconnection(); //conn.addrequestproperty("content-type", "text/html; charset=iso-8859-2"); conn.setdooutput(true); outputstreamwriter wr = new outputstreamwriter(conn.getoutputstream()); wr.write(data); wr.flush(); bufferedreader rd = new bufferedreader(new inputstreamreader(conn.getinputstream(), "iso-8859-2")); string line, = ""; while ((line = rd.readline()) != null) { = + line; } wr.close(); rd.close(); return all; } i understand whole file downloaded in line (or worng)?: bufferedreader rd = new bufferedreader(new inputstreamreader(conn.getinputstream(), "iso-...

asp.net mvc - What's the recommended place to perform validation: ViewModel, Model or Controller? -

i have registration page , perform validation (in addition stringlength , required annotations on viewmodel) duplicate usernames , email addresses. perform validation in controller when registration form posted back. i'm not sure if right place though. i can't imagine viewmodel right place require viewmodel have reference userrepository. make sense have kind of validation in model classes? if so, how implement on model can check if information valid before sent repository? update code of controller action: if (modelstate.isvalid) { if (!_userrepository.exists(registerviewmodel.username)) { if (!_userrepository.emailexists(registerviewmodel.email)) { _userrepository.add( new user { created = datetime.now, email = registerviewmodel.email, ...

mysql - Count totals by year and month -

i have table looks this: id,created,action 1,'2011-01-01 04:28:21','signup' 2,'2011-01-05 04:28:21','signup' 3,'2011-02-02 04:28:21','signup' how select , group these output is: year,month,total 2011,1,2 2011,2,1 try this: select date_format(created, '%y') 'year', date_format(created, '%m') 'month', count(id) 'total' table_name group date_format(created, '%y%m')

Current date should add 12 hours more in android -

in application want add 12 hours current date , time,then have show in format "yyyy-mm-dd hh:mm:ss". wrote code unable add 12 hours. how can do? please help. my code : calendar cal = calendar.getinstance(); date date = cal.gettime(); string date1 = (new simpledateformat("yyyy-mm-dd hh:mm:ss")).format(date); m_tvtrackend.settext(date1); the calendar class has add method can use add units. calendar cal = calendar.getinstance(); cal.add(calendar.hour, 12); date date = cal.gettime(); string date1 = (new simpledateformat("yyyy-mm-dd hh:mm:ss")).format(date); m_tvtrackend.settext(date1);

Python/SWIG: GC Object already tracked when trying to use a C function to dereference a pointer, from SWIG -

i have issue i'm dealing words (2 byte unsigned integers). here commands run import mysimlib mysimlib.init() strptr = mysimlib.strinit( 200 ) #where 200 number of characters want in #string. strinit returns malloc'd pointer wptr = mysimlib.wordinit () # wordinit returns malloc'd pointer word. mysimlib.write ("title", "data", 4) # 4 number of bytes required store data mysimlib.search ("title", strptr, 200, wptr) #search finds record same title, #copies data strptr number of bytes in record - long #the number of bytes in strptr greater. mysimlib.printword (wptr) #since cannot use python dereference word pointers, call c function print out. at point, program crashes. throws exception (reading violation) or gc object tracked error. thing - have string print function never fails when have print. when try word print, errors. this wordptr initiating function: unsigned int * wordinit () {...

jquery - How to fix "Error: Object doesn't support this property or method" javascript error in Internet Explorer? -

on page captcha demo: http://www.tutorialcadet.com/demo/ajaxform/ the captcha image not refreshing (when clicking on image) in internet explorer. in firefox. chrome, opera works fine. it throws in explorer popu error: line: 155 error: object doesn't support property or method then when check source code in explorer see on line 155: <td><div id="captchaimage"><a href="site_base/register/" id="refreshimg" onclick="refreshimg(); return false;" title="click refresh image"><img src="captcha/image.php?1311183335" alt="captcha image" width="132" height="46" align="left" /></a></div></td> then when click on image again, error popup shows up: line: 1 error: object doesn't support property or method when view source code see ?blank row? on first row. here screen mean blank first row: http://i54.tinypic.com/23ves1j.jpg any...

Django admin action-select checkbox removal? -

Image
pretty simple question. have removed top select-box, choosing action perform on selected models. however, leftmost checkbox not disappear, though have no action toolbar neither in top or in bottom. this annoying, looks if field given model, without headline. see image below... has 2 attributes - description , currentseason. i hope can me remove checkbox! if had removed actions drop down list settings modeladmin's actions none, action_checkbox should've been removed well. class seasonadmin(admin.modeladmin): actions = none here doc link: https://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disabling-all-actions-for-a-particular-modeladmin

sqlite - Slow Performance of Sql Query -

i writing sql query gives me slow performance. because of gives me 504 gateway timeout problem. please me remake query output results faster. put query below. select r.c1, parent_item.c2, parent_item.c3, parent_item.c4, parent_item.c5, parent_item.c6, parent_item.c7, pt.c8, child_item.c9, t.c10, child_item.c11, table1 child_item, table2 t, table3 r, table1 parent_item, table4 pt r.col1 = child_item.id , t.id=child_item.typeid , parent_item.id = r.parent_itemid , pt.id = parent_item.typeid , parent_item.id=800 , parent_item.id = (select itemid table5 itemid=parent_item.id ((10!= 1) ? , (holder_itemid in (10,100) , level > 0): "")) , child_item.id = (select itemid table5 itemid=child_item.id ...

objective c - CALayer frame origin.y is flipped, 0 is at the bottom? -

when add set fram on calayer origin.y reversed, 0 @ bottom of super layer , increasing origin.y moves in super layer. there did cause flipped? expect origin.y=0 top, not bottom. thanks, you can flip coordinate system behave ios this... layer.sublayertransform = catransform3dmakescale(1.0f, -1.0f, 1.0f);

linux - Passing one shell script variable to another shell script -

i trying access 1 script variable script example, script1.sh: export a=10 export b=20 echo "testing" exit script2.sh: . script1.sh echo $a the problem involved here able access variable 'a' script1 in script2 executing all commands written in script1.sh annoying. want access exported variables in script1 , donot want run commands in script1 while calling in script2 . kindly help! thanks, karthik assigning variable command. unless you're prepared write bash parser in bash, want cannot done.

c# - XIRR Calculation -

Image
how calculate excel's xirr function using c#? according xirr function openoffice documentation (formula same in excel) need solve xirr variable in following f(xirr) equation: you can calculate xirr value by: calculating derivative of above function -> f '(xirr) after having f(xirr) , f'(xirr) can solve xirr value using iterative newton's method - famous formula-> edit i've got bit of time so, here - complete c# code xirr calculation: class xirr { public const double tol = 0.001; public delegate double fx(double x); public static fx composefunctions(fx f1, fx f2) { return (double x) => f1(x) + f2(x); } public static fx f_xirr(double p, double dt, double dt0) { return (double x) => p*math.pow((1.0+x),((dt0-dt)/365.0)); } public static fx df_xirr(double p, double dt, double dt0) { return (double x) => (1.0/365.0)*(dt0-dt)*p*m...

signals - Discretizing functions in Matlab -

Image
i have following function , set of values: z(t): {r → [-2,3] | z(t) = sin(0.5×π×t) + cos(2×π×t) + 1 t = [-1 : 0.001 : 1] i need determine z(n×ts) = z(n) , using sample period ts=0.01 , therefore discretizing fucnction. i tried using d2d, i've understood can applied zpk functions. is there other way it? if want 0 order hold approximation of signal, can done following code: ts = 0.01; t = -1:0.001:1; n = t./ts; nsampled = nan(size(t)); nsampled(1:10:end) = n(1:10:end); zcont = @(t)(sin(pi*t/2)+cos(2*pi*t)+1); zzoh = @(n,ts)(zcont(floor(n).*ts)); zdisc = @(n,ts)(zcont(n.*ts)); figure; plot(t,zcont(t),'b','displayname','continuous'); hold on; plot(t,zzoh(n,ts),'r','displayname','zoh'); stem(t,zdisc(nsampled,ts),'k','displayname','discrete'); legend('show'); this give output in attached figure. you can try play ceil() or round() instead of floor() different behavior. if ne...

php - firefox having "#;" in the addressbar -

why firefox(haven't tested in browser) has problems loading form values when #; in addressbar? if have <input type='radio' checked="checked"> , presence of element in addressbar may lead input not getting checked(as expected) how can avoid behavior? example code: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" style="min-height:100%;"> <head> <title>stuff2test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body class="popup" > <form action="" id="frm"> <a href="#;" onclick="alert('added');">add #; addressbar, , refresh</a> <?php $rnd = mt_rand(1, 4); ?> <label for="r_v1"> <input id="r_v1...

php - __toString magic and type coercion -

i've created template class managing views , associated data. implements iterator , arrayaccess , , permits "sub-templates" easy usage so: <p><?php echo $template['foo']; ?></p> <?php foreach($template->post $post): ?> <p><?php echo $post['bar']; ?></p> <?php endforeach; ?> anyways, rather using inline core functions, such hash() or date() , figured useful create class called templatedata , act wrapper data stored in templates. this way, can add list of common methods formatting, example: echo $template['foo']->ascase('upper'); echo $template['bar']->asdate('h:i:s'); //etc.. when value set via $template['foo'] = 'bar'; in controllers, value of 'bar' stored in it's own templatedata object. i've used magic __tostring() when echo templatedata object, casts (string) , dumps it's value. however, despite mantra...

CodeIgniter Security -

i've been doing reading on php security , ran great question/article on > exploitable php functions there ton of interesting commands/functions should never possible run. my question is... ci have built in protection/prevention against using of commands/functions found on list? if so, please point out me, cant seem find it. if not, possible add or create ci core class preventing or of possibly exploitable commands? it might sound lil counter intuitive, having ci dictate best practices seems big part of design... example, csrf break form submission process if dont set right... , thats built right in, disabled... thanks, peter i think got answered. there seems preg_replace looking these commands on input class @ line 763. please correct me if wrong.

ios4 - loading uiwebview from specified location -

//move bookmarked place if page opened bookmark section. - (void)webviewdidfinishload:(uiwebview *)webview1; { if(chkview == 2) { //move webview chkscrollvalue position. [webview stringbyevaluatingjavascriptfromstring:[nsstring stringwithformat:@"document.body.scrolltop = %d", chkscrollvalue]]; // [webview stringbyevaluatingjavascriptfromstring:[nsstring stringwithformat:@"window.scrollby(0,%d);",chkscrollvalue]]; } } i'm loading webview displaying html in resources folder , working fine. now, i'm using javascript html , not working anymore. i got solution. performing task after webviewdidfinishload . rather added function , added code in function [self performselector:@selector(loadbookmark) withobject:nil afterdelay:0.4] ;

linux - C++ 64 bit file i/o gotchas -

i found interesting bug when converting c++ app 32 64 bit linux. our filestore class implements saving/restoring structs to/from file. calls fopen() , fclose() before , after each operation except in 1 method. in (buggy) method on 32-bit platforms, can fseek() , fread() without error though file has been fclose()'d other methods. on 64-bit platform crashes every time on fread(). guess on 32-bit platform underlying file struct persists after fclose() can still accessed. have further info on why difference , other gotchas 64bit file i/o? it sounds undefined behavior me. 64 bit vs 32 bit aspect of question red herring. compiler free erase home directory, or maybe file federal tax return in such circumstances.

design - Recommend a future-proof cross-platform server platform, scalable up and down -

an application dealing cpu-intensive text processing needs run on several server platforms (as many possible, windows , linux enough), , if possible mobile platforms well. desktop support plus development environment, not must. rdbms access required. parallel computing (hadoop, qizmt) support plus. open source origin not requirement. i looking @ qt, right point when nokia made surprising announcement windows phone 7. means qt faces uncertain future. .net / mono seems not bad, mobile platform support lacking. thoughts? facetious answer: javascript , html5 spacewar dudes chose keeping 1962 game going 10+ years.

javascript - JS/Jquery variable schange event -

possible duplicate: detect variable change in javascript how can found out variable has changed? i have event performed every time when variable example == 1, want perfome when variable changes. you can via property setter , newly-standardized part of language (new of the ecmascript5 specification ). work property defined setter on object, not old variable or property. here's example of object foo property both getter , setter: var obj = {}; object.defineproperty(obj, "foo", (function(){ var value = 42; function fooget() { display("getting: " + value); return value; } function fooset(newvalue) { display("setting: " + newvalue); value = newvalue; } return { get: fooget, set: fooset }; })()); live example , works on browsers support ecmascript5 properties, think google chrome @ moment or of course, directly use getter , setter functions rather properties. :-)

git branch issue -

i have local system work (windows) , commit changes , production server (ubuntu) pull changes. i create new branch when have major changes on code. last branch 0.9.1 i pull on server with: sudo git pull git@git.myrepo.com:myproject.git 0.9.1 however, wanted roll previous branch (0.9) , can see when branch -a: * master remotes/origin/0.1 remotes/origin/0.2 remotes/origin/0.3 remotes/origin/0.4 remotes/origin/0.5 remotes/origin/0.6 remotes/origin/0.7 remotes/origin/head -> origin/master remotes/origin/master on local machine use git gui , can see branch 0.9 (and 0.8 , 0.9.1) how come cannot see on server? thanks you should checkout local branch try instead of git pull: git checkout -b 0.9.1 after that, work push changes remote: git push origin 0.9.1 off topic, should consider tags instead of branches major releases.

java - How to Compare Dates and Times? -

how can compare whether 2 datetimes same or @ least overlap? for example, let's have following 2 sets of start , stop times: start time: 2011-07-21 9:00am stop time: 2011-07-21 10:00am start time: 2011-07-21 9:05am stop time: 2011-07-21 10:30am the datetimes not match exactly, can't straight equality test. however, purposes datetimes overlap sufficient deemed match, how can test type of overlap? i highly recommend use jodatime , overlap method. from javadoc, not tell if 2 intervals overlap. tells overlapping interval is. returns: overlap interval, null if no overlap

Compiling android Kernel -

i have been in phase of compiling android kernel install module on emulator. stuck horrible error. here how compiling code: >> path=$path:/home/user/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- >> make cross_compile=arm-eabi- arch=arm ============================================ platform_version_codename=aosp platform_version=aosp target_product=full target_build_variant=eng target_simulator= target_build_type=release target_build_apps= target_arch=arm target_arch_variant=armv5te host_arch=x86 host_os=linux host_build_type=release build_id=openmaster ============================================ - - - - - prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc -mthumb-interwork -ibionic/libc/private -ibionic/libc/private -o out/target/product/generic/obj/lib/crtbegin_dynamic.o -c bionic/libc/arch-arm/bionic/crtbegin_dynamic.s assembler messages: fatal error: invalid -march= option: `armv5te' make: *** [out/target/prod...

asp.net - Converting aspx page into flash swf -

i have iframe advertisement google adsense want flash format how convert iframe flash swf as robert posted, print2flash take printable content (presumably have printable content displayed in iframe) , convert flash (swf) file. print2flash website: print2flash lets convert printable document (e.g. microsoft word, or excel, or powerpoint document) adobe ® flash ® file ( file swf extension ). file can shared users don't have software created original document (for example, microsoft word). can view such files adobe ® flash ® player available across number of operating systems. , these files can published on web fast , easy access them anywhere across globe.

Nested jQuery Cycle slideshows: Why is my thumbnail navigation breaking? -

here my example . i have created portfolio, using fancybox launch lightbox containing nested cycle slideshows. thumbnail navigation works fine on first slideshow, when click link (heroes children) second slideshow, breaks. html same, not sure going on here. i've reworked 3 times, searched remedy, have hard time finding many examples of nested cycle slideshows thumbnail navigation. able find solution different problem having, here on stack overflow, figured place seek help. any idea of what's going wrong here? here's javascript: <!-- lightbox javascript --> <script type="text/javascript"> $(document).ready(function() { function formattitle(title, currentarray, currentindex, currentopts) { return '<div id="project-title">' + (title) + '</div>'; } $(".work-thumb").fancybox({ 'titleposition' : 'inside', '...

Parsing XML with nodes containing HTML in Qt -

i try parse xml file nodes containing html in qt, looks this: <root> <list> <element>some <i>text<i></element> <element><b>another line of text<b></element> <element><i>tag opened here</element> <element>and closed here</i></element> </list> </root> i tried different approaches in qt, getting html node somehow not possible (in easy way). qdomdocument : way found text of qdomelement: use save() function ( documentation ), whole line "<element>...</element>", not inner text. qxmlstreamreader there function readelementtext(qxmlstreamreader::includechildelements) ( documentation ), removes html tags, text of first example "some text". can done in more effective way? i thought of solution, think it: how wrapping contents of <element> tags in cdata sections (using string replace or regex functions) before xml file pa...

iphone - UITableViewCell doesn't pickup UITableViewCellSelectionStyleBlue when adding CAGradientLayer sublayer -

i have uitableviewcell i've added gradient using cagradientlayer. works fine, table cell doesn't turn blue when selected, after setting it's selectionstyle uitableviewcellselectionstyleblue. if don't add gradient layer, works fine. is there way make these items work together? here's code inside of cellforrowatindexpath: //cell gradient cagradientlayer *gradient = [cagradientlayer layer]; gradient.frame = cgrectmake(10, 0, 300, 50); gradient.colors = [nsarray arraywithobjects: (id)[[uicolor colorwithred:255/255.0 green:255/255.0 blue:255/255.0 alpha:1] cgcolor], (id)[[uicolor colorwithred:255/255.0 green:255/255.0 blue:255/255.0 alpha:1] cgcolor], (id)[[uicolor colorwithred:245/255.0 green:245/255.0 blue:245/255.0 alpha:1] cgcolor], (id)[[uicolor colorwithred:247/255.0 green:247/255.0 blue:247/255.0 alpha:1] cgcolor], ...

php - How Can I Populate a Simple Shopping Cart from Two MySQL Databases? -

i developing simple php shopping cart , overall going well. difficulty having in being able pull data 2 separate databases in order populate fields of shopping cart (unit price, name, quantities, etc...). here showcart function: function showcart() { global $db; $cart = $_session['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents $id=>$qty) { $sql = 'select * table_name id ='. $id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id....

python - Using urllib2 to do a SOAP POST, but I keep getting an error -

i trying api call via soap post , keep getting "typeerror: not valid non-string sequence or mapping object." @ data = urllib.urlencode(values) sm_template = """<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:header> <autotaskintegrations xmlns="http://autotask.net/atws/v1_5/"> <partnerid>partner id</partnerid> </autotaskintegrations> </soap:header> <soap:body> <getthresholdandusageinfo xmlns="http://autotask.net/atws/v1_5/"> </getthresholdandusageinfo> </soap:body> </soap:envelope>""" values = sm_template%() data = urllib.urlencode(values) req = urllib2.request(site, data) response = urllib2.urlopen(r...

image - Android: Overlay a picture (jpg) with transparency -

Image
i have picture (jpg) want display on screen. additionally picture should covered partially transparent effect. transparent cover should dynamic. e.g. each day more of picture shown. here picture show mean: i have picture without gray cover , want add cover in different steps. can give me hint how that. you can widgets: framelayout general mechanism overlaying view on top of another: <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <imageview android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/my_image"/> <view android:id="@+id/overlay" android:layout_width="fill_parent" android:layout_height=...

html - setcookie() has header problem -- no whitespace, text, or anything before the <?php tag -

the following code has no whitespace or text before opening php tag. when applied, warning says header has been called "on line 3" (setcookie). i'm @ loss why. <?php $value = 'something somewhere'; setcookie("testcookie", $value); ?> <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> </head> <body> </body> </html> thank help. if have saved file utf-8 bom (byte order mark) 3 charcters ouput @ start of file. these characters tell (dumb) applications utf-8 file. using bom not necessary applications. http://en.wikipedia.org/wiki/byte_order_mark if save file again without bom should fine. not sure if what's happening without seeing actual file worth shot. some editors show kind of file is. use editplus e...

Static file in MonoRail can not be loaded in Forms Authentication mode -

i applied forms authentication monorail project. in login page, static files can not loaded. seems static file can loaded after user logged in. in login page, request script.js redirected http://localhost:49529/mysite/login/index.rails?returnurl=%2fmysite2fcontent%2fjs%2fscripts.js thanks help. if go extension less path , register "*" request go through monorail might case. try add staticfilehandler before monorailhttphandlerfactory setting this: <add verb="*" path="*.pdf" type="system.web.staticfilehandler"/> <add verb="*" path="*.zip" type="system.web.staticfilehandler"/> ... <add verb="*" path="*" type="castle.monorail.framework.monorailhttphandlerfactory, castle.monorail.framework"/>

iphone client side mac server TCP /IP -

i'm doing typical client - server application, server going mac (the server uses asynsocket) , clients iphones/ipod touch/ipads , want know how can send messages between de iphones example. can send information server, , answers me correctly, don't know how sen message between user1 - server - user2 , user2 answers message :s can me? possible to using asyncsocket? thanks. if want have direct communication between clients, isn't client - server application anymore. for peer-to-peer communication suggest use gamekit . create gksession mode gksessionmodepeer , same session id on both clients can communicate. read peer-to-peer connectivity in game kit programming guide .

php - Is there any faster/better way instead of using preg_match in the following code? -

possible duplicate: how can edit code echo data of child's element search term found in, in xmlreader? this code finds if there string 2004 in <date_iso></date_iso> , if so, echo data specific element search string found. i wondering if best/fastest approach because main concern speed , xml file huge. thank ideas. this sample of xml <entry id="4406"> <id>4406</id> <title>book @ 2002</title> <link>http://www.sebastian-bergmann.de/blog/archives/33_book_look_back_at_2002.html</link> <description></description> <content_encoded></content_encoded> <dc_date>20.1.2003, 07:11</dc_date> <date_iso>2003-01-20t07:11</date_iso> <blog_link/> <blog_title/> </entry> this code <?php $books = simplexml_load_file('planet.xml'); $search = '2004'; foreach ($books->entry $entry) { if (p...

c++ - Warning C4710 (not inlined) with inherited destructors -

i have 3 classes build chain of inheritance. 2 of classes pure abstract (iproxy , idataproxy), third 1 "does work" (dataproxy). classes following (only showing con/destructors here): iproxy: class __declspec(dllexport) iproxy { public: iproxy() {} virtual ~iproxy() {} }; idataproxy: class __declspec(dllexport) idataproxy : public iproxy { public: idataproxy() {} virtual ~idataproxy() {} }; dataproxy header: class __declspec(dllexport) dataproxy : public idataproxy { public: dataproxy(); virtual ~dataproxy() {} }; dataproxy implementation file: dataproxy::dataproxy() : m_operationtype( eunknown ) {} when compile class dataproxy microsoft c++ compiler (version 12.00.8804) following warnings: warning c4710: function 'virtual __thiscall idataproxy::~idataproxy(void)' not inlined warning c4710: function 'virtual __thiscall idataproxy::~idataproxy(void)' not inlined warning c4710: function 'virtual __thiscall dat...

C# to Lambda - count decimal places / first significant decimal -

out of curiosity, there equivalent lambda expression following? ... started using lambda not familiar yet methods zip ... //pass in double , return number of decimal places //ie. 0.00009 should result in 5 //edit: number of decimal places good. //however, want position of first non-zero digit //after decimal place. int count=0; while ((int)double_in % 10 ==0) { double_in*=10; count++; } double1.tostring().skipwhile(c => c!='.').skip(1).count() for example: double double1 = 1.06696; int count = double1.tostring().skipwhile(c => c!='.').skip(1).count(); // count = 5; double double2 = 16696; int count2 = double2.tostring().skipwhile(c => c!='.').skip(1).count(); // count = 0;