Posts

Showing posts from April, 2011

unicode - How does the browser encode non-ASCII characters when posting them to the server? -

is there standard browser http-posting follows? if not can server detect encoding in way? is there standard browser http-posting follows? there html5 has codified it, it's not straightforward. the encoding used browser encode text when submitted form same encoding used view page containing form. if have included content-type: ...;charset=... http header or <meta> tag encoding used unless user deliberately changes encoding of page browser settings. users won't change setting unless page has been served wrong charset , unreadable. (even then, setting getting more obscure in modern browsers.) if don't set encoding of page containing form anything; it'll non-utf encoding associated user's region, bets off. if include attribute accept-charset="..." in <form> element supposed form submitted in encoding, regardless of encoding of form page (whether set page or chosen user). unfortunately, accept-charset broken in ie:

vb.net - Loading text from a file into a textbox -

i'm trying place text text file in textbox, textbox remains blank after code executes. how can fix this? dim fileno1 integer = freefile() fileopen(fileno1, "c:\users\main computer\desktop\vb test\gyn-obs-d.txt", openmode.input, openaccess.read, openshare.shared) dim y boolean = 0 dim c = 0 textbox1.text = "1" while not eof(fileno1) c += 1 dim txt string = lineinput(fileno1) debug.writeline(txt) dim inputstring string = txt textbox1.text = txt if c = 40 y = 1 exit end if write1(inputstring, y) loop fileclose(fileno1) edit: added class still wrong ' of course these next 2 @ top imports system imports system.io class test public shared sub main() try ' create instance of streamreader read file. ' using statement closes streamreader. using sr new streamreader("testfile.txt") dim line string ' read , di

java - MessagePack and Immutable Objects -

i have many immutable domain objects private final fields , public getter methods. possible serialize them using messagepack implementation java ? i know @message annotation supports public fields, hoping use @messagepackbeans , @ordinalenum annotations. when try , serialize 1 of objects, don't exception on .write call, serialization fails. i've included complete example below. is there doing wrong, or should give on trying use messagepack? import java.io.ioexception; import org.msgpack.messagepack; import org.msgpack.annotation.messagepackbeans; import org.msgpack.annotation.ordinalenum; public class msgpacktest { @ordinalenum public static enum myenum { a; } @messagepackbeans public final static class myobject { private final string mystring; private final myenum myenum; public myobject(string mystring, myenum myenum) { this.mystring = mystring; this.myenum = myenum; } public string getmystring() { retur

filter - hbase search between composite keys - java -

in h base row key of form string+date e.g : abc+01/03/2012 searching based on 3 parameters (string,date,date) : 1.) first parameter string should match row key before + sign, have got filter rowfilter=new rowfilter(compareop.equal, new binaryprefixcomparator(bytes.tobytes(ticker))); because searching prefix, if search "ab", results "ab" , "abc", condition getting exact match? 2.) second parameter date should > row key date extracted row key abc+01/03/2012. 3.) third parameter date should < row key date extracted row key abc+01/03/2012. basically dates should fall between provided dates only. what possible solution this? thnx try use scan setting start row , stop row, so, set start row= string+timestamp_1, stop row = string+timestamp_2. if need find row 'string*'+ts, need write own datepostfixcomparator(startts, endts). the second case slower first.

php - SimpleXML access separated text nodes -

i have xml file following: ... <myelement>introduction:<br /> ... </myelement> ... are there way return "introduction:" , rest after </br> of element? i using php , simplexml. naively use echo $document->myelement shows "introduction:...", mixed introduction line , content. simplexml not have concept of text-nodes might know domdocument (see this comparison table ). so in php option import <myelement> element dom , operation there: # prints "introduction:" echo dom_import_simplexml($myelement)->firstchild->data; // ^ // `- domtext

ios - Infinite Loop Event Handler Pairs -

i have 2 views have event handler in delegates called time interaction occurs. in each event hander i'd performs interaction on other view. issue here run infinite loop of , forth calls on event handlers i.e. when 1 interaction on other, triggers event handler, , on. there way around this? here delegate method. view1 , view2 2 views. position custom class used update positions of each view. -(void) viewdelegate: (uiview*) dview didchangeposition: (position*) newposition { if( dview == view1 ){ [view2 movetoposition: newposition]; }else{ [view1 movetoposition: newposition]; } } at beginning of viewdelegate:didchangeposition: save delegate of view1 and/or view2 local variables, , nil out actual delegate properties. can freely call movetoposition: or other code generate delegate callback. @ end of method restore delegates saved values.

