Posts

Showing posts from September, 2011

c - Why are the values of a struct corrupted after the struct is initialized? -

i trying initialize array of structs values, cannot values stay constant. use initial loop retrieve values string , assign them struct in array. once try iterate through array loop, of values not same. this code in question: void printorder(order *node) { printf("title is: %s\n",node->title); printf("price is: $%f\n",node->price); printf("id is: %d\n",node->custid); printf("category is: %s\n",node->category); } void initorder(order *neworder, char *title, double price, int custid, char *category) { neworder->title = title; neworder->price = price; neworder->custid = custid; neworder->category = category; neworder->next = null; printf("new order object initialized\n"); } char *title; char *pricetemp; char *idtemp; char *category; order localorders[numorders]; // num

ruby - How can I remove a line in one file on Rails? -

i trying remove line in 1 file on rails. found method gsub_file, undefined method in rails 4. it's reverse method of insert_into_file of thor. e.g.) app/assets/stylesheets/application.css before *= require_tree . <- needs removed! *= require_self after *= require_self this should performed in rails application template. if implementing application template (for use rails new myapp -m option), try using thor gsub_file , this: gsub_file 'app/assets/stylesheets/application.css', /*= require_tree .\n/, "" take @ rails_apps_composer gem if you'd see lots of file manipulation using thor.

Scrollbar on JavaFX table leaves a white space when using custom CSS -

Image
a picture worth thousand words: . as can see i'm using custom css on table, cant fill upper-right corner. tried changing background of scroll-pane without result. here's actual css: .table-row-cell { -fx-background-color: rgba(71, 81, 80,0.5); } .table-row-cell:hover { -fx-background-color: rgba(40, 96, 93, 0.50); } .table-row-cell:hover:empty { -fx-background-color: rgba(71, 81, 80,0.5); } .table-row-cell .table-cell { -fx-border-width: 0px; } .table-view { -fx-border-color: rgba(1, 11, 12, 1); -fx-background-radius: 2; -fx-border-width: 1px; -fx-border-radius: 2; -fx-background-color: rgba(71, 81, 80,0.2); -fx-background-insets: 0; } .table-view .column-header { -fx-background-color: rgba(1, 11, 12, 1); } .scroll-bar { -fx-background-color: rgba(1, 11, 12, 1); } .scroll-bar .increment-button:hover { -fx-background-color: rgba(1, 11, 12, 1); } .scroll-bar .decrement-button:hover { -fx-background-color: rgba(1, 11, 12, 1); } .s

c# - Count numbers of \r\r in a string -

this question has answer here: how count of sub-string occurrences? [duplicate] 8 answers i want count, how have \r\r in string variable. for example: string samplestring = "9zogl22n\r\r\nv4bv79gy\r\r\nkaz73ji8\r\r\nxw0w91qq\r\r\ns05jxqxx\r\r\nw08qsxh0\r\r\nuyggbaec\r\r\nu2izr6y6\r\r\n106iha5t\r"; the result in example 8. you can write simple extension method that: public static int linefeedcount(this string source) { var chars = source.tochararray(); bool found = false; int counter = 0; int count = 0; foreach(var ch in chars) { if (ch == '\r') found = true; else found = false; if (found) counter++; else counter = 0; if(counter != 0 && counter%2 == 0) count++; } return count; } then use it: int count = inputstring.linefeedcount();

android - App crashing when trying to save to SD Card -

