Posts

Showing posts from April, 2015

Spring Security - Prevent AccessDeniedException from stopping application normal flow -

i'm using spring secuirty 3 acl module. i'm securing methods @preauthentication annotations using custom permissionevaluator . working fine, every time permissionevaluator returns access_denied accessdeniedexception thrown @ point , stops application execution. desired behaivore when permissionevaluator returns , access_denied , secured method call prevented (skipped) , rest of application keeps running normally. have idea on how achieve this? if wrap each call want happen in try...catch , can behavior. basically, since it's exception, normal exception handling apply it. if application can handle exception , continue normally, that! here's example of mean: // 1st method denied want continue execution after try { // call method throw exception } catch (/*the exception expect thrown , want continue after*/){} // 2nd method denied want continue execution after try { // call method b throw exception } catch (/*the exception expect thrown , ...

Opengl ES sliding texture animation -

i d animate texture on vertex left right. how can this? my old code is: float texcoords[] = { itextcoord, 0.0f, itextcoord, 1.0f, itextcoord+1.0f, 0.0f, itextcoord+1.0f, 1.0f, }; this.settexturecoords(texcoords); but isnt best:( you can use glmatrixmode(gl_texture_matrix) , gltranslatef() .

Selecting BLOB column from Oracle database to SQL Server database over linked server -

how select blob column oracle database using openquery on sql server using linked server connect oracle database? when try using syntax, receive error: select * openquery(linked_server_name , 'select blobcolumn table') derivedtbl_1 errors: ole db provider "msdaora" linked server "linked_server_name" returned message "oracle error occurred, error message not retrieved oracle.". ole db provider "msdaora" linked server "linked_server_name" returned message "data type not supported.". can change ole db provider you're using connect oracle? microsoft ole db provider oracle not support blob data types. oracle ole db provider does. if change connection oracle use oracle provider, should work.

javascript - ajax loading file with slideToggle effect -

i loading text files in div container, , i've made work far. wish animate slidetoggle effect. webpage looks like: <div id="content" style="width: 75%"> <?php foreach(new directoryiterator('uploads/temp') $file) { if(!$file->isdot()) { echo '<a href="#" onmousedown="javascript:ajax.query( \'view.php?file=uploads/temp/'.$file.'\',\'file\')">'.$file.'</a> '; } } ?> <div id="file" style="text-align: justify"></div> </div> how apply slidetoggle function links? can check actual webpage here many thanks you'll need attach callback event ajax request, slide animation not occur until content has loaded. using jquery's built-in ajax , event functionality this: <?php foreach... { // removed onmousedown, event attached using pure jquery ...

printing - Using Reportbuilder for Delphi, is it possible to print landscape and portrait within the same report? -

Image
we're using reportbuilder delphi , have report, made of several smaller subreports, set print landscape. there way make first subreport print in portrait, whilst others print landscape? i have tried setting orientation on tppreport printersetup object before prints , seemed work @ first, caused problems printing report, , exporting pdf. thanks! yes possible. in report design main, uncheck parentprintersetup sub reports. set polandscape or poportrait in printersetup sub report sub report tab. tested reportbuilder 12.03, delphi xe , foxit 4.1.1 edit 1 tested d2007 , reportbuilder 10.07. no , problem printing pdf first subreport portrait , second subreport landscape. here dfm containing report definition tested with. object form1: tform1 left = 0 top = 0 caption = 'form1' clientheight = 176 clientwidth = 377 color = clbtnface font.charset = default_charset font.color = clwindowtext font.height = -11 font.name = 'tahoma...

How to make Google Chrome extension to run jQuery Script -

i have jquery script: $('[id^=changesetlist] tr').each(function () { var sid = $(this).attr('sid'); $(this).find('td span.changesetdescription').append('<span class="csethash">' + sid + '</span>').css('color','#777'); }); i want run when visit kilnhg.com. i put in in kiln_hash.user.js file , installed chrome doesn't anything. i think might because requires jquery. i have read few tutorials , looks might need create manifest.json file , put , .user.js file zip file .crx extension. i still not know need put in manifest file. how can work? update i created manifest.json file: { "name": "kiln hash", "version": "1.0.1", "description": "show hash in changeset list in kiln", "content_scripts": [ { "matches": ["https://*.kilnhg.com/*"], "js": ["jqu...

php - mysql select data from two tables and different structure -

hi there i'm building kind of agenda/website php/mysql. agenda has public events , users' personal notes ordered date. need load events events table in database , notes notes table. 2 tables have different structure , have 1 same field: datetime. how can sort date public events , personal notes then? please me out! =) luca improving don's answer per op comments, can add column know table row in. select 'events' tbl, datetime, location, organizer, null notes events union select 'user_notes' tbl, datetime, null, null, notes user_notes order datetime desc

