Posts

Showing posts from February, 2012

Dropbox for local development, Git for cloud -

i asking question because, while have found related topics, of focus on using dropbox remote, haven't found addresses question: is there hazardous using dropbox local repo way work seamlessly from/between multiple machines (eg. let's made fork, make changes on desktop, want continue work laptop without running $ git commands), having remote elsewhere? another way ask question might be: there way use of dropbox-connected machines 1 local development space ... idea of machines on dropbox 1 machine purposes of development... know isn't clear way ask question, don't know how can more clear. i want make sure there won't conflicts between how repository tracks changes, , way synced via dropbox - more particularly, wondering if make commit, or stage file(s) on machine (let's call these "operations"), , update dropbox-syncs machine b, operations reflected on machine b when dropbox-sync complete, git run automatically ensure operations ref...

How to export data from oracle table and import the same contents into table of an external database? -

i have tried sql> exp prime/prime@emp1 file=archive.dmp log=archive.log table=archive; should need add these in query, indexes=y trigger=y constraints=n grants=y commit=y what significance of these? is import command same export? it this? sql> imp prime/prime@emp2 file=archive.dmp log=archive.log table=archive; you have said issue/error is, guessing, judging "sql> " prompt in example, seems running sql*plus. the exp/imp , expdp/impdp utilities command line programs (dos/bash), not sub-commands within sqlplus. to run "within" sqlplus have "host out" follows: portable: sql> host imp .... unix/linux: sql> ! imp .... dos: sql> $ imp.exe .....

c# - How to make an array of "types.Add()" -

i not sure if title right, want make array of this: (microsoft.office.interop.excel._worksheet)newworkbook_first.sheets.add(); now thought had happen: private static microsoft.office.interop.excel.applicationclass appexcel; private static workbook newworkbook_first = null; private static _worksheet newsheets = null; newsheets = new (microsoft.office.interop.excel._worksheet)newworkbook_first.sheets.add()[]; but didn't solve problem. how make array of type? i think want array of _worksheet based on cast. newsheets = new microsoft.office.interop.excel._worksheet[]; note: see code newworkbook_first.sheets.add() method , can't create instance of method.

java - Execute Ruby Gem from Ruby Script -

i have installed gem rvpacker gem. command runs fine want set options. have method now def runpacker(dir, type) puts dir puts type begin rvpacker -v -f -d #{dir} -t ace -a #{type} rescue exception =>e puts "error!" puts e.message puts e.backtrace.inspect return 1 end return 0 end how write rvpacker line using parameters? it's script run java app using jruby. when call command jruby directly got org.jruby.embed.parsefailedexception: (syntaxerror) <script>:1: syntax error, unexpected tuminus rvpacker -v -f -d p:\temp-workspace\rpgtestproject1 -t ace -a unpack but when write in console directly it's fine. rvpacker -v -f -d #{dir} -t ace -a #{type} not ruby code , wanted execute ruby interpreter ;) ave me!

ios - Connecting Objects with two View controllers in Swift -

