Posts

Showing posts from August, 2014

What's the purpose of the command in mongodb? -

i new mongodb , have following query follows "db.runcommand( { addshard : "sf103", maxsize:100000 } );" why using sf103 if use command in environment getting following errors>>> db.runcommand( { addshard : "sf103", maxsize:100000 } ); { "ok" : 0, "errmsg" : "couldn't connect new shard dbconnectionpool: connect failed sf103 : " } > here, sf103 represents what???? please me....... advance thanks, kumar. addshard takes first parameter "serverhostname[:port]". sf103 example host name specified. mongo host want add cluster. please read doc understand how configure mongo cluster. mongo sharded cluster config --sai

legacy - When is it time to port an old application to new platform? -

i'm working company has established application written in vb6. application stable , continues provide company income. however, beginning show age , noises been made port more modern platform such .net. since hardly ever cut , dry decision appreciate input on when time port long standing application modern platform. some of pros , cons have worked through: in favor of porting finding skills old programming language becomes harder , more expensive support platform vendor ends @ point leveraging modern programming practises on old platform becomes harder or impossible rewriting provides opportunity improve existing practises moving modern platform motivating development team moving modern platform provides marketing opportunities against porting "if not broken don't fix it" the cost of rewriting versus return risks associated transition old new application upskilling existing software engineers some related stackoverflow questions: what ...

javascript - jquery dropdown menu opens repeatedly upon hover -

i've got bit of problem jquery menu. works fine, if hover on buttons 3 or 4 times, menu expand 3 or 4 times repetitively, , can wait quit. can please tell me how stop this? here's javascript i'm using: <script type="text/javascript"> $(function () { $('#dropmenu .level1 .submenu.submenu').hover(function() { $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).hide(1000); $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).show(1000); }, function() { $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).show(1000); $(this).find('ul.level2,.level3 li,.level4 li,.level5 li,.level6 li').stop(true, true).hide(1000); });}); </script> any insight appreciated. thanks hey robert, hate when simple hover action unexpected results. on time i've developed few methods resolving flicking of element...

localization - Find the flow direction from CurrentCulture in c# -

