Posts

Showing posts from August, 2012

javascript - Using $(tag).load() successfully in jQuery -

hi i'm trying use jquery load html document existing html document. i've tried using code below, text doesn't load. i'm not sure why. point me towards i'm doing wrong please? <!doctype html public "-//w3c//dtd xhtml 1.0 frameset//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript">$("#test").load("test.txt")</script> </head> <body> <div id="test"></div> </body> </html> try on dom ready like <script type="text/javascript"> $(document).ready(function(){ $("#test").load("test.txt...

mysql - How to run asp.net 4.0 websites on asp.net 3.5.? -

i have application developed in 4.0 asp.net. , want make changes using 3.5 asp.net. is possible? or have download 4.0 version. i modified web config file according 3.5 version........but not work. it doesn't .net 3.5 .net 2.0, .net 4 significant update. it's better install .net 4.

php - How to get good performances when using symfony 2 ACL system with a large number of object? -

in our project using symfony 2 acl system control access entities stored in database (postgresql). everything works fine until want check permission on large quantity of object (a few hundreds). performance getting bad. on pages number of query database above 4000. number in fact in direct relation number of entities in our database. more grows more query on page need done. is there way check user's authorization on many object while conserving descent performance (keeping number of query db low)? there way load acl data related 1 or many different entities. system tries load them in small amount of query , keeps data around can reused without going database again. private function loadblogpostsacls($blogpostrepository) { $oids = array(); foreach ($blogpostrepository->findby(array(), array('date' => 'asc')) $blogpost) { $oids[] = objectidentity::fromdomainobject($blogpost); } $this->aclprovider->findacls($oids)...

android - Extraction Of Face From a Bitmap -

