Posts

Showing posts from May, 2014

datetime - SQL Server 2012 Time Range Check? -

what smart way determine if current time between 59th minute of hour , first minute of next hour, using pure tsql on mssql 2012? i not want cut off time "now", want cut off date , time calculation. this gets me kind of close : datepart time between (instead of convert date) not since need calculate based on current time , not table values. the following might illustrate if server in "the bad time" , should return value of '1' 14:58:59 , should not considered in "bad time" 14:59:00 , should considered in "bad time" 14:59:04 , should considered in "bad time" 14:59:57 , should considered in "bad time" 15:00:02 , should considered in "bad time" 15:01:26 , should not considered in "bad time" 15:02:00 , should not considered in "bad time" 15:02:01 , should not considered in "bad time" thanks. edit: this code works, sure can done more efficiently. recommendati

How do I prevent SOAP XML request and response from going into my Apache error log file? -

newbie question: how stop apache error log files being filled soap xml requests & responses? can tell, these aren't errors , everything's working fine...the indication "[error]" after timestamp. include image data can pretty large. check this answer , link mod_log_config documentation . basically, should able customize types of information written logs. aware though if use log analysis software or scripts expect particular format, may need reconfigure tools understand new custom format. update: relevant except mod_log_config documentation. directives go in apache configuration file, you're specifying location , format of error log. in case, you'll want conditional check headers or in environment determin whether it's soap request want ignore. the third argument optional , controls whether or not log particular request based on presence or absence of particular variable in server environment. if specified environment varia

javascript - Is It possible to close window without the alert? -

this question has answer here: how can close browser window without receiving “do want close window” prompt? 17 answers when open form in new window, click button close window without alert box. is possible? any appreciated. thanks alot if talking window.open() function try use window.close()

ios - Constraining motion inside a circle -

looking direction on this. have ring of radius r. inside ring have circle of radius c, c < r. want user able grab inner circle , move/throw it, circle should constrained stay inside ring. suggestions on following? handling touch events the math involved constrain view circle? i working in ios, concept general. not sure mean "handling touch events", here's math: hypot(circle.center.y - ring.center.y, circle.center.x - ring.center.x) < (r - c)

ruby on rails - How do I interrupt the destroy method before it puts up the confirmation? -

in view file have %td= link_to 'destroy', fund_subfund_path(@fund, subfund), :method => :delete, :data => { :confirm => 'are sure?' } my controller has def destroy @subfund = subfund.find(params[:id]) fund_id = @subfund.fund_id nickname = @subfund.nickname if @loans.empty? @subfund.destroy respond_to |format| format.html { redirect_to fund_path(fund_id), notice: 'subfund ' + nickname + ' destroyed.' } format.json { head :no_content } end else respond_to |format| format.html { redirect_to fund_path(fund_id), notice: 'subfund ' + nickname + " has loans, can't destroyed." } format.json { head :no_content } end end end the redirects , messages work fine. problem if @loans not empty , @subfund.destroy action not carried out, "are sure?" confirmation still appears. how intercept method before confirmation message? i did try link_to

json - run shell script/bash commands in Sublime Text latex build without any file arguments -

