Posts

Showing posts from January, 2012

Extension Methods for CRM 2011 Online Instances Causing TypeLoad Exceptions -

i writing plugin client on crm online trial tenant (so assume has latest patches etc.) , have come across error i’ve not seen before. speaking use extension method along lines of following, clarity of code really: public static void addorupdate(this entity e, string propertyname, object value) { if (e.attributes.contains(propertyname)) { e.attributes[propertyname] = value; } else { e.attributes.add(propertyname, value); } } nothing hugely controversial there think? anyway whatever reason if include class file part of plugin client, following error thrown: unhandled exception: system.servicemodel.faultexception`1 system.typeloadexception: microsoft dynamics crm has experienced error. reference number administrators or support: #9a0442a7 [foo.bar.plugins: foo.bar.plugins.trackactivity] [6ed535ec-c7a8-e211-858f-3c4a92dbdc37: foo.bar.plugins.trackactivity: create of task] there no trace included, shows plugin isn’t executed (even if fir

HTML5 FullScreen API toggle with JavaScript -

i trying make button toggle (on/off) html5 fullscreen on website. after reading plenty of documentation, appears there still inconsistencies among how browsers treat properties it. i went kind of "cross-browser" approach does work in firefox , safari/macos, partially works in safari/windows , totally fails work in chrome , opera. some castrated code snippets: // class init initialize: function() { this.elmbuttonfullscreen = $('fullscreen'); this.elmbuttonfullscreen.on('click', this.onclickfullscreen.bindaseventlistener(this)); }, // helper methods _launchfullscreen: function(element) { if(element.requestfullscreen) { element.requestfullscreen(); } else if(element.mozrequestfullscreen) { element.mozrequestfullscreen(); } else if(element.webkitrequestfullscreen) { element.webkitrequestfullscreen(); } }, _cancelfullscreen: function() { if(document.cancelfullscreen) { document.cancelfullscreen(); } else if(document.mozc

HTML/CSS links clickable area considerably larger than intended -

i have page made of 4 photographs text underneath them links navigating site. works, except active area link extends entire length of page once begins. can move mouse under pictures , text , still activates hover. the site can found here . can add code here if need be, thought being able see whole thing might help! thank in advance may able offer! remove line height: 420px ; .photography, .cinematography, .contact , .about. have tested it, works fine on firefox , chrome.

filesystems - Filepaths in Wampserver and PHP -

trying use filesystem functions in wampserver environment , cannot read or open files. ran these: echo dirname('c:/wamp/localhost/www/test/test.php'); $basename = basename('c:/wamp/localhost/www/test/'); var_dump($basename); $pathinfo = pathinfo('c:/wamp/localhost/www/test/'); var_dump($pathinfo); $realpath = realpath('c:/wamp/localhost/www/test/test.php'); var_dump($realpath); which returned: c:/wamp/localhost/www/test string 'test' (length=4) array (size=3) 'dirname' => string 'c:/wamp/localhost/www' (length=21) 'basename' => string 'test' (length=4) 'filename' => string 'test' (length=4) boolean false but: $match_id = file('c:/wamp/localhost/www/test/ccg_wcp.csv'); gives me: warning: file(c:/wamp/localhost/www/test/ccg_wcp.csv): failed open stream: no such file or directory in c:\wamp\www\test\test.php on line 32 coming linux, don't unde

api - 404 network error twitter search with json -

i'm getting error syntaxerror: illegal character [break on error] jquery19106301322763694621_1367656472546(� error: permission denied access property 'tostring' "networkerror: 404 not found - https://twitter.com/statuses/user_timeline/musictechfest.json?count=5&callback=jquery19106301322763694621_1367656472544&_=1367656472545 " in replay this, , don't understand what's problem, worked yesterday , it's not. $(document).ready(function() { console.log('doc ready!'); var search_term = { q: 'musictechfest' }; search(search_term); function search(search_form){ //colsole.log('searching for'); console.dir(search_term); $.ajax({ // url: 'http://search.twitter.com/search.json?' + $.param(search_term), url: 'http://search.twitter.com/search.json?q=%twitter%count=4$refresh_interval=60000',

string parsing to get an attribute java android -

i programming in android , getting xml data through soap placing in string object. want id's , put them in array. how do ?????? code below, want values 1101, 1103 in array..... please <getavailablespotresult> <garage id=1 name='south garage' address='100 acme dr' city='san jose' state='ca' zip='95052'> <floor number='1'> <spot id='1101' status='available'/> <spot id='1103' status='available'/> </floor> </garage> </getavailablespotresult> you need parse xml required data. if google, "how parse xml in java android", you'll lots of results. first try , read official documentation on parsing xml data , see examples. you can check out other similar questions how read xml file in android , read xml file in android . can try this tutorial. please tr

html - Border-bottom issue (expanding downwards on hover) -

i'm working on navigation, , can't seem figure out how make bottom border increase in size upwards, instead of expanding downwards (which in turn extends header few pixels), fix extending header setting height, the border still extend downwards instead of upwards. the css: header { margin: 0; padding: 0; left: 0; top: 0; width: 100%; position: absolute; background: #000000; } ul { list-style-type: none; display: block; margin: 0 0 0 20px; padding: 0; } ul li { display: inline-block; padding: 0; } ul li a{ display: block; border-bottom: 1px solid #fff; font-size: 19px; } ul li a:hover{ border-bottom: 2px solid #fff; background: #333; font-size: 19px; } the html: <header> <ul id="nav"> <li><a href="">link 1</a></li> <li><a href="">link 2</a></li> <li><a href="">link 3</a></li> </ul> <

android - MapActivity is not showing list -

i developing scenario in have show addresses of nearest location in listview on mapactivity . after running code list not appear on mapactivity . here code: public class gmapactivity extends com.google.android.maps.mapactivity implements onclicklistener{ mapview _mapview; private static int latitudee6 = 37985339; private static int longitudee6 = 23716735; private gpslistener _gpslister=new gpslistener(); list<overlay> overlaylist; mapcontroller controller; button _cancelbtn; string returnaddress = ""; listview locationlistview; arraylist<string> locationaddressarraylist=new arraylist<string>(); arrayadapter<string> locationadapter; locationlistadapter locationlistadapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.mapscreen); _mapview=(mapview)findviewbyid(r.id.mapview);

asp.net mvc - MVC4 Pass custom view Model back to Controller Action -

i have custom class public class bloggerviewmodel { public person blogger; public list<bloggerwebsite> bloggerwebsites; } that pass view [httpget] public actionresult edit(int id) { blogger = getbyid(id); var websites = getbloggerswebsites(id); var bloggerviewmodel = new bloggerviewmodel(); bloggerviewmodel.blogger = blogger; bloggerviewmodel.bloggerwebsites = websites; return view(bloggerviewmodel); } then when post edit action [httppost] public actionresult edit(bloggerviewmodel entity) { return view(entity); } entity null. my view ( took out allot of code didn't need see. such of text box bindings) @model bloginect.model.models.bloggerviewmodel <h2>edit</h2> @using (html.beginform()) { @html.validationsummary(true) <fieldset> <legend>person</legend> @html.hiddenfor(model => model.blogger.id) <div c

sqlite - Sort comments by rating for the top two rows of the result and the rest by date? -

let's have table of comments, so: --------------------------- | comment | date | rating | --------------------------- | | 1 | 1 | --------------------------- | b | 4 | 3 | --------------------------- | c | 7 | 2 | --------------------------- | d | 1 | 10 | --------------------------- | e | 3 | 20 | --------------------------- i want sort table 2 rated comments appear @ top of result, independently of date, , rest of comments sorted date in descending order. results should this: --------------------------- | comment | date | rating | --------------------------- | e | 3 | 20 | --------------------------- | d | 1 | 10 | --------------------------- | c | 7 | 2 | --------------------------- | b | 4 | 3 | --------------------------- | | 1 | 1 | --------------------------- is possible? you 2 sql-queries. first 1 selects 2 highest comm

Django edit and update data with MySql -

in website, each user has own login id , password, if user logged in, can add, edit , update record only. models.py is class report(models.model): user = models.foreignkey(user, null=false) name = models.charfield(max_length=20, null=true, blank=true) views.py def profile(request): if request.method == 'post': reportform = reportform(request.post) if reportform.is_valid(): report = reportform.save(commit=false) report.user = request.user report.save() return redirect('/index/') else: report = report.objects.get() reportform = reportform(instance=report) return render_to_response('report/index.html', { 'form': reportform, }, context_instance=requestcontext(request)) a user should have 1 age , should in 1 row of data in database. if there no data in database, i.e if it's first time user,

android - Proguard NoSuchMethodError ITelephony -

my code works fine after applying proguard getting following exception 05-04 16:12:00.803: e/androidruntime(22257): java.lang.nosuchmethoderror: com.android.internal.telephony.itelephony.a i ma having itelephony.aidl still getting error. can tell me if there way around ? on google, couldn't more information on examples of how keep interfaces, interface members , inner classes along inner class members. actually want keep in app obsfucate , optimize it. there way achieve ? you need exclude itelephony class proguard , i.e. add ... -keep class com.android.internal.telephony.itelephony { *; } ... entry proguard.cfg file. you'll find in project root folder. proguard tool obfuscates code, i.e. makes more compact , less readable others applying various optimization (e.g. renaming classes). in cases might have negative impact on functionality, e.g. if consider dynamic reflection calls. cheers!

java - Android SQL databse Error while creating -

i've made e- mail client android phone, , want save e- mails in sqlite database. if want fill database test data, error: e/sqlitelog(21212): (1) near "to": syntax error e/sqlitedatabase(21212): error inserting subject=test subject to=emailadress2 from=emailadress1 content=test content android.database.sqlite.sqliteexception: near "to": syntax error (code 1): , while compiling: insert mail(subject,to,from,content) values (?,?,?,?) (...) (1) near "from": syntax error e/error(21212): android.database.sqlite.sqliteexception: near "from": syntax error (code 1): , while compiling: select id, from, to, subject, content mail id = -1 i use following code database: mainactivity.java public void dbcreate(view view){ string = "emailadress1"; string = "emailadress2"; string subject = "test subject"; string content = "test content"; try { data

java - windowDeactivated not working on Mac -

i have following code: public audiodialog() { this.addwindowlistener(new windowlistener() { public void windowactivated(windowevent e) { } public void windowclosed(windowevent e) { } public void windowclosing(windowevent e) { } public void windowdeactivated(windowevent e) { system.out.println("deactivated"); dispose(); } public void windowdeiconified(windowevent e) { } public void windowiconified(windowevent e) { } public void windowopened(windowevent e) { } }); } windowdeactivated correctly executed under windows when jdialog loses focus, under mac nothing happens. can tell me i'm doing wrong?

drupal 7 - Mysql like search with more than one column -

i have drupal site search option. if user enters search keyword, need compare more 1 columns , display records. i have tried following query $search = 'test'; $sql_query = db_select('logoinfo', 'l')->fields('l'); $or = db_or(); $or->condition('search_field', '%'.db_like($search).'%','like'); $or->condition('companyname', '%'.db_like($search).'%','like'); $sql_query->condition($or); $selectlogos = $sql_query->execute(); it displays records matching search keyword order of auto increment id asc. but want display records first having both search_field , companyname matches keyword, after other records matches either companyname or search_field . please advise achieve this. since orderby requires field name , can't order expression, you'll need use addexpression alias , order alias. expression in example return 0 if value not in both fields , 1

html - Stop wide image from producing horizontal scrollbar -

on webpage have wide image, should take right 50% of screen. appears want to, produces unwanted horizontal scroll bar. don't want image scale down, want remain looking does, not produce horizontal scroll bar. how this? html: <div class="image"> </div> css: .image { position:absolute; left:50%; background-image: url('images/banneriphone.png'); width:774px; height:759px; } edit: had suggestions remove overflow option. didn't work, changed code around (put image in html) still didn't work. here's cssdesk link: http://cssdesk.com/mqzpc use in css hide scrollbar of css class image: .image { position:absolute; left:50%; background-image: url('images/banneriphone.png'); width:774px; height:759px; overflow-x:hidden; overflow-y:hidden; } overflow-x hide horizontal scrollbar overflow-y hide vertical scrollbar edit: here can see example of overflow property: h

Error running ruby server with load error -

i new ruby. when try run ruby application, error: $ ruby script/server /home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- script/../config/boot (loaderror) /home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in`require' script/server:2:in `<main>' how can fix this?