after being given suggestions use circular crop implemented in application use extract face bitmap inefficient mean of no use , similar cropping rectangular face. here have done til now: launched camera taken picture detected face in picture painting rectangular window in area face has been detected now serious issue facing getting face bitmap. want face. ignore other details in face detection window. if matlab have been simpler of edge detection techniques , segmentation algorithms , function. want know how can same process in android application? plz share code snippets if u know of any. taking of time , want on face extraction part. code did till now: public class makeover extends activity { private static final int take_picture_code = 100; private static final int max_faces = 5; private bitmap camerabitmap = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); ((button)findviewbyid(r...

Amazon s3 - Downloads show as corrupt for some users but not for others -

i'm having strange problem users (all using mac) reporting files downloaded our s3 storage corrupt (even after re-downloads). have tried downloading files myself on both windows, ubuntu , osx , work me, not sure have used exact same browser/os combo have. are there headers needed file downloads required browsers/os combination in order file ok? or there else should up? i kind of assume http-headers moot once file has been downloaded drive , try open there, trying figure out if there can on server end or if problem lies users computers. not quite sure if stackoverflow question, perhaps better @ server fault or super user? never use sites not sure.

windows - Batch File to disable internet options proxy server -

in windows , want disable proxy server setting in internet options using batch script. command can use this? if unsure referring to, see internet properties > connections > lan settings >proxy server thank you it's in registry, under [hkey_current_user\software\microsoft\windows\currentversion\internet settings] you can either use reg command in bat, or prepare couple of .reg files, automate changes. for example, disable proxy, try reg add "hkcu\software\microsoft\windows\currentversion\internet settings" /v proxyenable /t reg_dword /d 0 /f

java - Spring/Hibernate: New entity-classes in dependend project -

i have (eclipse-)project uses spring , hibernate map entities: <bean id="mysessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="mydatasource" /> <property name="annotatedclasses"> <list> <value>book</value> <value>language</value> <value>person</value> <!-- ... --> </list> </property> <property name="hibernateproperties"> <!-- ... --> </property> </bean> now have project depends on projects , includes above mentioned bean in own applicationcontext.xml must add own entities. i not want add entity bean-definition of primary project, because not belong there. how can extend bean mysessionfactory new annotatedclasses used in dependend project? try usin...

filesystems - iOS: How do I rename a folder in the documents directory -

i'm not sure if silly question. if move file using -[nsfilemanger moveitematpath:topath:error:] 1 place e.g. /images/image.png /otherimages/image.png old directory /images deleted automatically or still exist? also, if wanted rename images pictures done in ios or have move new path/url? if move file using [nsfilemanager moveitematpath:topath:error:] source directory won't deleted. if file, stay empty. to rename directory, use same command, don't specify files. example: nserror* error = [[nserror alloc] init]; [nsfilemanager moveitematpath:@"/images/" topath:@"/otherimages/" error:&error]; and directory renamed otherimages , keep contents.

java - Why can't we define main function in static inner classes? -

i have following simple code public class tester { static class testerchild { public static void main(string args[]) { system.out.println("test"); } } } it compiles fine. when run following error [aniket@localhost src]$ java tester error: not find or load main class tester question why can't define our main method in static inner class? update1 : as specified in answers/comments have change code following public class tester { public static class testerchild { public static void main(string args[]) { system.out.println("test"); } } } i compiled , made 2 class files tester.class , tester$testerchild.class . still getting error [aniket@localhost desktop]$ java tester$testerchild error: not find or load main class test update 2: ok included current directory in classpath , executed still getting error [aniket@localhost desktop]$ java -cp . tester$testerchild error: ...

how to set date while type ="date".in jquery -

i want set date .i used .val() function not work in android. <input name="casedate" id="casedate" min="2000-01-01" value="" type="date" class="casedate_h" > js: var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').val(today); $("#casedate").attr("value", today); wrap code inside : $(document).ready(function(){ var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+...

indexing - Using CGI page as directory index in Boa web server -

i using boa web server on arm based board. wish use cgi script home page. in boa.conf, used option directoryindex index.cgi however, when entering ip of host board in browser, error 403, , page accessible if manually add /index.cgi address bar. when changing directoryindex index.html everything works fine. i've tried playing around alias , scriptalias didn't help. realize can use html redirect index.html last resort, feel there must better way. so i've found this patch it written around boa-0.94.14rc20 while i'm using boa-0.94.13 i've managed compile , work changing following line: req->cgi_type = cgi; to reg->is_cgi = cgi; this still isn't perfect though since passing parameters cgi page in boa.conf still results in error 403.

Wordpress Menu Wrap -

the following website's theme, http://174.132.194.251/~taninew/ driving me crazy. i've been able use css code word wrapping , line wrapping in past, seems menu items wrap in 2 or 3 lines. how fix that? you'll want make menu items responsive, or reduce width , padding on menu list

How to replace one dll in deployed azure worker role to modified version? -

i need replace 1 dll-file in deployed azure worker role 1 modified, because role contains bug , don't have release tag. i'm trying via rdp, when i'm trying copy new dll approot folder vm tells me old dll file open in program , can't replayced. this isn't idea. should repackaging deployment , performing update. attempting via rdp may replace file, if role goes down or gets moved when windows azure bring role change gone since redeploy last package knew about, you'd dll bug in it. as why telling open because worker role actively using likely. you'd have stop worker role process able replace it. best option still perform update of whole package. you can see documentation more information how updates occur: http://msdn.microsoft.com/en-us/library/windowsazure/hh472157.aspx

c# - Windows XP compatibility -

i working on project targets windows xp platform. have been developing on windows xp virtual machine visual studio 2008 (with .net 3.5) make sure going work client. method became annoying (turning on, turning off, minimizing, restoring virtual machine window, lower performance). on native machine, using visual studio 2012 ultimate on windows 7. if going import project machine native 1 , continue developing it, how can sure going work on windows xp? my application written in c# .net framework 3.5. make sure target .net framework 3.5 in visual studio 2012. how to: target version of .net framework rebuild application , test in virtual xp machine. windows xp supporting .net framework 3.5 there should no problems. microsoft .net framework 3.5 but tell client microsoft support windows xp going end should start planning upgrade. http://www.microsoft.com/en-us/windows/endofsupport.aspx

python - Stucked in a django south migration - TransactionManagement error -

i having trouble when applying django south migration: as always, executed migrate command after successful schemamigration python manage.py migrate webapp the log console: running migrations webapp: - migrating forwards 0020_auto__add_example. > webapp:0020_auto__add_example transactionmanagementerror: transaction managed block ended pending commit/rollback the error not related specific migration if move backwards , try shows same message. any ideas? edit. log of query: (0.005) select `south_migrationhistory`.`id`, `south_migrationhistory`.`app_name`, `south_migrationhistory`.`migration`, `south_migrationhistory`.`applied` `south_migrationhistory` `south_migrationhistory`.`applied` not null order `south_migrationhistory`.`applied` asc; args=() running migrations webapp: - migrating forwards 0020_auto__add_example. > webapp:0020_auto__add_example (0.002) create table rollback_test (x int); args=() transactionmanagementerror: transaction managed block ende...

php - How to display website link, facebook & twitter icon in QR code using phpqrcode? -

i display website link, facebook & twitter icons. i display 1 of above fields (links not fb , twitter icons) qrcode::png($website); qrcode::png($facebook); qrcode::png($twitter); but want display combinedly below website: http://example.com/ [ facebook icon ] [twitter icon]

java - Why is there a need of the 2 following methods in NumberFormat? -

i see numberformat has 2 methods similar: 1) abstract number parse(string source, parseposition parseposition) returns long if possible (e.g., within range [long.min_value, long.max_value] , no decimals), otherwise double. 2) object parseobject(string source, parseposition pos) parses text string produce number. in presence of parse(s,parseindex) need of parseobject(..) needs cast desired output? aware first method throws parseexception , latter not. wondering why need of these 2 similar methods. in advance. one of commonly heard complaints jdk why integer.parseint , similar methods cannot used validate string without involving expensive mechanism of exceptions. numberformat seems have answered complaint providing method can signal failure returning null .