i have sublime text build system running latex. using shell script (with no arguments) delete various extensions generated latex. problem sublime-text thinks filename.tex argument script. so tried following script: { // general settings "target": "make_pdf", "selector": "text.tex.latex", "cmd": ["latexmk", "-e","\\$dvipdf = 'dvipdfmx %o -o %d %s'", "-e", "\\$latex = 'latex %o -interaction=nonstopmode -synctex=1 %s'","-f", "-pdfdvi"], "variants": [ { "cmd":["my_script.sh"], "name": "clean" } ] } here used ls in place of script illustrate. when run build-file, tries run my_script.sh filename.tex instead of my_script.sh. can run build file ? i have been there , done . . . there , again . . . , visited again , again . . . the solution use custom plugin (n

How do I rename XML values using php? -

how rename value in xml using php? i've got far: <?php $q = $_get["q"]; $q = stripslashes($q); $q = explode('|^', $q); $old = $q[0]; $dom = new domdocument; $dom->preservewhitespace = false; $dom->formatoutput = true; $dom->load("test.xml"); $xpath = new domxpath($dom); $query1 = 'channel/item[title="' . $old . '"]/title'; $entries = $xpath->query($query1); foreach ($entries $entry) { $oldchapter = $entry->parentnode->removechild($entry); $item = $dom->getelementsbytagname('item'); foreach ($item $items) { $title = $dom->createelement('title', $q[1]); $items->appendchild($title); } } $dom->save("test.xml"); basically, take 2 titles url, old existing title, , 1 user wants change (so oldtitle|^newtitle ), , puts them array. what i've tried

php - jQuery - Display a textbox when a link/button is clicked -

i'm trying put reply button each comment when click on button (for example "reply"), textbox come automatically users can fill in form. i didn't far... php <div id='replycomment' class='reply' onclick='jsreply($comment_id);'>reply</div> <div id='showreply'></div> jquery function jsreply(comment_id) { var form = '<form id="showreplyform" action"add_reply.php" method="post">'; form += '<textarea name="replybody" cols="35" rows="2" maxlength="299"</textarea>'; form += '<input type="hidden" name="replybodyid" value="' + comment_id + '" />' form += '<input type="submit" name="replysubmit" value="reply"/></form>'; jquery('#replybody').replacewith(form); } can please me that? a

html - How to use height:50% if the container height is not defined? -

i use height:50%, container's height not defined, what's correct solution? <div id="container"> <div id="left-50"> <div id="left-50-1">1</div> <div id="left-50-2">2</div> </div> <div id="image"> <img src="http://automarka.hu/images/stories/audi%20a8%202.8%20v6%20fsi%202007.jpg"> </div> </div> #container { overflow:hidden; } #left-50 { float:left; } #left-50-1 { height:50%; width:50px; background:yellow; } #left-50-2 { height:50%; width:50px; background:purple; } #image { float:left; } jsfiddle url: http://jsfiddle.net/xqmdf/ the correct solution define container height. or refer body or other defined element. make container display:inline-block; adjust image height ... or define fixed height. demo: http://jsfiddle.net/xqmdf/2/

c++ work around comparison between pointer and integer -

do { getline (myfile,temp); if (temp[0] != "="){ myalbums[i].tracks.push_back(temp); } else { break; } }while(true); gives me error: iso c++ forbids comparison between pointer , integer [-fpermissive] i trying loop through lines in text file , 'push_pack' if line not begin "=" equals character. else want break out of loop. any appriceated! if (temp[0] != "="){ should be if (temp[0] != '='){ the reason temp[0] of type char (assume temp string read in), should compare char literal '=' not string literal "=" . assuming read temp successfully, may need check if not case. edit (thanks adam liss) strings literals "=" of ( const char * ) type, enclosed in double-quotes; individual characters enclosed in single-quotes. therefore, have compile complain message comparing char (char literal integers) const char * . quoting here: ibm c++ documentat

mootools - Javascript Need to pull a value from a function within an array -

Image
here code: <script> window.addevent('domready', function(){ new request.stocks({ stocks: ['sxcl'], oncomplete: function(yahoo){ var result = ''; array.each(array.from(yahoo.query.results.quote), function(quote){ result += '<div class="company-ticks"></div> <span class="company">steel excel ({name})</span> <span class="sub-info"> - otc markets<span> </div> <div><span class="value"> {lasttradepriceonly}</span><span class="changeup"> <img src="change-up.gif" class="change-img" />{change} ({changeinpercent})</span></div></div>'.substitute(quote); }, this); $('stocks').set('html', result); }, onrequest: function(script){ $('stocks').set('text', 'loading

visual studio 2010 - Call Tree Data Missing From Profiling Report -

i attempting use visual studio performance profiler profile process have running. using "sampling" collection type, , attaching process after has started. when finish profiling , attempt load report, displays message "no call tree data available" above cpu usage graph. in addition, following error generated: da0002: appears file collected without setting environment variables vsperfclrenv.cmd. symbols managed binaries may not resolve. the information can find on error around running profiler command line, not visual studio. my best guess may 32-bit vs. 64-bit issue, received upgraded computer 64-bit of windows 7. worked fine on previous machine had 32-bit version of windows 7.

java - How do I compare two passwords (create password and confirm password) useing the .equals() method? -

i'm building simple create account user gui integrated loginscreen class. creates simple user, serializes it, , lets me use access in log in program. problem is, when type in passwords, they're never correct. problem program tells me passwords not same. i'm not sure how fix this, , know how. i'll post code below(the whole thing, along serializing class because problem may here). user class: package passwordprogram; import java.util.arraylist; import java.awt.borderlayout; import java.awt.color; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.io.serializable; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jpasswordfield; import javax.swing.jtextfield; import javax.swing.uimanager; public class user implements serializable, actionlistener { public static arraylist<strin

iis - FileLoadException during activation of WCF service -

after deploying wcf service in iis, error when accessing service: server error in '/myservice' application. the given assembly name or codebase invalid. (exception hresult: 0x80131047) description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.io.fileloadexception: given assembly name or codebase invalid. (exception hresult: 0x80131047) source error: an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [fileloadexception: given assembly name or codebase invalid. (exception hresult: 0x80131047)] system.runtimetypehandle.gettypebyname(string name, boolean throwonerror, boolean ignorecase, boolean reflectiononly, stackcrawlmarkhandle stackmark, intptr pprivhos

including facebook.php makes my web shows extra information -

i have read tutorials related displaying facebook name, picture , on. must include (or require) file "facebook.php", downloaded in latest version facebook github web. problem when require "facebook.php" web looks this: http://imageshack.us/f/543/facebookphp.png/ file supposed contain functions getuser() , facebook instance, example, why has got html code appear in web?

java - Thread safe collection for indexed access -

do have thread-safe version of arraylist supports index-based access. i not find counterpart arraylist in concurrent package, have linkedlist(concurrentlinkedqueue). blocking versions dont suit purpose. i need create thread safe 'sorted' arraylist - inheriting available vanilla thread-safe version. though deprecated, can save of headaches using vector .

tortoisesvn - How to delete a latest branch/tag for a repository in svn? -

i developing 1 project in development server. first version entire project. after done development, committed code , updated local repository. url: svn+ssh://home/projects/application_name once it's done used branch/tag option , created new branch tag 1.1.0. url new branch below one. url: svn+ssh://home/projects/application_name_1.1.0 now checked out new branch code in test server testing. got errors ned resolve them. can create new branch/tag did after resolved errors in dev server , again can move new branch code test server. what want know how can delete 1.1.0 branch permanently svn can create new branch again 1.1.0 name. you don't have remove branch "permanently". can remove regular commit , create new branch did before. svn rm svn+ssh://home/projects/application_name_1.1.0 svn cp svn+ssh://home/projects/application_name \ svn+ssh://home/projects/application_name_1.1.0

javascript - How to color keywords with HTML? -

Image
i'm developing sql-based webapp , need color keyworkds, such select, in, update, delete, from, , on, notepad++, sublime, etc.. does have idea on how javascript? i thinking running async task on every keystroke, have nooo idea on how that... per https://code.google.com/p/google-code-prettify/wiki/gettingstarted add <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?lang=sql"></script> to <head> , put <pre class="prettyprint lang-sql">...</pre> around html-escaped sql. http://google-code-prettify.googlecode.com/svn/trunk/tests/prettify_test.html#sql_lang shows sql highlighting in action.

c# - Unexpected behaviour in ternary operator -

i came across weird behavior when changed if-else ternary operator return statement. i've simplified code here: class foo { private bool condition; private int intvalue = 1; private decimal decimalvalue = 1m; public object ternaryget { { return condition ? decimalvalue : intvalue; } } public object ifelseget { { if (condition) return decimalvalue; return intvalue; } } public foo(bool condition) { this.condition = condition; } } class program { static void main(string[] args) { var footrue = new foo(true); var foofalse = new foo(false); console.writeline("{0}, {1}", footrue.ternaryget.gettype(), footrue.ifelseget.gettype()); console.writeline("{0}, {1}", foofalse.ternaryget.gettype(), foofalse.ifelseget.gettype()); }

joomla2.5 - Joomla simple text area that send data via POST -

i'm developing joomla! 2.5 component. it, username && password passed via admin area, connect webserver send info via xml. i can show component in part of front-end without problem. now need insert, in frontend end-user, single text-area users insert value (e.g., theyr card number [it's loyalty component]) , value must passed previous component. atm don't need ajax call, page refreshed. so process must textarea => insert data => press submit => show component result (page refresh, no problem). i need develop plugin? need "extend" component? saw several topic on web didn't found show (i think) simple case my. i need hand you, on correct way. thank you. in main controller file can access post & values, where want place input: create form points component, appropriate <form action="index.php?option=com_yourcomp" method="get" <input type="text" name="your_text_input&q

Automatically install access database when creating setup file in c# -

i have created c# application using access database. have deploy application successfully. want install access database automatically in other users computer automatically. i have tried change app.config files connection string , no use..:( me you have more specific. did install application using installer? copying , pasting? maybe these help: stackoverflow - "how install visual studio 2010 setup project ms access database on computer not having office 2010 installed?" codeproject - deploy application , database msdn forums - "how attach sql database file creating .exe setup in c#"

function - php global variable not showing correct answer -

its simple code don't understand whats point :( function aaa($b){ $a = 30; global $a,$c; return $c=($b+$a);} echo aaa(40); //output 40 why output 40 ? when call $a outside of function gives me desired answer point ? $a = 30; function aaa($b){ global $a,$c; return $c=($b+$a); } echo aaa(40); //output 70 function aaa($b){ global $a,$c; $a = 30; return $c=($b+$a); } echo aaa(40); //output 70 see global keyword stands here: function aaa($b) { $a = 30; # local variable, overwritten in next line global $a, $c; # importing $a global scope - null return $c = ($b + $a); # $c = (40 + null) } the manual @ http://php.net/global reminds global variable influences function if used inside there. not first call subsequent calls. this makes function non-deterministic, less useful code , might - did - irritated it. an easy way out is: instead of putting parametric values of function global variables, turn them parameters: function aa

ios - How to present view controller properly? -

i have pretty simple application couple of uiviewcontrollers (say vc_a , vc_b ). every screen has button allows switch screen (no uinavigation used). app schedules local notification, which, when expired, should present view controller ( vc_n - no matter screen active @ moment). the problem application throws: 'nsinternalinconsistencyexception', reason: 'attempting begin modal transition <vc_a: 0x2021e0> <vc_n: 0xf84b970> while transition in progress. wait viewdidappear/viewdiddisappear know current transition has completed' what proper way implement such behaviour? a. use uiviewcontroller's new presentviewcontroller:animated:completion present 3 controllers instead of old modal method. b. create boolean flag , initialize no. c. before view controller presentation, check flag. if yes, set no. , present vc. in completion block, set flag yes again. d. app should ignore flag when present initial view controlle

r - Automated download from multiple URLs, handling Feedback Dialog / cookies -

i try bulk download corine landcover zip-files this site think interconnected feedback survey window google analytics making troubles here.. there sort of curl handler these issues? i viewed cookie in sqlite manager, these entries: basedomain = "europa.eu", name = "clc06_c133.zip", value = "sectors%3denvironment", host = "www.eea.europa.eu",.. cookie path "c:\users\kay\appdata\roaming\mozilla\firefox\profiles\ckut8fjm.default\cookies.sqlite" setwd("d:/gis database/corinelc/") mylist <- list( clc06_1 <- "111 - continuous urban fabric", clc06_2 <- "112 - discontinuous urban fabric", clc06_3 <- "121 - industrial or commercial units", clc06_4 <- "122 - road , rail networks , associated land", clc06_5 <- "123 - port areas", clc06_6 <- "124 - airports", clc06_7 <- "131 - mineral extraction sites", clc06_8 <- "132 - dump si

php - Round datetime to last hour -

i tried not find example of im trying do. i got datetime values in mysql database has rounded down when value on use. example, these values: 2013-04-20 07:14:42 2013-04-20 07:19:51 2013-04-20 07:37:26 2013-04-20 07:46:28 2013-04-20 07:59:44 should rounded down to: 2013-04-20 07:00:00 and 2013-04-20 16:25:34 should be: 2013-04-20 16:00:00 etc... php code gets date value: $d = strtotime($row["date"]); so, how possible round down datetime value? try this, $date = "2013-04-20 16:25:34"; echo date("y-m-d h:00:00",strtotime($date)); codepad demo.

rsa - determining hash function used in digital signature -

i have digital signature (rsa - pkcs#1). after decrypting rsa public key following 128 bytes 00 01 ff ff ff .. ff 00 30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 77 51 1b f4 d7 17 d7 ad 8c 2d e5 89 2a ca e0 6d a3 c0 7d 13 4d d7 b8 01 14 87 03 00 69 e4 9b b3 pkcs#1 padding removed, 51 bytes left: 30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 77 51 1b f4 d7 17 d7 ad 8c 2d e5 89 2a ca e0 6d a3 c0 7d 13 4d d7 b8 01 14 87 03 00 69 e4 9b b3 i 2 things this: is possible determine hash function used? encoded algorithm id should prepended actual body of digest, possible tell algorithm raw bytes? where actual digest start (how long head / digest is)? this appears emsa-pkcs1-v1_5 described in rfc 3447 , means after removing header , padding, have der encoding of algorithmidentifier followed hash value itself. from rfc: for 6 hash functions mentioned in appendix b.1, der encoding t of digestinfo value equal following: [...]

Could I use LLVM for parsing Fortran? -

i newbie llvm. basic need parse fortran codes. looking @ llvm website, seems llvm can used library parsing codes. use parse fortran codes, , extract information codes (ast?)? llvm compiler backend. thing knows how parse llvm ir - intermediate language designed emitted programing language frontends. official frontend llvm clang, can handle c, c++ , objc. if you're interested in other languages, there's dragonegg , llvm plugin gcc. uses gcc's front-end , llvm backend, can parse gcc knows how parse. know work being done on making generate correct code ada , fortran. here's excerpt page: current status works best gcc-4.6. fortran works well. ada, c , c++ work well. ada works poorly gcc-4.7. it can compile reasonable amount of obj-c, obj-c++ , go. it can compile simple java programs, don't execute (this consequence of java front-end not supporting gcc's lto). debug info poor.

function - plotting routine for n number of arguments in r -

i have following parameters wish plot: weight <- c(102,20,30,04,022,01,220,10) height <- c(102,20,30,04,022,01,220,10) catg <- c(102,20,30,04,022,01,220,10) catg <- matrix(height,nrow = 2) and these should plotted in pdf file saved in path: figurefolder <- "c:\\..." i attempting write function takes n number of input parameters , saves them file (in case file if defined figurefolder). have following function: plotting_function <- function( ...,figurefolder){ # find number of input arguments nargin <- length(as.list(match.call())) -1 nargin <- nargin - 2 variable_list <- list(...) variable_list <- variable_list[1:nargin] (i in 1:length(variable_list)){ if (variable_list[i] == "catg") routine 1 go here if(variable_list[i] != "catg") routine 2 go here } } so, here trying make function work thatif variable 'catg' inserted functio

database design - Enterprise Architect Generate DDL for package not working -

i have class diagram in enterprise architect. want have database tables of package. right click on class diagram package , select code engineering --> generate ddl. in "generate package ddl" dialog, select "include child packages". problem in list below, no table added can select , generate. thanks. here steps generate ddl uml class diagram in enterprise architect (ea) 9.3: open project in ea open model's class diagram in editor window. use project browser window on right side , click on floders until find model , double-click it. click tools => model transformation (mda) => transform current package. brings model transformation dialog. select classes want mapped ddl schema in left side of dialog (use button if want them all) click , select ddl checkbox in transformations box on right of dialog click transform. generate ddl diagram. double click ddl diagram in project browser , open ddl diagram in editor tab click tools => da

Custom Facebook Like Box in PHP -

i know can embed facebook's own like box on web page, many people have found out can no longer styled as used able (removing border best can seems). so wondering whether possible build own customised box have control on styling of it, , make fit in design of web page needs go on? i've been attempting work way through graph api documentation on facebook site , know how information such number of "likes" page has , other information page itself, can't seem find out how pull random number of profile pics people have liked page (the same how works on box social plugin basically). thanks.

jquery - Send JSON using $.Ajax() with a POST method -

i trying send json object using $.ajax() in jquery post method, pure html page ,to datapower endpoint.the response header in fire bug gives me"internal server error",please can 1 tell me doing wrong here : http/1.1 500 error x-backside-transport: fail fail content-type: text/xml connection: close my jquery code looks : $(document).ready(function () { $('#btn_submitcallback').click(function () { //add values need api object var objcallbackdata = new object; var d = new date(); var dat = d.getdate(); var mon = d.getmonth() + 1; var year = d.getfullyear(); var todaydate = dat + "/" + mon + "/" + year; alert("inside submit callback"); //build object objcallbackdata.store_code = "poo726"; //$('#sel_title').val(); objcallbackdata.ti

visual studio 2010 - PostSharp in web project using NuGet -

after followed steps listed here : http://doc.postsharp.net//postsharp-2.1/default.aspx##postsharp-2.1.chm/html/41129237-a5d4-4acf-aef4-c46759ccfb4b.htm it gives me error : " postsharp not introduced in build process. if nuget restored postsharp package, need rebuild solution." do have ideea why? thanks the requirespostsharp.cs file meant helpful, not work correctly. if postsharp otherwise working, can safely delete file .

c# - how to access exe file in server machine through network -

i have developed c# application , created setup file. , i'm using sql server 2008 r2. want when i'm installed setup file , sql server in server machine, other users should able access application. this application user information handling system. therefore other users should able access application on machine , insert data , database same (server machine's database). anyone please me on problem. hope can understand problem.

using custom user model with django-allauth gives error Cannot resolve keyword 'username' into field. Choices are: activityhistory, app, ...., -

i trying integrate django-allauth, , tried use custom user model. stated here , created model class client(abstractbaseuser): fname = models.charfield(max_length=50) lname = models.charfield(max_length=50) email = models.emailfield(max_length=150, unique=true, db_index=true) created_at = models.datetimefield(auto_now_add=true) state_choices = ( (0, 'pending'), (1, 'active'), (2, 'deleted'), (3, 'banned'), ) state = models.smallintegerfield(choices=state_choices, default=1, editable=false) objects = clientmanager() username_field = 'email' required_fields = ['fname', 'lname'] def save(self, *args, **kwargs): ######### def get_short_name(self): return self.fname def get_full_name(self): return '%s %s' % (self.fname, self.lname) def has_perm(self, perm, obj=none): ########### def has_module_perm