Posts

Showing posts from April, 2013

css - two div left right with auto width -

<div id="leftdiv" style="background: yellow; min-width: 400px; max-width: 800px;">left content left content left content</div> <div id="rightdiv" style="background: red; width: 250px;">right content right content right content</div> i put float: left in left div max-width , min-width not working. how can fix ? float right div must before left coz gives trouble in version of ie <div id="rightdiv" >right content right content right content</div> <div id="leftdiv">left content left content left content</div> css same bot #leftdiv { background-color:yellow; min-width:100%; max-width:800px; float:left; } #rightdiv { background-color:red; width:250px; float:right; }

css - Styling :after pseudoelement in Firefox -

i can't figue out way rid of :after alement on firefox. does't show in firebug @ all, , it's messed in firefox. probelm in question css arrow pointing downwards: .arrow-box { position: relative; background: #000000; } .arrow-box:after { top: 100%; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; } .arrow-box:after { border-color: rgba(0, 0, 0, 0); border-top-color: #000000; border-width: 10px; left: 50%; margin-left: -10px; } it works fine everywhere apart firefox. how can :after styled on firefox alone? [edit] <ul> <li > <a href="index.php">strona główna</a> </li> <li class="arrow-box"> <a href="index.php?page=lista-instalacji">lista instalacji</a> </li> <li > <a href...

emacs - "cl-labels with dynamic scoping is not implemented" -