asp.net - How can I count different values stored in one cell in SQL? -

i have survey, questions yes or no answers. made 1 page in asp.net , of questions radio buttons , answers same text in .net . .aspx: asp:radiobutton id="money1" runat="server" groupname="money" text="yes" asp:radiobutton id="money2" runat="server" groupname="money" text="no" .aspx.cs: if (money1.checked) { cmd.parameters.add(new sqlparameter("@money", money1.text)); } else if (money2.checked) { cmd.parameters.add(new sqlparameter("@money", money2.text)); } sql field: money nvarchar(50) checked now ok, , result stored in db requested. but have make report , i'm trying make sql view count results of yes , no questions, specifically, how many people answered yes , no? can see, both results stored in 1 cell. so, correct sql statement should use catch count of answer different result. select money, count(*)...

windows phone - How to accessicon from images using position in XAML style sheet -

Image
how accessicon images using position in xaml style sheet like have below image , want access icon @ 2 row , 2 column by using xaml style sheet idea. http://www.evohosting.co.uk/blog/wp-content/uploads/2011/07/blue.jpg thank you that image not conducive being split (some of shadows overlap icons below), if want can: create class has method returns icon icon sheet given row , column create converter calls method , use source binding of image . this class takes source image , width , height of each icon. given row , column index, geticon function calculates x , y position of icon , returns croppedbitmap containing icon. icons ask cached don't end creating same icon multiple times. public class iconsheet { public bitmapimage sheetsource; private int iconwidth, iconheight; private dictionary<tuple<int, int>, croppedbitmap> cache = new dictionary<tuple<int, int>, croppedbitmap>(); public icon...

java - Compress image from URL before download? -

i want know if it's possible compress image before actual download. let's image on specific url 500kb big, want compress 50kb or 100kb. i'm asking because have gridview in android populated imageviews specific url. , if image/s on url "big" download slow. how deal particual problem, idea? possible? yes, can if write corresponding service on server. it's better offer images in different sizes or qualities begin , load files need. for example, have foo-highquality.jpg low compression (high quality) , foo-lowquality.jpg high compression (low quality). app load each file depending on need. you cannot make server not control "compress" you.

scala - Structured Type to match Class Constructor -

is possible create structured type ins scala match class constructor (as opposed method/function definitions in class) to match method call class, this type sometype : {def somemethod:string} which allows make method goes this somemethod(a:sometype) = { println(a.somemethod) } what equivalent this type anothertype: {.......} which work this class userid(val id:long) extends anyval so can this anothermethod(a:anothertype,id:long):anothertype = { new a(id) } anothermethod(userid,3) // return instance of userid(3) i believe possible using manifest using runtimeclass , getconstructors, wondering if possible using more cleanly (by using structured types) instead of reflection or structural types, consider using types companion object function value, scala> case class userid(val id: long) extends anyval defined class userid scala> def anothermethod[t, u](ctor: t => u, t: t) = ctor(t) anothermethod: [t, u](ctor: t => u, t: t)u scala...

c++ - Identifying the nth inserted element of matrix which fills by inserting alternating upper and lower triangle elements -

i trying write function able map nth inserted element matrix (i,j) position. known method filling matrix, doing in following way non-standard way. (0,0)...(0,1)...(1,0)...(0,2)...(2,0)...(n,0)...(0,n)... (1,1)....(1,2)...(2,1)...(n,1)...(1,n) .....(n,n) in other words starts @ top left, , after inserting diagonal element, inserts alternating elements upper , lower triangle way across outter row & column, rinses , repeats steps 1 row / 1 column in. and trying achieve function std::pair<int,int> getmatrixcoordinates (int nthelement) { return std::pair<int,int> (row, col) ; } this merely takes bit of programming: template <int n> std::pair<int, int> getmatrixcoordinates(int i) { int a(n - std::sqrt(n * n - i)); int b(i - (2 * n - a) * a); int c(a + (b + 1) / 2); return std::make_pair(b & 1? a: c, b & 1? c: a); }

html - How to prevent automatic line break -

i've div of 200px width , text in it, how should prevent automatic line break if text gets longer 200px? <div style="overflow:hidden; width:200px;"> long text </div> just use css property <div style="overflow:hidden; width:200px; white-space:nowrap"> long text </div>

html - background-image no display -

i'm busy creating simple site. when tried create background-image, wouldnt display. i've used same mapping normal image, check if mapping wasn't wrong. this current code: <body> <table> <!-- multiple <trs><tds><divs></divs></tds></trs> --> </table> </body> my css looks this: * { padding:0; margin:0; } html, body { height:100%; width: 100%; } body{ background: transparent url('./img/background.jpg') no-repeat 0 center; display: inline-block; } edit: i've changed to: background: transparent url('../img/background.jpg') no-repeat 0 center; it worked, when refreshed page again, stoped working.. change code background: transparent url('./img/background.jpg') no-repeat 0 center; , write background: transparent url('../img/background.jpg') no-repeat 0 center;