iphone - Is it possible to use NSThreads for parsing four different URLs using NSXMLParser -

if try parse single http url, done quickly. if have parse 4 different urls @ application launch, feasible use nsthreads , nsoperation queue. can 1 explain small example if possible? sagos write nsoperation subclass, , in main method, this: - (void)main { nsxmlparser *parser = [[[nsxmlparser alloc] initwithcontentsofurl:myurl_] autorelease]; [parser setdelegate:self]; [parser parse]; } implement parser delegate methods on nsoperation subclass. instantiate subclasses, assign them urls, , add them operation queue. use notifications or delegates know when finished.

java - Android video recognition -

i tried google in hope find google goggles alike tools/libraries allow developer recognize objects in video. i understand complex topic. are there libraries recognize shapes in video? instance detect if there squares in given frame/video? i'm pretty sure goggles can that, researched doesn't have sdk use. update : recognizr seems example of part of trying accomplish. it's application not released yet. opencv (open source computer vision) library lots of folks use base these styles of project off of. there's beta-quality project running opencv code using ndk on android: http://opencv.willowgarage.com/wiki/android there plenty of resources opencv linked wiki , project page, , it's pretty easy find samples opencv floating around. said, it's pretty complex topic overall, , while framework gives leg on development there still plenty layer in before have working prototype.

.Net Linq to JSON with Newtonsoft JSON library -

i have json sent webservice looks this. { root: [ { "key": "foo1", "val": "150" }, { "key": "foo2", "val": "220" }, { "key": "foo3", "val": "300" }, { "key": "dataid", "val": "2289" } ] } say wanted return value of val key equal "dataid" . how using json.net library? i know can loop through values find object far bigger example here. thanks in advance well something going have loop through @ point. if need fetch lots of values key same json, should build dictionary<string, string> - means looping on once (either explicitly or using linq todictionary method) having fast access afterwards. here's sample code: using ...

build - Problem creating jar through maven -

hi, i trying creating executable jar using maven. jar created , when try execute java -jar myjar following error caused by: java.lang.classnotfoundexception: org.apache.hadoop.conf.configuration @ java.net.urlclassloader$1.run(urlclassloader.java:202) i extracted jar , see hadoop classes not present. , in logs see hadoop jars not copied .where problem my pom.xml follows : <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> <version>2.2-beta-4...

mongodb - Mongo geospatial index options -

in mongo geospatial index documentation there parameter called "distancemultiplier", there's no explanation. anyone know does? it scales distance returned "dis" in result: > db.runcommand({geonear: 'places', near: [50, 50]}) { "ns" : "geotest.places", "near" : "1100110000001111110000001111110000001111110000001111", "results" : [ { "dis" : 7.853626559350774, "obj" : { "_id" : objectid("4d4b20890da611546bcbdf96"), "loc" : { "lat" : 42.739037, "long" : 52.992964 }, "category" : [ "1" ] } }, > db.runcommand({geonear: 'places', near: [50, 50], distancemultiplier: 4}) { "ns" : ...

javascript - Firefox scrollTop problem -

i have problem firefox scrolltop value , onscroll event. works great in ie, safari , chrome firefox seems lag. i tried update background position onscroll event, when take handle , drag , down quickly, firefox stops updating scrolltop value , causes lag in app. you can try code , in firefox console when dragging handle , see values stops updating : function savescrolllocation () { console.log(document.documentelement.scrolltop); } window.onscroll=savescrolllocation ; any idea how make firefox respond more quickly? there 2 ways handle - throttle (execute function set interval) , debounce (execute function after specified time has passed since last call). you'll want use throttling in situation. a simplified solution may ( updated : see @ http://jsfiddle.net/yvvnu/1/ ): window.onscroll=catchscroll; var timeoutid = 0; var jitterbuffer = 200; function catchscroll() { if (timeoutid) cleartimeout (timeoutid); ...

php - select rows depending on an array values -

