Posts

Showing posts from June, 2015

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

spring mvc - HTML character display problem -

i trying display a/c in div tag, label comes spring multilingual framework , getting converted a/c here c getting capitalized, tried escape character nothing worked okay, problem browser capitalizing letter. try replacing 'c' &#99; , if isn't working check css styles applied div for text-transform: capitalize; or text-transform: uppercase; capitalize transforms first character of each word uppercase uppercase transforms characters uppercase and change to text-transform: none; ==example== <div>a/&#99;</div> more info »

unix - expect script freezes when called from Ruby -

i've list of hosts on need install public key. purpose, i've written ruby script calls expect script , passes password, host name , public key file. expect script in turn performs ssh-copy-id each host, feeding in password , answering "yes" unknown host keys. the expect script works absolutely fine when run command line. when executed ruby script, expect fails answer "yes" unknown host key confirmation : "are sure want continue connecting (yes/no)?". expect script freezes when yes/no question thrown it. any appreciated. here ruby script : #!/usr/bin/env ruby -w hosts=['test@blah1.edu','test2@blah2.edu','test3@blah3.edu'] password="blahblahblah" key_file="/home/blah/.ssh/id_rsa.pub" hosts.each{ |host| command="expect sshcopy.exp #{host} #{key_file} #{password}" `#{command}` } and here expect script sshcopy.exp : set host [lrange $argv 0 0] set key_file [lrange $argv 1 1] s

iphone - frequent bug in UI (tabbar pushed from navigation) -

i have encountered bug several times. have application navigation controller (navbar hidden). when button "pressed" want push view tabbarviewcontroller. when new view pushed, it's 20 pixels lower should (and part of tabbar not visible). if enter modal-view controller tabbarviewcontroller , dismiss it, tabbarviewcontroller shown properly. i put status bar in every view unspecified (thought problem) , un-checked autoresize subviews each view. in code use bounds property instead of application frame . in worked hope work in case too.......:)

web services - Creating Java Calendar, basic parameters -

i send java calendar object on web service (soap). notice kind of object complex , there should better method send same information. what basic attributes should sended on web service, client can create java calendar out of attributes? i'm guessing: timezone, date, , time? also, how can client recreate calendar based on attributes? thanks! in fact go timezone tz (timezone calendar expressed in), locale loc (used data representation purpose) , long time (utc time) if want same object. in uses time enough though, receiver express own timezone , locale.

java - Dynamic Jfreechart -

i have problem getting primefaces dynamic image working. think doing in example on primefaces showcase image isn't loaded on page. managed bean looks follows. @managedbean(name = "statisticsbean") @nonescoped public class statisticsbean { private wmcuser user; private basicgroup group; private list<gameprogressstatistics> linechartstats; private list<userstatistics> userstatistics; private static final logger logger = logger.getlogger(statisticsbean.class.getname()); public statisticsbean() { ... createuserstatistics(); } private void createuserstatistics() { list<wmcuser> users = grouphelper.getnondeletedmembers(group); (wmcuser wmcuser : users) { userstatistics.add(new userstatistics( wmcuser.getstatuser().getmakecount(), wmcuser.getstatuser().getgamesplayed(), wmcuser.getfirstname(), wmcuser.getlastname())); } } publi

Path to django on google app engine -

i don't understand error. use django-nonrel, upload application manage.py. , sometimes have this: <type 'exceptions.attributeerror'>: 'settings' object has no attribute 'database_routers' traceback (most recent call last): file "/base/data/home/apps/appid/3.347077242893060339/execute.py", line 2, in <module> djapp import queue_controller file "/base/data/home/apps/appid/3.347077242893060339/djapp/queue_controller.py", line 5, in <module> djapp.models import operation file "/base/data/home/apps/appid/3.347077242893060339/djapp/models.py", line 3, in <module> django.db import models file "/base/data/home/apps/appid/3.347077242893060339/django/db/__init__.py", line 66, in <module> router = connectionrouter(settings.database_routers) file "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/conf/__init__.py", line 32, in __getattr__ return getattr

java - Adding a dynamic servlet using servlet 3.0 throws exception -