i'm trying use cl-labels in emacs package i'm writing. user has filed bug report problem i'm not observing in own emacs @ version 24.3.1, user on 24.3.2. https://github.com/d11wtq/fiplr/issues/3 `cl-labels' dynamic scoping not implemented i'm using cl-labels here: https://github.com/d11wtq/fiplr/blob/f368e84410d2ee57117b2d6501c0cf42359bc252/fiplr.el#l154-l177 ;; builds gigantic `find' shell command -prune, -o, -not , shit. (defun fiplr-list-files-shell-command (type path ignored-globs) "builds `find' command locate project files & directories." "path base directory recurse from." "ignored-globs alist keys 'directories , 'files." (cl-labels ((type-abbrev (assoc-type) (cl-case assoc-type ('directories "d") ('files "f"))) (name-matcher (glob) (mapconcat 'identity ...

c# - Web app, load image into memory to get width -

i have web application displays large thumbnails. layout built on server. what's best way, server side, load images memory want adjust row layout depending on cumulative width of images? need know width, can vary image image? i'm thinking, create control, load image, width, clear memory? ideas? you should able load file. no need create control. see this bitmap constructor . for example: int width; using (bitmap bmp = new bitmap(filename)) { width = bmp.width; }

c++ - Private Class Variables -

i having trouble accessing private class variable in 1 of programs. made test program still don't understand i'm doing wrong. test.h class test { private: int number; public: int randomize(); }; test.cpp #include "test.h" #include <iostream> int test::randomize() { number == 1; std::cout << number; return number; } main.cpp #include "test.h" #include <stdio.h> int main(int argc, char* argv[]) { test test; int result = test.randomize(); printf ("number = %d", result); return 0; } i warning when compiling test.cpp:6:9: warning: expression result unused [-wunused-value] number == 1; and outputting 134514363number = 134514363 i have no clue going on. thinking outside scope maybe. mean still compiling fine, thought wouldn't able access number @ if wasn't doing right. any appreciated. thanks == comparison operator; returns bool true if operands...

search - Emacs: Is it possible to list all matching lines for a certain query string for marked files in dired? -

i found out m-x occur other day. ( how achieve code folding effects in emacs? ) i wonder if list matching lines in multiple files(or buffers) preferably marked in dired mode. m-x multi-occur m-x multi-occur-in-matching-buffers and also: m-x multi-occur-in-this-mode (defun multi-occur-in-this-mode () "show lines matching regexp in buffers major mode." (interactive) (multi-occur (get-buffers-matching-mode major-mode) (car (occur-read-primary-args))))

android - Thread.Wait() exception, not knowing how to fix it -

i have frameanimation, want start 3 second or so...therefore added in thread wait 3 second meet exception. im havent done work thread before pretty first time using it, can help? this code: public void settimerimage4bot() throws exception { thread thread = new thread(); animationdrawable frameanimation = (animationdrawable)bot.getdrawable(); frameanimation.setcallback(bot); frameanimation.setvisible(true, true); frameanimation.start(); log.i("baoanh","start"); thread.wait(3000); frameanimation.stop(); log.i("baoanh","stop"); generaterandom(); } this error: 05-21 10:11:55.633: warn/system.err(740): java.lang.illegalmonitorstateexception: object not locked thread before wait() 05-21 10:11:55.633: warn/system.err(740): @ java.lang.object.wait(native method) 05-21 10:11:55.633: warn/system.err(740): @ java.lang.object.wait(object.java:326) 05-21 10:11:55.633: warn/system.err(740): @ c...

centos - ffmpeg thumbnailer configure/make trouble in CentOS6 -

i using centos 6.4 86x64. what planning install ffmpegthumbnailer. i have downloaded @ link below. https://code.google.com/p/ffmpegthumbnailer/ the problem when extract tar.gz , command configure, it alway says this. checking ffmpeg... no configure: error: package requirements (libavutil libavformat libavcodec >= 52.26.0 libswscale) not met: no package 'libavutil' found no package 'libavformat' found no package 'libavcodec' found no package 'libswscale' found of course, installed ffmpeg 1.2. /usr/lib64/libswscale.so.0.11.0 /usr/lib64/libswscale.so.0 and have libswscale.so. what can solve this? thanks:d ============i solved 1 , another=============== i solved(?) console said. adjust pkg_config_path. i find libavutil.pc , give path pkg_config_path, below. export pkg_config_path=/usr/lib/pkgconfig/ then looks ok, got one. ./configure works nice suspected message. configuration summary ---- png support : ...

couchdb - How to get a couchapp to serve a file with no extension (implied .html) -

i have couchapp working fine. this works: http://domain.com/file.html not: http://domain.com/file i want understand if there no extension, should try .html extension. i'm not sure if _rewrite rule (which using prettify urls) or else. afaik rewrites cannot used add suffix matched variable in url path. an alternative approach use put content of file.html document id "file" under given key (named "content" or similar), create show function [1] (calling "render") outputs value of key content type "text/html" , create rewriter such as: { "from": "/:doc", "to": "/_show/render/:doc", "method": "get", "query": { } } the complete design doc this: { "_id": "_design/rewrite", "shows": { "render": "function(doc) { return { headers: { \"content-type\": \"text/html\...

Nunit - Why single test with unique name is executing multiple times? -

i have test like [test] [testcase("chrome", testname = "one")] [testcase("firefox", testname = "two")] [testcase("ie", testname = "three")] public void mytest(string browser) { ............. } i calling through programming as simplenamefilter filter = new simplenamefilter() { }; test = "seleniumtests.test.one"; filter.add(test); coreextensions.host.initializeservice(); testpackage testpackage = new testpackage(@"d:\test.dll"); remotetestrunner remotetestrunner = new remotetestrunner(); remotetestrunner.load(testpackage); testresult result = remotetestrunner.run(new nulllistener(), filter, true, loggingthreshold.all); when executed above code, test "one" executing , calling multiple time, can tell why happening this? thanks in advance, kishore. first of in case don't need first [test] , since have [testcas...

scala - Why is there an Option.get method -

why method get defined in option , not in some ? one apply pattern matching or use foreach , map , flatmap , getorelse preferred anyway without danger of runtime exceptions if none.get called. are there cases get method convinent justifies this? using get method reminds me java "i don't have check null because know var set" , see nullpointerexception . option.get useful when know, reasoning isn't captured type system, value have not none. however, should reach when you've tried: arranging knowledge expressed types. using option processing methods mentioned (flatmap, getorelse etc), , none of them fit elegantly. it's convenient throwaway / interactive code (repl, worksheets etc).

Serializing multidimensional arrays to JSON with JAXB and MOXy -

i'm serializing next two-dimensional string array jaxb/moxy: @xmlelement(name = "row") @xmlelementwrapper(name = "rows") private string[][] rows; and want serialized next json: "rows": [ ["1", "2"], ["3","4"], ["5","6"] ] but instead: "rows": [ { "item": ["1","2"] }, { "item": ["1","2"] }, { "item": ["1","2"] } ] any ideas how fix this? note: i'm eclipselink jaxb (moxy) lead , member of jaxb (jsr-222) expert group. the current support multi-dimensional arrays in moxy matches xml representation defined in jaxb specification. update answer once have come appropriate workaround you. below enhancement request can use track our first-class support use case: http://bugs.ecl...

set position of infowindow android google maps v2 -

i have used custom infowindow when marker clicked. but showing window @ default location. i.e. on top of marker. but, want infowindow overlapped on marker. how can set position infowindow?? afaik not possible in google map api v2 , think there open issue for kind of task, can find @ moment.

batch file - Sending a error message if folder not found -

i have written bat file users download svn repository , open folder using start command. here how script looks like: @echo off echo. echo. [ svn updater ] set svnurl=https://svn.test.com/test set source=c:\projects\ set svn=c:\program files\tortoisesvn\bin echo. "%svn%\tortoiseproc.exe" /command:checkout /path:"%source%" /url:%svnurl% /closeonend:2echo. done. echo. echo. operation complete. start c:\projects\ this works fine if svn installed checkout destination folder c:\projects. problem if tortoise svn not installed in user's machine. operation fail , return message "cannot open c:\projects\" folder doesn't exist. question: need place if condition or rescue if couldn't open local folder, , rather send message "svn not installed". can please me out this. ruby programmer , don't know batch scripting. thanks in advance this alert user. did want do? if not exist "%source%\" ( echo please install xx...

how to parse milliseconds into date in javascript -

i getting stucked convert date ms (receiving json) recieving date in json in format below /date(1355250600000)/ so converted ms ---> var d = response.contributionsdate.replace("/", "").replace("/", "").replace("date(", "").replace(")", ""); so d = 1355250600000 to convert tried code below---> var date = new date(d); alert(date); but did not work ( invalid date ), if have idea date parsing, me d string, not number. try var date = new date(+d); instead. the prefix + causes coercion number. incidentally, can simplify replace operations to var d = +response.contributionsdate.match(/^\/date\((\d+)\)\/$/)[0];

Cant get the print preview for the panel C# -

i want program show print preview of panel instead showing whole paper size. how set print preview of this? bitmap memoryimage; public void getprintarea(panel pnl) { memoryimage = new bitmap(pnl.width, pnl.height); rectangle rect = new rectangle(0, 0, pnl.width, pnl.height); pnl.drawtobitmap(memoryimage, new rectangle(0, 0, pnl.width, pnl.height)); } protected override void onpaint(painteventargs e) { if (memoryimage != null) { e.graphics.drawimage(memoryimage, 0, 0); base.onpaint(e); } } public void printdoc1_printpage(object sender, printpageeventargs e) { rectangle pagearea = e.pagebounds; e.graphics.drawimage(memoryimage, (pagearea.width / 2) - (this.panel1.width / 2), this.panel1.location.y); } public void print(panel pnl) { //printdocument1 pannel = pnl; getprintarea(pnl); previewdlg.document = print...

php - how to call a jquery click function by a button generated from ajax file -

hi have form appends table when user inputs value eg. if user inputs '1' values related '1' appended on table , table appended on page calling function of jquery append table row when add button pressed function not working because generating button ajax???? can me in this here script generate new row $(document).ready(function() { var currentitem = $('#items').val(); $('#addnew').click(function() { var strtoadd = '<tr><td align="center"><input type="text" size="6" maxlength="6" id="ord_' + currentitem + '" maxlength="6" name="ord_' + currentitem + '" class="form-input-oth" onkeyup="return copy(this.val());"/></td>\n\ <td align="center"><input type="text" size="6" maxlength="6" id="srn...

algorithm - String matching between complete and incomplete(or short form) strings -

this question might reported duplicates, have done lots of research , haven't got satisfactory, thought better ask precisely. in project, need match address strings. have implemented several string searching algorithms, soundex, levenshtein distance, damerau–levenshtein distance, fuzzy search, character frequency matching etc. results become unsatisfactory search between strings - st. , street, jr. , junior etc. thought of replacing st. streets, cause problems in addresses 'st. pauls street'. should do? create string distance dictionary. example: distance('street','st')=0 . need training data create dictionary though.

xcode - iOS app - Lite version or paid version -

in windows phone "app.xaml.cs" file contains following method identify whether app trial version in windows phone app. private void application_launching(object sender, launchingeventargs e) { var license = new microsoft.phone.marketplace.licenseinformation(); istrial = license.istrial(); } here istrail property returns true or false. there method available ios detect lite or paid version? there no concept of trial in ios app store. submit 2 different apps different names - lite/pro etc. since apps different binaries, can use compile time preprocessor macros differentiate between pro , lite versions. eg, in pro target, define lite=0 , , in lite: lite=1 , , in code: #if lite //do #else //do else #endif just word of warning: might want check apple guidelines respect free/paid apps combo. @manujmv mentioned, don't want use words "trial" or "beta" in app name. app submitted app store should functionally complete in , should supp...

php - How can I send valid JSON back to iOS application? -

i have problem. i'm trying weeks fetch data database, encode json , send ios application. problem every time json not valid says http://jsonviewer.stack.hu/ here code have now: //connection database $dbhandle = mysql_connect($hostname, $username, $password) or die("unable connect mysql"); //echo "connected mysql<br>"; //select database work $selected = mysql_select_db("test",$dbhandle) or die("could not select examples"); $result = mysql_query("select * test.debiteur sort_naam '%eri%'"); while($row = mysql_fetch_array($result, mysql_assoc)) { $deb_nr['deb_nr'] = $row['deb_nr']; $deb_naam['name'] = $row['deb_naam']; $deb_adres['adrs'] = $row['deb_adres']; $testje = array_merge($deb_nr, $deb_naam, $deb_adres); $testjevervolg = array('klanten' => array($testje)); sendresponse(200, json_encode($testjevervolg)); } } this returns: { ...

php - add form in javascript -

hello i've got form that <form action="xx.php"> <div id="myform"> </div> <button>add form</button> <div id="clone"> </div> </form> and when user click on "add form", "myform" cloned "clone". know why form submitted, can reach input form "myform" , not input of cloned form (into xx.php). because cloned form created javascrpt ? if "cloning" form, cloning 'name' attributes guess, after submitting won't work discussed in question: posting form fields same name attribute

php - How do I refresh an HTML file when the contents of a different file change? -

i have situation device accessing simple mysql database using php. when search, results written in html file. i have second device (very basic android tablet) has html file opened. using live.js refreshes when it's contents change. need this: static message saying "waiting search results" , when contents of page change results shown... something this: on tablet load 1.html (waiting search results). when contents of page 2.html change (there search query), display (2.html). after push of button (user input), let's go 1.html , wait contents of page 2.html change again. with live.js alone can watch file that's open... any idea on how can achieve this? bunch. [edit - solved] got work this: when user of tablet pushes button runs php script replaces contents of file (the previous search results) "waiting results" text. of course, has live.js in head, , when new search occurs, page reloads new search results. it easier thought overthinking it. ...

java - How to get action url in jsp using Struts 2 -

i have url:  http://demo.lendingclub.com/account/summary.action . when visit url, first go authenticate interceptor , in interceptor class, if use: string uri = req.getrequesturi(); it return /account/summary.action but if use in jsp: <% httpservletrequest req = servletactioncontext.getrequest(); string uri = req.getrequesturi(); %> it return : /mainapp/pages/account/summary.jsp why they're different, , how can action url in jsp? the easiest way current actions url is: <s:url/> if supply namespace , action parameters can make point @ other actions without these parameters defaults current url.

ruby on rails - Devise validation constantly failing on sign up -

making simple ruby on rails app practise requires user sign up. everything works until implement regex validation on 'profile_name' field here's 'user' model: validates :profile_name, presence: true, uniqueness: true, format: { with: /^a-za-z0-9_-$/, message: 'must formatted correctly.' } and yet profile name 'jon' refuses pass. error coming from, other 'user' model? you need add brackets around ranges regex matches "any of range" rather "all of range in order". put + on end allow match in range more once. need change beginning , ending of lines beginning , ending of strings! validates :profile_name, presence: true, uniqueness: true, format: { with: /\a[a-za-z0-9_-]+\z/, ...

ios - decryption using sqlcipher in iphone -

okey, studying sqlcipher , preparing document on it. far study shows how encrypt database, not find how decrypt database. have few more questions. found can not perform coredata operation on encrypted database.so 1) can run sql query on encrypted database. 2) if have perform coredata operation, have decrypt database. 3) , last not least, how decryption using sqlcipher. please answer if these questions make sense. thanks yes, can perform sql query on encrypted database, pages within sqlcipher enabled sqlite database need decrypted prior retrieving unencrypted data. in order access sqlcipher encrypted database, need issue either pragma key command, or programmatically call sqlite3_key . additional documentation can found here , along mailing list here .

How do I use vim as 'git log' editor? -

when run git log , editor git log using? also: is there anyway can use vim default editor git log ? if want search against git log, what's best way? i'm doing like: git log | grep bla . the git log command pipes it's output default pager , not editor. pager less or more on systems. can change default pager vim command: git config --global core.pager 'vim -' now can search using vim functionality / usual.

spring - How can order an List<Map<String, Object>> with PagedListHolder? -

i have pagedlistholder: list<map<string, object>> list = n value; pagedlistholder pagedlistholder = new pagedlistholder(list); string sortcolumn = request.getparameter("sidx"); string sord=request.getparameter("sord"); boolean ascending=false; if(sord!=null&&sord.equals("asc")){ ascending=true; } pagedlistholder.setsort(new mutablesortdefinition(sortcolumn, ascending,true)); pagedlistholder.resort(); the sordcolumn , sord correct not work how can solve? thanks. try following list<linkedhashmap<string, object>> list = new arraylist<linkedhashmap<string,object>>();

php - Permission error - cannot delete uploaded files from FTP -

i have found several posts asking similar questions situation different. in upload class i'm creating directory user's id mkdir , calling move_uploaded_file move tmp file /uploads/id/file after performing several other checks. problem can't seem delete file once it's been uploaded php directory created mkdir . can delete files uploaded root of /uploads directories created in /uploads . testing purposes, i've used permission 0777 mkdir , i'm calling chmod on file 0777 after calling move_uploaded_file . i thought because php uses linux user starts apache httpd upload files, , signing ftp different user, still able delete files uploaded root of /uploads regardless of user. i've made sure /uploads owned same user starts apache i'm still not having luck. @ appreciated.

c# - Excel file path doesn't work -

i have (and works): if (sport == "athletics") { excel_init("c:/users/dries canfyn/desktop/score/scoretablemenathletics.xlsx"); } but want include excel file in project. the excel file in folder called io, in same folder class 'if' in. how can reach excel file? path should use? determine workingdirectory , use relative path there. workingdirectory .exe resides, depends on how started process. can use relative path like if (sport == "athletics") { excel_init("io/scoretablemenathletics.xlsx"); } i don't know happens inside excel_init , consider msdn , processstartinfo.workingdirectory property : when useshellexecute property false, gets or sets working directory process started. when useshellexecute true, gets or sets directory contains process started.

iOS Timelime View -

i want implement timeline view. in need have months (with dates) on top , many rows below bar of time period. (very similar this image ) please tell me, should start, subclassing uiscrollview or using drawrect . , whether possible use uitableviewcell each row? please show me right direction. thank you! you may try one, :- https://www.cocoacontrols.com/controls/multicolumntableviewforios

osx - How to add Scheduling in a Sandboxed app? -

i need add scheduling app. app launch automatically @ specified time , date. have done referring scheduling timed jobs . have placed plist file scheduling in /users/username/library/launchagents . works in non-sandboxed app, not working in sandboxed app. can't able add scheduling file path /users/username/library/launchagents . gives me error error domain=nscocoaerrordomain code=513 "“com.sample.schedule.plist” couldn’t copied because don’t have permission access “launchagents”." userinfo=0x100114f10 {nssourcefilepatherrorkey=/users/username/library/developer/xcode/deriveddata/schedulinginsandbox-cernhnigkuqhehbndryxlekpiiiu/build/products/debug/schedulinginsandbox.app/contents/resources/com.sample.schedule.plist, nsuserstringvariant=( copy ), nsdestinationfilepath=/users/username/library/launchagents/com.sample.schedule.plist, nsfilepath=/users/username/library/developer/xcode/deriveddata/schedulinginsandbox-cernhnigkuqhehbndryxlekpiiiu/build/products/debug/sch...

java - Specifying method in getter/setter -

to understand meaning of encapsulation, example class private fields must accessed through class public methods per definition, stll doesn't make difference field still accessible is. so,i think there should processing inside getters/setters hide how field being handled. breaks principal of behind pojos. how can 1 handle situation? i'm not sure according "the principle of pojos". following pojo , still hides implementation details behind getters , setters: public class example { private int thousands; private int units; public void setvalue(int value) { thousands = value / 1000; units = value % 1000; } public int getvalue() { return 1000 * thousands + units; } }

c# - Force a hyperlink to open in a new window using context.Response -

i have web page having links pdf files, e.g. http://www.someurl.com/somefolder/filename.pdf . when user clicks on these links, authentication kicks in, user logs in , file can downloaded. i'm trying achieve downloads open in new window. i have limited access/control code , can't put target=_blank attribute href or add javascript. code downloads after authentication below: string filename = path.getfilename(context.request.physicalpath); filestream myfilestream; long filesize; string strmappath = context.server.mappath(filename); myfilestream = new filestream(strmappath, filemode.open); filesize = myfilestream.length; //allocate size our buffer array byte[] buffer = new byte[(int)filesize]; myfilestream.read(buffer, 0, (int)filesize); myfilestream.close(); //do buffer cleanup context.response.buffer = true; context.response.clear(); //add appropriate headers context.response.addheader("content-disposition", "attachement filename=" + filename);...

libgdx - Importing projects into eclipse only imports Android projects -

when try import eclipse,and select root directory -> select folder have my-gdx-game-android,html,desktop.. imports android , shows message: could not set project description 'my-gdx-game-android' because project description file (.project) out of sync file system. make sure when import projects select existing projects workspace , not existing android code workspace . if select second one, eclipse import android specific projects. base project in libgdx pure java project doesn't rely on android won't imported using function. true html , desktop projects since they're not android projects.

jsf - p:fileUpload not working inside p:dialog -

this question has answer here: how use primefaces p:fileupload? listener method never invoked or uploadedfile null / throws error / not usable 7 answers i'm getting wrong or what, same code p:fileupload works fine, when put p:fileupload p:dialog, not working. <p:dialog id="confirmdialog" appendtobody="true" header="maj fichier fmd" widgetvar="confirmation"> <h:form enctype="multipart/form-data" > <h:panelgrid columns="1" cellpadding="5"> <p:fileupload auto="true" fileuploadlistener="#{parserxls.handlefileuploadfmd()}" sizelimit="2097152" label="choose" ...

sql - NHibernate calling procedure using named query in c# -

i facing problem while calling procedure using named query in nhibernate. can call simple procedure / parametrized procedure have procedure accept 3 argument, 1 varchar(max) type have guid seperated commas(this passed in parameter sql query), other varchar(50) , last 1 bit type. i have following procedure create procedure [dbo].[ar_tarcustomer_readaccount_forbalancedetail] @customerlist varchar(max), @asofdate varchar(50), @postedonly bit set nocount on; declare @errornumber int declare @sql varchar(max) declare @postedinvoice varchar(50) declare @postedpayment varchar(200) set @postedinvoice = '' set @postedpayment= '' if (@postedonly = 1) begin set @postedinvoice = ' , ari.fisposted = 1 ' set @postedpayment = ' , pay.fisposted = case pay.fpaymenttype when ''cm'' 0 when ''epd'' 0 else 1 end' e...

SQL Joining and Replacing spaces with NA -

i trying join 2 sql queries for example table1 have empname ,empcode table2 have empname,empcode,empsalary i trying name , salaries details wherever there no salary have reflect "na" my query is: select a.empname,if((empsalary=" "),"na",b.salary) salary (select empname,empcode table 1) inner join (select empcode,empsalary table 2) b on a.empcode=b.empcode is query correct. select a.empname, case when b.empsalary = '' or b.empsalary null 'na' else b.empsalary end salary table 1 inner join table 2 b on a.empcode = b.empcode

jquery - UI Scroll like iPhone HTML 5 -

i using jquery , html 5 ,and css 3 . the requirement need implement http://cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/ showing list iphone. how create scrollable content stylish scroll bar. there jquery plugin & ui code available? i need content fetched ajax when user scroll down , there no data. you're there! iscroll4 library achieves demo have come across , plays nicely jquery. isn't jquery in itself, it's small, efficient , imho good! http://cubiq.org/iscroll-4 pay careful attention notes on refresh() method (not 'pull refresh' different) - you'll need after requesting ajax content. missed if implemented correctly, works well.

asp.net - textarea save wont save with breakline -

i have textarea , want present it. want text saved same break lines or \n. but wouldnt. heres code : string content = request.form["content"]; content = system.web.httputility.htmlencode(content); updatecontent(content, id); public void updatecontent(string content, string id) { sql = "update tbl_zac_squares set lotstext =@lotstext id = " + id; connection = new sqlconnection(conn); connection.open(); cmd = new sqlcommand(sql, connection); cmd.parameters.addwithvalue("@lotstext", content); cmd.executenonquery(); connection.close(); } then present : <td align="right" style="padding: 12px; font-family: arial; font-size: 12pt; color: #000000"> <div > <%=dt_details.rows[0][9].tostring() %></div> </td> you encode content before saving in database have de...

php - How to get iframe content from a remote page? -

i think php useless, bacause iframe inserted after php executed, or wrong? so, solution aware of use javascript/jquery. e.g. work if js on same page iframe: <html> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script type="text/javascript"> $(function() { var mycontent = $("#iframe").contents().find("#mycontent") }); </script> </head> <body> <iframe src="mifile.html" id="iframe" style="width:200px;height:70px;border:dotted 1px red" frameborder="0"> <div id="mycontent"> iframe content blablabla </div> </iframe> </body> </html> however using simple html dom library grab distant webpage like: $url = 'http://page-with-some-iframe.com/'; $html = file...

Inheritance C++ (Diamond dread) -

Image
i have following problem inheritance (i love google it, don't know correct keywords seems). i have module class implements imodule interface function a() . have clientmodule class inherits module class , implements iclientmodule interface function b() inherits imodule interface. starting ambiguity , double inheritance problems . here class diagram should tell bit more problem: i need have separated access module class imodule interface , clientmodule iclientmodule interface offers access imodule interface well. make iclientmodule not inherit imodule (and rename iclient). in clientmodule, inherit module , implement iclient. or, alternative solution written after reading comments: make clientmodule class inherit iclientmodule in example. however, instead of inheriting module, give clientmodule member variable module, , forward calls member needed. this: class imodule { virtual void a() {} }; class module : public imodule { ... }; class iclientmo...

Unwrapping the Haskell State Monad -

in process of writing assignment university having ever-joyous fun of learning new haskell monads. yay!!! i have function typechecks fine: compile :: prog -> state varsstate string compile prog@(prog functions) = s1 <- sequence (map (translate_func 0) [get_function prog name | name <- [func_name func | func <- functions]]) return $ trace ("here's program: \n" ++ show prog) $ concat $ s1 but when other function: maybe_compile_prog :: maybeok prog -> string -> io () maybe_compile_prog (error msg) _ = putstrln ("error: " ++ msg) maybe_compile_prog (ok prog) modulename = s1 <- compile prog writefile (modulename ++ ".m") ((header modulename) ++ s1) tries call it, blows @ line s1 <- compile prog saying couldn't match expected type "io t0" actual type "state varsstate string". i assume because maybe_compile_prog returns type io () expects unwrap io information? varssta...

javascript - Opening element on top of others -

i have grid of images , text. default, image showing. when user clicks image, should expand on others , show text. it's partly working. http://jsfiddle.net/kbhfh/1/ <div id="container"> <div class="logo"> <img src="http://www.bnl.gov/today/intra_pics/2012/01/intel-logo-110px.jpg" alt=""> <p class="logotext"> ... </p> </div> .... if click leftmost icon in top row, want. there problems though. when click of icons, other elements slide 1 place closer top leftmost corner because clicked element moves out of it's place due absolute positioning. sliding effect doesn't show in example in jsfiddle because used same images elements. if click other icon, expand correctly, except goes leftmost corner in top row. should expand way left (like now) should go higher. if clicked item isn't first 1 in row, should still expand same amount le...

android - How to set height and width for Relative Layout through code -

i want add 1 imageview, textview in relative layout background image through programmatically.i spedified height , width relative layout not fitting specified width , height. going wrong ploesae in advance here code: relativelayout.layoutparams lp_topheader = new relativelayout.layoutparams(800,45); relative_topheader = new relativelayout(this); relative_topheader.setlayoutparams(lp_topheader); relative_topheader.setid(1); resources resources_topheader = getresources(); drawable drawable_topheader = resources_topheader.getdrawable(r.drawable.headerbar_m); relative_topheader.setbackgrounddrawable(drawable_topheader); setcontentview(relative_topheader); relativelayout.layoutparams lp_banner = new relativelayout.layoutparams(385, 206); relative_banner = new relativelayout(this); relative_banner.setid(2); relative_banner.setlayoutparams(lp_banner); lp_banner.setmargins(40, 40, 0, 0); lp_banner.addrule(relativelayout.below,1); image...

android position view inside layout -

my activity has background image 1280x800 pixels. set using android:scaletype="centercrop" . there's flagstaff depicted on background image , need position image ("flag") above flagstaff. if device's screen dimension 1280x800, "flag"'s position (850, 520). screen size can vary , android scales , shifts background image accordingly centercrop flag. hence need assign somehow scale , shift "flag" image make placed nicely above flagstaff. i have examined imageview.java , found scaletype used set private matrix mdrawmatrix . have no read access field it's private. so, given @override public void ongloballayout() { imageview bg = ...; imageview flag = ...; int bgimagewidth = 1280; int bgimageheight = 800; int flagposx = 850; int flagposy = 520; // should here place flag nicely? } you can see size of screen ( context.getresources().getdisplaymetrics().widthpixels , context.getresources(...

redirect - C# linkbutton not firing in Gridview within Updatepanel -

i'm hoping can me. have searched web suitable answer haven't found one. i have following linkbutton in gridview ( gridview2 ) within updatepanel set updatemode='conditional' : <itemtemplate> <asp:linkbutton id="lblsccomments" runat="server" width="80" text='<%#eval("shortcode")%>' commandname="hypersc" oncommand="gridview2_command" commandargument='<%#eval("shortcode")%>'/> </itemtemplate> with code behind: protected void gridview2_command(object sender, commandeventargs e) { if (e.commandname == "hypersc") { string sc = e.commandargument.tostring(); lblshortcode.text = sc; session["scode"] = sc; server.transfer("~/memberpages/reviews.aspx"); } } unfortunately, when click on link command not firing. working outside of updat...

Facebook API unknown exception with api call after login -

Image
after successful facebook login exception: fatal error: uncaught graphmethodexception: api calls server require appsecret_proof argument thrown in .../.../lib/base_facebook.php on line 1238 the code is: $user = $facebook -> getuser(); if(!$user) { //redirect etc. stuff here } else { $me = $facebook -> api("/me"); //we exception here } anyone seen similar error? cant find info on error anywhere. thanks as posted here , appsecret_proof thing added latest version of php sdk quite recently. guess app setting appsecret_proof enabled, not using latest version of php sdk appcesret_proof not generated. might want check setting @ app dashboard > setting > advanced > security. edit: 2013-08-09 have [official document][3].

python - Setup dictionary lazily -

let's have dictionary in python, defined @ module level ( mysettings.py ): settings = { 'expensive1' : expensive_to_compute(1), 'expensive2' : expensive_to_compute(2), ... } i values computed when keys accessed: from mysettings import settings # settings "prepared" print settings['expensive1'] # value computed. is possible? how? if don't separe arguments callable, don't think it's possible. however, should work: class mysettingsdict(dict): def __getitem__(self, item): function, arg = dict.__getitem__(self, item) return function(arg) def expensive_to_compute(arg): return arg * 3 and now: >>> settings = mysettingsdict({ 'expensive1': (expensive_to_compute, 1), 'expensive2': (expensive_to_compute, 2), }) >>> settings['expensive1'] 3 >>> settings['expensive2'] 6 edit: you may want cache results of expensive_to_co...

asp.net - implement form authentication on some pages not all pages -

i want implement form authentication on pages not pages. in application many other pages there want make public contact us, , all. for pages want implement form authentication. please me on this. <authorization> <deny users ="?" /> <allow users = "*" /> </authorization> if had directory called "administration" contained administration pages, add following web.config: <location path="administration"> <system.web> <authorization> <allow roles="admin" /> <deny users="*" /> </authorization> </system.web> </location> then users in role "admin" can access pages in "administration" directory. path can substituted specific page rather directory if required.

Django JOIN query without foreign key -

is there way in django write query using orm, not raw sql allows join on table without there being foreign key? looking through documentation appears in order 1 one relationship work there must foreign key present? in models below want run query join on useractivity.request_url useractivitylink.url. class useractivity(models.model): id = models.integerfield(primary_key=true) last_activity_ip = models.charfield(max_length=45l, blank=true) last_activity_browser = models.charfield(max_length=255l, blank=true) last_activity_date = models.datetimefield(auto_now_add=true) request_url = models.charfield(max_length=255l, blank=true) session_id = models.charfield(max_length=255l) users_id = models.integerfield() class meta: db_table = 'user_activity' class useractivitylink(models.model): id = models.integerfield(primary_key=true) url = models.charfield(max_length=255l, blank=true) url_description = models.charfield(max_length=...