Posts

Showing posts from January, 2012

java - Using UncaughtExceptionHandler in Struts Application -

i have web application based on struts 2 mvc. had configure proper logging in application did , working fine. what want is, need runtime exceptions , error due system failure (such lost database connection, third party service down etc etc), logged in application log file. i read thread.uncaughtexceptionhandler , gone through this answer still unable start requirement. can suggest me how initiate this? classes make? configure? etc etc. tell, there no multithreading involved in application. thank you! below log4j.properties log4j.appender.file=org.apache.log4j.rollingfileappender log4j.appender.file.file=${catalina.home}/logs/backlogapp.log log4j.appender.file.maxfilesize=1000kb log4j.appender.file.maxbackupindex=1 log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-4p %m%n log4j.appender.datepattern='.'yyyy-mm-dd # root logger option log4j.rootlogger=warn, file log4j.logger.com.nagar...

android - Coludn't get the data to server when i turned off the GPS once. It's not sending even after GPS turned on -

i need create application track location using background , , send data server. program send data when reboot device because have launch service on boot complete( android.intent.action.boot_completed). i don't data server when turned off , turned on gps. when reboot device it's working.it should send data server mobile data if gps turned off. can 1 me please? whenever turned off , turned on should work without reboot device. how can i? gpstracker.java public class gpstracker extends service { private static final string tag = "boomboomtestgps"; private locationmanager mlocationmanager = null; private static final int location_interval = 1000 * 60 * 10; private static final float location_distance = 10f; private class locationlistener implements android.location.locationlistener{ location mlastlocation; public locationlistener(string provider) { log.e(tag, "locationlistener " + provider); mlastlocation = new location...

ios - Table view, manual and settings in one screen: Best practice? -

i writing text editing app. target ios 6 , 7, , use storyboards , autolayout. i thought layout welcome screen work well: <files in table view> <instructions user> <settings> the settings view pretty complex, , benefit having own view controller. instructions view static, , has no logic. i can think of 3 ways organize this: create table 3 sections, 1st section list of files, , 2nd , 3rd section big, custom cells with. wrap 3 views in scrollview wrap instructions , settings in scrollview i prefer first solution, seems the, natural way user navigate, haven't seen examples of adding viewcontroller cell tableview anywhere, , haven't been able google me any. prototype cells not seem right way go settings view/controller either. best practice, suggestions, input? apple recommends 1 view controller per "screen," rules out option 1. wouldn't want start attempt embed viewcontroller in table cell , smells wrong in case. yo...

file io - Changing the BytesAvailableFcnCount during reading from a serial port in MATLAB -

i trying build serial port device in matlab . have 2 devices 'com1' , 'com2'. 'com1' asynchrounously writes data serial port 'com2'. have alternative names 'com1' , 'com2', follows: global serialcom serialcom=serial('com1'); %serial communication portal com 1 global testdummy testdummy=serial('com2'); %serial communication portal com 2 the number of bytes in input buffer of testdummy triggers testdummyfunction 2, , specified using testdummy.bytesavailablefcncount field (below). testdummy.bytesavailablefcnmode = 'byte'; testdummy.bytesavailablefcncount = 2; testdummy.bytesavailablefcn = @testdummycomfunction; i have function "testdummyfunction" on testdummy side triggered using bytesavailable callback property in matlab.the structure of function follows: function testdummyfunction(testdummy,bytesavailable) % testdummyfunction(testdummy,...bytesavailable) % inputs: % testdummy:refers seria...

java - Upgrade from Netbeans 7.2.1 to Netbeans 7.3.1 classpath error -

i upgraded netbeans 7.2.1 netbeans 7.3.1. have existing gwt project using jdk 7 ee. upon setting netbeans 7.3.1 point glassfish 4 , redeploying new server, see warning in output window of netbeans: warning: [options] bootstrap class path not set in conjunction -source 1.6 what warning , should concerned? i went gwt project properties , found drop-down pointing jdk 6. changed jdk 7 , warning went away.

winapi - How to get the size in pixels of the Resize Corners of a Window -

Image
is there way (api) of getting size (vertical , horizontal) in pixels of resize corners? i referring area @ each of corners of window can resize window in both directions (left-to-right , top-to-bottom) @ same time using mouse. know there mouse cursor when hover on corners of window , mouse cursor diagonal resizing cursor. thank you edit: example: hover mouse on right edge of sizable window. start in middle (vertically) of window , move mouse along edge until horizontal sizing cursor changes diagonal sizing cursor. how determine asking os how far position when cursor changes, top of window. i suggest use size of scrollbars. call getsystemmetrics sm_cyhscroll , sm_cxvscroll. may sm_cysizeframe , sm_cxsizeframe sizes can combined. but think better value use height of status bar. microsoft windows seems use fixed value can seen on screenshot.

c# - Problems after moving my project from Azure sdk 1.8.0.0 to 2.0.0.0 -

i moving project azure sdk 1.8.0.0 2.0.0.0 it works fine in development environment when going deploy on azure portal gives me error. shown below an unhandled exception occurred. type: system.io.filenotfoundexception process id: 3620 process name: waiishost thread id: 5 appdomain unhandled exception role frontend_in_0 exception: not load file or assembly 'microsoft.windowsazure.serviceruntime, version=1.8.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. @ diagconfig.config.getroleinstancediagmonitor() @ frontend.webrole.onstart() @ microsoft.windowsazure.serviceruntime.roleenvironment.initializeroleinternal(roletype roletypeenum) @ microsoft.windowsazure.serviceruntime.implementation.loader.roleruntimebridge.<initializerole>b__0() @ system.threading.executioncontext.runtrycode(object userdata) @ system.runtime.compilerservices.runtimehelpers.executecodewithguaranteedcleanup(trycode c...

php - get the name of the current $_GET variable -

this question has answer here: get url query string 10 answers i want know url user has accessed. example, if user accessed: index.php?register it echo '1'. if (isset($_get)) { switch ($_get) { case "register": echo 1; break; } } but doesn't anything, why? how name of first element? $_get array. you'd need place switch statement inside foreach loop: foreach ($_get $k => $v) { switch ($k) { case 'register': echo 1; break; } } also, $_get superglobal always set – there's no need if (isset($_get)) {

foreach - speed php load time up -

i have following php code: // add unsubscribers array $unsubs = array(); foreach($unsubscribers->response->results $entry2) { $unsubs[] = $entry2->emailaddress; } // loop through subscribers foreach($result->response->results $entry) { echo '<tr class="'. $entry->emailaddress.'">'; echo '<td>'. $entry->emailaddress.'</td>'; echo '<td></td><td>'; // if subscriber in our unsubscriber array, output email again if(in_array($entry->emailaddress, $unsubs)) { echo $entry->emailaddress; } echo '</td><td></td>'; echo '<td></td>'; echo '<td></td>'; echo '</tr>'; } where empty <td></td> located place following: $getlists = new cs_rest_campaigns($_post['campaign_id'], $auth); $getlistsresult = $wrap->get_lists_...

matlab - Self reference within an object method -

just started crash coursing in matlab oo programing , write set method object set value reciprocate setting in relevant field on other object. classdef person properties age; sex; priority; % net priority based on adjustment values adjustment; % personal adjustment value each interest family; end methods function obj = set.sex(obj, value) if value == 'm' || value == 'f' obj.sex = value; else error('sex must m or f') end end function obj = set.family(obj,value) if class(value) == 'family' obj.family = value; else error('family must of type family') end end end end classdef family properties husband; wife; children; elders; adjustment; % interest adjustment values end methods function = set.husband(this,person) if class(person) == 'person' this.husband = person; person.family = this; else error('husband must of type person...

ember.js - Updating loaded models with JS -

to explain exact use-case: have news-model 'created_at' field. displaying dates arraycontroller works fine , expected. want now, converting these dates fuzzy times http://pragmaticly.github.io/smart-time-ago/ (or http://timeago.yarp.com/ ). problem here is, need call $('.timeago').timeago('refresh'); once timestamps loaded , displayed. seems work fine long navigate within ember-app. when refresh site plugin somehow can't convert it. suppose command doesn't called @ right time app. doing in following 2 ways right now: in view: didinsertelement: function(){ $('body').timeago('refresh'); } and in controller: updatefuzzytime: function(){ $('body').timeago('refresh'); }.observes('content') when in either place settimeout() command set 1000ms work. so how can ember perform command when model loaded , displayed on refresh? (in project had similar issue , there used rerender() command did work, in...

string - Generate frames for graphics.newImageSheet animation -

i try build function generates frames list graphics.newimagesheet. function print seemingly correct list "1,2,3,4,5.." graphics.newimagesheet reject following error: warning: sequence (fastrun) has invalid index (0) falls outside rang e of valid image sheet frame indices: 1 <= index <= 9. code: function generateframes(num) numframes = num frames = 1 i=2, numframes, 1 frames = frames .. "," .. end end sheetdata = { width=32, height=40, numframes=9, sheetcontentwidth=96, sheetcontentheight=120 } mysheet = graphics.newimagesheet( "media/enemies/enemy-" .. type .. ".png", sheetdata) generateframes(9) print("frames: " .. frames) sequencedata = { { name = "fastrun", frames={ frames }, time=1000, loopcount = 0 } } don't use string in frames = {...} , use table. function generateframes(num) local frametable = {} numframes = num frames = 1 i=2, numfra...

php - array containing two arrays with no key -

i bug squashing script when discovered array ( $array ) contained 2 arrays no key so: array(19) { ["id"]=> string(3) "243" ["var"]=> string(4) "test" } array(10) { ["id"]=> int(243) } they both contain different data, removed of show i'm talking about. find cause of , fix it, need temporary fix value of var first array. when use print_r , var_dump actual value of var null . reason can't seem store value of var in variable. any ideas? here full array (with sensitive data masked) array ( [id] => 243 [ordering] => 0 [state] => 1 [checked_out] => 203 [checked_out_time] => 2013-07-17 14:28:15 [status] => new [order_id] => 84 [username] => 267 [ankleside] => left [engraving] => left [serial] => 152 [color_padding] => left [color_shell] => left [scan] => scan_2013-07-17_xxxxxx_x_hotmail.com_left.png ...

Is it possible for a MongoDB connection to timeout in Python? -

(newbie question, sorry -i'm beginning mongodb) i connecting mongo on heroku this: self.connection = pymongo.connection(mongo_url) self.db = self.connection.app13805318 is possible try use self.db after few hours , can't read it? need kind of keepalive or refresh of connection? citing pymongo documentation: http://api.mongodb.org/python/current/api/pymongo/mongo_client.html#pymongo.mongo_client.mongoclient the resultant client object has connection-pooling built in. performs auto-reconnection when necessary. if operation fails because of connection error, connectionfailure raised. if auto-reconnection performed, autoreconnect raised. application code should handle exception (recognizing operation failed) , continue execute. so @james-wahlin suggested in comments, should not solely rely on pymongo's connection-pooling mechanism wrap usage of self.db in try..except clauses. hope helps.

c++ - glvertexpointer std::vector, struct memory opengl -

i use struct struct vertex { float pos[3]; float tex[2] = {0, 0}; float norm[3] = {0, 0, 0}; int index_mtl; }; i use vector std::vector<vertex> verts; how use "glvertexpointer" struct vector. i wanted drawing function. in end did not succeed. void obj_render::drawobject() { glenableclientstate(gl_vertex_array); glvertexpointer(3, gl_float, 0, verts.data()->pos); gldrawarrays(gl_triangles,0,3); // deactivate vertex arrays after drawing gldisableclientstate(gl_vertex_array); } if use struct vertices no longer tightly packed , need specify stride: glenableclientstate( gl_vertex_array ); glvertexpointer( 3, gl_float, sizeof( vertex ), &verts[0].pos ); gldrawarrays( gl_triangles, 0, 3 ); gldisableclientstate(gl_vertex_array); like so: #include <gl/glut.h> #include <vector> struct vertex { float pos[3]; float tex[2]; float norm[3]; int index_mtl; }; std::vector< vertex > ...

c# - JQuery unobtrusive still validates removed HTML DOM -

i have ajax partial view created, , after it's created use jquery.validator.unobtrusive.parse('#recommend_fields'); to turn on unobstrusive validation! great! now when remove dom i.e. $('#recommend_fields').remove() and click submit, still tries validate it. modelstate shows errors regards id's used exist inside recommend_fields . any reason this? ajax request var request = $.ajax({ url: "/somearea/somecontroller/createview", type: "get", datatype: "html" }); request.done(function (msg, text) { if (text == "success") { $('#recommmended_sys').empty().append(msg); jquery.validator.unobtrusive.parse('#recommend_fields'); } }); n.b please remember above snippets, work, want know how turn off unobtrusive validation? i didn't use unobtrusive validation in end because when dom gone won't validate client side anyway, validates server...

android - Image with Centered Text (part of the image) in 9 patch? -

Image
i trying create 9patch png button in android using image static text , icon in it. used 9 patch tool in sdk when try use resulting png, malformed 9patch errors. here image of looks in 9 patch editor... is scenario possible or(is because have many patches) or issue else? basically discovered although possible, there better solutions (the 1 mentioned above , described in more detail below) i ended going solution mentioned in comment above. creating 9 patch of background/gradient , floating icon on left , putting text property of button itself. works enough! as noted below commenter, possible long don't have broken lines on right or bottom of 9patch... if took above image , removed 2 lines on bottom right side , right bottom, works charm (i'm still going go other option however)

linux - C++ command line utility input file location changes behaviour -

i've wrote command line utility extracting text dxf files. utility named drawingtotext. assuming directory structure this(linux os): /home/dave/dxfs/ with bunch of dxf files in dxfs folder. location, assuming file exists named "p1-1522-yi-wd-0403r1.dxf", running drawingtotext fails: drawingtotext p1-1522-yi-wd-0403r1.dxf with error: segmentation fault (core dumped) running drawingtotext ~/dxfs/p1-1522-yi-wd-0403r1.dxf gives me expect plus @ end: *** error in 'drawingtotext': free(): invalid next size (fast): 0x0000000002031170 *** with backtrace , huge memory map. now, moving file directory (/home/dave/ instead of /home/dave/dxfs/) results in results i'm looking no error. renaming file else "mydxf.dxf" , keeping in /home/dave/dxfs/ fixes issue well. my question how , why location of file change behaviour of program , how fix it? the code here: http://www.github.com/davidworkman9/drawingtotext/ the main file called "au...

date - New to Pivot Tables for Excel 2010 -

the data pulling is: ata, claim amount , # units ata claim amount # units 11/7/2010 $322.89 4 3/29/2011 $41.36 24 (4 ctns) 3/4/2011 $20.68 12 (2 ctns) 3/24/2011 $72.38 42 (7 ctns) 7/29/2011 $50.79 2 8/4/2011 $101.58 4 8/5/2011 $253.96 10 (2 ctns) 12/9/2011 $76.19 3 units 12/15/2011 $78.36 4 units 9/13/2011 $54.42 2 12/13/2011 $612.23 25 10/27/2011 $24.49 1 3/10/2012 $24.49 1 4/18/2012 $489.78 20 (4 ctns) 4/16/2012 $124.08 72 (12 ctns) 5/8/2012 $1,224.45 50 (10 ctns) 7/1/2012 $59.86 1 7/15/2012 $489.78 20 (4 ctns) 7/17/2012 $122.45 5 (1 ctn) 11/10/2012 $119.72 2 (1ctn) 11/18/2012 $199.54 10 (2 ctns) 10/29/2012 $748.82 192 (32 ctn) 12/6/2012 $25.58 1 12/9/2012 $25.58 6 12/3/2012 $126.98 5 11/4/2012 $38.09 3 7/31/2012 $122.45 5 2/17/2013 $54.42 5 10/26/2012 $20.68 12 3/23/2013 $982.83 252 4/8/2013 $51.15 12 4/3/2013 $39.91 2 2/25/2013 $54.42 5 3/27/2013 $23.40 6 5/20/2013...

javascript - adding Picture dynamically to Photoswipe -

i trying add pictures(from array) dynamically photoswipe. have tried use "append" method of jquery without success.i readed people wrote issue on web did not find rigth answer.any helps welcome. i found way add images dynamically photoswipe, bit hackish. there 3 tings 1 must do: update originalimages (dont know how importent is). add click handlers images. add images instance.cache.images. i did following code: var images, image, i, metadata, src,caption, util =window.code.util; images=$('#addedimages').find('a'); instance.originalimages = $('#all-photo-swipe-images').find('.a'); (i = 0; < images.length; i++) { image = images[i]; src = instance.settings.getimagesource(image); caption = instance.settings.getimagecaption(image); metadata = instance.settings.getimagemetadata(image); image.__photoswipeclickhandler = photos...

gis - Looking for Geo Spatial Library can be integrate with Hadoop -

i looking geo spatial library can integrate hadoop. need perform few functions aggregate, extract values of points, dissolve etc. comes arcgis. looking similar can hadoop , using mr or hbase or hive whatever suitable. please provide me suggestions. thanks in advance. there video on youtube called building geospatial processing pipeline using hadoop , hbase monsanto describes 1 approach integrating geospatial data hadoop , hbase. combine gdal mapreduce "to convert geospatial datasets common format , projection." slides presentation here . there bindings variety of different languages gdal . if python, shapely choice spatial operations such dissolve, intersection, etc.

How can I save a Prefuse generated graph as a pdf in java? -

i using prefuse java api in java code visualize network. wondering, how can save image? want save pdf? in advance. prefuse draws graph visualization in display , subclass of jcomponent . thus can apply tutorials save swing components on pdf: export swing component pdf using itext http://www.javaworld.com/javaworld/jw-12-2006/jw-1209-swing.html

How to track changes made to View of Sharepoint list? -

hi everyone! is there way track changes made view of list in sharepoint 2007. random user made changes list view using modify view button. tracked user name , date. thanks help you can track changes made view spchangeview class. find out how use spchange api here: http://msdn.microsoft.com/en-us/library/bb447511(v=office.14).aspx how create query specific changes: http://msdn.microsoft.com/en-us/library/bb447550(v=office.14).aspx the links sp2010 work 2007 too.

performance - *SOLVED* Is there any way to improve the speed of reading a text file in Python? -

i reading file of 587 kb contains words a-z like: aa bb cc ...and on... now, no matter code write, literally takes 38 seconds read file! with open('dictionary.txt', encoding = 'utf-8') dictionary: dictionary.read().splitlines() my question is: how can read file in less @ least 4 seconds? also, must return words in list. the problem has been solved "all right, everyone. got it! instead of being in problem , selecting random word, printing words instead, silly me. , when doing this, it's giving me word in fraction of second: pastie.org/8149529 " this should require less memory because iterates on lines: words = [] open('dictionary.txt', encoding='utf-8') dictionary: line in dictionary: words.extend(line.split())

ios - How can I pick a one array out of 400? -

i have file 420 nsarrays of words. each array has between 10 , 200 nsstrings. file size 988 kb. it builds , runs fine when compiler no optimization. when try make archive hangs @ "analyzing 86 of 86 files." suspect it's because compiler gets stuck on optimizing file. split file 2 parts , archive after hour of compiling. i put arrays dictionary , return 1 array want. think that's what's hanging compiler. -- 420 nsarrays ... nsarray *foils_easy = [nsarray arraywithobjects:a_easy, about_easy, ... you_easy, your_easy, nil]; nsarray *keys = @[@"a", @"about", ... @"you", @"your"]; nsdictionary *allfoils = [nsdictionary dictionarywithobjects:foils_easy forkeys:keys]; return [allfoils objectforkey:target]; i don't need dictionary, except determine array return. there way construct array name can returned? maybe can use in putting image on screen? nsstring *foregroundimagename = [nsstring stringwithformat:@"%...

javascript - Event for multiple div's with same ID -

edit: needed use class, pointing 1 out me i have following div's: <div class="section-link" id="section-tooltip" data-content="popup option trigger" rel="popover" data-placement="right"> <div class="section-features" style="display: none;"> content </div> </div> <div class="section-link" id="section-tooltip" data-content="popup option trigger" rel="popover" data-placement="right"> <div class="section-features" style="display: none;"> content </div> </div> <div class="section-link" id="section-tooltip" data-content="popup option trigger" rel="popover" data-placement="right"> <div class="section-features" style="display: none;"> content </div> </div> as can see ...

python - Why can't I iterate through list of lists this way? -

sorry i'm new python, needed take 6 individual lists , concatenate them such resemble list of lists. i.e. a1 list + b1 list b + c1 list c , a2 list + b2.... etc should become [[a1,b1,c1], [a2,b2,c2]...] i tried this: comblist = [[0]*6]*len(lengthlist) in range(len(lengthlist)): print comblist[i][0] = poslist[i] comblist[i][1] = widthlist[i] comblist[i][2] = heightlist[i] comblist[i][3] = arealist[i] comblist[i][4] = perimlist[i] comblist[i][5] = lengthlist[i] # i++ print comblist and tried variation appended instead: in range(len(lengthlist)): print comblist[i][0].append(poslist[i]) comblist[i][1].append(widthlist[i]) comblist[i][2].append(heightlist[i]) comblist[i][3].append(arealist[i]) comblist[i][4].append(perimlist[i]) comblist[i][5].append(lengthlist[i]) # i++ print comblist so have 2 questions. why didn't either of work, cus in mind should have. ...

android - How to implement a thread safe central object/list that can be accessed without concurrency exceptions? -

i'm having trouble implementing thread safe way centrally update , access list of class objects in android app. open type of question, not lot of source code can given. basically have app activity , service. service implements udp broadcasting task , udp broadcast listening task. broadcasted information json serialized copy of class represents device. e.g. uuid, ip, administrative info user set name, description, etc... json stored in udp packet , sent, udp packet received , de-serialized , processed. de-serialized class stored in hashtable , current instance belongs service. e.g. wants access data has go through service. whole thing async. the activity binds service (via , extension of binder) can call service methods, start/stop udp tasks. activity listen android intents service issue when updates or new device data has been received, , ui display information related received udp packet data. note again the packet data stored in container class belonging service. the pr...

algorithmic trading - Python TA-Lib abstract API usage -

i've had @ module documentation ta-lib abstract-specific guide , yet still unclear abstract api can me (and how). specifically, see python code example instantiates custom indicator maintains indicator value state , periodically calculates, say, rsi individual input value, opposed array of input values. what envision ability pass values indicator sequentially (as become available), example, instead of maintaining numpy array of 700 items calculate rsi on 5 minute candles - every 5 minutes - wonder if possible pass abstract indicator function candle close price, once every 5 minutes, , output 14-period rsi value calculated state. better suited application keeps track of 9 different indicator values 5 different timeframes indefinitely , around clock. whilst numpy arrays convenient generating once-off indicator value arrays, live system ongoing indicator calculations more maintained , more memory efficient ta-lib object maintain indicator state somehow. abstract api can do?...

backbone.js - Backbone app with CommonJS and Browserify -

i thinking of bringing existing app on using commonjs modules , using browserify bundle modules 1 file. i'm getting head around writing modules 1 thing i'm little sceptical before dive in , start re-writing bits, how can optimise don't have include backbone, underscore, jquery , helper files in in each file, ie. var backbone = require('/backbone'); var $ = require('/jquery'); var _ = require('/underscore'); at top of each file going little tedious after while. being complete commonjs, browserify n00b, i'm wondering if i'm missing obvious somewhere? the "very obvious thing" you're missing can create globals in node.js, , in browserify environment same. either explicitly using global.backbone = require('/backbone') , or less explicit doing backbone = require('/backbone') (without var in front). note in browser, global object in fact window object. however, attaching window object mean l...

java - Calling functions from threads -

i beginner in java. have been studying multithreading. want create 2 threads , these 2 threads must run separate methods concurrently. here these threads should call sum , diff method , run simultaneously. getting error, method should of thread type. how achieve it. class demo implements runnable { void sum() { //some lines of code } void diff() { //some lines of code } public void run () { system.out.println("inside run"); } } class test { public static void main (string []args){ demo o = new demo (); demo o1 = new demo (); thread th = new thread (o); thread th1= new thread(o1); th.start(); th1.start(); o.th.sum(); // getting error here o1.th1.diff(); // getting error here } } first of have compilation error because you're trying reference variable th field on object of type demo. th not field, rather local var...

c++ - When should we provide our own Hash function for `std::unordered_set` -

when compile following code, saw errors related hash. int f_no_meaninga(unordered_set<vector<int>>& setvec, vector<int>& vec) { setvec.insert(vec); return 1; } int main() { vector<int> w{2, 3, 7}; unordered_set<vector<int>> setvec; } $ g++ --version g++ (ubuntu/linaro 4.6.3-1ubuntu5) 4.6.3 $ g++ $1.cpp -o $1 -g -wall -weffc++ -pedantic -std=c++0x /tmp/cccqfq4n.o: in function `std::__detail::_hash_code_base , std::vector >, std::_identity > >, std::equal_to > >, std::hash > >, std::__detail::_mod_range_hashing, std::__detail::_default_ranged_hash, false>::_m_hash_code(std::vector > const&) const': /usr/include/c++/4.6/bits/hashtable_policy.h:753: undefined reference std::hash<std::vector<int, std::allocator<int> > ::operator()(std::vector<int, std::allocator<int> >) const' /tmp/cccqfq4n.o: in function ...

json - Unexpected duplicate key error using @JsonTypeInfo property -

i have simple hierarchy of data objects, have converted json format. this: @jsontypeinfo(use = jsontypeinfo.id.name, include = jsontypeinfo.as.property, property = "documenttype") @jsonsubtypes({@type(transcriptiondocument.class), @type(archivedocument.class)}) public class document{ private string documenttype; //other fields, getters/setters } @jsontypename("archive") public class archivedocument extends document { ... } @jsontypename("transcriptions") public class transcriptiondocument extends document { ... } upon json parsing encounter errors one: unexpected duplicate key:documenttype @ position 339. , because in generated json there 2 documenttype fields. what should changed make jsontypename value appear in documenttype field, without error (eg replacing other value)? jackson version 2.2 your code doesn't show it, bet have getter in document class documenttype property. should annotate getter @jsonignore so: @...

excel - How to fix an 'Out of memory" eroor -

my following code poppes runtime error7: "out of memory". dont understand why. not long code. identified row @ error occurs. thoughts? sub discrepancy_report() dim var1 long dim var2 long dim var3 long dim colrg range dim lastr long dim dr string dim r integer dim sht1 worksheet dim sht2 worksheet dim errbox integer r = 5 on error goto datasheeterror set sht1 = sheets("datasheet") on error goto discrepancysheeterror set sht2 = sheets("discrepancyreport") on error goto 0 sht2.select rows("9:999").select selection.delete shift:=xlup range("a9").select sht1.select lastr = activesheet.range("a1").offset(activesheet.rows.count - 1, 0).end(xlup).row lastr = lastr - 1 'store values in array dim tbl range dim var() variant dim c long, matchrow long set tbl = range("a3:g" & lastr) redim var(1 tbl.rows.count) c = 1 tbl.ro...

devise in rails 3 : 'user_signed_in?' false 'signed_in?' true 'current_user' nil -

i migrating rails 2 app rails 3 , had use new authentication solution since restful_authentication no longer supported. trying out devise , having problems it. i have login page, directs app. can use app without logging in options not available until login. once logging in devise says have logged in via flash message, current_user evaluate nil , current_user.blank? evaluates true , user_signed_in? evaluate false . oddly signed_in? evaluates true . checking session data shows warden.user.user.id contains correct user id , csrf token exists. true both in view , in controller. here routes.rb myapp::application.routes.draw devise_for :users match "/:controller(/:action(/:id))" match "/:controller(/:action(/:id))(.:format)" match "/:controller(/:action(.:format))" devise_scope :user 'signup', :to => 'devise/registrations#new' 'login', :to => 'devise/sessions#new' 'signout', :to =...

c# - Serializing in Json.net -

i want know serialize json data > csharp send json request server , how deserialize server response csharp object i using json.net framework { "jsonrpc":"2.0", "method":"call", "params": { "session_id":"90334", "context":{} }, "id":"r5" } there no question here assuming want serialize json string object? @ least post have tried , errors receiving if any. per json.net web site found here http://james.newtonking.com/pages/json-net.aspx string json = "<you json string>"; jobject o = jobject.parse(json); // here how access string jsonrpc = (string)o["jsonrpc"]; // access array of object jarray sizes = (jarray)o["<arrayname>"]; string arrayentry = (string)sizes[0];

mysql - Generate a random DB insert with PHP -

i have 2 tables this: table: matrix matrix_id round_id p_1_1 p_1_2 p_2_1 p_2_2 p_3_1 p_3_2 int(11) int(11) int(11) int(11) int(11) int(11) int(11) int(11) autoincrement table: matrix_elements: element_id matrix int(11) int(11) autoincrement now need randomly select table matrix_elements , insert new row table matrix . each of p_1_1, p_1_2 etc.. have filled random matrix matrix_elements table. the requirement each 2 of columns p_1_1 etc.. have filled value: 8 i totally lost , did not try before ask. in need of directions in order achieve this, not necessarly prepared code. thanks suggestion. this takes multiple statements 1 row... , may have misunderstood requirements, here goes: edit: modified 1 statement , work rand() insert matrix select null, 1, -- no idea round_id should be... if( 0 in (one8, two8), 8, (select element_id matrix_elements...

excel - How do I keep the hyperlinking of my search results? -

Image
i've got long list of names , categories in excel , each item in list hyperlinks worksheet in book. because it's unwieldy ctrl+f elements in list since it's massive, i've set search box using =search, =rank, , =vlookup functions. search box work search draws in , displays text , these search results not retain original hyperlinking , defeats point of database. long story short: how can keep hyperlinking of search results yielded search function constructed in excel 2007? thanks, grateful responses. let me know if can clarify doing. p.s. have more primitively limited knowledge of vba if vba way go, i'd happy learn. if can find item searching for, can link them cell has link (inception style) e.g. in new workbook: then, can link cell has letter a with: =hyperlink("[book1]sheet1!"&address(match("a",a1:a3,0),1),"go search term") this search a in a1:a3 area of spreadsheet, make address using match position, ...

python - How to Check if an Argument Was Called Without an Action? -

i want able see if argument called without using store action. instead of code looking this: parser = argparse.argumentparser() parser.add_argument('-a', '--argument', action="store", dest="some_arg", help='help data..', default="none") args = parser.parse_args() if args.some_arg == "user input": print "argument called." i want user not have enter in "user input" same result print "argument called" . in other words if user wanted reference argument have type: script.py --argument instead of: script.py --argument user input you can use store_true action. set value true if argument specified, or false otherwise: parser = argparse.argumentparser() parser.add_argument('--foo', action='store_true') args = parser.parse_args() if args.foo: print('--foo specified')

javascript - scrolltop() doesn't work with body.height() -

i've got fiddle. http://jsfiddle.net/qf47a/3/ well, tried similar code on website, worked great until added doctype . code return top 0px . well take look: on jsfiddle. starts 0 , , ascends negative numbers. when add position:absolute; element in dom (in english) gives it's space float does. there isn't way around unless add height body. basically body doesn't know #fly there body has no height. if remove position:absolute; see document.height work in case

Display joomla component within another component -

i have 2 components trying integrate. i created new view in component #1, i iframe or load content component #2. the iframe works once have added 'tmpl=component', click link in iframe. joomla includes joomla footer , header. is there efficient way load content component #2 component #1? i not have access joomla template. have access component #1 , #2. thanx. using iframe not best option, better off invoking model of other component main component's controller , handle views main component. double component exist in backend logic, , views handled main component alone. this work if secondary component's developer refrained using jpath_component or other constants point wrong component. to make example, in controller or main component's model: $com_path = jpath_site.'/components/com_secondary_component/models'; jmodellegacy::addincludepath($com_path , 'seccompprefixmodel'); $secondarymodel = jmodellegacy::getinstance( ...

java - JTextArea in other JFrame display realtime console output -

i have "consoleframe" should display console output in real-time jtextarea. i redirected output streams: private void redirectsystemstreams() { outputstream out = new outputstream() { @override public void write(int b) throws ioexception { updatetextarea(string.valueof((char) b)); } @override public void write(byte[] b, int off, int len) throws ioexception { updatetextarea(new string(b, off, len)); } @override public void write(byte[] b) throws ioexception { write(b, 0, b.length); } }; system.setout(new printstream(out, true)); system.seterr(new printstream(out, true)); } and call swingutilities.invokeandwait method append new text, works fine private void updatetextarea(final string text) { try { swingutilities.invokeandwait(new runnable() { @override public void run() { txt_console.app...

uwsgi - Can't figure out how to serve static files with Nginx -

i have followed tutorial found here , when trying access static files page not found error. here tutorial following https://gist.github.com/evildmp/3094281 this in error log file nginx. 2013/07/17 09:55:15 [emerg] 2891#0: "upstream" directive not allowed here in /etc/nginx/nginx.conf:2 and nginx conf file # nginx.conf upstream django { # connect socket # server unix:///tmp/uwsgi.sock; # file socket server 127.0.0.1:8000; # web port socket 8001 } server { # port site served on listen 8000; # domain name serve server_name inventory.ien.gatech.edu; # substitute machine's ip address or fqdn charset utf-8; #max upload size client_max_body_size 75m; # adjust taste # django media location /media { alias /desktop/projects/newest/ien_inventory/inventory/templates/media; # django project's media files } location /static { alias /desktop/projects/newest/ien_inventory/inventory/templates/media; # django ...

asp.net - Silverlight call from aspx no longer working -

i'm fixing old code uses silverlight along arcgis. silverlight portion broke on time. code that's used is: <asp:silverlight id="xamlmain" runat="server" source="clientbin/controlpoints.xap" minimumversion="3.0.40624.0" width="100%" height="100%" /> and way called function refreshcontrolpointlayer() { var slcontrol = document.getelementbyid("xamlmain"); slcontrol.content.refreshcontrolpointslayer(); } i "slcontrol.control undefined." after looking silverlight call (i have no prior experience or knowledge of silverlight) found way it's being called old, changed new object way. <object type="application/x-silverlight-2" data="data:application/x-silverlight," width="100%" height="100%"> <param name="source" value="clientbin/controlpoints.xap" /> <param ...

aptana3 - How to transfer remote files in Aptana Studio 3 when connected via Connections Manager? -

how connect remote files aptana studio 3 without connecting ftp. on rt-click "run web deployment wizard" , no other options "transfer files , other options". , connected in connections manager. apparently project not connected. if follow through "run web deployment wizard" ask ftp credentials, etc. after that, should able edit files in project , transfer them without bothering ftp information again. think wizard come 1 time each project connect remote server. i have remote project , when right-click, options transfer of files. connected project should have subfolder called "connections" contains files in project. wanted upload screenshots of project view, don't have permissions yet.

Getting CMake to give an error/warning about unreferenced symbols -

i'm wondering how go making cmake produce error, or @ least warning, when linker cannot find symbols referenced in source file? for example, let's have foo.c: #include "bar.h" //bar.h provides bar() void foo(void) { bar() return; } in case building static library, if not smart how have used add_library() directive, default behavior seems to not give warning bar unreferenced symbols in foo's object archive file (.a) there's -z now gcc linker these days, yeah, isn't cmake's problem. the fool-proof way i've found works on shared libraries, write test each shared library , dlopen(path, rtld_now) (and similar windows) , use return value test return value. list of shared objects, have wrapper function around add_library adds shared libraries global property used generate tests dynamically. remember there being way tell if target shared or static, i'm not finding docs right now.

php - Convert custom date format using a simple user-entered format -

i need import text files various sources contain dates in various formats. given how many messed pieces of data have encountered in test files have gathered far, have decided force user enter date format before importing file, e.g. mmddyyyy or dd.mm.yyyy etc. i can't expect these users understand enough enter y-m-d or n/j/y formats easy enough parse, , can't rely on "standards" "if dash used, month comes before day", etc., automatic parsing out of question. the other issue usual php date formatting can't predict if date format have single or double digits, , don't know how createfromformat parse if give them single digit when expects double digit... so first thought start separating pure numeric dates others , force user enter full 8 digit date along format code - otherwise becomes messy. that's far i've gotten far... i thought parsing date , format string side side, again cause issues one-digit numbers if i'm not careful...

Want CSS columns to overlap -

Image
i've searched through stackoverflow , found plenty of people trying avoid overlapping in css columns, i'm being asked make text , images overlap. update: better image explaining i've been asked do, , link code i'm using. thanks! http://unfetteredletters.com/webdev/twocolumnlayout.jpg link code: http://unfetteredletters.com/webdev/af_columnlayout/af_2columnlayout.html is possible? you can negative margins. check out this: http://coding.smashingmagazine.com/2009/07/27/the-definitive-guide-to-using-negative-margins/ #content {margin-right:-100px;}

Creating catalog for each customer in SQL server database -

i have 2 tables. customer table, containing customerid, name, dob etc , table contains text fields along customerid. customers require able search through mentioned text fields in second table. this simple problem made complicated fact second table can large (several billion records). looking @ using full text search , have created full text catalog , full text index database , table respectively. approach slow! wondering if somehow possible create full-text catalog each individual customer? if have other thoughts, i'd happy here them thanks

php - I am getting an error when inserting with execute($array) -

i have table percentile int(3) no fosw int(3) yes null dflr int(3) yes null foa int(3) yes null sog int(3) yes null rst int(3) yes null ssw int(3) yes null total int(3) no and array: array ( [percentile] => 99 [fosw] => 125 [dflr] => 110 [foa] => 60 [sog] => 120 [rst] => 40 [ssw] => 45 [total] => 500 ) and code not work reason... catch not throw error. if statement echos error... if ($_post['percent']=='add'){ try{ $post = $_post; unset($post['percent']); $sth = $dbh->prepare("insert percentiles (percentile, fosw, dflr, foa, sog, rst, ssw, total) values (?,?,?,?,?,?,?,?)"); if ($sth->execute($post)){ echo 'done<br/>'; } else echo 'error...

node.js - Express: passing options to an included server -

i develop express website can run either stand-alone or part of larger server while allowing degree of configuration. for example, have large main server in server.js , write server app.js defines route /* provide small service. want able either: run app.js standalone, provide routes through localhost:port/ define route within server.js maps server, example /app/* allow app.js handle requests. reading through smashing node , see if define express server , routes in app.js , can use: server.use('/app', require('app.js') gain use of routes. problem approach not see how pass configuration options app.js . you write app.js module callable function: var express = require("express"); var app; // <-- note global var initialize = function(conf) { if (app) { return app; } conf = conf || {}; app = express(); // here goes configutation code, example: if (conf.static) { app.use(express.static...