Posts

Showing posts from July, 2012

Quoting strings in C++ -

in pascal lazarus/delphi, have function quotedstr() wraps string within single quotes. here's example of current c++ code: //i need quote tblcustomers pqxx::result r = txn.exec( "select * \"tblcustomers\" "); another one: //i need quote ccustomername std::cout << "name: " << r[a]["\"ccustomername\""]; similar above, have double-quote strings. typing in kind of slowing me down. there standard function can use this? btw, develop using ubuntu/windows code::blocks. technique used must compatible across both platforms. if there's no function, means must write one. string str = "tblcustomers"; str = "'" + str + "'"; see more options here

predict.svm function R text mining? -

i have training set contains sentences , labels(1 et -1 ). after creating svm model. want predict label , score of new data. code : library(tm); require(rcmdrplugin.temis); library(rtexttools); require(e1071) news=read.csv("c:..polarity.csv",header=f,sep=';') # training data traindata <- as.data.frame(news[1:196,]); trainvector <- as.vector(traindata[,1]); # choose sentences without labels trainsource <- vectorsource(trainvector); traincorpus <- corpus(trainsource) # create training corpus #cleaning training corpus traincorpus <- tm_map(traincorpus,stripwhitespace) traincorpus <- tm_map(traincorpus,tolower) traincorpus <- tm_map(traincorpus, removewords,stopwords("french")) traincorpus <- tm_map(traincorpus,removenumbers) traincorpus <- tm_map(traincorpus, function(x) gsub("(['’\n??]|[[:punct:]]|[[:space:]]|[[:cntrl:]])+", " ", x)) corpus1 <- corpus(dirsource("c.../file", encoding="ut...

c++ - gsoap returns error 12 and "No user identifier provided" stream error -