python - Django From Choices Tuple Concatnation -

i'm trying in form: sites = list( site.objects.all().order_by('site_code') ) sites = ((s.site_code, s.site_code) s in sites ) site_choices = ('all', 'all') + (sites,) i know can't concatenate 2 tuples, , makes new reference of tuple, error getting object.__new__(generator) not safe, use generator.__new__() i've tried different things trying add tuple directly in comprehension, etc no luck. have better solution this? thanks have tried using lists instead of tuples? sites = [(s.site_code, s.site_code) s in site.objects.all().order_by('site_code')] site_choices = [('all', 'all')] + sites hope helps.

vba - Macro runs perfectly in excel but error message when called in powershell -

i have written macro calls 3 other macros inside of in order use public variable in 3 macros . macro runs excel when try , call macro in power shell receive error message. here macro works in excel: public fnum integer sub master_macro() combine_workbooks automate_search delete_duplicate end sub here powershell code: #powershellscript test automation of 80% test # start excel $excel = new-object -comobject excel.application #open file $filepath = 'c:\file build project\!notes filebuild project\pf pm data collection workbook-template our macro' $workbook = $excel.workbooks.open($filepath) #no point see excel since else shutdown in vba $excel.visible = $false $excel.displayalerts = $false #run macro save workbook close excel $excel.run("master_macro") $workbook.save() $excel.quit() finally here error message receive when powershell run: exception calling "run" "31" argument(s): "cannot run macro 'delete_duplic

Opening up file for inclusion in PHP -

this piece of code: $filepath = __dir__.'/code_twitter_common_config.php'; echo $filepath; produces following: /users/mine/google drive/php/parnassus/public_html/apps/code/twitter/code_twitter_common_config.php this piece of code: if (file_exists($filepath)) { echo 'file exists'; } else { echo 'file not exist'; } produces: file exists this piece of code: $string = file_get_contents($filepath); echo $string; produces nothing (no error codes... nothing). i tried doing: $string = file_get_contents("\"".$filepath."\""); echo $string; which produced: warning: file_get_contents("/users/mine/google drive/php/parnassus/public_html/apps/code/twitter/code_twitter_common_config.php"): failed open stream: no such file or directory in /users/mine/google drive/php/parnassus/public_html/apps/code/twitter/itb_statuses.php on line 19 i checked file permissions, , entire google drive folder set 0777

android - With jfeinstein10's slidingmenu,how to create slide up menu -

Image
i use sliding menu library create slide menu shows in bottom of screen pull bottom title bar up. this.. i new android. idea how reuse library this? class/function should modified? any appreciated. i believe modifying jfeinstein10's lib might take time. consider following documented lib fits needs: android sliding panel

facebook - Dividing Wordpress comments into 2 columns -

i using wordpress comment system , divide comments 2 columns. recent comments need @ top too, similar how facebook pages work. the content on pages of site comments - exception of 'about us' page entire content area comments. for information using photoria theme 2 column theme second column taken sidebar - don't know whether effects or not! hope asking clear! i'm relatively new website design speak me such :) thanks in advance, paul multiple column layouts can tricky while keeping content order accurate — i.e., keeping recent comments @ top of each columns. edit assuming markup has same classes theme demo, try adding css: #commentspost { overflow: hidden; /* clears floats */ } .comment.odd { float: left; width: 45%; } .comment.even { float: right; width: 45%; } this leave gaps due comments being longer others. if that's issue fot use jquery masonry plugin take care of additional white space appears between floate

html - Problems with base_64 to jpeg decode in php -