Android app freezes without ANR after moving code into runnable -

i'm implementing custom camera , use onpreviewframe() real-time fx. main effect (fx1) runnable , seems ok, dropping frames when needed. second simpler fx (fx2) runs when fx1 off. when fx2 running on main thread ok (it runs in 2msec) saw anr decided move second runnable, causing app freeze. class fx2runnable implements runnable { private byte[] data; fx2runnable(byte[] _data) { data = _data; } public void run() { hview.fx2(data); hview.post(new runnable() { public void run() { hview.postinvalidate(); //.invalidate(); caused anr!! } }); flag_fx2_processing = false; } } here how call it private previewcallback previewcallback=new previewcallback() { public void onpreviewframe(byte[] data, camera cam) { if(fx==1) { // fx1 if(flag_fx1_processing) { //skip } else { flag_fx1_process...

html - Rotate a div in jQuery and stopping it with value recieved from server -

i rotating div using keyframe animation , working fine. while div rotating waiting server response , once recieve response (which angle) want stop div @ particular angle. i tried remove class animating when div coming orignal position visual flick , resting @ required place. here jsfiddle http://jsfiddle.net/bvkwh/3/ jquery : $("#stop").click(function () { var pos = $(".pos").val(); $("#bg > img").removeclass('animate'); $("#bg > img").css({ '-webkit-transform': 'rotate(' + pos + 'deg)' }); $("#bg > img").css({ '-moz-transform': 'rotate(' + pos + 'deg)' }); }); $("#start").click(function () { $("#bg > img").addclass('animate'); }); css: #bg { height: 500px; width: 500px; overflow:hidden; } #bg > img { -webkit-transition: 2s; -moz-transition: 2s; } #bg...

sql - How to optimumly perform a MySQL query on a datetime column using only the time component -

i have mysql datetime column want query against, want query time of day component of datetime column, believe using functions hour() minutes() etc create full table scans. using query below not optimum. select datetime_col articles time(datetime_col) > "09:00:00" && time(datetime_col) < "13:00:00" what best way query time component?

c# - Extract variables from querystring -

