Posts

Showing posts from May, 2013

Reading and Writing Sequencefile using Hadoop 2.0 Apis -

i looking example using new api read , write sequence files. effectively need know how use these functions createwriter(configuration conf, org.apache.hadoop.io.sequencefile.writer.option... opts) the old definition not working me: sequencefile.createwriter( fs, conf, path, key.getclass(), value.getclass()); similarly need know code reading sequence file, follwoing deprecated: sequencefile.reader(fs, path, conf); here way use same - string uri = args[0]; configuration conf = new configuration(); path path = new path( uri); intwritable key = new intwritable(); text value = new text(); compressioncodec codec = new gzipcodec(); sequencefile.writer writer = null; option optpath = sequencefile.writer.file(path); option optkey = sequencefile.writer.keyclass(key.getclass()); option optval = sequencefile.writer.valueclass(value.getclass()); option optcom = sequencefile.writer.compression(compressiontype.record, codec); ...

ios - Gesture Recognizer never fires -

this have uicollectionviewcontroller - uicollectionviewcell - uiscrollview - imageview i trying handle tap on imageview never called. uitapgesturerecognizer *tap =[[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletap:)]; [cell.imageview addgesturerecognizer:tap]; - (void)handletap:(uitapgesturerecognizer *)recognizer { nslog(@"tap"); nsindexpath *indexpath = [self.collectionview indexpathforitematpoint:[recognizer locationinview:self.collectionview]]; } cell's imageview should allow user interaction first detect tap. make sure enable user interaction following line. [cell.imageview setuserinteractionenabled:yes];

c++ - unresolved link error when working with directx 11 -

i attempting create class instances directx window have initialize method , clean method have pushed .h , .cpp file , upon doing these 2 errors: error 58 error lnk2019: unresolved external symbol "public: void __cdecl d3dwindow::cleand3d(void)" (?cleand3d@d3dwindow@@qeaaxxz) referenced in function winmain c:\users\thatguy\documents\game dev\tutorial work\directx 11 tutorial\directx 11 tutorial\main.obj directx 11 tutorial error 59 error lnk2019: unresolved external symbol "public: void cdecl d3dwindow::initd3d(struct hwnd *)" (?initd3d@d3dwindow@@qeaaxpeauhwnd__@@@z) referenced in function winmain c:\users\thatguy\documents\game dev\tutorial work\directx 11 tutorial\directx 11 tutorial\main.obj directx 11 tutorial main.cpp: // include basic windows header files , direct3d header files #include <windows.h> #include <windowsx.h> #include "d3dwindow.h" // windowproc function prototype lresult callback windowproc(hwnd hwn...

sql - Update multiple columns on a row with a single select in sqlite -

in sqlite need update row counts of related table. the query below want walks table multiple times counts: update overallcounts set total = (count(*) widgets joinid=1234), totalc = (count(*) widgets joinid=1234 , source=0), totall = (count(*) widgets joinid=1234 , source=2), iic = (select case when count(*)>0 1 else 0 end widgets joinid=1234 , widgets.source=0), il = (select case when count(*)>0 1 else 0 end widgets joinid=1234 , widgets.source=2) id=1234 this query retrieves want need turn output update statement: select count(*) total, sum(case when source=0 1 else 0 end) totalc, sum(case when source=2 1 else 0 end) totall, case when source=0 1 else 0 end iic, case when source=2 1 else 0 end il widgets joinid=1234 sqlite not support joins in update queries. limitation of sqlite design. however, can still in sqlite using powerful insert or replace syntax. disadvantage of have entry in overallcounts (if did not have entry inserted). syntax...

objective c - How to tell when UITableVIew has completed ReloadData? -

i trying scroll bottom of uitableview after done performing [self.tableview reloaddata] i had [self.tableview reloaddata] nsindexpath* indexpath = [nsindexpath indexpathforrow: ([self.tableview numberofrowsinsection:([self.tableview numberofsections]-1)]-1) insection: ([self.tableview numberofsections]-1)]; [self.tableview scrolltorowatindexpath:indexpath atscrollposition:uitableviewscrollpositionbottom animated:yes]; but read reloaddata asynchronous, scrolling doesn't happen since self.tableview , [self.tableview numberofsections] , [self.tableview numberofrowsinsection 0. thanks! what's weird using: [self.tableview reloaddata]; nslog(@"number of sections %d", [self.tableview numberofsections]); nslog(@"number of rows %d", [self.tableview numberofrowsinsection:([self.tableview numberofsections]-1)]-1); in console returns sections = 1, row = -1; when exact same nslogs in cellforrowatindexpath sections = 1 , row = 8; (8 right) ...

