Posts

Showing posts from September, 2012

sfml - How to add resources to non qt-project in qt-creator using qmake -

as title says i'm trying add resources project (sfml) i'm developing on gnu/linux. i'm using qt-creator develop non-qt application using qmake build project. means usual qt way handle resources in .qrc not option. i've tried symlink resource folder build folder works feels wrong. any suggestions of great help. after smashing head against while ended restructuring project , using make instead of qmake. worked charm. then added custom make script build steps in qt creator can build , run ctrl+r.

Automate file upload in node.js -

i have written node.js server accept file. app.post('/', function(req, res) { console.log(req.files); fs.readfile(req.files.displayimage.path, function (err, data) { var newpath = __dirname + "/"+req.files.displayimage.name; fs.writefile(newpath, data, function (err) { if (err) throw err; res.redirect("back"); }); }); }); this works perfect html form is <form action="http://localhost/", method="post", enctype="multipart/form-data"> <input type="file", name="displayimage"> <input type="submit", name="upload"> but want remove html ui , want have node.js code automatically consume file. ok have file hard-coded path. i need node.js script can call server code , send file upload. any help?

windows - How to have a config file automatically add 'global' modules for all pages -

i building internal automation/web tool using perl apache. hosted in windows environment. question when dealing many pages have common modules. instead of manually adding each module each page, possible have 'global module' pull in modules available pages? for example, if need add new modules , there 10 pages, instead of going each page , adding use new::package; possible in 1 config file make new::package available each file uses config module? i have done php, include/require in init script , include init script on each page. package myproj::configuration use package1; ... use package999; # main page use myproj::configuration; # modules included in page, without needing add them manually tldr: can have configuration module import multiple modules/packages pages include magic configuration module? edit: add new perl, if obvious thing, go easy :) this not obvious thing @ all. exporter module provides export_to_level function can problem. normally,

php - Magento change email address of form -

i bought magento based website days ago. there form in page website.com/service actual code in backend is: {{block type="core/template" name="serviceform" form_action="/contacts/index/service" template="contacts/form_service.phtml"}} and in front-end <form method="post" id="contactform" action="/contacts/index/service"> it not contact form contact form lots of additional parameters. want edit email address form submitted to. if form action /contacts/index/post/ have edited file at /app/code/core/mage/contacts/controllers/indexcontroller.php but unable find file can edit /contacts/index/service . think form working tells me your inquiry submitted , responded possible. thank contacting us. after redirecting me page after form submission. want edit email , need find location of file. @aynber located function me can't seem find email. public function serviceaction() {

java - Different looping behaviors in Groovy -

why these 2 loops have different results? thought both initialize of values in each array 5 second 1 works. explain why is? static main(args) { double[][] x = new double[3][3] double[][] y = new double[3][3] for(row in x) { for(num in row) { num=5 } } for(int i=0;i<y.size();i++) { for(int j=0;j<y[i].size();j++) { y[i][j]=5 } } println "x: ${x}" println "y: ${y}" } and here's output x: [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] y: [[5.0, 5.0, 5.0], [5.0, 5.0, 5.0], [5.0, 5.0, 5.0]] first pair of for loops nothing , correct. num new variable in scope of inner for . reference integer table. when assign it, becomes reference value 5. table cell not change. for c programmer. int 5 = 5; int *num; it is: num = &five; it not: *num = five;

storing multiple arrays within a struct in C -

i trying design data structure in c can store multiple arrays possibly in struct, each of arrays of different size. example: typedef struct task_list { int total_tasks; unsigned int *task_array }task_list; typedef struct node_list { int total_nodes; task_list *array_node }node_list; therefore if have 5 nodes, total_nodes 5 , wish have 5 subsequent arrays namely array_node[0] , array_node[1] ... array_node[4] . each of arrays hold unsigned integers(tasks). problem each of these arrays hold different number of tasks ( total_tasks in struct task_list ), therefore size of each of arrays different. how create , allocate memory each of these task array's? , best way access them later? if 1-d arrays, best way allocate memory through malloc. again, since 1-d can access them via array notation, being careful no exceed bounds given total_nodes , total_tasks. use free free arrays when deleting nodes. if array nodes gets bigger, use realloc make array bigge

css - Nav Pills Background Leak -

Image
i looking use navigation pills on website, resulting in background leak. see effect on website: http://oleb.net/blog/2011/12/tutorial-how-to-sort-and-group-uitableview-by-date/ . hover on pills multiple times see issue. can see outline of pills appear. here code tried: .navigation-main { border-top: 1px solid rgba(0,0,0,0.1); padding-top: 5px; clear: both; display: block; font: 700 13px/1.3076923076 lato, sans-serif; letter-spacing: .05em; text-transform: uppercase; width: 100%; } .navigation-main .menu { max-width: 1272px; margin: 0 auto; } .navigation-main ul { list-style: none; margin: 0; padding-left: 0; text-align: center; } .navigation-main li { display: inline-block; position: relative; width: 100px; } .navigation-main li:after { content: none; display: block; font-size: 11px;