in project have 2 view controllers, , having trouble connecting objects such uiimageview view controller. when try create iboutlet, tells me "could not insert new outlet collection: not find information class named uiviewcontroller". believe problem stems fact original declaration of class follows: class uiviewcontroller: uiviewcontroller { when in fact view controller named mainscene instead. however, when change first uiviewcontroller think should (mainscene), doesn't show me option of connecting iboutlet... class mainscene: uiviewcontroller { so, have 2 questions. do need have whole separate class second uiviewcontroller , solve issues? is there better way link objects uiviewcontroller or doing horribly wrong (the scenario)? thanks much short answer: 1. yes, , yes. 2. there's no better way, , you're not doing horribly wrong. (you missed step.) you have 2 view controllers. assuming different, subclass each 1 uiviewcontr...

r - Insert a plot inside a paragraph -

i trying find method wrap text around plot in word file create using reporters package. in word, have option called 'with text wrapping'. wondering whether can create similar result nesting addplot function , addparagraph . has done before? please shed guidance. thank you i afraid reporters can't that. there new function ( pot_img in latest release of reporter s) let concatenate text , images in paragraph has no wrapping option. ~ david (author of package)

linux - Pthread_create causing segmentation fault (C++, Kubutnu 15) -

i in shock , confusion, honestly. after reading several dozen topics on "pthread_create causing segmentation fault" still have problem. did ordered, , result zero: @ stage of debug, program gives segmentation fault on line creation process. i not understand anything. grateful help. in advance. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <pthread.h> #include <interfacemanager.h> using namespace std; interfacemanager iface; void* watch_for_interfaces(void*) { iface.monitoring(); } int main() { sigset_t *set; sigemptyset(&(*set)); sigaddset(&(*set), sigint); sigaddset(&(*set), sigterm); pthread_t th1, th2; int i=1; if (pthread_create(&th2, null, watch_for_interfaces, (void*)&i) != 0) { perror("th2 error\n"); exit(1); } printf (...

php - $wpdb returns duplicate posts -

i have created shortcode shows posts created after user last logged in. shortcode working fine, not sure why getting 7 duplicate posts. test created post named "sample article", , when echo out title of post, result. sample article sample article sample article sample article sample article sample article sample article sample article shortcode function latest_posts_after_last_login( $atts ) { global $wpdb, $current_user; $atts = shortcode_atts( array( 'post_type' => ''), $atts, 'latest_posts_after_last_login' ); $post_type = $atts['post_type']; $last_login = get_user_meta( $current_user->id, '_last_login_for_posts', true ); $querystr = " select $wpdb->posts.* $wpdb->posts, $wpdb->postmeta $wpdb->posts.id = $wpdb->postmeta.post_id , $wpdb->posts.post_status = 'publish' , $wpdb->posts.post_type = '%s' , $...

Mongodb query to select less than and equal based on custom comparator -

i using mongodb database , need run less , equal filter based on custom comparator. following more details. "profile" collection having "level" field string {"name":"test1", "level":"intermediate"} following value of level , corresponding weight novice intermediate experienced advance i want write query below should return profile collection level less , equal "experienced" (i.e. includes result "novice", "intermediate" , "experienced" db.profile.find( { level: { $lte: "experienced" } } ) i understand, need provide custom comparator. how can do? you can't use custom comparators in mongodb query. ones available are: $eq , $gt , $gte , $lt , $lte , $ne , $in , $nin . you can, however, use $in want: db.profile.find( { level: { $in: [ "experienced", "intermediate ", "novice" ] } } );

Upserting map using mule mongodb connector -

i using mule's mongodb connector update document in items collection. element trying update in document map shown below -- "ratings": {"stars":4.5 , "votes":232}, however, connector updates subitem string -- "ratings": "{\"stars\":4.5 , \"votes\":232}", here flow doing update -- <flow name="update-subitem-in-db"> <logger message="updating in db item #[itemid] -- #[payload] )" level="info" doc:name="logger" /> <mongo:update-objects-by-function-using-map collection="items" config-ref="mongo_db" doc:name="update object" upsert="true" function="$set" multi="false"> <mongo:query-attributes> <mongo:query-attribute key="_id">#[itemid]</mongo:query-attribute> </mongo:query-attributes> <mo...

r - caret with SNOW not using parallel processor on a particular set of data -

i have 2 data frames ( here reproducibility) trainfin1 , trainfin2 , both sampled same bigger dataset. i'm trying run cross-validated rpart on them using caret on multiprocessor using dosnow package. interestingly, trainfin1 trained nicely across 4 processors (finishing in 25 seconds). trainfin2 seems stuck on 1 processor (observed in windows task manager window), , never see finish processing after half hour. my code below require(caret) require(rpart) load("trainfin.rdata") fitcontrol <- traincontrol(method = "repeatedcv", number = 5, repeats = 5) #setup parallel processing require(dosnow) cl <- makecluster(4, type = "sock") registerdosnow(cl) #train set.seed(12345) firstset <- train(x = trainfin1[, names(trainfin1) != "happiness"], y = trainfin1$happiness, method = "rpart2", trcontrol = fitcontrol) set.seed(12345) secondset <- train(x = trainfin2[, names(train...

File write operations through java on a mounted location keeps on failing on Yosemite -

my web project development , debugging setup requires mounting file location on centos vm running on development system , writing files mounted location. used work fine till few days when on maverick. upgraded yosemite(10.10.3) , file write operations on mounted location keeps on failing randomly. failure not consistent occurs high frequency , development setup rendered useless. same file operation times out once or twice may succeed on second or third try problem not mounted location gets unmounted because not mount location in later attempts , file write succeeds automatically on own. i keep on getting following stack trace( pasting few relevant calls top of call stack) caused by: java.io.ioexception: operation timed out @ java.io.fileoutputstream.writebytes(native method) @ java.io.fileoutputstream.write(fileoutputstream.java:345) @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1489) @ org.apache.commons.io.ioutils.copylarge(ioutils.java:1465) @ org.apache.commons.io....

file - What should be the extension for a python program script? -

i new programming , trying write basic programs in python. difficult type in terminal. so, want create text file can write codes or make changes, save , run directly in python. extension have save text file inorder recognize python script? you should use extension .py . example test.py .

java - android.support.v4.app.Fragment Google Map on API 10 -

this works on api 12 , above on 11 , below crash. this class: public class home extends fragment { supportmapfragment mmapview; googlemap googlemap; final long tiempo = 5 * 1000; double latitude,longitude; public view view; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { if (view != null) { viewgroup parent = (viewgroup) view.getparent(); if (parent != null) parent.removeview(view); } try { view = inflater.inflate(r.layout.fragment_home, container, false); } catch (inflateexception e) { } gpstracker gps = new gpstracker(getactivity()); if(gps.cangetlocation()){ latitude = gps.getlatitude(); longitude = gps.getlongitude(); mmapview = (supportmapfragment) getactivity().getsupportfragmentmanager().findfragmentbyid(r.id.mapa); ...

ios - Required Constructor for UIViewController in Swift -

i have created viewcontroller subclass uiviewcontroller. have properties defined nullable shown below: // cloudkit let container :ckcontainer? let publicdb :ckdatabase? now, initialize using init constructor method , xcode complains need override initwithcoder constructor in opinion feels kind of unnecessary. init() { container = ckcontainer.defaultcontainer() publicdb = container!.publicclouddatabase super.init(nibname: nil, bundle: nil) } required init(coder adecoder: nscoder) { container = ckcontainer.defaultcontainer() publicdb = container!.publicclouddatabase super.init(coder: adecoder) } i end lot of duplicate initialization code container , publicdb can see above. is there better way of doing same have done? you make method called setup or similar , shift these 2 lines container = ckcontainer.defaultcontainer() publicdb = container!.publicclouddatabase in method. then, in dif...

php - On Dropdown Selection, how to fill complete form fields from Database -

how fill complete form input fields database based on value selected dropdown example: in application, selecting client name fills complete form input fields details stored in database. sample code: <select name="client"> <option value="">-- select client name -- </option> <option value="1">john</option> <option value="2">smith</option> </select> <input name="phone" type="text" value=""> <input name="email" type="text" value=""> <input name="city" type="text" value=""> <textarea name="address"></textarea> all input fields need filled values on client name selection. edit: i tried ajax couldn't able particular variable file... below code: <script> $(document).ready(function() { $('#client')....

primitive - Can the range for double in Java be extended? -

the data type double covers range 4.94065645841246544e-324d 1.79769313486231570e+308d. if have deal numbers less 4.94065645841246544e-324d, there data type can use? is there data type can use? yes 1 . might use bigdecimal . linked javadoc says (in part) provides immutable, arbitrary-precision signed decimal numbers . 1 bigdecimal not primtive type (and range of primtive types mandated specification).

javascript - Using getComputedStyle with IE 11 -

Image
note: has update below. change description not getcomputedstyle issue, issue print-media , fact internet explorer supports document.stylesheets[].cssrules. i bit confused on thought worked , not sure broke. using getcomputedstyle thought support in modern browsers, not expected answer ie 11. given code: getrealstyle: function(elm, attributes) { var returnobj = {}; var computed = getcomputedstyle(elm); for(var i=0; i<attributes.length; i++) { returnobj[attributes[i]] = computed[attributes[i]]; } return returnobj; }, where "attributes" array of names interested in getting computed css for. this: attributes: [ 'lineheight', 'alignmentbaseline', 'backgroundimage', 'backgroundposition', 'backgroundrepeat', 'backgroundcolor', 'baselineshift', 'bordertopwidth','bordertopstyle','bordertopcolor', 'borderbo...

python - How to get complex64 output from numpy.fft? -

i have following code: ga=rfft2(a) a type float32 , ga comes out complex128 doubling data. how can out complex64 data? isn't default functionality fftw ? well, seems type defined quite deep in c code. fftpack_litemodule.c uses npy_cdouble array type , complex128 . solution see transform array complex64 using astype(np.complex64) or use scipy.fftpack package returns array of float64 encoding complex values as: [y(0),re(y(1)),im(y(1)),...,re(y(n/2))] if n [y(0),re(y(1)),im(y(1)),...,re(y(n/2)),im(y(n/2))] if n odd

javascript - How to verify that the timestamp send is in UTC in mongoose/Hapijs? -

i'm building application in node.js using hapi , database in mongodb using mongoose. have following message schema: var schema = { : { type : schema.objectid, ref : 'user' }, content : { type : string, required : true }, group : { type : schema.objectid, ref : 'group' }, created : { type : number, default : date.now() } }; i want created field in schema timestamp , in utc. client converts current timestamp utc timestamp , sends server. however, can't find possible way on server verify whether timestamp provided has been converted utc or not. there way impose validation in hapi/mongoose? thanks in advance. edit : changed type of created field number since want store timestamp , not date string. hapi allows have validate property on each route. under hood uses joi validate schema provided in property payload, parameters, query string , head...

linux - AWK convert minutes and seconds to only seconds -

i have file i'm trying convert seconds. looks this: 49.80 1:03.40 1:01.00 1:00.40 1:01.00 i've tried: awk -f: '{seconds=($1*60);seconds=seconds+$2;print seconds}' file which outputs: 2988 63.4 61 60.4 61 i've tried: sed 's/^/:/g' file | awk -f: '{seconds=($2*60);seconds=seconds+$3;print seconds}' which outputs same results. obtain these results: 49.80 63.4 61 60.4 61 just add check if records contains both seconds , minutes awk -f: 'nf==1; nf==2{seconds=($1*60);seconds=seconds+$2;print seconds}' nf number of fields in each record(row). nf==1 if contains 1 field, not gonna calculations. see there no {action} part associated check. hence awk performs default action print entire line nf==2 true if string contains 2 fields. takes associated action, performs calculations. test $ awk -f: 'nf==1; nf==2{seconds=($1*60);seconds=seconds+$2;print seconds}' file 49.80 63.4 61 60.4 61

ios - CoreSpotlight indexing not working -

i using corespotlight api index content. reason not able find data when search in spotlight. let atset:cssearchableitemattributeset = cssearchableitemattributeset() atset.title = "simple title" atset.contentdescription = "simple twitter search" let item = cssearchableitem(uniqueidentifier: "id1", domainidentifier: "com.shrikar.twitter.search", attributeset: atset) cssearchableindex.defaultsearchableindex().indexsearchableitems([item]) { (error) -> void in print("indexed") } when run app see data indexed , error nil. have added corespotlight , mobilecoreservices build phase. try use itemcontenttype initializer : let atset:cssearchableitemattributeset = cssearchableitemattributeset(itemcontenttype: kuttypeimage string) atset.title = "simple title" atset.contentdescription = "simple twitter search" let item = cssearchableitem(uniqueidentifier: "id1", domainidentifier: ...

java - Optimize mysql query that take long execution time about 4 minutes -

select nl.ndc, formulary_status bh.webdav_formulary_detail wfd inner join bh.payer_map pm on wfd.payer_map_id = pm.payer_map_id inner join bh.ndc_lookup nl on wfd.product_id = nl.uid pm.payer_id ='p00000000001001' , pm.formulary_id='01244' , nl.ndc in ('16590061572' , '35356078830' , '35356078860' , '35356078890' , '49999085690' , '54868381500' , '54868381501' , '54868381503' , '54868381504' , '54868381505' , '59011044010' , '59011044020' , '63629377401' , '63629377402' , '63629377403'); the below mysql tables myisam engine show create table webdav_formulary_detail; create table webdav_formulary_detail ( product_id mediumint(8) unsigned not null, formulary_status char(2) not null, file_iid smallint(5) unsigned not null default '0', payer_map_id smallint(5) ...

DB Installation Issue: Binary files folder (bin) is missing in downloaded zip for MongoDB (Windows 64-bit) -

i downloaded mongodb windows 64-bit http://www.mongodb.org/downloads . file name: mongodb-src-r3.0.3.zip however, zip folder doesn't have bin folder & no .exe files use installation (as given in installation steps). the below commands use windows 7 64-bit architecture. wmic os caption wmic os osarchitecture even tried using .msi (installation package) given in same downloads page. doesn't give error. still bin folder not created test mongodb (mongod.exe). am missing something?

How to create a query with query_string using Elasticsearch Java Api -

currently query request body looks { "query": { "query_string": { "default_field": "file", "query": "email or @gmail.com @yahoo.com" } }, "highlight": { "fields": { "file": { } } } } my java code looks string querystring = "{" + "\"query_string\": " + "{" + "\"default_field\":" + " \"file\"," + " \"query\": \"email or @gmail.com @yahoo.com\"" + "}" + "}"; with following api calls searchrequestbuilder searchrequestbuilder = client.preparesearch() .setindices("resume") .settypes("docs").setquery(querystring...

How to send an array with jquery to php script? -

i sending array php script using ajax call, not able access array in php. here code: seats = ["s4","s6","s9","s24"]; sendbookedseats(seats); function sendbookedseats(seats){ console.log(seats); $.ajax({ type: "post", url: "index.php", data: { 'seats' : seats, } }) } how access array seats in php script? send data json: seats= ["s4","s6","s9","s24"]; sendbookedseats(seats); function sendbookedseats(seats){ console.log(seats); $.ajax({ type: "post", url: "index.php", data: { 'seats' : json.stringify(seats), } }) } php: json_decode($_post["seats"]);

Microsoft Excel Finding Position Based on two column data? -

Image
fail count total number position 0 666 3 1 555 5 0 777 1 2 444 7 1 888 4 2 655 6 3 566 9 3 780 8 0 700 2 position column result need automatically function (any combination of builtin function or custom function). logic here minimum value of column (fail count) , maximum value of column (total number) first position. , minimum value of column (fail count) , second maximum value of column (total number) second position. continue till end data of column , b. how sorting data: order fail count ascending and, if equal fail count , total number descending? with formula becomes array formula bad performance. formula in d2 downwards: {=match(b2*10^(max($a$2:$a$1000)-a2),large($b$2:$b$1000*10^(max($a$2:$a$1000)-$a$2:$a$1000),row($a$2:$a$1000)-row($a$1)),0)} this array formula. input cell without curly brackets , press [ctrl]+[shift]+[enter] finish.

Storing local docker images on External HDD boot2docker -

i'm using docker on macbook air unfortunately has quite limited hard drive space (120gb). was wondering how store containers on external drive instead of default (which believe /var/lib/docker/) ? edit: in fact not /var/lib/docker - when using boot2docker believe files stored on virtualbox instance. after clearing macbook folder, mount external hard drive on path: mount -t <fstype> -o defaults /dev/<your device> /var/lib/docker/ for use boot2docker , try like: mount -t vboxsf -o uid=1000,gid=50 /dev/<your device> /var/lib/docker/ where <your device> example sdb .

javascript - Send data obtained from facebook with form -

i trying send data php page html page. data acquired javascript variable. scenario: trying create facebook login page. acquired data fb script , want send name php page. here sample of code: obtain name fb script: function testapi() { console.log('welcome! fetching information.... '); fb.api('/me', function(response) { var vv=response.name; console.log('successful login for: ' + response.name); document.getelementbyid('status').innerhtml = 'thanks logging in, ' + vv + '!'; }); variable vv contains value of name. i try send this form : <form method="post" action="sample.php" id="form1"> <input type="hidden" name="field1" value="<?php echo $vv; ?>" /> <input type="hidden" name="field2" value="bar" /> <a href="sample.php" onclick="document.getelementbyid('form1')....

ios - presentAudioRecordingControllerWithOutputURL not recognized in WatchKit project -

Image
i have existing project watchkit , new watchos release apple have implemented method called presentaudiorecordingcontrollerwithoutputurl record audio applewatch. when call method have 2 compilations errors. imagine have add or include more don't know have change in project. errors: /path/myproject watchkit extension/awmessagescontroller.m:278:56: 'wkaudiorecordingpresetwidebandspeech' unavailable: not available on ios /path/myproject watchkit extension/awmessagescontroller.m:277:11: 'presentaudiorecordingcontrollerwithoutputurl:preset:maximumduration:actiontitle:completion:' unavailable: not available on ios presentaudiorecordingcontrollerwithoutputurl cannot used in ios extension. have migrate code appropriately (e.g., copy files watch target). refer apple's documentation .

javascript - Changing color of specific ChartJS - AngularChartJS point -

i have line chart made angularjs - http://jtblin.github.io/angular-chart.js/#getting_started - chart.js. <canvas id="line" class="chart chart-line" data="data" labels="labels" legend="true" series="series" click="onclick" options="options"> </canvas> $scope.labels = labels_filtered; $scope.series = [word]; $scope.data = [_.values(response.graph_values)]; is possible set different color point in graph depending on conditions? (for example: points value > 10 set color red, else set color green) [edit] link small demo: http://plnkr.co/edit/s0w5wpznmu4bcxrjoppl?p=preview . set colors of dots 80,81 values red , other points color. thanks. you have manually set point color of chart: mylinechart.datasets[0].points[4].fillcolor = "rgba(000,111,111,55)" ; example: (function() { var app = angular.module("line_chart", ["chart.js"]...

angularjs - Building a Angular Login System with MySQL Database -

i have found many tutorials of angular authentications systems using external api etc. want have user login database of users, in php. how go doing this? controllers/services , directives in 1 file dont know how separate them of yet. what framework suggest website allow users post projects , such , other usergroups can hired projects? looking nice feel angular. suggestions? this have far: login.html: <div ng-controller="loginctrl"> <h3 style="text-align:center;">{{moduletitle}}</h3> <form class="form-signin" name="loginform" role="form"> <label for="inputemail" class="sr-only">email</label> <input type="text" id="inputemail" class="form-control" placeholder="email address" ng-model="data.email"> <label for="inputpassword" class="sr-only">password</label...

javascript - Does _.pluck preserves the original index of the "plucked" array? -

i have mongodb document array of objects field looking this: "leaving_users" : [ { "user_id" : "fz78pr82jpz66gc3p", "leaving_date" : isodate("2015-06-12t14:14:14.501z") } ] can use _.pluck obtain leaving_date related specific user_id ? my code seems work fine wanted check right way it, , sure won't end different index if use _.pluck function. here code: if (doc.leaving_users //guarding //if user belongs leaving_users object array && _.pluck(doc.leaving_users, "user_id").indexof(userid) != -1 //if leaving_date field after yesterday && doc.leaving_users[_.pluck(doc.leaving_users, "user_id").indexof(userid)].leaving_date > yesterday) { leftrecently = true; } else{ leftrecently = false; } bonus question: how make more elegant? ...

c++ - Syntax errors when right shift operator is used as a template parameter -

if take address of right shift operator , pass template parameter, right shift symbol being misread end of template parameter list, , resulting confusion causing multiple errors. template <class t, void(t::*)(int)> struct templatemagic {}; struct teststruct { void operator>> (int) {} }; int main() { //all errors on line: templatemagic<teststruct, &teststruct::operator>> >* ptr; } running in microsoft visual studio express 2013 windows desktop version 12.0.31101.00 update 4 gives following errors: error c2143 : syntax error : missing ';' before '>' error c2275 : 'teststruct' : illegal use of type expression error c2833 : 'operator >' not recognized operator or type as far can tell, operator>> > symbols being broken apart reads operator> , followed terminating > close template arguments, , ending spare > lulz. assume bug. is there way reword gets recognized valid? ...

assembly - Efficient three valued compare -

for unsigned integers getting result of if (a>b) => 1 if (a=b) => 0 if (a<b) => -1 can optimized branchless version return ((a > b) - (a < b)) this can written x86 assembly so: 4829d1 cmp rcx,rdx 0f94c1 setz cl 19c0 sbb eax,eax 83d8ff sbb eax,-$01 d3e8 shr eax,cl 13 bytes in total is there way without branches in less 5 instructions or in fewer bytes? a solution less bytes (11 bytes) , 1 less instruction (4 instructions) may faster: 483bca cmp rcx,rdx 1bc0 sbb eax,eax 483bd1 cmp rdx,rcx 83d000 adc eax,0 this can improved upon 10 bytes if have spare register known null. ... 11d8 adc eax,ebx

django rest framework - what URL I should give for generic filters? -

i'm using django rest framework , i'm trying use generic filters backend. view looks this: class agents(generics.listapiview): serializer_class = serializer.agentserializer model = serializer_class.meta.model filter_backends = (filters.djangofilterbackend,) queryset = models.agent.objects.all() filter_fields = ('available', 'online', 'agency') and added following url: url('^api/agents/$', api_views.agents.as_view()), now when enter urls these: api/agents/?online=false api/agents/?available=true it works , return correct list based on filters. however, when try this: api/agents/123/?online=false i'm getting page not found. reading this doc tells me when use generic filter works returning single object, , give following url example: http://example.com/api/products/4675/?category=clothing&max_price=10.00 but didn't understand if should create own url single object id? or suppose happen automat...

java - Index of column out of range : 2, number of column 1 -

i have tabel : klas_student create table if not exists klas_student( student varchar(7) references studenten (studentenummer) on delete cascade not null, klas text not null references klas (naam_id) on delete cascade not null ); in tabel want add values, way preparedstatement. preparedstatement studenttoklas = conn.preparestatement("insert klas_student " + "values (?)"); studenttoklas.setstring(1, studentnummer); studenttoklas.setstring(2, klasidtoinsert); however error keeps popping : org.postgresql.util.psqlexception: l'indice de la colonne est hors limite : 2, nombre de colonnes : 1. @ org.postgresql.core.v3.simpleparameterlist.bind(simpleparameterlist.java:56) @ org.postgresql.core.v3.simpleparameterlist.setstringparameter(simpleparameterlist.java:118) @ org.postgresql.jdbc2.abstractjdbc2statement.bindstring(abstractjdbc2statement.java:2304) @ org.postgresql.jdbc2.abstractjdbc2statement.setstring(abstractjdbc2s...

linux - search value and count number from log file -

i've value in logfile below , want catch same number , count them , put in file every 10 minutes. how can ? [14/06/2015 14:33:55.311] - warning- conflict detected between 2 sources !!! id1=67 id2=69 number=1193046 [14/06/2015 14:33:55.607] - warning- conflict detected between 2 sources !!! id1=70 id2=69 number=1193046 [14/06/2015 14:33:55.886] - warning- conflict detected between 2 sources !!! id1=69 id2=70 number=466000000 [14/06/2015 14:33:56.086] - warning- conflict detected between 2 sources !!! id1=64 id2=69 number=1193046 [14/06/2015 14:33:57.064] - warning- conflict detected between 2 sources !!! id1=70 id2=69 number=1193046 [14/06/2015 14:33:57.074] - warning- conflict detected between 2 sources !!! id1=64 id2=69 number=1193046 [14/06/2015 14:33:57.454] - warning- conflict detected between 2 sources !!! id1=68 id2=70 number=466000000 [14/06/2015 14:33:57.657] - warning- conflict detected between 2 sources !!! id1=68 id2=70 number=466000000 [14/06/2015 14:33:5...

c# - SignalGenerator class at naudio library - duration time play -

i use naudio generating tone in specified frequency that: private void gen_sinus(double frequency) { waveout _mywaveout = new waveout(); signalgenerator mysinus = new signalgenerator(44100, 1);//using naudio.wave.sampleproviders; mysinus.frequency = frequency; mysinus.type = signalgeneratortype.sin; _mywaveout.init(mysinus); _mywaveout.play(); } i want when clicking button play tone specific time passed method. let's call example: double toneduration i prefer prevent sleep methods because has accurate possible. you can use offsetsampleprovider this, , set take duration: var trimmed = new offsetsampleprovider(signalgenerator); trimmed.take = timespan.fromseconds(10); waveout.init(trimmed); waveout.play();

c# - get roles attribute of controller in OnActionExecuting in mvc -

i want read filter attributes of controller in onactionexecuting method. have written code empty array. public class basecontroller : controller { protected override void onactionexecuting(actionexecutingcontext filtercontext) { var getactionname = filtercontext.actiondescriptor.actionname; var getcontrollername = filtercontext.actiondescriptor.controllerdescriptor.controllername; var getusername = user.identity.name; var getuserroles = roles.getrolesforuser(getusername); foreach (var filter in filtercontext.actiondescriptor.getcustomattributes(typeof(roles), false)) { var desiredvalue = filter.tostring(); } //some business logic here } } this controller [authorize(roles = "admin")] public class admincontroller : basecontroller { public actionresult index() { return view(); } ...

javascript - Select option from dropdown and submit request using nodejs -

i working on nodejs scrapping website , new nodejs.the website initial page popup in 1 has select option selectbox , submit later pages can browsed.this has done first time , stored cookie later use. i able html page of popup not able select option selectbox , submit request. here code var express = require('express'); var request=require('request'); var cheerio=require('cheerio'); var j = request.jar(); //var cookie = request.cookie(); j.setcookie("city_id=1; path=/; domain=.bigbasket.com", 'http://bigbasket.com/', function(error, cookie) { //console.log("error"+error.message); console.log("cookie "+cookie); }); var app=express(); app.get('/', function(req, res){ console.log("hi"); var sessionval = req.session; request({uri:'http://bigbasket.com/', headers:{'user-agent': 'mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/4...

hadoop - Loading my own python modules for Pig UDFs on Amazon EMR -

i trying call 2 of own modules pig. here's module_one.py: import sys print sys.path def foo(): pass here's module_two.py: from module_one import foo def bar(): foo() i got both of them s3. here's when trying import them pig: 2015-06-14 12:12:10,578 [main] info org.apache.pig.main - apache pig version 0.12.0-amzn-2 (rexported) compiled may 05 2015, 19:03:23 2015-06-14 12:12:10,579 [main] info org.apache.pig.main - logging error messages to: /mnt/var/log/apps/pig.log 2015-06-14 12:12:10,620 [main] info org.apache.pig.impl.util.utils - default bootup file /home/hadoop/.pigbootup not found 2015-06-14 12:12:11,277 [main] info org.apache.hadoop.conf.configuration.deprecation - mapred.job.tracker deprecated. instead, use mapreduce.jobtracker.address 2015-06-14 12:12:11,279 [main] info org.apache.hadoop.conf.configuration.deprecation - fs.default.name deprecated. instead, use fs.defaultfs 2015-06-14 12:12:11,279 [main] info org.apache.pig.backen...

How to get the value? To get the date selected in calendar by php after submit the form -

here code calendar on 1 page. want show value of calendar on next page when user clicks on submit button , move on next page. <td> <div data-date-format="yyyy-mm-dd" data- date="document.write(date())" class="input-append date mydatepicker"> <input type="text" value="" name="doj" size="16" class="span2" required> <span class="add- on"><i class="icon-calendar"></i></span> </div> </td> let's store date in parameter called date. link place want go like: <a href=\"projectname/classname?myparam=" + date + "\" > in other class request param by: request.getparameter("myparam");

Facebook Reach Estimate - not suficient permissions -

i trying follow example on reach estimate in facebook api documentation here . getting error: { "error": { "message": "(#10) not have sufficient permissions perform action", "type": "oauthexception", "code": 10 } } my approach open https://developers.facebook.com/tools/explorer , generate token giving permissions including ads_management . and perform call: act_id/reachestimate?currency=eur&targeting_spec={'countries':['us']} where obtain ad account id going ads manager , reading off url (or visiting power editor). it looks simple, have no idea @ point missing, getting same error while using php api. all ideas appreciated. thank you. if using own app generate access token, on standard or basic tier of marketing api. these tiers, need specify each adaccount going use. in developer too, select app , go apps > settings > advanced. under "advertising acc...

asp.net mvc - How to create a dynamic dropdown in mvc -

how create dropdown option values coming controller. controller getting database table's column value. for example if dropdown selecting country, , have 3 country in database table's country column, in dropdown should show 3 country. , if add 1 more value in country table, should come in dropdown. i new mvc found bit difficult. using mvc5. nb: since 1 model refered inside view, cant add model dropdown i have done same in own website. how it: firstly, create action controller returns json value: public actionresult getcountrynames() { list<string> countrynames = new list<string>(); countrynames = context.getcountries(); // ef context countrynames database return json(countrynames.toarray()); } then in view add html mark up: <select id="countrylist" onchange="dosomething();"></select> this dropdownlist. has javascript function declared in "onchange" event, if want wh...

javascript - What is difference between fillRect(0,0,0,1) and clearRect() -

Image
is there difference between: ctx.fillstyle = "rgba(0, 0, 0, 1)"; ctx.fillrect(0, 0, 100, 100) and ctx.clearrect(0, 0, 100, 100) any kind of difference in performance or resulting image or canvas data? (updated correspond ops changes in question:) fillrect() ctx.fillstyle = "rgba(0, 0, 0, 1)"; fill region opaque pixels, in case black (note alpha normalized value [0,1]). clearrect() opposite, " clearing " pixels bitmap becomes transparent (technically region filled black transparent pixels). clearrect() optimized while fillrect() bound compositing/blending rules (porter-duff) former faster. means clearrect free fill region directly based on current transformation, while fillrect has go through compositing/blending formula whatever set (globalcompositeoperation) in addition. that of course in theory - depend on browser implementation. here simple performance test showing in chrome filling faster clearing (i not sure goes on ...

system.reflection - understanding Invocation Target Exception wrapping in Java -

m method , want invoke on specific instance through reflection. following code show how did invokation: try { m.invoke(classinstance); } catch (oopassertionerror e) { } catch (exception e) { system.out(e.getcause().getclass().getname()); } now instance suppose throw following class when invoke specific method tried invoke earlier, m in previous code: public class oopassertionerror extends assertionerror { } i thought program catch oopassertionerror catch exception instead . , prints following line : "package.oopassertionerror". why happening ? invocationtargetexception wraps method's exceptions, written in javadoc. see what cause java.lang.reflect.invocationtargetexception? more details. good luck in reflections! ;)

c++ - CFormView cleanup when switching Views -

where best place cleanup gdi objects in cformview? i have tried in cformview::ondestroy not called when switching views. void cmyview::ondestroy() { cformview::ondestroy(); if (m_brush.m_hobject!=null) verify(m_brush.deleteobject()); } the problem have many gdi objects created in oninitialupdate created everytime user activates view. need better method of cleaning gdi objects when user switches views.

responsive design - css: get white space at bottom and right of main background image on website if resolution falls below 1024 x 786 -

i working on new website work , new css. have created following site: http://hewdenportal.co.uk/ the problem is, when user resizes window below 1024 x 768 blank white space @ bottom , right of main background image, don't want there because background should set scale 100% width , height. can please show me going wrong? my css background image: header .layer { width: 100%; height: 100%; background: rgba(24, 24, 24, 0.8); } change <header style="background-image: url('assets/images/header.png'); <header id="background"> and add following properties: #background { width: 100%; height: 100%; background-image: url('http://www.hewdenportal.co.uk/assets/images/header.png'); background-size: cover; position: fixed; }

powershell - Add a script for a specific choice -

i want add (small) script main script has choices. how can ? the script want add: *$shell = new-object -comobject wscript.shell $desktop = [system.environment]::getfolderpath('desktop') $shortcut = $shell.createshortcut("$desktop\jauns notepad.lnk") $shortcut.targetpath = "notepad.exe" $shortcut.iconlocation = "%windir%\system32\imageres.dll 98" $shortcut.save()* and main script: do { { write-host "" write-host "1 - selection 1" write-host "2 - selection 2" write-host "" write-host "0 - exit" write-host "" write-host -nonewline "type choice , press enter: " $choice = read-host write-host "" $ok = $choice -match '^[abcdx]+$' if ( -not $ok) { write-host "invalid selection" } } until ( $ok ) switch -regex ( $choice ) { "1"...

javascript - Spline chart drawn on the xaxis in case of single value or constant values - highchart -

Image
while using older version of highchart - 2.1.6, if plot had 1 value or series of same values, plot @ middle of screen below. but, ever since have upgraded version of highchart 4.1.5, line sticks bottom, on xaxis. this. i looking option set normal but, didn't find yet. me out please. i have tried pointpadding on series , maxpadding on yaxis, no use. here fiddle replicated - http://jsfiddle.net/ka4p4sym/2/ var chart = $('#container').highcharts(); i set yaxis.minrange option, demo . won't place line in middle, make space on top , bottom.

ios - Passing data to another ViewController in Swift -

Image
before begin, let me have taken @ popular post on matter: passing data between view controllers my project on github https://github.com/model3volution/tipme i inside of uinavigationcontroller, using push segue. i have verified ibaction methods linked , segue.identifier corresponds segue's identifier in storyboard. if take out prepareforsegue: method segue occurs, without data updating. my specific error message is: could not cast value of type 'tipme.facesviewcontroller' (0x10de38) 'uinavigationcontroller' (0x1892e1c). override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { // new view controller using segue.destinationviewcontroller. if segue.identifier == "tofacesvc" { let navcontroller:uinavigationcontroller = segue.destinationviewcontroller as! uinavigationcontroller let facesvc = navcontroller.topviewcontroller as! facesviewcontroller facesvc.balancelabel.text = "balance before ...

javascript - Jquery refresh new opened window -

i want refresh new opened window, have link , when click on open new window , want refresh , edit new window url after 3 seconds. $('.link').on('click', function(e) { e.preventdefault(); window.open('/page/?q=param', '_blank'); settimeout(function(){ window.location.href = window.location.href.replace( /[\?#].*|$/, "/?q=new_value" ); }, 3000); }); this code refreshing original page not new one. want way refresh new one. store new window reference , access location attribute. var newwindow = window.open('/page/?q=param', '_blank'); you can $('.link').on('click', function(e) { e.preventdefault(); var newwindow = window.open('/page/?q=param', '_blank'); settimeout(function() { newwindow.location.href = newwindow.location.href.replace(/[\?#].*|$/, "/?q=new_value"); }, 0); });

javascript - angularjs custom twitter bootstrap modal directive -

i trying create custom twitter bootstrap modal popup using angularjs directives. problem how can control popup controller <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">hello modal</h4> </div> <div class="modal-body"> <p>modal popup</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> and controller directive is var modal = angular.module('directivemodal', ['ngroute','nganimate']); modal.directive('loginmodal', function() { return { restrict: 'ea', templateurl: ...

Build Neo4J Graph from Json in Spring -

i'm wondering best way create graph in neo4j json using spring. imagine have simple nodeentity person: @nodeentity public class person { private set<person> friends; } i want build graph of friendships between persons json object like: { persons: [ {name:"fritz", friend:["hans"]}, {name:"hans", friends:["fritz", "georg"]}, {name:"georg", friends:["hans"]} ] } can use spring data rest apis de-serialize json directly node entities , relations? good question, in past tried write sd-rest single entities, not entities relationships. i write own rest-controller , transform json correct objects. you use cypher directly , pass json root parameter json cypher. unwind {json}.persons person // merge = get-or-create merge (p:person {name:person.name}) unwind person.friends friend // because friend can come earlier friend person merge (f:person {name:friend.name}) // merge o...

ios - Can't retrieve non jpg/png files from the Asset Catalog in Xcode 7 -

i want retrieve non jpg/png files asset catalog in xcode 7. saw possible add kind of data asset catalog. so way doing working before moving gif/video xcode project assets catalog private struct walkthroughvideo { static let name = "tokyo" static let type = "mp4" } private var movieplayer : avplayerviewcontroller? = { guard let path = nsbundle.mainbundle().pathforresource(walkthroughvideo.name, oftype: walkthroughvideo.type) else { return nil } let url = nsurl.fileurlwithpath(path) let playerviewcontroller = avplayerviewcontroller() playerviewcontroller.player = avplayer(url: url) return playerviewcontroller }() so path nil. can't find file. there new way retrieve dataset ? obviously pathforresource not going work, because resource not in app bundle more - it's in asset catalog. in effect, no longer has "path". you have use new nsdataasset class, can fetch arbitrary data name out of a...