i trying build simple gsoap client stuck. code, wrote. currencyratessoapproxy currproxy; std::string login = "kav120@aubg.bg"; std::string password = "mypass"; std::string = "usd"; std::string = "eur"; _ns1__getlatestrate* getrate = new _ns1__getlatestrate; getrate->singlecurrencyfrom = &from; getrate->singlecurrencyto = &to; getrate->password = &password; getrate->userid = &login; _ns1__getlatestrateresponse* resp = new _ns1__getlatestrateresponse; if (currproxy.getlatestrate(getrate, resp) == soap_ok) std::cout << "works"; else { currproxy.soap_stream_fault(std::cout); std::cout << currproxy.error; } currencyratesoapproxy: class soap_cmac currencyratessoapproxy : public soap { public: /// endpoint url of service 'currencyratessoapproxy' (change needed) const char *soap_endpoint; ...

Organize and relate class in PHP -

well, trying adapt old code more object oriented model find difficulties in doing it. structure of classes this: // config.php class config { const setting1 = 'value'; const setting2 = 'value'; } // main.php include 'config.php' class main { var $config; var $info; var $db; function _construct() { $this->config = &new config; $this->info = &new info; $this->db = &new db($this); } } class info { function getsetting($a, $config) { if ($a>0) return $config::setting1; return $config::setting2; } } class db { function _construct($main) { $setting1 = $main->config::setting1; } } // index.php $main = new main; echo $main->info->getsetting(1, $main->config); so, see, there incorrect things in code. want have inside main class, create $main object , there access other object. db need constant config yet don't want create ne...

printing - What does "%%" mean in Java? -

i've inherited code i'm trying modify, , i've see following syntax in number pf places. int titlerecend = inputline.indexof("%%headerend"); ... int filenamestart = inputline.indexof("%%file: ")+8; int filenameend = inputline.indexof("%%filenameend"); i've reviewed this related link can;t find exact match dual % either answer or in javadoc associated answer. understand has print formattimg, can't seem find syntactical information %% instead of, % . what these veriable declarations do--or supposed do? %% means % character java.util.formatter pattern. since % denotes beginning of format specifier %% used escape % char. system.out.println("%%"); prints % for string.indexof % or %% have no special meaning.

driver - Realtek network adaptor 8168E transmit/receive using loopback -

i trying transmit , receive realtek 8168e using loopback(for windows 7 platform) ( writing tx buffer , reading rx buffer) reading rx buffer gives 0. on checking interrupt status register, tdu , rdu bit set 1 (tx/rx descriptor unavailable) network adaptor : realtek 8168e data sheet referred : realtek 8168b transmitter side configuration - allocated memory tx descriptor per specification given in data sheet (page no:55). aligned descriptor 256 byte alignment. also allocated separate buffer (txbuffer) store data transmitted. placed address of txbuffer specified field in tx descriptor. enabled mac loopback bit in tx config register (40h). then have enabled npq bit in txpoll register (38h). after that, have done nic reset offset 37h. then have enabled loopback bit in bmcr register. enabled tx ok, , tx descriptor unavailable interrupts in interrupt mask register (3ch). placed tx descriptor address mac register tnpds (20h). then @ last enabled te bit in ...

.net - In Windows Vista and later, is it possible to obtain the partial result of desktop compositing? -

it doesn't have latest version, totally fine if few frames old. what i'm trying display screen inside window, don't want window show in miniature screen. can think few possible hacks accomplish this. first 1 hiding (in way) window, taking screenshot , making visible again, there chance cause flicker: how can capture screen under own window excluding own window another option through magnification api, still feels little bit of hack. excluding windows screen capture i'm speculating in compositing desktop environment should possible access compositing engine , request version of compositing doesn't include 1 or more layers. result of "extra" composition made available requesting application asynchronously, maybe few frame laters. is there way using win32 api? some other relevant resources c++ - how screen-capture, except windows

Why not name all files .php instead of .html -

if point out i'm missing here, appreciated i'm new haven't encountered situation wrongly naming html file php can bad. perhaps it's less confusing developers? php files sent evaluated after browser requests them whereas html files directly given browser. so if there no php code in .php file, still sending evaluated, though doesn't loading time of page, if anything.

php - view pdf file in browser from mysql database -

i trying retrieve pdf files stored in mysql database , display them in browser. when view button clicked, displaying error: failed load pdf document . my code follows: $query= mysql_query("select uploaded_file pdf_file id='2'"); header('content-description: file transfer'); header("content-type: application/pdf"); header('content-disposition:inline; filename="'.$query.'"'); @read($query); in above code, when view button clicked, file id passed. you're not using result set.... $result= mysql_query("select uploaded_file pdf_file id='2'"); $row=mysql_fetch_row($result); $file = $row['uploaded_file']; header("content-type: application/pdf"); @read($file); also - i'm not sure why you're want use content-disposition inline. go follows display inline: header('pragma: public'); header('expires: 0'); header('cache-control: must-revalid...

sql server - oracle formatting ==> to_char(12.222,'000000000009') gives me output as 000000000012. How can I get same format in TSQL? -

oracle formatting ==> select to_char(12.222,'000000000009') dual gives me output 000000000012. select to_char(1,'000000000009') dual gives me output 000000000001. select to_char(12,'000000000009') dual gives me output 000000000012. how can same format in tsql? let me try elaborate more. want number formatted in tsql formats in oracle. say, if enter 1 oracle query appends 11 zeros before 1. if enter 12.22 oracle query appends 10 zeros before 12.(note decimals not considered) if enter 123 output 9 zeros appended before 123. do want this? declare @i int=12 declare @digit_number int =10 select replicate('0', @digit_number-len(cast(@i varchar(50))))+cast(@i varchar(50))

deployment - my rails application not work on my debian server in production -

when run browser rails application on debian server, tree of application appears in browser. install , configure passenger , apache not work. why? thanks you have web server pointed @ <some_path>/app instead of <some_path>/app/public . example apache virtualhost: <virtualhost *:443> servername www.app.com documentroot "/var/app/current/public/" customlog /var/log/apache2/app_log combined errorlog /var/log/apache2/app_log <directory /var/app/current/public> allowoverride options -multiviews </directory> sslengine on sslcertificatefile /etc/ssl/certs/app.crt sslcertificatekeyfile /etc/ssl/private/app.key sslcertificatechainfile /etc/ssl/certs/bundle.crt </virtualhost>

asp.net - File upload/download failing -

i'm working on website need have upload/download functionality. upload works fine, when press download uploaded file nothing happens. //upload protected void btnupload_click(object sender, eventargs e) { string filename = path.getfilename(fileupload1.postedfile.filename); fileupload1.saveas(server.mappath("files/" + filename)); con.open(); sqlcommand cmd = new sqlcommand("insert filestable(filename,filepath) values(@name,@path)", con); cmd.parameters.addwithvalue("@name", filename); cmd.parameters.addwithvalue("@path", "files/" + filename); cmd.executenonquery(); con.close(); bindgridviewdata(); } //download protected void gvdetails_selectedindexchanged(object sender, eventargs e) { sqlcommand com = new sqlcommand("select filename,filepath filestable id=@id", con); ...

string - I want to cut variable on another variables using Python -

i have variable c . c = ' fr,de,uk,it ' i want cut variable on variables: c1 , c2 , c3 , c4 so c1 = 'fr' , c2 = 'de' , c3 = 'uk' , c4 = 'it' . how do that? c1, c2, c3, c4 = c.split(',') note if, suspect, you're hoping arbitrary number of dynamic variables created depending on length of list, should not try that. keep them in list: c_list = c.split(',')

Where is android studio building my .apk file? -

i've been rebuilding project ground up, there's been lot of problems it. @ moment, everything's working great, except when try run app, message 'local path doesn't exist.' , local path pointing @ path: androidstudioprojects\myproject\myproject..\build\production\myproject.apk , , true enough, there no .apk file @ location, or indeed anywhere else in project filesystem. however, can build app no problems, , running gradlew packagedebug gives me message ' build successful ', .apks should being generated. question is, going, or if aren't being generated, why not? where build path of each module set? i'm confused because project structure->facets->android->compiler settings, project structure->modules->paths->compiler output, build.gradle, , myproject.iml seem have build path, don't quite understand how relate edit: know should be , it's not there want know how change build path edit 2: reason running gradlew b...

c++ - Sieve of eratosthenes : bit wise optimized -

after searching net came know bit-wise version of sieve of eratosthenes pretty efficient. problem unable understand math/method using. the version have been busy looks this: #define max 100000000 #define lim 10000 unsigned flag[max>>6]={0}; #define ifc(n) (flag[n>>6]&(1<<((n>>1)&31))) //line 1 #define isc(n) (flag[n>>6]|=(1<<((n>>1)&31))) //line 2 void sieve() { unsigned i, j, k; for(i=3; i<lim; i+=2) if(!ifc(i)) for(j=i*i, k=i<<1; j<lim*lim; j+=k) isc(j); } points understood (please correct me if wrong): statement in line 1 checks if number composite. statement in line 2 marks number 'n' composite. the program storing value 0 or 1 @ bit of int. tends reduce memory usage x/32. (x size have been used had int been used store 0 or 1 instead of bit in solution above) points going above head of : how finction in line 1...

java - call get methods for different classes behind one another -

i have class name "constituentset". has 1 method namely "getnucleusinconstset()" output "proposition" class . new class "proposition" have method namely "getproperty()". want know propertry of "proposition nucleus" in class "constituentset". not know how can that. wrote follow not work. (constituentset.getnucleusinconstset()).getproperty()) public class constituentset{ // constructor private proposition nucleusinconstset; public proposition getnucleusinconstset() { return nucleusinconstset; } } public class proposition{ //constructor private property property; public property getproperty() { return this.type; } } you have: (constituentset.getnucleusinconstset()).getproperty() but need call instance of constituentset e.g. constituentset cs = new constituentset(); cs.getnucleusinconstset().getpropert...

SQL query issue with condition -

i have query here: select formam.*, sms_montime1.idticket, sms_montime1.mbyllur,sms_montime1.time_added formam left join sms_montime1 on formam.id = sms_montime1.idticket sms_montime1.idticket ='' or sms_montime1.idticket null , dyqani_pergjegjes=$dyqanip order formam.data_fillim desc the issue is, worked fine when added condition and dyqani_pergjegjes=$dyqanip no longer works, don't error though, don't desired result. someone please this prolly fix problem: select formam.*, sms_montime1.idticket, sms_montime1.mbyllur,sms_montime1.time_added formam left join sms_montime1 on formam.id = sms_montime1.idticket sms_montime1.idticket ='' or (sms_montime1.idticket null , dyqani_pergjegjes=$dyqanip) order formam.data_fillim desc what changed put brackets around sms_montime1.idticket null , dyqani_pergjegjes=$dyqanip to ensure correct precedence of or , and.

php - Using checkboxes to specify items in array -

i want use checkboxes specify items added array, code follows: $columns = array( if (isset($_post['customerid'])) { 'customer id' => 'customerid', } if (isset($_post['first_name'])) { 'first name' => 'first_name', } ); how can make work? many thanks you can't use if statements inside of array, move outside so. $columns = array(); if (isset($_post['customerid'])) { $columns['customer id'] = 'customerid'; } if (isset($_post['first_name'])) { $columns['first name'] = 'first_name'; }

asp.net - Chinese is not displayed in ActivePDF -

i going use activepdf generate chinese reports via asp.net application. example dim otk aptoolkitnet.toolkit = new aptoolkitnet.toolkit() otk.newpage() otk.setfont("helvetica|encoding=unigb-ucs2-h", 24) otk.printtext(72.0, 720.0, "每日活动报表") pdf file generated, displays "kˇeåm;r¤b¥he" instead of "每日活动报表". please let me know should do? meta tag defined set (content="text/html; charset=utf-8") in aspx page level. the encodings supported built-in fonts winansiencoding, macromanencoding, macexpertencoding , custom (using 1 of previous 3 base encoding). you need font glyphs defined encoding. built in helvetica font not have glyphs defined "每日活动报表". try using arial unicode ms instead.

windows phone 8 - Does the MPP Player framework support RTSP? -

does mpp player framework support playing files on real time streaming protocol on wp8? i've tried following: <mmppf:mediaplayer source="rtsp://78.129.192.5:1935/akdrd/dunyalive.mp4" margin="0,11,0,214" grid.row="1"> <mmppf:mediaplayer.plugins> <adaptive:adaptiveplugin /> </mmppf:mediaplayer.plugins> </mmppf:mediaplayer>

ember.js - Can't find DS.Store instantiation in Ember application -

Image
i have build small ui widget in ember.js using jsfiddle. works fine ember-data fixture adaptor wanted take local environment , thought i'd use brunch build environment me. since time i've wasted full day trying work , i'm hoping can me on hump. strong suspicion @ time remaining problem either namespace or sequencing issues arises out of common-js packaging brunch you. i'm quite new common-js may simple lack of understanding ... here's basic problem: when run application , move activities template assertion failed: application not have 'store' property defined error. my initialisation file looks this: // namespace app = require('app'); // ===== router ===== app.router.map(function() { this.resource('index', { path: '/' }, function() {}); this.resource('activities', { path: '/activities' }, function() {}); this.resource('hi', { path: '/hi' }, function() {}); }); // ===== routes ...

mysql - Update one table with unique values from another? -

we started 1 table project , realized needed multiple tables wanted do. we started switch over, want switched 1 table multiple. what have now: table: contact +-----+-------+--------+----------+ | id | fname | lname | phone | +-----+-------+--------+----------+ | 123 | john | doe | 555-1234 | | 124 | mary | shelly | 555-5857 | | 125 | jane | doe | null | +-----+-------+--------+----------+ table: phone +----+--------+----------+------+ | id | con_id | phone | main | +----+--------+----------+------+ | 1 | 125 | 555-5857 | n | +----+--------+----------+------+ so have few added , changed. now, need add data isn't in phone table contact table. temp table: table: temp +------------+----------+------+ | foreign_id | phone | main | +------------+----------+------+ | 123 | 555-1234 | y | | 124 | 555-4153 | y | | 125 | 555-5857 | n | +------------+----------+------+ but when add temp phone, end duplicate entries ...

jquery - Get an image from an array -

i'm trying place image array div. arralegro =[ "01.png", "02.png", "03.png", "04.png"]; n=2; var goimg = 'alegro/' + arralegro[n]; alert (goimg); //correct - `alegro/02.png` $('#divr').empty(); $("#divr").prepend('<img id="slide" src=' + goimg + '/>'); // here wrong firebug says - 404 not found . image there. $("#divr").prepend('<img id="slide" src="alegro/02.png"/>'); // works way i think might forgetting double quotes around src attribute. try line: $("#divr").prepend('<img id="slide" src="' + goimg + '" />'); // here wrong

Cakephp : how can i retrieve my media files from the folder to display on my view page -

i working on cakephp 2.x .. have done right .. displaying user form in have given him option upload audio file .. have taken file user .. saving file app/uploads folder .. , path database ... problem dont how can know retrieve audio file , show them view page here uploading function public function audio(){ if ($this->request->ispost()){ $this->loadmodel('audio'); $file = $this->request->data['audio']['file']; $iduser = $this->auth->user('iduser'); if ($file['error'] === upload_err_ok) { $id = string::uuid(); $name =$file['name']; $folder_url = app.'uploads/'.$iduser; if(!is_dir($folder_url)) { mkdir($folder_url); } move_uploaded_file($file['tmp_name'], $folder_url.ds.$name); $this->request->data['audio']['user_id'] = $iduser; $this...

javascript - Highcharts line chart, hover over point selects another point on chart -

to chart pass data array of arrays of utc datetime , value, e.g : [ [1374537600000, 69.67575704891426] [1373932800000, 69.67575704891426] ] i hard-coded data values in jsfiddle . when hover on point, another point selected reason. highcharts should able handle without resulting in issue, need switch order of data: data: [ [1373932800000, 69.67575704891426], [1374537600000, 69.67575704891426] ] fiddle

server configuration - I can't update my extension - SmartFoxServer -

i working smartfoxserver 2x. have problem updating of extension's code. extension name is: "myfirstextension". there .jar file in folder named: myfirstextension.jar . extension tested , working fine. want update code. open eclipse , add few line of code project. exported new code new .jar , override old .jar. after restarting server see old code run. don't have idea why. how server remember old code ? there cache can delete ? how resolve problem ? thanks, tomek i have been experimenting sfs2x while , sure every time restart server extensions reloaded. if have 'reload mode' in 'zone extension tab' set auto, extension reload without restarting server. it seems doing right , because you've tested extension, export path must right. double check export path similar following c:\program files\smartfoxserver2x\sfs2x\extensions\myfirstextension\myfirstextension.jar you try exporting alternative path , manually copy file extension path. i...

graphics - How do I tell my MATLAB GUI that I want to plot on it using an external .m file? -

i have gui(made using guide) in there axes on can draw. when saved gui, have .fig file , .m file (whose names start_gui.m , start_gui.fig). now, trying plot on these axes using external m file, have passed gui handles. follows: function cube_rotate(angle1,angle2,handles) gcf=start_gui.fig; %this name of gui.fig file in guide set(gcf,'currentaxes',handles.cube_axes)%this allows plot on gui %plot end handles.cube_axes name of handle in gui created using guide. inspite of passing handles, won't allow me plot in gui. throws error saying: ??? undefined variable "start_gui" or class "start_gui.fig". start_gui.fig name of gui figure generated in guide. how make plot in axes in start_gui.fig? thanks help! you've made few errors. first referring file name without single quotes denote string. second trying open existing figure assigning variable named gcf . give variable gcf contains string 'start_gui.fig' . in...

local - Should I expect to have exactly same match everytime I run the match with greedy algorithm? -

i'm using greedy algorithm or local algorithm match propensity score in 2 groups. end same number of matches every time doesn't match same last time. normal? "greedy" doesn't mean "deterministic," in particular if have 2 choices equal weight/value may possible first select 1 choice during 1 algorithm execution , first select other choice on algorithm execution.

javascript - Find position of highlighted text in pdf loaded in web page -

i'm trying have little idea of how achieve it. namely, i' trying capture index of in pdf document (loaded on web page) user's mouse clicked , released. example: "this great placeholding text serves example" say user highlights substring "great placeholding text", how can capture: the content of highlighted text, in example "great placeholding text" the index @ mouse pressed , released in essence i'm trying allow users highlight , save parts of pdf document (as position of portion of text have saved) later reference. any ideas much appreciated, all!

mysql - PHP Script to Edit Database Fields -

i have working registration component purchased joomla stores users information in database. have few hidden fields need match inputs of other fields, component not allow fields change dynamically on registration. i'd use cron job select relevant field database , set value hidden field value, every user. can point me in right direction started on php script? cron man cron introduction cron: http://www.unixgeeks.org/security/newbie/unix/cron-1.html from intro: in /etc directory find sub directories called 'cron.hourly', 'cron.daily', 'cron.weekly' , 'cron.monthly'. if place script 1 of directories run either hourly, daily, weekly or monthly, depending on name of directory.

c# - Wrong Return Type -

i don't understand why getting error of: 'system.collections.generic.list notify.mainpage.webclient_openreadcompleted(object, system.net.openreadcompletedeventargs)' has wrong return type code: webclient.openreadcompleted += webclient_openreadcompleted; and: private list<sightingtype> webclient_openreadcompleted(object sender, openreadcompletedeventargs e) { datacontractjsonserializer ser = null; var sightingt = new list<sightingtype>(); try { ser = new datacontractjsonserializer(typeof(observablecollection<sightingtype>)); observablecollection<sightingtype> sightingtypes = ser.readobject(e.result) observablecollection<sightingtype>; foreach (var sightingtype in sightingtypes) { sightingt.add(sightingtype); } } catch (exception ex) { ...

c# - post JSON to asp.net page -

i want post json object asp.net page. have looked on web , have seen how call web service, or page methods using ajax send or retrieve json, post json. reason being dynamically create pdf document, pdf document contain information inside table. this tried: function gettablevaluesandpost() { try { getalltablerows("n");// n stands not submitting database same method used submit // processing , create pdf method. var tablevalues = '{' + 'w_vendor:[' + w_vendor + "],w_invoice:[" + w_invoice + "],w_invdate:[" + w_invdate + "]," + "w_amount:[" + w_amount + "]," + "w_account:[" + w_account + "]," + "w_fund:[" + w_fund + "]," + "w_org:[" + w_org + "]," + "w_prog:[" + w_prog + "]," + "w_adrsstyp:[" + w_adrsstyp + "]," + ...

ios - Caching images doesnt stay once applicationDidEnterBackground is activated -

i have been having issue no matter framework use cache images, afnetworking sdwebimage's caching techniuqes write disk. everytime press home button, go app. images have re cached. i have no clue start looking in order use both afnetworking regular networking functions, such json , image uploading used https://gist.github.com/sibljon/5957892 resolve namespace collisions cold totally override afnetworkings uiimageview , stick sdwebimage instead of calling thanks jonsibley , his answer dont call [imagefile setimagewithurl:[nsurl urlwithstring:friendavatar] placeholderimage:[uiimage imagenamed:@"defaultprofileimage.png"]]; im calling (just sd_ in front now) allows me override afnetworkings caching. correct? [imagefile sd_setimagewithurl:[nsurl urlwithstring:friendavatar] placeholderimage:[uiimage imagenamed:@"defaultprofileimage.png"]]; edit udpate: after more testing found out app cleaning cache once resumes app, not when starts suspended (wh...

solr - WordDelimiterFilterFactory not including all permutations -

i have solr index has deal part numbers - worddelimiterfilterfactory seems ideally suited for. example part number "ch2300-100". i'm expecting following queries match field (and do): ch ch2300-100 ch2300100 but following query doesn't match: ch2300 looking @ debugging output - combination of word parts isn't generated. expected catenatewords and/or catenatenumbers attribute handle case seems not work. missing in configuration allow permutations of tokenized fragments matched? <schema version="1.5" name="test"> <types> <fieldtype name="text" class="solr.textfield"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" cat...

javascript - How to hide a div whenever another div is displayed on the screen. -

i have helpsection displayed default. when user searches results, page reloads , searchresults should displayed section located , section set display:none. i have jquery searches page , determines if helpsection on screen or not. if searchresults being displayed, helpsection should disappear. i have tried various methods , none of them worked. appreciated. like : if($('#yourelement').is(':visible')) { $('#yourotherelement').hide(); } if want show instead, can use show(), : $('#yourotherelement').show(); however, if determined on page load, smarter define using server-side language.

sql - Incorrect Join in a View -

i creating view in sql manager 2012 has employee details (name, costcenter, etc). cost centers labeled in master report more detailed need (however, need info in future don't want remove it). created table has of cost centers basic label. i added main employee table view added cost center label table view. connected costcenterno employee table costcenterno in label table. selected label name viewed instead of main label employee table. the problem when run connection duplicated several of rows, going 400+ on 1200 rows. want replace complex label simple label reporting. here code in view. select dbo.eemasterdata.empno, dbo.eemasterdata.empname, dbo.eemasterdata.jobno, dbo.eemasterdata.jobname, dbo.eemasterdata.orgunit, dbo.eemasterdata.orgname, dbo.eemasterdata.parea, dbo.eemasterdata.psubareano,dbo.eemasterdata.psubareaname, dbo.eemasterdata.masterccno,dbo.costcenterconsolidatedlkup.costcentermain, dbo.eemasterdata.positionno, dbo.eemasterdata.positionname, ...

google maps - XML file erroring due to certain characters in strings -

i have xml file pulls database. i'm getting error on strings , url's because contains characters xml treating code , either gives syntax error or says entity not defined. there way, since data string, set xml when data in quotes, ignores code , treats text? created example marker name , url having errors. marker name has & sign , url has msa, ll, spn, , iwloc doesn't like. <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <markers> <marker name="c&o canal trail" address="" city="" state="" zip="" image="" width="" height="" lat="39.693978" lng="-78.154822" category="kml" notes="" url="https://maps.google.com/maps/ms?msid=209491726150360274926.0004e18eed520de4890e6&msa=0&ll=39.213103,-77.295685&spn=0.619262,1.540833&iwloc=0004e18eee21c28a5a313" hike_distance="...

if statement - python else syntax error -

this python script process string suffering syntax error in line 24, else: . any ideas might be? j=raw_input("enter string: ") import os def addtoclipboard(text): command = 'echo ' + text.strip() + '| clip' os.system(command) def parse(string): result="" linelist=string.split("\n") in range(len(linelist)): h=linelist[i].split("@") if len(h)<2: continue if len(h)>2: count=0 x in range(len(h)): if x==len(h)-1: continue re0=count+len(h[x])+(x*1) re1=i+1 re3=str(re1)+"-"+str(re0) result+=str(re3)+", " count+=len(h[x]) else: re0=len(h[0]) re1=i+1 re3=str(re1)+"-"+str(re0) result+=str(re3)+", " result =result[:-2] addtoclipboard(result) print result parse(j) it's problem indentation level of else , make sure align @ same level of corresponding if . please use ide or text editor catch kind of errors. is, it's impossible se intended code...

cocoa - Efficient conversion of int to string -

i've seen several questions/answers here suggest best way string representation of integer in objective-c use [nsstring stringwithformat:@"%d", x] . i'm afraid c/c++ programmer in me having hard time believing want bring formatting code play such simple task. is, assume stringwithformat needs parse through format string looking different type specifiers, field widths, , options possibly use, has able interpret variable length list of parameters , use format specifier coerce x appropriate type, go through lengthy process of conversion, accounting signed/unsigned values , negation along way. needless in c/c++ use itoa(x) 1 thing , extremely efficiently. i'm not interested in arguing relative merits of 1 language on another, rather asking question: incredibly powerful [nsstring stringwithformat:@"%d", x] really efficient way very, simple task in objective-c? seems i'm cracking peanut sledge hammer. you use itoa() followed of +[ns...

SVN Pre-Commit: Getting name of url when the commit goes -

i need catch url files commited. example: my branch checkout http://localhost.home.network:443/svn/test in branch commited files a.txt , b.txt. i want catch using svn hook (either pre-commit or post-commit) url svn respository. if question not clear, ask me , i'll provide information needed. use svnlook changed in post commit hook list of changed files. output contains relative paths within repository, , root of repository passed first argument post commit hook. you can use following bash script post-commit hook see how works: #! /bin/bash exec >> /tmp/post-commit.log 2>&1 echo "commit: $0 $*" svnlook changed "$1"

c# - Quickly redraw tooltip like MPC-HC's seekbar -

if hover mouse on media player classic - home cinema 's seekbar, tooltip visible duration time info. when start move mouse horizontally across seekbar, tooltip smoothly follows cursor along. using regular tooltip control, tooltip wont follow cursor smoothly enough see time cursor on over seekbar. can't read c++ don't know how implementing feature, using small custom window looks tooltip or else? a nice mpc-hc developer helped me out: how implement tracking tooltips http://msdn.microsoft.com/en-us/library/windows/desktop/hh298405%28v=vs.85%29.aspx

how make a datetime object in year 0 with python -

exactly title says. if try gives me valueerror year value i'd have datetime year 0. there way this? from docs the datetime module exports following constants: datetime.minyear smallest year number allowed in date or datetime object. minyear 1. datetime.maxyear largest year number allowed in date or datetime object. maxyear 9999.

Angularjs ng-grid REST calls -

folks, i trying make ng-grid make rest calls upon editing. i have followed clue post: angularjs , ng-grid - auto save data server after cell changed however keep getting error, if has faced similar, pleas advice: error: no controller: ngmodel @ error (<anonymous>) @ getcontrollers (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4823:19) @ nodelinkfn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4960:35) @ compositelinkfn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4550:15) @ compositelinkfn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4553:13) @ publiclinkfn (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:4455:30) @ object.<anonymous> (http://www.yojit.com/app/lib/angular/ng-grid.js:2691:13) @ object.applyfunction [as fn] (http://www.yojit.com/app/#/employeelist:778:50) @ object.scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js:8811:27...

Rally rallyaddnew with Portfolio Items -

i have been trying use rallyaddnew add features , rollups, rendered in grid/cardboard. got work , display, cannot customize text create new "feature" or "rollup", rather says create new "portfolioitem/feature" , "portfolioitem/rollup" { xtype: 'rallyaddnew', recordtypes: ['portfolioitem/feature', 'portfolioitem/rollup'], listeners: { recordadd: function() { // }, beforerecordadd: function() { // } } i couldn't find in sdk on how customize this. this defect. should using display name of type instead of type path. i'll file defect this. fyi there existing defect around pi types , adding details has been fixed has not been released in sdk version yet.

save - Saving an image to sd card from android pager -

i have pager activity in android application need save images according there position in pager. managed saving part when iam in first image click save saves second image same second image save third dont know whats wrong code! ` enter code here public boolean onoptionsitemselected(menuitem item) { // handle item selection if (item.getitemid()==r.id.menufinale) { imageview imageview = (imageview) findviewbyid(r.id.image_one); imageview.setdrawingcacheenabled(true); bitmap bitmap = imageview.getdrawingcache(); file root = environment.getexternalstoragedirectory(); mediastore.images.media.insertimage(getcontentresolver(), bitmap, "my pic" ,"saved gallery"); file file = new file(root.getabsolutepath()+"/dcim/camera/img.jpg"); try { file.createnewfile(); fileoutputstream ostream = new fileoutputstream(file); bitmap.compress(compressformat....

tic tac toe - tic tac toe game java -

i novice java student, assigned tic tac toe game. when try compile , run program, following error: run: exception in thread "main" java.lang.nullpointerexception @ tictactoegame.tictactoegame.displayboard(tictactoegame.java:55) @ tictactoegame.tictactoegame.main(tictactoegame.java:23) java result: 1 build successful (total time: 0 seconds) i warning in createboard method says "local variable hides field" below code project far. of code provided me school, , suppose initialize array in createboard method , determine winner in winortie method. have ideas how run? doing wrong in initization of array? thank can me out this. package tictactoegame; import static tictactoegame.tictactoegame.gameboard; public class tictactoegame { static int[][] gameboard; static final int empty = 0; static final int nought = -1; //this 'o' static final int cross = 1; //this 'x' public static void main(string[] args) { ...

listing all available languages in android apps -

i've been searching while couldn't find similar i'd need. i'd know how can list languages available in android application? , say, pick 1 of them run default. just create preferences activity in application , display supporting languages within (may in list view check mark or something), when user selects specific language, save selected language preference in application shared preference. within every activity of application run conditional flow , use application's drawables , string values respect language selected in application preference. edit here example of localization http://www.icanlocalize.com/site/tutorials/android-application-localization-tutorial/ since don't want check selected language in phone's settings, in application's context, should create preferences activity specific application. here example of saving creating , using preferences : http://androidpartaker.wordpress.com/2010/07/11/android-preferences/ after doi...

jquery - manipulate request string dynamically with javascript -

i have request link: <a href=index.jsp></> and have divs in part of page, contain values , change user or under conditions: <input id="var1" /> <input id="var2" /> how can update dynamically url have inside value of these 2 vars, resulting in <a href=index.jsp?var1=1&var2=17></> is there easy javascript/jquery way, or, html way perhaps? var val1 = $('#var1').val(), val2 = $('#var2').val(); $('a').attr('href', function(i, src) { return src+ '?var1=' + val1 + '&var2=' + val2 ; }); use correct selector select element . set href of anchor , appending querystring parameters it. if want change in particular event need listen event , perform same actions. the same can written way can easier understand. var val1 = $('#var1').val(), val2 = $('#var2').val(); var src = $('a').attr('href'); // cu...

How do I read from a file using powershells Get-Content use join and put a space inbetween each line read -

currently have following code: $memory = (get-content "c:\bat\logs\results.txt") -join " " when read in contents of file expecting there space in between each line read in. jams making difficult read. what doing wrong? try this... $memory = (gc .\tem.txt) -join "`n`n"

Cannot Install ruby-oci8 on Ubuntu 12.04LTS -

i execute $ bundle install for rails application... (3.2.8) right when gets ruby-oci8 ... gem::installer::extensionbuilderror: error: failed build gem native extension. /home/ubuntu/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb checking load library path... ld_library_path... checking /usr/lib/oracle/12.1/client/... no checking ld.so.conf... no checking cc... ok checking gcc... yes checking lp64... no checking sys/types.h... yes checking ruby header... ok version of oracle sql*plus... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/ubuntu/.rvm/rubies...

php - mb_substr cutting off words in post excerpt? -

this code using show html formatting on wordpress post excerpts: function get_excerpt($post, $ln){ if (!empty($post->post_excerpt)) { if (strlen($post->post_excerpt) > $ln) { echo mb_substr(($post->post_excerpt), 0, $ln); } } else { if (strlen($post->post_content) > $ln) { echo mb_substr(($post->post_content), 0, $ln); } } } how can edit mb_substr excerpt end @ period? instance, excerpt end "she has lovable , innocent charm tha" instead of "she has lovable , innocent charm keeps people caring her." want excerpt finish sentence , end in period instead of stopping @ character limit, set @ 800. in code $ln set 800. update: this code ended using. words still cut off in excerpt added read more link end dots. function get_excerpt($post, $ln){ if (!empty($post->post_excerpt)) { if (strlen($post->post_ex...

Problems with Java Triangle Type Program -

import java.util.scanner; public class labassignment4 { public static void main(string[] args){ scanner user = new scanner(system.in); //variables double a, b, c; system.out.println("enter longest side: "); = user.nextdouble(); system.out.println("enter second side: "); b = user.nextdouble(); system.out.println("enter third side: "); c = user.nextdouble(); //help fix code compute triangle type correctly... if (a==b&&b==c) { system.out.println("equilateral triangle"); } else if (a==b && b==c); { system.out.println("isoceles triangle"); } if (!((a == b) && (a == c) && (b == c))); { system.out.println("scale...

vba - How to loop through each column in Excel and apply column width based on condition -

i in need of excel vba code autofit columns default , loop through each column width , if width exceeds particular value eg., 50, restrict particular column width 30 , sets word wrap true. public function lastcolumn(optional wks worksheet) long if wks nothing then: set wks = activesheet lastcolumn = cells.find("*", searchorder:=xlbycolumns, searchdirection:=xlprevious).column end function sub macro1() dim lastcol long cells.select cells.entirecolumn.autofit lastcol = lastcolumn(thisworkbook.sheets("sheet1")) = 1 lastcol if columns(i).columnwidth > 70 columns(i).columnwidth = 70 columns(i).wraptext = true end if next end sub is there better way achieve this? something like sub autofit() dim col range each col in activesheet.usedrange.columns 'only columns have values col.autofit if col.columnwidth > 50 'set values here col.co...

ios - Data passing of photo taken in App -

i used code -(ibaction)takephoto { picker = [[uiimagepickercontroller alloc]init]; picker.delegate = self; [picker setsourcetype:uiimagepickercontrollersourcetypecamera]; [self presentviewcontroller:picker animated:yes completion:nil]; [self performseguewithidentifier:@"cropimage" sender:sender]; } - (void) imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { //obtaining saving path nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *imagepath = [documentsdirectory stringbyappendingpathcomponent:@"latest_photo.png"]; //extracting image picker , saving nsstring *mediatype = [info objectforkey:uiimagepickercontrollermediatype]; if ([mediatype isequaltostring:@"public.image"]){ uiimage *editedimage = [info objectforkey:uiimagepickercontrollereditedimage]; nsdata *webdata = ...