hi there way flowdirection current culture. i have set property public string flowdirection { { return // should return flow direction using thread.currentthread.currentuiculture. } } i dont want hardcode like if (currentlanguage.tolower().startswith("ar")) { return flowdirection.righttoleft; } else { return flowdirection.lefttoright; } use this: cultureinfo.textinfo.isrighttoleft taken related question

r - Apply a function to each data frame -

i have 4 data frames contain date column, price column , return column. data.1: date price return 2009-01-02 100 0.2 2009-01-03 110 0.1 etc. data.2: date price return 2009-02-02 60 0.15 2009-02-03 50 -0.1 etc. i set loop , apply function density() each data frame, returning density values returns. i through creating list, setting loop , using lapply() this, so > ff <- list(data.1, data.2, data.3, data.4) > for(i in 1:length(ff){ density[[i]] <- lapply(ff, density(ff[[i]]$return))} but doesn't work. offer me help? thanks in advance - dani first, should initialize density if want manual assignment. densities <- list() second, use density function in funny way. should specify function different in lapply. either give function , arguments after comma, or construct own custom little function in lapply call, shown below. data.1 <- data.frame( x1 = letters[1:10], x2 = 1:10 ) data.2 <...

How to disable certain console warnings in Qt -

on paint events, qt outputs several warnings in console: "qpainter::begin: painter active" i disable particular warning because clutters output window , i'm not planning fix it. how can that? the way remove qt sources , recompile them. easier , reliable fix cause. p. s. actually, noted in other answer, possible install msg handler , filter out particular message calling strcmp(), that's both ugly , not reliable - if message altered in future version, start appearing again.

OpenGL ES Learning - some question about rotating -

hy there! new opengl es, saw many examples in net, have question rotations. how can double rotating @ 1 time? need rotate object on center, , @ same time, need rotate object on circle, has center point, in space. the second thing: i create code: glloadidentity... gltranslatef 0,0,0.. glrotatef... drawsomeobject... glloadidentity... gltranslatef 0,3,0.. glrotatef... drawsomeobject... it good, code can rotate drawing objects on it's own center. how can rotate or translate objects group? so this: //translate, , rotate in group1 gltranslatef 0,0,0.. glrotatef... group1 glloadidentity... gltranslatef 0,0,0.. glrotatef... drawsomeobject... glloadidentity... gltranslatef 0,3,0.. glrotatef... drawsomeobject... end group1 //translate, , rotate in group1 gltranslatef 2,0,0.. glrotatef... group2 glloadidentity... gltranslatef 0,0,0.. glrotatef... drawsomeobject... glloadidentity... gltranslatef 0,3,0.. glrotatef... drawsomeobject... end group2 apply...

javascript - Better way than MD5? -

i'm wondering there quicker, more efficent way of comparing 2 text files check equality comparing md5 of 2 files? i'm using javascript. if have calculate md5 of files each time this, might check lengths same, compare them byte byte. calculating md5 (or other hash) means running through whole file anyway. pseudocode: bool filesaresame(file1, file2) { if (file1.length != file2.length) return false; (int i=0;i<file1.length;i++) { if (file1[i] != file2[i]) return false; } return true; }

java - Best Mock object framework for EJB junit tests -

which mocking framework preferred testing ejb's (specifically message driven beans), i'm looking @ mockobjects , easymock , mockejb , mockito open all. i've not used mocking framework before , particularly interested in low learning curve / great getting started guide. i should clarify, using ejb 2. it's not mocking framework, might have @ openejb , lightweight ejb container suitable for, amongst other things, use in unit tests. save having mock container's interfaces, , can still mock interfaces other components.

Android - Service variable access -

i implementing application in android needs access location object. running logistics object in object. afterwards binding activity service, servicegps.java, service , location update seems works ok, problem cant not access location object inside servicegps. the connection service defined update global variable in activity class private serviceconnection mconnection = new serviceconnection() { @override public void onserviceconnected(componentname classname, ibinder service) { @suppresswarnings("unchecked") servicegps mservice = ((localbinder<servicegps>)service).getservice(); // hold of resource, db etc , pass through object use mlocationmanager = mservice.getmlocation(); } @override public void onservicedisconnected(componentname arg0) { // todo auto-generated method stub } }; if debug code, mlocationmanager recibes correct values. want access mservice.getml...

Has anyone developed a front end for ELMAH? -

the default web interface fine exception logging, using general logging , need other people able examine logs. thinking else may have developed front end it. i ran asp.net exception reporter (based on elmah) project on codeplex. they've built ui elmah organizes type of error.

c# - Passing strongly typed arguments in .NET COM interop -

i have 2 .net classes exposed via com interop - let's foo , bar, , need pass argument of type foo method defined in bar. this: [comvisible(true)] public class foo { // whatever } [comvisible(true)] public class bar { public void method(foo fff) { // fff } } when run following vbs (using cscript.exe): set foo = createobject("testcsproject.foo") set bar = createobject("testcsproject.bar") call bar.method(foo) i error: d:\test.vbs(3, 1) microsoft vbscript runtime error: invalid procedure call or argument: 'bar.method' however, if change method declaration this: public void method(object o) { foo fff = (foo)o; // fff } everything works. tried magic interfaces, attributes, etc. no luck far. any insight? many thanks make sure, define guid attribute, necessary if make queryinterface (vb probably). have generate new unique guid every comvisible class. [guid("77777777-333...

validation - Flex 4 create validator that allows only letters and dashes? -

how can create validator allows letters dashes input? thanks in advance edit this have far.. if write test passes , if write 123 fails if write test123 passes don't want edit the validator works wanted. :) override protected function dovalidation(value:object):array { results = []; var regex:regexp = /^[a-za-z _-]*[a-za-z][a-za-z _-]*$/; if(regex.test(value string)) { trace("passed") return results; } else { var err:validationresult = new validationresult(true,"","","only letters allowed"); results.push(err); trace("error") } return results; } ok correct re ^[a-za-z _-]*[a-za-z][a-za-z _-]*$

php - Edit content in ckeditor -

iam using ckeditor in website add content pages. i'm not able understand how content in ckeditor editing later... how load content ckeditor? iam using following code load editor: if ( !@file_exists( '../../ckeditor/ckeditor.php' ) ) { if ( @file_exists('../../ckeditor/ckeditor.js') || @file_exists('../../../ckeditor/ckeditor_source.js') ) printnotfound('ckeditor 3.1+'); else printnotfound('ckeditor'); } include_once '../../ckeditor/ckeditor.php'; include_once '../../ckfinder/ckfinder.php'; // check ckeditor class. if not defined, paths in lines 57 , 70 must checked. if (!class_exists('ckeditor')) { printnotfound('ckeditor'); } else { $ckeditor = new ckeditor(); $ckeditor->basepath = '../../ckeditor/'; $ckfinder = new ckfinder(); $ckfinder->basepath = '../../ckfinder/'; // note: basepath property in ckfinder class starts capital letter...

html - How to match a keyword on a web page that is NOT within an <a> and its href, using JavaScript? -

i'm searching page find specific keyword. easy enough. added complication don't want match keyword if part of <a> tag. e.g. <p>here example content has keyword in it. want match keyword here but, don't want match <a href="http://www.keyword.com">keyword</a> here.</p> if @ above example content, word 'keyword' appears 4 times. want match first 2 times appears paragraph, not want match when appears part of href , part of <a> content. so far i've managed use below: var tester = new regexp("((?!<a.*?>)("+keyword+")(?!</a>))", 'ig'); the problem above still matches keyword if part of href . any ideas? thanks you can't reliably javascript regexes. it's hard enough .net regex engine 1 of few support infinite-length lookbehind assertions, javascript doesn't know lookbehind assertions @ all, can't see came before text want match. so shou...

java - Creating An In-Game Web Browser on Android -

in game, i'd have kind of "message of day" feature. basically, when user taps "message of day" button in main menu, open browser view in-game. when user done, taps "close" button , view disappears, returning him game menu. so, possible create browser view dynamically? if yes, how? the following can used in dialog public void setwebview() { //webviewclient used if want capture stuff webview, if link pressed webviewclient yourwebclient = new webviewclient() { @override public boolean shouldoverrideurlloading(webview view, string url) { open_web = true; if (!url.startswith("http://") && !url.startswith("https://")) { url = "http://" + url; } intent browserintent = new intent("android.intent.action.view...

Wordpress - List all posts (with proper_pagination) -

on wordpress site i'm working on, lists posts category, after page lists posts (with pagination, showing 10 per page). how go achieving this? thanks you create new page template loop in it: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'post', 'posts_per_page' => 10, 'paged' => $paged ); $wp_query = new wp_query($args); while ( have_posts() ) : the_post(); ?> <h2><?php the_title() ?></h2> <?php endwhile; ?> <!-- pagination links --> <?php next_posts_link( '&larr; older posts', $wp_query ->max_num_pages); ?> <?php previous_posts_link( 'newer posts &rarr;' ); ?>

java - can't find run as junit test in eclipse -

i created test class in eclipse this @runwith(springjunit4classrunner.class) @contextconfiguration(locations = { "classpath:applicationcontext.xml" }) @transactionconfiguration @transactional public class teamtest extends abstracttransactionaljunit4springcontexttests { @test public void testcreate() { assert (true); }} however, when click right click on file don't see option run junit! what wrong? i using eclipse 3.6 make sure eclipse environment using junit 4. junit 3 doesn't make use of annotations (it uses old extends testcase style) there few things double check: window > preferences > java > junit are seeing junit4 or junit3 imports? if looks good, make sure project using junit4 instead of junit3. right click on project > properties > java build path > libraries is junit4 included there? junit related there? if junit3 in there, click on , click remove . click add library... , follow prompts there add ju...

actionscript 3 - Can I send more than one 'stream' of jpeg ByteArray data in a single URLRequest and output 2 images? Flash AS3 -> PHP -

i have as3 swf users can upload jpg images ec2 instances sit behind , elastic load balancer. jpg images converted bytearray data , sent using urlloader.load(urlrequest) i make 2 calls when uploading, 1 upload large version, upload thumbnail version. php script bytearray data uploaded converts file using file_put_contents($destination, $globals["http_raw_post_data"]) is possible combine these 2 requests single request contains both bytearray data large , thumbnail images , 'split' http_raw_post_data create 2 files @ server. better uploading bytearray large version using imagemagick resize resulting image thumbnail realise option. any suggestions? cheers you can try somethis this: multipart form data in as3 class version 1.2

append url with a session id jquery -

i have static session id i'm using , need add url when clicked, can't seem right. if go http://www.mysite.com/test.php redirected, session id xyx needs added, correct url hit page http://www.mysite.com/test.php?sessionid=xyx <a href="http://www.mysite.com/test.php" class="foo">link here</a> $('.foo').click(function(){ (this).append(?sessionid=xyx');' }); i know wrong, documentation ive found more complex needs. thanks! this should add session id , send user new url, use e.preventdefault stop system using normal event, add session id url , send browser there: <a href="http://www.mysite.com/test.php" class="foo">link here</a> $('.foo').click(function(e) { e.preventdefault(); window.location = $(this).attr('href') + '?sessionid=xyx'; });

xaml - Wpf disable repeatbuttons when scrolled to top/bottom -

i'm making touchscreen interface uses listbox. have button above , below listbox page up/down. i'm trying when scrolled way pageup button gets disabled. , when scrolled way down pagedown button gets disabled too. here's code in styles.xaml listbox <style x:key="{x:type listbox}" targettype="{x:type listbox}"> <setter property="template"> <setter.value> <controltemplate x:key="{x:type listbox}" targettype="{x:type listbox}"> <dockpanel> <repeatbutton x:name="lineupbutton" dockpanel.dock="top" horizontalalignment="stretch" height="50" content="/\" command="{x:static scrollbar.pageupcommand}" commandtarget="{binding elem...

javascript - Try to create HTML5 table in WebOS but failed -

i try create html5 table in webos using following javascript, table not created. can't see further detail in log other first mojo.log "try create database". 2011-01-25t15:48:50.251507z [43854] qemux86 user.notice lunasysmgr: {lunasysmgrjs}: com.palm.phonegap: info: try create database, palminitframework347:2527 do have idea? thanks.. var db; function opendb(){ var shortname = 'mcrm'; var version = '1.0'; var displayname = 'mcrm' var maxsize = 65536; db = opendatabase(shortname, version, displayname, maxsize); try { db.transaction( function(transaction) { mojo.log.info("try create database"); transaction.executesql( 'create table if not exists bookmarks' + ' (id integer not null primary key autoincrement, ' + ' resource_id integer not null ' + ' re...

sql - How do I write a query to delete duplicates in a table? -

given table resembling one, called vehicleuser: vehicleuserid | vehicleid | userid 1                     | 1001       | 2 2                     | 1001       | 2 3                     | 1001       | 2 4                     | 1001       | 3 5                     | 1001       | 3 6  ...

javascript - In jQuery, what's the proper way to "move" an element from its parent to another element? -

using jquery 1.4 , jqueryui 1.8 specifically, i'm using draggables/droppables, , when dropped, move draggable (it's children, events, etc) belonging parent element appended/added child of drop target. i know in droppable drop option, can supply following callback: function(event, ui) { // stuff } where $(this).target drop target, , ui.draggable child element move - i'm not sure proper way perform move, preserving events, etc. append() remove element , place want. $(this).target.append(ui.draggable); // or, if $(this).target not jquery object var target = $(this).target; $(target).append(ui.draggable);

language agnostic - Complexity of algorithms of different programming paradigms -

i know programming languages turing complete, wonder whether problem can resolved algorithm of same complexity programming language (and in particular programming paradigm). to make answer more explicit example: there problem can resolved imperative algorithm of complexity x (say o(n) ), cannot resolved functional algorithm same complexity (or vice versa)? edit: the algorithm can different. question complexity of solving problem -- using approach available in language. in general, no, not algorithms can implemented same order of complexity in languages. can trivially proven, instance, hypothetical language disallows o(1) access array. however, there aren't algorithms (to knowledge) cannot implemented optimal order of complexity in functional language. complexity analysis of algorithm's pseudocode makes assumptions operations legal, , operations o(1). if break 1 of assumptions, can alter complexity of algorithm's implementation though language turing ...

templates - Python dictionaries, find similarities -

i have python dictionary thousand items. each item is, itself, dictionary. i'm looking clean , elegant way parse through each item, , find & create templates. here's simplified example of individual dictionaries' structure: {'id': 1, 'template': none, 'height': 80, 'width': 120, 'length': 75, 'weight': 100} from this, want pass through once, , if, 500 of 1000 share same height , width, determine that, can build template off data, , assign template id 'template'. can build gigantic reference hash, i'm hoping there's cleaner more elegant way accomplish this. the actual data includes closer 30 keys, of small subset need excluded template checking. @eumiro had excellent core idea, namely of using itertools.groupby() arrange items common values in batches. besides neglecting sort things first using same key function @jochen ritzel pointed-out (and mentioned in documentation), didn...

jquery - ajaxFileUpload have more params than "file" -

can have more param send url: using ajaxfileupload ? im using $.ajaxfileupload() , when ajax fileupload want pass param too. im passing param called "file" file uploading in it.. settings this: url:'photo.php?mode=upload', secureuri:false, type: 'post', fileelementid:'file', datatype: 'json', success: function (data, status) tried adding data: { param : '1' } doesnt pass anything.. data: { 'id': id } ex: $.ajaxfileupload ( { url: 'samplereportedithandler.html', secureuri: false, fileelementid: 'uploadfile', data: { 'id': '100' } beforesend: function () {}, success: function (data, status) {}, error: function (data, status, e) {} } )

android - How Do I Get The Currently Running Activity In My Application? -

i have class needs access application's main activity, design outside of control cannot pass instance it. purpose dynamically create view , set activity. is there way me access main activity through static method? or there alternative? according comments above, maybe need static instance of context initialized in application/activity oncreate?

c# - Using the generic type 'System.Collections.Generic.List<T>' requires '1' type arguments -

i trying create program create vector, generate 100 random numbers (0 - 99) , ask user input whether want numbers sorted high low or low high. this code have far trying vector working. using system; using system.collections.generic; using system.collections.generic.list; //this error comes. using system.linq; using system.text; namespace system.collections.generic { class list<t> { static void main(string[] args) { list<int> vectorlist = new list<int>(); vectorlist.capacity(100); int = 100; (int x = 0; x <= 100; x++) { random rand = new random(); = rand.next(0, 100); vectorlist.add(i); console.writeline(i); } } } } except have no idea how fix issue, appreciated. it's side issue (boltclock has right), change this: list<int> vectorlist = new list<int>(); vector...

Kohana 3 ORM: Getting most repeated values, ranked, and inserting into new object / array -

so, in series of kohana 3 orm questions :) i have, essentially, pivot table, called connections . connections table connects song keyword . that's great , working (thanks last 2 questions!) i want output connected songs keyword. so, somehow query connections table , output object (with arbitrarily limited number of iterations $n ) ranks songs number of times have been connected, ie. number of times particular song_id appears particular keyword_id . i have literally no idea how achieve this, without querying every single row (!!!) , counting individual results in array.... there must more elegant way achieve this? i believe more of sql question. using db query builder: db::select('songs.*')->select(array('count("keywords.id")', 'nconnections')) ->from('songs') ->join('connections', 'left')->on('connections.song_id', '=', 'songs.id') ->join('keywords...

php - CONVERT HEADER INTO <img> -

i'd show image in page using <img> tag instead of header ( header("content-type: image/jpeg"); ). ideas? <?php $main_img = "porsche_911_996_carrera_4s.jpg"; // main big photo / picture $watermark_img = "watermark.gif"; // use gif or png, jpeg has no tranparency support $padding = 3; // distance border in pixels watermark image $opacity = 50; // image opacity transparent watermark $watermark = imagecreatefromgif($watermark_img); // create watermark $image = imagecreatefromjpeg($main_img); // create main graphic if(!$image || !$watermark) die("error: main image or watermark not loaded!"); $watermark_size = getimagesize($watermark_img); $watermark_width = $watermark_size[0]; $watermark_height = $watermark_size[1]; $image_size = getimagesize($main_img); $dest_x = $image_size[0] - $watermark_width - $padding; $dest_y = $image_size[1] - $watermark_height...

iphone - Can I check if there is a next page in browser history w/Javascript? -

here quick description: i'm using iwebkit display webpage full screen iphone app. when this, gain real estate, lose navigation buttons. can put buttons act forward/back on page , recapture capability. desirable, can put other content on same line buttons (like "home" button, , title) i'd able control display of these javascript-powered forward , buttons, depending on whether there next or previous page go to. example, if there no next page, next button can grayed out , not clickable. if cannot control how buttons displayed, clickable have no effect. may lead user-confusion. in conclusion, want know if there data can accessed tell me whether there next page in history. and, matter, previous page. reading, history.next hidden security reasons. history.forward() , history.go(1) seem useful ways transition pages, not check see if pages exist. history.length( ) tells how many pages in history, afaik can't figure in queue. is there way check whether there n...

drop down menu - ASP.NET MVC - DropDownList Validation Problem -

i've got 2 dropdownlists in form on page contain same values (a list of languages). want ensure user doesn't select same value in each of drop downs. i've tried using javascript ensure selected values aren't same, works fine form submits anyway. what's best way accomplish this? here's code view: <script type="text/javascript"> function checklanguageddl() { var form = document.getelementbyid("form0"); var sourcelangindex = form.sourcelanguage.selectedindex; var targetlangindex = form.targetlanguage.selectedindex; var strsourcelanguage = form.sourcelanguage.options[sourcelangindex].text; var strtargetlanguage = form.targetlanguage.options[targetlangindex].text; if (strsourcelanguage == strtargetlanguage) { alert("source language , target language must different!"); return; } } </script> <% html...

java - How to use the equivalent of indexof() with biginteger in VB.Net? -

i trying sum digits in large number. have gotten length of number with l = answer.bitlength() can't figure out how increament through each digit using loop. ideas? i'm using java.math.biginteger . visual studio 2005 version 2.0 i should add can't seem use <> or of simple math options biginteger i'm using. if tell me how use different biginteger more willing swap. dim answer java.math.biginteger dim sum integer = 0 dim x integer dim integer 'sets value of answer equal 1 answer = java.math.biginteger.valueof(1) 'gets 100! = 1 100 answer = answer.multiply(java.math.biginteger.valueof(i)) next 'gets length of answer dim l integer l = answer.bitlength() 'sums digits in 100! x = 0 l - 1 'need pull each character here add them next final solution summing digits. wageoghe. dim r integer dim s integer s = 0 while (answer.compareto(java.math.biginteger.valueof(0)) > 0) r = answer.mod(java.math.biginteger.valueof(10)).tostring() s...

android - Application can't be moved to SD card -

i have put following in androidmanifest.xml described in article : <application android:name="myapp" ... android:installlocation="auto"> ... </application> <uses-sdk android:minsdkversion="4" android:targetsdkversion="8" /> but move sd card remaining disabled application (other installed applications on phone can moved sd card). what's wrong it? just tried this. have line inside appliction tag. agreed doesn't work. article shows part of manifest tag like: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nbt.keypad" android:versioncode="1" android:versionname="1.0" android:installlocation="auto"> then works me.

php - How to enable javascript enhancement of phpdocs? -

the questions has all. i'm using -o html:frames:earthli not have javascript. can't seem find documentation on how enable it. example: http://manual.phpdoc.org/htmlframesconverter/dom/earthli/ if want have earthli theme javascript menus, use -o html:frames:dom/earthli just using -o html:frames:earthli doesn't it.

c++ - ‘numeric_limits’ was not declared in this scope, no matching function for call to ‘max()’ -

i compiled code @ home on mac w/ xcode , there no provblem. compile @ school g++ on linux , these errors: :‘numeric_limits’ not member of std :expected primary-expression before ‘>’ token :no matching function call ‘max()’ #include <iostream> #include <cstdlib> using namespace std; int getintegerinput(int lower, int upper) { int integer = -1; { cin >> integer; cin.clear(); cin.ignore(std::numeric_limits<streamsize>::max(), '\n'); //errors here }while (integer < lower || integer > upper); return integer; } i'm geussing maybe have include header. if take away std:: gives me similar error ‘numeric_limits’ not declared in scope you need include header file <limits> , std::numeric_limits defined. mac compiler helping out automatically including header file; however, should not rely on behavior , explicitly include header files need.

java - Native library build path variables in Eclipse -

i have shared eclipse projects use build path variable relative location jar dependencies. in build path appear variablename/subdirectory/blah.jar . developers have define 1 variable in workspace , projects build paths work. the problem of jars require "native library location" set. dlls typically in same location jar in, cannot figure out way use variablename reference dlls location. relative variable, developers should have set 1 variable instead of grinding out huge user library definition. in projects' launch configurations can (assuming java application type of run/debug config), in arguments tab, can add line in bottom textarea (vmargs) -djava.library.path=variablename/subdirectory assuming jni libs are. variablename can defined through "variables..." (either en env_var if define environment variable or redefining variable "edit...").

c# - Need to detect drop location in reference to Grid Element in WPF -

i creating grid elements dynamically onto stack panel. when object dropped on stack panel, fires event needs determine drop point in reference grid element on stackpanel. using wpf, might make answers different. for example, have following code called when object dropped onto grid element(that has been created dynamically). /*handles drop event grid item*/ private void grid_drop(object sender,drageventargs e) { object droppeddata = e.getdata(typeof(object)); //this part not important /*get grid dropped on*/ grid grid = (grid)sender; /*translate drop point in reference stack panel*/ point droppoint = this.translatepoint(e.getposition(this),stackpanel)); } here have stopped, need calculate following if droppoint above middle point of grid else if droppoint below middle point of grid why don't relative position grid, rather stack panel , compare point.y grid.actualheight/...

PHP email Validation of IBM email only, (World wide) -

i pretty new php, how validate email address have ibm domain only? valid address are: xxxxx@us.ibm.com xxxxx@in.ibm.com xxxxx@ro.ibm.com xxxxx@ibm.com the php should able accept of above. please help thanks split on @ verify regex. list($username,$domain) = explode('@',$email); if (preg_match('/ibm\.com$/',$domain)) { echo "yup it's ibm."; }

fortran - How do I set the correct compiler to use the -fastsee option -

how set correct complier use -fastsee option in fortran? error i'm getting: mod5.2.0.0: make -f makef90_5.2.0.0 gfortran -fastsse -c src_5.2.0.0/modtrn.f -o obj90_5.2.0.0/modtrn.o f951: error: unrecognized command line option "-fastsse" make: * [obj90_5.2.0.0/modtrn.o] error 1 -fastsse optimisation option of pgf (the portland group fortran compiler). executable typically called pgf90 or pgf95 . how make build use pgf instead of gfortran specific build process of application trying build. (you try make fc=pgf90 , stab in dark. better inspect makefile and/or installation docs.)

.net - Should I implement a Data Source Control for a specific use-case? -

i'm in situation have no choice use data source controls. i'm using infragistics user controls , grids rely heavily on data source controls job done. but, experience data source controls, once need down nitty gritty , insert special logic on insertions, updates , deletes, hit roadblock , end having write sql queries using , sql data source. i keep logic in code as possible. found tutorial implementing own data source controls, before delve want know. writing specific data source control particular use case leverage special logic can't done otherwise acceptable? have looked @ objectdatasource ? configure providing the names of c# methods responsible crud operations. in methods can whatever want.

php - Include File - session error -

for small comments widget. i'm trying include widget .php file @ wish- in practical way user just: <?php include "comments.php"; ?> i'm trying create admin-login-panel right widget, offer logged admin delete posts (and more other options). the problem is : have start use $_session , prevent admin having login on , on again @ each change / page-refresh. but, using sessions inside widget can see header , session warnings ...olready started... ....and on. is not option force user put pages top 'session_starts', i'd keep things simple. php- include widget. can still keep trying php sessions or should try else? in advance suggestion. alright, information have given us, problem is: php sessions uses special cookie sent in header. must perform session_start(); before other content sent browser, can set cookie in header. unfortunately, looks have start session outside of including of widget. why starting session outside of widget...

php - Make use of a "deleted" column in CakePHP -

instead of deleting row on delete want update column called "deleted" time delete happened (and maybe set "deleteduserid" column). of course, on object->find operations want exclude deleted rows. possible or crazy? you'll want use beforefind() model callback filter rows deleted=1. check $querydata['conditions'] , appending $querydata['conditions']['model.deleted'] = 0 if 'model.deleted' or 'deleted' not set. for more details, see http://book.cakephp.org/view/76/callback-methods .

javascript - Create an array and check against it -

i not sure of how this, want create array , able add new items array. since items supposed random number, when new instance created checked against rest of array , sure number has generated not in array. how accomplish this? i looked @ Å ime vidas's answer , seems work, tried shorten var arr = []; function add(a) { var n = ~~(math.random() * 100); (var = 0; < a.length; i++) { if ( a[i] === n) { a.push(n) } } } (var i=0; i<5; i++){ add(arr) } document.getelementbyid('output').innerhtml += arr; and don't understand why wouldn't work. pretty same thing, correct? var arr = []; function add(a) { var n = ~~(math.random() * 1000); !is(a, n) && a.push(n); } function is(a, n) { (var = 0; < a.length; i++) { if ( a[i] === n ) { return true; } } return false; } the add function creates random integer number between 0 , 1000, , adds array. is function checks whether n number somewhere inside...

Character '&' in XML Parsing iphone -

i using nsxmlparsing parse xml , formatting not in control from xml seems it's using utf-8 encoding, illegal character encoding error when character '&' comes picture. due have go dirty way of breaking strings , parsing. any way out? suggestions ? thanks yogurt it sounds have malformed xml. "&" start of entity in xml, e.g. &amp; or &lt; . having raw "&" doesn't match entity illegal.

flex - Whould the function be garbage collected before evaluating? -

i have function in class: private function fireitemcreated(data: bytearray): void { settimeout(function(): void { var event: itemcreatedevent = new itemcreatedevent(data); dispatchevent(event); }, 1000); } this function called dispatch item created event when image thumbnail created. but delays event on time prevent user interface freezes. , i'm guessing happen if garbage collector executes after fireitemcreated function call before timer event. closure removed or stays until executed? it can't happen. if function called settimeout called. function-object passed settimeout creates strong closure-binding linked execution context , all settimeout callback functions protected ( strongly held ) host engine (imagine there invisible var timeouts = [] can't access). wouldn't fun if timers magically swallowed evil grime captain. good question , happy coding. the issue described can happen in other languages , implementati...

sql - how to use like function in MySQL or run LIKE command in mysql when search need to more specific -

i want search in database how person have name 'i steven' i want search on user table 3 column firstname secondname lastname i want sorting them first name match comes first secondname latter , lastname last when see result. are command in mysql solve puzzle select if (firstname 'i steven%', 4, if(secondname 'i steven%', 2, if (lastname 'i steven%', 1, 0) ) ) first_name_first user firstname 'i steven%' or secondname 'i steven%' or lastname 'i steven%' order first_name_first desc;

sql - one table or many for many different but interacting events? -

i'm creating application core function tracks various data on time (blood glucose levels, insulin dosages, food intake etc) , i'm trying decide how best organize information in database. at basic within particular umbrella event, thought of having single events table fields properties might come up. may unwieldy, though, because vast majority of fields end being blank many of entires; i'm not sure if that's problem. benefit of way easier call , display events. since many of events have 'timestamp' in common, question whether belong on same table. i'm not sure makes sense have table every kind of event, because taken separately of events have 1 property other timestamp, , have co-mingle. (many types of data not come in group) some types of events have durations. comparatively rare. 1 class of events rate stays same unless rate altered or temporary override (those ones i'm worried about). simple binary tags (which planning on having linking table...

android - can't install windows usb driver - vodafone 845 -

my environment is: windows xp sp3, eclipse, available software installed using sdk manager. following android developer site's guide, write , run hello world app on android 2.3 emulator. wanted see if run app on real device - vodafone 845 (huawei u8120?) in case. here stuck 2 days trying install windows usb driver device. when connect device through usb debug setting on, windows keeps ackowledge usb mass storage. on device manager, tried update driver, selected c:\program files\android\android-sdk-windows\google-usb_driver\android_winusb.inf file. complained like: "the specified location not contain information hardware" it's because of missing manufacturer/product information (vid_12d1&pid_1031) in inf file, right? http://developer.android.com/sdk/win-usb.html site lists supported devices , says additional devices require windows drivers provided hardware manufacturer far couldn't information. i guess many developers facing issue own devices no...

c - Is there a way to, find and replace the text value between nodes of a corrupt xml file, using libxml? -

libxml, info. needed without parsing file. is there way to, find , replace text value between nodes of corrupt xml file, using libxml? in general - no. depends on how file corrupted. please clarify it.

How to get "Internet Call" Information in Android -

im working on android application in take backup of contact information , restore,i retreive information of contact, example: display name cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri,null,null, null, null) string name = cursor.getstring(cursor.getcolumnindexorthrow(contactscontract.contacts.display_name)); phone number cursor phones = getcontentresolver().query(contactscontract.commondatakinds.phone.content_uri, null,contactscontract.commondatakinds.phone.contact_id +" = "+ contactid,null, null); similary unable "internet call" value. kindly tell in class information internet call information. any in regards appreciated.and urgent dont know if best way, worked, new new android. uri uri = contactscontract.data.content_uri; string[] projection = new string[] { contactscontract.data._id, contactscontract.data.display_name, contactscontract.commondatakinds.sipaddress.sip_address, contac...