Posts

Showing posts from August, 2011

python - How to merge notifications with a common title in pynotify? -

how can tell pynotify.notification object merge has same title? (per discussion:) setting append hint on notifications ( set_hint_string('append', '') ) tells notification daemon should merge notifications app when have same titles.

jquery - How do I convert a javascript string to HTML to be displayed in a form? -

ok know there has way this, can't find out how anywhere. newb jquery , javascript, sorry if dumb question. calling cfc (coldfusion) jquery , returning html. problem is, when return data, in form of javascript string , being displayed plain text on page, instead of being processed html. there function, or way convert string html? this how write html inside of jquery element: $('#id_of_element_to_put_html_inside').html(your_javascript_string);

asp.net - In a .Net web site, what are my options for sending email alerts when folder contents change? -

i don't know .net environment, first idea write console app scans folder new content, , emails alerts out. put .exe scheduled task on server, executing every few minutes. seems pretty archaic me though. there more elegant way website? no matter type of application choose way notifications folder changes in .net through filesystemwatcher class. approach create windows service run in background , listen notifications.

java - Is there Swing component that will automatically format XML? -

i looking java swing component, automatically format messy xml (in 1 line, see example): <person><name>joe</name><surname>black</surname></person> etc. etc. its not nice see billion lines long line :) , hope there component, that'll dirty work me. thankx edit: xml input plain string database, there no real xml doc me :( you don't need rely on swing component formatting. can try pretty printing xml , set formatted output directly in component. has been asked before .

javascript - Scroll to bottom of page, only if the user already was at the bottom before DOM manipulation -

i'd learn how use window.scrollto . here's desired behavior: determine if user scrolled bottom of page, or no scroll bar visible then want grow div, working if #1 true, use window.scrollto scroll bottom of page after div has grown changed window height. ideas? working han's idea, can detect whether window scrolled bottom this: $('button').click(function(){ var shouldscroll = $(document).scrolltop() + $(window).height() === $(document).height(); $('<div>added content</div>').appendto('body'); if(shouldscroll) { $(window).scrolltop(document.body.scrollheight); } }); updated jsfiddle here: http://jsfiddle.net/jameskovacs/nqntc/1/

iphone - Using UIWebView to load web images? -

