Posts

Showing posts from March, 2014

android - TableLayout looks fine on emulator but not on device -

android - TableLayout looks fine on emulator but not on device - i'm running code on emulator android 2.2 , works fine. when set on device (galaxy s 2.3.3) main screen should show list of elements in table - stays blank. toasts shown , header app_name the table made of button (defined in xml) , list of elements loaded db. main.xml <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <tablelayout android:id="@+id/tablelayoutmain" android:layout_width="match_parent" android:layout_height="wrap_content"> <tablerow> <button android:text="@string/add_button" android:id="@+id/add_button" android:layout_height="wrap_content" android:layout_margint...

c++ - Singleton class pointer assignment doesn't work -

c++ - Singleton class pointer assignment doesn't work - i have class abc singleton.(this c++) when abc *b = abc::getinstance(); abc* a; a=b; then when check in debugger value of b not assigned a. in debugger value of shown 0x00000000 , garbage values members of abc (vs 2008 debugger) i did *b in debugger watch window , see valid values, when *a see null , garbage values (this after above process over) a , b pointers. the address point same, although specific address different. one other reason might you're debugging in release mode, , you're not using variable a afterwards. in case, compiler can decide omit declaration , assignment of a . c++ singleton

sql - strange behavior with Turkish language setting -

sql - strange behavior with Turkish language setting - i have database collation arabic_ci_as when have windows english language settings can do select column table column= 'a' and can do select column table column= 'a' i mean naming not case sensitive in turkish windows if of names not named in db raise error in windows application i mean in turkish windows names must case sensitive any thought explain , how solve such don't face 1 time again in language settings the difference might in collation used. depending on collation, code might case sensitive or case insensitive. you can check server collation command: select serverproperty('collation') somwtimes, database collation may different, check command: select databasepropertyex('databasename', 'collation') for more info, see this article. sql sql-server-2005 sql-server-2000

c# - Pulling Data from 1 DataContext to use in another's Method -

c# - Pulling Data from 1 DataContext to use in another's Method - i have been trying convert sql statement linq 1 , having problem fact part of info returned in seperate database(datacontext) rest. pretty sure can overcome seem failing @ accomplishing or finding examples of previous successful attempts. can offer guidance on overcome hurdle? thanks select p.personid, p.firstname, p.middlename, p.lastname, cp.enrollmentid, cp.enrollmentdate, cp.disenrollmentdate [connect].dbo.tblperson p inner bring together ( select c.clientid, c.enrollmentid, c.enrollmentdate, c.disenrollmentdate [cmo].dbo.tblcmoenrollment c left outer bring together [cmo].dbo.tblworkerhistory wh on c.enrollmentid = wh.enrollmentid inner bring together [cmo].dbo.tblstaffextended se on wh.worker = se.staffid (wh.enddate null or wh.enddate >= getdate()) , wh.worker = --workerguid param here ) cp on p.personid = cp.clientid order p.person...

How to return multiple JSON objects in an AJAX request in django -

How to return multiple JSON objects in an AJAX request in django - currently have view render template , homecoming 2 query lists. view shown below def view_notifications(request,user_id): context_instance=requestcontext(request) user = user.objects.get(pk=user_id) user.profile.notifications = 0 user.profile.save() notices = list(notifications.objects.filter(n_reciever=user.id, is_read=0).order_by('-time')) number = notifications.objects.filter(n_reciever=user.id, is_read=0).order_by('-time').count() if number < 5: old_notices = list(notifications.objects.filter(n_reciever=user.id, is_read=1).order_by('-time')[:5]) else: old_notices = false notifications.objects.all().update(is_read = 1) homecoming render_to_response('profiles/notifications.html', {'new_notice': notices, 'old_notices':old_notices, 'number': number,},context_instance=requestcontext(request))...

doctrine2 - Doctrine update query with LIMIT -

doctrine2 - Doctrine update query with LIMIT - i update-query limit that: update anytable set anycolumn = 'anyvalue' anothercolumn='anothervalue' limit 20 how possible doctrine 2.1 ? not doctrine specific, maybe possible subquery ? class="lang-sql prettyprint-override"> update messages set test_read=1 id in ( select id ( select id messages order date_added desc limit 5, 5 ) tmp ); doctrine doctrine2 doctrine-query

mysql - Can I use ON DUPLICATE KEY UPDATE for multiple fields? -

mysql - Can I use ON DUPLICATE KEY UPDATE for multiple fields? - i have sql insert statement looks this? $sql = "insert profile_answers (user_id, profile_id, question_id, question_answer, timestamp) values ($user_id, $profile_id, {$i}, $answer, now())"; this called 3 times, each time altering question id user_id , profile_id same. possible prevent duplicate entries using 'on duplicate key update first looking @ first 2 fields (user_id, profile_id)? a entry in db this: user_id profile_id question_id 5 7 1 5 7 2 5 7 3 is possible prevent sec insert of ( 5, 7, 1) example? alter table profile_answers add together unique index(user_id, profile_id, question_id); this prevent inserting same values twice these columns. mysql

VBA - Excel - On Error goto userform -

VBA - Excel - On Error goto userform - when there error, want go userform , alter info entered on form , re pass macro , go on from: if len(dir(sfilepath & newfol, vbdirectory)) = 0... if len(dir(sfilepath & newfol, vbdirectory)) = 0 mkdir sfilepath & newfol & "\" on error goto userform1 else msgbox ("folder exists please re come in new folder name") 'end userform1.show moveandsave_reports end if the above give me error message: compile error: label not defined @ "on error goto userform1" when utilize "on error goto" statement, you're telling programme when hits error, skip specific line in current procedure. example: on error goto errorhandler x = 10 / 0 msgbox "x = infinity!" errorhandler: msgbox "cannot split zero" in example, when code hits error (after "on error" statement), sto...