i have array populated cookie. length differ each time. values contains ids taht want select database. know can use below retrieve multiple rows specific ids: $query = "select game_id,thumb,title,rating,instructions games game_id in ('111','110')"; my question is, how can retrieve database ids of array $favgames ? found in question following: where id in (' . implode(',', $ids) . ')'; doesn't seems works me. other options have? you'll need this: $query = "select game_id,thumb,title,rating,instructions games game_id in ('" . implode("','", $favgames) ."')"; if don't have single quotes in call implode, query like: select game_id,thumb,title,rating,instructions games game_id in ('111,110') notice missing quotes? that's what's causing error.

c# - Silverlight MVVM Confusion: Updating Image Based on State -

i'm developing silverlight application , i'm trying stick mvvm principals, i'm running problems changing source of image based on state of property in viewmodel. intents , purposes, can think of functionality i'm implementing play/pause button audio app. when in "play" mode, isactive true in viewmodel , "pause.png" image on button should displayed. when paused, isactive false in viewmodel , "play.png" displayed on button. naturally, there 2 additional images handle when mouse hovers on button. i thought use style trigger , apparently they're not supported in silverlight. i've been reviewing forum post question similar mine it's suggested use visualstatemanager . while might changing image hover/normal states, part missing (or i'm not understanding) how work state set via view model. post seems apply events rather properties of view model. having said that, haven't completed normal/hover affects, either. below sil...

java - Retrieving a random item from ArrayList -

i'm learning java , i'm having problem arraylist , randomgenerator . i have object called catalogue has array list of objects created class called item . need method in catalogue returns information on 1 of item objects in list. item needs selected @ random. have used random generator util cannot working. can't work out have done wrong. import java.util.arraylist; import java.util.random; public class catalogue { private random randomgenerator; private arraylist<item> catalogue; public catalogue () { catalogue = new arraylist<item>(); } public item anyitem() { int index = randomgenerator.nextint(catalogue.size()); return catalogue.get(index); system.out.println("managers choice week" + anyitem + "our recommendation you"); } when try compile error pointing @ system.out.println line saying 'cannot find symbol variable anyitem' any appreciated :) thanks...

Validation of Checkbox in Listview Control by Jquery/Javascript? -

i trying validate checkbox 1 of item in listview control. have button check define clientclick function on button , wrote javascript code. didn't work. displaye lstviewtest object null.. function btnclick() { var listview = document.getelementbyid('<%= lstviewtest.findcontrol("tableitem").clientid %>'); (var = 0; < listview.rows.length; i++) { var inputs = listview.rows[i].getelementsbytagname('input'); (var j = 0; j < inputs.length; j++) { if (inputs[j].type == "checkbox" || inputs[j].type == "checkboxsend") if (inputs[j].checked) return true; } alert("please select @ least one"); return false; } } thanks in advance, appreciate time

How safe is recursion in Python? -

i'm working on ai homework, , despite professor's suggestions, have no intention of writing assignment in lisp. however, do want write recursively, better keep concise , simple. here question: am running major risk of running out of stack space if perform search on large state space? how deep python stack go? how deep python stack go? the default recursion limit in python 1000 frames. can use sys.setrecursionlimit(n) change @ own risk. if you're set on using python, suggest using pattern more suited language. if want use recursive style search, , need arbitrary stack depth, can make use of python's enhanced generators (coroutines) create "trampoline pattern" (there example in pep342 ) and despite professor's suggestions, have no intention of writing assignment in lisp if exercise intended recursion-based, tail-call optimized language, lisp, best bet.

sql - Need to index column in AND statement? -

i have select on table this: id username speed is_running the statement like: select * mytable username = 'foo' , is_running = 1 i have index on "username". if i'm running above statement, need index "is_running" best performance? or first column of select make difference? i'm using mysql 5.0. it depends on type of data you're storing. if it's bool, may not see gain index on column alone. may want try add composite index on 2 columns: alter table mytable add index `idx_username_is_running` ( `username` , `is_running` );

c++ - This may be due to a corruption of the heap, which indicates a bug in testcrypto.exe or any of the DLLs it has loaded -