regex - Perl search and replace NOT working -

i trying replace string in file procedure seems removing string , not replacing want example perl -ne 'print unless s/serverip=${solid.host}/ads/;' needstobereplaced.prp > blah.txt will remove "serverip=${solid.host}" , leave line blank instead of printing "ads" in place i running in windows way. have no 3rd parameter in regex because want change first occurrence. have tried perl -pi -e 's/serverport=${solid.port}/ads/;' needstobereplaced.txt but permission errors editing in place no go you print line if substitution not successful. if want print always, not use unless : perl -pe "s/serverip=\${solid.host}/ads/;" needstobereplaced.prp > blah.txt you should escape dollar sign prevent interpretation perl. also note double quotes must used on ms windows.

actionscript 3 - Parsing XML data in AS3 by attribute -

i building application allows user add ingredients in fridge list , search of potential recipes based on ingredients they've listed. i using xml data set out in simple schema so: <items> <item category="meat">chicken</item> <item category="meat">beef</item> <item category="vegetable">green beans</item> </items> the scrolling list part of app based on nettuts tutorial ( http://active.tutsplus.com/tutorials/actionscript/create-a-smooth-rolling-scroller-with-as3/ ). want able filter list programatically xml attributes (i.e. 'category' attribute above). here full document class below (i wasn't sure functions include exclude might important). functions should aware of dataloaded() parses xml data , puts textfield , dataload() instantiates urlloader object load xml. name of document class recipematcher , constructor same. i think i've commented pretty there shouldn't many qu...

Is Kendo UI ASP.NET MVC open source? -

i trying reproduce issue incompatibility between kendo ui's datasourceresponse class , servicestack.text json serializer. can locate source code client side javascript. does know if kendo ui's c# source code asp.net mvc available? i supposed reflect it, wouldn't able share of code in issue report. this covered under kendo license agreement: https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-mvc.aspx 1.3 source code. software’s source code provided can create modifications under terms of agreement. 1.3.3 acknowledge software’s source code confidential , contains valuable , proprietary trade secrets of telerik. except provided in section 2.2 of agreement, under no circumstances may portion of software’s source code or modified version of source code distributed, disclosed or otherwise made available third party . however, if you're filing ticket telerik directly they're first-party, should share , discover them.

actionscript 3 - How to determine primary swipe direction (using MultiTouch) in AS3? -

i'm trying implement simple swipe recognition on touch screen using as3. need know whether swipe left, right, top, or bottom. first question: easier using simple mouse_down , mouse_up, , calculate distance(s) moved? or easier using multitouch? i see code multitouch showing how implement swipe detection , getting direction thus: if (e.offsety == 1) { //user swiped towards bottom square_mc.y += 100; } if (e.offsety == -1) { //user swiped towards top square_mc.y -= 100; } if (e.offsetx == 1) { //user swiped towards right square_mc.x += 100; } if (e.offsetx == -1) { //user swiped towards left square_mc.x -= 100; } but if need resolve 1 direction (that left or up, right or bottom, etc), how do (and if offsetx , offsety true offsets, why checking +1 , -1 only? or function called during swipe? i'm trying 1 complete swipe). i'm thinking skipping multitouch might simpler, welcome fee...

javascript - Angularjs data binding with a data attribute object -