ruby on rails - Devise implementation. Admin as a separate table or as a column -

ruby on rails - Devise implementation. Admin as a separate table or as a column - may question theoretical, know sentiment on usage of devise separate table, or column in users table. some basic point great discuss: 1. in situation take or other implementation? 2. methods devise add together when implementing seperate table? 3. find easiest way implement devise, , why? thank in advance sure can 2 or more devise model in each application. but in many case 'single table inheritance(sti)' might help lot. if info not different , have same behavior. create easy handle complex info sometimes. but there create lot of null column in table when each role store different info , have slower query time. if want customize much more role can devise cancan help life easier. ps. in real life normalized info not mean have database design. ruby-on-rails devise theory

web services - Are there best practices for naming SOAP interface methods and variables? -

web services - Are there best practices for naming SOAP interface methods and variables? - in .net, microsoft has guidelines naming classes, members, etc. when developing class libraries. other languages may have best practices how name classes, how/if utilize notations. now soap protocol can used perchance communicate across language boundaries. there best practices how name functions, variable names, etc.? or should utilize whatever language (if @ all) uses? or when i'm generating soap interface via tools (e.g. wcf service contracts), should utilize whatever tool produces? there seems no official w3c naming convention service method names. some commonly used guidelines: method names should indicate client's point of view use different method names instead of overloading in general, pascalcasing seems favored (no underscores). .net, follow .net naming conventions normal methods. you may find this blog post oracle useful. web-services soap nami...

models - Google App Engine writes painfully slow - how to fix -

models - Google App Engine writes painfully slow - how to fix - i have pretty simple models need optimize writes app engine using python painfully slow. here models (example not actual) class library(db.model): name = db.stringproperty() books = db.listproperty(db.key) #usually between 20 - 200 items class book(db.model): author = db.referenceproperty(author) class author(db.model): name = db.stringproperty() def add_library(books): library = library(name="bob's") book in books: lbook = book() author = author(name="tom") author.put() lbook.author = author lbook.put() library.books.append(lbook) library.put() this takes between 8 20 seconds insert 1 library, normal? how can optimize more efficient the problem info model proposed here. cannot have big number of list of keys on 1 side of relationship, described in article - http://code.google.com/appengine/article...

Form bean scopes in struts -

Form bean scopes in struts - when have declared our form bean in session scope, few questions arise : note : session per client. assumptions : a)form bean object in session. b)in reset() method, access fields of form bean object, there in session. q-1) when session created , destroyed ? q-2) reset() method called each user request? yes, reset field values in reset(), how come these values available throughout session ? q-3)are request scope attribute values available after validate() method ? the container responsible session management. for each request action uses given form. because fields aren't reset; it's deal checkbox defaults, although there other uses. of course; otherwise values wouldn't available in action. struts

.htaccess - Htaccess RedirectMatch proper use -

.htaccess - Htaccess RedirectMatch proper use - i have .htaccess file setup following. it's simple concept requests forwarded cgi-bin/controller.rb except requests in /images, /css, /javascripts, or /cgi-bin i want root redirected /index/show that's part erroring. keeps infinitely redirecting /index/showindex/showindex/show... can explain why redirectmatch doesn't work? redirectmatch permanent ^/$ /index/show errordocument 404 /404 rewriteengine on rewritecond %{request_uri} !^/images/ [nc] rewritecond %{request_uri} !^/css/ [nc] rewritecond %{request_uri} !^/javascripts/ [nc] rewritecond %{request_uri} !^/cgi-bin/ [nc] rewriterule (.*) /cgi-bin/controller.rb?%{query_string}&page=$1 [l] avoid using redirectmatch , rewriterule @ same time. different modules , applied @ different times in request-flow. can accomplish same using rewriterule's: rewriteengine on rewritecond %{request_uri} !^/index/show [nc] rewriterule ^$ /index/show [l] rew...

Scheduling a task in Windows Server 2008 R2 -

Scheduling a task in Windows Server 2008 R2 - i have scheduled task run ssis job using task scheduler (ts). configured run user belongs admin group. the security "run whether user logged on or not" checked "dont store password" checked "run highest preveilage" unchecked the scheduled task run when user logged in when user logs out task doest seem run. figured "run whether user logged on or not" should run task when user isnt logged on. what missing? try storing password. if user isn't logged in , password isn't stored there may no proper authentication. if domain user, can seek creating local user password never expires. windows-server-2008 scheduled-tasks

Starting Android services by intent vs. by instance creation -

Starting Android services by intent vs. by instance creation - it's understanding android services supposed singletons - no more 1 class instance running @ time. you're supposed start them via intents, opposed to myservice mse = new myservice(); however, in google's in-app billing sample, that's in dungeons.java, line 235. it's legal. i'm wondering, if start service this, framework later recognize it's running? in other words, if seek phone call startservice() on same service later on, framework recognize instance of service exists , dispatch startservice() calls it? if instantiate service straight instead of using intents guarantees service run within activities process. if activity should killed downwards goes service too. bad practice? depends on wanted. if need service live through potential shutdowns of activities yes that's bad thing do. if don't care or app can tolerate shutdowns it's ok. however, i'd argu...

vb.net - Insert statements fail when run against SQL Server 2008 -