i need create add servlets @ runtime. when run following code. protected void processrequest(httpservletrequest request, httpservletresponse response)throws servletexception, ioexception { response.setcontenttype("text/html;charset=utf-8"); printwriter out = response.getwriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title> uri out</title>"); out.println("</head>"); out.println("<body>"); integer generatedkey = math.abs(randomiser.nextint()); out.print(generatedkey); createservlet(integer.tostring(generatedkey),request.getservletcontext()); } { out.println("</body>"); out.println("</html>"); out.close(); } } private void createservlet(stri

c# - Get the export value of a checkbox using iTextSharp -

i'm working on dynamically filling in fields on pdf document using itextsharp. i'd able determine "export value" of checkbox codebehind in order determine value send checkbox if should checked. of documents i've worked in past had same export value every check box 1 i'm working varies checkbox checkbox. go through of text boxes , make them consistent save lot of time in future if determine export value of these checkboxes @ runtime , set them accordingly. thanks in advance! i tried implement solution below in c# , ended following code: public string getcheckboxexportvalue(acrofields pdfdocument, string checkboxfieldname) { acrofields.item item = pdfdocument.getfielditem(checkboxfieldname); if (item.values.count > 0) { pdfdictionary valuedict = item.getvalue(0); pdfdictionary appearancedict = valuedict.getasdict(pdfname.ap); // if there's appearance dict @ all, 1 key "of

CKEditor and ASP.Net MVC 3 RequiredAttribute -

i've integrated ckeditor 3 (formerly fckeditor) asp.net mvc (v3 specific) application. have requiredattribute in model field needs editor client side validation doesn't work correctly ckeditor. when try submit , i've entered data ckeditor required validation doesn't see data. if try resubmitting again, works. i've looked around online , can't find solution. using jquery , using jquery adapter http://docs.cksource.com/ckeditor_3.x/developers_guide/jquery_adapter if looking more generic way can add javascript : $(document).ready(function () { if ($('.text-editor')) { $('.text-editor').ckeditor(); $('input[type=submit]').bind('click', function() { $('.text-editor').ckeditorget().updateelement(); }); } }); and use .text-editor css class on textarea , works fine. @html.textareafor(model => model.description, new { @class = "text-editor" }) i

android - Publishing multiple versions of one app on Google Market -

i have android app display high quality images with. there many different screen sizes , ratios. know there filters show apps in market devices small/medium/large screens. if put images of both sizes in 1 app double size of app, right? is practice make multiple versions different screen sizes? i make 1 app in 3 versions such devices: medium screen mdpi medium screen hdpi + large screen mdpi large (tablets) if it's possible how can specify them in manifests? or somewhere in market? no 1 seems addressing file size issue you're asking about, i'll try. you should package high quality images set of separate downloads, 1 each type of device plan support. makes base app small, , ensures end user's disk space filled images needs. i've not done myself, idea send on right search path. imagine design separate download either resources on own server, or set of apps in market (i.e. "myapp image pack hdpi", "... mdpi", etc.).

php - Bypassing the AJAX Same-Origin Policy - A particular case -

while trying refresh page contents dynamically using ajax/jquery, have learned s-o-p issue , restrictions, wondering if there way solve little problem. to make easier understand first explain workflow. i receive web pages via email, html emails. web pages contain html forms in such way, once form complete sent proper web server (php) store data. i use outlook 2007 email client (don't here, know!!!), security restrictions, iframes disabled when "opening" email. have circumvented problem using vba script copies whole page content, saves on filesystem stand-alone web page , loads browser (firefox). once page loaded browser, address bar shows local/filesystem url, such file:///c:/users/bob/desktop/outlookpage.htm till here no problem, works fine; problem: i wished dynamic update page contents using ajax, using jquery.load , that's s-o-p comes in. php page being loaded dynamically update web page seen running on domain, being blocked. i wondering how ci

hiding xml from public direct access -

so question how prevent public access xml file on server.. i have website allows users listen music online can't download... music in flash player reading off xml file.. the playlist example named playlist.xml how prevent public directly accessing xml file if found via "view source" ? is possible if how change settings? you can't. flash client, running on user's computer, has able access file. if can access file, else running on user's computer can too. you try adding in required http headers (by editing flash player) not difficult bypass.

Update two ID's at once SQL - PHP -

i have table that's pk int field. problem need swap 2 of values round. this current code: $newid = (int)$id; $newid = $newid - 1; $result = mysql_query("update homescroller set id = '$newid' id = '$id'") or die('error '.mysql_error()); $result2 = mysql_query("update homescroller set id = '$id ' id = '$newid'") or die('error '.mysql_error()); the table contains @ max 3 rows contain info slideshow on frontpage of website. frontpage orders them ids. change order need edit id's. the table contains @ max 3 rows contain info slideshow on frontpage of website. frontpage orders them ids. change order need edit id's. if that's case, application/database poorly architect-ed, , need re-think database design before go further. primary keys should immutable, i.e.: should never change. you're talking doing changing primary keys. fix application/database, , won't have problem. s

c# - Clean approach to finding a folder's parent -

i have piece of code searches folder given starting directory. once folder found need name of it's parent. following piece of code works terribly ugly. have flag, "sessionfound" assist breaking nested foreach loops. following works. hoping eyes on , see if suggestions on how make less verbose , bit more concise. thanks. private void setprojectfolder(string sessionid) { //ioc container gives root directory begin search. string[] supportdirs = directory.getdirectories(applicationcontainer.supportdirectory); bool sessionfound = false; foreach (string directory in supportdirs) { if (!sessionfound) { foreach (string folder in directory.getdirectories(directory)) { if (!sessionfound) { foreach (string productsubfolder in directory.getdirectories(folder))

java - One entityManger finds entity , the other does not -

i have strange behavior in program. have 2 classes (class login , creategame) have injected entitymanager in each using annotation @persistencecontext(unitname="myunitpu") entitymanager entitymanger; in point remove object called "user" database using entitymanger.remove(user) method in login class. business logic user can host , join games ( in same time) removing user entries in database games user has created removed , entries showing in games user has joined removed also. after that, call function checks if user exists using method in login class entitymanager.find(user) which surprisingly enough, finds user. after call method in creategame class tries find user using again entitymanger.find(user) the entitymanger in class fails find user (which expected result user removed , it's not in database) so question : why entitymanager in 1 class finds user (which wrong) other doesn't find it? has ever same problem? ps : "bu

sql - load data infile mysql how to ignore not valid records inserting -

i have text file , want load db table using load data infile, file contains invalid values, contain empty strings, how ignore lines? edit text file first search-and-replace invalid values. then load data mysql.

ASP.net Membership provider client or serverside authentication -

i developing mvc2 application using built in membership provider. asking myself if authentication on server or client? authentication on server. really wanted say " in middle of nowhere " =)

perl - How I reference hash inside of subroutine? -

i trying use tie function of module config::inifiles cannot figure out how reference hash inside of sub routine. if remove tie function , related code sub routine works perfectly. this line thought work, tells me "$cfg" not initialized. use config::inifiles sub config_file { $cfg_file = 'settings.ini'; %cfg; tie %cfg, 'config::inifiles', ( -file => "$cfg_file" ); #my $cfg = config::inifiles->new( -file => $cfg_file ); } sub esx_host_check { $esx_host = config_file()->$cfg{esx}{host}; } i sure simple, stumped. first off, tie function returns internal hidden object represents tie, , not tied variable itself. secondly, can not return plural tied value (hash or array) subroutine , have work way expecting. need return reference plural value, , dereference when need use it. use config::inifiles; sub config_file { tie %cfg, 'config::inifiles', -file => 'settings.ini'; # tie

my php script enters blank info into mysql db! -

when try enter data form have made adds new entry can see phpmyadmin not transfer other details across i using simple form collects 9 fileds post update.php. here have in update.php <?php $realname = $_post['realname']; $age = $_post['age']; $country = $_post['country']; $gamename = $_post['gamename']; $gamelevel = $_post['gamelevel']; $itemlevel = $_post['itemlevel']; $class = $_post['class']; $played = $_post['played']; $support = $_post['support']; mysql_connect ("localhost", "mydb_userid", "mypassword") or die ('error: ' . mysql_error()); mysql_select_db ("mydb_recruitment"); $query="insert applicants (id, realname, age, country, gamename, gamelevel, itemlevel, class, played, support)values ('null','".$realname."','".$age."','".$country."','".$gamename."','".

html - Doctype breaks jquery fadeOut method in IE! -

i added doctype page fix little ie rendering problem. looks so: <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> my fadeout code (i'm using stop(true,true) restart animation if in progress): $('#myelement').stop(true, true).show().fadeout(5000); now, jquery fadeout(5000) method doesn't fade in ie anymore. know of fix this? edit: i've tried pretty every flavor of doctype out there, , no matter 1 use, fadeout animation not work in ie. have tried doctype, transitional or xhtml?

.htaccess - Simple Mod_rewrite rule for a simple website (Classic) :( -

i have been making own little website small cms. , can't mod_rewrite work me, i'm after seems simple , straightforward. right links this: localhost/cms/?page=history, localhost/cms/?news=galery-module etc.. want them this: localhost/cms/page/history the code in .htacess file right is(but not seem work although mod_rewrite on): options +followsymlinks rewriteengine on rewritecond %{script_filename} !-d rewriterule /cms1/([-a-z0-9]+) /cms1/?page=$1 thank help! this should work: options +followsymlinks rewriteengine on rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule /cms1/([a-za-z0-9-]+)/?([a-za-z0-9-]*) /cms1/?$1=$2 also note wrote cms1 , not cms , in rules not in urls, adjust accordingly.

windows phone 7 - Compressing PCM -

i'm recording sound microsoft.xna.framework.audio.microphone there way compress after words? best have mp3 or wmv files, can't find solution. cloud computing slow think. unfortunately, there no framework support audio compression. although technically implement algorithm in managed code, consume processing power , application won't pass microsoft certification.

How to check if two instances of the same java program are running? -

hi making program run through javaw.exe, not visible directly. issue sometime, (accidently) can happen user runs multiple instances of same application, e.g entering javaw myprogram 2 times under such situation, there way can prevent multiple instances of same program run if program running. this article explains multiple ways prevent it: http://www.rgagnon.com/javadetails/java-0288.html

ios - UITableViewController won't scroll on custom implementation -

there numerous posts out there stating 1 should avoid use of uitableviewcontroller. more , more want give in, i'm using coredatatableviewcontroller super class that's tied entire application, , don't have time rewrite all. of course, uitableviewcontroller's view shouldn't take entire screen (ipad project), put subview on regular uiview instance frame set pretty size. that's when weird things start happen. i copied custom class (groupstableviewcontroller->coredatatableviewcontroller->uitableviewcontroller) test-project working fine, current project. alloc/init , addsubview view. at first table show empty. gives? viewwillappear: message not sent. the...? alright, call manually (at point, i'm starting doubt myself). next, table filled content, interactivity gone. no taps, no scrolling. i tried setting userinteractionenabled on everything, no result. n00b thing, i'm sure, silly stuck on. yet here am, stuck. can point me right direction? d

python - Non-generated script with SetupTools/Distribute in setup.py -

i'm trying non-generated script when run setup.py install python package building. i have read distutils documentation couldn't find clear examples on how accomplish this. mercurial in part importing install_scripts : from distutils.command.install_scripts import install_scripts and goes on replace things within hg script. hg executable ends being used overriding default behavior of using this: #!/users/alfredo/python/foo/bin/python # easy-install-script: 'foo==0.0.1','foo' __requires__ = 'foo==0.0.1' import pkg_resources pkg_resources.run_script('foo==0.0.1', 'foo') i trying not end using pkg_resources importing foo package, rather end script using. i'm aware why auto-generated , still want go other route. this copy of base setup.py using: import distribute_setup distribute_setup.use_setuptools() setuptools import setup tests_require = ['pytest'] setup( name = "foo", version = "0.

What is the best way to arrange variables and methods in a class? -

i arrange variables , methods this: class myclass { // public variables // public methods // private methods // private variables } i want know best arrangement defining functions , variables in terms of readability? edit: enum , class definitions within class? like this: class myclass { // private fields // public methods // private methods } you shouldn't have public fields. use properties instead. stylecop has set of rules on suggested code order . see sa1201 : within class, struct, or interface, elements must positioned in following order: fields constructors finalizers (destructors) delegates events enums interfaces properties indexers methods structs classes and sa1202 : to comply rule, adjacent elements of same type must positioned in following order access level: public internal protected internal protected private if use stylecop warn w

Django memcached won't cache a large template output -

i using django memcached. in 1 of templates, added {% cache 28800 template_browse_gene_list %} ... {% endcache %} the stuff in block rather large, on 1 mb; result of iterating through expensive sql returns lots of data. since queryset lazily evaluated, using cache here avoids sql, if cache works. when use locmem cache backend, works. avoid sql , cached result. when hookup memcached, -i 4m setting, following in verbose output: <30 new auto-negotiating client connection 30: client using ascii protocol .... <30 template.cache.template_browse_gene_list.d41d8cd98f00b204e9800998ecf8427e >30 end <30 connection closed. the connection closed line displayed page returned, after quite wait. think when sql done, connection closed message appears. basically, nothing gets memcached entry. again, worked locmem. any thoughts? thanks. found this... explains it... memcache won't store key/value because value big

database - Cannot drop tablespace in oracle -

hi, problem 1 when try drop tablespace using drop tablespace command, fails , error message tablespace not exist. when select * dba_tablespaces, can see tablespace name. problem 2 when try connect oracle using aquadata, "connection failed:- no more data read socket" please suggest "when execute query select * dba_tablespaces, tablespace name shown in lower case." by default oracle sql case insensitive. is, both of these statements equivalent: drop tablespace ts1 including contents / drop tablespace ts1 including contents / however, when comes storing metadata oracle uses upper case object names. doesn't matter unless when created database objects wrapped names in double-quotes. @ point oracle becomes case sensitive. it appears such situation. need issue command tablespace name in double quote: drop tablespace "ts1" including contents /

php - Why can't Selenium RC see a site on virtual machine -

i'm having trouble getting selenium see sites hosted on virtual machine. following test causes error, , have no idea why: <?php require_once 'phpunit/extensions/seleniumtestcase.php'; class actualtest extends phpunit_extensions_seleniumtestcase { protected function setup() { $this->setbrowser("*firefox"); $this->setbrowserurl("http://10.48.77.48/"); // ip of virtual machine $this->sethost('192.168.101.1'); // ip of mac } public function testgethomepage() { $this->open("/", true); } } it returns following error message, indicating couldn't find virtual machine: $ phpunit actualtest.php phpunit 3.5.6 sebastian bergmann. e time: 7 seconds, memory: 6.75mb there 1 error: 1) actualtest::testgethomepage phpunit_framework_exception: response selenium rc server testcomplete(). xhr error: url = http://10.48.77.48/ response_code = 404 error_message = page n

iphone - UIView - Center alignment all the contents of UIView? -

how center alignment contents of view. when rotating ipad contents not align center self how resolve problem?? thanks!!! provide implementation of didrotatefrominterfaceorientation method , center subviews. - (void)didrotatefrominterfaceorientation:(uiinterfaceorientation)frominterfaceorientation { for(uiview *subview in [self.view subviews]) { subview.center = self.view.center; } }

asp.net - Import Excel to SQL Server 2005 using Sqlbulkupload -

i want upload excel file using sqlbulkcopy sql server 2005 table. excel file size 43mb. when uploading file display error message the request filtering module configured deny request exceeds request content length. my web.config file setting <httpruntime executiontimeout="12000" maxrequestlength="2097151" usefullyqualifiedredirecturl="false" minfreethreads="8" minlocalrequestfreethreads="4" apprequestqueuelimit="100"/> thanks in advance. maxallowedcontentlength : optional uint attribute. specifies maximum length of content in request, in bytes. the default value 30000000. not has anything sql server or bulk copy...

html - span height width unable to change -

trying make 1 horizontal box.. inside update limits. if u see below sample code, u can understand how set limits. limit classes height, unable decrease. please tel me reason.. want make using div , span only <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr"> <head> <style> .limitblock { border-left: 1px solid black; } .limitrblack { border-right: 1px solid black; } .horbox { background-color:#ffffff; height:4px; width:400px; margin-left:5px; border: 1px solid #aaaaaa; } </style> </head> <body> <div class="horbox"> <div style="margin-

drupal - How to create a horizontal bar graph about reviews on each product? -

i trying create horizontal bar graph showing how many 1star, 2star etc reviews there on each product, like amazon does . how this? there aren't contributed modules know of you're looking for. lot of work, might able accomplish combination of fivestar , views , , views charts modules. there's chance it's going require custom development though.

html - How do I get one element to respond to the click of another element? - CSS/jQuery -

the question simple, in implementation has gone awry. you can see implementation here . so want happen is, when click on 1 of names in box #1, dotted line , #1 in dotted circle both turn black , solid. dotted line not border. same should happen when click other data in other corresponding boxes. the main issue facing when use .css function in jquery manually change color , border, works nicely. however, modify toggle class (because couldn't toggle() work css function) - when click once, see element clicked highlighted (with 1px border - functionality there), , corresponding number box (and dotted line) turned solid black. thanks. it looks javascript fine. thing see messing things line: $('#bc1 dashed-circle').toggleclass('bc-dashed-to-solid-circle'); you'll want change selector #bc1 .dashed-circle . the reason dashes , number aren't changing color because of specificity. declare normal color (#bdbebf) selector #blank-dashboard-brea

iphone - Add three Buttons in an UIAlertView -

i created uialertview, , add 2 buttons, need add 1 more button in alert view. how edit code add 1 more button? uialertview *alert = [[uialertview alloc] initwithtitle:@"refresh" message:@"are want refresh data" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil]; [alert show]; [alert release]; if struggling find solution, following code may you. uialertview *alert = [[uialertview alloc] initwithtitle:@"refresh" message:@"are want refresh data" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", @"done", nil]; [alert show]; [alert release];

iphone - Best practice around using UIViews as containers for background etc -

while designing views in ib, find simple use uiviews containers other controls. use give special background color etc.. is practice or should doing else ? guess programmatically draw rectangle. i'm trying leverage ib as can. thanks yes, think so. tend use uiviews group controls need changed e.g. hiding group of buttons. don't believe there performance penalty doing this. re: interface builder, guess depends on feel confortable with. can create uiview containers programatically ;)

elisp - Cutting a text file into multiple parts in Emacs -

i using gnu emacs 23 editor. have huge text file containing 10,000 lines want chop multiple files. using mouse select required text paste in file painful. prone errors too. if want divide text file according line numbers 4 file first file:lines 1-2500 second file:lines 2500-5000 third file :lines 5000-7500 fourth file: lines: 7500-10000 how do this? @ least, there efficient way copy large regions of file specifying line numbers c-u friend. try this: c-spc (set mark @ point) c-u 2500 <down> (equivalent pressing down key 2500 times) m-w (copy)

php - Create a multidimensional array in a loop -

i trying create array in loop: $datapoints = array( array('x' => 4321, 'y' => 2364), array('x' => 3452, 'y' => 4566), array('x' => 1245, 'y' => 3452), array('x' => 700, 'y' => 900), array('x' => 900, 'y' => 700)); with code $datapoints = array(); $brands = array("cocacola","dellchannel","ebayfans","google", "microsoft","nikeplus","amazon"); foreach ($brands $value) { $resp = gettwitter($value); $datapoints = array( "x"=>$resp['friends_count'], "y"=>$resp['statuses_count']); } but when loop completes array looks this: array ( [x] => 24 [y] => 819 ) this because you're re-assigning $datapoints new array on each loop. change to: $datapoints[] = array("x"=>$resp['

linux - how/where to add rDNS for an IP address -

how/where add rdns entry ip address in centos box. going use secondary ip address in postfix. if it's local machine (eg. 10.0.0.1 etc), goes /etc/hosts . if public ip, need contact provider (the owner of netblock) have configure in dns. colocation providers may have web interfaces this, consumer-access providers typically won't let it.

c - Java scsi access -

i'd port linux c program java. program controls camera connected pc usb cable. c code uses linux scsi generic (sg). sample code c program: #include <linux/../scsi/sg.h> ... static int scsi_write(int sg_fd, uint8_t *cmd, uint32_t cmdlen, uint8_t *buf, uint32_t buflen) { sg_io_hdr_t io; int r; memset(&io, 0, sizeof(io)); io.interface_id = 's'; io.cmd_len = cmdlen; ... r = ioctl(sg_fd, sg_io, &io); ... } is there way port program java? searching cross-platform scsi library written java, found none. searching jni on scsi/sg, no luck. while java supports lot of posix api, ioctl system call not part of does. you'll need use jni allow java call function such scsi_write wrote in question. cost of using more shims minimal given you're talking interfacing external hardware anyway. cmd , buf arguments map naturally java byte arrays (and since java's arrays know length, won'

mysql - posting a value and retrieve it in php -

i have 2 fields in form category name , id . id auto increment. after posting category name, want posted category id pass next page. i think doing mistake in select statement. http://pastebin.com/3tu2hr6g instead of "select thirdpartycategoryid,'".$thirdpartycategoryname."' thirdpartycategorymaster" you want this: "select thirdpartycategoryid,thirdpartycategoryname thirdpartycategorymaster thirdpartycategoryname='".$thirdpartycategoryname."'" and before forget: please check , escape user input http requests before insert queries. code posted extremely vulnerable sql injection .

android - read/write /dev/ttySDIO0 like a file? -

need read/write tty sdio device in user space program in using jni in android. possible open device (/dev/ttysdio0) using fopen , read/write normal file? from terminal apps possible cat/echo it. looking approach can used in program. i don't see .read operation defined in sdio uart driver. thank you. edit: using android dev phone 1 has android 1.6 (linux kernel version 2.6.29). when browsed sdio driver source latest linux kernel version 2.6.34. has added file_operations structure has .read operation listed. realized need upgrade android resolve issue. thank time, effort , answers.

MATLAB rotation problem -

hey all, need rotated versions of 3d shepp logan phantom , it's corresponding rotation matrix. here's thing, use function called phantom3d create 3d slp, function allows euler angles specify rotation. example: phi = 45; theta = 45; psi = 45; %just matrix of inputs create shepp logan phantom e =[ 1 .6900 .920 .810 0 0 0 0+phi 0+theta 0+psi -.8 .6624 .874 .780 0 -.0184 0 0+phi 0+theta 0+psi -.2 .1100 .310 .220 .22 0 0 -18+phi 0+theta 10+psi -.2 .1600 .410 .280 -.22 0 0 18+phi 0+theta 10+psi .1 .2100 .250 .410 0 .35 -.15 0+phi 0+theta 0+psi .1 .0460 .046 .050 0 .1 .25 0+phi 0+theta 0+psi .1 .0460 .046 .050 0 -.1 .25 0+phi 0+theta 0+psi .1 .0460 .023 .050 -.08 -.605 0 0+phi 0+theta 0+psi .1 .023

perl - How to create using XML::TreeBuilder element with CDATA? -

i use xml::treebuilder creating , parsing of xml files. possible create element cdata using xml::treebuilder? <script> <![cdata[ function matchwo(a,b) { if (a < b && < 0) { return 1; } else { return 0; } } ]]> </script> xml::treebuilder uses xml::parser read , parse xml , creates bunch of xml::elements. if want manipulate xml creating new tags , on, want use xml::dom or xml::generator .

Agile practices on embedded software development -

i have had great success e.g. fast development cycles , continuous integration. however, think pair programming or continuous customer communication less useful due issues specific of embedded software programming. what think? useful agile practices on embedded software development? i have disagree. i've done it, , 10 years ago co-founded agile coaching company specializing in embedded (we're no longer company the website still up several useful resources). helped company adopt agile embedded project, , worked them. agile practices short iterations, pair programming, , frequent communication customer even more important embedded software because there's more @ stake, both because embedded systems harder/more expensive update in field, , because used in mission-critical applications. as pair programming, if company has 1 person knows first thing component of software, that's huge risk, , pair programming great way of doing cheap knowledge transfe

issue with singleton method in calling WCF using JQuery -

i created bare simple method, increments number 1 , returns value. [servicecontract] public interface icalc { [operationcontract] [webget(uritemplate = "getnumber")] int getnextnumber(); service class: [servicebehavior(instancecontextmode = instancecontextmode.single)] public class calculator : icalc { int = 1; public int getnextnumber() {return i++; } } the service hosted using webhttpbinding , works when opened browser. example, when browse http://localhost:8083/calc/getnumber , <int xmlns="http://schemas.microsoft.com/2003/10/serialization/">1</int> every time refresh, value keeps incrementing 1 in xml response (as expected due singleton behavior) problem when call same service using jquery as: $.ajax( { type: "get", url: "http://localhost:8083/calc/getnumber", data: "", contenttype: "a

Is this possible to write Win32 .dll files by C#.NET? -

is possible write win32 .dll files c#.net ? if yes, can find tutorials? if no, what's suggestion write win32 .dlls? thanks. it sounds you're trying create classic win32 dll win32-style exports? (win32-style exports dllimport picks up.) can't managed code (c# or managed c++); far know, you'll need use unmanaged c/c++ that. programming windows charles petzold or similar book on programming win32 might place start; or find 'hello world' win32 dll sample. or create win32 dll project in visual studio , @ files creates you, there should placeholder text started. managed code use files have .dll extension, containers managed code, , don't have win32-style entry points, other code that's expecting win32 entry points can't use them. referred "managed assemblies" rather dlls avoid confusion. -- update - there might alternate option: can create what's called "mixed mode dll" dll contains both native code , managed

javamail connect to imap over ssl to read mails -

i want read emails exchange server on imap ssl javamail api. using following piece of code. properties props =system.getproperties(); props.setproperty("mail.store.protocol","imaps"); session session = session.getdefaultinstance(props, null); store store = session.getstore("imaps"); store.connect("server hostname","username","password"); but unable establish connection. following error. javax.mail.messagingexception: sun.security.validator.validatorexception: pkix path validation failed: java.security.cert.certpathvalidatorexception: timestamp check failed; nested exception is: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path validation failed: java.security.cert.certpathvalidatorexception: timestamp check failed @ com.sun.mail.imap.imapstore.protocolconnect(imapstore.java:618) @ javax.mail.service.connect(service.j

javascript - random image and its url -

i want create random image , url, mean not link of image, in addition image's link, want specified url, random image displayed , when u click on it, u go specified url here javascript: function random_imglink(){ var myimages=new array() //specify random images below. can have many wish myimages[1]="/documents/templates/projedepo/banner/canon.jpg" myimages[2]="/documents/templates/projedepo/banner/indigovision.jpg" var ry=math.floor(math.random()*myimages.length) if (ry==0) ry=1 var randomimage = '<img src="'+myimages[ry]+'" height="420" width="964" />'; document.getelementbyid("image2").innerhtml = randomimage; } random_imglink() here html: <div id="slider_container"> <div id="image2"> </div> <div id="thumb2"> <a href="#" rel="/documents/templates/

SOAP exception : axis2ns2:selectionFailure -

im getting unknown exception when doing request webservice: axis2ns2:selectionfailure anyone know problem ? edit: detailed error: {"message":"axis2ns5:selectionfailure","stacktrace":" @ system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse response, stream responsestream, boolean asynccall)\r\n @ system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters)\r\n this problem occurs when there error xml namespace.

osx - Does anybody know equivalent for NETLINK Sockets API for MAC OS X? -

does know equivalent netlink sockets api mac os x ? trying port linux application mac os x , couldn’t find similar in macos. i need provide asynchronous access network adapter in application. polling network adapter configuration changes etc every amount of seconds not convenient solution me. netlink socket api game me way receive notification when interesting happened. i know netlink linux specific thing communicate between linux kernel , user space, maybe there exist netlink under macos. i see the tool communicate kernel – sysctl() does have info? you can use kernel control architecture documented in nke section of docs osx provides reason.

iphone - symbolicating iPad app crash reports -

here, bit new ipad developement , objective-c. facing problem here reading device logs. when browsed through logs, people said have build , archive , use build device. next time when connected device machine, device logs automatically symbolicate crash logs. not case. the steps following right now. put xcode configuration device , release. build -> build , archive. go build folder, drag , drop binary file on itunes icon , select replace. after testing, re-connect ipad, go organizer window, select device, click on device logs. this shows symbols only...not clue of crashed. eg:the crash report thread 0 crashed: 0 libsystem.b.dylib 0x30d7c2d4 __kill + 8 1 libsystem.b.dylib 0x30d7c2c4 kill + 4 2 libsystem.b.dylib 0x30d7c2b6 raise + 10 3 libsystem.b.dylib 0x30d90d72 abort + 50 4 libsystem.b.dylib 0x30d7e980 __assert_rtn + 152 5 libgcc_s.1.dylib 0x307e8b4e _unwind_sjlj_resume

How to get binary post data in Django !nicely? -

forgive me if bit of newbie question, started learn django yesterday, , i'm trying not bad habits, i.e. trying things "the django way" start. i have view recieves binary data http post field. django of course autoconverts binary data unicode string. my question is, how raw binary data? a couple of things occurred me. let request request i'm processing. using request.raw_post_data involve parsing data again - when appearantly request.post stores raw data , trying around on-the-fly conversion (and besides, new in development version). using base64 or transfer data work, seems overhead when data transfer not problem. doing request.encoding="foo" before getting field (and reassigning afterwards) doesn't work either because still unicode string, besides feeling bit of dirty hack. using "base64" here (not bad transfer encoding) gives me assertionerror . thanks in advance ideas! edit: clarify - not talking classic file upload

android - It is possible to specify/reduce the onTap area of the items on a mapview? -

i have mapview , itemizedoverlay , on android developers example. have problem. when user presses 1 or 2 cm out of 32x32 image of item on map, dialog of item opens. don't want that. want reduce "press" area of item 32x32 proportions of image of item on map how can that? had same problem itemizedoverlay, , ended using normal overlay instead. needed write own method measuring users tap on screen, , used approach in article: http://blog.pocketjourney.com/2008/03/19/tutorial-2-mapview-google-map-hit-testing-for-display-of-popup-windows/ if has solution itemizedoverlay great if share. br, vanja

asp.net mvc - Multiple validations on a property using FluentValidation -

i'm using fluentvalidation , asp.net mvc 3. i have couple of questions regarding validation. i have validation on view model setup this: public newsviewmodelvalidator() { // title required rulefor(x => x.title) .notempty() .withmessage("title required"); // title must less or equal 100 characters rulefor(x => x.title) .length(1, 100) .withmessage("title must less or equal 100 characters"); } is how must done, or need include in 1 statement? i need 2 validations done on title property, name must required field , cannot longer 100 characters. below source after validation triggered: <td valign="top"><b>title: *</b></td> <td> <input class="input-validation-error" data-val="true" data-val-length="title must less or equal 100 characters" data-val-length-max="100" data-val-length-min="1" data-val-required="tit

java - Struts - My action is called twice -

i'm using jsp include this: <jsp:include page="/citybest.html"> <jsp:param value="shopping" name="action"/> </jsp:include> this calls method 'shopping' method of action class. problem method called twice. if remove include call not called @ all. checked in debug mode of ecilipse. 1 have idea on what's case here? if have form submit button calls method includes form.submit() cause form submitted twice in browsers. otherwise you'll need provide more information.

Is there a Java equivalent for Python's map function? -

i transform collection (list) of objects of class a collection of objects of class b, python's map function it. there "well-known" implementation of (some kind of library)? i've searched in apache's commons-lang no luck. still not exist functional programming features added in java 8 - project lambda i think google guava best needs now

How to know when isolated storage is being deleted in Silverlight? -

i have silverlight app uses isolatedstorage store info current session. if user right clicks mouse , chooses silverlight , goes delete application storage, exception of type isolatedstorageexception when call isolatedstoragefile.getuserstoreforsite(). i don't want use try-catch block catch exception, want able call method successfully, or similar method 1 above. is there way know (maybe event) when user deletes application storage? use silverlight 4.0. thank ! they no events can use determine whether user has done action. the best can use error handler , display message user, perhaps politely pointing out 1 possible cause might deletion of site storage. according documentation unless user has disabled or set set quota 0 call should succeed wouldn't surprise if sl doesn't it.

c# - Confusion with cookie session token and oauth2.0 don't know where to go anymore -

i'm confused, frustrated , nothing seems make sense , work more. i' dev iframe fb app , i've been using javascript sdk (fb.init()) access_token, doesn't work, i'm logged fb , doesn't works... did reading, , read there problems using cookies in iframes in opera , ie, thinking in use oauth 2.0 i'm not sure how via facebook sdk c# , i'm lost, don't know if still need use javascript fb.init(). documentation out there poor , unclear, lot of stuff refers old code, , after hours of reading, jumping on examples, i'm messed , confused. can some, please, point/explain/enlightening me this? thanks lot guys, appreciated! merry christmas! the configuration instructions scenario detailed in documentation. here link: http://facebooksdk.codeplex.com/wikipage?title=asp.net%20mvc%20sample&referringtitle=documentation for authentication in iframe app don't have use javascript sdk (although have use if using xfbml). have redirect user

objective c - Deploy a file into iPad app Documents folder from Xcode -

in ipad xcode project have file located inside resources group folder. when deploying on ipad goes application folder ...aff9-8a934f9408b3/myapp.app , need go ...aff9-8a934f9408b3/documents . how can that? you can't directly place files application's document folder on device part of deployment. however, can copy them (read only) bundle application's document folder. to obtain reference item in bundle, can use: nsbundle *appbundle = [nsbundle mainbundle]; nsstring *bundlepath = [appbundle pathforresource:@"xxxx" oftype:@"xxx"]; you can load data , save normally. there's more info on process in following question (amongst others): iphone copying folder bundle documents

signtool - How to renew a code signing certificate -

i have code signing certificate thawte expire in couple of weeks. i have paid renewal, , have received renewal .cer file. i have created updated .pfx file allows me sign firefox addons, , signature valied in "future" time. however, when try use same .pfx file sign internet explorer plug-in, signtool error 0x80880253 ("the certificate no longer valid"). i try use mmc.exe , certmgr.exe renew certificate in certificate manager console, whatever - expiration date remains in 2010. i able see "renewed" certificate in certmgr wizard, under "other people" tab rather under "personal" tab. does have idea i'm doing wrong? thanks you should have new certificate in personal store. try delete , install again. if not successfull, may try workaround of referencing directly .pfx file instead of certificate storage: signtool.exe sign /f certificate.pfx /p mypassword ....

php - How to properly run a Symfony task in the background from an action? -

what correct way run symfony tasks in separate process. first guess use fork/exec, according this , can't keeps open file descriptors or connections (like mysql). doesn't sound option. alternative exec('symfony taskname &') , seems hack. best can do? there third way? the way handled use task queue. when want background process, add queue of kind (you use database, or use actual queue daemon beanstalkd). have daemonized procces(es) job pull work out of queue , perform it.

frequency analysis - FFT pitch detection for guitar string -

i have pitch detection. input (microphone) data passed fft routine, i'm looking pitch maximum value means: max(pow(data[i].getre(), 2) + pow(data[i].getim(), 2)) 0<= < samplessize i need detection of guitar string's primary frequency. works freq 440 hz (and maybe higher, didn't check that) downto 250 hz. below value detected frequency twice high should be, ie. 195 hz detected frequency 380 hz. looks detects higher harmonics below 250 hz. pure 195 hz tone detects perfectly, quitar string wrong. any suggestion can cause ? or should use more sophisticated pitch detection? ps. sampling rate: 8000hz, input data size: 1024 i don't know guitars specifically, missing fundamentals seem quite common in acoustics. wikipedia page on pitch detection alludes secondary processing steps after fft, perhaps 1 of these helpful. also, see these 2 questions, lots of information there: (1) , (2) .

java - What kind of data structure we should use to create map like Google map? -

if had indicate travel directions visually on map (like google maps), data structure use store it? how store map itself? without putting thought it; at bare minimum, geographical map set of vertices edges connecting them, vertices intersections , dead ends of roads , edges roads connect them. directions series of references vertices need traverse vertex vertex b. so store geographical map, use tree/map. provide directions use list of references vertices or starting vertex , list of edges end vertex. associating more information each vertex/edge gives need make full map. (ie, weight of each edge shortest path).

Can a WCF service be consumed as if it were an ASP.NET Web Service? -

i'm integrating product vendor our existing processes. this product interfaces our system via asp.net web service. in, need write asp.net web service has particular method names , parameters vendor has specified. simple enough, we're wanting migrate stuff possible wcf. haven't used wcf yet, see it's replacement asp.net web services (and other things). seeing how cannot modify vendor's product, way write new web service using wcf if wcf service can consumed if asp.net web service (i.e., far vendor's product concerned, consuming asp.net web service). can wcf services consumed in way? yes, web services web services. in general wcf more flexible , more powerful asp.net, can on-the-wire message , out of wcf service same messages asmx service. but, wcf different default. migrating should mechanical. replace .asmx file containing this: <%@ webservice language="c#" codebehind="~/app_code/communicationservice.cs&qu

mvvm - Type name showing up in WPF drop-down list -

i'm binding list<selectitem> combobox using mvvm. combobox has right value , looks fine. however, when click on down button see options in combobox, list of 10 items each read mynamespace.selectitem . if select #2, value in combobox reads 2 . here's code selectitem : public class selectitem { public string value { get; set; } public string display { get; set; } } my xaml: <combobox itemssource="{binding path=mylist}" displaymemberpath="display" selectedvalue="{binding path=mylistvalue, mode=twoway}" /> and here's queue list of selectitems : mylist= new list<selectitem>(); (int = 1; <= 10; i++) { var page = new selectitem() { display = i.tostring(), value = i.tostring() }; mylist.add(page); if (i == 1) mylistvalue = page; } check typo. with followi