i have base_64 (in session) string. can print jpeg image when i'm doing in html <img src="data:image/jpeg;base64,/9j/4aaqskzjrgabaqeayadiaad/2wbdaaggbgcgbqghbwcjcqgkdbqndasldbksew8uhrofhh0a hbwgjc4nicisixwckdcpldaxndq0hyc5ptgypc4zndl/2wbdaqkjcqwldbgndrgyirwhmjiymjiy mjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjiymjl/waarcafgaqadasia ahebaxeb/8qahwaaaqubaqebaqeaaaaaaaaaaaecawqfbgcicqol/8qatraaagedawieawufbaqa aaf9aqidaaqrbrihmuege1fhbyjxfdkbkaeii0kxwrvs0fakm2jyggkkfhcygroljicokso0nty3 odk6q0rfrkdisuptvfvwv1hzwmnkzwznaglqc3r1dnd4exqdhiwgh4ijipktljwwl5izmqkjpkwm p6ipqrkztlw2t7i5usldxmxgx8jjytlt1nxw19jz2uhi4+tl5ufo6erx8vp09fb3+pn6/8qahwea awebaqebaqebaqaaaaaaaaecawqfbgcicqol/8qatreaagecbaqdbacfbaqaaqj3aaecaxeebsex bhjbuqdhcrmimoeifekrobhbcsmzuvavynlrchyknoel8rcygromjygpkju2nzg5okneruzhselk u1rvvldywvpjzgvmz2hpann0dxz3ehl6gooehyahiimkkpoulzaxmjmaoqokpaanqkmqsro0tba3 ulm6wspexcbhymnk0tpu1dbx2nna4upk5ebn6onq8vp09fb3+pn6/9oadambaairaxeapwd2pw8/ mxost/0/eflggrcra8lc/w

googleglass/mirror-quickstart-dotnet project gives SQL server error -

i using googleglass/mirror-quickstart-dotnet project. able run application on local iis when deploy ec2 cloud instance, keeps throwing following error : server error in '/glassapp' application. a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server

How to make self-registering COM server (exe) with C++ -