i need parse following string /mydata.csv(membercount.sum,production.sum[salesperson="james almond","area="europe "area 1" (germany)",area="north america",area="north america [level a]"]) the first part easy, clause within brackets ([]) giving me bit of headache since can contain double quotes example shows. (note content within brackets can change dynamically) i expect following output when parsing last part of string : salesperson james almond area europe "area 1" (germany) area north america area north america [level a] i've been working regex can't seem right. hoping have magic! you may give try balancing group definitions : string pattern = @"^[^\[\]]*" + @"(" + @"((?'open'\[)[^\[\]]*)+" + @"((?'close-open'\])[^\[\]]*)+" + @")*" ...

Writing Calculator class into a "Command Line Calculator" program (Java) -

here relevant part of main program assignment: public static void main(string [] args) { int characters = args.length; if (characters < 3) system.out.println("you did not type in calculation!"); else if (characters % 2 == 0) system.out.println("invalid number of command line parameters."); else { calculathor counter = new calculathor(); counter.count(args); } } } i'm allowed write class shown below (calculator) program in assignment. can't figure out how printable result calculation. i presume switch statement working intended in receiving operator user's input , putting use need else actual result. class calculator { int result; int = 0; string[] args; void count(string[] args) { switch (args[i].charat(i)) { case '+': result = integer.parseint(args[i]) + integer.parseint(args[i+2]); break; case '...

javascript - return to index.html from images.html by using phone back button in phonegap android -

i working on android phonegap, app has 2 .html pages ,(1) index.html has multiple pages using jquery mobile, have link in index.html (2)images.html, images.html simple html page, want phone's button navigate index.html's multiple page having id #page2 when on images.html. 1 can plz me in getting work (hardware) phone's button navigate index.html#page2, have button code working absolutely fine in index.html, how can make useable index.html#page2 images.html here button code whick working index.html..... // javascript document $("#page2").click(function(){ $.mobile.changepage("#page2"); }); document.addeventlistener("deviceready", ondeviceready, false); // phonegap loaded function ondeviceready() { console.log("phonegap ready!"); // waiting button document.addeventlistener("backbutton", handlebackbutton, false); } // handle button function handlebackbutton() { console.log("back button pressed!"); if($.mob...

r - Exporting a Data Set (package development) -

i have package ( qdap ) , accompanying data package ( qdapdictionaries ) used of functions in qdap seen here in line 41 use syn.env line 454 here . i have asked a related question on r-help list told off list not appropriate list uses private notation roxygen2, however, export data sets qdapdictionaries . tried adding @export .r file describes data sets results in error when compiling. > set(qdapdictionaries) installing qdapdictionaries "c:/r/r-3.0.1/bin/i386/r" --vanilla cmd install \ "c:\users\trinker\github\qdapdictionaries" --library="c:/r/r-3.0.1/library" \ --with-keep.source --install-tests * installing *source* package 'qdapdictionaries' ... ** r ** data *** moving datasets lazyload db ** inst ** preparing package lazy loading ** *** installing indices ** building package indices ** testing if installed package can loaded *** arch - i386 error in namespaceexport(ns, exports) : undefined exports: abbreviations, actio...

can class inherit struct in C++? -

this question has answer here: in c++, can derive class struct 3 answers i have following code in c++: typedef struct { int a; int b; float c; } data; class datainfo : public data { // code here }; my question can class inherit struct in c++? how happens? struct included in c++ provide complitability c. has same functionality class , members in struct public default. can inherit class struct , same in reverse.

asp.net - How to use common master page for C# and VB.NET WebForms sites -

the problem i have 2 projects: 1 c# webforms application (child) based on .net 4.5 (visual studio 2012), second vb.net webforms app (parent) running .net 4.0 (visual studio 2010). need use master page parent project (including code behind , controls embedded in master), session state , authentication info in child. what i've done i think may possible creating virtual directory in parent site containing child project , linking parent masterpage directly. when tried it, i've got unresolved reference errors, i've tried adding parent dll referenced child project. i suppose may possible have common authentication info , session state) when running 2 distinct sites under single domain, can handled virtual directory , session state stored in separate process or in sql. still, there problem master containing logic (mainly common layout/controls) i'm unable bind new project far. don't know , try next. is there possibility glue 2 projects common master page temp...

java - Forwarding a request in Spring WebFlow -

currently application logic using request parameters execute logic. in new requirement can request have db key(db have values) request parameter. can fetch data database problem existing logic/flow not work expects data in parametermap. in spring-mvc can forward request again , append parameters request @controller public class testcontroller { @requestmapping(value="/test") public string showtestpage() { return "forward:/test2?param1=foo&param2=bar"; } } @controller public class testcontroller2 { @requestmapping(value="/test2") public string showtestpage(httpservletrequest request) { string param1 = request.getparameter("param1"); string param2 = request.getparameter("param2"); return "testpageview"; } } but in spring-webflow not sure how replicate same behavior works on states instead of request mapping. can please let me know if there way forward in spri...

powershell - Could not load file or assembly -

in power shell script loading custom assembly , instantiating class of assembly new-object . assembly.loadfile() executes new-object statement gives bellow exception. new-object : exception calling ".ctor" "1" argument(s): "could not load file or assembly 'myassembly, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of ts dependencies. system cannot find file specified." script: [system.reflection.assembly]::loadfile("myassembly.dll") $a=new-object myassembly.myclass -argumentlist "arg1" this custom assembly references following assemblies system system.core system.runtime.serialization system.xml.linq system.data system.xml i tried explicitly loading system.runtime.serialization dll below. same exception [system.reflection.assembly]::load("system.runtime.serialization, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089") any idea? don't use loadfile . sin...

javascript - If state of checkbox was changed can it be permanently saved on page? -

if checkbox checked/unchacked want save state permanently on page. try smth this: function savestate() { document.getelementbyid($(this).parent().attr('id')).innerhtml = '<input type="checkbox" checked onclick="savestate.call(this)">' } and <td id="test"> <input type="checkbox" onclick="savestate.call(this)"> </td> but after page refresh changes missed. you have 2 options data persist across page loads: save server-side save client-side using local storage quickest client-side option: localstorage.setitem("state", savestate()); // save localstorage.getitem("state") //

c# raw socket ip header total length -

i using udp raw sockets. i wish read first, example, 64 bytes of every packet. ipaddr = ipaddress.parse( "10.1.2.3" ); sock = new socket(addressfamily.internetwork, sockettype.raw, protocoltype.ip); sock.bind(new ipendpoint(ipaddr, 0)); sock.setsocketoption(socketoptionlevel.ip, socketoptionname.headerincluded, true); sock.iocontrol(iocontrolcode.receiveall, bitconverter.getbytes(rcvall_iplevel), null); sock.receivebuffersize = 32768; byte[] buffer = new byte[64]; // max ip header, plus tcp/udp ports while (!btheend ) { int ret = sock.receive(buffer, buffer.length, socketflags.none); ... } i receive packets, ip header' "total length" <= 64. if use bigger buffer ( byte[] buffer = new byte[32768] ), got right "total length" ( value <= 32768 ). the goal packets, ip header, corret packet length; routine doesn't have cause packet fragmentation tcp/ip stack. socketflags.peek means data returned left intact subseq...

node.js - Incorrect connections number -

i wrote simple script retrieve list of connected users. var app, io, server; app = require("express")(); server = require("http").createserver(app); io = require("socket.io").listen(server); server.listen(1339); app.get("/", function(req, res) { res.sendfile(__dirname + "/index.html"); }); console.log('init', io.sockets.manager.server.connections); io.sockets.on("connection", function(socket) { console.log('connect: ', io.sockets.manager.server.connections); socket.on("disconnect", function(data) { console.log('disconnect: ', io.sockets.manager.server.connections); }); }); and html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect('http...

hadoop - Handling bad records during sqoop import or export -

i looked @ options provided sqoop export operation not find options handle bad records. example once in while possible character present number expected in huge set of records. there way handle these scenarios in sqoop without failing job , providing bad records in file. sqoop expects data export clean , not provide facilities handle corrupted data. can use mr/pig/hive job clean data up, prior using sqoop export them.

java - 3d triangle in libgdx -

my problem in libgdx, created triangle in 3d mesh class in simple piece of code : mesh = new mesh(true, 3, 3, new vertexattribute(vertexattributes.usage.position, 3, "vposition")); mesh.setvertices(new float[] { vert1.x, vert1.y, vert1.z, vert2.x, vert2.y, vert2.z, vert3.x, vert3.y, vert3.z }); mesh.setindices(new short[] { 0, 1, 2 }); what important me able change vert1, vert2, vert3, store triangle vertices coordinates, want create triangle during game. when triangle displayed, seems appear @ desired place, according give him in verts vector3. now, here's thing : used camera.rotatearound() create way around scene , created small box see if script camera merely working. ! can see box rotating if move camera. when rotate around scene, triangle created doesn't rotate , stays motionless @ screen, 2d mesh ! so here question : how make 3d triangle in libgdx , how make triangle render according camera movement ? found solution here ...

c++ - Is there any library similar to conio.h? -

i installed codeblocks , wanted make program reads keystrokes instantly, without me having press enter. did when using dev c + + on windows, i'm using ubuntu , codeblocks best ide found , not have library . can tell me if there conio, , if so, how install? linux alternative conio.h ncurses library. install search packages: libncurses , libncurses-dev .

SQL Statement for more than one type of code in the same column -

i have basic query selecting 1 table , joining table. on second table using filter on column exclude records don't want. the first table basic, things name, id, address, etc. contains no duplicates. second table (product table) more this: id code desc desc2 ----------------------------------------- 94 pg county code sydney, ne 95 pg county code monticello, ut 96 pg county code vernal, ut 97 pg county code other, out of state pg county code no data 1 ps race code spanish american 2 ps race code other - white 3 ps race code black 4 ps race code american indian and select looks this: select a.*, b.desc custtable inner join prod_table b on a.id = b.id b.code = 'pg' i have need records prod_table code = 'ps'. is there way in 1 qu...

c# - How to extend TextAreaFor in MVC -

i know how extend textboxfor : public static mvchtmlstring textboxfor<tmodel, tvalue>(this htmlhelper<tmodel> htmlhelper, expression<func<tmodel, tvalue>> expression, object htmlattributes) { mvchtmlstring html = default(mvchtmlstring); routevaluedictionary routevalues = new routevaluedictionary(htmlattributes); html = system.web.mvc.html.inputextensions.textboxfor(htmlhelper, expression, routevalues); return html; } i want same textareafor unfortunately system.web.mvc.html.inputextensions dose not contain textareafor method. how can solve ? see doc , it's in textareaextensions static class return system.web.mvc.html.textareaextensions.textareafor(htmlhelper, expression, routevalues); or just return htmlhelper.textareafor(expression, routevalues); by way, third argument (as in textboxfor) idictionary<string, object> htmlattributes , nothing routevalues. ...

iphone - Data fetch from database -

i stored information in server. used json fetching data. data fetch , store device database , fetch it. problem have set images in cat_id=1 & set images in cat_id=2. im using different array different set of images const char *sql = "select id,cat_id,product_image product cat_id = '1'"; , const char *sql = "select id,cat_id,product_image product cat_id = '2'"; . if use "%@" displays values. code: first set of images: if (sqlite3_open([path utf8string], &database) == sqlite_ok) { const char *sql = "select id,cat_id,product_image product cat_id = '1'"; nslog(@"sql %s",sql); sqlite3_stmt *statement; // int catid = 0; if (sqlite3_prepare_v2(database, sql, -1, &statement, null) == sqlite_ok) { // "step" through results - once each row. while (sqlite3_step(statement) == sqlite_row) { catname = [[nsstring alloc] initwithutf8string: (const char *) sqlite3_column_text(statemen...

Odd string split in ruby? -

i have expression "1=2,3=(4=5,6=7)" , want create hash out of - 1 => 2, 3 => (4=5,6=7). can in 2 passes. in first pass, can transform (.*) (4;5,6;7) , in 2nd pass split. any better solutions? as long don't need worry nested parentheses, , inside parentheses treated plain string: str = "1=2,3=(4=5,6=7)" hash[str.scan(/([^=,]+)=(\([^\)]+\)|[^=,]+)/)] # => {"1"=>"2", "3"=>"(4=5,6=7)"} if need nested hashes, use recursive method: def hashify(str) arr = str.scan(/([^=,]+)=(\([^\)]+\)|[^=,]+)/).map |key, val| if val[0] == '(' && val[-1] == ')' [key, hashify(val[1..-2])] else [key, val] end end hash[arr] end hashify "1=2,3=(4=5,6=7)" # => {"1"=>"2", "3"=>{"4"=>"5", "6"=>"7"}} note still doesn't handle nested parentheses properly. need prope...

java - How to implement environment-specific init parameters in my tomcat application -

i'd able implement configuration-less deployment java application (tomcat7, spring-mvc). example, right considering creating 1 context.xml file each environment (prod, stage, dev) deploy to: context_prod.xml context_stage.xml context_dev.xml context.xml (for localhost) on each of our servers have symlink context.xml point appropriate context file (e.g. context_prod.xml). when deploy, don't have worry changing database references, keys, etc. i feel there's better way this; perhaps 1 built spring? spring has added functionality handle environment configuration: http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/ this still seems little bit complicated me , have done asking in own spring mvc applications our logging. in dispatcherservlet configuation have line: <context:property-placeholder location="classpath*:/system.properties"/> <util:properties id="mysystemproperties" location="classpat...

android - How do I avoid focus highlighting in touch mode? -

i'm trying make app friendly keyboard driven navigation , i've added focus highlight around actionable items. i'm having trouble removing focus highlighting when operating in touch mode. in other words, don't want focus highlighting visible when not using keyboard navigation. possible? i'm experimenting several variations of item states in selector xml toying different values of focusableintouchmode i'm not getting anywhere. have edittext defined follows: <edittext android:id="@+id/edittext1" android:background="@drawable/edit_text_selector" android:focusable="true" android:enabled="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/textview2" android:layout_torightof="@+id/textview2" android:ems="10" android:inputtype="textemailaddress" > <request...

linux - How scheduler gets called when a high priority task comes -

i have read here situations scheduler called. happens when high priority task comes? high priority tasks scheduled more low priority tasks when high priority task comes still has wait until quantum of running task over.

Constants in EL 3.0 - Property not found -

i'm trying reference constant el on jsf page ( https://java.net/projects/el-spec/pages/staticfield ), i'm stuck on exception: javax.servlet.servletexception: /faces/signup.xhtml @18,85 maxlength="#{signupbean.username_maxlength}": property 'username_maxlength' not found on type com.foo.signupbean i'm using tomcat 8.0.0-rc1 , here backing bean , input declaration: bean: @managedbean @requestscoped public class signupbean implements serializable { public static final int username_maxlength = 30; ... } input field on page: <input type="text" jsf:id="username" jsf:value="#{signupbean.username}" maxlength="#{signupbean.username_maxlength}" /> update: with maxlength="#{(com.foo.signupbean).username_maxlength}" i'm getting java.lang.nullpointerexception: argument error: parameter value null first, off, see balusc's updated answer how use constants in el 3.0 ex...

java - How to avoid this warning:com.sun.org.apache.xerces.internal.parsers.SAXParser is Sun proprietary API and may be removed in a future release -

recently upgraded jdk1.5 jdk1.6, during compilation below warning thrown. import com.sun.org.apache.xerces.internal.parsers.saxparser; ... org.xml.sax.xmlreader l_oparser = new saxparser(); during compilation [javac] c:\users\project\src\com\test\ecommerce\services\paymentservices\authorization\historytransactionresponseparser.java:14: warning: com.sun.org.apache.xerces.internal.parsers.saxparser sun proprietary api , may removed in future release [javac] import com.sun.org.apache.xerces.internal.parsers.saxparser; this warning not shown when compiling jdk1.5. you should use approach suggested in java api xml processing (jaxp) , let runtime decide implementation of sax parser. example: saxparserfactory spf = saxparserfactory.newinstance(); spf.setnamespaceaware(true); saxparser saxparser = spf.newsaxparser();

c# - Silverlight Toolkit ; Pie Chart Avoiding Some Colors -

we need create chart service types. types can added dynamically , don't have proper color definition each of them. so using telerik silverlight radchart , fine until client came trick requirement. shouldn't show 2 colors in grid: red , green. there way avoid red , green palette of colors , still able render chart random colors? a solution toolkit charts generate colors in c# code , rewrite pie data point template. way have found article explaining same approach telerik charts: binding color of series items so if want eliminate 2 colors, set other colors chartitemmodel.color property. c# code this: public class chartitemmodel { public string title { get; set; } public double value { get; set; } public brush color { get; set; } } var chartitems = new [] { new chartitem { title = "item1", value = 25, color = (brush)resources["bluebrush"] }, new chartitem { title = "item2", value = 75, color = (brush)res...

java - Using Swingworker to constantly update a GUI -

in code, user presses button, , want invoke swingworker background thread, loop through list, cross reference other data, , update gui jlabel every pass through loop. problem know should in doinbackground(), have nothing return, , want update jpanel new jlabel every time loop loops. how do this? thanks! here complete example swing worker example you have use publish() , override process() example: class worker extends swingworker<void, string> { @override     protected void doinbackground() throws exception { //here make heavy task running in thread not in edt //process after time call publish()     }     @override     protected void process(list<string> chunks) {         //this executed in edt //here update label     } }

android - How to swap regions in bitmap -

ex.: i have bitmap size 500x500. , on bitmap have coordinates 2 regions. 1 region @ x=10, y=10, size 10x10 second region @ x=400, y=400, size 10x10 what best way swap 2 regions in bitmap. you can trough canvas. something like: bitmap swapped = bitmap.createbitmap(origin.getwidth(), origin.getheight(), origin.getconfig()); canvas drawer = new canvas(swapped); drawer.drawbitmap(origin, new rect(0,0,100,100), new rect(100,100,100,100), paint); drawer.drawbitmap(origin, new rect(100,100,100,100), new rect(0,0,100,100), paint); at point 'swapped' bitmap have origin pieces drawed in different regions. for more see canvas documentation: http://developer.android.com/reference/android/graphics/canvas.html#drawbitmap(android.graphics.bitmap , android.graphics.matrix, android.graphics.paint)

c++ - glfw3 specific refrences missing with glfw3 -

when had tried compile example code glfw3 on http://www.glfw.org/documentation.html (copy/pasted test compilation), got following errors: /tmp/cccdekoi.o: in function main': example.cpp:(.text+0x38): undefined reference toglfwcreatewindow' example.cpp:(.text+0x5b): undefined reference glfwmakecontextcurrent' example.cpp:(.text+0x7a): undefined reference toglfwwindowshouldclose' collect2: error: ld returned 1 exit status i compiling g++ example.cpp -o example -lgl -lglfw , when installed latest glfw 3.0.2, installed without problems. glfw3 builds libglfw3 default, not libglfw glfw2 did. you're still linking against glfw2 installation. solution: g++ example.cpp -o example -lgl -lglfw3

c# - Retrieve values from a ClientDataSet -

i writing webservice implements 3 interfaces. 1 of them uses reference com interface named interop.xxxora. in public interface of interop.xxxora i've got functions "getshiftreportdata" , "doendofshift": int doendofshift(string clientkey) member of eps30ora.ieps30svr dynamic getshiftreportdata(string clientkey, int shiftno) member of eps30ora.ieps30svr getshiftreportdata returs clientdataset (delphi) this line in webservice call it: int shift_num = svr.doendofshift(inputparams.ck); object shift_data = svr.getshiftreportdata(inputparams.ck, shift_num); i don't error buy dont nothing in shift_data. i need know how access returned cliendataset in order send values client. any appreciated. thanks in question (both title , last substantive sentence), seem saying have "returned clientdataset" want access. i don't know client is, other data-oriented interface tclientdataset, think best , easiest way access tclient...

json - Weather Underground API to get historical data in Python -

i trying pull historical data weather underground api. adapted python example code (see below). when run exception "typeerror: list indices must integers, not str" json stream includes bunch of fields daily summary information (dailysummary), cannot out , of values have in list. i put url json viewer @ structure, , cannot figure out doing wrong. appreciated. import urllib2 import json f = urllib2.urlopen('http://api.wunderground.com/api/d08c4738fb303c66/geolookup/conditions/q/ca/san_francisco.json') json_string = f.read() parsed_json = json.loads(json_string) location = parsed_json['location']['city'] temp_f = parsed_json['current_observation']['temp_f'] print "current temperature in %s is: %s" % (location, temp_f) f.close() h = urllib2.urlopen('http://api.wunderground.com/api/d08c4738fb303c66/history_19760508/q/ca/san_francisco.json') json_string = h.read() parsed_json = json.loads(json_string) date = pa...

php - setting up if(!filter_var($email, FILTER_VALIDATE_EMAIL)) -

i running insert form , checking errors. when try put if(!filter_var($email, filter_validate_email)) in if statement, loads blank white page no matter what. not set on server? how if that's case. here context trying use it: if(empty($_post['email']) && !filter_var($email, filter_validate_email)) { thanks

java - Tomcat Container Managed SSO Valve and Spring Security -

we have on dozen legacy web applications (each own app contexts) use tomcat's container managed security simple form-based authentication. use tomcat's single sign on valve allow authenticated users jump between web apps without need of re-authenticating. developing new web applications using spring security framework. is possible users authenticated via new spring security apps able jump older legacy (non-spring) apps without need of re-authenticating? way bridge spring security tomcat sso valve? i prefer avoid making changes legacy web apps, understand if doesn't seem possible. you able using j2eepreauthenticatedprocessingfilter: http://static.springsource.org/spring-security/site/docs/3.2.x/reference/htmlsingle/#d4e2766 please note: when tomcat sso configured provides java ee authentication web application. means application transparent if authenticated form authentication or tomcat sso. java ee authentication. so, need use j2eepreauthenticatedpro...