Posts

Showing posts from July, 2015

php - Faster way for this mysql_query -

$handle = fopen("stock.csv", "r"); while (($data = fgetcsv($handle, 1000, ";")) !== false) { $model = mysql_real_escape_string ($data[0]); $quantity = mysql_real_escape_string ($data[7]); mysql_select_db("verradt33_xoho", $link); $quantity = str_replace("ja", "10", $quantity); $quantity = str_replace("nee", "0", $quantity); $result = mysql_query("update dev_product set quantity = $quantity model = '$model'") or die(mysql_error()); even tho code works, takes long time process 7000+ lines in csv. due having replace ja or nee 10 or 0 every single line. is there way make faster? can't touch csv file, that's hard part of course. current load time 40 minutes. your first question should be: is column model indexed? secondly, try commenting out database access's , see how long takes .csv processing! mysql_select_db("verradt33_xoho",

Write data to one csv row Python -

in py script, need write data csv file result of 5 columns per row. title:info title title title title 1 2 3 4 5 1 2 3 4 5 title:info title title title title 1 2 3 4 5 i want use file.write() method, not csv module if @ possible. for ip in open("list.txt"): open("data.txt", "a") csv_file: csv_file.write("\r title:" + ip + ", title, title, title, title \r") line in open("0820-org-apflog.txt"): new_line = line.split() #search apflog correct lines if "blocked" in new_line: if "src="+ip.strip() in new_line: #write columns new text file & remove headers lines in files , add commas csv_file.write(ip + ", " + new_line[11].replace("dst=", ", ") + new_line[12].replace("proto=", ", ")) try

unit testing - SystemVerilog program block vs. traditional testbench -

are there features of sv program block offers can't duplicated other methods? the less concrete version of question is: should bother program blocks verification? i'm moving environment constrained verilog-95 environment sv supported, , i'm wondering if i'm creating work myself not using program blocks. check out ieee std 1800-2012 § 3.4 & § 24. full description program blocks. in short, incomplete summary, program block: cannot cannot contain always procedures, primitive instances, module instances, interface instances ( virtual interface , port interface allowed), or other program instances. specifies scheduling in reactive region. prevents race conditions. has system task $exit , terminates program instances calls it. the simulation terminate when program instances have exited. is module block except stated above. the idea of program block create clear separation between test , design. in earlier versions of systemverilo

haskell - How to get a SHA-1 digest of a X509 certificate with HsOpenSSL? -

i'm writing web server accepts ssl connections , calculate sha-1 hash of client certificates: import openssl (withopenssl) import openssl.session ssl import openssl.x509 x509 import openssl.evp.digest evp sslstuff :: ssl.ssl -> io string sslstuff ssl = withopenssl $ x509 <- liftm fromjust $ ssl.getpeercertificate ssl issuer <- x509.getissuername x509 false subj <- x509.getsubjectname x509 false putstrln $ "\tsubject: " ++show subj putstrln $ "\tissuer: " ++show issuer dg <- liftm fromjust $ evp.getdigestbyname "sha1" cert <- x509.printx509 x509 putstrln cert let s = evp.digest dg cert putstrln $ "after digest: "++s return s i certificate, digest 15 bytes long instead of 20. i'm not sure correctly convert cert string before passing evp.digest. please give me example of how right way? i not know haskell. following code might you. x509 * x509; char sha1dig[sha1_digest_length]; /

sql - Date Aging Report + Cummulative -

i working on aging report based on last action date stored in table, given table below: requestno usercode lastactiondate actiontype req1 407 12/14/2012 9:47 saved req1 407 12/14/2012 9:48 submitted req1 407 12/14/2012 9:48 approved req1 203 12/17/2012 9:54 reviewed req1 242 12/18/2012 10:29 wf setup in dev. req1 203 12/18/2012 15:14 transport prod. req1 242 12/18/2012 15:16 completed req2 407 12/27/2012 10:36 submitted req2 456 12/27/2012 11:18 approved req2 407 12/27/2012 11:27 approved req2 203 12/27/2012 17:34 reviewed req2 242 12/28/2012 14:07 wf setup in dev. req2 203 12/28/2012 14:11 transport prod. req2 242 12/28/2012 21:27 completed req3 407 12/27/2012 11:32 submitted req3 456 12/27/2012 11:33 approved req3 407 12/27/2012 11:3

ios - Update NSError UserInfo -

i'm trying update nserror object more information. example, api call may fail , want update error object returned api class view controller information (method name caused error, client message, additional info). there isn't setter method userinfo dictionary , trying set value dictionary raises exception (not key value code compliant believe). thought creating new nserror object updated user info, wasn't sure if might lose information. question what's best way update user info dictionary of nserror object? easiest way mutable copy of userinfo dictionary , add whatever that. have create new nserror (since there not setuserinfo: method) same domain , code original one.

python - Cleaner / reusable way to emit specific JSON for django models -

i'm rewriting end of app use django, , i'd keep front end untouched possible. need consistent json sent between projects. in models.py have: class resource(models.model): # name chosen consistency old app _id = models.autofield(primary_key=true) name = models.charfield(max_length=255) @property def bookingpercentage(self): bookings.models import booking return booking.objects.filter(resource=self) .aggregate(models.sum("percent"))["percent__sum"] and in views.py gets resource data json: def get_resources(request): resources = [] resource in resource.objects.all(): resources.append({ "_id": resource._id, "name": resource.first, "bookingpercentage": resource.bookingpercentage }) return httpresponse(json.dumps(resources)) this works need to, seems antithetical django and/or python.

Python while statment doesnt work -

this question exact duplicate of: while statement close program [closed] 1 answer i have homework question. should create dictionary represent following: north leads garden. south leads kitchen. east leads dining room. west leads living room. the player should prompted direction , respond location off in direction. example, if player enters north, program should respond: north leads garden. if player enters invalid direction, program should ignore input , ask direction. program end when player enters quit. my problem when user enter "quit" program doesn't exit. dnt understand why while statement not working. here code: #create dictionary represent possible #exits location in adventure game game = {"north" : "north leads garden.", "south" : "south leads kitchen.", "east" : "eas

Syntax rules for Lazarus Pascal procedural "Units" -

i organise app's source code pascal compilation units using file -> new unit the following unit compiles ok ... unit cryptounit; {$mode objfpc}{$h+} interface function encrypt(key, plaintext:string):string; function decrypt(key, ciphertext:string):string; implementation uses classes, sysutils, blowfish; function encrypt(key, plaintext:string):string; ... however 1 has compilation errors can't identify "exception" @ line 6 ... unit exceptionunit; {$mode objfpc}{$h+} interface procedure dumpexceptioncallstack(e: exception); // <--- problem implementation uses classes, sysutils, fileutil; { see http://wiki.freepascal.org/logging_exceptions } procedure dumpexceptioncallstack(e: exception); ... if assume exception defined in sysutils (how can tell?) can't put uses sysutils before interface (the compiler complains expecting interface ) how tell compiler exception defined in sysutils ? other units used use

.net - Microsoft/SSRS report textbox returns #error when string value that is decimal is converted to decimal and empty string is just printed -

i have value coming database string, decimal , when decimal want display decimal , format way, if isn't decimal display whatever value comes back. here's code: =iif ( isnothing(fields!amount.value) or len(trim(fields!amount.value)) < 1, fields!amount.value, //have tried cstr(fields!amount.value) in case conversion below makes report expect decimals values iif ( isnumeric(fields!amount.value), cdec(fields!amount.value), fields!amount.value ) ) the comment above not part of code, put here. anyway, based on above, decimals converted decimals , display ok, strings either empty or hold non-numeric value show #error. here's sample result display: 72.00 95.00 #error 20.00 what's wrong expression? , why couldn't ssrs use c# instead of vb?!!? update: know problem has conversion , not logic check whether value nothing, less 1 character, or numeric, because following works: =iif ( isnothing(fields!am

PHP to Go using Unix domain sockets -

i'm trying use unix socket have php send ipc messages go. seems work, except php seems keep reading response socket, , won't let go. (the browser load-spinner keeps going, , there's no page render.) i'm using flag php_normal_read in php:socket_read() function, , explicitly sending "\n" go. watching go process in terminal, appears work correctly on end. edit: think browser caching issue. if send different data php echo, works expected. switched fmt.fprintln() make sure wasn't getting newline wrong. go: package main import ( "net" "fmt" "log" "os" ) const socket_addr = "/tmp/odc_ws.sock" func echoserver(c net.conn){ buf := make([]byte, 512) size, err := c.read(buf) if err != nil { log.fatal("read error: ", err) } data := buf[0:size] fmt.println("server received: ", string(data)) // new code t := time.now() re

C++ Boost library geometry.hpp -

i installed boost library in ubuntu 12.04 lts using command libboost-all-dev, when include /boost/geometry.hpp doesn't included. have checked system , doesn't contain geometry.hpp file or geometry. there no geometry file in boost library downloaded i downloaded boost 1.54 http://www.boost.org/users/download/ 2 days ago. version got has boost_1_54_0/boost/geometry.hpp and boost_1_54_0/boost/geometry/geometry.hpp how did boost?

Hibernate-search OneToMany infinite indexing -

all help/comments appreciated i've got @onetomany relationship. tvenue , tvenueitem want able search on various fields on venue i've marked @indexed. setup so: @indexed @entity public class tvenue implements java.io.serializable { private set<tvenueitem> tvenueitems = new hashset<tvenueitem>(0); ....... @onetomany(cascade=cascadetype.all, fetch=fetchtype.lazy, mappedby="tvenue") public set<tvenueitem> gettvenueitems() { return this.tvenueitems; } ........... and @entity public class tvenueitem implements java.io.serializable { private string name; private tvenue tvenue; ........... @manytoone(fetch=fetchtype.lazy) @joincolumn(name="venue_id", nullable=false) public tvenue gettvenue() { return this.tvenue; } @field @column(name="_name", nullable=false, length=100) public string getname() { return this.name; } .......

JavaScript html forms calculator not working -

im trying make simple perimeter calculator projector screen. the code should take response radio button input , diagonal length calculate perimeter accordingly. here code atm: <html> <body> <script language="javascript"> function calc() { var form = document.forms.calculator; var = number(getselectedvalue(form.elements.a)); var b = number(getselectedvalue(form.elements.b)); if (a = 0) { l = 0.8; h = 0.6; } else if (a = 1) { l = 0.872; h = 0.49; } else { l = 0.922; h = 0.386; } form.elements.total.value = 2 * b * (l + h); } function getselectedvalue(flds) { var = 0; var len = flds.length; while (i < le

ruby - Homebrew - Correcting warning after running Brew Doctor - Altering Path (/user/bin) issue -

Image
context i'm getting error, when running brew doctor command in terminal after installing homebrew ( https://github.com/mxcl/homebrew ): to fix issue i'm following instructions here : how modify path homebrew? when type in sudo vi /etc/paths terminal (i'm on root), way part of answer given in stackoverflow question reference above, this: when quit terminal , type in brew docotor still same warning. questions main question: doing wrong? ancillary question: why in terminal not have ability type after running command? ancillary question: why there white space , ~ characters after running command? running command: echo 'export path="/usr/local/bin:/usr/local/sbin:~/bin:$path"' >> ~/.bash_profile fixed issue me. found @ website: http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/ via how modify path homebrew?

javascript - Angular - Toggling element class inside an ng-repeat based on radio input selection -

i'm using angular write questionnaire questions retrieved resource. based on design, have toggle custom icon instead of standard radio button icon. solution i've come hide radio input (using opacity/filter) , absolutely position div on input same dimensions radio input. clicking radio input toggle background image custom icon. unfortunately, has work in ie8 conventional css :checked tactics out. the question blocks this: <h2>{{ quiz.questions[asked].questiontext }}</h2> <ul> <li ng-repeat="answer in quiz.questions[asked].answers"> <label> <input type="radio" ng-model="$parent.picked" name="answer" value="{{ answer.answerid }}"/> <div class="radio-mimic {{ checked }}"></div> {{ answer.answertext }}. </label> </li> </ul> <a class="btn&quo

php - I'm confused, what is the TRUE way to build an MVC or MVVM design pattern? -

so i've been looking more tutorials , articles mvc design pattern deepen understanding of them , i'm starting doubt if have been doing wrong. yeah goal of patterns make code reusable , minimize repeated code, correct? i've been seeing various ways of how design patterns explained confusing me bit. in past thought controller-as-a-mediator-between-model-and-view way, i'm learning that wrong , view more template. read somewhere (i think here) in true mvc pattern, there definition 1 model , other "models" different facets of single model. case? best way separate code , make reusable? how in code? , again somewhere else read web-applications better stick mvvm pattern. so i'm bit confused. effective pattern separate concerns in web-application , make code reusable? prefer not see description of pattern, short example in code understand better. so yeah goal of patterns make code reusable , minimize repeated code, correct? is best way s

Java, reference variables that point to the same object in the memory -

i'm developing gui program, have made classes, cluster actionlisteners, functionality. question regarding how jvm handles jbuttons, has same actionlistener added them. first; aware jvm can save memory, letting 2 reference variables point identical string (for instance), point same string object in memory. public class example { string str1 = "somestring"; string str2 = "somestring"; } now, question this: if have, say, 5 jbuttons. buttons have same actionlistener added them. when program run, have 5 seperate, identical, instaces of same class added them? or jvm similar (to above mentioned) ? thanks in advance :) well, depends on how created actionlisteners . if did button1.addactionlistener(new actionlistener() { .... }); .... button5.addactionlistener(new actionlistener() { .... }); or actionlistener al= new actionlistener() { .... }; button1.addactionlistener(al); .... button5.addactionlistener(al); in first

JavaScript Enumeration object - faster with strings, or numbers? -

in project working on, have script 'enumeration' object in it, such: var myenumeration = { top: "top", right: "right", bottom: "bottom", left: "left" }; when have use use 1 of literal values, comparison myenumeration.left or whatever case is. however: @ least in c#, string values evaluate more numbers, since strings have character-for-character comparision ensure string matches string b. this brings me question: implementing myenumeration number values perform more quickly? var myenumeration = { top: 0, right: 1, bottom: 2, left: 3 }; when comparing strings, javascript compares each characters 1 one, left-to-right. when comparing 2 numbers, it's single comparison. can guess 1 faster - numerical comparison. however, kind of optimization might premature. unless need efficiency gain (comparing hundreds of values frequently, perhaps?), don't think them.

Overriding java superclass method in Clojure -

i'm doing javafx stuff, following tableview example. in original java author @override s several of tablecell class methods he's deriving directly from, @override s updateitem method 2 levels in class hierarchy , belongs cell class. is there way in clojure? i'm doing proxy i'm okay using :gen-class if necessary. thought read somewhere can override immediate base class in clojure. (defn make-editing-cell [] (let [textfield (atom nil)] (proxy [tablecell] [] (startedit [] (proxy-super startedit) (println "start editing")) (canceledit [] (proxy-super canceledit) (println "cancel editing")) (updateitem [item empty] ;(proxy-super updateitem ) ;; causes runtime error no matching field found (if empty (do (println "empty!") (doto (.settext nil) (.setgraphic nil))) (do (println "not empty!&

c# - Save BitmapImage to File -

i working on program downloads images url bitmapimageand displays it. next try save bitmapimage harddrive using jpegbitmapencoder. file created actual jpeg image empty or 1 black pixel. public guid savephoto(string istrimagepath) { imagepath = istrimagepath; bitmapimage objimage = new bitmapimage( new uri(istrimagepath, urikind.relativeorabsolute)); picturedisplayed.source = objimage; savedcreationobject = objimage; guid photoid = system.guid.newguid(); string photolocation = photoid.tostring() + ".jpg"; //file name filestream filestream = new filestream(photolocation, filemode.create); jpegbitmapencoder encoder = new jpegbitmapencoder(); encoder.frames.add(bitmapframe.create(objimage)); encoder.save(filestream); return photoid; } this function saves , displays photo. photo displayed correctly again when saved empty jpeg or 1 black pixel. when create bitmapimage uri, time required download image. if ch

php - Yii reset field value on addError -

i'm looking reset field value when calling adderror function within controller. $model->adderror('table_name','table "'.$model->table_name.'" used. pick new name.',array('value'=>$current_name)); can pass param values activeform textfield adderror function? , if so, how? reset? set empty string after have added error. $model->table_name = "";

java - Show TextView from Main method in widget -

hey guys want program application shows countdown specific day. on top of want offer widget. main activity ok don't know how reference of textview in main activity. show code(sorry i'm beginner :) ) main: public class mainactivity extends activity { private static final string tag = mainactivity.class.getsimplename(); textview tv; long diff; long milliseconds; long endtime; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); typeface tf = typeface.createfromasset(getassets(), "fonts/pricedow.ttf"); tv = (textview)findviewbyid(r.id.textview1); tv.settypeface(tf); simpledateformat formatter = new simpledateformat("dd.mm.yyyy, hh:mm"); formatter.setlenient(false); ...................................................................................... widget: public class exampleappwidgetprovider extends appwidgetpr

javascript - How to get images to load faster in HTML5 mobile app? -

in html5 mobile app, retrieving 10 images @ time imgur (the user clicks button more images). when images retrieved, apply formatting via css (mostly height , width fits dimensions of iphone). my guess 1 of reasons why it’s taking long because i’m applying formatting images once they’re retrieved , showing these images. better off saving images in state should displayed right dimensions don’t have apply css them? in getting images load faster? thanks! according this post , should grabbing 6 @ time. also, open browser's debugger, go netowrk tab , watch how long things taking.

python - Pymongo and n-grams search -

i have collection of documents in mongo db. using pymongo access , insert collection. want : in python, use map reduce efficiently query number of times n -gram phrase used across entire corpus. i know how single words, struggling extend n-grams. dont want tokenize using nltk library , run map reduce. believe take efficiency out of solution. thanks. if want efficient system, you'll need break down n-grams ahead of time , index them. when wrote 5-gram experiment (unfortunately backend offline had give hardware), i've created map of word => integer id , , stored in mongodb hex id sequence in document key field of collection (for example, [10, 2] => "a:2" ). then, randomly distributing ~350 million 5-grams 10 machines running mongodb offered sub-second query times whole data set. you can similar scheme. document such as: {_id: "a:2", seen: [docid1, docid2, ...]} you'll able find given n-gram found. update: actually, small co

Python OS.System with variables and quotes -

#!/usr/bin/python import os readline = open('desktops.txt','r') line in readline: machinename = line query = os.system(r'wmic -u corp.fakedomain.com/domainusername%password //'+machinename+ '"select * win32_useraccount localaccount = true"|grep "500|"|cut -d "\\" -f 2|cut -d "|" -f1') getting..... "example: wmic -u [domain/]adminuser%password //host "select * win32_computersystem" sh: syntax error: unterminated quoted string" if replace \\machinename variable real ip 192.168.1.100 works fine.

Railo 4/ Tomcat / IIS7.5 / Coldfusion / cffile upload of docx not working -

i moved web application coldfusion railo server , encountered puzzling issue application's file upload functionality. works fine files, .docx files don't uploaded. in railo see error: form field [form.theformfieldname] not file field i have registered "docx" mimetype in iis , tomcat application/vnd.openxmlformats-officedocument.wordprocessingml.document i did small test , cfdumped #form# twice. first time .doc file, , second time .docx file. dump 1: .doc file scope docsbestand string c:\inetpub\wwwroot\site\web-inf\railo\temp\tmp-321.upload fieldnames string jsoninput,docsbestand jsoninput string {"pro":{"idaanvraag":"052300022920333" ,"bron":"spontaan"},"apiklant":"demo","apikey":kl541231231} dump 2: .docx file docsbestand string pk!0�(r�[content_types].xml �(��t�n�0�w�?d�v������[��0��z��l�i�q�b� \"%���ك�ښl �w%�=���^i7+���%�g&�0�a�6�l4��l60#�Ò�s ���

javascript - A variable that I've initialized is undefined when I try to use it on the next line of code -

i'm developing web application heavily using javascript , jquery. i create app object when web page loads , call init() method in footer. var app = new app(); app.init(); these first lines of code in init() method. // load index app.loadindex(); alert(hashtag_index); these few lines of loadindex() method. hashtag_index = []; // load topic json file $.ajax({ url : './data/index.json', type : 'get', datatype : 'json', . . . // if file loading successful, save index data success : function(data){ var raw_index = []; $.each(data, function(key, val) { raw_index.push(data[key]); }); // add hashtag object global hashtag_index hashtag_index = raw_index; } }); basically loadindex() method loads json file 135kb , load data object hashtag_index variable. hashtag_index variable defined global, it's accessible globally. the variable hashtag index have 8 different obj

client - Breeze Server-Side errors and Sql triggers -

how sql server database trowed errors details @ client side (like sql raiserror level) using breeze manager perhaps in savechanges fail function. example : // server-side (sql-server : trigger - after insert) raiserror ('espace utilise par place, cannot delete.', 16, 1) rollback tran return // client-side (breeze : savechanges - savefailed) var savechanges = function () { ..... function savefailed(error) { var msg = 'save failed: ' + geterrormessages(error); logerror(msg, error); error.message = msg; throw error; } }; update 1 : ok, after updated breeze version 1.4.1 i've got error details @ client : a) application stop @ server-side (breeze controller api) invalidoperationexception @ code bellow point without debug breakpoint assigned. [httppost] public saveresult savechanges(jobject savebundle) { return _contextprovider.sa

XPages iNotes Calendar -

Image
how control display of time , dates on inotes calendar control in xpage? have times shown using 12 hour format hh:mm , date use mmm dd, yyyy. thank you. the date , time format inotes calendar defined in language files common languages. these language files specific inotes calendar. they stored in com.ibm.xsp.extlib.domino_x.x.x.xxxxxxxx-xxxx.jar file in folder dominoserverpath\data\domino\workspace\applications\eclipse\plugins . if unpack jar file (it's zip file) you'll find folder resources\web\dwa\date\nls , there language specific subfolders de , en , en-gb , en-ie , en-us . date , time format definied in subfolders in file calendar.js . this file starts e.g. en-us lines: surprisingly, date , time format not right en-us . same en , en-gb , en-ie . i'd call bug or @ least wrong packaging. if change time format line d_dtfmt_time0: "hh:mmt" 12 hour time format am/pm. close setting d_dtfmt_time0 other settings date , time forma

Java applet throws error in remove object from Iterator array -

welcome, programming simple rpg game in java applet. getting more , more complicated , many errors thrown face. today have problem .remove(); method. exception in thread "awt-eventqueue-1" java.util.concurrentmodificationexception @ java.util.arraylist$itr.checkforcomodification(unknown source) @ java.util.arraylist$itr.remove(unknown source) @ rpg.main.paint(main.java:365) @ rpg.main.update(main.java:331) @ sun.awt.repaintarea.updatecomponent(unknown source) @ sun.awt.repaintarea.paint(unknown source) @ sun.awt.windows.wcomponentpeer.handleevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$200(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source)

asp.net - Change execution timeout at runtime -

in cases, build reports in asp.net require several minutes build -- longer default execution timeout. possible change timeout @ runtime and/or specific page [and/or specific webservice method]? we've experimented httpruntimesection.executiontimeout no avail (throws exception @ runtime saying the configuration read only. ). you can adjust timeouts in webconfig file desired page <location path="somefile.aspx"> <system.web> <httpruntime executiontimeout="180"/> <system.web/> <location/>

Need help formatting CoffeeScript using the plugin in Visual Studios 2012 -

what's exact cofeescript produce following javascript: var addartist= function() { var adddiv, artistval; adddiv = $("#artistname"); artistval = $("#artistinput").val(); $(" <div id=\"artistname2\"><label>" + artistval + "</label> /div>").appendto(adddiv); return false; }; i tried using http://js2coffee.org/ convert cofee which produces: addartist = -> adddiv = undefined artistval = undefined adddiv = $("#artistname") artistval = $("#artistinput").val() $(" <div id=\"artistname2\"><label>" + artistval + "</label> /div>").appendto adddiv false when paste visual studios uses cofeescript plugin ouput is: (function() { var addartist; addartist = function() { var adddiv, artistval; adddiv = $("#artistname"); artistval = $("#artistinput").val();

templates - Server side ASP.NET driven templating system w/ logic (similar to JsRender) -

i'm looking templating library, similar jsrender , runs server side on .net. mustache non-starter, because it's logic-less. need functionality similar {{if}} , {{else}} , {{for array}} , , ability call custom functions within template. in theory, use jsrender on server reading output watin or other .net headless browser ... thought i'd put question out there in case can bypass headless browser part. any ideas?

Java: String immutability and operator == -

this question has answer here: how compare strings in java? 23 answers i have code cannot understand. in beginning can see 2 identical strings, , when compare them use of operator == says true, same equals() method, when create 2 identical strings during runtime operator == says false. why happening ? does mean when hardcode identical strings placed in same position in memory , both references point it? found similar question , there no explicit answer. public class stringtesting { public static void main(string[] args){ string string1 = "hello"; //\ // } same place in memory ? string string2 = "hello"; /// system.out.println(string1 == string2); //true system.out.println(string1.equals(string2)); //true

java - Connect tomcat through socket -

i have been trying communicate tomcat using socket. forming http message , writing outputstream. connection gets established not receiving response. when trying connect through telnet same message able response. please find code snippet below , point missing. string text1 = text.gettext(); string text2 = text_1.gettext(); string address = combo.gettext(); system.out.println("text1 =" + text1 + " text2 = " + text2 + " address = "+address); try{ stringbuilder builder = new stringbuilder(); socket socket = new socket("localhost", 8082); dataoutputstream outtoserver = new dataoutputstream(socket.getoutputstream()); bufferedreader infromserver = new bufferedreader(new inputstreamreader(socket.getinputstream())); //u need post actual http message here stringbuilder requestbuil

vb.net - If - Strange Behavior in Detecting Type -

i discovered strange behavior in vb.net today in trying work nullable datetime data. pulling datetime value out of xml file inserting database, , want allow empty value. thought should use if prevent casting errors: dim lastrun datetime? = _ if(rowdata("lastrun") = "", nothing, ctype(rowdata("lastrun"), datetime)) it seems should return value of nothing in case if false, or value of date time lastrun if value not blank. instead, when if condition returns false, value of datetime.minvalue , causes exception on insert database due sql datetime underflow. i able fix using datetime? cast in last parameter, behavior seems odd me. expected type datetime? because that's variable type. also, narrowest type can allow both possible result values datetime? , since either datetime or nothing . , yet somehow decides result value should datetime , guess typecasts nothing datetime.minvalue ? going on here? part of problem i'm used

internet explorer 9 - SEC7111: HTTPS security is compromised using IE -

i'm having issues having image gallery display in ie. http://www.campchiefouray.org/summer-camp-photos-2013.html running url through developer tools in browserstack i'm seeing following error. has had issue, , if so, coming , , importantly how can fix?! appreciated. sec7111: https security compromised http://www.campchiefouray.org/summer-camp-photos-2013.html

javascript - jquery plugin method ands callbacks -

i have basic plugin populates array within plugin. how can array via method call parameters. first plugin please go easy on me if dumb question. basic plugin (function($) { $.fn.myplugin = function() { return this.each(function(){ tagarray = []; // array populated //code stuff populate array }); } })(jquery); i tagarray so... var arr = $('.classname').myplugin("getarray"); where can use array elsewhere. how can accomplish this? thank help. i don't see why need "getarray" parameter. in case need define 1 array , make function return it: (function($) { $.fn.myplugin = function() { var tagarray = []; this.each(function(){ // add tagarray }); return tagarray; } })(jquery);

javascript - setInterval doesn't seem to re-execute php script -

what i'm trying variable update every 5 seconds doing this: setinterval(document.getelementbyid("listeners").innerhtml = "<?php include('../includes/shoutcaststuff.php'); echo $dnas_data['currentlisteners']; ?>",5000); but happens inner html set doesn't update every 5 seconds should. guess php executes once, have no idea if that's case or not. , i'm aware should make function stuff inside setinterval... i'll clean code once figure out how make work. in advance. ok... ajax 'the best' answer since no more 2 people logged in @ time here server requests isn't such big deal. here's how got work: function lcount(){ $.get("../includes/shoutcaststuff.php",{count: "true"}, function(data){ document.getelementbyid('listeners').innerhtml = data; }); } setinterval(lcount,5000); and added end of php: if(isset($_get["count"])){ echo $dnas_dat

html - php mail form w/upload option not working correctly -

i trying create quote form basic contact info, checkbox option , option upload image email complete form email address. have html portion have problem php part. when form emails me sends contact info , fails send option check checkbox , image uploaded. here code form html portion: <form action="quote_form.php" method="post" enctype="multipart/form-data" name="quoteform" id="quoteform" onsubmit="mm_validateform('name','','r','lastname','','r','email','','risemail','phone','','risnum','textfield','','risnum');mm_validateform('name','','r','lastname','','r','phone','','risnum','email','','risemail','info-about-item','','r');return document.mm_returnvalue"> <p> <

forms - Is there a way to set a distinct ID and name for a text_field in Rails 2? -

i've got rails 2 site i'm trying add form handler to, i'm running problems converting html form fields form handler fields. the form code begins with: <% form_for @newsavedmap, :html=>{:id=>'createamap'} |f| %> i keep getting errors when try things <%= text_field :newsavedmap, :html=>{ :value => 'new map', :name=>'newsavedmapname', :id=> 'savedmap_name', :size => '30' } %> error: actionview::templateerror (wrong number of arguments (1 2)) on line #284 of app/views/layouts/maptry.html.erb: here fields. how can convert these form handler fields in rails 2? <input id="savemap_name" name="newsavedmapname" size="30" type="text" value="new map"></p> <select id="startdrop" name="startthere"> <options here> </select> <select multiple id="waypoints&qu