ruby on rails - Why "bundle install" try to install outdated version of gems? -

i have different gemsets > rvm gemset list gemsets ruby-2.0.0-p247 (found in /users/kai/.rvm/gems/ruby-2.0.0-p247) => (default) global rails4 > rvm gemset use rails4 using ruby-2.0.0-p247 gemset rails4 > rails -v /users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': not find 'railties' (>= 0) among 43 total gem(s) (gem::loaderror) /users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec' /users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem' /usr/bin/rails:22:in `<main>' /users/kai/.rvm/gems/ruby-2.0.0-p247@rails4/bin/ruby_noexec_wrapper:14:in `eval' /users/kai/.rvm/gems/ruby-2.0.0-p247@rails4/bin/ruby_noexec_wrapper:14:in `<main>' and when i'm doing: > bundle install fetching gem metadata https://rubygems.org/......... fetching gem me

Azure blob download is incredibly slow using PowerShell (via Get-AzureStorageBlobContent), but fast via Azure Explorer, etc? -

with basic code loops through storage account , mirrors containers , blobs local disk, i'm finding get-asurestorageblobcontent cmdlet incredibly slow? seems take real time second or 2 per blob regardless of blob size...which adds considerable overhead when we've got thousands of tiny files. in contrast, on same machine , network connection (even running simultaneously), azure explorer same bulk copy 10x 20x faster, , azcopy literally 100x faster (async), it's not network issue. is there more efficient way use azure storage cmdlets, or dog slow nature? get-azurestoragecontainer mentions -concurrenttaskcount option implies ability async, there's no documentation on how achieve async , given operates on single item i'm not sure how could? this code i'm running: $localcontent = "c:\local_copy" $storageaccountname = "myblobaccount" $storageaccountkey = "mykey" import-module azure $blob_account = new-azuresto

When to use global variable in jQuery? -

i need set dateformat few datepickers. what best way define dateformat ? defining simple method function dateformat() { return 'yy-mm-dd'; } or global variable like dateformat = 'yy-mm-dd' ? ok, according your comment : @markushofmann, reply. can please me out when use global variables in jquery example if any? …i've been looking information use of global variables jquery . here i'll sum i've found. may find sources @ end of answer. here go: normally define global variables omitting var (like did in question) : dateformat = 'yy-mm-dd'; but!!! omitting var generates implicit global, bad thing , generate error in strict mode. however, if need generate global variables in production code (which should avoided) declare them explicitly: window.dateformat = 'yy-mm-dd';   can use above approach create global vars inside namespace in window / jquery object: window object: window.myna

.net - Variable number of rows in RDLC Report with Page Breaks -

first , foremost not duplicate of post: how page break after specific row(suppose 25 rows) in rdlc reporting post solved 1 part of question stuck on second part. i have report represents cheque. report looks (crudely) this: section 1 make payable [dataset field] amount: [dataset field] date: [dataset field] section 2 paid item 1 paid item 2 paid item 3 paid item 4 section 3 paid item 1 paid item 2 paid item 3 paid item 4 this report controlled through single dataset. section 2 , section 3 problem lies. these sections represent each row of data inside of dataset so, if print cheque right had 4 records of data, sections 2 , 3 display same data. data contained inside of list control. here problem: need each list control display 10 records print beyond 10 records onto separate page. when used technique described in article above, works, when inserts page break breaks section 3 onto page. it seems achieve through sort of manipulation of

sql server 2008 - Entity Framework with LINQ using CONTAINS in WHERE clause very slow with large integer list -

i have function first queries function in database returns list of employees user allowed see. run in couple ms. using list query employee table employees user allowed see. when run generated sql in query analyzer takes few milliseconds. when runs entity framework taking on 8 seconds. initially had list of allowedemployees read http://mikeinba.blogspot.ca/2009/09/speeding-up-linq-contains-queries-with.html , tried using hashset instead performace still bad. how can performance similar in sql query analyzer? doing wrong? i using sql 2008 , ef5.0 public iqueryable<employee> findallbywithpermissions(int eid, expression<func<employee, bool>> predicate) { if (predicate != null) { hashset<int> allowedemployees = securityrepository.getpermissableemployees(eid); return datacontext.set<employee>().where(predicate).where(p => allowedemployees.contains(p.employeeid)).asqueryable<employee>(); ; }

Code First: UserData and User tables -