ruby on rails - How do I get ActiveRecord to use data from joins? -

i'm running activerecord statement @items = item.joins(:order => :person) .select('items.*').select('orders.*') .includes(:order => [:person, :organization]) .order('created_at desc') .limit(10) and these queries: select items.*, orders.* items inner join orders on orders.id = items.order_id inner join people on people.id = orders.person_id items.deleted_at null order created_at desc limit 10 item load (0.001ms) select (trace) select orders.* orders orders.deleted_at null , orders.id in (51, 50, 49, 48, 47, 46) order orders.created_at desc order load (0.000ms) select (trace) select people.* people people.deleted_at null , people.id in (11, 22, 21, 19, 18) person load (0.000ms) select (trace) select organizations.* organizations organizations.id in (1) organization load (0.000ms) why activerecord re-selecting data database if select'd using inner join in first select items.*,

math - Inverting a 4x4 Matrix algorithm -

i'm trying invert 4x4 matrices, i've seen examples of calculating determinant few dozens of calculations, did not seem work me, might've messed somewhere, i've been trying find way solve this, answer this: public matrix inverse() { double[] array = new double[]{ 1/m[0], m[4], m[8], 0, m[1], 1/m[5], m[9], 0, m[2], m[6], 1/m[10], 0, -m[12], -m[13], -m[14], 1/m[15] }; return new matrix(array); } basicly is, calculating invert of it's components, has been working quite well, expect number 15, last number, it's been spewing out infinity reason, have clue why? guess division zero, question, inverse of 0? answer 0? (not sure if relevant, matrices row-major) your attempt write down inverse of 4x4 matrix utterly wrong. there's absolutely no point trying fix since can never work. you ask result of 1/0 is. well, division 0 , result not defined. there no real number x satisfies

