Posts

Showing posts from August, 2012

angularjs - How to dynamically configure ng-grid -

i have view in angularjs application in want allow user select between various differently configured grids. ideally bind value passed ng-grid directive model variable, illustrated below. however, although example renders markup works when simple string value passed ng-grid (ie. <div class="gridstyle" ng-grid="gridoptions1"></div> , dynamic configuration fails. var app = angular.module('myapp', ['nggrid']); app.controller('myctrl', function($scope) { $scope.option; $scope.mydata = [{name: "moroni", age: 50}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 34}]; $scope.gridoptions1 = { data: 'mydata', columndefs: [{ field:"name", displayname: "name"}, { field:&q

unable to start MySql server through xampp control panel -

i unable start mysql server through xampp control panel? got following error description. error: mysql shutdown unexpectedly. may due blocked port, missing dependencies, improper privileges, crash, or shutdown method. press logs button view error logs , check windows event viewer more clues if need more help, copy , post entire log window on forums those error logs.can please me? 2013-08-23 17:36:40 4768 [note] plugin 'federated' disabled. 2013-08-23 17:36:40 b14 innodb: warning: using innodb_additional_mem_pool_size depre`enter code here`cated. option may removed in future releases, option innodb_use_sys_malloc , innodb's internal memory allocator. 2013-08-23 17:36:40 4768 [note] innodb: innodb memory heap disabled 2013-08-23 17:36:40 4768 [note] innodb: mutexes , rw_locks use windows interlocked functions 2013-08-23 17:36:40 4768 [note] innodb: compressed tables use zlib 1.2.3 2013-08-23 17:36:40 4768 [note] innodb: not using cpu crc32 instructions 2013-08-23 1

dbcontext - Reset modified state of entity in OnObjectMaterialized -

when save entity database encrypt values in onsavingchanges event handler. when entity loaded database i'm using onobjectmaterialized decrypt values. this works great except if call save on 1 of entities after been materialized, object context thinks entity has been modified , saves database. so how reset modified state such thinks decrypted values values in database?

How to test the following SQL script in Oracle 11g -

below script written in oracle 11g: merge tblbio t using (select e.id, tblduplicate.cpid, e.bdt,e.ln, e.fn tblduplicate, entities trim(e.id) = trim(tblduplicate.id)) source on (t.cpid = source.cpid , trim(t.bdt) = trim(source.bdt)) when matched update set t.id = source.id, t.stat = '4' t.cmp = 'hhcc' , t.thn = '2013' , trim(lower(source.ln)) = trim(lower(t.ln)) , trim(lower(source.fn)) = trim(lower(t.fn)) , nvl(trim(t.bdt), ' ') <> ' ' , t.bdt <> '00000000' , nvl(trim(source.bdt), ' ') <> ' ' , source.bdt <> '00000000' , t.stat <> '4' due data integrity problem, script once in awhile generate more 1 records. in script generate error. want create validation prior script run. when validation generate more 1 records stop script running. how can that? i tried write following validation capture record count o

jQuery + css3 transition on a slider -

my animations works well, need calculate correct pixels translatex. currenltly calculates first click on .next .prev $('.prev').click(function(e) { e.preventdefault(); var idx = $('.wrap.fadein').addclass('fadeout').removeclass('fadein').css("transform", "translatex(" + $(this).index() * 160 + "px)").index() - 1; $('.wrap').eq(idx).addclass('fadein').removeclass('fadeout').css("transform", "translatex(" + $(this).index() * -0 + "px)"); updatenav(); }); $('.next').click(function(e) { e.preventdefault(); var idx = $('.wrap.fadein').addclass('fadeout').removeclass('fadein').css("transform", "translatex(" + $(this).index() * -160 + "px)").index() + 1; $('.wrap').eq(idx).addclass('fadein').removeclass('fadeout').css("transform", "translatex(

table - Using rowspan in HTML -

is possible have rowspan="2.5" ? using in creating timetable using html tables. have 1-hour interval , need show time 30-mins. how can it? thanks! no, it's not possible have decimals rowspan/colspan values. not does spec so (they must integers), wouldn't make sense. what can instead make each row 30 minutes instead of hour. then, double rowspan (5 instead of 2.5).

ruby - What are options hashes? -

will please explain options hashes? working through ruby course testfirst.org. exercise 10 (temperature_object) requires knowledge of options hashes. options hash nice concept enabled feature of ruby parser. say, have method required arguments. may pass optional arguments. on time may add more optional arguments or remove old ones. keep method declaration clean , stable, can pass optional arguments in hash. such method this: def foo(arg1, arg2, opts = {}) opts.to_s # return string value of opts end so has 2 required values , last argument default value of hash. if don't have optional arguments pass, call this: foo(1, 2) # => "{}" if have optional, call this: foo(1, 2, {truncate: true, redirect_to: '/'}) # => "{:truncate=>true, :redirect_to=>\"/\"}" this code idiomatic ruby parser allows omit curly braces when passing hash last argument method: foo(1, 2, truncate: true, redirect_to: '/') # => &

unsigned - Using bit masking to set 0 to 1 and everything else to 0 -

how use bit masking make bits in number 1 if 0, , 0 if not? using unsigned variable: so, if have 0000-0000 , become 1111-1111 . if have 0101-0110 (or 0000-0001 , or 1111-1111 , etc), become 0000-0000 . is possible without using conditional? sure, it's possible: int y = 0xff; y = ~(y & 1 | y>>1 & 1 | y>>2 & 1 | ...) - 1 but unless academic exercise, shouldn't. if you're concerned performance, y = y != 0 faster. explanation: y & 1 takes first bit of number. y >> k shifts number right k bits, allowing bit y >> k & 1 . | them together, results in 1 if bit set or 0 if not. subtracting 1 gives 0 if bit set, , -1 if not. binary representation of -1 1111... shift: 1010 - y 1010 - y >> 0 101 - y >> 1 10 - y >> 2 1 - y >> 3 take first bit: 0 - y >> 0 & 1 1 - y >> 1 & 1 0 - y >> 3 & 1 1 - y >> 4 & 1 or them: 1 - 0

ms access - Using a form without a lookup field -

i'm trying follow commandment of not using lookup field , getting stuck doing simple. table people: primaryid, employeeid, lastname, firstname, phonenumber table tasks: primaryid, employeeid, summary, duedate, status i've got employeeid linked people tasks in 1 many relationship. queries work fine, know link good. here's problem: people don't know other people's id, know last name. causes problem in populating tasks table. i'd create form tasks has combobox (or similar) gives dropdown of employee.lastname options, fills in tasks.employeeid automatically. i'm getting stuck on first step. i've got dropdown work, shows me names, when click one, never updates anything. it's blank. is there easy way (preferably without vba) - or violating database rule attempting such thing? tl;dr - want use human readable field (lastname) source table provide different field value (employeeid) same table field on destination table (tasks) - using fo

Graphs lost after upgrading to Gitlab 6.0 -

yesterday i've upgraded gitlab installation 5.3 6.0 (technically 5.3 5.4 , 5.4 6.0), , can't display network , other graphs since then. on network page seems javascript not loaded, got 'network not defined' error. graphs seems different issue, can't find in logs. is bug or did wrong? both functions working fine before upgrade. this seems bug in gitlab. breaks when encounters commit doesn't change files, such when creating branch. it in issue tracker issue #4867 , has been fixed in master .

eclipse - how do i use database for my program in android -

i new android. tried few codes n read sqlite bit. couldn't understand much. still having difficulty in using database created using sqlite browser in program. my project app should display content in database 1 after other. database consisting of 2 columns. id , description. package com.example.singlepop; import java.util.calendar; import android.os.bundle; import android.app.activity; import android.view.gravity; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.linearlayout; import android.widget.popupwindow; import android.widget.textview; import android.widget.linearlayout.layoutparams; public class single extends activity { popupwindow popup; linearlayout layout; textview tv; layoutparams params; linearlayout mainlayout; button but; boolean click = true; @override protected void oncreate(bundle savedinstancestate) { super.oncr

performance - Understanding Rails runtime metrics -

i'm trying diagnose performance issue in rails 4 , can't figure out what's going on. here's timing i'm seeing on server: completed 200 ok in 2816ms (views: 644.1ms | activerecord: 162.0ms | solr: 0.0ms) i'm (mostly) satisfied views time, , activerecord time, don't understand why completed time (2816ms) large. what time represent? , there way decrease time? what you're showing on 2/3 of request processing time isn't included in model/view. what's left? other code running within controller , request processing life-cycle. the best way profile install newrelic rpm gem , run local profiler: add gem gemfile: gem 'newrelic_rpm' enable local profiling in development config/newrelic.yml: development: <<: *default_settings monitor_mode: false developer_mode: true execute request 2-3 times warm rails app , visit local newrelic app view traces , track down what's happening: http://localhost:3000

android - SimpleAdapter in Fragment don't show the multicolumn list -

surfing on internet didn't found nothing argument apart question on site: here problem code good, list don't show. code: @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); id = getarguments().getstring("id"); mylist = new arraylist<hashmap<string, string>>(); new myasynctask().execute(); //popolate mylist mschedule = new simpleadapter(getactivity(), mylist, r.layout.rowlinerepair, new string[] {"type", "description", "qta", "price"}, new int[] {r.id.type, r.id.description, r.id.qta, r.id.totale}); setlistadapter(mschedule); } i'm using listfragment, same in fragment. need beacuse i'm creating multicolumn list. thanks i resolved. in postexecute inserted: mschedule = new simpleadapter(getactivity(), mylist, r.layout.rowlinerepair, new string[] {"type", "description&qu

php - concat group a SELECT in another SELECT -

simple question: there 2 tables: genre [name,songid] song [id,title,userid,status] select id,name,title,userid,status songs inner join genre on song.id=genre.songid order id asc; what query result from +----+-------------+----------------------+--------+--------+ | id | genre.name | song.title | userid | status | +----+-------------+----------------------+--------+--------+ | 1 | tech | feel | 1 | 1 | | 2 | tech | tester | 1 | 1 | | 3 | music | sejujurnya | 1 | 1 | | 4 | music | not done | 1 | 1 | | 5 | life | cinta | 1 | 1 | | 6 | life | feel | 1 | 1 | | 7 | life | not done | 1 | 1 | | 8 | truth | tester | 1 | 1 | | 9 | tree | tester | 1 | 1 | | 10 | climb | tester | 1

c++ - How to use cin with a variable number of inputs? -

i in programming competition yesterday , had read in input of form n a1 a2 ... m b1 b2 ... bm ... where first line says how many inputs there are, , next line contains many inputs (and inputs integers). i know if each line has same number of inputs (say 3), can write like while (true) { cin >> a1 >> a2 >> a3; if (end of file) break; } but how do when each line can have different number of inputs? here's simple take using standard libraries: #include <vector> // vector #include <iostream> // cout/cin, streamsize #include <sstream> // istringstream #include <algorithm> // copy, copy_n #include <iterator> // istream_iterator<>, ostream_iterator<> #include <limits> // numeric_limits int main() { std::vector<std::vector<double>> contents; int number; while (std::cin >> number) { std::cin.ignore(std::numeric_lim

ruby on rails - RoR: first_or_initialize block doesn't save -

i have following code, works fine no errors models never saved... myarray.each |item| r = mymodel.unscoped.where(:site_id => @site.id, :url => item['permalink_url']).first_or_initialize |r| r.title = 'asdasdadaddjfgnfd' r.save! end end terminal shows sql select statements when attempting find models, update/insert statements never run. what missing here? rails first_or_* methods invoke passed block initialize or create part. if record found, methods return passed block never run. check source so can use block in first_or_* methods initialize new items, not update existing ones. likely, records such conditions exist , don't updated. try move update code, like myarray.each |item| r = mymodel.unscoped.where(:site_id => @site.id, :url => item['permalink_url']).first_or_initialize r.title = 'asdasdadaddjfgnfd' r.save! end

Upload an entire XML file to Azure Mobile Services -

i have xml 25,000 objects want transition cloud instead of keeping local. buuuuuut have no idea how xml document service, preferably want in sql database comes service. know how upload app 25,000 objects service times out. sure there cant find documentation on. private async void bw_worker(object sender, doworkeventargs e) { foreach(card x in cardslist) { await app.mobileservice.gettable<card>().insertasync(x); } } it gets past 7500 times out. running in background worker. couldn't find such limits on imagined process takes long complete.

iphone - Updated substring in NSAttributedString -

how can replace substring in nsmutableattributedstring without adding static range number? have label text: @"12 friends" , want replace 12 (number of friends) number (and use same attributes substring) once come server, , can not use below approach since number of digits unknown: /*wrong approach*/ nsmutableattributedstring *mutableattributedstring = [[nsmutableattributedstring alloc] initwithattributedstring:label.attributedtext]; [mutableattributedstring replacecharactersinrange:nsmakerange(0, 2) withstring:counter]; [label setattributedtext:mutableattributedstring]; if label read "x friends" why not use formatted string , pass in number of friends parameter. of course make whole thing variable localization, etc. basic idea this: nsinteger numberfromserver = ... nsstring *string = [nsstring stringwithformat:@"%d friend%@",numberfromserver,((numberfromserver != 1) ? @"s" : @"")]; nsmutableattributedstring *attribute

mysql - "set session" in a SQLAlchemy session object -

i'm using sqlalchemy project, , need able specify session variable/setting 1 specific call performance reasons: set session max_heap_table_size = 1024 * 1024 * 64; i can of course in mysql directly (on shell), how set session variable in sqlalchemy session? use session event execute arbitrary sql statement on each new transaction. can use events on connection level, depends on use case. here how on session level: session = sessionmaker() @event.listens_for(session, 'before_flush') def set_max_heap_table_size(session, transaction, connection): session.execute('set max_heap_table_size = 1024 * 1024 * 64') if unsure way works you, try them, write test cases , find out if works you. there may 1 caveat (unsure): since connection not dropped returned pool, setting might persist. in case might want attach restore default, e.g. on after_flush event. not entirely sure on one, might want experiment. if unnecessary, use after_begin event, there

java - ListOfFiles, getPath, shuffling when have more than 3 -

im using display image in folder , subfolder, "works fine", files named in form ex: 17000.001 17000.002 18555.001 18542.001 1.001 1.002 1.003 1.004 ..... the .xxx extension (a renamed tiff) the program works in way: you type number want, example: want 17000, type 17000, , return first .001 in screen, , others .002, .003 , how many have, want walk throught next image button , previsoly image... the problem is: when try search number have more 4 .004 or more, dont display first, display "random", .002, 004 or other cant understand why, piece of code "path" it!! dont kill me because code ^^! .... public void geralistaarquivos(string subdir, string matricula) { string diretorio = "f:\\registro_sql\\imagens\\livro02" + "\\" + subdir + "\\"; string novaimagem = null; file folder = new file(diretorio); listoffiles = folder.listfiles(); if

java - Issues with embedding PDF in pptx using docx4j -

i have attach pdf file in pptx slide during runtime. tried following: attached pdf file in pptx slide (insert -> object -> adobe acrobat document). accessed oleobject using following code : oleobjectbinarypart oleobjectbinarypart = new oleobjectbinarypart(new partname("/ppt/embeddings/oleobject1.bin")); updating oleobjectbinarypart using following code: oleobjectbinarypart.setbinarydata(reportblob.getbinarystream()); updating pptx new oleobject: pptmlpackage.getparts().getparts().put(new partname("/ppt/embeddings/oleobject1.bin"), oleobjectbinarypart); pptmlpackage.save(new file("c:/test_report/pptx_out.pptx")); after executing code pptx_out.pptx file got generated without errors. while trying open embedded pdf in powerpoint 2010 i'm getting following error: the server application, source file, or item can't found, or returned unknown error. may need reinstall sever application. is problem oleobject when updating

Uninitialized constant ActionView::Helpers::InstanceTag in Rails 4 -

i have following code, use customize form_for. need inherit actionview::helpers::instancetag class instancetag < actionview::helpers::instancetag i exception after upgrade rails 4 , saw in docs there no such class. best class use instead of it? after research. found actionview::helpers::instancetag is transformed module called activemodelinstancetag actionview::helpers::activemodelinstancetag

concurrency - Neo4j-Neoclipse Concurrent access issue -

i creating few nodes in neo4j using spring data, , accessing them via findbypropertyvalue(prop, val) . everything works correctly when reading/writing embedded db using spring data. now, per michael hunger's book : relationship , opened neoclipse in read-only mode connection active neo4j connection in java.. but, somehow still says neo4j's kernel actively used other program or something. question 1 : what doing wrong here? also, have created few nodes , persisted them. whenever restart embedded neo4j db, can view nodes when findall() . question 2 : when try visualize nodes in neoclipse (considering db accessible), can see one single node(which empty), has no properties associated it, whereas have name property defined. i started java app, persisted few nodes, traversed , got output in java console. now, shutdown application , started neoclipse ide, connected db , found no nodes present(problem of question 2). after trying again(heads down), go java app ,

sublimetext3 - Is LESS-build compatible with Sublime Text 3? -

im migrating sublime text 2 sublime text 3, packages dont work, less-build.. when try build .less files (ctrl+b) console shows me this: [winerror 2] el sistema no puede encontrar el archivo especificado [cmd: ['c:\otros programas\sublime text 3\data\packages\less-build\dotless.compiler.exe', 'c:\xampp\htdocs\santa_anita\web\bundles\almacen\css\layout.less', 'layout.css']] [dir: c:\xampp\htdocs\santa_anita\web\bundles\almacen\css] [path: c:\program files\common files\netsarang;c:\program files\common files\microsoft shared\windows live;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\xampp\php;c:\xampp\mysql\bin;c:\program files\git\cmd;c:\program files\windows live\shared;c:\program files\microsoft sql server\90\tools\binn\;c:\program files\nodejs\;c:\program files\nmap;c:\socketeq\windowsandroid_root\system\bin;c:\socketeq\windowsandroid_root\system\lib;c:\users\desarrollo\appdata\roaming\npm;

excel - apply recorded macro for all sheets -

i recorded macro specific sheet. problem is, each time run macro sheet, using values of sheet created macro. want macro works sheet. here code looks like: sub autograph() ' ' autograph macro ' ' keyboard shortcut: ctrl+shift+g ' range("b:b,c:c").select range("c1").activate activesheet.shapes.addchart2(227, xllinemarkers).select activechart.setsourcedata source:=range("sheet1!$b:$b,sheet1!$c:$c") range("b:b,d:d,e1,e:e").select range("e1").activate activesheet.shapes.addchart2(227, xlline).select activechart.setsourcedata source:=range( _ "sheet1!$b:$b,sheet1!$d:$d,sheet1!$e$1,sheet1!$e:$e") end sub where sheet1 sheet's name recorded macro. think need change common sheet, couldn't find out logic. appreciate comment. you have sheet hardcoded. why doing this. one way remove references sheet1. cause excel default whatever sheet on. sub autogra

javascript - Continuity test if statment -

i have if statement looks this: if ($(window).width() < 799) { $('.element').css({'display': 'none'}); } else { $('.element').css({'display': 'block'}); } i continuity test statement when window resized, go normal (or other way around). have tried setinterval not seem work nor seem right thing do. i'm aware can use css media queries of this, of code not show can not done in css. $(window).on('resize', function() { $('.element').toggle( $(this).width() < 799 ); }).trigger('resize'); // <- fires on pageload

python - DragonFly - no external application? -

context i'm working dragonfly, python module. @ point, want speech recognized , outputted me. question i'm wondering if there way use dragonfly purely voice recognition without going through windows speech recognition (or alternative program). dragonfly meant "post-speech-recognition"? the examples i've seen , run open windows speech recognition. i've looked old speech recognition module - pyspeech, "borrows" windows speech recognition. should looking towards other modules? dragonfly uses shared recognizer, starts windows speech recognition. if modify dragonfly use inproc recognizer, windows speech recognition not start. (unfortunately, don't know enough python contribute fix.)

ios - How to update the background of a UIImageVIew? -

solved : turn off auto-layout , use springs-struts i have pong type game i've been experimenting uses 3 uiimageview objects xib file. 1 uiimageview ball, bouncing around screen via nstimer object, , other 2 "paddles". when user taps screen, ball starts moving. dragging finger up-and-down moves right side paddle. paddle uses 10x60 png file background. when user taps screen, ball in motion, wanted temporarily change background on paddle visual effect. problem is, changing background of paddle seems reset positions of uiimageviews on screen. there esoteric property of ios resets view or when background changed or doing wrong? .h file @property (weak, nonatomic) iboutlet uiimageview *paddleleft; @property (weak, nonatomic) iboutlet uiimageview *paddleball; @property (weak, nonatomic) iboutlet uiimageview *paddleright; .m file @synthesize paddleright; @synthesize paddleleft; @synthesize paddleball; ... - (void) touchesbegan:(nsset *)touches withevent:(uie

android - How to set multiple click actions on ListView's item -

i added 2 imageviews on listview's each item. want add these imageviews onclick actions. add android:onclick="action" imageview's on list_item.xml. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/listitem" android:orientation="horizontal" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_marginleft="5dp" android:background="@drawable/point" /> <textview android:id="@+id/title" android:layout_width="wrap_content"

javascript - AngularJS custom directive breaks data binding on radio element -

i have set basic boolean binding on radio element. when user selects "true" radio element, should display div beneath further options. when view loads, i'd ensure elements "true" have div's beneath displayed. prior angular, 2 two things jquery: // pseudo-ish code $(element).on("click", function() { /* show/hide div */ }); $(element:checked).each(function() { /* show child div if val() == 'true' */} with angular, needed directive that. directive want do, broke data binding element, element no longer checked if model set true/false. how data binding work again "true" radio checked, , div shows? any suggestions on improving directive/code? angular newbie here, loving framework far! here's fiddle shows it: http://jsfiddle.net/nloding/slpbg/ here's code: html: <div ng-app="myapp" ng-controller="testcontroller"> <input type="radio" name="transfercontrol&

constructor - How to create strongly typed list class in vb.net -

i hate admit new object oriented programming in vb.net. have class object called subscriber.vb works ok i'd create "set" or list of these objects. please me leverage following code create list of subscribers "consumer" loop through list of subscribers? here have far: public class subscriber public sub new(byval thesubscriberid int32) dim sconndatabase string = configurationmanager.connectionstrings("databaseconnstring").connectionstring dim connection new sqlconnection(sconndatabase) dim cmd sqlcommand try cmd = new sqlcommand("getsubscriberinfo_v", connection) cmd.commandtype = commandtype.storedprocedure cmd.parameters.addwithvalue("@subscriberid", thesubscriberid) connection.open() dim objreader sqldatareader = cmd.executereader() while objreader.read() setobjectdata(objreader) loop objreader.close() connection.close() catch ex exception throw end try end sub priv

ios - UISearchbar Controller problems, displaying results? -

Image
so of right trying implement uisearchbarcontroller , have been successful in filtering , getting searching right, when search whats displayed in uitableviewcells incorrect. app test app , want able search through bunch of different cells. here's code , image how search looks now: here's .h: #import <uikit/uikit.h> @interface exerciseviewcontroller : uitableviewcontroller <uitableviewdelegate, uitableviewdatasource> @end and .m: #import "exerciseviewcontroller.h" #import "detailviewcontroller.h" #import "exercises.h" @interface exerciseviewcontroller () @end @implementation exerciseviewcontroller { nsarray *tabledata; nsarray *searchresults; } @synthesize tableview = _tableview; - (void)viewdidload { [super viewdidload]; //this data, want display exercise name. exercises *exercise1 = [exercises new]; exercise1.name = @"barbell rollouts"; exercise1.materials = @"30 min"; exercise1.imagefile = @&q

data structures - How are hashtables (maps) stored in memory? -

this question hashtables, might cover other data structures such linked lists or trees. for instance, if have struct follows: struct data { int value1; int value2; int value3; } and each integer 4-byte aligned , stored in memory sequentially, key , value of hash table stored sequentially well? if consider following: std::map<int, string> list; list[0] = "first"; is first element represented this? struct listnode { int key; string value; } and if key , value 4-byte aligned , stored sequentially, matter next pair stored? what node in linked list? just trying visualize conceptually, , see if same guidelines memory storage apply open-addressing hashing (the load under 1) vs. chained hashing (load doesn't matter). it's highly implementation-specific. , not referring compiler, cpu architecture , abi, implementation of hash table. hash tables use struct contains key , value next each other, have guessed. others have 1 arr

c# - Does HDInsight only work with ASV (blob storage)? -

i save data produced map reducer in hdinsight in format can easy report upon. ideally table structure (azure table storage). having done research, looks hdinsight service can work azure storage vault (asv) (both reading , writing). correct? i prefer implement hdinsight mapper/reducer in c#. i don't know hive or pig, , wonder if there functionality allow persist results of reducer in external (azure table) data storage other asv? currently default storage backing hdinsight asv. can store data on 'local' hdfs filesystem on hdinsight cluster. however, means keeping cluster running permanently, , limits storage on compute nodes. can expensive. one solution might sqoop results out sql server (or sql azure) depending on size , plan them. alternatively, working on connector between hive , azure tables , allows read azure tables hive (by way of external table) shortly getting write support well.

c# - Best way to bind an interface to the result of another binding -

let's have following interface , class: public interface imyservice { void dosomething(); } public class magicinterfaceimplementor<t> { public t getimplementation() { // not relevant. } } the way instance of imyservice through magicinterfaceimplementor<imyservice> . can setup injection pretty magicinterfaceimplementor<imyservice> : bind<magicinterfaceimplementor<imyservice>().toself(); [strictly, isn't necessary in particular instance, i'm doing bit more binding in actual case.] my question - how bind imyservice ? i think can this, i'm not sure it's best way, since i'm explicitly calling kernel, typically frowned upon: bind<imyservice>().tomethod(context => { return ((magicinterfaceimplementor<imyservice>) context.kernel.getservice(typeof(magicinterfaceimplementor<imyservice>))) .getimplementation(); }); any suggestions of more proper wa

javascript - Checking for any dirty Backbone model data within collection -

i have requirement "nag" user unsaved changes when switch between different backbone collection models (by clicking on table row). i've googled "check backbone model dirty data" (for instance) , not found definitive. i accomplished using underscore's "some" , isequal functionality , in manner such following, "some()" being sufficient determine if there any un-saved changes (as opposed precise changes might be), in particular because model attribute array of objects. var anydirty = _.some(mycollection.models, function(model) { return !_.isequal(model.get('nodes'), model.previousattributes()['nodes]); }); i new backbone , wondering if accepted sort of approach adhoc checking dirty model data. or, backbone provide sort of built in functionality purpose, initial attempts @ googling did not reveal? i have attribute need monitor in addition 'nodes', i'm switching using changedattributes(): http

json - Integrating tabletop.js with d3.js? -

Image
i want reference google spreadsheet using tabletop for data in d3 visualization. best solution can come this, know it's not quite right. window.onload = function() { init() }; var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_us&hl=en_us&key=0amyzu_s7qhsmddnzuzrlyldnwtzclxdrmxlyqzvxsfe&output=html'; function init() { tabletop.init( { key: public_spreadsheet_url, callback: showinfo, simplesheet: true } ) } d3.json("showinfo", function(data) { console.log(data); }); the data comes array (see output below); , there no need apply d3.json . can start using array d3 visualization right away. window.onload = function() { init() }; var public_spreadsheet_url = "https://docs.google.com/spreadsheet/pub?hl=en_us&hl=en_us&key=0amyzu_s7qhsmddnzuzrlyldnwtzclxdrmxlyqzvxsfe&output=html"; function init() { tabletop.init( { key: public_spreadsheet_url, c

c# - When to remove event handlers from an object? -

so registering event handlers in object's loaded event. tv.previewmousedown += new mousebuttoneventhandler(signalscrollviewer_previewmousedown); but had 2 questions. if loaded occurs twice , tries add event handler again there problems? how should handle unregistering event? automatically handle unregistering on destruction or need handle in event unloaded or something? yes cause subscription causes handler execute twice. can remove loaded handler inside loaded handler . msdn : loaded , unloaded might both raised on controls result of user-initiated system theme changes. theme change causes invalidation of control template , contained visual tree, in turn causes entire control unload , reload. therefore loaded cannot assumed occur when page first loaded through navigation page. if object gone cannot raise events, no need that. , handler not keep object alive (it's other way around).

Best way to share Java variables between classes -

i have odd problem in java. can solve solution seems inefficient. i have class, simplified is class zot { double edges[]; } the problem in many cases want instance , instance b share 1 of edge instances. in other words, instance may allocate edge[2] , want instance b share edge[2]. easy enough in can set instance b point @ instance's edge[2]. how can efficiently? if allocate edges[] in instance a, can assign b's instance point a. want allocate single edge (e.g. edge[2]) in , assign in b. in java, 1 cannot (as far know) allocate single member of array (as 1 can in c++). ideally, want allocate useful member , assign it. could, of course, allocate 4 members, assign ones need, set unwanted members null , let gc clean up, if there hundreds or thousands of instances seems clumsy. suggestions? you can declare , allocate double edges[] outside of both classes, pass array parameter in constructor both of instances want share it. in java arra

php - Adding Google Analytics Dashboard to Custom Post Type [WordPress] -

Image
i have theme in attempting add plugin google analytics dashboard's "sparkline" custom posts column. make bit more clear, need add this: to columns here and that's it! i'm not well-versed php enough know how done. analytics data appears out-of-the-box on standard post types , other custom ones, if helps. i ask developer assistance, seems have disappeared. in advance, , i'm hoping 1 of quick, stupid situations easy answer can shared greenhorn :) hello, if want program solution of team-it not easy. should use google analytics api php. not possible describe @ small peace of text,but, may be, following links helpful , developer: https://developers.google.com/analytics/devguides/reporting/core/v3/coredevguide http://code.google.com/p/google-api-php-client/downloads/list https://developers.google.com/analytics/solutions/reporting

jquery - On Mouseover show large Images without Distortion -

on mouseover show large images without distortion images come database using php question simple method there in jquery css javascript etc simplest thanks. this code images shows database <div> <table> <tr> <td> ?php $query = "select * images"; $result = mysql_query($query); while($fetch = mysql_fetch_array($result)) { echo "<img src=\"http://localhost/images_path/{$fetch['image']}\" width=\"15%\" height=\"135px\">"." &nbsp"; } ?> </td> </tr> </table> </div> you can simple css.. div.img img { height: 90px; width: 110px; } div.img img:hover { height: auto; width: auto; } another method maybe function mouseover() { var img1 = document.getelementbyid("img1"); img1.src ="images/p2.jpg"; img1.width = ""; img1.height = ""; } function mouseout() { var img1 = document.get

html - How to use a while loop for Flow Player in php? -

i have videos coming server. first video player works fine rest empty not sure why here have right now. while($row = mysql_fetch_assoc($query12)) { echo"<a href='$urls' style='display:block;width:520px;height:330px' id='player'> </a> <br/> <br/>"; } and flow player <script> flowplayer("player", { src:"flowplayer-3.2.16.swf", wmode: "opaque" // allows html hide flash content }, { clip: { autoplay: false } }); </script> you can replace id class , initialise players targeting class name. example php/html while($row = mysql_fetch_assoc($query12)) { echo"<a href='$urls' style='display:block;width:520px;height:330px' class='player'> </a> <br/> <br/>"; } js

c# - Limit namespace access on runtime compiled scripts -

i building sort of modding system aspect of game in unity. allows common user write c# code used give access elements of game @ times, giving host of multiplayer server ability decide map load parameters etc. for of don't know, unity uses mono's equivalent of .net 2.0, question less specific unity , rather more towards c# , .net. i have assembly loading working, i've come point nice if give " user " access assemblies such system , unityengine . of course include dll 's in referenceassemblies property of compilerparameters , give them access possibly harmful functionality, such reflection , instantiate , destroy many others. how limit assembly references namespaces, such system.io , system.collections , without giving access system.reflection ? now posting of possibly relevant code: //excuse unityscript... find quicker things in //it's c# javascript syntax ;) //create compiler parameters var params:compilerparameters = new compilerparam

solr - SolrCloud hash range set to null after recovery from index corruption -

i have solrcloud set 12 shards 2 replicas each, divided on 6 servers (each server hosting 4 cores). solr version 4.3.1. due memory errors on 1 machine, 3 of 4 indexes became corrupted. unloaded cores, repaired indexes lucene checkindex tool, , added cores again. afterwards solrcloud hash range has been set null shards corrupt indexes (so new records can't indexed shards). know how set range on shards again? i ended fixing uploading new clusterstate.json zookeeper, using zookeeper cli tool, correct hash ranges set (they deducible since sorted shard name).

bind different modelview and view to each TabItem via MVVM in WPF -

i'm using mvvm dynamically create tabs viewmodel. in code, attempt hold collection of "tabitem" specify how tab appears (custom template) & in addition modelview object, , based on modelview display on tabitem view #1 / or view #2. my current s/w architecture follows: my mainwindow.xaml: <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:viewmodel="clr-namespace:myapp.viewmodel" x:class="myapp.mainwindow" xmlns:views="clr-namespace:myapp.view" height="700" width="1000" background="#ff1b0000" resizemode="noresize"> <window.datacontext> <viewmodel:tabitemviewmodel/> </window.datacontext> <grid> <tabcontrol background="black" margin="0,25,0,0" borderthickness="0,0,0,0" itemssource="{binding tab