i have problems code first , code migrations. i have user class , userdata class (with optional information first/last name), when try run 'add-migration' or 'update-database' command, several errors. i have created user class: public class user { public int id { get; set; } public string username { get; set; } public string emailaddress { get; set; } public datetime dateofbirth { get; set; } public userdata userdata { get; set; } public int userdataid { get; set; } } and userdata class: public class userdata { public int id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string city { get; set; } public string country { get; set; } } with setup error: multiple identity columns specified table 'users'. 1 identity column per table allowed. when trying run 'update-database' (the 'add-migration' command runs fine). i tried add pub

python - How to re-establish asyncore connection with server (solved) -

i have asyncore client interacts server written in c. need able detect when server closes connection , keep re-trying connect until available again. here code have: asyncore client turn starts threaded module (receiverboard) run in separate thread. class detclient(asyncore.dispatcher): buffer = "" t = none def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.create_socket(socket.af_inet, socket.sock_stream) self.connect((host,port)) self.host=host self.port=port self.t = receiverboard(self) self.t.start() def sendcommand(self, command): self.buffer = command def handle_error(self): self.t.stop() self.close() def handle_write(self): sent=self.send(self.buffer.encode()) self.buffer="" def handle_read(self): ##there code here parse received message , call appropriate ##method in threaded module receiverboard my first problem wanted client (above) keep retrying connect server (d

asp.net - How do I convert a string to currency? -