ruby on rails - Validation after database submission -

i have payments model follows: class payment < activerecord::base attr_accessible :amount, :method, :payment_date, :reference_no, :invoice_id belongs_to :invoice validates :amount, presence: true validates :method, presence: true validates :payment_date, presence: true validate :payment_not_more_than_balance def payment_not_more_than_balance if amount > self.invoice.balance self.errors.add :amount, 'payments should less or equal invoice amount' end end end i trying run validation whereby once attempts make payment greater invoice balance, validation error issued. currently, code above makes submission database runs validation. that if have invoice balance of 2000, when make payment of 2000, payment submitted (leaving me invoice balance of 0) , later issued error 'payments should less or equal invoice amount' not neccessary. the error should run if attempt make payment of 2000 when invoice balance 0 how can correct that

python - Passing est datetime to MySql -

in mysql db there column of type datetime. need select records column -- ones less current est date. used code python - datetime of specific timezone determine est date: import mysqldb import datetime class est(datetime.tzinfo): def utcoffset(self, dt): return datetime.timedelta() def dst(self, dt): return datetime.timedelta(0) def get_est(): return datetime.datetime.now(est()) here select request: a = 'select * table1 date <= %s' % get_est() print cursor.execute(a) data = cursor.fetchall() item in data: print item at point, have error of: file "/usr/lib/python2.7/dist-packages/mysqldb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.programmingerror: (1064, "you have error in sql syntax; check manual corresponds mysql server version right syntax use near '= 2013-05-04 13:23:21.776521+00:00' @ line 1") how rid of it? notice have use current est da

