Posts

Showing posts from September, 2012

php - "SyntaxError: missing ; before statement" -

im trying write code add javascript in variable. going find until error "syntaxerror: missing ; before statement" ... have found out if remove line works (i put // ---- on line). please can help? $this->paint_javascript_function_text .= ' function image_'.$this->archive_id.'_rollover (){ document.getelementbyid("details").innerhtml = "'.$this->archive_name.'<br />'.$this->archive_dimensions.' - price &#163;'.$this->archive_price.' inc packaging"; } function image_'.$this->archive_id.'_fullsize (){ document.getelementbyid("gallery").innerhtml = '; $this->paint_javascript_function_text .= "'"; $this->paint_javascript_function_text .= '<table width="100%" height="400"border="0" align="center"><tr><td align="right" valign="middle...

c# - inherit method throws error -

i have following super class: abstract class contactqueue { public abstract datetime period { get; set; } public abstract string type { get; set; } public abstract string tostring(); public string rewriteperiod(string choice) { new cultureinfo("da-da"); switch (choice) { case ("day"): return period.tostring("ddd"); case ("week"): return ""+period.tostring("ddd")+" uge: "+weeknumber(period); case ("year"): return period.year.tostring(); default: return ""; } } private int weeknumber(datetime fromdate) { // jan 1st of year datetime startofyear = fromdate.adddays(-fromdate.day + 1).addmonths(-fromdate.month + 1); // dec 31st of year datetime endofyear = startofyear.addy...

java - sorting on ArrayList but ArrayList have same value -

my text is ---- sınİsıru, sınİuzo puanları azalan : ------ {deneme deneme deneme}{anya}{ltd. Ştİ.}{1.75}{1.25}{14.00}{10.00}{1.75}{1.2}{false} ------ {deneme deneme deneme }{dzlİ}{ Ştİ.}{1.43}{1.14}{11.43}{9.14}{1.43}{0.57}{false} ------ {deneme deneme deneme }{meİn}{ Ştİ.}{1.29}{1.10}{10.29}{8.76}{1.29}{0.55}{false} ------ {deneme deneme deneme }{hay}{ Ştİ.}{1.29}{1.10}{10.29}{8.76}{1.29}{0.55}{false} ------ {deneme deneme deneme }{ahan}{ Ştİ.}{1.29}{1.10}{10.29}{8.76}{1.29}{0.55}{false} ------ {deneme deneme deneme }{msa}{ Ştİ.}{1.29}{1.10}{10.29}{8.76}{1.29}{0.55}{false} ------ {deneme deneme deneme }{Ş}{ Ştİ.}{1.29}{1.10}{10.29}{8.76}{1.29}{0.55}{false} ------ {deneme deneme deneme }{ko}{. Ştİ.}{1.25}{1.08}{10.00}{8.67}{1.25}{0.54}{false} kolon1:1.75,1.43,1.29... kolon2:1.25,1.14,1.10.. then ı sorted them smallest bigger. there replaced number ı dont want replaced number. exemaple if contain text contain 3,3,3,3,3,2,2,2,2,1,1,1,1,1,1 ı want 1 2 3 public class poi...

sockets - Java:ObjectInputStream returns same Object -

i programming java network using sockets , exchanging data between remote programs using simple objects. in present case have objectinputstream constructed using : new objectinputstream(socket.getinputstream()) so using writeobject method write object contains string fields. however receiver when calls readobject returns same object. to check set 1 of string fields store current time. while writing object different time each object. received object show same single time in string field. clearly speaking every object returned after each call objectinputstream.readobject exact clone of other why happening? try doing objectinputstream.reset();

Hive - What is the purpose of CLIDriver.java? -

i trying understand hive codebase. org.apache.hive.cli.clidriver do? class contains hardly comments , javadoc doesn't explain either. the clidriver class in hive designed starting hive session , reading hiverc files if there any, loading configurations , processing ; terminated commands execute in hive thanks, achyut

VB6 MsgBox not working with ASP.NET -

i using vb6 application dll in web application. in vb6 application there many msgbox alerts available. when debug web application got alerts dll. when configure in iis , browse no msgbox alerts coming.where issue? if want display message boxes on server debugging purposes, here link describes how that: how enable message box in iis server it explains why bad idea. :)

javascript - jquery tabslideout behaviour -

i have problem here slide out. works 1 one php file not on same code? i have tried changing id's confused. please help. <input id="#submit456" type="submit" class="button" value="request quote &raquo;" style="background:#336600; color:#fff; padding:8px; font-weight:bold; margin-top:-4px; float:right; font-size:11px; font-family: arial, helvetica,sans-serif;" > $("#submit456").click(function(event){ if (obj.hasclass('open')) { slidein(); } else { slideout(); } });

C for loop with integers -

i following book let c , following code has been shown being correct: for ( < 4 ; j = 5 ; j = 0 ) printf ( "%d", ) ; but in turbo c gives 3 warnings: code has no effect. possibly incorrect assignment. 'j' assigned value never used. if book making point code allowed c standard, correct. code not violate rule of c standard, provided i , j have been declared correctly (and printf too, including #include <stdio.h> ). however, nobody write code this, because not useful. why compiler issuing warning, because code technically allowed not programmer intend. if book claiming code useful in way, typographical error. wrong. if book has more few errors this, should discard it.

postgresql - Postgres locale error -

i have postgres database hosted on digital river, on ubuntu, , followed these instructions install : but wrong locale settings , cannot work out how fix it. when run psql command following error: postgres@assay:/home/deployer$ psql perl: warning: setting locale failed. perl: warning: please check locale settings: language = "en_us:en", lc_all = (unset), lc_ctype = "utf-8", lang = "en_us.utf-8" supported , installed on system. perl: warning: falling standard locale ("c"). psql (9.1.9) thank kamal nasser on digital river forums providing correct answer ( the following commands below requires root privileges ): $ locale-gen en_us en_us.utf-8 $ dpkg-reconfigure locales i think correct link original answer: digital ocean site not responding can't check it. https://www.digitalocean.com/community/questions/postgresql-and-rails-4

mysql - How to optimize double select query -

select `id`, `field2`, `field3`, `field4` title `articles` `category_id` = 'x' , `id` not in (select `articleid` `article-seen` `userid` = 'y') how can optimize this? think double select bad, im new mysql try using join same result makes query looks simpler

security - node.js - secure image file upload -

we had implement image uploader node.js project. framework using express.js did described here: http://howtonode.org/really-simple-file-uploads but not sure how secure image uploader. did far is: checking file size checking extension , header rename file file accessible on special route , not in root folder is enough? don't feel comfortable following line: // checking filesize, extension, headers fs.readfile(req.files.displayimage.path, function (err, data) { ... ... ... // renaming file // save file ... ... ... } is save read image way? afraid, there malicious code in req.files.displayimage.path. need add more checks or our checks sufficient? attack vectors offer attacker if use code described? thank advices tschoartschi

arguments for subsequent call of function in python -

this question has answer here: “least astonishment” , mutable default argument 29 answers hi new python. can explain how below 2 pieces of code give different outputs? function gets defined each time called? def f(a, l=[]): l.append(a) return l def f(a, l=none): if l none: l = [] l.append(a) return l on running print f(1) print f(2) print f(3) i these outputs respectively [1] [1, 2] [1, 2, 3] [1] [2] [3] this common 'gotcha' new python developers. in first example looks new empty list should created each time function called without second parameter. isn't. single list created when function object created , when python script loaded or finish entering function in interactive shell. list used every invocation of function, hence acculumation see. the second standard way of working...

wcf - The remote server returned an error: (400) Bad Request. -

i have created cloud application in there 1 web role , 1 wcf service getting used web role. when inserting picture using stream function blob using service giving error remote server returned error: (400) bad request. even changing webconfig of client , server side not helping. if update service client side web role,configuration.svcinfo,configuration91.svcinfo getting updated default value if service web.config updated max values. i have tried thing there related error.but still after 2 days still @ same position. error occuring is:- **line 85: [system.componentmodel.editorbrowsableattribute(system.componentmodel.editorbrowsablestate.advanced)] line 86: webrole1.servicereference1.uploadfileresponse webrole1.servicereference1.itransferservice.uploadfile(webrole1.servicereference1.remotefileinfo request) { line 87: return base.channel.uploadfile(request); line 88: } line 89: source file: d:\faltu\wcfmathservicelibrary\webrol...

komodoedit - How to delete the right column in Komodo Edit 8? -

image link you see want delete column in cursor present no mention in doucmentation how it. using komodo edit 8.i dont know called -right-column,right-column markup etc.please space consuming room on monitor. komodo dev here, i'm assuming talking minimap. can rid of either current file alone via "view > view minimap" or globally via "preferences > editor > scrolling > use minimap scrollbar". documentation on minimap can found here: http://docs.activestate.com/komodo/8.0/editor.html#minimap .

jsp - could not understand the concept of jsp_precompile -

as mentioned in books ,when append ?jsp_precompile query compile files n further queries accessed faster.. question "how use ?jsp_precompile" whether use in url written in code appended "?jsp_precompile" or call jsp page specially in browser appending this. so. if first case not working in mine, when jsp page called has nothing in it.. query appears on browser has jsp_precompile appended or may related http://www.coderanch.com/t/615977/tomcat/jsp-compiled-files-java-files problem. (please try answer 1 also). or if 2nd case why need of appending in end calling jsp browser automatically compiles it.. jsp_precompile special.. see this nice overview . 1 may conclude, measure introduced later standard (for miscellaneous java ee servers) precompile jsps. jsp might not run, compiled! no other parameters should given. jsp run, server specific trait. nowadays there other means maven plugins whatever.

Finding Top level parent of each row of a table [SQL Server 2008] -

i have following 2 tables table person id name 1 2 b 3 c 4 d 5 e table relationhierarchy parentid childid 2 1 3 2 4 3 this form tree structure d | c | b | parentid , childid foreign keys of id column of person table i need write sql can fetch me top level parent i-e root of each person. following cte can each. converted function , ran each row of person. have got 3k rows in person table , takes 10 secs that. can suggest approach can take less. problem function runs following cte runs 3k times declare @childid int set @childid = 1 --chield search ;with rcte ( select *, 1 lvl relationhierarchy childid = @childid union select rh.*, lvl+1 lvl dbo.relationhierarchy rh inner join rcte rc on rh.childid = rc.parentid ) select top 1 id, name rcte r inner join dbo.person p on p.id = r.parentid order lvl desc i have updated answer in original questio...

rstudio - Package error when running r code on command line -

i have code run includes part: if (!require("yaml")) { install.packages("yaml") library("yaml") } when run in rstudio, runs seamlessly , there no bugs. however, when try running code on command line, error: $ rscript.exe file.r loading required package: yaml installing package(s) ‘/usr/lib/r/site-library’ (as ‘lib’ unspecified) error in contrib.url(repos, type) : trying use cran without setting mirror calls: install.packages -> grep -> contrib.url in addition: warning message: in library(package, lib.loc = lib.loc, character.only = true, logical.return = true, : there no package called ‘yaml’ execution halted rstudio sets default repository when call install.packages within rstudio. when run script via command line, have tell r repository use (or set global default repository). you can fix problem telling r use favorite repository. for example, if want use rstudio's package repository, set repos="http://cran...

css - HTML dropdown options are wider than button -

firstly pretty not problem options having padding/margin/border i've set them have none. to see problem please go here: http://antemortem.thecomicseries.com/comics/last scrolling down bellow image html dropdown menu 'page 1' on it. clicking on there few other options, , right there maybe 15px of menu cannot understand. can't clicked on options, isn't supposed there , makes options width greater 180px it's set be. please note, have tested see if grey space appears on chrome , opera, , doesn't. leads me believe appears on firefox... to see code please inspect element easier investigate, if not can past html/css in. so want grey space gone, options no wider dropdown menu button itself. thanks! html: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <!-- last update: 23/05/2013 --> <meta http-equiv="content-type" content="text/html; charset=utf-8...

How do I forward/redirect all requests from HTTP to HTTPS in NancyFX SelfHost? -

i'm trying requests made to: http://<myserver>:1234 are redirected to: https://<myserver>:1234 i've tried using "this.requireshttps()" in modules, when hit url http://<myserver>:1234 , browser spins, , i'm guessing it's because didn't construct nancyhost http uri. can't add http uri nancyhost along https uri so: var host = new nancyhost(new uri("http://localhost:1234"), new uri("https://localhost:1234")); because i'll registration conflicts. any ideas? you cant have http , https listening on same port. change port https binding, , specify in requireshttps call.

c# - Passing out failure reason for a commonly failing method -

when throw exception, can put handy message in give more information why operation failed. obviously throwing exceptions on methods commonly die not practice. this article on msdn suggests both tryparse pattern , tester-doer pattern, neither of these patterns allow extract information why method failed. is there accepted pattern passing out of safely-failing method allows glean more data of reason failing? clearly public failurereason tryparsewithmessage(string s, out myclass myclass) or public bool tryparsewithmessage(string s, out myclass myclass, out failurereason failurereason) these seem little dirty normal case method succeed... my suggestion return tuple<statusmessage, myclass> . you'd do var result = parsewithstatus(data); if (result.item1 == statusmessage.success) return result.item2; else { // handle each statusmessage case failure. } or along lines ( switch instead of if/else , instance).

svn - Subversive Connector Discovery is not opening in Eclipse Kepler -

subversive connector discovery not opening in eclipse kepler 64 (ubuntu 13.04 64). so, i've installed svnkit 1.7.9 + jna library 3.4.0 connector directly http://eclipse.svnkit.com/1.7.x , connector not appearing in window >> preferences >> team >> svn >> svn connector (tab). when tried add new repository in "svn repository exploring" view, i'm getting this: svn: '0x00400006: validate repository location' operation finished error: selected svn connector library not available or cannot loaded. if selected native javahl connector, please check if binaries available or install , select pure java subversion connector plug-in connectors update site. if connectors installed can change selected 1 at: window->preferences->team->svn->svn connector. selected svn connector library not available or cannot loaded. if selected native javahl connector, please check if binaries available or install , select...

python - count repeated keys in a dict -

i have dict : newdict ={'category': 'failure', 'week': '1209', 'stat': 'tdc_ok', 'severitydue': '2_critic', 'category': 'failure', 'week': '1210', 'stat': 'tdc_nok', 'severitydue': '2_critic'} i want count stat key week , have tried : >>> counterdict = defaultdict(counter) >>> in newdict : counterdict[int(newdict['week'])][newdict['stat']]+=1 but result : [(1210, counter({'tdc_nok': 12}))] i don't understand why 12 , why last week? how can please? you loop on dictionary keys, count same keys many times. there nothing dynamic loop body: counterdict[int(newdict['week'])][newdict['stat']]+=1 if have 12 keys in dictionary, above line executed 12 times. if expected see loop access multiple keys same name, misunderstood how dictionaries work. dictionaries...

firefox bug in background-size, with hover and opacity -

i think found strange bug in firefox. when have hover class on div background-size property (with change in opacity) size of of image use in background, changes 1 pixel in horizontal, or in vertical. i made example of probleme here: http://jsfiddle.net/xz4f8/ the html: <div class="group cont_tutto"> <div class="conteiner_articoli_cinema"> <div class="back_navigazione_articoli-mag"> <div class="articolo_mag"> <div class="tipo-articoli-mag">speciale cinema</div> <a href="http://www.google.it"> <div class="articolo_mag_cover" style="background-image:url('http://pu2.everyeye.it/public/immagini/16072013/now-you-see-me--i-maghi-del-crimine_articolo.jpg')"></div> </a> <div class="mag_titolo"> <h2><a href="/pc/articoli/stealth-bastard-deluxe_recensione_184...

overflow - How to set CSS properties so <td> can wrap with white-space but have a certain height? -

i have table fixed layout. columns set 25% wide (four columns) , rows set 20% in height (5 rows). have text larger side , overflowing next row. have set overflow: hidden, doesn't seem apply <td> . if white-space: nowrap doesn't take advantage of 20% height set cell, takes 1 line. how can work around text wrapped, cut off @ 20% height? thanks! table cells difficult style. usual solution wrap contents in div, so <td> original contents </td> becomes <td> <div> original contents </div> </td> and apply styles had td div .

asp.net - Can a Webpage loading in a browser change that browser's settings? -

i developing asp.net website, want browser, user browsing from, have settings enabled user surf site. 1) can webpage detect if settings enabled in browser? 2) if not, can website (through javascript or mechanism) change settings automatically? will appreciate if can respond 3 browsers: ie, chrome , firefox. depends on settings checking far if they're set or not. being able change settings though, no can not that. here example of of settings can detect , test http://www.cyscape.com/showbrow.asp

javascript - Thunderbird Extension: Get the mail HTML and Object -

how can mail html (i mean body) , object on thunderbird extension? intention automatically _post elements webpage. thank's valerio http://mdn.beonex.com/en/extensions/thunderbird/howtos/common_thunderbird_use_cases/view_message.html has examples. either render email first, , use that, or raw contents of message (you don't want that).

javascript - Cannot figure out what I am doing wrong with add friend button -

so trying figure out how make add friend button. using node.js route post jade view engine showing input button in form add contact button. using jquery change button name add contact contact requested on click, , added value addcontact: boolean type mongoose user schema. here node.js app.js file: app.post('/addcontact', user.addcontactpost); here node.js route file: exports.addcontactpost = function(req, res, err) { user.findbyidandupdate(req.signedcookies.userid,{ addcontact: req.body.addcontact }, function(err) { if(err) { console.log("post2"); return res.render('addcontacterror', {title: 'weblio'}); } }); }; here jade file: extends layout block content div legend search results div#userresults user in ufirstname a(href='/user/#{user.id}') p #{user.firstname} #{user.la...

How to change lightswitch logo without Sharepoint -

Image
how change logo and/or theme when using lightswitch without sharepoint, using visual studio 2012? properties/general properties tab not have logo selection if using sharepoint. has application version , default language. you under edit client properties on general properties tab: then see icon/theme:

google apps script - Get value of textbox in a table (GAS) -

i know discussed sooo many times, can't value of textbox placed in table. know how value of textbox (e.parameter.textboxname), it's working without problems. the difference have gadget containing 5 tabs, each intro text , table. each table contains approximately 30 rows, each 2 textboxes , button submit value of 2 textboxes in specific row spreadsheet. working fine, names (and ids well) unique, problem when submit textboxes, "undefined" (in spreadsheet). i guess problem lays somewhere in complexity of script, this: function buttonclick(e) { var app = uiapp.getactiveapplication(); var thevalue = e.parameter.textboxname; ...something... } ..is not enough define textbox is. i'm getting button id without problem with var buttid = new string(e.parameter.source); i'm trying head around couple of days without results. i'm not gas , i'm out when comes objective programming. have ideas how value? can id of table if helps, use then? ...

Creating X numbers of Applications and Application Pools in iis using a batch script -

i have batch file allow me create application , application pool in iis. works, creates 1 application , application pool. this current script: @echo on setlocal enabledelayedexpansion rem "content source path" set arg1=%1 rem "content destination path" set arg2=%2 rem "apps setup" set arg3=%3 rem split virt names , loop through it. /f "tokens=1* delims=," %%a in (%arg3%) ( set vir=%%a set pool=!vir!!poolname! rem create application %systemroot%\system32\inetsrv\appcmd add app /site.name:"default web site" /path:/!vir! /physicalpath:"%arg2%" rem create app pool %systemroot%\system32\inetsrv\appcmd add apppool /name:!pool! /managedpipelinemode:integrated /processmodel.identitytype:applicationpoolidentity /enable32bitapponwin64:false rem assign app pool application %systemroot%\system32\inetsrv\appcmd set app /app.name:"default web site/!vir!" /applicationpool:!pool! ...

java - How should I unit-test a long function? -

if have long method of code gathers data 2 or 3 difference sources , returns result. how can refactor more unit-testable? method webservice , want make 1 call client code gather data. i can refactor portions out smaller methods more testable. current method still calling 5 methods , remain less testable. assuming java programming language, there pattern making such code testable? this common testing problem, , common solution come across separate sourcing of data code uses data using dependency injection. not supports testing, strategy when working external data sources (good segregation of responsibilities, isolates integration point, promotes code reuse being reasons this). the changes need make go like: for each data source, create interface define how data source accessed, , factor out code returns data separate class implements this. dependency inject data source class containing 'long' function. for unit testing, inject mock implementation of each d...

objective c - 'Not key value coding-compliant' error from deleted xib -

in project have contentviewcontroller class used xib layout. however, later decided delete xib , programatically insert subviews. when deleted 1 of subviews had been present, got: "terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ setvalue:forundefinedkey:]: class not key value coding-compliant key infoview.'" from research know sort of error due linkage issues between class , xib. checked make sure no class in workspace references infoview, that's not issue. how can unlink contentviewcontroller xib when xib no longer exists? in advance! sometimes there issues nib file being deleted inside app, safe way resolve implement loadview , custom view creation there prevent superclass trying load nib.

c - Floating Point Square Root Reciprocal Method Correct Rounding -

i have implemented 32-bit ieee-754 floating point square root using newton-raphson method (in assembly) based upon finding reciprocal of square root. using round-to-nearest rounding method. square root method accepts normalized values , zeros, no denormalized values or special values (nan, inf, etc.) i wondering how can achieve correct rounding (with assembly instructions) results correct (to ieee-754) inputs? basically, know how test if results correct, want adjust algorithm below obtain correctly rounded results. instructions should add algorithm? see: determining floating point square root more information thank you! why not square result, , if it's not equal input, add or subtract (depending on sign of difference) least significant bit, square, , check whether have given better result? better here mean less absolute difference. case tricky when "crossing" √2 mantissa, checked once , all. edit i realize above answer insufficient. squaring in ...

C#, WPF - Animate item removed from listbox -

this question has answer here: how can implement fading in , out of added/removed listitems 6 answers got xaml code animating when adding item listbox - works great: <window.resources> <style targettype="{x:type listboxitem}"> <style.triggers> <eventtrigger routedevent="loaded"> <eventtrigger.actions> <beginstoryboard> <storyboard> <doubleanimation storyboard.targetproperty="opacity" from="0" to="1" duration="0:0:2"> </doubleanimation> </storyboard> </beginstoryboard> </eventtrigger.actions> </eventtrigger> </s...

javascript - how to break the long word in html? -

i'm creating list dynamically in javascript. want break long word in dot dot dot(.....). example, if word "software life cycle development" want change "software life cycl....". and used "word-break:break-all;white-space:normal;" current output is: software life cycle development. can tell, how fix this? in advance. var parent = document.getelementbyid('searchlistview'); var listitem = document.createelement('li'); listitem.setattribute('id', 'listitem_' + listid); listitem.setattribute('data-icon', 'false'); listitem.innerhtml = "<img src=" + imagesrc + " class='ui-li-icon ui-li-has-icon'></img> <a target='_black' data-role='button' href='#' id=" + listid + " name= " + url + " data-theme ='c' rel='external' data-inline='true' style='margin-left:0em; word-break:break-all;white-spac...