vb.net - Insert statements fail when run against SQL Server 2008 - i have deploy vb.net application developed in vb.net , visual studio 2005. client using sql server 2008, while application beingness built against sql server 2000. i received next error against sql server 2008: an explicit value identity column in 'outgoing_invoice' table can specified when column list used , identity insert on here query inserting info in 2 tables: dim cmd1 new sqlcommand("insert stock values(@invoice_no, @gate_pass, @exp_no, @clm_no, @category, @item_name, @weight, @units_case, 0, 0, @crtns_removed, @pieces_removed, 0, 0, @date_added, @date_removed, @inc_total_price, @out_total_price, @discount, @amount, 'sold', @expiry_date) insert outgoing_invoice values(@invoice_no, @exp_no, @party_name, @party_code, @city, @contact, @category, @item_name, @weight, @units_case, @crtns_issued, @pieces_issued, @crtns_removed, @pieces_removed, 0, 0, @scheme, @unit_price, @o...

opencl - Writing to global memory in CUDA -

opencl - Writing to global memory in CUDA - i inquire effect of writing global memory in cuda. known global memory reads have great impact performance (coalescing, caches, bank conflicts) since may require quite lot of cycles wait incoming memory, may block execution @ moment. however writing memory in cuda? suffer type of memory write pattern? total cost straightforwardly sum of writes in kernel? any related references , comments appreciated. in general reply question "yes", stores similar loads. difference since stores "fire , forget", if there work not depend on stored addresses can run multiprocessor(s) after issuing stores, , stalls happen when read-after-write dependencies encountered. for total details, suggest reading section 5.3.2 of latest cuda programming guide. also see appendix f of document specific info pertaining different architecture families. illustration compute capability 1.x has more performance "cliffs" com...

php - Optimizing ajax speed for use in a gameserver (MMO) -

php - Optimizing ajax speed for use in a gameserver (MMO) - i'm creating browser-based game (mmo) server , client, using php, jquery , simple ajax calls. server utilize php daemon. server , client need communicate each other fast possible. right i'm reaching responses times of 500 ms (server in us, i'm in europe) quite happy with, multiple players online! can seek out here: http://www.nickotopia.com/ would possible increment speed farther using technologies don't know of? heard smart move transfer node.js can handle faster ajax calls. worth it, considering in case distance between server , client? thanks in advance! instead of repeating ajax calls (as guess doing), should utilize server-push solution, comet-like, cut down number of useless communications between server , browser. php jquery ajax

javascript - Is it possible to change text color based on background color using css? -

javascript - Is it possible to change text color based on background color using css? - is possible alter text color based on background color using css? like in image as text crosses on 1 div (white-space:nowrap) possible alter text color using css or jquery/javascript? thanks here solution (thinking through different way): use div overflow: hidden; navy 'bar' shows rating scale. write out 2 sets of text: inside div bar (overflow: hidden;), white (on top) in underlying div container, black. (container) the result overlap of 2 colored text divs: ________________________________ | 1 | 2 | |_(dark bluish w white)_|__________| here jsfiddle it works great because 'cut through' letters if bar @ width. check out, think looking for. javascript jquery css

java - Is there a way to pass all properties from a property-file as JVM params? -

java - Is there a way to pass all properties from a property-file as JVM params? - we can pass single property through java cli using -d argument: java -dkey=value ... is there way pass properties property file in way? something like: java -dprop.file=myproperties.properties ... you can if add system.getproperties().load(new fileinputstream(system.getproperty("prop.file"))); java properties

ruby - Detecting eventmachine disconnections and testing for reconnect -

ruby - Detecting eventmachine disconnections and testing for reconnect - i'm trying build scheme ontop of event machine observe when tcp connection has failed , test see if reconnect can fired. i've gone through of eventmachine code can't seem find there callback connection either timing out in action or in reconnection. though i've set times in code, there no callback on pending connect, , if seek re fire reconnect no feedback whether connection has succeeded or failed. i'm using connect telnet interface. eventmachine.run c = eventmachine.connect "10.8.1.99",5000,connectinterface c.pending_connect_timeout = 10 end any help appreciated. eventmachine provide unbind method this: module connectinterface def connection_completed puts "connected" end def unbind puts "disconnected" end end em::run em::connect("10.8.1.99", 5000, connectinterface) end be aware unbind method called on d...

jquery - Setting the id of a link based on it's href -

jquery - Setting the id of a link based on it's href - $('.portfoliothumbs ul li a').mouseover( function(){ var buttlink = $(this).attr('href') var buttlinkarray = buttlink.split( '/' ); // split url after each / , create array of each var pfn = buttlinkarray[2]; // want portfolio folder name var url = window.location.pathname; $('.gallerynav ul li a').removeclass('hovered'); $('.gallerynav ul li a' + '#' + pfn).addclass('hovered'); window.location.pathname = url + '#' + pfn; } ); this code allows me set id on each button based on href when user "mouseover's" it. know how can done automatically when page loads, each button in list gets , id based on it's href, without user interaction. thanks, dan iterate through links on page load. if using jquery 1.7+ utilize prop set href attribute. otherwise uti...

Best way to get velocity/speed in android -

Best way to get velocity/speed in android - having new sensors (linear_acceleration, rotation_vector) what's best way real speed of phone (supposing can't utilize gps's method getspeed(). what's mutual usage of 2 sensors along quaternions? thanks! guillermo. what thinking on when speaking abaut "speed of phone" ? if understand, interested on speed when in auto phone or this? for this, have utilize gps sensor because 1 can give speed. linear acceleration provide acceleration , not speed, different. if interested in how utilize gps sensor, can give exemple of code. android

Visual Studio vanishes when packaging an Azure application -

Visual Studio vanishes when packaging an Azure application - i'm running visual studio 2010 sp1. when seek bundle azure application (right-click webrole, click package...) begins bundle application, spits out few things log, visual studio vanishes. disappears. no error, no nothing. it's gone. here's log output vs before vanishing act: ------ build started: project: mywebapp, configuration: release cpu ------ mywebapp -> d:\mywebapp-trunk\src\mywebapp\bin\mywebapp.dll ------ build started: project: mywebapp-webrole, configuration: release cpu ------ ------ publish started: project: mywebapp-webrole, configuration: release cpu ------ transformed web.config using web.release.config obj\release\transformwebconfig\transformed\web.config. looking @ /bin/release folder of webrole, bundle not finish (the serviceconfiguration.cfg there, /app.publish/mywebapp-webrole.cspkg file 0kb). i'm not sure see went wrong. thought why happens and/or might find di...

function - Android: Change speed of a ball using SeekBar -

function - Android: Change speed of a ball using SeekBar - i have written app shows bouncing ball on screen. want add together seekbar increases velocity of ball when alter value. made functions in ball class , set x , y velocities. package perseus.gfx.test; import everything; public class gfxactivity extends activity implements onseekbarchangelistener { viewgroup.layoutparams vg = new viewgroup.layoutparams(-1, -1); double velx, vely; double x, y; double finx, finy; seekbar velo; textview tv; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); ball ball = new ball(this); setcontentview(r.layout.main); addcontentview(ball, vg); tv = (textview)findviewbyid(r.id.test); velo = (seekbar)findviewbyid(r.id.vel); velo.setonseekbarchangelistener(this); x = ball.getspeedx(); y = ball.getspeedy(); ball.setspeedx(finx); ball.setspeedy(finy); } @override public void ...

asp.net - Changing Razor View Seems to Restart My Application -

asp.net - Changing Razor View Seems to Restart My Application - it appears me simple alter .cshmtl file in application restarts application. i'm not sure it's restarting, painfully slow when reloading page. seem normal? have advice figure out why might happening? makes development real drag. i sense have time , cup of coffee , cigarette every time create change. , don't smoke! if continues, might have take smoking. if alter view application should not restart. takes time cause view gets compiled before rendered. you can set breakpoint on application_start() method in global.asax see if application gets restarted. asp.net asp.net-mvc

javascript - plupload - send another request parameter with uploaded file -

javascript - plupload - send another request parameter with uploaded file - plupload creates nice ids in file object. how id can sent upload script? upload script has 3 variables in $_post - file name, chunk number , total number of chunks. how add together parameter plupload's post request (in case, file.id)? the first step add together handler beforeupload event. then, if using multipart, can alter uploader settings dynamically set different multipart params: plupload_instance.bind('beforeupload', function (up, file) { up.settings.multipart_params = {fileid: file.id} }); (warning: illustration overrides , multipart_params, can play smarter setting fileid) if not using multipart, options pass argument header, or manually add together param url each file (these 2 options should done within beforeupload). note when not using multipart, plupload add together name , chunk params url after url set uploader, each file, params go. javas...

Text decoration on scroll to top javascript code -

Text decoration on scroll to top javascript code - i have link @ bottom of page <a href="javascript:scroll(0,0)"> online marketing </a> to scroll top of page makes text bluish , underlined how add together code remove text deceration it? i tried a href="javascript:scroll(0,0)" style="text-decoration: none; color:#ffffff;"> scroll top stopped working way round remove text deceration using code on specific element? your code looks right...which odd. perhaps seek assigning scroll button css class. in style sheet add a.standardtextlink:link, a.standardtextlink:active, a.standardtextlink:visited {text-decoration:none;color:#fff;} then in html <a href="javascript:scroll(0,0)" class="standardtextlink">scroll top</a> hopefully that'll sort it. c javascript scroll text-decorations

jQuery slider color picker / slider to change background -

jQuery slider color picker / slider to change background - i'm trying do: decreasing temperature values of slider, need circle represents star gradually increment , alter background color link: http://astro.unl.edu/naap/hr/animations/hrexplorer.html but code isn't doing it.....see lines $("#s_tem").slider({ see code: http://jsfiddle.net/nxnxj/19/ thanks.. you assigning variable chosencolor values like: #597459745974 which not valid css color attributes. [edit] here's code should going: $("#s_tem").slider({ change: function(event, ui) { var hexvalue = ui.value.tostring(16).touppercase(); if (hexvalue.length < 2) hexvalue = "0" + hexvalue; var chosencolor = numbertohexcolor(hexvalue); $('#t_tem').val(chosencolor); $("#star").css('background-color', chosencolor); }, value: 5800, min: 2300, max: 40000, step: 100, }...

java - about hadoop filesystem transferFromLocalFile -

java - about hadoop filesystem transferFromLocalFile - i writing code transfer files hadoop hdfs parallel. have many threads calling filesystem.copyfromlocalfile. i think cost of opening filesystem not small, have 1 filesystem opened in project. though there might a problem when many threads calling @ same time. far, works fine no problem. could please give me info re-create method? give thanks much& have great weekend. i see next design points consider: a) bottleneck of process? think in 2-3 parallel re-create operations local disk or 1gb ethernet became bottleneck. can in form of multithreaded application or can run few processes. in case not think need high level of parallelism. b) error handling. failure of 1 thread should not stop whole process, and, in same time file should not lost. doing in such cases agree in worst case file can copied twice. if ok - scheme can work in simple "copy delete" scenario. c) if re-create 1 of cluster nodes - hd...

ruby - In RSpec I want to replace argument to a method call -

ruby - In RSpec I want to replace argument to a method call - my app using openuri's open() method, fetch web page. in spec want able replace url passed in open path of local file. so when calling open('http://www.google.com') want switch url /path/to/file . is there build-in way in rspec? i not think rspec provide accomplish this. you're improve off adding parameter method invokes open() in application. create code reusable. if application code cannot modified, seek overwrite open() method substitute parameter in rspec script. ruby rspec rspec2

jquery - Ajax Long Polling -

jquery - Ajax Long Polling - i asked question on stackoverflow function of mine , people recommended utilize ajax long polling. have spent past couple of days researching subject , have tried write basic long polling code, none of has worked , can not work @ all. here basic function: <script language='javascript' type='text/javascript'> var interval=self.setinterval("checkformessages()",4000) function checkformessages() { $('#incomingmessages<?php echo $otherchatuser ?>').load('checkfornewmessages.php?username=<?php echo $username; ?>&otherchatuser=<?php echo $otherchatuser; ?>'); } </script> would able tell me how turn basic long polling function, or direct on path need there. help much appreciated. thanks! usually (i.e. when not using long polling), javascript code create request server , server homecoming info immediately. however, server may not have of i...

eclipse - Where can a stale binary hide when developing an android app? -

eclipse - Where can a stale binary hide when developing an android app? - guess found myself: apparently else-if block detected unreachable code , not compiled binary. @ to the lowest degree conclusion now. it's 7am. farther investigate after little nap. i'm totally lost , lost day on digging deep. i have android app. @ point, changes not debugged anymore. seamed running stale code. i've done obvious (refresh, project clean), less obvious (eclipse -clean, fresh checkout of project) , lastly thing did was: download eclipse install mercurial , adt install android sdk checkout project virgin workspace run app in newly created virtual device guess what, still behaves follows: when set breakpoint @ "// breakpoint" pressing f6 (step over) can step through "// 1" , "// 2" although after //1, //2 should unreachable. debugger knows nil variables in else-if block while i'm @ //1 } else if (column == 4) { // breakpoint text...

eclipse - Managed Beans not getting deployed with the rest of the application -

eclipse - Managed Beans not getting deployed with the rest of the application - enviornment: ide: eclipse 3.7 server: tomcat 7.0 jsf 2.0 i new jsf , started having unusual problem when seek deploy application. for reason gets deployed except beans. started when noticed no matter did, couldn't access newly created bean facelet. noticed couldn't utilize new functions created in old beans. i did little experiment took existing setter method in login bean, , changed from: public void setname(string name) { this.name = name; } to public void setname(string name) { this.name = "not typed"; } but value retrieved bean on next page value typed login form. i think faces-config.xml , web.xml files both set correctly. googled problem , thing found adding @managedbean , @sessionscope annotations before bean declarations may help older versions of jsf, didn't work. i have tried creating new server, , re-creating project, did not help eit...

ruby - How can I generate XML with Nokogiri without "<?xml version=..."? -

ruby - How can I generate XML with Nokogiri without "<?xml version=..."? - possible duplicate: print xml document without xml header line @ top i have problem nokogiri::xml::builder. generating xml wth code: builder = nokogiri::xml::builder.new request { info '1' } end and result is: <?xml version="1.0" encoding="utf-8"?><request><data>1</data></request> how can remove: <?xml version="1.0" encoding="utf-8"?> from xml? maybe take root node of current document object beingness built – .doc – instead of whole document? builder.doc.root.to_s ruby xml nokogiri

css - CSS3 box-shadow property doesn't validate? -

css - CSS3 box-shadow property doesn't validate? - when run css through w3c's validator, time utilize box-shadow property, error this: 0 not box-shadow value : 0 0 10px #000 it appears stop @ whatever first value is, since changing order of values alter error match: #000 not box-shadow value : #000 0 0 10px i'm validating profile set css3, it's not case of me forgetting alter default profile setting css2 (where box-shadow property doesn't exist). why doesn't think of values i'm using correct? shadow render fine in firefox , other browser supports non-prefixed box-shadow property. it's a known validator bug. apparently forgot unitless values permitted (especially unitless 0 values). there's nil wrong css; values you're using correct. if you're picky , can't set bug tarnishing otherwise would-have-been successful validation, can add together units 0 values: box-shadow: 0px 0px 10px #000; but wh...

javascript - How to pass JSON to jqChart? -

javascript - How to pass JSON to jqChart? - client side sends post request php on server side. php returns json client. example: [["1","-1"],["2","0"],["3","0"],["4","0"],["5","4"],["6","5"],["7","3"]] now client side have create chart. created chart jquery plugin jqplot , flot, jqchart doesn't show correctly. here jquery code: if ($jqlib == "flot") { var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]]; $.post('database2json.php', function(data){ $.plot($("#placeholder"), [d2, data]); }, 'json' ); } else if ($jqlib == "jqchart") { $.post('database2json.php', function(podaci){ $('#placeholder').jqchart({ ...

php - AJAX call using the last variable loaded on the page instead of current post -

php - AJAX call using the last variable loaded on the page instead of current post - i'm creating custom plugin fires ajax phone call when sharing post on twitter, google + or liking on facebook. within index.php file set within loop gets called on every new post on home page. <?php cp_social_sharing_4pts(); ?> here part of php function: function cp_social_sharing_4pts(){ if ( is_user_logged_in() ) { echo '<script type="text/javascript"> var postid = '.get_the_id().'; function cp_share_twitter_do(){ jquery.ajax({datatype: "json", data: {action: "cp_share_twitter_do", post: postid}, success: function(data){ if(data.success==true){ boxy.alert(data.message); thebox.hide(); thebox.unload(); } else { boxy.alert(data.message); } } }); } </script> '; } // show buttons echo 'post id: '.get_the_id().'<br />'; // debug echo '<a href="https://twitter.com/shar...

Objective-C Implementing a class (Initialization of array) -

Objective-C Implementing a class (Initialization of array) - my initialization of array getting weird error. i'm missing? error @ gameboard array. @implementation tictactoe - (id)init { self = [super init]; if (self) { gameboard [3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; // error saying: "expected expression" turn = 1; winner = 0; cellschosen = 0; } ... you have gameboard declared in @interface tictactoe , right? cannot utilize c array initialization syntax, because array initialized. unfortunately c doesn't provide shortcut assign arrays, should create temporary array initialized values , utilize memcpy re-create elements array. ... if (self) { int tmpgameboard[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; nsassert(sizeof(tmpgameboard) == sizeof(gameboard), ...

visual studio 2010 - Test environment does not copy my files -

visual studio 2010 - Test environment does not copy my files - i utilize vs2010. in test project have folder named "messageinstances" , in folder there subfolder "get_activity", within folder there xml files. when run test, these files should copied accordingly out assembly dir, i.e. if out folder test project output copied out\messageinstances\get_activity\ folder should filled xml files. i tried different settings *.testsettings file, tried running test resharper unit test runner , vs', neither copied files right folder. played deploymentitem attribute , still no success. what else can try? the deploymentitem attribute work if build action on item set content , copy output directory set copy if newer or copy always. additionally, if tests running testsettings file need enable deployment in settings. create sure editing active test run config in case have mutiple. your deploymentitem should defined follows: [deploymentitem("me...

android - Background of MenuItem won't change -

android - Background of MenuItem won't change - i posted similar question regarding code compiling managed running. however, code doesn't alter default white background darker color. here code: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="theme"> <item name="@android:panelfullbackground">@android:color/background_dark</item> <item name="@android:panelcolorbackground">@android:color/background_dark </item> <item name="@android:panelbackground">@android:color/background_dark</item> </style> </resources> i'm applying theme here: <menu xmlns:android="http://schemas.android.com/apk/res/android" style="@style/theme"> <item android:id="@+id/add"/>...... </menu> edit: here output logcat 01-10 05:47:08.434: e/androidruntime(30...

linux - How to scroll through command history of tmux? -

linux - How to scroll through command history of tmux? - c-b: gives tmux command prompt. there way scroll through commands entered on previously? arrow or ctrl p/n don't seem work. up , down work in default (emacs) mode; if however, have set vi-mode need either explicitly come in command mode (by pressing escape 1 time @ tmux's command prompt—ctrlb,:), or can create keybinds commands in .tmux.conf , thereby removing need alter modes: set -g status-keys vi bind-key -t vi-edit history-up bind-key -t vi-edit downwards history-down tmux's default bindings can seen ctrlb,: , entering lsk -t vi-edit . defaults are, in case: bind-key -ct vi-edit history-up bind-key -ct vi-edit downwards history-down note -ct switch command mode. linux terminal tmux

retina display - How do I add a high-resolution custom marker on a static google map -

retina display - How do I add a high-resolution custom marker on a static google map - i'm using google static maps (documention here) show shops' locations, , i'm using custom marker instead of default. however, marker image appears low-resolution on high-resolution mobiles iphone 4. how prepare it? set &markers=scale:2 in conjunction @2x marker icon image , &scale=2 parameter. i answered in duplicate question here: http://stackoverflow.com/a/17130379/378638 google-maps retina-display

objective c - UIModalPresentationFullScreen is not working properly in iPad Landscape? -

objective c - UIModalPresentationFullScreen is not working properly in iPad Landscape? - i have show info in modalviewcontroller ipad . have nowadays viewcontroller2 viewcontroller1 modalview full screen . viewcontroller1 in uitabbarcontroller , viewcontroller2 should hide tabbar. so, used code show viewcontroller2 viewcontroller1, uiviewcontroller *viewcontroller2=[[uiviewcontroller alloc] init]; viewcontroller2.modalpresentationstyle = uimodalpresentationfullscreen; [self presentmodalviewcontroller: viewcontroller2 animated:yes]; when phone call viewcontroller2 in landscape mode, viewcontroller shows half of screen in viewcontroller1. , also, simulator automatically alter portrait , automatically homecoming landscape mode. problem in this? can please help me find solution? in advance. set modelpresentationstyle uimodalpresentationcurrentcontext. may solve problem. solved problem. objective-c ios uiinterfaceorientation presentmodalviewcontroll...

html - Preventing from cheating -

html - Preventing from cheating - i'm making facemash analog , found out it's easy cheat ^^ if type in browser several times: http://domain.com/rate.php?winner=1&loser=2, can create photo №1 winner. know it's possible prevent cookies , ip-blocking, don't know how exactly. please help me. thanks! thant's illustration (not mine): http://facemash.moefelt.dk/ upd can provide source code if needed. upd 1 rate.php http://jsfiddle.net/6xlr6/ index.php http://jsfiddle.net/avf4m/1/ you can utilize $_post instread of $_get, cheat harder ! cookies can saved in cache if user clean everytime, useless. edit : <form method=post action="rate.php"> <table> <tr> <td><img src="images/<?=$images[0]->filename?>" /></td> <td><img src="images/<?=$images[1]->filename?>" /></td> <input type="radio" name="winer" v...

wcf - svcutil generated code missing parts -

wcf - svcutil generated code missing parts - i have this: "%programfiles%\microsoft sdks\windows\v7.0a\bin\svcutil.exe" ^ /nologo /t:code /l:cs /mc /tcv:version35 /ct:system.collections.generic.list`1 /n:*,myns ^ /config:myserviceproxy.config ^ /out:serviceproxy.cs ^ https://remote-service/servicea?wsdl it generates classes, types , endpoint configurations expect. when add together multiple endpoints ex: "%programfiles%\microsoft sdks\windows\v7.0a\bin\svcutil.exe" ^ /nologo /t:code /l:cs /mc /tcv:version35 /ct:system.collections.generic.list`1 /n:*,myns ^ /config:myserviceproxy.config ^ /out:serviceproxy.cs ^ https://remote-service/servicea?wsdl https://remote-service/serviceb?wsdl https://remote-service/servicec?wsdl no endpoints in myserviceproxy.config, , serviceawsclient() methods missing serviceproxy.cs. update: removed /i option, bec made classes internal. update: can generate 2 .cs files, if utilize /serializer:datacontractse...

c# - Where do I deploy the DLL's to be used while calling unmanaged code from a custom .Net Data Provider which will be deployed to the GAC? -

c# - Where do I deploy the DLL's to be used while calling unmanaged code from a custom .Net Data Provider which will be deployed to the GAC? - i have build custom .net info provider , in process of trying deploy can utilize in sql integration services (ssis). issue running referencing unmanaged methods in win32 dll. in order info provider work in ssis, have sign managed provider dll , deploy global assembly cache (gac). when seek utilize info provider in business intelligence development studio (bids), gives me next error: title: connection manager ------------------------------ test connection failed because of error in initializing provider. unable load dll 'rtb32.dll': specified module not found. (exception hresult: 0x8007007e) ------------------------------ buttons: ok ------------------------------ how/where supposed deploy unmanaged code along provider works? things have tried: embedding dll's managed dll. adding unmanaged dll's gac....

javascript - find latitude and longitude using distance -

javascript - find latitude and longitude using distance - i want find latitude, example point = (18.5204303,73.8567437) point b = (x,73.8567437) distance =20km(kilometers) i need find latitude(x) of point b, 20 km point a.longitude should same. help me in advance i found reply question var lat1 = 18.5204303; var lon1 = 73.8567437; var d = 20; //distance travelled var r = 6371; var brng = 0; var latmax; brng = torad(brng); var lat1 = torad(lat1), lon1 = torad(lon1); var lat2 = math.asin( math.sin(lat1)*math.cos(d/r) + math.cos(lat1)*math.sin(d/r)*math.cos(brng) ); var lon2 = lon1 + math.atan2(math.sin(brng)*math.sin(d/r)*math.cos(lat1), math.cos(d/r)-math.sin(lat1)*math.sin(lat2)); lon2 = (lon2+3*math.pi) % (2*math.pi) - math.pi; lat2= todeg(lat2); lon2= todeg(lon2); alert(lat2); alert(lon2); function torad(value) { /** converts numeric degree...

c# - php developer needs help in asp.net tables -

c# - php developer needs help in asp.net tables - i humbly need help. php developer learning asp.net c# requirement of our company. familiar basics of c# , oops. problem facing learned how retrieve values database , create info table know can bind grid command display info technique restricts me of own stuff datagrid want used hard code table in php if needed build table like <?php */ retrive info database , store in array using $row_sql = mysql_fetch_array() function /* .... .... ?> <table> <tr> <td><?php $row_sql['fieldname']; ?></td> </tr> .... .... </table> ?> i know can such thing repeater not sure want utilize such command or because not familiar asp.net style. so can please guide me how can this. or please tell me should larn asp.net if know how in php? update: ok here did still getting error firstly created databale filling dataset dataadapter. used code suggested getting next error: forea...

Ruby instance variable access -

Ruby instance variable access - just curious best practice accessing instance variable within class assuming attr_accessor set. class test attr_accessor :user def initializer(user) @user = user end def foo @user end end or class test attr_accessor :user def initializer(user) @user = user end def foo self.user end end so instance variable (@user) or getter method (test#user)? getter method, because it's easier refactor. want update time stamp @ point of access. class test def user @user.last_read = time.now @user end end and references user updated new logic. not easy if references @user . ruby

Javascript call nested function -

Javascript call nested function - i have next piece of code: function initvalidation() { // irrelevant code here function validate(_block){ // code here } } is there way can phone call validate() function outside initvalidation() function? i've tried calling validate() think it's visible within parent function. you can phone call validate within initvalidation . this. function initvalidation() { // irrelevant code here function validate(_block){ // code here } homecoming validate(somevar); } validate not visible outside of initvalidation because of scope. edit: here's suggestion of solution. (function() { function validate(_block){ // code here } function initvalidation() { // irrelevant code here homecoming validate(somevar); } function otherfunctions() { // ... } // initvalidation = function }()); // initvalidation = un...

.net - Converting List of String to either a Dataset or Datatable -

.net - Converting List of String to either a Dataset or Datatable - i'm working on project involves csv file. using microsoft.jet.oledb.4.0 extract everything. however, there big numbers don't create on , "blanked" out. so, after doing research, able find illustration stuff list. example: dim lstexample new list(of string)(). from here utilize steamreader grab csv file , store it. since first 3 lines garbage, i'm skipping , reading rest of lines along 30 columns of comma delimited data. my problem i'm unable lstexample either dataset or datatable. manually created list , still errors out. the error occurs on line: datarow(i) = itemproperties(i).getvalue(item, nothing) saying "parameter count mismatch." any ideas list dataset/datatable? public shared sub manualreadcsvfile(byval strfilepath string) dim lstexample new list(of string)() using reader = new streamreader("c:\sftp_target\atl-536437.csv...

android - How to make a phone call (to call a given person) if we know the contact's _ID -

android - How to make a phone call (to call a given person) if we know the contact's _ID - my problem store contacts/persons' _id in database , want initiate phone phone call in order phone call stored contact when user presses button. i retrieve _id cursor , store database string cont_id = cursor.getint(cursor.getcolumnindex(contactscontract.contacts._id)); ... later on, when user presses button call intent intent = new intent(intent.action_dial, uri.parse("content://contacts/people/" + cont_id)); startactivity(intent); now problem dialer displayed "empty", not display desired person. so, seems not fill in person. android development guide says @ intent description: action_dial content://contacts/people/1 -- display phone dialer person filled in. how else should fill in desired person? hint? uri.parse("content://contacts/people/" + cont_id) here expecting content://contacts/people/ + cont_id should give p...

How can I use variables in other modules in python? -

How can I use variables in other modules in python? - that's one.py: test = {'1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]} import 2 two.example() and that's two.py: def example(): print test[1][5] can tell me why fail next error? nameerror: global name 'test' not defined thanks! you can import in function def example(): 1 import test print test[1][5] or can pass test in variable #one.py two.example(test) #two.py def example(test): print test[1][5] python

java - If http.path is set, is there a way to provide a route for / -

java - If http.path is set, is there a way to provide a route for / - i have in application.conf http.path=/manage so, when go http://localhost:9000/ not found 404 page. is there way redirect / /manage/ while still keeping app @ http.path=/manage ? from documentation, http.path setting used for, the url path application runs on server: utilize if not host play application @ root of domain you’re serving from. parameter has no effect when deployed war, because path handled application server. if not case, may improve off using routes file manage urls, specify both / , /manage , , action index page simple redirect action want forwards on to. the other alternative front end play server http server, apache or lighttp, , perform redirect within http server config. http.path meant used for, help play applications co-exist in existing web server environment. java routes playframework

Javascript Date Object Comparison with hidden value -

Javascript Date Object Comparison with hidden value - i have been reading obsessively in how perform date object comparing in javascript. got ideas , pointers, cant seem joy. here issue. using jquery datepicker set hidden value. if hidden value changes, compare date today's date, if match, send alert console. here script. no errors reported in chrome console; doesn't seem want create date comparing after. var date2 = new date(); $("select[name=sanctiondatestart_hidden]").change(function () { if ($("select[name=sanctiondatestart_hidden]").gettime() == date2.gettime()) alert("yayayayaya"); }); appreciate insight cares share. edit: here ended resolving issue, posting in case else can utilize this. post below help me going in right direction. var date2 = new date(); $("#sanctiondatestart").datepicker({ altfield: "#sanctiondatestart_hidden", altformat: "yy-...

sql - mysql subquery with joins -

sql - mysql subquery with joins - i have table 'service' contains details serviced vehicles. has id , vehicle_registrationnumber foreign key. whenever vehicle serviced, new record made. so, illustration if create service auto registration abcd, create new row, , set car_reg, date , car's mileage in service table (id set autoincreament) (e.g 12 | 20/01/2012 | abcd | 1452, service same auto create row 15 | 26/01/2012 | abcd | 4782). now want check if auto needs service (the lastly service either 6 or more months ago, or current mileage of auto more 1000 miles since lastly service), need know date of lastly service , mileage of auto @ lastly service. want create subquery, homecoming 1 row each car, , row i'm interested in newest 1 (either greatest id or latest enddate). need bring together other tables because need view (i utilize codeigniter don't know if it's possible write subquires using ci's activerecord class) select * ( select * ...

android - how users opt-out of c2dm message -

android - how users opt-out of c2dm message - we implementing c2dm force notifications users. want user able "opt-out" @ beginning. if opt-in, register device , send id our server store later delivery , track unique device id. the problem there doesn't seem reliable way in android device id. i've read says, "just generate guid @ first startup of app". well, fine, if user starts app, opts in, uninstalls , re-installs app, opts out, have no way of removing old device (since device id of sec install new). i've tested , old c2dm registration id works after uninstall , re-install. any suggestions? how others allow users opt-out of notifications. how track devices? having device id nice, don't need handle opt-outs. when send c2dm message server, include registration id. then, when device receives message, can compare delivered registration id thinks registration id is. if matches, show notification. if doesn't match, ping...

Plone/Dexterity schema.Choice not allowing Spanish characters -

Plone/Dexterity schema.Choice not allowing Spanish characters - in plone 4.1.2 created mycontenttype dexterity. has 3 zope.schema.choice fields. 2 of them take values hardcoded vocabulary , other 1 dynamic vocabulary. in both cases, if take value has spanish accents, when save add together form selection gone , doesn't show in view form (without showing error message). if take non accented value works fine. any advise on how solve problem? (david; hope asked me for) # -*- coding: utf-8 -*- 5 import grok zope import schema plone.directives import form, dexterity zope.component import getmultiadapter plone.namedfile.interfaces import iimagescaletraversable plone.namedfile.field import namedblobfile, namedblobimage plone.formwidget.contenttree import objpathsourcebinder zope.schema.vocabulary import simplevocabulary, simpleterm zope.schema.interfaces import ivocabularyfactory z3c.formwidget.query.interfaces import iquerysource zope.component import queryutility pl...

html - Formatting with CSS stylesheet using link tag -

html - Formatting with CSS stylesheet using link tag - i have issues printing footer of website. reason, footer prints correctly, link shows normal unformatted link bluish font. going on? style sheet included on page. <div id='footer'>private site&copy; <a href='mailto: contact@privsite.com'>contact us</a></div> #footer { padding-top: 20px; border: solid #4f7d7d; border-width: 1px 0 0 0; text-align:center; display: inline; } #footer a:visited, #footer a:link { color: #666; text-decoration:none; } #footer a:hover { color: #060; } if you're using same color link, visited , active states, can create code little simpler like: #footer a{ color: #666; text-decoration:none; } #footer a:hover{ color:#060; } also, order of psudeo-classes anchor tags is: :link - unvisited links :visited - visited links :active - active links :hover - links beingness hovered :focus - links beingness focussed...

c: dynamic alloc of 3d array when 1 dimension unknown -

c: dynamic alloc of 3d array when 1 dimension unknown - i trying dynamically allocate 3d array, these params: 1) first 2 dimensions know, , can defined constants (acount , bcount). 3rd needs decided @ runtime. 2) want able address array using: arr[i][j][k] = n; 3) want avoid death million+ mallocs so in next code, first part using "*arr" works great, , 2nd part using "*brr" meets sorry end. there way accomplish these params using magic potion of asterisks ? (i compiling using vs2010 c++, nasty castings.) #define acount 9000 #define bcount 195 #define ccount 8 short (*arr)[bcount][ccount]; short (*brr)[acount][bcount]; void main(void) { arr = (short (*)[bcount][ccount] ) malloc( (unsigned long) acount * bcount *ccount * sizeof(short)); (int j = 0; j < acount; ++j) (int k = 0; k < bcount; ++k) (int m = 0; m < ccount; ++m) arr[j][k][m] = j + k + m; // still live here ...