i'm developing asp.net application utilizes sql database. have form captures data user. if have text box grabs number, how convert number money before goes database? we store currency value in sql server money . you want use tryparse application won't crash if user enters invalid value. decimal value; if (decimal.tryparse(mytextbox.text, out value)) { // value. } else { // user enters invalid value. display error message. }

numpy - Take laplacian of unevenly sampled data in python -

i have bunch of unevenly sampled (1-d) data in form of x , y values take laplacian of. there easy way in numpy/scipy? i thinking of taking gradient of gradient, wouldn't introduce artifacts, in evenly sampled data? eg, given data 0,0,0,4,8,8,8 , 1d laplace operator 1,-2,1 , laplacian 0,0,4,0,-4,0,0 , using gradient of gradient yield 0,1,2,0,-2,-1,0 one way of arriving @ [1, -2, 1] operator evenly spaced grids either compute first derivatives forward difference scheme, , second backwards difference scheme, or viceversa, since both yield same result. option uneven grid both ways , average results. lets looking @ grid point hb ahead of previous grid point, , hf behind next one: --+----+----+--- x-hb x x+hb if didn't mess algebra, laplacian @ x computed average described above be: (f(x+hf)*(1+hb/hf) + f(x)(2+hb/hf+hf/hb) + f(x-hb)(1+hf/hb)) / (2*hf*hb) you can compute on 1d array doing: def laplacian(x, y): x = np.asarray(x) y = np.asar

regex - What does this PHP regular expression do? -

public function getblock( $tag ) { preg_match ('#<!-- start '. $tag . ' -->(.+?) <!-- end '. $tag . ' -->#si', $this->content, $tor); $tor = str_replace ('<!-- start '. $tag . ' -->', "", $tor[0]); $tor = str_replace ('<!-- end ' . $tag . ' -->', "", $tor); return $tor; } does know function does? public function getblock( $tag ) { //below finds start tag, matches character multiple times // until finds <!-- end $tag -->, store result in $tor preg_match ('#<!-- start '. $tag . ' -->(.+?) <!-- end '. $tag . ' -->#si', $this->content, $tor); //the # delimiter, s meaning treat single line // . matches \r\n example. , means insensitive $tor = str_replace ('<!-- start '. $tag . ' -->', "", $tor[0]); $tor = str_replace

d2 - Late static binding in d -

i'm working on generic collection class template, let's list(t) i'd able php's late static binding. might best illustrated simplified sample code. code compiles fine on dmd, needs small change way want. module main; import std.stdio; import std.string; class list(t) { private t[] _list; public void append(t t) { _list ~= t; } // needed... public list select(bool delegate(t t) dg) { // auto should whatever subclass of list(t) calling method. auto result = new list!t(); foreach(t; _list) { if (dg(t)) result.append(t); } return result; } int opapply(int delegate(ref t) dg) { int result = 0; (int = 0; < _list.length; i++) { result = dg(_list[i]); if (result) break; } return result; } } enum gender { male, female, secret } class person { private str

Flexslider - possible to control via hover instead of click? -

i using flexslider manual controls, , it's working properly. instead of clicking controls, need them change slide when hover on controls. possible? looked @ js file , can't find click function change. here flexslider js: https://raw.github.com/woothemes/flexslider/master/jquery.flexslider.js and code: $(window).load(function(){ $('.flexslider').flexslider({ animation: "slide", directionnav: true, controlscontainer: "header#site", manualcontrols: ".nav1 li" }); }); and html (simplified) this: <header id="site"> <ul class="nav1"> <li>link 1</li> <li>link 2</li> <li>link 3</li> </ul> <div class="flexslider"> <ul class="slides"> <li>image 1</li> <li>image 2</li> <li>image 3</li> </ul> </div> </header> would answer issue well. found way

c# - What is the recommended way to make multiple instances of Worker role do the same job? -

my worker role expose wcf service , have multiple instances. i want client call service , make all instances working concurrently . i'm trying figure out best way scatter-gather task. (and i'm trying avoid service bus , use wcf only) i can't think of way without service bus topics. or using custom functionality same thing. why trying avoid service bus?

android - Andengine Troubles, Nothing showing on screen? SimpleBaseGameActivity -

i have code: public class gameactivity extends simplebasegameactivity{ static final int camera_width = 800; static final int camera_height = 480; public font mfont; public camera mcamera; public scene mcurrentscene; public static baseactivity instance; @override public engineoptions oncreateengineoptions() { // todo auto-generated method stub instance = this; mcamera = new camera(0,0, camera_width, camera_height); return new engineoptions(true, screenorientation.landscape_fixed, new ratioresolutionpolicy(camera_width, camera_height), mcamera); } @override protected void oncreateresources() { // todo auto-generated method stub mfont = fontfactory.create(this.getfontmanager(), this.gettexturemanager(), 256, 256, typeface.create(typeface.default, typeface.bold), 32); mfont.load(); } @override protected scene oncreatescene() { // todo auto-generated method stub mengine.registerupdatehandler(new fpslogger()); mcurrentscene = new scene();

global name 'class' is not defined - Python -

i defined class called parser in file called parser.py , parses test result.... import sys import re class parser: def __init__(self): pass def udp_parse(self, filename=""): # ... code on here now, in main.py . have: from dbconn import * parser import * import os import subprocess def main() dbconn = dbconn() parse = parser() # more code here ... if __name__ == '__main__': main() and i'm getting: traceback (most recent call last): file "iperf.py", line 108, in <module> main() file "iperf.py", line 49, in main parse = parser() nameerror: global name 'parser' not defined parser.py in same directory dbconn.py , main.py . dbconn() works without problem, i'm not understanding why parser() can't work ... parser existing python module . use different file name (not parser.py) or insert path in sys.path before stdlibs. import sys sys.path.inse

vb.net - Can't dynamically fill third column TableLayoutPanel -

using vb 2012 dynamically creating new table inside table , trying fill 3 columns labels, 1st , 2nd fill correctly can't filling of third working. dim ctr new tablelayoutpanel ctr.backgroundimage = serials_downloader.my.resources.resources.serialbg ctr.visible = true ctr.backcolor = color.transparent ctr.columncount = 3 ctr.width = 212 ctr.height = 64 tablelayoutpanel1.controls.add(ctr, 0, tablelayoutpanel1.rowcount - 1) dim lblnew2 new label() lblnew2.text = "a" lblnew2.forecolor = system.drawing.color.white lblnew2.visible = true lblnew2.textalign = contentalignment.middlecenter lblnew2.font = new font("decker", 8) lblnew2.dock = dockstyle.fill ctr.controls.add(lblnew2, 0, 0) dim lblnew new label() lblnew.text = "b" lblnew.forecolor = system.drawing.color.white lblnew.visible = true lblnew.textalign = contentalignment.middlecenter lblnew.font = new font("decker", 8) lblnew.dock = dockstyle.fill ctr.controls.add(lblnew, 1, 0) di

How to save and restore exact floating point values to a human readable file in C++ -

i need able save , restore exact floating point values human readable (text) file c++ program. can use %a format sprinf save exact value, i'm not able find way restore it. using %a format sscanf not working me. my sample program below. prints 0x1.921fb4d12d84ap+1 value of num1, when type value in, sets num2 0. i'm running in cygwin environment (dll version 1.7.22) using gcc 4.7.3, g++ compile options include: -std=gnu++11 -wall -wextra #include <cstdio> #include <string> #include <iostream> int main () { double num1 = 3.1415926; double num2; std::string input; int result; printf("%la\n", num1); std::cout << std::endl; std::cout << "input:" << std::endl; std::cin >> input; std::cout << "got: " << input << std::endl; num2 = 0.0; result = sscanf(input.c_str(), "%la", &num2); std::cout << "num2 " <

objective c - Importing view controllers for delegation not working -

i have view controller, firstviewcontroller, subclass, fourthviewcontroller. firstviewcontroller's interface is: #import "fourthviewcontroller.h" @interface firstviewcontroller : uiviewcontroller <fourthviewcontrollerdelegate> in fourthviewcontroller's .h, have: #import "firstviewcontroller.h" @protocol fourthviewcontrollerdelegate -(void) updatelabel; @end @interface fourthviewcontroller : firstviewcontroller @property (weak, nonatomic) id<fourthviewcontrollerdelegate>delegate; this giving me error message: cannot find interface declaration of 'firstviewcontroller', superclass of 'fourthviewcontroller' i'm not sure why error occuring. advice help. is keeping delegate in same .h file controller critical you? pulled separate .h file , whole thing worked me. this: //firstviewcontroller.h #import <foundation/foundation.h> #import "fourthviewcontrollerdelegate.h" @interface firstviewco

Django jQuery ajax post to https fails -

i'm writing chrome extension use , post ajax calls api made django , tastypie. get ajax calls successful , can access data. post calls failing in production because api hosted https://, in local environment works (htt://localhost:8000). i providing correct csrf token in header. seems error happening here: https://github.com/toastdriven/django-tastypie/blob/master/tastypie/authentication.py#l259 api require referer header check call secure. it not seem possible set in ajax headers referer value directly, if name of header starts x- . thanks in advance solutions or tips solve issue. maxime. the reason check explained in original source of method : # suppose user visits http://example.com/ # active network attacker (man-in-the-middle, mitm) sends # post form targets https://example.com/detonate-bomb/ , # submits via javascript. # # attacker need provide csrf cookie , token, # that's no problem mitm , session-independent # nonce we're using. mitm ca

java - Not able to access environment variables using runtime exec -

i trying run few .bat commands using runtime exec(java). issue after setting environment variables, not able use these variables. runtime rt = runtime.getruntime(); process pr; pr = rt.exec("cmd.exe /c echo %java_home%"); inputstream is; inputstreamreader isr; bufferedreader reader ; string line; = pr.getinputstream(); isr = new inputstreamreader(is); reader = new bufferedreader(isr); while ((line = reader.readline()) != null) { system.out.println(line); } reader.close(); pr.getoutputstream().close();` java_home doesnt return actual env path. the code worked me, try { runtime rt = runtime.getruntime(); process pr; pr = rt.exec("cmd.exe /c echo %java_home%"); inputstream is; inputstreamreader isr; bufferedreader reader; string line; = pr.getinputstream(); isr = new inputstreamreader(is); reader = new bufferedreader(isr);

ios - Instantiate a DrawRect View From ViewController -

i apologize if may simple question. new using draw rect , want call viewdidload in view controller when draw rect in view subclass. have far doesn't anything. need add? thank circleview = [[circleview alloc] init]; [self.view addsubview:circleview]; [circleview setneedsdisplay]; here code in circle view - (void)drawrect:(cgrect)rect { nslog(@"worked"); cgcontextref contextref = uigraphicsgetcurrentcontext(); cgcontextsetrgbfillcolor(contextref, 0, 0, 255, 0.1); cgcontextsetrgbstrokecolor(contextref, 0, 0, 255, 0.5); cgcontextstrokeellipseinrect(contextref, cgrectmake(100, 100, 25, 25)); } thats have. know might need init frame dont know how choose draw rect. there no need call [circleview setneedsdisplay]; explicitly in -viewdidload , uiview automatically invoke -drawrect: when displaying first time. circleview doesn't show because frame {0, 0; 0, 0}. need give meaningful frame , this: circleview = [[circleview a

why a java proccess's resident memory and virtual memory usage is very different between jre 1.6.43 and jre 1.7.25 -

when java proccess run in jre 1.6.43,i use top command monitor memory usage,show fellow: top - 09:14:05 13 days, 23:04, 2 users, load average: 1.78, 1.35, 1.25 tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie cpu(s): 1.5%us, 1.3%sy, 0.0%ni, 95.7%id, 1.5%wa, 0.0%hi, 0.0%si, 0.0%st mem: 23651m total, 23466m used, 184m free, 402m buffers swap: 40962m total, 0m used, 40962m free, 17427m cached pid user pr ni virt res shr s %cpu %mem time+ command 23764 sysomc 20 0 695m 467m 12m s 16 2.0 58:53.41 java then, run java proccess in jre 1.7.25,the top command show memory usage like: top - 10:40:26 15 days, 31 min, 1 user, load average: 0.77, 0.89, 0.87 tasks: 1 total, 0 running, 1 sleeping, 0 st

How to apply CSS setting to specific HTML element -

html: <div class="tagline">web portal name</div><br /> <div id="logged_in_user_dtls" style="color:#fff; margin-top:15px; font:bold; width:100%; position:relative; margin-left:800px;float:left;"> <span> welcome <?php echo $_session['username'] ?> </span> | <a href="login.php"><span> sign out</a> </span> </div> in web templete, i'm displaying logged in user name followed welcome message. problem: when user name long(approx 30 char) next link (sign out link), moved right hand side. how can avoid moving sign out link right. know may have simple answer unable figure out. note: tried change marigin-left setting, spoiling alignment. update: can keep sign out link's position fixed, irrespective of user name lenght? set max-width long names , put ellipsis show this: <span cl

css - IE8 Transparent PNG issue -

i trying display transparent png background image (actually bootstrap image) on page. now want display less opacity. not displaying correctly (displays edges around image) i know can fixed adding background-color attribute. but there other way fix it. have tried various microsoft filter attributes... like -ms-filter:"progid:dximagetransform.microsoft.alpha(opacity=10)"; opacity: 0.1; but not help. use code instead. remember should in same order! live demo (works ie6) .box:hover { -ms-filter:"progid:dximagetransform.microsoft.alpha(opacity=10)"; filter: alpha(opacity=10); -moz-opacity: 0.1; -webkit-opacity: 0.1; opacity: 0.1; }

c++builder - Assertion failed: xdrPtr && xdrPtr == *xdrLPP, file xx.cpp, line 2349 -

Image
have system build using c++ builder 2010 after running 20 hours starts firing of assertion failures. assertion failed: xdrptr && xdrptr == *xdrlpp, file xx.cpp, line 2349 tried google on crazy not info. people seem refer bunch of different assertions in xx.cpp shortcomings in exception handling in c++ builder. haven't found referencing particular line in file. we have integrated madexcept , seems somewhere along way catches out of memory exception, not sure if it's connected. no matter assertion triggering doesn't seem correct. edit: found instance of if-statement part of it's statement used function throw exception. wonder if culprit somehow messing flow of exception handling or something? consider if(foo() == 0) { ... } wrapped in try catch block. if exception thrown within foo() no int returned here how if statement react? i'm thinking still might try finish executing line , performing if check on return of function barf since no

perl - How to sort a file list according their part of the file name? -

i have array( @pssm_list ) contains files this 1.nr.pssm 2.nr.pssm 3.nr.pssm 4.nr.pssm 5.nr.pssm 6.nr.pssm 7.nr.pssm the name of file list 1.nr.pssm 226.nr.pssm i try use sort(@pssm_list) , order not 1 226 so try write code this opendir(pssm_handle,$argv[0]); @pssm_list = grep(/\.pssm/,readdir(pssm_handle)); $tag = 0; until($tag > 226) { foreach $file (@pssm_list) { @temp = split("[.]",$file); if($temp[0] == $tag) { push(@sorted,join("",$file)); } } $tag++; } i want know there exists solution can sort list in 1 line? i hit upon problem well, , used package called sort::naturally me sort numbers correctly. under natural sorting, numeric substrings compared numerically, , other word-characters compared lexically.

Install python-numpy in the Virtualenv environment -

i install python-numpy in virtualenv environment. system ubuntu 12.04, , python 2.7.5. first installed virtualenv $ sudo apt-get install python-virtualenv and set environment by $ mkdir myproject $ cd myproject $ virtualenv venv new python executable in venv/bin/python installing distribute............done. activated by $ . venv/bin/activate installed python-numpy in environment by $ sudo apt-get install python-numpy however, tried import numpy in python in environment after steps above. python told me "no modules named numpy". whereas, numpy imported in python globally. tried remove , install many times not work. beginner of both python , linux. apt-get still install modules globally, when you're in new virtualenv . you should either use pip install numpy within virtual environment (easiest way), or else compile , install numpy source using setup.py file in root of source directory (slightly harder way, see here ). i'd thoroughly

Access github API with rails oauth plugin -

i'm implementing application supposed able talk different apis on behalf of users. amongst others, includes github. i'm using oauth-plugin ( https://github.com/pelle/oauth-plugin ) perform authentication each api. unfortunately, doesn't work github. here's current githubtoken implementation: class githubtoken < consumertoken github_settings={ :site=>"https://github.com", :request_token_path => "/login/oauth/request_token", :authorize_path => "/login/oauth/authorize", :access_token_path => "/login/oauth/access_token", } def self.consumer @consumer||=create_consumer end def self.create_consumer(options={}) oauth::consumer.new credentials[:key],credentials[:secret],github_settings.merge(options) end def self.get_request_token(callback_url, scope=nil) https://github.com/login/oauth/authorize consumer.get_request_token({:oauth_callback=>callback_url}, :scope=&

Powershell for GitHub setup -

i installed github windows , convenience added entries powershell in context menu in windows explorer. registry commands are: c:\windows\system32\windowspowershell\v1.0\powershell.exe -noexit c:\\windows\\system32\\windowspowershell\\v1.0\\powershell.exe -noexit -command set-location -literalpath '%l' as suggested in shell.ps1 added ". (resolve-path "$env:localappdata\github\shell.ps1")" profile.ps1 poshgit , rest setup within powershell environment. not working though. can see shell.ps1 executed (when running "$env:github_posh_git" see right value appearing) when navigate git repo not see enhanced prompt. what missing? ps : version of powershell have came github windows , though folder says "1.0" running $psversiontable.psversion returned major minor build revision ----- ----- ----- -------- 2 0 -1 -1 i got answer github support: the enhanced prompt provided posh-git [1], , isn't add

iphone - After authenticating token(ACCESS GRANTED), doesn't redirect to Callback URL -

i'm implementing oauth 1.0 in ios app using simple-oauth1 project. use withings api modified little bit simple-oauth1(like consumer oauth key, secret key, callback url...). , inserted nslog(request.url.absolutestring); following code(it's in oauth1controller.m) - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *) request navigationtype:(uiwebviewnavigationtype)navigationtype { if (_delegatehandler) { nsstring *urlwithoutquerystring = [request.url.absolutestring componentsseparatedbystring:@"?"][0]; nslog(request.url.absolutestring); if ([urlwithoutquerystring rangeofstring:oauth_callback].location != nsnotfound) { with code, i tap oauth login button webview shows login page. i enter id/password. webview shows account allow page. tap "allow" button. (nslog shows http://oauth.withings.com/account/authorize?acceptdelegation=true&oauth_consumer_key=blahblah&oauth_nonce=blahblah&

c# - Rewriting method declaration -

i'm iterating on methods in type , have rewrite aren't static. i'd have insert parameter either first or last parameter can't figure out how create parametersyntax object this have far var methods = m in r.members.oftype<methoddeclarationsyntax>() !m.modifiers.contains(syntax.token(syntaxkind.statickeyword)) select new { orgmethoddecl = m, rewrittendecl = rewritemethoddeclaration(m,name)}; var rewrittentype = r; foreach(var m in methods){ rewrittentype = rewrittentype.replacenode(m.orgmethoddecl, m.rewrittendecl); } and rewritemethoddeclaration have issue methoddeclarationsyntax rewritemethoddeclaration(methoddeclarationsyntax method, string name) { var p = syntax.parameter(); //type dynamic, name: name var parameters = method.parameterlist.addparameters(p); return method.

javascript - Skrollr & relative mode fails to work -

i'm trying use skrollr library ( https://github.com/prinzhorn/skrollr ) create think simple bit of functionality mean when bottom-top attribute triggered (when top 25px above bottom viewport) opacity 0, , user scrolls down further opacity increase 1 when bottom of element 25px above bottom viewport. however, when load html file states in console elements either skrollable-after or skrollable-between, when not case later 2 elements (at least when viewport obscuring later 2 elements). final element stated being skrollable-between when in reality far beneath bottom of viewport. i did think may issue loading of various assets, s.refresh() doesn't change (at least in manner using it). html follows, skrollr.js being latest source file on github (0.6.11). any guidance appreciated. <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> <script type="text/javascript" src="skrollr

c - Sorting linked list -

i have slight problem sorting in linked lists. have doubly linked list needs sorting after intital input, swap function intend use, problem herein lies screws header pointers there may be. cannot sort list jusr replacing data there many variables , can change in course of development (new variables can added or deleted) task *taskheader; struct task{ task *pprev; //large number of variables int number; task *pnext; task(){ pprev = null; pnext = null; } } //swap function void swap(task *task2, task *task3) task* task1 = task2->prev; // alias readability task* task4 = task3->next; // alias readability if(task1!=null) task1->next = task3; task3->prev = task1; task3->next = task2; task2->prev = task3; task2->next = task4; if(task4!=null) task4->prev = task2; } void sort(task *taskheader){ task *temp = taskheader; while(temp != null){ if(temp->number < temp->pnext->number) swap(temp,

Optimize SQL Server Query using "OR" or "UNION" -

we have sql server table called deals general table including financial trade entries, number of can hundreds of thousands or millions. each row in deals has 1 column called product , of type varchar , corresponds different trade type: bond trade, equity trade, future or option trade, simple , more complex. want search whole table deals not matured. depending on type of trade, term "matured" has different meanings. example, product type "bond" , others, check value of column maturitydate in deals table, larger given date, i.e., maturitydate > @date. , deal type "future", have column valuedate in same table larger given date , maturitydate larger given date. first draft of query this: select * deals ( (product in ('proda', 'prodb') , maturitydate > @cd) or (product in ('prodc', 'prodd') , (maturitydate > @cd , valuedate > @cd)) or (product in ('prode', 'prodf', some_other_product_typ

django admin tinymce for part of textareas -

i'm using django admin + grappelli + tinymce grappelli. it works perfect, can't figure out how make admin form textareas , apply tinymce part of them. for example, i've 2 fields: description , meta-description. need tinymce description , need textarea without tinymce meta-descrption. tinymce in admin enabled via form this: class adminform(forms.modelform): def __init__(self, *args, **kwargs): """sets list of tags string""" instance = kwargs.get('instance', none) if instance: init = kwargs.get('initial', {}) kwargs['initial'] = init super(adminform, self).__init__(*args, **kwargs) class media: js = ( settings.static_url + 'grappelli/tinymce/jscripts/tiny_mce/tiny_mce.js', settings.static_url + 'grappelli/tinymce_setup/tinymce_setup.js', ) and en

oracle11g - export oracle database dump file using bat file -

could please let me know there way make dump file using bat file [ not working me ] try send username , password , sid [ tns alias] not work connection in tnsnames.ora testdb = (description = (address = (protocol = tcp)(host = ara-server)(port = 1521)) (connect_data = (server = dedicated) (service_name = xe) ) ) and bat file cls @echo off rem export full database auto filename dump , log rem batch file create dump , log files in same directory of batch rem file name syntax --> <schemaname>_<dd>_<mm>_<yyyy> rem auther: deepu mohan p, www.deepumohan.com rem created: 07-sep-2009 rem modified: 30-sep-2009, 01-oct-2009 rem user credentials set /p schema=enter username: set /p pwd=enter password: set /p sid=sid: rem following block getting year, month , day rem ====================================================== /f "tokens=2-4 skip=1 delims=(-)" %%g in ('echo.^|date') ( /f "tokens=2 delims

C# Jagged Array check if value exists/true -

this code , using 2 dimension array . top = 0; if(rowcol[i-1][j]){ top = rowcol[i-1][j] } but shows error : cannot implicitly convert type 'string' 'bool' full code : string[] filedata = file.readalllines(@"c:\users\apr13mpsip\desktop\oneorganizer\oneorganizer\wordpuzzle\testing.txt"); string[] linevalues; int row = 0; int col; string[][] rowcol = new string[filedata.length][]; foreach (string line in filedata) { linevalues = line.split(new string[] { "," }, stringsplitoptions.none); rowcol[row] = new string[linevalues.length]; col = 0; foreach (string value in linevalues) { rowcol[row][col] = value; col++; } row++; } (int = 0; < rowcol.getlength(0) ; i++) { (int j = 0; j < rowcol[i].getlength(0) ; j++) {

Ruby on Rails: difference between text_area and text_area_tag helpers? -

in ruby on rails: difference between text_area , text_area_tag helpers? more importantly, know which 1 more suited long html text input (specifically in case, blog posts ) ?? difference if use form_for , pass activerecord object , pass, let's say, f block, more convenient use example <%= f.text_area :body %> because sets proper id, name , value automatically. there's no difference between these helpers in handling long html text inputs, if want use activerecord object form, should use text_area because, said, it's more convenient.

jquery remove parent tr not working in first time -

on click of delete button, want remove parent tr. problem when click on delete, blinks , doesn't remove tr on first click , when click delete second time, iut gets removed. please help $(".adel").on('click', function () { $(this).parents('tr').hide(); }); <tr id="rowtr"> <td></td> <td id="rowtd"> <a id="" class="adel" href=''> <img src='del.png'> </a> </td> </tr> try this: $(".adel").on('click', function (e) { e.preventdefault(); $(this).closest('tr').remove(); }); working fiddle here : http://jsfiddle.net/2zhbc/1/

sql server - How to get the caller's user id in an impersonated procedure? -

if write procedure "execute xxx", possible retrieve original user, called procedure, somehow within procedure ? does original_login() return information you're after? http://technet.microsoft.com/en-us/library/ms189492.aspx

xcode - Macports selfupdate fails -

i tried run sudo port selfupdate, didn't work. reinstalled port, xcode , on. still doesn't work. port upgrade outdated works properly. think has tcl, dont how solve problem. i use osx 10.8.4, xcode 4.6.3. here output of sudo port -d -v selfupdate ---> updating macports base sources using rsync receiving file list ... done sent 36 bytes received 69 bytes 70.00 bytes/sec total size 4925440 speedup 46908.95 receiving file list ... done sent 36 bytes received 76 bytes 44.80 bytes/sec total size 512 speedup 4.57 macports base version 2.1.3 installed, macports base version 2.2.0 downloaded. ---> updating ports tree synchronizing local ports tree rsync://rsync.macports.org/release/tarballs/ports.tar receiving file list ... done sent 36 bytes received 70 bytes 42.40 bytes/sec total size 53770240 speedup 507266.42 receiving file list ... done sent 36 bytes received 77 bytes 45.20 bytes/sec total size 512 speedup 4.53 receiving file list ... done sent 3