c# - How much memory does my CPU support? -

this second question, following first ( how detect if cpu 32 or 64 bit ). i know how find out if cpu has 64 bit architecture. having 64-bit architecture, not mean can address 2^64 (=16,777,216 tb). for example: if run piece of code: managementobjectsearcher searcher = new managementobjectsearcher("root\\cimv2", "select * win32_processor"); managementobjectcollection cpus = searcher.get(); foreach (managementobject queryobj in cpus) { console.writeline("addresswidth: {0}", queryobj["addresswidth"]); console.writeline("datawidth: {0}", queryobj["datawidth"]); console.writeline("architecture: {0}", queryobj["architecture"]); } this result in: addresswidth: 32 (meaning, os 32-bit) datawidth: 64 (meaning, cpu 64-bit) architecture: 9 (meaning 64-bit architecture) now want know maximum possibly memory cpu supports. if cpu @ internet ( http://ark.intel.com/products/65520 ) see can a

Status bar in google map -

i want make status bar in top of map this: http://gmaps-samples-v3.googlecode.com/svn/trunk/geolocate/geolocate.html can show me how that, thanks. <!doctype xhtml public "-//w3c//dtd xhtml 4.01//en"> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>where i?</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="geometa.js"></script> <style type="text/css"> *, html { margin:0; padding:0 } div#map_canvas { width:100%; height:100%; } div#info { width:100%; position:absolute; overflow:hidden; text-align:center; top:0; left:0; } .lightbox { filter:alpha(opacity=60); -moz-opacity:0.6; -kh

asp.net - Where can I clear non-razor view engines in a Web Pages site? -

it recommended when using razor view engine unload others (such web forms) in global.asax so: viewengines.engines.clear(); viewengines.engines.add(new razorviewengine()); but razor 2 web sites not have global.asax file, can accomplish there?

python - PIL returns empty boxes instead of images -

i'm trying write program in python 3 using pil , having hard time displaying image... i using dictionaries temporarily store variables config.ini usernames={} usericons={} in range(numberofusers): usernames[i]=config[str(i)]["username"] usericons[i]=config[str(i)]["usericon"] later, want display grid images(thumbnails) , usernames user select from usericonwidgets={} in range(numberofusers): usericons[i]=imagetk.photoimage(image.open(config[str(i)]["usericon"])) usericonwidgets[i]=label(usersselectioncanvas,borderwidth=2,relief=solid,) usericonwidgets[i].configure(image=usericons[i]) usericonwidgets[i].grid(row=i,column=0) however, keep getting empty square images should be... no errors appear, white boxes... doing wrong , how fix it?

c# - Measuring code execution time -

i want know how time procedure/function/order takes finish, testing purposes. this did method wrong 'cause if difference of seconds 0 can't return elapsed milliseconds: notice sleep value 500 ms elapsed seconds 0 can't return milliseconds. dim execution_start system.datetime = system.datetime.now threading.thread.sleep(500) dim execution_end system.datetime = system.datetime.now msgbox(string.format("h:{0} m:{1} s:{2} ms:{3}", _ datediff(dateinterval.hour, execution_start, execution_end), _ datediff(dateinterval.minute, execution_start, execution_end), _ datediff(dateinterval.second, execution_start, execution_end), _ datediff(dateinterval.second, execution_start, execution_end) * 60)) can show me better way this? maybe timespan ? the solution: dim execution_start new stopwatch execution_start.start() threading.thread.sleep(500) messagebox.show("h:" & execution_start.elapsed.hours & vbnewline &am

c++ - Doubts in a code to test the use of assignment operator -

i writing code test use of assignment operator , copy constructor. code follows: #include <iostream> #include <algorithm> using namespace std; class fun { int i; public: fun():i(1) {i=1;cout<<"in: cons\n";} ~fun() {cout<<"in: des\n";} fun& operator=(fun b) { cout<<"in: assignop\n"; swap(this->i, b.i); return *this; } fun(fun& b) { cout<<"in: copy cons\n"; b.i = this->i; } void print() { cout<<i<<endl; } }; main() { fun a; fun b; b = a; a.print(); } and here output of code: in: cons in: cons in: copy cons in: assignop in: des -1216991244 in: des in: des now, there 2 things can't understand output. firstly, why code going in copy constructor function? s

objective c - NSManagedObjectContext performBlockAndWait causing deadlock when called from two threads -

i have osx app i'm using parent/child nsmanagedobjectcontext setup. child moc has nsprivatequeueconcurrencytype , 1 i'm using. parent set nsmainqueueconcurrencytype when call performblockandwait on child context background thread @ same time called main thread deadlock – semaphore_wait_trap . pausing debugger shows both threads stuck @ performblockandwait how can around this? thought method designed situation , queue blocks on context's private queue return appropriately? i worked around creating serial queue , doing performblock calls through make sure wouldn't mess each-other up. honestly, i'm not sure if practice did solve problem particular situation.

git - Octopus merge: cosmetic, or indispensible in some cases? -

i can octopus merge of branches a , b head . or, can ordinary merge of a , followed ordinary merge of b , , if there no conflicts end same content. use of octopus matter of taste in how commit history look, or there conflicts more resolved via octopus? is use of octopus matter of taste in how commit history look no. 2 sources in case isn't sample: imagine 10-20-30 branches, must merge mainline, , calculate amount of merges. single advantage of om - can merge amount of sources in 1 operation are there conflicts more resolved via octopus? octopus merge merge non-conflicting sources, lot of branches guaranteed disjoint changes ususal case real-world

ios - UIPickerView not showing data correctly (Only Show "?") -

forgive me if question has been discussed previously. have problem displaying data in uipickerview, it display question mark "?" . header file.h #import <uikit/uikit.h> @interface custompickerviewcontroller : uiviewcontroller <uipickerviewdelegate, uipickerviewdatasource> { nsmutablearray *arraycolors; } @property (strong, nonatomic) iboutlet uipickerview *kotapicker; @end impl.m - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview { return 1; } - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component { return [arraycolors count]; } - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row { return [arraycolors objectatindex:row]; } - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component { nslog(@"the data %@", [arraycolors objectatindex:row]); } - (void)viewdidload { [super viewdidload]

regex - PHP replace all dots to comma -

this question has answer here: replace comma(,) dot(.) regex php 5 answers i have string 10.2, 200.3, 33.00 and want replaced 10,2, 200,3, 33,00 i tried preg_replace("/[.]$/","/\d[,]$/",$input); but not replacing! i can't use str_replace because it's task in university preg_replace('/\./', ',', $input); this replace '.' dots ','. preg_replace('/(\d+).(\d+)/', '$1,$2', $input); this more specific need. $1 replaces first digit in parenthesis; $2 second. -buy me beer nw ;)