i'm trying make app averages colour , stuff, have. i've got colour in imageview , have made bitmap, want save on sd card. when press button try , make so, crashes. i'm hoping give its' own folder when saving, , custom file name. (in ideal world, i'd 1 increases 1 each time, swatch_01.png , swatch_02.png , etc.) if it's simple might cry little bit. edit: thank guys, it's fixed. hadn't created javerager_swatches folder , imageview wasn't converting bitmap correctly. had @ after amount of sleep , managed solve it. package com.colours.javerager; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.outputstream; import android.app.actionbar; import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.graphics.drawable.bitmapdrawable; import android.os.bundle; import android.os.environment; import android.support.v4

tcl - How to PUT xml content using method ::http::geturl -method PUT -

when tried fire fox open httprequest addon, able put sucessfully. put http://12.222.20.17:8080/qcbin/rest/domains/test/projects/runtest/runs/385762 accept: application/xml content-type: application/xml <entity type="run"> <fields> <field name="status"> <value>passed</value> </field> </fields> </entity> -- response -- 200 ok server: apache-coyote/1.1 but trying simulate same operation tcl put method http package, getting bad request response set xml {<entity type="run"><fields><field name="status"><value>passed</value></field></fields></entity>} set headers(cookie) $cookie set headers(accept) "application/xml" set headers(content-type) "application/xml" set headers(content) $xml set token [::http::geturl "http://12.222.20.17:8080/qcbin/rest/domains/test/projects/runtes

crash - Debugging Python Fatal Error: GC Object already Tracked -

my python code has been crashing error 'gc object tracked' . trying figure out best approach debug crashes. os : linux. is there proper way debug issue. there couple of suggestions in following article. python memory debugging gdb not sure approach worked author. is there way generate memory dumps in such scenario analyzed. in windows world. found article on this. not entirely answers question: http://pfigue.github.io/blog/2012/12/28/where-is-my-core-dump-archlinux/ found out reason issue in scenario (not reason gc object crash). used gdb , core dumps debug issue. i have python , c extension code (in shared object). python code registers callback routine c extension code. in workflow thread c extension code calling registered call routine in python code. this worked fine when multiple threads did same action concurrently resulted in crash 'gc object tracked'. synchronizing access python objects multiple thread resolve issue. than

mysql - show sum per time period and sum per entire time span -

i have product sells monthly , have user's email i want see total sum purchased per month per email. also total amount purchased per email months combined try : i understand question this select email,sum(amount),'2' ord ( select email,sum(amount) amount ,month(d1) t1 group month(d1),email) t group email union select email,sum(amount) amount, '1' ord t1 group month(d1),email order ord this query return first show sum of amount per month , email after show sum of amount per email

Rails: getting nil values in hidden field -

i'm getting nil values when i'm using hidden field <%= form_for @hour |f| %> <%= f.hidden_field "days[]", :value => "sunday" %> <%= f.hidden_field "days[]", :value => "monday" %> <%= f.hidden_field "days[]", :value => "tuesday" %> <%= f.hidden_field "days[]", :value => "wednesday" %> <%= f.hidden_field "days[]", :value => "thursday" %> <%= f.hidden_field "days[]", :value => "friday" %> <%= f.hidden_field "days[]", :value => "saturday" %> <% end %> my parameters: "days"=>[nil,nil,nil,nil,nil,nil,nil] am doing hidden fields wrong? thanks check if below code helps. <%= form_for @hour |f| %> <%= f.hidden_field "days[0]", :value => "sunday" %> <%= f.hidden_field "days[1]&quo

VBA on Excel "Out of Memory" error -

i'm on excel 2010, on admittedly large sheet (400k rows x 20 columns). my code aims to: load entire sheet array examine every row criteria rows qualify copied array finally return second array sheet the second array end being 90% of original i wrote definition of 2 variable arrays variants , tried initialize them copying sheet's content twice. first copy works, second 1 hit error of "out of memory". any ideas if there's workaround? or limitation of vba/ excel. is there way not pre-define / initialize destination array, , instead, let "grow" every successful qualification of criteria? (on scale of magnitude). sub copypending() dim lastrow long dim lastcol integer dim allrange() variant dim copyrange() variant dim long dim x long dim z long lastcol = 21 lastrow = activesheet.usedrange.rows.count allrange = range(cells(2, 1), cells(lastrow, lastcol)).value copyrange = range(cells(2, 1), cells(lastrow, lastcol)).value '''

c# - program database plugin based (plugin base)? -

i’m writing program based on plugin, have database has customer list name , etc plugin written project supposed calculate incoming data (information) , assume there 4 individuals going write 4 plugins program , instance 1 obtains number of customers , second plugin calculates debts , etc thing how can enter customer list in interface input in way ones write plugins won’t involved in database , have information interface input , job subsequently namespace pluginbasdeapp.plugindefenition{ public interface iplugin { string name { get; } list<iaction> actions { get; } } } namespace pluginbasdeapp.plugindefenition{ public interface iaction { string name { get; } list<customer> run(list<customer> customers ); } }

security - format string vulnerability in C# or JAVA -

i have found format string vulnerability in c++ c++ old language.i want know format string vulnerability still exist in modern languages c# or java format string vulnerability :- format string problems classic c/c++ issue rare due ease of discovery. reason format string vulnerabilities can exploited due %n operator. %n operator write number of characters, have been printed format string therefore far, memory pointed argument. however, languages such c# , java produce managed code not susceptible memory address overwrites clr/jvm manage process memory rather being responsibility of developer. can mean buffer overflow vulnerability lot less (but can happen depending on 3rd party components being called or vulnerabilities in languages themselves). so answer no managed languages such c# , java.

android listview fling animation is too fast -

i have custom listview shows items "page page". i've written ontouch method , works perfect, want write onfling method realize smooth , inertial scrolling of listview. the problem scrolling animation of smoothscrolltoposition(int position) isn't smooth, it's fast. smoothscrolltoposition(int position, int offset, int duration) works, minsdk must 8 , besides functions place current element badly despite on offset. this code of onfling method: @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { if(null == getadapter()) return false; boolean returnvalue = false; float pty1 = 0, pty2 = 0; if (e1 == null || e2 == null) return false; pty1 = e1.gety(); pty2 = e2.gety(); if (pty1 - pty2 > swipemindistance && math.abs(velocityy) > swipethresholdvelocity) { float currentvelocity = math.min(math.abs(velocityy),

android - How To Use non-staticHow “getSystemService” in Custom adapter? -

in android eclipse when want use non-statichow “getsystemservice", show me error: cannot make static reference non-static method getcontext() type arrayadapter arrayaddapter.java : package ir.redreactor.app.com.noviner; import java.util.arraylist; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.textview; public class adapternote extends arrayadapter<structnote> { public adapternote(arraylist<structnote> array) { super(g.context, r.layout.adapter_notes, array); } private static class viewholder { public viewgroup layoutrt; public textview txttitle; public textview txtsort; public textview txttablename; public textview txtid; public textview txtpos; public textview txtdetail; public viewholder(view view) { txttitle = (textview) view.findviewbyid(r.id.txttitlean); txtsort = (textview)

.htaccess - How to block an empty user agent request -

is there solution preventing http request has empty user agent string preferably using .htaccess? #redirect empty user agent, unless it's accessing rss feed rewritecond %{http_user_agent} ^$ rewritecond %{request_uri} !^/rss.php # <-- path rss.php rewriterule .* http://%{remote_addr}/ [r,l] source: http://wiki.e107.org/index.php?title=htaccessexample

hadoop - zookeeper.znode.parent mismatch exception -

i have installed hadoop 2.2.0 & hbase-0.94.18 on ubuntu 12.04. when try run command create 't1','c1' in hbase shell, following error- error client.hconnectionmanager$hconnectionimplementation: check value configured in 'zookeeper.znode.parent'. there mismatch 1 configured in master. what's wrong? a few things in no particular order: to start with, let error display continue. try 7 times , exit. before exits, show name of exception occurring. try up. says masternotrunningexception . verify master indeed running doing $sudo jps . should see entry hmaster . if not, start hbase-master service. assuming you're going pseudo-distributed mode, may want check /etc/hosts make sure entries point 127.0.0.1 , not 127.0.1.1 . for cloudera's installs, here guide on how setup hbase in pseudo-distributed mode. includes instructions install hbase-master , zookeeper correctly.

html - image height 100% comes out larger than div -

i'm trying make image inside div 100% of height, width proportional. when set height 100% comes out larger div . misunderstanding height 100% means? here's css: #whoami_bg { position: absolute; left: 3%; top: 26%; width: 45%; height: 35%; background: rgba(50, 204, 239, 0.4); } #whoami_bg img { height: 100%; width: auto; display: block; margin: 0 auto; } and here html: <div id="whoami_bg"> <br /> <a href="whoami.html"> <img src = "images/whoami_image.gif" /> </a> </div> it scale, scales big. happens in chrome , safari @ least. have tried giving image class = "whoami" , putting style in img.whoami tag, works same. reason images have decided give 110%. :p it seems simple; how make image 100% height of div ? remove tag code: <br /> it pushes <a> content down , overflows it's parent container.

pointers - Assigning a type uintptr to uint64 in GoLang -

i'm trying assign value found in variable of type uintptr uint64 variable in go. using myvar = valfromsystem gives me cannot use valfromsystem (type uintptr) type uint64 in assignment and trying myvar = *valfromsystem gives me invalid indirect of valfromsystem (type uintptr) is there way pull value pointed valfromsystem assign myvar? first, cast valfromsystem unsafe.pointer . unsafe.pointer can casted pointer type. next, cast unsafe.pointer pointer whatever type of data valfromsystem points to, e.g. uint64 . ptrfromsystem = (*uint64)(unsafe.pointer(valfromsystem)) if want value of pointer (without dereferencing it), can use direct cast: uint64fromsystem = uint64(valfromsystem) though remember should use type uintptr when using pointers integers.

hadoop - spring xd stream definition dynamic parameters -

we need use hdfs sink store data in hdfs. when creating stream definition, can use "directory" property specify hdfs directory want save file. however, in our use case want directory dynamic based on timestamp. thinking if it's possible maybe use spel in directory property of hdfs sink maybe extract timestamp header? thanks!! rodrigo knows this, else checking out thread, see explanation of new functionality searching "partitionpath" under section of reference doc: https://github.com/spring-projects/spring-xd/wiki/sinks#hadoop-hdfs

java - Split string at hyphen characters too -

the line below splits string on ( . ), ( , ), ( : ) , newline ( \n ) characters. string[] textphrases = text.split("[.,:\\n]"); i need split on hyphen characters too, not work: string[] textphrases = text.split("[.,:/-/\\n]"); what missing or doing wrong? thank you. this regex. hyphen has special meaning inside character class. need place hyphen first or last item in class: [-.,:\n]

executable - How do I create a standalone exe with AutoHotkey? -

i have created script remap windows button right-mouseclick . how can create executable autohotkey file can offer download, automatically runs script? why not use ahk2exe ? according docs, can use in 3 ways: gui interface: run "convert .ahk .exe" item in start menu. right-click: within open explorer window, can right-click .ahk file , select "compile script" (only available if script compiler option chosen when autohotkey installed). creates exe file of same base filename script, appears after short time in same directory. note: exe file produced using same custom icon, .bin file , use mpress setting last used method #1 above. command line: compiler can run command line following parameters: ahk2exe.exe /in myscript.ahk [/out myscript.exe] [/icon myicon.ico] [/bin autohotkeysc.bin] [/mpress 0or1] for example: ahk2exe.exe /in "myscript.ahk" /icon "myicon.ico" usage: parameters containing spaces should

Scala: Option[T] as ?[T] (or even T?) -

i tried type ?[_] = option[_] def f(x: ?[int]) = (y <- x) yield y (but don't know doing.) insofar types objects, should able define postix operator (i.e. 0 arity method) use in type signatures (i think). might need space like def f(x: int ?) = (y <- x) yield y scala makes easy use option type matching , polymorphism, avoid null. but, classes (nullable) vars , java returns vars. using classes , calling java 2 of scala's selling points. easy-to-write , easy-to-read syntax support options more strongly. what things scala "?" make parsing special. ideally, 1 write def f(x: int?) = (y <- x) yield y like other languages. can in scala (without macro)? first, types not objects. in fact, scala has 2 namespaces: values , types. different things, , play different rules. the postfix idea kind of nice, actually, not possible. there's infix notation types, though. now, wrote: type ?[_] = option[_] each underscore has different m

Ignore a field when creating a mapping on elasticSearch using NEST -

i'm creating index , adding mapping indexdescriptor, have couple of doubts regarding mapping process: how can avoid index specific field class? how can boost , specify value of "boostfield" fluent interface configuration? is indexdescriptor correct place map class fields without using elasticproperty attribute i'm asking these questions because i'm new using nest , seems current documentation outdated how i'm creating index: createindex(indexname, descriptor => descriptor.addmapping<candidatetextinfo>( m => m.mapfromattributes(). boostfield(c=>c.setname(d=>d.headline)).numericdetection())); public class candidatetextinfo { public string profilepicture { get; set; } public objectid userid { get; set; } //field ignore on mapping public string name { get; set; } public string headline { get; set; } public gender gender { get; set; } public byte rating { get; set; } pu

android - The method onListItemClick(ListView, View, int, long) is undefined for the type Fragment -

i getting method onlistitemclick(listview, view, int, long) undefined type fragment error: fragmentc.java: package com.example.fragment; import android.graphics.color; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmenttransaction; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.viewgroup.layoutparams; import android.widget.listview; import android.widget.textview; public class fragmentc extends fragment{ textview mtext; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { textview mtext = new textview(getactivity()); mtext.settext("fragment c added. \n click button go previous state"); mtext.setbackgroundcolor(color.magenta); mtext.setlayoutparams(new layoutparams(layoutparams.match_parent, layoutparams.match_parent));

java - communicate with rest services via domino agent -

i need communicate external rest service. have 'sync' information between notes database , other system e.g. when user creates document in notes similar 'note' should created in other system. i have received info describes service (how perform crud operations). i assume agent should written in java instead of lotusscript. can provide example agent connect service , perform basic post/get calls?

sql - Insert records into two tables having common column -

i want insert name stud in foreign key t_id primary key in table (teacher) want know query that. insert stud s_id,name,t_id,username,password s_id="+s_id) this query writing in jsp page...but giving me error cannot add or update child row: foreign key constraint fails (`userdb`.`stud`, constraint `stud_ibfk_1` foreign key (`t_id`) references `teachers` (`t_id`)); ("insert stud(s_id,name,t_id,username,password) values ( " + s_id + "," + name + "," + t_id + "," + username + "," + password + ")") this correct parameterized insert query syntax. your query had 2 where clauses written incorrectly, plus values clause not there, plus didn't mention column names explicitly in syntax. hence, query doesn't make sense @ all. p.s. used dummy data. insert appropriate , relevant data in query. also, assumed parameter names same columns' names. please modify parameters according code if necess

maven - Error in neo4j connectivity with Java -

on adding "dependencies" given above pom file got following error message. dependencies: <dependencies> ... <dependency> <groupid>org.neo4j</groupid> <artifactid>neo4j-jdbc</artifactid> <version>1.9</version> </dependency> </dependencies> <repositories> <repository> <id>neo4j-maven</id> <name>neo4j maven</name> <url>http://m2.neo4j.org</url> </repository> </repositories> code : package javaapplication2; import java.sql.*; import java.io.*; import java.util.*; import java.sql.*; import javax.swing.joptionpane; /** * @author shanal */ public class neo { public static void main(string[] args) throws exception { // make sure neo4j driver registered class.forname("org.neo4j.jdbc.driver"); // connect connection con = drivermanager.getcon

mysql - PHP Form with required fields -

i want creat form can connect mysql , can insert records have done. want make fields mandatory, username , car example. showing error field required or "name cannot have numbers". stuff that. unable figure out. some please: i have index.html <form action="insert.php" method="post"> nume: <input type="text" name="name"><span class="error">* <?php echo $error;?></span><br> prenume: <input type="text" name="prenume"><br> masina: <input type="radio" name="masina" value="vito"> (vito) <input type="radio" name="masina" value="skoda"> (skoda) <input type="radio" name="masina" value="skoda2"> (skoda) <input type="radio" name="masina" value="audi"> (audi)<br><br> data: <input type="date" name

android - Onkeydown failed to work on (screen touch ) -

i have textbox default value onkeydown should cleared default value seems i'm not able fix please me on this. this script $('input').keydown(function () { this.value = "" }); $('input').blur(function () { if (this.value = "") { this.value = this.title; } }); you want use focus() not keydown() clearing default text, otherwise won't possible type in box. secondly, javascript case sensitive, should if , not if , , need use == comparison operator. $('input').focus(function () { this.value = "" }); $('input').blur(function () { if (this.value == "") { this.value = this.title; } });

bash - How to allocate array which is passed to a function by name -

i want create function iterates through array , inserts given value, if not yet included. using function on 2 different parts of code , have use different arrays. therefore delivering array names function. can't figure out how allocate slot of array store element @ place. here code: name=("hello" "world") function f { array_name=$2[@] array=("${!array_name}") length=${#array_name[@]} (( = 0; <= $length; i++ )); if [[ "${array[i]}" = "$1" ]]; break; fi if [[ "$i" = "$length" ]]; ${2[$length+1]=$1}; fi done } f "test" "name" edit: want array append given value this for in ${name[@]} echo $i done would have output: hello world test but apparently "${2[$length+1]=$1}" not working. (idea passing array here: bash how pass array argument function ) if understand correctly want

c# - How to check if slideshow is running -

i want check if slideshow running. here code: private void checkslideshow() { if (globals.thisaddin.application.activepresentation.slideshowwindow.active == msotrue) { //slideshow running } } i error: the name 'msotrue' not exist in current context what msotrue , need write here ... == ? write msotristate.msotrue http://msdn.microsoft.com/en-us/library/ms251168 .

Reading large XML files with MATLAB -

after searching online tonight i've failed find solid solution problem. i have large xml files, more n42 schema xml ( link ), i'd read matlab. size wise, these files 50mb - 300mb i.e. large. i need couple of tags within file it's proving difficult data! standard matlab xmlread() function uses dom access runs memory problems , takes forever. is there easy option matlab e.g. sax or using regular expressions? i'm happy if isn't elegant solution, allow me access data. thanks in advance! you can use java within matlab . use java sax parser.

python - Scrapy -- scrappy not returning information from a html tag -

i'm trying of scraping website, i'm using scraping scrapy , when make scraping html data, html tag need obtain data, i'm using xpath obtain of data tag not return nothing this website (" http://www.exito.com/products/0000293501259261/arroz+fortificado?cid=&page= ") , part of html i'm scraping <div class="pdpinfoproductprice"> <meta itemprop="currency" content="cop"> <h4 itemprop="price" class="price"> $5.350</h4> </div> i need use scrapy on tag h4 obtain price , when i'm scraping obtain class empty, class not have tag inside should simple thing do, can not get price in way i using xpath on page can obtain price sel.xpath('[@id="plpcontent"]/div[3]/div[5]/h4').extract() sel.xpath('//*[@id="atg_store_two_column_main"]/div[2]').extract() //*[@id="mainwhitecontent"]/div[2]/div[1]/div[1]/div[1]/d

eclipse - android app is crashing -

using big nerd ranch tutorial book , finished chapter or have 1 page left there points in quizactivity.java i'm not sure if i'm supposed delete. my quizactivity.java is package com.bignerdranch.android.geoquiz; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v7.app.actionbaractivity; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.button; import android.widget.textview; import android.widget.toast; public class quizactivity extends actionbaractivity { private button mtruebutton; private button mfalsebutton; private button mnextbutton; private textview mquestiontextview; private truefalse[] mquestionbank = new truefalse [] { new truefalse(r.string.question_oceans, true), new truefalse(r.string.question_mideast, false), new truefalse(r.string.question_africa, fals

android - How to check an EditText has focus? -

how check edittext has focus? there method boolean hasfocus() yes, hasfocus() there, inherited android.view.view another way achieve edittext et = (edittext) findviewbyid(r.id.edittxt); if(this.getcurrentfocus().getid() == et.getid()){ // view in focus }else{ // not in focus }

python - DateTimeProperty time-zone -

using gea , trying set time-zone datetimeproperty below. set timezone in model class , not when creating entry. class person(ndb.model): date_created = ndb.datetimeproperty(auto_now_add=true) you not setting timezone, setting datetime, when create entity. timezone should stored seperately. appengine datetime functionality works utc. you should convert utc when performing queries, , timezone want when displaying content.

networking - Confusion regarding SSH Security after Authentication -

i have been reading ssh , how uses public key crytography authenticate client. have understood concepts have doubt: quoting archlinux wiki page: "when ssh server has public key on file , sees requesting connection, uses public key construct , send challenge. challenge coded message , must met appropriate response before server grant access. makes coded message particularly secure can understood private key. while public key can used encrypt message, cannot used decrypt same message. you, holder of private key, able correctly understand challenge , produce correct response." after authentication happens , server gives me access, how further messages encrypted? of commands run on server, how ensure response of of commands indeed valid/genuine? short version: during key exchange phase symmetric cipher chosen , new symmetric key generated. communications after point encrypted and, due properties of (good) key exchange protocol, session key known particular clie

asp.net - Debug VBScript from MSScriptControl.ScriptControlClass, Change DefaultAppPool registry -

i have asp.net application use msscriptcontrol.scriptcontrolclass execute vbscripts. however, breakpoints ('stop') ignored when eval() function runs script. i'd see jitdebugger triggered, allow me use microsoft script debugger debug script. has had similar issues? edit: after investigation found due our iis settings (we using windows authentication) asp.net worker process runs defaultapppool , not have same privileges or registry set logged on user. guess question "how change regsitry keys defaultapppool user?" edit2: asked question in separate thread , got answer: how change registry keys defaultapppool? the answers " debugging script in ms script control " list relevant options , registry values. if hints not help, try isolate culprit systematic checks. can debug a console script without script control a console script using code via script control an asp without script control

ascii - Java StringBuilder Appending Vertical-Tab Character Fails -

i receive data inputstream , have ascii character 11 vertical tab. can see vertical tab 11 in debugger. try append character stringbuilder appended , length increased. however, problem when string returned ascii character lost when doing stringbuilder.tostring().tochararray() ascii character 11 can seen. i need see in string ascii character 11. public static void main(string[] args) { // receive data inputstream int read = inputstream.read(); stringbuilder stringbuilder = new stringbuilder(); stringbuilder.append((char) read); // /u000b ' ' stringbuilder.append("h"); system.out.println(stringbuilder.tostring()); // prints h char[] characters = stringbuilder.tostring().tochararray(); // length 2 } how can achived? edit: i need see ascii character in original string in debugger. example: public string getoriginalstring() { return originalstring; } public string process(string originalstring) { return modifie

Restrict Kendo Grid to Current Route Id -

i'm trying include kendo ui asp.net mvc grid on edit page of mvc application , restrict grid return values current route id. i've been researching ways this, can't find that's need, or i'm new @ connect dots. my ideas far either apply filter datasource or send parameter controller , have restrict datasourceresult. for datasource filter in view, can this: .filter(filters => { filters.add(d => d.companyid).isequalto(2); }) but can't figure out how replace hardcoded 2 value from, say, @viewcontext.routedata.values["id"], or something. passing parameter controller, can following: public actionresult divisions_read([datasourcerequest]datasourcerequest request, int id) { using (var db = new appcontext()) { iqueryable<division> divisions = db.divisions; datasourceresult result = divisions.todatasourceresult(request, division => new divisionviewmodel { divisionid = division.divisionid,

C++ Can't find error -

not sure i'm doing wrong here. can't run. #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int _tmain(int argc, _tchar* argv[]) { int a[] = { 2, 3, 4, 5 }; skipone(a, 2); } void skipone(int * array, int n) { int total = 0; (int = 0; < sizeof(array); i++) { if (i != n) { total = + array[i]; } } cout << "the total is: " << total << endl; } this went below. #include "stdafx.h" #include <iostream> #include <vector> using namespace std; void skipone(vector<int> & array, int n) { int total = 1; (int = 0; < array.size(); i++) { if (i != n) { total *= array[i]; } } cout << "the total is: " << total << endl; }

jquery - How to change the formatting (eg make bold) only the first 5 words typed in a form -

i change formatting of first 5 words user inputs textarea automatically (eg looks para). i know there way value of text input in jquery using: $('input').keyup(function() { $('span').text($(this).val()); }); however, have no idea whether possible change formatting of first few words user types, while typing it. reason wish because have comment system "title" of comment first 5 words of textarea of comment, , want people recognise while typing (as part of ui feedback). can done? how? thanks! $('input').keyup(function() { var txt = $(this).val(); var re=new regexp("\\s+(?: \\s+(?: \\s+(?: \\s+(?: \\s+)?)?)?)?"); var beginning = re.exec(txt); $('span').text(beginning); var rest = txt.substring(beginning.length); // start space });

string - python print invalid syntax -

print (n+1) ": x1= ",x1,"f(x)= ",fx i want print x1 , value of function @ x1 (fx), invalid syntax on end of first quotation. can explain me problem is. the problems there should comma(,) before 1st quotation. print (n+1), " : x1=",x1,"f(x)=",fx printing f(x) print correct value if have return statement in function

java - exception during convert html to pdf using itext -

i trying convert html pdf file in java using itext.i using eclipse editor,i have add 2 jar file xmlworker-5.4.3.jar, itextpdf-5.1.0.jar in classpath.my code given beloow document document = new document(); pdfwriter writer = pdfwriter.getinstance(document, new fileoutputstream("pdf.pdf")); document.open(); xmlworkerhelper.getinstance().parsexhtml(writer, document,new fileinputstream("index.html")); system.out.println( "pdf created!" ); when run above code gives me exception. don't know how solve it. exception given below exception in thread "main" java.lang.nosuchmethoderror: com.itextpdf.text.log.loggerfactory.getlogger(ljava/lang/class;)lcom/itextpdf /text/log/loger; @ com.itextpdf.tool.xml.net.fileretrieveimpl.<clinit> (fileretrieveimpl.java:67)at com.itextpdf.tool.xml.css.styleattrcssresolver.

entity framework - Do rowversion/timestamp columns in SQL Server need a nonclustered index when using EF code-first? -

all of tables have rowversion column ef uses optimistic concurrency checking. should create nonclustered index on column faster data retrieval? each table has clustered primary key named id . whenever updating data, ef/sql try locate row based on id first , run rowversion check? none of query plans seek on column. writes performed filtering on primary key columns causes seek on index provides primary key. rowversion index never helps. to answer such questions empirically, compare execution plans , without index in question.

metaprogramming - Any way to implement implicit "it" in Ruby blocks, like in Lisp? -

apparently in lisp when write block/lambda without parameters, word "it" takes value passed in block. this seems elegant; it; want in ruby. there way make work? 3.times { p } should print "0 1 2" obviously eval block in context included method_missing returned value :it (or maybe def object#it). value should return? if "yield 42" block, , block declared without parameters, there general way recover value 42? (the original version of question asked c#, hence comments. apparently c# doesn't have lisp does.) nope, don't think so. ruby has self it's not going out here you have do 3.times { |n| p n }

Java Servlet/JSP Custom Error Page -

i have custom error page setup basic debugging whilst i'm programming , reason none of values try catches through. error page says: "null null null". if can i'd grateful. servlet: package com.atrium.userservlets; import java.io.ioexception; import java.util.regex.matcher; import java.util.regex.pattern; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpsession; import com.atrium.daos.userdao; import com.atrium.userbeans.userregistrationbean; @webservlet("/register") public class userregistrationservlet extends httpservlet { private static final long serialversionuid = 1l; public userregistrationservlet() { super(); } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexcept