Posts

Showing posts from April, 2011

c# - Redirecting to a page using mvc -

i have first method below contained in dll. decided extend can have control on page redirect to. @ moment when pass returnurl nothing happens. page returns view entered values. ? want able redirect page resides in path /views/rental/index how can achieve that? [httppost] public virtual actionresult createaccount(createnewaccountinfo createnewaccountinfo, website website, string returnurl) { if (this._accountmanager.usernamealreadyexists(createnewaccountinfo.username)) this.modelstate.addmodelerror("createnewaccountinfo", errormessageprovider.createnewaccountinfo_username_alreadyexists); if (this.modelstate.isvalid) { this._accountmanager.createnewaccount(createnewaccountinfo); return this.redirecttoreturnurl(returnurl);

java - BigInteger/SecureRandom in jar very slow when called from Coldfusion -

i have class creates random string based on biginteger. works fine , efficient when run standalone (windows, 22ms). private securerandom random = new securerandom(); public string testme() { return new biginteger(130, random).tostring(30) } when code put library (jar) , called coldfusion (9.0.2), code hangs 1 1.5 minutes (on server, linux). code called cfc: <cfset mytest = createobject("java", "com.acme.mytest")> <cffunction name="runtest" access="public"> <cfset var value = mytest.testme()/> </cffunction> what missing? i astonished difference not noticable on windows box. there different securerandom strategies. on window using random seed based on host name, windows can wander off dns reverse lookup first time. can time out request after minute or so. i ensure have recent update of java because believe problem fixed in update of java 6. (not securerandom, first network operation

css - Scrollable dynamic content -

i building custom lightbox jquery , wondering when need scroll form responsive site. on screen sizes form grows below fold when go scroll page site behind scrolls instead. how put focus on new dynamic content scrollability? www.evoke.me click contact button after scrolling down page bit. here code working with. $('#contact').on( 'click', function(e){ e.preventdefault(); $('#modal').remove(); $('body').append('<div id="modal"></div>'); $("#modal").load('/forms/contact-form.html').hide().fadein(1000); }); #modal{ position:absolute; overflow:auto; top:0; z-index:5000; width:100%; height:100%; background:rgba(255, 255, 255, .95) url(../images/diag-pattern.png) repeat 0 0; } the problem not getting focus on dynamic content. problem content not scrollable because used position: fixed without overflow: auto . make contact form sc

jquery mobile - mmenu fixed header opens good, but closes without animation -

i'm working jquery mobile , mmenu.js jquery plugin. , i'm trying set header fixed. i've tried in 2 different ways: 1) jquery mobile option: <div data-role="header" data-theme="a" data-position="fixed"> 2) css: <div data-role="header" data-theme="a" style="position: fixed; width: 100%;"> in both cases, can open menu correctly, header animation. when close it, close without animation, header appear. thanks help!

objective c - NSDateFormatter issue involving week numbers -

on machine (regional settings united states), default "short" date format set "1/5/13" (month/day/year). in system preferences, have appended week number, "1/5/13 1". my problem code, try convert string date: nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdatestyle:nsdateformattershortstyle]; nsdate *date = [dateformatter datefromstring:@"1/5/13 1"]; nslog(@"date: %@", date); on machine, prints: date: 2000-01-01 05:00:00 +0000 that's 2000 , not close 2013 . what causing problem? i'm late discussion, , have seen number of solutions offered, see wrong them 2 incompatible date format elements being used together. original approach failed because string you're attempting date doesn't match nsdateformattershortstyle provides for. if you're going evaluate week of year, you've got use capitalized form of year; provides "week of year" kind of cal

jquery - Javascript else if statement not working -

i have following: html <div class="tab-pane" id="message"> <textarea rows="4" cols="50" id="send_message" placeholder="enter text ..."> </textarea> <a href="#message" class="btn btn-large btn-info" data-toggle="tab">ok</a> <a href="#message" class="btn btn-large btn-info" data-toggle="tab">cancel</a> javascript $('#message').click(function(){ if($("a", this).is(":contains(ok)")) { console.log("im in ok!!"); } else if($("a", this).is(":contains(cancel)")) { console.log("im in cancel!!"); } }); this works fine when hit ok button , executes expected, when hit cancel code in ok executed only. cancel code never executes! doing wrong? this element event bound to. it's always #message , t

facebook - How To Print Out A <List>Reference object in java? -

i using spring social api create facebook application. using list<reference> friends = facebook.friendoperations().getfriends(); list of friends. want print out list when prints out [org.springframework.social.facebook.api.reference@7606931d, i have tried using @override public string tostring() { return tostringbuilder.reflectiontostring(this); } but still prints out references. there anyway print out need? loop through list of references, , print each of them individually, this: for (reference friend : friends) { system.out.println(friend.getname()); }

Jackson 2.2 mixins - upgrading from 1.9 new module api -

in 1.9 code used objectmapper.getdeserializationconfig.addmixinannotations , objectmapper.getserializationconfig.addmixinannotations. in 2.2 seems no longer possible , must done via modules. correct? in module looks register mix-ins both serializer , deserialization configurations. in code upgrading there more serializer configs deserializer configs , wondering if there way duplicate configuration in 2.2. another way of stating question can add mixin's in 2.2 , specify apply serialization etc? or deserialization? i got answer on jackson forum. had not gotten reply in few days , timing running out me in scenario posted here option. my assumption 2.x dominant use case mix-ins apply both serialization , deserialization, , common method add them directly via objectmapper , or using module methods. underlying implementation changed try keep objects other mapper immutable; , unification of mix-in settings more result of (and general simplification) goal. if nee

javascript - D3.js Tree layout canvas resize -

this continuation of efforts build collapsible tree layout using d3.js. generate (multilevel) flare.json data format flat json the layout looks like: ( http://bl.ocks.org/mbostock/raw/4339083/ ) around 3k nodes , depth of nodes around 25. current size of canvas need set 8000px width , 8000px height in order nodes visible know not reasonable when number of tree levels rendered 2 or 3. furthermore, intend make code reusable other trees maybe smaller/larger in size based on data source(json file) selected. so wondering if possible resize canvas size relative positions of nodes/ number of nodes shown on screen. way, code more systematic , adaptable. i saw this: dynamically resize d3 tree layout based on number of childnodes but resizes tree, if can imagine in case of tree around 3k nodes, makes hard read , comprehend. i know might not related d3.js tagged explain issue , bring in d3 experts might have faced similar condition. i attempting filter out uninformative nodes

recursion - Javascript 'this' overwriting in Z combinator and every other recursive function -

background: i have recursive function implemented z-combinator shown here , here makes no use of arguments.callee since deprecated in upcoming es6 . issue the main issue z-combinator , recursive anonymous functions i've seen far updates de this value inner function scope (the self-returned @ return clause), this references top level lost, , want maintain through inner functions. is there way maintain top level this without passing additional function argument, obvious way rid of issue not clean want? edit: right solve issue passing top this reference z-combinator this: co.utilities.z(this.createhtmlfromlom)(this.lom, this); in recursive function return same function passing top value this: function createhtmlfromlom(callee:any, lom_section:lom, self:any):void { /* other code. */ return callee(lom_section.children[widget], self); } this z-combinator definition: function z(func:any):any { var f = function () { return f

java - Sending Multiple Intents from a Single Activity to Another Activity -

i new android, , trying send user-inputted data (their names) activity. have in past been able send single lines between activities using intents, have not been able work out how send 2 different strings 2 different textviews. here code mainactivity far: package com.example.game; import android.content.intent; import android.os.bundle; import android.app.activity; import android.view.menu; import android.widget.button; import android.widget.edittext; import android.view.view; import android.widget.autocompletetextview; public class mainactivity extends activity { public final static string extra_message = "com.example.myfirstapp.message"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button button = (button)findviewbyid(r.id.button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { s

r - adding and removing grid lines from a lattice histogram -

i have following code, creates histogram: inst <- data.frame(c(10:27),c(76,97,128,135,137,141,110,94,67,44,39,26,19,12,7,5,2,1)) names(inst) <- c("instsize","noofinst") library(lattice) trellis.par.set(theme = col.whitebg()) myplot <- xyplot(noofinst ~ instsize, data = inst, type = c("h", "g"), col = "blue", xlab = "instance size (number of aircraft)", ylab = "number of instances", scales=list( y=list( at=seq(0,150,10), labels=seq(0,150,10) ), x=list( at=seq(10,27,1), labels=seq(10,27,1) ) ) ) i add grid lines every tick in y axis , remove of vertical grid lines. possible? thanks myplot <- xyplot(noofinst ~ instsize, data = inst, type = "h", col = "blue", xl

Ideal Java Data Structure for Streaming data to QT Creator -

does knows, best way stream data (like strings, int, reals, ....) betweem java app , qt app. try qt:qdatastream , java:dataoutputsttream, theres difference in byte arrays. can me?? thanks... use xml or json both languages using same standard. in json should able encapsulate byte arrays , other types you've mentioned easily. if you're using qt 5 can simple use qjsondocument::fromrawdata . otherwise can find libraries both java , qt in json.org .

tomcat7 - External web app location does not create directory under webapps in Tomcat -

so far have been using tomcat 6 specify war deployed in context.xml file under $catalina_home/conf/catalina/localhost application1-context.xml, application2-context.xml. etc. example application1-context.xml <context path="/myapps/app1" docbase="c:\warfiles\appone.war" debug="0" privileged="true"> <loader classname="mycustomapplicationloader"/> <logger classname="org.apache.catalina.logger.systemoutlogger" verbosity="4" timestamp="true"/> </context> this create folder myapps#app1 under $catalina_home/webapps folder. but since migrating tomcat7, not happen more. unless have war file "appone.war" directly under tomcat appbase directory i.e. $catalina_home/webapps war not unpacked folder under $catalina_home/webapps directory. i have read apache bug report: https://issues.apache.org/bugzilla/show_bug.cgi?id=51294&quot%

c# - OpenOfficeXML and HTML written to spreadsheet's cells -

i have been trying write html content excel spreadsheet's cells using excelpackage openofficexml , c#. i getting errors stating input string has invalid token. has came across similar? saving html directly in excel works ok. i not want use html encoding content has in readable form. without knowing more of specifics: if you're using xml create spreadsheet, should use cdata tags html content <someentry> <![cdata[ html here ]]> </someentry> in c# can add cdata. type of element. xmlcdatasection cdata; cdata = doc.createcdatasection("<somenodename><h1>blah</h1></somenodename>"); xmlelement root = doc.documentelement; root.appendchild(cdata); otherwise, need escape quotes , double quotes \" \' or can use system.security.securityelement.escape() encode both single , double quotes.

pattern matching - Scala mutable collections and "Reference must be prefixed warnings" -

i have use mutable linked list specific use case. i'd avoid "reference must prefixed" warnings. aliasing import seems solution: import scala.collection.mutable.{linkedlist => mutablelinkedlist} it works on cases except in pattern matching empty linkedlist, still produces warning: case mutablelinkedlist() => // the way can remove warning seems to qualified case check on empty list: case scala.collection.mutable.linkedlist() => // why first case not rid of warning? just import mutable package: import collection.mutable and use mutable collection: mutable.linkedlist(1, 2, 3) or if prefer more concise variant: import collection.{mutable => m} m.linkedlist(1, 2, 3) it work pattern matching also.

javascript - Display full sized image on <img> hover? -

i have <img> in mvc 4 razor display template, , i'd display tooltip containing full sized image when user hovers on image. html: <img height="50" width="50" src="@model.imagestring" /> @model.imagestring contains image data string, looks this: "data:image/*;base64," + convert.tobase64string(file.data) if couldn't guess, file.data byte[] . how can display full-sized tooltip upon hovering <img> ? here quick example: http://jsfiddle.net/bgn96/ this along lines of shan robertson suggesting. var $tooltip = $('#fullsize'); $('img').on('mouseenter', function() { var img = this, $img = $(img), offset = $img.offset(); $tooltip .css({ 'top': offset.top, 'left': offset.left }) .append($img.clone()) .removeclass('hidden'); }); $tooltip.on('mouseleave', function() { $tooltip.empty().ad

r - Improving on a visual fitting process for fecundity data -

i can find little information out there on subject, wish fit pearson curves fecundity data. data , solution below lifted book (applied demography biologists, carey 1993). wish automate process using maximum likelihood, apply goodness of fit tests. purely visual/ trial , error exercise fitting curve data. i've not had success pearsonds package or other methods such fitdist. #par(mar=c(5,5,3,4),cex=1.2) ###taken carey 1993,egg/fem/day egg=c(0,0,0,2.32,17.82,36.34,80.77,68.49,75.00,82.12,75.16,65.20,56.04,43.28,53.52,49.50,27.85,37.62,28.53,30.34,29.57,48.17,27.25,25.37,28.66,13.00,17.13,8,12.70,10.25,4) ##vector days,x d=seq(from=0,to=length(med)-1) ###parameters pearson function a1=.55 a2=34 m1=1.46 m2=3 ##the pearson function y=2.8 peari=function(pearson) { y*((1+d/a1)^m1)*((1-d/a2)^m2) } pr2=(peari(egg)) ## plot(egg,main=expression(bold( paste("pearson type function fitted ", m[x]))), xlab="age (days)",ylab="

.htaccess - Redirect for wordpress permalink -

i'm trying change wordpress permalink structure in .htaccess /%postname%/ /%category%/%postname%/ suggestions? yup ditto prix said. wordpress permalink structure rewriting done internally php code. rewriting done in root .htaccess file, permalink structures handled internally wordpress. when save wordpress permalinks .htaccess file automatically created in website root folder. internal permalink structure rewriting done wordpress relies on root .htaccess file in order correctly perform rewriting. permalink structure tags not used in .htaccess code or files , internal rewriting feature of wordpress. or in other words, permalink structure tags not used in .htaccess code or files.

java - Does Sonar's complexity metric include equals() and hashCode() methods -

when sonar calculates cyclomatic complexity equals() , hashcode() methods included? if there way exclude them? yes, every method used compute overall complexity of enclosing class. i guess understand why you're asking such question: modern ides generate #equals() , #hashcode() methods you, , generated method tend quite complex. however, part of code, , add complexity: should tested - other method, prevent regression.

opencv - number recognition in photography -

i want recognize number photograpny, specific photo of men number attached on body - let's marathon runner starting number on chest. i've tried tesseract it's simple ocr tool reads text. my idea use opencv detect people on photo, focus on parts number can placed (like chest), more transformation - increase contrast, recognize rectangles, , try read number ocr. i'm starting photo recognition, please tell me sound reasonable ? or maybe there tool task ? yes possible. did in-depth analysis of marathon runner bibs 1 of our users. combination of how images taken, image preparation before ocr, segmentation remove false positives (logos, brands, banners, etc.), , powerful ocr software capable of reading less perfect images , patterns. see analysis report of task here in www.ocr-it.com blog post: http://www.ocr-it.com/user-scenario-process-digital-camera-pictures-and-ocr-to-extract-specific-numbers

PHP foreach with conditional -

<? foreach ($cases $case) :?> <? if (isset($case['case_status']) && ($case['case_status'] == 'incomplete')) :?> <div> <div class="alert alert-error"> <?= $warning ?> </div> i'm trying have foreach print out div once if condition met. problem is, every case meets condition div printed. i have tried using in_array, don't think understand syntax. in_array correct? there better way this? you can use flag mark, have printed div , add condition if: <? $flag = false; foreach ($cases $case) :?> <? if (isset($case['case_status']) && ($case['case_status'] == 'incomplete') && ($flag == false)) :?> <div> <div class="alert alert-error"> <?= $warning ?> </div> <?php $flag = true; ?> or if don't need in loop, can break after first encounte

Android device keeps disconnecting from adb / eclipse -

so i've read every stack overflow answer issue, still no solution. device keeps getting disconnected. i've switched through 12 wires, i've tried every usb port; nothing. eclipse keeps dropping connection. happens when enter debug mode. has found solution this? bug in new update? seriously, makes debugging , testing painful. slows down testing @ least 3 times. there has better solution. i experience when nexus7 2012 kept disconnecting; root cause usb3 connection. changing usb2 port fixed issues; can try switching lower speed port?

Text opacity in CSS -

is there way treat text inside of wordpress widget, make semi transparent using opacity funcion? limiting myself content of following code block. #content .widget .caption h3 { color:#000000; font-family:'overlock'; margin:0 -10px; padding:0 10px; font-size:27px; height:46px; line-height:46px; font-weight:bold; } with option below, entire widget treated transparent. #content .widget .caption h3 { color:#000000; font-family:'overlock'; margin:0 -10px; padding:0 10px; font-size:27px; height:46px; line-height:46px; font-weight:bold; opacity:0.2; } i want have opacity changed. possible way? you can use rgba color attribute this: color: rgba(0,0,0,0.5); the 0.5 @ end specifiies 50% opacity. apply text, , not containing element. you've got watch browser compatibility

sql - Validating Multiple Logins in vb6 -

how can code in vb6 capture exact login time of employees in system. my system daily time records. each employee has login schedule 8:00am - timeinam, 12:00pm - timeoutam, 1:00pm - timeinpm, 5:00pm timeoutpm i want time of employees , compute lates , undertime based login time , login schedule. i'm concern employees has multiple logins in every session. how manage know if belong timeinam,timeoutam,timeinpm,or timeoutpm. the structure of table have these breaktime fields in every session. here's how look: empid | timeinam | breakoutam | breakinam | timeoutam | timeinpm | breakoutpm | breakinpm timeoutpm | late | undertime | date | sql database. any 1 me , glad. im working month now., example of scenarios empid=0001 date=08-13-2013 8:00am - timeinam, 12:00pm - timeoutam, 1:00pm - timeinpm, 5:00pm timeoutpm on date login morning session 2times 7:57:23 7:58:10 //it happens when thinks didn't login. time in again he logout in morning @ 12:

visual studio 2010 - After getting asp.net project from VS team server: references don't work? -

i downloaded asp.net project work's team server , seems bunch of references aren't working. if go references folder in solution explorer many of them have little yellow caution sign next them , if click on 1 them says "this project cannot viewed in object browser ". can't find them in add references library either. how can correct this? most of them asp.net, dononotopenauth or similar web refs thanks it sounds added reference path doesn't exist on system.if right-click 1 of missing references , choose properties popup menu able see path has been set reference , verify if case. if team not doing it, recommend copying third-party dlls central folder under source control e.g. /lib , add references there ensure there no path discrepancies in future.

php - Update image src with input field.? -

three url input fields. <input type="url" name="image1"/> <input type="url" name="image2"/> <input type="url" name="image3"/> and 3 images tag. <img src="image link first input"/> <img src="image link second input"/> <img src="image link third input"/> can php.?and use condition example if want change 1 image src other src code not change mean update 1 image. the simple way: <img src="image link first input"/> becomes <img src="<php echo $_get['image1']]?>"/> assumes form uses get

jquery - Click anywhere closes MagnificPopup ajax box -

whenever i'm trying fill login form (which magnific pop ajax box) gets closed in first instance of click. main.html $(document).ready(function() { $('.ajax-popup-link').magnificpopup({ type: 'ajax', aligntop: false, overflowy: 'scroll' }); }); <a class="simple-ajax-popup-align-top" href="result.php">try me</a><br> result.php <div> <form action="..." method="post"> email: <label class="field_container"> password: <input type='text' name='cust_username' id='username' maxlength="12" style="width: 250px; height: 30px" /></label> <label class="field_container"> password: <input type='password' name='cust_password' id='password' maxle

Using all Heroku's features through a browser? -

is possible developer set , manage features heroku provides nothing web browser? for example, can make use of (including "addons") has heroku cli command if don't have access box? ...once again... purpose of op, have web browser! as pointed out in comments, don't need access linux or os x use heroku cli. if you're on windows, download , use that . the heroku dashboard complete , can app management tasks there. if don't want use git command line when pushing code heroku, can use gui git tooling in visual studio or github windows .

javascript - jQuery Smooth Scroll to any Anchor -

this question has answer here: jquery scroll element 22 answers i have tried many different codes smooth scroll anchors. can't find 1 works. needs able scroll vertically, horizontally, , diagonally. problem find others don't seem work multiple targets. want able scroll anchor on page without having edit script. fiddle this code matches closest, cant work: var $root = $('html, body'); $('a').click(function () { $root.animate({ scrollleft: $($.attr(this, 'href')).offset().left, scrolltop: $($.attr(this, 'href')).offset().top }, 500); return false; }); it works in jsfiddle when put on page doesn't why not duplicate? multi-direction script doesn't target single elements. applies links on page. i can't jsfiddle work, see if works: $(function(){ $('a').on({

jquery - Maintain divs visibility when hovering if div is not a child element of triggering element -

i have simple hover on script: $('#loginbutton').hover( function () { $('#loginform').stop().fadein('fast'); }, function () { $('#loginform').stop().fadeout('fast'); } ); unfortunately, #loginform not child of #loginbutton , though both divs overlap. is there way can maintain #loginform s visibility if mouse leaves #loginbutton , moves on #loginform ? fiddle: http://jsfiddle.net/p4sxh/ a bit hacky think got it: http://jsfiddle.net/p4sxh/2/ $('#loginform').hover( function () { $('#loginform').stop().fadein('fast'); }, function () { $('#loginform').stop().fadeout('fast'); } ); $('#loginbutton').hover( function () { $('#loginform').stop().fadein('fast'); }, function () { $('#loginform').stop().fadeout('fast'); } );

How to handle large datatables c# and update database -

good day. i asking bit of advise on other experience has been , pitfalls ect. sql developer needing write front end using c#. i returning query mssql database via stored procedure , putting datatable. there 140k rows in result set. using standard calls datareader return resultset. no binding. what return parts of datatable datagrid on form , allow user manipulate data in grid , save datatable collect next part of datatable , manipulate that. don't want to pull things datatable in segments need update calculations on entire datatable when change made. and save changes database, when done. if can point me best , efficient way appreciated. thank in advance scott

c# - ajax updatetargetid with mvc partial views not rendering properly -

i have view contains tab layout, each tab contains form submitting through ajax.beginform. if modelstate not valid return view cannot work out how render view properly. when submit 1 of forms renders whole page again within tab, don't want. thought using ajax updatetargetid render div needs replacing, said renders whole page within tab. view @model trakman_portal_administration.models.vehlist @using trakman_portal_administration.models <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> @*<script src="@url.content("~/scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>*@ <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function () { $("#tabs").tabs(); }); </script> @{ viewbag.title = "edit"; } <div class="editbanner&q

merge - How to update my local repo using git pull without pushing -

i have local branch haven't done changes. do git checkout anotherbranch # switched branch 'anotherbranch' # branch behind 'origin/anotherbranch' 25 commits, , can fast-forwarded. # (use "git pull" update local branch) so apparantly need pull latest changes. this git pull origin anotherbranch i expect in sync, isn't because git status on branch anotherbranch branch ahead of 'origin/anotherbranch' 2 commits. (use "git push" publish local commits) nothing commit, working directory clean is because merge part of git pull added 2 commits? these commits not show when git log. instead on top 2 commits made author. feels wrong me push 2 commits. don't want push @ update local branch. how can this? in case git pull mistake how can revert without producing alternative realities or other git horrors (i haven't pushed anything, except on feature branch) git status on branch anotherbranch branch ahead of 'orig

c++ - Auto detect resolution of preview pin - Directshow -

i have graph displays preview of capture card (avermedia hd dvr pci) window connected ps3 via components. know if there simple way of detecting when resolution of source changes. for example, ps3, menu displayed @ 1920x1080 (1080i) , when enter game, game changes 1280x720 (720p). set resolution using iamstreamconfig , am_media_type need know when switch resolution. if stay @ 1080i, image 1/4 of entire rectangle showing bad experience. would solution creating filter , reading bytes of image detect if there data there? thanks in advance.

c# - Why am I getting exception Directory Is Not empty? -

this question has answer here: cannot delete directory directory.delete(path, true) 27 answers i have line: directory.delete(outputfiles, true); if set true should delete subdirectories , files. checked directory empty deleted next time. before exception in directory had 4 subdirectories , in 1 of them had zip file of 7 mb size. system.io.ioexception unhandled hresult=-2147024751 message=the directory not empty. source=mscorlib stacktrace: @ system.io.directory.deletehelper(string fullpath, string userpath, boolean recursive, boolean throwontopleveldirectorynotfound) @ system.io.directory.delete(string fullpath, string userpath, boolean recursive, boolean checkhost) @ diagnostic_tool_blue_screen.createdirectories.createdirectoriesatconstructor() in d:\c-sharp\diagnostic tool blue screen\diagnostic tool blue screen\diagnostic tool

c# - Setting an ItemTemplate property in RunTime -

i trying display small progress bar in gridview within asp.net application. trying itemtemplate. <itemtemplate> <table width="100%"> <tr> <td style="width: 75%; background-color: red"></td> <td style="width: 25%; background-color: green" ></td> </tr> </table> </itemtemplate> i want set width percentage based on calculation of values within row. can done somehow eval? or need code behind? you can try following approach (sample calculation below): <td style='<%# string.format("width: {0}%; background-color: red", (int)eval("width") / 100) %>'></td> but readability

java - Proxying 3rd party GUI -

my issue following: need incorporate gui of 3rd party product gui of product , need remove of 3rd party gui components on fly. thought using iframe, can't see how can utilized modification of embedded page. there libraries me or way write proxy scratch? thanks, mikhail you try use tool changes pages in browser on-the-fly, example greasemonkey . another approach use use scraping library, jsoup ( others , comparison ).

android - Phonegap check internet connection -

how can check internet connection in cordova 3.0 build? because tried function ondeviceready(){ checkconnection(); alert(navigator.connection.type); } but returns 0. i heard jquery mobile don't know how use because tried function checkconnection(){ alert(navigator.online);} with jquery mobile library loaded returns true. this happening on smartphone , on avd too. can me? you can check connection this: function checkconnection() { if( !navigator.network ) { // set parent windows navigator network object child window navigator.network = window.top.navigator.network; } // return type of connection found return ( (navigator.network.connection.type === "none" || navigator.network.connection.type === null || navigator.network.connection.type === "unknown" ) ? false : true ); } returns true connection , false no connectivity. in android manifest, use following permission: <use

oracle - Comparing two tables for different columns PL SQL -

i new pl sql , have encountered problem. not hard solve , i'm going wrong. problem this: have 2 tables different amount of columns. need run check see different columns , add them 1 of tables. example: table 1 has 1 column called name. table 2 has 2 columns called name , id. (name has same data type in both tables) in case, need run script check table 1 , 2, see table 1 missing 'id' column , add table 1. is possible? so far have this: select table_name, column_name user_tab_columns table_name = 'test_tbl' or table_name ='test_tbl1' which returns columns both tables. have looked everywhere on internet no luck @ all. have tried intersect , join no luck. if has or point me in right direction appreciate much! to different columns select table_name, column_name user_tab_columns table_name = 'table1' , column_name not in ( select column_name user_tab_columns table_name='table2') union select table_name,

c# - Incorrect Request.Browser.MinorVersion for Safari 5.1.2 -

asp.net web application, os: windows 7, browser: safari 5.1.2 (7534.52.7) in server-side code request.browser.minorversion gives me value of 1.0 can please tell me reason, why? the version in fallowing format major.minor.revision.build. according major 5 , minor 1. can see here latest version of safari windows 5.1: http://en.wikipedia.org/wiki/safari_version_history

CakePHP plugin loading fails because of wrong path -

i encountered strange problem when trying webtechnick's facebook plugin work cakephp: error: facebook.connectcomponent not found. error: create class connectcomponent below in file: /home/$user/www/cakephp-project/plugin/facebook//controller/component/connectcomponent.php so can't find file because of wrong path. plugin/facebook//controller/andsoon... what problem here? followed instructions , haven't found typos. edit: from appcontroller.php public $components = array('facebook.connect'); from bookscontroller.php public $helpers = array('facebook.facebook'); from bootstrap.php cakeplugin::load('facebook'); i use cakephp 2.3.8. have config/facebook.php-file not important in context.

error when I translate installed modules in Prestashop -

when want translate installed modules in prestashop show me following error warning: file_put_contents(/themes/leoshoes/modules/blockadvertising/fr.php): failed open stream: permission denied in /controllers/admin/admintranslationscontroller.php on line 654 i use prestashop 1.5.0.17 you missing appropriate permissions on file/folder. - check directory /themes/leoshoes/modules/blockadvertising/ exists , set permissions 777 (read, write, execute). - if file /themes/leoshoes/modules/blockadvertising/fr.php exists set permissions 777. if cannot change permissions, maybe can try removing file.

ant conditional if within a macrodef -

within ant, have macrodef. assuming have use macrodef, , there item inside said macrodef want run iff property special.property exists , true, do? i have <macrodef name="somename"> <sequential> <somemacrodefthatsetstheproerty /> <some:thingherethatdependson if="special.property" /> <sequential> </macrodef> which doesn't work - some:thingherethatdependson doesnt have "if" attribute, , cannot add 1 it. antcontrib not available. with target can give target "if", can macrodef? in ant 1.9.1 , higher, there new implementation of if , unless attributes . might you're thinking of. first, need put them namespace . add them <project> header: <project name="myproject" basedir="." default="package" xmlns:if="ant:if" xmlns:unless="ant:unless"> now, can add them ant task or sub entity: &l

java - Trying to use Button to insert TextField into database -

Image
i trying use button insert multiple textfield's database. able insert raw strings database via: have made few changes after suggestions. public class dataentry extends mysqlclass { static label jnaam = new label("naam"); static textfield lnaam = new textfield(30); static label jemail =new label("e-mail"); static textfield lemail=new textfield(30); static label jadres =new label("adres"); static textfield ladres =new textfield(30); static label jplaats =new label("plaats"); static textfield lplaats =new textfield(100); static label jpostcode =new label("postcode"); static textfield lpostcode =new textfield(6); static label jtelefoon =new label("telefoon");static textfield ltelefoon =new textfield(13); static label jbedrijfsnaam =new label("bedrijfsnaam"); static textfield lbedrijfsnaam =new textfield(30); public static void main(string[] args) throws exception {

merge - How to connect two pandas data frames from right and left? -

is there way following in more elegant way (i.e. fewer commands): df_1 = pandas.dataframe({'col1':[1,2,3], 'col2':[10,20,30]}) df_2 = pandas.dataframe({'col3':[100,200,300], 'col4':[1000,2000,3000]}) col in ['col3','col4']: df_1[col] = df_2[col] print df_1 you can use concat in [407]: pd.concat([df_1, df_2], axis=1) out[407]: col1 col2 col3 col4 0 1 10 100 1000 1 2 20 200 2000 2 3 30 300 3000

function - SQL: How to return MAX and MIN in one row? -

Image
i want last cost latest costing date , minimum cost products. when use query below, giving me max date , min cost each column. please see screenshots below. select max(costingdate) latestdate, min(cost) minprice, outletcode, productid accountscosting outletcode = 'c&t01' group outletcode, productid result: e.g - productid: 200006 select * accountscosting productid = 200006 , outletcode = 'c&t01' order costingdate desc what want last costing date minimum cost (the 1 highlighted red color). if purchase date same 2013-03-20 , should return minimum cost. how can edit query result? appreciated! first need latest date can find minimum cost them. e.g. select a.outletcode, a.productid, latestdate, min(cost) minprice ( select max(costingdate) latestdate, outletcode, productid accountscosting outletcode = 'c&t01' group outletcode, productid ) left join account

PHP OOP accessing global variable -

i have 2 php files. first library , other function problem if declare variable outside class error saying unidentified variable. need in advance. lib.php class test{ public function __construct() { $this->_link = mysql_connect('localhost','root',''); mysql_select_db('test_db', $this->_link); } public function query($sql) { } } function.php include_once('lib.php'); $lib = new test(); function testfunction(){ $lib->query($sql); } the problem variable $db unidentified , don't want type $lib = new test() every function. in advance. access variable inside every function using function whatever($bar) { global $lib; $lib->foo($bar); or pass $lib parameter function whatever($lib, $bar) { $lib->foo($bar);

java - Where is the .log file for an RCP application running from inside eclipse? -

Image
during development of rcp application (running inside eclipse) came across widget disposed error table part, stack trace swamped debug output on console , cannot re-produce error i've been trying find .log file application, be? check launch config find workspace of launched rcp (see picture). in folder there .metadata/.log file

unix - How to grep files under a pattern path -

let's there following tree of directories: foo/ +bar/ | +view/ | | +other/ | | +file.groovy | | +file2.groovy | | +file.txt | +file3.groovy +xyz/ +view/ +file4.groovy +file5.groovy and want grep method on groovy files directory either view or under view (that file.groovy, file2.groovy , file4.groovy). i'm trying using --include=.*\/view\/.*\.groovy far know regex anything , / character , word view , / character , , word .groovy but doesn't return anything. isn't there way of doing using include option? specifying -path option find should work: find foo/ -path "*/view/*" -name "*.groovy" -exec grep method {} \;

Image similarity by Euclidean distance in hsv color space in MATLAB -

the code included below calculates euclidean distance between 2 images in hsv color space , if result under threshold (here set 0.5) 2 images similar , group them in 1 cluster. this done group of images (video frames actually). it worked on group of sample images when change sample starts work odd, e.g result low 2 different images , high (like 1.2) 2 similar images. for example result these 2 similar images relatively high: first pic , second pic when should under 0.5. what wrong? in code below, f divided 100 allow comparison values near 0.5 . im1 = imread('1.jpeg'); im2 = imread('2.jpeg'); hsv = rgb2hsv(im1); hn1 = hsv(:,:,1); hn1=hist(hn1,16); hn1=norm(hn1); hsv = rgb2hsv(im2); hn2 = hsv(:,:,1); hn2=hist(hn2,16); hn2=norm(hn2); f = norm(hn1-hn2,1) f=f/100 these 2 lines: hn1=hist(hn1,16); hn1=norm(hn1); convert 2d image scalar. suspect not you're interested in doing..... edit: probably better approach be: hn1 = hist(hn1(:),

jquery - javascript password meter not incrementing -

i know question here, dont think relates design pattern instead more @ stupidity. there ridiculously simple solution this, i'm tired , it's starting me bit. i've fired in console , responds accordingly when type input , doesn't respond. here's js $(document).ready(function(){ var passwordstrength = function (element){ var password = element.val(); var strength = [ 'very weak', 'weak', 'better', 'strong', 'very strong' ]; var score = 0; // > 6 if (password.length > 6){ score+=1; } //has lower , uppercase if ((password.match(/[a-z]/) ) && (password.match(/[a-z]/))){ score+=1; } //has number if (password.match(/\d+/)){ score+=1; } //has special character if (password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)){ score+=1; } //more 12 characters if (password.length > 12){ score+=1; }

replaceState in HTML5 and iframe -

i trying load webpage "a.html" in frame in page "b.html". also, running script replaces url "a.html" using history.replacestate({},"","/a.html") in "b.html". running above script before iframe gets loaded i.e. url of window changes "b.html" "a.html". url changes "a.html", "a.html" page doesnt load in iframe. whereas, if dont run above script, "a.html" page gets loaded in iframe. can please tell me why webpage doesnt load in iframe? thanks in advance. before page loads, run replacestate() , redirect browser same page. page runs replacestate() , redirects browser...... same page again. seems me forever redirecting browser same page , that's why iframe won't load

ios - Cocos2d image masking -

Image
i'm working on game main character rides on ship , when enemy parallel ship, drops tube. main problem tube bigger ship visible behind while going down or up. please note image (the ship) on top of tube transparent image. thanks! you can clip draw regions in cocos2d without effort. if add code tube object can define suitable region draw object. outside of rectangle doesn't drawn. -(void) visit { if(!self.visible) return; glenable(gl_scissor_test); cgrect thisclipregion = _clipregion; thisclipregion = cc_rect_points_to_pixels(thisclipregion); glscissor(thisclipregion.origin.x, thisclipregion.origin.y, thisclipregion.size.width, thisclipregion.size.height); [super visit]; gldisable(gl_scissor_test); }

state saving - iOS Autosaved object -

in app have singleton object, should save state through app launches. need save somehow. i see 2 options: 1) save on app termination (plus, maybe, going background); 2) save each time property changed. first option looks bad, because app can killed, example, because of bug, memory limits or device power-off (low battery). expect state won't saved. second option needs either manual notifications each change, or kvo + observing of each property. seems wrong here. maybe, can give me advice or there well-known pattern (i've tried google, found nothing particular). update: yes, there nsuserdefaults , improve usability (smth. more key-values) write wrapper-methords, end same problem (lines of manual coding). update2: coredata bad choice me: 1 object store + inserting there needs more lines of code. update3: it's not question "how save". it's "how call saving automatically (or less of coding)". in nsuserdefault way need manually im

java - How transmit parameters from href by not method GET? -

how transmit parameters href not method get? use spring. maybe spring tools can me? method get: <a href="savecandidate?id=${candidate.id}">${candidate.name}</a> candidate.id transmit method how transmit candidate.id post(for example method)? no,by default href hits method,there no way specify method. try html form specify method's or move logic get . if can use client script ( javascript ),there possibility with.

Store Angularjs form data in database using php -

my index.html: <form name="myform" ng-controller="ctrl" ng-submit="save(user)"> <label>name:</label> <input type="text" ng-model="user.name"/><br /><br /> <label>email:</label> <input type="text" ng-model="user.email"/><br /><br /> <input type="submit" value="submit"/> </form> script.js function ctrl($scope,$http) { $scope.save = function(user) { var data={ name: user.name, email:user.email } console.log(data); $http.post("insert.php",data).success(function(data){ console.log(data); }); } } insert.php <? php $data = json_decode(file_get_contents('php://input'), true); if (json_last_error() === json_error_none) { // use $data instead of $_post print_r($data); ?> this code store form data in database.. not working..

javascript - angularjs ng-class with different conditions -

i have view shows data , want add class on list items in view. <input type="text" class="filter" placeholder="search..." ng-model="search"> <ul> <li ng-repeat="item in items | filter:search | orderby:'date'"> {{ date }} {{ item.heading }}<button ng-click="deleteitem(item.id)"><i class='icon-trash'></i></button> </li> </ul> i have variables called item.date , want compare variables today . here logic: if (item.date - today <= 0) apply class1 if else (item.date - today > 0 && item.date - today <= 3) apply class2 , on how can achieve angular? can put logic directly view or need define in controller? thanks in advance since have bit heavy comparisons make, suggest moving inside function rather having in html: <li ng-class="getclass(item.date)" ng-repeat="item in items | f

performance - Perl: Most efficent way to calculate percentile -

i have perl script, goes through couple of gig worth of files , generates report. in order calculate percentile doing following my @values = 0; while (my $line = <inputfile>){ ..... push(@values, $line); } # sort @values = sort {$a <=> $b} @values; # print 95% percentile print $values[sprintf("%.0f",(0.95*($#values)))]; this saves values upfront in array , calculates percentile, can heavy on memory (assuming millions of values), there more memory efficient way of doing this? you can process file twice: first run count number of lines ( $. ). number, can count size of sliding window keep highest numbers needed find percentile (for percentiles < 50, should invert logic). #!/usr/bin/perl use warnings; use strict; $percentile = 95; $file = shift; open $in, '<', $file or die $!; 1 while <$in>; # count number of lines. $line_count = $.; seek $in, 0, 0; # rewind. # calculate size of sliding wi

Unit Testing in xcode(Using GHUnit and OCMock) -

in xcode,i trying unit testing using ghunit , ocmock described here : unit testing xcode and set methods descibed here : ghunittestcase but got error in method (void)setupclass { } when initialize viewcontroller object below : #import <ghunitios/ghunit.h> #import <ocmock/ocmock.h> #import "rs_loginrsviewcontroller.h" @interface samplelibtest : ghtestcase { rs_loginrsviewcontroller * login; } @end @implementation samplelibtest // run before each test method - (void)setup { } // run after each test method - (void)teardown { } // run before tests run class - (void)setupclass { ghtestlog(@"log test ghtestlog(...) test specific logging."); login = [[rs_loginrsviewcontroller alloc]init]; } // run before tests run class - (void)teardownclass { } // tests prefixed 'test' , contain no arguments , no return value - (void)testa { ghtestlog(@"log test ghtestlog(...) test specific logging."); } // overrid

java - Fortify Error : "No rules file found" -

when run fortify analysis against java project receive error : [warning]: no rules files found [error]: no rules files found where can configure rules file ? the folder \core\config\rules contains rules files can dowloaded update.fortify.com invoking command (on windows): bin\fortifyupdate.cmd

Is there a tidy way of associating metadata with functions in C++ -

i have codebase many command line options. currently, each command line option lives in table along function pointer run if command passed in on command line. e.g. static commandfunction s_commands[] = { { "command1", func1 }, { "command2", func2 }, { "command3", func3 }, etc... }; my problem is, table huge, , functions live elsewhere. prefer string command live right beside each function. so example: command_arg("command1") void func1() { dostuff ... } command_arg("command2") void func2() { dostuff ... } command_arg("command3") void func3() { dostuff ... } is possible? you can template specialized address of function: #include <stdio.h> // in header file. template<void(*fn)()> struct fnmeta { static char const* const meta; }; // no definition of meta // some.cc void some() {} template<> char const* const fnmeta<some>::meta = &quo

C# Dynamic Data Linq To SQL website assembly loading -

i using visual studio 2010 ultimate. have got following error when try import dynamic data linq sql website project on computer: ------ rebuild started: project: c:...\testversion99website\, configuration: debug cpu ------ validating web site building directory '/testversion99website/app_code/'. building directory '/testversion99website/dynamicdata/content/'. building directory '/testversion99website/dynamicdata/fieldtemplates/'. c:\users\test\documents\visual studio 2010\websites\testversion99website\dynamicdata\fieldtemplates\multilinetext_edit.ascx(7): build (web): not load file or assembly 'system.web.dynamicdata, version=99.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. ... c:\users\test\documents\visual studio 2010\websites\testversion99website\dynamicdata\fieldtemplates\text_edit.ascx(7): build (web): not load file or assembly 'system.web.dynamicd

java - non-locking threading code using atomic types when implementing a sliding window class for time -

i trying understand code yammer metrics. confusion starts trim method , call trim in both update , getsnapshot. explain logic here 15 min sliding window? why want clear map before passing snapshot (this stats of window calculated). package com.codahale.metrics; import java.util.concurrent.concurrentskiplistmap; import java.util.concurrent.timeunit; import java.util.concurrent.atomic.atomiclong; public class slidingtimewindowreservoir implements reservoir { // allow many duplicate ticks before overwriting measurements private static final int collision_buffer = 256; // trim on updating once every n private static final int trim_threshold = 256; private final clock clock; private final concurrentskiplistmap<long, long> measurements; private final long window; private final atomiclong lasttick; private final atomiclong count; public slidingtimewindowreservoir(long window, timeunit windowunit) { this(window, windowunit, clock.defaul