#pragma once #include <string> #include <vector> #include <stdint.h> class passwordcrypt { public: passwordcrypt(std::vector<uint8_t> buffer); ~passwordcrypt(void); void passcrypto(std::vector<uint8_t> buffer); const std::vector<uint8_t>& encrypt(const std::vector<uint8_t>& buffer); const std::vector<uint8_t>& decrypt(std::vector<uint8_t>& buffer); private: uint8_t* key; }; -------------------------------------------------------------------------------------- #include "passwordcrypt.h" passwordcrypt::passwordcrypt(std::vector<uint8_t> buffer) { this->key = new uint8_t[200]; int sum = 0; (int = 0 ; i< buffer.size() ;i++) sum += buffer[i]; srand(sum); uint8_t hash[0x10]; (int = 0; < 0x10; i++) hash[i] =(uint8_t)rand(); (int = 1; < 0x100; i++) { key[i * 2] = (uint8_t)i; key[(i * 2) + 1] = (u...

ios - How to Sync iPhone Core Data with web server, and then push to other devices? -

i have been working on method sync core data stored in iphone application between multiple devices, such ipad or mac. there not many (if @ all) sync frameworks use core data on ios. however, have been thinking following concept: a change made local core data store, , change saved. (a) if device online, tries send changeset server, including device id of device sent changeset. (b) if changeset not reach server, or if device not online, app add change set queue send when come online. the server, sitting in cloud, merges specific change sets receives master database. after change set (or queue of change sets) merged on cloud server, server pushes of change sets other devices registered server using sort of polling system. (i thought use apple's push services, apparently according comments not workable system.) is there fancy need thinking about? have looked @ rest frameworks such objectiveresource , core resource , , restfulcoredata . of course, these working ruby on rails...

How to compare changesets in Git? -

git makes easy compare differences between commits, using instance git commands diff , difftool. in tortoisegit select 2 commits compare them. but there way compare changesets ? in other words: see differences between diffs of 1 set of commits , diffs of set of commits. this handy compare (sets of) commits cherry-picked or have been rebased. perhaps diff <(git show rev1) <(git show rev2) want?

gorm - Is it possible to configure Grails to never change a domain object unless .save() is called? -

is possible configure grails changes domain objects never persisted unless .save() explicitly called? i'm aware of .read() , i'm looking general solution disable dirty-checking globally. i don't think there's perfect solution question. referring this issue discussion , disabling dirty-checking impossible without interfering hibernate basic workings. personally, don't think worth risks.

c# - Sending a string to a PHP page and having the PHP Page Display The String -

what i'm trying have php page display string i've created through function in c# application, via system.net.webclient. that's it. in it' s simplest form, have: webclient client = new webclient(); string url = "http://wwww.blah.com/page.php"; string testdata = "wooooo! test!!"; byte[] senddata = client.uploadstring(url, "post", testdata); so, i'm not sure if that's right way it.. , i'm not sure how obtain string , display on php page. print_r(senddata) ?? any appreciated! there 2 halves posting. 1) code posts page , 2) page receives it. for 1) c# looks ok. use: string url = "http://wwww.blah.com/page.php"; string data = "wooooo! test!!"; using(webclient client = new webclient()) { client.uploadstring(url, data); } for 2) in php page: if ( $_server['request_method'] === 'post' ) { $postdata = file_get_contents('php://input'); print $pos...

uinavigationcontroller - Relocate views in the navigationcontroller -

is possible relocate uiview i've added subview of viewcontroller? problem: navigationcontroller stack -> viewcontroller -> rectangle view when change device orientation want relocate rectangle view. how can access rectangle subview? thanks knowledge. you can tag view, want (so can later viewwithtag) or run through subviews array looking it.

iphone - Core Data Query Multiple Columns with Single Search String -

i have simple core data model 2 string attributes (size , category). given search string 'small widget' possible return records match query words @ least 1 attribute (i.e. records 'small' size , 'widget' category)? have: nsstring *search = @"small widget" nspredicate *predicate = [nspredicate predicatewithformat:@"size contains[cd] %@ or category contains[cd] %@", search, search]; ... this won't return results (as no category or size equals "small widget"). suggestions? note search strings user entered text field , may come in order can't split manually. i haven't tested looks want this: nsstring *search = @"small widget"; nspredicate *predicate = [nspredicate predicatewithformat:@"%@ contains[cd] size , %@ contains[cd] category", search, search]; the search string contain (or not) size , category, should ask if current size or category contained on search string. you split sear...

Is there a universal date format for PHP? -

okay there way set date can modified different format later on. example: date in mysql database, , in universal format; gets put document, there way date format changed on-the-fly? yes, it's called unix timestamp , represents seconds since epoch (december 31rst, 1969). with timestamps, can use date() function output date in format wish.

Removing non-repository files with git? -

i'm writing autotools code , in process of development, tons of files generated. is there anyway tell git remove files directory not part of repository? thanks! you can use git-clean . command remove untracked files/directories. default, print have removed, without removing them. given -f flag remove files, , -d flag remove empty directories : git clean -df also removing ignored files : git clean -dfx

ios - Edge Detection of Image in iPhone Using Image Magick -

Image
i want convert rgb image below image. using imagemagick library . want know functions can convert in original image image-2. here below 2 images. use imagemagick library. image processing simillar link in objective c. @apoorv dont know thing if want edge detection may can use opencv instead. here link of source code , tutorials of how detect edge in iphone using opencv iphone , opencv http://dasl.mem.drexel.edu/~noahkuntz/opencvtut5.html here sample project have created in iphone using opencv original image image after edge detection.

javascript - How to refresh page with image showing when refreshing.. This doesn't work in IE :( -

i have tried below in firefox , works, doesn't in ie 7 , 8 -- page refreshes don't see image when refreshing in ie. in advance. javascript: window.onload = show; function show() { document.getelementbyid("img444").style.display="none"; settimeout("hide()", 5000); // 5 seconds } function hide() { document.getelementbyid("img444").style.display="block"; window.location.reload(false); } html: <img id="img444" src="images/indicator.gif" style="display: none;"/> well changed code per @gov's comment , work on ie7 , firefox. so should work you

sql - How to display a time in specific format -

using sql server 2005 table1 id timecolumn 001 13.00 002 03.30 003 14.00 004 23.00 005 08.30 ... table1 format timecolumn format: hh:mm timecolumn datatype nvarchar timecolumn display time 1 hour or halfhour timecolumn not display 08.20, 08.56. display time 08.00, 08.30. i want display time 13 instead of 13.00, 3.5 instead of 03.30. expected output id timecolumn value 001 13.00 13 002 03.30 3.5 003 14.00 14 004 23.00 23 005 18.30 18.5 ... how make query above condition? based on facts, there 2 cases last 3 digits, either .30 ; or .00 so replace them select id, timecolumn, value = replace(replace(timecolumn, '.30', '.5'), '.00', '') table1 edit to drop leading 0, can use instead (the value column numeric) select id, timecolumn, value = round(convert(float,timecolumn)*2,0)/2 table1 or if need varchar select id, timecolumn, value ...

java - Apache Commons equals/hashCode builder -

i'm curious know, people here think using org.apache.commons.lang.builder equalsbuilder / hashcodebuilder implementing equals / hashcode ? better practice writing own? play hibernate? what's opinion? the commons/lang builders great , have been using them years without noticeable performance overhead (with , without hibernate). alain writes, guava way nicer: here's sample bean: public class bean{ private string name; private int length; private list<bean> children; } here's equals() , hashcode() implemented commons/lang: @override public int hashcode(){ return new hashcodebuilder() .append(name) .append(length) .append(children) .tohashcode(); } @override public boolean equals(final object obj){ if(obj instanceof bean){ final bean other = (bean) obj; return new equalsbuilder() .append(name, other.name) .append(length, other.length) .app...

ipad - oAuth with Custom Login screen in iPhone app -

is there way in can use oauth provide own custom login screen , not web view ?? light on highly appreciated. hi think not possible had tried myspace , twitter show login form within app such out going web browser.

path - does Python zipfile always use posixpath filenames regardless of operating system? -

it won't matter current utility, coding practice, i'd know if files in zip file, using zipfile module, can accessed using posix-style pathname such subdir/file.ext regardless of on operating system made, or on system python script running. or if, in case of windows, file stored or accessed subdir\file.ext. read pydoc module, , did searches here , on google, couldn't see relevant question. thanks. yes. you can see these lines zipfile module: # used ensure paths in generated zip files use # forward slashes directory separator, required # zip format specification. if os.sep != "/" , os.sep in filename: filename = filename.replace(os.sep, "/") and in zip specification : file name: (variable) the name of file, optional relative path. path stored should not contain drive or device letter, or leading slash. slashes should forward slashes '/' opposed backwards slashes '\' compatibility amiga ...

c# - Control.Invoke() vs. Control.BeginInvoke() -

possible duplicate: what's difference between invoke() , begininvoke() first of all, apologize bad grammar since english not native tongue. this understanding: control.invoke(delegated_method) // executes on thread wich control created on witch holds handle ,typically main thread of winform application . control.begininvoke(delegated_method // executes asynchronously on threadpool thread . according msdn, says executes delegate asynchronously on thread control's underlying handle created on. my question : am understand begininvoke treats main thread in matter thread pool, , execute delegated method on main thread when "gets chance" ? another question raised, possible create control not on main thread ? if give me example? yes, executed on dispatcher of ui thread created it. as creating control on background thread, wouldn't advise it. furthermore, haven't mentioned technology working with.

php - how to add a tag to the navigation tabs displayed in moodle profile page -

i want add new tab navigation of profile page. hope using moodle block or module. please give me clue this. you have hack code in /user/tabs.php (moodle 1.9). just add new element $toprow array: $toprow[] = new tabobject('extra', 'http://a_link', 'extra'); where i'm specifying id, link , label new tab. obviously, have add code manage content of tab (possibly using $filterselect ). in above file, done other tabs, use template. for parameters of tabobject constructor, refer /htdocs/lib/weblib.php . the truth in code.

c# - Static vs member field revisited, need advice -

i need advice on piece of functionality ought implement. scenario haven httphandler servers intercept file uploads. in handler, need persist large dictionary of strings inside memory. dictionary might large 100 entries. wondering whether safe store in static variable, not initialized every time instance of handler created (there lot of instance sure). in general, approach in such scenarios. better idea use static fields, persist data not changed? 100 items in dictionary isn't big - in fact, barely getting size hashing faster linear search. if never change once initialized, static may work - try have other abstraction between static , instance - example "context" or "configuration" class can pass instances need it. can have multiple parallel configurations (if need), related instances can share context/configuration - no duplication.

c++ - How can someone define a data type, and then use it in other file that's included in the same file, right after the data type definition -

i needed asn1 ber encoder/decoder , found part of "asn1c" compiler (here's link http://lionet.info/asn1c/blog/ ). i have no problems compiling whole thing, using "configure, make, make install" procedure, seems impossible compile separately. i'm trying compile ber encoder/decoder functionality of package static library, in netbeans. however, i'm having big problems "include" nonsenses. here's example... in asn1parser.h file there's typedef of new type called "asn1c_integer_t" //some preprocessor statements removed keep post short... typedef intmax_t asn1c_integer_t; #include "asn1p_list.h" #include "asn1p_oid.h" /* object identifiers (oids) */ #include "asn1p_ref.h" /* references custom types */ etc... however, of these files included in previous file (asn1p_oid.h, example) using new data type defined in previous file. #ifndef asn1_parser_oid_h #define asn1_parser_oid_h...

ios - iPhone MKMapView: set map region to show all pins on map -

i'm trying set map region (center , span) map shows pin-annotations @ same time. i'm having trouble converting long/lat coordinates nsstring double, resp. make calculations them. here code i'm using: - (void)updatememberpins{ //calculate new region show on map double center_long = 0.0f; double center_lat = 0.0f; double max_long = 0.0f; double min_long = 0.0f; double max_lat = 0.0f; double min_lat = 0.0f; (member *member in members) { //find min , max values if ([member.loclat doublevalue] > max_lat) {max_lat = [member.loclat doublevalue];} if ([member.loclat doublevalue] < min_lat) {min_lat = [member.loclat doublevalue];} if ([member.loclong doublevalue] > max_long) {max_long = [member.loclong doublevalue];} if ([member.loclong doublevalue] < min_long) {min_long = [member.loclong doublevalue];} //sum long , lang average later center_lat = center_lat + [member.loclat doublevalue]; center_long = center_long + [member.loc...

c - My dll is exporting every function without my consent! -

i using mingw compiler , code blocks ide. facing problem in don't understand how come dll exports every function without me using __declspec(dllexport) these functions. here 2 sample files, main.h , main.cpp : main.h : #ifndef __main_h__ #define __main_h__ #include windows.h #ifdef build_dll #define dll_export __declspec(dllexport) #else #define dll_export __declspec(dllimport) #endif #ifdef __cplusplus extern "c" { #endif void somefunction(const lpcstr sometext); #ifdef __cplusplus } #endif #endif // __main_h__ main.cpp : #include "main.h" void somefunction(const lpcstr sometext) { messageboxa(0, sometext, "dll fxn message", mb_ok | mb_iconinformation); } bool flag = false; extern "c" bool winapi dllmain(hinstance hinstdll, dword fdwreason, lpvoid lpvreserved) { switch (fdwreason) { case dll_process_attach: // attach process // return false fail dll load b...

java - Need to view the thumbnail of the word Document -

if browse word file through file upload control in html, want view thumbnail of document(first page enough) image in right control..how programmatically..please suggest..thanks in advance... here's question c# , embedded solution visualbasic the problem, may need native code using com interface: the windows shell provides native com interface accessing file's preview image called iextractimage. show how access file's instance of interface c++ or visual basic .net using com interop. this, use windows shell api. provides programming interface virtual objects windows explorer displays , manages such folders, files, printers, etc. found never tried: jacob, java-com-bridge . missing link.

java - Why ArrayList grows at a rate of 1.5, but for Hashmap it's 2? -

as per sun java implementation, during expansion, arraylist grows 3/2 it's initial capacity whereas hashmap expansion rate double. reason behind this? as per implementation, hashmap, capacity should in power of two. may reason hashmap's behavior. in case question is, hashmap why capacity should in power of two? the expensive part @ increasing capacity of arraylist copying content of backing array new (larger) one. for hashmap, creating new backing array , putting map entries in new array. and, higher capacity, lower risk of collisions. more expensive , explains, why expansion factor higher. reason 1.5 vs. 2.0? consider "best practise" or "good tradeoff".

iphone - Getting location and acceleration information -

i developing iphone app in have acceleration , deceleration user moving. app work chronometer. how can latitude , longitude anh how can calculate acceleration , deceleration. sample code or information link better. have @ mapkit location. also uiaccelerometer movement edit have @ core location lets things headings , speeds using location.

web services - Send email with content without using webservice in iPhone app -

in app need send email mail id provided user predefined content. this has done internally without interaction of user i.e, user enters email id in provided textfield , clicks send button, mail content has sent mail-id. can done without using webservice. please me out in this. thanks in advance, hanu i have achieved smksmtpmessage - library allows send email attachments if required code, without user interaction required

javascript - how to hide url address in status bar? -

possible duplicate: javascript: change browser window status message when hover on link text, target link shown in status bar. how can hide link address in status bar. example, in following link: <a href="javascript:$('#fileupload2').fileuploadstart()">start upload</a> try this <a onclick="javascript:$('#fileupload2').fileuploadstart()" href="javascript:void(0)">start upload</a>` only javascript:void(0) show in browser window. james

java - What bytecode library when controlling line numbers? -

i need generate new classes (via generation of java byte code) existing classes. analyse body (expressions) of methods of class. expressions determine code generate. for me importand set source file new classes (same base java file) controlling line numbers (when exception thrown stacktrace should contain line numbers of base java file). example: have file baseclass.java . compiler generates baseclass.class this. i'd analyse class file , generate byte codes generatedclass.class . when @ c exception thrown stacktrace should contain "baseclass.java line 3". baseclass.java 1: class baseclass { 2: void method() { 3: call(); 4: } 5:} generatesclaas.class a: class generatedclass { b: void generatedmethod() { c: generatedcall(); d: } e:} my question: there libraries support requirement? javassist, asm or bcel? use purpose? hints how or example code helpfull. edit: hints library not use because requirement can not fullfiled helpfull, :)...

unix - How to get the trace of process? -

suppose there process in inactive state many days , want know until time process in active state. other log records can information? unix platform. use strace debugging utility. can attach running process, save output log file , analyse later. [root@localhost ~]# [root@localhost ~]# strace -o log -p 7166 process 7166 attached - interrupt quit

internet explorer - Is IE 6 skipped in HTTP-EQUIV compatibility modes? -

this article specifies ie 9 (edge), ie8, ie7 , ie5 valid http-equiv document modes. why ie6 skipped? render same ie5? company supports ie6+, want find reliable way test ie6 compatibility ui changes without requiring vm. the article specifies compatibility modes ie (8-9) can run in. ie5(.5) equals quirks mode . ie8 cannot run in ie6 compatibility mode. ie6 not absolutely render same ie5(.5) (unless it's in quirks mode). if want reliable way test in ie6, ie7, etc., should try ietester (which found reliable), spoon , etc. if don't want use vms. you should check so question . stated there: also, don't trust ie8 compatibility mode.

.net - XML Xpath Query -

i have been converting vb.net xml code read specific xml elements opposed attribute values, , have following line has stumped me: dim fnode xmlnodelist = x.selectnodes(string.format("tables /table /field[ @pkid='{0}' ]", fk)) my questions regarding end part, how write check elements value opposed specific attribute? specific element want check <pk> , want evaluate against fk. thanks. tables/table/field[pk='{0}'] there nothing special attributes in context - can test against value of pk element removing @ . example input xml: <tables> <table> <field> <pk>42</pk> <!-- other fields --> </field> </table...

gcc - Serious Memory Clash: Variables clashing in C -

struct message { char type; double idnum; char *time; char *asset; bool bs; float price1; int shares1; float price2; int shares2; }; typedef struct message message; struct asset { obook *orderbook; trade *tradebook; //will point latest trade int qtytraded; float valuetraded; char* time; }; typedef struct asset asset; int main(int argc, char*argv[]) { message* newmessage; asset* check; //manipulation , initialization of check, holds proper values. newmessage = parser("n,2376,01/02/2011 09:15:01.342,jpassociat futstk 24feb2011,b,84.05,2000,0,0",newmessage); // messageprocess(newmessage,assetmap); printf("last trade address %p last trade time %s\n",check->tradebook,check->time); } message* parser(char *message,message* new_message) { char a[9][256]; char* tmp ...

cakephp - cake php: correct url to action -

hay together! i have 2 urls 1 action , each should generate different views. e.g.: /abc -> connects controller x, action y, view = 0 /def -> connects controller x, action y, view = 1 this works fine with router::connect('/abc', array('controller' => 'x 'action' => 'y', 'view' => 0)); router::connect('/def', array('controller' => 'x 'action' => 'y', 'view' => 1)); but there problem: i have formular, wich should send data /def or /abc how can manually set, wich route should used?! thank help! edit: $form->create('model', array('url' => array('action' => 'index', 'view' => '1'))); // def $form->create('model', array('url' => array('action' => 'index', 'view' => '0'))); // abc both leads me /controller/index , not /def or /abc ...

sql - Find duplicates for several columns exclusive ID-column -

i've found lot of answers on how find duplicates including pk-column or without focus on this: if have table called t1, , columns c1, c2 , c3 query show duplicate values. select c1, c2, c3, count(*)as dupcount t1 group c1, c2, c3 having count(*) > 1 but more common requirement id of duplicates have equal c1,c2,c3 values. so need following doesn't work because id must aggregated: select id t1 group c1, c2, c3 having count(*) <> 1 (the id of duplicates must different columns must equal) edit : thank all. i'm suprised how fast people give excellent answers on stackoverflow! there lot of versions suggested here think came new one. select * @t t1 exists (select * @t t2 t1.id <> t2.id , t1.c1 = t2.c1 , t1.c2 = t2.c2 , t1.c3 = t2.c3)

string - using switch block in java instead of multiple if statements -

public class { public void search(boolean[] searchlist) { // searchlist array used identify options search in given order // e.g. boolean [] searchlist = new boolean [] {false, false, true, false}; boolean searchl = false; boolean searchm = false; boolean searchk = false; boolean searcha = false; if(searchlist[0] == true) searchl = true; if(searchlist[1] == true) searchm = true; if(searchlist[2] == true) searchk = true; if(searchlist[3] == true) searcha = true; if(searchl == true) // write query search ls if(searchm == true) // write query search ms ........... } is there way can simplify code ? @all : sorry posting wrong question before. confused! thanks, sony public class { public enum searchoption { search_l, search_m, search_a, search_k; } /** * make them pass in enum search. * pros: type safe, can use selections give * cons: must add enum add new ty...

A grammar question about c++ -

binarytree* sortedlisttobst(listnode *& list, int start, int end) { if (start > end) return null; // same (start+end)/2, avoids overflow int mid = start + (end - start) / 2; binarytree *leftchild = sortedlisttobst(list, start, mid-1); binarytree *parent = new binarytree(list->data); parent->left = leftchild; list = list->next; parent->right = sortedlisttobst(list, mid+1, end); return parent; } binarytree* sortedlisttobst(listnode *head, int n) { return sortedlisttobst(head, 0, n-1); } this function transferring sorted list bst.. don't understand in 1st line. why " listnode *& "... if " listnode* " why wrong? thank explanation. thanks. 1 more question.. if "listnode &list" must wrong, why need "*" also,.. amateur of c++ forgive me stupid question this reference pointer. changes make listnode (making point @ else) affect variable passed function. if remove this, recursive calls,...