Posts

Showing posts from September, 2012

ruby on rails - Add user id to comment model -

i'm following tutorial : http://guides.rubyonrails.org/getting_started.html#adding-a-second-model it works when using commenter , comment user can add name , message want associate comment user id (i have users) it uses rails generate model comment commenter:string body:text post:references want replace commenter:string user id association ( user_id:integer ?). in previous question suggested author_id:integer did not work. not sure start , there doesn't seem tutorials on subject (i have read ror guides on associations etc can't find correct way generate user id comment model) comments_controller.rb def create @listing = listing.find(params[:listing_id]) @comment = @listing.comments.create(params[:comment]) redirect_to listing_path(@listing) end you can generate comment mode this: rails generate model comment user:references body:text post:references the references type specify create user_id:integer column , adds belongs_to association

c# - How to let the UI refresh during a long running *UI* operation -

before flag question being duplicate, hear me out. most people have long running non-ui operation doing , need unblock ui thread. have long running ui operation must run on ui thread blocking rest of application. basically, dynamically constructing dependencyobject s @ run time , adding them ui component on wpf application. number of dependencyobject s need created depends upon user input, of there no limit. 1 of test inputs have has 6000 dependencyobject s need created , loading them takes couple minutes. the usual solution of using background worker in case not work, because once dependencyobject s created background worker, can no longer added ui component since created on background thread. my current attempt @ solution run loop in background thread, dispatch ui thread each unit of work , calling thread.yield() give ui thread chance update. works - ui thread chance update couple times during operation, application still blocked. how can application keep updating

Word 2007 vba, directly select field by name attribute of code property? -

is there way have vba select field in word doc using name attribute of field code property? maybe using pseudo selector? background: have 8 fields (docproperty name_first, name_last, etc) in document in 4 places (total 32 items) instead of looping through entire collection of fields, want able return collection of fields match name_first, , make changes,insertafter, etc, call update method on fields only. updating fields causing noticeable delay on each form field when exited next field. the msdn documentation shows examples using ordinal index numbers, isn't helpful in real world. if changes ordinal position of field, donkeykong! a bookmark can referenced name. if want update 4 fields reflect name_first, place bookmarks on 4 fields names "name_first_1", "name_first_2" etc. update fields like: for = 1 4 activedocument.bookmarks("name_first_" & i).range.fields(1).update next in words: bookmarked range pseudo selector. field

c# - "Store update, insert, or delete statement affected an unexpected number of rows (0) -

i'm using ef in order insert simple object db: public bool addquestion(question question) { try { _ctx.questions.add(question); _ctx.savechanges(); return true; } catch(exception ex) { return false; } } my dbcontext like: public class anycontext:dbcontext { public anycontext():base() { configuration.proxycreationenabled = false; configuration.lazyloadingenabled = false; database.setinitializer(new migratedatabasetolatestversion<anycontext, anycontextmigrationconfiguration>()); } public anycontext(string connectionstring) : base(connectionstring) { configuration.proxycreationenabled = false; configuration.lazyloadingenabled = false; database.setinitializer(new migratedatabasetolatestversion<anycontext, anycontextmigrationconfiguration>()); } public dbset<question> questions { get; set; } } and poco like:

In Freemarker how do I insert the right number of spaces to place text in a specified column? -

i'm doing simple c code generation using freemarker. generating line following: #define my_constant (0) from template of form: #define ${name} (${value}) i generating bunch of these , want them come out this #define my_constant (0) #define my_new_constant (42) #define my_other_constant (101) with values column aligned. there easy way this? need write directive it? thanks in advance. you can use right_pad builtin. #define ${name?right_pad(30)} (${value}) see doc here .

Strong parameters in Ruby -

i'm getting error message strong parameters. think it's rails 4 doesn't use attributes anymore. code toy.rb is: class toy < activerecord::base attr_accessible :name, :price, :vendor validates :name, :presence => true validates :price, :presence => true validates :price, :numericality => true validates :vendor, :presence => true end how can change strong parameters? edit: used different rb changed employees , have: class employee < activerecord::base params.require(:employee).permit(:first, :last, :salary, :salary, :ssn) validates :first, :presence => true validates :last, :presence => true validates :salary, :presence => true validates :salary, :numericality => true validates :ssn, :presence => true end it's still telling me "ndefined local variable or method `params' #" the code need is params.require(:toy).permit(:name, :price, :vendor) you put in controller. typically

visual studio - How to generate shader debug information (pdb) in VS2012 -

i'm trying debug shaders in directx 11 sdk application using graphics diagnostics tool in vs2012, when click start debugging on 1 of shaders in graphics pixel history panel i'm getting pixel shader.pdb not loaded , i'm not able find pdb file anywhere. i tried compiling shaders @ runtime using d3dx11compilefromfile d3dcompile_debug flag using hlsl compiler debugging information turned on (/od /zi) none of these options producing pdb file use in graphics diagnostics tool. how generate these files? i think "pixel shader.pdb not loaded" message misleading. no .pdb files generated hlsl-compiler. debug info integrated binary (either memory blob or .cso file). shader file named "pixel shader" ? maybe says not shader, kind of visual studio's internal source files (shader debugger in vs2012 unstable sometimes) some ideas that, probably, can solve issue: make sure debug , release output binaries not messed up. check both debug , r

Why does Scala type inference fail in one case but not the other? -

background: i'm using net.liftweb.record mongodb access database. @ point, in need of drawing table of collection of documents database (and render them ascii table). ran obscure type inference issues easy solve nevertheless made me want understand why happening. reproduction: simplicity, i've reduced code (what think is) absolute minimum, depends on net.liftweb.record , none of mongo specific types. i've kept real-life body of function under question make example more realistic. maketable takes apples, , functions map apples columns. columns can either mapped real field on apples, or dynamically computed value (with name). able mix 2 (real fields , dynamic values) in single seq , defined structural type col . to see how code (below) behaves, try following variants of cols parameter maketable : // ok: cols = seq(_.isdone) cols = seq(job => dyncol1) cols = seq(job => dyncol1, job => dyncol2) // error: found: seq[job => object], required: seq[

jQuery Char Count Variable Issue -

i having @ various methods of using character count in jquery , found 1 , modified , implemented having bit of issue it. wondering if guys give me pointers may going wrong. this have code: function countchar(val) { var len = val.value.length; if (len >= 500) { val.value = val.value.substring(0, 500); $('.stat').text(0); } else { $sv = (500 - len); $('.stat').text($sv); if ($sv <= 20) { $('.stat').css({'border': '1px solid #c33', 'color': '#c33', 'background-color': '#f6cbca'}); } else if ($sv >= 21 && $sv <= 150) { $('.stat').css({'border': '1px solid #9f6000', 'color': '#9f6000', 'background-color': '#feefb3'}); } else { $('.stat').css({'border&

Jetty 8 vs Jetty 9 for production environment -

we using jetty 8 production environment serving low latency traffic. wondering advantages move jetty 9, given have low latency requirement. thanks! jetty 9 has refactored io layer on jetty 8 should garner improvements in area. see blog information on how , why jetty best of breed in area. https://webtide.com/jetty-in-techempower-benchmarks/ specifically down latency tests jetty came out on top. [edit] should note perhaps not appropriate question forum since outside of intent of stack overflow , more inline server fault...just fair warning.

ios - the language area show pending status in iTune connect In-App purchase Details -

Image
i'm configuring in-app purchase in itunes connect , area of language showing pending status. how can resolve issue? all language changes reviewed apple. process takes few days.

ActionScript 3.0 AddChild Function Not Working -

i have tested out code , addchild won't work. no errors outputted. package{ import flash.display.movieclip; import flash.events.event; import flash.events.mouseevent; import flash.display.*; import flash.events.*; import flash.geom.rectangle; import flash.media.sound; import flash.text.*; public class game extends flash.display.movieclip{ public static const state_init:int = 10; public static const state_play:int = 20; public static const state_end_game:int = 30; public var gamestate:int = 0; public var score:int = 0; public var chances:int = 5; public var bg:movieclip; public var enemies:array; public var player:movieclip; public var level:number = 0; public var scorelabel:textfield = new textfield public var levellabel:textfield = new textfield public var chanceslabel:textfield = new textfield public var scoretext:textfield = ne

asp.net mvc - Kendo MVC multiple uploaders -

i'm using kendo controls mvc. have basic uploader working, need create them dynamically , handle code on end. here's simple example that's working <input name="attachments" type="file" id="attachments" /> <script type="text/javascript"> $(document).ready(function () { $("#attachments").kendoupload({ async: { saveurl: '@url.action("save", "appconfig")', autoupload: true } }); }); </script> [httppost] public actionresult save(ienumerable<httppostedfilebase> attachments) { if (saveuploadedfile(attachments, "background")) { return content(""); } else { return content("error"); } } however, need create ids dynamically , handle on backend. how i'm making file uploaders @foreach

php - How do I post on click of an image? -

i wondering if possible me post name on click of image variable. when have text field , hit submit , variable posted, want except on click of image, display image. anyways tried , dont thing... appreciated thanks! <html> <body> <img src = "img/tumblr_m4zptebtju1qm0f2jo1_500.gif" name = "img" method = "post" action = ""> <?php $img = $_post["img"]; echo "<img src = "$img">"; ?> </body> </html> just use <input type="image" src="images/f.jpg" name="submit" /> as submit button

max - using scanner class to average numbers in java -

i using scanner class average numbers together. using method averaging. not want program run if there more 20 args. cant seem work. new @ java , trying learn. i appreciate can get. thanks! import java.util.scanner; class programtwo { public static void main (string[] args) { scanner scan = new scanner(system.in); double x = 0.00d; if (args != null) { system.out.println ("enter numbers averaged. remember no more 20!:"); x = scan.nextint(); if (x <= 21) { system.out.println("please not add more 20 numbers"); } } else { } } public double average(double [] values) { double average = 0.0; if ((values != null) && (values.length > 0)) { (double value : values) { average += value; } average /= values.length; } return average; } } here

go - Converting []uint8 to float64 -

what best way handle http resp.body formatted []uint8 , not json? convert bytes float64 . this returned value response: value : %!f([]uint8=[48 46 48 48 49 50 53 53 50 49]) try using parsefloat strconv package ( play ): b := []uint8{48, 46, 48, 48, 49, 50, 53, 53, 50, 49} f, err := strconv.parsefloat(string(b), 64) if err != nil { // handle parse error } fmt.printf("%f\n", f) // 0.001255

elisp - How to debug igrep in emacs -

i have highly customized igrep.el special purpose. search works fine : grep exited abnormally code 1 @ wed feb 5 18:18:09 at end. how go debugging code? how find out part modified causing problem? never debugged in emacs before. my second question, there way "highlight" token igrepping in igrep window? i trying iqbal's solution incorporating highlight inside grep comand so: ;;;###autoload (defun igrep (program regex files &optional options) (interactive (igrep-read-args)) (if (null program) (setq program (or igrep-program "grep"))) (if (null options) (setq options igrep-options)) (if (not (listp files)) ; (stringp files) (setq files (list files))) (if (and (member ?~ (mapcar 'string-to-char files)) (save-match-data (string-match "\\`[rj]?sh\\(\\.exe\\)?\\'" (file-name-nondirectory shell-file-name)))) ;; (restricted, job-control, or standard) bourne shel

c - linked list code from my professor, bit confused -

typedef struct node{ int data; struct node *next; } node, *nodeptr; int main(…){ nodeptr firstnode = null; … } nodeptr insertathead(nodeptr head, int data) { /* create , fill new node*/ nodeptr newnode = (nodeptr)malloc(sizeof(node)); /*check malloc not return null, if yes – output error , exit */ newnode->data = data; newnode->next =null; /* add beginning of linked list*/ if (firstnode==null) /*linked list empty*/ firstnode=newnode; else { newnode->next = firstnode; firstnode = newnode; } return firstnode; } i received code base homework on. i'm having issues passing node pointer (firstnode). error: conflicting types 'insertathead'. see think problem in definition. first node called head everwhere else called firstnode. did make change, i'm lost how pass pointer. show original code given, posted code directly lecture notes. in advance. you're coding right solution, doing if isn't in function. should this: #inc

what is the syntax for accessing address of this pointer in C++? -

i trying know address of pointer. tried in following way. can suggest me right method? trying print cout<<&this<<endl; in class member function. compiler generates error c2102: '&' requires l-value. if i'm not mistaken, std::cout << this should suffice. class foo { public: void foo() { std::cout << << std::endl; } }; int main() { foo foo{}; foo.foo(); }

Scheme: Mutating elements in an array for chess -

i have been working on simple chess program in scheme, , 1 of helper functions have defined consumes piece, , coordinates (current-location) , places @ specified coordinates (move-here) on chess board, switching out piece may located @ move-here coordinates. function working had hoped, yet whatever reason no longer functioning properly. have no idea causing this, , have been tracing , re-tracing code while trying find bug. hoping may able shed light on situation. here code piece-switching function, along structures used within code: (define-struct place (row column piece)) ;; place structure (make-place r c p) r rank of piece ;; symbol of 'pawn, 'rook, 'knight, 'bishop, 'king or 'queen ;; , column , place. c , p give placement coordinates, ;; column 1 symbol '(a b c d e f g h) , row number ;; 1 - 8 inclusive. (define-struct piece (rank color)) ;; piece structure (make-piece r col) rank described place structure, ;; , colour symbo either 'bla

javascript - How to addClass and removeClass with fade via jQuery? -

i'm trying fade 1 image another. tried css route making top image transparent on hover, that's not going work in case. in case, on hover, i'm trying fade logo logo glow. logos aren't perfect shape, having 2 pictures on top of 1 redundant, since user can see "over" picture, aka logo glow, without hovering on it. i found jquery's addclass , removeclass , thought that'd work. far, has, except fading isn't occurring. instead, it's switching on-hover image. here's fiddle of code , except logo has been replaced apple , over-logo has been replaced orange, since logo pictures locally stored. the javascript have in fiddle this: $(document).ready(function() { $('img#logo').hover( function(){ $(this).stop(true).addclass('over', 500) }, function(){ $(this).stop(true).removeclass('over', 500) }); }); and here html: <img id="logo" class="top" width="256" height="

What is Java Regex to match number then space then 3 alphabet char? -

i want validate of money currency unit. 100 usd : valid 1.11 usd : not valid 1,12 usd : not valid 12 : not valid so valid string "the number space 3 alphabet char". text.matches("^\\d+ [a-za-z]{3}*$") i got error: exception caught: dangling meta character '*' near index 16 ^\d+ [a-za-z]{3}*$ so how fix it? i fixed obmitting * fine: text.matches("^\\d+ [a-za-z]{3}$")

c# - What's the proper way to deal with \ in .NET console application arguments? -

this question has answer here: backslash , quote in command line arguments 3 answers i wrote small application copy files source destination. expected 2 parameters, source , destination. following command works fine. test.exe "c:\source path" "d:\destination" the problem have when pass parameter within " , end \ messes up. for example: test.exe "c:\source path\" "d:\destination" since \ escape character test.exe gets first argument c:\source path" instead of c:\source path\ so, what's proper way deal problem. even basic sample shows strange behavior - \" passed command line converted " : static void main(string[] args) { foreach(var s in args) { system.console.writeline(s); } } test.exe @"c:\source path\" @"d:\destination" the @ makes string ver

Printing matrix with numpy, python -

i want return matrix. missing? import numpy print matrix([[0,1],[1,1]]) i following error: traceback (most recent call last): file "fib.py", line 2, in <module> print matrix([[0,1],[1,1]]) nameerror: name 'matrix' not defined you have call like: print numpy.matrix(...) or (to avoid writing whole word numpy ): import numpy np print np.matrix(...)

ios - Why are FetchedResultsController delegate methods not being called for deleted records? -

just wondering if else has found deletes synchronised via icloud not triggering fetchedresultscontroller delegate methods called on device importing transaction logs? the transaction logs imported because nspersistentstoredidimportubiquitouscontentchangesnotification notification fetchedresultscontroller methods don't called. inserted or updated records transaction imports results in delegate methods being correctly called. calling performfetch correctly updates result set calling reloaddata on uitableview sufficient ui updated correctly. this works if call save on context after merging changes - never had before. [self.managedobjectcontext mergechangesfromcontextdidsavenotification:notification]; nserror *error; if ([self.managedobjectcontext haschanges]) { [self.managedobjectcontext save:&error]; } any idea why deletes not triggering fetchedresultscontroller delegate methods ? seems new issue suddenly. pretty sure never had issue - perhaps else

Facebook login - jssdk dont redirect to my webpage after dialog -

today when clicked facebook login in webpage, dialog popup usual, after clicked ok, popup stuck @ blank page url https://www.facebook.com/dialog/oauth?app_id= {appid}&client_id={client id}&display=popup&domain={domain}&e2e=%7b%7d&locale=en_us&origin=1&redirect_uri=http%3a%2f%2fstatic.ak.facebook.com%2fconnect%2fxd_arbiter.php%3fversion%3d29%23cb%3df2356881fe8e6bc%26domain%3d{domain}%26origin%3dhttp%253a%252f%252f{domain}%252ff1d6980bbb127d2%26relation%3dopener%26frame%3df17ee4a3b5fd2e8&response_type=token%2csigned_request&scope=email%2cpublish_stream&sdk=joey and didnt auto close , redirect webpage. at blank page popup, view source , see js: var message = "cb=f1a6be948fefda&domain={domain}&origin=http\u00253a\u00252f\u00252fjebsenwine.dev.cleargo.com\u00252ffe2018a8b499c4&relation=opener&frame=f7e1c0c9232fd2&access_token={access token}&base_domain=", origin = "http://{domain}", domain = "

ruby on rails - Setting up Elastic Beanstalk on Ubuntu -

after doing research on scalability decided deploy rails app via aws instead of heroku. elastic beanstalk seems easy use problem i'm running can't figure out how install elastic beanstalk. i'm developing on remote aws ubuntu 12.04 instance. know apt-get lines install eb command line? find on amazon , various guides point me downloading/installing on local pc, want install on remote instance i'm developing on. thanks! tom you can use aws cli or aws elastic beanstalk command line tool . haven't tried cli deploying on elastic beanstalk sure works.

javascript - How do I change the title of an HTML page generated by Docco? -

currently title of html page generated docco name of source code file. how change that? set custom title generated code. just make sure first line in source file has header section in it, example: // # custom title var code = require('somelib'); the above code, when given input docco, result in html page title "my custom title".

css - Responsive works on screen tester, but not on cellphone -

live link here http://soloveich.com/pr6/ that's wordpress site. using bootstrap, i've put entire design in 2 columns <div class="col-md-3 col-sm-6 col-xs-12" id="side1"></div> <div class="col-md-9 col-sm-6 col-xs-12"></div> not gonna put styling here. of it. also, using wen's responsive column layout shortcodes inpost responsive columns. everything works on screen testers. not on cellphones, though. these 2 main columns don't stack on each other, menu refuses turn responsive 1 (it on screen tester), , inpost columns start overflowing. usually using tester http://quirktools.com/screenfly/ add <meta name="viewport" content="width=device-width, initial-scale=1" /> inside <head> tag. you can find explanation viewport meta tag here .

php - Escaping quotes before MySQL -

Image
here have script validate description users pass: if(strlen($_post['descriprtion']) >250) { //some error code here } else { $description = $mysqli->escape_string(htmlentities(trim($_post['description']))); } now, test description i'm testing . give me when print out page: as can see, there's black slash before single quote. i considering using stripslashes() , should use it? use stripslashes() when want echo variable. echo $var; // --> i\'m testing. not funny. echo stripslashes($var); // --> i'm testing. not funny. working dmeo

ios - Is there a way to pop back to previous navigation controller? -

Image
i have base nav controller has tab bar controller nested inside. inside tab bar controller nav controller nested in it. if i'm in child nav controller can pop root view in 1 of views takes me root view of child nav controller. there way pop first nav controller? if using storyboard can use unwind segue approach works me just control + drag "pop main screen" uibutton exit (green button @ bottom of scene) select unwind method declared in first screen title "main" e.g. -(ibaction)customunwind:(uistoryboardsegue *)sender { nslog(@"unwind successful"); }

matlab - Capitalizing only the first letters without changing any numbers or punctuation -

i modify string have make first letter capitalized , other letters lower cased, , else unchanged. i tried this: function new_string=switchcase(str1) %str1 represents given string containing word or phrase str1lower=lower(str1); spaces=str1lower==' '; caps1=[true spaces]; %we want first letter , letters after space capital. strnew1=str1lower; strnew1(caps1)=strnew1(caps1)-32; end this function works nicely if there nothing other letter after space. if have else example: str1='wow ! ~code~ works !!' then gives new_string = 'wow ^code~ works !' however, has give (according requirement), new_string = 'wow! ~code~ works !' i found code has similarity problem. however, ambiguous. here can ask question if don't understand. any appreciated! thanks. interesting question +1. i think following should fulfil requirements. i've written example sub-routine , broken down each step obvious i'm doing

java - Replacing HTML code with character entity -

i have string contains html code &#148; & &#146; etc. want replace respective entity set ( " & ' ) in java. have tried following code. if (stringutils.isnotblank(string)) { string = stringescapeutils.unescapexml(string); string = stringescapeutils.unescapehtml(string); string = string.replaceall("<.*?>", ""); string = string.trim(); } input string : brief tie side, string style embellished shimmering silver sequins. dangling gunmetal chain tassels decorate end of each hip tie. model&amp;apos;s measurements height 5&amp;apos;10.5&amp;quot; hips 36&amp;#148; waist 23.5&amp;#148; model wears size 2 i getting following output contains badencoding: brief tie side, string style embellished shimmering silver sequins. dangling gunmetal chain tassels decorate end of each hip tie. model's measurements height 5'10.5" hips 36<94> waist 23.5<94> bust 35<94

ruby - Rails Deadline Calculator Help: future date = number input from user + date selected by the user -

i new ruby on rails , trying build deadline calculator works one: ( click here ). as can see hyperlinked example, deadline calculator allow user enter given number form field reflecting number of days until deadline. deadline calculator add number given date selected user. calculator print resulting date of deadline based on these 2 user inputs. example: imagine user receives letter stating, "you have 45 days 2/5/14 mail response letter...." , wanted calculate date equal 45 days after 2/5/14. user input "45" (days) , "2/5/14" (start date) , click "calculate" button. website display like, "your deadline saturday, march 22, 2014." here's have far.... my app/views/pages/about_page.html.erb file contains following block of code: <div class="row"> <div class="col-xs-2"> <%= form_tag %> <%= number_field_tag 'days' %> <p>after</p>

How can I allocate 16K continuous memory in kernel and get the physical address? -

my understand kernel page size 4k. want allocate 16k continuous memory buffer driver. used kmalloc() , returns me pointer (i assume allocation successful). does mean 16k continuous? and address kmalloc() virtual address? if need pass address hw register, use virtual address or physical address? yes - memory allocated kmalloc physically continous , address virtual address. try virt_to_phys() macro obtain physical address.

java - Why does the Date class object prints today's date instead of reference of Date class -

when create object, object have reference of data members , methods of class. eg: testobject obj = new testobject(); system.out.println("test object is:"+obj); as per knowledge, new operator is, creates/ allocates memory blocks specified class(variables , methods) , assigns reference left hand variable (obj). so, above print statement prints reference of testobject class. but, question is, when create object date class , print object, prints today's date. eg: date date = new date(); system.out.println("date object is:"+date); the above code prints today's date. why , how printing date instead of date class reference. please me. am sorry, if silly question. silly, don't have answer question. brief explanation appreciable. when use reference of instance print, internally, it's called tostring() method of class. in date class, tostring() method return whatever date contains. date api's tostring()

java - Particular uploading issue via JSP -

hi creating file upload , download form via jsp. working fine, can upload small files, can create , fetch download particular file , delete file if required. now problem is, suppose 2 users using app. user uploaded file named file.txt. sometime later user b uploaded file named file.txt. previous file overwrite. dont want popup box alert user b file of name exists. instead want folder created each user have files stored on server side in named folder. savefile="c:/temp/"+savefile; i need modify line of code think. task completed. ok task done. guy had exact same task me. how create folder in tomcat webserver using java program? thanks guys inputs.

asp.net - create csv file from multiple datatables in c# -

i want export data multiple datatables csv file. i know how write 1 datatable csv. any please. have function public void createcsvfile(datatable dt, string strfilepath) { try { streamwriter sw = new streamwriter(strfilepath, false); int columncount = dt.columns.count; (int = 0; < columncount ; i++) { sw.write(dt.columns[i]); if (i < columncount - 1) { sw.write(","); } } sw.write(sw.newline); foreach (datarow dr in dt.rows) { (int = 0; < columncount ; i++) { if (!convert.isdbnull(dr[i])) { sw.write(dr[i].tostring()); } if (i < columncount - 1) { sw.write(","); } } sw.write(sw.newline); } sw.close(); } catch (exception ex) { throw ex; } } you can app

.net - Newrelic - Console Application and throughput -

i'm trying configure long running application (console application) newrelic. purpose of application read xml feed (lots , lots of data) , update database accordingly. i want monitor performance (which works great now) emails if there issues (errors). i have customized log4net adapter use newrelic api notifyerror this works fine , can see errors logged in newrelic, error % shows 0 means never error alerts (even though there many , threshold @ 0.1%). assume due fact throughput quite hight (23k rpm). is there way of adjusting how newrelic sees throughput make errors bit more meaningful? there 1 way influence throughput measurement. if operations influencing throughput considered transactions new relic, use api call ignoretransaction() ignore significant transactions, including might throw error you're flagging noticeerror().

add exchange distribution groups to lync 2013 -

is possible can settings in lync server , these type of dl ( distribution list ) or address bydefault add in lync group while user logged in lync account , search option work contacts. either through registry hacks,gpo or else know. any assistance or advice appreciated.. it sounds want control distribution group display in lync clients? believe possible this, if build custom lync client , use contactmanager.beginaddgroup. don't believe possible clients using lync server apis. perhaps there way on server-side using 1 of exchange apis.

java - Use values (integers) returned in JSONArray -

im having issues being able indivisual responses json array. im trying write code allow me use vaules indivisually, how combine them if needed too. these responses integers. java jsonobject jsonobj = new jsonobject(jsonstr); data_array = jsonobj.getjsonarray("data"); (int = 0; < data_array.length(); i++) { jsonobject prod = data_array.getjsonobject(i); log.d("logging response", prod); } json [5652,8388,8388,7537,8843,2039,8235,0,12220] i'd figure out how can add them , return calculated result, how use them individually. such (prod + prod + prod) etc... use jsonarray data = jsonobj.getjsonarray("data"); (int = 0; < data.length(); i++) { integer prod = (integer) data.get(i); system.out.println("prod " + prod); // loop , add array or arraylist }

.htaccess - PHP sessions in HTACCESS - timeout -

i'm debugging infinite loop problem in php in "logout" routine. if($_session) { session_unset(); session_destroy(); } sleep(1); header('7location: http://accounts.domain.com/'); exit; in main / initial.inc.php script have :- $sess=0; $sess=$_session['loggedin']; foreach($_session $asw => $asd) { $logrep.="sessw '$asw' '$asd'\n"; } if($sess>0) { if($sess<$ty) { $logrep.="is timed out - logging out\n"; header('location: http://accounts.domain.com/logout/'); exit; theres bit more code i've taken out - in 'logout' script ive got destroy / unset etc - but when redirects inward script, sessions still exist ? - & determines i'm timed out, & redirects logout routine. query: there fool-proof way remove / eliminate sessions ? query :- $previous_name = session_name("name"); session_save_path("$directory"); s

iphone - How to do socket pooling in iOS? -

how this: writing in wall should visible in other's wall @ same point of time in chat. seems have work socket programming. how give every character updates other user? the socketrocket popular , useful objective c library socket programming. has inbuilt example chat also. check out: https://github.com/square/socketrocket must have web server though testing.

sql - Appending to an extracted file -

i have procedure extracting data edw file user in business objects use. i use cursor select data need , run in loop follows: for x in c_body loop utl_file.put_line(out_file, x.data_line); end loop; utl_file.fclose(out_file); dbms_output.put_line('copy file ' ||lv_path||'/'||lv_filename|| ' ' ||lv_pub_path||'/'||lv_filename); osutil.runoscmd('cp -f '||lv_path||'/'||lv_filename||' '||lv_pub_path, lv_os_out, ln_os_num); if ln_os_num != 0 dbms_output.put_line('copy file '||lv_filename||' failed. error = ' || lv_os_out || ' ' || ln_os_num); raise exit_now; end if; is there way can run procedure multiple times , append extracted file? running massive extract of 2 years history data , rather append multiple times smaller sets rather use full 24 months (it's going take forever). thanks in advance you can append file using utl_file append o

Why is my ExtJS singleton not working? -

i have extjs singleton class. as test calling method of in app.js launch() function. but singleton static method not defined. i thought when require class singleton becomes active? ext.loader.setconfig({ enabled : true, paths: { 'am': 'app' } }); ext.application({ name: 'am', autocreateviewport: true, requires: [ 'am.localization.resourcemanager' ], controllers: [ 'users' ], launch: function() { alert(resourcemanager.initbundleloader()); } }); ext.define('am.localization.resourcemanager', { alternateclassname: 'resourcemanager', singleton: true, init: function() { this.initbundleloader(); }, statics: { test: 'here', initbundleloader: function() { debugger; ext.applyif(ext.loader, { resourcebundles: new object() }); },

meteor - Re-rendering a hidden element -

i creating meteor app has list of posts visible on left half of page , hidden display container on right. user clicks on post title, , display container becomes on right side of page , shows full post. now, container displays full post hidden , has elements filled handlebar expressions. if click on post, same display container stays open, has contents changed. clicking on post template.postslist.events({ 'click .post': function (e, template) { e.preventdefault(); session.set('selectedpost', this._id); } }); example handlebar expression template.postdisplay.title = function () { return posts.findone(session.get('selectedpost')).title } everything working fine , well, except reactive nature of display container. if in database changes (whether added comment, change in title, etc) display becomes hidden again , have re-click post. postslist template has values updated , seamlessly without blink or anything. is there way have d

camera - Flashligth LED cannot be turned on in Galaxy S2 (JB) -

i'm working on app turn on flash light led of handsets. code general: cam = camera.open(); cam.setpreviewtexture(new surfacetexture(0)); campara = cam.getparameters(); campara.setflashmode(parameters.flash_mode_torch); cam.setparameters(campara); cam.startpreview(); this code works in many handsets, flashlight led not turn on in galaxy s2 (4.1.2). did body meet similar problem or has experience in why galaxy s2 has such problem in api?? thanks. have @ source simple android flashlight app published: simple android flashlight app

javascript - Fetch multiple data from a php file using AJAX and insert them in different input fields -

i using ajax in order access data php file. have problem format of retrieved data database, please help. so, ajax function splice. retrieves data find_account.php function processreqchange() { // if req shows "loaded" if (req.readystate == 4) { // if "ok" if (req.status == 200) { form_prof.prof_id.value = req.responsetext; form_prof.prof_name.value = req.responsetext; form_prof.prof_username.value = req.responsetext; form_prof.prof_password.value = req.responsetext; } else { alert("problem in retrieving xml data:\n" + req.statustext); } } } find_account.php <?php include("connect.php"); session_start(); $account = $_get['account']; $query = "select * profs profs_name = '".$account."'"; $result = mysql_query($query); $num = mysql_num_rows($result); if(empty($num)) { echo 'data not found';

multithreading - C++ method pointer to overriden method -

i finished bit of program hoping work way expected to, , turns out, did! here situation: i have handler class base class: class handler { public: handler(); virtual ~handler(); virtual void handle(socket socket); protected: virtual void dowork(socket socket); private: std::thread * handlerthread; static void processdata(socket socket); }; i have printhandler subclass of handler : class printhandler : public handler { public: printhandler(); ~printhandler(); protected: virtual void dowork(socket socket); }; here definitions of dowork in base class handler , subclass printhandler : void handler::dowork(socket socket) { std::cerr << "if see this, didn't override dowork function" << std::endl; } void printhandler::dowork(socket socket) { std::cerr << "this in base class" << std::endl; } when create pointer printhandler , cast pointer handler , call handle method on objec

regex - awk concatenate next lines when matching -

i using awk analyze text file , concatenate lines matching regex following line. using following command: awk '/^ [0-9]/{printf $0 ;next;}1' *filename* when test prompt works expected when put same command in bash script output same input file. any idea on why should not work in bash script? update here's complete script: #!/bin/bash # file in $( ls *.raw ) awk '/^ [0-9]/{printf $0 ;next;}1' file > temp done i tried using awk '/pattern/{printf "%s",$0;next}1' file suggested @kent add %s @ beginning of file. solved i modified command concatenate matching line 2 following lines using getline follows: (awk '/^ [0-9]/{l1=$0;getline;l2=(l1 $0);getline; print l2 $0}' < input_file) > output_file i modified command concatenate matching line 2 following lines using getline follows: (awk '/^ [0-9]/{l1=$0;getline;l2=(l1 $0);getline; print l2 $0}' < input_file) > output_file

java - Getting NullPointerException in code which was working earlier -

i have code check pnr number. because of internet issues, thought give users check pnr sms. added 2 radio buttons, 1 internet , 1 sms. problem when click pnr button, gives nullpointer exception. here main activity.java public class mainactivity extends activity implements onclicklistener { /** called when activity first created. */ private edittext pnrnumber; private textview errmsg; private button getpnr; private button pnrclear; button yes, no; radiobutton checkbyinternet, checkbysms; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); errmsg = (textview) findviewbyid(r.id.errmsg); pnrnumber = (edittext) findviewbyid(r.id.pnrnumber_p01); getpnr = (button) findviewbyid(r.id.checkpnrbutton); pnrclear = (button) findviewbyid(r.id.pnrclear); getpnr.setonclicklistener(this); pnrclear.setonclicklistener(this