php - Finding tablename -

i've 8 tables.. assume x1,x2...x8. these tables have similar structure fields as: id,content,pageview. pageview count number of views of particular id. post's stored in rows particular id's. i want find first top 10 post on basis of pageview these 8 tables. i used : $sql="select id,content x1,x2,x3,x4,x5,x6,x7,x8 order pageview;" results comes up.ok! suppose results like id content 13 1 19 okay .. .. . in result want find id:19 belongs table? can run loops match content wont fast enough , logic.. any solution find tablename of particular id? your sample query not run if have same field names in each table. not mention you're producing cartesian product since you're not joining on of fields. i think might looking union instead: select * ( select 'x1' whichtable, id, content, pageview x1 union select 'x2' whichtable, id, content, pageview x2 ... union select 'x8' which

c# - FileStream throws File not found -

the program meant set file path , idea when data set, should use function: public void sendfile(string filename, long filesize, networkstream io) { sendfilenametoserver(); sendfilesizetoserver(); byte[] filedata; try { if (!file.exists(filename)) { throw new filenotfoundexception("file not exist!"); } filestream openfilestream = new filestream(filename, filemode.open, fileaccess.read); binaryreader breader = new binaryreader(openfilestream); int32 remainingsize = convert.toint32(_filesize); { filedata = breader.readbytes(bufsize); io.write(filedata, 0, bufsize); remainingsize -= bufsize; } while (remainingsize > bufsize); { filedata = breader.readbytes(remainingsize); io.write(filedata, 0,

click on the button to run php code and echo result -

i want implement script: http://www.daniloaz.com/en/560/programming/backup-de-bases-de-datos-mysql-con-php/ on website backup database @ end of day. may know possible me put button click , run script , echo status after finish without refreshing page or bring me new page. as @ moment everyday need go link: www.example.com/backup.php daily backup, want ease job :) any idea how this? what type of button? if html yes it's easy have button on ever page want along div so: <input type="button" name="perform_backup" onclick="do_backup()"><div id="results"> no backup has been performed yet</> then have javascript calls backup php script <script> function do_backup(){ var xhreq = new xmlhttprequest(); var request = "http://www.example.com/backup.php " // prepare request server xhreq.open("get", request, false); // send request xhreq.send(null); document.getele

c - Simple test of malloc and free with int pointer causes double free or corruption error -

to learn more pointers wrote simple test function creates pointer, allocates space ande after output on shell space shall freed. void main() { int *p = (int*) malloc(sizeof(int)); int = 42; printf("p: %x\n", p); printf("*p: %d\n", *p); printf("a: %s\n", a); printf("&a: %x\n", &a); p = &a; printf("p: %x\n", p); printf("*p: %x\n", *p); //until works expected free(p); //error // printf("p: %x\n", p); // shall cause error, because space freed // printf("*p: %x\n", *p); // shall cause error, because space freed } at first runs ok. free(p) caused no error. tried same test struct , got double free error. "ok, maybe wrong, lets go start", thought , ctrl+z 1 above, before. still error. why? thats newbie question, know. code above can find everywhere in web simple demonstration of malloc , free. here: http://www.cplusplus.com/reference/cstdlib/free/ hope, can

python - How to react on actions (events) in real time in Tkinter? -

i´d create program react on actions user in real time. example there 3 labels . , when user clicks on one, want recolor border different color , user should able "type" (single) number in label . know entry widget, labels suitable whole application. thank answers your question vague answer precisely, address each individual point: yes, it's possible "react .. in real time" -- whenever event detected acted upon possible. yes, it's possible color border of widget when event detected yes, it's possible type label. though, obviously, behavior unusual , may not expect. i suspect none of solve real problem, have no idea you're trying accomplish.

jquery mobile - How to bind the element id to an observable using an extender in knockout? -

i have set of check boxes, each bound custom "checked" handler: <input type="checkbox" name="colours-red" data-bind="jqmcheckbox: colourred" id="check-1" /> <input type="checkbox" name="colours-green" data-bind="jqmcheckbox: colourgreen" id="check-2" /> <input type="checkbox" name="colours-blue" data-bind="jqmcheckbox: colourblue" id="check-3" /> my view model easy: this.colourred = ko.observable(false); this.colourgreen = ko.observable(false); this.colourblue = ko.observable(false); now, try extend colours follows, automatically updated. need other subscribers notified, if changing: ko.extenders.elementid = function (target, option) { target.elid = ko.observable(); function setelementid(target, option) { target.elid(option); } target.subscribe(setelementid); return target; }; inside

web services - Versatile, lightweight and free programming language that runs on desktop and cloud -

i'm student , (need to) write small desktop , web apps time time. i've used realbasic few times i'm pretty sure theres better languages. those requirements: run on windows/os x , linux have webframework available node.js js, vibe d, etc a nice ide/text editor support language (code completion) os x free run native, or small portable vm lika dao or have packed delphi , realbasic not ruby (sorry) i'm open sorts of languages, d looked best combination of vibe.d, after spending day trying set on os x dropped it. python: pre-installed on os x , 99% of linux distros. installable on windows. python has flask, bottle, django, web2py, web.py, , quite few more. i use sublime text . textwrangler good, don't remember if had support code completion. free. you can use py2exe , py2app make standalone executables. not ruby. python's web frameworks excellent , pyqt4/ pyside complete python bindings qt4.

nginx - PHP-FPM - upstream prematurely closed connection while reading response header -

already saw same question - upstream prematurely closed connection while reading response header upstream, client jhilke dai said not solved @ , agree. got same exact error on nginx+phpfpm installation. current software versions: nginx 1.2.8 php 5.4.13 (cli) on freebsd9.1. bit isolated error , sure happened when trying import large files, larger 3 mbs mysql via phpmyadmin. counted backend closing connection when 30 secs limit reached. nginx error log throwing this [error] 49927#0: *196 upstream prematurely closed connection while reading response header upstream, client: 7x.xx.x.6x, server: domain.com, request: "post /php3/import.php http/1.1", upstream: "fastcgi://unix:/tmp/php5-fpm.sock2:", host: "domain.com", referrer: "http://domain.com/phpmyadmin/db_import.php?db=testdb&server=1&token=9ee45779dd53c45b7300545dd3113fed" my php.ini limits raised accordingly upload_max_filesize = 200m default_socket_timeout = 60 max_execut

ruby on rails 3 - How to update an attribute ':what_cause' of model user using group of radio button in rails3 -

i want update attribute ':what_cause' of model user on page in session. user clicks on 1 of 3 radio buttons , corresponding value should transferred method updates it. wrote following code- <%= form_for :user |f| %> <label>pratham</label> <%= f.radio_button :what_cause, "pratham" %> <label>kali</label> <%= f.radio_button :what_cause, "kali" %> <label>akshaya</label> <%= f.radio_button :what_cause, "akshaya" %> <%= f.submit "save", :controller => "users_controller", :action => "change_cause", :method => "put" %> <% end %> and here code updation in change_cause method of users_controller.rb- def change_cause if params[:radio_button] == "pratham" @user.update_attribute(:what_cause, "pratham") end if params[:radio_button] == "kali" @user.update_attribute(:what_cause

python - Scraping a web page as you manually navigate -

is there way, using library or method, scrape webpage in real time user navigates manually? scrapers know of such python mechanize create browser object emulates browser - of course not looking since if have browser open, different 1 mechanize creates. if there no solution, problem want scrape elements html5 game make intelligent agent of sorts. won't go more detail, suspect if others trying same in future (or real time scraping real user), solution useful them well. thanks in advance! depending on use-case is, set socks proxy or other form of proxy , configure log traffic, instruct browser use it. you'd scrape log somehow. similarly, if have control on router, configure capture , logging there, e.g. using tcpdump . wouldn't decrypt encrypted traffic, of course. if working 1 browser, there may way instruct @ each action via custom browser plugin, i'd have guess you'd running security model issues lot. the problem html5 game typically of &q

node.js readline - write data appears in input -

i've got basic readline implementation seems have problem when write written data appears in input , raises 'line' event. in standard linux rxvt window. var rl readline.createinterface({ input: process.stdin, output: process.stdout, // terminal: false <--- setting true/false makes no difference }); rl.on('line', function(line) { var inp = line.trim(); console.log('line event'); switch(inp) { case .... default: console.log('unknown command: ' + inp + '\n'); } }); and rl.write(string); from socket i/o. write raises 'line' event , written data apears unknown command. if enter data on terminal raises 'line' event expected , works ok. clearly data written shouldn't appear on input , asking might reason this. thanks actually rl.write trigger line event. should in docs isn't. if want bypass parser write process.stdout. previously termina

c++ - What is the most common way to develop a iOS app? -

just wondering if developers use xcode develop in same way. in, developers or angry birds make view controllers? there 1 way go developing apps in xcode, , major companies way? also, how go developing ios app in c or c++ , not objective-c? need use objective-c? how can develop using c or c++? angry birds , such created game engines such corona ( http://www.coronalabs.com/products/corona-sdk/ ) note rovio (angry birds) developed own game engine. if you're interested in developing games suggest game engine rather doing code via xcode (while might possible :)).

html - Position: fixed scrolls too far -

Image
my question layout in image: white box in upper right corner = content box the black line @ bottom = footer bar the box right = sidebar box the sidebar set css position: fixed , follow users scroll. the problem is, on small screen sizes, user can scroll far, meaning sidebar box, go futher down footer bar. how can make sidebar stop 20 pixels before hitting footer? css code: div#sidebar { margin: 20px 0px 20px 20px; width: 270px; height: 295px; border: 1px solid #ccc; background-color:#fff; padding: 20px; position:fixed; left: 730px; } div#content { margin: 20px 0px 20px 0px; width: 650px; height: 600px; border: 1px solid #ccc; background-color:#fff; float: left; padding: 20px; } div#footer { width: 100%; min-width:1024px; height: 30px; border: 1px solid black; background:#252525; text-align:center; padding-top:10px; color:#555; } i try adjust #sidebar margin-bottom . what's html?

Assembly x86 Understanding Define Word (DF) instruction -

Image
i'm starting play little bit assembly excuse me if questions dumb. my questions (i'm trying divide 100 5, playing memory , variables of course!) why dw (define word) instruction executed that? mean, understand of others line in particular dark 1 me.. also, can explain me why var instantiated @ address 0010ah ? think it's because 4 istructions before instantiation occupy 4*16bits=4*2bytes=8bytes, , var filed on stack right after. shouldn't instruction elsewhere? loaded on stack once program starts run? bonus question: how can check what's on stack in emu8086? because using assembler , not compiler. literally translating mnemonics , data flat binary file (or more commonly, headers included ie pe). dw quite literally "declaring word". it's placing $0200 @ place in code. if look @ handy table , can see opcode add r8, r/m8 while i'm not going go whole opcode structure , disassembly, you'll see [r] meaning has modrm by

java - Spring MVC Stack Over Flow Error - trying to get data from database -

i have form inserts database before preform insert check if there existing records. unable insert record , getting stackoverflow error. can tell me causes error , can rid of it. if remove check hasrecords code preforms fine. code doesn't want access database @ point. have created different types of function preform check here records @ point keep getting same error stackoverflow code com.crimetrack.service.monitoringmanager.getmonitoringstdate(monitoringmanager.java:60) public string getmonitoringstdate(integer crimerecno, integer socialsecuritynumber) throws exception { return this.getmonitoringstdate(crimerecno, socialsecuritynumber); } dao getmonitoringstdate public string getmonitoringstdate(integer crimerecno, integer socialsecuritynumber){ //select minimum start date in event there several records although not allowed string sql = "select ifnull(min(monitoringstdate),'0') monitoringstdate tblmonitoring crimerecno