i'm complete beginner in com , in process of grasping ins , outs of it. right there problem i'm trying solve (it's part of test assignment). what need make self-registering exe com server in native c++, i.e. executable register com-object on execution. of examples find tell of implementing server in dll , using regsvr32 on it, need self-registering exe. can explain how do that? upd: okay, little more: doesn't work. here's snippet: int _tmain(int argc, _tchar* argv[]) { iclassfactory *factory = new isimpleserverfactory(); dword classtoken; ::coinitialize(null); coregisterclassobject( iid_isimpleserver, factory, clsctx_local_server, regcls_multipleuse, &classtoken); isimpleserver *pisimpleserver = null; hresult hr = cocreateinstance( clsid_csimpleserver, null, clsctx_local_server, iid_isimpleserver, (void **)&pisimpleserver); //

Current Android Mobile Sound Profile -

how know current android mobile sound profile? mean whether device in either silent/meeting or etc... can send device current profile status others? audiomanager = (audiomanager)getsystemservice(context.audio_service); switch (am.getringermode()) { case audiomanager.ringer_mode_silent: log.i("myapp","silent mode"); break; case audiomanager.ringer_mode_vibrate: log.i("myapp","vibrate mode"); break; case audiomanager.ringer_mode_normal: log.i("myapp","normal mode"); break; } private static boolean isairplanemodeon(context context) { return settings.system.getint(context.getcontentresolver(), settings.system.airplane_mode_on, 0) != 0; }

winapi - Delphi form staying on top of itself -

i've got app has window stays in front of other windows, stays in front of other 'stay on top' windows checking z order , moving forwards if isn't top most. works ok, except window has controls pop things combo boxes , hints. happens window moves in front of hints etc. the logic i've attempted looks @ handle of window in front , attempts see if owner (using getwindow (h,gw_owner)) or parent (getparent(h)) window. failing continues call recursively see if window parent of parent etc. this doesn't work , application tries put in front of popped-up control not ideal. suggestions on other approaches? thanks terry the hints have application handle parent , owner. testing h=application.handle solves problem them. combo boxes seem different story , calls parent return 65556 , owner gives 0.

java - Iterable interface implementation -

can tell me if implementation stack right? class leveliter<node> implements iterable<node> { stack<node> s = null; public leveliter(stack<node> s) { this.s = s; } public iterator<node> iterator(){ iterator<node> = new iterator<node>() { private int index = 0; @override public boolean hasnext(){ return (index < s.size() && !s.isempty()); } @override public integer next(){ return (integer) (s.pop()).data; } @override public void remove(){ s.remove(); } }; return it; } } where node node in binary tree - class node{ int data; node left; node right; public node(int data){ this.data = dat

spring mvc - Including a folder of css/js files in jsp -

i have set of common css/js files application in 2 folders commoncss , commonjs in folder(u_i) inside webroot. including them below <script type="text/javascript" src="${commonresourcepath}/commonjs/dsf.js"></script> <script type="text/javascript" src="${commonresourcepath}/commonjs/sdc.js"></script> . . <script type="text/javascript" src="${commonresourcepath}/commonjs/eee.js"></script> but include files in folder automatically giving folder path like <myinclude:allfiles foldername="${commonresourcepath}/commonjs"/> is there way it? in advance... i tried find this, haven't found. so, think nobody did yet. if need it, can create own jsp tag you. some tutorials on google: https://www.google.com.br/search?q=creating+custom+jsp+tag

php - What is the simplest method of programmatically adding data to JSON? -

for php/html page simplest method of adding data json? should using php, js, or jquery? i've tried different lots of different methods found online, can't work. i've tried of these can't quite right. var myobject = new object(); json.stringify() json.parse() $.extend(); .push() .concat() i have json file loaded {"commentobjects": [ {"thecomment": "abc"}, {"thecomment": "def"}, {"thecomment": "ghi"} ] } i want programmatically add var thisnewcomment = 'jkl; {"thecomment": thisnewcomment} so json variable be {"commentobjects": [ {"thecomment": "abc"}, {"thecomment": "def"}, {"thecomment": "ghi"}, {"thecomment": "jkl"}

java - How do I parse a JSON to JTree and vice versa -

i'm using java, , want parse complex json string (one contains objects, arrays values, , arrays of objects jtree) , vice versa. able create method parses json string (using jackson objectmapper , jsonnode ) jtree, want tree editable. , once changed, want able parse json string or java class represented json string. there proper way this? i can advice use gson ( https://sites.google.com/site/gson/gson-user-guide ) convert data complex jtree structure , vice versa. can grab java class represented json string tree , convert json gson . as example: complextreeobject obj = new complextreeobject(); gson gson = new gson(); string json = gson.tojson(obj);

mysql - Combining two tables in a database -

i have made 2 tables. first table holds metadata of file. create table filemetadata ( id varchar(20) primary key , filename varchar(50), path varchar(200), size varchar(10), author varchar(50) ) ; +-------+-------------+---------+------+---------+ | id | filename | path | size | author | +-------+-------------+---------+------+---------+ | 1 | abc.txt | c:\files| 2kb | eric | +-------+-------------+---------+------+---------+ | 2 | xyz.docx | c:\files| 5kb | john | +-------+-------------+---------+------+---------+ | 3 | pqr.txt |c:\files | 10kb | mike | +-------+-------------+---------+------+---------+ the second table contains "favourite" info particular file in above table. create table filefav ( fid varchar(20) primary key , id varchar(20), favouritedby varchar(300), favouritedtime varchar(10), foreign key (id) references filemetadata(id) ) ; +--------+------+-----------------+----------------+ | fid | id

xml - How to count unique attributes with XPath? -

i need number of each unique attribute in xml document: <locvalres flag="final" id="dummy"> <station name="sampieri" distance="2901857" duration="3482348" externalid="008302686#80" externalstationnr="008302686" type="wgs84" x="14744601" y="36731901"/> <station name="pozzallo" distance="2903750" duration="3484620" externalid="008302642#80" externalstationnr="008302642" type="wgs84" x="14847168" y="36733609"/> <station name="scicli" distance="2907477" duration="3489092" externalid="008302695#80" externalstationnr="008302695" type="wgs84" x="14699187" y="36790088"/> <station name="ispica" distance="2909739" duration="3491806" externalid="008302562#80&

c++ - Opening a text in notepad in MFC -

just title stated. how open text in notepad in mfc? i used cfiledialog open "save as" dialog box : tchar szfilters[] = _t ("text files (*.txt)¦*.txt¦all files (*.*)¦*.*¦¦"); cfiledialog dlg (false, _t ("txt"), _t ("*.txt"), ofn_overwriteprompt, szfilters); if (dlg.domodal () == idok) m_strpathname = dlg.getpathname(); after have path name in m_strpathname , there anyway directly open txt file had been saved in notepad? i have button onshowdata , code inside. shellexecute(null, _t("open"), m_strpathname, null, null, sw_show); is there other method this?? problem solved the following api can used same winexec("c:\myfolder", ...)

php - Using the LinkedIn API with one oauth connection -

i want have linkedin app connect api, , let users of website data linkedin api through app. don't want require users connect linkedin, because none of data need on profiles. need can through personal oauth connection. example, company lookup. in short, there way pass through linkedin authentication users of website, such 1 access token fielding requests? technically, yes can done, you'll breaking linkedin tos, , you'll getting in trouble linkedin. check linkedin tos, or take @ linkedin api guide have written summarizes can or cannot done, without breaking terms of service.

python - wxpython , passing boolean flag for background checking -

how can value button click frame? btnyes = wx.button(panel, -1, "ok") self.bind(wx.evt_button, self.clickyes, btnyes) def clickyes(self, evt): print "clicked yes" self.close() whenever user click yes , want value check in other module. confirmation flag. when user confirmed 1 item carrying on doing other items. confirmation flag using here below : def my_methodabc(): matchlist = [] x, y in product(d1rows, d2rows): if userconfirmedfromwxpythonclickyesbutton(): matchlist.append(abc) return matchlist use messagedialog. there lots of examples on web. here couple: http://wiki.wxpython.org/messageboxes http://www.blog.pythonlibrary.org/2010/06/26/the-dialogs-of-wxpython-part-1-of-2/ and here's simple example: import wx ######################################################################## class mainframe(wx.frame): """""" #---------------------

C# Performance Counter - How to watching W3WP / Active Request? -

i want watch w3wp / active request c#.net, w3wp / active request invisible in visual studio 2010 ultimate's performance counter object. how can watch active request @ real time c#? there different way? as said here , best way follow requests/sec @ worker process level follow counter called requests /sec in category w3svc_w3wp . specify instance name following pattern pid_apppool_name or _total if don't know pid/apppoolname.

c++ - How to distinguish between items returned by EnumObjects of IShellFolder -

i trying computers in workgroup using shell hresult hr = s_ok; ulong celtfetched; lpitemidlist pidlitems = null; lpitemidlist netitemidlst = null; ishellfolder* pfolder = null; ienumidlist* penumids = null; ishellfolder* pdesktopfolder = null; lpitemidlist full_pid; hr = shgetmalloc(&pmalloc); hr = shgetdesktopfolder(&pdesktopfolder); hr = shgetspecialfolderlocation(null, csidl_computersnearme, &netitemidlst); hr = pdesktopfolder->bindtoobject(netitemidlst, null, iid_ishellfolder, (void **)&pfolder); if(succeeded(hr)) { hr = pfolder->enumobjects(null, shcontf_nonfolders, &penumids); if(succeeded(hr)) { strret strdisplayname; while((hr = penumids->next(1, &pidlitems, &celtfetched)) == s_ok && celtfetched > 0) { hr = pfolder->getdisplaynameof(pidlitems, shgdn_normal, &strdisplayname); if(succeeded(hr)) { wprintf(l"%s\n", strdisplayname.p

android - TimePicker dialog with toast when the time setted is reach? -

i want create simple timepicker dialog in preferences screen? question is: possible? or timepicker must in mainactivity? can explain me how set alarm in timepicker dialog , show toast when time setted reach? have gone through android guide pickers ? believe pretty explains want do. you can visit tutorial well.

What would be an ideal caching system for a PHP Heroku App? -

i working improve server time php app on heroku. noticed when cache php file html file, service times go down 2500+ms around 20ms. now, here couple of problems @ hand... 1) cached html page need change after user actions. deluge of such actions drown server. actions can come in deluge, or there no action hours. 2) app typically run on multiple dyno's on heroku, each own ephemeral file system. each dyno can potentially have own version of cached file, , cached file disappear automatically after 24 hours, or every time push new code server. i new world of web programming, , thinking of solving above in following way. there better ways ? tools ? plugins ? frameworks ? please suggest. have work on heroku though. store cached file on s3. of site run s3. in case of user action, cache updated. instead of updating cache directly, schedule update happen after 30s. file name of cachedpage.html.scheduled placed on s3 time period. requests come during time period invalidated.

python - String to float and regex -

i have problem regex , string... i need solution in regex code take float number of string. don't know why code doesn't work. from bs4 import beautifulsoup import urllib2 re import sub url = 'http://www.ebay.es/itm/pet-shop-boys-official-promo-barcelona-electric-tour-beer-cerveza-20cl-bottle-/111116266655' #raw_input('dime la url que deseas: ') code = urllib2.urlopen(url).read(); soup = beautifulsoup(code) info = soup.find('span', id='v4-27').contents[0] print info info = sub("[\d]+,+[\d]", "", info) = float(info) print \d means non-digits . need use \d instead. here details: http://en.wikipedia.org/wiki/regular_expression#character_classes updated i see, approach replace non-digits chars. mind, match needed information more clear: >>> import re >>> s = "15,00 eur" >>> price_string = re.search('(\d+,\d+)', s).group(1) >>> price_string '15,0

Powershell Import-Module fails with DllNotFoundException -

trying use http://powershellgac.codeplex.com on computer powershell 2.0, using in powershell 3.0 on main pc shows on other pc: get-module -listavailable manifest applocker {} manifest psdaignostics {} manifest troubleshootinggpack {} manifest gac {} manifest gac {} manifest gac {} the brackets filled on main pc, why isn't working? have set exeuctionpolicy "unrestricted". still same error. have set $env:psmodulepath correctly on both pcs. (how else find gac manifest @ all) edit: forgot add important info: when start .ps1 script inside powershell ise works, on other pc. there's nothing wrong script itself, i'm clueless. -listavailable lists modules can find on machine, modules not loaded (using import-module). powershell 2.0 not show exported commands until module loaded, powershell 3.0 does. see here . if want see exported commands loaded module try get-module . the result

java - How do I fix these missing libraries? -

Image
so these 3 missing libraries, still didn't manage add imported project. tried lot of things , won't work. downloaded google play services sdk manager , google-play-services_lib isn't there, while google-play-services there, need both. captureactivity , portraitqr, tried adding both jars project dexedlibs didn't work. tried downloading this don't know how add project (i know how add single jars) edit: okay played around little bit , think i'm closer solution now. manually added google play services lib , capture activity , how libraries now: the remaining problem there red exclamation mark next project , when go build paths there red error: i tried captureactivity.jar can't find it. can anyoe me out here? you should import them new project->android project existing code-> locate projects path , make sure make them library project; right click on project-> properties-> android -> scroll bottom , check 'is library'

php - Can I instantiate an exception without throwing it? -

i using saas error , exception logging service called rollbar. in code, have rollbar static object can use report exceptions service. for example: try { ... throw new someexception(); ... } catch (someexception $e) { rollbar::report_exception($e); } my question is: can instantiate exception without throwing it, if other normal object, , there caveats? i things this: if($api_response_ok) { // stuff ... } else { rollbar::report_exception(new apiexception($api_error_msg)); } // script execution continues... yes, exception other object.

sql - Adding YEAR TO MONTH interval to TIMESTAMP value -

i have case have add year month interval timestamp value & achieve using way select (end_date + numtoyminterval(2, 'month')) dual above code works end_date values except values. for example, when end_date = 31-july-2013 , expected result above code 30-sept-2013 throws error ora-01839: date not valid month specified this because above code returns 31-sept-2013 invalid date. is there alternate way achieve this? (i can use add_months issue function returns date values & need timestamp return value) am missing anything? since end_date not have fractional seconds, or indeed time component, can use add_months , cast timestamp : select cast(add_months(end_date, 2) timestamp) ... but add_months has own quirks. if original date last day of month, you'll last day of adjusted month - want if you're going shorter month in case, maybe not if you're going other way: with t ( select to_timestamp('2013-07-31', 'yyyy-m

c# - Filtering ckeditor content when being retrieved from database -

first off realize there similar questions out there, newbie , none seem answer i'm trying achieve. building asp.net mvc 4 application, have content of ckeditor textbox (entered user) saving database. problem being when retrieve data has tags following attached.... <p>ck editor test 2</p> instead of ck editor test 2 is there clean way of returning data displayed without tags , still display bold text example. ps - not using web-forms (as many similar solutions involve) thanks in advance. with little help, @html.raw(httputility.htmldecode(item.body)) in place of @html.displayfor(modelitem => item.body) thats took.

Passing named arguments to a Javascript function -

this question has answer here: named parameters in javascript 8 answers calling javascript function like somefunction(1, true, 'foo'); is not clear without familiarity function. i have seen , used style comments inserted name arguments: somefunction(/*itemstoadd*/1, /*displaylabel*/ true, /*labeltext*/ 'foo'); but when gets beyond 3 or more parameters, seems better pass arguments in json object makes order-independent, , allows default values provided in called function somefunction({'itemstoadd':1, 'labeltext':'foo', 'displaylabel':true}); my question is; general practice in industry, , there overriding reasons not using of these methods. lint example not second method. personally i'd grep function name , take @ comment associated it. maintained code have comment above function explaining arg

CSS 3 Div Floats with Liquid center div -

it's quite simple question can't figure out what's wrong. i have 3 divs, 2 of set pixel sizes , other (the middle) fills remaining space between two. |------|--------------------------|------| | | | | | | | | | | | | |------|--------------------------|------| <--------------------------> width fill i have following css: left div #leftdiv { height: 50px width: 50px; float: left; } middle div #middlediv { min-width: 270px; width: calc(100% - 100px); width: -moz-calc(100% - 100px); width: -webkit-calc(100% - 100px); width: -o-calc(100% - 100px); float: left; } right div #rightdiv { width: 100px; height: 50px; float: right; } i've simplified here, right div doesn't float, goes underneath so: |------|--------------------------| | |

android - Posting image using tumblr -

{"meta":{"status":401,"msg":"not authorized"},"response":[]} tumblr gives above result while posting image. defaulthttpclient client = new defaulthttpclient(); httpresponse resp = null; string result = null; httppost hpost = new httppost("http://api.tumblr.com/v2/blog/" + username +".tumblr.com/post"); list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(2); namevaluepairs.add(new basicnamevaluepair("type", "photo")); namevaluepairs.add(new basicnamevaluepair("caption", "hello")); namevaluepairs.add(new basicnamevaluepair("source", "url_of_the_image")); string debug = ""; try { hpost.setentity(new urlencodedformentity( namevaluepairs)); consumer.sign(hpost); resp = client.

javascript - google URL shortener, wait for data to be fully received - NodeJS -

i trying use google's url shortener api. using code shorten using node js: function _shorten (url, callback) { if (!url) { console.error('please specify valid url.'); return; } if (typeof _url.parse(url).protocol === 'undefined') { url = 'http://' + url; } if (!callback) { callback = false; } var key = _getkey(), options = { host: 'www.googleapis.com', port: 443, path: '/urlshortener/v1/url' + (key ? '?' + _querystring.stringify({'key': key}) : ''), method: 'post', headers: { 'content-type': 'application/json' } }; var req = _https.request(options, function(res) { res.setencoding('utf8'); res.on('data', function (d) { d = json.parse(d); // <--- here problem if (callback) {

File writing with hidden window Qt c++ -

i have program writes things file qt. outputs supposed go in file on console. what wanted hide window process run in background. when call hide() method of mainwindow, console keeps displaying data supposed go in file, file remains empty. note i'm using fstream functions, not provided qt. where problem come ? i hide() window when button clicked : void mainwindow::on_pushbutton_clicked() { if (ui->editlogfilepath->text().length() > 0) { if (!(hhook = setwindowshookex(idhook, mkeyboardproc, getmodulehandle(null), threadid))) { qdebug() << "hook failed !"; return ; } else hide() } } } i fill file in mkeyboardproc function : static mainwindow *cur = null; // initialized cur = this; in constructor lresult callback mkeyboardproc(int ncode, wparam wparam, lparam lparam) { lresult nexthook = callnexthookex(cur->gethook(), ncode, wparam, lparam); if (wparam == wm

css - Make background image responsive -

i want make background image responsive both in width in height can run in mobile. i have used .your_background_class_name { width: 100%; height:auto; top: 0px; left: 0px; z-index: -1; position: absolute; } but works in width not in height. changes should make work? html { background: url(https://encrypted-tbn2.gstatic.com/images?q=tbn:and9gcsvctt0i--skokqvfuvt-i4et6vq5ve7lxpkly9stelcwlkh1ps) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } know more background-size here . see demo

d3.js - JSON data structure for D3jS report and D3jS code -

Image
i trying achieve below report json data var data = [{"monthyearshortname":"2014-09-13t00:00:00","product":"deposits","actual":330393232.5,"forecast":495589848.75,"target":495589848.75},{"monthyearshortname":"2014-09-13t00:00:00","product":"fee based","actual":111868709.42,"forecast":167803064.13,"target":167803064.13},{"monthyearshortname":"2014-09-13t00:00:00","product":"lending","actual":18146873.33,"forecast":27220309.995,"target":27220309.995}] i not sure if right data structure. if picking wrong structure create report, great. i using below code generating report. <div id="reportcontent" runat="server" style="border: 1px solid #58595d; border: 1px solid rgba(88, 89, 93, .3);"><svg></svg></div> function c

php - Should be a simple mod_rewrite rule -

this rule not seem functioning, cannot determine why, looks fine me: rewriterule ^shop_en/proddetail.php?prod=(.+)$ /shop/product/$1 [l,nc,ne,r=301] its not processed @ all, sites error message stating cannot find 'proddetail.php'. which weird too, because on quick test tried following: rewriterule ^shop_en/proddetail.php$ /shop/product [l,nc,r=301] which worked fine. going on? edit : product id's working can contain letters, numbers , dashes. in simplest terms, convenient definitions: i want route trying access: www.domain.com/shop_en/proddetail.php?prod=333 to following url: www.domain.com/shop/product/333 how can this? try this rewriterule ^/?shop/product/([a-za-z0-9\-]+)$ shop_en/proddetail.php?prod=$1 [l,nc,ne,r=301]

spring - Delete access_token after logout -

i have little question. at moment spring configuration uses defaulttokenservices (provided spring-security-oauth2-2.0.0.m3.jar). generates correctly access_token. now cancel/delete/remove/revoke token when logout. in security.xml configured logout in http tag: <sec:logout logout-url="/logout" logout-success-url="/auth" invalidate-session="true" delete-cookies="true" /> and redirection successfully. if write test doing login, logout , after try access restricted path access_token can successful request, expect not authorized error. why? how can configure logout access_token automatically deleted force new login? the lifetime of access_token independent of login session of user grants access client. oauth2 has no concept of user login or logout, or session, fact expect logout revoke token, seem indicate you're misunderstanding how oauth2 works. should clarify in question why want things work way , why need oauth.

plsql - maximum storage allocated for date in bytes in oracle -

i have searched found nothing relevant answer question. doubt know max size varchar2 data type 32767 bytes on similar lines how space allocated store value of date data type. treated varchar2 data type? such size depend on number of characters? or different. thanks from documentation : the database stores dates internally numbers. dates stored in fixed-length fields of 7 bytes each, corresponding century, year, month, day, hour, minute, , second. so date 7 bytes. timestamps longer (11 bytes) hold additional precision, , adding time zone increases further (to 13 bytes). can see if dump value: create table t42 (d date, t timestamp); insert t42 (d, t) values (sysdate, systimestamp); column dumpd format a40 column dumpt format a60 select dump(d) dumpd, dump(t) dumpt t42; dumpd dumpt ---------------------------------------- ---------------------------------------------------

opencv - Fastest moving object recognition and tracking in Android -

i working on augment reality game, need recognize , track fast moving object. have tried following image processing libraries, 1. opencv 2. boofcv 3. fastcv i have tried tld algorithm track object, tracking successful performance needed improved. if object moving faster result takes time, because of processing time taken algorithms. have tried circulant,mean-shift algorithms boofcv. check these demos : opentld using fastcv boofcv demonstration object tracking in these 2 demos seems calculation takes time. can go following scenario faster, extract r,g,b matrix of object tracked take camera frames , convert r,g,b matrix , search tracked object matrix in camera frame. is there better way ?? i suggest using gray scale instead of rgb, done in image processing way computation reduced 1 matrix instead of 3. if need check color, use rgb when needed not through out whole computation. tracking fast moving objects difficult. try using camera can take more

servlets - I want to draw lines as the jsp will get new lat and long every second -

i want draw lines jsp new lat , long every second. at http://www.codeproject.com/articles/209616/a-simple-gps-based-application-to-record-current-l - there image showing lines of markers in map. if new values of x , y same previous stop until gets different value. please me. unlike image there wouldn't markers. instead of markers lines made between every 2 points. thank you. to draw line can use http://jsdraw2d.jsfiction.com/ for checking value change can compare or use listener classes.

Android - Remove the straight line while displaying multiple routes on a map -

Image
in application, display of map , multiple routes between source , destination done using google mapv2 api. problem is, while displaying multiple routes on map, 1 straight comes along correct routes. want rid of straight line between source , destination. trying find way past 2 days. please guide me. displaymap.java polylineoptions rectline = null; if(result.equalsignorecase("exception caught")){ toast.maketext(getapplicationcontext(), "invalid values", toast.length_long).show(); } else{ if (weakref.get() != null && ! weakref.get().isfinishing()){ // if(response.equalsignorecase("success")){ arraylist<latlng> directionpoint = v2getroutedirection.getdirection(document); int duration = v2getroutedirection.getdurationvalue(document); log.e("traffic durationtime",""+duration); int trf