Posts

Showing posts from May, 2010

Is it possible to copy control array to another control array in VB6? -

i want copy content of control array control array, possible in vb6? please help you don't need second control array hold values in labels of first one, need normal array. suppose have control array of 3 labels called mylabel: dim labelvalues(2) string dim integer sub deleteandsavelabelvalues = 0 2 mylabel labelvalues(i) = .caption(i) .caption(i) = "" end next end sub to replace label values, iterate through control array again , set caption appropriate array value.

javascript - Binding to strings containing custom components in Ember.js -

i'm trying display string, pulled model, contains ember custom components. don't seem compiled though -- see (1) , (2) in output. if replace custom components standard html elements , use {{{-}}} syntax binding, things right (see (3) , (4) in output), not sufficient application have in mind, though. how can ember compile custom components before displaying them? app.js: app = ember.application.create(); var g1 = "{{#my-bold}}yo{{/my-bold}}, {{#my-italic}}dude{{/my-italic}}!"; var g2 = "<b>yo</b>, <i>dude</i>!"; app.indexroute = ember.route.extend({ model: function() { return {greeting1: g1, greeting2: g2} } }); app.myboldcomponent = ember.component.extend({tagname: "span"}); app.myitaliccomponent = ember.component.extend({tagname: "span"}); index.html <script type="text/x-handlebars"> {{outlet}} </script> <script type="text/x-handlebars" id="compo...

asp.net mvc - Call Stored Procedures from Entity Framework return value from temp tables -

i using asp.net mvc 4.5 , ef. imported stored procedures ado.net entity data model. have .edmx , xx.tt storeprocedure_result.cs . but there stored procedure not have _result.cs file this because stored procedure returns select #temptable when want import function create complex type, sees function not return value.. i thinks return value temp tables not allowed. any ideas how can solve it? thanks

java - JPA 2.0, Write query with multiple conditionals -

i have entity fields @entity public myentity { @id @generatedvalue(strategy = generationtype.identity) public long id; public uuid uuid; public string value; ..... } now create query returns 1 if there @ least x entities in database same uuid, or returns 2 if there @ least y entities same uuid , have same value. im not sure if described well. if in java collection following code: int b = 0; string y = ..; uuid x = ...; list<myentity> list = getallentitieswithsameuuid(x) if (list.sze() == 50) return 1 (myentity e : list) { if (e.value.equalsignorecase(y)) { b++; if (b == 100) { return 2; } } } in case have process tons of data, move processing database server , in application retrieve integer result of query. can use jpa's query, criteriaquery, (something else) achieve this? i'm using jpa 2.0, , hibernate 4. i use 2 queries , combine both in java: string value = ..; uuid uuid...

Jquery number increment to <p> tag -

i trying write variable holds main value of paragraph tag seen here: <button id="button">random words</button> <p id="inc">0</p> <script> $(document).ready(function(){ $('#button').on("click", function(){ var oldval = $("#inc") $('#inc').text( oldval + 1) }); }); </script> how turn '#inc' number can + 1 increment? you can use callback text function accept old text , modify new. you need parse old value integer incrementing it: $('#button').on("click", function(){ $('#inc').text(function(i,oldval){ return parseint(oldval,10) + 1 ; }); }); working demo

python - all possible wordform completions of a (biomedical) word's stem -

i'm familiar word stemming , completion tm package in r. i'm trying come quick , dirty method finding variants of given word (within corpus.) example, i'd "leukocytes" , "leuckocytic" if input "leukocyte". if had right now, go like: library(tm) library(rweka) dictionary <- unique(unlist(lapply(crude, words))) grep(pattern = lovinsstemmer("company"), ignore.case = t, x = dictionary, value = t) i used lovins because snowball's porter doesn't seem aggressive enough. i'm open suggestions other stemmers, scripting languages (python?), or entirely different approaches. this solution requires preprocessing corpus. once done quick dictionary lookup. from collections import defaultdict stemming.porter2 import stem open('/usr/share/dict/words') f: words = f.read().splitlines() stems = defaultdict(list) word in words: word_stem = stem(word) stems[word_stem].append(word) if __...

c# - Player movement starts after a few seconds after pressing the button -

