Posts

Showing posts from August, 2012

wordpress - Out of Memory Listing Custom Post type in Admin? -

this strange , serious problem. going " all images " in admin area (equivalent of posts) shows memory exhausted error, , white screen. , after upping memory high amount. i guess wondering why memory needed build list? i assume must error on part, coding. perhaps i've done wrong in declaring post type? common "gotchas" in area? i'd hate "increase memory" because seems weak work around serious problem. add_filter( 'manage_edit-image_columns', 'symbiostock_image_manager_edit_columns' ); function symbiostock_image_manager_edit_columns( $columns ) { $columns = array( 'cb' => '<input type="checkbox" />', 'image_preview' => 'preview', 'date' => 'uploaded', 'title' => 'image name', 'description' => 'description', 'exclusive' => 'exclusive',

ColdFusion 9 cffile error Access is Denied -

i getting following error: the cause of exception was: java.io.filenotfoundexception: //server/c$/folder1/folder2/folder3/folder4/folder5/login.cfm (access denied). when doing this: <cffile action="copy" destination="#copyto#\#apfold#\#applic#\#files#" source="#path#\#apfold#\#applic#\#files#"> if try write c:\folder1\folder2\folder3\folder4\folder5\login.cfm , works fine. problem doing way script developers able manually sync files application folder. have multiple servers each instance randomly picked bigip. writing c:\ drive copy file server developer accessing. if developer close out browser , go right in make sure changes worked, if happen sent different server, won't see change. since works writing c:\, know permissions correct. i've copied path out of error message , put in address bar on server , got folder/file fine. else stopping being able access server? it seems want access file via unc

Delphi stream read error when loading image -

my program loads lot of images, have problem 1 image used print-screen button copy it, game, bmp, rest. whenever run program, says project1.exe raised exception class ereaderror message 'stream read error' process stopped.... the code this: procedure tform1.formcreate(sender: tobject); var path, destination:string; begin path:=paramstr(0); destination:=extractfilepath(path)+'leagueoflegendsdesktop.bmp'; image1.picture.loadfromfile(destination); end; which correct. suggest me? the explanation file not valid windows bitmap (maybe file truncated). or perhaps file uses esoteric format not supported delphi. using run-length encoding, example. if file did not exist you'd different error, 1 indicated no such file exists. so, file exists cannot loaded. ergo, it's not windows bitmap. step 1 diagnose @ format of file. load bitmap file header , check values make sense. easiest way step through vcl code when running program under debugger. enable debu

azure - MemcacheShimEmulator error -

i have solution in development has been hosted on azure , runs fine want add memcache ensure scalability. add windows azure caching 1.8.1.0 , add windows azure caching memcache shim 1.8.0.0 via nuget. have endpoint of memcache_default internal port of 11212 (to avoid port conflict because 11211 in use) , have caching enabled in web role. when run application, web role cycles , number of errors in event log repeating on each cycle... first.... log name: application source: .net runtime date: 08/04/2013 21:11:56 event id: 1026 task category: none level: error keywords: classic user: n/a computer: drake description: application: memcacheshiminstaller.exe framework version: v4.0.30319 description: process terminated due unhandled exception. exception info: system.typeinitializationexception stack: @ microsoft.applicationserver.caching.memcacheshiminstaller.memcacheshiminstaller.main(system.string[]) second.... faulting a

html - How many times does a brower request for an image or any media from the server -

i think title covers pretty everything. how many times browser request file eg image whick used in several places on same page? have same image being used severally , know how how client minimize bandwidth usage if browser gonna request many times the browser download image once , cache it. if requests same image again display cached version.

jquery - PartialView rendering on new page -

in parent view called createadmin have html controls, button , div place holder partial view @using (html.beginform()) { <p style="padding-left: 920px;"> <button name="button" value="search" id="searchresultbtn"> search</button> </p> <div class="editor-field" id="searchresult"> //place holder partial view </div> } when clicked on button "search" partial view should rendered dynamically inside <div id="searchresult"><div> the jquery is $(document).ready(function () { $("#searchresultbtn").click(function () { $.get('/views/shared/_adminsearchresult.cshtml', function (data) { $('#searchresult').html(data); }); }); }); my controller method [httppost] public actionresult createadmin(string button, administration admin) { if

python - Creating one Django Form to save two models -

i have regular django user model , userdetails model ( onetoonefield user ), serves extension user model. (i tried django 1.5's feature , headache strangely horrible documentation, stuck onetoonefield option) so, in quest build custom registration page have registration form comprised of user fields , userdetails fields, wondered if there way generate form automatically (with of validations) out of these 2 related models. know works form made of 1 model: class meta: model = mymodel but there anyway similar functionality form comprised of 2 related models? from django.forms.models import model_to_dict, fields_for_model class userdetailsform(modelform): def __init__(self, instance=none, *args, **kwargs): _fields = ('first_name', 'last_name', 'email',) _initial = model_to_dict(instance.user, _fields) if instance not none else {} super(userdetailsform, self).__init__(initial=_initial, instance=instance,

java - confusion about mongodb capped collection -

i new mongodb. here code snippet: mongoclient mongo = new mongoclient("localhost", 27017); db db = mongo.getdb("testdb"); dbcollection collection = db.getcollection("user"); for db.getcollection("user") , if there existing collection named "user", return collection. if "user" not exit, getcollection("user") create new collection. want know type of collection getcollection create. getcollection return capped collection? i have read mongodb manual: you must create capped collections explicitly using createcollection() method. does mean collection created getcollection not capped collection? also want know: what max default size dbcollection on 32 bit system? what max number of collections within db? mongodb not create capped collection except through technique describe (it created through api or shell). max default size collection? around 2gb on 32 bit system. however, 10gen no

c# - When to specify constraint `T : IEquatable<T>` even though it is not strictly required? -

in short, looking guidance on of following 2 methods should preferred (and why): static ienumerable<t> distincta<t>(this ienumerable<t> xs) { return new hashset<t>(xs); } static ienumerable<t> distinctb<t>(this ienumerable<t> xs) t : iequatable<t> { return new hashset<t>(xs); } argument in favour of distincta : obviously, constraint on t not required, because hashset<t> not require it, , because instances of t guaranteed convertible system.object , provides same functionality iequatable<t> (namely 2 methods equals , gethashcode ). (while non-generic methods cause boxing value types, that's not i'm concerned here.) argument in favour of distinctb : generic parameter constraint, while not strictly necessary, makes visible callers method compare instances of t , , therefore signal equals , gethashcode should work correctly t . (after all, defining new type without explicitly implementing eq

httpresponse - Receive partial file(sometimes) when reading from Google Storage using HTTP Response -

i trying read files google storage , write files in our filesystem (hdfs). if run period of time (lets 7 days), full file lines matching whats on source , partial files (discrepancy quite large). pasting below method takes response , writes file. or suggestions how can troubleshoot further appreciated. thanks, before calling method simple check on response status code - if(response.getstatuscode() == 200 && stringutils.equals(response.getcontenttype(), "application/zip")) { writehdfsfile(response, path); } private void writehdfsfile(httpresponse response, string path) throws ioexception { final gzipinputstream inputstream = new gzipinputstream(response.getcontent()); path filepath = new path(path); final fsdataoutputstream outputstream = filesystem.create(filepath, true); final byte[] buffer = new byte[1024]; int length; try { while((length = inputstream.rea

Java annotation processing basics -

i have used simple annotations given in jdk , other libraries such hibernate, i've never written own. can me decide if annotation proper way this? i want annotate method this: @myannotation(5) public void foo() { methodthatmighttakelongerthan5(); } when foo takes longer 5 seconds, print message log file. possible annotations? preferred implementation? going bit further...i'd able modify value passed annotation via jmx bean can modify @ runtime if want to. possible/preferred? you put methodthatmighttakelongerthan5(); inside thread, run thread in foo() , wait 5 seconds thread.sleep(5000); , check if thread done. if not, print whatever need. assume there way check if thread running, i'm not sure.

windows - Difference between "%~dp0" and ".\"? -

let's i'm using batch file , want direct folder located in same directory of batch. if i'm not wrong write "%~dp0\whateverfoldername". can't same done writing ".\whateverfoldername"? if so, difference and/or advantage of respective command? pushd %~dp0 is used change original directory batch started. useful in newer os's when user may 'run administrator' changes current directory you! try sometime. make simple bat @echo off echo.cd=%cd% pushd %~dp0 echo.cd=%cd% pause now run it. run again 'as administrator' on vista, win 7, win 8, 2008 server, or 2012 server. see happens?

parsing - How to Parse a huge xml file (on the go) using Python -

i have huge xml file (the current wikipedia dump ). xml having size of 45 gb represents entire data of current wikipedia. first few lines of file (output of more): <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://ww w.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.mediawiki.org/x ml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:la ng="en"> <siteinfo> <sitename>wikipedia</sitename> <base>http://en.wikipedia.org/wiki/main_page</base> <generator>mediawiki 1.21wmf6</generator> <case>first-letter</case> <namespaces> <namespace key="-2" case="first-letter">media</namespace> <namespace key="-1" case="first-letter">special</namespace> <namespace

javascript - Unable to see complete scraped web page in Google Apps Script logs -

a few weeks ago started learning javascript , google apps script api, in regard spreadsheets. have been trying make spreadsheet fetches web pages , pulls stats friends game league of legends. however, have been running problem site want use, free lol stats site updates frequently. i'm not familiar @ web development, seems when try access page on lolking.net, example http://www.lolking.net/summoner/na/60783 google's urlfetchapp.fetch() not load dynamic page. instead of final source, this doesn't me . there easy way around or have use website? you getting fhe raw html page clientside js included. wont work system not gas. need debug page js , find ajax call data want. same gas. might not work if call authenticated etc.

javascript - backbone.js: possible to push <script type="text/template> content to an external file -

i'm using backbone , in code have lot of text/template content i'd push external file ( templates\name-of-template.js ?) , load dynamically. there easy way this? when try link file <script type="text/template src='whatever'> not work. probably easiest thing load file w/ ajax. var myview = backbone.view.extend({ initialize: function() { this.gettemplate(); }, gettemplate: function() { var self = this; $.ajax({ url: "some/html/template.html" }).done(function( content ) { self.template = _.template( content ); self.render(); }); }, render: function() { this.$el.html( this.template({}) ); } }); also, if using require.js can use text! plugin... define( [ "underscore", "backbone", "text!some/html/template.html" ], function( _, backbone, htmltemplate ) { var myview = backbone.view.extend({ ini

database - How can I write a PL/SQL procedure to copy tables and contents from another account -

i need write pl/sql procedure create tables match ones in account(i have access account). need have same columns , types. also, need filled same data help me! edit: sql> create or replace procedure maketables 2 3 begin 4 execute immediate 5 'create table table1 (select * another_acct.table1); 6 create table table2 (select * another_acct.table2); 7 create table table3 (select * another_acct.table3); 8 create table table4 (select * another_acct.table4)'; 9 end; 10 / procedure created. but when run error: sql> begin 2 maketables; 3 end; 4 / begin * error @ line 1: ora-00911: invalid character ora-06512: @ "bs135.maketables", line 4 ora-06512: @ line 2 when say, "account", mean, "user/schema"? if so, can simple. go read/google "oracle create table select". lets create table select statement, issue statement such create table new_table select * other_schema.old_table you

audio - A simple Real-Time Mic Meter in Android -

i have helped book pro android media... here code: public class micmeter extends activity implements onclicklistener { recordaudio recordtask; int blocksize = 256; int frequency = 8000; int channelconfig = audioformat.channel_configuration_mono; int audioencoding = audioformat.encoding_pcm_16bit; textview txt; button start; boolean started = false; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_mic_meter); start = (button)findviewbyid(r.id.button1); txt = (textview)findviewbyid(r.id.textview1); start.setonclicklistener(this); } private class recordaudio extends asynctask <void,double[],void>{ @override protected void doinbackground(void... params) { try{ int buffersize = audiorecord.getminbuffersize(frequency,channelconfig,audioencoding); audiorecord audiorecord = new audiorecord( mediarecorder.audiosource.mic, frequency, channelco

c# - How to move WPF UserControl from one window to another? -

Image
let's have usercontrol called myvideocontrol located in mainwindow.xaml: <window name="_mainwindow"> <grid> <myvideocontrol name="_localvideo"/> </grid> </window> now user clicks button , want usercontrol float on top of mainwindow.xaml, inside newly created window called popup.xaml. <window name="_popupwindow"> <grid> <myvideocontrol name="_localvideo"/> </grid> </window> how accomplish this, entire object gets moved? use xaml declaratively place myvideocontrol inside windows, i'm guessing i'll need programatically? yes can removing usercontrol mainwindow , adding logical child of control in popupwin window. usercontrol.xaml: <usercontrol x:class="wpfapplication1.usercontrol1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc

android - Trouble setting items in AlertDialog with OnClickListener -

having trouble trying set spinner withing alertdialog, keep getting error "the method setitems(int, dialoginterface.onclicklistener) in type alertdialog.builder not applicable arguments (string[], new view.onclicklistener(){})" i'm new android programming , still getting used it, appreciated! thanks alertdialog.builder b = new builder(this); b.settitle("select day"); string[] types = {"1", "2", "3"}; b.setitems(types, new onclicklistener){ public void onclick(dialoginterface dialog, int which){ dialog.dismiss(); switch(which){ case 0: day = "1"; break; case 1: day = "2"; break; } } }); change: b.setitems(types, new onclicklistener){ to b.setitems(types, new dialoginterface.onclicklistener){ and have split string[] types = {"1

c# Json.net deserializing List<Dictionary<string,object>> -

what proper way deserialize json string? array of dictionaries each dict has "title" , "children" children array of dicts. i using treeview item source, treeview displays title1 > child1 because assume wrong deserializing i'm doing. try print out child1's first child can't figure out how it. code below has invalid cast exception. s = @"[{""title"":""title1"",""children"":[{""title"":""child1"",""children"":[{""title"":""grandchild1"",""children"":[{""title"":""huh""}]}] }] }]"; list<dictionary<string, object>> marr = jsonconvert.deserializeobject<list<dictionary<string, object>>>(s); mtreeview.itemssource = marr; list<dictionary<string,object>> cs = (list<dictionary<st

ioc container - How to iterate over Ninject StandardKernel's configured bindings to debug? -

in ninject binding module, public class carmodule : ninjectmodule { public override void load() { kernel.bind(scanner => scanner.fromthisassembly().selectallclasses() .inheritedfrom<icar>().bindallinterfaces()); foreach (var binding in kernel.getbindings(typeof(icar))) { trace.writeline(string.format("[{0}] service bound [{1}]", binding.service.name, binding.target.gettype().name)); } // output looks like: //[icar] service bound [bindingtarget] //[icar] service bound [bindingtarget] //[icar] service bound [bindingtarget] } } i need sanity check see types i've bound services. i'm having trouble accessing type names of bound types . instead of [bindingtarget] , i'd see [mercedes] , [ferrari] , etc... is there and/or common way this? in iockernel, d add method getall instances of given

objective c - Realtime audio compression with AudioConverterFillComplexBuffer in iOS -

i trying realtime encoding of buffer coming recording callback, seem not understand how this, , how works. in fact spent hours reading apple's reference don't it. i want through various threads here on so, still no me. i have recording callback: static osstatus recordingcallback(void *inrefcon, audiounitrenderactionflags *ioactionflags, const audiotimestamp *intimestamp, uint32 inbusnumber, uint32 innumberframes, audiobufferlist *iodata) { // data gets rendered here audiobuffer buffer; // variable check status osstatus status; /** reference object owns callback. */ audioprocessor *audioprocessor = (__bridge audioprocessor*) inrefcon; /** on point define number of channels, mono iphone. number of frames usally 512 or 1024. */ buffer.mdatabytesize = innumberframes * 2; // sample size buffer.mnumberchannels = 1; //

math - rounding to the nearest zero, bitwise -

i wonder how can round nearest 0 bitwise? previously, perform long division using loop. however, since number divided number power 2. decide use bit shifting. so, can result this: 12/4=3 13/4=3 14/4=3 15/4=3 16/4=4 can performing long division usual? 12>>2 13>>2 if use kind of bit shifting, behavior different different compiler? how rounding up? using visual c++ 2010 compiler , gcc. thx bitwise shifts equivalent round-to-negative-infinity divisions powers of two, meaning answer never bigger unrounded value (so e.g. (-3) >> 1 equal -2). for non-negative integers, equivalent round-to-zero.

javascript - Node JS push server send/receive -

i trying set node js server push notifications browser app. have basic example working, wondering how send data server client on handshake. i need send server user id, when notification comes in them, can routed user. my server looks this var app = require('http').createserver(handler) , io = require('socket.io').listen(app) , fs = require('fs'); app.listen(8000); function handler ( req, res ) { res.writehead( 200 ); res.end('node working'); }; io.sockets.on( 'connection', function ( socket ) { socket.volatile.emit( 'notification' , "blah" ); }); and client looks this var socket = io.connect('http://localhost:8000'); socket.on('notification', function (data) { //prints data here }); in socket.io, emit other event handler (e.g. jquery's .on('click'...) ); declare event , send data. on server, add .on('event', ...) catch request , process it.

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] -

i using program connecting ms access 2007 , getting exception please me out.the exception is, have checked many tutorials not getting best solution. java.sql.sqlexception: [microsoft][odbc microsoft access driver] not find file '(unknown)'. at sun.jdbc.odbc.jdbcodbc.createsqlexception(jdbcodbc.java:6956) @ sun.jdbc.odbc.jdbcodbc.standarderror(jdbcodbc.java:7113) @ sun.jdbc.odbc.jdbcodbc.sqldriverconnect(jdbcodbc.java:3072) @ sun.jdbc.odbc.jdbcodbcconnection.initialize(jdbcodbcconnection.java:323) @ sun.jdbc.odbc.jdbcodbcdriver.connect(jdbcodbcdriver.java:174) @ java.sql.drivermanager.getconnection(drivermanager.java:579) @ java.sql.drivermanager.getconnection(drivermanager.java:221) @ multithreading.dbaccess.main(dbaccess.java:14) import java.sql.*; public class dbaccess { public static void main(string[] args) { try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string database = "jdbc:odbc:driver={microsoft acce

css - Shift Footer tag to center -

i working on website adapted http://joelb.me/scrollpath/ want relocate footer menu float left center. have been working on 3 days. kindly help i have checked url have given in question above. nav has position: fixed . therefore, adding couple of css properties job. can add below properties. width: 320px; left: 50%; margin-left: -160px; the trick give left 50% makes element start rendering after (vertical) center of viewport. give margin-left negative pull left. now, giving magnitude of margin-left half of element's width make sure element pulled left in such way vertical center coincides of viewport.

python - How can I dynamically instantiate (by classname as a string) the class to call getThings() in this example? -

i want see source definition object.__new__() , decided use quick way accessing code. why python giving me typeerror (is not type:method) , when type() tells me it's type:method? (1) >>> import inspect >>> print inspect.getsource(object.__new__) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/local/cellar/python/2.7.3/frameworks/python.framework/versions/2.7/lib/python2.7/inspect.py", line 701, in getsource lines, lnum = getsourcelines(object) file "/usr/local/cellar/python/2.7.3/frameworks/python.framework/versions/2.7/lib/python2.7/inspect.py", line 690, in getsourcelines lines, lnum = findsource(object) file "/usr/local/cellar/python/2.7.3/frameworks/python.framework/versions/2.7/lib/python2.7/inspect.py", line 526, in findsource file = getfile(object) file "/usr/local/cellar/python/2.7.3/frameworks/python.framework/versions/2.7/lib/python2.7/

Using cilk++ work stealing -

i new cilk++ , want use cilk's work stealing scheduler. couldn't find information on this. can me regarding this? thanks. there's lots of information @ http://cilkplus.org website. you'll need 1 of: intel compose xe the gcc "cilkplus" branch the cilk plus/llvm development branch pointers of these available @ http://cilkplus.org/which-license . there's tutorial available @ website - @ http://cilkplus.org/cilk-plus-tutorial . barry

asp.net mvc 4 - How to create a custom attributes that derive from AuthorizeAttribute? -

after user has create account, he/she needs create profile he/she submits information used letter. have 2 such controllers need information user's profile. i'm trying create attribute check whether user has created profile before letting him access action methods. if not, user should redirected profile page . public class notauthorizedwithoutprofileattribute : authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { var username = httpcontext.profile.username; var repository = new owrepository(); var userinfo = repository.getuserinfo(username); if (userinfo == null) return false; else return true; } } the problem having concerning username, i.e. following line var username = httpcontext.profile.username; why giving null? yet how i've getting logged user's name. i don't know profile configuration it's safest use httpcontextbase.user

java - Value entered for one entry is stored for other entries instead of unique values -

i have module have update attendance of each student. code below: public void updatedailyattendance(actionrequest areq, actionresponse ares) throws exception{ int totalemployees = employeelocalserviceutil.getemployeescount(); string attendancevalue = getattendancevalue(areq); //long attpkey = counterlocalserviceutil.increment(employee.class.getname()); (int = 0; < totalemployees; i++) { // use attendancevalue update employee entry //string attendancevalue = getattendancevalue(areq); // parametervalue value of radio button parameter long attpkey = counterlocalserviceutil.increment(employee.class.getname()); attendance newattendanceinstance = new attendanceimpl(); newattendanceinstance.setattid(attpkey); newattendanceinstance.setattstatus(attendancevalue); attendancelocalserviceutil.addattendance(newattendanceinstance); } } private string getattendancevalue(actionrequest areq) { enumeration parameters = areq.getpara

How to access the web service in html page? Static site? -

accessing web service in html pages, have static site want access 1 web service in site. if running static site assume webservice want access not on same domain , cannot set proxy on server side. if both assumptions correct cannot use "ordinary" ajax because of same origin policy in browser. best bet may jsonp supported many webservices. i give simple example. retrieve value stored under key "mykey" openkeyval storage webservice in javascript jquery, call $.ajax({ url: "http://api.openkeyval.org/mykey", datatype: "jsonp", success: function(data){ // data } }); and store value, call $.ajax({ url: "http://api.openkeyval.org/store/", data: "mykey=myvalue", datatype: "jsonp", success: function(data){ // value has been succesfully saved } }); please note nowadays many people consider cross-origin resource sharing (cors) better alternative json

Java Mysql Integrity Constraint Violation Exception -

my swing applications throws few exceptions. tried catch integrity constraint violation exception , display message "duplicate id". when happened, without catching here: catch(mysqlintegrityconstraintviolationexception ex) goes catch (sqlexception ex). want is, catch integrity violation exception , display user friendly message instead of technical message comes ex.getmessage(). how do this? shippmenttransfer shiptrns = new shippmenttransfer(shipid, gin, issuedate, tostore, itemname, qty, driver, vehicle); int res = shipmenttanscontroller.addshipgin(shiptrns); if (res > 0) { joptionpane.showmessagedialog(null, "record added"); resetall(); } } catch (dataintegrityviolationexception ex) { joptionpane.showmessagedialog(null, "duplicate id"); } catch (classnotfoundexception ex) {

mysql - mysqlvb query for beginners -

i using vb.net 2010 , mysql. insert working got problem in update. con.open() dim cmd new odbc.odbccommand("update date1 set event_title='" + txteventtitle.text + "',description='" + rchdescription.text + "',calender='" + datetimepicker1.value.date() + "')", con) cmd.executenonquery() con.close() this query doesn't update record table. m beginner need step step procedure update query. not using datagrid display records. please me. thank you. remove closing paren + "')" in query.

c# - How can I set User-Agent and Referer headers when using ClientWebSocket in .net 4.5? -

the obvious answer of using clientwebsocket.setheader throws exception because it's protected header: system.argumentexception occurred message=the 'user-agent' header must modified using appropriate property or method. parameter name: name paramname=name stacktrace: @ system.net.webheadercollection.throwonrestrictedheader(string headername) the exception string suggests using property/method on clientwebsocket can't find such property/method. seems exception designed httpwebrequest class, has such property. the code, doesn't work: clientwebsocket socket = new clientwebsocket(); // throw socket.options.setrequestheader("user-agent", "someuseragentstring"); // throw socket.options.setrequestheader("referer", "somereferer"]); it doesn't you'll able set properties, @ least not right now. might able via reflection. if closely @ stack trace, you'll see throwing method system.net.

in which path should i need to put the text file to write in android -

i have android app , need write string values in text file. have coding write in text file. don't know should create text file.please refer code below, fileoutputstream fout = null; outputstreamwriter osw = null; try{ fout = openfileoutput(“public.dat”, context.mode_private); osw = new outputstreamwriter(fout); osw.write(“text”); osw.close(); fout.close(); }catch(exception e){ e.printstacktrace(system.err); } please inform me in path should create text file. if want store data locally app, on device's internal file system (not on external sd card), should consider sharedpreferences , are, default, private files in private storage space of app, convenient access. sharedpreferences perfect key/value pairs, not suitable data formats. if have different needs, context class has broad variety of methods on offer. please note both activity , application objects context s you'll able access these. please refer documentation: getdir() get

Using gsub to extract character string before white space in R -

i have list of birthdays this: dob <- c("9/9/43 12:00 am/pm", "9/17/88 12:00 am/pm", "11/21/48 12:00 am/pm") i want grab calendar date variable (ie drop after first occurrence of white-space). here's have tried far: dob.abridged <- substring(dob,1,8) dob [1] "9/9/43 1" "9/17/88 " "11/21/48" dob.abridged <- gsub(" $","", dob.abridged, perl=t) > dob.abridged [1] "9/9/43 1" "9/17/88" "11/21/48" so code works calendar dates of length 6 or 7, not length 8. pointers on more effective regex use gsub can handle calendar dates of length 6, 7 or 8? thank you. no need substring , use gsub : gsub( " .*$", "", dob ) # [1] "9/9/43" "9/17/88" "11/21/48" a space ( ), character ( . ) number of times ( * ) until end of string ( $ ). see ?regex learn regular expressions.

javascript - Update dropdown selected value to hyphen(-) as soon as text box clicked -

i have amount dropdown, initial selected value $10, , amount textbox, project requirement user start typing in textbox dropdown value should change "-" , again user clicks on dropdown value in textbox should blank , hyphen should removed, please suggest how achieve this. below code(no script written far): <div class="selectcontainer ui-grid-a" id="dd2"> <select class="left" name="card1selectamount" data-mini="true" id="giftcardamount1" style="width: 30%;padding-left: 20px" onclick="dropdownclicked()"> <option value="10" selected="selected">$10</option> <option value="15">$15</option> <option value="20">$20</option> <option value="25">$25</option> <option value="30">$30</option> <option value="35&qu

asp.net - How to Customize RadRating tooltip for each Star -

my question related customization of radrating tooltip each item. assinging value radrating in method. have show 1 star 2 values. e.g if value 6 3 stars should selected , have use 5 stars. code on server side assinging value radrating : radratingcustomerup.value = (customer.rating != null) ? convert.todecimal(customer.rating / 2) : 0; while on markup : <telerik:radrating id="radratingcustomerup" runat="server" precision="half" orientation="horizontal" readonly="false"> </telerik:radrating> now how show tootip comes on hover of rating stars equal value. if value 7 3.5 stars selected , tooltip shows 3.5 want show tooltip according exact value (7) , if 2 stars selected tooltip must show 4 on hover how can ? the following client script override value displayed in tooltip of radrating. need place on page cusomized rating control.

c# - Remove excel document action pane -

Image
we can attach document action pane excel file using developer-> expansion pack-> microsoft action pane -> attach. once excel saved , opening again have stored excel document. i have excel file (refer image) , wish remove(detach) document action pane using inter op programming in c#. possible so? code snippet : application xlapp = null; try { xlapp = new microsoft.office.interop.excel.applicationclass(); string versionno = xlapp.version; xlapp.visible = true; microsoft.office.core.msoautomationsecurity mso = xlapp.automationsecurity; xlapp.automationsecurity = microsoft.office.core.msoautomationsecurity.msoautomationsecurityforcedisable; workbook newwb = xlapp.workbooks.open(filename, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing,type.missing, type.missing, type.missing, type.missing, type.missing, type.missing); // here want code detach

php - 'White Screen of Death' Causes - WordPress CMS -

i have installed theme on wordpress , when activated merely results in blank white screen. possible causes of this? , steps in take start finding issue. the problem revealed when moving site our test server hosting company's sever, have used host various other wordpress sites. causes of white screen in instance? , steps in take start finding issue. have took steps following research such increasing memory limit , disabling plugins etc worked fine on original server doubt can caused plugins etc. thank you update right, far, have increased memory limit 128m, , disabled plugins temporarily naming folders. i have enabled debugging suggestion @sabari, has resulted in following error: fatal error : call undefined function mb_internal_encoding() in /home/neatly/public_html/wp-content/themes/best_wedding_dress-babe23c7e828662f1a07c296a5608f52/functions.php on line 12 i less useless php make suggestions on how proceed excellent such , how define mb_internal_encoding. here c

jquery - NO ajax request is happening in jstree -

i trying sub nodes (in case sub categories) on clicking in parent nodes (categories). can see no ajax request happening in case. have used solution website - ( http://www.miketyka.com/2012/10/lazy-loading-with-jstree-and-ajax/ ). here jstree code below - /** * menu tree generation */ $("#menu_tree") .bind("open_node.jstree", function (e, data) { // binding collapse nodes whenever user expands single node data.rslt.obj.siblings().filter(".jstree-open").each(function () { data.inst.close_node(this); }); }) .jstree({ "json_data": { "ajax": { "url": base_url + "draw/get_child" } }, "types": { // let user expand or collapse node clicking on node title "types": { "default": { "select_node": function (e) { this.toggle_node(e); return false; }

java - sorting by code -

i have food categories in db like: category_id | parent_id | code | name -------------+-----------+--------+---------------------------------- 1 | | | root 2 | 1 | 1 | vegetables 11 | 1 | 10 | seeds 54 | 11 | 10.1 | sunflower seeds 12 | 1 | 11 | sugar , candy 22 | 2 | 1.1 | frozen vegetables i want sort either code in query or programmatically using parent_id (in pojo after mapping). effect should this: 1 ---1.1 ------1.1.1 ------1.1.2 ------1.1.3 ---1.2 2 3 ---3.1 ... i tried order code received records ordered like: 1, 10.1.1, 11, 1.1.1 should try sort in query or when it's mapped. maybe there interfaces/other utils in java purpose? code type character varying , i'm using postgresql something this. sorts parent_id because sorting on varchar column code column not easy due mismatch bet

r - Access "natural coercion" logic from C/C++ code -

when calling unlist or c , type promoted smallest type capable of representing everything: > c(as.integer(1), 2.3, '3') [1] "1" "2.3" "3" > c(true, 5) [1] 1 5 > unlist(list(as.integer(1:5), as.complex(2:4))) [1] 1+0i 2+0i 3+0i 4+0i 5+0i 2+0i 3+0i 4+0i how can access logic c/c++ code? i have looked c sources of c , unlist , found following code in both do_c_dflt , do_unlist ( main/bind.c ): if (data.ans_flags & 512) mode = exprsxp; else if (data.ans_flags & 256) mode = vecsxp; else if (data.ans_flags & 128) mode = strsxp; else if (data.ans_flags & 64) mode = cplxsxp; else if (data.ans_flags & 32) mode = realsxp; else if (data.ans_flags & 16) mode = intsxp; else if (data.ans_flags & 2) mode = lglsxp; else if (data.ans_flags & 1) mode = rawsxp; the variable data , of type binddata , computed routine answertype seems define coercion logic. however, type binddata declared in b

asp.net - Getting error to generate pdf -

protected void txt_btn_click(object sender, eventargs e) { response.contenttype = "application/pdf"; response.addheader("content-disposition", "attachment;filename=testresult.pdf"); response.cache.setcacheability(httpcacheability.nocache); stringbuilder htmltext = new stringbuilder(); htmltext.append("<table style='color:red;' border='1'><tr><th>createing pdf</th><tr><td> abcdef</td></tr></table>"); stringreader stringreader = new stringreader(htmltext.tostring()); document doc = new document(pagesize.a4); list<itextsharp.text.ielement> elements = itextsharp.text.html.simpleparser.htmlworker.parsetolist(stringreader, null); doc.open(); foreach (object item in elements) { doc.add((ielement)item); } doc.close(); // response output pdfwriter.getinstance(doc, response.outputstream); doc

javascript - Want to pass in returned data to my custom callback within jQuery's $.post() -

basically i'm creating own callback , passing method called _ajaxcall() . _ajaxcall() takes following parameters: data = object containing user submitted data posted server posturl = url post callback = function expression called upon successful return of data server. here _ajaxcall() method: _ajaxcall: function (data, posturl, callback) { $.post(posturl, { data : data }, 'json').done(function (returned) { switch(returned.success) { case true: typeof callback === 'function' && callback(returned); break; } }).fail(function (xhr, textstatus, errorthrown) { if (status !== 200) { window.location = document.url; } }); } commentupdate : function(self) { var posturl = '/submission/comment/' + self.attributes.commentid; var data = { action: self.attributes.action, commentid : self.attributes.commentid, comment: self.attributes.comment }; var callback = function(ret

excel - How to return dynamically created vectors to the workspace? -

hello i'm trying write function reads type of spreadsheet , creates vectors dynamically it's data returns said vectors workspace. my xlcs structured rows, in first row there string should become name of vector , rest of rows contain numbers make vector. here code: function [ b ] = read_excel(filename) %read_excel function read time series data spreadsheet % contents of first cell know name vector [nr, name]=xlsread(filename, 'sheet1','a2:a2'); % transform string name_str = char(name); % create filename varname=genvarname(name_str); % numbers make vector a=xlsread(filename,'b2:ct2'); % create vector corect name , data eval([varname '= a;']); end as far can tell vector created corectly, have no ideea how return workspace. preferably solution should able return indeterminate nr of vectors prototype , want function return nr of vectors of user's choice @ once. to more precise, vector varname created can use in script, if add

java - Is it possible that JButton and actionPerformed method are in different files? -

is possible have button on 1 file , actionperformed(actionevent e) method in different file? trying add actionlistener button, choose1 in file trialdump.java actionperformed(actionevent e) method in file listen.java. tried extending public class trialdump extends listen shows error. idea how can add method button? thanks. here code in file trialdump.java: package core; import javax.swing.grouplayout; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextarea; import javax.swing.jtextfield; import javax.swing.swingconstants; import javax.swing.*; import java.awt.*; // create simple gui window public class trialdump { private static void createwindow() { // create , set window. jframe frame = new jframe("pdf denoiser"); frame.setdefaultcloseoperation(jframe.exit_on_close); // edit jpanel panel = new jpanel(); grouplayout layout = new grouplayout(panel); panel.