Posts

Showing posts from March, 2015

java - Add a character in an EditText -

i need add character "s" right after last written number in edittext (oe) so: if write number : "123", must send "123s" instead. if write "1234", must send "1234s" instead. how ? my code: ((button) findviewbyid(r.id.btn_write_hrm_noty)).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { str = oe.gettext().tostring(); str = str.substring(0, 0) + "g" + str.substring(0, str.length()); mservice.enablehrnotification(mdevice, str); } }); i'm little confused. asking how add character string? if so: str+='s'; work. add string edittext .settext(str) or put notification 's' added (as blundell suggested).

c++ - Finding a substring passing only 2 iterators? -

i have curious problem. fix goes high performance library. 1 of tasks change interface use internal string descriptor format pointer , length instead of std string parameters. 1 of functions search , find pattern within string , copy rest of string after pattern buffer. i added change of assigning entire iterator range buffer{ custom allocator version of std string } , erasing characters upto pattern. fix rejected saying better. my problem this. input string pair of iterators. may or may not own byte pointed end iterator i.e. cannot dereference safely. the pattern std::find(start, end, value); does not allow value string. strstr(start, value); takes null terminated string. code has linkage boost. there boost utilities or stl algorithms take 2 string iterators , return iterator pointing first byte of string pattern. of course. there brain dead solution of creating temporary string , reassigning. can avoid allocations? std::search(begin, end, pat_begin, pat_e

ruby - Variables declared within `class << self` -

how should consider @variable declared within class << self block outside method definition? @ final part of script: class vardemo @@class_var_1 = "this @@class_var_1" @class_i_var = "this @class_i_var" attr_accessor :ivar_1 attr_accessor :ivar_2 def initialize(ivar_1: "base_ivar_1", ivar_2: "base_ivar_2") @@class_var_2 = "this @@class_var_2, defined within instance method" @ivar_1 = ivar_1 @ivar_2 = ivar_2 vardemo.class_i_var_2 = "class_i_var_2 defined through accessor on class object" end def print_vars puts "from within instance method. here 'self' is: #{self}" # test instance variables puts "@ivar_1: #{@ivar_1}" puts "@ivar_2: #{@ivar_2}" puts "self.ivar_1: #{self.ivar_1}" puts "self.ivar_2: #{self.ivar_2}" puts "ivar_1: #{ivar_1}" puts "ivar_2: #{ivar_2}" # tes

jsf - How to use one backing bean for 2 JSP pages -

i want use single backing bean 2 jsp pages. my current flow page1 , page2 follows. both page1 , page2 wants use same backing bean edit objects defined in bean. how write entries in faces-config.xml? <navigation-rule> <from-view-id>/wizards/script/pag1.jsp</from-view-id> <navigation-case> <from-outcome>finish</from-outcome> <to-view-id>/wizards/script/page2.jsp</to-view-id> </navigation-case> </navigation-rule> you can use conditional navigation. see following example. <?xml version="1.0" encoding="utf-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <navigation-rule> &l

linq - MongoDB C# - how to do the following -

how do following using mongodb c# driver .net. say have following collection (ignore if there syntax errors): {_id: "2312321321sdd", "ticker": "aapl", "companyname" : "apple", "viewed": "2013-05-13"} {_id: "2312321321sde", "ticker": "aapl", "companyname" : "apple", "viewed": "2013-05-12"} {_id: "2312321321sdf", "ticker": "goog", "companyname" : "google", "viewed": "2013-05-12"} {_id: "2312321321sdg", "ticker": "msft", "companyname" : "microsoft", "viewed": "2013-05-12"} {_id: "2312321321sdh", "ticker": "msft", "companyname" : "microsoft", "viewed": "2013-05-11"} using c# and/or linq mongodb driver, how latest 3 viewed items distinct

python - Should I delete or set a variable to "deleted" in django/postgresql? -

specifically app, have created model in order allow user (the user_parent) follow other users. class follow(models.model): user_parent = models.foreignkey(user, unique=true, related_name="follow_set") users_followed = models.manytomanyfield(user, related_name="follow_followed") whenever user parent follows user, user being followed added variable users_followed. right trying figure out how best unfollow other users. delete user being followed users_followed variable or should add field model describing whether user still being followed or not? which expensive action database perform? it same in terms of expense, since table update. either approach should fine

python - Embed .SVG files into PDF using reportlab -

i have written script in python produces matplotlib graphs , puts them pdf report using reportlab . i having difficulty embedding svg image files pdf file. i've had no trouble using png images want use svg format produces better quality images in pdf report. this error message getting: ioerror: cannot identify image file does have suggestions or have overcome issue before? you need make sure importing pil (python imaging library) in code reportlab can use handle image types svg. otherwise can support few basic image formats. that said, recall having trouble, when using pil, vector graphics. don't know if tried svg remember having lot of trouble eps.

jsf - Selected element not set to the backing bean -

i have following field in jsp. selected value not set element. when did inspect element on drop down field in ff, shows element not selected. not set backing bean. missing? <h:selectonmenu id="scriptengine" value="#{addscriptbean.scriptengine}" required="true"> <f:selectitems value="#{addscriptbean.scriptengines}"/> </h:selectonemenu> the backing bean code follows public list<selectitem> getscriptengines() { list<selectitem> items = new arraylist<selectitem>(); try { getscriptenginenamescommand command = (getscriptenginenamescommand) commandfactory.getinstance().getcommand(getscriptenginenamescommand.class.getname()); command.doexecute(); map<string, string> enginenames = command.getenginenames(); messagesource messagesource = getmessagesource(); locale locale = requestutils.getuserlocale((httpservletrequest) facescontext.g

literate programming - Put result of code right below the code in resulting PDF. Haskell -

is there way execute code in .lhs file , put result right below code in resulting pdf? for example: [1,2,3] ++ [4,5,6] [1,2,3,4,5,6] if using latex, can use lhs2tex . here simple example document: \documentclass{article} %include polycode.fmt %options ghci \begin{document} < [1,2,3] ++ [4,5,6] evaluates \eval{[1,2,3] ++ [4,5,6]}. > x = [1 .. 6] , evaluates \eval{x}, too. \end{document} this run ghci source file input in background. can evaluate expressions using \eval in context of current (literate haskell) module, , results spliced resulting .tex sources.

datagrid - Dynamic Loading Grids; Javascript or Tag library -

i looking grid implementation on dashboard. requirement here if data grid might fetching changes while user looking through grid, changes should reflected. row present in page 1 may present in page 2 after sometime. if user clicks on page 2, should shown fresh page fetched database , item should in page 2. so, need use pagedobjectlist data , show data when user looks next page. same requirement sorting too. so looking javascript grid jqgrid or dhtmlx grid or tag library has sort of ajax calling mechanism sorting , paging instead of showing old data fetched first. please suggest grid/ tag library implementation can fulfill above mentioned requirement. in advance i went dhtmlxgrid, has configurable actions needed, onpageaction, onsort etc. simple write custom code trigger events. recommend others, pretty handy , solid.

sql - Best approach for tracking 'end_time' value for a table with 'start_time' and 'duration' columns -

i have preexisting 'events' table includes event_datetime column , event_duration_minutes column. 2 columns datetime , integer, respectively. i've come across need trigger email when event ends. in order accomplish this, creating recurring job sweeps db every 10 minutes looking completed events. started writing query find events have ended within given time window, due variable nature of duration field each record, query has been eluding me. i thinking best approach add in end_time column , automatically set start_time + duration. right way go? in case, drawing complete blank on how go query - there simple way approach these cases? or general need such query sign db needs work? edit - on postgres 9.2. , here the schema looks in rails schema.rb: create_table "events", :force => true |t| t.string "title" t.text "details" t.datetime "created_at", :null => false t.datetime "updated_at&quo

winforms - How to show conditional data in Crystal Report? -

i working on crystal report based reciept generated on run time. on process have perform couple of things: 1- printing of 2 reciept in single go 2- showing different text in 2 different reciept. different mean on top of reciept have show text for customer only , in other printout have show for office use only . on customer reciept have show address on bottom. is possible do? how do it?

Bash backup specified file extensions in multiple directories -

i have line here find "$directory" -name "*.sh" -print0 | xargs -0 cp -t ~/bckup backs ending in .sh. how multiple file extensions? i've tried different combinations of quotes, parentheses , $. none of them worked =\ i file extensions different folders , i'm not sure how search file name specific extension. here whole code in case: #!/bin/bash collect() { find "$directory" -name "*.(sh|c)" -print0 | xargs -0 cp -t ~/bckup #xargs handles files names spaces. gives error of "cp: not overwrite just-created" if file didn't exist } echo "starting log" timelimit=10 echo "please enter directory collect. if no input in 10 secs, default of /home selected" read -t $timelimit directory if [ ! -z "$directory" ] #if directory doesn't have length of 0 echo -e "\nyou want copy $directory." #-e \n work , won't show part of string else directory=/home/ echo "time's up.

opengl - Using libGLE to extrude profile with holes -

i'm looking way of extruding profile holes. found 'gle tubing , extrusion fact sheet' don't know how extrude holes? wanting extrude 'o', extrude 2 'u' , flip 1 of them? example nice. don't need gts or opencascade simple task. also, libgle public domain code? little documentation exists.

java - Dealing with a DragGestureRecognizer when it is no longer needed -

how deal draggesturerecognizer when no longer needed? i'm using dragsource.getdefaultdragsource().createdefaultdraggesturerecognizer() make sure custom draggesturelistener receives drag , drop events on jtable : draggesturelistener dgl = new defaultdragtoreordertablegesturelistener(getview().gettrackstable()); draggesturerecognizer dgr = dragsource.getdefaultdragsource().createdefaultdraggesturerecognizer(getview().gettrackstable(), dndconstants.action_move, dgl); this works well. however, need remove draggesturelistener @ point revert dnd behaviour default. assume question of unregistering draggesturelistener draggesturerecognizer . but; do draggesturerecognizer? still registered system, can't find way unregister it? how deal draggesturerecognizer ? package com.tracker.workspace.ui.views.test; import java.awt.dnd.dndconstants; import java.awt.dnd.draggestureevent; import java.awt.dnd.draggesturelistener; import java.awt.dnd.draggesturerecognizer; import jav

java - selenium webdriver tests using C# -

i have set of selenium webdriver tests written in c sharp in visual studio ide. is there framework web interface can run them? this web interface should display list of tests, ability run 1 or tests , display results of running. depending on testing framework using (mstest, nunit etc) doubt there specific 'web interface' it. you'd, more likely, need continuous integration world, , grab ci solution. teamcity, jenkins, cruisecontrol.net free (some limitations on teamcity's free license) ci software. learning curve, able give nice interface tests running, when fail, how long take etc - in nice report. it also, wouldn't hard write yourself. reports nunit etc make documented & standardised xml. thus, wouldn't take take information need , shove nice report.

How to specify 2 keys in python sorted(list)? -

how sort list of strings key=len first key=str ? i've tried following it's not giving me desired sort: >>> ls = ['foo','bar','foobar','barbar'] >>> >>> in sorted(ls): ... print ... bar barbar foo foobar >>> >>> in sorted(ls, key=len): ... print ... foo bar foobar barbar >>> >>> in sorted(ls, key=str): ... print ... bar barbar foo foobar i need get: bar foo barbar foobar define key function returns tuple in first item len(str) , second 1 string itself. tuples compared lexicographically. is, first lengths compared; if equal strings compared. in [1]: ls = ['foo','bar','foobar','barbar'] in [2]: sorted(ls, key=lambda s: (len(s), s)) out[2]: ['bar', 'foo', 'barbar', 'foobar']

Close windows explorer popup using Javascript function in Java code -

how close windows explorer popup using javascript function in java code? i have close windows explorer popup in java code. using javascript function window.close() close window popup breaking loop. here piece of code: scriptenginemanager manager = new scriptenginemanager(); scriptengine engine = manager.getenginebyname("javascript"); string script = "function winclose() {"+"var close_result = window.parent.close();"+"" +"document.getelementbyid('close_result').value = close_result;"+"console.log(\"change box value\");}"; engine.eval(script); invocable inv = (invocable) engine; inv.invokefunction("winclose", "window close!!" ); but giving me exception window not defined. actually have never used javascript in java code. please me out window close function in javascript. although have not mentioned hope java code part of applet. in case shoul

osx - Java application is not able to find JDK 1.7 on Mac (Installer created with install4j) -

i have created java application installer using install4j mac os x . application uses jdk 1.7 . i have set jdk version in install4j well. i have installed jdk 1.7 on mac , when type java -version command on console gives me jdk 1.7. application installed out of luck, when try start application gives me error : exception in thread “main” java.lang.unsupportedclassversionerror: (unsupporte d major.minor version 51.0) the above error occurs because uses apple's inbuilt jdk 1.6. want app use jdk 1.7 installed on machine. edit now have created installer selecting openjdk in jre option. not giving me unsupportedclassversionerror application icon blinks on dockbar , goes. below cosole log. 5/23/13 11:16:47.777 com.apple.launchd.peruser.502[154]: ([0x0-0x92092].com.install4j.9409-6211-0940-9008.25[800]) exited code: 1 5/23/13 11:17:09.166 com.apple.launchd.peruser.502[154]: ([0x0-0x93093].com.install4j.9409-6211-0940-9008.25[802]) exited code: 1 5/23/13 11:17:12

html - stackoverflow page not appearing inside iframe -

i used display web pages in iframe s. when tried display stackoverflow user info in iframe, went wrong. content not getting displayed. may possible reason (or reasons) behavior? how can display page in iframe ? possible display in iframe pure html or there need javascript or ajax or that? if not possible, there workaround this? here live demo. a possible reason same of google. sites not allow sites iframed. to quote @daan: google uses x-frame-options http header disallow putting pages in iframes: https://developer.mozilla.org/en/the_x-frame-options_response_header could case too.

Twitter 3-legged authorization in Ruby -

i trying hand ruby on rails. have written code in sinatra. anyway question may not have framework. , question may sound novice question. playing twitter 1.1 apis , oauth first time. i have created app xyz , registered twitter. got xyz's consumer key i.e., consumer_key , consumer secret i.e. consumer_secret. got xyz's own access token i.e access_token , access secret i.e. access_secret xyz application type: read, write , access direct messages xyz callback url: http://www.mysite.com/cback , have checked: allow application used sign in twitter what trying simple: 1) users come website , click link link twitter account (not signin twitter) 2) opens twitter popup user grants permission xyz perform actions on his/her behalf 3) once user permits , popup gets closed, xyz app gets user's access token , secret , save in database. 4) xyz uses user's token , secret perform actions in future. i may moron such work flow has been implemented on several thousands s

php - Timestamp vs Date -time in Mongo -

i have option of storing date in mongo iso oject or timestamp in mongo. which 1 more advisable , beneficial use , why?? timestamp data type not use end user ( http://php.net/manual/en/class.mongotimestamp.php ), means if store timestamp have no special abilities date manipulation int . the "special" abilities can confined map reduce , aggregation framework whereby valid date object (in aggregation framework) reliable way time comparison. so though can store timestamp int , , smaller isodate() recommend not to.

debugging - Assembly MOV doesn't work, Debug for Linux and INT code list -

i have problem here... i'm using debug (in cmd/ms-dos) learn things , peforme commands... set ax 1234 , dx abcd . so, did ' -a 100 ' register instruction, did: mov ah,dl , them " -g " (because set interruption) or "-g 102" peforme instruction , stop before 102 offset (if not set interruption). when peform -r show me registers values, remain unchanged, should ax:cd34 , ax 1234 yet, looks mov command doesn't works... doing wrong? http://img203.imageshack.us/img203/4866/movdxdldoesntworks.png (sorry link, need reputation post image) i know if exists windows debug linux, mean, have nasm , yasm in linux installation (debian-based), it's compiler, need write code file, , compile run, have "emulator" or "debug" tool asm in linux? debug windows software in picture above? the last thing, sorry make message long 3 questions, don't want "flood" lot of topics, so, last question can find kind of list of interru

git - Gitlab: Can't clone repo over SSH -

i've installed gitlab version 5.1 on server (centos 6.4 64bit). after lot of hiccups, can clone, pull , push... on http. anytime try ssh clone, error occurs: $ git clone git@git.server:my-project.git cloning 'my-project'... fatal: r my-project my-user denied fallthru (or mis-spelled reponame) fatal: not read remote repository. please make sure have correct access rights , repository exists. this denied fallthru error apparently no stranger google , stackoverflow, of them gitolite-related, not case here, gitlab has dropped gitolite per v5. missing here? first time working gitlab, please gentle. ok, after upgrading 5.2 problem's gone.

sql - Need to solve Group by -

select wk_nbr,region_cd,plant_cd, pos_gap_1day from(select wk_nbr,region_cd,plant_cd, round((case when sum(gap_1day)>0 sum(gap_1day) else 0 end ),2) pos_gap_1day table group wk_nbr,region_cd,plant_cd) in above query problem facing pos_gap_1day should sum positive numbers in column above query not give right answer since check sum(gap_1day)>0 . the problem need group wk_nbr , region_cd , plant_cd . please suggest try change round((case when sum(gap_1day)>0 sum(gap_1day) else 0 end ),2) pos_gap_1day to round(sum(case when sign(gap_1day) > 0 gap_1day else 0 end), 2) pos_gap_1day

asp.net mvc - Different Log on screens depending on area - MVC3 -

i have area mobile layout. have controllers in route uses normal website layout. the problem when use [authorize(roles = "rolename")] , user isn't in role page(mobile site) gets redirected normal website login page , not mobile one. is possible have switch between logins depending on area user trying access site? i've tried adding following in area web.config didn't work: <authentication mode="forms"> <forms loginurl="~/activation/login/index" timeout="2880" /> </authentication> any suggestions? when login action gets hit, check if on mobile device , redirect mobile login page if are. private static string[] mobiledevices = new string[] {"iphone","ppc", "windows ce","blackberry", "opera mini","mobile","palm",

Singleton in Android -

i have followed link , made singleton class in android. http://www.devahead.com/blog/2011/06/extending-the-android-application-class-and-dealing-with-singleton/ problem want single object. have activity , activity b. in activity access object singleton class . use object , made changes it. when move activity b , access object singleton class gave me initialized object , not keep changes have made in activity a. there other way save changing? please me experts. mainactivity public class mainactivity extends activity { protected myapplication app; private onclicklistener btn2=new onclicklistener() { @override public void onclick(view arg0) { intent intent=new intent(mainactivity.this,nextactivity.class); startactivity(intent); } }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //get application instance app = (myappl

android - Converting String to SimpleDateFormat incorrect result -

can guys advice why have incorrect result on end on method? public static string convertdatestringtohumanreadable(string datetoconvert) { // datetoconvert 1981-03-17t00:00:00 string date_format_pattern_input = "yyyy-mm-dd't'hh:mm:ss"; string date_format_pattern_output = "dd-mm-yyyy"; simpledateformat inputdate = new simpledateformat(date_format_pattern_input); date datetoparse = inputdate.parse(datetoconvert, new parseposition(0)); // datetoparse.tostring() sat jan 17 00:00:00 eet 1981 // why jan, i'm expecting march simpledateformat outputdate = new simpledateformat(date_format_pattern_output); return outputdate.format(datetoparse); } use mm instead of mm string date_format_pattern_input = "yyyy-mm-dd't'hh:mm:ss"; string date_format_pattern_output = "dd-mm-yyyy";

joomla - Need help DIV alignment(position) in css -

i developing joomla template , have 2 div each has 2 divs. border top menu <div id='menu' class='span12' > <div id='mainmenu' class='span9'> main menu</div> <div id='search' class='span3'> search </div> </div> i using bootstrap.min.css fine, second(top-menu, search) div in each div(top, menu) showing right after finishing first div under top-border; here css style #top { background-color: black; height:40px; } #top-border { background-color: red; height:30px; float:left; } #top-menu { background-color: blue; float:right; height:30px; } #menu { background-color: purple; height:50px; } #mainmenu { background-color: yellow; height:40px; } #search { background-color: brown; float:right; height:40px; } #photo { background-color: green; margin-right:-20px; height:300px; } when put width 100% in #top works fine width changed. idea how solve wit

javascript - Select all Elements on a page -

i looking function in javascript clicks on every element (links, buttons,...) on page. elements should disabled default. using testing environment in selenium check whether elements on page deactivated. at first, elements on page: var elements = document.getelementsbytagname("*"); now them, make mouse-event, make loop , apply event on every element: var clickevent = document.createevent ('mouseevents'); clickevent.initevent ('click', true, true); (var i=0; < elements.length; i++) { elements[i].dispatchevent (clickevent); }

javascript - Implementing a master view with multiple collections. Backbone.js -

edit my humble mockup of want implement i have defined such view: define(['jquery', 'underscore', 'backbone', 'text!_templates/gv_container.html', 'bootstrap/bootstrap-tab'], function($, _, backbone, htmltemplate, tab) { var gridviewcontainer = backbone.view.extend({ id: 'tab-panel', template: _.template(htmltemplate), events: { 'click ul.nav-tabs a': 'tabclicked' }, tabclicked: function(e) { e.preventdefault(); $(e.target).tab('show'); }, render: function() { this.$el.append(this.template); return this; } }); return gridviewcontainer; }); // define(...) the view's template looks this: <ul class="nav nav-tabs"> <li class="active"><a href="#products">products</a></li> <!-- other tabs --> </ul> <d

jquery - Why the sub links won't work? -

i have problem links in slidedown menu. the link's aren't clickable why? you can see here: jsfiddle my jquery code is: $('.links').hide(); $('.header a').click(function(e) { $(this).next('.links').slidetoggle('normal'); e.preventdefault(); }); your selector .header a affect anchors contained within .header , don't want. want toggle() when anchor, direct child of .header clicked. $('.header > a').click(function(e) { e.preventdefault(); $(this).next('.links').slidetoggle('normal'); });

How to prevent interim identity holes in SQL Server -

is there way (using config + transaction isolation levels) ensure there no interim holes in sql server identity column? persistent holes ok. situation trying avoid when 1 query returns hole subsequent similar query returns row not yet committed when query had been run first time. your question 1 of isolation levels , has nothing identity. same problem applies any update/insert visibility. first query can return results had include uncommited row in 1 , 1 situation: if use dirty reads (read uncommited). if do, deserve inconsistent results you'll , deserve no help. if want see stable results between 2 consecutive reads must have transaction encompases both reads , use serializable isolation level or, better, use row versioning based isolation level snapshot. recommendation enable snapshot , use it. see using snapshot isolation . all need promise inserts table committed in order of identity values claim. i hope read again , realize impossibility of request (&

android - Acces function from constructor in Lua -

i have class in lua. in constructor declare variables (in empty table) , after want acces function of object insert objects in table. code this: local boxclass = require("box") local surprisebox = {} local surprisebox_mt = { __index = surprisebox } -- metatable function surprisebox.new() -- constructor local object = { boxes = {} } surprisebox:createboxes() print('constructor -> ' .. #object.boxes) --> 0 return setmetatable( object, surprisebox_mt ) end ------------------------------------------------- function surprisebox:createboxes() local box1 = boxclass.new('palo', 'images/chestclose.gif', 'open') local box2 = boxclass.new('moneda', 'images/chestclose.gif', 'open') self.boxes = { box1, box2} end after access function createboxes() there nothing inside table. thanks help! when call surprisebox:createboxes() , self parameter still points surprisebox table, not ob

java - How to manage MySQL Connections properly? -

i working on server-application written in java. there 30 client requests per second, every request specific mysql table entry gets updated. all server threads use single mysql connection, obtain singleton class. server thread creates statement , executes update query. although close created statements after execution, server stops updating mysql table after hours. what wrong? setup misconcept? perhaps, connection closed due timeout. can make use of connection#isvalid in order verify whether or not connection still open. you may take @ connection timeout drivermanager getconnection . there several tips listed. also, may consider use of connection pool in code. apache commons place start.

io - What is the best way to get keyboard events (input without press 'enter') in a Ruby console application? -

i've been looking answer in internet while , have found other people asking same thing, here. post presentation of case , response "solutions" have found. i such new in ruby, learning purposes decided create gem, here . trying implement keyboard navigation program, allow user use short-cuts select kind of request want see. , in future, arrow navigations, etc. my problem: can't find consistent way keyboard events user's console ruby. solutions have tried: highline gem: seems not support feature anymore. anyway uses stdin, keep reading. stdin.getch: need run in parallel loop, because @ same time user can use short-cut, more data can created , program needs show it. , well, display formated text in console, (rails log). when loop running, text lost format. curses: cool need set position(x,y) display text every time? confusing. here trying it. may note using "stty -raw echo" (turns raw off) before show text , "stty raw -echo" (tu

my native android project shows an error "05-13 14:00:09.930: A//system/bin/app_process(5774): stack corruption detected: aborted" -

in latest project , use 2 native libraries.some time shows error code in log cat "05-13 14:00:09.930: a//system/bin/app_process(5774): stack corruption detected: aborted", but work properly.i dont know how solve problem 1 please me.

objective c - JSONKit returning unwanted NSCFString rather than NSDictionary -

i've been pulling hair out tried figure out whats wrong here, reason jsonkit isn't giving me dictionary need can reference particular key/value pairs within plist. instead displaying nscfstring doesn't conform methods objectforkey: . i've scoured around solutions; telling me disable arc, restart/reinstall xcode, , variety of different implementations no budging. worse yet, have same code block in project same function , works seamlessly. nserror * error = null; nsdata * plistdata = [nsdata datawithcontentsoffile:filepath]; id plist = [nspropertylistserialization propertylistwithdata:plistdata options:nspropertylistimmutable format:null error:&error]; nsstring * jsonstring = [plist jsonstringwithoptions:jkserializeoptionpretty error:&error]; nsdictionary * returndictionary = [jsonstring objectfromjsonstring]; for(id elem in returndictionary) { for(id elements in elem) { nslog(@"%@",elements); } } the error given: -[nsc

centos - Launch perl script on startup -

i'm trying launch perl script supposed run time on startup. i'm working on centos server. i added line in /etc/rc.d/rc.local , script won't start while works when type same line console : perl /svcmon/bin/svcperf.pl --svc fav01svc --interval 5 >> /dev/null & this script supposed launched , have wait many time want datas inserted in database, adding >> /dev/null/& allows keep on using machine while script working in background. i don't know because don't why doesn't work... do have idea of try ? edit : turns out managed launch script doing : nohup /usr/bin/perl /svcmon/bin/svcperf.pl --svc fav01svc --interval 5 > /outputsvcperf.txt & but doesn't work because postgresql server isn't launched in time while supposed launched on startup , before perl script... in unix shell (where command works) type command: " which perl " this produce output giving full path perl binary. let's

MySQL function returning error -

#1415 - not allowed return result set function delimiter $$ create function test.fngetlastdaylastfinyear (pdate datetime) returns datetime begin declare monthno int; declare yearno int; declare outputdate datetime; select monthno = datepart(month,@pdate); if(@monthno <= 3) select @yearno = (datepart(year,getdate()) - 1); select @outputdate = date_format(@yearno,'%d/%m/%y'); else select @outputdate= date_format(@pdate,'%d/%m/%y'); end if; return @outputdate; end if want "return" result set, must use create procedure , not create function in docu explained can use create function when return single value. update: if want set variable in function , return it, suggest using select field your-variable rest-of-normal-select; e.g. declare monthno int; select datepart(month,pdate) monthno; this works if datepart function works expected.

bitmapimage - WPF C# image brightness -

i loaded image bitmapimage . xaml <image margin="12,12,16,71" name="imgphoto"> code behind openfiledialog op = new openfiledialog(); op.title = "select picture"; op.filter = "all supported graphics|*.jpg;*.jpeg;*.png|" + "jpeg (*.jpg;*.jpeg)|*.jpg;*.jpeg|" + "portable network graphic (*.png)|*.png"; if (op.showdialog() == true) { imgphoto.source = new bitmapimage(new uri(op.filename)); } how can change brightness of image ?

python - parsing email_message['Subject'] results 3 strings instead of 1 -

i'm parsing email subject , getting multiple strings (depending on subject length) starting =?utf-8?b? . normal behavior? how can join strings 1 string 1 encoding? email_message = email.message_from_string(raw_email) print email_message['subject'] ... =?utf-8?b?15bxkneqiner15pxmden15qg15hxodez16hxmdeqiner15vxk9ezinec15txkdez158g?= =?utf-8?b?157xk9ev16ig15txp9ez15pxldetineu15bxlcdxnneqinei15xxkdetineq150g15dxonezineo15u=?= =?utf-8?b?16nxnsdxlneo15hxla==?= edit: subjectdecoded, encoding = decode_header(email.utils.parseaddr(email_message['subject'])[1])[0] if encoding==none: subjectdecodedparsed = email_message['subject'] print 'i not decoding subject' print subjectdecodedparsed else: subjectdecodedparsed = subjectdecoded.decode(encoding) print 'i decoding subject' print subjectdecodedparsed.encode('utf8') #<--- first line presented here your string encoded using quoted-printable form

How to get the business "description" via Google Places API? -

in google places, when editing business, able add "description" under "basic information". way, such edit go http://www.google.com/local/add/businesscenter , click "edit" under business listing. when query places api details of business, don't see "description": url = "https://maps.googleapis.com/maps/api/place/details/json?key=#{key}&sensor=#{sensor}&reference=#{reference}" i looked @ place details results , , don't see "description" field there. so how can place/business description field via google api query? the question asks "how description" user continues describe problem editing own business. it appears google not store place's descriptions in it's own google places db instead gives excerpts relevant freebase/wikipedia pages the answer editing business description "you can't directly" or "create or edit wikipedia/freebase page indirectly add

Using R to process Mail Files -

i've done bit of searching , after not finding thought post question. actually, because i've not found much, think may indicator of answer be, anyway...here is: does have experience using r process files postal mailings...and if so...what packages use? i realize r might not best tool task have use tools have @ hand , have "extra" things @ work stay employed...so please don't flame me hard question. basically i'm looking @ merge purge, dup/elim sort of stuff. i've played compare() , merge() commands bit. i'd incorporate equivalencies in compares such as st=st=st.=street blvd=blvd=blvd.=boulevard etc... i'm wondering if packages have been developed sort of data processing i'm not reinventing wheel. i'd suggest following basic workflow: (1) read in data. don't know looks based on question, i'll assume that's easy you. (2) use mix of gsub , toupper , , other string manipulation tools convert data same

e commerce - How to add Fee to Selected Payment Methods in Magento 1.7 -

i have multiple payment methods in magento 1.7.0.2 for add fee of them. how can that? ps: if there community based extension may extended or may suffice great, life saver of now. you can extend shopping cart price rules functionality editing core files or writing extension idea (allow negative discounts shopping cart rules). there paid extension problems solved not considered in article above. you can write extension uses different idea - add own total. more complex.

ubuntu - Git - how to push on every repository inside folder -

on local computer have every project inside workspace folder, there have git repositories cloned repositories of github, bitbucket, etc. so example have this: workspace\ githubrepo1\ githubrepo2\ bitbucketrepo1\ bitbucketrepo2\ ... there many more (of course not folder names). i have done commits on of local repositories , want push them respective remote repositories. remote directions configured correctly , using ssh access, won't ask me password. maybe done terminal command, don't know how. using ubuntu. so, how make git push on every repository inside workspace . thank you. a simple shell construct: for repo in ${home}/workspace/* (cd ${repo} && git push) done if often, add .bashrc pushall() { repo in ....... ........ done } then can run pushall whenever need to...

%typemapping of a C++ Library for Python Interface -

i want create python wrapper c++ library. cool, if there automatic conversion of std::vector python lists , other way round. unfortunatly if add code interface-file still errors in run-time. %typemap(in) std::vector<float> value (std::vector<float> vin) { int ilen = pysequence_length($input); for(unsigned int = 0; < ilen; i++) { pyobject *o = pysequence_getitem($input, i); if (pynumber_check(o)) { vin.push_back((float)pyfloat_asdouble(o) ); } } $1 = vin; } %typemap(out) std::vector<float> { std::vector<float> vout = $1; int ilen = vout.size(); $result = pylist_new(ilen); for(unsigned int = 0; < ilen; i++) { double fval = vout.at(i); pyobject *o = pyfloat_fromdouble((double) fval); pylist_setitem($result, i, o); } } class header: class trainingset { private: std::vector<std::vector<float> > m_vinputlist; std::vector<

Android XML buttons -

i trying make calculator android. have started using xml make buttons , such , going reference them in java math. having trouble making them buttons instead of lines. understand weight sum, don't know if supposed using kind of thing. code following: (code has been updated) <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/total" android:textsize="45sp" android:id="@+id/calcdisplay" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wr

google app engine - Simple static website in GAE with custom 404 error page -

i using gae simple static website html/htm pages, pictures etc. using python 2.7. so use straight forward app.yaml , main.py , works. however, when accessing page not exist, shows standard 404 page. want change 1 custom error page, , tried below not work. here app.yaml , main.py files: application: xxxx version: 11 runtime: python27 api_version: 1 threadsafe: true default_expiration: "7d" inbound_services: - warmup handlers: - url: / static_files: index.html upload: index.html - url: /(.*) static_files: \1 upload: (.*) - url: /.* script: main.app main.py: import webapp2 class basehandler(webapp2.requesthandler): def handle_exception(self, exception, debug): # set custom message. self.response.write('an error occurred.') # if exception httpexception, use error code. # otherwise use generic 500 error code. if isinstance(exception, webapp2.httpexception): self.response.set_status(exception.code) else:

ruby on rails - Google contacts API 401 error RestClient::Unauthorized -

i want retrieve google contacts user in ruby on rails using restclient, every time tried, face restclient 401 unauthorized error on query line. assume query wrong or missgin something, didn't find usefull in google contact api doc. idea ? here's scope scope = 'https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.google.com/m8/feeds/contacts/default/full/+https://mail.google.com/mail/feed/atom/+https://www.googleapis.com/auth/calendar' here's method call freshly received access_token def import_google_contact(user_email, access_token) r = restclient.get "https://www.google.com/m8/feeds/contacts/#{user_email}/full?access_token=#{access_token}" ... end which weird since manage user email before in same method using request r = restclient.get "https://www.googleapis.com/oauth2/v2/userinfo?access_token=#{access_token}" i discovered didn't put right parameter in sc

angularjs - How can I get directive to fire after view loaded? -

i know has been asked thousand time, think i've tried every solution i've read , can't seem work. i have api i'm getting images, after pulling images view want them use photoswipe displaying on mobile. i have directive: 'use strict'; app.directive('photoswipe', function () { return { replace: false, restrict: 'a', link: function photoswipelink(scope, element, attr) { scope.$watch(attr.photoswipe, function(value){ angular.element('#gallery a').photoswipe({ enablemousewheel: false, enablekeyboard: false }); }); } }; }); i error in console: code.photoswipe.createinstance: no images passed. i guess because directive running before view has rendered. if add $timeout instead of watch code work. unfortunately solution no good, there delay in getting data api. also, code doesn't work within timeout. i have tried, above code, i've tried using $viewconten

How do I count the number of times where A happened and B happened with R from a table? -

let's data a b c 0 1 0 1 1 0 <- here , b 1 1 0 0 0 1 1 1 1 1 <- here 1 1 0 <- , here i want count number of times both , b 1. in case 3. easy sql have no idea how r . if df data.frame columns, a,b,c : sum(df$a==1 & df$b==1)

rspec - capybara within :css syntax meaning -

i'm working on fixing specs, , have found piece of syntax nobody seems know represents. in capybara suite there multiple occurrences of: within(:css, '#foo') do by removing :css have found functionally identical within('#foo') do is there difference? other symbols can passed in first parameter within? after following @andrey botalov's link, have found explains kind of selector being input within block. in case, capybara.default_selector set :css , :css default. other option listed :xpath

r - ggplot 2 "Error: Discrete value supplied to continuous scale" -

i ask how fix bug described in question title? yesterday, code working fine , plotting routine produced desired graph. woke today , tried add features , got error message. any clue why , how fix this? thx data link: data.csv code: # loading data morstats <- read.csv(file = "f:/purdue university/ra_position/phd_researchanddissert/phd_draft/dissertationdraft/moroccocge-cc_stats.csv", header=true, sep=",", na.string="na", dec=".", strip.white=true) # transferring .csv data data frames moroccostats <- as.data.frame(morstats) # changing data in dataframe "as.numeric" moroccostats[3:38] <- sapply(moroccostats[3:38],as.numeric) moroccostats <- droplevels(moroccostats) # reorder moroccostats <- transform(moroccostats,year=factor(year,levels=unique(year))) # load packages library(reshape2) library(ggplot2) library(lattice) library(grid) library(plyr)