i'm following tutorial on unity 5 create simple stealth game. i followed instructions create script controls movement of player . when tested game noticed player takes few seconds after pressing button before moving . it's if before moving should await conclusion of rotation performed quaternion.lerp . also pressing x button should scream attract attention , take proper animation.. runs sound the animation not done .. performed once in multiple tests did. public class playermovement : monobehaviour { public audioclip shoutingclip; // audio clip of player shouting. public float turnsmoothing = 15f; // smoothing value turning player. public float speeddamptime = 0.1f; // damping speed parameter private animator anim; // reference animator component. private hashids hash; // reference hashids. void awake () { // setting references. anim = getcomponent<animator>(); hash ...

javascript - Passing two numbers for each visible image -

i've got multiple images common class. user able hide or make them visible. i need pass 2 numbers each visible image. starting number should 0 , should continues number. i've done far. the current output 0,1,1,2,2,3.... i want output 0,1,2,3,4,5,.... $('#passnum').click(function(){ var curnumber= 0; $('.visibeimage:visible').each(function(){ usenumber(curnumber++); }); }); note: first number should 0 pass default index parameter in each function instead of manually iterating $('.visibeimage:visible').each(function(index, value){ usenumber(index + 1); });

View Product page magento -

in magento when click on product go www.mysite.com/product.html how can change to www.mysite.com/sometext/product.html thanks in advance.. go menu admin > catalog > url rewrite management click on "add new url rewrite" button select "create url rewrite:" product filter product in grid , select product click on "skip select category" button @ end of page change request path "sometext/product.html"

controller - Isolate and shared scope same time in directive AngularJS -

new angular not sure if ask question right way. so have form. <form ng-controller="mycontroller" action="" method="get"> <div mydirective> <input ng-model="question.sex" value="male" type="radio"> <input ng-model="question.sex" value="female" type="radio"> <button ng-click="log(logthisquestionansware())"></button> </div> <div mydirective> <input ng-model="question.agree" value="no" type="radio"> <input ng-model="question.agree" value="yes" type="radio">\ <button ng-click="log(logthisquestionansware())"></button> </div> </form> so goal log current "question" answer. on button click. how can access local question in mydirective separate second directive , ha...

jquery - Jqgrid - Uncaught RangeError: Maximum call stack size exceeded -

dynamic column width according content i tried adjusting column width dynamically according content way ,by finding characters length of each row ,then getting max length out of , setting grid column width. loadcomplete : function () { $("#grid").on("jqgridafterloadcomplete jqgridremapcolumns", function () { var $this = $("#grid"), colmodel = $this.jqgrid("getgridparam", "colmodel"), icol, irow, rows, row, n = $.isarray(colmodel) ? colmodel.length : 0; var rowdata = ""; var rowdatalen=""; var input = []; var divs = $( "div" ); var colwidth=125; (icol = 0; icol < n; icol++) { input = []; (irow = 0, rows = this.rows; irow ...

ios - Pass data from one view controller to the other using unwind segue with identifier -

here code: making user able select image phone , want jump previous view controller passing image file too.. @ibaction func unwindtothisviewcontroller(segue: uistoryboardsegue) { if (segue.identifier == "unwindtothis") { } } if original view controller still loaded in memory can use nsnotification via nsnotificationcenter. in view controller needs data, in viewdidload: nsnotificationcenter.defaultcenter().addobserver(self, selector: "imagereceived:", name: "imagereceived", object: self.videodeviceinput?.device) then add deinit method same controller, remove observer when view controller no longer loaded. deinit { nsnotificationcenter.defaultcenter().removeobserver(self, name: "imagereceived", object: nil) } still in same class create method handle notification: func imagereceived(notification: nsnotification) { if let image = notification.object as? uiimage { // image stuff here. } } in view controller...

javascript function callback in C code using Emscripten -

the task call javascript function callback in order show progress of while-loop operation. e.g. js: var my_js_fn = function(curstate, maxstate){//int variables console.log(curstate.tostring() + " of " + maxstate.tostring()); } c pseudocode: int smth_that_calls_my_fn(int i, int max) { /* the_magic call my_js_fn() */ } int main(){ //.... while (i < max){ smth_that_calls_my_fn(i,max); } //.... return 0; } how can link smth_that_calls_my_fn , my_js_fn ? the magic you're looking pretty simple -- need use em_asm_args macro. specifically, can like int smth_that_calls_my_fn(int i, int max) { em_asm_args({ my_js_fn($0, $1); }, i, max); } make sure #include <emscripten.h> in c file macro exists. the em_asm_args macro takes javascript code (in braces) first argument, , other parameters want pass in. in js code, $0 first argument follow, $1 next , on. i wrote blog entry going detail on topic if...

javascript - offset not changing after jQuery animation -

http://plnkr.co/edit/c6oaitttvlhltk7b3muf?p=preview i'm working on jquery animation , need have animated divs retain new offset after animation ends. the goal of animation able click on 1 of smaller circles @ bottom , swap places/size larger circle @ top. function leadershiptoshow(id) { console.log('leadershiptoshow (' + id + ')'); var x = $('.activeleadership').offset().left; var y = $('.activeleadership').offset().top; var h = $('.activeleadership').height(); var w = $('.activeleadership').width(); if($(id).hasclass('activeleadership')){ console.log('already selected');return false; } console.log('x ' + x + ', y ' + y); console.log($(id).offset()); var xi = $(id).offset().left; var yi = $(id).offset().top; console.log('xi ' + xi + ', yi ' + yi); var hi = $(id).height(); var wi = $(id).width(); var xoffset = math.abs(x - xi); var yoffset = math.ab...

php - error getting data procedure in codeigniter -

i created stored procedure, saves values ​​in table temporal.y show "select " in sqlserver works . when call procedure in codeigniter generated empty array. this procedure in codeigniter function verificacion_ocupados($codigo,$llave_maestra){ $sql = "sp_verificacionocupados ?, ?"; $query = $this->db->query($sql,array($codigo, $llave_maestra)); $data = $query->result(); $query->free_result(); return $data; } this procedure create procedure [dbo].[sp_verificacionocupados] @codigo int, @llave_maestro varchar(50) declare @finicio date; declare @ffinal date; declare @codigo_dias int; declare @no varchar(100); create table #pivote( code int ); set @no='veremos'; begin select @ffinal=oel_fecha_fin,@finicio=oel_fecha_inicio operaciones_especiales_llave em_codigo=@codigo , oel_estado=2 , th_llave=@llave_maestro ; if @@rowcount>0 beg...

bash - How to use >> inside find -exec statement? -

from time time have append text @ end of bunch of files. find these files find . i've tried find . -type f -name "test" -exec tail -n 2 /source.txt >> {} \; this results in writing last 2 lines /source.txt file named {} many times file found matching search criteria. i guess have escape >> somehow far wasn't successful. any appreciated. -exec takes 1 command (with optional arguments) , can't use bash operators in it. so need wrap in bash -c '...' block, executes between '...' in new bash shell. find . -type f -name "test" -exec bash -c 'tail -n 2 /source.txt >> "$1"' bash {} \; note: after '...' passed regular arguments, except start @ $0 instead of $1. bash after ' used placeholder match how expect arguments , error processing work in regular shell, i.e. $1 first argument , errors start bash or meaningful if execution time issue, consider doing expor...

c# - Nhibernate subsequent read after stored procedure call -

i have strange behaviour of nhibernate , ado.net. i'm using nhibernate standard orm operation faster ado.net (like batch or calling stored procedure). so i'm doing following var item = _items.getbyid(100); then call stored procedure update same entity following instructions var session = _sessionmanager.opensession(); using (var tx = session.begintransaction()) { var item = _items.getall().firstordefault(x => x.itemcode == code); var cmd = session.connection.createcommand(); session.transaction.enlist(cmd); cmd.commandtype = commandtype.storedprocedure; sqlparameter id = sqlutil.getparam("@bigid", sqldbtype.bigint, inout: false); cmd.commandtext = "storedupdateitem"; cmd.parameters.add(sqlutil.getparam("@tstts", sqldbtype.timestamp, inout: false)); cmd.parameters.add(id); int ret = cmd.executenonquery(); if (ret != 1) { throw new applicationexception(...

Identify Parent Child records using oracle SQL and avoid merge -

i have requirement find parent child accounts using sql query , avoid merge process if survivor child , loser parent. have records in table x in following format survivor loser 400-giz-514 400-1729e3 table x temporary table , records in them stored in base tables in base table relationship between these 2 records is row_id par_ou_id parent 400-1729e3 null child 400-giz-514 400-1729e3 please me query identify these type of records , flag them not picked nightly process merge. should able remove records temp table using delete tablex exists ( select 1 basetable basetable.row_id = tablex.survivor , basetable.par_ou_id = tablex.loser )

javascript - How to use Comet and Push technique using AJAX and PHP -

i calling ajax after each 5 seconds update info of current logged-in user database table in php. but creates heavy load on website, , website down after time when there multiple users logged-in on website. is there way use other techniques comet or push improve script? here code using: javascript code: jquery(document).ready(function ($) { update_data(); function update_data() { $.ajax({ type: "post", url: "$url", data: {update_current_time:1}, success: function(response){ settimeout(update_data, 5000); }, error: function(){ settimeout(update_data, 5000); } }); } }); php code: if(isset($_post['update_current_time'])) { $query = "update users set user_timer=now() user_id=".$_session['id']; $db->execute(); echo 'success'; die; } to use push or comet need setup "webserver" listen port. cannot ...

MySql subqueries and max or group by? -

i have table: id student class question answer time 1 1 1 1 c 12:30 2 1 1 1 d 12:36 3 1 1 2 12:38 4 2 1 1 b 11:24 5 2 1 1 c 11:26 6 2 1 3 d 11:35 7 2 3 3 b 11:24 i'm trying write query this: for each student in specific class select recent answer each question. so, choosing class "1" return: id student class question answer time 2 1 1 1 d 12:36 3 1 1 2 12:38 5 2 1 1 c 11:26 6 2 1 3 d 11:35 i've tried various combinations of subqueries, joins, , grouping, nothing working. ideas? you can use sub-query recent answer per question , use derived table , join original table: select m.* mytable m inner join ( select student, question, max(`time`) mtime mytable class = 1...

c - Coccinelle: Change ordered struct declaration to unordered -

i'm trying find resources/tutorials me create coccinelle script find structure declarations , change them ordered unordered. in our code base use several structs hundreds of times. added member in middle of definition , need update hundreds of declarations. default value of 0 if switch declarations order unordered, good, , more future proof next change. ex: struct some_struct { int blah; int blah2; } // code now. struct some_struct ex1 = { 0, 1, }; // need script change struct some_struct ex2 = { .blah1 = 0, .blah2 = 1 } can point me in right direction? coccinelle tutorials: http://coccinelle.lip6.fr/papers.php you can try mailing list asking questions. may work: @@ constant c1, c2; identifier i; @@ struct some_struct = { + .blah1 = c1, + .blah2 = c2, };

Performance Improvement Tips for ForEach loop in C#? -

i need optimize below foreach loop. foreach loop taken more time unique items. instead can filteritems converted list collection. if how it. take unique items it. the problem arises when have 5,00,000 items in filteritems. please suggest ways optimize below code: int = 0; list<object> order = new list<object>(); list<object> unique = new list<object>(); // filteritems collection of records. can converted list collection directly, can take unique items it. foreach (record rec in filteritems) { string text = rec.getvalue(“column name”); int position = order.binarysearch(text); if (position < 0) { order.insert(-position - 1, text); unique.add(text); } i++; } it's unclear mean "converting filteritems list" when don't know it, consider sorting after you've got items, rather go: var strings = filteritems.select(record => record.getvalue("column name")) .disti...

xml - php with soap service -

i need use xml file: http://www.mubashermisr.com/mubadelayed/service1.asmx?wsdl to connect gettopgainers methode use code: <?php ini_set("soap.wsdl_cache_enabled", "0"); // disabling wsdl cache $wsdl_path = "http://www.mubashermisr.com/mubadelayed/service1.asmx?wsdl"; $parameters = array("username"=>"xxxx","password"=>"xxxx","id"=>"xxxxx"); $client = new soapclient($wsdl_path, array('trace' => 1)); try { $result = $client->gettopgainers($parameters); print_r($result); } catch (soapfault $exception) { echo $exception; } ?> but following error: soapfault exception: [soap:server] server unable process request. ---> object reference not set instance of object. in c:\wamp\www\soap\soap.php:24 stack trace: #0 c:\wamp\www\soap\soap.php(24): soapclient->__call('gettopgainers', array...

javascript - dropdown with form fields bootstrap 3 -

Image
i'm trying build dropdown functions in image below (or go kayak's website): i need dropdown field within dropdown field, , need couple of fields allow incrementing/decrementing. i couldn't dropdown within dropdown work right. tried variations of following: i've tried variations of: <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="dropdownmenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> dropdown <span class="caret"></span> </button> <form> <div class="dropdown form-group clearfix"> <button class="btn btn-dropdown dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">fare class <span class="caret"></span></button> ...

Having trouble with C# form passing -

i'm trying c#, after doing ton of java. wanted pass gui form class, run trouble trying access containers etc. there. this autogenerated form class: namespace wecker { public partial class weckerdesign : form { public weckerdesign() { initializecomponent(); new weckerrun(this); } } } and recieving class: namespace wecker { class weckerrun { weckerdesign wdesign = new weckerdesign(); public weckerrun(weckerdesign wdesign) { this.wdesign = wdesign; new displayclock(wdesign); } } } however, when trying access container "clockfield" recieving class, can't find it. however, in passing class, can there this.clockpanel. ... , on. the recieving class won't suggest me that. in java, pass down class whole "this" in order have exact same reference in other class, can treat if in original class got object reference from. ...

ios - NSDictionary vs [String:AnyObject] in Swift -

i updated external swift library, , 1 of methods has changed face from: public convenience method(data:nsdictionary?) { ... } to: public convenience method(data:[string: anyobject]?) { ... } what mean? initially, old, @{@"optiona":@yes} passed data argument. new need pass 2 items. thinking write @{@"optiona":@yes,@"optionb":@no} , correct? it means parameter swift dictionary , no objective-c nsdictionary anymore. to pass data, use square brackets instead of curly brackets , remove "@" (in swift) ["optiona":true, "optionb": false] if calling method objective-c, method parameter should exposed nsdictionary , right @{@"optiona":@yes,"optionb":@no} missed @-sign before optionb

jslint - wro4j CSS Lint Adding Custom Rules -

our team wants use wro4j tool, , have gotten setup , able run csslint , jslint. create our own custom css rules, can't find documentation on csslint rules stored , how create our own. any appreciated. in order add csslint rules, should update configuration options section of maven plugin: <plugins> <plugin> <groupid>ro.isdc.wro4j</groupid> <artifactid>wro4j-maven-plugin</artifactid> <version>${wro4j.version}</version> <executions> <execution> <goals> <goal>csslint</goal> </goals> </execution> </executions> <configuration> <options>box-model</options> </configuration> </plugin> </plugins> more details documented here . update : rules defined csslint library (version 0.9.10). rules defined in library can referred in configuration section of maven plugin. adding custom r...

Restore AccessToken from my server Facebook Android SDK 4.0 -

working facebook sdk > 4.0 i'v got problem, save accesstoken don't how retrieve or check availability? facebook doc says use session.open(accesstoken, statuscallback) sdk 4.0 session class deprecated , removed. how can create accesstoken saved params ?

c# - TeamCity + MSTest - how to capture generated artifacts? -

Image
i've searched , searched, no avail. how 1 capture unit test output artifacts from teamcity + mstest step? we're stuffing folders/artifacts in test directory fine - i'm not asking [deploymentitem] , friends specifically, generate bunch of logfiles tests run , i'd hold on these historical inspection. currently manually inspect auto-generated testresults folders troublesome since have multiple build agents, , mstest has habit of deleting "out" folder once it's done. i've tried turning deployment off .testsettings file, mstest still tries execute in special temporary deploy directory - nothing deployed in (you can imagine how works) edit: to clear, issue mstest executes one's tests in difficult-to-programatically-predict folders, rendering teamcity's artifact capture next useless. question is: how 1 nail down/predictably locate these would-be artifacts , capture them teamcity? to capture files output teamcity build ...

Eclipse Android Runtime Errors twitter feed -

i new eclipse , have been trying integrate twitter feed app, using tutorial http://javapapers.com/android/android-twitter-feed-reader/ . having followed tutorial, when running app many errors. 07-23 20:40:01.348: d/dalvikvm(898): not late-enabling checkjni (already on) 07-23 20:40:03.188: e/trace(898): error opening trace file: no such file or directory (2) 07-23 20:40:04.478: d/dalvikvm(898): gc_concurrent freed 68k, 5% free 2731k/2860k, paused 20ms+13ms, total 96ms 07-23 20:40:04.568: d/androidruntime(898): shutting down vm 07-23 20:40:04.568: w/dalvikvm(898): threadid=1: thread exiting uncaught exception (group=0x40a71930) 07-23 20:40:04.598: e/androidruntime(898): fatal exception: main 07-23 20:40:04.598: e/androidruntime(898): java.lang.runtimeexception: unable start activity componentinfo{com.example.witsbuses/com.example.witsbuses.mainactivity}: java.lang.runtimeexception: content must have listview id attribute 'android.r.id.list' 07-23 20:40:04.598: e/androidru...

Mailchimp API send call returns Campaign_EgpPrediction error -

i'm using mailchimp v2.0 api @ moment replicate, update , send mail campaigns. far good, i'm getting curious error when call campaigns/send { "status": "error", "code": -99, "name": "campaign_egpprediction_exception", "error": "campaign_egpprediction" } if try again, may work. seems sporadic. workflow: replicate 1 of our standard campaigns new id, id update title, make url-driven campaign updating url value, move folder, send it. all other api calls successful, send sometimes says that. i can't find reference error anywhere in mailchimp docs, have asked api support team whilst i'm waiting... this caused predicted bounce rate warning. after went ahead , sent campaign despite warning (which doesn't exist in mailchimp's documentation) got following compliance team shortly afterwards: this note mailchimp compliance team. omnivore, our automated abuse pr...

cmd - Batch file for incremental renaming of files/folders with date -

i have folder called output . want rename using batch file output_old05aug15 , 05aug15 today's date. however, if output_old05aug15 present, output renamed output_old05aug15_2nd , on. need batch file renames folder accordingly. edit: got incrementally rename folders exist. here's have done: @echo off setlocal /d %%f in (.\output) ( if exist "output_old*" ( set reqren=y /l %%x in (2,1,999) if defined reqren if not exist "output_old_%%x" (rename "%%f" "output_old_%%x"&set "reqren=") ) else (rename "%%f" "output_old") ) goto :eof i referred post batch file - rename , incremental folder number? @echo off setlocal enabledelayedexpansion rem locale, ie: 'thu 08/06/2015' /f "tokens=2 delims=/ " %%m in ("%date%") set /a "n=(3*((1%%m)%%100-1))" set month=janfebmaraprmayjunjulaugsepoctnovdec set monthname=!month:~%n%,3! set dt=%date:~7,2%%monthn...

c# - Importing .DAT file to Database? -

how go import/inserting .dat file database calling procedure? here's file , has go database in format. 50 4411902304 1 3 441192304 01/02/2013 would process same .dat file xml file? here's have xml sqlconnection myconnection = new sqlconnection("user id=name;" + "password=password;server=servername;" + "trusted_connection=yes;" + "database=database; " + "connection timeout=30"); var conn = new sqlconnection(); conn.connectionstring = "user id=idname;" + "password=password;" + "server=servername;" + "trusted_connection=yes;" + "database=databasename; " + "connection timeout=30"; string filepath = "c:/testdata2.xml"; s...

cordova - PhoneGap plugin "startApp" not working with jQueryMobile -

i have included startapp phonegap plugin in 1 of app. there tag id "mytest". trying open "twitter" app startapp plugin. here code using: function ondeviceready() { $("#mytest").on("click", function() { alert("clicked"); navigator.startapp.check("twitter://", function(message) { alert("success"); }, function(error) { alert("err"); }); }); } i using jquerymobile this. when app lunched first time or re-started again after killing it, startapp works file when navigate different pages within application , come , click link open twitter, not work. is issue jquerymobile or else? please? the phonegap plugin using one: startapp

Python 2 + Flask - ImportError: No module named request -

i'm trying install flask , using pip. running basic: from flask import flask app = flask(__name__) @app.route("/") def hello(): return "hello world!" if __name__ == "__main__": app.run() i importerror: no module named request python --version returns python 2.7.6 pip show flask returns version: 0.10.1 from i've been able find, request module python 3 related. , says use urllib2 . so i've added import urllib2 , get: importerror: dlopen(/usr/local/cellar/python/2.7.10_2/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): symbol not found: __pyerr_replaceexception referenced from: /usr/local/cellar/python/2.7.10_2/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload/_io.so expected in: flat namespace what doing wrong? creating virtualenv worked me. following steps on page http://flask.pocoo.org/docs/0.10/installation/#virtualenv do: pip install virtuale...

haskell - What is Ord type? -

is every class not type in haskell : prelude> :t max max :: ord => -> -> prelude> :t ord <interactive>:1:1: not in scope: data constructor ‘ord’ prelude> why not print ord type signature ? okay, there's couple of things going on here. first when write :t ord you're looking called ord in value namespace; have constructor, since name starts capital letter. haskell keeps types , values separate; there no relationship between name of type , names of type's constructors. when there's 1 constructor, people use same name type. example being data foo = foo int . declares two new named entities: type foo , constructor foo :: int -> foo . it's not idea think of making type foo can used both in type expressions , construct foo s. because common declarations data maybe = nothing | a . here there 2 different constructors maybe a , , maybe isn't name of @ @ value level. so because you've seen ord in type expre...

authentication - Password security in sessions -

instead of stroing plain text passwords, use strong hashing function high computation cost , random salt thwart rainbow attacks etc. but when user in session, typically or username stored along hash of password cookie authenticate sesssion. if user's browser cookie space compromised, doesn't attacker obtain easier target of cracking username+ session hash, instead of username + pass hash? in django example, passwords hashed pbkdf2 or bcrypt, session hashes use less complex hmac , no random salt. security issue? if yes, right way handle sessions? for each session, suggest use dedicated sessionid - random long 128bit value. and, keep session key as: username:sessionid:hash where hash = sha1(sessionid|username|client_ip|secret_server_side_password); every time, when receive cookie, need again compute hash, , compare received one. as result, cookie useless after session closed (mismatch sessionid). moreover, if cookie stolen active session, server can ...

javascript - How does d3.svg.diagonal() read bound data? -

i in process of learning d3.js right now, , going through few tutorials, find confused how commands d3.svg.diagonal() able access bound data. take example below: var canvas = d3.select('body').append('svg') .attr('width', 500) .attr('height', 500) .append('g') .attr('transform', 'translate(50,50)'); var tree = d3.layout.tree() .size([400,400]); var data = { 'name':'max', 'children': [ { 'name':'sylvia', 'children': [ {'name': 'craig'}, {'name': 'robin'}, {'name': 'anna'} ] }, { 'name': 'david', 'children': [ {'name': 'jeff'}, ...

Ensuring random order for iteration over Set Python -

i iterating on set in python. in application prefer iteration in random order each time. see same order each time run program. isn't fatal there way ensure randomized iteration on set? use random.shuffle on list of set. >>> import random >>> s = set('abcdefghijklmnopqrstuvwxyz') >>> in range(5): #5 tries l = list(s) random.shuffle(l) print ''.join(l) #iteration nguoqbiwjvelmxdyazptcfhsrk fxmaupvhboclkyqrgdzinjestw bojweuczdfnqykpxhmgvsairtl wnckxfogjzpdlqtvishmeuabry frhjwbipnmdtzsqcaguylkxove

Orbiting the Camera in AutoCAD 2015 with C# -

i'm writing static class contains methods simplify working autocad's camera. methods seem work except orbit. heres orbit method in context of class public static class cameramethods { #region _variables , properties private static document _activedocument = autodesk.autocad.applicationservices.application.documentmanager.mdiactivedocument; private static database _database = _activedocument.database; private static editor _editor = _activedocument.editor; private static viewtablerecord _initialview = _editor.getcurrentview(); private static viewtablerecord _activeviewtablerecord = (viewtablerecord)_initialview.clone(); #endregion /// <summary> /// orbit angle around passed axis /// </summary> public static void orbit(vector3d axis, angle angle) { // adjust viewtablerecord //var olddirection = _activeviewtablerecord.viewdirection; _ac...

Google Apps Script targeting header on doc with different first page headers -

i have simple little apps script refreshes our dynamic logo on request. problem can't target header if designer checks "different first page header/footer" checkbox. there away target different header if it's checked? here code i'm using: function onopen() { documentapp.getui().createmenu('branding') .additem('update branding', 'updatelogo') .addtoui(); } function updatelogo() { var doc = documentapp.getactivedocument(); var header = doc.getheader(); if (header) { var images = header.getimages(); var logowidth = 250; if (images.length > 0) { var image = images[0]; logowidth = image.getwidth(); // pixels image.removefromparent(); } var freshlogo = urlfetchapp.fetch("http://example.com/logo.jpg").getblob(); var newimage = header.insertimage(0, freshlogo); var logoratio = newimage.getheight() / newimage.getwidth(); newimage.setwidth(logowidth); newim...

inno setup - Why does adding the Images library fail in Julia? -

i'm getting started julia 0.3.10 under windows 7. language installs , runs, can't install images package. when type: pkg.add("images") i output looks ok, lines below. looks if inno setup has detected version problem, i'm not sure version problematic. i've tried deleting "julia" , re-downloading, no avail. also, i've searched web various pieces of error message, stackoverflow; nothing appears relevant. after pkg.add("images") , few dozen normal-looking lines, then: info: building images info: installing imagemagick library info: attempting create directory c:\users\jim\.julia\v0.3\images\deps\downloads info: attempting create directory c:\users\jim\.julia\v0.3\images\deps\usr\lib\x64 info: attempting create directory c:\users\jim\.julia\v0.3\images\deps\downloads info: directory c:\users\jim\.julia\v0.3\images\deps\downloads created info: downloading file [link @ imagemagick] download/binaries/imagemagick-6.9.1-9-q16-x64-d...

php - Rewriting image names during page display -

i've web site have many listings. lets products. products have slugs generated name of products , stored in database. , products have images under folder of /images/products/ i use php, no framework. at moment give name images using slug during upload process. example: product id: 2500 product name: plazma tv url slug: plazma-tv image name: plazma-tv-01.jpg (and goes on -02.jpg -03.jpg ...) what want upload images product ids (2500-01.jpg...) , change image names slug-01.jpg when page displayed visitor. reason change name able use image name , alt text better seo success in search results. i've more 60.000 photos uploded @ moment. thanks

javascript - How to prevent jquery validator to send default element name and value? -

i have jquery validator plugin , need have ajax validation method. first of all, tried use remote , understand sends element's value , uses element's name. if need other parameter name instead of element's name? method can applied different form elements class , need sure send same parameter element's value. so, if have this: <input name="zip1" class="zip" /> <input name="zip2" class="zip" /> and rule config this: remote: 'http://example.com' then ajax calls 'example.com/?zip1=value' , 'example.com/?zip2=value' , while need have specific parameter name. another thing need process response , i'm not sure how remote . so i'm thinking creating custom method instead of using remote , ajax call parameter name want, process response , set validation status. is there better solution?

Yelp ruby gem on Heroku -

i have code initializer in yelp.rb: yelp.client.configure |config| config.consumer_key = env['config.consumer_key'] config.consumer_secret = env['config.consumer_secret'] config.token = env['config.token'] config.token_secret = env['config.token_secret'] end i have yelp.yml file loads in , works great in development. as push heroku (i have keys set in heroku , have triple verified no spelling errors) error 'yelp::error::missingapikeys: you're missing api key' i've ran code in rails c on development (see below) , passes, ran exact same code in rails c on heroku side , error. tried without using env , used exact api keys , same error. client = yelp::client.new({ consumer_key = env['config.consumer_key'], consumer_secret = env['config.consumer_secret'], token = env['config.token'], token_secret = env['config.token_secret'] }) what different between production , development? ...

c# - DbSet.Add & DbSet.Remove Versus using EntityState.Added & EntityState.Deleted -

in entity framework 6 there multiple way of adding / removing entities, example adding entities, can use:- b.students.add(student); db.savechanges(); or db.entry(student).state = entitystate.added; db.savechanges(); and when deleting object:- db.entry(studenttodelete).state = entitystate.deleted; db.savechanges(); or db.remove(studenttodelete) db.savechanges(); i did not find resources talks differences , , of online tutorials mention both approaches if same. have read reply on article link using dbset.add set status entity , related entities/collections added, while using entitystate.added adds related entities/collections context leaves them unmodified, , same thing applies dbset.remove & entitystate.deleted so these differences correct ? edit as understand graph operation means both parent , child got deleted/added , if parent marked deletion or addition. did these 2 tests :- using (var db = new testcontext()) { var = new department { departmen...

algorithm - How is worst case time complexity of constructing suffix tree linear? -

i have trouble understanding how worst case time complexity of constructing suffix tree linear - particularly when need build suffix tree string may composed of repeating single character such "aaaaa". even if construct compressed suffix tree "aaaaa", won't able compress nodes since no 2 edges starting out of node can have string-labels beginning same character. this result in suffix tree of height 5, , @ each insertion of suffix, need keep traversing root leaf. here how approached: suffixes: a, aa, aaa, aaaa, aaaaa create root node, create edge bearing 'a' , connect new node, left bears "$", , repeat process until can aaaaa. this result in o(n^2) instead of o(n). missing here? i agree comments, here more details: the procedure describe forming aaaaa tree o(n), not o(n^2). node , leaf creation constant-time operations, , perform them n==5 times. assumption of o(n^2) seems based on idea you'd traverse root leaf in ...

ajax - How to get HTTP request and response from WebSocket connection -

currently, using standard setup node.js + passport + ajax webserver, backbone on client, , app server exposing apis back-end. client makes ajax request node, housecleaning such checking session authentication, passes request along app server. we experimenting replacing ajax portion between client , node websockets. part have working fine. using passport check if request authenticated. standard node route, request , response included trivial task, i'm not sure how socket. var server = http.createserver(app).listen(port); var io = socketio.listen(server); var namespaced = io.of('/socket/test'); namespaced.on('connection', function (socket) { console.log('a user connected /socket/test'); socket.on('fetch', function (args) { // client has sent socket message functionally replace ajax request // authenticate session here - how request?? }); });

c# - How to stick my form to a window of a thirdparty application? -

i'm trying stick form window of application (let's microsoft outlook). when move outlook window, form should still stick @ right-hand side of it. at moment, i'm monitoring outlook's position in while(true) loop (with sleep() ) , adjusting form's position it. here 2 problems: if sleep() duration short, takes performance check outlook's position , adjust form often. if sleep() duration long, form slow in adjusting outlook (it lags ). isn't there native solution this? you have hook on process , listen event this should give starting point using system; using system.diagnostics; using system.runtime.interopservices; using system.windows.forms; namespace windowsformsapplication1 { public partial class form1 : form { private const uint winevent_outofcontext = 0x0000; private const uint event_object_locationchange = 0x800b; private const uint event_system_movesizestart = 0x000a; private const ...

exception - index out of bounds in jsp and servlet -

type exception report message java.lang.indexoutofboundsexception: index: 0, size: 0 description server encountered internal error prevented fulfilling request. root cause java.lang.indexoutofboundsexception: index: 0, size: 0 java.util.arraylist.rangecheck(unknown source) java.util.arraylist.get(unknown source) com.ncr.usedetails.displaydetails.<init>(displaydetails.java:20) org.apache.jsp.success_jsp._jspservice(success_jsp.java:72) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:439) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:395) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:339) javax.servlet.http.httpservlet.service(httpservlet.java:731) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) com.ncr.registration.putdetails.dopost(putdetails.java:81) jav...