i have json attached data attribute on page. json data used build table in angularjs. i'm using coffeescript , haml. app = angular.module("myapp", []) app.controller "tablectrl", ($scope) -> $scope.table = $("#mydata").data("myjson") #table{"ng-app"=>"myapp","ng-controller" =>"tablectrl"} %table %tbody %tr{"ng-repeat"=>"(i,item) in table" }}"} %td {{item.name}} the page loads data table. elsewhere on page json on data attribute can changed user jquery. how can have 2-way binding between json data , table? i.e want table change json on data attribute changed locally. what need tell angularjs observe $("#mydata").data("myjson") changes , update $scope.table when change occurs. try adding following code controller (sorry don't know coffeescript). $scope.$watch( fun...

including dynamic content in documentation generated by python-sphinx -

i using sphinx generate documentation project, , building documentation part of product's install process. dynamically include hostname in text and/or code-blocks. have not seen explanations in documentation facility including output of shell command or other specific line(s) specific file. capacity exist? here 2 sphinx extensions can this: autorun : executes python code in runblock directives, captures output , inserts documents. programoutput : executes arbitrary commands using program-output directive , inserts output documents.

java - Connection to MySQL with JDBC -

i have been trying connect external mysql server location @ http://mysql10.000webhost.com using jdbc in eclipse, keep getting error. here code: import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import com.mysql.jdbc.preparedstatement; //import com.mysql.jdbc.driver; public class main { public static void main(string[] args) throws sqlexception { try{ class.forname("com.mysql.jdbc.driver").newinstance(); connection conn=drivermanager.getconnection("jdbc:mysql://mysql10.000webhost.com/database","username","password"); java.sql.preparedstatement statement = conn.preparestatement("select * promoid"); resultset result=statement.executequery(); while(result.next()) { system.out.println(result.getstring(1)); } } catch (exception e)...

Firefox Proxy - How to avoid the websites seeing my real ip? -

im trying use proxy firefox, issue sites getting real ip. -if enter http://www.showmemyip.com shows me proxy ip. -if enter http://www.whatismyip.com shows me proxy ip + "no proxy detected" -if enter http://whatismyipaddress.com/proxy-check shows me proxy ip + "proxy server not detected." + on false (green) how can possible detecting ip? saw flash doesnt use proxy configured on firefox... pages im trying access dont have flash script. is there way of being 100% see proxy ip , not mine? thanks! that because proxy pass ip server in http header( detail ), should setup proxy anonymously.

r - How to plot a function that calculates the PDF? -

Image
so pdf function calculates: fx = 0.3 if (0<=x<1) 0.1 if (1<=x<2) 0.25 if (2<=x<3) 0.15 if (3<=x<4) 0.2 if (4<=x<5) 0 otherwise , coding it: fx = function(x) { if ((0<=x) & (x<1)) 0.3 else if ((1<=x) & (x<2)) 0.1 else if ((2<=x) & (x<3)) 0.25 else if ((3<=x) & (x<4)) 0.15 else if ((4<=x) & (x<5)) 0.2 else 0 } how go plotting y=fx? i've tried: x <- runif(n,0,5) y <- fx(x) plot(x, y, type='1', xlim=c(0,5), ylim=c(0,5)) but error 'x' , 'y' have differing lengths? your problems comes down fact function isn't vectorized (it doesn't deal vector well). if use accepted solution previous question exactly same problem won't have issues eg # solution work , vectorized fx <- function(x) c(0, 0.3,0.1,0.25,0.15,0.20, 0)[findinterval(x, c(-inf, 0:5, inf))] x <- runif(n,0,5) plot(x, f...

c++ - How to achieve O(1) erasure from a std::list -

the question recommended way use std::list achieve o(1) erasure of list items? usually, when choose doubly linked list, want able remove element list in o(1) time, , move different list in o(1) time. if element has own prev , next pointers, there no real trick getting job done. if list doubly linked circular list, removal doesn't require knowing list contains item. as per iterator invalidation rules , std::list iterators durable. so, seems me behavior desire when using std::list on own item stash iterator within class, , containing list. class item { typedef std::shared_ptr<item> ptr; struct ref { std::list<ptr>::iterator iter_; std::list<ptr> *list_; }; ref ref_; //... }; this has downside need create own decorated version of std::list knows update ref_ whenever item added list. can't think of way doesn't require embedded iterator, since not having 1 mean erasure incur o(n) find operation first. wha...

node.js - nodejs setTimeout memory leak? -

v0.10.4 here's simple loop results in ever-increasing memory usage: function redx(){ settimeout(function(){ redx() },1000); console.log('loop'); } redx(); what doing wrong ?? edit ok, tried suggestion reference timeout object in scope , seems garbage collection kick in after 40 seconds, here's abbreviated logs top: 3941 root 20 0 32944 7284 4084 s 4.587 3.406 0:01.32 node 3941 root 20 0 32944 7460 4084 s 2.948 3.489 0:01.59 node 3941 root 20 0 32944 7516 4084 s 2.948 3.515 0:01.68 node 3941 root 20 0 33968 8400 4112 s 2.948 3.928 0:02.15 node 3941 root 20 0 33968 8920 4112 s 3.275 4.171 0:02.98 node 3941 root 20 0 33968 8964 4112 s 2.948 4.192 0:03.07 node 3941 root 20 0 33968 9212 4112 s 2.953 4.308 0:03.16 node 3941 root 20 0 33968 9212 4112 s 2.953 4.308 0:03.25 node 3941 root 20 0 33968 9212 ...

MIPS: n choose k function -

so i'm writing calculator in mips , i'm trying write n choose k function. algorithm want use this: if want 5 choose 3 i'll have loop (5*4*3)/(3*2*1). suppose have multiply , divide functions, how implement in mips? right have this, isn't working @ all: calnchoosek: move $t1, $a0 move $t2, $a2 move $t3, $a0 # copies counter move $t4, $a2 loop_top: beq $t3, $t4, loop_bottom subi $t3, $t3, 1 move $a0, $t1 move $a2, $t3 jal multi move $t1, $v0 j loop_top loop_bottom: beq $t4, $zero, exit1 subi $t4, $t4, 1 move $a0, $t2 move $a2, $t4 jal multi move $t2, $v0 j loop_bottom exit1: move $a0, $t1 move $a2, $t2 jal divi i'm thinking logic totally flawed , might have start fresh. me? in loop_bottom , $t4 set 0 in last iteration. multiply $t2 0 , 0 denominator. divi calculating k*(n!-k!)/0 – divided zero!

sql - Save when new record and update when edit on data occurs -

i have code save button , update button there way can combine 2 commands in 1 button? for example when click 'save/update button' save on database if new record , rather update if system found there record on database , save edited data's code save button dim sqlconn new sqlclient.sqlconnection sqlconn.connectionstring = "server = skpi-apps1;" & _ "database = eoems;integrated security=true" try dim mycommand new sqlcommand sqlconn.open() mycommand = new sqlcommand("insert tblofficeequipmentprofile(oe_category,oe_subcategory,oe_id,oe_name,oe_user,oe_brand,oe_model,oe_specs,oe_serialno,oe_propertyno,oe_macaddress,oe_static_ip,oe_vendor,oe_purchasedate,oe_warrantyinclusiveyear,oe_warrantystatus,oe_status,oe_dept_code,oe_location_code,oe_remarks) values('" & cmbcategory.text & "','" & cmbsubcategory.text & "','" & txtoeid.text & "...

.htaccess - htaccess rewrite not working as expected just change my address in addressbar, no rewriting at all -

i have folder/file structure as: rootfolder/ lowres/lowres.php hires/hires.php sys.php basically, want rewrite such when user calls page site.com/img_0001_hq.html, .htaccess rewrite sys.php?1=img_0001_hq. also, want limit acceptable emdings ".html" , "/" , if ending not present want call sys.php?1=p_404. rewriting doing expected when comes errors... when call page site.com/hires/hires.php or site.com/lowres/lowres.php, rewriting not working, scripts (hires.php , lowres.php) run, , report errors, in lack of variables sys.php not triggered. also, when call pages site.com/hires or site.com/lowres, sys.php runs, but, wrong. also, when calling these addresses, address in browser changes site.com/hires/?1=p_404 or site.com/lowres/?1=p_404. heck going on?! :d oh, yeah, .htaccess looks this: indexignore * rewriteengine on rewriterule ^(.*)(/|.html)$ sys.php?1=$1 [l] rewriterule ^(.*)$ sys.php?1=p_404 [l] i going nuts on this... :) try adding c...

Google Drive (401) Not Authorized Error -

i have been using google drive sdk integration since october. has worked fine since then, , have not modified code in project since got working. today, unknown reason, every request download or upload file drive returns error: the remote server returned error (401) not authorized. the section of code working on is: public static stream getdownloadstream(string id) { file file = driveservice.files.get(id).fetch(); if (!string.isnullorempty(file.downloadurl)) { stream stream; var request = (httpwebrequest) webrequest.create( new uri(file.downloadurl)); auth.applyauthenticationtorequest(request); try { var response = (httpwebresponse)request.getresponse(); if (response.statuscode == httpstatuscode.ok) { stream = response.getresponsestream(); } else { ...

flash - ActionScript Compiler UncaughtErrorEvent -

after using asc2 compile air application, found error stack trace missing while catching uncaughterrorevent. here example code: var root:sprite = this; root.loaderinfo.uncaughterrorevents.addeventlistener(uncaughterrorevent.uncaught_error,errorhandle); throw new error("test"); protected function errorhandle(event:uncaughterrorevent):void { var message:string; if (event.error error) { message = error(event.error).message; message+="\n"+error(event.error).getstacktrace(); } else if (event.error errorevent) { message = errorevent(event.error).text; } else { message = event.error.tostring(); } } while using asc1, can see full stack trace in error handle. using asc2, empty stack trace. anyone have same problem? how uncaughterrorevent stack trace? don't cast event.error error , in: error(event.er...

How to handle server errors/exceptions in GWT 2.5 + RequestFactory and PostgreSQL? -

environment gwt 2.5 using requestfactory eclipselink 2.4.1 postgresql 9.1 problem to give context part of requestfactory i'm looking at, i've inserted structure of snippet below: requestcontext.persist().fire(new receiver<objectproxy>(){ @override public void onsuccess(objectproxy response){ //run code here... } @override public void onfailure(serverfailure error){ //see description below needs done here. } in onfailure() function, i'd have different responses errors may thrown postgresql such violation of uniqueness constraint when user tries insert new barcode or new id number has been taken (the user must able choose id). this not have in onfailure() function - looking place in framework handling. questions how identify , respond different error types thrown database or server in gwt requestfactory? step 1 - d...

wpf - SQL server CE 4.0 windows XP -

i have made wpf application works fine on windows7 , xp. however, after adding functionality related databases , entity framework still runs under windows 7 not on windows xp. every time tries use database "operation not supported on platform". i have added dlls needed , modified .config can see app can run without sql server ce 4.0 installed. have tried installing sql ce on windows xp machine , edit .config use instead of dlls, same result. more info: app made run on .net framework 4.0 should try embedded db? <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=4.4.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <system...

xml - php - CURL HTTP Authentication at server side -

i want change xml value in php don't change .... <?php $url = "http://192.168.1.103:8080/ew.xml"; $xml = '<?xml version="1.0" ?> <ddcconfig:getvalue xmlns:ddcconfig="urn:smuddcconfiguration"> <ddcconfig:network> <ddcconfig:localip>192.168.103.223</ddcconfig:localip> <ddcconfig:globalip>168.188.127.123</ddcconfig:globalip> <ddcconfig:rootbridge>yes</ddcconfig:rootbridge> </ddcconfig:network> </ddcconfig:getvalue>'; $ch = curl_init(); curl_setopt($ch, curlopt_verbose, 1); curl_setopt($ch, curlopt_userpwd, "lmk:alrud89"); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_url, "$url"); curl_setopt($ch, curlopt_port, 8080); curl_setopt($ch, curlopt_put, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_postfields,array($xml)); $http_result = curl_exec($...

How to flip a imageView in 45-degree in Android? -

i have known imageview.setrotationy(degree) can horizontal(0-degree) flip, , imageview.setrotationx(degree) can vertical(90-degree) flip. what if want 45-degree flip? how it? thanks help.

class - Understanding variable scope in Python classes -

this question has answer here: how reference existing class variables when defining them 3 answers can please explain why fail: class a: = 42 b = list(a + in range(10)) it fails because a isn't in namespace generator expression can see. this works python2 , python3. lambda default argument trick reference of a in namespace generator expression can see. >>> class a: ... = 42 ... b = (lambda a=a:list(a + in range(10)))() ... >>> a.b [42, 43, 44, 45, 46, 47, 48, 49, 50, 51] using list comprehension b clearer in opinion ... b = (lambda a=a:[a + in range(10)])()

java - My loop using charAt isn't working -

i in need of loop. trying run loop. when array string champs contains character 'b' first letter display both time , champ. could tell me i've done wrong or why isn't showing up? output receive "time champs" public static void displayteam(short[] time, string[] champs){ system.out.println("time champs"); for(int a= 0; < time.length; a++){ char fletter=champs[a].charat(0); if("b".equals(fletter)){ system.out.println(time[a] + " " + champs[a]); } } } thanks helps , contributes. replace this: if("b".equals(fletter)) with this: if('b' == fletter) it's safe use == primitive values char . since fletter char , what's happening code rather complex. @ first glance, 1 might wonder how compiles. what's going on string.equals takes object argument. since fletter char , gets auto-boxed character object. string "b...

algorithm - Computer Vision / Augmented Reality: how to overlay 3D objects over vision? -

i trying create sample application can overlay 3d objects on camera screen. placed @ particular point, , re-drawn every frame user moves camera shift perspective. in essence, i'm looking replicate this: http://www.youtube.com/watch?v=eestftqbzow here's attempt @ phrasing problem more precisely: consider being given initial image matrix (representing x,y pixel coords) @ time of initial object placement. once placed, every subsequent video frame need analyzed re-position object that's been placed can re-drawn (overlayed) correctly given new perspective. i have bit of background in computer vision, unsure how particular task. reference, sample application i'm looking create android, if knows of existing code leverage great well. i'm open being directed academic papers describing algorithms need implement. thanks. this pretty known problem in computer vision. there various papers can refer this, including systems simultaneous localisation , mapping (s...

c# - How to create event receivers programatically? -

we creating content databases, site collections , libraries programatically. uploading documents in document library. want create event receivers programatically in c# (without using visual studio) list created progrmatically ? want activate them programatically. there way ? can please provide me code or link through step step guide ? if can use event receiver template in visual studio , define c# code required event might solve purpose. itemadded event receiver did simple this: public override void itemadded(spitemeventproperties properties) { if (properties.listtitle.equals("cl2")) { using (spsite site = properties.opensite()) { using (spweb web = site.rootweb) { string sytr = web.url.tostring(); string s = web.portalurl.tostring(); string sq = web.serverrelativeurl.tostring(); string str = site.url.to...

dns - Redirecting or rewriting non-www/wildcard to www.domain.com -

i want redirect non www thats domain.com www.domain.com. know there lot of people had posted same question here. went through of them, realized case little different. running e-commerce application on aws ec2 instances load balancer on , dns parked in route 53. integrated akamai had change cname , change domain name domain.com www.domain.com can serve our customers via akamai. problem facing unable redirect domain.com www.domain.com. since route53 doesnt not 301 redirection, re-parked our domain godaddy, has got domain forwarding feature. tried redirect using domain forwarding also, seems not helping enough. presently using wwwzier.com redirect traffic, planning have .htaccess. since commerce between , site expected load faster cant have server level redirection or rewrite. what other ways achieve same. do kindly me since fighting fire since week now. thanks lot. what did setup micro instance apache running. micro instances free year. opened port 80 directly in se...

Is there an app, website, or any way to search all tagged Facebook or Instagram photos of someone? -

i find way search tagged facebook or instagram photos of someone? i have found many ways search hashtags , topics not i'm trying do. want search , display photos tagged usernames/handles. thanks i have been building tool allows search yours , friends' facebook photos. youa can find here: http://www.phemories.com

java - Need 2 radio button but each of them in different Composite group in SWT -

i need 2 radio button each of them in different composite group in swt. need single selection among them. please me code. (need without using swing buttongroup) shell shell = new shell(display); default = new group(shell,swt.radio); default.settext("default"); default.setlayout(new rowlayout(swt.horizontal)); compbutton = new button(default,swt.radio); compbutton.settext("play against computer"); pl2button = new button(shell,swt.radio); pl2button.settext("player1 vs player2"); when try select radio button, both selected.i need 1 of them selected. you can follow below approach if don't want use buttongroup add selection action listener ( button.addselectionlistener ) both buttons in action listener of first button, clear second button similarly in action listener of second button, clear first button

c# - How to generate a reference number by using customer name and year? -

i want generate unique number based on customer name , date of birth. if customer name chandra shekar , date of birth 28/12/1990 . i want xxxx-1990 xxxx should number should generate based on customer name. how can generate number string value? thank you. this tricky if need able guarantee uniqueness immediately . scheme tries convert string "small" number (one smaller in terms of information original string) suffer possible collisions. so depends on requirements. if need able reliably generate id later on give name , number purely algorithmically, you've got problem. on other hand, if can store "name, date of birth, generated id" in table somewhere, start using hash of form (i wouldn't suggest using gethashcode there's no guarantee stay stable on time, common cryptographic hash should fine) , results in table. use part uniqueness, too. example, if hash "fred blogs" gave 1234, , did hash "jim smith", mi...

internet explorer 8 - Pie graph drawn through Highchart not getting loaded in IE8 -

we using highchart api along javascript draw graphs in our application. in ie8 window gets hanged try open graph. don't know how fix this. in other browsers i.e. chrome,mozilla working fine. the code goes var chart=new highcharts.chart({ chart: { renderto: container, plotbackgroundcolor: '#ffffff', plotborderwidth: null, plotshadow: false, spacingtop: 0, spacingbottom: 0, animation: false }, title: { usehtml: true, text: licensetext, style: { color: '#000000', fontsize: '12px', textdecoration: 'underline', fontweight: 'bold' } }, plotoptions: { pie: { borderwidth: width, allowpointselect: false, cursor: 'pointer', startangle: 90, size: size, datalabels: { enabled: showlabel, crop: true } } }, series: [{ name: ...

verification - I need to verify the ownership of website using "metatag" in Webmaster Tools - Response 400: Bad Request -

i need verify ownership of website using "metatag" in webmaster tools. using google webmaster tool api in vb.net. following code logic. dim client new webclient try dim query string client.headers.add("authorization: googlelogin auth=" + _auth) client.headers.add("gdata-version: 2") client.headers.add("content-type", "application/atom+xml") query = "<atom:entry xmlns:atom=""http://www.w3.org/2005/atom"" " + _ "xmlns:wt=""http://schemas.google.com/webmasters/tools/2007""> " + _ "<atom:id>https://www.google.com/webmasters/tools/feeds/sites/http%3a%2f%2ftestwebsite2.demos.classicinformatics.com%2f</atom:id> " + _ "<atom:category scheme='http://schemas.google.com/g/2005#kind' " + _ "term='http://schemas.google.com/webmasters/too...

c# - Navigate Url in Hyperlink is not redirect my page? -

i have hyperlink use navigateurl attribute , give url link in not redirect target page. can when redirect url using code behind working properly. have mention code use in code behind, don't want put code on code behind. can me wrong here. <asp:hyperlink id="hlnkadduser" runat="server" onclick="return gb_show('add hiring manager', this.href, 500, 650)" imageurl="~/images/resources/thumb/add.png" tooltip="add hiring manager" text="add hiring manager"></asp:hyperlink> **<%--navigateurl='<%# "~/recruiter/adduser.aspx?userid=0" + "&profileid=" + hdnclientid.value + "&usertypeid=8" %>'--%>** string hlnkadduserurl = string.format("~/recruiter/adduser.aspx?userid=0" + "profileid=" + hdnclientid.value + "usertypeid=8"); hlnkadduser.navigateurl = hlnkadduserurl; ...

SQL Server : PDO `IN` statement syntax -

how can write following request using pdo? $query = "select test table cond in(1,2,3)"; i tried this, not working: $query = "select test table cond in(?)"; $params = array($condarray); $result = sqlsrv_query($connconfig, $query, $params) ; @your common sense comment trick. reference - asked questions pdo $ids = array(1,2,3); $in = str_repeat('?,', count($arr) - 1) . '?'; $sql = "select * table column in ($in)"; $stm = $db->prepare($sql); $stm->execute($ids); $data = $stm->fetchall();

c# - How to get original string from the int generated by gethashcode -

i have generate hash code as string textboxval="naresh"; int code =textboxval.gethashcode(); textbox2.text=code.tostring(); it has generated integer value -1078339947; now want original name naresh this(-1078339947) hashcode. how can this. for practical purposes, can't: there lot less hash codes there strings, there more 1 original value give same hash code. hashing is, in reality, one-way operation. if refers reversible hash, isn't true hash (because hash by definition reduces input set 1 of smaller number of output values). closest operation describe might encryption function - allow reverse operation - unlikely generate small number 10-digit output in question.

visual studio 2010 - linking libtiff - LNK2001: unresolve external symbol TIFFOpen -

i using msvs 2010 on 64 bit machine. installed tiff libraries version 3.8.2 using set-up file, changed project properties sheet: include - *\gnuwin32\include; linker - *\gnuwin32\lib, input - libtiff.lib. msvs 2010 still gives me linker errors: lnk2001: unresolved external symbol tiffopen lnk2001: unresolved external symbol tiffgetfield lnk2001: unresolved external symbol tiffistiled (because of function calls in 1 of source files). i have tried adding include directory environment variables path well, no avail. downloaded tiff-4.0.3.zip , built libraries command prompt described on libtiff website. updated project properties sheet accordingly: include - *\libtiff; linker - *\libtiff, input - libtiff.lib, libtiff_i.lib. copied libtiff.dll *\windows\system , *\windows\system32 directories , added *\libtiff directory environment variables path. still, msvs 2010 gives me same errors. i have searched online , no 1 seems have had such problem, or have had similar issues diffe...

r - How to calculate the amount of numbers inside a specific range -

i'm still having problems calculating numbers. trying find amount of numbers inside [-0.5 , 0.5] first line, , amount of numbers outside same range in second line. i use abc = rnorm(100, mean=0, sd=1) . have 100 numbers in total, have 35 numbers inside range, , 35 outside range, dosen't add 100. length(abc[abc>=-0.5 & abc<=0.5]) [1] 35 length(abc[abc<-0.5 & abc>0.5]) [1] 35 then tried: length(which(abc>=-0.5 & abc<=0.5)) [1] 40 length(which(abc<-0.5 & abc>0.5)) [1] 26 and still doesn't add 100. what's wrong? you after: r> set.seed(1) r> abc = rnorm(100, mean=0, sd=1) r> length(abc[abc >= -0.5 & abc <= 0.5]) [1] 41 r> length(abc[abc < -0.5 | abc > 0.5]) [1] 59 what went wrong two things: abc < -0.5 & abc > 0.5 asking values less -0.5 and greater 0.5 however, had: abc[abc<-0.5 & abc>0.5] bit different due scoping. let's pull apart: r> ab...

How to create Class Diagram in Eclipse? -

i wanted create class diagram of project in eclipse.the project implemented,suggest me tool sketch diagram of project in eclipse. take @ model development tools (mdt) . for reverse engineering, can use jupe .

asp.net - Call a method in an aspx page -

can call method in asp.net web page (in aspx.cs page) without checking in pageload? for example '../test2.aspx/testmethod in this link have noticed can give url: "pagename.aspx/methodname", in jquery ajax method. have tried , never works me. page methods new mechanism in asp.net application server code cab bound asp.net pages to enable page methods need drag scriptmanager control page , mark enablepagemethods “true”. <asp:scriptmanager id="scriptmanager1" runat="server" enablepagemethods="true"> </asp:scriptmanager> go code behind file of page , add static method [webmethod] public static string helloworld(string name) { return string.format("hi {0}",name); } in javascript function can use pagemethods object call webmethod of page. <script type="text/javascript"> function greetingsfromserver() { var name = 'jalp...

windows phone 8 - Nothing happens after clicking a button -

first of , question title may bit irrelevant. don't know how put title little mess. developed simple windows phone 8 application few days earlier. today added necessary images project submitting in app store. when tried build in release mode, compiler gave me exception in app.xaml.cs file in line : phoneapplicationservice.current.useridledetectionmode = idledetectionmode.disabled; then commented out line check & after application running. after clicking on button in home page, app has gone in idle mode & doesn't navigate other page. page navigation code : navigationservice.navigate(new uri("/category.xaml?", urikind.relativeorabsolute)); can please tell me happening here ?

ios - png file shows up on simulator, but not ipad -

i'm struggling problem maybe can me with. [slider setthumbimage:[uiimage imagenamed:@"circle_black.png"] forstate:uicontrolstatenormal]; the above code correctly displays image in ipad simulator, not on actual ipad device. have had @ other threads , have tried following no success: - lowercase letters (filenames shown, no capitals) - re-created file in case corrupt - clean rebuild - seems in bundle (build phases->copy bundle resources has file listed) my ipad ipad1, ios 5. any other suggestions try? @jason, image name case-sensitive in iphone/ipad, whereas in simulator image name not case-sensitive. check once.

python - List the words in a vocabulary according to occurrence in a text corpus , Scikit-Learn -

i have fitted countvectorizer documents in scikit-learn . see terms , corresponding frequency in text corpus, in order select stop-words. example 'and' 123 times, 'to' 100 times, 'for' 90 times, ... , on is there built-in function this? if cv countvectorizer , x vectorized corpus, then zip(cv.get_feature_names(), np.asarray(x.sum(axis=0)).ravel()) returns list of (term, frequency) pairs each distinct term in corpus countvectorizer extracted. (the little asarray + ravel dance needed work around quirks in scipy.sparse .)

imagemagick - Failed to convert NCL high-resolution postscript to png -

i got postscript file ncl script whit mpdatabaseversion = "highres" (high resolution map). , got imagemagick 6.2.8 run in rhel 5.6 i386. when ran convert high-resolution.ps test.png , got: error: /undefinedresult in --ashow-- operand stack: 0 0 ( ) execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- dictionary stack: --dict:1171/1684(ro)(g)-- --dict:0/20(g)-- --dict:143/200(l)-- current allocation mode local current file position 629039 but same postscript convert without error in rhel 3 i386 imagemagick 5.5.6, how come? i googled while, s...

Azure Hadoop and Entity Framework -

i stating new project needs portable , in scenarios have 100's millions of entities. now azure getting hadoop of course got attention big data scenario. have small data scenario under 1 million rows. entity framework code-first way see designing needing hadoop in mix of course may complicate things (entity framework of course been used give simpler storage providers smaller data sets) now question have experience in mix? can recommended if approach or not, if not there better way? working on reasonably large system based on entity framework code first, caveats have been working ef4 , cannot upgrade 5, mileage may vary , outcomes going affected intend do, experience has been ef doesn't handle large amounts of data tremendously well, quite inflexible, if need change standard behaviour in way there chance going end having hack nasty workarounds, , performance isn't amazing. if want things aren't things ef expects do, can run walls. if thinking of de...

Check JSON string from AJAX response with jQuery -

i've using jquery on contact form web app we're building, getting json response server is: {"success": true} here's jquery far: $('.contact-form').on('submit', function(e) { // prevent submitting e.preventdefault(); // loading data-* attr var $submit = $('#contact-submit'); $submit.html($submit.data('text')); // form data var form = $(this); var post_url = form.attr('action'); var post_data = form.serialize(); // ajax call $.ajax({ type : 'post', url : post_url, data : post_data, datatype: 'json', success: function(){ }, error: function(){ } }); }); i've hit wall i've never 'checked' ...