is possible download images inside uiwebview , load uiimage? allow user grab email web site , load app. guess manual way right let user download image photo album , can allow person load accessing photo album. i'm trying make bit more smooth if can shed light on great. thanks! you can't save images downloaded in uiwebview unless in base64 format. actually thing can catching source code of page using javascript , save string. (that's why images should in base64 format).

How do I return the cat_name value instead of array with PHP? -

i did digging , understand array means there multiple values coming query. post found print_r see values. how return 1 of values though? this: <?php $category = get_the_category(); $parent = get_cat_name($category[0]->category_parent); $cat_name = get_the_category($category[cat_name]); echo 'category' . $category . '<br />'; echo 'parent: ' . $parent . '<br />'; echo 'cat name: ' . $cat_name . '<br />'; print_r ($cat_name); ?> returns this: categoryarray parent: location cat name: array array ( [0] => stdclass object ( [term_id] => 11 [name] => nashville [slug] => nashville [term_group] => 0 [term_taxonomy_id] => 11 [taxonomy] => category [description] => [parent] => 8 [count] => 1 [object_id] => 20 [cat_id] => 11 [category_count] => 1 [category_description] => [cat_

javascript - Adding/Subtracting days from a date doesn't change the year/month correctly -

if have date 2011-01-02 , subtract 7 days date should give me 2010-12-26 , instead gives me 2011-01-26 ? see js below verify link: var date = new date('2011','01','02'); alert('the original date '+date); var newdate = new date(date); newdate = newdate.setdate(newdate.getdate() - 7); var nd = new date(newdate); alert('the new date '+nd); http://jsbin.com/upeyu/6 i think meant this: (working perfectly) var date = new date('2011','01','02'); alert('the original date '+date); var newdate = new date(date); newdate.setdate(newdate.getdate() - 7); var nd = new date(newdate); alert('the new date '+nd); jsfiddle example

python - how do I insert a cookie into a urllib2 openerdirector object? -

is there way append cookie made , used openerdirector object? try this: import urllib2 import cookielib # load cookies file saved_cookies = cookielib.mozillacookiejar('cookie_file_name') saved_cookies.load() opener = urllib2.build_opener() # opener director # something... opener.add_handler(urllib2.httpcookieprocessor(saved_cookies)) edit: according python cookielib document , old cookies kept unless overwritten newly loaded ones.

Connecting a Microsoft Access Database to Java using JDBC and compiling -

for school database project making database program (user gui , database). using microsoft access 2010 created database , populated sample data, , saved in .mdb format , placed in project folder. when running in eclipse following code works fine, connects , retrieves query. find unable export code jar , run (which required project, give them working copy of program on cd or flash drive), , i'm unable port code on netbeans have work, trying compile on linux machine. i assume problem including drivers or trying use microsoft access. error when running jar or running on netbeans given below code. ask either how include drivers make program portable, or how else can approach problem? thanks in advance import java.sql.*; public class jdbctest { static connection connection; static statement statement; public static void main(string args[]){ try { class.forname("sun.jdbc.odbc.jdbcodbcdriver").newinstance(); string datab

mysql - how to start php? -

i asp.net developer , want learn php software need run compile php file ? how install software path should set ? kind of database needs store data , retrieve date ? see me beginner , give idea / information .......... thanxx straight horses mouth. getting started . need php interpreter, if have access webhost has php installed you're half way there, if have linux partition you're half way there, otherwise check out xampp.

performance - Slow MySQL Updates/Inserts/Deletes -

i seem having slow inserts, updates , deletes on tables on specific database mysql. not lot of data in tables (from 2k 20k). small number of columns (5-10), indexes (two of them), , no duplicate index issue. i'm running mysql 5.0.45 myisam. i run following query , takes 5-7 seconds: update accounts set updated_at = '2010-10-09 11:22:53' id = 8; selects seem come right away. explain gives me following: +----+-------------+----------+-------+---------------+---------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | | +----+-------------+----------+-------+---------------+---------+---------+------+------+-------------+ | 1 | simple | accounts | index | null | primary | 4 | null | 1841 | using index | +----+-------------+----------+-------+---------------+---------+---------+------+------+-------------+ the profiler doesn't show significant data other

php - Fatal error: Call to undefined function site_url() -

i using codeigniter framework php. have created view named "login.php". once i created view, loaded view inside of function named "index" located inside class named "cci" extends controller keep receiving error: fatal error: call undefined function site_url() in c:\wamp\www\finalp_cci_clone\system \application\views\login.php on line 12. don't understand issue having because the welcome page loads fine , second function inside of "cci" class loads fine well. here of code: controller files: function cci() { parent::controller(); } function index() { $this->load->view('login'); } function test() { echo "testing data"; } } /* end of file login.php / / location: ./system/application/controllers/cci.php */ class welcome extends controller { function welcome() { parent::controller(); } function index() { $this->load->view('welcome_message'); } function t

rails 3 - Securing an app with SSL -

i have rails 3 app hosted on heroku contains sensitive data why want implement ssl. info learned google searching doesn't match use case want ssl entire site. i'd understanding following. is there simple way force app requests use ssl? want landing page have ssl landing page has sign in form. seems it'd lot simpler ssl select ssl on per page basis. being said, need gem this? thank you this article should you.

c# - Using Late-Binding to Automate Word is throwing a MissingMemberException -

i trying access information running microsoft word application using following code.. object appclass = marshal.getactiveobject("word.application"); object documents = appclass.gettype().getproperty("documents"); object count = documents.gettype().invokemember("count", bindingflags.getproperty, null, documents, null); when run code tells me that count not found , has thrown missingmemberexception. can tell me doing wrong? you didn't reference documents object, getproperty returns propertyinfo. fix: object appclass = marshal.getactiveobject("word.application"); object documents = appclass.gettype().invokemember("documents", bindingflags.getproperty, null, appclass, null); object count = documents.gettype().invokemember("count", bindingflags.getproperty, null, documents, null); adding reference microsoft.office.word.interop can make lot less painful.

vBulletin redirect after login -

facts: - main site on www.domain.com - vbulletin installed on forum.domain.com - vbulletin authentication integrated in main site (no problems here) question: how can redirect user url www subdomain upon authentication? extra info: using "url" field in login form, works urls relative forum root (i.e. can set "forum.php?...", if set "http://some_domain/" ignored , user redirected forum home after authentication). thanks, puiu

connect to Oracle db with JDBC driver. How set charSet? -

i need connect oracle database use jdbc driver. on structure url string connect , not see, xan set charset connect. me please. you shouldn't need set character set. java uses unicode internally , data database should converted database character set utf-16 jdbc driver.

encoding - How many bytes do we need to store an arabic character -

i'm little confused storage needed representing arabic character. please let me know if true: in iso/iec 8859-6 encoding takes 2 bytes (http://en.wikipedia.org/wiki/iso/iec_8859-6) in unicode takes 4 bytes (http://en.wikipedia.org/wiki/arabic_unicode) what advantages of each encoding? when should prefer 1 on one? well first, unicode not encoding. standard assigning code points every character in every language. these code points integers; how many bytes take depends on specific encoding. common unicode encodings utf-8 , utf-16. to summarise: iso 8859-6 uses 1 byte each arabic character, doesn't support "arabic presentation forms", nor characters other script ascii. utf-8 uses 2 bytes each arabic character, , 3 bytes "arabic presentation forms". utf-16 uses 2 bytes each arabic character, including "arabic presentation forms". i use 2 examples: 'Ø­' (u+062d) , 'ï»°' (u+fef0). numbers hexadecimal codes repr

displaying custom error pages in asp.net mvc 2.0 on production site -

i have developed production site in godaddy server.now want display custom error page if there error occurs in site.i have made following changes in web.config file , <customerrors mode="on" defaultredirect="/areas/user/views/shared/error"> <error statuscode="403" redirect="noaccess.htm" /> <error statuscode="404" redirect="/areas/user/views/shared/error" /> </customerrors> but if error occurs server display default error page 404 page. now want display customised error page.please tell me entire steps implement in asp.net mvc 2.0.i,e there coding have write in controllers or in global.asax. thanks in advance, this line indicates when page not found redirect error.aspx, can create view inside share folder , design desire , change url example, create page mycustomerrorpage.aspx inside shared folder, change redirect page to <error statuscode="404&q

Android linearLayout problem -

this first post here, stuck linearlayout, have linearlayout(horizontal) 3 buttons in of set third button layout_weight=1 takes whole space in linearlayout pretty working properly. but when put layout in horizontalscrollview weight property doesnt works me, want display 2 button horizontally on whole screen width , when scrolled third button should appear taking whole width of screen hiding both buttons not happening. regard's saurabh agnihotri you cant horizontal scroll view. can 1 thing.. take view flipper , take 2 layout in it. in 1 layout there 2 buttons giving weight 1. , in second layout put button , give width fill_parent. use gesture listener move view flippers layouts. horizontal scroll view.

c# - Handle flash button using WatiN -

i using watin browser automation. cool. today ended in problem need call flash object (uploadify button) in asp.net page. this code seems working fine, doesn't show actions element ele = window.element(find.byid("uploadifyuploader")); ele.click(); is there way achive in watin.? i wrong, think firing ele.click() results in clicking on <object/> element, not button. content of <object/> element application. have flash object there, be, example, java applet. clicking on button similar clicking button on different application - have automate windows, not ie, kind of api calls needed, findwindowex or sendmessage etc. think using watin.core.native.windows namespace little bit helpful, insufficient. have use extern methods user32.dll . instead of this, use kind of library windows automation. heard autoit good, didn't use it. small tasks prefer deal native calls. additionally, winspy++ helpful finding windows prop

c++ - Doing multiple tasks at once? (combining a GUI related function to carryout some process) -

i'm sorry if title sounds "off", elaborate further, problem - i've written simple winsock server passes information (text messages) between connected clients (this console application). program i've tried combining i've learned win32api client program . getting little ahead of self went ahead , wrote basic ui don't know how combine two?. understand ( :| ) console application running top-bottom sequentially while ui continuously drawing window on screen , waiting happen. point, how combine these too??. i'm quite put off this. a gui works through event-driven message-loop. message-loop dispatches incoming events function-calls. if press button, function called, can call instance network send -function. if need send (or receive) large amounts of data, should create separate thread , message-loop network stuff, gui stays responsive.

java ee - JPA and order of columns in the database -

i'm using eclipselink persistence provider. there way specify order in columns appear in database? column-order in database doesn't match attribute-order in entities. far i've understood hibernate order columns alphabetically can't find specifications eclipselink. eclipselink sorts mappings , columns based on weight of mapping. weight not set other ensure baisc mappings first, , relationship mappings second. you can set weight mapping if desire using descriptorcustomizer. set descriptor not order mapping weight, order specified used (setshouldordermappings(false)). public void mycustomizer implements descriptorcustomizer { public void customize(classdescriptor descriptor) { descriptor.getmappingforattributename("name").setweight(2); } } there have been recent changes weighting of mappings in 2.2 development, mappings sorted name within same weight levels.

c# - Webservice initialisation issue -

i have simple web service. when call test method first time takes 5 seconds respond , thereafter takes less time fine. but if application stays idel 5 mins , when call same method again takes same amount of time took before respond. how can make faster ? i tried setting keepalive = true , pre compiling , deploying, still no luck localhost.webservice1 svc = new websvctest.localhost.webservice1(); private void button1_click(object sender, eventargs e) { stopwatch stopwatch = new stopwatch(); stopwatch.start(); string returnval = svc.helloworld(); stopwatch.stop(); timespan ts = stopwatch.elapsed; // format , display timespan value. string elapsedtime = string.format("{0:00}:{1:00}:{2:00}.{3:00}", ts.hours, ts.minutes, ts.seconds, ts.milliseconds / 10); messagebox.show(elapsedtime); } problem iis processmodel id

c# - UserControl always on top (topmost, XAML/WPF) -

i'm using wpf notifyicon philipp sumi . has ability use wpf usercontrol popup in tray icon. works nice, in 1 situation have popup application shown on top of popup. want popup on top. can done? can influence z-order of usercontrol? edit - reaction comments: realize question looks stupid, because other app finds information important, , thinks should on top. in case, that's not situation. i'm connecting external app. purpose of app load data external device. when app finished, says "loading finished" in popup. app process data. when app completes processing (almost immediately), shows box: "completed processing, click here show data". so: in specific case information popup more useful user, because contains button has click. both popups "talk" same data. understand may raise more comment's like: "why use popup?". please focus on answer question, not alternative solutions. well, there no such makemythingsupertopmos

An ideal set of documentation for a bigger project -

if assignment work on 2 years old project 200k lines of code, sufficient 1 pesky 10 packages 3 components uml diagram , 2 pages of documentation? what think ideal amount of documentation startet reasonably fast, or there advice me me comprehension of virtualy undocumented project classes spanning 5k lines. thank answers. you have sympathies :) think more general issue of "how understand new appplication" make great community wiki question start reading source. 200k lines isn't huge. take quick read on source. isn't attempt learn everything, idea of structure, key things mentioned, naming schemes , on. idea come out idea of things are, can go , have more detailed rummage when proves necessary. i asked once when reading code in similar situation doing. interesting question , had think answer. in case, aim idea of key flows of application, , key data structures , how managed , changed. do know application or supposed do? work? has been released?

svn - nightly build Script for SubVersion -

i have prepared solution multiple projects netbeans ide versioned under linux subversion. i prepare script automatize nightly build creation: - checkout latest version svn - compile multiple projects - choose subset of files (libraries, headers, etc...) - tar.gz them - commit tar.gz svn some suggestions? in advance ciao andrea the google phrase continous integration. for java can start checking out cruisecontrol . can configure run both nightly builds , continous integration (on every checking in svn). actual build script written in ant or similar.

c# - How do I programatically change the layout of a Word 2010 document? -

we have application reads word documents , imports them our file format. a recent bug found page count available in page layout view, word 2010 defaults web layout. using .net c# how can change view give page count? i believe property looking document.activewindow.view.type = wdprintview; can read more in on msdn .

visual studio - Pass a parameter from Main Report to a Subreport -

apologies these recent newbie questions, i'm not asking search engines correct questions. i have report i'm trying reconstruct after upgrading vs2008 vs2010 introduced errors existing crystal report. so, have semi-working report i'm trying duplicate. i have report containing subreports. main report has parameters in queries within "database fields" , need pass fields particular subreport's "parameter fields" can reference parameters in own queries. so, question is: how create association between query result on main report , parameter on subreport? for crystal reports visual studio 2010 - that's 1 works currently, isn't it? when adding sub-report [or changing "change subreport links" existing report] can select parameter on subreport drop-down on bottom left of 'links' tab (or subreport links dialog, if editing existing subreport) once you've selected field (or parameter) on left in 'availabl

hibernate - specify db password in ant build file -

my webapp has hibernate config file specifies db password follows: <property name="hibernate.connection.password">p1ssw2rd</property> has ant build file, possible specify db password @ build time , pass hibernate? <target name="init-development"> <property name="databasepassword" value="xxxx"/> </target> you can create template hibernate config password label this: <property name="hibernate.connection.password">@@hiber_password@@</property> and when ant starts build, copy template config on real hibernate config, applying replacement password label real db password specified in build.xml. that: <copy file="${src.dir}/hibernate-config.xml.tpl" tofile="${src.dir}/hibernate-config.xml"> <filterchain> <replacetokens> <token key="@@hiber_password@@"

iphone - Do something to selected image in scroll view -

i try make following: horizontal list of images, can select , it. example flip image around x axis. know how rotate image. created scrollview , load images. added event handler when tap on image. don't know how tapped image. how code method tapped image? - (void)viewdidload { [super viewdidload]; img1 = [uiimage imagenamed:@"imgtest.jpg"]; img2 = [uiimage imagenamed:@"imgtest2.jpg"]; arrayofimages = [[nsmutablearray alloc] init]; [arrayofimages addobject:img1]; [arrayofimages addobject:img2]; [arrayofimages addobject:img1]; [arrayofimages addobject:img2]; scrollview = [[uiscrollview alloc] init]; scrollview.scrollenabled = yes; scrollview.pagingenabled = yes; scrollview.directionallockenabled = yes; scrollview.showsverticalscrollindicator = no; scrollview.showshorizontalscrollindicator = no; scrollview.delegate = self; scrollview.backgroundcolor = [uicolor bluecolor]; scrollview

asp.net mvc 2 - how to implement a partial view with generic type inference -

i working through this sample , came across problem. implement pagination, sample extends list , adds pagination it. list used model. in view want add pagination control. in sample add page want make user control because plan implement pagination in multiple pages. off course has typed view since can't use wildcards in c# can not implement this: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol<paginatedlist<?>>" %> since plan use members declared in paginatedlist , not in list don't need type. in c# method solve problem type inference how don in partial view? define interface containing pagination properties want use in partial view. have paginatedlist<t> class implement interface. have partial view typed interface. public interface ipaginated { int pageindex { get; } int pagesize { get; } int totalcount { get; } int totalpages { get; } } public class paginatedlist<

grammar - ANTLR on a noisy data stream Part 2 -

Image
following interesing discussion bart kiers on parsing noisy datastream antlr , i'm ending problem... the aim still same : extracting useful information following grammar, verb : 'sleeping' | 'walking'; subject : 'cat'|'dog'|'bird'; indirect_object : 'car'| 'sofa'; : . {skip();}; parse : sentenceparts+ eof ; sentenceparts : subject verb indirect_object ; a sentence it's 10pm , lazy cat sleeping heavily on sofa in front of tv. produce following this perfect , it's doing want.. big sentence, i'm extracting words had sense me.... the, founded following error. if somewhere in text i'm introducing word begin token, i'm ending mismathedtokenexception or noviableexception it's 10pm , lazy cat sleeping heavily, doggy bag, on sofa in front of tv. produce error : doggy interpreted beginning dog part of token subject ,

python - Extracting Date and Time info from a string. -

i have database full of data, including date , time string, e.g. tue, 21 sep 2010 14:16:17 +0000 what able extract various documents (records) database based on time contained within date string, tue, 21 sep 2010 14:16:17 +0000 . from above date string, how use python , regex extract documents have time 15:00:00 ? i'm using mongodb way, in conjunction python. you can use $where : db.collection.find({$where: "var d = new date(this.dateproperty); return d.getutchours() == 15 && d.getutcminutes() == 0 && d.getutcseconds() == 0"}) or regular expression: db.collection.find({dateproperty: /.*15:00.*/}) the second can bit faster first both relatively slow. speedup things store dates in built-in date format. if need query on datetime components consider adding indexable date representation such {y:2010,m:9,d:21,h:14,i:16,s:17} (properties depend on query needs, if need query hour have {h:14} ). can have index per each component.

javascript - Jquery - Get element by id constructing the id in string -

i have trouble using element jquery. constructing name in var such as: var myid = "#" + mygotid; $(myid).attr("title", "changed"); $(myid) returning empty. want element id constructing id dynamically joining strings. edit @pointy — additional code supplied in comment op: var form = $('form#formdefaultvalue'); $(':submit', form).click(function(event) { event.preventdefault(); $.post(form.attr('action'), form.serialize(), function(data, status, xmlhttprequest) { if (status == 'success') { $("#msginformation").html("your changes have been saved."); jquery("#spandefaultvalue").attr("class", "db"); var g = indexnodeselected; g = g.replace("\\", "\\\\\\\\"); $('#'+ g).find("span").attr("class", ""); } i don't know happening because have not posted code, mak

using list with python multiprocessing -

can me out sharing list between multiple python processes. problem self.id_list , self.mps_in_process working in following code. import time, random multiprocessing import process #, manager, array, queue class mp_stuff(): def __init__(self, parent, id): time.sleep(1 + random.random()*10) # simulate data processing parent.killmp(id) class paramhandler(): def dofirstmp(self, ids): self.mps_in_process = [] self.id_list = ids id = self.id_list.pop(0) p = process(target=mp_stuff, args=(self, id)) self.mps_in_process.append(id) p.start() def domp(self): tmp in range(3): # nr of concurrent processes if len(self.id_list) > 0: id = self.id_list.pop(0) p = process(target=mp_stuff, args=(self, id)) self.mps_in_process.append(id) p.start() def killmp(self, kill_id): self.mps_in_process.remove(kill_id) self.

gwt2 - With GWT, is there a way to not load widgets declared in uibinder xml files? -

one common design have gwt create widget contains 2 children: , b. i declare these 2 widgets , b in uibinder file associated main widget. what want load or not widget depending on if statement. ideal approach set provided=true widget , set widget null when want not load widget. gwt throws error. is there way declare widgets in uibinder , not loading them ? thanks edit: after lot of discussions, ideal approach declared field "provided=true" , "optional=true" when optional=true, createandbindui must not throw exception if field null. clean approach. if think feature must exists in gwt, please star issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=5699 edit 2 : using lazypanel described thomas seems better way handle this. i stumbled on gwt issue, led me here, here's take on it, 20 months later. use lazypanel , set visible="false" it's content not built until need (simply call setvisible(true) reveal

version control - Git / Gitosis - Repository Read Access Denied -

i have installed git on ubuntu server. local machine using tortoisegit have cloned gitosis-admin local machine. worked fine. after checking out gitosis-admin repository manage keys , repositories in gitosis.conf, added new repository gittest .conf file. fallowing steps failed: create new folder on local manchine named gittest added testfile committed push local repository server client says: "error:gitosis.serve.main:repository read access denied" this error appears if init repository on server using "git init" in new created folder @ /srv/git/repositories/gittest, add file repository clone isn't empty, try clone local machine. can solve error? try running git init --bare in /srv/git/repositories/gittest instead of git init .

iphone - nstimer stop when touch the screen -

i have timer class, nstimer inside, push notification uitableviewcontroller, , notification object(value of timer) affected in uitableviewcell. problem when touch screen scroll, timer stop, nstimer don't start in other thread? how can fix problem. my timerclass #import "timeretape.h" #import "fonctionutile.h" #import "mission.h" static timeretape *sngtimeretape = nil; @implementation timeretape @synthesize repeatingtimeretape; @synthesize datecomp; @synthesize questioncircuit; @synthesize b_pause; +(timeretape *) singletontimer { @synchronized(self){ if (sngtimeretape == nil ) { sngtimeretape = [[timeretape alloc]init]; } } return sngtimeretape; } -(id)init { self = [super init]; if (self != nil) { datecomp = [[nsdatecomponents alloc] init]; b_pause = false; } return self; } - (void)starttimer { [repeatingtimeretape invalidate]; nsstring * temps;

perl - Is a plain-text password in a CGI script a security hole? -

i've read things can go wrong web server may lead display of php scripts plain text files in web browser; consequently i've moved of php scripts directory outside web root. i've been wondering whether same happen cgi scripts in cgi-bin. my main concern 1 script contains user name , password mysql database. if possible security hole (at least far database content concerned), there way of putting sensitive data in different location , getting there (like saving in file in different directory , reading file, example)? scripts written in perl btw. i've read things can go wrong web server may lead display of php scripts plain text files in web browser; consequently i've moved of php scripts directory outside web root. i've been wondering whether same happen cgi scripts in cgi-bin. yes. if goes wrong causes programs served instead of executed, of content exposed. same issue php (except given way cgi-bin directories configured (i.e. aliased directo

windows vista - Appcelerator Titanium crashing too frequently? -

i started using appcelerator titanium promising platform native desktop , mobile app development without sandbox (not adobe air sandbox). after few days of development no reasons started crashing every time launch program on windows machine (with vista). found this post too. having similar experiences appcelerator titanium? yeah, i've had happen well. of files weren't getting copied build directories deleted them. of time worked fine rebuilds them every time run titanium. however, 1 day did @ 1 point , stopped working. did me. i had 1 or 2 other odd things happen causing issue this. think once created new project , copied files on :[ little sad. overall i'm still fan of product. can't imagine didn't work in android. must have have had multiple people having issue specific setup or configuration. possibly appcelerator didn't have enough data them research it?

Creating a Java project that uses myBatis and Sybase Database -

could please show me go decent tutorials setting ibatis using sybase database. there seems little information out there on , of uses mysql no good! oracle/sun has web page on connection info you'll need @ sybase jconnect driver configuration . you'll use same ibatis property names db. can jdbc driver, if don't have already, @ sybase . once connection set of tutorials should apply db. primary key generation db specific issue resolve.

Python: pygame.mixer.music and unicode filenames -

when try use pygame.mixer.music.open() filename string containing unicode characters, seems throw unicodeencodeerror time: file "c:\testplayer.py", line 43, in <module> pygame.mixer.music.load(x) unicodeencodeerror: 'ascii' codec can't encode characters in position 12-19: ordinal not in range(128) (lines broken viewing pleasure) i checked x's existance using os.path.exists(x), returned true. doing wrong? if not, possible manually fix pygame's mixer (which .pyd file)? i'm using python 2.6, , pygame 1.9.1. i forgot add file tried opening mp3 file, pygame's website/wiki states pygame.mixer.music should work those. in fact, does, long filename contains ascii characters. instead of passing filename, open file in unicode compatible way , pass file object pygame.mixer.music.load

c# - Separation of background/foreground layers in a scanned document -

i need automatically remove mildly colored background of scanned document image ocr. scantailor open source c++ gui-based app background separation among other things, cannot figure out how run last step removes background. ideally, find code , either: port part c# modify c++ respond command line execution, performing step on given image can me understand how can either? or know other libraries can this? (any language/platform acceptable) you referring thresholding, despeckling , noise removal techniques necessary in ocr applications. the quality of results depends many different factors - print quality of original scan quality image resolution background colours , patterns used. noise , other marks. you may find ievolution.net library @ http://www.hi-components.com/nievolution.asp useful. has many image processing functions play with. there many commercial engines available. there no 1 perfect function solve image processing problems. must adapt f

android - GPS emulator tracks -

i using android emulator ddms simulate movement using gpx file. there 1000 entries in gpx file. however, i'm finding onlocationchanged method being triggered few times during course of entire file. code follows... locationmanager locationmanager = (locationmanager) this.getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider, 1000, 1, mylistener); mylistener = new locationlistener(){ public void onlocationchanged(location location){ double mylat = location.getlatitude(); double mylon = location.getlongitude(); ... } ... } my understanding of requestlocationupdates being set 1000 should request location update every 1 second provided location more 1m away previous. correct? if so, why retrieving few of lat/lon pairs gpx file? wouldn't retrieving thousand? (the gps data running there constant motion.) i haven't had luck using emulator locations using gpx, kml, or ma

css - Placing an image from the sprite in the specific position -

let's have sprite lots of icons. want place 1 of icons in specific position on div, e.g. 15px right side , 20px top. previously, when had single image file used following code: background: white url(./imgs/some/icon.png) no-repeat 91% 47%; now image in sprite can access using background-position: 0 -471px; but see there no place add current 91% 47%. there kind of workaround? it's possible use css3 in project if helps. thanks! would able add <div> , give correct background, , absolute position needs be? i'm thinking background-position percentages out when use sprite sheet.

c# - Creating a dockable form that stays above the task bar -

i trying create news ticker , i'm looking best way create dockable form dock desktop, above task bar (the user can move dock 1 of sides or top of screen). best way in c#? check out article here . it's older article, since it's based off of shell programming, should still apply more recent versions of framework.

iphone - What should I watch to debug this Core-Data / NSFetchedResultsController bug? -

i've got bug in core data implementation cannot seem hold of, , need tips on should looking figure out how fix it. to make long story short, have uitableview being populated nsfetchedresultscontroller . want users able change sorting options data, give them picker change underlying fetchedresultscontroller different preset configurations. can change , forth between different fetchedresultscontrollers no issue whatsoever. can add , remove data, never experiencing crashes, no problem. however, on 2 (out of 6, , same 2) of fetchedresultcontroller configurations, items added database not added tableview. , items in tableview disappear once edited. here steps go through reproduce bug: set sorting configuration works add new item database (at point controllerwillchangecontent fires) change configuration doesn't work add new item database ( controllerwillchangecontent not fire) switch working configuration the item added visible in tableview switch non-working c

git reset --hard HEAD leaves untracked files behind -

when run git reset --hard head , it's supposed reset pristine version of pulled, understand it. unfortunately, leaves files lying around, git status shows big list of untracked files. how tell git "just bring in last pull, nothing more, nothing less"? you have use git clean -f -d rid of untracked files , directories in working copy.

asp.net - Converting Date string to DateTime Format vb.net -

i have example , gives me exception "conversion string x datetime invalid" here method validate datetime. example date string : "27/03/1985" public function validatedatecolumn(byref fieldname string) boolean try if isdate(fieldname) dim actualdate datetime = cdate(fieldname) dim dtlicexp datetime = cdate(actualdate.tostring("d", thread.currentthread.currentculture)) fieldname = dtlicexp.tostring("mm/dd/yyyy") return true end if catch ex exception 'fieldname &= "format must mm/dd/yyyy" return false end try end function any idea validate date string formate datetime. i want convert date "27/03/1985" datetime. i'm using asp.net vb.net. have @ using datetime.tryparseexact method or datetime.parseexact method

networking - How can a java application running on windows 7 choose which network adapter to use -

hi writing application device -- tablet -- running windows 7. application being written in java. application needs aware of networking adapter available (wifi, 3g, etc ...) there java library similar 1 developed android -- android.net, android.net.wifi, etc ... -- in brief, how can java application running on windows 7 choose network adapter use ? thank you! you can see network interfaces available using java.net.networkinterface.getnetworkinterfaces() . note: loopback interface present in list. however, appears way force system use particular network interfaces referring ip address particular network interface on. example, 4-arg socket constructor s take local address third argument (i linked one, other takes hostname first argument). datagramsocket has 2-arg constructor similar.

testing - Adoption of TDD on older Java application -

i've got problem , i'm asking help i've started working on web application, has no tests, based on spring 2.5 , hibernate 3.2, not modularized, classes having 5k lines, view technology there jsp used on place quite lot things duplicated (like many similar search forms few differencies not many shared parts). aplication works well, however, running fine, when there need add or change functionality, realy slow , not convenient. is there possibility employ tdd @ point? or recomend dont't think can develop forever way now, getting messier time. thanky answers. i start picking copy of michael feathers' book working legacy code - pure gold. once learn techniques refactoring , breaking apart application @ it's logical seams, can work on integrating tdd in newer modules/sprout classes , methods, etc. case in point, switched tdd approach ten year old application written in every version of our framework, , while we're still struggling pieces

objective c - NCSFDictionary, Mutating method sent to immutable object -

i have started jump realm of objective-c , getting all. have been working on unarchiving file nsmutablearray , initializing in model array. array filled various nsmutabledicationary's. have seen add dictionaries non-mutable, went ahead , copied regular , put them in mutable , remove old one. solution seems work every instance except first. i @ loss why work first. here how initializing all -(id) initwithlist:(nsmutablearray *)savedlist { self = [super init]; if (self) { int size=0; serverlist=[[nsmutablearray alloc] initwitharray:savedlist copyitems:yes]; size=[serverlist count]; for(int i=0;i<size;i++) { loginlist=[nsmutabledictionary dictionarywithdictionary:[serverlist objectatindex:i]]; [serverlist addobject:loginlist]; [serverlist removeobjectatindex:i]; } } return self; } here code throwing error, value being read off of checkbox in tableview , passed here c

.net - Problems capturing HTTP response -

i have code makes http request: //successful request var requestinbytes = encoding.getbytes(urlwithparameters.tostring()); httpwebrequest req = (httpwebrequest)webrequest.create(urlwithparameters.tostring()); req.method = "post"; req.contentlength = requestinbytes.length; req.contenttype = "application/x-www-form-urlencoded"; stream newstream = req.getrequeststream(); // send data. newstream.write(requestinbytes, 0, requestinbytes.length); newstream.close(); however, i'm having trouble capturing response. right now, i'm trying this: //no response? system.io.streamreader st = new streamreader(((httpwebresponse)req.getresponse()).getresponsestream()); var response = st.readline(); but coming blank response? try: httpwebresponse response = req

java - Design pattern / data loading solution -

i have been working on few projects involve loading data, remotely, local, json, xml. problem having due speed of development , changing minds of various clients finding designs rigid , them more flexable. have been trying think of reusable solution data loading, , advice imagine many of out there have had same problem. what create generic loadingoperation abstract class, has member variables of type parser , loader , have parse() , loaddata() methods respectivly. parser , loader classed interfaces , classes implement these xmlparser , jsonparser, localloader , remoteloader etc. like have new class extends loadingoperation each thing loaded, weather thats local xml file, or remote json, or whatever. the problem is specific parser implementation cannot return custom data types without breaking polymorphic behavior of loadingoperation class. have been messing around generics , declaring subclasses of loadingoperation class specificloader extends loadingoperation<cust

html - Opera bug overflow:hidden & position:absolute viewport-size -

i ran bug in opera (v10.63 on windows7) – not first time, don't see workaround time... i have container-div overflow:hidden. inside div second div (image-holder) position:absolute , image. -> part of image exceeds dimensions of container should hidden (i don't want image affect scrollbars) what opera gets wrong size of viewport: instead of using size of container calculate size of viewport, opera calculates using size of image-holder (-> scrollbars). — here's link site (image in bottom-left corner): http://lescaves.ch i found following article reporting bug (but not providing solution): http://www.greywyvern.com/code/opera/bugs/overflowpositioning — does have experience or knows fix/workaround? thanks, julian try adding position: fixed <img> tag (not #image selector).

sql - Performance problem with 8 Nested Stored Procedures -

i have performance problem need run stored procedure .net 1.1. stored procedure calls 8 stored procedures. each 1 of them process information throw comparative between old new informacion , anter afects physical table in database. the problem comes since try run directly ssms. servers starts crashing, getting slow , impossible work. think infrastructure people has restar service directly on server. i'm working in development enviroment there no problem, can't upload production enviroment. i've been thinking in use procedures comparison purposes , never affect physical data. retrive information them in temporary tables in principal procedure , open try-catch , begin-end transactions blocks , affect database in principal stored informacion in temp tables. my principal stored follows: best way can this?? create proc sptest as /*some processes here, temporary tables, etc...*/ begin try begin distributed transaction sp_nested1 sp_nested2 sp_nested3 sp_

c# - Filter XDocument more efficiently -

i filter high performance xml elements xml document. take instance xml file contacts: <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="asistentes.xslt"?> <contactlist evento="cena navidad 2010" empresa="company"> <contact type="1" id="1"> <name>name1</name> <email>xxxx@zzzz.es</email> <confirmado>si</confirmado> </contact> <contact type="1" id="2"> <name>name2</name> <email>xxxxxxxxx@zzzze.es</email> <confirmado>sin confirmar</confirmado> </contact> </contaclist> my current code filter xml document: using system; using system.xml.linq; class test { static void main() { string xml = @" xml above"; xdocument doc = xdocument.parse(xml); foreach (xelemen

iphone - multiple NSFetchRequestController's in the same view? -

is problem have multiple nsfetchrequestcontrollers on same view? have 4 tables in 1 view , need 4 controllers - have use tags differentiate between tables guess - curious best practice. i don't think there's wrong this. assuming data behind each of tables aren't closely related, you're going end 4 separate data structures anyway (to cache results of multiple fetches). 1 thing might useful having separate datasource each table, shared delegate . way, can handle view logic in shared delegate, example pushing new view controllers when cells selected. thought.

python - Sound shortened in PyGame -

i'm using ubuntu 10.4 , learning pygame following tutorial 'pummel chimp , win $$$'. i made 2 '.wav' files, when try play them, strange noise thud, short. i don't error message. why doesn't work expected? >>> import pygame >>> pygame.init() (6, 0) >>> def load_sound(name): class nonesound(object): def play(self): pass if not pygame.mixer: return nonesound() fullname = os.path.join('data', name) try: sound = pygame.mixer.sound(fullname) except pygame.error, message: print 'cannot load sound:', name raise systemexit, message return sound >>> whiff_sound = load_sound('whiff.wav') >>> whiff_sound.play() <channel object @ 0xb772f1c0> >>> here wav i'm using. (broken link) i had same problem sound, opened sound in program called wavepad sound editor , re-saved file .wav , set sample rate 2205

mysql - WordPress get specific posts in arbitrary order -

right now, i'm doing: $posts = get_posts(array('post_type' => 'page', 'post__in' => array(1, 3, 2, 9, 7))); and having 2 issues: post 3 of 'post_type' => 'post' , doesn't selected, want it! if leave out 'post_type' => 'page' , post 3 selected (because must assume 'post_type' => 'post'.). i want able order posts arbitrarily ids . if knew how use mysql, do: select * wp_posts id in (1, 3, 2, 9, 7) order find_in_set(id, '1,3,2,9,7'); but, how should wordpress ? first fetch posts arbitrarily ids , loop through posts you can in way:- $posts=$wpdb->get_results("select id $wpdb->posts id in (1, 3, 2, 9, 7) order find_in_set(id, '1,3,2,9,7')"); $count=count($posts); ($counter=0 ; $counter < $count; $counter++) { $post=get_post( $posts[$counter]->id, $output ); //do stuffs posts } hope helps